Changeset 276
- Timestamp:
- 01/01/08 11:31:24 (1 year ago)
- Files:
-
- trunk/cocoa/JRShellView/JRShellView.h (modified) (1 diff)
- trunk/cocoa/JRShellView/JRShellView.m (modified) (4 diffs)
- trunk/cocoa/JRShellView/JRShellViewDemo/AppController.h (modified) (1 diff)
- trunk/cocoa/JRShellView/JRShellViewDemo/AppController.m (modified) (1 diff)
- trunk/cocoa/JRShellView/JRShellViewDemo/English.lproj/MainMenu.nib/classes.nib (modified) (1 diff)
- trunk/cocoa/JRShellView/JRShellViewDemo/English.lproj/MainMenu.nib/info.nib (modified) (1 diff)
- trunk/cocoa/JRShellView/JRShellViewDemo/English.lproj/MainMenu.nib/keyedobjects.nib (modified) (previous)
- trunk/cocoa/JRShellView/JRShellViewDemo/JRShellViewDemo.xcodeproj/wolf.mode1v3 (modified) (13 diffs)
- trunk/cocoa/JRShellView/JRShellViewDemo/JRShellViewDemo.xcodeproj/wolf.pbxuser (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cocoa/JRShellView/JRShellView.h
r271 r276 1 1 #import <Cocoa/Cocoa.h> 2 2 3 @protocol JRShellViewCommandHandler <NSObject> 4 - (NSString*)executeCommand:(NSString*)command_ errorString:(NSString**)errorString_; 5 //TODO probably a category - (NSString*)rewriteCommand:(NSString*)command_; 6 @end 7 3 8 @interface JRShellView : NSTextView { 4 NSMutableArray *commandHistory; 5 unsigned currentCommandHistoryIndex; 9 unsigned commandStart; 6 10 7 unsigned commandStart; 8 NSString *uncompletedCommand; 11 NSString *uncompletedCommand; 12 13 NSMutableArray *commandHistory; 14 unsigned currentCommandHistoryIndex; 15 16 id<JRShellViewCommandHandler> commandHandler; 9 17 } 10 18 19 - (id<JRShellViewCommandHandler>)commandHandler; 20 - (void)setCommandHandler:(id<JRShellViewCommandHandler>)handler_; 21 11 22 @end trunk/cocoa/JRShellView/JRShellView.m
r275 r276 2 2 3 3 @interface NSText (UndocumentedSelectionMovement) 4 // see: 5 // <http://www.hcs.harvard.edu/~jrus/Site/System%20Bindings.html> 6 // <http://www.lsmason.com/articles/macosxkeybindings.html> 4 7 - (IBAction)moveParagraphBackwardAndModifySelection:(id)sender; 5 8 - (IBAction)moveToBeginningOfDocumentAndModifySelection:(id)sender; … … 53 56 } 54 57 58 - (id<JRShellViewCommandHandler>)commandHandler { 59 return commandHandler; 60 } 61 62 - (void)setCommandHandler:(id<JRShellViewCommandHandler>)handler_ { 63 commandHandler = handler_; // Not retained. 64 } 65 55 66 - (void)keyDown:(NSEvent*)event_ { 56 67 if ([event_ type] != NSKeyDown || ![[event_ characters] length]) { … … 79 90 - (void)insertNewline:(id)sender_ { // return 80 91 NSString *cmd = [self calcCurrentCommandString]; 92 NSString *cmdResult = nil, *errorString = nil; 81 93 if (cmd) { 82 // TODO cmd = [commandHandler rewriteCommand ];83 // TODO result = [commandHandler executeCommand];94 // TODO cmd = [commandHandler rewriteCommand:cmd]; 95 cmdResult = [commandHandler executeCommand:cmd errorString:&errorString]; 84 96 [commandHistory addObject:cmd]; 85 97 currentCommandHistoryIndex = NSNotFound; … … 87 99 [super setSelectedRange:NSMakeRange([[self string] length],0)]; // Go to end of command in case return was issued elsewhere. 88 100 [super insertNewline:sender_]; 89 // TODO output 101 if (errorString) { 102 [super insertText:errorString]; 103 [super insertNewline:sender_]; 104 } else { 105 if (cmdResult) { 106 [super insertText:cmdResult]; 107 [super insertNewline:sender_]; 108 } 109 } 90 110 [self insertPrompt]; 91 111 } trunk/cocoa/JRShellView/JRShellViewDemo/AppController.h
r271 r276 1 // 2 // AppController.h 3 // JRShellViewDemo 4 // 5 // Created by wolf on 12/31/07. 6 // Copyright __MyCompanyName__ 2007. All rights reserved. 7 // 1 #import <Cocoa/Cocoa.h> 2 #import "JRShellView.h" 8 3 9 #import <Cocoa/Cocoa.h> 10 11 @interface AppController : NSObject { 12 4 @interface AppController : NSObject <JRShellViewCommandHandler> { 5 IBOutlet JRShellView *shellView; 13 6 } 14 7 trunk/cocoa/JRShellView/JRShellViewDemo/AppController.m
r271 r276 1 //2 // AppController.m3 // JRShellViewDemo4 //5 // Created by wolf on 12/31/07.6 // Copyright __MyCompanyName__ 2007. All rights reserved.7 //8 9 1 #import "AppController.h" 10 2 11 3 @implementation AppController 4 5 - (void)awakeFromNib { 6 [shellView setCommandHandler:self]; 7 } 8 9 - (NSString*)executeCommand:(NSString*)command_ errorString:(NSString**)errorString_ { 10 if ([command_ isEqualToString:@"rentzsch"]) { 11 *errorString_ = @"rentzsch is obviously already reversed or something. I mean, seriously check those consonants."; 12 return nil; 13 } else { 14 unsigned charIndex = 0, charCount = [command_ length]; 15 unichar *input = (unichar*)[[NSMutableData dataWithCapacity:charCount * sizeof(unichar)] mutableBytes]; 16 [command_ getCharacters:input]; 17 unichar *output = (unichar*)[[NSMutableData dataWithCapacity:charCount * sizeof(unichar)] mutableBytes]; 18 for (; charIndex < charCount; charIndex++) { 19 output[charCount-charIndex-1] = input[charIndex]; 20 } 21 return [NSString stringWithCharacters:output length:charCount]; 22 } 23 } 12 24 13 25 - (void)applicationDidFinishLaunching:(NSNotification*)notification_ { trunk/cocoa/JRShellView/JRShellViewDemo/English.lproj/MainMenu.nib/classes.nib
r271 r276 26 26 <key>LANGUAGE</key> 27 27 <string>ObjC</string> 28 <key>OUTLETS</key> 29 <dict> 30 <key>shellView</key> 31 <string>JRShellView</string> 32 </dict> 28 33 <key>SUPERCLASS</key> 29 34 <string>NSObject</string> trunk/cocoa/JRShellView/JRShellViewDemo/English.lproj/MainMenu.nib/info.nib
r271 r276 11 11 <key>IBOpenObjects</key> 12 12 <array> 13 <integer>21 2</integer>13 <integer>21</integer> 14 14 </array> 15 15 <key>IBSystem Version</key> trunk/cocoa/JRShellView/JRShellViewDemo/JRShellViewDemo.xcodeproj/wolf.mode1v3
r271 r276 198 198 <array/> 199 199 <key>OpenEditors</key> 200 <array> 201 <dict> 202 <key>Content</key> 203 <dict> 204 <key>PBXProjectModuleGUID</key> 205 <string>79AEA9BA0D29CC6E00A2C50F</string> 206 <key>PBXProjectModuleLabel</key> 207 <string>JRShellView.m</string> 208 <key>PBXSplitModuleInNavigatorKey</key> 209 <dict> 210 <key>Split0</key> 211 <dict> 212 <key>PBXProjectModuleGUID</key> 213 <string>79AEA9BB0D29CC6E00A2C50F</string> 214 <key>PBXProjectModuleLabel</key> 215 <string>JRShellView.m</string> 216 <key>_historyCapacity</key> 217 <integer>0</integer> 218 <key>bookmark</key> 219 <string>79AEA9BC0D29CC6E00A2C50F</string> 220 <key>history</key> 221 <array> 222 <string>79AEA9AC0D29CB8500A2C50F</string> 223 </array> 224 </dict> 225 <key>SplitCount</key> 226 <string>1</string> 227 </dict> 228 <key>StatusBarVisibility</key> 229 <true/> 230 </dict> 231 <key>Geometry</key> 232 <dict> 233 <key>Frame</key> 234 <string>{{0, 20}, {1046, 730}}</string> 235 <key>PBXModuleWindowStatusBarHidden2</key> 236 <false/> 237 <key>RubberWindowFrame</key> 238 <string>78 756 1046 771 0 0 2560 1578 </string> 239 </dict> 240 </dict> 241 <dict> 242 <key>Content</key> 243 <dict> 244 <key>PBXProjectModuleGUID</key> 245 <string>79AEA9BD0D29CC6E00A2C50F</string> 246 <key>PBXProjectModuleLabel</key> 247 <string>JRShellView.h</string> 248 <key>PBXSplitModuleInNavigatorKey</key> 249 <dict> 250 <key>Split0</key> 251 <dict> 252 <key>PBXProjectModuleGUID</key> 253 <string>79AEA9BE0D29CC6E00A2C50F</string> 254 <key>PBXProjectModuleLabel</key> 255 <string>JRShellView.h</string> 256 <key>_historyCapacity</key> 257 <integer>0</integer> 258 <key>bookmark</key> 259 <string>79AEA9C00D29CC6E00A2C50F</string> 260 <key>history</key> 261 <array> 262 <string>79AEA9BF0D29CC6E00A2C50F</string> 263 </array> 264 </dict> 265 <key>SplitCount</key> 266 <string>1</string> 267 </dict> 268 <key>StatusBarVisibility</key> 269 <true/> 270 </dict> 271 <key>Geometry</key> 272 <dict> 273 <key>Frame</key> 274 <string>{{0, 20}, {1046, 730}}</string> 275 <key>PBXModuleWindowStatusBarHidden2</key> 276 <false/> 277 <key>RubberWindowFrame</key> 278 <string>38 781 1046 771 0 0 2560 1578 </string> 279 </dict> 280 </dict> 281 </array> 200 <array/> 282 201 <key>PerspectiveWidths</key> 283 202 <array> … … 356 275 <array> 357 276 <array> 358 <integer> 4</integer>277 <integer>2</integer> 359 278 <integer>1</integer> 360 279 <integer>0</integer> … … 426 345 </dict> 427 346 <dict> 428 <key>BecomeActive</key>429 <true/>430 347 <key>ContentConfiguration</key> 431 348 <dict> … … 464 381 <key>TableOfContents</key> 465 382 <array> 466 <string>79 AEA9A10D29CB0A00A2C50F</string>383 <string>794053AA0D2AFF9A00976130</string> 467 384 <string>1CE0B1FE06471DED0097A5F4</string> 468 <string>79 AEA9A20D29CB0A00A2C50F</string>385 <string>794053AB0D2AFF9A00976130</string> 469 386 <string>1CE0B20306471E060097A5F4</string> 470 387 <string>1CE0B20506471E060097A5F4</string> … … 600 517 <key>WindowOrderList</key> 601 518 <array> 602 <string>79AEA9C10D29CC6E00A2C50F</string> 603 <string>79AEA9C20D29CC6E00A2C50F</string> 604 <string>79AEA9C30D29CC6E00A2C50F</string> 519 <string>794053D20D2B029600976130</string> 520 <string>794053C20D2B018D00976130</string> 521 <string>794053C30D2B018D00976130</string> 522 <string>794053C40D2B018D00976130</string> 605 523 <string>1C78EAAD065D492600B07095</string> 606 524 <string>1CD10A99069EF8BA00B06720</string> 607 525 <string>79AEA9B00D29CC0E00A2C50F</string> 608 <string>79 AEA9BD0D29CC6E00A2C50F</string>526 <string>7940539F0D2AFF8300976130</string> 609 527 <string>79AEA9BA0D29CC6E00A2C50F</string> 610 528 <string>/Users/wolf/code/trac/cocoa/JRShellView/JRShellViewDemo/JRShellViewDemo.xcodeproj</string> … … 688 606 <array> 689 607 <string>79AEA9B00D29CC0E00A2C50F</string> 690 <string>79 AEA9B10D29CC0E00A2C50F</string>608 <string>794053AE0D2AFF9A00976130</string> 691 609 <string>1CD0528F0623707200166675</string> 692 610 <string>XCMainBuildResultsModuleGUID</string> … … 730 648 <key>sizes</key> 731 649 <array> 732 <string>{{0, 0}, {316, 1 85}}</string>733 <string>{{316, 0}, {378, 1 85}}</string>650 <string>{{0, 0}, {316, 198}}</string> 651 <string>{{316, 0}, {378, 198}}</string> 734 652 </array> 735 653 </dict> … … 746 664 <key>sizes</key> 747 665 <array> 748 <string>{{0, 0}, {694, 1 85}}</string>749 <string>{{0, 1 85}, {694, 196}}</string>666 <string>{{0, 0}, {694, 198}}</string> 667 <string>{{0, 198}, {694, 183}}</string> 750 668 </array> 751 669 </dict> … … 780 698 </array> 781 699 <key>Frame</key> 782 <string>{{316, 0}, {378, 1 85}}</string>700 <string>{{316, 0}, {378, 198}}</string> 783 701 <key>RubberWindowFrame</key> 784 <string> 99 1082694 422 0 0 2560 1578 </string>702 <string>1319 1019 694 422 0 0 2560 1578 </string> 785 703 </dict> 786 704 <key>RubberWindowFrame</key> 787 <string> 99 1082694 422 0 0 2560 1578 </string>705 <string>1319 1019 694 422 0 0 2560 1578 </string> 788 706 </dict> 789 707 <key>Module</key> … … 808 726 <array> 809 727 <string>1CD10A99069EF8BA00B06720</string> 810 <string>79 AEA9B20D29CC0E00A2C50F</string>728 <string>794053AF0D2AFF9A00976130</string> 811 729 <string>1C162984064C10D400B95A72</string> 812 <string>79 AEA9B30D29CC0E00A2C50F</string>813 <string>79 AEA9B40D29CC0E00A2C50F</string>814 <string>79 AEA9B50D29CC0E00A2C50F</string>815 <string>79 AEA9B60D29CC0E00A2C50F</string>816 <string>79 AEA9B70D29CC0E00A2C50F</string>730 <string>794053B00D2AFF9A00976130</string> 731 <string>794053B10D2AFF9A00976130</string> 732 <string>794053B20D2AFF9A00976130</string> 733 <string>794053B30D2AFF9A00976130</string> 734 <string>794053B40D2AFF9A00976130</string> 817 735 </array> 818 736 <key>ToolbarConfiguration</key> 819 737 <string>xcode.toolbar.config.debugV3</string> 820 738 <key>WindowString</key> 821 <string> 99 1082694 422 0 0 2560 1578 </string>739 <string>1319 1019 694 422 0 0 2560 1578 </string> 822 740 <key>WindowToolGUID</key> 823 741 <string>1CD10A99069EF8BA00B06720</string> … … 953 871 <string>{{0, 0}, {650, 209}}</string> 954 872 <key>RubberWindowFrame</key> 955 <string> 99 1254650 250 0 0 2560 1578 </string>873 <string>1744 1042 650 250 0 0 2560 1578 </string> 956 874 </dict> 957 875 <key>Module</key> … … 976 894 <array> 977 895 <string>1C78EAAD065D492600B07095</string> 978 <string>79 AEA9B80D29CC0E00A2C50F</string>896 <string>794053B50D2AFF9A00976130</string> 979 897 <string>1C78EAAC065D492600B07095</string> 980 898 </array> … … 982 900 <string>xcode.toolbar.config.consoleV3</string> 983 901 <key>WindowString</key> 984 <string> 99 1254650 250 0 0 2560 1578 </string>902 <string>1744 1042 650 250 0 0 2560 1578 </string> 985 903 <key>WindowToolGUID</key> 986 904 <string>1C78EAAD065D492600B07095</string> trunk/cocoa/JRShellView/JRShellViewDemo/JRShellViewDemo.xcodeproj/wolf.pbxuser
r271 r276 8 8 addToTargets = ( 9 9 8D1107260486CEB800E47090 /* JRShellViewDemo */, 10 ); 11 breakpoints = ( 10 12 ); 11 13 codeSenseManager = 79AEA9A50D29CB0A00A2C50F /* Code sense */; … … 21 23 243, 22 24 20, 23 48 .16259765625,25 48, 24 26 43, 25 27 43, … … 36 38 ); 37 39 }; 38 PBXPerProjectTemplateStateSaveDate = 220842757; 39 PBXWorkspaceStateSaveDate = 220842757; 40 }; 41 perUserProjectItems = { 42 79AEA9AC0D29CB8500A2C50F /* PBXBookmark */ = 79AEA9AC0D29CB8500A2C50F /* PBXBookmark */; 43 79AEA9BC0D29CC6E00A2C50F /* PBXTextBookmark */ = 79AEA9BC0D29CC6E00A2C50F /* PBXTextBookmark */; 44 79AEA9BF0D29CC6E00A2C50F /* PBXTextBookmark */ = 79AEA9BF0D29CC6E00A2C50F /* PBXTextBookmark */; 45 79AEA9C00D29CC6E00A2C50F /* PBXTextBookmark */ = 79AEA9C00D29CC6E00A2C50F /* PBXTextBookmark */; 40 PBXPerProjectTemplateStateSaveDate = 220921734; 41 PBXWorkspaceStateSaveDate = 220921734; 46 42 }; 47 43 sourceControlManager = 79AEA9A40D29CB0A00A2C50F /* Source Control */; 48 44 userBuildSettings = { 45 }; 46 }; 47 795A7F90099D0E3600450061 /* AppController.h */ = { 48 uiCtxt = { 49 sepNavIntBoundsRect = "{{0, 0}, {997, 1223}}"; 50 sepNavSelRange = "{86, 25}"; 51 sepNavVisRange = "{0, 160}"; 52 sepNavWindowFrame = "{{775, 156}, {1056, 1350}}"; 53 }; 54 }; 55 795A7F91099D0E3600450061 /* AppController.m */ = { 56 uiCtxt = { 57 sepNavIntBoundsRect = "{{0, 0}, {997, 1246}}"; 58 sepNavSelRange = "{383, 0}"; 59 sepNavVisRange = "{0, 1041}"; 60 sepNavWindowFrame = "{{746, 173}, {1056, 1350}}"; 49 61 }; 50 62 }; … … 90 102 79AEA9A60D29CB1100A2C50F /* JRShellView.m */ = { 91 103 uiCtxt = { 92 sepNavIntBoundsRect = "{{0, 0}, {9 87, 7700}}";93 sepNavSelRange = "{ 599, 0}";94 sepNavVisRange = "{ 0, 1048}";95 sepNavWindowFrame = "{{ 78, 724}, {1046, 803}}";104 sepNavIntBoundsRect = "{{0, 0}, {997, 6538}}"; 105 sepNavSelRange = "{3135, 0}"; 106 sepNavVisRange = "{1592, 3140}"; 107 sepNavWindowFrame = "{{838, 185}, {1056, 1350}}"; 96 108 }; 97 109 }; … … 99 111 uiCtxt = { 100 112 sepNavIntBoundsRect = "{{0, 0}, {987, 699}}"; 101 sepNavSelRange = "{ 0, 0}";102 sepNavVisRange = "{0, 236}";103 sepNavWindowFrame = "{{ 38, 749}, {1046, 803}}";113 sepNavSelRange = "{72, 85}"; 114 sepNavVisRange = "{0, 694}"; 115 sepNavWindowFrame = "{{810, 744}, {1046, 803}}"; 104 116 }; 105 };106 79AEA9AC0D29CB8500A2C50F /* PBXBookmark */ = {107 isa = PBXBookmark;108 fRef = 79AEA9A60D29CB1100A2C50F /* JRShellView.m */;109 };110 79AEA9BC0D29CC6E00A2C50F /* PBXTextBookmark */ = {111 isa = PBXTextBookmark;112 fRef = 79AEA9A60D29CB1100A2C50F /* JRShellView.m */;113 name = "JRShellView.m: 22";114 rLen = 0;115 rLoc = 599;116 rType = 0;117 vrLen = 1048;118 vrLoc = 0;119 };120 79AEA9BF0D29CC6E00A2C50F /* PBXTextBookmark */ = {121 isa = PBXTextBookmark;122 fRef = 79AEA9A70D29CB1100A2C50F /* JRShellView.h */;123 rLen = 0;124 rLoc = 9223372036854775807;125 rType = 0;126 };127 79AEA9C00D29CC6E00A2C50F /* PBXTextBookmark */ = {128 isa = PBXTextBookmark;129 fRef = 79AEA9A70D29CB1100A2C50F /* JRShellView.h */;130 name = "JRShellView.h: 1";131 rLen = 0;132 rLoc = 0;133 rType = 0;134 vrLen = 236;135 vrLoc = 0;136 117 }; 137 118 8D1107260486CEB800E47090 /* JRShellViewDemo */ = {
