aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-04-27 21:28:38 +0000
committerBibiko <bibiko@eva.mpg.de>2009-04-27 21:28:38 +0000
commitc69089a7abb022fc1e454ff2bf8297887b1fc2f1 (patch)
tree8cf424741725775908b4be64fcfed1a90ab8e10f
parent494226553237e2e19d882339180f8be26153eea4 (diff)
downloadsequelpro-c69089a7abb022fc1e454ff2bf8297887b1fc2f1.tar.gz
sequelpro-c69089a7abb022fc1e454ff2bf8297887b1fc2f1.tar.bz2
sequelpro-c69089a7abb022fc1e454ff2bf8297887b1fc2f1.zip
• MySQL Help improved
- added help target (online, in current page, in MySQL help ⌥⌘O,P,M) - GUI support for go back/forward (not yet implemented) - ⌘G, ⇧⌘G for find next/prev in current page - ⌘F selects search field; ⌘+ and ⌘- support - online search is version sensitive
-rw-r--r--Interfaces/English.lproj/DBView.xib574
-rw-r--r--Source/CustomQuery.h20
-rw-r--r--Source/CustomQuery.m514
3 files changed, 814 insertions, 294 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index cfe974b4..a0c17cd6 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -8,9 +8,9 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="662"/>
- <integer value="5429"/>
+ <integer value="5428"/>
<integer value="3994"/>
+ <integer value="662"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4802,6 +4802,7 @@
</object>
<string key="NSFrameSize">{588, 316}</string>
<reference key="NSSuperview" ref="541887300"/>
+ <reference key="NSNextKeyView" ref="798764405"/>
<reference key="NSDocView" ref="798764405"/>
<object class="NSColor" key="NSBGColor">
<int key="NSColorSpace">1</int>
@@ -4833,6 +4834,7 @@
</object>
<string key="NSFrame">{{0, 34}, {588, 316}}</string>
<reference key="NSSuperview" ref="661948784"/>
+ <reference key="NSNextKeyView" ref="593223452"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="142711676"/>
<reference key="NSHScroller" ref="705947940"/>
@@ -6237,7 +6239,7 @@
<reference key="NSControlView" ref="269606631"/>
<int key="NSButtonFlags">-2030812929</int>
<int key="NSButtonFlags2">34</int>
- <object class="NSCustomResource" key="NSNormalImage" id="22507558">
+ <object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSGoLeftTemplate</string>
</object>
@@ -7871,13 +7873,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSWindowTemplate" id="78186995">
<int key="NSWindowStyleMask">31</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 201}, {445, 309}}</string>
+ <string key="NSWindowRect">{{196, 201}, {351, 309}}</string>
<int key="NSWTFlags">-201325568</int>
<string key="NSWindowTitle">MySQL Help</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
- <string key="NSWindowContentMinSize">{100, 100}</string>
+ <string key="NSWindowContentMinSize">{351, 120}</string>
<object class="NSView" key="NSWindowView" id="539508428">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
@@ -7906,9 +7908,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>public.url-name</string>
</object>
</object>
- <string key="NSFrame">{{0, 36}, {445, 273}}</string>
+ <string key="NSFrameSize">{351, 273}</string>
<reference key="NSSuperview" ref="539508428"/>
- <reference key="NSNextKeyView"/>
<string key="FrameName"/>
<string key="GroupName"/>
<object class="WebPreferences" key="Preferences">
@@ -7934,16 +7935,16 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="NSSearchField" id="375350404">
<reference key="NSNextResponder" ref="539508428"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrame">{{53, 9}, {171, 19}}</string>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{243, 282}, {98, 19}}</string>
<reference key="NSSuperview" ref="539508428"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSearchFieldCell" key="NSCell" id="980282163">
- <int key="NSCellFlags">343014976</int>
- <int key="NSCellFlags2">268567552</int>
+ <int key="NSCellFlags">341966400</int>
+ <int key="NSCellFlags2">268568576</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString">search in the MySQL help</string>
+ <string key="NSPlaceholderString">search term</string>
<reference key="NSControlView" ref="375350404"/>
<bool key="NSDrawsBackground">YES</bool>
<int key="NSTextBezelStyle">1</int>
@@ -7992,63 +7993,230 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSPeriodicInterval">75</int>
</object>
<int key="NSMaximumRecents">255</int>
+ <bool key="NSSendsWholeSearchString">YES</bool>
+ </object>
+ </object>
+ <object class="NSButton" id="702259470">
+ <reference key="NSNextResponder" ref="539508428"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{81, -83}, {77, 32}}</string>
+ <reference key="NSSuperview" ref="539508428"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="809334050">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">larger</string>
+ <reference key="NSSupport" ref="244931163"/>
+ <reference key="NSControlView" ref="702259470"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">268435585</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">+</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
</object>
</object>
- <object class="NSButton" id="946363074">
+ <object class="NSButton" id="881970916">
<reference key="NSNextResponder" ref="539508428"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{20, 11}, {22, 17}}</string>
+ <string key="NSFrame">{{150, -83}, {86, 32}}</string>
+ <reference key="NSSuperview" ref="539508428"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="973253866">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">smaller</string>
+ <reference key="NSSupport" ref="244931163"/>
+ <reference key="NSControlView" ref="881970916"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">268435585</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">-</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSSegmentedControl" id="405872755">
+ <reference key="NSNextResponder" ref="539508428"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{12, 282}, {100, 19}}</string>
<reference key="NSSuperview" ref="539508428"/>
<bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="1295">
+ <object class="NSSegmentedCell" key="NSCell" id="580543076">
<int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">131072</int>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="405872755"/>
+ <object class="NSMutableArray" key="NSSegmentImages">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSSegmentItem">
+ <double key="NSSegmentItemWidth">3.200000e+01</double>
+ <object class="NSCustomResource" key="NSSegmentItemImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSLeftFacingTriangleTemplate</string>
+ </object>
+ <string key="NSSegmentItemTooltip">Go Back</string>
+ <bool key="NSSegmentItemDisabled">YES</bool>
+ <int key="NSSegmentItemImageScaling">0</int>
+ </object>
+ <object class="NSSegmentItem">
+ <double key="NSSegmentItemWidth">3.200000e+01</double>
+ <object class="NSCustomResource" key="NSSegmentItemImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSListViewTemplate</string>
+ </object>
+ <string key="NSSegmentItemLabel"/>
+ <string key="NSSegmentItemTooltip">MySQL Table of Content</string>
+ <int key="NSSegmentItemTag">1</int>
+ <int key="NSSegmentItemImageScaling">0</int>
+ </object>
+ <object class="NSSegmentItem">
+ <double key="NSSegmentItemWidth">3.200000e+01</double>
+ <object class="NSCustomResource" key="NSSegmentItemImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSRightFacingTriangleTemplate</string>
+ </object>
+ <string key="NSSegmentItemLabel"/>
+ <string key="NSSegmentItemTooltip">Go Forward</string>
+ <bool key="NSSegmentItemDisabled">YES</bool>
+ <int key="NSSegmentItemImageScaling">0</int>
+ </object>
+ </object>
+ <int key="NSSelectedSegment">1</int>
+ <int key="NSTrackingMode">2</int>
+ <int key="NSSegmentStyle">2</int>
+ </object>
+ </object>
+ <object class="NSButton" id="82616913">
+ <reference key="NSNextResponder" ref="539508428"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{193, 283}, {43, 17}}</string>
+ <reference key="NSSuperview" ref="539508428"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="1021410721">
+ <int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134479872</int>
- <string key="NSContents"/>
+ <string key="NSContents">MySQL</string>
<object class="NSFont" key="NSSupport" id="22">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">9.000000e+00</double>
<int key="NSfFlags">3614</int>
</object>
- <reference key="NSControlView" ref="946363074"/>
- <int key="NSButtonFlags">-2033958657</int>
- <int key="NSButtonFlags2">134</int>
- <object class="NSCustomResource" key="NSNormalImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSPathTemplate</string>
- </object>
+ <reference key="NSControlView" ref="82616913"/>
+ <int key="NSButtonFlags">-930856705</int>
+ <int key="NSButtonFlags2">402653357</int>
<string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
+ <string key="NSKeyEquivalent">m</string>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
</object>
- <object class="NSButton" id="321782713">
+ <object class="NSButton" id="867359114">
<reference key="NSNextResponder" ref="539508428"/>
- <int key="NSvFlags">-2147483356</int>
- <string key="NSFrame">{{277, 10}, {22, 17}}</string>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{158, 283}, {35, 17}}</string>
<reference key="NSSuperview" ref="539508428"/>
<bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="5430109">
+ <object class="NSButtonCell" key="NSCell" id="729612662">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">134479872</int>
- <string key="NSContents"/>
+ <string key="NSContents">Page</string>
<reference key="NSSupport" ref="22"/>
- <reference key="NSControlView" ref="321782713"/>
- <int key="NSButtonFlags">-2033958657</int>
- <int key="NSButtonFlags2">70</int>
- <reference key="NSNormalImage" ref="22507558"/>
+ <reference key="NSControlView" ref="867359114"/>
+ <int key="NSButtonFlags">-930856705</int>
+ <int key="NSButtonFlags2">402653357</int>
<string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
+ <string key="NSKeyEquivalent">p</string>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
</object>
+ <object class="NSButton" id="859272377">
+ <reference key="NSNextResponder" ref="539508428"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{115, 283}, {43, 17}}</string>
+ <reference key="NSSuperview" ref="539508428"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="808436088">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134479872</int>
+ <string key="NSContents">Online</string>
+ <reference key="NSSupport" ref="22"/>
+ <reference key="NSControlView" ref="859272377"/>
+ <int key="NSButtonFlags">-930856705</int>
+ <int key="NSButtonFlags2">402653357</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">o</string>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSButton" id="771216088">
+ <reference key="NSNextResponder" ref="539508428"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{157, -40}, {132, 32}}</string>
+ <reference key="NSSuperview" ref="539508428"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="572009263">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">focusToSearch</string>
+ <reference key="NSSupport" ref="244931163"/>
+ <reference key="NSControlView" ref="771216088"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">268435585</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">f</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="302242389">
+ <reference key="NSNextResponder" ref="539508428"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{71, -40}, {97, 32}}</string>
+ <reference key="NSSuperview" ref="539508428"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="814774449">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">FindNext</string>
+ <reference key="NSSupport" ref="244931163"/>
+ <reference key="NSControlView" ref="302242389"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">268435585</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">g</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="817639338">
+ <reference key="NSNextResponder" ref="539508428"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{72, -62}, {96, 32}}</string>
+ <reference key="NSSuperview" ref="539508428"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="477541011">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">FindPrev</string>
+ <reference key="NSSupport" ref="244931163"/>
+ <reference key="NSControlView" ref="817639338"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">268435585</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent">G</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
</object>
- <string key="NSFrameSize">{445, 309}</string>
+ <string key="NSFrameSize">{351, 309}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string>
- <string key="NSMinSize">{100, 116}</string>
+ <string key="NSMinSize">{351, 136}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSCustomView" id="139279766">
@@ -12970,19 +13138,115 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">showHelpContent:</string>
+ <string key="label">makeTextSmaller:</string>
+ <reference key="source" ref="177792895"/>
+ <reference key="destination" ref="881970916"/>
+ </object>
+ <int key="connectionID">5468</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">makeTextLarger:</string>
+ <reference key="source" ref="177792895"/>
+ <reference key="destination" ref="702259470"/>
+ </object>
+ <int key="connectionID">5469</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">helpNavigator</string>
<reference key="source" ref="601471102"/>
- <reference key="destination" ref="946363074"/>
+ <reference key="destination" ref="405872755"/>
</object>
- <int key="connectionID">5458</int>
+ <int key="connectionID">5478</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">showLastHelp:</string>
+ <string key="label">helpSegmentDispachter:</string>
<reference key="source" ref="601471102"/>
- <reference key="destination" ref="321782713"/>
+ <reference key="destination" ref="405872755"/>
</object>
- <int key="connectionID">5461</int>
+ <int key="connectionID">5481</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">helpTargetMySQLButton</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="82616913"/>
+ </object>
+ <int key="connectionID">5490</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">helpTargetPageButton</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="867359114"/>
+ </object>
+ <int key="connectionID">5491</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">helpTargetOnlineButton</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="859272377"/>
+ </object>
+ <int key="connectionID">5492</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">helpTargetOnlineButton:</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="859272377"/>
+ </object>
+ <int key="connectionID">5493</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">helpTargetPageButton:</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="867359114"/>
+ </object>
+ <int key="connectionID">5494</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">helpTargetMySQLButton:</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="82616913"/>
+ </object>
+ <int key="connectionID">5495</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">helpSearchFieldCell</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="980282163"/>
+ </object>
+ <int key="connectionID">5496</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">helpSearchFindNextInPage:</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="302242389"/>
+ </object>
+ <int key="connectionID">5502</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">helpSearchFindPreviousInPage:</string>
+ <reference key="source" ref="601471102"/>
+ <reference key="destination" ref="817639338"/>
+ </object>
+ <int key="connectionID">5505</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">selectText:</string>
+ <reference key="source" ref="375350404"/>
+ <reference key="destination" ref="771216088"/>
+ </object>
+ <int key="connectionID">5506</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -18275,9 +18539,16 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="177792895"/>
- <reference ref="321782713"/>
<reference ref="375350404"/>
- <reference ref="946363074"/>
+ <reference ref="405872755"/>
+ <reference ref="82616913"/>
+ <reference ref="859272377"/>
+ <reference ref="302242389"/>
+ <reference ref="817639338"/>
+ <reference ref="702259470"/>
+ <reference ref="881970916"/>
+ <reference ref="771216088"/>
+ <reference ref="867359114"/>
</object>
<reference key="parent" ref="78186995"/>
</object>
@@ -18301,32 +18572,130 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="parent" ref="375350404"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">5456</int>
- <reference key="object" ref="946363074"/>
+ <int key="objectID">5464</int>
+ <reference key="object" ref="702259470"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="809334050"/>
+ </object>
+ <reference key="parent" ref="539508428"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5465</int>
+ <reference key="object" ref="809334050"/>
+ <reference key="parent" ref="702259470"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5466</int>
+ <reference key="object" ref="881970916"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="973253866"/>
+ </object>
+ <reference key="parent" ref="539508428"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5467</int>
+ <reference key="object" ref="973253866"/>
+ <reference key="parent" ref="881970916"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5474</int>
+ <reference key="object" ref="405872755"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="580543076"/>
+ </object>
+ <reference key="parent" ref="539508428"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5475</int>
+ <reference key="object" ref="580543076"/>
+ <reference key="parent" ref="405872755"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5484</int>
+ <reference key="object" ref="82616913"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1021410721"/>
+ </object>
+ <reference key="parent" ref="539508428"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5485</int>
+ <reference key="object" ref="1021410721"/>
+ <reference key="parent" ref="82616913"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5486</int>
+ <reference key="object" ref="867359114"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="729612662"/>
+ </object>
+ <reference key="parent" ref="539508428"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5487</int>
+ <reference key="object" ref="729612662"/>
+ <reference key="parent" ref="867359114"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5488</int>
+ <reference key="object" ref="859272377"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="808436088"/>
+ </object>
+ <reference key="parent" ref="539508428"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5489</int>
+ <reference key="object" ref="808436088"/>
+ <reference key="parent" ref="859272377"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5497</int>
+ <reference key="object" ref="771216088"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="572009263"/>
+ </object>
+ <reference key="parent" ref="539508428"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5498</int>
+ <reference key="object" ref="572009263"/>
+ <reference key="parent" ref="771216088"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5500</int>
+ <reference key="object" ref="302242389"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1295"/>
+ <reference ref="814774449"/>
</object>
<reference key="parent" ref="539508428"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">5457</int>
- <reference key="object" ref="1295"/>
- <reference key="parent" ref="946363074"/>
+ <int key="objectID">5501</int>
+ <reference key="object" ref="814774449"/>
+ <reference key="parent" ref="302242389"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">5459</int>
- <reference key="object" ref="321782713"/>
+ <int key="objectID">5503</int>
+ <reference key="object" ref="817639338"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="5430109"/>
+ <reference ref="477541011"/>
</object>
<reference key="parent" ref="539508428"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">5460</int>
- <reference key="object" ref="5430109"/>
- <reference key="parent" ref="321782713"/>
+ <int key="objectID">5504</int>
+ <reference key="object" ref="477541011"/>
+ <reference key="parent" ref="817639338"/>
</object>
</object>
</object>
@@ -19461,12 +19830,27 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>5441.IBPluginDependency</string>
<string>5452.IBPluginDependency</string>
<string>5453.IBPluginDependency</string>
- <string>5456.IBAttributePlaceholdersKey</string>
- <string>5456.IBPluginDependency</string>
- <string>5457.IBPluginDependency</string>
- <string>5459.IBAttributePlaceholdersKey</string>
- <string>5459.IBPluginDependency</string>
- <string>5460.IBPluginDependency</string>
+ <string>5464.IBPluginDependency</string>
+ <string>5465.IBPluginDependency</string>
+ <string>5466.IBPluginDependency</string>
+ <string>5467.IBPluginDependency</string>
+ <string>5474.IBPluginDependency</string>
+ <string>5475.IBPluginDependency</string>
+ <string>5484.IBAttributePlaceholdersKey</string>
+ <string>5484.IBPluginDependency</string>
+ <string>5485.IBPluginDependency</string>
+ <string>5486.IBAttributePlaceholdersKey</string>
+ <string>5486.IBPluginDependency</string>
+ <string>5487.IBPluginDependency</string>
+ <string>5488.IBAttributePlaceholdersKey</string>
+ <string>5488.IBPluginDependency</string>
+ <string>5489.IBPluginDependency</string>
+ <string>5497.IBPluginDependency</string>
+ <string>5498.IBPluginDependency</string>
+ <string>5500.IBPluginDependency</string>
+ <string>5501.IBPluginDependency</string>
+ <string>5503.IBPluginDependency</string>
+ <string>5504.IBPluginDependency</string>
<string>557.IBPluginDependency</string>
<string>557.ImportedFromIB2</string>
<string>565.IBEditorWindowLastContentRect</string>
@@ -20494,7 +20878,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{1384, 275}, {200, 32}}</string>
+ <string>{{412, 275}, {200, 32}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{628, 654}</string>
<string>{{284, 769}, {200, 32}}</string>
@@ -20815,8 +21199,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{342, -13}, {944, 550}}</string>
- <string>{{342, -13}, {944, 550}}</string>
+ <string>{{68, -13}, {944, 550}}</string>
+ <string>{{68, -13}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -21110,21 +21494,27 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{482, 578}, {445, 309}}</string>
- <string>{{482, 578}, {445, 309}}</string>
+ <string>{{101, 425}, {351, 309}}</string>
+ <string>{{101, 425}, {351, 309}}</string>
<boolean value="NO"/>
<boolean value="YES"/>
- <string>{100, 100}</string>
+ <string>{351, 120}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</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>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
<string key="name">ToolTip</string>
- <reference key="object" ref="946363074"/>
- <string key="toolTip">Show MySQL main categories</string>
+ <reference key="object" ref="82616913"/>
+ <string type="base64-UTF8" key="toolTip">U2VhcmNoIGluIE15U1FMIEhlbHAgIFvijKXijJhNXQ</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -21133,12 +21523,28 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
<string key="name">ToolTip</string>
- <reference key="object" ref="321782713"/>
- <string key="toolTip">Show MySQL main categories</string>
+ <reference key="object" ref="867359114"/>
+ <string type="base64-UTF8" key="toolTip">U2VhcmNoIGluIGN1cnJlbnQgcGFnZSBb4oyl4oyYUF0</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="859272377"/>
+ <string type="base64-UTF8" key="toolTip">U2VhcmNoIGluIHRoZSBvbmxpbmUgZG9jdW1lbnRhdGlvbiBb4oyl4oyYT10</string>
+ </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>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{456, 426}, {292, 112}}</string>
@@ -21410,7 +21816,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5461</int>
+ <int key="maxID">5506</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -22537,12 +22943,16 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>copyQueryFavorite:</string>
<string>gearMenuItemSelected:</string>
<string>getHelpForCurrentWord:</string>
+ <string>helpSearchFindNextInPage:</string>
+ <string>helpSearchFindPreviousInPage:</string>
+ <string>helpSegmentDispachter:</string>
+ <string>helpTargetMySQLButton:</string>
+ <string>helpTargetOnlineButton:</string>
+ <string>helpTargetPageButton:</string>
<string>removeQueryFavorite:</string>
<string>runAllQueries:</string>
<string>runSelectedQueries:</string>
- <string>showHelpContent:</string>
<string>showHelpForSearchString:</string>
- <string>showLastHelp:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -22560,6 +22970,10 @@ Y2hhbmdlIHRoZSBvcmRlcg</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">
@@ -22576,7 +22990,12 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>customQueryView</string>
<string>editorFontMenuItem</string>
<string>errorText</string>
+ <string>helpNavigator</string>
<string>helpSearchField</string>
+ <string>helpSearchFieldCell</string>
+ <string>helpTargetMySQLButton</string>
+ <string>helpTargetOnlineButton</string>
+ <string>helpTargetPageButton</string>
<string>helpWebView</string>
<string>helpWebViewWindow</string>
<string>queryFavoritesButton</string>
@@ -22606,7 +23025,12 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>CMCopyTable</string>
<string>NSMenuItem</string>
<string>id</string>
+ <string>NSSegmentedControl</string>
<string>NSSearchField</string>
+ <string>NSSearchFieldCell</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
<string>id</string>
<string>NSWindow</string>
<string>id</string>
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index 4f8fd468..66c5e965 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -48,6 +48,10 @@
IBOutlet id copyQueryFavoriteButton;
IBOutlet id runSelectionButton;
IBOutlet id runAllButton;
+ IBOutlet id helpTargetPageButton;
+ IBOutlet id helpTargetOnlineButton;
+ IBOutlet id helpTargetMySQLButton;
+
IBOutlet NSMenuItem *runSelectionMenuItem;
IBOutlet NSMenuItem *clearHistoryMenuItem;
IBOutlet NSMenuItem *shiftLeftMenuItem;
@@ -61,7 +65,8 @@
IBOutlet NSWindow *helpWebViewWindow;
IBOutlet id helpWebView;
IBOutlet NSSearchField *helpSearchField;
- NSString *lastHelpString;
+ IBOutlet NSSearchFieldCell *helpSearchFieldCell;
+ IBOutlet NSSegmentedControl *helpNavigator;
NSArray *queryResult;
NSUserDefaults *prefs;
@@ -70,8 +75,12 @@
CMMCPConnection *mySQLConnection;
NSString *usedQuery;
+ NSString *mySQLversion;
+
int queryStartPosition;
+ int helpTarget;
+
}
// IBAction methods
@@ -83,8 +92,12 @@
- (IBAction)gearMenuItemSelected:(id)sender;
- (IBAction)getHelpForCurrentWord:(id)sender;
- (IBAction)showHelpForSearchString:(id)sender;
-- (IBAction)showHelpContent:(id)sender;
-- (IBAction)showLastHelp:(id)sender;
+- (IBAction)helpSegmentDispachter:(id)sender;
+- (IBAction)helpTargetPageButton:(id)sender;
+- (IBAction)helpTargetOnlineButton:(id)sender;
+- (IBAction)helpTargetMySQLButton:(id)sender;
+- (IBAction)helpSearchFindNextInPage:(id)sender;
+- (IBAction)helpSearchFindPreviousInPage:(id)sender;
// queryFavoritesSheet methods
@@ -105,6 +118,7 @@
// MySQL Help
- (void)showHelpFor:(NSString *)aString;
- (NSString *)getHTMLHelpFor:(NSString *)aString;
+- (void)helpTargetValidation;
// Other
- (void)setConnection:(CMMCPConnection *)theConnection;
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index d0f0f606..5afc918b 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -28,8 +28,9 @@
#import "SPStringAdditions.h"
#import "SPTextViewAdditions.h"
-@implementation CustomQuery
+#define MYSQL_DEV_SEARCH_URL @"http://search.mysql.com/search?q=%@&site=refman-%@"
+@implementation CustomQuery
#pragma mark IBAction methods
@@ -113,221 +114,6 @@
[self performQueries:queries];
}
-/*
- * Retrieve and show the data for "HELP 'search word'"
- */
-
-- (IBAction)showHelpForSearchString:(id)sender
-{
- [self showHelpFor:[[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
-}
-
-/*
- * Retrieve and show the data for "HELP 'currentWord'"
- */
-- (IBAction)getHelpForCurrentWord:(id)sender
-{
- NSString *aString = [[textView string] substringWithRange:[textView getRangeForCurrentWord]];
-
- // if(![aString length]) return;
-
- [self showHelpFor:aString];
-
-}
-
-/*
- * Retrieve and show the data for "HELP 'contents' (MySQL help root)".
- */
-
-- (IBAction)showHelpContent:(id)sender
-{
- [self showHelpFor:@"contents"];
-}
-
-- (IBAction)showLastHelp:(id)sender
-{
- NSLog(@"%@", lastHelpString);
- if([lastHelpString length])
- [self showHelpFor:lastHelpString];
-}
-
-
-/*
- * Retrieve and show the data for "HELP 'aString'".
- */
-- (void)showHelpFor:(NSString *)aString
-{
- NSString * helpString = [self getHTMLHelpFor:aString];
- lastHelpString = [[NSString stringWithString:aString] retain];
- // Order out the Help window
- if(![helpWebViewWindow isVisible])
- {
-
- // Get the major MySQL server version in the form of x.x, which is basically the first 3 characters of the returned version string
- //get mysql version
- CMMCPResult *theResult = nil;
- NSString *mySQLVersion;
- theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE 'version'"];
- NSString *version = [[theResult fetchRowAsArray] objectAtIndex:1];
- if ( [version isKindOfClass:[NSData class]] ) {
- // starting with MySQL 4.1.14 the mysql variables are returned as nsdata
- mySQLVersion = [[NSString alloc] initWithData:version encoding:[mySQLConnection encoding]];
- } else {
- mySQLVersion = [[NSString stringWithString:version] retain];
- }
-
- [helpWebViewWindow setTitle:[NSString stringWithFormat:@"%@ (%@ %@)", NSLocalizedString(@"MySQL Help", @"mysql help"), NSLocalizedString(@"version", @"version"), [mySQLVersion substringToIndex:3]]];
- [helpWebViewWindow orderFront:helpWebView];
- }
-
- if(![helpString length]) return;
-
- [[helpWebView mainFrame] loadHTMLString:helpString baseURL:nil];
-
-}
-
-
-/*
- * Return the help string HTML formatted from executing "HELP 'aString'".
- * If more than one help topic was found return a link list.
- */
-- (NSString *)getHTMLHelpFor:(NSString *)aString
-{
-
- if(![aString length]) return(@"");
-
- CMMCPResult *theResult = nil;
- NSDictionary *tableDetails;
- NSRange aRange;
- NSMutableString *theHelp = [NSMutableString string];
- [theHelp setString:
- @"<html>"
- @"<head>"
- @" <style type='text/css' media='screen'>"
- @" body {"
- @" margin: 2px;"
- @" padding: 10px;"
- @" font-family:'Helvetica';"
- @" font-size:9pt;"
- @" }"
- @" .internallink {"
- @" color:#6A81DD;"
- @" text-decoration:none;"
- @" }"
- @" .code {"
- @" font-family:Monaco;"
- @" }"
- @" .header {"
- @" padding:5mm;"
- @" }"
- @" </style>"
- @"</head>"
- @"<body>"
-
- ];
-
- theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"HELP '%@'", aString]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] || ![theResult numOfRows]) return @"";
-
- tableDetails = [[NSDictionary alloc] initWithDictionary:[theResult fetchRowAsDictionary]];
-
- if ([tableDetails objectForKey:@"description"]) { // one single help topic found
- if ([tableDetails objectForKey:@"name"]) {
- [theHelp appendString:@"<h2 class='header'>&nbsp;&nbsp;"];
- [theHelp appendString:[[[tableDetails objectForKey:@"name"] copy] autorelease]];
- [theHelp appendString:@"</h2>"];
-
- }
- if ([tableDetails objectForKey:@"description"]) {
- NSMutableString *desc = [NSMutableString string];
- NSError *err1 = NULL;
- NSString *aUrl;
-
- [desc setString:[[[tableDetails objectForKey:@"description"] copy] autorelease]];
-
- // Look for an URL and create an HTML link out of it
- aRange = [desc rangeOfRegex:@"URL: +(.*)" options:RKLNoOptions inRange:NSMakeRange(0, [desc length]) capture:1 error:&err1];
- if(aRange.location != NSNotFound) {
- aUrl = [desc substringWithRange:aRange];
- [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a href='%@'>%@</a>", aUrl, aUrl]];
- }
- // aRange = NSMakeRange(0,0);
- // int safeCnt = 0;
- // while(1){
- // aRange = [desc rangeOfRegex:@"(http.*?)\\s" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length, [desc length]-aRange.location-aRange.length) capture:1 error:&err1];
- // if(aRange.location != NSNotFound) {
- // aUrl = [desc substringWithRange:aRange];
- // [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a href='%@'>%@</a>", aUrl, aUrl]];
- // }
- // else
- // break;
- // safeCnt++;
- // if(safeCnt > 20)
- // break;
- // }
-
- [theHelp appendString:@"<pre class='code'>"];
- [theHelp appendString:desc];
- [theHelp appendString:@"</pre>"];
- }
- if([tableDetails objectForKey:@"example"]){
- NSString *examples = [[[tableDetails objectForKey:@"example"] copy] autorelease];
- if([examples length]){
- [theHelp appendString:@"<br><br><i><b>Example:</b></i><br><br><pre class='code'>"];
- [theHelp appendString:examples];
- [theHelp appendString:@"</pre>"];
- }
- }
- } else { // list all found topics
- int i;
- int r = [theResult numOfRows];
- if (r) [theResult dataSeek:0];
-
- if(![aString isEqualToString:@"contents"])
- [theHelp appendString:[NSString stringWithFormat:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), aString]];
- else
- [theHelp appendString:[NSString stringWithFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), aString]];
-
- [theHelp appendString:@"<ul>"];
- for ( i = 0 ; i < r ; i++ ) {
- NSArray *anArray = [theResult fetchRowAsArray];
- NSString *topic = [anArray objectAtIndex:[anArray count]-2];
- [theHelp appendString:
- [NSString stringWithFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic]];
- }
- [theHelp appendString:@"</ul>"];
- }
- [theHelp appendString:@"</body></html>"];
-
- [tableDetails release];
- return theHelp;
-
-}
-
-/*
- * Link detector: If user clicked at an http link open it in the default browser,
- * otherwise search for it in the MySQL help.
- */
-- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
-{
- int navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
- if([[[request URL] scheme] isEqualToString:@"applewebdata"]){
- [self showHelpFor:[[[request URL] path] substringWithRange:NSMakeRange(1,[[[request URL] path] length]-1)]];
- [listener ignore];
- } else {
- if (navigationType == WebNavigationTypeOther) {
- [listener use];
- } else if (navigationType == WebNavigationTypeLinkClicked) {
- [[NSWorkspace sharedWorkspace] openURL:[actionInformation objectForKey:WebActionOriginalURLKey]];
- [listener ignore];
- } else {
- // Ignore WebNavigationTypeFormSubmitted, WebNavigationTypeBackForward,
- // WebNavigationTypeReload and WebNavigationTypeFormResubmitted.
- [listener ignore];
- }
- }
-}
-
- (IBAction)chooseQueryFavorite:(id)sender
/*
@@ -1571,6 +1357,302 @@ traps enter key and
}
}
+#pragma mark MySQL Help
+
+
+/*
+ * Retrieve and show the data for "HELP 'aString'".
+ */
+- (void)showHelpFor:(NSString *)aString
+{
+ NSString * helpString = [self getHTMLHelpFor:aString];
+ // Order out the Help window
+ if(![helpWebViewWindow isVisible])
+ {
+
+ // Get the major MySQL server version in the form of x.x, which is basically the first 3 characters of the returned version string
+ //get mysql version
+ CMMCPResult *theResult = nil;
+ theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE 'version'"];
+ NSString *version = [[theResult fetchRowAsArray] objectAtIndex:1];
+ if ( [version isKindOfClass:[NSData class]] ) {
+ // starting with MySQL 4.1.14 the mysql variables are returned as nsdata
+ mySQLversion = [[NSString alloc] initWithData:version encoding:[mySQLConnection encoding]];
+ } else {
+ mySQLversion = [[NSString stringWithString:version] retain];
+ }
+
+ [helpWebViewWindow setTitle:[NSString stringWithFormat:@"%@ (%@ %@)", NSLocalizedString(@"MySQL Help", @"mysql help"), NSLocalizedString(@"version", @"version"), [mySQLversion substringToIndex:3]]];
+ [helpWebViewWindow orderFront:helpWebView];
+ helpTarget = 2;
+ [self helpTargetValidation];
+ }
+
+ if(![helpString length]) return;
+
+ [[helpWebView mainFrame] loadHTMLString:helpString baseURL:nil];
+
+
+}
+
+
+/*
+ * Retrieve and show the data for "HELP 'search word'" according to helpTarget
+ */
+- (IBAction)showHelpForSearchString:(id)sender
+{
+ switch(helpTarget)
+ {
+ case 0: // page
+ [helpWebView searchFor:[[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] direction:YES caseSensitive:NO wrap:YES];
+ break;
+ case 1: // online
+ // Open MySQL Documentation search in browser using the term
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:
+ [[NSString stringWithFormat:
+ MYSQL_DEV_SEARCH_URL,
+ [[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]],
+ [[mySQLversion substringToIndex:3] stringByReplacingOccurrencesOfString:@"." withString:@""]]
+ stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];
+ // [[helpWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:
+ // [[NSString stringWithFormat:
+ // MYSQL_DEV_SEARCH_URL,
+ // [[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]],
+ // [[mySQLversion substringToIndex:3] stringByReplacingOccurrencesOfString:@"." withString:@""]]
+ // stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]]];
+ break;
+ case 2: // MySQL
+ [self showHelpFor:[[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
+ break;
+ }
+}
+
+/*
+ * Retrieve and show the data for "HELP 'currentWord'"
+ */
+- (IBAction)getHelpForCurrentWord:(id)sender
+{
+ NSString *aString = [[textView string] substringWithRange:[textView getRangeForCurrentWord]];
+ // if(![aString length]) return;
+ [self showHelpFor:aString];
+}
+
+/*
+ * Find Next/Previous in current page
+ */
+- (IBAction)helpSearchFindNextInPage:(id)sender
+{
+ if(!helpTarget)
+ [helpWebView searchFor:[[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] direction:YES caseSensitive:NO wrap:YES];
+}
+- (IBAction)helpSearchFindPreviousInPage:(id)sender
+{
+ if(!helpTarget)
+ [helpWebView searchFor:[[helpSearchField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] direction:NO caseSensitive:NO wrap:YES];
+}
+/*
+ * Navigation for back/TOC/forward
+ */
+- (IBAction)helpSegmentDispachter:(id)sender
+{
+ switch([helpNavigator selectedSegment])
+ {
+ case 1:
+ [self showHelpFor:@"contents"];
+ break;
+ }
+}
+
+/*
+ * Set helpTarget
+ */
+
+- (IBAction)helpTargetPageButton:(id)sender
+{
+ helpTarget = 0;
+ [self helpTargetValidation];
+}
+- (IBAction)helpTargetOnlineButton:(id)sender
+{
+ helpTarget = 1;
+ [self helpTargetValidation];
+}
+- (IBAction)helpTargetMySQLButton:(id)sender
+{
+ helpTarget = 2;
+ [self helpTargetValidation];
+}
+
+/*
+ * Control search target buttons and help behaviour
+ */
+- (void)helpTargetValidation
+{
+ switch(helpTarget)
+ {
+ case 0: // page
+ [helpTargetPageButton setState:NSOnState];
+ [helpTargetOnlineButton setState:NSOffState];
+ [helpTargetMySQLButton setState:NSOffState];
+ [helpSearchFieldCell setSendsWholeSearchString:YES];
+ break;
+ case 1: // online
+ [helpTargetPageButton setState:NSOffState];
+ [helpTargetOnlineButton setState:NSOnState];
+ [helpTargetMySQLButton setState:NSOffState];
+ [helpSearchFieldCell setSendsWholeSearchString:YES];
+ break;
+ case 2: // MySQL
+ [helpTargetPageButton setState:NSOffState];
+ [helpTargetOnlineButton setState:NSOffState];
+ [helpTargetMySQLButton setState:NSOnState];
+ [helpSearchFieldCell setSendsWholeSearchString:NO];
+ break;
+ }
+}
+
+/*
+ * Return the help string HTML formatted from executing "HELP 'aString'".
+ * If more than one help topic was found return a link list.
+ */
+- (NSString *)getHTMLHelpFor:(NSString *)aString
+{
+
+ if(![aString length]) return(@"");
+
+ CMMCPResult *theResult = nil;
+ NSDictionary *tableDetails;
+ NSRange aRange;
+ NSMutableString *theHelp = [NSMutableString string];
+ [theHelp setString:
+ @"<html>"
+ @"<head>"
+ @" <style type='text/css' media='screen'>"
+ @" body {"
+ @" margin: 2px;"
+ @" padding: 10px;"
+ @" font-family:'Helvetica';"
+ @" font-size:9pt;"
+ @" }"
+ @" .internallink {"
+ @" color:#6A81DD;"
+ @" text-decoration:none;"
+ @" }"
+ @" .code {"
+ @" font-family:Monaco;"
+ @" }"
+ @" .searchstring {"
+ @" }"
+ @" .header {"
+ @" padding:2mm;"
+ @" }"
+ @" </style>"
+ @"</head>"
+ @"<body>"
+
+ ];
+
+ theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"HELP '%@'", aString]];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] || ![theResult numOfRows]) return @"";
+
+ tableDetails = [[NSDictionary alloc] initWithDictionary:[theResult fetchRowAsDictionary]];
+
+ if ([tableDetails objectForKey:@"description"]) { // one single help topic found
+ if ([tableDetails objectForKey:@"name"]) {
+ [theHelp appendString:@"<h2 class='header'>&nbsp;&nbsp;"];
+ [theHelp appendString:[[[tableDetails objectForKey:@"name"] copy] autorelease]];
+ [theHelp appendString:@"</h2>"];
+
+ }
+ if ([tableDetails objectForKey:@"description"]) {
+ NSMutableString *desc = [NSMutableString string];
+ NSError *err1 = NULL;
+ NSString *aUrl;
+
+ [desc setString:[[[tableDetails objectForKey:@"description"] copy] autorelease]];
+
+ [desc replaceOccurrencesOfString:[aString uppercaseString] withString:[NSString stringWithFormat:@"<span class='searchstring'>%@</span>", [aString uppercaseString]] options:NSLiteralSearch range:NSMakeRange(0,[desc length])];
+
+ // detect and generate http links
+ aRange = NSMakeRange(0,0);
+ int safeCnt = 0; // safety counter - not more thn 20 links allowed
+ while(1){
+ aRange = [desc rangeOfRegex:@" ((https?|ftp:file)://.*?)\\s" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length, [desc length]-aRange.location-aRange.length) capture:1 error:&err1];
+ if(aRange.location != NSNotFound) {
+ if([[desc substringWithRange:aRange] hasSuffix:@"."] )
+ aRange.length -= 1;
+ aUrl = [desc substringWithRange:aRange];
+ [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a href='%@'>%@</a>", aUrl, aUrl]];
+ }
+ else
+ break;
+ safeCnt++;
+ if(safeCnt > 20)
+ break;
+ }
+
+ [theHelp appendString:@"<pre class='code'>"];
+ [theHelp appendString:desc];
+ [theHelp appendString:@"</pre>"];
+ }
+ if([tableDetails objectForKey:@"example"]){
+ NSString *examples = [[[tableDetails objectForKey:@"example"] copy] autorelease];
+ if([examples length]){
+ [theHelp appendString:@"<br><br><i><b>Example:</b></i><br><br><pre class='code'>"];
+ [theHelp appendString:examples];
+ [theHelp appendString:@"</pre>"];
+ }
+ }
+ } else { // list all found topics
+ int i;
+ int r = [theResult numOfRows];
+ if (r) [theResult dataSeek:0];
+
+ if(![aString isEqualToString:@"contents"])
+ [theHelp appendString:[NSString stringWithFormat:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), aString]];
+ else
+ [theHelp appendString:[NSString stringWithFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), aString]];
+
+ [theHelp appendString:@"<ul>"];
+ for ( i = 0 ; i < r ; i++ ) {
+ NSArray *anArray = [theResult fetchRowAsArray];
+ NSString *topic = [anArray objectAtIndex:[anArray count]-2];
+ [theHelp appendString:
+ [NSString stringWithFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic]];
+ }
+ [theHelp appendString:@"</ul>"];
+ }
+ [theHelp appendString:@"</body></html>"];
+
+ [tableDetails release];
+ return theHelp;
+
+}
+
+/*
+ * Link detector: If user clicked at an http link open it in the default browser,
+ * otherwise search for it in the MySQL help.
+ */
+- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
+{
+ int navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
+ if([[[request URL] scheme] isEqualToString:@"applewebdata"]){
+ [self showHelpFor:[[[request URL] path] substringWithRange:NSMakeRange(1,[[[request URL] path] length]-1)]];
+ [listener ignore];
+ } else {
+ if (navigationType == WebNavigationTypeOther) {
+ [listener use];
+ } else if (navigationType == WebNavigationTypeLinkClicked) {
+ [[NSWorkspace sharedWorkspace] openURL:[actionInformation objectForKey:WebActionOriginalURLKey]];
+ [listener ignore];
+ } else {
+ // Ignore WebNavigationTypeFormSubmitted, WebNavigationTypeBackForward,
+ // WebNavigationTypeReload and WebNavigationTypeFormResubmitted.
+ [listener ignore];
+ }
+ }
+}
+
#pragma mark -