aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-25 18:15:04 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-25 18:15:04 +0000
commit29cb06ee02f5393c51d7b45d60e314a94c08e5b2 (patch)
treed3fb7c1f819256ae1ae24f16e02a7107e41e3542
parent946b196134295d5bb1d030b2c51e04930bcdd17f (diff)
downloadsequelpro-29cb06ee02f5393c51d7b45d60e314a94c08e5b2.tar.gz
sequelpro-29cb06ee02f5393c51d7b45d60e314a94c08e5b2.tar.bz2
sequelpro-29cb06ee02f5393c51d7b45d60e314a94c08e5b2.zip
• Bundle Editor
- FInished implementation to display bundles in an outline view
-rw-r--r--Interfaces/English.lproj/BundleEditor.xib208
-rw-r--r--Source/SPBundleEditorController.h2
-rw-r--r--Source/SPBundleEditorController.m271
3 files changed, 331 insertions, 150 deletions
diff --git a/Interfaces/English.lproj/BundleEditor.xib b/Interfaces/English.lproj/BundleEditor.xib
index 6f52902d..f7f1d6fa 100644
--- a/Interfaces/English.lproj/BundleEditor.xib
+++ b/Interfaces/English.lproj/BundleEditor.xib
@@ -23,8 +23,6 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="899"/>
- <integer value="730"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -92,6 +90,7 @@
<int key="NSvFlags">4370</int>
<string key="NSFrameSize">{142, 420}</string>
<reference key="NSSuperview" ref="34907435"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="_NSCornerView" key="NSCornerView">
<nil key="NSNextResponder"/>
@@ -192,6 +191,7 @@
</object>
<string key="NSFrame">{{1, 1}, {142, 420}}</string>
<reference key="NSSuperview" ref="802985400"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="472206854"/>
<reference key="NSDocView" ref="472206854"/>
<reference key="NSBGColor" ref="255000212"/>
@@ -202,6 +202,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {15, 102}}</string>
<reference key="NSSuperview" ref="802985400"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="802985400"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">0.99585062265396118</double>
@@ -211,6 +212,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {192, 15}}</string>
<reference key="NSSuperview" ref="802985400"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="802985400"/>
<string key="NSAction">_doScroller:</string>
@@ -219,6 +221,7 @@
</object>
<string key="NSFrame">{{0, 22}, {144, 422}}</string>
<reference key="NSSuperview" ref="69213598"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="34907435"/>
<int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="769403162"/>
@@ -236,6 +239,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{-1, -1}, {32, 25}}</string>
<reference key="NSSuperview" ref="78837987"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="846292214">
<int key="NSCellFlags">67239424</int>
@@ -264,6 +268,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{30, -1}, {32, 25}}</string>
<reference key="NSSuperview" ref="78837987"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="653176607">
<int key="NSCellFlags">67239424</int>
@@ -288,6 +293,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{61, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="78837987"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredPopUpButtonCell" key="NSCell" id="998795499">
<int key="NSCellFlags">71433792</int>
@@ -374,7 +380,7 @@
</object>
<object class="NSMenuItem" id="642604110">
<reference key="NSMenu" ref="973574710"/>
- <string key="NSTitle">Reload Bundles</string>
+ <string key="NSTitle">Reload Bundles without Saving</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="545549031"/>
@@ -384,6 +390,7 @@
</object>
</object>
</object>
+ <int key="NSSelectedIndex">3</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -393,6 +400,7 @@
</object>
<string key="NSFrameSize">{142, 23}</string>
<reference key="NSSuperview" ref="69213598"/>
+ <reference key="NSWindow"/>
<bool key="BWABBIsResizable">YES</bool>
<bool key="BWABBIsAtBottom">YES</bool>
<bool key="BWABBHandleIsRightAligned">NO</bool>
@@ -401,6 +409,7 @@
</object>
<string key="NSFrameSize">{142, 444}</string>
<reference key="NSSuperview" ref="358491109"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="BWCustomView" id="338542681">
@@ -408,6 +417,34 @@
<int key="NSvFlags">4370</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="587735074">
+ <reference key="NSNextResponder" ref="338542681"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{236, 318}, {292, 18}}</string>
+ <reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="702004127">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">131072</int>
+ <string key="NSContents">Disable Command</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="587735074"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <object class="NSCustomResource" key="NSNormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSSwitch</string>
+ </object>
+ <object class="NSButtonImageSource" key="NSAlternateImage">
+ <string key="NSImageName">NSSwitch</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
<object class="NSScrollView" id="179792134">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">274</int>
@@ -446,6 +483,7 @@
</object>
<string key="NSFrameSize">{138, 92}</string>
<reference key="NSSuperview" ref="971406968"/>
+ <reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="1001899575">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -527,6 +565,7 @@
</object>
<string key="NSFrame">{{1, 1}, {504, 210}}</string>
<reference key="NSSuperview" ref="179792134"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="965862131"/>
<reference key="NSDocView" ref="965862131"/>
<reference key="NSBGColor" ref="856229010"/>
@@ -541,6 +580,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{454, 1}, {15, 190}}</string>
<reference key="NSSuperview" ref="179792134"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="179792134"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
@@ -551,6 +591,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="179792134"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="179792134"/>
<string key="NSAction">_doScroller:</string>
@@ -560,6 +601,7 @@
</object>
<string key="NSFrame">{{20, 105}, {506, 212}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="971406968"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="414961522"/>
@@ -571,6 +613,7 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{435, 58}, {96, 28}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1051503991">
@@ -592,6 +635,7 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{435, 16}, {96, 28}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="697434956">
<int key="NSCellFlags">67239424</int>
@@ -612,6 +656,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {161, 22}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="SRRecorderCell" key="NSCell" id="670400760">
<int key="NSCellFlags">67239424</int>
@@ -632,8 +677,9 @@
<object class="NSPopUpButton" id="1013555552">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{236, 347}, {167, 22}}</string>
+ <string key="NSFrame">{{236, 351}, {167, 22}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="4363123">
<int key="NSCellFlags">-2076049856</int>
@@ -667,6 +713,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{17, 61}, {167, 22}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="299353121">
<int key="NSCellFlags">-2076049856</int>
@@ -698,8 +745,9 @@
<object class="NSPopUpButton" id="904079305">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{236, 387}, {167, 22}}</string>
+ <string key="NSFrame">{{236, 391}, {167, 22}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="886363818">
<int key="NSCellFlags">-2076049856</int>
@@ -731,8 +779,9 @@
<object class="NSPopUpButton" id="117047836">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{17, 347}, {167, 22}}</string>
+ <string key="NSFrame">{{17, 351}, {167, 22}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="131002945">
<int key="NSCellFlags">-2076049856</int>
@@ -764,8 +813,9 @@
<object class="NSButton" id="277233496">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">265</int>
- <string key="NSFrame">{{504, 345}, {25, 25}}</string>
+ <string key="NSFrame">{{504, 349}, {25, 25}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1021110085">
<int key="NSCellFlags">67239424</int>
@@ -784,8 +834,9 @@
<object class="NSTextField" id="411989314">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{186, 351}, {48, 14}}</string>
+ <string key="NSFrame">{{186, 355}, {48, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="679867674">
<int key="NSCellFlags">68288064</int>
@@ -807,6 +858,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{204, 63}, {161, 19}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="748268806">
<int key="NSCellFlags">-1804468671</int>
@@ -835,6 +887,7 @@
<int key="NSvFlags">288</int>
<string key="NSFrame">{{17, 83}, {167, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="849546250">
<int key="NSCellFlags">68288064</int>
@@ -851,6 +904,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{201, 83}, {167, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="622343774">
<int key="NSCellFlags">68288064</int>
@@ -865,8 +919,9 @@
<object class="NSTextField" id="669651343">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{236, 410}, {167, 14}}</string>
+ <string key="NSFrame">{{236, 414}, {167, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="44795332">
<int key="NSCellFlags">68288064</int>
@@ -883,6 +938,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 320}, {167, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="553916693">
<int key="NSCellFlags">68288064</int>
@@ -897,8 +953,9 @@
<object class="NSTextField" id="931989616">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{17, 370}, {167, 14}}</string>
+ <string key="NSFrame">{{17, 374}, {167, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="370999655">
<int key="NSCellFlags">68288064</int>
@@ -915,6 +972,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{201, 43}, {167, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="627233937">
<int key="NSCellFlags">68288064</int>
@@ -931,6 +989,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{204, 22}, {161, 19}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="43525095">
<int key="NSCellFlags">-1804468671</int>
@@ -947,8 +1006,9 @@
<object class="NSTextField" id="1032857532">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">264</int>
- <string key="NSFrame">{{17, 410}, {167, 14}}</string>
+ <string key="NSFrame">{{17, 414}, {167, 14}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="434303900">
<int key="NSCellFlags">68288064</int>
@@ -963,8 +1023,9 @@
<object class="NSTextField" id="209604501">
<reference key="NSNextResponder" ref="338542681"/>
<int key="NSvFlags">264</int>
- <string key="NSFrame">{{20, 390}, {161, 19}}</string>
+ <string key="NSFrame">{{20, 394}, {161, 19}}</string>
<reference key="NSSuperview" ref="338542681"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1025501303">
<int key="NSCellFlags">-1804468671</int>
@@ -981,11 +1042,13 @@
</object>
<string key="NSFrame">{{143, 0}, {548, 444}}</string>
<reference key="NSSuperview" ref="358491109"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrameSize">{691, 444}</string>
<reference key="NSSuperview" ref="391663674"/>
+ <reference key="NSWindow"/>
<bool key="NSIsVertical">YES</bool>
<int key="NSDividerStyle">2</int>
<string key="NSAutosaveName">SPQueryFavoriteSplitView</string>
@@ -1052,24 +1115,13 @@
</object>
<string key="NSFrameSize">{691, 444}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSMinSize">{691, 466}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">SPBundleEditor</string>
</object>
- <object class="NSTreeController" id="645644012">
- <object class="NSMutableArray" key="NSDeclaredKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>bundleName</string>
- </object>
- <bool key="NSEditable">YES</bool>
- <object class="_NSManagedProxy" key="_NSManagedProxy"/>
- <bool key="NSAvoidsEmptySelection">YES</bool>
- <bool key="NSPreservesSelection">YES</bool>
- <bool key="NSSelectsInsertedObjects">YES</bool>
- <string key="NSTreeContentChildrenKey">_children_</string>
- </object>
<object class="NSMenu" id="655873624">
<string key="NSTitle"/>
<object class="NSMutableArray" key="NSMenuItems">
@@ -1124,6 +1176,20 @@
</object>
</object>
</object>
+ <object class="NSTreeController" id="645644012">
+ <object class="NSMutableArray" key="NSDeclaredKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>bundleName</string>
+ <string>disabled</string>
+ <string>name</string>
+ </object>
+ <bool key="NSEditable">YES</bool>
+ <object class="_NSManagedProxy" key="_NSManagedProxy"/>
+ <bool key="NSAvoidsEmptySelection">YES</bool>
+ <bool key="NSPreservesSelection">YES</bool>
+ <bool key="NSSelectsInsertedObjects">YES</bool>
+ <string key="NSTreeContentChildrenKey">_children_</string>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -1546,22 +1612,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">value: selection.name</string>
- <reference key="source" ref="209604501"/>
- <reference key="destination" ref="645644012"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="209604501"/>
- <reference key="NSDestination" ref="645644012"/>
- <string key="NSLabel">value: selection.name</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">selection.name</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">986</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
<string key="label">value: selection.command</string>
<reference key="source" ref="965862131"/>
<reference key="destination" ref="645644012"/>
@@ -1656,6 +1706,46 @@
</object>
<int key="connectionID">995</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: selection.disabled</string>
+ <reference key="source" ref="587735074"/>
+ <reference key="destination" ref="645644012"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="587735074"/>
+ <reference key="NSDestination" ref="645644012"/>
+ <string key="NSLabel">value: selection.disabled</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">selection.disabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">999</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: selection.name</string>
+ <reference key="source" ref="209604501"/>
+ <reference key="destination" ref="645644012"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="209604501"/>
+ <reference key="NSDestination" ref="645644012"/>
+ <string key="NSLabel">value: selection.name</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">selection.name</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1027</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">disabledCheckbox</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="587735074"/>
+ </object>
+ <int key="connectionID">1028</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1822,7 +1912,7 @@
<reference ref="850254010"/>
</object>
<reference key="parent" ref="0"/>
- <string key="objectName">Gear Menu</string>
+ <string key="objectName">Outline Context Menu</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">903</int>
@@ -1933,6 +2023,7 @@
<reference ref="1032857532"/>
<reference ref="994416682"/>
<reference ref="570587248"/>
+ <reference ref="587735074"/>
</object>
<reference key="parent" ref="358491109"/>
<string key="objectName">Bundle Content View</string>
@@ -2278,6 +2369,20 @@
<reference key="object" ref="850254010"/>
<reference key="parent" ref="655873624"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">996</int>
+ <reference key="object" ref="587735074"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="702004127"/>
+ </object>
+ <reference key="parent" ref="338542681"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">997</int>
+ <reference key="object" ref="702004127"/>
+ <reference key="parent" ref="587735074"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2391,13 +2496,15 @@
<string>970.IBPluginDependency</string>
<string>982.IBPluginDependency</string>
<string>994.IBPluginDependency</string>
+ <string>996.IBPluginDependency</string>
+ <string>997.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{454, 288}, {691, 444}}</string>
+ <string>{{149, 306}, {691, 444}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{454, 288}, {691, 444}}</string>
+ <string>{{149, 306}, {691, 444}}</string>
<boolean value="NO"/>
<boolean value="YES"/>
<string>{691, 444}</string>
@@ -2470,7 +2577,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.brandonwalkin.BWToolkit</string>
- <string>{{504, 213}, {204, 98}}</string>
+ <string>{{230, 222}, {243, 98}}</string>
<string>com.brandonwalkin.BWToolkit</string>
<string>com.brandonwalkin.BWToolkit</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2612,6 +2719,8 @@
<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>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -2630,7 +2739,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">995</int>
+ <int key="maxID">1028</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2882,6 +2991,7 @@
<string>commandTextView</string>
<string>commandsOutlineView</string>
<string>commandsTableView</string>
+ <string>disabledCheckbox</string>
<string>duplicateMenuItem</string>
<string>fallbackLabelField</string>
<string>inputFallbackPopupButton</string>
@@ -2902,6 +3012,7 @@
<string>id</string>
<string>id</string>
<string>NSTableView</string>
+ <string>NSButton</string>
<string>NSMenuItem</string>
<string>NSTextField</string>
<string>NSPopUpButton</string>
@@ -2925,6 +3036,7 @@
<string>commandTextView</string>
<string>commandsOutlineView</string>
<string>commandsTableView</string>
+ <string>disabledCheckbox</string>
<string>duplicateMenuItem</string>
<string>fallbackLabelField</string>
<string>inputFallbackPopupButton</string>
@@ -2964,6 +3076,10 @@
<string key="candidateClassName">NSTableView</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">disabledCheckbox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">duplicateMenuItem</string>
<string key="candidateClassName">NSMenuItem</string>
</object>
@@ -3557,6 +3673,7 @@
<string>NSActionTemplate</string>
<string>NSMenuCheckmark</string>
<string>NSMenuMixedState</string>
+ <string>NSSwitch</string>
<string>button_add</string>
<string>button_remove</string>
</object>
@@ -3565,6 +3682,7 @@
<string>{10, 10}</string>
<string>{9, 8}</string>
<string>{7, 2}</string>
+ <string>{15, 15}</string>
<string>{128, 128}</string>
<string>{128, 128}</string>
</object>
diff --git a/Source/SPBundleEditorController.h b/Source/SPBundleEditorController.h
index bc25ff51..b08be971 100644
--- a/Source/SPBundleEditorController.h
+++ b/Source/SPBundleEditorController.h
@@ -47,9 +47,9 @@
IBOutlet NSMenuItem *duplicateMenuItem;
IBOutlet NSMenuItem *revealInFinderMenuItem;
IBOutlet SRRecorderControl *keyEquivalentField;
+ IBOutlet NSButton *disabledCheckbox;
IBOutlet NSTreeController *commandBundleTreeController;
- NSMutableArray *commandBundleArray;
NSMutableArray *touchedBundleArray;
NSMutableDictionary *commandBundleTree;
NSSortDescriptor *sortDescriptor;
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 9e459ac4..fe2c8289 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -34,9 +34,10 @@
@interface SPBundleEditorController (PrivateAPI)
-- (void)_updateInputPopupButton;
+- (void)_updateBundleDataView;
- (id)_currentSelectedObject;
- (id)_currentSelectedNode;
+- (void)_enableBundleDataInput:(BOOL)enabled;
- (NSUInteger)_arrangedScopeIndexForScopeIndex:(NSUInteger)scopeIndex;
- (NSUInteger)_scopeIndexForArrangedScopeIndex:(NSUInteger)scopeIndex;
- (NSUInteger)_arrangedCategoryIndexForScopeIndex:(NSUInteger)scopeIndex andCategory:(NSString*)category;
@@ -54,7 +55,6 @@
{
if ((self = [super initWithWindowNibName:@"BundleEditor"])) {
- commandBundleArray = nil;
touchedBundleArray = nil;
draggedFilePath = nil;
oldBundleName = nil;
@@ -86,7 +86,6 @@
[outputDataTableScopeArray release];
[inputFallbackInputFieldScopeArray release];
- if(commandBundleArray) [commandBundleArray release], commandBundleArray = nil;
if(touchedBundleArray) [touchedBundleArray release], touchedBundleArray = nil;
if(commandBundleTree) [commandBundleTree release], commandBundleTree = nil;
if(sortDescriptor) [sortDescriptor release], sortDescriptor = nil;
@@ -99,7 +98,9 @@
- (void)awakeFromNib
{
- commandBundleArray = [[NSMutableArray alloc] initWithCapacity:1];
+ // Init all needed variables; popup menus (with the chance for localization); and set
+ // defaults
+
touchedBundleArray = [[NSMutableArray alloc] initWithCapacity:1];
commandBundleTree = [[NSMutableDictionary alloc] initWithCapacity:1];
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:kBundleNameKey ascending:YES selector:@selector(localizedCompare:)];
@@ -233,11 +234,11 @@
[anItem setTag:kDataTableScopeArrayIndex];
[inputGeneralScopePopUpMenu addItem:anItem];
[anItem release];
- [inputGeneralScopePopUpMenu addItem:[NSMenuItem separatorItem]];
- anItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Disable Command", @"disable command menu label") action:@selector(scopeButtonChanged:) keyEquivalent:@""];
- [anItem setTag:kDisabledScopeTag];
- [inputGeneralScopePopUpMenu addItem:anItem];
- [anItem release];
+ // [inputGeneralScopePopUpMenu addItem:[NSMenuItem separatorItem]];
+ // anItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Disable Command", @"disable command menu label") action:@selector(scopeButtonChanged:) keyEquivalent:@""];
+ // [anItem setTag:kDisabledScopeTag];
+ // [inputGeneralScopePopUpMenu addItem:anItem];
+ // [anItem release];
[scopePopupButton setMenu:inputGeneralScopePopUpMenu];
[keyEquivalentField setCanCaptureGlobalHotKeys:YES];
@@ -248,6 +249,10 @@
#pragma mark -
+/**
+ * Store input source in bundle dict since it is not bound
+ * via key binding and update various GUI elements
+ */
- (IBAction)inputPopupButtonChanged:(id)sender
{
@@ -268,10 +273,14 @@
[currentDict setObject:input forKey:SPBundleFileInputSourceKey];
- [self _updateInputPopupButton];
+ [self _updateBundleDataView];
}
+/**
+ * Store input fallback source in bundle dict since it is not bound
+ * via key binding.
+ */
- (IBAction)inputFallbackPopupButtonChanged:(id)sender
{
@@ -288,6 +297,10 @@
}
+/**
+ * Store output action in bundle dict since it is not bound
+ * via key binding.
+ */
- (IBAction)outputPopupButtonChanged:(id)sender
{
@@ -308,6 +321,11 @@
}
+/**
+ * If scope was changed store that info in the bundle dict since it is not bound
+ * via key binding. In addition move the selected item to its new scope in the tree.
+ * If a category was set check if the scope also has this category; if not create it.
+ */
- (IBAction)scopeButtonChanged:(id)sender
{
@@ -358,10 +376,13 @@
[oldScope release];
- [self _updateInputPopupButton];
+ [self _updateBundleDataView];
}
+/**
+ * Duplicate the selected bundle (processed in addCommandBundle:)
+ */
- (IBAction)duplicateCommandBundle:(id)sender
{
if ([commandsOutlineView numberOfSelectedRows] == 1)
@@ -370,6 +391,11 @@
NSBeep();
}
+/**
+ * If sender == self duplicate selected bundle; otherwise add a new bundle -
+ * insert the new item under the selected one and set scope and category resp. according
+ * to current selection in the tree
+ */
- (IBAction)addCommandBundle:(id)sender
{
NSMutableDictionary *bundle;
@@ -510,12 +536,15 @@
[removeButton setEnabled:([[commandBundleTreeController selectedObjects] count] == 1 && ![[[commandBundleTreeController selectedObjects] objectAtIndex:0] objectForKey:kChildrenKey])];
[addButton setEnabled:([[commandBundleTreeController selectionIndexPath] length] > 1)];
- [self _updateInputPopupButton];
+ [self _updateBundleDataView];
[[self window] makeFirstResponder:commandsOutlineView];
}
+/**
+ * Remove the selected bundle but before ask for confirmation
+ */
- (IBAction)removeCommandBundle:(id)sender
{
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Remove selected Bundle?", @"remove selected bundle message")
@@ -537,6 +566,9 @@
}
+/**
+ * Reveal selected bundle.spBundle folder in Finder
+ */
- (IBAction)revealCommandBundleInFinder:(id)sender
{
@@ -547,6 +579,9 @@
}
+/**
+ * Open Save Panel for saving the selected bundle to disk
+ */
- (IBAction)saveBundle:(id)sender
{
NSSavePanel *panel = [NSSavePanel savePanel];
@@ -561,16 +596,25 @@
[panel beginSheetForDirectory:nil file:[[self _currentSelectedObject] objectForKey:kBundleNameKey] modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"saveBundle"];
}
+/**
+ * Show help web page for Bundle Editor
+ */
- (IBAction)showHelp:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:NSLocalizedString(@"http://www.sequelpro.com/docs/Bundle_Editor", @"Localized help page for bundle editor - do not localize if no translated webpage is available")]];
}
+/**
+ * Reload all installed bundles and order front the Bundle Editor
+ */
- (IBAction)reloadBundles:(id)sender
{
[self showWindow:self];
}
+/**
+ * Read all installed bundles and order front the Bundle Editor
+ */
- (IBAction)showWindow:(id)sender
{
@@ -580,13 +624,10 @@
return;
}
-
-
// Order out window
[super showWindow:sender];
- // Re-init commandBundleArray
- [commandBundleArray removeAllObjects];
+ // Re-init commandBundleTree
[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:kInputFieldScopeArrayIndex] setObject:[NSMutableArray array] forKey:kChildrenKey];
[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:kDataTableScopeArrayIndex] setObject:[NSMutableArray array] forKey:kChildrenKey];
[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:kGeneralScopeArrayIndex] setObject:[NSMutableArray array] forKey:kChildrenKey];
@@ -621,7 +662,6 @@
[bundleCommand addEntriesFromDictionary:cmdData];
[bundleCommand setObject:[bundle stringByDeletingPathExtension] forKey:kBundleNameKey];
- [commandBundleArray addObject:bundleCommand];
if([[cmdData objectForKey:SPBundleFileScopeKey] isEqualToString:SPBundleScopeInputField]) {
if([cmdData objectForKey:SPBundleFileCategoryKey] && [[cmdData objectForKey:SPBundleFileCategoryKey] length]) {
BOOL catExists = NO;
@@ -644,6 +684,7 @@
[[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:0] objectForKey:kChildrenKey] addObject:bundleCommand];
}
}
+
else if([[cmdData objectForKey:SPBundleFileScopeKey] isEqualToString:SPBundleScopeDataTable]) {
if([cmdData objectForKey:SPBundleFileCategoryKey] && [[cmdData objectForKey:SPBundleFileCategoryKey] length]) {
BOOL catExists = NO;
@@ -666,6 +707,7 @@
[[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:1] objectForKey:kChildrenKey] addObject:bundleCommand];
}
}
+
else if([[cmdData objectForKey:SPBundleFileScopeKey] isEqualToString:SPBundleScopeGeneral]) {
if([cmdData objectForKey:SPBundleFileCategoryKey] && [[cmdData objectForKey:SPBundleFileCategoryKey] length]) {
BOOL catExists = NO;
@@ -688,6 +730,7 @@
[[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:2] objectForKey:kChildrenKey] addObject:bundleCommand];
}
}
+
}
if (cmdData) [cmdData release];
}
@@ -705,6 +748,9 @@
}
+/**
+ * Save all touched bundles to disk and close the Bundle Editor window
+ */
- (IBAction)saveAndCloseWindow:(id)sender
{
@@ -766,6 +812,10 @@
}
+/**
+ * Save the passed NSDictionary representing a bundle to disk at path aPath and
+ * return success
+ */
- (BOOL)saveBundle:(NSDictionary*)bundle atPath:(NSString*)aPath
{
@@ -886,11 +936,13 @@
BOOL isDir;
BOOL copyingWasSuccessful = YES;
+
// Copy possible existing bundle with content
if([[NSFileManager defaultManager] fileExistsAtPath:possibleExisitingBundleFilePath isDirectory:&isDir] && isDir) {
if(![[NSFileManager defaultManager] copyItemAtPath:possibleExisitingBundleFilePath toPath:savePath error:nil])
copyingWasSuccessful = NO;
}
+
if(!copyingWasSuccessful || ![self saveBundle:aBundle atPath:savePath]) {
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Error while saving the Bundle.", @"error while saving a Bundle")
defaultButton:NSLocalizedString(@"OK", @"OK button")
@@ -909,12 +961,10 @@
#pragma mark -
#pragma mark NSWindow delegate
-/**
- * Suppress closing of the window if user pressed ESC while inline table cell editing.
- */
- (BOOL)windowShouldClose:(id)sender
{
+ // Suppress closing of the window if user pressed ESC while inline table cell editing.
if(isTableCellEditing) {
[commandsOutlineView abortEditing];
isTableCellEditing = NO;
@@ -927,8 +977,7 @@
- (void)windowWillClose:(NSNotification *)notification
{
- // Clear commandBundleArray if window will close to save memory
- [commandBundleArray removeAllObjects];
+ // Clear some stuff if window will close to save memory
[touchedBundleArray removeAllObjects];
[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:0] setObject:[NSMutableArray array] forKey:kChildrenKey];
[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:1] setObject:[NSMutableArray array] forKey:kChildrenKey];
@@ -978,20 +1027,16 @@
#pragma mark -
#pragma mark outline delegates
-
- (BOOL)outlineView:(id)outlineView isItemExpandable:(id)item
{
if([item isKindOfClass:[NSDictionary class]] && [item objectForKey:kChildrenKey])
return YES;
-
return NO;
}
- (NSInteger)outlineView:(id)outlineView numberOfChildrenOfItem:(id)item
{
-
- if(item == nil)
- item = commandBundleTree;
+ if(item == nil) item = commandBundleTree;
if([item isKindOfClass:[NSDictionary class]])
if([item objectForKey:kChildrenKey])
@@ -1007,11 +1052,9 @@
- (id)outlineView:(id)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
-
if(item && [item respondsToSelector:@selector(objectForKey:)])
return [item objectForKey:kBundleNameKey];
return @"";
-
}
- (BOOL)outlineView:outlineView isGroupItem:(id)item
@@ -1045,79 +1088,38 @@
return NO;
}
+/**
+ * Validate GUI elements and remember the bundle name after the user
+ * selected another bundle
+ */
- (void)outlineViewSelectionDidChange:(NSNotification *)aNotification
{
if([aNotification object] != commandsOutlineView) return;
+ // Remember selected bundle name to reset the name if the user cancelled
+ // the editing of the bundle name
if(oldBundleName) [oldBundleName release], oldBundleName = nil;
- if(![[self _currentSelectedObject] objectForKey:kChildrenKey])
+ if(![[self _currentSelectedObject] objectForKey:kChildrenKey]) {
oldBundleName = [[[self _currentSelectedObject] objectForKey:kBundleNameKey] retain];
- else
+ [self _enableBundleDataInput:YES];
+ } else {
+ [self _enableBundleDataInput:NO];
if(oldBundleName) [oldBundleName release], oldBundleName = nil;
-
- if(oldBundleName != nil && ![touchedBundleArray containsObject:oldBundleName])
- [touchedBundleArray addObject:oldBundleName];
- [self _updateInputPopupButton];
-
-}
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
-{
- if([commandsOutlineView numberOfSelectedRows] != 1 || [items count] != 1 ||
- ![[items objectAtIndex:0] isLeaf]) return NO;
-
- // Remove old temporary drag file if any
- if(draggedFilePath) {
- [[NSFileManager defaultManager] removeItemAtPath:draggedFilePath error:nil];
- [draggedFilePath release];
- draggedFilePath = nil;
}
- NSImage *dragImage;
- NSPoint dragPosition;
-
- NSDictionary *bundleDict = [[items objectAtIndex:0] representedObject];
- NSString *bundleFileName = [bundleDict objectForKey:kBundleNameKey];
- NSString *possibleExisitingBundleFilePath = [NSString stringWithFormat:@"%@/%@.%@", bundlePath, bundleFileName, SPUserBundleFileExtension];
-
- draggedFilePath = [[NSString stringWithFormat:@"/tmp/%@.%@", bundleFileName, SPUserBundleFileExtension] retain];
-
- BOOL isDir;
-
- // Copy possible existing bundle with content
- if([[NSFileManager defaultManager] fileExistsAtPath:possibleExisitingBundleFilePath isDirectory:&isDir] && isDir) {
- if(![[NSFileManager defaultManager] copyItemAtPath:possibleExisitingBundleFilePath toPath:draggedFilePath error:nil])
- return NO;
- }
-
- // Write temporary bundle data to disk but do not save the dict to Bundles folder
- if(![self saveBundle:bundleDict atPath:draggedFilePath]) return NO;
-
- // Write data to the pasteboard
- NSArray *fileList = [NSArray arrayWithObjects:draggedFilePath, nil];
- // NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- [pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil];
- [pboard setPropertyList:fileList forType:NSFilenamesPboardType];
+ // Remember the selected bundle name in touchedBundleArray to save only those
+ // bundles which were at least selected by the user to minimize disk activity
+ if(oldBundleName != nil && ![touchedBundleArray containsObject:oldBundleName])
+ [touchedBundleArray addObject:oldBundleName];
- // Start the drag operation
- dragImage = [[NSWorkspace sharedWorkspace] iconForFile:draggedFilePath];
- dragPosition = [[[self window] contentView] convertPoint:[[NSApp currentEvent] locationInWindow] fromView:nil];
- dragPosition.x -= 32;
- dragPosition.y -= 32;
- [[self window] dragImage:dragImage at:dragPosition offset:NSZeroSize
- event:[NSApp currentEvent] pasteboard:pboard source:[self window] slideBack:YES];
+ [self _updateBundleDataView];
- return YES;
}
-
#pragma mark -
#pragma mark TableView delegate
-/*
- * Save spBundle name if inline edited (suppress empty names) and check for renaming and / in the name
- */
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
@@ -1193,13 +1195,21 @@
scopeIndex = kInputFieldScopeArrayIndex;
NSIndexPath *currentIndexPath = [commandBundleTreeController selectionIndexPath];
- NSUInteger *newIndexPath[[currentIndexPath length]];
+ NSUInteger newIndexPathLength = 4;
+ NSUInteger *newIndexPath[newIndexPathLength];
[currentIndexPath getIndexes:&newIndexPath];
+ newIndexPath[3] = 0;
// Set the category index
- newIndexPath[2] = (NSUInteger)[self _arrangedCategoryIndexForScopeIndex:scopeIndex andCategory:[categoryTextField stringValue]];
+ NSUInteger newCategoryIndex = (NSUInteger)[self _arrangedCategoryIndexForScopeIndex:scopeIndex andCategory:[categoryTextField stringValue]];
+ if(newCategoryIndex == NSNotFound) {
+ newIndexPath[2] = 0;
+ newIndexPathLength--;
+ } else
+ newIndexPath[2] = newCategoryIndex;
- [commandBundleTreeController moveNode:[self _currentSelectedNode] toIndexPath:[NSIndexPath indexPathWithIndexes:newIndexPath length:[currentIndexPath length]]];
+ // Move the selected item to the new category node
+ [commandBundleTreeController moveNode:[self _currentSelectedNode] toIndexPath:[NSIndexPath indexPathWithIndexes:newIndexPath length:newIndexPathLength]];
[commandBundleTreeController rearrangeObjects];
[commandsOutlineView reloadData];
}
@@ -1233,7 +1243,7 @@
}
#pragma mark -
-#pragma mark TableView drag & drop delegate methods
+#pragma mark OutlineView drag & drop delegate methods
/**
* Allow for drag-n-drop out of the application as a copy
@@ -1243,14 +1253,13 @@
return NSDragOperationMove;
}
-
/**
- * Drag a table row item as spBundle
+ * Drag selected bundle as spBundle file to eg Finder
*/
-- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rows toPasteboard:(NSPasteboard*)aPboard
+- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
{
-
- if([commandsOutlineView numberOfSelectedRows] != 1 || [rows count] != 1) return NO;
+ if([commandsOutlineView numberOfSelectedRows] != 1 || [items count] != 1 ||
+ ![[items objectAtIndex:0] isLeaf]) return NO;
// Remove old temporary drag file if any
if(draggedFilePath) {
@@ -1262,13 +1271,12 @@
NSImage *dragImage;
NSPoint dragPosition;
- NSDictionary *bundleDict = [commandsOutlineView itemAtRow:[rows firstIndex]];
+ NSDictionary *bundleDict = [[items objectAtIndex:0] representedObject];
NSString *bundleFileName = [bundleDict objectForKey:kBundleNameKey];
NSString *possibleExisitingBundleFilePath = [NSString stringWithFormat:@"%@/%@.%@", bundlePath, bundleFileName, SPUserBundleFileExtension];
draggedFilePath = [[NSString stringWithFormat:@"/tmp/%@.%@", bundleFileName, SPUserBundleFileExtension] retain];
-
BOOL isDir;
// Copy possible existing bundle with content
@@ -1282,7 +1290,7 @@
// Write data to the pasteboard
NSArray *fileList = [NSArray arrayWithObjects:draggedFilePath, nil];
- NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+ // NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
[pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil];
[pboard setPropertyList:fileList forType:NSFilenamesPboardType];
@@ -1295,7 +1303,6 @@
event:[NSApp currentEvent] pasteboard:pboard source:[self window] slideBack:YES];
return YES;
-
}
#pragma mark -
@@ -1309,6 +1316,9 @@
[commandTextView setNeedsDisplay:YES];
}
+/**
+ * Group text changes to improve the undo behaviour
+ */
- (void)textDidChange:(NSNotification *)aNotification
{
@@ -1389,7 +1399,10 @@
@implementation SPBundleEditorController (PrivateAPI)
-- (void)_updateInputPopupButton
+/**
+ * Update various GUI elements due to scope or input changes
+ */
+- (void)_updateBundleDataView
{
NSInteger anIndex;
@@ -1410,6 +1423,7 @@
NSString *scope = [currentDict objectForKey:SPBundleFileScopeKey];
if(!scope) scope = SPBundleScopeGeneral;
+ // Update the scope popup button
if([scope isEqualToString:SPBundleScopeGeneral])
[scopePopupButton selectItemWithTag:kGeneralScopeArrayIndex];
else if([scope isEqualToString:SPBundleScopeInputField])
@@ -1419,8 +1433,7 @@
else
[scopePopupButton selectItemWithTag:kDisabledScopeTag];
- [currentDict setObject:[NSNumber numberWithBool:NO] forKey:SPBundleFileDisabledKey];
-
+ // Change due scope setting various popup buttons
switch([[scopePopupButton selectedItem] tag]) {
case kGeneralScopeArrayIndex: // General
[inputPopupButton setMenu:inputNonePopUpMenu];
@@ -1461,7 +1474,6 @@
[fallbackLabelField setHidden:YES];
break;
case kDisabledScopeTag: // Disable command
- [currentDict setObject:[NSNumber numberWithBool:YES] forKey:SPBundleFileDisabledKey];
break;
default:
[inputPopupButton setMenu:inputNonePopUpMenu];
@@ -1472,6 +1484,8 @@
[outputPopupButton selectItemAtIndex:anIndex];
}
+ // If input method is "Selected Text" display fallback input popup
+ // otherwise hide it
if([input isEqualToString:SPBundleInputSourceSelectedText]) {
[inputFallbackPopupButton setHidden:NO];
[fallbackLabelField setHidden:NO];
@@ -1480,21 +1494,31 @@
[fallbackLabelField setHidden:YES];
}
+ // Validate add and remove bundle button in left bar
[removeButton setEnabled:([[commandBundleTreeController selectedObjects] count] == 1 && ![[[commandBundleTreeController selectedObjects] objectAtIndex:0] objectForKey:kChildrenKey])];
[addButton setEnabled:([[commandBundleTreeController selectionIndexPath] length] > 1)];
}
+/**
+ * Return the current selected object as NSDictionary
+ */
- (id)_currentSelectedObject
{
return [[commandsOutlineView itemAtRow:[commandsOutlineView selectedRow]] representedObject];
}
-- (id)_currentSelectedNode
+/**
+ * Return the current selected object as NSTreeNode
+ */
+- (id)_currentSelectedNode
{
return [commandsOutlineView itemAtRow:[commandsOutlineView selectedRow]];
}
+/**
+ * Convert scope index from unsorted index to sorted (arranged) index
+ */
- (NSUInteger)_arrangedScopeIndexForScopeIndex:(NSUInteger)scopeIndex
{
@@ -1515,6 +1539,9 @@
}
+/**
+ * Convert scope index from sorted (arranged) index to unsorted index
+ */
- (NSUInteger)_scopeIndexForArrangedScopeIndex:(NSUInteger)scopeIndex
{
@@ -1528,8 +1555,32 @@
return k;
}
+/**
+ * Enable / disable data input
+ */
+- (void)_enableBundleDataInput:(BOOL)enabled
+{
+ [nameTextField setEnabled:enabled];
+ [inputPopupButton setEnabled:enabled];
+ [inputFallbackPopupButton setEnabled:enabled];
+ [scopePopupButton setEnabled:enabled];
+ [commandTextView setEditable:enabled];
+ [outputPopupButton setEnabled:enabled];
+ [disabledCheckbox setEnabled:enabled];
+ [keyEquivalentField setEnabled:enabled];
+ [categoryTextField setEnabled:enabled];
+ [tootlipTextField setEnabled:enabled];
+}
+
+/**
+ * Return that index for the unsorted scopeIndex and given category. If the category
+ * does not exist create a new category node.
+ */
- (NSUInteger)_arrangedCategoryIndexForScopeIndex:(NSUInteger)scopeIndex andCategory:(NSString*)category
{
+
+ if(!category || ![category length]) return NSNotFound;
+
NSString *unsortedBundleName = [[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:scopeIndex] objectForKey:kBundleNameKey];
if(!unsortedBundleName || ![unsortedBundleName length]) return scopeIndex;
@@ -1546,6 +1597,7 @@
}
returnIndex++;
}
+ // Not found ergo create it
NSMutableDictionary *newCat = [NSMutableDictionary dictionary];
[newCat setObject:category forKey:kBundleNameKey];
[newCat setObject:[NSMutableArray array] forKey:kChildrenKey];
@@ -1553,11 +1605,22 @@
newPath[0] = 0;
newPath[1] = k;
newPath[2] = 0;
+
+ // Add it
[[[j representedObject] objectForKey:kChildrenKey] addObject:newCat];
+
+ // Rearrange the tree
[commandBundleTreeController rearrangeObjects];
[commandsOutlineView reloadData];
- return [self _arrangedCategoryIndexForScopeIndex:scopeIndex andCategory:category];
+ // Find new position in sorted tree
+ returnIndex = 0;
+ for(id c in [j childNodes]) {
+ if([[[c representedObject] objectForKey:kBundleNameKey] isEqualToString:category] && [[c representedObject] objectForKey:kChildrenKey]) {
+ return returnIndex;
+ }
+ returnIndex++;
+ }
}
k++;
}