diff options
-rw-r--r-- | Interfaces/English.lproj/FieldEditorSheet.xib | 457 | ||||
-rw-r--r-- | Resources/PreferenceDefaults.plist | 83 | ||||
-rw-r--r-- | Source/SPFieldEditorController.h | 16 | ||||
-rw-r--r-- | Source/SPFieldEditorController.m | 261 |
4 files changed, 372 insertions, 445 deletions
diff --git a/Interfaces/English.lproj/FieldEditorSheet.xib b/Interfaces/English.lproj/FieldEditorSheet.xib index 727a7bef..56099439 100644 --- a/Interfaces/English.lproj/FieldEditorSheet.xib +++ b/Interfaces/English.lproj/FieldEditorSheet.xib @@ -1,13 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9L30</string> - <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.54</string> - <string key="IBDocument.HIToolboxVersion">353.00</string> + <string key="IBDocument.SystemVersion">10B504</string> + <string key="IBDocument.InterfaceBuilderVersion">732</string> + <string key="IBDocument.AppKitVersion">1038.2</string> + <string key="IBDocument.HIToolboxVersion">437.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="NS.object.0">732</string> + </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="2"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -15,7 +20,7 @@ </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> @@ -54,7 +59,6 @@ <int key="NSvFlags">34</int> <string key="NSFrame">{{0, 48}, {667, 5}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -62,7 +66,7 @@ <string key="NSContents">Box</string> <object class="NSFont" key="NSSupport" id="485752450"> <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.300000e+01</double> + <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <object class="NSColor" key="NSBackgroundColor" id="186095045"> @@ -76,7 +80,7 @@ </object> <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes> + <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> </object> </object> <int key="NSBorderType">3</int> @@ -89,7 +93,6 @@ <int key="NSvFlags">257</int> <string key="NSFrame">{{581, 13}, {66, 25}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <int key="NSTag">1</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="630700737"> @@ -98,16 +101,16 @@ <string key="NSContents">OK</string> <object class="NSFont" key="NSSupport" id="26"> <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.100000e+01</double> + <double key="NSSize">11</double> <int key="NSfFlags">3100</int> </object> - <int key="NSTag">1</int> <reference key="NSControlView" ref="315097820"/> + <int key="NSTag">1</int> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">35</int> <object class="NSFont" key="NSAlternateImage" id="584363783"> <string key="NSName">Helvetica</string> - <double key="NSSize">1.100000e+01</double> + <double key="NSSize">11</double> <int key="NSfFlags">16</int> </object> <string key="NSAlternateContents"/> @@ -121,7 +124,6 @@ <int key="NSvFlags">-2147483391</int> <string key="NSFrame">{{581, 13}, {66, 25}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <int key="NSTag">1</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="605249070"> @@ -129,8 +131,8 @@ <int key="NSCellFlags2">134348800</int> <string key="NSContents">Close</string> <reference key="NSSupport" ref="26"/> - <int key="NSTag">1</int> <reference key="NSControlView" ref="1049865951"/> + <int key="NSTag">1</int> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">35</int> <reference key="NSAlternateImage" ref="584363783"/> @@ -145,7 +147,6 @@ <int key="NSvFlags">257</int> <string key="NSFrame">{{507, 13}, {66, 25}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="617021739"> <int key="NSCellFlags">67239424</int> @@ -157,7 +158,7 @@ <int key="NSButtonFlags2">35</int> <object class="NSFont" key="NSAlternateImage" id="815573050"> <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.100000e+01</double> + <double key="NSSize">11</double> <int key="NSfFlags">16</int> </object> <string key="NSAlternateContents"/> @@ -171,7 +172,6 @@ <int key="NSvFlags">256</int> <string key="NSFrame">{{94, 13}, {66, 25}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1054617135"> <int key="NSCellFlags">67239424</int> @@ -193,7 +193,6 @@ <int key="NSvFlags">256</int> <string key="NSFrame">{{20, 13}, {66, 25}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="369856023"> <int key="NSCellFlags">67239424</int> @@ -215,7 +214,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{328, 13}, {48, 25}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="583599991"> <int key="NSCellFlags">71433792</int> @@ -247,109 +245,6 @@ <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="524851662"/> - <object class="NSMenuItem" id="657320705"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">Image</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <object class="NSCustomResource" key="NSOnImage" id="670969392"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSMenuCheckmark</string> - </object> - <object class="NSCustomResource" key="NSMixedImage" id="533428846"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSMenuMixedState</string> - </object> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="331580392"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">Sound (m4a)</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">1</int> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="350758430"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">Sound (mp3)</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="670969392"/> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">2</int> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="231072377"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">Sound (linear)</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="670969392"/> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">3</int> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="254749674"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">Movie</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="670969392"/> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">4</int> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="853091810"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">PDF</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="670969392"/> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">5</int> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="364525587"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">HTML</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="670969392"/> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">6</int> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="800624537"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">Doc</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="670969392"/> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">7</int> - <reference key="NSTarget" ref="583599991"/> - </object> - <object class="NSMenuItem" id="964663224"> - <reference key="NSMenu" ref="70895771"/> - <string key="NSTitle">RTF</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="670969392"/> - <reference key="NSMixedImage" ref="533428846"/> - <string key="NSAction">_popUpItemAction:</string> - <int key="NSTag">8</int> - <reference key="NSTarget" ref="583599991"/> - </object> </object> </object> <bool key="NSPullDown">YES</bool> @@ -364,7 +259,6 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{183, 16}, {137, 19}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSSegmentedCell" key="NSCell" id="772630454"> <int key="NSCellFlags">-2080244224</int> @@ -374,13 +268,13 @@ <object class="NSMutableArray" key="NSSegmentImages"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSSegmentItem"> - <double key="NSSegmentItemWidth">4.500000e+01</double> + <double key="NSSegmentItemWidth">45</double> <string key="NSSegmentItemLabel">Text</string> <string key="NSSegmentItemTooltip">Show data as text</string> <int key="NSSegmentItemImageScaling">0</int> </object> <object class="NSSegmentItem"> - <double key="NSSegmentItemWidth">4.400000e+01</double> + <double key="NSSegmentItemWidth">44</double> <string key="NSSegmentItemLabel">Image</string> <string key="NSSegmentItemTooltip">Try to show data as image</string> <int key="NSSegmentItemTag">1</int> @@ -388,7 +282,7 @@ <int key="NSSegmentItemImageScaling">0</int> </object> <object class="NSSegmentItem"> - <double key="NSSegmentItemWidth">4.400000e+01</double> + <double key="NSSegmentItemWidth">44</double> <string key="NSSegmentItemLabel">Hex</string> <string key="NSSegmentItemTooltip">Show data hexadecimal</string> <int key="NSSegmentItemImageScaling">0</int> @@ -413,7 +307,7 @@ <int key="NSvFlags">2322</int> <object class="NSMutableSet" key="NSDragTypes"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="set.sortedObjects"> + <object class="NSArray" key="set.sortedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <string>Apple HTML pasteboard type</string> <string>Apple PDF pasteboard type</string> @@ -430,7 +324,6 @@ </object> <string key="NSFrameSize">{667, 14}</string> <reference key="NSSuperview" ref="1068411389"/> - <reference key="NSWindow"/> <object class="NSTextContainer" key="NSTextContainer" id="222392072"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> @@ -447,19 +340,17 @@ <nil key="NSDelegate"/> </object> <reference key="NSTextView" ref="459839028"/> - <double key="NSWidth">6.670000e+02</double> + <double key="NSWidth">667</double> <int key="NSTCFlags">1</int> </object> <object class="NSTextViewSharedData" key="NSSharedData"> <int key="NSFlags">2917</int> + <int key="NSTextCheckingTypes">0</int> + <nil key="NSMarkedAttributes"/> <reference key="NSBackgroundColor" ref="940290613"/> - <object class="NSColor" key="NSInsertionColor" id="1021276550"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MAA</bytes> - </object> <object class="NSDictionary" key="NSSelectedAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSBackgroundColor</string> <string>NSColor</string> @@ -472,18 +363,21 @@ <string key="NSColorName">selectedTextBackgroundColor</string> <object class="NSColor" key="NSColor" id="394290367"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> + <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes> </object> </object> <object class="NSColor" id="935002176"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextColor</string> - <reference key="NSColor" ref="1021276550"/> + <object class="NSColor" key="NSColor" id="1021276550"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> </object> </object> </object> - <nil key="NSMarkedAttributes"/> + <reference key="NSInsertionColor" ref="1021276550"/> <nil key="NSLinkAttributes"/> <nil key="NSDefaultParagraphStyle"/> </object> @@ -495,7 +389,6 @@ </object> <string key="NSFrameSize">{667, 349}</string> <reference key="NSSuperview" ref="983787914"/> - <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="459839028"/> <reference key="NSDocView" ref="459839028"/> <reference key="NSBGColor" ref="940290613"/> @@ -510,28 +403,25 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{220, 1}, {11, 141}}</string> <reference key="NSSuperview" ref="983787914"/> - <reference key="NSWindow"/> <int key="NSsFlags">256</int> <reference key="NSTarget" ref="983787914"/> <string key="NSAction">_doScroller:</string> - <double key="NSPercent">9.929578e-01</double> + <double key="NSPercent">0.99295777082443237</double> </object> <object class="NSScroller" id="426249328"> <reference key="NSNextResponder" ref="983787914"/> - <int key="NSvFlags">256</int> + <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {87, 18}}</string> <reference key="NSSuperview" ref="983787914"/> - <reference key="NSWindow"/> <int key="NSsFlags">257</int> <reference key="NSTarget" ref="983787914"/> <string key="NSAction">_doScroller:</string> - <double key="NSCurValue">1.000000e+00</double> - <double key="NSPercent">9.456522e-01</double> + <double key="NSCurValue">1</double> + <double key="NSPercent">0.94565218687057495</double> </object> </object> <string key="NSFrame">{{0, 51}, {667, 349}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="1068411389"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="977735067"/> @@ -543,7 +433,7 @@ <int key="NSvFlags">274</int> <object class="NSMutableSet" key="NSDragTypes"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="set.sortedObjects"> + <object class="NSArray" key="set.sortedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <string>Apple PDF pasteboard type</string> <string>Apple PICT pasteboard type</string> @@ -555,7 +445,6 @@ </object> <string key="NSFrame">{{0, 51}, {667, 349}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSImageCell" key="NSCell" id="521189288"> <int key="NSCellFlags">270663168</int> @@ -582,7 +471,7 @@ <int key="NSvFlags">2322</int> <object class="NSMutableSet" key="NSDragTypes"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="set.sortedObjects"> + <object class="NSArray" key="set.sortedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <string>Apple HTML pasteboard type</string> <string>Apple PDF pasteboard type</string> @@ -601,11 +490,11 @@ <string>NeXT font pasteboard type</string> <string>NeXT ruler pasteboard type</string> <string>WebURLsWithTitlesPboardType</string> + <string>public.url</string> </object> </object> <string key="NSFrameSize">{667, 14}</string> <reference key="NSSuperview" ref="967441740"/> - <reference key="NSWindow"/> <object class="NSTextContainer" key="NSTextContainer" id="872196016"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> @@ -622,16 +511,17 @@ <nil key="NSDelegate"/> </object> <reference key="NSTextView" ref="702566211"/> - <double key="NSWidth">6.670000e+02</double> + <double key="NSWidth">667</double> <int key="NSTCFlags">1</int> </object> <object class="NSTextViewSharedData" key="NSSharedData"> <int key="NSFlags">4067</int> + <int key="NSTextCheckingTypes">0</int> + <nil key="NSMarkedAttributes"/> <reference key="NSBackgroundColor" ref="940290613"/> - <reference key="NSInsertionColor" ref="1021276550"/> <object class="NSDictionary" key="NSSelectedAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSBackgroundColor</string> <string>NSColor</string> @@ -642,10 +532,10 @@ <reference ref="935002176"/> </object> </object> - <nil key="NSMarkedAttributes"/> + <reference key="NSInsertionColor" ref="1021276550"/> <object class="NSDictionary" key="NSLinkAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSColor</string> <string>NSCursor</string> @@ -661,7 +551,7 @@ <string key="NSHotSpot">{8, -8}</string> <int key="NSCursorType">13</int> </object> - <integer value="1" id="9"/> + <integer value="1"/> </object> </object> <nil key="NSDefaultParagraphStyle"/> @@ -674,7 +564,6 @@ </object> <string key="NSFrameSize">{667, 349}</string> <reference key="NSSuperview" ref="604699677"/> - <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="702566211"/> <reference key="NSDocView" ref="702566211"/> <reference key="NSBGColor" ref="940290613"/> @@ -686,28 +575,25 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{639, 2}, {11, 359}}</string> <reference key="NSSuperview" ref="604699677"/> - <reference key="NSWindow"/> <int key="NSsFlags">256</int> <reference key="NSTarget" ref="604699677"/> <string key="NSAction">_doScroller:</string> - <double key="NSPercent">6.016427e-01</double> + <double key="NSPercent">0.60164272785186768</double> </object> <object class="NSScroller" id="393370468"> <reference key="NSNextResponder" ref="604699677"/> - <int key="NSvFlags">256</int> + <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {87, 18}}</string> <reference key="NSSuperview" ref="604699677"/> - <reference key="NSWindow"/> <int key="NSsFlags">257</int> <reference key="NSTarget" ref="604699677"/> <string key="NSAction">_doScroller:</string> - <double key="NSCurValue">1.000000e+00</double> - <double key="NSPercent">9.456522e-01</double> + <double key="NSCurValue">1</double> + <double key="NSPercent">0.94565218687057495</double> </object> </object> <string key="NSFrame">{{0, 51}, {667, 349}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="967441740"/> <int key="NSsFlags">528</int> <reference key="NSVScroller" ref="699979333"/> @@ -720,17 +606,15 @@ <object class="NSPSMatrix" key="NSDrawMatrix"/> <string key="NSFrame">{{325, 232}, {32, 32}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <int key="NSpiFlags">28682</int> - <double key="NSMinValue">1.600000e+01</double> - <double key="NSMaxValue">1.000000e+02</double> + <double key="NSMinValue">16</double> + <double key="NSMaxValue">100</double> </object> <object class="NSBox" id="398943605"> <reference key="NSNextResponder" ref="559857537"/> <int key="NSvFlags">10</int> <string key="NSFrame">{{0, 398}, {667, 5}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -740,7 +624,7 @@ <reference key="NSBackgroundColor" ref="186095045"/> <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes> + <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> </object> </object> <int key="NSBorderType">3</int> @@ -753,7 +637,6 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{9, 408}, {649, 14}}</string> <reference key="NSSuperview" ref="559857537"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="581551870"> <int key="NSCellFlags">67239488</int> @@ -778,7 +661,6 @@ </object> <string key="NSFrameSize">{667, 428}</string> <reference key="NSSuperview"/> - <reference key="NSWindow"/> </object> <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string> <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> @@ -829,54 +711,6 @@ <int key="connectionID">44</int> </object> <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="657320705"/> - </object> - <int key="connectionID">45</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="331580392"/> - </object> - <int key="connectionID">46</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="350758430"/> - </object> - <int key="connectionID">47</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="231072377"/> - </object> - <int key="connectionID">48</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="254749674"/> - </object> - <int key="connectionID">49</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="853091810"/> - </object> - <int key="connectionID">50</int> - </object> - <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">editSheetProgressBar</string> <reference key="source" ref="1001"/> @@ -981,30 +815,6 @@ <int key="connectionID">63</int> </object> <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="364525587"/> - </object> - <int key="connectionID">64</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="800624537"/> - </object> - <int key="connectionID">65</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">quickLookFormatButton:</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="964663224"/> - </object> - <int key="connectionID">66</int> - </object> - <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">editSheetOkButton</string> <reference key="source" ref="1001"/> @@ -1066,28 +876,26 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> - <object class="NSArray" key="object" id="1002"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="object" ref="0"/> <reference key="children" ref="1000"/> <nil key="parent"/> </object> <object class="IBObjectRecord"> <int key="objectID">-2</int> <reference key="object" ref="1001"/> - <reference key="parent" ref="1002"/> - <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="1003"/> - <reference key="parent" ref="1002"/> + <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="1004"/> - <reference key="parent" ref="1002"/> + <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> @@ -1097,7 +905,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="559857537"/> </object> - <reference key="parent" ref="1002"/> + <reference key="parent" ref="0"/> <string key="objectName">Field Edit Sheet</string> </object> <object class="IBObjectRecord"> @@ -1261,70 +1069,16 @@ <reference key="object" ref="70895771"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="964663224"/> - <reference ref="364525587"/> - <reference ref="853091810"/> - <reference ref="350758430"/> - <reference ref="231072377"/> - <reference ref="800624537"/> - <reference ref="254749674"/> - <reference ref="657320705"/> <reference ref="524851662"/> - <reference ref="331580392"/> </object> <reference key="parent" ref="583599991"/> </object> <object class="IBObjectRecord"> - <int key="objectID">22</int> - <reference key="object" ref="964663224"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">23</int> - <reference key="object" ref="364525587"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">24</int> - <reference key="object" ref="853091810"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">25</int> - <reference key="object" ref="350758430"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">26</int> - <reference key="object" ref="231072377"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">27</int> - <reference key="object" ref="800624537"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">28</int> - <reference key="object" ref="254749674"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">29</int> - <reference key="object" ref="657320705"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">30</int> <reference key="object" ref="524851662"/> <reference key="parent" ref="70895771"/> </object> <object class="IBObjectRecord"> - <int key="objectID">31</int> - <reference key="object" ref="331580392"/> - <reference key="parent" ref="70895771"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">32</int> <reference key="object" ref="521189288"/> <reference key="parent" ref="189033461"/> @@ -1391,12 +1145,11 @@ </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>-1.IBPluginDependency</string> - <string>-2.IBPluginDependency</string> <string>-3.IBPluginDependency</string> <string>1.IBEditorWindowLastContentRect</string> + <string>1.IBPluginDependency</string> <string>1.IBWindowTemplateEditedContentRect</string> <string>1.ImportedFromIB2</string> <string>1.windowTemplate.hasMaxSize</string> @@ -1422,17 +1175,8 @@ <string>20.IBPluginDependency</string> <string>21.IBEditorWindowLastContentRect</string> <string>21.IBPluginDependency</string> - <string>22.IBPluginDependency</string> - <string>23.IBPluginDependency</string> - <string>24.IBPluginDependency</string> - <string>25.IBPluginDependency</string> - <string>26.IBPluginDependency</string> - <string>27.IBPluginDependency</string> - <string>28.IBPluginDependency</string> - <string>29.IBPluginDependency</string> <string>3.IBPluginDependency</string> <string>30.IBPluginDependency</string> - <string>31.IBPluginDependency</string> <string>32.IBPluginDependency</string> <string>33.IBPluginDependency</string> <string>33.IBShouldRemoveOnLegacySave</string> @@ -1469,71 +1213,61 @@ <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{211, 454}, {667, 428}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{211, 454}, {667, 428}}</string> - <reference ref="9"/> - <integer value="0" id="8"/> + <integer value="1"/> + <integer value="0"/> <boolean value="NO"/> <string>{3.40282e+38, 3.40282e+38}</string> <string>{560, 200}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{580, 195}, {126, 173}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{528, 472}, {92, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>SPEditSheetTextView</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>CMImageView</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> + <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableDictionary"> <string key="NS.key.0">ToolTip</string> @@ -1545,15 +1279,13 @@ </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="8"/> - <reference ref="9"/> + <integer value="0"/> + <integer value="1"/> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> @@ -1561,9 +1293,7 @@ <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> @@ -1634,7 +1364,7 @@ <string key="className">NSTextView</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>doDecomposedStringWithCanonicalMapping:</string> <string>doDecomposedStringWithCompatibilityMapping:</string> @@ -1700,7 +1430,7 @@ <string key="superclassName">NSWindowController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>closeEditSheet:</string> <string>dropImage:</string> @@ -1721,7 +1451,7 @@ </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>editImage</string> <string>editSheet</string> @@ -1769,7 +1499,7 @@ <string key="superclassName">NSWindowController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>closeEditSheet:</string> <string>dropImage:</string> @@ -1790,7 +1520,7 @@ </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>editImage</string> <string>editSheet</string> @@ -1835,6 +1565,15 @@ </object> </object> <int key="IBDocument.localizationMode">0</int> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <integer value="1050" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> + <integer value="3000" key="NS.object.0"/> + </object> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> </data> diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist index 4f127c88..825a093d 100644 --- a/Resources/PreferenceDefaults.plist +++ b/Resources/PreferenceDefaults.plist @@ -106,5 +106,88 @@ <true/> <key>PrintImagePreviews</key> <true/> + <key>QuickLookTypes</key> + <array> + <dict> + <key>MenuLabel</key> + <string>Image</string> + <key>Extension</key> + <string>icns</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Sound (m4a)</string> + <key>Extension</key> + <string>m4a</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Sound (mp3)</string> + <key>Extension</key> + <string>mp3</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Sound (linear)</string> + <key>Extension</key> + <string>wav</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Movie (mov)</string> + <key>Extension</key> + <string>mov</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>PDF</string> + <key>Extension</key> + <string>pdf</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>HTML</string> + <key>Extension</key> + <string>html</string> + <key>treatAsText</key> + <true/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Word Document</string> + <key>Extension</key> + <string>doc</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Word Document (xml)</string> + <key>Extension</key> + <string>docx</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>RTF</string> + <key>Extension</key> + <string>rtf</string> + <key>treatAsText</key> + <false/> + </dict> + </array> </dict> </plist> diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h index 97edd4b3..56b7a2bd 100644 --- a/Source/SPFieldEditorController.h +++ b/Source/SPFieldEditorController.h @@ -25,7 +25,8 @@ #import <Cocoa/Cocoa.h> @interface SPFieldEditorController : NSWindowController -{ +{ + IBOutlet id editSheetProgressBar; IBOutlet id editSheetSegmentControl; IBOutlet id editSheetQuickLookButton; @@ -40,7 +41,7 @@ IBOutlet id editSheetOkButton; IBOutlet id editSheetOpenButton; IBOutlet id editSheetFieldName; - + id sheetEditData; BOOL editSheetWillBeInitialized; BOOL isBlob; @@ -48,19 +49,21 @@ NSStringEncoding encoding; NSString *stringValue; NSString *tmpFileName; - + NSString *tmpDirPath; + int counter; unsigned long long maxTextLength; BOOL editTextViewWasChanged; BOOL allowUndo; BOOL wasCutPaste; BOOL selectionChanged; - + NSUserDefaults *prefs; - + int editSheetReturnCode; - + NSUndoManager *esUndoManager; + } - (IBAction)closeEditSheet:(id)sender; @@ -81,7 +84,6 @@ - (void)processUpdatedImageData:(NSData *)data; - (void)invokeQuickLookOfType:(NSString *)type treatAsText:(BOOL)isText; -- (void)removeQuickLooksTempFile:(NSString*)aPath; - (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector; - (void)textViewDidChangeSelection:(NSNotification *)notification; diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 662bb008..2234681f 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -53,6 +53,28 @@ allowUndo = NO; selectionChanged = NO; + + tmpDirPath = NSTemporaryDirectory(); + tmpFileName = nil; + + NSMenu *menu = [editSheetQuickLookButton menu]; + [menu setAutoenablesItems:NO]; + NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Interpret data as:", @"Interpret data as:") action:NULL keyEquivalent:@""]; + [item setTag:1]; + [item setEnabled:NO]; + [menu addItem:item]; + [item release]; + NSUInteger tag = 2; + if([prefs objectForKey:@"QuickLookTypes"]) { + for(id type in [prefs objectForKey:@"QuickLookTypes"]) { + NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""]; + [item setTag:tag]; + [item setAction:@selector(quickLookFormatButton:)]; + [menu addItem:item]; + [item release]; + tag++; + } + } } return self; @@ -61,6 +83,12 @@ - (void)dealloc { + + // On Mac OSX 10.6 QuickLook runs non-modal thus order out the panel + // if still visible + if([[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] isVisible]) + [[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] orderOut:nil]; + if ( esUndoManager ) [esUndoManager release]; if ( sheetEditData ) [sheetEditData release]; [super dealloc]; @@ -253,7 +281,6 @@ } while([esUndoManager groupingLevel] < cycleCounter) [esUndoManager beginUndoGrouping]; - cycleCounter = 0; } @@ -263,10 +290,6 @@ [editSheet orderOut:nil]; [NSApp endSheet:editSheet]; - // Ensure all text changes in sheetEditData are returned - if([editImage image] == nil) - sheetEditData = [[NSString stringWithString:[editTextView string]] retain]; - // For safety reasons inform QuickLook to quit quickLookCloseMarker = 1; @@ -307,6 +330,19 @@ [NSApp stopModal]; editSheetReturnCode = 1; } + + // Delete all QuickLook temp files if it was invoked + if(tmpFileName != nil) { + NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:tmpDirPath error:nil]; + for (NSString *file in dirContents) { + if ([file hasPrefix:@"SequelProQuickLook"]) { + if(![[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", tmpDirPath, file] error:NULL]) { + NSLog(@"QL: Couldn't delete temporary file '%@/%@'.", tmpDirPath, file); + } + } + } + } + [NSApp abortModal]; } @@ -474,16 +510,53 @@ - (IBAction)quickLookFormatButton:(id)sender { - switch([sender tag]) { - case 0: [self invokeQuickLookOfType:@"pict" treatAsText:NO]; break; - case 1: [self invokeQuickLookOfType:@"m4a" treatAsText:NO]; break; - case 2: [self invokeQuickLookOfType:@"mp3" treatAsText:NO]; break; - case 3: [self invokeQuickLookOfType:@"wav" treatAsText:NO]; break; - case 4: [self invokeQuickLookOfType:@"mov" treatAsText:NO]; break; - case 5: [self invokeQuickLookOfType:@"pdf" treatAsText:NO]; break; - case 6: [self invokeQuickLookOfType:@"html" treatAsText:YES]; break; - case 7: [self invokeQuickLookOfType:@"doc" treatAsText:NO]; break; - case 8: [self invokeQuickLookOfType:@"rtf" treatAsText:YES]; break; + + id types = [prefs objectForKey:@"QuickLookTypes"]; + + if(types != nil && [types isKindOfClass:[NSArray class]] && [types count] > [sender tag] - 2) { + NSDictionary *type = [types objectAtIndex:[sender tag] - 2]; + [self invokeQuickLookOfType:[type objectForKey:@"Extension"] treatAsText:([[type objectForKey:@"treatAsText"] intValue])]; + } +} + +- (void)createTemporaryQuickLookFileOfType:(NSString *)type treatAsText:(BOOL)isText +{ + // Create a temporary file name to store the data as file + // since QuickLook only works on files. + // Alternate the file name to suppress caching by using counter%2. + tmpFileName = [NSString stringWithFormat:@"%@SequelProQuickLook%d.%@", tmpDirPath, counter%2, type]; + + // if data are binary + if ( [sheetEditData isKindOfClass:[NSData class]] && !isText) { + [sheetEditData writeToFile:tmpFileName atomically:YES]; + + // write other field types' representations to the file via the current encoding + } else { + + // if "html" type try to set the HTML charset - not yet completed + if([type isEqualToString:@"html"]) { + + NSString *enc; + switch(encoding) { + case NSASCIIStringEncoding: + enc = @"US-ASCII";break; + case NSUTF8StringEncoding: + enc = @"UTF-8";break; + case NSISOLatin1StringEncoding: + enc = @"ISO-8859-1";break; + default: + enc = @"US-ASCII"; + } + [[NSString stringWithFormat:@"<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=%@'>%@", enc, [editTextView string]] writeToFile:tmpFileName + atomically:YES + encoding:encoding + error:NULL]; + } else { + [[sheetEditData description] writeToFile:tmpFileName + atomically:YES + encoding:encoding + error:NULL]; + } } } @@ -492,63 +565,25 @@ */ - (void)invokeQuickLookOfType:(NSString *)type treatAsText:(BOOL)isText { - - // Load private framework + + // Load QL via private framework (SDK 10.5) if([[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load]) { - + [editSheetProgressBar startAnimation:self]; - - // Create a temporary file name to store the data as file - // since QuickLook only works on files. - // Alternate the file name to suppress caching by using counter%2. - tmpFileName = [NSString stringWithFormat:@"%@SequelProQuickLook%d.%@", NSTemporaryDirectory(), counter%2, type]; - // if data are binary - if ( [sheetEditData isKindOfClass:[NSData class]] && !isText) { - [sheetEditData writeToFile:tmpFileName atomically:YES]; - - // write other field types' representations to the file via the current encoding - } else { - - // if "html" type try to set the HTML charset - not yet completed - if([type isEqualToString:@"html"]) { - - NSString *enc; - switch(encoding) { - case NSASCIIStringEncoding: - enc = @"US-ASCII";break; - case NSUTF8StringEncoding: - enc = @"UTF-8";break; - case NSISOLatin1StringEncoding: - enc = @"ISO-8859-1";break; - default: - enc = @"US-ASCII"; - } - [[NSString stringWithFormat:@"<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=%@'>%@", enc, [editTextView string]] writeToFile:tmpFileName - atomically:YES - encoding:encoding - error:NULL]; - } else { - [[sheetEditData description] writeToFile:tmpFileName - atomically:YES - encoding:encoding - error:NULL]; - } - } - + [self createTemporaryQuickLookFileOfType:type treatAsText:isText]; + counter++; - + // Init QuickLook id ql = [NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel]; [[ql delegate] setDelegate:self]; - [ql setURLs:[NSArray arrayWithObject: [NSURL fileURLWithPath:tmpFileName]] currentIndex:0 preservingDisplayState:YES]; - // TODO: No interaction with iChat and iPhoto due to .scriptSuite warning: - // for superclass of class 'SPAppController' in suite 'Sequel Pro': 'NSCoreSuite.NSAbstractObject' is not a valid class name. + // unknown image format [ql setShowsAddToiPhotoButton:NO]; [ql setShowsiChatTheaterButton:NO]; // Since we are inside of editSheet we have to avoid full-screen zooming @@ -562,7 +597,7 @@ quickLookCloseMarker = 0; [editSheetProgressBar stopAnimation:self]; - + // Run QuickLook in its own modal seesion for event handling NSModalSession session = [NSApp beginModalSessionForWindow:ql]; for (;;) { @@ -573,35 +608,84 @@ break; [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; - + } [NSApp endModalSession:session]; - + // set ql's delegate to nil for dealloc [[ql windowController] setDelegate:nil]; - - // Remove temp file after closing the sheet to allow double-click event at the QuickLook preview. - // The afterDelay: time is a kind of dummy, because after double-clicking the model session loop - // will break (ql not visible) and returns the event handling back to the editSheet which by itself - // blocks the execution of removeQuickLooksTempFile: until the editSheet is closed. - // [NSObject cancelPreviousPerformRequestsWithTarget:self - // selector:@selector(removeQuickLooksTempFile) - // object:tmpFileName]; - - [self performSelector:@selector(removeQuickLooksTempFile:) withObject:tmpFileName afterDelay:.1]; + } + // Load QL via framework (SDK 10.5 but SP runs on 10.6) + // TODO: This is an hack in order to be able to support QuickLook on Mac OS X 10.5 and 10.6 + // as long as SP will be compiled against SDK 10.5. + // If SP will be compiled against SDK 10.6 we can use the standard way by using + // the QuickLookUI which is part of the Quartz.framework. See Developer example "QuickLookDownloader" + // file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/samplecode/QuickLookDownloader/index.html#//apple_ref/doc/uid/DTS40009082 + else if([[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load]) { + + [editSheetProgressBar startAnimation:self]; + [self createTemporaryQuickLookFileOfType:type treatAsText:isText]; + + counter++; + + // TODO: If QL is visible reload it - but how? + // Up to now QL will close and the user has to redo it. + if([[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] isVisible]) { + [[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] orderOut:nil]; + } + + [[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] makeKeyAndOrderFront:nil]; + + [editSheetProgressBar stopAnimation:self]; + + } else { + [SPTooltip showWithObject:[NSString stringWithFormat:@"QuickLook is not available on that platform."]]; } - + } -- (void)removeQuickLooksTempFile:(NSString*)aPath +// QuickLook delegates for SDK 10.6 +- (void)beginPreviewPanelControl:(id)panel { - if(![[NSFileManager defaultManager] removeItemAtPath:aPath error:NULL]) - NSLog(@"Couldn't delete temp file at path '%@'", aPath); + + // This document is now responsible of the preview panel + [panel setDelegate:self]; + [panel setDataSource:self]; + + // Due to the unknown image format disable image sharing + [panel setShowsAddToiPhotoButton:NO]; + +} +// QuickLook delegates for SDK 10.6 +- (void)endPreviewPanelControl:(id)panel +{ + // This document loses its responsisibility on the preview panel + // Until the next call to -beginPreviewPanelControl: it must not + // change the panel's delegate, data source or refresh it. +} +// QuickLook delegates for SDK 10.6 +- (BOOL)acceptsPreviewPanelControl:(id)panel; +{ + return YES; +} +// QuickLook delegates for SDK 10.6 +// - (BOOL)previewPanel:(QLPreviewPanel *)panel handleEvent:(NSEvent *)event +// { +// } +// QuickLook delegates for SDK 10.6 +- (NSInteger)numberOfPreviewItemsInPreviewPanel:(id)panel +{ + return 1; +} +// QuickLook delegates for SDK 10.6 +- (id)previewPanel:(id)panel previewItemAtIndex:(NSInteger)index +{ + return [NSURL fileURLWithPath:tmpFileName]; } -// This is the delegate method +// QuickLook delegates for SDK 10.5 // It should return the frame for the item represented by the URL // If an empty frame is returned then the panel will fade in/out instead - (NSRect)previewPanel:(NSPanel*)panel frameForURL:(NSURL*)URL @@ -619,6 +703,23 @@ 5, 5); } +// QuickLook delegates for SDK 10.6 +// It should return the frame for the item represented by the URL +// If an empty frame is returned then the panel will fade in/out instead +- (NSRect)previewPanel:(id)panel sourceFrameOnScreenForPreviewItem:(id)item +{ + // Return the App's middle point + NSRect mwf = [[NSApp mainWindow] frame]; + return NSMakeRect( + mwf.origin.x+mwf.size.width/2, + mwf.origin.y+mwf.size.height/2, + 5, 5); +} +// QuickLook delegates for SDK 10.6 +// - (id)previewPanel:(id)panel transitionImageForPreviewItem:(id)item contentRect:(NSRect *)contentRect +// { +// return [NSImage imageNamed:@"database"]; +// } -(void)processPasteImageData { @@ -775,7 +876,9 @@ { // Do nothing if user really didn't changed text (e.g. for font size changing return) - if(!editTextViewWasChanged && (editSheetWillBeInitialized || ([[[notification object] textStorage] changeInLength]==0))) { + if(!editTextViewWasChanged && (editSheetWillBeInitialized + || (([[[notification object] textStorage] editedRange].length == 0) + && ([[[notification object] textStorage] changeInLength] == 0)))) { // Inform the undo-grouping about the caret movement selectionChanged = YES; return; |