Browse files

delete action row

auto save
  • Loading branch information...
1 parent d6f2d08 commit 01ae659a9bd21997c3dc4d419637fc742636d950 @dabaopku committed Mar 11, 2012
View
12 iStroke.xcodeproj/project.pbxproj
@@ -24,7 +24,7 @@
E7727A1D14E4546C00935AE7 /* Stroke.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7727A1C14E4546C00935AE7 /* Stroke.mm */; };
E772DBF914E4424100A06FE6 /* Gesture.mm in Sources */ = {isa = PBXBuildFile; fileRef = E772DBF914E4424100A06FE5 /* Gesture.mm */; };
E7AC6F5B14E90B70008D0A2D /* DrawStrokeCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7AC6F5A14E90B70008D0A2D /* DrawStrokeCell.mm */; };
- E7BE9CCB150BD9E4002FDFAF /* ActionTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = E7BE9CCA150BD9E4002FDFAF /* ActionTableView.m */; };
+ E7BE9CCB150BD9E4002FDFAF /* ActionTableView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7BE9CCA150BD9E4002FDFAF /* ActionTableView.mm */; };
E7C4ED6F14E6DF6D006444E0 /* DrawStrokeView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7C4ED6E14E6DF6D006444E0 /* DrawStrokeView.mm */; };
E7DCA2A815064A6400915E49 /* ApplicationManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7DCA2A615064A6400915E49 /* ApplicationManager.mm */; };
E7DCA2AC15064D0400915E49 /* ApplicationOutlineView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7DCA2AB15064D0400915E49 /* ApplicationOutlineView.mm */; };
@@ -68,8 +68,8 @@
E772DBF914E4424100A06FE7 /* Gesture.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Gesture.hh; sourceTree = "<group>"; };
E7AC6F5914E90B70008D0A2D /* DrawStrokeCell.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DrawStrokeCell.hh; sourceTree = "<group>"; };
E7AC6F5A14E90B70008D0A2D /* DrawStrokeCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DrawStrokeCell.mm; sourceTree = "<group>"; };
- E7BE9CC9150BD9E4002FDFAF /* ActionTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionTableView.h; sourceTree = "<group>"; };
- E7BE9CCA150BD9E4002FDFAF /* ActionTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ActionTableView.m; sourceTree = "<group>"; };
+ E7BE9CC9150BD9E4002FDFAF /* ActionTableView.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ActionTableView.hh; sourceTree = "<group>"; };
+ E7BE9CCA150BD9E4002FDFAF /* ActionTableView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActionTableView.mm; sourceTree = "<group>"; };
E7C4ED6D14E6DF6D006444E0 /* DrawStrokeView.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DrawStrokeView.hh; sourceTree = "<group>"; };
E7C4ED6E14E6DF6D006444E0 /* DrawStrokeView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DrawStrokeView.mm; sourceTree = "<group>"; };
E7DCA2A615064A6400915E49 /* ApplicationManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ApplicationManager.mm; sourceTree = "<group>"; };
@@ -174,8 +174,8 @@
E76D7B6B14F7F7A2004DA0E5 /* Action.mm */,
E771E70E14FCEDAF00AF0524 /* Command.hh */,
E771E70F14FCEDAF00AF0524 /* Command.mm */,
- E7BE9CC9150BD9E4002FDFAF /* ActionTableView.h */,
- E7BE9CCA150BD9E4002FDFAF /* ActionTableView.m */,
+ E7BE9CC9150BD9E4002FDFAF /* ActionTableView.hh */,
+ E7BE9CCA150BD9E4002FDFAF /* ActionTableView.mm */,
);
name = Action;
sourceTree = "<group>";
@@ -297,7 +297,7 @@
E73AB3D614FFCC7B0040C595 /* NSTextFieldCell+VerticalCenter.m in Sources */,
E7DCA2A815064A6400915E49 /* ApplicationManager.mm in Sources */,
E7DCA2AC15064D0400915E49 /* ApplicationOutlineView.mm in Sources */,
- E7BE9CCB150BD9E4002FDFAF /* ActionTableView.m in Sources */,
+ E7BE9CCB150BD9E4002FDFAF /* ActionTableView.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
5 iStroke/ActionTableView.h → iStroke/ActionTableView.hh
@@ -8,9 +8,10 @@
#import <Foundation/Foundation.h>
-
+@class Application;
@interface ActionTableView : NSTableView {
-
+ Application *app;
}
+@property(retain) Application *app;
@end
View
16 iStroke/ActionTableView.m → iStroke/ActionTableView.mm
@@ -6,15 +6,17 @@
// Copyright 2012年 PKU. All rights reserved.
//
-#import "ActionTableView.h"
-
+#import "ActionTableView.hh"
+#import "Application.hh"
@implementation ActionTableView
+@synthesize app;
-(void) keyDown:(NSEvent *)event
{
BOOL deleteKeyEvent = NO;
+ BOOL dealt=NO;
if ([event type] == NSKeyDown)
{
@@ -34,9 +36,15 @@ -(void) keyDown:(NSEvent *)event
if (deleteKeyEvent)
{
- NSLog(@"Delete");
+ if([[self selectedRowIndexes] count]>0)
+ {
+ [app.actions removeObjectsAtIndexes:[self selectedRowIndexes]];
+ [self reloadData];
+ dealt=YES;
+ }
}
- else
+
+ if(!dealt)
{
[super keyDown:event];
}
View
1 iStroke/Application.mm
@@ -81,7 +81,6 @@ -(void) removeFromParent
{
if (parent) {
[parent.children removeObject:self];
- NSLog(@"delete");
}
parent=nil;
}
View
3 iStroke/ApplicationManager.hh
@@ -10,14 +10,15 @@
#import "Application.hh"
#import "NSTextFieldCell+VerticalCenter.h"
+@class ActionTableView;
@interface ApplicationManager:NSObject
<NSOutlineViewDataSource,NSOutlineViewDelegate,NSTableViewDataSource,NSTableViewDelegate> {
NSMutableArray * applications;
Application * curApp;
IBOutlet CommandTypeDelegate *commandTypeDelegate;
- IBOutlet NSTableView * gestureTableView;
+ IBOutlet ActionTableView * actionTableView;
IBOutlet NSOutlineView *applicationOutlineView;
}
View
7 iStroke/ApplicationManager.mm
@@ -8,6 +8,7 @@
#import "ApplicationManager.hh"
#import "Application.hh"
+#import "ActionTableView.hh"
@implementation ApplicationManager
@@ -147,7 +148,10 @@ -(void) load
}
if([applications count]>0)
+ {
curApp=[applications objectAtIndex:0];
+ actionTableView.app=curApp;
+ }
}
#pragma mark - NSOutlineView
@@ -196,7 +200,8 @@ -(BOOL) outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
{
[curApp release];
curApp=[item retain];
- [gestureTableView reloadData];
+ actionTableView.app=curApp;
+ [actionTableView reloadData];
return YES;
}
View
1 iStroke/ApplicationOutlineView.mm
@@ -80,7 +80,6 @@ -(void) keyDown:(NSEvent *)event
-(void) reloadData
{
[super reloadData];
- [appManager save];
[self expandItem:nil expandChildren:YES];
}
View
3 iStroke/iStrokeAppDelegate.hh
@@ -24,8 +24,7 @@
IBOutlet NSWindow *drawStrokeWindow;
IBOutlet DrawStrokeView *drawStrokeView;
IBOutlet NSTableView *tableStroke;
- IBOutlet ApplicationOutlineView *applicationOutlineView;
-
+ IBOutlet ApplicationOutlineView *applicationOutlineView;
}
@property(assign) IBOutlet NSWindow *window;
View
2 iStroke/iStrokeAppDelegate.mm
@@ -54,6 +54,8 @@ - (void)applicationWillTerminate:(NSNotification *)notification {
if(preStroke){
delete preStroke;
}
+
+ [self save:nil];
}
- (IBAction)toggleTrack:(NSButton *)sender {
View
27 iStroke/zh-Hans.lproj/MainMenu.xib
@@ -1392,7 +1392,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 362}, {391, 15}}</string>
<reference key="NSSuperview" ref="902648261"/>
- <reference key="NSNextKeyView"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="902648261"/>
<string key="NSAction">_doScroller:</string>
@@ -2110,14 +2109,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">gestureTableView</string>
- <reference key="source" ref="163057030"/>
- <reference key="destination" ref="179209629"/>
- </object>
- <int key="connectionID">817</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
<string key="label">appManager</string>
<reference key="source" ref="355779344"/>
<reference key="destination" ref="163057030"/>
@@ -2140,6 +2131,22 @@
</object>
<int key="connectionID">820</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">appManager</string>
+ <reference key="source" ref="976324537"/>
+ <reference key="destination" ref="163057030"/>
+ </object>
+ <int key="connectionID">821</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">actionTableView</string>
+ <reference key="source" ref="163057030"/>
+ <reference key="destination" ref="179209629"/>
+ </object>
+ <int key="connectionID">822</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -3646,7 +3653,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">820</int>
+ <int key="maxID">822</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>

0 comments on commit 01ae659

Please sign in to comment.