Revision: 4981
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4981&view=rev
Author:   hofman
Date:     2008-11-23 15:27:33 +0000 (Sun, 23 Nov 2008)

Log Message:
-----------
convenience class factory methods and initializer for typeSelectHelper class

Modified Paths:
--------------
    trunk/SKBookmarkController.m
    trunk/SKDownloadController.m
    trunk/SKMainWindowController.m
    trunk/SKNotesDocument.m
    trunk/SKTypeSelectHelper.h
    trunk/SKTypeSelectHelper.m

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2008-11-23 14:12:52 UTC (rev 4980)
+++ trunk/SKBookmarkController.m        2008-11-23 15:27:33 UTC (rev 4981)
@@ -191,7 +191,7 @@
     [[[outlineView 
tableColumnWithIdentifier:SKBookmarksWindowFileColumnIdentifer] headerCell] 
setTitle:NSLocalizedString(@"File", @"Table header title")];
     [[[outlineView 
tableColumnWithIdentifier:SKBookmarksWindowPageColumnIdentifer] headerCell] 
setTitle:NSLocalizedString(@"Page", @"Table header title")];
     
-    [outlineView setTypeSelectHelper:[[[SKTypeSelectHelper alloc] init] 
autorelease]];
+    [outlineView setTypeSelectHelper:[SKTypeSelectHelper typeSelectHelper]];
     
     [outlineView registerForDraggedTypes:[NSArray 
arrayWithObjects:SKBookmarkRowsPboardType, nil]];
     

Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m        2008-11-23 14:12:52 UTC (rev 4980)
+++ trunk/SKDownloadController.m        2008-11-23 15:27:33 UTC (rev 4981)
@@ -102,7 +102,7 @@
 - (void)windowDidLoad {
     [self setWindowFrameAutosaveName:SKDownloadsWindowFrameAutosaveName];
     
-    [tableView setTypeSelectHelper:[[[SKTypeSelectHelper alloc] init] 
autorelease]];
+    [tableView setTypeSelectHelper:[SKTypeSelectHelper typeSelectHelper]];
     
     [tableView registerForDraggedTypes:[NSArray 
arrayWithObjects:NSURLPboardType, SKWeblocFilePboardType, NSStringPboardType, 
nil]];
 }

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-11-23 14:12:52 UTC (rev 4980)
+++ trunk/SKMainWindowController.m      2008-11-23 15:27:33 UTC (rev 4981)
@@ -506,21 +506,14 @@
         [self showSnapshotsWithSetups:snapshotSetups];
     
     // typeSelectHelpers
-    SKTypeSelectHelper *typeSelectHelper = [[[SKTypeSelectHelper alloc] init] 
autorelease];
+    SKTypeSelectHelper *typeSelectHelper = [SKTypeSelectHelper 
typeSelectHelperWithMatchOption:SKFullStringMatch];
     [typeSelectHelper setMatchesImmediately:NO];
     [typeSelectHelper setCyclesSimilarResults:NO];
-    [typeSelectHelper setMatchOption:SKFullStringMatch];
     [thumbnailTableView setTypeSelectHelper:typeSelectHelper];
     [pdfView setTypeSelectHelper:typeSelectHelper];
+    [noteOutlineView setTypeSelectHelper:[SKTypeSelectHelper 
typeSelectHelperWithMatchOption:SKSubstringMatch]];
+    [outlineView setTypeSelectHelper:[SKTypeSelectHelper 
typeSelectHelperWithMatchOption:SKSubstringMatch]];
     
-    typeSelectHelper = [[[SKTypeSelectHelper alloc] init] autorelease];
-    [typeSelectHelper setMatchOption:SKSubstringMatch];
-    [noteOutlineView setTypeSelectHelper:typeSelectHelper];
-    
-    typeSelectHelper = [[[SKTypeSelectHelper alloc] init] autorelease];
-    [typeSelectHelper setMatchOption:SKSubstringMatch];
-    [outlineView setTypeSelectHelper:typeSelectHelper];
-    
     // This update toolbar item and other states
     [self handleChangedHistoryNotification:nil];
     [self handlePageChangedNotification:nil];

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2008-11-23 14:12:52 UTC (rev 4980)
+++ trunk/SKNotesDocument.m     2008-11-23 15:27:33 UTC (rev 4981)
@@ -130,9 +130,7 @@
     [arrayController setSortDescriptors:[NSArray 
arrayWithObjects:indexSortDescriptor, stringSortDescriptor, nil]];
     [outlineView reloadData];
     
-    SKTypeSelectHelper *typeSelectHelper = [[[SKTypeSelectHelper alloc] init] 
autorelease];
-    [typeSelectHelper setMatchOption:SKSubstringMatch];
-    [outlineView setTypeSelectHelper:typeSelectHelper];
+    [outlineView setTypeSelectHelper:[SKTypeSelectHelper 
typeSelectHelperWithMatchOption:SKSubstringMatch]];
 }
 
 - (NSArray *)writableTypesForSaveOperation:(NSSaveOperationType)saveOperation {

Modified: trunk/SKTypeSelectHelper.h
===================================================================
--- trunk/SKTypeSelectHelper.h  2008-11-23 14:12:52 UTC (rev 4980)
+++ trunk/SKTypeSelectHelper.h  2008-11-23 15:27:33 UTC (rev 4981)
@@ -57,6 +57,11 @@
     BOOL processing;
 }
 
++ (id)typeSelectHelper;
++ (id)typeSelectHelperWithMatchOption:(int)aMatchOption;
+
+- (id)initWithMatchOption:(int)aMatchOption;
+
 - (id)dataSource;
 - (void)setDataSource:(id)anObject;
 

Modified: trunk/SKTypeSelectHelper.m
===================================================================
--- trunk/SKTypeSelectHelper.m  2008-11-23 14:12:52 UTC (rev 4980)
+++ trunk/SKTypeSelectHelper.m  2008-11-23 15:27:33 UTC (rev 4981)
@@ -63,19 +63,30 @@
 
 @implementation SKTypeSelectHelper
 
-// Init and dealloc
 
-- (id)init {
++ (id)typeSelectHelper {
+    return [[[self alloc] init] autorelease];
+}
+
++ (id)typeSelectHelperWithMatchOption:(int)aMatchOption {
+    return [[[self alloc] typeSelectHelperWithMatchOption:aMatchOption] 
autorelease];
+}
+
+- (id)initWithMatchOption:(int)aMatchOption {
     if (self = [super init]){
         searchCache = nil;
         searchString = nil;
         cycleResults = YES;
         matchesImmediately = YES;
-        matchOption = SKPrefixMatch;
+        matchOption = aMatchOption;
     }
     return self;
 }
 
+- (id)init {
+    return [self initWithMatchOption:SKPrefixMatch];
+}
+
 - (void)dealloc {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     [self stopTimer];


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to