Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Application manager to deal with delegate

  • Loading branch information...
commit 0206df9f393fef12d2618cc96a4f247d11863b2b 1 parent 08717fb
@dabaopku authored
View
160 iStroke.xcodeproj/project.pbxproj
@@ -20,15 +20,8 @@
E76D7B6C14F7F7A3004DA0E5 /* Action.mm in Sources */ = {isa = PBXBuildFile; fileRef = E76D7B6B14F7F7A2004DA0E5 /* Action.mm */; };
E771E71014FCEDAF00AF0524 /* Command.mm in Sources */ = {isa = PBXBuildFile; fileRef = E771E70F14FCEDAF00AF0524 /* Command.mm */; };
E771E71414FE541000AF0524 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E771E71614FE541000AF0524 /* Localizable.strings */; };
- E7727A1714E4541E00935AE7 /* ApplicationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E7727A1614E4541E00935AE7 /* ApplicationManager.m */; };
E7727A1A14E4544A00935AE7 /* Application.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7727A1914E4544A00935AE7 /* Application.mm */; };
E7727A1D14E4546C00935AE7 /* Stroke.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7727A1C14E4546C00935AE7 /* Stroke.mm */; };
- E772DBE414E4424100A06FA8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E750793414E2E70F00964C83 /* Cocoa.framework */; };
- E772DBEA14E4424100A06FA8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E772DBE814E4424100A06FA8 /* InfoPlist.strings */; };
- E772DBED14E4424100A06FA8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E772DBEC14E4424100A06FA8 /* main.m */; };
- E772DBF014E4424100A06FA8 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = E772DBEE14E4424100A06FA8 /* Credits.rtf */; };
- E772DBF314E4424100A06FA8 /* testAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E772DBF214E4424100A06FA8 /* testAppDelegate.m */; };
- E772DBF614E4424100A06FA8 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E772DBF414E4424100A06FA8 /* MainMenu.xib */; };
E772DBF914E4424100A06FE6 /* Gesture.mm in Sources */ = {isa = PBXBuildFile; fileRef = E772DBF914E4424100A06FE5 /* Gesture.mm */; };
E7AC6F5714E8F578008D0A2D /* GestureItem.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7AC6F5614E8F578008D0A2D /* GestureItem.mm */; };
E7AC6F5B14E90B70008D0A2D /* DrawStrokeCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7AC6F5A14E90B70008D0A2D /* DrawStrokeCell.mm */; };
@@ -62,27 +55,13 @@
E771E70F14FCEDAF00AF0524 /* Command.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Command.mm; sourceTree = "<group>"; };
E771E71514FE541000AF0524 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
E771E71814FE5BB000AF0524 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
- E7727A0E14E4534E00935AE7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = "zh-Hans"; path = "/Users/dabao/develop/iStroke/test/zh-Hans.lproj/Credits.rtf"; sourceTree = "<absolute>"; };
- E7727A0F14E4534E00935AE7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "/Users/dabao/develop/iStroke/test/zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<absolute>"; };
- E7727A1014E4534E00935AE7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-Hans"; path = "/Users/dabao/develop/iStroke/test/zh-Hans.lproj/MainMenu.xib"; sourceTree = "<absolute>"; };
E7727A1214E4534E00935AE7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-Hans"; path = "/Users/dabao/develop/iStroke/iStroke/zh-Hans.lproj/MainMenu.xib"; sourceTree = "<absolute>"; };
E7727A1314E4534E00935AE7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "/Users/dabao/develop/iStroke/iStroke/zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<absolute>"; };
E7727A1414E4534E00935AE7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = "zh-Hans"; path = "/Users/dabao/develop/iStroke/iStroke/zh-Hans.lproj/Credits.rtf"; sourceTree = "<absolute>"; };
- E7727A1514E4541E00935AE7 /* ApplicationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationManager.h; sourceTree = "<group>"; };
- E7727A1614E4541E00935AE7 /* ApplicationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationManager.m; sourceTree = "<group>"; };
E7727A1814E4544A00935AE7 /* Application.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Application.hh; sourceTree = "<group>"; };
E7727A1914E4544A00935AE7 /* Application.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Application.mm; sourceTree = "<group>"; };
E7727A1B14E4546B00935AE7 /* Stroke.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Stroke.hh; sourceTree = "<group>"; };
E7727A1C14E4546C00935AE7 /* Stroke.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Stroke.mm; sourceTree = "<group>"; };
- E772DBE214E4424100A06FA8 /* test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = test.app; sourceTree = BUILT_PRODUCTS_DIR; };
- E772DBE714E4424100A06FA8 /* test-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "test-Info.plist"; sourceTree = "<group>"; };
- E772DBE914E4424100A06FA8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- E772DBEB14E4424100A06FA8 /* test-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "test-Prefix.pch"; sourceTree = "<group>"; };
- E772DBEC14E4424100A06FA8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- E772DBEF14E4424100A06FA8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
- E772DBF114E4424100A06FA8 /* testAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = testAppDelegate.h; sourceTree = "<group>"; };
- E772DBF214E4424100A06FA8 /* testAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = testAppDelegate.m; sourceTree = "<group>"; };
- E772DBF514E4424100A06FA8 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
E772DBF914E4424100A06FE5 /* Gesture.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Gesture.mm; sourceTree = "<group>"; };
E772DBF914E4424100A06FE7 /* Gesture.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Gesture.hh; sourceTree = "<group>"; };
E7AC6F5514E8F578008D0A2D /* GestureItem.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GestureItem.hh; sourceTree = "<group>"; };
@@ -103,14 +82,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- E772DBDF14E4424100A06FA8 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- E772DBE414E4424100A06FA8 /* Cocoa.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -118,7 +89,6 @@
isa = PBXGroup;
children = (
E750793A14E2E70F00964C83 /* iStroke */,
- E772DBE514E4424100A06FA8 /* test */,
E750793314E2E70F00964C83 /* Frameworks */,
E750793114E2E70F00964C83 /* Products */,
);
@@ -128,7 +98,6 @@
isa = PBXGroup;
children = (
E750793014E2E70F00964C83 /* iStroke.app */,
- E772DBE214E4424100A06FA8 /* test.app */,
);
name = Products;
sourceTree = "<group>";
@@ -181,8 +150,6 @@
E76D7B6E14F80363004DA0E5 /* Application */ = {
isa = PBXGroup;
children = (
- E7727A1514E4541E00935AE7 /* ApplicationManager.h */,
- E7727A1614E4541E00935AE7 /* ApplicationManager.m */,
E7727A1814E4544A00935AE7 /* Application.hh */,
E7727A1914E4544A00935AE7 /* Application.mm */,
E76D7B6A14F7F7A1004DA0E5 /* Action.hh */,
@@ -193,29 +160,6 @@
name = Application;
sourceTree = "<group>";
};
- E772DBE514E4424100A06FA8 /* test */ = {
- isa = PBXGroup;
- children = (
- E772DBEC14E4424100A06FA8 /* main.m */,
- E772DBE614E4424100A06FA8 /* Supporting Files */,
- );
- path = test;
- sourceTree = "<group>";
- };
- E772DBE614E4424100A06FA8 /* Supporting Files */ = {
- isa = PBXGroup;
- children = (
- E772DBF114E4424100A06FA8 /* testAppDelegate.h */,
- E772DBF214E4424100A06FA8 /* testAppDelegate.m */,
- E772DBF414E4424100A06FA8 /* MainMenu.xib */,
- E772DBE714E4424100A06FA8 /* test-Info.plist */,
- E772DBE814E4424100A06FA8 /* InfoPlist.strings */,
- E772DBEB14E4424100A06FA8 /* test-Prefix.pch */,
- E772DBEE14E4424100A06FA8 /* Credits.rtf */,
- );
- name = "Supporting Files";
- sourceTree = "<group>";
- };
E7C4ED7014E6DFF5006444E0 /* Interface */ = {
isa = PBXGroup;
children = (
@@ -276,23 +220,6 @@
productReference = E750793014E2E70F00964C83 /* iStroke.app */;
productType = "com.apple.product-type.application";
};
- E772DBE114E4424100A06FA8 /* test */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = E772DBF714E4424100A06FA8 /* Build configuration list for PBXNativeTarget "test" */;
- buildPhases = (
- E772DBDE14E4424100A06FA8 /* Sources */,
- E772DBDF14E4424100A06FA8 /* Frameworks */,
- E772DBE014E4424100A06FA8 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = test;
- productName = test;
- productReference = E772DBE214E4424100A06FA8 /* test.app */;
- productType = "com.apple.product-type.application";
- };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -315,7 +242,6 @@
projectRoot = "";
targets = (
E750792F14E2E70F00964C83 /* iStroke */,
- E772DBE114E4424100A06FA8 /* test */,
);
};
/* End PBXProject section */
@@ -332,16 +258,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- E772DBE014E4424100A06FA8 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- E772DBEA14E4424100A06FA8 /* InfoPlist.strings in Resources */,
- E772DBF014E4424100A06FA8 /* Credits.rtf in Resources */,
- E772DBF614E4424100A06FA8 /* MainMenu.xib in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -353,7 +269,6 @@
E750794814E2E70F00964C83 /* iStrokeAppDelegate.mm in Sources */,
E719195B14E2F70C00193FDB /* EventListener.mm in Sources */,
E750796314E2EE3200964C85 /* ProcessHooker.m in Sources */,
- E7727A1714E4541E00935AE7 /* ApplicationManager.m in Sources */,
E7727A1A14E4544A00935AE7 /* Application.mm in Sources */,
E7727A1D14E4546C00935AE7 /* Stroke.mm in Sources */,
E772DBF914E4424100A06FE6 /* Gesture.mm in Sources */,
@@ -366,15 +281,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- E772DBDE14E4424100A06FA8 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- E772DBED14E4424100A06FA8 /* main.m in Sources */,
- E772DBF314E4424100A06FA8 /* testAppDelegate.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
@@ -414,33 +320,6 @@
name = Localizable.strings;
sourceTree = "<group>";
};
- E772DBE814E4424100A06FA8 /* InfoPlist.strings */ = {
- isa = PBXVariantGroup;
- children = (
- E772DBE914E4424100A06FA8 /* en */,
- E7727A0F14E4534E00935AE7 /* zh-Hans */,
- );
- name = InfoPlist.strings;
- sourceTree = "<group>";
- };
- E772DBEE14E4424100A06FA8 /* Credits.rtf */ = {
- isa = PBXVariantGroup;
- children = (
- E772DBEF14E4424100A06FA8 /* en */,
- E7727A0E14E4534E00935AE7 /* zh-Hans */,
- );
- name = Credits.rtf;
- sourceTree = "<group>";
- };
- E772DBF414E4424100A06FA8 /* MainMenu.xib */ = {
- isa = PBXVariantGroup;
- children = (
- E772DBF514E4424100A06FA8 /* en */,
- E7727A1014E4534E00935AE7 /* zh-Hans */,
- );
- name = MainMenu.xib;
- sourceTree = "<group>";
- };
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -510,36 +389,6 @@
};
name = Release;
};
- E772DBF814E4424100A06FA8 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_OBJC_EXCEPTIONS = YES;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "test/test-Prefix.pch";
- INFOPLIST_FILE = "test/test-Info.plist";
- PRODUCT_NAME = "$(TARGET_NAME)";
- WRAPPER_EXTENSION = app;
- };
- name = Debug;
- };
- E772DBF914E4424100A06FA8 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- COPY_PHASE_STRIP = YES;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- GCC_ENABLE_OBJC_EXCEPTIONS = YES;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "test/test-Prefix.pch";
- INFOPLIST_FILE = "test/test-Info.plist";
- PRODUCT_NAME = "$(TARGET_NAME)";
- WRAPPER_EXTENSION = app;
- };
- name = Release;
- };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -561,15 +410,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- E772DBF714E4424100A06FA8 /* Build configuration list for PBXNativeTarget "test" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- E772DBF814E4424100A06FA8 /* Debug */,
- E772DBF914E4424100A06FA8 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
/* End XCConfigurationList section */
};
rootObject = E750792714E2E70F00964C83 /* Project object */;
View
21 iStroke/Application.hh
@@ -18,7 +18,7 @@ namespace iStroke {
};
}
-@interface Application : NSObject<NSTableViewDataSource,NSTableViewDelegate>{
+@interface Application : NSObject{
NSString *identifier;
NSString *name;
NSMutableArray *actions;
@@ -26,7 +26,6 @@ namespace iStroke {
Application *parent;
NSMutableArray *children;
- IBOutlet CommandTypeDelegate *commandTypeDelegate;
}
@property(retain) NSMutableArray *actions;
@@ -35,8 +34,24 @@ namespace iStroke {
@property(retain) NSMutableArray *children;
@property(retain) Application *parent;
--(void) addAction:(id)action;
-(NSArray*) allAction;
-(iStroke::MatchResult) matchAction:(iStroke::Stroke *)stroke;
+@end
+
+@interface ApplicationManager:NSObject
+ <NSOutlineViewDataSource,NSOutlineViewDelegate,NSTableViewDataSource,NSTableViewDelegate> {
+
+ NSMutableArray * applications;
+ Application * curApp;
+
+ IBOutlet CommandTypeDelegate *commandTypeDelegate;
+}
+
+@property(retain) NSMutableArray * applications;
+@property(retain) Application *curApp;
+
+-(void) addAction:(id)action;
+
+
@end
View
89 iStroke/Application.mm
@@ -30,17 +30,11 @@ -(id) init
}
return self;
}
--(void) addAction:(id)action
-{
- assert([action isKindOfClass:[Action class]]);
- [self.actions addObject:[action retain]];
-}
-(void) dealloc
{
[actions release];
[children release];
- [commandTypeDelegate release];
}
-(NSArray *) allAction
@@ -79,18 +73,82 @@ -(NSArray *) allAction
return res;
}
+@end
+
+@implementation ApplicationManager
+
+@synthesize applications;
+@synthesize curApp;
+
+-(id) init
+{
+ self=[super init];
+ if (self) {
+ applications=[NSMutableArray new];
+ curApp=[[Application alloc] init];
+ curApp.name=NSLocalizedString(@"Default", @"");
+ [applications addObject:[curApp retain]];
+ }
+ return self;
+}
+
+-(void) dealloc
+{
+ [commandTypeDelegate release];
+}
+
+-(void) addAction:(id)action
+{
+ assert([action isKindOfClass:[Action class]]);
+ [curApp.actions addObject:[action retain]];
+}
+
+
+#pragma mark - NSOutlineView
+
+-(id) outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
+{
+ if (item) {
+ return [[(Application*)item children] objectAtIndex:index];
+ }
+ else
+ {
+ return [applications objectAtIndex:index];
+ }
+}
+
+-(BOOL) outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
+{
+ return YES;
+}
+
+-(NSInteger) outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
+{
+ if(item==nil)
+ return [applications count];
+
+ return [[(Application *)item children] count];
+}
+
+-(id) outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
+{
+ return ((Application*)item).name;
+}
+
+
+
#pragma mark - NSTableView
-(NSInteger) numberOfRowsInTableView:(NSTableView *)tableView
{
- return [actions count];
+ return [curApp.actions count];
}
-(id) tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
NSString *col=[tableColumn identifier];
- Action *act=[actions objectAtIndex:row];
+ Action *act=[curApp.actions objectAtIndex:row];
if ([col isEqualToString:@"gesture"]) {
return [act image];
@@ -110,7 +168,7 @@ -(id) tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColum
-(void) tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
NSString *col=[tableColumn identifier];
- Action *act=[actions objectAtIndex:row];
+ Action *act=[curApp.actions objectAtIndex:row];
if([col isEqualToString:@"type"])
{
@@ -127,9 +185,20 @@ -(void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColum
[cell reloadData];
}
if ([cell isKindOfClass:[NSTextFieldCell class]]) {
- [cell setVerticalCentering:YES];
+ [(NSTextFieldCell *)cell setVerticalCentering:YES];
}
}
@end
+
+
+
+
+
+
+
+
+
+
+
View
16 iStroke/ApplicationManager.h
@@ -1,16 +0,0 @@
-//
-// ApplicationManager.h
-// iStroke
-//
-// Created by dabao on 12-2-10.
-// Copyright 2012年 PKU. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-
-@interface ApplicationManager : NSObject {
-
-}
-
-@end
View
14 iStroke/ApplicationManager.m
@@ -1,14 +0,0 @@
-//
-// ApplicationManager.m
-// iStroke
-//
-// Created by dabao on 12-2-10.
-// Copyright 2012年 PKU. All rights reserved.
-//
-
-#import "ApplicationManager.h"
-
-
-@implementation ApplicationManager
-
-@end
View
4 iStroke/iStrokeAppDelegate.hh
@@ -13,7 +13,7 @@
#import "Application.hh"
#import "Command.hh"
-@interface iStrokeAppDelegate : NSObject <NSApplicationDelegate,NSOutlineViewDataSource,NSOutlineViewDelegate> {
+@interface iStrokeAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
@@ -25,7 +25,7 @@
IBOutlet NSTableView *tableStroke;
IBOutlet NSOutlineView *appTable;
- IBOutlet Application *gestures;
+ IBOutlet ApplicationManager *appManager;
}
@property(assign) IBOutlet NSWindow *window;
View
38 iStroke/iStrokeAppDelegate.mm
@@ -38,6 +38,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
eventListener = [[EventListener alloc] init];
[eventListener start];
+
}
- (void)applicationWillTerminate:(NSNotification *)notification {
@@ -121,42 +122,11 @@ -(void)doneStroke
Application *app=[[Application alloc] init];
Action *act=[[Action alloc] initWithStroke:preStroke];
- [gestures addAction:act];
- [gestures.children addObject:app];
- act.name=[NSString stringWithFormat:@"stroke %i",[gestures.actions count]];
+ [appManager addAction:act];
+ [appManager.applications addObject:app];
+ act.name=[NSString stringWithFormat:@"stroke %i",[appManager.applications count]];
[tableStroke reloadData];
[appTable reloadData];
}
-
-#pragma mark - NSOutlineView
-
--(id) outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
-{
- if (item) {
- return [[(Application*)item children] objectAtIndex:index];
- }
- else
- {
- return gestures;
- }
-}
-
--(BOOL) outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
-{
- return YES;
-}
-
--(NSInteger) outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
-{
- if(item==nil)
- return 1;
-
- return [[(Application *)item children] count];
-}
-
--(id) outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
-{
- return ((Application*)item).name;
-}
@end
View
193 iStroke/zh-Hans.lproj/MainMenu.xib
@@ -62,8 +62,8 @@
<object class="NSCustomObject" id="97419981">
<string key="NSClassName">CommandTypeDelegate</string>
</object>
- <object class="NSCustomObject" id="106816411">
- <string key="NSClassName">Application</string>
+ <object class="NSCustomObject" id="457698766">
+ <string key="NSClassName">ApplicationManager</string>
</object>
<object class="NSMenu" id="649796088">
<string key="NSTitle">AMainMenu</string>
@@ -1359,6 +1359,7 @@
<int key="NSvFlags">18</int>
<string key="NSFrameSize">{620, 496}</string>
<reference key="NSSuperview" ref="104997985"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="455995807"/>
<object class="NSMutableArray" key="NSTabViewItems">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1485,6 +1486,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{155, 392}</string>
<reference key="NSSuperview" ref="490364720"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="588952478"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="741588472">
@@ -1492,6 +1494,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{155, 17}</string>
<reference key="NSSuperview" ref="403690099"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="321133953"/>
<reference key="NSTableView" ref="355779344"/>
</object>
@@ -1500,6 +1503,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{408, 0}, {16, 17}}</string>
<reference key="NSSuperview" ref="779850270"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="490364720"/>
</object>
<object class="NSMutableArray" key="NSTableColumns">
@@ -1584,6 +1588,7 @@
</object>
<string key="NSFrame">{{1, 17}, {155, 392}}</string>
<reference key="NSSuperview" ref="779850270"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="355779344"/>
<reference key="NSDocView" ref="355779344"/>
<reference key="NSBGColor" ref="348310064"/>
@@ -1594,6 +1599,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{408, 17}, {15, 99}}</string>
<reference key="NSSuperview" ref="779850270"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1067839027"/>
<reference key="NSTarget" ref="779850270"/>
<string key="NSAction">_doScroller:</string>
@@ -1604,6 +1610,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 116}, {422, 15}}</string>
<reference key="NSSuperview" ref="779850270"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="902648261"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="779850270"/>
@@ -1619,6 +1626,7 @@
</object>
<string key="NSFrame">{{1, 0}, {155, 17}}</string>
<reference key="NSSuperview" ref="779850270"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="741588472"/>
<reference key="NSDocView" ref="741588472"/>
<reference key="NSBGColor" ref="348310064"/>
@@ -1628,6 +1636,7 @@
</object>
<string key="NSFrame">{{17, 37}, {157, 410}}</string>
<reference key="NSSuperview" ref="455995807"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="403690099"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="588952478"/>
@@ -1652,6 +1661,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{404, 403}</string>
<reference key="NSSuperview" ref="462411736"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="883520016"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="496270914">
@@ -1659,6 +1669,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{404, 17}</string>
<reference key="NSSuperview" ref="604154655"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="398213687"/>
<reference key="NSTableView" ref="179209629"/>
</object>
@@ -1667,6 +1678,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{302, 0}, {16, 17}}</string>
<reference key="NSSuperview" ref="902648261"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="462411736"/>
</object>
<object class="NSMutableArray" key="NSTableColumns">
@@ -1873,6 +1885,7 @@
</object>
<string key="NSFrame">{{1, 17}, {404, 403}}</string>
<reference key="NSSuperview" ref="902648261"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="179209629"/>
<reference key="NSDocView" ref="179209629"/>
<reference key="NSBGColor" ref="348310064"/>
@@ -1883,6 +1896,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{302, 17}, {15, 289}}</string>
<reference key="NSSuperview" ref="902648261"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="552518531"/>
<reference key="NSTarget" ref="902648261"/>
<string key="NSAction">_doScroller:</string>
@@ -1893,6 +1907,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 362}, {391, 15}}</string>
<reference key="NSSuperview" ref="902648261"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="902648261"/>
@@ -1908,6 +1923,7 @@
</object>
<string key="NSFrame">{{1, 0}, {404, 17}}</string>
<reference key="NSSuperview" ref="902648261"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="496270914"/>
<reference key="NSDocView" ref="496270914"/>
<reference key="NSBGColor" ref="348310064"/>
@@ -1917,6 +1933,7 @@
</object>
<string key="NSFrame">{{182, 26}, {406, 421}}</string>
<reference key="NSSuperview" ref="455995807"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="604154655"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="883520016"/>
@@ -1929,6 +1946,7 @@
</object>
<string key="NSFrame">{{10, 33}, {600, 450}}</string>
<reference key="NSSuperview" ref="968799211"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="779850270"/>
</object>
<string key="NSLabel">手势</string>
@@ -1949,9 +1967,10 @@
</object>
<string key="NSFrame">{{7, 11}, {620, 496}}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="968799211"/>
</object>
- <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
+ <string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSMaxSize">{1e+13, 1e+13}</string>
</object>
<object class="NSWindowTemplate" id="401820873">
@@ -1967,9 +1986,10 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{7, 11}, {480, 270}}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
</object>
- <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
+ <string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSMaxSize">{1e+13, 1e+13}</string>
</object>
</object>
@@ -2714,59 +2734,59 @@
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">commandTypeDelegate</string>
- <reference key="source" ref="106816411"/>
- <reference key="destination" ref="97419981"/>
+ <string key="label">appTable</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="355779344"/>
</object>
- <int key="connectionID">786</int>
+ <int key="connectionID">792</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">dataSource</string>
- <reference key="source" ref="179209629"/>
- <reference key="destination" ref="106816411"/>
+ <reference key="source" ref="355779344"/>
+ <reference key="destination" ref="457698766"/>
</object>
- <int key="connectionID">787</int>
+ <int key="connectionID">794</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
- <reference key="source" ref="179209629"/>
- <reference key="destination" ref="106816411"/>
+ <reference key="source" ref="355779344"/>
+ <reference key="destination" ref="457698766"/>
</object>
- <int key="connectionID">788</int>
+ <int key="connectionID">795</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">gestures</string>
- <reference key="source" ref="976324537"/>
- <reference key="destination" ref="106816411"/>
+ <string key="label">commandTypeDelegate</string>
+ <reference key="source" ref="457698766"/>
+ <reference key="destination" ref="97419981"/>
</object>
- <int key="connectionID">789</int>
+ <int key="connectionID">798</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">dataSource</string>
- <reference key="source" ref="355779344"/>
- <reference key="destination" ref="976324537"/>
+ <reference key="source" ref="179209629"/>
+ <reference key="destination" ref="457698766"/>
</object>
- <int key="connectionID">790</int>
+ <int key="connectionID">799</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
- <reference key="source" ref="355779344"/>
- <reference key="destination" ref="976324537"/>
+ <reference key="source" ref="179209629"/>
+ <reference key="destination" ref="457698766"/>
</object>
- <int key="connectionID">791</int>
+ <int key="connectionID">800</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">appTable</string>
+ <string key="label">appManager</string>
<reference key="source" ref="976324537"/>
- <reference key="destination" ref="355779344"/>
+ <reference key="destination" ref="457698766"/>
</object>
- <int key="connectionID">792</int>
+ <int key="connectionID">801</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -4020,12 +4040,6 @@
<reference key="parent" ref="230306224"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">784</int>
- <reference key="object" ref="106816411"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Gesture Table Delegate - Current Application</string>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">757</int>
<reference key="object" ref="97419981"/>
<reference key="parent" ref="0"/>
@@ -4081,6 +4095,12 @@
<reference key="object" ref="761828323"/>
<reference key="parent" ref="726961961"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">793</int>
+ <reference key="object" ref="457698766"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Application Manager</string>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -4360,11 +4380,13 @@
<string>773.IBPluginDependency</string>
<string>774.IBPluginDependency</string>
<string>775.IBPluginDependency</string>
+ <string>776.IBPluginDependency</string>
+ <string>779.IBPluginDependency</string>
<string>78.IBPluginDependency</string>
<string>78.ImportedFromIB2</string>
- <string>784.IBPluginDependency</string>
<string>79.IBPluginDependency</string>
<string>79.ImportedFromIB2</string>
+ <string>793.IBPluginDependency</string>
<string>80.IBPluginDependency</string>
<string>80.ImportedFromIB2</string>
<string>81.IBEditorWindowLastContentRect</string>
@@ -4658,12 +4680,14 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1"/>
<string>{{452, 109}, {196, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
@@ -4688,9 +4712,104 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">792</int>
+ <int key="maxID">801</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">ApplicationManager</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/ApplicationManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">CommandTypeDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/CommandTypeDelegate.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSDocument</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>printDocument:</string>
+ <string>revertDocumentToSaved:</string>
+ <string>runPageLayout:</string>
+ <string>saveDocument:</string>
+ <string>saveDocumentAs:</string>
+ <string>saveDocumentTo:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>printDocument:</string>
+ <string>revertDocumentToSaved:</string>
+ <string>runPageLayout:</string>
+ <string>saveDocument:</string>
+ <string>saveDocumentAs:</string>
+ <string>saveDocumentTo:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">printDocument:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">revertDocumentToSaved:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">runPageLayout:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocument:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocumentAs:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocumentTo:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/NSDocument.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">iStrokeAppDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/iStrokeAppDelegate.h</string>
+ </object>
+ </object>
+ </object>
</object>
- <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
Please sign in to comment.
Something went wrong with that request. Please try again.