aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DBView.xib229
-rw-r--r--Source/CustomQuery.h2
-rw-r--r--Source/CustomQuery.m61
3 files changed, 105 insertions, 187 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index b0c9e362..54f9e234 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -2235,8 +2235,8 @@
<bool key="NS.raise.underflow">YES</bool>
<bool key="NS.raise.dividebyzero">YES</bool>
</object>
- <string key="NS.decimal">,</string>
- <string key="NS.thousand">.</string>
+ <string key="NS.decimal">.</string>
+ <string key="NS.thousand">,</string>
<bool key="NS.hasthousands">NO</bool>
<bool key="NS.localized">YES</bool>
<bool key="NS.allowsfloats">NO</bool>
@@ -2899,7 +2899,7 @@
<reference key="NSControlView" ref="363916571"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <object class="NSCustomResource" key="NSNormalImage" id="426878029">
+ <object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_action</string>
</object>
@@ -2914,7 +2914,10 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSImage" ref="426878029"/>
+ <object class="NSCustomResource" key="NSImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">button_action</string>
+ </object>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
@@ -14335,6 +14338,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6255</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">tableDocumentInstance</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="427689665"/>
+ </object>
+ <int key="connectionID">6256</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -23515,14 +23526,14 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6255</int>
+ <int key="maxID">6256</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">CMCopyTable</string>
- <string key="superclassName">NSTableView</string>
+ <string key="superclassName">SPTableView</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">copy:</string>
<string key="NS.object.0">id</string>
@@ -23549,7 +23560,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
<object class="IBPartialClassDescription">
<string key="className">CMCopyTable</string>
- <string key="superclassName">NSTableView</string>
+ <string key="superclassName">SPTableView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
@@ -23639,6 +23650,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>autopairMenuItem</string>
<string>autouppercaseKeywordsMenuItem</string>
<string>clearHistoryMenuItem</string>
+ <string>commentCurrentQueryMenuItem</string>
+ <string>commentLineOrSelectionMenuItem</string>
<string>completionListMenuItem</string>
<string>copyQueryFavoriteButton</string>
<string>customQueryView</string>
@@ -23661,6 +23674,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>runSelectionMenuItem</string>
<string>shiftLeftMenuItem</string>
<string>shiftRightMenuItem</string>
+ <string>tableDocumentInstance</string>
<string>tableWindow</string>
<string>textView</string>
<string>valueSheet</string>
@@ -23675,6 +23689,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
<string>id</string>
<string>CMCopyTable</string>
<string>NSMenuItem</string>
@@ -23697,6 +23713,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>id</string>
+ <string>id</string>
<string>CMTextView</string>
<string>id</string>
<string>id</string>
@@ -23747,14 +23764,21 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/CMImageView.h</string>
+ <string key="minorKey">Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/CMMCPConnection.h</string>
+ <string key="minorKey">Frameworks/MCPKit/MCPFoundationKit/MCPNull.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/CMImageView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
@@ -24091,6 +24115,14 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">SPTableView</string>
+ <string key="superclassName">NSTableView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPTableView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">TableContent</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
@@ -24098,17 +24130,11 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addRow:</string>
- <string>closeEditSheet:</string>
<string>copyRow:</string>
- <string>dropImage:</string>
<string>filterTable:</string>
- <string>openEditSheet:</string>
- <string>quickLookFormatButton:</string>
<string>reloadTable:</string>
<string>reloadTableValues:</string>
<string>removeRow:</string>
- <string>saveEditSheet:</string>
- <string>segmentControllerChanged:</string>
<string>setCompareTypes:</string>
<string>showAll:</string>
<string>stepLimitRows:</string>
@@ -24126,12 +24152,6 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -24143,18 +24163,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>compareField</string>
<string>copyButton</string>
<string>countText</string>
- <string>editData</string>
- <string>editImage</string>
- <string>editSheet</string>
- <string>editSheetProgressBar</string>
- <string>editSheetQuickLookButton</string>
- <string>editSheetSegmentControl</string>
- <string>editTextScrollView</string>
- <string>editTextView</string>
<string>fieldField</string>
<string>filterButton</string>
- <string>hexTextScrollView</string>
- <string>hexTextView</string>
<string>limitRowsButton</string>
<string>limitRowsField</string>
<string>limitRowsStepper</string>
@@ -24182,16 +24192,6 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
<string>CMCopyTable</string>
<string>id</string>
<string>id</string>
@@ -24227,6 +24227,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>chooseDatabase:</string>
<string>chooseEncoding:</string>
<string>closeDatabaseSheet:</string>
+ <string>closeErrorConnectionSheet:</string>
<string>closeSheet:</string>
<string>copyCreateTableSyntax:</string>
<string>export:</string>
@@ -24280,6 +24281,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -24288,6 +24290,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addDatabaseButton</string>
<string>chooseDatabaseButton</string>
+ <string>connectionErrorDialog</string>
<string>contentViewSplitter</string>
<string>createTableSyntaxWindow</string>
<string>customQueryInstance</string>
@@ -24324,6 +24327,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
+ <string>NSWindow</string>
<string>NSSplitView</string>
<string>NSWindow</string>
<string>id</string>
@@ -24741,149 +24745,6 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
</object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">CustomQuery</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addQueryFavorite:</string>
- <string>chooseQueryFavorite:</string>
- <string>chooseQueryHistory:</string>
- <string>closeQueryFavoritesSheet:</string>
- <string>closeSheet:</string>
- <string>copyQueryFavorite:</string>
- <string>gearMenuItemSelected:</string>
- <string>helpSearchFindNextInPage:</string>
- <string>helpSearchFindPreviousInPage:</string>
- <string>helpSegmentDispatcher:</string>
- <string>helpSelectHelpTargetMySQL:</string>
- <string>helpSelectHelpTargetPage:</string>
- <string>helpSelectHelpTargetWeb:</string>
- <string>helpTargetDispatcher:</string>
- <string>removeQueryFavorite:</string>
- <string>runAllQueries:</string>
- <string>runSelectedQueries:</string>
- <string>showHelpForCurrentWord:</string>
- <string>showHelpForSearchString:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>affectedRowsText</string>
- <string>autohelpMenuItem</string>
- <string>autoindentMenuItem</string>
- <string>autopairMenuItem</string>
- <string>autouppercaseKeywordsMenuItem</string>
- <string>clearHistoryMenuItem</string>
- <string>commentCurrentQueryMenuItem</string>
- <string>commentLineOrSelectionMenuItem</string>
- <string>completionListMenuItem</string>
- <string>copyQueryFavoriteButton</string>
- <string>customQueryView</string>
- <string>editorFontMenuItem</string>
- <string>errorText</string>
- <string>helpNavigator</string>
- <string>helpSearchField</string>
- <string>helpSearchFieldCell</string>
- <string>helpTargetSelector</string>
- <string>helpWebView</string>
- <string>helpWebViewWindow</string>
- <string>multipleLineEditingButton</string>
- <string>queryFavoritesButton</string>
- <string>queryFavoritesSheet</string>
- <string>queryFavoritesView</string>
- <string>queryHistoryButton</string>
- <string>removeQueryFavoriteButton</string>
- <string>runAllButton</string>
- <string>runSelectionButton</string>
- <string>runSelectionMenuItem</string>
- <string>shiftLeftMenuItem</string>
- <string>shiftRightMenuItem</string>
- <string>tableWindow</string>
- <string>textView</string>
- <string>valueSheet</string>
- <string>valueTextField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>CMCopyTable</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>NSSegmentedControl</string>
- <string>NSSearchField</string>
- <string>NSSearchFieldCell</string>
- <string>NSSegmentedControl</string>
- <string>WebView</string>
- <string>NSWindow</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>NSMenuItem</string>
- <string>id</string>
- <string>CMTextView</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBDocumentRelativeSource</string>
- <string key="minorKey">../../Source/CustomQuery.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">SPTableView</string>
- <string key="superclassName">NSTableView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBDocumentRelativeSource</string>
- <string key="minorKey">../../Source/SPTableView.h</string>
- </object>
- </object>
- </object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string>
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index fe2865ab..618bd0d0 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -35,6 +35,7 @@
@interface CustomQuery : NSObject
{
+ IBOutlet id tableDocumentInstance;
IBOutlet id tableWindow;
IBOutlet id queryFavoritesButton;
IBOutlet id queryHistoryButton;
@@ -98,7 +99,6 @@
BOOL queryIsTableSorter;
BOOL isDesc;
NSNumber *sortField;
- BOOL tempAlertWasShown; // a temp value for nightly builts
}
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index f5742df4..bf15ff30 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -674,7 +674,8 @@
if(!tableReloadAfterEditing) {
for ( i = 0 ; i < [theResult numOfFields] ; i++) {
- theCol = [[NSTableColumn alloc] initWithIdentifier:[NSArrayObjectAtIndex(cqColumnDefinition,i) objectForKey:@"datacolumnindex"]];
+ NSDictionary *columnDefinition = NSArrayObjectAtIndex(cqColumnDefinition,i);
+ theCol = [[NSTableColumn alloc] initWithIdentifier:[columnDefinition objectForKey:@"datacolumnindex"]];
[theCol setResizingMask:NSTableColumnUserResizingMask];
[theCol setEditable:YES];
SPTextAndLinkCell *dataCell = [[[SPTextAndLinkCell alloc] initTextCell:@""] autorelease];
@@ -689,6 +690,14 @@
[theCol setDataCell:dataCell];
[[theCol headerCell] setStringValue:NSArrayObjectAtIndex(theColumns, i)];
+ // Set the width of this column to saved value if exists and maps to a real column
+ if ([columnDefinition objectForKey:@"org_name"] && [[columnDefinition objectForKey:@"org_name"] length]) {
+ NSNumber *colWidth = [[[[prefs objectForKey:@"tableColumnWidths"] objectForKey:[NSString stringWithFormat:@"%@@%@", [columnDefinition objectForKey:@"db"], [tableDocumentInstance host]]] objectForKey:[columnDefinition objectForKey:@"org_table"]] objectForKey:[columnDefinition objectForKey:@"org_name"]];
+ if ( colWidth ) {
+ [theCol setWidth:[colWidth floatValue]];
+ }
+ }
+
[customQueryView addTableColumn:theCol];
[theCol release];
}
@@ -1117,7 +1126,6 @@
}
hasBackgroundAttribute = NO;
- tempAlertWasShown = NO; //temp for nightly builds
// Set up the interface
// Bind backgroundColor
@@ -1649,6 +1657,55 @@
}
}
+/**
+ * Saves the new column size in the preferences for columns which map to fields
+ */
+- (void)tableViewColumnDidResize:(NSNotification *)aNotification
+{
+ // Abort if still loading the table
+ if (![cqColumnDefinition count]) return;
+NSLog(@"start");
+ // Retrieve the original index of the column from the identifier
+ int columnIndex = [[[[aNotification userInfo] objectForKey:@"NSTableColumn"] identifier] intValue];
+ NSDictionary *columnDefinition = NSArrayObjectAtIndex(cqColumnDefinition, columnIndex);
+ NSLog(@"1");
+ // Don't save if the column doesn't map to an underlying SQL field
+ if (![columnDefinition objectForKey:@"org_name"] || ![[columnDefinition objectForKey:@"org_name"] length])
+ return;
+ NSLog(@"2");
+
+ NSMutableDictionary *tableColumnWidths;
+ NSString *host_db = [NSString stringWithFormat:@"%@@%@", [columnDefinition objectForKey:@"db"], [tableDocumentInstance host]];
+ NSString *table = [columnDefinition objectForKey:@"org_table"];
+ NSString *col = [columnDefinition objectForKey:@"org_name"];
+
+ // Retrieve or instantiate the tableColumnWidths object
+ if ([prefs objectForKey:@"tableColumnWidths"] != nil) {
+ tableColumnWidths = [NSMutableDictionary dictionaryWithDictionary:[prefs objectForKey:@"tableColumnWidths"]];
+ } else {
+ tableColumnWidths = [NSMutableDictionary dictionary];
+ }
+
+ // Edit or create database object
+ if ([tableColumnWidths objectForKey:host_db] == nil) {
+ [tableColumnWidths setObject:[NSMutableDictionary dictionary] forKey:host_db];
+ } else {
+ [tableColumnWidths setObject:[NSMutableDictionary dictionaryWithDictionary:[tableColumnWidths objectForKey:host_db]] forKey:host_db];
+ }
+
+ // Edit or create table object
+ if ([[tableColumnWidths objectForKey:host_db] objectForKey:table] == nil) {
+ [[tableColumnWidths objectForKey:host_db] setObject:[NSMutableDictionary dictionary] forKey:table];
+ } else {
+ [[tableColumnWidths objectForKey:host_db] setObject:[NSMutableDictionary dictionaryWithDictionary:[[tableColumnWidths objectForKey:host_db] objectForKey:table]] forKey:table];
+ }
+
+ // Save the column size
+ [[[tableColumnWidths objectForKey:host_db] objectForKey:table] setObject:[NSNumber numberWithFloat:[[[aNotification userInfo] objectForKey:@"NSTableColumn"] width]] forKey:col];
+ [prefs setObject:tableColumnWidths forKey:@"tableColumnWidths"];
+}
+
+
#pragma mark -
#pragma mark TextView delegate methods