aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-28 11:36:30 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-28 11:36:30 +0000
commit87f5d0a9f91c49e9e4ae5f9411fc3a0e716911b1 (patch)
tree71f0532b6e0a751cdcf91c2c3321e840625bc2df
parent7053b1fe3330b469e79d0f0689b6a2af931fb665 (diff)
downloadsequelpro-87f5d0a9f91c49e9e4ae5f9411fc3a0e716911b1.tar.gz
sequelpro-87f5d0a9f91c49e9e4ae5f9411fc3a0e716911b1.tar.bz2
sequelpro-87f5d0a9f91c49e9e4ae5f9411fc3a0e716911b1.zip
• Custom Query:
- added to History list "Replace Editor Content" (stored in the prefs) and a search field - "Save ... to Favorites" menu title changes according to selection in the textView Problem: How can we allow if the user hits RETURN in a search field (fav/history) to select the next menu item if any and to change the first responder to popup button menu list?
-rw-r--r--Interfaces/English.lproj/DBView.xib452
-rw-r--r--Resources/PreferenceDefaults.plist2
-rw-r--r--Source/CustomQuery.h5
-rw-r--r--Source/CustomQuery.m83
4 files changed, 476 insertions, 66 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 9d072239..ce0b0cb5 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -8,7 +8,6 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="5597"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -186,7 +185,6 @@
</object>
<string key="NSFrameSize">{212, 26}</string>
<reference key="NSSuperview" ref="199860064"/>
- <reference key="NSNextKeyView" ref="643201879"/>
<reference key="NSDocView" ref="643201879"/>
<object class="NSColor" key="NSBGColor" id="529261656">
<int key="NSColorSpace">6</int>
@@ -222,7 +220,6 @@
</object>
<string key="NSFrameSize">{212, 26}</string>
<reference key="NSSuperview" ref="801427893"/>
- <reference key="NSNextKeyView" ref="588922296"/>
<int key="NSsFlags">0</int>
<reference key="NSVScroller" ref="540853896"/>
<reference key="NSHScroller" ref="566705316"/>
@@ -337,7 +334,6 @@
</object>
<string key="NSFrameSize">{212, 354}</string>
<reference key="NSSuperview" ref="233472824"/>
- <reference key="NSNextKeyView" ref="251040077"/>
<reference key="NSDocView" ref="251040077"/>
<object class="NSColor" key="NSBGColor" id="1024678221">
<int key="NSColorSpace">6</int>
@@ -369,7 +365,6 @@
</object>
<string key="NSFrameSize">{212, 354}</string>
<reference key="NSSuperview" ref="1017775084"/>
- <reference key="NSNextKeyView" ref="73685676"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="693168867"/>
<reference key="NSHScroller" ref="656188692"/>
@@ -494,7 +489,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="298226231"/>
- <reference key="NSNextKeyView" ref="347093764"/>
<reference key="NSDocView" ref="347093764"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">6</int>
@@ -521,7 +515,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="192579410"/>
- <reference key="NSNextKeyView" ref="685057119"/>
<int key="NSsFlags">512</int>
<reference key="NSVScroller" ref="245346414"/>
<reference key="NSHScroller" ref="353686052"/>
@@ -2242,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>
@@ -2862,29 +2855,6 @@
<object class="NSTextView" id="1055190999">
<reference key="NSNextResponder" ref="1072692119"/>
<int key="NSvFlags">6418</int>
- <object class="NSMutableSet" key="NSDragTypes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="set.sortedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>Apple HTML pasteboard type</string>
- <string>Apple PDF pasteboard type</string>
- <string>Apple PICT pasteboard type</string>
- <string>Apple PNG pasteboard type</string>
- <string>Apple URL pasteboard type</string>
- <string>CorePasteboardFlavorType 0x6D6F6F76</string>
- <string>CorePasteboardFlavorType 0x75726C20</string>
- <string>NSColor pasteboard type</string>
- <string>NSFilenamesPboardType</string>
- <string>NSStringPboardType</string>
- <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
- <string>NeXT RTFD pasteboard type</string>
- <string>NeXT Rich Text Format v1.0 pasteboard type</string>
- <string>NeXT TIFF v4.0 pasteboard type</string>
- <string>NeXT font pasteboard type</string>
- <string>NeXT ruler pasteboard type</string>
- <string>WebURLsWithTitlesPboardType</string>
- </object>
- </object>
<string key="NSFrameSize">{688, 14}</string>
<reference key="NSSuperview" ref="1072692119"/>
<object class="NSTextContainer" key="NSTextContainer" id="326170846">
@@ -2945,7 +2915,6 @@
</object>
<string key="NSFrame">{{1, 1}, {688, 155}}</string>
<reference key="NSSuperview" ref="71560786"/>
- <reference key="NSNextKeyView" ref="1055190999"/>
<reference key="NSDocView" ref="1055190999"/>
<reference key="NSBGColor" ref="449903125"/>
<object class="NSCursor" key="NSCursor" id="32917531">
@@ -2977,7 +2946,6 @@
</object>
<string key="NSFrameSize">{690, 157}</string>
<reference key="NSSuperview" ref="873437769"/>
- <reference key="NSNextKeyView" ref="1072692119"/>
<int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="413233170"/>
<reference key="NSHScroller" ref="783638826"/>
@@ -3064,7 +3032,6 @@
</object>
<string key="NSFrame">{{1, 17}, {688, 228}}</string>
<reference key="NSSuperview" ref="678281118"/>
- <reference key="NSNextKeyView" ref="581095761"/>
<reference key="NSDocView" ref="581095761"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -3097,7 +3064,6 @@
</object>
<string key="NSFrame">{{1, 0}, {688, 17}}</string>
<reference key="NSSuperview" ref="678281118"/>
- <reference key="NSNextKeyView" ref="1038415606"/>
<reference key="NSDocView" ref="1038415606"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -3106,7 +3072,6 @@
</object>
<string key="NSFrameSize">{690, 246}</string>
<reference key="NSSuperview" ref="345834048"/>
- <reference key="NSNextKeyView" ref="90844306"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="472831765"/>
<reference key="NSHScroller" ref="851610321"/>
@@ -3156,6 +3121,38 @@
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="13183167"/>
+ <object class="NSMenuItem" id="96807437">
+ <reference key="NSMenu" ref="766637184"/>
+ <string key="NSTitle">Replace Editor Content</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="450876295"/>
+ <reference key="NSMixedImage" ref="414351669"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="830957297"/>
+ </object>
+ <object class="NSMenuItem" id="744554218">
+ <reference key="NSMenu" ref="766637184"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="450876295"/>
+ <reference key="NSMixedImage" ref="414351669"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="830957297"/>
+ </object>
+ <object class="NSMenuItem" id="252023923">
+ <reference key="NSMenu" ref="766637184"/>
+ <string key="NSTitle">..placeholder for seachfield..</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="450876295"/>
+ <reference key="NSMixedImage" ref="414351669"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="830957297"/>
+ </object>
</object>
</object>
<bool key="NSPullDown">YES</bool>
@@ -3212,6 +3209,7 @@
<reference key="NSOnImage" ref="450876295"/>
<reference key="NSMixedImage" ref="414351669"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">1000</int>
<reference key="NSTarget" ref="416049103"/>
</object>
<object class="NSMenuItem" id="601952975">
@@ -3279,7 +3277,7 @@
<reference key="NSControlView" ref="363916571"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <object class="NSCustomResource" key="NSNormalImage">
+ <object class="NSCustomResource" key="NSNormalImage" id="775296042">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_action</string>
</object>
@@ -3294,10 +3292,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">button_action</string>
- </object>
+ <reference key="NSImage" ref="775296042"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
@@ -3523,7 +3518,7 @@
</object>
<bool key="NSNoAutoenable">YES</bool>
</object>
- <int key="NSSelectedIndex">15</int>
+ <int key="NSSelectedIndex">6</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -6364,7 +6359,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="842408319">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -6961,7 +6956,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<string key="NSFrameSize">{302, 307}</string>
- <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
@@ -11343,7 +11337,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="532635418">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">4364</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -11352,6 +11346,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{20, 1}, {176, 19}}</string>
<reference key="NSSuperview" ref="532635418"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSearchFieldCell" key="NSCell" id="1072338815">
<int key="NSCellFlags">343014976</int>
@@ -11413,6 +11408,84 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<string key="NSFrameSize">{217, 20}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <string key="NSClassName">NSView</string>
+ </object>
+ <object class="NSCustomView" id="456635389">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">4364</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSSearchField" id="388856443">
+ <reference key="NSNextResponder" ref="456635389"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{20, 1}, {176, 19}}</string>
+ <reference key="NSSuperview" ref="456635389"/>
+ <reference key="NSWindow"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSSearchFieldCell" key="NSCell" id="292622292">
+ <int key="NSCellFlags">343014976</int>
+ <int key="NSCellFlags2">272925696</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="22"/>
+ <string key="NSPlaceholderString">search for queries (as regexp)</string>
+ <reference key="NSControlView" ref="388856443"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <int key="NSTextBezelStyle">1</int>
+ <reference key="NSBackgroundColor" ref="480189472"/>
+ <reference key="NSTextColor" ref="454249633"/>
+ <object class="NSButtonCell" key="NSSearchButtonCell">
+ <int key="NSCellFlags">130560</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">search</string>
+ <string key="NSAction">_searchFieldSearch:</string>
+ <reference key="NSTarget" ref="292622292"/>
+ <reference key="NSControlView" ref="388856443"/>
+ <int key="NSButtonFlags">138690815</int>
+ <int key="NSButtonFlags2">0</int>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ <object class="NSButtonCell" key="NSCancelButtonCell">
+ <int key="NSCellFlags">130560</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">clear</string>
+ <object class="NSMutableArray" key="NSAccessibilityOverriddenAttributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>AXDescription</string>
+ <string>NSAccessibilityEncodedAttributesValueType</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>cancel</string>
+ <reference ref="9"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSAction">_searchFieldCancel:</string>
+ <reference key="NSTarget" ref="292622292"/>
+ <reference key="NSControlView" ref="388856443"/>
+ <int key="NSButtonFlags">138690815</int>
+ <int key="NSButtonFlags2">0</int>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ <string key="NSRecentsAutosaveName">SPQueryHistorySearchField</string>
+ <int key="NSMaximumRecents">10</int>
+ <bytes key="NSSearchFieldFlags">CAAAAA</bytes>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{217, 20}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSUserDefaultsController" id="461189245">
@@ -15242,6 +15315,70 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6437</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">queryFavoritesSaveAsMenuItem</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="5128219"/>
+ </object>
+ <int key="connectionID">6440</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.QueryHistoryReplacesContent</string>
+ <reference key="source" ref="96807437"/>
+ <reference key="destination" ref="461189245"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="96807437"/>
+ <reference key="NSDestination" ref="461189245"/>
+ <string key="NSLabel">value: values.QueryHistoryReplacesContent</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.QueryHistoryReplacesContent</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">6443</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">queryHistorySearchMenuItem</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="252023923"/>
+ </object>
+ <int key="connectionID">6446</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">queryHistorySearchFieldView</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="456635389"/>
+ </object>
+ <int key="connectionID">6450</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">queryHistorySearchField</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="388856443"/>
+ </object>
+ <int key="connectionID">6451</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">filterQueryHistory:</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="388856443"/>
+ </object>
+ <int key="connectionID">6452</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="388856443"/>
+ <reference key="destination" ref="601471102"/>
+ </object>
+ <int key="connectionID">6453</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -18176,6 +18313,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="13183167"/>
+ <reference ref="96807437"/>
+ <reference ref="744554218"/>
+ <reference ref="252023923"/>
</object>
<reference key="parent" ref="830957297"/>
</object>
@@ -21440,6 +21580,45 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="object" ref="1072338815"/>
<reference key="parent" ref="57646700"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6441</int>
+ <reference key="object" ref="96807437"/>
+ <reference key="parent" ref="766637184"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6444</int>
+ <reference key="object" ref="744554218"/>
+ <reference key="parent" ref="766637184"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6445</int>
+ <reference key="object" ref="252023923"/>
+ <reference key="parent" ref="766637184"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6447</int>
+ <reference key="object" ref="456635389"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="388856443"/>
+ </object>
+ <reference key="parent" ref="1043842561"/>
+ <string key="objectName">Query History Search</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6448</int>
+ <reference key="object" ref="388856443"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="292622292"/>
+ </object>
+ <reference key="parent" ref="456635389"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6449</int>
+ <reference key="object" ref="292622292"/>
+ <reference key="parent" ref="388856443"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -22723,6 +22902,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>6432.IBAttributePlaceholdersKey</string>
<string>6432.IBPluginDependency</string>
<string>6433.IBPluginDependency</string>
+ <string>6441.IBPluginDependency</string>
+ <string>6444.IBPluginDependency</string>
+ <string>6445.IBPluginDependency</string>
+ <string>6447.IBEditorWindowLastContentRect</string>
+ <string>6447.IBPluginDependency</string>
+ <string>6448.IBAttributePlaceholdersKey</string>
+ <string>6448.IBPluginDependency</string>
+ <string>6449.IBPluginDependency</string>
<string>654.IBPluginDependency</string>
<string>654.ImportedFromIB2</string>
<string>655.IBPluginDependency</string>
@@ -23051,7 +23238,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{351, 701}, {215, 98}}</string>
+ <string>{{379, 650}, {215, 98}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -23068,7 +23255,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{383, 624}, {137, 20}}</string>
+ <string>{{497, 684}, {215, 64}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -23727,9 +23914,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{94, 422}, {944, 550}}</string>
+ <string>{{172, 340}, {944, 550}}</string>
<boolean value="NO"/>
- <string>{{94, 422}, {944, 550}}</string>
+ <string>{{172, 340}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -23895,7 +24082,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{303, 496}, {236, 305}}</string>
+ <string>{{381, 414}, {236, 305}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -24553,6 +24740,22 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{409, 828}, {217, 20}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{419, 772}, {217, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
@@ -24762,7 +24965,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6439</int>
+ <int key="maxID">6453</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -26092,6 +26295,151 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</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>chooseQueryFavorite:</string>
+ <string>chooseQueryHistory:</string>
+ <string>closeSheet:</string>
+ <string>filterQueryFavorites:</string>
+ <string>filterQueryHistory:</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>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>
+ </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>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>queryFavoriteNameTextField</string>
+ <string>queryFavoritesButton</string>
+ <string>queryFavoritesSaveAsMenuItem</string>
+ <string>queryFavoritesSearchField</string>
+ <string>queryFavoritesSearchFieldView</string>
+ <string>queryFavoritesSearchMenuItem</string>
+ <string>queryFavoritesSheet</string>
+ <string>queryHistoryButton</string>
+ <string>queryHistorySearchField</string>
+ <string>queryHistorySearchFieldView</string>
+ <string>queryHistorySearchMenuItem</string>
+ <string>runAllButton</string>
+ <string>runSelectionButton</string>
+ <string>runSelectionMenuItem</string>
+ <string>saveQueryFavoriteButton</string>
+ <string>shiftLeftMenuItem</string>
+ <string>shiftRightMenuItem</string>
+ <string>tableDocumentInstance</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>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>NSTextField</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSSearchField</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSWindow</string>
+ <string>id</string>
+ <string>NSSearchField</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSMenuItem</string>
+ <string>NSButton</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>id</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>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string>
diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist
index 5db7e463..bf58e7ec 100644
--- a/Resources/PreferenceDefaults.plist
+++ b/Resources/PreferenceDefaults.plist
@@ -42,6 +42,8 @@
<false/>
<key>QueryFavoriteReplacesContent</key>
<false/>
+ <key>QueryHistoryReplacesContent</key>
+ <false/>
<key>CustomQueryEditorFont</key>
<data>BAtzdHJlYW10eXBlZIHoA4QBQISEhAZOU0ZvbnQehIQITlNPYmplY3QAhYQBaRiEBVsyNGNdBgAAAA4AAAD//k0AbwBuAGEAYwBvAAAAhAFmCoQBYwCYAZgAmACG</data>
<key>CustomQueryEditorBackgroundColor</key>
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index 522cdd0d..0e6d2bc6 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -42,9 +42,13 @@
IBOutlet id queryFavoritesButton;
IBOutlet NSMenuItem *queryFavoritesSearchMenuItem;
+ IBOutlet NSMenuItem *queryFavoritesSaveAsMenuItem;
IBOutlet id queryFavoritesSearchFieldView;
IBOutlet NSSearchField *queryFavoritesSearchField;
IBOutlet id queryHistoryButton;
+ IBOutlet NSMenuItem *queryHistorySearchMenuItem;
+ IBOutlet id queryHistorySearchFieldView;
+ IBOutlet NSSearchField *queryHistorySearchField;
IBOutlet CMTextView *textView;
IBOutlet CMCopyTable *customQueryView;
@@ -128,6 +132,7 @@
- (IBAction)helpSelectHelpTargetPage:(id)sender;
- (IBAction)helpSelectHelpTargetWeb:(id)sender;
- (IBAction)filterQueryFavorites:(id)sender;
+- (IBAction)filterQueryHistory:(id)sender;
// Query actions
- (void)performQueries:(NSArray *)queries;
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index cf9ee266..0970d2c5 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -154,7 +154,7 @@
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:@"addNewQueryFavorite"];
}
- else if ([queryFavoritesButton indexOfSelectedItem] == 3) {
+ else if ([queryFavoritesButton indexOfSelectedItem] == 3) {
// Open query favorite manager
[NSApp beginSheet:[favoritesManager window]
modalForWindow:tableWindow
@@ -176,7 +176,11 @@
*/
- (IBAction)chooseQueryHistory:(id)sender
{
- [textView insertText:[queryHistoryButton titleOfSelectedItem]];
+ if ([queryHistoryButton indexOfSelectedItem] > 3) {
+ if([prefs boolForKey:@"QueryHistoryReplacesContent"])
+ [textView setSelectedRange:NSMakeRange(0,[[textView string] length])];
+ [textView insertText:[queryHistoryButton titleOfSelectedItem]];
+ }
}
/*
@@ -196,8 +200,11 @@
{
// "Clear History" menu item - clear query history
if (sender == clearHistoryMenuItem) {
- [queryHistoryButton removeAllItems];
- [queryHistoryButton addItemWithTitle:NSLocalizedString(@"Query History…",@"Title of query history popup button")];
+ // Remove all history buttons beginning from the end
+ while([queryHistoryButton numberOfItems] > 4)
+ [queryHistoryButton removeItemAtIndex:[queryHistoryButton numberOfItems]-1];
+
+ // [queryHistoryButton addItemWithTitle:NSLocalizedString(@"Query History…",@"Title of query history popup button")];
[prefs setObject:[NSArray array] forKey:@"queryHistory"];
}
@@ -443,14 +450,15 @@
// add query to history
// if(!queriesSeparatedByDelimiter) { // TODO only add to history if no “delimiter” command was used
if(!tableReloadAfterEditing && [usedQuery length]) {
- [queryHistoryButton insertItemWithTitle:usedQuery atIndex:1];
+
+ [queryHistoryButton insertItemWithTitle:usedQuery atIndex:4];
int maxHistoryItems = [[prefs objectForKey:@"CustomQueryMaxHistoryItems"] intValue];
- while ( [queryHistoryButton numberOfItems] > maxHistoryItems + 1 )
+ while ( [queryHistoryButton numberOfItems] > maxHistoryItems + 4 )
[queryHistoryButton removeItemAtIndex:[queryHistoryButton numberOfItems]-1];
- for ( i = 1 ; i < [queryHistoryButton numberOfItems] ; i++ )
+ for ( i = 4 ; i < [queryHistoryButton numberOfItems] ; i++ )
[menuItems addObject:[queryHistoryButton itemTitleAtIndex:i]];
[prefs setObject:menuItems forKey:@"queryHistory"];
@@ -1818,11 +1826,39 @@
*/
- (void)controlTextDidChange:(NSNotification *)notification
{
- if ([notification object] == queryFavoriteNameTextField) {
+ if ([notification object] == queryFavoriteNameTextField)
[saveQueryFavoriteButton setEnabled:[[queryFavoriteNameTextField stringValue] length]];
+ else if ([notification object] == queryFavoritesSearchField){
+ [self filterQueryFavorites:nil];
+ [[saveQueryFavoriteButton menu] sizeToFit];
+ }
+ else if ([notification object] == queryHistorySearchField) {
+ [self filterQueryHistory:nil];
+ [[queryHistoryButton menu] sizeToFit];
}
- else if ([notification object] == queryFavoritesSearchField) {
+
+}
+
+/*
+ * TODO !! If user hit RETURN in fav/history search field
+ * the next menu item if any should be highlighted and the
+ * menu list should become the first responder - but how?
+ */
+- (void)controlTextDidEndEditing:(NSNotification *)notification
+{
+ if ([notification object] == queryFavoritesSearchField) {
[self filterQueryFavorites:nil];
+ if( [queryFavoritesButton numberOfItems] > 6 ) {
+ // TODO How to select the next menu item if user hits ENTER in search field?
+ // [queryFavoritesButton selectItemAtIndex:6];
+ }
+ }
+ else if ([notification object] == queryHistorySearchField) {
+ [self filterQueryHistory:nil];
+ if( [queryHistoryButton numberOfItems] > 4 ) {
+ // TODO How to select the next menu item if user hits ENTER in search field?
+ // [queryHistoryButton selectItemAtIndex:4];
+ }
}
}
@@ -2429,11 +2465,16 @@
*/
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
- // Use the menu item's title instead of its action as all menu items in the drop down have the same action
- if ([[menuItem title] isEqualToString:@"Save Query to Favorites"]) {
- return ([[textView string] length] > 0);
+ // Control "Save ... to Favorites" = tag is set to 1000
+ if ( [menuItem tag] == 1000 ) {
+ if ([[textView string] length] < 1) return NO;
+ if([textView selectedRange].length)
+ [menuItem setTitle:NSLocalizedString(@"Save Selection to Favorites",@"Save Selection to Favorites")];
+ else if(currentQueryRange.length)
+ [menuItem setTitle:NSLocalizedString(@"Save Current Query to Favorites",@"Save Current Query to Favorites")];
+ else
+ [menuItem setTitle:NSLocalizedString(@"Save All to Favorites",@"Save All to Favorites")];
}
-
return YES;
}
@@ -2489,6 +2530,15 @@
}
+- (IBAction)filterQueryHistory:(id)sender
+{
+ int i;
+ NSMenu *menu = [queryHistoryButton menu];
+ for (i=4; i< [menu numberOfItems]; i++)
+ [[menu itemAtIndex:i] setHidden:(![[[menu itemAtIndex:i] title] isMatchedByRegex:[NSString stringWithFormat:@"(?i).*%@.*", [queryHistorySearchField stringValue]]])];
+
+}
+
- (void)awakeFromNib
{
// Set the structure and index view's vertical gridlines if required
@@ -2496,7 +2546,12 @@
// Add the searchfield to the Query Favorite popup button list
[queryFavoritesSearchMenuItem setView:queryFavoritesSearchFieldView];
-
+ [queryFavoritesSearchField setNextKeyView:queryFavoritesButton];
+
+ // Add the searchfield to the Query Favorite popup button list
+ [queryHistorySearchMenuItem setView:queryHistorySearchFieldView];
+ [queryHistorySearchField setNextKeyView:queryHistoryButton];
+
// Populate the query favorites popup button
NSMenu *menu = [queryFavoritesButton menu];
int i = 6;