[dasher] MacOSX: Store entire context/history (i.e. reverse through all you have written)
- From: Patrick Welche <pwelche src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [dasher] MacOSX: Store entire context/history (i.e. reverse through all you have written)
- Date: Tue, 1 Dec 2009 17:12:21 +0000 (UTC)
commit 8fc68617d88fbf6fb685a97f7f8095c48f9c44a5
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Tue Dec 1 17:03:55 2009 +0000
MacOSX: Store entire context/history (i.e. reverse through all you have written)
ChangeLog | 3 +++
Src/MacOSX/COSXDasherControl.mm | 4 +++-
Src/MacOSX/DasherEdit.h | 4 ++--
Src/MacOSX/DasherEdit.mm | 37 +++++--------------------------------
4 files changed, 13 insertions(+), 35 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 67770bb..3a0400c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
* MacOSX: Set DEBUG for Development build;
remove (Win32-only) IMEConversionHelper
+ * MacOSX: Store entire context/history (i.e. reverse through
+ all you have written)
+
2009-12-01 Patrick Welche <prlw1 cam ac uk>
diff --git a/Src/MacOSX/COSXDasherControl.mm b/Src/MacOSX/COSXDasherControl.mm
index f16453b..dd62c03 100644
--- a/Src/MacOSX/COSXDasherControl.mm
+++ b/Src/MacOSX/COSXDasherControl.mm
@@ -185,7 +185,9 @@ void COSXDasherControl::ExternalEventHandler(Dasher::CEvent *pEvent) {
}
break;
case EV_EDIT_CONTEXT:
- NSLog(@"ExternalEventHandler, m_iEventType = EV_EDIT_CONTEXT");
+ //NSLog(@"ExternalEventHandler, m_iEventType = EV_EDIT_CONTEXT");
+ CEditContextEvent *ecvt((CEditContextEvent *)pEvent);
+ SetContext(StdStringFromNSString([dasherEdit textAtOffset:ecvt->m_iOffset Length:ecvt->m_iLength]));
break;
case EV_START:
NSLog(@"ExternalEventHandler, m_iEventType = EV_START");
diff --git a/Src/MacOSX/DasherEdit.h b/Src/MacOSX/DasherEdit.h
index 00b04a8..a74d700 100644
--- a/Src/MacOSX/DasherEdit.h
+++ b/Src/MacOSX/DasherEdit.h
@@ -11,13 +11,13 @@
@interface DasherEdit : NSObject
{
BOOL dasherIsModifyingText;
+ NSMutableString *allTextEntered;
}
- init;
- (void)sendString:(NSString *)aString toTargetApp:(AXUIElementRef)aTargetApp;
- (void)outputCallback:(NSString *)aString targetApp:(AXUIElementRef)aTargetApp;
- (void)deleteCallback:(NSString *)s targetApp:(AXUIElementRef)aTargetApp;
-- (NSString *)getNewContextCallback:(int)maxChars;
-
+- (NSString *)textAtOffset:(int)iOffset Length:(int)iLength;
@end
diff --git a/Src/MacOSX/DasherEdit.mm b/Src/MacOSX/DasherEdit.mm
index 02cd630..a4742d7 100644
--- a/Src/MacOSX/DasherEdit.mm
+++ b/Src/MacOSX/DasherEdit.mm
@@ -20,6 +20,7 @@
{
if (self = [super init])
{
+ allTextEntered = [[NSMutableString alloc] initWithCapacity:1024];
}
return self;
@@ -36,7 +37,7 @@
dasherIsModifyingText = YES;
[self sendString:aString toTargetApp:aTargetApp];
dasherIsModifyingText = NO;
-
+ [allTextEntered appendString:aString];
[[Chatter sharedInstance] addToBufferedText:aString];
}
@@ -52,40 +53,12 @@
[self sendString:@"\b" toTargetApp:aTargetApp];
}
dasherIsModifyingText = NO;
-
+ [allTextEntered deleteCharactersInRange:NSMakeRange([allTextEntered length]-len, len)];
[[Chatter sharedInstance] removeFromBufferedText:s];
}
-
-- (NSString *)getNewContextCallback:(int)maxChars
-{
-#if 0
- NSString *result = nil;
-
- this needs redoing to handle the new setup of typing into other apps
-
- NSString *s = [[self currentTextUI] string];
- NSRange r = [[self currentTextUI] selectedRange];
- unsigned int location = 0;
- unsigned int length = maxChars;
-
- if ((int)r.location < maxChars) {
- location = 0;
- length = r.location;
- } else {
- location = r.location - maxChars;
- length = maxChars;
- }
-
- r = NSMakeRange(location, length);
-
- result = r.length <= 0 ? @"" : [s substringWithRange:r];
-#endif
-
- [[Chatter sharedInstance] clearBuffer];
-
-// return result;
- return @"abcde";
+-(NSString *)textAtOffset:(int)iOffset Length:(int)iLength {
+ return [allTextEntered substringWithRange:NSMakeRange(iOffset,iLength)];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]