Revision: 2901
http://skim-app.svn.sourceforge.net/skim-app/?rev=2901&view=rev
Author: hofman
Date: 2007-09-11 13:41:33 -0700 (Tue, 11 Sep 2007)
Log Message:
-----------
Search anchored note text with type select.
Modified Paths:
--------------
trunk/SKMainWindowController.m
trunk/SKNotesDocument.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2007-09-11 19:42:17 UTC (rev 2900)
+++ trunk/SKMainWindowController.m 2007-09-11 20:41:33 UTC (rev 2901)
@@ -3691,7 +3691,14 @@
if ([typeSelectHelper isEqual:[thumbnailTableView typeSelectHelper]] ||
[typeSelectHelper isEqual:[pdfView typeSelectHelper]]) {
return pageLabels;
} else if ([typeSelectHelper isEqual:[noteOutlineView typeSelectHelper]]) {
- return [[noteArrayController arrangedObjects] valueForKey:@"contents"];
+ int i, count = [noteOutlineView numberOfRows];
+ NSMutableArray *texts = [NSMutableArray arrayWithCapacity:count];
+ for (i = 0; i < count; i++) {
+ id item = [noteOutlineView itemAtRow:i];
+ NSString *contents = [item type] ? [(PDFAnnotation *)item
contents] : [[(SKNoteText *)item contents] string];
+ [texts addObject:contents ? contents : @""];
+ }
+ return texts;
} else if ([typeSelectHelper isEqual:[outlineView typeSelectHelper]]) {
int i, count = [outlineView numberOfRows];
NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];
@@ -3706,7 +3713,8 @@
if ([typeSelectHelper isEqual:[thumbnailTableView typeSelectHelper]] ||
[typeSelectHelper isEqual:[pdfView typeSelectHelper]]) {
return [[thumbnailTableView selectedRowIndexes] lastIndex];
} else if ([typeSelectHelper isEqual:[noteOutlineView typeSelectHelper]]) {
- return [[noteArrayController arrangedObjects] indexOfObject:[self
selectedNote]];
+ int row = [noteOutlineView selectedRow];
+ return row == -1 ? NSNotFound : row;
} else if ([typeSelectHelper isEqual:[outlineView typeSelectHelper]]) {
int row = [outlineView selectedRow];
return row == -1 ? NSNotFound : row;
@@ -3718,9 +3726,8 @@
if ([typeSelectHelper isEqual:[thumbnailTableView typeSelectHelper]] ||
[typeSelectHelper isEqual:[pdfView typeSelectHelper]]) {
[self setPageNumber:itemIndex + 1];
} else if ([typeSelectHelper isEqual:[noteOutlineView typeSelectHelper]]) {
- int row = [noteOutlineView rowForItem:[[noteArrayController
arrangedObjects] objectAtIndex:itemIndex]];
- [noteOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row]
byExtendingSelection:NO];
- [noteOutlineView scrollRowToVisible:row];
+ [noteOutlineView selectRowIndexes:[NSIndexSet
indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ [noteOutlineView scrollRowToVisible:itemIndex];
} else if ([typeSelectHelper isEqual:[outlineView typeSelectHelper]]) {
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex]
byExtendingSelection:NO];
[noteOutlineView scrollRowToVisible:itemIndex];
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2007-09-11 19:42:17 UTC (rev 2900)
+++ trunk/SKNotesDocument.m 2007-09-11 20:41:33 UTC (rev 2901)
@@ -420,26 +420,24 @@
#pragma mark SKTypeSelectHelper datasource protocol
- (NSArray *)typeSelectHelperSelectionItems:(SKTypeSelectHelper
*)typeSelectHelper {
- return [[arrayController arrangedObjects] valueForKey:@"contents"];
+ int i, count = [outlineView numberOfRows];
+ NSMutableArray *texts = [NSMutableArray arrayWithCapacity:count];
+ for (i = 0; i < count; i++) {
+ id item = [outlineView itemAtRow:i];
+ NSString *contents = [item type] ? [item valueForKey:@"contents"] :
[[item valueForKey:@"contents"] string];
+ [texts addObject:contents ? contents : @""];
+ }
+ return texts;
}
- (unsigned int)typeSelectHelperCurrentlySelectedIndex:(SKTypeSelectHelper
*)typeSelectHelper {
- NSArray *arrangedNotes = [arrayController arrangedObjects];
int row = [outlineView selectedRow];
- id item = nil;
- if (row == -1)
- return NSNotFound;
- item = [outlineView itemAtRow:row];
- if ([item valueForKey:@"type"])
- return [arrangedNotes indexOfObject:item];
- else
- return [[arrangedNotes valueForKey:@"child"] indexOfObject:item];
+ return row == -1 ? NSNotFound : row;
}
- (void)typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper
selectItemAtIndex:(unsigned int)itemIndex {
- int row = [outlineView rowForItem:[[arrayController arrangedObjects]
objectAtIndex:itemIndex]];
- [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row]
byExtendingSelection:NO];
- [outlineView scrollRowToVisible:row];
+ [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex]
byExtendingSelection:NO];
+ [outlineView scrollRowToVisible:itemIndex];
}
- (void)typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper
didFailToFindMatchForSearchString:(NSString *)searchString {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit