Revision: 2711
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2711&view=rev
Author:   hofman
Date:     2007-08-23 05:53:21 -0700 (Thu, 23 Aug 2007)

Log Message:
-----------
Allow typing non-control and non-alphanumeric characters for type-select, just 
not as the initial character. Add some convenience accessors for those.

Scroll row found by type-select to visible.

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

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKBookmarkController.m        2007-08-23 12:53:21 UTC (rev 2711)
@@ -368,6 +368,7 @@
 
 - (void)typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper 
selectItemAtIndex:(unsigned int)itemIndex {
     [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] 
byExtendingSelection:NO];
+    [tableView scrollRowToVisible:itemIndex];
 }
 
 @end

Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m        2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKDownloadController.m        2007-08-23 12:53:21 UTC (rev 2711)
@@ -336,6 +336,7 @@
 
 - (void)typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper 
selectItemAtIndex:(unsigned int)itemIndex {
     [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] 
byExtendingSelection:NO];
+    [tableView scrollRowToVisible:itemIndex];
 }
 
 @end

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKMainWindowController.m      2007-08-23 12:53:21 UTC (rev 2711)
@@ -3633,8 +3633,10 @@
     } else if ([typeSelectHelper isEqual:[noteOutlineView typeSelectHelper]]) {
         int row = [noteOutlineView rowForItem:[[noteArrayController 
arrangedObjects] objectAtIndex:itemIndex]];
         [noteOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] 
byExtendingSelection:NO];
+        [noteOutlineView scrollRowToVisible:row];
     } else if ([typeSelectHelper isEqual:[outlineView typeSelectHelper]]) {
         [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] 
byExtendingSelection:NO];
+        [noteOutlineView scrollRowToVisible:itemIndex];
     }
 }
 

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKNotesDocument.m     2007-08-23 12:53:21 UTC (rev 2711)
@@ -348,6 +348,7 @@
 - (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];
 }
 
 @end

Modified: trunk/SKOutlineView.m
===================================================================
--- trunk/SKOutlineView.m       2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKOutlineView.m       2007-08-23 12:53:21 UTC (rev 2711)
@@ -91,9 +91,9 @@
     unichar eventChar = [characters length] > 0 ? [characters 
characterAtIndex:0] : 0;
        unsigned modifierFlags = [theEvent modifierFlags] & 
NSDeviceIndependentModifierFlagsMask;
     
-    if (typeSelectHelper && modifierFlags == 0 && [[NSCharacterSet 
alphanumericCharacterSet] characterIsMember:eventChar])
+    if ([typeSelectHelper isTypeSelectCharacter:eventChar] && typeSelectHelper 
&& modifierFlags == 0)
         [typeSelectHelper processKeyDownCharacter:eventChar];
-    else if (typeSelectHelper && modifierFlags == 0 && eventChar == '/')
+    else if ([typeSelectHelper isRepeatCharacter:eventChar] && modifierFlags 
== 0)
         [typeSelectHelper repeatSearch];
     else if (eventChar == NSHomeFunctionKey && (modifierFlags & 
~NSFunctionKeyMask) == 0)
         [self scrollToBeginningOfDocument:nil];

Modified: trunk/SKTableView.m
===================================================================
--- trunk/SKTableView.m 2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKTableView.m 2007-08-23 12:53:21 UTC (rev 2711)
@@ -69,9 +69,9 @@
     unichar eventChar = [characters length] > 0 ? [characters 
characterAtIndex:0] : 0;
        unsigned modifierFlags = [theEvent modifierFlags] & 
NSDeviceIndependentModifierFlagsMask;
     
-    if (typeSelectHelper && modifierFlags == 0 && [[NSCharacterSet 
alphanumericCharacterSet] characterIsMember:eventChar])
+    if ([typeSelectHelper isTypeSelectCharacter:eventChar] && typeSelectHelper 
&& modifierFlags == 0)
         [typeSelectHelper processKeyDownCharacter:eventChar];
-    else if ([typeSelectHelper cyclesSimilarResults] && modifierFlags == 0 && 
eventChar == '/')
+    else if ([typeSelectHelper isRepeatCharacter:eventChar] && modifierFlags 
== 0)
         [typeSelectHelper repeatSearch];
        else if ((eventChar == NSDeleteCharacter || eventChar == 
NSDeleteFunctionKey) && modifierFlags == 0 && [self canDelete])
         [self delete:self];

Modified: trunk/SKTypeSelectHelper.h
===================================================================
--- trunk/SKTypeSelectHelper.h  2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKTypeSelectHelper.h  2007-08-23 12:53:21 UTC (rev 2711)
@@ -76,6 +76,9 @@
 - (void)processKeyDownCharacter:(unichar)character;
 - (void)repeatSearch;
 
+- (BOOL)isTypeSelectCharacter:(unichar)character;
+- (BOOL)isRepeatCharacter:(unichar)character;
+
 @end
 
 

Modified: trunk/SKTypeSelectHelper.m
===================================================================
--- trunk/SKTypeSelectHelper.m  2007-08-23 11:08:50 UTC (rev 2710)
+++ trunk/SKTypeSelectHelper.m  2007-08-23 12:53:21 UTC (rev 2711)
@@ -39,6 +39,7 @@
 #import "SKTypeSelectHelper.h"
 
 #define TIMEOUT 0.7
+#define REPEAT_CHARACTER '/'
 
 @interface NSString (BDSKTypeAheadHelperExtensions)
 - (BOOL)containsStringStartingAtWord:(NSString *)string options:(int)mask 
range:(NSRange)range;
@@ -157,6 +158,18 @@
     processing = NO;
 }
 
+- (BOOL)isTypeSelectCharacter:(unichar)character {
+    if ([[NSCharacterSet alphanumericCharacterSet] 
characterIsMember:character])
+        return YES;
+    if ([self isProcessing] && [[NSCharacterSet controlCharacterSet] 
characterIsMember:character])
+        return YES;
+    return NO;
+}
+
+- (BOOL)isRepeatCharacter:(unichar)character {
+    return [self cyclesSimilarResults] && character == REPEAT_CHARACTER;
+}
+
 @end 
 
 #pragma mark -


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to