|
32 | 32 | NSString *const SCXcodeMinimapHighlightSelectedSymbolChangeNotification = @"SCXcodeMinimapHighlightSelectedSymbolChangeNotification"; |
33 | 33 | NSString *const SCXcodeMinimapShouldHighlightSelectedSymbolKey = @"SCXcodeMinimapShouldHighlightSelectedSymbolKey"; |
34 | 34 |
|
| 35 | +NSString *const SCXcodeMinimapHighlightSearchResultsChangeNotification = @"SCXcodeMinimapHighlightSearchResultsChangeNotification"; |
| 36 | +NSString *const SCXcodeMinimapShouldHighlightSearchResultsKey = @"SCXcodeMinimapShouldHighlightSearchResultsKey"; |
| 37 | + |
35 | 38 | NSString *const SCXcodeMinimapHighlightCommentsChangeNotification = @"SCXcodeMinimapHighlightCommentsChangeNotification"; |
36 | 39 | NSString *const SCXcodeMinimapShouldHighlightCommentsKey = @"SCXcodeMinimapShouldHighlightCommentsKey"; |
37 | 40 |
|
|
44 | 47 | NSString *const SCXcodeMinimapHideEditorScrollerChangeNotification = @"SCXcodeMinimapHideEditorScrollerChangeNotification"; |
45 | 48 | NSString *const SCXcodeMinimapShouldHideEditorScrollerKey = @"SCXcodeMinimapShouldHideEditorScrollerKey"; |
46 | 49 |
|
| 50 | +NSString *const SCXcodeMinimapAutohideChangeNotification = @"SCXcodeMinimapAutohideChangeNotification"; |
| 51 | +NSString *const SCXcodeMinimapShouldAutohideKey = @"SCXcodeMinimapShouldAutohideKey"; |
| 52 | + |
47 | 53 | NSString *const SCXcodeMinimapThemeChangeNotification = @"SCXcodeMinimapThemeChangeNotification"; |
48 | 54 | NSString *const SCXcodeMinimapThemeKey = @"SCXcodeMinimapThemeKey"; |
49 | 55 |
|
|
58 | 64 | NSString *const kHighlightBreakpointsMenuItemTitle = @"Highlight breakpoints"; |
59 | 65 | NSString *const kHighlightIssuesMenuItemTitle = @"Highlight issues"; |
60 | 66 | NSString *const kHighlightSelectedSymbolMenuItemTitle = @"Highlight selected symbol"; |
| 67 | +NSString *const kHighlightSearchResultsMenuItemTitle = @"Highlight search results"; |
61 | 68 | NSString *const kHighlightCommentsMenuItemTitle = @"Highlight comments"; |
62 | 69 | NSString *const kHighlightPreprocessorMenuItemTitle = @"Highlight preprocessor"; |
63 | 70 | NSString *const kHighlightEditorMenuItemTitle = @"Highlight main editor"; |
64 | 71 | NSString *const kHideEditorScrollerMenuItemTitle = @"Hide editor scroller"; |
| 72 | +NSString *const kAutohideMenuItemTitle = @"Autohide"; |
65 | 73 |
|
66 | 74 | NSString *const kThemeMenuItemTitle = @"Theme"; |
67 | 75 | NSString *const kEditorThemeMenuItemTitle = @"Editor Theme"; |
@@ -99,6 +107,7 @@ - (void)registerUserDefaults |
99 | 107 | SCXcodeMinimapShouldHighlightBreakpointsKey : @(YES), |
100 | 108 | SCXcodeMinimapShouldHighlightIssuesKey : @(YES), |
101 | 109 | SCXcodeMinimapShouldHighlightSelectedSymbolKey : @(YES), |
| 110 | + SCXcodeMinimapShouldHighlightSearchResultsKey : @(YES), |
102 | 111 | SCXcodeMinimapShouldHighlightCommentsKey : @(YES), |
103 | 112 | SCXcodeMinimapShouldHighlightPreprocessorKey : @(YES)}; |
104 | 113 |
|
@@ -187,6 +196,15 @@ - (void)createMenuItem |
187 | 196 | [highlightSelectedSymbolMenuItem setState:(selectedSymbolHighlightingEnabled ? NSOnState : NSOffState)]; |
188 | 197 |
|
189 | 198 |
|
| 199 | + NSMenuItem *highlightSearchResultsMenuItem = [[NSMenuItem alloc] initWithTitle:kHighlightSearchResultsMenuItemTitle |
| 200 | + action:@selector(toggleSearchResultsHighlighting:) keyEquivalent:@""]; |
| 201 | + [highlightSearchResultsMenuItem setTarget:self]; |
| 202 | + [minimapMenu addItem:highlightSearchResultsMenuItem]; |
| 203 | + |
| 204 | + BOOL searchResultsHighlightingEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapShouldHighlightSearchResultsKey] boolValue]; |
| 205 | + [highlightSearchResultsMenuItem setState:(searchResultsHighlightingEnabled ? NSOnState : NSOffState)]; |
| 206 | + |
| 207 | + |
190 | 208 | NSMenuItem *highlightCommentsMenuItem = [[NSMenuItem alloc] initWithTitle:kHighlightCommentsMenuItemTitle |
191 | 209 | action:@selector(toggleCommentsHighlighting:) keyEquivalent:@""]; |
192 | 210 | [highlightCommentsMenuItem setTarget:self]; |
@@ -223,6 +241,15 @@ - (void)createMenuItem |
223 | 241 | [hideEditorScrollerMenuItem setState:(shouldHideEditorScroller ? NSOnState : NSOffState)]; |
224 | 242 |
|
225 | 243 |
|
| 244 | + NSMenuItem *autohideMenuItem = [[NSMenuItem alloc] initWithTitle:kAutohideMenuItemTitle |
| 245 | + action:@selector(toggleAutohide:) keyEquivalent:@""]; |
| 246 | + [autohideMenuItem setTarget:self]; |
| 247 | + [minimapMenu addItem:autohideMenuItem]; |
| 248 | + |
| 249 | + BOOL shouldAutohide = [[[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapShouldAutohideKey] boolValue]; |
| 250 | + [autohideMenuItem setState:(shouldAutohide ? NSOnState : NSOffState)]; |
| 251 | + |
| 252 | + |
226 | 253 | [minimapMenu addItem:[NSMenuItem separatorItem]]; |
227 | 254 | } |
228 | 255 |
|
@@ -312,6 +339,15 @@ - (void)toggleSelectedSymbolHighlighting:(NSMenuItem *)sender |
312 | 339 | [[NSNotificationCenter defaultCenter] postNotificationName:SCXcodeMinimapHighlightSelectedSymbolChangeNotification object:nil]; |
313 | 340 | } |
314 | 341 |
|
| 342 | +- (void)toggleSearchResultsHighlighting:(NSMenuItem *)sender |
| 343 | +{ |
| 344 | + BOOL searchResultsHighlightingEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapShouldHighlightSearchResultsKey] boolValue]; |
| 345 | + |
| 346 | + [sender setState:(searchResultsHighlightingEnabled ? NSOffState : NSOnState)]; |
| 347 | + [[NSUserDefaults standardUserDefaults] setObject:@(!searchResultsHighlightingEnabled) forKey:SCXcodeMinimapShouldHighlightSearchResultsKey]; |
| 348 | + [[NSNotificationCenter defaultCenter] postNotificationName:SCXcodeMinimapHighlightSearchResultsChangeNotification object:nil]; |
| 349 | +} |
| 350 | + |
315 | 351 | - (void)toggleCommentsHighlighting:(NSMenuItem *)sender |
316 | 352 | { |
317 | 353 | BOOL commentsHighlightingEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapShouldHighlightCommentsKey] boolValue]; |
@@ -348,6 +384,15 @@ - (void)toggleEditorScrollerHiding:(NSMenuItem *)sender |
348 | 384 | [[NSNotificationCenter defaultCenter] postNotificationName:SCXcodeMinimapHideEditorScrollerChangeNotification object:nil]; |
349 | 385 | } |
350 | 386 |
|
| 387 | +- (void)toggleAutohide:(NSMenuItem *)sender |
| 388 | +{ |
| 389 | + BOOL shouldAutohide = [[[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapShouldAutohideKey] boolValue]; |
| 390 | + |
| 391 | + [sender setState:(shouldAutohide ? NSOffState : NSOnState)]; |
| 392 | + [[NSUserDefaults standardUserDefaults] setObject:@(!shouldAutohide) forKey:SCXcodeMinimapShouldAutohideKey]; |
| 393 | + [[NSNotificationCenter defaultCenter] postNotificationName:SCXcodeMinimapAutohideChangeNotification object:nil]; |
| 394 | +} |
| 395 | + |
351 | 396 | - (void)setMinimapTheme:(NSMenuItem *)sender |
352 | 397 | { |
353 | 398 | NSString *currentThemeName = [[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapThemeKey]; |
|
0 commit comments