aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-12-14 22:12:36 +0000
committerstuconnolly <stuart02@gmail.com>2010-12-14 22:12:36 +0000
commit2f1146de80e658021e6a0fc63a20b039f73cca06 (patch)
treeaf451ac4cd3fbbee8b03f306cfdc95435e5ca1f5
parent9859a8f8b20ebf038967a09b40bba9b4eb2f223b (diff)
parent263c981e4905595ebcb3e5d57609ddf75bdf40a2 (diff)
downloadsequelpro-2f1146de80e658021e6a0fc63a20b039f73cca06.tar.gz
sequelpro-2f1146de80e658021e6a0fc63a20b039f73cca06.tar.bz2
sequelpro-2f1146de80e658021e6a0fc63a20b039f73cca06.zip
Bring outline view branch up to date with trunk (r3018:3028).
-rw-r--r--Interfaces/English.lproj/BundleEditor.xib5
-rw-r--r--Interfaces/English.lproj/DBView.xib56
-rw-r--r--README3
-rw-r--r--Source/NoodleLineNumberView.m141
-rw-r--r--Source/SPAppController.m54
-rw-r--r--Source/SPBundleCommandTextView.m20
-rw-r--r--Source/SPDatabaseDocument.m38
-rw-r--r--Source/SPTableData.m2
-rw-r--r--Source/SPTextViewAdditions.m4
-rw-r--r--Source/SPXMLExporter.m4
10 files changed, 181 insertions, 146 deletions
diff --git a/Interfaces/English.lproj/BundleEditor.xib b/Interfaces/English.lproj/BundleEditor.xib
index 8f224ad4..25be786e 100644
--- a/Interfaces/English.lproj/BundleEditor.xib
+++ b/Interfaces/English.lproj/BundleEditor.xib
@@ -23,7 +23,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="683"/>
+ <integer value="686"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -383,7 +383,6 @@
</object>
</object>
</object>
- <int key="NSSelectedIndex">3</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -875,7 +874,7 @@
<string key="NSFrame">{{20, 140}, {506, 189}}</string>
<reference key="NSSuperview" ref="338542681"/>
<reference key="NSNextKeyView" ref="971406968"/>
- <int key="NSsFlags">562</int>
+ <int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="414961522"/>
<reference key="NSHScroller" ref="724741922"/>
<reference key="NSContentView" ref="971406968"/>
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 1e9085a1..760c4033 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -23,13 +23,13 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="7208"/>
+ <integer value="7210"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.brandonwalkin.BWToolkit</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
@@ -222,7 +222,7 @@
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor" id="1001122760">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
</object>
</object>
<reference key="NSTextColor" ref="454249633"/>
@@ -3530,7 +3530,7 @@
<string>public.url</string>
</object>
</object>
- <string key="NSFrame">{{0, -8}, {694, 14}}</string>
+ <string key="NSFrameSize">{694, 14}</string>
<reference key="NSSuperview" ref="888807510"/>
<object class="NSTextContainer" key="NSTextContainer" id="845974686">
<object class="NSLayoutManager" key="NSLayoutManager">
@@ -4575,7 +4575,7 @@
<reference key="NSSuperview" ref="618407678"/>
<reference key="NSTarget" ref="618407678"/>
<string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.98496240601503759</double>
+ <double key="NSPercent">0.98496240377426147</double>
</object>
<object class="NSScroller" id="195758564">
<reference key="NSNextResponder" ref="618407678"/>
@@ -7205,7 +7205,7 @@
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="234287744">
<nil key="NSNextResponder"/>
@@ -7359,7 +7359,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{213, 129}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="423199625">
<int key="NSWindowStyleMask">7</int>
@@ -7369,7 +7369,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">Reset Auto Increment</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{255, 95}</string>
<object class="NSView" key="NSWindowView" id="748618982">
<nil key="NSNextResponder"/>
@@ -7532,7 +7532,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string>
<string key="NSMinSize">{255, 117}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="787219800">
<int key="NSWindowStyleMask">1</int>
@@ -7542,7 +7542,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">New Relation</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="842408319">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@@ -8143,7 +8143,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSFrameSize">{302, 307}</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="437271354">
<int key="NSWindowStyleMask">9</int>
@@ -8153,7 +8153,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">New Trigger</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{360, 348}</string>
<object class="NSView" key="NSWindowView" id="729080358">
<nil key="NSNextResponder"/>
@@ -8560,7 +8560,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{360, 370}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="1066802919">
<int key="NSWindowStyleMask">3</int>
@@ -8572,7 +8572,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 50}</string>
<object class="NSView" key="NSWindowView" id="525490268">
<nil key="NSNextResponder"/>
@@ -8692,7 +8692,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{213, 72}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="553728448">
<int key="NSWindowStyleMask">9</int>
@@ -8704,7 +8704,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="1052076676">
<nil key="NSNextResponder"/>
@@ -8839,7 +8839,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{213, 129}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="828950706">
<int key="NSWindowStyleMask">15</int>
@@ -8851,7 +8851,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{350, 200}</string>
<object class="NSView" key="NSWindowView" id="749598685">
<nil key="NSNextResponder"/>
@@ -9074,7 +9074,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{350, 222}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">SPCreateSyntaxSheet</string>
</object>
<object class="NSWindowTemplate" id="466147946">
@@ -9087,7 +9087,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="860968037">
<nil key="NSNextResponder"/>
@@ -9257,7 +9257,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{213, 129}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="78186995">
<int key="NSWindowStyleMask">31</int>
@@ -9267,7 +9267,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">MySQL Help</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{351, 120}</string>
<object class="NSView" key="NSWindowView" id="539508428">
<nil key="NSNextResponder"/>
@@ -9665,7 +9665,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string>
<string key="NSMinSize">{351, 136}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">MYSQL_HELP_WINDOW</string>
</object>
<object class="NSWindowTemplate" id="633448481">
@@ -9676,7 +9676,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">Filter</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{380, 170}</string>
<object class="NSView" key="NSWindowView" id="257361103">
<nil key="NSNextResponder"/>
@@ -10318,7 +10318,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{380, 192}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">SPTableFilterPanel</string>
</object>
<object class="NSWindowTemplate" id="923391973">
@@ -10818,7 +10818,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA</bytes>
<string key="NSWindowTitle">Secure Text Input Sheet</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="978976687">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@@ -10922,7 +10922,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA</bytes>
<string key="NSFrameSize">{338, 150}</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSCustomView" id="884983195">
<nil key="NSNextResponder"/>
@@ -11105,7 +11105,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA</bytes>
<string key="NSColorName">disabledControlTextColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes>
+ <bytes key="NSWhite">MC4zMzMzMzMzNDMzAA</bytes>
</object>
</object>
</object>
diff --git a/README b/README
index 3374c423..cb788d74 100644
--- a/README
+++ b/README
@@ -29,4 +29,5 @@ originally location or re-add it using the steps above.
As a last resort jump onto IRC and join #sequel-pro on irc.freenode.net and
any of the developers will be happy to help you out.
-- Ben (aka avenjamin) \ No newline at end of file
+- Ben (aka avenjamin)
+
diff --git a/Source/NoodleLineNumberView.m b/Source/NoodleLineNumberView.m
index 0bb9b25e..9e0d284a 100644
--- a/Source/NoodleLineNumberView.m
+++ b/Source/NoodleLineNumberView.m
@@ -353,7 +353,7 @@
- (void)drawHashMarksAndLabelsInRect:(NSRect)aRect
{
- id view;
+ id view;
NSRect bounds;
bounds = [self bounds];
@@ -362,87 +362,88 @@
{
[backgroundColor set];
NSRectFill(bounds);
-
+
[[NSColor colorWithCalibratedWhite:0.58 alpha:1.0] set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(bounds) - 0/5, NSMinY(bounds)) toPoint:NSMakePoint(NSMaxX(bounds) - 0.5, NSMaxY(bounds))];
+ [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(bounds) - 0.5, NSMinY(bounds)) toPoint:NSMakePoint(NSMaxX(bounds) - 0.5, NSMaxY(bounds))];
}
-
- view = [self clientView];
-
- if ([view isKindOfClass:[NSTextView class]])
- {
- NSLayoutManager *layoutManager;
- NSTextContainer *container;
- NSRect visibleRect;
- NSRange range, glyphRange, nullRange;
- NSString *text, *labelText;
- NSUInteger rectCount, index, line, count;
- NSRectArray rects;
- CGFloat ypos, yinset;
- NSDictionary *textAttributes, *currentTextAttributes;
- NSSize stringSize;
+
+ view = [self clientView];
+
+ if ([view isKindOfClass:[NSTextView class]])
+ {
+ NSLayoutManager *layoutManager;
+ NSTextContainer *container;
+ NSRect visibleRect;
+ NSRange range, glyphRange, nullRange;
+ NSString *text, *labelText;
+ NSUInteger rectCount, index, line, count;
+ NSRectArray rects;
+ CGFloat ypos, yinset;
+ NSDictionary *textAttributes;
+ NSSize stringSize;
NSMutableArray *lines;
- layoutManager = [view layoutManager];
- container = [view textContainer];
- text = [view string];
- nullRange = NSMakeRange(NSNotFound, 0);
-
+ layoutManager = [view layoutManager];
+ container = [view textContainer];
+ text = [view string];
+ nullRange = NSMakeRange(NSNotFound, 0);
+
yinset = [view textContainerInset].height;
- visibleRect = [[[self scrollView] contentView] bounds];
+ visibleRect = [[[self scrollView] contentView] bounds];
+
+ textAttributes = [self textAttributes];
- textAttributes = [self textAttributes];
-
lines = [self lineIndices];
- // Find the characters that are currently visible
- glyphRange = [layoutManager glyphRangeForBoundingRect:visibleRect inTextContainer:container];
- range = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];
-
- // Fudge the range a tad in case there is an extra new line at end.
- // It doesn't show up in the glyphs so would not be accounted for.
- range.length++;
-
- count = [lines count];
-
- for (line = [self lineNumberForCharacterIndex:range.location inText:text]; line < count; line++)
- {
- index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
-
- if (NSLocationInRange(index, range))
- {
- rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0)
- withinSelectedCharacterRange:nullRange
- inTextContainer:container
- rectCount:&rectCount];
-
- if (rectCount > 0)
- {
- // Note that the ruler view is only as tall as the visible
- // portion. Need to compensate for the clipview's coordinates.
- ypos = yinset + NSMinY(rects[0]) - NSMinY(visibleRect);
-
- // Line numbers are internally stored starting at 0
- labelText = [NSString stringWithFormat:@"%lu", (unsigned long)(line + 1)];
-
- stringSize = [labelText sizeWithAttributes:textAttributes];
-
- currentTextAttributes = textAttributes;
-
- // Draw string flush right, centered vertically within the line
- [labelText drawInRect:
- NSMakeRect(NSWidth(bounds) - stringSize.width - RULER_MARGIN,
- ypos + (NSHeight(rects[0]) - stringSize.height) / 2.0,
- NSWidth(bounds) - RULER_MARGIN * 2.0, NSHeight(rects[0]))
- withAttributes:currentTextAttributes];
- }
- }
+ // Find the characters that are currently visible
+ glyphRange = [layoutManager glyphRangeForBoundingRect:visibleRect inTextContainer:container];
+ range = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];
+
+ // Fudge the range a tad in case there is an extra new line at end.
+ // It doesn't show up in the glyphs so would not be accounted for.
+ range.length++;
+
+ count = [lines count];
+
+ CGFloat boundsRULERMargin2 = NSWidth(bounds) - RULER_MARGIN * 2.0;
+ CGFloat boundsWidthRULER = NSWidth(bounds) - RULER_MARGIN;
+ CGFloat yinsetMinY = yinset - NSMinY(visibleRect);
+
+ for (line = [self lineNumberForCharacterIndex:range.location inText:text]; line < count; line++)
+ {
+ index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
+
+ if (NSLocationInRange(index, range))
+ {
+ rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0)
+ withinSelectedCharacterRange:nullRange
+ inTextContainer:container
+ rectCount:&rectCount];
+
+ if (rectCount > 0)
+ {
+ // Note that the ruler view is only as tall as the visible
+ // portion. Need to compensate for the clipview's coordinates.
+
+ // Line numbers are internally stored starting at 0
+ labelText = [NSString stringWithFormat:@"%lu", (NSUInteger)(line + 1)];
+
+ stringSize = [labelText sizeWithAttributes:textAttributes];
+
+ // Draw string flush right, centered vertically within the line
+ [labelText drawInRect:
+ NSMakeRect(boundsWidthRULER - stringSize.width,
+ yinsetMinY + NSMinY(rects[0]) + ((NSHeight(rects[0]) - stringSize.height) / 2.0),
+ boundsRULERMargin2, NSHeight(rects[0]))
+ withAttributes:textAttributes];
+ }
+ }
if (index > NSMaxRange(range))
{
break;
}
- }
- }
+ }
+ }
}
- (void)mouseDown:(NSEvent *)theEvent
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index e5b47c80..2117a3ac 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -544,16 +544,16 @@
defaultButton:NSLocalizedString(@"Update", @"Update button")
alternateButton:NSLocalizedString(@"Cancel", @"Cancel button")
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"A bundle ‘%@’ is already installed. Do you want to update it?", @"a bundle ‘%@’ is already installed. do you want to update it?"), [installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]]]];
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"A bundle ‘%@’ is already installed. Do you want to update it?", @"a bundle ‘%@’ is already installed. do you want to update it?"), [[installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]] objectForKey:@"name"]]];
[alert setAlertStyle:NSCriticalAlertStyle];
NSInteger answer = [alert runModal];
if(answer == NSAlertDefaultReturn) {
NSError *error = nil;
- NSString *moveToTrashCommand = [NSString stringWithFormat:@"osascript -e 'tell application \"Finder\" to move (POSIX file \"%@\") to the trash'", newPath];
+ NSString *moveToTrashCommand = [NSString stringWithFormat:@"osascript -e 'tell application \"Finder\" to move (POSIX file \"%@\") to the trash'", infoPath];
[moveToTrashCommand runBashCommandWithEnvironment:nil atCurrentDirectoryPath:nil error:&error];
if(error != nil) {
- NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while moving “%@” to Trash.", @"error while moving “%@” to trash"), newPath]
+ NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while moving “%@” to Trash.", @"error while moving “%@” to trash"), [[installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]] objectForKey:@"path"]]
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
otherButton:nil
@@ -661,28 +661,28 @@
BOOL userTerminated = NO;
- while(1) {
- NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
- untilDate:[NSDate distantPast]
- inMode:NSDefaultRunLoopMode
- dequeue:YES];
-
- if ([event type] == NSKeyDown) {
- unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
- if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
- userTerminated = YES;
- break;
- }
- }
- [NSApp sendEvent:event];
- if(![processDocument isWorking]) break;
- usleep(1000);
- }
-
- if(userTerminated) {
- NSBeep();
- return;
- }
+ // while(1) {
+ // NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
+ // untilDate:[NSDate distantPast]
+ // inMode:NSDefaultRunLoopMode
+ // dequeue:YES];
+ //
+ // if ([event type] == NSKeyDown) {
+ // unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
+ // if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
+ // userTerminated = YES;
+ // break;
+ // }
+ // }
+ // [NSApp sendEvent:event];
+ // if(![processDocument isWorking]) break;
+ // usleep(1000);
+ // }
+ //
+ // if(userTerminated) {
+ // NSBeep();
+ // return;
+ // }
if(processDocument && command) {
if([command isEqualToString:@"passToDoc"]) {
@@ -1421,7 +1421,9 @@
}
if([cmdData objectForKey:SPBundleFileUUIDKey] && [[cmdData objectForKey:SPBundleFileUUIDKey] length])
- [installedBundleUUIDs setObject:[NSString stringWithFormat:@"%@ (%@)", bundle, [cmdData objectForKey:SPBundleFileNameKey]] forKey:[cmdData objectForKey:SPBundleFileUUIDKey]];
+ [installedBundleUUIDs setObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSString stringWithFormat:@"%@ (%@)", bundle, [cmdData objectForKey:SPBundleFileNameKey]], @"name",
+ infoPath, @"path", nil] forKey:[cmdData objectForKey:SPBundleFileUUIDKey]];
if([cmdData objectForKey:SPBundleFileTooltipKey] && [[cmdData objectForKey:SPBundleFileTooltipKey] length])
[aDict setObject:[cmdData objectForKey:SPBundleFileTooltipKey] forKey:SPBundleFileTooltipKey];
diff --git a/Source/SPBundleCommandTextView.m b/Source/SPBundleCommandTextView.m
index 8a5bf620..6411ccfd 100644
--- a/Source/SPBundleCommandTextView.m
+++ b/Source/SPBundleCommandTextView.m
@@ -29,25 +29,15 @@
@implementation SPBundleCommandTextView
-- (id)init
-{
- if(self = [super init])
- {
- ;
- }
- return self;
-}
-
- (void)dealloc
{
-
- [[NSNotificationCenter defaultCenter] removeObserver:self];
[prefs removeObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
[prefs release];
[lineNumberView release];
}
-- (void) awakeFromNib
+- (void)awakeFromNib
{
prefs = [[NSUserDefaults standardUserDefaults] retain];
@@ -68,6 +58,12 @@
// Re-define tab stops for a better editing
[self setTabStops];
+ // add NSViewBoundsDidChangeNotification to scrollView
+ [[commandScrollView contentView] setPostsBoundsChangedNotifications:YES];
+
+ // disabled to get the current text range in textView safer
+ [[self layoutManager] setBackgroundLayoutEnabled:NO];
+
}
- (void)drawRect:(NSRect)rect
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 44d3965c..86588f88 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -55,6 +55,7 @@
#import "SPTableCopy.h"
#import "SPDatabaseRename.h"
#import "SPServerSupport.h"
+#import "SPTooltip.h"
@interface SPDatabaseDocument (PrivateAPI)
@@ -4553,7 +4554,10 @@
if(!docProcessID) docProcessID = @"";
// Authenticate command
- if(![docProcessID isEqualToString:[commandDict objectForKey:@"id"]]) return;
+ if(![docProcessID isEqualToString:[commandDict objectForKey:@"id"]]) {
+ [SPTooltip showWithObject:NSLocalizedString(@"URL scheme command couldn't authenticated", @"URL scheme command couldn't authenticated") atLocation:[NSApp mouseLocation]];
+ return;
+ }
if([command isEqualToString:@"SelectDocumentView"]) {
if([params count] == 2) {
@@ -4645,7 +4649,8 @@
if([command isEqualToString:@"ExecuteQuery"]) {
// Bail if document is busy
- if (_isWorkingLevel) return;
+ if (_isWorkingLevel)
+ [SPTooltip showWithObject:NSLocalizedString(@"Connection window is busy. URL scheme command bailed", @"Connection window is busy. URL scheme command bailed") atLocation:[NSApp mouseLocation]];
NSString *outputFormat = @"tab";
if([params count] == 2)
@@ -4660,6 +4665,7 @@
NSFileManager *fm = [NSFileManager defaultManager];
NSString *status = @"0";
BOOL isDir;
+ BOOL userTerminated = NO;
if([fm fileExistsAtPath:queryFileName isDirectory:&isDir] && !isDir) {
NSError *inError = nil;
@@ -4717,12 +4723,21 @@
NSInteger i, j;
NSArray *theRow;
NSMutableString *result = [NSMutableString string];
-
if(writeAsCsv) {
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
[result setString:@""];
theRow = [theResult fetchNextRowAsArray];
for( j = 0 ; j < [theRow count] ; j++ ) {
+
+ NSEvent* event = [NSApp currentEvent];
+ if ([event type] == NSKeyDown) {
+ unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
+ if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
+ userTerminated = YES;
+ break;
+ }
+ }
+
if([result length]) [result appendString:@","];
id cell = NSArrayObjectAtIndex(theRow, j);
if([cell isKindOfClass:[NSNull class]])
@@ -4742,6 +4757,7 @@
else
[result appendFormat:@"\"%@\"", [[cell description] stringByReplacingOccurrencesOfString:@"\"" withString:@"\"\""]];
}
+ if(userTerminated) break;
[result appendString:@"\n"];
[fh writeData:[result dataUsingEncoding:NSUTF8StringEncoding]];
}
@@ -4751,6 +4767,16 @@
[result setString:@""];
theRow = [theResult fetchNextRowAsArray];
for( j = 0 ; j < [theRow count] ; j++ ) {
+
+ NSEvent* event = [NSApp currentEvent];
+ if ([event type] == NSKeyDown) {
+ unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
+ if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
+ userTerminated = YES;
+ break;
+ }
+ }
+
if([result length]) [result appendString:@"\t"];
id cell = NSArrayObjectAtIndex(theRow, j);
if([cell isKindOfClass:[NSNull class]])
@@ -4770,6 +4796,7 @@
else
[result appendString:[[[cell description] stringByReplacingOccurrencesOfString:@"\n" withString:@"↵"] stringByReplacingOccurrencesOfString:@"\t" withString:@"⇥"]];
}
+ if(userTerminated) break;
[result appendString:@"\n"];
[fh writeData:[result dataUsingEncoding:NSUTF8StringEncoding]];
}
@@ -4779,6 +4806,11 @@
}
}
+ if(userTerminated) {
+ [SPTooltip showWithObject:NSLocalizedString(@"URL scheme command was terminated by user", @"URL scheme command was terminated by user") atLocation:[NSApp mouseLocation]];
+ status = @"1";
+ }
+
// write status file as notification that query was finished
BOOL succeed = [status writeToFile:statusFileName atomically:YES encoding:NSUTF8StringEncoding error:nil];
if(!succeed) {
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 404395b9..28717864 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -944,6 +944,7 @@
// Run the status query and retrieve as a dictionary.
NSMutableString *escapedTableName = [NSMutableString stringWithString:[tableListInstance tableName]];
+ [escapedTableName replaceOccurrencesOfString:@"\\" withString:@"\\\\" options:0 range:NSMakeRange(0, [escapedTableName length])];
[escapedTableName replaceOccurrencesOfString:@"'" withString:@"\\\'" options:0 range:NSMakeRange(0, [escapedTableName length])];
MCPResult *tableStatusResult = nil;
@@ -964,6 +965,7 @@
tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM information_schema.VIEWS AS r WHERE r.TABLE_NAME = '%@' AND r.TABLE_SCHEMA = '%@'", escapedTableName, escapedDatabaseName]];
}
else if ([tableListInstance tableType] == SPTableTypeTable) {
+ [escapedTableName replaceOccurrencesOfRegex:@"\\\\(?=\\Z|[^\'])" withString:@"\\\\\\\\"];
tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE '%@'", escapedTableName ]];
[tableStatusResult setReturnDataAsStrings:YES];
}
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 11defa20..f04c6684 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -534,7 +534,7 @@
[[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil];
- BOOL selfIsQueryEditor = ([[[self class] description] isEqualToString:@"SPTextView"]) ;
+ BOOL selfIsQueryEditor = ([[[self class] description] isEqualToString:@"SPTextView"] && [self respondsToSelector:@selector(currentQueryRange)]) ;
if([cmdData objectForKey:SPBundleFileInputSourceKey])
inputAction = [[cmdData objectForKey:SPBundleFileInputSourceKey] lowercaseString];
@@ -553,7 +553,7 @@
if(!currentQueryRange.length)
currentQueryRange = currentSelectionRange;
- NSRange replaceRange = NSMakeRange(currentSelectionRange.location, 0);
+ NSRange replaceRange = currentSelectionRange;
if([inputAction isEqualToString:SPBundleInputSourceSelectedText]) {
if(!currentSelectionRange.length) {
if([inputFallBackAction isEqualToString:SPBundleInputSourceCurrentWord])
diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m
index 962d5a53..57977be0 100644
--- a/Source/SPXMLExporter.m
+++ b/Source/SPXMLExporter.m
@@ -113,7 +113,9 @@
if (([self xmlFormat] == SPXMLExportMySQLFormat) && [self xmlOutputIncludeStructure]) {
structureResult = [connection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [[self xmlTableName] backtickQuotedString]]];
- statusResult = [connection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE %@", [[self xmlTableName] tickQuotedString]]];
+ NSMutableString *escapedTableName = [NSMutableString stringWithString:[[self xmlTableName] tickQuotedString]];
+ [escapedTableName replaceOccurrencesOfString:@"\\" withString:@"\\\\\\\\" options:0 range:NSMakeRange(0, [escapedTableName length])];
+ statusResult = [connection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE %@", escapedTableName]];
if ([structureResult numOfRows] && [statusResult numOfRows]) {
831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268