diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-02-01 07:38:07 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-02-01 07:38:07 +0000 |
commit | 8f845a4a23d26c7842de6bd34a3d2f9ec7630ee5 (patch) | |
tree | 80958549f3160dccbf211727785a740bec77881a | |
parent | 2e5835045251c7b520f267bf2577fee65ffd6105 (diff) | |
download | sequelpro-8f845a4a23d26c7842de6bd34a3d2f9ec7630ee5.tar.gz sequelpro-8f845a4a23d26c7842de6bd34a3d2f9ec7630ee5.tar.bz2 sequelpro-8f845a4a23d26c7842de6bd34a3d2f9ec7630ee5.zip |
• changed the behaviour of ⇧⌘K (Show/Hide Console) slightly
- the main purpose of that keyboard short-cut is the SHOW the Console window even if it's visible but hidden under other windows; now ⇧⌘K orders out the Console window if it's invisible or visible but mot the front most window; if it's the front most window ⇧⌘K will hide it
-rw-r--r-- | Source/SPDatabaseDocument.m | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index dd368e27..bdd6bd7c 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -871,30 +871,31 @@ */ - (void)toggleConsole:(id)sender { - BOOL isConsoleVisible = [[[SPQueryController sharedQueryController] window] isVisible]; - // If the Console window is not visible data are not reloaded (for speed). - // Due to that update list if user opens the Console window. - if(!isConsoleVisible) { - [[SPQueryController sharedQueryController] updateEntries]; - } + // Toggle Console will show the Console window if it isn't visible or if it isn't + // the front most window and hide it if it is the front most window + if ([[[SPQueryController sharedQueryController] window] isVisible] + && [[[NSApp keyWindow] windowController] isKindOfClass:[SPQueryController class]]) + + [[[SPQueryController sharedQueryController] window] setIsVisible:NO]; + else + + [self showConsole:nil]; - // Show or hide the console - [[[SPQueryController sharedQueryController] window] setIsVisible:(!isConsoleVisible)]; } /** - * Brings the console to the fron + * Brings the console to the front */ - (void)showConsole:(id)sender { - BOOL isConsoleVisible = [[[SPQueryController sharedQueryController] window] isVisible]; - if (!isConsoleVisible) { - [self toggleConsole:sender]; - } else { - [[[SPQueryController sharedQueryController] window] makeKeyAndOrderFront:self]; - } + // If the Console window is not visible data are not reloaded (for speed). + // Due to that update list if user opens the Console window. + if(![[[SPQueryController sharedQueryController] window] isVisible]) + [[SPQueryController sharedQueryController] updateEntries]; + + [[[SPQueryController sharedQueryController] window] makeKeyAndOrderFront:self]; } @@ -3209,7 +3210,7 @@ // Show/hide console if ([menuItem action] == @selector(toggleConsole:)) { - [menuItem setTitle:([[[SPQueryController sharedQueryController] window] isVisible]) ? NSLocalizedString(@"Hide Console", @"hide console") : NSLocalizedString(@"Show Console", @"show console")]; + [menuItem setTitle:([[[SPQueryController sharedQueryController] window] isVisible] && [[[NSApp keyWindow] windowController] isKindOfClass:[SPQueryController class]]) ? NSLocalizedString(@"Hide Console", @"hide console") : NSLocalizedString(@"Show Console", @"show console")]; } // Clear console |