aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-04-23 07:10:57 +0000
committerBibiko <bibiko@eva.mpg.de>2009-04-23 07:10:57 +0000
commit4d4db598830ce633c32577ff98c65963aa4c7aa4 (patch)
tree52a0378ab3580ad68be8dfec5051be02f08e2130
parent60d4410b32e957df668713fb53c8f041d1325fdb (diff)
downloadsequelpro-4d4db598830ce633c32577ff98c65963aa4c7aa4.tar.gz
sequelpro-4d4db598830ce633c32577ff98c65963aa4c7aa4.tar.bz2
sequelpro-4d4db598830ce633c32577ff98c65963aa4c7aa4.zip
• synchronized gear menu titles for "Remove table/view" according to selected table/view types
• disable/enable gear menu item "Duplicate table/view" according to the number of selected tables/views => for > 1 selected items disable the menu item
-rw-r--r--Interfaces/English.lproj/DBView.xib111
-rw-r--r--Source/TablesList.h3
-rw-r--r--Source/TablesList.m38
3 files changed, 142 insertions, 10 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 4efff6ed..ff4011c2 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -8,8 +8,8 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="3994"/>
<integer value="4811"/>
+ <integer value="3994"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -3153,7 +3153,7 @@
</object>
</object>
</object>
- <int key="NSSelectedIndex">13</int>
+ <int key="NSSelectedIndex">2</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -12721,6 +12721,22 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">5424</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">removeTableMenuItem</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="831803264"/>
+ </object>
+ <int key="connectionID">5425</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">duplicateTableMenuItem</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="924446696"/>
+ </object>
+ <int key="connectionID">5426</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -20138,7 +20154,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{0, 724}, {200, 32}}</string>
+ <string>{{1861, 680}, {200, 32}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{628, 654}</string>
<string>{{284, 769}, {200, 32}}</string>
@@ -20437,7 +20453,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{90, 158}, {175, 73}}</string>
+ <string>{{323, 314}, {175, 73}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
@@ -20459,8 +20475,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{81, 206}, {944, 550}}</string>
- <string>{{81, 206}, {944, 550}}</string>
+ <string>{{314, 362}, {944, 550}}</string>
+ <string>{{314, 362}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -20642,7 +20658,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{290, 331}, {236, 254}}</string>
+ <string>{{1847, 269}, {236, 254}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -21025,7 +21041,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5424</int>
+ <int key="maxID">5426</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -22129,6 +22145,85 @@ 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>closeTableSheet:</string>
+ <string>copyTable:</string>
+ <string>removeTable:</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>
+ </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>copyTableNameField</string>
+ <string>copyTableSheet</string>
+ <string>customQueryInstance</string>
+ <string>duplicateTableMenuItem</string>
+ <string>removeTableMenuItem</string>
+ <string>tabView</string>
+ <string>tableContentInstance</string>
+ <string>tableDataInstance</string>
+ <string>tableDocumentInstance</string>
+ <string>tableDumpInstance</string>
+ <string>tableEncodingButton</string>
+ <string>tableNameField</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>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>
+ </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 76b49609..f3abca1b 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -53,6 +53,9 @@ enum sp_table_types
IBOutlet id tableNameField;
IBOutlet id tableEncodingButton;
IBOutlet id addTableButton;
+
+ IBOutlet NSMenuItem *removeTableMenuItem;
+ IBOutlet NSMenuItem *duplicateTableMenuItem;
CMMCPConnection *mySQLConnection;
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 0d3aa48e..c78ca385 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -715,7 +715,21 @@
contentLoaded = NO;
statusLoaded = NO;
}
-
+
+ // To be able to disable duplicateTableMenuItem
+ [[duplicateTableMenuItem menu] setAutoenablesItems:NO];
+
+ // Set gear menu items Remove/Duplicate table/view according to the table types
+ [duplicateTableMenuItem setEnabled:YES];
+ if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_VIEW)
+ {
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove view", @"remove view menu title")];
+ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate view", @"duplicate view menu title")];
+ } else {
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove table", @"remove table menu title")];
+ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate table", @"duplicate table menu title")];
+ }
+
// set window title
[tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
[tableDocumentInstance name], [tableDocumentInstance database], [tables objectAtIndex:[tablesListView selectedRow]]]];
@@ -726,7 +740,27 @@
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
-
+
+ // To be able to disable duplicateTableMenuItem
+ [[duplicateTableMenuItem menu] setAutoenablesItems:NO];
+
+ // Set gear menu items Remove/Duplicate table/view according to the table types
+ NSIndexSet *indexes = [tablesListView selectedRowIndexes];
+ unsigned currentIndex = [indexes lastIndex];
+ [duplicateTableMenuItem setEnabled:NO];
+ int tblTypesChecksum = 0;
+ while (currentIndex != NSNotFound)
+ {
+ tblTypesChecksum += [[tableTypes objectAtIndex:currentIndex] intValue];
+ currentIndex = [indexes indexLessThanIndex:currentIndex];
+ }
+ if(tblTypesChecksum == 0)
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove tables", @"remove tables menu title")];
+ else if(tblTypesChecksum == [indexes count])
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove views", @"remove views menu title")];
+ else
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove tables/views", @"remove tables/views menu title")];
+
// set window title
[tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion],
[tableDocumentInstance name], [tableDocumentInstance database]]];