Changeset 425


Ignore:
Timestamp:
Jun 22, 2006, 12:10:37 AM (16 years ago)
Author:
livings124
Message:

Remember selected inspector tab.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Defaults.plist

    r310 r425  
    2929        <key>History</key>
    3030        <array/>
     31        <key>InfoTab</key>
     32        <string>Info</string>
    3133        <key>InfoVisible</key>
    3234        <false/>
  • trunk/macosx/InfoWindowController.m

    r418 r425  
    4444#define TAB_FILES_HEIGHT 250.0
    4545
     46@interface InfoWindowController (Private)
     47
     48- (void) setWindowForTab: (NSString *) identifier animate: (BOOL) animate;
     49
     50@end
     51
    4652@implementation InfoWindowController
    4753
     
    6167    [window setFrameUsingName: @"InspectorWindowFrame"];
    6268   
    63     NSRect frame = [window frame];
    64     float difference = TAB_INFO_HEIGHT - [[[fTabView selectedTabViewItem] view] frame].size.height;
    65     frame.origin.y -= difference;
    66     frame.size.height += difference;
    67     [window setFrame: frame display: YES];
    68    
    69     [window setMinSize: NSMakeSize(MIN_WINDOW_WIDTH, frame.size.height)];
    70     [window setMaxSize: NSMakeSize(MAX_WINDOW_WIDTH, frame.size.height)];
     69    NSString * identifier = [[NSUserDefaults standardUserDefaults] stringForKey: @"InfoTab"];
     70    [fTabView selectTabViewItemWithIdentifier: identifier];
     71    [self setWindowForTab: identifier animate: NO];
    7172}
    7273
     
    321322- (void) tabView: (NSTabView *) tabView didSelectTabViewItem: (NSTabViewItem *) tabViewItem
    322323{
     324    NSString * identifier = [tabViewItem identifier];
     325    [self setWindowForTab: identifier animate: YES];
     326    [[NSUserDefaults standardUserDefaults] setObject: identifier forKey: @"InfoTab"];
     327}
     328
     329- (void) setWindowForTab: (NSString *) identifier animate: (BOOL) animate
     330{
    323331    NSWindow * window = [self window];
    324332    NSRect frame = [window frame];
    325333
    326334    float height;
    327     NSString * identifier = [tabViewItem identifier];
    328     if ([identifier isEqualToString: TAB_INFO_IDENT])
    329         height = TAB_INFO_HEIGHT;
    330     else if ([identifier isEqualToString: TAB_ACTIVITY_IDENT])
     335   
     336    if ([identifier isEqualToString: TAB_ACTIVITY_IDENT])
    331337        height = TAB_ACTIVITY_HEIGHT;
    332338    else if ([identifier isEqualToString: TAB_OPTIONS_IDENT])
    333339        height = TAB_OPTIONS_HEIGHT;
    334     else
     340    else if ([identifier isEqualToString: TAB_FILES_IDENT])
    335341        height = TAB_FILES_HEIGHT;
    336    
    337     NSView * view = [tabViewItem view];
     342    else
     343        height = TAB_INFO_HEIGHT;
     344   
     345    NSView * view = [[fTabView selectedTabViewItem] view];
    338346    float difference = height - [view frame].size.height;
    339347    frame.origin.y -= difference;
    340348    frame.size.height += difference;
    341349   
    342     [view setHidden: YES];
    343     [window setFrame: frame display: YES animate: YES];
    344     [view setHidden: NO];
     350    if (animate)
     351    {
     352        [view setHidden: YES];
     353        [window setFrame: frame display: YES animate: YES];
     354        [view setHidden: NO];
     355    }
     356    else
     357        [window setFrame: frame display: YES];
    345358   
    346359    [window setMinSize: NSMakeSize(MIN_WINDOW_WIDTH, frame.size.height)];
Note: See TracChangeset for help on using the changeset viewer.