Revision: 14101
http://sourceforge.net/p/skim-app/code/14101
Author: hofman
Date: 2024-03-13 17:55:51 +0000 (Wed, 13 Mar 2024)
Log Message:
-----------
Add option to highlight all search results rather than the selected, accessed
through context menu
Modified Paths:
--------------
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
trunk/SKMainWindowController_UI.m
trunk/SKStringConstants.h
trunk/SKStringConstants.m
trunk/de.lproj/Localizable.strings
trunk/en.lproj/Localizable.strings
trunk/es.lproj/Localizable.strings
trunk/fr.lproj/Localizable.strings
trunk/it.lproj/Localizable.strings
trunk/ja.lproj/Localizable.strings
trunk/nl.lproj/Localizable.strings
trunk/pl.lproj/Localizable.strings
trunk/ru.lproj/Localizable.strings
trunk/zh_CN.lproj/Localizable.strings
trunk/zh_TW.lproj/Localizable.strings
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2024-03-12 22:37:41 UTC (rev 14100)
+++ trunk/SKMainWindowController.h 2024-03-13 17:55:51 UTC (rev 14101)
@@ -181,6 +181,7 @@
unsigned int caseInsensitiveSearch:1;
unsigned int wholeWordSearch:1;
unsigned int caseInsensitiveFilter:1;
+ unsigned int highlightAllSearchResults:1;
unsigned int autoResizeNoteRows:1;
unsigned int addOrRemoveNotesInBulk:1;
unsigned int updatingOutlineSelection:1;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2024-03-12 22:37:41 UTC (rev 14100)
+++ trunk/SKMainWindowController.m 2024-03-13 17:55:51 UTC (rev 14101)
@@ -237,6 +237,7 @@
mwcFlags.caseInsensitiveSearch = [sud
boolForKey:SKCaseInsensitiveSearchKey];
mwcFlags.wholeWordSearch = [sud boolForKey:SKWholeWordSearchKey];
mwcFlags.caseInsensitiveFilter = [sud
boolForKey:SKCaseInsensitiveFilterKey];
+ mwcFlags.highlightAllSearchResults = [sud
boolForKey:SKHighlightAllSearchResultsKey];
groupedSearchResults = nil;
thumbnails = [[NSArray alloc] init];
notes = [[NSMutableArray alloc] init];
@@ -1850,7 +1851,8 @@
if ([findResults count] == 0) {
- [pdfView setHighlightedSelections:nil];
+ if (mwcFlags.highlightAllSearchResults == 0)
+ [pdfView setHighlightedSelections:nil];
[self updateRightStatus];
} else {
@@ -1880,9 +1882,11 @@
[pdfView goToRect:rect onPage:page];
}
- NSArray *highlights = [[NSArray alloc] initWithArray:findResults
copyItems:YES];
- [highlights setValue:[NSColor findHighlightColor] forKey:@"color"];
- [pdfView setHighlightedSelections:highlights];
+ if (mwcFlags.highlightAllSearchResults == 0) {
+ NSArray *highlights = [[NSArray alloc] initWithArray:findResults
copyItems:YES];
+ [highlights setValue:[NSColor findHighlightColor] forKey:@"color"];
+ [pdfView setHighlightedSelections:highlights];
+ }
if ([currentSel hasCharacters]) {
[pdfView setCurrentSelection:currentSel animate:YES];
@@ -1953,6 +1957,14 @@
for (result in groupedSearchResults)
[result setMaxCount:maxCount];
}
+
+ if (mwcFlags.highlightAllSearchResults) {
+ NSMutableArray *highlights = [NSMutableArray arrayWithArray:[pdfView
highlightedSelections]];
+ instance = [instance copy];
+ [instance setColor:[NSColor findHighlightColor]];
+ [highlights addObject:instance];
+ [pdfView setHighlightedSelections:highlights];
+ }
}
- (void)documentDidBeginDocumentFind:(NSNotification *)note {
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2024-03-12 22:37:41 UTC (rev 14100)
+++ trunk/SKMainWindowController_UI.m 2024-03-13 17:55:51 UTC (rev 14101)
@@ -997,6 +997,24 @@
[pdfView setCurrentSelection:[PDFSelection
selectionByAddingSelections:[sender representedObject]]];
}
+- (void)changeSearchResultsHighlighting:(id)sender {
+ if ([sender tag] == mwcFlags.highlightAllSearchResults)
+ return;
+ mwcFlags.highlightAllSearchResults = [sender tag];
+ [[NSUserDefaults standardUserDefaults]
setBool:mwcFlags.highlightAllSearchResults
forKey:SKHighlightAllSearchResultsKey];
+ NSArray *results = nil;
+ if (mwcFlags.highlightAllSearchResults) {
+ results = searchResults;
+ } else if (mwcFlags.findPaneState == SKFindPaneStateSingular &&
[leftSideController.findTableView window]) {
+ results = [leftSideController.findArrayController selectedObjects];
+ } else if (mwcFlags.findPaneState == SKFindPaneStateGrouped &&
[leftSideController.groupedFindTableView window]) {
+ results = [[leftSideController.groupedFindArrayController
selectedObjects] valueForKeyPath:@"@unionOfArrays.matches"];
+ }
+ results = [[NSArray alloc] initWithArray:results copyItems:YES];
+ [results setValue:[NSColor findHighlightColor] forKey:@"color"];
+ [pdfView setHighlightedSelections:results];
+}
+
- (void)deleteSnapshot:(id)sender {
[[sender representedObject] close];
}
@@ -1195,6 +1213,14 @@
[item setRepresentedObject:selections];
}
}
+ if ([menu numberOfItems] > 0)
+ [menu addItem:[NSMenuItem separatorItem]];
+ item = [menu addItemWithTitle:NSLocalizedString(@"Highlight Selected",
@"Menu item title") action:@selector(changeSearchResultsHighlighting:)
target:self tag:0];
+ if (mwcFlags.highlightAllSearchResults == 0)
+ [item setState:NSControlStateValueOn];
+ item = [menu addItemWithTitle:NSLocalizedString(@"Highlight All",
@"Menu item title") action:@selector(changeSearchResultsHighlighting:)
target:self tag:1];
+ if (mwcFlags.highlightAllSearchResults)
+ [item setState:NSControlStateValueOn];
} else if ([menu isEqual:[leftSideController.groupedFindTableView menu]]) {
NSIndexSet *rowIndexes = [leftSideController.groupedFindTableView
selectedRowIndexes];
NSInteger row = [leftSideController.groupedFindTableView clickedRow];
@@ -1219,6 +1245,14 @@
[item setRepresentedObject:selections];
}
}
+ if ([menu numberOfItems] > 0)
+ [menu addItem:[NSMenuItem separatorItem]];
+ item = [menu addItemWithTitle:NSLocalizedString(@"Highlight Selected",
@"Menu item title") action:@selector(changeSearchResultsHighlighting:)
target:self tag:0];
+ if (mwcFlags.highlightAllSearchResults == 0)
+ [item setState:NSControlStateValueOn];
+ item = [menu addItemWithTitle:NSLocalizedString(@"Highlight All",
@"Menu item title") action:@selector(changeSearchResultsHighlighting:)
target:self tag:1];
+ if (mwcFlags.highlightAllSearchResults)
+ [item setState:NSControlStateValueOn];
} else if ([menu isEqual:[rightSideController.snapshotTableView menu]]) {
NSInteger row = [rightSideController.snapshotTableView clickedRow];
if (row != -1) {
Modified: trunk/SKStringConstants.h
===================================================================
--- trunk/SKStringConstants.h 2024-03-12 22:37:41 UTC (rev 14100)
+++ trunk/SKStringConstants.h 2024-03-13 17:55:51 UTC (rev 14101)
@@ -136,6 +136,7 @@
extern NSString *SKCaseInsensitiveNoteSearchKey;
extern NSString *SKCaseInsensitiveFilterKey;
extern NSString *SKCaseInsensitiveFindKey;
+extern NSString *SKHighlightAllSearchResultsKey;
extern NSString *SKSpellCheckingEnabledKey;
extern NSString *SKGrammarCheckingEnabledKey;
extern NSString *SKDownloadsDirectoryKey;
Modified: trunk/SKStringConstants.m
===================================================================
--- trunk/SKStringConstants.m 2024-03-12 22:37:41 UTC (rev 14100)
+++ trunk/SKStringConstants.m 2024-03-13 17:55:51 UTC (rev 14101)
@@ -136,6 +136,7 @@
NSString *SKCaseInsensitiveNoteSearchKey = @"SKCaseInsensitiveNoteSearch";
NSString *SKCaseInsensitiveFilterKey = @"SKCaseInsensitiveFilter";
NSString *SKCaseInsensitiveFindKey = @"SKCaseInsensitiveFind";
+NSString *SKHighlightAllSearchResultsKey = @"SKHighlightAllSearchResults";
NSString *SKSpellCheckingEnabledKey = @"SKSpellCheckingEnabled";
NSString *SKGrammarCheckingEnabledKey = @"SKGrammarCheckingEnabled";
NSString *SKDownloadsDirectoryKey = @"SKDownloadsDirectory";
Modified: trunk/de.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/en.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/es.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/fr.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/it.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/ja.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/nl.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/pl.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/ru.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/zh_CN.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/zh_TW.lproj/Localizable.strings
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit