Ignore:
Timestamp:
10/20/02 05:39:33 (22 years ago)
Author:
Nicholas Riley
Message:

F-Script Anywhere 1.1.6d1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/F-Script Anywhere/Source/FSAController.m

    r14 r19  
    2828#import "FSAViewAssociationController.h"
    2929#import "FSAnywhere.h"
     30#import "FSAWindowManager.h"
    3031#import <FScript/FSInterpreter.h>
    3132
     
    107108            item = [fsaMenu addItemWithTitle: NSLocalizedStringFromTableInBundle(@"About F-Script AnywhereÉ", @"FSA", bundle, @"Title of Info Panel menu item") action:@selector(showInfo:) keyEquivalent: @""];
    108109            [item setTarget: self];
     110            [[FSAWindowManager sharedManager] setWindowMenu: fsaMenu];
    109111        }
    110112    }
     
    118120    sel = [menuItem action];
    119121    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);
    121123    return NO;
    122124}
     
    129131+ (void)showInfo:(id)sender;
    130132{
    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);
    132134    if (result == NSAlertAlternateReturn) {
    133135        [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: FSA_FScriptURL]];
     
    144146
    145147    if (self != nil) {
    146         NSString *appName = nil;
    147148        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;
    150185        NS_DURING
    151186            appName = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleName"];
     
    153188            FSALog(@"Exception occurred while trying to obtain application name: %@", localException);
    154189        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];
    176194}
    177195
     
    194212{
    195213    NS_DURING
     214        FSAWindowManager *wm = [FSAWindowManager sharedManager];
    196215        if (viewAssociationController == nil) {
    197216            viewAssociationController = [[FSAViewAssociationController alloc] initWithFSAController: self];
    198217        }
    199218        [viewAssociationController showWindow: self];
     219        if (![wm windowIsRegistered: [viewAssociationController window]]) {
     220            [wm registerSubordinateWindow: [viewAssociationController window]
     221                                forWindow: [self window]];
     222        }
    200223    NS_HANDLER
    201224        FSALog(@"%@", localException);
Note: See TracChangeset for help on using the changeset viewer.