Skip to content

Commit bb45db5

Browse files
committed
Added a SCInvertedSelectionView
The idea was to get better visibility with a theme like sunset, but this is mostly useless until I also invert the rest of the minimap colors.
1 parent 28029b1 commit bb45db5

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

SCXcodeMinimap.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
00DE23BB172E7DDE00DCC8A8 /* SCInvertedSelectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00DE23BA172E7DD900DCC8A8 /* SCInvertedSelectionView.m */; };
1011
18D2B13117244C0A0026D09F /* SCSelectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D2B13017244C0A0026D09F /* SCSelectionView.m */; };
1112
18FE09B61707639E00118FEB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18FE09B51707639E00118FEB /* Cocoa.framework */; };
1213
18FE09C9170764E400118FEB /* SCXcodeMinimap.m in Sources */ = {isa = PBXBuildFile; fileRef = 18FE09C8170764E400118FEB /* SCXcodeMinimap.m */; };
1314
/* End PBXBuildFile section */
1415

1516
/* Begin PBXFileReference section */
17+
00DE23B9172E7DD900DCC8A8 /* SCInvertedSelectionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCInvertedSelectionView.h; sourceTree = "<group>"; };
18+
00DE23BA172E7DD900DCC8A8 /* SCInvertedSelectionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SCInvertedSelectionView.m; sourceTree = "<group>"; };
1619
18D2B12F17244C0A0026D09F /* SCSelectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCSelectionView.h; sourceTree = "<group>"; };
1720
18D2B13017244C0A0026D09F /* SCSelectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCSelectionView.m; sourceTree = "<group>"; };
1821
18FE09B21707639E00118FEB /* SCXcodeMinimap.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCXcodeMinimap.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -81,6 +84,8 @@
8184
18FE09C8170764E400118FEB /* SCXcodeMinimap.m */,
8285
18D2B12F17244C0A0026D09F /* SCSelectionView.h */,
8386
18D2B13017244C0A0026D09F /* SCSelectionView.m */,
87+
00DE23B9172E7DD900DCC8A8 /* SCInvertedSelectionView.h */,
88+
00DE23BA172E7DD900DCC8A8 /* SCInvertedSelectionView.m */,
8489
18FE09BC1707639E00118FEB /* Supporting Files */,
8590
);
8691
path = SCXcodeMinimap;
@@ -158,6 +163,7 @@
158163
files = (
159164
18FE09C9170764E400118FEB /* SCXcodeMinimap.m in Sources */,
160165
18D2B13117244C0A0026D09F /* SCSelectionView.m in Sources */,
166+
00DE23BB172E7DDE00DCC8A8 /* SCInvertedSelectionView.m in Sources */,
161167
);
162168
runOnlyForDeploymentPostprocessing = 0;
163169
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// SCSelectionView.h
3+
// SCXcodeMinimap
4+
//
5+
// Created by Stefan Ceriu on 4/21/13.
6+
// Copyright (c) 2013 Stefan Ceriu. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
11+
@interface SCInvertedSelectionView : NSView
12+
13+
@property (nonatomic, strong) NSColor *selectionColor;
14+
15+
@end
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// SCSelectionView.m
3+
// SCXcodeMinimap
4+
//
5+
// Created by Stefan Ceriu on 4/21/13.
6+
// Copyright (c) 2013 Stefan Ceriu. All rights reserved.
7+
//
8+
9+
#import "SCInvertedSelectionView.h"
10+
11+
@implementation SCInvertedSelectionView
12+
13+
- (id)initWithFrame:(NSRect)frame
14+
{
15+
self = [super initWithFrame:frame];
16+
if (self) {
17+
18+
NSObject *DVTFontAndColorTheme = [NSClassFromString(@"DVTFontAndColorTheme") performSelector:@selector(currentTheme)];
19+
NSColor *backgroundColor = [DVTFontAndColorTheme performSelector:@selector(sourceTextBackgroundColor)];
20+
21+
// sets the selectionColor to the inverse of the currently selected theme's backgroundColor
22+
[self setSelectionColor:[NSColor colorWithCalibratedRed:(1.0f - [backgroundColor redComponent]) green:(1.0f - [backgroundColor greenComponent]) blue:(1.0f - [backgroundColor blueComponent]) alpha:0.3]];
23+
24+
}
25+
return self;
26+
}
27+
28+
- (void)drawRect:(NSRect)dirtyRect
29+
{
30+
[[self selectionColor] setFill];
31+
NSRectFill(dirtyRect);
32+
}
33+
34+
35+
@end

0 commit comments

Comments
 (0)