diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 147 | ||||
-rw-r--r-- | Source/TablesList.h | 1 | ||||
-rw-r--r-- | Source/TablesList.m | 69 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 6 |
4 files changed, 180 insertions, 43 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index e5257f5c..791517d4 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -1,21 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02"> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> <string key="IBDocument.SystemVersion">9J61</string> - <string key="IBDocument.InterfaceBuilderVersion">672</string> + <string key="IBDocument.InterfaceBuilderVersion">677</string> <string key="IBDocument.AppKitVersion">949.46</string> <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="5675"/> - <integer value="40"/> + <integer value="4811"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.WebKitIBPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="105205302"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="427689665"> @@ -38,7 +46,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{780, 480}</string> <object class="NSView" key="NSWindowView" id="579726586"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -379,10 +387,7 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <object class="NSCustomResource" key="NSImage" id="535711902"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">button_action</string> - </object> + <reference key="NSImage" ref="654575920"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="753352469"/> </object> @@ -443,6 +448,7 @@ </object> </object> </object> + <int key="NSSelectedIndex">3</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -2269,8 +2275,8 @@ <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">.</string> - <string key="NS.thousand">,</string> + <string key="NS.decimal">,</string> + <string key="NS.thousand">.</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">NO</bool> @@ -2945,7 +2951,7 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSImage" ref="535711902"/> + <reference key="NSImage" ref="654575920"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="984501775"/> </object> @@ -4102,6 +4108,7 @@ </object> </object> <string key="NSFrameSize">{944, 550}</string> + <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{780, 502}</string> @@ -4121,7 +4128,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{256, 191}</string> <object class="NSView" key="NSWindowView" id="586457094"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -4618,7 +4625,6 @@ </object> <string key="NSFrame">{{0, 17}, {215, 164}}</string> <reference key="NSSuperview" ref="112292194"/> - <reference key="NSNextKeyView" ref="158332213"/> <reference key="NSDocView" ref="158332213"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">2</int> @@ -4651,7 +4657,6 @@ </object> <string key="NSFrameSize">{215, 17}</string> <reference key="NSSuperview" ref="112292194"/> - <reference key="NSNextKeyView" ref="975843240"/> <reference key="NSDocView" ref="975843240"/> <reference key="NSBGColor" ref="1024678221"/> <int key="NScvFlags">4</int> @@ -4660,7 +4665,6 @@ </object> <string key="NSFrame">{{-1, 22}, {215, 181}}</string> <reference key="NSSuperview" ref="1043550915"/> - <reference key="NSNextKeyView" ref="131927425"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="785468991"/> <reference key="NSHScroller" ref="710690013"/> @@ -4798,7 +4802,6 @@ </object> </object> <string key="NSFrameSize">{519, 347}</string> - <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{256, 213}</string> @@ -9383,7 +9386,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowContentMaxSize">{269, 112}</string> <string key="NSWindowContentMinSize">{269, 112}</string> <object class="NSView" key="NSWindowView" id="44272488"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -9466,7 +9469,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> </object> <string key="NSFrameSize">{269, 112}</string> - <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{269, 134}</string> @@ -14943,6 +14945,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <int key="connectionID">5699</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">separatorTableMenuItem</string> + <reference key="source" ref="438574515"/> + <reference key="destination" ref="684779453"/> + </object> + <int key="connectionID">5700</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -24311,7 +24321,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> <string>{{366, 378}, {269, 112}}</string> <reference ref="9"/> <reference ref="9"/> - <integer value="1"/> + <reference ref="9"/> <string>{269, 112}</string> <string>{269, 112}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -24590,7 +24600,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">5699</int> + <int key="maxID">5700</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -25830,6 +25840,101 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> </object> </object> </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">TablesList</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addTable:</string> + <string>closeCopyTableSheet:</string> + <string>closeSheet:</string> + <string>copyTable:</string> + <string>removeTable:</string> + <string>renameTable:</string> + <string>updateTables:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>addTableButton</string> + <string>copyTableContentSwitch</string> + <string>copyTableMessageField</string> + <string>copyTableNameField</string> + <string>copyTableSheet</string> + <string>customQueryInstance</string> + <string>duplicateTableMenuItem</string> + <string>removeTableMenuItem</string> + <string>renameTableButton</string> + <string>renameTableMenuItem</string> + <string>separatorTableMenuItem</string> + <string>tabView</string> + <string>tableContentInstance</string> + <string>tableDataInstance</string> + <string>tableDocumentInstance</string> + <string>tableDumpInstance</string> + <string>tableEncodingButton</string> + <string>tableNameField</string> + <string>tableRenameField</string> + <string>tableRenameSheet</string> + <string>tableRenameText</string> + <string>tableSheet</string> + <string>tableSourceInstance</string> + <string>tableStatusInstance</string> + <string>tableWindow</string> + <string>tablesListView</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>id</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../Source/TablesList.h</string> + </object> + </object> + </object> </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string> diff --git a/Source/TablesList.h b/Source/TablesList.h index a1268ee7..1d05d62d 100644 --- a/Source/TablesList.h +++ b/Source/TablesList.h @@ -65,6 +65,7 @@ enum sp_table_types IBOutlet NSMenuItem *removeTableMenuItem; IBOutlet NSMenuItem *duplicateTableMenuItem; IBOutlet NSMenuItem *renameTableMenuItem; + IBOutlet NSMenuItem *separatorTableMenuItem; CMMCPConnection *mySQLConnection; diff --git a/Source/TablesList.m b/Source/TablesList.m index 8d4769ac..4c90df4b 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -512,8 +512,25 @@ } [tableWindow endEditingFor:nil]; - - [tableRenameText setStringValue:[NSString stringWithFormat:@"Rename table %@ to:", [self tableName]]]; + [tableRenameField setStringValue:[self tableName]]; + [renameTableButton setEnabled:NO]; + NSString *tableType; + switch([self tableType]){ + case SP_TABLETYPE_TABLE: + tableType = @"table"; + break; + case SP_TABLETYPE_VIEW: + tableType = @"view"; + break; + case SP_TABLETYPE_PROC: + tableType = @"procedure"; + break; + case SP_TABLETYPE_FUNC: + tableType = @"function"; + break; + + } + [tableRenameText setStringValue:[NSString stringWithFormat:@"Rename %@ `%@` to:", tableType, [self tableName]]]; [NSApp beginSheet:tableRenameSheet modalForWindow:tableWindow @@ -677,10 +694,17 @@ } if (object == tableRenameField) { - [renameTableButton setEnabled:([[tableRenameField stringValue] length] > 0)]; + [renameTableButton setEnabled:([[tableRenameField stringValue] length] > 0 && ![[self tableName] isEqualToString:[tableRenameField stringValue]])]; + } +} +- (void)controlTextDidEndEditing:(NSNotification *)notification +{ + id object = [notification object]; + + if (object == tableRenameField) { + [renameTableButton performClick:object]; } } - #pragma mark Getter methods /** @@ -904,6 +928,8 @@ // Reset the table information caches [tableDataInstance resetAllData]; + [separatorTableMenuItem setHidden:NO]; + if( [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_VIEW || [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_TABLE) { // If encoding is set to Autodetect, update the connection character set encoding @@ -963,10 +989,12 @@ [[tableSubMenu itemAtIndex:8] setHidden:NO]; [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")]; [[tableSubMenu itemAtIndex:9] setHidden:YES]; // checksum - - [renameTableMenuItem setHidden:YES]; - [removeTableMenuItem setTitle:NSLocalizedString(@"Remove view", @"remove view menu title")]; + + [renameTableMenuItem setHidden:NO]; // we don't have to check the mysql version + [renameTableMenuItem setTitle:NSLocalizedString(@"Rename view", @"rename view menu title")]; + [duplicateTableMenuItem setHidden:NO]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate view", @"duplicate view menu title")]; + [removeTableMenuItem setTitle:NSLocalizedString(@"Remove view", @"remove view menu title")]; } else if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_TABLE) { [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")]; @@ -983,8 +1011,10 @@ [[tableSubMenu itemAtIndex:9] setHidden:NO]; [renameTableMenuItem setHidden:NO]; - [removeTableMenuItem setTitle:NSLocalizedString(@"Remove table", @"remove table menu title")]; + [renameTableMenuItem setTitle:NSLocalizedString(@"Rename table", @"rename table menu title")]; + [duplicateTableMenuItem setHidden:NO]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate table", @"duplicate table menu title")]; + [removeTableMenuItem setTitle:NSLocalizedString(@"Remove table", @"remove table menu title")]; } else if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_PROC) { [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Procedure Syntax", @"copy create proc syntax menu item")]; @@ -998,9 +1028,11 @@ [[tableSubMenu itemAtIndex:8] setHidden:YES]; [[tableSubMenu itemAtIndex:9] setHidden:YES]; - [renameTableMenuItem setHidden:YES]; - [removeTableMenuItem setTitle:NSLocalizedString(@"Remove procedure", @"remove proc menu title")]; + [renameTableMenuItem setHidden:NO]; + [renameTableMenuItem setTitle:NSLocalizedString(@"Rename procedure", @"rename proc menu title")]; + [duplicateTableMenuItem setHidden:NO]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate procedure", @"duplicate proc menu title")]; + [removeTableMenuItem setTitle:NSLocalizedString(@"Remove procedure", @"remove proc menu title")]; } else if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_FUNC) { [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Function Syntax", @"copy create func syntax menu item")]; @@ -1014,9 +1046,11 @@ [[tableSubMenu itemAtIndex:8] setHidden:YES]; [[tableSubMenu itemAtIndex:9] setHidden:YES]; - [renameTableMenuItem setHidden:YES]; - [removeTableMenuItem setTitle:NSLocalizedString(@"Remove function", @"remove func menu title")]; + [renameTableMenuItem setHidden:NO]; + [renameTableMenuItem setTitle:NSLocalizedString(@"Rename function", @"rename func menu title")]; + [duplicateTableMenuItem setHidden:NO]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate function", @"duplicate func menu title")]; + [removeTableMenuItem setTitle:NSLocalizedString(@"Remove function", @"remove func menu title")]; } // set window title [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion], @@ -1062,9 +1096,13 @@ break; } - } else + } else { [removeTableMenuItem setTitle:NSLocalizedString(@"Remove items", @"remove items menu title")]; + } } + [renameTableMenuItem setHidden:YES]; + [duplicateTableMenuItem setHidden:YES]; + [separatorTableMenuItem setHidden:YES]; // set window title [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance name], [tableDocumentInstance database]]]; @@ -1179,10 +1217,9 @@ } if ([menuItem action] == @selector(renameTable:)) { - if ([self tableType] == SP_TABLETYPE_VIEW) { + if ([self tableType] == SP_TABLETYPE_FUNC || [self tableType] == SP_TABLETYPE_PROC) return NO; - } - + return ([tablesListView numberOfSelectedRows] == 1) && [[self tableName] length]; } diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index cf9efe34..588e2edc 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -68,7 +68,6 @@ 380F4EF50FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4EF40FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m */; }; 380F4F250FC0C3D300B0BFD7 /* mcpKitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4F240FC0C3D300B0BFD7 /* mcpKitTest.m */; }; 380F4F270FC0C51C00B0BFD7 /* MCPKit_bundled.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3330EC2A170008D359E /* MCPKit_bundled.framework */; }; - 380F4FE30FC109E400B0BFD7 /* SPScriptEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4FE20FC109E400B0BFD7 /* SPScriptEngine.m */; }; 384582BE0FB95C9100DDACB6 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 384582BC0FB95C9100DDACB6 /* Localizable.strings */; }; 384582C40FB95FF800DDACB6 /* func-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 384582C30FB95FF800DDACB6 /* func-small.png */; }; 384582C70FB9603600DDACB6 /* proc-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 384582C60FB9603600DDACB6 /* proc-small.png */; }; @@ -284,8 +283,6 @@ 380F4EF40FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = stringCategoryAdditionsTest.m; sourceTree = "<group>"; }; 380F4F230FC0C3D300B0BFD7 /* mcpKitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mcpKitTest.h; sourceTree = "<group>"; }; 380F4F240FC0C3D300B0BFD7 /* mcpKitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = mcpKitTest.m; sourceTree = "<group>"; }; - 380F4FE10FC109E400B0BFD7 /* SPScriptEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPScriptEngine.h; sourceTree = "<group>"; }; - 380F4FE20FC109E400B0BFD7 /* SPScriptEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPScriptEngine.m; sourceTree = "<group>"; }; 384582BD0FB95C9100DDACB6 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = Interfaces/English.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; }; 384582C30FB95FF800DDACB6 /* func-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "func-small.png"; sourceTree = "<group>"; }; 384582C60FB9603600DDACB6 /* proc-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "proc-small.png"; sourceTree = "<group>"; }; @@ -559,8 +556,6 @@ 17E641710EF01F5C001BC333 /* GUI */, 17E641720EF01F6B001BC333 /* SSHTunnel */, B57747D60F7A8990003B34F9 /* Category Additions */, - 380F4FE10FC109E400B0BFD7 /* SPScriptEngine.h */, - 380F4FE20FC109E400B0BFD7 /* SPScriptEngine.m */, ); name = Other; sourceTree = "<group>"; @@ -1008,7 +1003,6 @@ 5841423F0F97E11000A34B47 /* NoodleLineNumberView.m in Sources */, BCD0AD490FBBFC340066EA5C /* SPSQLTokenizer.l in Sources */, 387BBBA80FBCB6CB00B31746 /* TableRelations.m in Sources */, - 380F4FE30FC109E400B0BFD7 /* SPScriptEngine.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; |