diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-06-15 21:16:37 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-06-15 21:16:37 +0000 |
commit | f0b12b052c2bfe5cdb197f9adb31f8b7136ada66 (patch) | |
tree | 89c2aa6a5a291c39de265e3abc96ac8d86e73113 | |
parent | 95f796e8c75aeb13f4e1190d9ec08feecc35aba6 (diff) | |
download | sequelpro-f0b12b052c2bfe5cdb197f9adb31f8b7136ada66.tar.gz sequelpro-f0b12b052c2bfe5cdb197f9adb31f8b7136ada66.tar.bz2 sequelpro-f0b12b052c2bfe5cdb197f9adb31f8b7136ada66.zip |
• subclassed the editSheet textView
- added drag&drop feature of file content or path resp.
- added feature to in/decrease font size via ⌘+/- or two-finger zoom gesture
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 102 | ||||
-rw-r--r-- | Source/SPEditSheetTextView.h | 37 | ||||
-rw-r--r-- | Source/SPEditSheetTextView.m | 242 | ||||
-rw-r--r-- | Source/TableContent.m | 22 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 6 |
5 files changed, 381 insertions, 28 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 9c5155e9..c746e56f 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="673"/> + <integer value="604"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -80,6 +80,7 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{214, 395}</string> <reference key="NSSuperview" ref="73685676"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -176,6 +177,7 @@ </object> <string key="NSFrameSize">{214, 395}</string> <reference key="NSSuperview" ref="233472824"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="251040077"/> <reference key="NSDocView" ref="251040077"/> <object class="NSColor" key="NSBGColor" id="1024678221"> @@ -191,6 +193,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{175, 1}, {15, 481}}</string> <reference key="NSSuperview" ref="233472824"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="233472824"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">9.979253e-01</double> @@ -200,6 +203,7 @@ <int key="NSvFlags">256</int> <string key="NSFrame">{{-100, -100}, {141, 11}}</string> <reference key="NSSuperview" ref="233472824"/> + <reference key="NSWindow"/> <int key="NSsFlags">257</int> <reference key="NSTarget" ref="233472824"/> <string key="NSAction">_doScroller:</string> @@ -208,6 +212,7 @@ </object> <string key="NSFrameSize">{214, 395}</string> <reference key="NSSuperview" ref="355288374"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="73685676"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="693168867"/> @@ -230,6 +235,7 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{214, 125}</string> <reference key="NSSuperview" ref="685057119"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -293,6 +299,7 @@ </object> <string key="NSFrameSize">{214, 125}</string> <reference key="NSSuperview" ref="298226231"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="347093764"/> <reference key="NSDocView" ref="347093764"/> <reference key="NSBGColor" ref="1024678221"/> @@ -303,6 +310,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{175, 1}, {15, 481}}</string> <reference key="NSSuperview" ref="298226231"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="298226231"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">9.979253e-01</double> @@ -312,6 +320,7 @@ <int key="NSvFlags">256</int> <string key="NSFrame">{{-100, -100}, {141, 11}}</string> <reference key="NSSuperview" ref="298226231"/> + <reference key="NSWindow"/> <int key="NSsFlags">257</int> <reference key="NSTarget" ref="298226231"/> <string key="NSAction">_doScroller:</string> @@ -320,6 +329,7 @@ </object> <string key="NSFrame">{{0, 404}, {214, 125}}</string> <reference key="NSSuperview" ref="355288374"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="685057119"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="245346414"/> @@ -330,12 +340,14 @@ </object> <string key="NSFrame">{{-1, 22}, {214, 529}}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> </object> <object class="NSButton" id="644515521"> <reference key="NSNextResponder" ref="372294785"/> <int key="NSvFlags">292</int> <string key="NSFrame">{{0, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="492393561"> <int key="NSCellFlags">-2080244224</int> @@ -364,6 +376,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{20, 0}, {46, 25}}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="753352469"> <int key="NSCellFlags">-2076049856</int> @@ -480,6 +493,7 @@ </object> <string key="NSFrame">{{197, 0}, {15, 23}}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="875296521"> <int key="NSCellFlags">130560</int> @@ -512,6 +526,7 @@ </object> <string key="NSFrame">{{93, 0}, {104, 23}}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="761703901"> <int key="NSCellFlags">130560</int> @@ -532,6 +547,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{61, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="372294785"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="529591350"> <int key="NSCellFlags">-2080244224</int> @@ -554,6 +570,7 @@ </object> <string key="NSFrameSize">{212, 550}</string> <reference key="NSSuperview" ref="937377983"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="604818293"> @@ -566,6 +583,7 @@ <int key="NSvFlags">274</int> <string key="NSFrame">{{-7, -10}, {735, 564}}</string> <reference key="NSSuperview" ref="604818293"/> + <reference key="NSWindow"/> <object class="NSMutableArray" key="NSTabViewItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTabViewItem" id="831053945"> @@ -600,12 +618,14 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{688, 289}</string> <reference key="NSSuperview" ref="16936123"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTableHeaderView" key="NSHeaderView" id="926883367"> <reference key="NSNextResponder" ref="639957061"/> <int key="NSvFlags">256</int> <string key="NSFrameSize">{688, 17}</string> <reference key="NSSuperview" ref="639957061"/> + <reference key="NSWindow"/> <reference key="NSTableView" ref="715508012"/> </object> <object class="_NSCornerView" key="NSCornerView" id="868771861"> @@ -613,6 +633,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-26, 0}, {16, 17}}</string> <reference key="NSSuperview" ref="22340145"/> + <reference key="NSWindow"/> </object> <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1145,6 +1166,7 @@ </object> <string key="NSFrame">{{1, 17}, {688, 289}}</string> <reference key="NSSuperview" ref="22340145"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="715508012"/> <reference key="NSDocView" ref="715508012"/> <reference key="NSBGColor" ref="1024678221"/> @@ -1155,6 +1177,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{611, 17}, {15, 274}}</string> <reference key="NSSuperview" ref="22340145"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="22340145"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">9.858657e-01</double> @@ -1164,6 +1187,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{1, 291}, {610, 15}}</string> <reference key="NSSuperview" ref="22340145"/> + <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="22340145"/> <string key="NSAction">_doScroller:</string> @@ -1178,6 +1202,7 @@ </object> <string key="NSFrame">{{1, 0}, {688, 17}}</string> <reference key="NSSuperview" ref="22340145"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="926883367"/> <reference key="NSDocView" ref="926883367"/> <reference key="NSBGColor" ref="1024678221"/> @@ -1187,6 +1212,7 @@ </object> <string key="NSFrame">{{-1, 22}, {690, 307}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="16936123"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="943144555"/> @@ -1201,6 +1227,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{-1, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="413143172"> <int key="NSCellFlags">-1543373312</int> @@ -1222,6 +1249,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{93, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="917381158"> <int key="NSCellFlags">-2080244224</int> @@ -1243,6 +1271,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{30, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="578226656"> <int key="NSCellFlags">-1543373312</int> @@ -1267,6 +1296,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{61, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="626480887"> <int key="NSCellFlags">-1543373312</int> @@ -1303,6 +1333,7 @@ </object> <string key="NSFrame">{{125, 0}, {532, 23}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="4715"> <int key="NSCellFlags">130560</int> @@ -1320,6 +1351,7 @@ <int key="NSvFlags">289</int> <string key="NSFrame">{{657, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="220777809"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1072754876"> <int key="NSCellFlags">-1543373312</int> @@ -1342,6 +1374,7 @@ </object> <string key="NSFrameSize">{689, 329}</string> <reference key="NSSuperview" ref="628830973"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1063281455"> @@ -1354,6 +1387,7 @@ <int key="NSvFlags">264</int> <string key="NSFrame">{{7, 183}, {46, 14}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="749773740"> <int key="NSCellFlags">67239424</int> @@ -1380,12 +1414,14 @@ <int key="NSvFlags">4352</int> <string key="NSFrameSize">{688, 141}</string> <reference key="NSSuperview" ref="794929378"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTableHeaderView" key="NSHeaderView" id="459548655"> <reference key="NSNextResponder" ref="1038672854"/> <int key="NSvFlags">256</int> <string key="NSFrameSize">{688, 17}</string> <reference key="NSSuperview" ref="1038672854"/> + <reference key="NSWindow"/> <reference key="NSTableView" ref="584834515"/> </object> <object class="_NSCornerView" key="NSCornerView" id="476444025"> @@ -1393,6 +1429,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-26, 0}, {16, 17}}</string> <reference key="NSSuperview" ref="376224367"/> + <reference key="NSWindow"/> </object> <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1645,6 +1682,7 @@ </object> <string key="NSFrame">{{1, 17}, {688, 141}}</string> <reference key="NSSuperview" ref="376224367"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="584834515"/> <reference key="NSDocView" ref="584834515"/> <reference key="NSBGColor" ref="1024678221"/> @@ -1655,6 +1693,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{611, 17}, {15, 126}}</string> <reference key="NSSuperview" ref="376224367"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="376224367"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">8.936170e-01</double> @@ -1664,6 +1703,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{1, 143}, {610, 15}}</string> <reference key="NSSuperview" ref="376224367"/> + <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="376224367"/> <string key="NSAction">_doScroller:</string> @@ -1678,6 +1718,7 @@ </object> <string key="NSFrame">{{1, 0}, {688, 17}}</string> <reference key="NSSuperview" ref="376224367"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="459548655"/> <reference key="NSDocView" ref="459548655"/> <reference key="NSBGColor" ref="1024678221"/> @@ -1687,6 +1728,7 @@ </object> <string key="NSFrame">{{-1, 22}, {690, 159}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="794929378"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="1019209947"/> @@ -1701,6 +1743,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{-1, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="326048025"> <int key="NSCellFlags">-1543373312</int> @@ -1722,6 +1765,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{61, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="153146827"> <int key="NSCellFlags">-2080244224</int> @@ -1743,6 +1787,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{30, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="345927225"> <int key="NSCellFlags">-1543373312</int> @@ -1776,6 +1821,7 @@ </object> <string key="NSFrame">{{670, 183}, {10, 13}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="545156725"> <int key="NSCellFlags">130560</int> @@ -1808,6 +1854,7 @@ </object> <string key="NSFrame">{{93, 0}, {596, 23}}</string> <reference key="NSSuperview" ref="1063281455"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="372723860"> <int key="NSCellFlags">130560</int> @@ -1823,16 +1870,19 @@ </object> <string key="NSFrame">{{0, 330}, {689, 201}}</string> <reference key="NSSuperview" ref="628830973"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrame">{{7, 10}, {689, 531}}</string> <reference key="NSSuperview" ref="461236772"/> + <reference key="NSWindow"/> <int key="NSDividerStyle">2</int> </object> </object> <string key="NSFrame">{{10, 7}, {700, 544}}</string> <reference key="NSSuperview" ref="714795046"/> + <reference key="NSWindow"/> </object> <string key="NSLabel">Structure</string> <reference key="NSColor" ref="62854682"/> @@ -2194,8 +2244,8 @@ <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">.</string> - <string key="NS.thousand">,</string> + <string key="NS.decimal">,</string> + <string key="NS.thousand">.</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">NO</bool> @@ -4298,17 +4348,20 @@ </object> <string key="NSFrame">{{221, 0}, {723, 550}}</string> <reference key="NSSuperview" ref="937377983"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{944, 550}</string> <reference key="NSSuperview" ref="579726586"/> + <reference key="NSWindow"/> <bool key="NSIsVertical">YES</bool> <string key="NSAutosaveName">DBViewSplitter</string> </object> </object> <string key="NSFrameSize">{944, 550}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{780, 502}</string> @@ -6084,7 +6137,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{560, 200}</string> <object class="NSView" key="NSWindowView" id="999543752"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">4370</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -6533,6 +6586,29 @@ <object class="NSTextView" id="1011820278"> <reference key="NSNextResponder" ref="134546146"/> <int key="NSvFlags">2322</int> + <object class="NSMutableSet" key="NSDragTypes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="set.sortedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>Apple HTML pasteboard type</string> + <string>Apple PDF pasteboard type</string> + <string>Apple PICT pasteboard type</string> + <string>Apple PNG pasteboard type</string> + <string>Apple URL pasteboard type</string> + <string>CorePasteboardFlavorType 0x6D6F6F76</string> + <string>CorePasteboardFlavorType 0x75726C20</string> + <string>NSColor pasteboard type</string> + <string>NSFilenamesPboardType</string> + <string>NSStringPboardType</string> + <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> + <string>NeXT RTFD pasteboard type</string> + <string>NeXT Rich Text Format v1.0 pasteboard type</string> + <string>NeXT TIFF v4.0 pasteboard type</string> + <string>NeXT font pasteboard type</string> + <string>NeXT ruler pasteboard type</string> + <string>WebURLsWithTitlesPboardType</string> + </object> + </object> <string key="NSFrameSize">{667, 14}</string> <reference key="NSSuperview" ref="134546146"/> <object class="NSTextContainer" key="NSTextContainer" id="609699272"> @@ -6670,6 +6746,7 @@ </object> </object> <string key="NSFrameSize">{667, 416}</string> + <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{560, 222}</string> @@ -22805,6 +22882,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>122.ImportedFromIB2</string> <string>1221.IBPluginDependency</string> <string>1221.ImportedFromIB2</string> + <string>1222.CustomClassName</string> <string>1222.IBPluginDependency</string> <string>1222.ImportedFromIB2</string> <string>1225.IBPluginDependency</string> @@ -24436,6 +24514,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>SPEditSheetTextView</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -25276,8 +25355,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{176, 63}, {944, 550}}</string> - <string>{{176, 63}, {944, 550}}</string> + <string>{{143, 63}, {944, 550}}</string> + <string>{{143, 63}, {944, 550}}</string> <reference ref="9"/> <reference ref="9"/> <string>{{62, 352}, {845, 504}}</string> @@ -27481,6 +27560,17 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> </object> </object> </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">SPEditSheetTextView</string> + <string key="superclassName">NSTextView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../Source/SPEditSheetTextView.h</string> + </object> + </object> + </object> </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string> diff --git a/Source/SPEditSheetTextView.h b/Source/SPEditSheetTextView.h new file mode 100644 index 00000000..c333fd30 --- /dev/null +++ b/Source/SPEditSheetTextView.h @@ -0,0 +1,37 @@ +// +// $Id: SPTextViewAdditions.m 866 2009-06-15 16:05:54Z bibiko $ +// +// SPEditSheetTextView.h +// sequel-pro +// +// Created by Hans-Jörg Bibiko on June 15, 2009 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import <Cocoa/Cocoa.h> + + +@interface SPEditSheetTextView : NSTextView +{ + +} + +- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint; +- (void)insertFileContentOfFile:(NSString *)aPath; + + +@end diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m new file mode 100644 index 00000000..7f3611a8 --- /dev/null +++ b/Source/SPEditSheetTextView.m @@ -0,0 +1,242 @@ +// +// $Id: SPTextViewAdditions.m 866 2009-06-15 16:05:54Z bibiko $ +// +// SPEditSheetTextView.m +// sequel-pro +// +// Created by Hans-Jörg Bibiko on June 15, 2009 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import "SPEditSheetTextView.h" +#import "SPTextViewAdditions.h" + + +@implementation SPEditSheetTextView + +- (void) keyDown:(NSEvent *)theEvent +{ + + long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask); + + // Check if user pressed ⌥ to allow composing of accented characters. + // e.g. for US keyboard "⌥u a" to insert ä + // or for non-US keyboards to allow to enter dead keys + // e.g. for German keyboard ` is a dead key, press space to enter ` + if (([theEvent modifierFlags] & allFlags) == NSAlternateKeyMask || [[theEvent characters] length] == 0) + { + [super keyDown: theEvent]; + return; + } + + // NSString *characters = [theEvent characters]; + NSString *charactersIgnMod = [theEvent charactersIgnoringModifiers]; + // unichar insertedCharacter = [characters characterAtIndex:0]; + long curFlags = ([theEvent modifierFlags] & allFlags); + + if(curFlags & NSCommandKeyMask) { + if([charactersIgnMod isEqualToString:@"+"]) // increase text size by 1; ⌘+ and numpad + + { + [self makeTextSizeLarger]; + return; + } + if([charactersIgnMod isEqualToString:@"-"]) // decrease text size by 1; ⌘- and numpad - + { + [self makeTextSizeSmaller]; + return; + } + } + + [super keyDown: theEvent]; + +} + +/* + * Insert the content of a dragged file path or if ⌘ is pressed + * while dragging insert the file path + */ +- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender +{ + NSPasteboard *pboard = [sender draggingPasteboard]; + + if ( [[pboard types] containsObject:NSFilenamesPboardType] ) { + NSArray *files = [pboard propertyListForType:NSFilenamesPboardType]; + + // Only one file path is allowed + if([files count] > 1) { + NSLog(@"%@", NSLocalizedString(@"Only one dragged item allowed.",@"Only one dragged item allowed.")); + return YES; + } + + NSString *filepath = [[pboard propertyListForType:NSFilenamesPboardType] objectAtIndex:0]; + + // Set the new insertion point + NSPoint draggingLocation = [sender draggingLocation]; + draggingLocation = [self convertPoint:draggingLocation fromView:nil]; + unsigned int characterIndex = [self characterIndexOfPoint:draggingLocation]; + [self setSelectedRange:NSMakeRange(characterIndex,0)]; + + // Check if user pressed ⌘ while dragging for inserting only the file path + if([sender draggingSourceOperationMask] == 4) + { + [self insertText:filepath]; + return YES; + } + + // Check size and NSFileType + NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filepath traverseLink:YES]; + if(attr) + { + NSNumber *filesize = [attr objectForKey:NSFileSize]; + NSString *filetype = [attr objectForKey:NSFileType]; + if(filetype == NSFileTypeRegular && filesize) + { + // Ask for confirmation if file content is larger than 1MB + if([filesize unsignedLongValue] > 1000000) + { + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle:NSLocalizedString(@"OK", @"OK button")]; + [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"cancel button")]; + [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Do you really want to proceed with %.1f MB of data?", @"message of panel asking for confirmation for inserting large text from dragging action"), + [filesize unsignedLongValue]/1048576.0]]; + [alert setHelpAnchor:filepath]; + [alert setMessageText:NSLocalizedString(@"Warning",@"Warning")]; + [alert setAlertStyle:NSWarningAlertStyle]; + [alert beginSheetModalForWindow:[self window] + modalDelegate:self + didEndSelector:@selector(dragAlertSheetDidEnd:returnCode:contextInfo:) + contextInfo:nil]; + [alert release]; + + } else + [self insertFileContentOfFile:filepath]; + } + } + return YES; + } + + return [super performDragOperation:sender]; +} + +/* + * Confirmation sheetDidEnd method + */ +- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + + [[sheet window] orderOut:nil]; + if ( returnCode == NSAlertFirstButtonReturn ) + [self insertFileContentOfFile:[sheet helpAnchor]]; + +} +/* + * Convert a NSPoint, usually the mouse location, to + * a character index of the text view. + */ +- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint +{ + unsigned int glyphIndex; + NSLayoutManager *layoutManager = [self layoutManager]; + float fraction; + NSRange range; + + range = [layoutManager glyphRangeForTextContainer:[self textContainer]]; + glyphIndex = [layoutManager glyphIndexForPoint:aPoint + inTextContainer:[self textContainer] + fractionOfDistanceThroughGlyph:&fraction]; + if( fraction > 0.5 ) glyphIndex++; + + if( glyphIndex == NSMaxRange(range) ) + return [[self textStorage] length]; + else + return [layoutManager characterIndexForGlyphAtIndex:glyphIndex]; + +} + +/* + * Insert content of a plain text file for a given path. + * In addition it tries to figure out the file's text encoding heuristically. + */ +- (void)insertFileContentOfFile:(NSString *)aPath +{ + + NSError *err = nil; + NSStringEncoding enc; + NSString *content = nil; + + // Make usage of the UNIX command "file" to get an info + // about file type and encoding. + NSTask *task=[[NSTask alloc] init]; + NSPipe *pipe=[[NSPipe alloc] init]; + NSFileHandle *handle; + NSString *result; + [task setLaunchPath:@"/usr/bin/file"]; + [task setArguments:[NSArray arrayWithObjects:aPath, @"-Ib", nil]]; + [task setStandardOutput:pipe]; + handle=[pipe fileHandleForReading]; + [task launch]; + result=[[NSString alloc] initWithData:[handle readDataToEndOfFile] + encoding:NSASCIIStringEncoding]; + + [pipe release]; + [task release]; + + // UTF16/32 files are detected as application/octet-stream resp. audio/mpeg + if([result hasPrefix:@"application/octet-stream"] || [result hasPrefix:@"audio/mpeg"] || [result hasPrefix:@"text/plain"] || [[[aPath pathExtension] lowercaseString] isEqualToString:@"sql"]) + { + // if UTF16/32 cocoa will try to find the correct encoding + if([result hasPrefix:@"application/octet-stream"] || [result hasPrefix:@"audio/mpeg"] || [result rangeOfString:@"utf-16"].length) + enc = 0; + else if([result rangeOfString:@"utf-8"].length) + enc = NSUTF8StringEncoding; + else if([result rangeOfString:@"iso-8859-1"].length) + enc = NSISOLatin1StringEncoding; + else if([result rangeOfString:@"us-ascii"].length) + enc = NSASCIIStringEncoding; + else + enc = 0; + + if(enc == 0) // cocoa tries to detect the encoding + content = [NSString stringWithContentsOfFile:aPath usedEncoding:&enc error:&err]; + else + content = [NSString stringWithContentsOfFile:aPath encoding:enc error:&err]; + + if(content) + { + [self insertText:content]; + [result release]; + [self insertText:@""]; // Invoke keyword uppercasing + return; + } + // If UNIX "file" failed try cocoa's encoding detection + content = [NSString stringWithContentsOfFile:aPath encoding:enc error:&err]; + if(content) + { + [self insertText:content]; + [result release]; + [self insertText:@""]; // Invoke keyword uppercasing + return; + } + } + + [result release]; + + NSLog(@"%@ ‘%@’.", NSLocalizedString(@"Couldn't read the file content of", @"Couldn't read the file content of"), aPath); +} + + +@end diff --git a/Source/TableContent.m b/Source/TableContent.m index dd4f0981..6655a53b 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -2477,7 +2477,6 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn /** * Traps enter and return key and closes editSheet instead of inserting a linebreak when user hits return. - * Catch ⌘+ and ⌘- to de/increase font size of aTextView */ - (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector { @@ -2488,29 +2487,8 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn [NSApp stopModalWithCode:1]; return YES; } - else if([[NSApp currentEvent] modifierFlags] & NSCommandKeyMask) - { - // increase text size by 1; ⌘+ and numpad + - if([[[NSApp currentEvent] charactersIgnoringModifiers] isEqualToString:@"+"]) - { - [aTextView makeTextSizeLarger]; - return YES; - } - // decrease text size by 1; ⌘- and numpad - - else if([[[NSApp currentEvent] charactersIgnoringModifiers] isEqualToString:@"-"]) - { - [aTextView makeTextSizeSmaller]; - return YES; - } - else - { - return NO; - } - } else - { return NO; - } } return NO; } diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 2cbab6a7..fb9142f5 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -148,6 +148,7 @@ B5E92F400F75B32100012500 /* toolbar-export-xml.tiff in Resources */ = {isa = PBXBuildFile; fileRef = B5E92F3A0F75B32100012500 /* toolbar-export-xml.tiff */; }; B5EAC0FD0EC87FF900CC579C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5EAC0FC0EC87FF900CC579C /* Security.framework */; }; B5F4F7810F7BCF990059AE84 /* toolbar-switch-to-procedures.tiff in Resources */ = {isa = PBXBuildFile; fileRef = B5F4F7800F7BCF990059AE84 /* toolbar-switch-to-procedures.tiff */; }; + BC1847EA0FE6EC8400094BFB /* SPEditSheetTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */; }; BC2C8E220FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html in Resources */ = {isa = PBXBuildFile; fileRef = BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */; }; BCD0AD490FBBFC340066EA5C /* SPSQLTokenizer.l in Sources */ = {isa = PBXBuildFile; fileRef = BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */; }; /* End PBXBuildFile section */ @@ -399,6 +400,8 @@ B5E92F3A0F75B32100012500 /* toolbar-export-xml.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "toolbar-export-xml.tiff"; sourceTree = "<group>"; }; B5EAC0FC0EC87FF900CC579C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; B5F4F7800F7BCF990059AE84 /* toolbar-switch-to-procedures.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "toolbar-switch-to-procedures.tiff"; sourceTree = "<group>"; }; + BC1847E80FE6EC8400094BFB /* SPEditSheetTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPEditSheetTextView.h; sourceTree = "<group>"; }; + BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPEditSheetTextView.m; sourceTree = "<group>"; }; BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "sequel-pro-mysql-help-template.html"; sourceTree = "<group>"; }; BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; path = SPSQLTokenizer.l; sourceTree = "<group>"; }; BCD0AD4A0FBBFC480066EA5C /* SPSQLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPSQLTokenizer.h; sourceTree = "<group>"; }; @@ -680,6 +683,8 @@ 58C56EF40F438E120035701E /* SPDataCellFormatter.m */, 5841423D0F97E11000A34B47 /* NoodleLineNumberView.h */, 5841423E0F97E11000A34B47 /* NoodleLineNumberView.m */, + BC1847E80FE6EC8400094BFB /* SPEditSheetTextView.h */, + BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */, ); name = GUI; sourceTree = "<group>"; @@ -1146,6 +1151,7 @@ 177E7A230FCB6A2E00E9E122 /* SPExtendedTableInfo.m in Sources */, 58CDB3300FCE138D00F8ACA3 /* SPSSHTunnel.m in Sources */, 29A1B7E50FD1293A000B88E8 /* SPPrintAccessory.m in Sources */, + BC1847EA0FE6EC8400094BFB /* SPEditSheetTextView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; |