diff options
author | rowanbeentje <rowan@beent.je> | 2009-08-02 12:41:40 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-08-02 12:41:40 +0000 |
commit | 865751a6154ec9c31ef73e95c5ead99682cb40fd (patch) | |
tree | 61c81534a14a3e3173c17cd3aa8781e395e3aa81 /Source | |
parent | 89aed80bdcfdead340f9e5de5dc73ab051ae1f9b (diff) | |
download | sequelpro-865751a6154ec9c31ef73e95c5ead99682cb40fd.tar.gz sequelpro-865751a6154ec9c31ef73e95c5ead99682cb40fd.tar.bz2 sequelpro-865751a6154ec9c31ef73e95c5ead99682cb40fd.zip |
- Add a tooltip to the table information pane toggle button
- Change the "[Show/Hide] Console" button in the toolbar to a "Console" button, which shows or brings the console window to the front
- Update the default toolbar state to reflect recent additions
- Reset everyone's toolbars to ensure that normal users will have the new icons available and visible
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPPreferenceController.m | 7 | ||||
-rw-r--r-- | Source/TableDocument.m | 60 |
2 files changed, 41 insertions, 26 deletions
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 79be5318..ca7c6562 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -263,6 +263,13 @@ [prefs setObject:[NSArray arrayWithArray:favoritesArray] forKey:@"favorites"]; } + // For versions prior to r1128 (~0.9.6), reset the main window toolbar items to add new items + if (recordedVersionNumber < 1128 && [prefs objectForKey:@"NSToolbar Configuration TableWindowToolbar"]) { + NSMutableDictionary *toolbarDict = [NSMutableDictionary dictionaryWithDictionary:[prefs objectForKey:@"NSToolbar Configuration TableWindowToolbar"]]; + [toolbarDict removeObjectForKey:@"TB Item Identifiers"]; + [prefs setObject:[NSDictionary dictionaryWithDictionary:toolbarDict] forKey:@"NSToolbar Configuration TableWindowToolbar"]; + } + // Update the prefs revision [prefs setObject:[NSNumber numberWithInt:currentVersionNumber] forKey:@"LastUsedVersion"]; } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 3a337041..eb2b6129 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -642,6 +642,20 @@ } /** + * Brings the console to the fron + */ +- (void)showConsole:(id)sender +{ + BOOL isConsoleVisible = [[[SPQueryConsole sharedQueryConsole] window] isVisible]; + + if (!isConsoleVisible) { + [self toggleConsole:sender]; + } else { + [[[SPQueryConsole sharedQueryConsole] window] makeKeyAndOrderFront:self]; + } +} + +/** * Clears the console by removing all of its messages */ - (void)clearConsole:(id)sender @@ -1770,23 +1784,16 @@ [toolbarItem setPaletteLabel:[toolbarItem label]]; [toolbarItem setView:historyControl]; - } else if ([itemIdentifier isEqualToString:@"ToggleConsoleIdentifier"]) { - //set the text label to be displayed in the toolbar and customization palette - [toolbarItem setPaletteLabel:NSLocalizedString(@"Show/Hide Console", @"toolbar item for show/hide console")]; - //set up tooltip and image - [toolbarItem setToolTip:NSLocalizedString(@"Show or hide the console which shows all MySQL commands performed by Sequel Pro", @"tooltip for toolbar item for show/hide console")]; + } else if ([itemIdentifier isEqualToString:@"ShowConsoleIdentifier"]) { + [toolbarItem setPaletteLabel:NSLocalizedString(@"Show Console", @"toolbar item for show console")]; + [toolbarItem setToolTip:NSLocalizedString(@"Show the console which shows all MySQL commands performed by Sequel Pro", @"tooltip for toolbar item for show console")]; - if ([[[SPQueryConsole sharedQueryConsole] window] isVisible]) { - [toolbarItem setLabel:NSLocalizedString(@"Hide Console", @"Hide Console")]; - [toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]]; - } else { - [toolbarItem setLabel:NSLocalizedString(@"Show Console", @"Show Console")]; - [toolbarItem setImage:[NSImage imageNamed:@"showconsole"]]; - } + [toolbarItem setLabel:NSLocalizedString(@"Console", @"Console")]; + [toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]]; //set up the target action [toolbarItem setTarget:self]; - [toolbarItem setAction:@selector(toggleConsole:)]; + [toolbarItem setAction:@selector(showConsole:)]; } else if ([itemIdentifier isEqualToString:@"ClearConsoleIdentifier"]) { //set the text label to be displayed in the toolbar and customization palette @@ -1866,7 +1873,7 @@ return [NSArray arrayWithObjects: @"DatabaseSelectToolbarItemIdentifier", @"HistoryNavigationToolbarItemIdentifier", - @"ToggleConsoleIdentifier", + @"ShowConsoleIdentifier", @"ClearConsoleIdentifier", @"FlushPrivilegesIdentifier", @"SwitchToTableStructureToolbarItemIdentifier", @@ -1888,15 +1895,14 @@ { return [NSArray arrayWithObjects: @"DatabaseSelectToolbarItemIdentifier", - NSToolbarSeparatorItemIdentifier, @"SwitchToTableStructureToolbarItemIdentifier", @"SwitchToTableContentToolbarItemIdentifier", - @"SwitchToRunQueryToolbarItemIdentifier", - @"SwitchToTableInfoToolbarItemIdentifier", @"SwitchToTableRelationsToolbarItemIdentifier", + @"SwitchToTableInfoToolbarItemIdentifier", + @"SwitchToRunQueryToolbarItemIdentifier", NSToolbarFlexibleSpaceItemIdentifier, - @"ToggleConsoleIdentifier", - @"ClearConsoleIdentifier", + @"HistoryNavigationToolbarItemIdentifier", + @"ShowConsoleIdentifier", nil]; } @@ -1924,15 +1930,17 @@ NSString *identifier = [toolbarItem itemIdentifier]; - // Toggle console item - if ([identifier isEqualToString:@"ToggleConsoleIdentifier"]) { + // Show console item + if ([identifier isEqualToString:@"ShowConsoleIdentifier"]) { if ([[[SPQueryConsole sharedQueryConsole] window] isVisible]) { - [toolbarItem setLabel:@"Hide Console"]; - [toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]]; - } - else { - [toolbarItem setLabel:@"Show Console"]; [toolbarItem setImage:[NSImage imageNamed:@"showconsole"]]; + } else { + [toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]]; + } + if ([[[SPQueryConsole sharedQueryConsole] window] isKeyWindow]) { + return NO; + } else { + return YES; } } |