Changeset 3963

Show
Ignore:
Timestamp:
03/27/06 01:24:29 (3 years ago)
Author:
morris
Message:

Add commands to make/restore layout to default

Work in progress

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/MainMenu.nib/classes.nib

    r3957 r3963  
    4444                connect = id;  
    4545                hideConnection = id;  
     46                makeLayoutDefault = id;  
    4647                manual = id;  
    4748                nextConnection = id;  
    4849                preferences = id;  
    4950                previousConnection = id;  
     51                restoreLayoutToDefault = id;  
    5052                showDock = id;  
    5153                showTrackers = id;  
  • WiredClient/trunk/English.lproj/MainMenu.nib/info.nib

    r3957 r3963  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>440 203 412 357 0 0 1280 1002 </string> 
     6        <string>271 132 412 357 0 0 1280 1002 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
    99                <key>29</key> 
    10                 <string>143 873 614 44 0 0 1280 1002 </string> 
     10                <string>128 723 614 44 0 0 1280 1002 </string> 
    1111        </dict> 
    1212        <key>IBFramework Version</key> 
  • WiredClient/trunk/WCApplicationController.h

    r3957 r3963  
    6060- (IBAction)nextConnection:(id)sender; 
    6161- (IBAction)previousConnection:(id)sender; 
     62- (IBAction)makeLayoutDefault:(id)sender; 
     63- (IBAction)restoreLayoutToDefault:(id)sender; 
    6264 
    6365- (IBAction)manual:(id)sender; 
  • WiredClient/trunk/WCApplicationController.m

    r3957 r3963  
    300300        if(selector == @selector(hideConnection:) || 
    301301           selector == @selector(nextConnection:) || 
    302            selector == @selector(previousConnection:)) 
     302           selector == @selector(previousConnection:) || 
     303           selector == @selector(makeLayoutDefault:) || 
     304           selector == @selector(restoreLayoutToDefault:)) 
    303305                return [[WCDock dock] validateMenuItem:item]; 
    304306         
     
    498500 
    499501 
     502- (IBAction)makeLayoutDefault:(id)sender { 
     503        [[WCDock dock] makeLayoutDefault:sender]; 
     504} 
     505 
     506 
     507 
     508- (IBAction)restoreLayoutToDefault:(id)sender { 
     509        [[WCDock dock] restoreLayoutToDefault:sender]; 
     510} 
     511 
     512 
     513 
    500514#pragma mark - 
    501515 
  • WiredClient/trunk/WCConnection.h

    r3945 r3963  
    118118- (void)removeObserver:(id)target; 
    119119- (void)removeObserver:(id)target name:(NSString *)name; 
     120- (void)postNotificationName:(NSString *)name; 
    120121- (void)postNotificationName:(NSString *)name object:(id)object; 
    121122- (void)postNotificationName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo; 
  • WiredClient/trunk/WCConnectionController.m

    r3961 r3963  
    4848        NSDictionary    *windowTemplate; 
    4949         
    50         if([[self connection] bookmark]) 
    51                 windowTemplate = [WCSettings windowTemplateForKey:[[[self connection] bookmark] objectForKey:WCBookmarksIdentifier]]; 
    52         else 
    53                 windowTemplate = [WCSettings windowTemplateForKey:[[[self connection] URL] hostpair]]; 
     50        windowTemplate = [WCSettings windowTemplateForKey:[[self connection] identifier]]; 
    5451         
    5552        if(!windowTemplate) 
     
    160157                                                name:WCServerConnectionShouldUnhide]; 
    161158 
     159        [_connection addObserver:self 
     160                                        selector:@selector(_serverConnectionShouldLoadWindowTemplate:) 
     161                                                name:WCServerConnectionShouldLoadWindowTemplate]; 
     162 
     163        [_connection addObserver:self 
     164                                        selector:@selector(_serverConnectionShouldSaveWindowTemplate:) 
     165                                                name:WCServerConnectionShouldSaveWindowTemplate]; 
     166         
    162167        return self; 
    163168} 
     
    200205        if(!_hidden) 
    201206                [[self window] orderFront:self]; 
     207} 
     208 
     209 
     210 
     211- (void)_serverConnectionShouldLoadWindowTemplate:(NSNotification *)notification { 
     212        [self _loadWindowTemplate]; 
     213} 
     214 
     215 
     216 
     217- (void)_serverConnectionShouldSaveWindowTemplate:(NSNotification *)notification { 
     218        [self _saveWindowTemplate]; 
    202219} 
    203220 
     
    404421 
    405422                [connection setBookmark:bookmark]; 
     423                [connection postNotificationName:WCServerConnectionShouldSaveWindowTemplate]; 
    406424                 
    407425                [[NSNotificationCenter defaultCenter] postNotificationName:WCBookmarksDidChange]; 
  • WiredClient/trunk/WCDock.h

    r3574 r3963  
    6363- (IBAction)nextConnection:(id)sender; 
    6464- (IBAction)previousConnection:(id)sender; 
     65- (IBAction)makeLayoutDefault:(id)sender; 
     66- (IBAction)restoreLayoutToDefault:(id)sender; 
    6567 
    6668@end 
  • WiredClient/trunk/WCDock.m

    r3574 r3963  
    335335        else if(selector == @selector(disconnect:)) 
    336336                return [[self _selectedConnection] isConnected]; 
     337        else if(selector == @selector(makeLayoutDefault:)) 
     338                return [[[NSApp keyWindow] windowController] isKindOfClass:[WCConnectionController class]]; 
     339        else if(selector == @selector(restoreLayoutToDefault:)) 
     340                return ([[[NSApp keyWindow] windowController] isKindOfClass:[WCConnectionController class]] && 
     341                                [WCSettings windowTemplateForKey:WCWindowTemplatesDefault] != NULL); 
    337342 
    338343        return YES; 
     
    468473 
    469474 
     475- (IBAction)makeLayoutDefault:(id)sender { 
     476        NSAlert                         *alert; 
     477        WCServerConnection      *connection; 
     478         
     479        alert = [NSAlert alertWithMessageText:NSLS(@"Make Current Layout Default?", @"Make layout default dialog title") 
     480                                                        defaultButton:NSLS(@"OK", @"Make layout default dialog button title") 
     481                                                  alternateButton:NULL 
     482                                                          otherButton:NSLS(@"Cancel", @"Make layout default dialog button title") 
     483                                informativeTextWithFormat:NSLS(@"This cannot be undone.", @"Make layout default dialog button description")]; 
     484         
     485        if([alert runModal] == NSAlertDefaultReturn) { 
     486                connection = [(WCConnectionController *) [[NSApp keyWindow] windowController] connection]; 
     487                [connection postNotificationName:WCServerConnectionShouldSaveWindowTemplate]; 
     488                 
     489                [WCSettings setWindowTemplate:[WCSettings windowTemplateForKey:[connection identifier]] 
     490                                                           forKey:WCWindowTemplatesDefault]; 
     491        } 
     492} 
     493 
     494 
     495 
     496- (IBAction)restoreLayoutToDefault:(id)sender { 
     497        NSAlert                         *alert; 
     498        WCServerConnection      *connection; 
     499         
     500        alert = [NSAlert alertWithMessageText:NSLS(@"Restore Layout To Default?", @"Restore layout to default dialog title") 
     501                                                        defaultButton:NSLS(@"OK", @"Restore layout to default dialog button title") 
     502                                                  alternateButton:NULL 
     503                                                          otherButton:NSLS(@"Cancel", @"Restore layout to default dialog button title") 
     504                                informativeTextWithFormat:NSLS(@"This cannot be undone.", @"Restore layout to default dialog button description")]; 
     505 
     506        if([alert runModal] == NSAlertDefaultReturn) { 
     507                connection = [(WCConnectionController *) [[NSApp keyWindow] windowController] connection]; 
     508                 
     509                [WCSettings setWindowTemplate:[WCSettings windowTemplateForKey:WCWindowTemplatesDefault] 
     510                                                           forKey:[connection identifier]]; 
     511                 
     512                [connection postNotificationName:WCServerConnectionShouldLoadWindowTemplate]; 
     513        } 
     514} 
     515 
     516 
     517 
    470518#pragma mark - 
    471519 
  • WiredClient/trunk/WCPublicChat.m

    r3961 r3963  
    9494        NSButton                *button; 
    9595 
    96         toolbar = [[NSToolbar alloc] initWithIdentifier:WCChatToolbar]; 
    9796        _toolbarItems = [[NSMutableDictionary alloc] init]; 
    9897 
     
    166165        [_toolbarItems setObject:item forKey:[item itemIdentifier]]; 
    167166 
     167        toolbar = [[NSToolbar alloc] initWithIdentifier:[NSString UUIDString]]; 
    168168        [toolbar setDelegate:self]; 
    169         [toolbar setVisible:YES]; 
    170169        [toolbar setAllowsUserCustomization:YES]; 
    171         [toolbar setAutosavesConfiguration:YES]; 
    172         [toolbar setDisplayMode:NSToolbarDisplayModeDefault]; 
    173170 
    174171        return [toolbar autorelease]; 
     
    244241- (void)windowWillClose:(NSNotification *)notification { 
    245242        [[self connection] terminate]; 
     243} 
     244 
     245 
     246 
     247- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     248        [[[self window] toolbar] setPropertyTemplate:[windowTemplate objectForKey:@"Toolbar"]]; 
     249} 
     250 
     251 
     252 
     253- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     254        [windowTemplate setObject:[[[self window] toolbar] propertyTemplate] forKey:@"Toolbar"]; 
    246255} 
    247256 
  • WiredClient/trunk/WCServerConnection.h

    r3658 r3963  
    3434 
    3535@interface WCServerConnection : WIWindowController <WCConnection> { 
    36         IBOutlet NSTextField                                            *_addressTextField; 
    37         IBOutlet NSTextField                                            *_loginTextField; 
    38         IBOutlet NSSecureTextField                                      *_passwordTextField; 
     36        IBOutlet NSTextField                                                   *_addressTextField; 
     37        IBOutlet NSTextField                                                   *_loginTextField; 
     38        IBOutlet NSSecureTextField                                             *_passwordTextField; 
    3939 
    40         IBOutlet NSProgressIndicator                            *_progressIndicator; 
     40        IBOutlet NSProgressIndicator                                   *_progressIndicator; 
    4141 
    42         NSDictionary                                                            *_bookmark; 
     42        NSDictionary                                                                   *_bookmark; 
    4343         
    44         WCServer                                                                        *_server; 
    45         WCCache                                                                         *_cache; 
     44        WCServer                                                                               *_server; 
     45        WCCache                                                                                *_cache; 
    4646         
    47         WCLink                                                                          *_link; 
    48         NSNotificationCenter                                            *_notificationCenter; 
     47        WCLink                                                                                 *_link; 
     48        NSNotificationCenter                                                   *_notificationCenter; 
    4949         
    50         WCAccounts                                                                      *_accounts; 
    51         WCPublicChat                                                            *_chat; 
    52         WCConsole                                                                       *_console; 
    53         WCMessages                                                                      *_messages; 
    54         WCNews                                                                          *_news; 
    55         WCSearch                                                                        *_search; 
    56         WCServerInfo                                                            *_serverInfo; 
    57         WCTransfers                                                                     *_transfers; 
     50        WCAccounts                                                                             *_accounts; 
     51        WCPublicChat                                                                   *_chat; 
     52        WCConsole                                                                              *_console; 
     53        WCMessages                                                                             *_messages; 
     54        WCNews                                                                                 *_news; 
     55        WCSearch                                                                               *_search; 
     56        WCServerInfo                                                                   *_serverInfo; 
     57        WCTransfers                                                                            *_transfers; 
    5858         
    59         BOOL                                                                            _sentLogin; 
    60         BOOL                                                                            _loginFailed; 
    61         BOOL                                                                            _closingWindow; 
    62         BOOL                                                                            _reconnecting; 
    63         BOOL                                                                            _hidden; 
     59        BOOL                                                                                   _sentLogin; 
     60        BOOL                                                                                   _loginFailed; 
     61        BOOL                                                                                   _closingWindow; 
     62        BOOL                                                                                   _reconnecting; 
     63        BOOL                                                                                   _hidden; 
    6464} 
    6565 
    6666 
    67 #define WCServerConnectionWillReconnect                 @"WCServerConnectionWillReconnect" 
    68 #define WCServerConnectionShouldHide                    @"WCServerConnectionShouldHide" 
    69 #define WCServerConnectionShouldUnhide                  @"WCServerConnectionShouldUnhide" 
    70 #define WCServerConnectionTriggeredEvent                @"WCServerConnectionTriggeredEvent" 
     67#define WCServerConnectionWillReconnect                        @"WCServerConnectionWillReconnect" 
     68#define WCServerConnectionShouldHide                           @"WCServerConnectionShouldHide" 
     69#define WCServerConnectionShouldUnhide                         @"WCServerConnectionShouldUnhide" 
     70#define WCServerConnectionTriggeredEvent                       @"WCServerConnectionTriggeredEvent" 
    7171 
    72 #define WCServerConnectionServerInfoDidChange   @"WCServerConnectionServerInfoDidChange" 
    73 #define WCServerConnectionLoggedIn                              @"WCServerConnectionLoggedIn" 
    74 #define WCServerConnectionBannerDidChange               @"WCServerConnectionBannerDidChange" 
    75 #define WCServerConnectionPrivilegesDidChange   @"WCServerConnectionPrivilegesDidChange" 
     72#define WCServerConnectionShouldLoadWindowTemplate      @"WCServerConnectionShouldLoadWindowTemplate" 
     73#define WCServerConnectionShouldSaveWindowTemplate      @"WCServerConnectionShouldSaveWindowTemplate" 
    7674 
    77 #define WCServerConnectionReceivedServerInfo    @"WCServerConnectionReceivedServerInfo" 
    78 #define WCServerConnectionReceivedSelf                  @"WCServerConnectionReceivedSelf" 
    79 #define WCServerConnectionReceivedPing                  @"WCServerConnectionReceivedPing" 
    80 #define WCServerConnectionReceivedBanner                @"WCServerConnectionReceivedBanner" 
    81 #define WCServerConnectionReceivedPrivileges    @"WCServerConnectionReceivedPrivileges" 
     75#define WCServerConnectionServerInfoDidChange           @"WCServerConnectionServerInfoDidChange" 
     76#define WCServerConnectionLoggedIn                                      @"WCServerConnectionLoggedIn" 
     77#define WCServerConnectionBannerDidChange                       @"WCServerConnectionBannerDidChange" 
     78#define WCServerConnectionPrivilegesDidChange           @"WCServerConnectionPrivilegesDidChange" 
    8279 
    83 #define WCAccountEditorReceivedUser                             @"WCAccountEditorReceivedUser" 
    84 #define WCAccountEditorReceivedGroup                    @"WCAccountEditorReceivedGroup" 
     80#define WCServerConnectionReceivedServerInfo            @"WCServerConnectionReceivedServerInfo" 
     81#define WCServerConnectionReceivedSelf                          @"WCServerConnectionReceivedSelf" 
     82#define WCServerConnectionReceivedPing                          @"WCServerConnectionReceivedPing" 
     83#define WCServerConnectionReceivedBanner                        @"WCServerConnectionReceivedBanner" 
     84#define WCServerConnectionReceivedPrivileges            @"WCServerConnectionReceivedPrivileges" 
    8585 
    86 #define WCAccountsReceivedUser                                  @"WCAccountsReceivedUser" 
    87 #define WCAccountsCompletedUsers                                @"WCAccountsCompletedUsers" 
    88 #define WCAccountsReceivedGroup                                 @"WCAccountsReceivedGroup" 
    89 #define WCAccountsCompletedGroups                               @"WCAccountsCompletedGroups" 
     86#define WCAccountEditorReceivedUser                                     @"WCAccountEditorReceivedUser" 
     87#define WCAccountEditorReceivedGroup                            @"WCAccountEditorReceivedGroup" 
    9088 
    91 #define WCChatReceivedUser                                              @"WCChatShouldAddUser" 
    92 #define WCChatCompletedUsers                                    @"WCChatShouldCompleteUsers" 
    93 #define WCChatReceivedUserJoin                                  @"WCChatReceivedUserJoin" 
    94 #define WCChatReceivedUserLeave                                 @"WCChatReceivedUserLeave" 
    95 #define WCChatReceivedUserChange                                @"WCChatReceivedUserChange" 
    96 #define WCChatReceivedUserIconChange                    @"WCChatReceivedUserIconChange" 
    97 #define WCChatReceivedUserKick                                  @"WCChatReceivedUserKick" 
    98 #define WCChatReceivedUserBan                                   @"WCChatReceivedUserBan" 
    99 #define WCChatReceivedChat                                              @"WCChatReceivedChat" 
    100 #define WCChatReceivedActionChat                                @"WCChatReceivedActionChat" 
    101 #define WCChatReceivedTopic                                             @"WCChatReceivedTopic" 
     89#define WCAccountsReceivedUser                                          @"WCAccountsReceivedUser" 
     90#define WCAccountsCompletedUsers                                        @"WCAccountsCompletedUsers" 
     91#define WCAccountsReceivedGroup                                         @"WCAccountsReceivedGroup" 
     92#define WCAccountsCompletedGroups                                       @"WCAccountsCompletedGroups" 
    10293 
    103 #define WCFileInfoReceivedFileInfo                              @"WCFileInfoReceivedFileInfo" 
     94#define WCChatReceivedUser                                                      @"WCChatShouldAddUser" 
     95#define WCChatCompletedUsers                                            @"WCChatShouldCompleteUsers" 
     96#define WCChatReceivedUserJoin                                          @"WCChatReceivedUserJoin" 
     97#define WCChatReceivedUserLeave                                         @"WCChatReceivedUserLeave" 
     98#define WCChatReceivedUserChange                                        @"WCChatReceivedUserChange" 
     99#define WCChatReceivedUserIconChange                            @"WCChatReceivedUserIconChange" 
     100#define WCChatReceivedUserKick                                          @"WCChatReceivedUserKick" 
     101#define WCChatReceivedUserBan                                           @"WCChatReceivedUserBan" 
     102#define WCChatReceivedChat                                                      @"WCChatReceivedChat" 
     103#define WCChatReceivedActionChat                                        @"WCChatReceivedActionChat" 
     104#define WCChatReceivedTopic                                                     @"WCChatReceivedTopic" 
    104105 
    105 #define WCFilesReceivedFile                                             @"WCFilesReceivedFile" 
    106 #define WCFilesCompletedFiles                                   @"WCFilesCompletedFiles" 
     106#define WCFileInfoReceivedFileInfo                                      @"WCFileInfoReceivedFileInfo" 
    107107 
    108 #define WCMessagesReceivedMessage                              @"WCMessagesReceivedMessage" 
    109 #define WCMessagesReceivedBroadcast                            @"WCMessagesReceivedBroadcast
     108#define WCFilesReceivedFile                                                    @"WCFilesReceivedFile" 
     109#define WCFilesCompletedFiles                                          @"WCFilesCompletedFiles
    110110 
    111 #define WCNewsShouldAddNews                                             @"WCNewsShouldAddNews" 
    112 #define WCNewsShouldCompleteNews                                @"WCNewsShouldCompleteNews" 
    113 #define WCNewsShouldAddNewNews                                  @"WCNewsShouldAddNewNews" 
     111#define WCMessagesReceivedMessage                                       @"WCMessagesReceivedMessage" 
     112#define WCMessagesReceivedBroadcast                                     @"WCMessagesReceivedBroadcast" 
    114113 
    115 #define WCPrivateChatReceivedCreate                            @"WCPrivateChatReceivedCreate
    116 #define WCPrivateChatReceivedInvite                            @"WCPrivateChatReceivedInvite
    117 #define WCPrivateChatReceivedDecline                   @"WCPrivateChatReceivedDecline
     114#define WCNewsShouldAddNews                                                    @"WCNewsShouldAddNews
     115#define WCNewsShouldCompleteNews                                       @"WCNewsShouldCompleteNews
     116#define WCNewsShouldAddNewNews                                         @"WCNewsShouldAddNewNews
    118117 
    119 #define WCSearchReceivedFile                                    @"WCSearchReceivedFile" 
    120 #define WCSearchCompletedFiles                                  @"WCSearchCompletedFiles" 
     118#define WCPrivateChatReceivedCreate                                     @"WCPrivateChatReceivedCreate" 
     119#define WCPrivateChatReceivedInvite                                     @"WCPrivateChatReceivedInvite" 
     120#define WCPrivateChatReceivedDecline                            @"WCPrivateChatReceivedDecline" 
    121121 
    122 #define WCTransfersReceivedTransferStart               @"WCTransfersReceivedTransferStart
    123 #define WCTransfersReceivedQueueUpdate                 @"WCTransfersReceivedQueueUpdate
     122#define WCSearchReceivedFile                                           @"WCSearchReceivedFile
     123#define WCSearchCompletedFiles                                         @"WCSearchCompletedFiles
    124124 
    125 #define WCUserInfoReceivedUserInfo                              @"WCUserInfoReceivedUserInfo" 
     125#define WCTransfersReceivedTransferStart                        @"WCTransfersReceivedTransferStart" 
     126#define WCTransfersReceivedQueueUpdate                          @"WCTransfersReceivedQueueUpdate" 
     127 
     128#define WCUserInfoReceivedUserInfo                                      @"WCUserInfoReceivedUserInfo" 
    126129 
    127130 
     
    143146- (NSDictionary *)bookmark; 
    144147- (NSString *)name; 
     148- (NSString *)identifier; 
    145149- (WCAccount *)account; 
    146150- (WCServer *)server; 
  • WiredClient/trunk/WCServerConnection.m

    r3945 r3963  
    201201        } 
    202202 
    203         url = [_link URL]; 
     203        url = [_server URL]; 
    204204        user = [[url user] length] > 0 ? [url user] : WCDefaultLogin; 
    205205        password = [[url password] length] > 0 ? [[url password] SHA1] : @""; 
     
    546546- (void)removeObserver:(id)target name:(NSString *)name { 
    547547        [_notificationCenter removeObserver:target name:name object:NULL]; 
     548} 
     549 
     550 
     551 
     552- (void)postNotificationName:(NSString *)name { 
     553        [_notificationCenter mainThreadPostNotificationName:name]; 
     554         
     555        [[NSNotificationCenter defaultCenter] mainThreadPostNotificationName:name]; 
    548556} 
    549557 
     
    887895 
    888896- (WIURL *)URL { 
    889         return [_link URL]; 
     897        return [_server URL]; 
    890898} 
    891899 
     
    945953 
    946954 
     955- (NSString *)identifier { 
     956        if(_bookmark) 
     957                return [_bookmark objectForKey:WCBookmarksIdentifier]; 
     958 
     959        return [[_server URL] hostpair]; 
     960} 
     961 
     962 
     963 
    947964- (WCAccount *)account { 
    948965        return [_server account]; 
  • WiredClient/trunk/WCTrackerConnection.m

    r3945 r3963  
    176176 
    177177 
     178- (void)postNotificationName:(NSString *)name { 
     179        [_notificationCenter mainThreadPostNotificationName:name]; 
     180         
     181        [[NSNotificationCenter defaultCenter] mainThreadPostNotificationName:name]; 
     182} 
     183 
     184 
     185 
    178186- (void)postNotificationName:(NSString *)name object:(id)object { 
    179187        [_notificationCenter mainThreadPostNotificationName:name object:object];