From 5a194fdff493435091e550a96d9e8ce79f1ee463 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 17 Dec 2012 09:34:49 +0000 Subject: =?UTF-8?q?=20-=20Rearrange=20some=20menu=20shortcuts:=20=E2=8C=98?= =?UTF-8?q?F=20is=20now=20used=20on=20the=20Content=20tab=20to=20set=20the?= =?UTF-8?q?=20focus=20to=20the=20Filter=20Content=20tab=20bar.=20=20?= =?UTF-8?q?=E2=87=A7=E2=8C=98F=20is=20used=20to=20show=20the=20advanced=20?= =?UTF-8?q?content=20filter=20table.=20=20This=20allows=20^=E2=8C=98F=20to?= =?UTF-8?q?=20be=20used=20for=20the=20standard=20OS=20X=20fullscreen=20win?= =?UTF-8?q?dow=20command,=20addressing=20Issue=20#1513.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPCopyTable.m | 7 ---- Source/SPDatabaseDocument.h | 2 + Source/SPDatabaseDocument.m | 32 ++++++++++++++- Source/SPTableContent.h | 2 +- Source/SPTablesList.m | 98 ++++++++++++++++++++++----------------------- Source/SPWindow.h | 2 + Source/SPWindow.m | 23 +++++++++++ 7 files changed, 107 insertions(+), 59 deletions(-) (limited to 'Source') diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 82889aee..c36ac380 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -1175,13 +1175,6 @@ static const NSInteger kBlobAsImageFile = 4; [super keyDown:theEvent]; } -- (void)performFindPanelAction:(id)sender -{ - if([sender tag] == 1 && [[self delegate] isKindOfClass:[SPTableContent class]]) { - [(SPTableContent*)[self delegate] showFilterTable:self]; - } -} - #pragma mark - #pragma mark Field editing checks diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index 73a322d7..b5ea2373 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -330,6 +330,7 @@ - (IBAction)renameDatabase:(id)sender; #ifndef SP_REFACTOR /* method decls */ - (IBAction)showMySQLHelp:(id)sender; +- (IBAction) makeTableListFilterHaveFocus:(id)sender; - (IBAction)showServerVariables:(id)sender; - (IBAction)showServerProcesses:(id)sender; - (IBAction)openCurrentConnectionInNewWindow:(id)sender; @@ -377,6 +378,7 @@ - (IBAction)saveCreateSyntax:(id)sender; - (IBAction)copyCreateTableSyntaxFromSheet:(id)sender; - (IBAction)focusOnTableContentFilter:(id)sender; +- (IBAction)showFilterTable:(id)sender; - (IBAction)export:(id)sender; - (IBAction)exportSelectedTablesAs:(id)sender; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 63381d90..bc6cce5c 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -2301,6 +2301,26 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; [tableContentInstance performSelector:@selector(makeContentFilterHaveFocus) withObject:nil afterDelay:0.1]; } +/** + * Switches to the content view and makes the advanced filter view the first responder + */ +- (IBAction)showFilterTable:(id)sender +{ + [self viewContent:self]; + + [tableContentInstance performSelector:@selector(showFilterTable:) withObject:sender afterDelay:0.1]; +} + +/** + * Allow Command-F to set the focus to the content view filter if that view is active + */ +- (void)performFindPanelAction:(id)sender +{ + if ([sender tag] == 1 && [[self selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableContent]) { + [tableContentInstance makeContentFilterHaveFocus]; + } +} + /** * Exports the selected tables in the chosen file format. */ @@ -3377,6 +3397,14 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; [[customQueryInstance helpWebViewWindow] makeKeyWindow]; } +/** + * Forwards a responder request to set the focus to the table list filter area or table list + */ +- (IBAction) makeTableListFilterHaveFocus:(id)sender +{ + [tablesListInstance performSelector:@selector(makeTableListFilterHaveFocus) withObject:nil afterDelay:0.1]; +} + /** * Menu item validation. */ @@ -3522,12 +3550,12 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; } // Focus on table content filter - if ([menuItem action] == @selector(focusOnTableContentFilter:)) { + if ([menuItem action] == @selector(focusOnTableContentFilter:) || [menuItem action] == @selector(showFilterTable:)) { return ([self table] != nil && [[self table] isNotEqualTo:@""]); } // Focus on table list or filter resp. - if ([menuItem action] == @selector(focusOnTableListFilter:)) { + if ([menuItem action] == @selector(makeTableListFilterHaveFocus:)) { if([[tablesListInstance valueForKeyPath:@"tables"] count] > 20) [menuItem setTitle:NSLocalizedString(@"Filter Tables", @"filter tables menu item")]; diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h index 66aab772..3e62448d 100644 --- a/Source/SPTableContent.h +++ b/Source/SPTableContent.h @@ -53,7 +53,7 @@ @interface SPTableContent : NSObject #ifdef SP_REFACTOR - + #endif { IBOutlet SPDatabaseDocument *tableDocumentInstance; diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 8d0d6bbc..41551114 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -870,19 +870,18 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; // Get main menu "Table"'s submenu NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTag:SPMainMenuTable] submenu]; - [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create Syntaxes", @"copy create syntaxes menu item")]; - [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create Syntaxes...", @"show create syntaxes menu item")]; + [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Copy Create Syntaxes", @"copy create syntaxes menu item")]; + [[tableSubMenu itemAtIndex:5] setTitle:NSLocalizedString(@"Show Create Syntaxes...", @"show create syntaxes menu item")]; - [[tableSubMenu itemAtIndex:6] setTitle:NSLocalizedString(@"Check Selected Items", @"check selected items menu item")]; - [[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Repair Selected Items", @"repair selected items menu item")]; + [[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Check Selected Items", @"check selected items menu item")]; + [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Repair Selected Items", @"repair selected items menu item")]; - [[tableSubMenu itemAtIndex:9] setTitle:NSLocalizedString(@"Analyze Selected Items", @"analyze selected items menu item")]; - [[tableSubMenu itemAtIndex:10] setTitle:NSLocalizedString(@"Optimize Selected Items", @"optimize selected items menu item")]; + [[tableSubMenu itemAtIndex:10] setTitle:NSLocalizedString(@"Analyze Selected Items", @"analyze selected items menu item")]; + [[tableSubMenu itemAtIndex:11] setTitle:NSLocalizedString(@"Optimize Selected Items", @"optimize selected items menu item")]; - [[tableSubMenu itemAtIndex:11] setTitle:NSLocalizedString(@"Flush Selected Items", @"flush selected items menu item")]; - [[tableSubMenu itemAtIndex:12] setTitle:NSLocalizedString(@"Checksum Selected Items", @"checksum selected items menu item")]; + [[tableSubMenu itemAtIndex:12] setTitle:NSLocalizedString(@"Flush Selected Items", @"flush selected items menu item")]; + [[tableSubMenu itemAtIndex:13] setTitle:NSLocalizedString(@"Checksum Selected Items", @"checksum selected items menu item")]; - [[tableSubMenu itemAtIndex:3] setHidden:NO]; [[tableSubMenu itemAtIndex:4] setHidden:NO]; [[tableSubMenu itemAtIndex:5] setHidden:NO]; [[tableSubMenu itemAtIndex:6] setHidden:NO]; @@ -890,6 +889,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [[tableSubMenu itemAtIndex:8] setHidden:NO]; [[tableSubMenu itemAtIndex:9] setHidden:NO]; [[tableSubMenu itemAtIndex:10] setHidden:NO]; + [[tableSubMenu itemAtIndex:11] setHidden:NO]; #endif return; @@ -930,18 +930,18 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; if (selectedTableType == SPTableTypeView) { // Change mainMenu > Table > ... according to table type - [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create View Syntax", @"copy create view syntax menu item")]; - [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create View Syntax...", @"show create view syntax menu item")]; - [[tableSubMenu itemAtIndex:5] setHidden:NO]; // Divider - [[tableSubMenu itemAtIndex:6] setHidden:NO]; - [[tableSubMenu itemAtIndex:6] setTitle:NSLocalizedString(@"Check View", @"check view menu item")]; - [[tableSubMenu itemAtIndex:7] setHidden:YES]; // Repair - [[tableSubMenu itemAtIndex:8] setHidden:YES]; // Divider - [[tableSubMenu itemAtIndex:9] setHidden:YES]; // Analyse - [[tableSubMenu itemAtIndex:10] setHidden:YES]; // Optimize - [[tableSubMenu itemAtIndex:11] setHidden:NO]; - [[tableSubMenu itemAtIndex:11] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")]; - [[tableSubMenu itemAtIndex:12] setHidden:YES]; // Checksum + [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Copy Create View Syntax", @"copy create view syntax menu item")]; + [[tableSubMenu itemAtIndex:5] setTitle:NSLocalizedString(@"Show Create View Syntax...", @"show create view syntax menu item")]; + [[tableSubMenu itemAtIndex:6] setHidden:NO]; // Divider + [[tableSubMenu itemAtIndex:7] setHidden:NO]; + [[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Check View", @"check view menu item")]; + [[tableSubMenu itemAtIndex:8] setHidden:YES]; // Repair + [[tableSubMenu itemAtIndex:9] setHidden:YES]; // Divider + [[tableSubMenu itemAtIndex:10] setHidden:YES]; // Analyse + [[tableSubMenu itemAtIndex:11] setHidden:YES]; // Optimize + [[tableSubMenu itemAtIndex:12] setHidden:NO]; + [[tableSubMenu itemAtIndex:12] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")]; + [[tableSubMenu itemAtIndex:13] setHidden:YES]; // Checksum [renameTableMenuItem setHidden:NO]; // we don't have to check the mysql version [renameTableMenuItem setTitle:NSLocalizedString(@"Rename View...", @"rename view menu title")]; @@ -972,22 +972,22 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [copyCreateSyntaxContextMenuItem setTitle:NSLocalizedString(@"Copy Create View Syntax",@"Table List : Context Menu : Copy CREATE view statement")]; } else if (selectedTableType == SPTableTypeTable) { - [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")]; - [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create Table Syntax...", @"show create table syntax menu item")]; - [[tableSubMenu itemAtIndex:5] setHidden:NO]; // divider - [[tableSubMenu itemAtIndex:6] setHidden:NO]; - [[tableSubMenu itemAtIndex:6] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")]; + [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")]; + [[tableSubMenu itemAtIndex:5] setTitle:NSLocalizedString(@"Show Create Table Syntax...", @"show create table syntax menu item")]; + [[tableSubMenu itemAtIndex:6] setHidden:NO]; // divider [[tableSubMenu itemAtIndex:7] setHidden:NO]; - [[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Repair Table", @"repair table menu item")]; - [[tableSubMenu itemAtIndex:8] setHidden:NO]; // divider - [[tableSubMenu itemAtIndex:9] setHidden:NO]; - [[tableSubMenu itemAtIndex:9] setTitle:NSLocalizedString(@"Analyze Table", @"analyze table menu item")]; + [[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")]; + [[tableSubMenu itemAtIndex:8] setHidden:NO]; + [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Repair Table", @"repair table menu item")]; + [[tableSubMenu itemAtIndex:9] setHidden:NO]; // divider [[tableSubMenu itemAtIndex:10] setHidden:NO]; - [[tableSubMenu itemAtIndex:10] setTitle:NSLocalizedString(@"Optimize Table", @"optimize table menu item")]; + [[tableSubMenu itemAtIndex:10] setTitle:NSLocalizedString(@"Analyze Table", @"analyze table menu item")]; [[tableSubMenu itemAtIndex:11] setHidden:NO]; - [[tableSubMenu itemAtIndex:11] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")]; + [[tableSubMenu itemAtIndex:11] setTitle:NSLocalizedString(@"Optimize Table", @"optimize table menu item")]; [[tableSubMenu itemAtIndex:12] setHidden:NO]; - [[tableSubMenu itemAtIndex:12] setTitle:NSLocalizedString(@"Checksum Table", @"checksum table menu item")]; + [[tableSubMenu itemAtIndex:12] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")]; + [[tableSubMenu itemAtIndex:13] setHidden:NO]; + [[tableSubMenu itemAtIndex:13] setTitle:NSLocalizedString(@"Checksum Table", @"checksum table menu item")]; [renameTableMenuItem setHidden:NO]; [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Table...", @"rename table menu title")]; @@ -1020,16 +1020,16 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [copyCreateSyntaxContextMenuItem setTitle:NSLocalizedString(@"Copy Create Table Syntax",@"Table List : Gear Menu : Copy CREATE syntax (single table)")]; } else if (selectedTableType == SPTableTypeProc) { - [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create Procedure Syntax", @"copy create proc syntax menu item")]; - [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create Procedure Syntax...", @"show create proc syntax menu item")]; - [[tableSubMenu itemAtIndex:5] setHidden:YES]; // divider - [[tableSubMenu itemAtIndex:6] setHidden:YES]; // copy columns - [[tableSubMenu itemAtIndex:7] setHidden:YES]; // divider - [[tableSubMenu itemAtIndex:8] setHidden:YES]; + [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Copy Create Procedure Syntax", @"copy create proc syntax menu item")]; + [[tableSubMenu itemAtIndex:5] setTitle:NSLocalizedString(@"Show Create Procedure Syntax...", @"show create proc syntax menu item")]; + [[tableSubMenu itemAtIndex:6] setHidden:YES]; // divider + [[tableSubMenu itemAtIndex:7] setHidden:YES]; // copy columns + [[tableSubMenu itemAtIndex:8] setHidden:YES]; // divider [[tableSubMenu itemAtIndex:9] setHidden:YES]; - [[tableSubMenu itemAtIndex:10] setHidden:YES]; // divider - [[tableSubMenu itemAtIndex:11] setHidden:YES]; + [[tableSubMenu itemAtIndex:10] setHidden:YES]; + [[tableSubMenu itemAtIndex:11] setHidden:YES]; // divider [[tableSubMenu itemAtIndex:12] setHidden:YES]; + [[tableSubMenu itemAtIndex:13] setHidden:YES]; [renameTableMenuItem setHidden:NO]; [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Procedure...", @"rename proc menu title")]; @@ -1060,16 +1060,16 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [copyCreateSyntaxContextMenuItem setTitle:NSLocalizedString(@"Copy Create Procedure Syntax",@"Table List : Context Menu : Copy CREATE PROCEDURE syntax")]; } else if (selectedTableType == SPTableTypeFunc) { - [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create Function Syntax", @"copy create func syntax menu item")]; - [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create Function Syntax...", @"show create func syntax menu item")]; - [[tableSubMenu itemAtIndex:5] setHidden:YES]; // divider - [[tableSubMenu itemAtIndex:6] setHidden:YES]; // copy columns - [[tableSubMenu itemAtIndex:7] setHidden:YES]; // divider - [[tableSubMenu itemAtIndex:8] setHidden:YES]; + [[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Copy Create Function Syntax", @"copy create func syntax menu item")]; + [[tableSubMenu itemAtIndex:5] setTitle:NSLocalizedString(@"Show Create Function Syntax...", @"show create func syntax menu item")]; + [[tableSubMenu itemAtIndex:6] setHidden:YES]; // divider + [[tableSubMenu itemAtIndex:7] setHidden:YES]; // copy columns + [[tableSubMenu itemAtIndex:8] setHidden:YES]; // divider [[tableSubMenu itemAtIndex:9] setHidden:YES]; - [[tableSubMenu itemAtIndex:10] setHidden:YES]; // divider - [[tableSubMenu itemAtIndex:11] setHidden:YES]; + [[tableSubMenu itemAtIndex:10] setHidden:YES]; + [[tableSubMenu itemAtIndex:11] setHidden:YES]; // divider [[tableSubMenu itemAtIndex:12] setHidden:YES]; + [[tableSubMenu itemAtIndex:13] setHidden:YES]; [renameTableMenuItem setHidden:NO]; [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Function...", @"rename func menu title")]; diff --git a/Source/SPWindow.h b/Source/SPWindow.h index cfb2aa5f..7828735c 100644 --- a/Source/SPWindow.h +++ b/Source/SPWindow.h @@ -37,4 +37,6 @@ @property (assign) BOOL isSheetWhichCanBecomeMain; +- (void)toggleFullScreen:(id)sender; + @end diff --git a/Source/SPWindow.m b/Source/SPWindow.m index 39bed812..5563235f 100644 --- a/Source/SPWindow.m +++ b/Source/SPWindow.m @@ -33,6 +33,10 @@ #import "SPWindow.h" #import "SPWindowController.h" +@interface NSWindow (LionPlusMethods) +- (void)toggleFullScreen:(id)sender; +@end + @implementation SPWindow @synthesize isSheetWhichCanBecomeMain; @@ -165,4 +169,23 @@ return [super canBecomeMainWindow]; } +/** + * On 10.7+, allow the window to go fullscreen; do nothing on <10.7. + */ +- (void)toggleFullScreen:(id)sender +{ + if ([super respondsToSelector:@selector(toggleFullScreen:)]) { + [super toggleFullScreen:sender]; + } +} + +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + + if ([menuItem action] == @selector(toggleFullScreen:)) { + return ([super respondsToSelector:@selector(toggleFullScreen:)]); + } + return YES; +} + @end -- cgit v1.2.3