Revision: 2593
http://skim-app.svn.sourceforge.net/skim-app/?rev=2593&view=rev
Author: hofman
Date: 2007-07-31 04:01:04 -0700 (Tue, 31 Jul 2007)
Log Message:
-----------
commit edits before finding next/previous
Modified Paths:
--------------
trunk/SKFindController.h
trunk/SKFindController.m
Modified: trunk/SKFindController.h
===================================================================
--- trunk/SKFindController.h 2007-07-31 09:53:44 UTC (rev 2592)
+++ trunk/SKFindController.h 2007-07-31 11:01:04 UTC (rev 2593)
@@ -47,6 +47,7 @@
int lastChangeCount;
BOOL ignoreCase;
BDSKFindFieldEditor *fieldEditor;
+ CFArrayRef editors;
}
+ (id)sharedFindController;
@@ -68,6 +69,8 @@
- (id)target;
- (id)selectionSource;
+- (BOOL)commitEditing;
+
@end
Modified: trunk/SKFindController.m
===================================================================
--- trunk/SKFindController.m 2007-07-31 09:53:44 UTC (rev 2592)
+++ trunk/SKFindController.m 2007-07-31 11:01:04 UTC (rev 2593)
@@ -56,11 +56,13 @@
- (id)init {
if (self = [super init]) {
ignoreCase = YES;
+ editors = CFArrayCreateMutable(kCFAllocatorMallocZone, 0, NULL);
}
return self;
}
- (void)dealloc {
+ CFRelease(editors);
[fieldEditor release];
[super dealloc];
}
@@ -134,6 +136,7 @@
}
- (IBAction)findNext:(id)sender {
+ [self commitEditing];
[[self target] findString:findString options:[self findOptions] &
~NSBackwardsSearch];
[self updateFindPboard];
}
@@ -144,6 +147,7 @@
}
- (IBAction)findPrevious:(id)sender {
+ [self commitEditing];
[[self target] findString:findString options:[self findOptions] |
NSBackwardsSearch];
[self updateFindPboard];
}
@@ -243,4 +247,25 @@
return fieldEditor;
}
+- (void)objectDidBeginEditing:(id)editor {
+ if (CFArrayGetFirstIndexOfValue(editors, CFRangeMake(0,
CFArrayGetCount(editors)), editor) == -1)
+ CFArrayAppendValue((CFMutableArrayRef)editors, editor);
+}
+
+- (void)objectDidEndEditing:(id)editor {
+ CFIndex index = CFArrayGetFirstIndexOfValue(editors, CFRangeMake(0,
CFArrayGetCount(editors)), editor);
+ if (index != -1)
+ CFArrayRemoveValueAtIndex((CFMutableArrayRef)editors, index);
+}
+
+- (BOOL)commitEditing {
+ CFIndex index = CFArrayGetCount(editors);
+
+ while (index--)
+ if([(NSObject *)(CFArrayGetValueAtIndex(editors, index))
commitEditing] == NO)
+ return NO;
+
+ return YES;
+}
+
@end
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