Changeset 226


Ignore:
Timestamp:
05/17/06 05:25:05 (19 years ago)
Author:
rchin
Message:

Added a new "Browser for target..." at the top level FSA menu so that you can now open an object browser directly without opening a workspace (not everyone cares about smalltalk, unfortunantely).

Location:
trunk/Cocoa/F-Script Anywhere/Source
Files:
4 edited

Legend:

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

    r224 r226  
    4040}
    4141
     42- (id)initShowingInterpreter:(BOOL)showInterpreter;
     43
    4244- (IBAction)setFloating:(id)sender;
    4345- (IBAction)FSA_associateWithInterface:(id)sender;
  • trunk/Cocoa/F-Script Anywhere/Source/FSAController.m

    r224 r226  
    104104            item = [fsaMenu addItemWithTitle: NSLocalizedStringFromTableInBundle(@"New F-Script Workspace", @"FSA", bundle, @"Title of F-Script Workspace menu item") action:@selector(createInterpreterWindow:) keyEquivalent: @""];
    105105            [item setTarget: self];
     106            item = [fsaMenu addItemWithTitle: NSLocalizedStringFromTableInBundle(@"Browser for Target...", @"FSA", bundle, @"Title of F-Script Workspace menu item") action:@selector(createBrowserForSelection:) keyEquivalent: @""];
     107            [item setTarget: self];
    106108            [fsaMenu addItem: [NSMenuItem separatorItem]];
    107             item = [fsaMenu addItemWithTitle: NSLocalizedStringFromTableInBundle(@"About F-Script Anywhere...", @"FSA", bundle, @"Title of Info Panel menu item") action:@selector(showInfo:) keyEquivalent: @""];
     109            item = [fsaMenu addItemWithTitle: NSLocalizedStringFromTableInBundle(@"About F-Script Anywhere", @"FSA", bundle, @"Title of Info Panel menu item") action:@selector(showInfo:) keyEquivalent: @""];
    108110            [item setTarget: self];
    109111            [[FSAWindowManager sharedManager] setWindowMenu: fsaMenu];
     
    118120    NSAssert([menuItem target] == self, @"menu item does not target FSAController!");
    119121    sel = [menuItem action];
    120     if (sel == @selector(showInfo:) || sel == @selector(createInterpreterWindow:)) return YES;
     122    if (sel == @selector(showInfo:) || sel == @selector(createInterpreterWindow:) || sel == @selector(createBrowserForSelection:)) return YES;
    121123    FSALog(@"+[FSAController validateMenuItem:] unknown menu item for validation: %@", menuItem);
    122124    return NO;
     
    125127+ (void)createInterpreterWindow:(id)sender;
    126128{
    127     [[self alloc] init];
     129    [[self alloc] initShowingInterpreter:YES];
     130}
     131
     132+ (void)createBrowserForSelection:(id)sender;
     133{
     134    [[[self alloc] initShowingInterpreter:NO] FSA_associateAndOpenBrowser:sender];
    128135}
    129136
     
    136143}
    137144
    138 - (id)init {
     145- (id)initShowingInterpreter:(BOOL)showInterpreter {
    139146    self = [super initWithWindowNibName: @"FSAInterpreterPanel"];
    140 
     147   
    141148    if (self != nil) {
    142149        NSWindow *window = [self window];
    143150        NSString *label;
    144151        static unsigned numInterpWindows = 0;
    145 
    146         NSAssert(window != nil, @"Can't get interpreter window!");
    147         if (interpreterNum == 0) interpreterNum = ++numInterpWindows;
    148         if ( (label = [self interpreterLabel]) != nil) {
    149             [window setTitle: [NSString stringWithFormat: @"%@: %@", [window title], label]];
    150         }
    151 
    152         [window setLevel: NSNormalWindowLevel]; // XXX if set floating, it is globally floating!
    153         [self showWindow: self];
    154         [window makeKeyAndOrderFront: self];
     152       
     153        if(showInterpreter){
     154            NSAssert(window != nil, @"Can't get interpreter window!");
     155            if (interpreterNum == 0) interpreterNum = ++numInterpWindows;
     156            if ( (label = [self interpreterLabel]) != nil) {
     157                [window setTitle: [NSString stringWithFormat: @"%@: %@", [window title], label]];
     158            }
     159           
     160            [window setLevel: NSNormalWindowLevel]; // XXX if set floating, it is globally floating!
     161            [self showWindow: self];
     162            [window makeKeyAndOrderFront: self];
    155163#warning this should go away when F-Script properly accepts firstResponder on the InterpreterView
    156         [window makeFirstResponder: (NSView *)[[[self interpreterView] cliView] shellView]];
    157         [[FSAWindowManager sharedManager] registerWindow: window];
    158         system = [[[self interpreterView] interpreter] objectForIdentifier: @"sys" found: NULL];
    159         [system retain];
    160         NSAssert1([system isKindOfClass: [System class]], @"Initial value bound to identifier 'sys' is not a System object, but %@", system);
     164            [window makeFirstResponder: (NSView *)[[[self interpreterView] cliView] shellView]];
     165            [[FSAWindowManager sharedManager] registerWindow: window];
     166        }
     167        system = [[[self interpreterView] interpreter] objectForIdentifier: @"sys" found: NULL];
     168        [system retain];
     169        NSAssert1([system isKindOfClass: [System class]], @"Initial value bound to identifier 'sys' is not a System object, but %@", system);
    161170    }
    162171   
     
    211220}
    212221
    213 - (IBAction)FSA_associateWithInterface:(id)sender;
    214 {
    215     NS_DURING
    216         FSAWindowManager *wm = [FSAWindowManager sharedManager];
    217         if (viewAssociationController == nil) {
    218             viewAssociationController = [[FSAViewAssociationController alloc] initWithFSAController: self];
    219         }
    220         [viewAssociationController showWindow: self];
    221         if (![wm windowIsRegistered: [viewAssociationController window]]) {
    222             [wm registerSubordinateWindow: [viewAssociationController window]
    223                                 forWindow: [self window]];
    224         }
    225     NS_HANDLER
    226         FSALog(@"%@", localException);
    227     NS_ENDHANDLER
    228 }
    229 
    230222@end
Note: See TracChangeset for help on using the changeset viewer.