Changeset 19 for trunk/Cocoa/F-Script Anywhere/Source/FSAController.m
- Timestamp:
- 10/20/02 05:39:33 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/F-Script Anywhere/Source/FSAController.m
r14 r19 28 28 #import "FSAViewAssociationController.h" 29 29 #import "FSAnywhere.h" 30 #import "FSAWindowManager.h" 30 31 #import <FScript/FSInterpreter.h> 31 32 … … 107 108 item = [fsaMenu addItemWithTitle: NSLocalizedStringFromTableInBundle(@"About F-Script AnywhereÉ", @"FSA", bundle, @"Title of Info Panel menu item") action:@selector(showInfo:) keyEquivalent: @""]; 108 109 [item setTarget: self]; 110 [[FSAWindowManager sharedManager] setWindowMenu: fsaMenu]; 109 111 } 110 112 } … … 118 120 sel = [menuItem action]; 119 121 if (sel == @selector(showInfo:) || sel == @selector(createInterpreterWindow:)) return YES; 120 FSALog(@" -[FSAController validateMenuItem:] unknown menu item for validation: %@", menuItem);122 FSALog(@"+[FSAController validateMenuItem:] unknown menu item for validation: %@", menuItem); 121 123 return NO; 122 124 } … … 129 131 + (void)showInfo:(id)sender; 130 132 { 131 int result = NSRunInformationalAlertPanel( @"About F-Script Anywhere", @"F-Script Anywhere lets you embed a F-Script interpreter in a Cocoa application while it is running.\n\nF-Script Anywhere is currently installed in this application. To remove it, quit this application.\n\nFor more information about F-Script, please visit its Web site %@.", @"OK", @"Visit Web Site", nil, FSA_FScriptURL);133 int result = NSRunInformationalAlertPanel([NSString stringWithFormat: @"About F-Script Anywhere (version %s)", FSA_VERSION], @"F-Script Anywhere lets you embed a F-Script interpreter in a Cocoa application while it is running.\n\nF-Script Anywhere is currently installed in this application. To remove it, quit this application.\n\nFor more information about F-Script, please visit its Web site %@.", @"OK", @"Visit Web Site", nil, FSA_FScriptURL); 132 134 if (result == NSAlertAlternateReturn) { 133 135 [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: FSA_FScriptURL]]; … … 144 146 145 147 if (self != nil) { 146 NSString *appName = nil;147 148 NSWindow *window = [self window]; 148 149 NSAssert(window != nil, @"Can't get interpreter window!"); 149 NSString *label; 150 static unsigned numInterpWindows = 0; 151 152 NSAssert(window != nil, @"CanÕt get interpreter window!"); 153 if (interpreterNum == 0) interpreterNum = ++numInterpWindows; 154 if ( (label = [self interpreterLabel]) != nil) { 155 [window setTitle: [NSString stringWithFormat: @"%@: %@", [window title], label]]; 156 } 157 158 [window setLevel: NSNormalWindowLevel]; // XXX if set floating, it is globally floating! 159 [self showWindow: self]; 160 [window makeKeyAndOrderFront: self]; 161 #warning this should go away when F-Script properly accepts firstResponder on the InterpreterView 162 [window makeFirstResponder: (NSView *)[[[self interpreterView] cliView] shellView]]; 163 [[FSAWindowManager sharedManager] registerWindow: window]; 164 system = [[[self interpreterView] interpreter] objectForIdentifier: @"sys" found: NULL]; 165 [system retain]; 166 NSAssert1([system isKindOfClass: [System class]], @"Initial value bound to identifier 'sys' is not a System object, but %@", system); 167 } 168 169 return self; 170 } 171 172 - (void)dealloc; 173 { 174 [system release]; 175 [super dealloc]; 176 } 177 178 - (NSString *)interpreterLabel; 179 { 180 static NSString *appName = nil; 181 static BOOL retrievedAppName = NO; 182 183 if (appName == nil) { 184 if (retrievedAppName) return nil; 150 185 NS_DURING 151 186 appName = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleName"]; … … 153 188 FSALog(@"Exception occurred while trying to obtain application name: %@", localException); 154 189 NS_ENDHANDLER 155 if (appName != nil) { 156 [window setTitle: [NSString stringWithFormat: @"%@: %@", [window title], appName]]; 157 } 158 159 [window setLevel: NSNormalWindowLevel]; // XXX if set floating, it is globally floating! 160 [self showWindow: self]; 161 [window makeKeyAndOrderFront: self]; 162 #warning this should go away when F-Script properly accepts firstResponder on the InterpreterView 163 [window makeFirstResponder: (NSView *)[[[self interpreterView] cliView] shellView]]; 164 system = [[[self interpreterView] interpreter] objectForIdentifier: @"sys" found: NULL]; 165 [system retain]; 166 NSAssert1([system isKindOfClass: [System class]], @"Initial value bound to identifier 'sys' is not a System object, but %@", system); 167 } 168 169 return self; 170 } 171 172 - (void)dealloc; 173 { 174 [system release]; 175 [super dealloc]; 190 retrievedAppName = YES; 191 } 192 if (interpreterNum == 1) return appName; 193 return [NSString stringWithFormat: @"%@ [%u]", appName, interpreterNum]; 176 194 } 177 195 … … 194 212 { 195 213 NS_DURING 214 FSAWindowManager *wm = [FSAWindowManager sharedManager]; 196 215 if (viewAssociationController == nil) { 197 216 viewAssociationController = [[FSAViewAssociationController alloc] initWithFSAController: self]; 198 217 } 199 218 [viewAssociationController showWindow: self]; 219 if (![wm windowIsRegistered: [viewAssociationController window]]) { 220 [wm registerSubordinateWindow: [viewAssociationController window] 221 forWindow: [self window]]; 222 } 200 223 NS_HANDLER 201 224 FSALog(@"%@", localException);
Note:
See TracChangeset
for help on using the changeset viewer.