From 865751a6154ec9c31ef73e95c5ead99682cb40fd Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 2 Aug 2009 12:41:40 +0000 Subject: - 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 --- Interfaces/English.lproj/DBView.xib | 24 +++++---------- Source/SPPreferenceController.m | 7 +++++ Source/TableDocument.m | 60 +++++++++++++++++++++---------------- 3 files changed, 49 insertions(+), 42 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index d44e8f93..76b01146 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -3091,7 +3091,7 @@ -2042609409 35 - + NSImage button_action @@ -3106,10 +3106,7 @@ 1048576 2147483647 - - NSImage - button_action - + _popUpItemAction: @@ -10906,7 +10903,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 NSResponder - + 301 YES @@ -10915,7 +10912,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 298 {{0, 3}, {200, 26}} - YES -2076049856 @@ -10994,7 +10990,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 301 {{208, 3}, {61, 25}} - YES 67239424 @@ -11028,8 +11023,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {269, 32} - - NSView @@ -23543,12 +23536,11 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit - YES - - YES - - - YES + ToolTip + + ToolTip + + Toggle the visibility of the Information panel com.brandonwalkin.BWToolkit 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 @@ -641,6 +641,20 @@ [menuItem setTitle:(!isConsoleVisible) ? NSLocalizedString(@"Hide Console", @"Hide Console") : NSLocalizedString(@"Show Console", @"Show Console")]; } +/** + * 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 */ @@ -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; } } -- cgit v1.2.3