From 657ffd4480328d149b5f70721945f042b1849953 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 18 May 2009 14:25:08 +0000 Subject: Add most of the improvements made to the rename table sheet to the duplicate table sheet. --- Interfaces/English.lproj/DBView.xib | 289 ++++++++++----------------- Interfaces/English.lproj/Localizable.strings | Bin 47096 -> 48256 bytes Source/TablesList.h | 1 + Source/TablesList.m | 48 +++-- 4 files changed, 130 insertions(+), 208 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index b529cbbe..de7965c8 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,7 +8,7 @@ 353.00 YES - + YES @@ -46,7 +46,7 @@ {3.40282e+38, 3.40282e+38} {780, 480} - + 256 YES @@ -176,7 +176,6 @@ {{1, 1}, {212, 393}} - 6 @@ -208,7 +207,6 @@ {214, 395} - 530 @@ -293,7 +291,6 @@ {{1, 1}, {212, 123}} - 4 @@ -320,7 +317,6 @@ {{0, 404}, {214, 125}} - 530 @@ -387,7 +383,10 @@ 1048576 2147483647 - + + NSImage + button_action + _popUpItemAction: @@ -448,7 +447,6 @@ - 4 YES 1 YES @@ -2275,8 +2273,8 @@ YES YES - , - . + . + , NO YES NO @@ -2951,7 +2949,7 @@ 1048576 2147483647 - + _popUpItemAction: @@ -3917,7 +3915,6 @@ {{1, 17}, {688, 454}} - 2 @@ -3950,7 +3947,6 @@ {{1, 0}, {688, 17}} - 4 @@ -3959,7 +3955,6 @@ {{6, 32}, {690, 472}} - 562 @@ -4108,7 +4103,6 @@ {944, 550} - {{0, 0}, {1440, 878}} {780, 502} @@ -4823,7 +4817,7 @@ {3.40282e+38, 3.40282e+38} {213, 107} - + 256 YES @@ -4884,7 +4878,7 @@ 256 - {{167, 13}, {80, 28}} + {{160, 13}, {87, 28}} 1 YES @@ -4911,7 +4905,7 @@ 256 - {{89, 13}, {80, 28}} + {{82, 13}, {80, 28}} YES @@ -4931,6 +4925,7 @@ {262, 127} + {{0, 0}, {1440, 878}} {213, 129} @@ -7977,7 +7972,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 1}, {328, 180}} - @@ -8007,7 +8001,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{20, 45}, {341, 182}} - 18 @@ -8161,7 +8154,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 17}, {358, 258}} - 4 @@ -8195,7 +8187,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 0}, {358, 17}} - 4 @@ -8204,7 +8195,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{20, 45}, {371, 276}} - 18 @@ -8264,15 +8254,15 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1 2 - {{343, 483}, {269, 112}} + {{343, 480}, {269, 115}} 1886912512 tableSheet NSWindow View - {292, 112} - {269, 112} + {269, 115} + {269, 115} 256 @@ -8350,27 +8340,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 25 - - - 259 - {{116, 13}, {70, 28}} - - YES - - -2080244224 - 138018816 - Cancel - - - -2038284033 - 1 - - - Gw - 200 - 25 - - 258 @@ -8694,12 +8663,33 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1 + + + 259 + {{107, 13}, {79, 28}} + + YES + + 67239424 + 138018816 + Cancel + + + -2038284033 + 1 + + + Gw + 200 + 25 + + - {269, 112} + {269, 115} {{0, 0}, {1680, 1028}} - {269, 134} - {292, 134} + {269, 137} + {269, 137} 1 @@ -14868,14 +14858,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5686 - - - closeSheet: - - - - 5690 - closeSheet: @@ -14956,6 +14938,30 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5700 + + + closeSheet: + + + + 5703 + + + + copyTableButton + + + + 5705 + + + + delegate + + + + 5706 + @@ -18167,7 +18173,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - + @@ -18216,20 +18222,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - - 5329 - - - YES - - - - - - 5330 - - - 5331 @@ -21215,6 +21207,20 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 5701 + + + YES + + + + + + 5702 + + + @@ -22265,9 +22271,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5327.ImportedFromIB2 5328.IBPluginDependency 5328.ImportedFromIB2 - 5329.IBPluginDependency - 5329.ImportedFromIB2 - 5330.IBPluginDependency 5331.IBPluginDependency 5332.IBPluginDependency 5333.IBPluginDependency @@ -22516,6 +22519,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5682.IBPluginDependency 5683.IBPluginDependency 5684.IBPluginDependency + 5701.IBPluginDependency + 5701.ImportedFromIB2 + 5702.IBPluginDependency 579.IBPluginDependency 579.ImportedFromIB2 580.IBPluginDependency @@ -23543,8 +23549,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 ImageAndTextCell com.apple.InterfaceBuilder.CocoaPlugin - {{231, 459}, {306, 122}} - {{231, 459}, {306, 122}} + {{355, 517}, {306, 122}} + {{355, 517}, {306, 122}} @@ -23863,8 +23869,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin - {{273, 408}, {262, 127}} - {{273, 408}, {262, 127}} + {{649, 437}, {262, 127}} + {{649, 437}, {262, 127}} @@ -24052,15 +24058,13 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{749, 456}, {269, 112}} - {{749, 456}, {269, 112}} - - - - {292, 112} - {269, 112} - com.apple.InterfaceBuilder.CocoaPlugin + {{734, 411}, {269, 115}} + {{734, 411}, {269, 115}} + + + {269, 115} + {269, 115} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -24077,7 +24081,6 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin {{907, -2}, {228, 379}} com.apple.InterfaceBuilder.CocoaPlugin @@ -24329,8 +24332,8 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin - {{366, 378}, {269, 112}} - {{366, 378}, {269, 112}} + {{722, 605}, {269, 112}} + {{722, 605}, {269, 112}} @@ -24353,6 +24356,9 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -24612,7 +24618,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 5700 + 5706 @@ -25784,6 +25790,7 @@ Y2hhbmdlIHRoZSBvcmRlcg YES addTableButton + copyTableButton copyTableContentSwitch copyTableMessageField copyTableNameField @@ -25793,6 +25800,7 @@ Y2hhbmdlIHRoZSBvcmRlcg removeTableMenuItem renameTableButton renameTableMenuItem + separatorTableMenuItem tabView tableContentInstance tableDataInstance @@ -25817,10 +25825,12 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id NSMenuItem NSMenuItem id NSMenuItem + NSMenuItem id id id @@ -25852,101 +25862,6 @@ Y2hhbmdlIHRoZSBvcmRlcg - - YES - - TablesList - NSObject - - YES - - YES - addTable: - closeCopyTableSheet: - closeSheet: - copyTable: - removeTable: - renameTable: - updateTables: - - - YES - id - id - id - id - id - id - id - - - - YES - - YES - addTableButton - copyTableContentSwitch - copyTableMessageField - copyTableNameField - copyTableSheet - customQueryInstance - duplicateTableMenuItem - removeTableMenuItem - renameTableButton - renameTableMenuItem - separatorTableMenuItem - tabView - tableContentInstance - tableDataInstance - tableDocumentInstance - tableDumpInstance - tableEncodingButton - tableNameField - tableRenameField - tableRenameSheet - tableRenameText - tableSheet - tableSourceInstance - tableStatusInstance - tableWindow - tablesListView - - - YES - id - id - id - id - id - id - NSMenuItem - NSMenuItem - id - NSMenuItem - NSMenuItem - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - IBDocumentRelativeSource - ../../Source/TablesList.h - - - 0 ../../sequel-pro.xcodeproj diff --git a/Interfaces/English.lproj/Localizable.strings b/Interfaces/English.lproj/Localizable.strings index d7e2d1eb..1eda8574 100644 Binary files a/Interfaces/English.lproj/Localizable.strings and b/Interfaces/English.lproj/Localizable.strings differ diff --git a/Source/TablesList.h b/Source/TablesList.h index 1d05d62d..1024e57a 100644 --- a/Source/TablesList.h +++ b/Source/TablesList.h @@ -49,6 +49,7 @@ enum sp_table_types IBOutlet id tableWindow; IBOutlet id copyTableSheet; IBOutlet id tablesListView; + IBOutlet id copyTableButton; IBOutlet id copyTableNameField; IBOutlet id copyTableMessageField; IBOutlet id copyTableContentSwitch; diff --git a/Source/TablesList.m b/Source/TablesList.m index 23b70ba9..56286838 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -390,36 +390,35 @@ if ( ![tableSourceInstance saveRowOnDeselect] || ![tableContentInstance saveRowOnDeselect] ) { return; } + [tableWindow endEditingFor:nil]; // Detect table type: table or view tblType = [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue]; - switch(tblType){ + + switch (tblType){ case SP_TABLETYPE_TABLE: - tableType = NSLocalizedString(@"table",@"table"); - [copyTableMessageField setStringValue:NSLocalizedString(@"Duplicate table to", @"duplicate table message")]; - [copyTableContentSwitch setEnabled:YES]; - break; + tableType = NSLocalizedString(@"table",@"table"); + [copyTableContentSwitch setEnabled:YES]; + break; case SP_TABLETYPE_VIEW: - tableType = NSLocalizedString(@"view",@"view"); - [copyTableMessageField setStringValue:NSLocalizedString(@"Duplicate view to", @"duplicate view message")]; - [copyTableContentSwitch setEnabled:NO]; - break; + tableType = NSLocalizedString(@"view",@"view"); + [copyTableContentSwitch setEnabled:NO]; + break; case SP_TABLETYPE_PROC: - tableType = NSLocalizedString(@"procedure",@"procedure"); - [copyTableMessageField setStringValue:NSLocalizedString(@"Duplicate procedure to", @"duplicate procedure message")]; - [copyTableContentSwitch setEnabled:NO]; - break; + tableType = NSLocalizedString(@"procedure",@"procedure"); + [copyTableContentSwitch setEnabled:NO]; + break; case SP_TABLETYPE_FUNC: - tableType = NSLocalizedString(@"function",@"function"); - [copyTableMessageField setStringValue:NSLocalizedString(@"Duplicate function to", @"duplicate function message")]; - [copyTableContentSwitch setEnabled:NO]; - break; + tableType = NSLocalizedString(@"function",@"function"); + [copyTableContentSwitch setEnabled:NO]; + break; } - + + [copyTableMessageField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Duplicate %@ '%@' to:", @"duplicate object message"), tableType, [self tableName]]]; //open copyTableSheet - [copyTableNameField setStringValue:[NSString stringWithFormat:@"%@Copy", [tables objectAtIndex:[tablesListView selectedRow]]]]; + [copyTableNameField setStringValue:[NSString stringWithFormat:@"%@_copy", [tables objectAtIndex:[tablesListView selectedRow]]]]; [copyTableContentSwitch setState:NSOffState]; [NSApp beginSheet:copyTableSheet @@ -570,6 +569,7 @@ tableType = NSLocalizedString(@"function",@"function"); break; } + [tableRenameText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Rename %@ '%@' to:",@"rename item name to:"), tableType, [self tableName]]]; [NSApp beginSheet:tableRenameSheet @@ -776,10 +776,15 @@ [addTableButton setEnabled:([[tableNameField stringValue] length] > 0)]; } + if (object == copyTableNameField) { + ([copyTableButton setEnabled:([[copyTableNameField stringValue] length] > 0) && (![[self tableName] isEqualToString:[copyTableNameField stringValue]])]); + } + if (object == tableRenameField) { - [renameTableButton setEnabled:([[tableRenameField stringValue] length] > 0 && ![[self tableName] isEqualToString:[tableRenameField stringValue]])]; + ([renameTableButton setEnabled:([[tableRenameField stringValue] length] > 0) && (![[self tableName] isEqualToString:[tableRenameField stringValue]])]); } } + - (void)controlTextDidEndEditing:(NSNotification *)notification { id object = [notification object]; @@ -788,6 +793,7 @@ [renameTableButton performClick:object]; } } + #pragma mark Getter methods /** @@ -989,7 +995,7 @@ alertSheetOpened = YES; NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow", - [NSString stringWithFormat:NSLocalizedString(@"Couldn't rename '%@'.\nMySQL said: %@", @"message of panel when item cannot be renamed"), + [NSString stringWithFormat:NSLocalizedString(@"Couldn't rename '%@'.\nMySQL said: %@", @"message of panel when an item cannot be renamed"), anObject, [mySQLConnection getLastErrorMessage]]); } } -- cgit v1.2.3