From 8f845a4a23d26c7842de6bd34a3d2f9ec7630ee5 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 1 Feb 2011 07:38:07 +0000 Subject: =?UTF-8?q?=E2=80=A2=20changed=20the=20behaviour=20of=20=E2=87=A7?= =?UTF-8?q?=E2=8C=98K=20(Show/Hide=20Console)=20slightly=20-=20the=20main?= =?UTF-8?q?=20purpose=20of=20that=20keyboard=20short-cut=20is=20the=20SHOW?= =?UTF-8?q?=20the=20Console=20window=20even=20if=20it's=20visible=20but=20?= =?UTF-8?q?hidden=20under=20other=20windows;=20now=20=E2=87=A7=E2=8C=98K?= =?UTF-8?q?=20orders=20out=20the=20Console=20window=20if=20it's=20invisibl?= =?UTF-8?q?e=20or=20visible=20but=20mot=20the=20front=20most=20window;=20i?= =?UTF-8?q?f=20it's=20the=20front=20most=20window=20=E2=87=A7=E2=8C=98K=20?= =?UTF-8?q?will=20hide=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPDatabaseDocument.m | 33 +++++++++++++++++---------------- 1 file 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 -- cgit v1.2.3