From abd77a3b1e8e932c5de357e051131b79bbb49d9a Mon Sep 17 00:00:00 2001 From: avenjamin Date: Fri, 5 Jun 2009 08:28:49 +0000 Subject: - Added toolbar icon for table relations. - some TableDocument code cleanup --- .../Images/toolbar-switch-to-table-relations.png | Bin 0 -> 686 bytes Source/TableDocument.m | 36 ++++++++++++++++++--- sequel-pro.xcodeproj/project.pbxproj | 4 +++ 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 Resources/Images/toolbar-switch-to-table-relations.png diff --git a/Resources/Images/toolbar-switch-to-table-relations.png b/Resources/Images/toolbar-switch-to-table-relations.png new file mode 100644 index 00000000..9dff6a9e Binary files /dev/null and b/Resources/Images/toolbar-switch-to-table-relations.png differ diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 28e898a5..192c93a5 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -60,6 +60,8 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum @end +#pragma mark - + @implementation TableDocument - (id)init @@ -739,8 +741,8 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.sequelpro.com/docs/Getting_Connected"]]; } - -#pragma mark database methods +#pragma mark - +#pragma mark Database methods /** * sets up the database select toolbar item @@ -909,6 +911,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removedatabase"]; } +#pragma mark - #pragma mark Console methods /** @@ -937,6 +940,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum [[SPQueryConsole sharedQueryConsole] clearConsole:sender]; } +#pragma mark - #pragma mark Encoding Methods /** @@ -1128,6 +1132,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum return _supportsEncoding; } +#pragma mark - #pragma mark Table Methods /** @@ -1522,6 +1527,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum contextInfo:NULL]; } +#pragma mark - #pragma mark Other Methods /** @@ -1877,7 +1883,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum } [tableTabView selectTabViewItemAtIndex:4]; - [mainToolbar setSelectedItemIdentifier:@"SwitchToTableInfoToolbarItemIdentifier"]; + [mainToolbar setSelectedItemIdentifier:@"SwitchToTableRelationsToolbarItemIdentifier"]; } @@ -1935,6 +1941,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum return createTableSyntaxWindow; } +#pragma mark - #pragma mark Toolbar Methods /** @@ -2052,6 +2059,17 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum //set up the target action [toolbarItem setTarget:self]; [toolbarItem setAction:@selector(viewStatus:)]; + + } else if ([itemIdentifier isEqualToString:@"SwitchToTableRelationsToolbarItemIdentifier"]) { + [toolbarItem setLabel:NSLocalizedString(@"Relations", @"toolbar item label for switching to the Table Relations tab")]; + [toolbarItem setPaletteLabel:NSLocalizedString(@"Table Relations", @"toolbar item label for switching to the Table Relations tab")]; + //set up tooltip and image + [toolbarItem setToolTip:NSLocalizedString(@"Switch to the Table Relations tab", @"tooltip for toolbar item for switching to the Table Relations tab")]; + [toolbarItem setImage:[NSImage imageNamed:@"toolbar-switch-to-table-relations"]]; + //set up the target action + [toolbarItem setTarget:self]; + [toolbarItem setAction:@selector(viewRelations:)]; + } else { //itemIdentifier refered to a toolbar item that is not provided or supported by us or cocoa @@ -2075,6 +2093,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum @"SwitchToTableContentToolbarItemIdentifier", @"SwitchToRunQueryToolbarItemIdentifier", @"SwitchToTableInfoToolbarItemIdentifier", + @"SwitchToTableRelationsToolbarItemIdentifier", NSToolbarCustomizeToolbarItemIdentifier, NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, @@ -2094,7 +2113,10 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum @"SwitchToTableContentToolbarItemIdentifier", @"SwitchToRunQueryToolbarItemIdentifier", @"SwitchToTableInfoToolbarItemIdentifier", + @"SwitchToTableRelationsToolbarItemIdentifier", NSToolbarFlexibleSpaceItemIdentifier, + @"ToggleConsoleIdentifier", + @"ClearConsoleIdentifier", nil]; } @@ -2108,6 +2130,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum @"SwitchToTableContentToolbarItemIdentifier", @"SwitchToRunQueryToolbarItemIdentifier", @"SwitchToTableInfoToolbarItemIdentifier", + @"SwitchToTableRelationsToolbarItemIdentifier", nil]; } @@ -2224,6 +2247,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum } } +#pragma mark - #pragma mark SMySQL delegate methods /** @@ -2265,7 +2289,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum } } - +#pragma mark - #pragma mark SplitView delegate methods /** @@ -2329,7 +2353,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum [chooseDatabaseToolbarItem setMaxSize:NSMakeSize(leftPaneWidth, 32)]; } - +#pragma mark - #pragma mark TableView datasource methods - (int)numberOfRowsInTableView:(NSTableView *)aTableView @@ -2372,6 +2396,8 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum @end +#pragma mark - + @implementation TableDocument (PrivateAPI) /** diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 8d0bb08b..0a8ce9f2 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -103,6 +103,7 @@ B52460D80F8EF92300171639 /* SPTextViewAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B52460D60F8EF92300171639 /* SPTextViewAdditions.m */; }; B52460DB0F8EF93B00171639 /* Console.xib in Resources */ = {isa = PBXBuildFile; fileRef = B52460D90F8EF93B00171639 /* Console.xib */; }; B53857340F9CC3B600EB2354 /* button_clear.tiff in Resources */ = {isa = PBXBuildFile; fileRef = B53857330F9CC3B600EB2354 /* button_clear.tiff */; }; + B54F25E60FD909C400E2CF36 /* toolbar-switch-to-table-relations.png in Resources */ = {isa = PBXBuildFile; fileRef = B54F25E50FD909C400E2CF36 /* toolbar-switch-to-table-relations.png */; }; B57747D20F7A891A003B34F9 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = B57747D00F7A891A003B34F9 /* Preferences.xib */; }; B57747D40F7A8974003B34F9 /* SPPreferenceController.m in Sources */ = {isa = PBXBuildFile; fileRef = B57747D30F7A8974003B34F9 /* SPPreferenceController.m */; }; B57747D90F7A8990003B34F9 /* SPWindowAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B57747D80F7A8990003B34F9 /* SPWindowAdditions.m */; }; @@ -346,6 +347,7 @@ B52460D60F8EF92300171639 /* SPTextViewAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTextViewAdditions.m; sourceTree = ""; }; B52460DA0F8EF93B00171639 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Console.xib; sourceTree = ""; }; B53857330F9CC3B600EB2354 /* button_clear.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = button_clear.tiff; sourceTree = ""; }; + B54F25E50FD909C400E2CF36 /* toolbar-switch-to-table-relations.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "toolbar-switch-to-table-relations.png"; sourceTree = ""; }; B57747D10F7A891A003B34F9 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Preferences.xib; sourceTree = ""; }; B57747D30F7A8974003B34F9 /* SPPreferenceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPPreferenceController.m; sourceTree = ""; }; B57747D50F7A8978003B34F9 /* SPPreferenceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPPreferenceController.h; sourceTree = ""; }; @@ -736,6 +738,7 @@ 17E641BD0EF02036001BC333 /* toolbar-switch-to-sql.tiff */, 17E641BE0EF02036001BC333 /* toolbar-switch-to-structure.png */, 17E641BF0EF02036001BC333 /* toolbar-switch-to-table-info.png */, + B54F25E50FD909C400E2CF36 /* toolbar-switch-to-table-relations.png */, B5E92F350F75B32100012500 /* toolbar-export-csv.tiff */, B5E92F360F75B32100012500 /* toolbar-export-html.tiff */, B5E92F370F75B32100012500 /* toolbar-export-pdf.tiff */, @@ -1022,6 +1025,7 @@ 177E79300FCB54EC00E9E122 /* table-small-square.tiff in Resources */, 29A1B7EB0FD12E55000B88E8 /* printAccessory.xib in Resources */, 586F432B0FD74CFC00B428D7 /* SSHQuestionDialog.xib in Resources */, + B54F25E60FD909C400E2CF36 /* toolbar-switch-to-table-relations.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3