Skip to content

Commit 20b50ad

Browse files
committed
Various tweaks and fixes.
1 parent d6095c4 commit 20b50ad

File tree

8 files changed

+433
-31
lines changed

8 files changed

+433
-31
lines changed

SCXcodeMinimap.xcodeproj/project.pbxproj

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
184C11861A740F97002A7C65 /* SCXcodeMinimapSelectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 184C11821A740F97002A7C65 /* SCXcodeMinimapSelectionView.m */; };
1111
184C11871A740F97002A7C65 /* SCXcodeMinimapView.m in Sources */ = {isa = PBXBuildFile; fileRef = 184C11841A740F97002A7C65 /* SCXcodeMinimapView.m */; };
1212
184C118F1A741136002A7C65 /* DVTFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 184C118E1A741136002A7C65 /* DVTFoundation.framework */; };
13+
1876135F1A77A74300974BE1 /* IDEKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1876135E1A77A74300974BE1 /* IDEKit.framework */; };
1314
1883080A1A7411830005DF40 /* DVTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 188308091A7411830005DF40 /* DVTKit.framework */; };
1415
1883080C1A7411930005DF40 /* IDESourceEditor.ideplugin in Resources */ = {isa = PBXBuildFile; fileRef = 1883080B1A7411930005DF40 /* IDESourceEditor.ideplugin */; };
1516
188308101A7411A70005DF40 /* IDESourceEditor in Frameworks */ = {isa = PBXBuildFile; fileRef = 1883080F1A7411A70005DF40 /* IDESourceEditor */; };
@@ -19,7 +20,8 @@
1920
/* End PBXBuildFile section */
2021

2122
/* Begin PBXFileReference section */
22-
184C11711A740F8A002A7C65 /* DVTCompletingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTCompletingTextView.h; sourceTree = "<group>"; };
23+
1812C3911A77A7CF00E2CFB3 /* IDESourceCodeDocument.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = IDESourceCodeDocument.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
24+
184C11711A740F8A002A7C65 /* DVTCompletingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = DVTCompletingTextView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
2325
184C11721A740F8A002A7C65 /* DVTFontAndColorTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTFontAndColorTheme.h; sourceTree = "<group>"; };
2426
184C11731A740F8A002A7C65 /* DVTInvalidation-Protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DVTInvalidation-Protocol.h"; sourceTree = "<group>"; };
2527
184C11741A740F8A002A7C65 /* DVTPointerArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTPointerArray.h; sourceTree = "<group>"; };
@@ -28,18 +30,20 @@
2830
184C11771A740F8A002A7C65 /* DVTSourceModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTSourceModel.h; sourceTree = "<group>"; };
2931
184C11781A740F8A002A7C65 /* DVTSourceModelItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTSourceModelItem.h; sourceTree = "<group>"; };
3032
184C11791A740F8A002A7C65 /* DVTSourceNodeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTSourceNodeTypes.h; sourceTree = "<group>"; };
31-
184C117A1A740F8A002A7C65 /* DVTSourceTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTSourceTextView.h; sourceTree = "<group>"; };
32-
184C117B1A740F8A002A7C65 /* DVTTextStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTTextStorage.h; sourceTree = "<group>"; };
33+
184C117A1A740F8A002A7C65 /* DVTSourceTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = DVTSourceTextView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
34+
184C117B1A740F8A002A7C65 /* DVTTextStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = DVTTextStorage.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
3335
184C117C1A740F8A002A7C65 /* DVTViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTViewController.h; sourceTree = "<group>"; };
3436
184C117D1A740F8A002A7C65 /* IDEEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEEditor.h; sourceTree = "<group>"; };
35-
184C117E1A740F8A002A7C65 /* IDESourceCodeEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDESourceCodeEditor.h; sourceTree = "<group>"; };
36-
184C117F1A740F8A002A7C65 /* IDESourceCodeEditorContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDESourceCodeEditorContainerView.h; sourceTree = "<group>"; };
37-
184C11801A740F8A002A7C65 /* IDEViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEViewController.h; sourceTree = "<group>"; };
37+
184C117E1A740F8A002A7C65 /* IDESourceCodeEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = IDESourceCodeEditor.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
38+
184C117F1A740F8A002A7C65 /* IDESourceCodeEditorContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = IDESourceCodeEditorContainerView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
39+
184C11801A740F8A002A7C65 /* IDEViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = IDEViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
3840
184C11811A740F97002A7C65 /* SCXcodeMinimapSelectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCXcodeMinimapSelectionView.h; sourceTree = "<group>"; };
3941
184C11821A740F97002A7C65 /* SCXcodeMinimapSelectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCXcodeMinimapSelectionView.m; sourceTree = "<group>"; };
4042
184C11831A740F97002A7C65 /* SCXcodeMinimapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCXcodeMinimapView.h; sourceTree = "<group>"; };
41-
184C11841A740F97002A7C65 /* SCXcodeMinimapView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCXcodeMinimapView.m; sourceTree = "<group>"; };
43+
184C11841A740F97002A7C65 /* SCXcodeMinimapView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = SCXcodeMinimapView.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
4244
184C118E1A741136002A7C65 /* DVTFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DVTFoundation.framework; path = ../../../../../Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework; sourceTree = "<group>"; };
45+
1876135D1A77A69F00974BE1 /* IDEEditorDocument.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = IDEEditorDocument.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
46+
1876135E1A77A74300974BE1 /* IDEKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IDEKit.framework; path = ../../../../../Applications/Xcode.app/Contents/Frameworks/IDEKit.framework; sourceTree = "<group>"; };
4347
188308091A7411830005DF40 /* DVTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DVTKit.framework; path = ../../../../../Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework; sourceTree = "<group>"; };
4448
1883080B1A7411930005DF40 /* IDESourceEditor.ideplugin */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = IDESourceEditor.ideplugin; path = ../../../../../Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.ideplugin; sourceTree = "<group>"; };
4549
1883080F1A7411A70005DF40 /* IDESourceEditor */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = IDESourceEditor; path = ../../../../../Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.ideplugin/Contents/MacOS/IDESourceEditor; sourceTree = "<group>"; };
@@ -52,6 +56,7 @@
5256
18FE09C11707639E00118FEB /* SCXcodeMinimap-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SCXcodeMinimap-Prefix.pch"; sourceTree = "<group>"; };
5357
18FE09C7170764E400118FEB /* SCXcodeMinimap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCXcodeMinimap.h; sourceTree = "<group>"; };
5458
18FE09C8170764E400118FEB /* SCXcodeMinimap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCXcodeMinimap.m; sourceTree = "<group>"; };
59+
18FEFA8C1A782D8600DC98C5 /* IDEFileTextSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IDEFileTextSettings.h; sourceTree = "<group>"; };
5560
8742532217307161001C947C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
5661
/* End PBXFileReference section */
5762

@@ -64,6 +69,7 @@
6469
184C118F1A741136002A7C65 /* DVTFoundation.framework in Frameworks */,
6570
8742532317307161001C947C /* QuartzCore.framework in Frameworks */,
6671
1883080A1A7411830005DF40 /* DVTKit.framework in Frameworks */,
72+
1876135F1A77A74300974BE1 /* IDEKit.framework in Frameworks */,
6773
18FE09B61707639E00118FEB /* Cocoa.framework in Frameworks */,
6874
);
6975
runOnlyForDeploymentPostprocessing = 0;
@@ -90,6 +96,9 @@
9096
184C117E1A740F8A002A7C65 /* IDESourceCodeEditor.h */,
9197
184C117F1A740F8A002A7C65 /* IDESourceCodeEditorContainerView.h */,
9298
184C11801A740F8A002A7C65 /* IDEViewController.h */,
99+
1876135D1A77A69F00974BE1 /* IDEEditorDocument.h */,
100+
1812C3911A77A7CF00E2CFB3 /* IDESourceCodeDocument.h */,
101+
18FEFA8C1A782D8600DC98C5 /* IDEFileTextSettings.h */,
93102
);
94103
path = "Xcode Headers";
95104
sourceTree = "<group>";
@@ -117,6 +126,7 @@
117126
18FE09B51707639E00118FEB /* Cocoa.framework */,
118127
184C118E1A741136002A7C65 /* DVTFoundation.framework */,
119128
188308091A7411830005DF40 /* DVTKit.framework */,
129+
1876135E1A77A74300974BE1 /* IDEKit.framework */,
120130
1883080F1A7411A70005DF40 /* IDESourceEditor */,
121131
1883080B1A7411930005DF40 /* IDESourceEditor.ideplugin */,
122132
18FE09B71707639E00118FEB /* Other Frameworks */,
@@ -296,6 +306,7 @@
296306
"$(inherited)",
297307
"$(PROJECT_DIR)",
298308
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/SharedFrameworks",
309+
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Frameworks",
299310
);
300311
GCC_ENABLE_OBJC_GC = "";
301312
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -322,6 +333,7 @@
322333
"$(inherited)",
323334
"$(PROJECT_DIR)",
324335
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/SharedFrameworks",
336+
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Frameworks",
325337
);
326338
GCC_ENABLE_OBJC_GC = "";
327339
GCC_PRECOMPILE_PREFIX_HEADER = YES;

SCXcodeMinimap/SCXcodeMinimap.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ - (void)onDidFinishSetup:(NSNotification*)sender
126126
CGFloat width = editor.textView.bounds.size.width * kDefaultZoomLevel;
127127
NSRect miniMapScrollViewFrame = NSMakeRect(editor.containerView.bounds.size.width - width, 0, width, editor.scrollView.bounds.size.height);
128128

129-
SCXcodeMinimapView *miniMapView = [[SCXcodeMinimapView alloc] initWithFrame:miniMapScrollViewFrame editorScrollView:editor.scrollView editorTextView:editor.textView];
129+
SCXcodeMinimapView *miniMapView = [[SCXcodeMinimapView alloc] initWithFrame:miniMapScrollViewFrame editor:editor];
130130
[editor.containerView addSubview:miniMapView];
131131

132132
objc_setAssociatedObject(editor.scrollView, &kAssociatedObjectMinimapViewKey, miniMapView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

SCXcodeMinimap/SCXcodeMinimapView.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88

99
#import <Cocoa/Cocoa.h>
1010

11-
@class DVTSourceTextView;
12-
@class SCSelectionView;
11+
@class IDESourceCodeEditor;
1312

1413
@interface SCXcodeMinimapView : NSView
1514

16-
- (instancetype)initWithFrame:(NSRect)frameRect
17-
editorScrollView:(NSScrollView *)editorScrollView
18-
editorTextView:(DVTSourceTextView *)editorTextView;
15+
- (instancetype)initWithFrame:(NSRect)frame editor:(IDESourceCodeEditor *)editor;
1916

2017
- (void)updateOffset;
2118

SCXcodeMinimap/SCXcodeMinimapView.m

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import "SCXcodeMinimap.h"
1111
#import "SCXcodeMinimapSelectionView.h"
1212

13+
#import "IDESourceCodeEditor.h"
1314
#import "DVTTextStorage.h"
1415
#import "DVTPointerArray.h"
1516
#import "DVTSourceTextView.h"
@@ -44,29 +45,30 @@ - (void)dealloc
4445
[[NSNotificationCenter defaultCenter] removeObserver:self];
4546
}
4647

47-
- (id)initWithFrame:(NSRect)frame editorScrollView:(NSScrollView *)editorScrollView editorTextView:(DVTSourceTextView *)editorTextView
48+
- (instancetype)initWithFrame:(NSRect)frame editor:(IDESourceCodeEditor *)editor
4849
{
4950
if (self = [super initWithFrame:frame])
5051
{
52+
self.editorScrollView = editor.scrollView;
53+
self.editorTextView = editor.textView;
54+
5155
[self setWantsLayer:YES];
5256
[self setAutoresizingMask:NSViewMinXMargin | NSViewHeightSizable];
5357

54-
self.editorScrollView = editorScrollView;
55-
self.editorTextView = editorTextView;
56-
5758
self.scrollView = [[NSScrollView alloc] initWithFrame:self.bounds];
5859
[self.scrollView setAutoresizingMask:NSViewMinXMargin | NSViewHeightSizable];
60+
[self.scrollView setDrawsBackground:NO];
5961

6062
[self.scrollView setHorizontalScrollElasticity:NSScrollElasticityNone];
6163
[self.scrollView setVerticalScrollElasticity:NSScrollElasticityNone];
6264
[self addSubview:self.scrollView];
6365

6466
self.textView = [[DVTSourceTextView alloc] initWithFrame:self.editorTextView.bounds];
67+
[self.textView setTextStorage:editor.textView.textStorage];
6568
[self.textView setEditable:NO];
6669
[self.textView setSelectable:NO];
67-
[self.textView setTextStorage:editorTextView.textStorage];
68-
[self.scrollView setDocumentView:self.textView];
6970

71+
[self.scrollView setDocumentView:self.textView];
7072

7173
self.selectionView = [[SCXcodeMinimapSelectionView alloc] init];
7274
[self.textView addSubview:_selectionView];
@@ -163,16 +165,12 @@ - (void)updateOffset
163165
NSRect selectionViewFrame = NSMakeRect(0, 0, self.bounds.size.width * (1 / self.scrollView.magnification), self.editorScrollView.visibleRect.size.height);
164166

165167
if(editorContentHeight == 0.0f) {
168+
NSLog(@"editorContentHeight IS %f", editorContentHeight);
166169
[self.selectionView setFrame:selectionViewFrame];
167170
return;
168171
}
169172

170-
CGFloat ratio = (MAX(CGRectGetHeight(self.scrollView.bounds) , (CGRectGetHeight([self.scrollView.documentView frame]) - CGRectGetHeight(self.scrollView.bounds))) * (1 / self.scrollView.magnification)) / editorContentHeight * (1 / self.scrollView.magnification);
171-
172-
if(ratio == 0.0f) {
173-
[self.selectionView setFrame:selectionViewFrame];
174-
return;
175-
}
173+
CGFloat ratio = (CGRectGetHeight([self.scrollView.documentView frame]) - CGRectGetHeight(self.scrollView.bounds) * (1 / self.scrollView.magnification)) / editorContentHeight * (1 / self.scrollView.magnification);
176174

177175
CGPoint offset = NSMakePoint(0, MAX(0, floorf(self.editorScrollView.contentView.bounds.origin.y * ratio * self.scrollView.magnification)));
178176
[self.scrollView.documentView scrollPoint:offset];

SCXcodeMinimap/Xcode Headers/DVTTextStorage.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@
1212
@property DVTSourceModel* sourceModel;
1313
@property(readonly) id sourceModelService; // DVTSourceTextStorage
1414

15-
@property(readonly) unsigned long long currentChangeIndex;
16-
1715
-(NSColor*)colorAtCharacterIndex:(unsigned long long)charIndex effectiveRange:(NSRangePointer)range context:(id)context;
18-
-(void)fixSyntaxColoringInRange:(NSRange)range;
16+
1917
-(short)nodeTypeAtCharacterIndex:(unsigned long long)charIndex effectiveRange:(NSRangePointer)range context:(id)context;
20-
// FIXME: Workaround for NSObject+YOLO buggyness
21-
-(NSColor*)yl_colorAtCharacterIndex:(unsigned long long)charIndex effectiveRange:(NSRangePointer)range context:(id)context;
22-
- (id<DVTSourceLanguageSourceModelService>)sourceModelItemAtCharacterIndex:(unsigned long long)arg1; //DVTSourceTextStorage in Xcode 5, DVTSourceLanguageSourceModelService protocol in Xcode 5.1
2318

2419
@end

0 commit comments

Comments
 (0)