aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPPreferenceController.m7
-rw-r--r--Source/TableDocument.m60
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;
}
}