aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-04-27 23:21:30 +0000
committerBibiko <bibiko@eva.mpg.de>2009-04-27 23:21:30 +0000
commit48f7edad7277e6b67f813020943267487f4663c4 (patch)
treed369c162b54e50c86ccddf4e7430823b5cd6da61
parentc69089a7abb022fc1e454ff2bf8297887b1fc2f1 (diff)
downloadsequelpro-48f7edad7277e6b67f813020943267487f4663c4.tar.gz
sequelpro-48f7edad7277e6b67f813020943267487f4663c4.tar.bz2
sequelpro-48f7edad7277e6b67f813020943267487f4663c4.zip
• improved MySQL Help GUI resize behaviour
• fixed some minor issues to detect http links in help descriptions • first steps to make SQL statements and see [HELP %] clickable
-rw-r--r--Interfaces/English.lproj/DBView.xib15
-rw-r--r--Source/CustomQuery.m46
2 files changed, 49 insertions, 12 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index a0c17cd6..af9707ab 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="5428"/>
- <integer value="3994"/>
+ <integer value="5429"/>
<integer value="662"/>
+ <integer value="3994"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -7910,6 +7910,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<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">
@@ -7935,7 +7936,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="NSSearchField" id="375350404">
<reference key="NSNextResponder" ref="539508428"/>
- <int key="NSvFlags">265</int>
+ <int key="NSvFlags">266</int>
<string key="NSFrame">{{243, 282}, {98, 19}}</string>
<reference key="NSSuperview" ref="539508428"/>
<bool key="NSEnabled">YES</bool>
@@ -8089,7 +8090,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="NSButton" id="82616913">
<reference key="NSNextResponder" ref="539508428"/>
- <int key="NSvFlags">265</int>
+ <int key="NSvFlags">268</int>
<string key="NSFrame">{{193, 283}, {43, 17}}</string>
<reference key="NSSuperview" ref="539508428"/>
<bool key="NSEnabled">YES</bool>
@@ -8113,7 +8114,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="NSButton" id="867359114">
<reference key="NSNextResponder" ref="539508428"/>
- <int key="NSvFlags">265</int>
+ <int key="NSvFlags">268</int>
<string key="NSFrame">{{158, 283}, {35, 17}}</string>
<reference key="NSSuperview" ref="539508428"/>
<bool key="NSEnabled">YES</bool>
@@ -8133,7 +8134,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="NSButton" id="859272377">
<reference key="NSNextResponder" ref="539508428"/>
- <int key="NSvFlags">265</int>
+ <int key="NSvFlags">268</int>
<string key="NSFrame">{{115, 283}, {43, 17}}</string>
<reference key="NSSuperview" ref="539508428"/>
<bool key="NSEnabled">YES</bool>
@@ -21816,7 +21817,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5506</int>
+ <int key="maxID">5507</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 5afc918b..d735dc71 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1357,6 +1357,9 @@ traps enter key and
}
}
+
+
+#pragma mark -
#pragma mark MySQL Help
@@ -1457,7 +1460,7 @@ traps enter key and
{
switch([helpNavigator selectedSegment])
{
- case 1:
+ case 1: // TOC
[self showHelpFor:@"contents"];
break;
}
@@ -1575,21 +1578,54 @@ traps enter key and
// detect and generate http links
aRange = NSMakeRange(0,0);
- int safeCnt = 0; // safety counter - not more thn 20 links allowed
+ int safeCnt = 0; // safety counter - not more than 200 loops 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];
+ aRange = [desc rangeOfRegex:@"\\s((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:@"."] )
+ if([[desc substringWithRange:aRange] hasSuffix:@"."] || [[desc substringWithRange:aRange] hasSuffix:@")"])
aRange.length -= 1;
+ if([[desc substringWithRange:aRange] hasSuffix:@".)"] || [[desc substringWithRange:aRange] hasSuffix:@")."])
+ aRange.length -= 2;
aUrl = [desc substringWithRange:aRange];
[desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a href='%@'>%@</a>", aUrl, aUrl]];
}
else
break;
safeCnt++;
- if(safeCnt > 20)
+ if(safeCnt > 200)
+ break;
+ }
+ // detect and generate mysql links for "[HELP keyword]"
+ aRange = NSMakeRange(0,0);
+ safeCnt = 0;
+ while(1){
+ // TODO how to catch in HELP 'grant' last see [HELP SHOW GRANTS] ?? it's ridiculous
+ aRange = [desc rangeOfRegex:@"\\[HELP ([^ ]*?)\\]" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length+53, [desc length]-53-aRange.location-aRange.length) capture:1 error:&err1];
+ if(aRange.location != NSNotFound) {
+ aUrl = [desc substringWithRange:aRange];
+ [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]];
+ }
+ else
+ break;
+ safeCnt++;
+ if(safeCnt > 200)
break;
}
+ // detect and generate mysql links for capitalzed letters
+ // aRange = NSMakeRange(0,0);
+ // safeCnt = 0;
+ // while(1){
+ // aRange = [desc rangeOfRegex:@"(?<!\\w)([A-Z_]{2,}( [A-Z_]{2,})?)" 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 title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]];
+ // }
+ // else
+ // break;
+ // safeCnt++;
+ // if(safeCnt > 200)
+ // break;
+ // }
[theHelp appendString:@"<pre class='code'>"];
[theHelp appendString:desc];