diff options
-rw-r--r-- | Interfaces/English.lproj/MainMenu.xib | 66 | ||||
-rw-r--r-- | Source/CMCopyTable.h | 4 | ||||
-rw-r--r-- | Source/CMCopyTable.m | 22 | ||||
-rw-r--r-- | Source/TableDocument.h | 1 | ||||
-rw-r--r-- | Source/TableDocument.m | 18 | ||||
-rw-r--r-- | Source/TablesList.m | 36 |
6 files changed, 61 insertions, 86 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib index e25afd7e..fc74428e 100644 --- a/Interfaces/English.lproj/MainMenu.xib +++ b/Interfaces/English.lproj/MainMenu.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9G55</string> + <string key="IBDocument.SystemVersion">9J61</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.43</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="924"/> + <integer value="29"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -575,6 +575,15 @@ <reference key="NSOnImage" ref="625762401"/> <reference key="NSMixedImage" ref="315854375"/> </object> + <object class="NSMenuItem" id="609933882"> + <reference key="NSMenu" ref="71086556"/> + <string key="NSTitle">Copy with Column Names</string> + <string key="NSKeyEquiv">c</string> + <int key="NSKeyEquivModMask">1572864</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="625762401"/> + <reference key="NSMixedImage" ref="315854375"/> + </object> <object class="NSMenuItem" id="892596559"> <reference key="NSMenu" ref="71086556"/> <string key="NSTitle">Paste</string> @@ -1405,25 +1414,6 @@ <reference key="NSOnImage" ref="625762401"/> <reference key="NSMixedImage" ref="315854375"/> </object> - <object class="NSMenuItem" id="17386715"> - <reference key="NSMenu" ref="1056168652"/> - <string key="NSTitle">Copy Column Names</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="625762401"/> - <reference key="NSMixedImage" ref="315854375"/> - </object> - <object class="NSMenuItem" id="477591318"> - <reference key="NSMenu" ref="1056168652"/> - <bool key="NSIsDisabled">YES</bool> - <bool key="NSIsSeparator">YES</bool> - <string key="NSTitle"/> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="625762401"/> - <reference key="NSMixedImage" ref="315854375"/> - </object> <object class="NSMenuItem" id="785987636"> <reference key="NSMenu" ref="1056168652"/> <string key="NSTitle">Check Table</string> @@ -2376,11 +2366,11 @@ </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">copyColumnNames:</string> + <string key="label">copy:</string> <reference key="source" ref="63651044"/> - <reference key="destination" ref="17386715"/> + <reference key="destination" ref="609933882"/> </object> - <int key="connectionID">925</int> + <int key="connectionID">927</int> </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> @@ -3190,6 +3180,7 @@ <reference ref="287358431"/> <reference ref="465877627"/> <reference ref="1946"/> + <reference ref="609933882"/> </object> <reference key="parent" ref="119995921"/> </object> @@ -3467,8 +3458,6 @@ <reference ref="587676764"/> <reference ref="785987636"/> <reference ref="449401330"/> - <reference ref="477591318"/> - <reference ref="17386715"/> </object> <reference key="parent" ref="228261277"/> </object> @@ -3548,14 +3537,9 @@ <reference key="parent" ref="302471527"/> </object> <object class="IBObjectRecord"> - <int key="objectID">923</int> - <reference key="object" ref="477591318"/> - <reference key="parent" ref="1056168652"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">924</int> - <reference key="object" ref="17386715"/> - <reference key="parent" ref="1056168652"/> + <int key="objectID">926</int> + <reference key="object" ref="609933882"/> + <reference key="parent" ref="71086556"/> </object> </object> </object> @@ -3888,8 +3872,8 @@ <string>914.IBPluginDependency</string> <string>92.IBPluginDependency</string> <string>92.ImportedFromIB2</string> - <string>923.IBPluginDependency</string> - <string>924.IBPluginDependency</string> + <string>926.IBPluginDependency</string> + <string>926.ImportedFromIB2</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -3950,7 +3934,7 @@ <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{476, 517}, {146, 213}}</string> + <string>{{476, 497}, {268, 233}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{{654, 613}, {157, 223}}</string> @@ -4160,7 +4144,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{446, 257}, {209, 193}}</string> + <string>{{434, 537}, {209, 193}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{{180, 535}, {182, 253}}</string> @@ -4262,7 +4246,7 @@ w6gg4oaSIGZhY2FkZV0</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -4285,7 +4269,7 @@ w6gg4oaSIGZhY2FkZV0</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">925</int> + <int key="maxID">927</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/Source/CMCopyTable.h b/Source/CMCopyTable.h index 8b4e1485..071554b1 100644 --- a/Source/CMCopyTable.h +++ b/Source/CMCopyTable.h @@ -68,7 +68,7 @@ - (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal; /*! - @method selectedRowsAsTabString + @method selectedRowsAsTabStringWithHeaders @abstract getter of the selected rows of the table for copy @discussion For the selected rows returns a single string with each row separated by a newline and then for each column value separated by a @@ -76,7 +76,7 @@ returns something meaningful. @result The above described string, or nil if nothing selected */ -- (NSString *)selectedRowsAsTabString; +- (NSString *)selectedRowsAsTabStringWithHeaders:(BOOL)withHeaders; /*! @method draggedRowsAsTabString: diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m index 7eb80c52..e0f29aaa 100644 --- a/Source/CMCopyTable.m +++ b/Source/CMCopyTable.m @@ -27,8 +27,14 @@ - (void)copy:(id)sender { - NSString *tmp = [self selectedRowsAsTabString]; + NSString *tmp = nil; + + BOOL withHeaders = NO; + if([[sender title] isEqualToString:@"Copy with Column Names"]) { + withHeaders = YES; + } + tmp = [self selectedRowsAsTabStringWithHeaders:withHeaders]; if ( nil != tmp ) { NSPasteboard *pb = [NSPasteboard generalPasteboard]; @@ -52,7 +58,7 @@ - (BOOL)validateMenuItem:(NSMenuItem*)anItem { int row = [self selectedRow]; - if ([[anItem title] isEqualToString:@"Copy"] ) + if ( [[anItem title] isEqualToString:@"Copy"] || [[anItem title] isEqualToString:@"Copy with Column Names"] ) { if (row < 0 ) { @@ -64,7 +70,7 @@ //get selected rows a string of newline separated lines of tab separated fields //the value in each field is from the objects description method -- (NSString *)selectedRowsAsTabString +- (NSString *)selectedRowsAsTabStringWithHeaders:(BOOL)withHeaders { if ( [self numberOfSelectedRows] > 0 ) { @@ -73,7 +79,15 @@ id dataSource = [self dataSource]; NSMutableString *result = [NSMutableString stringWithCapacity:numColumns]; - + + if(withHeaders) { + int i; + for( i = 0; i < numColumns; i++ ){ + [result appendString:[NSString stringWithFormat:@"%@\t", [[[columns objectAtIndex:i] headerCell] stringValue]]]; + } + [result appendString:[NSString stringWithFormat:@"\n"]]; + } + //this is really deprecated in 10.3, but the new method is really weird NSEnumerator *enumerator = [self selectedRowEnumerator]; diff --git a/Source/TableDocument.h b/Source/TableDocument.h index 17440f68..33a70e90 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -150,7 +150,6 @@ //table methods - (IBAction)showCreateTableSyntax:(id)sender; - (IBAction)copyCreateTableSyntax:(id)sender; -- (IBAction)copyColumnNames:(id)sender; - (NSArray *)columnNames; - (IBAction)checkTable:(id)sender; - (IBAction)analyzeTable:(id)sender; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 3c02e687..3e666cfd 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1023,23 +1023,6 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum notificationName:@"Syntax Copied"]; } -- (IBAction)copyColumnNames:(id)sender -{ - //NSArray *columns; - NSString *columnNames; - //columns = ; - if ([self columnNames]) { - columnNames = [NSString stringWithFormat:@"`%@`", [[self columnNames] componentsJoinedByString:@"`, `"]]; - } - - if([columnNames length]){ - NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; - // Copy the string to the pasteboard - [pasteBoard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil]; - [pasteBoard setString:columnNames forType:NSStringPboardType]; - } -} - - (NSArray *)columnNames { NSArray *columns = nil; @@ -1553,7 +1536,6 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum // table menu items if ([menuItem action] == @selector(showCreateTableSyntax:) || [menuItem action] == @selector(copyCreateTableSyntax:) || - [menuItem action] == @selector(copyColumnNames:) || [menuItem action] == @selector(checkTable:) || [menuItem action] == @selector(analyzeTable:) || [menuItem action] == @selector(optimizeTable:) || diff --git a/Source/TablesList.m b/Source/TablesList.m index 0a264482..bd5a65e9 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -867,15 +867,15 @@ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create View Syntax", @"copy create view syntax menu item")]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create View Syntax", @"show create view syntax menu item")]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:2] setHidden:NO]; // divider - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setHidden:NO]; // copy columns - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:4] setHidden:NO]; // divider - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:5] setTitle:NSLocalizedString(@"Check View", @"check view menu item")]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:6] setHidden:YES]; // repair - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:YES]; // divider - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setHidden:YES]; // analyse - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:YES]; // optimize - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:10] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:11] setHidden:YES]; // checksum + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setHidden:NO]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setTitle:NSLocalizedString(@"Check View", @"check view menu item")]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:4] setHidden:YES]; // repair + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:5] setHidden:YES]; // divider + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:6] setHidden:YES]; // analyse + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:YES]; // optimize + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setHidden:NO]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:YES]; // checksum [removeTableMenuItem setTitle:NSLocalizedString(@"Remove view", @"remove view menu title")]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate view", @"duplicate view menu title")]; @@ -884,15 +884,15 @@ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Table Syntax", @"show create table syntax menu item")]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:2] setHidden:NO]; // divider - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setHidden:NO]; // copy columns - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:4] setHidden:NO]; // divider - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:5] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setHidden:NO]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:4] setHidden:NO]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:5] setHidden:NO]; // divider [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:6] setHidden:NO]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:NO]; // divider + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:NO]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setHidden:NO]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:NO]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:10] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:11] setHidden:NO]; [removeTableMenuItem setTitle:NSLocalizedString(@"Remove table", @"remove table menu title")]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate table", @"duplicate table menu title")]; @@ -908,8 +908,6 @@ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:YES]; // divider [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setHidden:YES]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:YES]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:10] setHidden:YES]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:11] setHidden:YES]; [removeTableMenuItem setTitle:NSLocalizedString(@"Remove procedure", @"remove proc menu title")]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate procedure", @"duplicate proc menu title")]; @@ -924,9 +922,7 @@ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:6] setHidden:YES]; [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:YES]; // divider [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setHidden:YES]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:YES]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:10] setHidden:YES]; - [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:11] setHidden:YES]; + [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:YES]; [removeTableMenuItem setTitle:NSLocalizedString(@"Remove function", @"remove func menu title")]; [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate function", @"duplicate func menu title")]; |