From 37bd86b2879c107ebb026954693540979cf25e2a Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 24 Jun 2009 15:03:22 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20separate=20Menu=20"Context=20Menu?= =?UTF-8?q?=20(Table=20List)"=20to=20DBView.xib=20-=20it's=20used=20for=20?= =?UTF-8?q?the=20contextual=20menu=20for=20the=20Table=20List=20=E2=80=A2?= =?UTF-8?q?=20fixed:=20contextual=20menu=20in=20Table=20List?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interfaces/English.lproj/DBView.xib | 489 ++++++++++++++++++++++++++++++++++-- Source/TablesList.h | 7 + Source/TablesList.m | 56 ++++- 3 files changed, 528 insertions(+), 24 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 35e3f50f..2f8ab81c 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,8 +8,8 @@ 353.00 YES - - + + YES @@ -92,6 +92,7 @@ 4352 {212, 381} + YES @@ -188,6 +189,7 @@ {212, 381} + @@ -203,6 +205,7 @@ -2147483392 {{175, 1}, {15, 481}} + _doScroller: 9.979253e-01 @@ -212,6 +215,7 @@ 256 {{-100, -100}, {141, 11}} + 257 _doScroller: @@ -220,6 +224,7 @@ {212, 381} + 528 @@ -230,10 +235,12 @@ {212, 381} + {212, 381} + NSView @@ -256,6 +263,7 @@ 4352 {212, 145} + YES @@ -319,6 +327,7 @@ {212, 145} + @@ -329,6 +338,7 @@ -2147483392 {{-100, -100}, {15, 20}} + _doScroller: 9.473684e-01 @@ -338,6 +348,7 @@ 256 {{-100, -100}, {141, 11}} + 257 _doScroller: @@ -346,6 +357,7 @@ {212, 145} + 512 @@ -356,11 +368,13 @@ {{0, 382}, {212, 145}} + NSView {{0, 23}, {212, 527}} + 2 NO @@ -411,6 +425,7 @@ 268 {{-1, -1}, {32, 24}} + YES 67239424 @@ -435,6 +450,7 @@ 268 {{30, -1}, {32, 24}} + YES 71433792 @@ -454,7 +470,6 @@ 1048576 2147483647 - 1 NSImage NSActionTemplate @@ -530,6 +545,7 @@ + 4 YES 1 YES @@ -541,6 +557,7 @@ 268 {{61, -1}, {32, 24}} + YES 67239424 @@ -565,6 +582,7 @@ 268 {{92, -1}, {32, 24}} + YES -2080244224 @@ -591,6 +609,7 @@ {212, 23} + YES YES NO @@ -599,6 +618,7 @@ {212, 550} + NSView @@ -611,6 +631,7 @@ 274 {{-7, -10}, {735, 564}} + YES @@ -645,12 +666,14 @@ 4352 {688, 289} + YES 256 {688, 17} + @@ -658,6 +681,7 @@ -2147483392 {{-26, 0}, {16, 17}} + YES @@ -1190,6 +1214,7 @@ {{1, 17}, {688, 289}} + @@ -1200,6 +1225,7 @@ -2147483392 {{611, 17}, {15, 274}} + _doScroller: 9.858657e-01 @@ -1209,6 +1235,7 @@ -2147483392 {{1, 291}, {610, 15}} + 1 _doScroller: @@ -1223,6 +1250,7 @@ {{1, 0}, {688, 17}} + @@ -1232,6 +1260,7 @@ {{-1, 22}, {690, 307}} + 562 @@ -1246,6 +1275,7 @@ 292 {{-1, -1}, {32, 25}} + YES -1543373312 @@ -1274,6 +1304,7 @@ 292 {{93, -1}, {32, 25}} + YES -2080244224 @@ -1298,6 +1329,7 @@ 292 {{30, -1}, {32, 25}} + YES -1543373312 @@ -1322,6 +1354,7 @@ 292 {{61, -1}, {32, 25}} + YES -1543373312 @@ -1358,6 +1391,7 @@ {{125, 0}, {532, 23}} + YES 130560 @@ -1378,6 +1412,7 @@ 289 {{657, -1}, {32, 25}} + YES -1543373312 @@ -1400,6 +1435,7 @@ {689, 329} + NSView @@ -1417,6 +1453,7 @@ 268 {{3, 3}, {49, 14}} + YES 68288064 @@ -1455,6 +1492,7 @@ {{672, 4}, {10, 13}} + YES 130560 @@ -1473,6 +1511,7 @@ {{0, 181}, {689, 20}} + 1 MC42NzU3Njg0OSAwLjcyMTk0ODE1IDAuNzY1MzA2MTIAA @@ -1514,12 +1553,14 @@ 4352 {688, 142} + YES 256 {688, 17} + @@ -1527,6 +1568,7 @@ -2147483392 {{-26, 0}, {16, 17}} + YES @@ -1779,6 +1821,7 @@ {{1, 17}, {688, 142}} + @@ -1789,6 +1832,7 @@ -2147483392 {{611, 17}, {15, 126}} + _doScroller: 8.936170e-01 @@ -1798,6 +1842,7 @@ -2147483392 {{1, 143}, {610, 15}} + 1 _doScroller: @@ -1812,6 +1857,7 @@ {{1, 0}, {688, 17}} + @@ -1821,6 +1867,7 @@ {{-1, 22}, {690, 160}} + 562 @@ -1835,6 +1882,7 @@ 292 {{-1, -1}, {32, 25}} + YES -1543373312 @@ -1856,6 +1904,7 @@ 292 {{61, -1}, {32, 25}} + YES -2080244224 @@ -1877,6 +1926,7 @@ 292 {{30, -1}, {32, 25}} + YES -1543373312 @@ -1910,6 +1960,7 @@ {{93, 0}, {596, 23}} + YES 130560 @@ -1925,16 +1976,19 @@ {{0, 330}, {689, 201}} + NSView {{7, 10}, {689, 531}} + 2 {{10, 7}, {700, 544}} + Structure @@ -2296,8 +2350,8 @@ YES YES - . - , + , + . NO YES NO @@ -4399,17 +4453,20 @@ {{221, 0}, {723, 550}} + NSView {944, 550} + YES DBViewSplitter {944, 550} + {{0, 0}, {1920, 1178}} {780, 502} @@ -6215,7 +6272,7 @@ {600, 127} {260, 127} - + 256 YES @@ -6224,6 +6281,7 @@ 266 {{17, 93}, {226, 14}} + YES 67239488 @@ -6240,6 +6298,7 @@ 258 {{20, 67}, {220, 18}} + YES -1804468671 @@ -6257,6 +6316,7 @@ 292 {{19, 43}, {189, 18}} + YES 67239424 @@ -6278,6 +6338,7 @@ 289 {{158, 13}, {87, 28}} + 1 YES @@ -6301,6 +6362,7 @@ 289 {{80, 13}, {80, 28}} + YES 67239424 @@ -6319,6 +6381,8 @@ {260, 127} + + {{0, 0}, {1440, 878}} {260, 149} @@ -6337,7 +6401,7 @@ {600, 112} {260, 112} - + 256 YES @@ -6420,6 +6484,7 @@ {260, 112} + {{0, 0}, {1680, 1028}} {260, 134} @@ -12510,7 +12575,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 NSView - + 265 YES @@ -12568,7 +12633,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {110, 20} - NSView @@ -12624,6 +12688,54 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 SPDatabaseData + + + + YES + + + Rename Table... + + 2147483647 + + + + + + Duplicate Table... + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Truncate Table... + + 2147483647 + + + + + + Remove Table... + + 2147483647 + + + + + @@ -15288,14 +15400,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 5694 - - - renameTableButton - - - - 5695 - tableRenameField @@ -16300,6 +16404,134 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6172 + + + menu + + + + 6187 + + + + duplicateTableMenuItem + + + + 6189 + + + + separatorTableMenuItem + + + + 6191 + + + + truncateTableButton + + + + 6192 + + + + removeTableMenuItem + + + + 6193 + + + + renameTable: + + + + 6194 + + + + renameTableMenuItem + + + + 6196 + + + + copyTable: + + + + 6197 + + + + truncateTable: + + + + 6198 + + + + removeTable: + + + + 6199 + + + + renameTableContextMenuItem + + + + 6200 + + + + duplicateTableContextMenuItem + + + + 6201 + + + + separatorTableContextMenuItem + + + + 6202 + + + + removeTableContextMenuItem + + + + 6203 + + + + truncateTableContextButton + + + + 6204 + + + + renameTableButton + + + + 6206 + @@ -23062,6 +23294,45 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 6180 + + + YES + + + + + + + + Context Menu (Table List) + + + 6182 + + + + + 6183 + + + + + 6184 + + + + + 6185 + + + + + 6186 + + + @@ -24449,6 +24720,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6157.IBAttributePlaceholdersKey 6157.IBPluginDependency 6158.IBPluginDependency + 6159.IBAttributePlaceholdersKey 6159.IBPluginDependency 6160.IBAttributePlaceholdersKey 6160.IBPluginDependency @@ -24456,6 +24728,17 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 617.ImportedFromIB2 6170.IBPluginDependency 6171.IBPluginDependency + 6180.IBEditorWindowLastContentRect + 6180.IBPluginDependency + 6182.IBAttributePlaceholdersKey + 6182.IBPluginDependency + 6183.IBPluginDependency + 6184.IBAttributePlaceholdersKey + 6184.IBPluginDependency + 6185.IBAttributePlaceholdersKey + 6185.IBPluginDependency + 6186.IBAttributePlaceholdersKey + 6186.IBPluginDependency 654.IBPluginDependency 654.ImportedFromIB2 655.IBPluginDependency @@ -25612,8 +25895,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{342, 190}, {944, 550}} - {{342, 190}, {944, 550}} + {{306, 323}, {944, 550}} + {{306, 323}, {944, 550}} {{62, 352}, {845, 504}} @@ -26082,8 +26365,8 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{736, 625}, {260, 112}} - {{736, 625}, {260, 112}} + {{695, 423}, {260, 112}} + {{695, 423}, {260, 112}} @@ -26320,7 +26603,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit - {{400, 219}, {157, 98}} + {{325, 248}, {157, 98}} com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit @@ -26346,6 +26629,14 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Delete all records of selected table(s) + + com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -26360,6 +26651,45 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.brandonwalkin.BWToolkit com.brandonwalkin.BWToolkit + {{623, 397}, {174, 93}} + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Remove the selected item(s) + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Delete all records of selected table(s) + + + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Duplicate the selected item + + + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Rename the selected item + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -26580,7 +26910,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 6172 + 6206 @@ -27889,6 +28219,119 @@ Y2hhbmdlIHRoZSBvcmRlcg + + YES + + TablesList + NSObject + + YES + + YES + addTable: + closeCopyTableSheet: + closeSheet: + copyTable: + removeTable: + renameTable: + truncateTable: + updateTables: + + + YES + id + id + id + id + id + id + id + id + + + + YES + + YES + addTableButton + copyTableButton + copyTableContentSwitch + copyTableMessageField + copyTableNameField + copyTableSheet + customQueryInstance + duplicateTableContextMenuItem + duplicateTableMenuItem + extendedTableInfoInstance + removeTableContextMenuItem + removeTableMenuItem + renameTableButton + renameTableContextMenuItem + renameTableMenuItem + separatorTableContextMenuItem + separatorTableMenuItem + tabView + tableContentInstance + tableDataInstance + tableDocumentInstance + tableDumpInstance + tableEncodingButton + tableNameField + tableRenameField + tableRenameSheet + tableRenameText + tableSheet + tableSourceInstance + tableTypeButton + tableWindow + tablesListView + truncateTableButton + truncateTableContextButton + + + YES + id + id + id + id + id + id + id + NSMenuItem + NSMenuItem + id + NSMenuItem + NSMenuItem + id + NSMenuItem + NSMenuItem + NSMenuItem + NSMenuItem + id + id + 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/Source/TablesList.h b/Source/TablesList.h index 574f9c18..0c2848ef 100644 --- a/Source/TablesList.h +++ b/Source/TablesList.h @@ -65,12 +65,19 @@ enum sp_table_types IBOutlet id tableRenameText; IBOutlet id renameTableButton; IBOutlet id truncateTableButton; + IBOutlet id truncateTableContextButton; IBOutlet NSMenuItem *removeTableMenuItem; IBOutlet NSMenuItem *duplicateTableMenuItem; IBOutlet NSMenuItem *renameTableMenuItem; IBOutlet NSMenuItem *separatorTableMenuItem; + IBOutlet NSMenuItem *removeTableContextMenuItem; + IBOutlet NSMenuItem *duplicateTableContextMenuItem; + IBOutlet NSMenuItem *renameTableContextMenuItem; + IBOutlet NSMenuItem *separatorTableContextMenuItem; + + CMMCPConnection *mySQLConnection; NSMutableArray *tables; diff --git a/Source/TablesList.m b/Source/TablesList.m index bf8976c2..b4f8b7c2 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -684,7 +684,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; - if ([tablesListView numberOfSelectedRows] == 1) { + if ([tablesListView numberOfSelectedRows] == 1) { [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Truncate table '%@'?", @"truncate table message"), [tables objectAtIndex:[tablesListView selectedRow]]]]; [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete ALL records in the table '%@'. This operation cannot be undone.", @"truncate table informative message"), [tables objectAtIndex:[tablesListView selectedRow]]]]; } @@ -1153,6 +1153,7 @@ [tableDataInstance resetAllData]; [separatorTableMenuItem setHidden:NO]; + [separatorTableContextMenuItem setHidden:NO]; if( [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_VIEW || [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_TABLE) { @@ -1228,6 +1229,13 @@ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate View...", @"duplicate view menu title")]; [truncateTableButton setHidden:YES]; [removeTableMenuItem setTitle:NSLocalizedString(@"Remove View", @"remove view menu title")]; + + [renameTableContextMenuItem setHidden:NO]; // we don't have to check the mysql version + [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename View...", @"rename view menu title")]; + [duplicateTableContextMenuItem setHidden:NO]; + [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate View...", @"duplicate view menu title")]; + [truncateTableContextButton setHidden:YES]; + [removeTableContextMenuItem 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")]; @@ -1250,6 +1258,15 @@ [truncateTableButton setHidden:NO]; [truncateTableButton setTitle:NSLocalizedString(@"Truncate Table", @"truncate table menu title")]; [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Table", @"remove table menu title")]; + + [renameTableContextMenuItem setHidden:NO]; + [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Table...", @"rename table menu title")]; + [duplicateTableContextMenuItem setHidden:NO]; + [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Table...", @"duplicate table menu title")]; + [truncateTableContextButton setHidden:NO]; + [truncateTableContextButton setTitle:NSLocalizedString(@"Truncate Table", @"truncate table menu title")]; + [removeTableContextMenuItem 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")]; @@ -1269,6 +1286,14 @@ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Procedure...", @"duplicate proc menu title")]; [truncateTableButton setHidden:YES]; [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Procedure", @"remove proc menu title")]; + + [renameTableContextMenuItem setHidden:NO]; + [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Procedure...", @"rename proc menu title")]; + [duplicateTableContextMenuItem setHidden:NO]; + [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Procedure...", @"duplicate proc menu title")]; + [truncateTableContextButton setHidden:YES]; + [removeTableContextMenuItem 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")]; @@ -1288,6 +1313,14 @@ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Function...", @"duplicate func menu title")]; [truncateTableButton setHidden:YES]; [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Function", @"remove func menu title")]; + + [renameTableContextMenuItem setHidden:NO]; + [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Function...", @"rename func menu title")]; + [duplicateTableContextMenuItem setHidden:NO]; + [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Function...", @"duplicate func menu title")]; + [truncateTableContextButton setHidden:YES]; + [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Function", @"remove func menu title")]; + } // set window title [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion], @@ -1328,25 +1361,46 @@ case SP_TABLETYPE_TABLE: [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")]; [truncateTableButton setTitle:NSLocalizedString(@"Truncate Tables", @"truncate tables menu item")]; + [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")]; + [truncateTableContextButton setTitle:NSLocalizedString(@"Truncate Tables", @"truncate tables menu item")]; + [truncateTableButton setHidden:NO]; + [truncateTableContextButton setHidden:NO]; break; case SP_TABLETYPE_VIEW: [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")]; + [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")]; + [truncateTableButton setHidden:YES]; + [truncateTableContextButton setHidden:YES]; break; case SP_TABLETYPE_PROC: [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")]; + [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")]; + [truncateTableButton setHidden:YES]; + [truncateTableContextButton setHidden:YES]; break; case SP_TABLETYPE_FUNC: [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")]; + [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")]; + [truncateTableButton setHidden:YES]; + [truncateTableContextButton setHidden:YES]; break; } } else { [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Items", @"remove items menu title")]; + [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Items", @"remove items menu title")]; + [truncateTableButton setHidden:YES]; + [truncateTableContextButton setHidden:YES]; } } + [renameTableContextMenuItem setHidden:YES]; + [duplicateTableContextMenuItem setHidden:YES]; + [separatorTableContextMenuItem setHidden:YES]; + [renameTableMenuItem setHidden:YES]; [duplicateTableMenuItem setHidden:YES]; [separatorTableMenuItem setHidden:YES]; + [separatorTableContextMenuItem setHidden:YES]; // set window title [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance name], [tableDocumentInstance database]]]; -- cgit v1.2.3