aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.h6
-rw-r--r--Source/CustomQuery.m46
-rw-r--r--Source/SPDatabaseDocument.m2
-rw-r--r--Source/SPExportController.h3
-rw-r--r--Source/SPExportController.m29
5 files changed, 64 insertions, 22 deletions
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index f4299db0..add6be7f 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -47,7 +47,7 @@
#define SP_HISTORY_SAVE_MENUITEM_TAG 300001
#define SP_HISTORY_CLEAR_MENUITEM_TAG 300002
-@class SPQueryFavoriteManager, SPDataStorage;
+@class SPQueryFavoriteManager, SPDataStorage, BWSplitView;
@interface CustomQuery : NSObject
{
@@ -107,6 +107,9 @@
IBOutlet NSSearchFieldCell *helpSearchFieldCell;
IBOutlet NSSegmentedControl *helpNavigator;
IBOutlet NSSegmentedControl *helpTargetSelector;
+
+ IBOutlet NSButton *queryInfoButton;
+ IBOutlet BWSplitView *queryInfoPaneSplitView;
SPQueryFavoriteManager *favoritesManager;
@@ -178,6 +181,7 @@
- (IBAction)copyQueryHistory:(id)sender;
- (IBAction)clearQueryHistory:(id)sender;
- (IBAction)showCompletionList:(id)sender;
+- (IBAction)toggleQueryInfoPaneCollapse:(id)sender;
// Query actions
- (void)performQueries:(NSArray *)queries withCallback:(SEL)customQueryCallbackMethod;
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index fdc7c5d3..88c4f61c 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -45,6 +45,8 @@
#import "SPAlertSheets.h"
#import "SPMainThreadTrampoline.h"
+#import <BWToolkitFramework/BWToolkitFramework.h>
+
@implementation CustomQuery
#pragma mark IBAction methods
@@ -450,6 +452,16 @@
return (NSFontPanelSizeModeMask|NSFontPanelCollectionModeMask);
}
+/**
+ * Toggle whether the query info pane is visible.
+ */
+- (IBAction)toggleQueryInfoPaneCollapse:(id)sender
+{
+ [queryInfoPaneSplitView toggleCollapse:sender];
+
+ [sender setToolTip:([sender state] == NSOffState) ? NSLocalizedString(@"Show Query Information", @"Show Query Information") : NSLocalizedString(@"Hide Query Information", @"Hide Query Information")];
+}
+
#pragma mark -
#pragma mark Query actions
@@ -2254,7 +2266,6 @@
}
-
#pragma mark -
#pragma mark SplitView delegate methods
@@ -2271,11 +2282,7 @@
*/
- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
- if ( offset == 0 ) {
- return proposedMax - 100;
- } else {
- return proposedMax - 73;
- }
+ if (sender != queryInfoPaneSplitView) return (offset == 0) ? (proposedMax - 100) : (proposedMax - 73);
}
/*
@@ -2283,13 +2290,16 @@
*/
- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
- if ( offset == 0 ) {
- return proposedMin + 100;
- } else {
- return proposedMin + 100;
- }
+ if (sender != queryInfoPaneSplitView) return proposedMin + 100;
}
+/**
+ * The query information pane cannot be resized.
+ */
+- (NSRect)splitView:(NSSplitView *)splitView effectiveRect:(NSRect)proposedEffectiveRect forDrawnRect:(NSRect)drawnRect ofDividerAtIndex:(NSInteger)dividerIndex
+{
+ return (splitView == queryInfoPaneSplitView ? NSZeroRect : proposedEffectiveRect);
+}
#pragma mark -
#pragma mark MySQL Help
@@ -3061,7 +3071,6 @@
*/
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
-
// Control "Save ... to Favorites"
if ( [menuItem tag] == SP_SAVE_SELECTION_FAVORTITE_MENUITEM_TAG ) {
if ([[textView string] length] < 1) return NO;
@@ -3077,12 +3086,10 @@
if ( [menuItem tag] == SP_SAVE_ALL_FAVORTITE_MENUITEM_TAG ) {
if ([[textView string] length] < 1) return NO;
}
-
// Avoid selecting button list headers
else if ( [menuItem tag] == SP_FAVORITE_HEADER_MENUITEM_TAG ) {
return NO;
}
-
// Control Clear History menu item title according to isUntitled
else if ( [menuItem tag] == SP_HISTORY_CLEAR_MENUITEM_TAG ) {
if ( [tableDocumentInstance isUntitled] ) {
@@ -3093,7 +3100,6 @@
[menuItem setToolTip:NSLocalizedString(@"Clear the document-based history list", @"clear the document-based history list tooltip message")];
}
}
-
// Check for History items
else if ( [menuItem tag] >= SP_HISTORY_COPY_MENUITEM_TAG && [menuItem tag] <= SP_HISTORY_CLEAR_MENUITEM_TAG ) {
return ([queryHistoryButton numberOfItems]-7);
@@ -3245,7 +3251,15 @@
[prefs addObserver:self forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL];
-
+ // Collapse the query information pane
+ /*if ([queryInfoPaneSplitView collapsibleSubview]) {
+ [queryInfoButton setNextState];
+ [queryInfoButton setToolTip:NSLocalizedString(@"Show Query Information", @"Show Query Information")];
+
+ [queryInfoPaneSplitView setValue:[NSNumber numberWithFloat:[queryInfoPaneSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"];
+ [[queryInfoPaneSplitView collapsibleSubview] setFrameSize:NSMakeSize([queryInfoPaneSplitView collapsibleSubview].frame.size.width, 0)];
+ [queryInfoPaneSplitView setCollapsibleSubviewCollapsed:YES];
+ }*/
}
/**
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index e7c12fcf..028c2c30 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -2346,7 +2346,7 @@
*/
- (IBAction)exportSelectedTablesAs:(id)sender
{
- [exportControllerInstance exportTables:[tablesListInstance selectedTableItems] asFormat:[sender tag]];
+ [exportControllerInstance exportTables:[tablesListInstance selectedTableItems] asFormat:[sender tag] usingSource:SPTableExport];
}
#pragma mark -
diff --git a/Source/SPExportController.h b/Source/SPExportController.h
index f1737595..83b21525 100644
--- a/Source/SPExportController.h
+++ b/Source/SPExportController.h
@@ -238,7 +238,7 @@
@property(readwrite, assign) MCPConnection *connection;
- (void)export;
-- (void)exportTables:(NSArray *)table asFormat:(SPExportType)format;
+- (void)exportTables:(NSArray *)table asFormat:(SPExportType)format usingSource:(SPExportSource)source;
- (void)openExportErrorsSheetWithString:(NSString *)errors;
- (void)displayExportFinishedGrowlNotification;
- (NSString *)expandCustomFilenameFormatFromString:(NSString *)format usingTableName:(NSString *)table;
@@ -253,6 +253,7 @@
- (IBAction)selectDeselectAllTables:(id)sender;
- (IBAction)toggleCustomFilenameFormatView:(id)sender;
- (IBAction)toggleAdvancedExportOptionsView:(id)sender;
+- (IBAction)exportCustomQueryResultAsFormat:(id)sender;
- (IBAction)toggleSQLIncludeStructure:(id)sender;
- (IBAction)toggleSQLIncludeContent:(id)sender;
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index e8bbf1a4..6eab3a34 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -131,13 +131,13 @@
*/
- (void)export
{
- [self exportTables:nil asFormat:SPSQLExport];
+ [self exportTables:nil asFormat:SPSQLExport usingSource:SPTableExport];
}
/**
* Displays the export window with the supplied tables and export type/format selected.
*/
-- (void)exportTables:(NSArray *)exportTables asFormat:(SPExportType)format
+- (void)exportTables:(NSArray *)exportTables asFormat:(SPExportType)format usingSource:(SPExportSource)source
{
// Select the correct tab
[exportTypeTabBar selectTabViewItemAtIndex:format];
@@ -150,7 +150,7 @@
if ([exportFiles count] > 0) [exportFiles removeAllObjects];
// Select the 'selected tables' source option
- [exportInputPopUpButton selectItemAtIndex:SPTableExport];
+ [exportInputPopUpButton selectItemAtIndex:source];
// If tables were supplied, select them
if (exportTables) {
@@ -595,6 +595,17 @@
[self _toggleExportButtonOnBackgroundThread];
}
+/**
+ * Opens the export sheet, selecting custom query as the export source.
+ */
+- (IBAction)exportCustomQueryResultAsFormat:(id)sender
+{
+ [self exportTables:nil asFormat:[sender tag] usingSource:SPQueryExport];
+
+ // Ensure UI validation
+ [self switchInput:exportInputPopUpButton];
+}
+
#pragma mark -
#pragma mark Table view datasource methods
@@ -669,6 +680,18 @@
}
}
+/**
+ * Menu item validation.
+ */
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ if ([menuItem action] == @selector(exportCustomQueryResultAsFormat:)) {
+ return ([[customQueryInstance currentResult] count] > 1);
+ }
+
+ return YES;
+}
+
#pragma mark -
/**