From edd1d6f093a5d6d3301a8f8cade43b051bd69083 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 2 Mar 2009 23:51:06 +0000 Subject: - Re-design the custom query favourties editor and get rid of the nasty plus/minus buttons. Also add some interface element validation. - Tidy up CustomQuery.h by getting rid of the definition of all datasource and delegate method signatures which don't need to be declared. --- Interfaces/English.lproj/DBView.xib | 430 +++++++++++++++++++----------------- Source/CustomQuery.h | 45 +--- Source/CustomQuery.m | 15 +- 3 files changed, 244 insertions(+), 246 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 618a6ac0..d7ea72ae 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,7 +8,7 @@ 353.00 YES - + YES @@ -6954,7 +6954,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 15 2 - {{363, 524}, {418, 191}} + {{503, 367}, {418, 200}} 1886912512 Query favorites NSWindow @@ -6962,36 +6962,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View {3.40282e+38, 3.40282e+38} - {213, 107} + {213, 125} - + 256 YES - - - 257 - {{340, 12}, {28, 30}} - - YES - - 67239424 - 134348800 - Remove - - - 113524991 - 2 - - NSImage - querydelete - - - fw - 200 - 25 - - 274 @@ -7004,28 +6980,28 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - 256 - {365, 94} + 4352 + {376, 105} YES 256 - {365, 17} + {376, 17} 256 - {{366, 0}, {12, 17}} + {{-22, 0}, {12, 17}} YES name - 3.623290e+02 + 3.733290e+02 8.932900e+01 1.000000e+03 @@ -7066,7 +7042,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - {{1, 17}, {365, 94}} + {{1, 17}, {376, 105}} @@ -7076,7 +7052,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 - {{366, 17}, {11, 94}} + {{-100, -100}, {11, 105}} 256 @@ -7086,7 +7062,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 - {{1, 111}, {365, 11}} + {{-100, -100}, {365, 11}} 257 @@ -7100,7 +7076,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - {{1, 0}, {365, 17}} + {{1, 0}, {376, 17}} @@ -7109,10 +7085,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - {{20, 48}, {378, 123}} + {{20, 57}, {378, 123}} - 50 + 514 @@ -7120,80 +7096,115 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 QSAAAEEgAABBcAAAQXAAAA - + - 257 - {{308, 12}, {28, 30}} + 289 + {{322, 5}, {81, 28}} YES - + 67239424 - 134348800 - Copy + 138018816 + Close - - 113524991 - 2 - - NSImage - querycopy - + + -2038284033 + 1 + - fw + DQ 200 25 - + - 257 - {{372, 12}, {28, 30}} + 292 + {{20, 36}, {28, 23}} YES - - 67239424 - 134348800 - Add - - - 113524991 - 2 - - NSImage - queryadd - + + -2080244224 + 134217728 + + + + -2033434369 + 162 + - 200 - 25 + 400 + 75 - + - 256 - {{15, 13}, {72, 28}} + 292 + {{47, 36}, {28, 23}} YES - - 67239424 - 138018816 - Close + + -1543373312 + 134217728 + + + + -2033434369 + 162 + + + + 400 + 75 + + + + + 290 + {{119, 36}, {279, 23}} + + YES + + -2080244224 + 134217728 + + + + 147603711 + 162 + + + 400 + 75 + + + + + 292 + {{74, 36}, {46, 23}} + + YES + + 604110336 + 134348800 + Copy - - -2038284033 - 1 - + + 147603711 + 162 - DQ - 200 - 25 + + 400 + 75 - {418, 191} + {418, 200} + {{0, 0}, {1440, 878}} - {213, 129} + {213, 147} {3.40282e+38, 3.40282e+38} @@ -7624,7 +7635,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {3.40282e+38, 3.40282e+38} {300, 130} - + 256 YES @@ -7696,7 +7707,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6 - {1068, 1e+07} + {1108, 1e+07} {223, 0} @@ -7780,7 +7791,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {575, 173} - {{0, 0}, {1440, 878}} {300, 152} @@ -10795,30 +10805,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 739 - - - copyQueryFavorite: - - - - 740 - - - - removeQueryFavorite: - - - - 741 - - - - addQueryFavorite: - - - - 742 - dataSource @@ -12343,6 +12329,46 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 4781 + + + addQueryFavorite: + + + + 4788 + + + + removeQueryFavorite: + + + + 4789 + + + + copyQueryFavorite: + + + + 4792 + + + + removeQueryFavoriteButton + + + + 4793 + + + + copyQueryFavoriteButton + + + + 4794 + @@ -13047,23 +13073,15 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - - - + + + + - - 729 - - - YES - - - - 730 @@ -13094,24 +13112,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - - 731 - - - YES - - - - - - 733 - - - YES - - - - 743 @@ -13928,21 +13928,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - - 3845 - - - - - 3846 - - - - - 3847 - - - 3848 @@ -17630,6 +17615,62 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 4782 + + + YES + + + + + + 4783 + + + YES + + + + + + 4784 + + + YES + + + + + + 4785 + + + + + 4786 + + + + + 4787 + + + + + 4790 + + + YES + + + + + + 4791 + + + @@ -18175,9 +18216,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 3842.IBPluginDependency 3843.IBPluginDependency 3844.IBPluginDependency - 3845.IBPluginDependency - 3846.IBPluginDependency - 3847.IBPluginDependency 3848.IBPluginDependency 3849.IBPluginDependency 3850.IBPluginDependency @@ -18690,6 +18728,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 4776.ImportedFromIB2 4777.IBPluginDependency 4777.ImportedFromIB2 + 4782.IBPluginDependency + 4783.IBPluginDependency + 4784.IBPluginDependency + 4785.IBPluginDependency + 4786.IBPluginDependency + 4787.IBPluginDependency + 4790.IBPluginDependency + 4791.IBPluginDependency 495.IBAttributePlaceholdersKey 495.IBPluginDependency 495.ImportedFromIB2 @@ -18824,21 +18870,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 725.ImportedFromIB2 728.IBPluginDependency 728.ImportedFromIB2 - 729.IBAttributePlaceholdersKey - 729.IBPluginDependency - 729.ImportedFromIB2 73.IBAttributePlaceholdersKey 73.IBPluginDependency 73.ImportedFromIB2 730.IBAttributePlaceholdersKey 730.IBPluginDependency 730.ImportedFromIB2 - 731.IBAttributePlaceholdersKey - 731.IBPluginDependency - 731.ImportedFromIB2 - 733.IBAttributePlaceholdersKey - 733.IBPluginDependency - 733.ImportedFromIB2 735.IBPluginDependency 735.ImportedFromIB2 74.IBAttributePlaceholdersKey @@ -19737,9 +19774,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin {{481, 388}, {519, 335}} {{481, 388}, {519, 335}} @@ -20258,6 +20292,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -20395,25 +20437,15 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin - {{252, 367}, {418, 191}} - {{252, 367}, {418, 191}} + {{617, 624}, {418, 200}} + {{617, 624}, {418, 200}} {3.40282e+38, 3.40282e+38} - {213, 107} - com.apple.InterfaceBuilder.CocoaPlugin - + {213, 125} com.apple.InterfaceBuilder.CocoaPlugin - - ToolTip - - ToolTip - - Remove a query favorite - - com.apple.InterfaceBuilder.CocoaPlugin @@ -20437,26 +20469,6 @@ Y2hhbmdlIHRoZSBvcmRlcg com.apple.InterfaceBuilder.CocoaPlugin - - ToolTip - - ToolTip - - Duplicate a query favorite - - - com.apple.InterfaceBuilder.CocoaPlugin - - - ToolTip - - ToolTip - - Add a query favorite - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin @@ -20673,7 +20685,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 4781 + 4794 @@ -20763,12 +20775,14 @@ Y2hhbmdlIHRoZSBvcmRlcg YES affectedRowsText + copyQueryFavoriteButton customQueryView errorText queryFavoritesButton queryFavoritesSheet queryFavoritesView queryHistoryButton + removeQueryFavoriteButton tableWindow textView valueSheet @@ -20777,6 +20791,7 @@ Y2hhbmdlIHRoZSBvcmRlcg YES id + id CMCopyTable id id @@ -20787,6 +20802,7 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h index 61dbc7b8..8e81c7e5 100644 --- a/Source/CustomQuery.h +++ b/Source/CustomQuery.h @@ -28,7 +28,6 @@ #import "CMMCPConnection.h" #import "CMMCPResult.h" - @interface CustomQuery : NSObject { IBOutlet id tableWindow; @@ -42,62 +41,34 @@ IBOutlet id valueTextField; IBOutlet id queryFavoritesSheet; IBOutlet id queryFavoritesView; + IBOutlet id removeQueryFavoriteButton; + IBOutlet id copyQueryFavoriteButton; - CMMCPConnection *mySQLConnection; NSArray *queryResult; NSUserDefaults *prefs; NSMutableArray *queryFavorites; + + CMMCPConnection *mySQLConnection; } -//IBAction methods +// IBAction methods - (IBAction)performQuery:(id)sender; - (IBAction)chooseQueryFavorite:(id)sender; - (IBAction)chooseQueryHistory:(id)sender; - (IBAction)closeSheet:(id)sender; -//queryFavoritesSheet methods +// queryFavoritesSheet methods - (IBAction)addQueryFavorite:(id)sender; - (IBAction)removeQueryFavorite:(id)sender; - (IBAction)copyQueryFavorite:(id)sender; - (IBAction)closeQueryFavoritesSheet:(id)sender; -//getter methods +// Accessors - (NSArray *)currentResult; -//additional methods +// Other - (void)setConnection:(CMMCPConnection *)theConnection; - (void)setFavorites; - (void)doPerformQueryService:(NSString *)query; -//tableView datasource methods -- (int)numberOfRowsInTableView:(NSTableView *)aTableView; -- (id)tableView:(NSTableView *)aTableView - objectValueForTableColumn:(NSTableColumn *)aTableColumn - row:(int)rowIndex; -- (void)tableView:(NSTableView *)aTableView - setObjectValue:(id)anObject - forTableColumn:(NSTableColumn *)aTableColumn - row:(int)rowIndex; - -//tableView drag&drop datasource methods -- (BOOL)tableView:(NSTableView *)aTableView writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard; -- (NSDragOperation)tableView:(NSTableView*)aTableView validateDrop:(id )info proposedRow:(int)row - proposedDropOperation:(NSTableViewDropOperation)operation; -- (BOOL)tableView:(NSTableView*)aTableView acceptDrop:(id )info row:(int)row dropOperation:(NSTableViewDropOperation)operation; - -//tableView delegate methods -- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; - -//splitView delegate methods -- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview; -- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset; -- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset; - -//textView delegate methods -- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector; - -//last but not least -- (id)init; -- (void)dealloc; - @end diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 7936e962..04b4b9f8 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -723,8 +723,20 @@ traps enter key and return NO; } +/* + * Updates various interface elements based on the current table view selection. + */ +- (void)tableViewSelectionDidChange:(NSNotification *)notification +{ + if ([notification object] == queryFavoritesView) { + + // Enable/disable buttons + [removeQueryFavoriteButton setEnabled:([queryFavoritesView numberOfSelectedRows] == 1)]; + [copyQueryFavoriteButton setEnabled:([queryFavoritesView numberOfSelectedRows] == 1)]; + } +} -//last but not least +// Last but not least - (id)init; { self = [super init]; @@ -740,5 +752,4 @@ traps enter key and [super dealloc]; } - @end -- cgit v1.2.3