diff options
author | stuconnolly <stuart02@gmail.com> | 2010-12-14 22:12:36 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-12-14 22:12:36 +0000 |
commit | 2f1146de80e658021e6a0fc63a20b039f73cca06 (patch) | |
tree | af451ac4cd3fbbee8b03f306cfdc95435e5ca1f5 | |
parent | 9859a8f8b20ebf038967a09b40bba9b4eb2f223b (diff) | |
parent | 263c981e4905595ebcb3e5d57609ddf75bdf40a2 (diff) | |
download | sequelpro-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.xib | 5 | ||||
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 56 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | Source/NoodleLineNumberView.m | 141 | ||||
-rw-r--r-- | Source/SPAppController.m | 54 | ||||
-rw-r--r-- | Source/SPBundleCommandTextView.m | 20 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 38 | ||||
-rw-r--r-- | Source/SPTableData.m | 2 | ||||
-rw-r--r-- | Source/SPTextViewAdditions.m | 4 | ||||
-rw-r--r-- | Source/SPXMLExporter.m | 4 |
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> @@ -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]) { |