aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/Preferences.xib690
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPPreferenceController.h19
-rw-r--r--Source/SPPreferenceController.m596
5 files changed, 1046 insertions, 261 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib
index f44b75b9..46df42c1 100644
--- a/Interfaces/English.lproj/Preferences.xib
+++ b/Interfaces/English.lproj/Preferences.xib
@@ -21,7 +21,8 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1682"/>
+ <integer value="802"/>
+ <integer value="1717"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -604,7 +605,7 @@
<reference key="NSNextResponder" ref="594324362"/>
<int key="NSvFlags">12</int>
<string key="NSFrame">{{202.5, 176}, {360, 5}}</string>
- <string key="NSBounds">{{4, 0}, {352, 5}}</string>
+ <string key="NSBounds">{{5.5, 0}, {349, 5}}</string>
<reference key="NSSuperview" ref="594324362"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -3279,6 +3280,38 @@ AQAAAAA</bytes>
<int key="NSvFlags">268</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTextField" id="187965597">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{124, 28}, {121, 14}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="983858855">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272761856</int>
+ <string key="NSContents">theme name</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="187965597"/>
+ <reference key="NSBackgroundColor" ref="700609571"/>
+ <reference key="NSTextColor" ref="1035618107"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="919512780">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{49, 28}, {83, 14}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="133660147">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272761856</int>
+ <string key="NSContents">Color Theme:</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="919512780"/>
+ <reference key="NSBackgroundColor" ref="700609571"/>
+ <reference key="NSTextColor" ref="1035618107"/>
+ </object>
+ </object>
<object class="NSScrollView" id="288292400">
<reference key="NSNextResponder" ref="1033452264"/>
<int key="NSvFlags">268</int>
@@ -3401,7 +3434,7 @@ AQAAAAA</bytes>
<double key="NSPercent">0.57142859697341919</double>
</object>
</object>
- <string key="NSFrame">{{20, 20}, {222, 244}}</string>
+ <string key="NSFrame">{{20, 55}, {222, 244}}</string>
<reference key="NSSuperview" ref="1033452264"/>
<reference key="NSNextKeyView" ref="25515031"/>
<int key="NSsFlags">2</int>
@@ -3413,7 +3446,7 @@ AQAAAAA</bytes>
<object class="NSPopUpButton" id="748242000">
<reference key="NSNextResponder" ref="1033452264"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{204, 275}, {24, 24}}</string>
+ <string key="NSFrame">{{20, 23}, {24, 24}}</string>
<reference key="NSSuperview" ref="1033452264"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="373813305">
@@ -3450,9 +3483,47 @@ AQAAAAA</bytes>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="474302340"/>
+ <object class="NSMenuItem" id="1505">
+ <reference key="NSMenu" ref="28667448"/>
+ <string key="NSTitle">Save current Theme…</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="1039721224"/>
+ <reference key="NSMixedImage" ref="720177216"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="373813305"/>
+ </object>
+ <object class="NSMenuItem" id="191185083">
+ <reference key="NSMenu" ref="28667448"/>
+ <string key="NSTitle">Load saved Theme</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="1039721224"/>
+ <reference key="NSMixedImage" ref="720177216"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="476368233">
+ <string key="NSTitle">Load saved Theme</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <bool key="NSMenuExcludeMarkColumn">YES</bool>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="164147578">
+ <reference key="NSMenu" ref="28667448"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="1039721224"/>
+ <reference key="NSMixedImage" ref="720177216"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="373813305"/>
+ </object>
<object class="NSMenuItem" id="726637834">
<reference key="NSMenu" ref="28667448"/>
- <string key="NSTitle">Export Color Scheme…</string>
+ <string key="NSTitle">Export current Color Theme…</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -3464,7 +3535,7 @@ AQAAAAA</bytes>
</object>
<object class="NSMenuItem" id="62630352">
<reference key="NSMenu" ref="28667448"/>
- <string key="NSTitle">Import Color Scheme…</string>
+ <string key="NSTitle">Import Color Theme…</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -3477,6 +3548,7 @@ AQAAAAA</bytes>
</object>
<reference key="NSMenuFont" ref="320262838"/>
</object>
+ <int key="NSSelectedIndex">4</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -3605,26 +3677,6 @@ AQAAAAA</bytes>
<reference key="NSTextColor" ref="1035618107"/>
</object>
</object>
- <object class="NSButton" id="462361579">
- <reference key="NSNextResponder" ref="1033452264"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{26, 269}, {176, 32}}</string>
- <reference key="NSSuperview" ref="1033452264"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="603963569">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">Default Colors</string>
- <reference key="NSSupport" ref="320262838"/>
- <reference key="NSControlView" ref="462361579"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">129</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
<object class="NSButton" id="742042283">
<reference key="NSNextResponder" ref="1033452264"/>
<int key="NSvFlags">268</int>
@@ -4185,6 +4237,112 @@ AQAAAAA</bytes>
</object>
</object>
</object>
+ <object class="NSWindowTemplate" id="1034673896">
+ <int key="NSWindowStyleMask">1</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{343, 491}, {216, 104}}</string>
+ <int key="NSWTFlags">1886912512</int>
+ <string key="NSWindowTitle"/>
+ <string key="NSWindowClass">NSWindow</string>
+ <object class="NSMutableString" key="NSViewClass">
+ <characters key="NS.bytes">View</characters>
+ </object>
+ <string key="NSWindowContentMaxSize">{216, 104}</string>
+ <string key="NSWindowContentMinSize">{216, 104}</string>
+ <object class="NSView" key="NSWindowView" id="985350347">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTextField" id="294234359">
+ <reference key="NSNextResponder" ref="985350347"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{17, 76}, {182, 14}}</string>
+ <reference key="NSSuperview" ref="985350347"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="276434863">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">4195328</int>
+ <string key="NSContents">Name:</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="294234359"/>
+ <reference key="NSBackgroundColor" ref="700609571"/>
+ <reference key="NSTextColor" ref="1035618107"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="336557380">
+ <reference key="NSNextResponder" ref="985350347"/>
+ <int key="NSvFlags">258</int>
+ <string key="NSFrame">{{20, 50}, {176, 18}}</string>
+ <reference key="NSSuperview" ref="985350347"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="17465994">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">4326400</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="336557380"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="1001357688"/>
+ <reference key="NSTextColor" ref="6928728"/>
+ </object>
+ </object>
+ <object class="NSButton" id="107835671">
+ <reference key="NSNextResponder" ref="985350347"/>
+ <int key="NSvFlags">259</int>
+ <string key="NSFrame">{{113, 13}, {88, 28}}</string>
+ <reference key="NSSuperview" ref="985350347"/>
+ <int key="NSTag">1</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="460571945">
+ <int key="NSCellFlags">604110336</int>
+ <int key="NSCellFlags2">138018816</int>
+ <string key="NSContents">Save</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="107835671"/>
+ <int key="NSTag">1</int>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <object class="NSFont" key="NSAlternateImage" id="937783764">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">11</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="76427887">
+ <reference key="NSNextResponder" ref="985350347"/>
+ <int key="NSvFlags">259</int>
+ <string key="NSFrame">{{15, 13}, {88, 28}}</string>
+ <reference key="NSSuperview" ref="985350347"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="748282128">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">138018816</int>
+ <string key="NSContents">Cancel</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="76427887"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="937783764"/>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{216, 104}</string>
+ <reference key="NSSuperview"/>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
+ <string key="NSMinSize">{216, 126}</string>
+ <string key="NSMaxSize">{216, 126}</string>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -4788,14 +4946,6 @@ AQAAAAA</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">setDefaultColors:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="462361579"/>
- </object>
- <int key="connectionID">1086</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
<string key="label">showCustomQueryFontPanel:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="742042283"/>
@@ -6354,6 +6504,143 @@ AQAAAAA</bytes>
</object>
<int key="connectionID">1693</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">saveColorScheme:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1505"/>
+ </object>
+ <int key="connectionID">1713</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">themeSelectionMenu</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="476368233"/>
+ </object>
+ <int key="connectionID">1715</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">nextKeyView</string>
+ <reference key="source" ref="76427887"/>
+ <reference key="destination" ref="107835671"/>
+ </object>
+ <int key="connectionID">1733</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">nextKeyView</string>
+ <reference key="source" ref="107835671"/>
+ <reference key="destination" ref="336557380"/>
+ </object>
+ <int key="connectionID">1734</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enterNameWindow</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1034673896"/>
+ </object>
+ <int key="connectionID">1735</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enterNameLabel</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="294234359"/>
+ </object>
+ <int key="connectionID">1736</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enterNameInputField</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="336557380"/>
+ </object>
+ <int key="connectionID">1737</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">colorThemeName</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="187965597"/>
+ </object>
+ <int key="connectionID">1742</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">colorThemeNameLabel</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="919512780"/>
+ </object>
+ <int key="connectionID">1743</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CustomQueryEditorThemeName</string>
+ <reference key="source" ref="187965597"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="187965597"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">value: values.CustomQueryEditorThemeName</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CustomQueryEditorThemeName</string>
+ <object class="NSDictionary" key="NSOptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMultipleValuesPlaceholder</string>
+ <string>NSNoSelectionPlaceholder</string>
+ <string>NSNotApplicablePlaceholder</string>
+ <string>NSNullPlaceholder</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>User-defined</string>
+ <string>User-defined</string>
+ <string>User-defined</string>
+ <string>User-defined</string>
+ </object>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1751</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">closePanelSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="76427887"/>
+ </object>
+ <int key="connectionID">1752</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">closePanelSheet:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="107835671"/>
+ </object>
+ <int key="connectionID">1753</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">themeNameSaveButton</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="107835671"/>
+ </object>
+ <int key="connectionID">1754</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="336557380"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">1755</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -7296,9 +7583,10 @@ AQAAAAA</bytes>
<reference ref="774563613"/>
<reference ref="782193237"/>
<reference ref="742042283"/>
- <reference ref="462361579"/>
- <reference ref="748242000"/>
<reference ref="288292400"/>
+ <reference ref="748242000"/>
+ <reference ref="919512780"/>
+ <reference ref="187965597"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">Editor</string>
@@ -7341,15 +7629,6 @@ AQAAAAA</bytes>
<reference key="parent" ref="1033452264"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">1035</int>
- <reference key="object" ref="462361579"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="603963569"/>
- </object>
- <reference key="parent" ref="1033452264"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">1036</int>
<reference key="object" ref="742042283"/>
<object class="NSMutableArray" key="children">
@@ -7448,11 +7727,6 @@ AQAAAAA</bytes>
<reference key="parent" ref="742042283"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">1059</int>
- <reference key="object" ref="603963569"/>
- <reference key="parent" ref="462361579"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">1060</int>
<reference key="object" ref="10706281"/>
<reference key="parent" ref="676806550"/>
@@ -8947,6 +9221,9 @@ AQAAAAA</bytes>
<reference ref="474302340"/>
<reference ref="726637834"/>
<reference ref="62630352"/>
+ <reference ref="1505"/>
+ <reference ref="191185083"/>
+ <reference ref="164147578"/>
</object>
<reference key="parent" ref="373813305"/>
</object>
@@ -9024,6 +9301,139 @@ AQAAAAA</bytes>
<reference key="object" ref="208478618"/>
<reference key="parent" ref="1021385850"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1708</int>
+ <reference key="object" ref="1505"/>
+ <reference key="parent" ref="28667448"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1709</int>
+ <reference key="object" ref="191185083"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="476368233"/>
+ </object>
+ <reference key="parent" ref="28667448"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1710</int>
+ <reference key="object" ref="476368233"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="parent" ref="191185083"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1712</int>
+ <reference key="object" ref="164147578"/>
+ <reference key="parent" ref="28667448"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1716</int>
+ <reference key="object" ref="1034673896"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="985350347"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Enter Name Sheet</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1717</int>
+ <reference key="object" ref="985350347"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="107835671"/>
+ <reference ref="294234359"/>
+ <reference ref="76427887"/>
+ <reference ref="336557380"/>
+ </object>
+ <reference key="parent" ref="1034673896"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1718</int>
+ <reference key="object" ref="107835671"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="460571945"/>
+ </object>
+ <reference key="parent" ref="985350347"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1721</int>
+ <reference key="object" ref="294234359"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="276434863"/>
+ </object>
+ <reference key="parent" ref="985350347"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1722</int>
+ <reference key="object" ref="336557380"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="17465994"/>
+ </object>
+ <reference key="parent" ref="985350347"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1723</int>
+ <reference key="object" ref="76427887"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="748282128"/>
+ </object>
+ <reference key="parent" ref="985350347"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1724</int>
+ <reference key="object" ref="748282128"/>
+ <reference key="parent" ref="76427887"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1725</int>
+ <reference key="object" ref="17465994"/>
+ <reference key="parent" ref="336557380"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1726</int>
+ <reference key="object" ref="276434863"/>
+ <reference key="parent" ref="294234359"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1730</int>
+ <reference key="object" ref="460571945"/>
+ <reference key="parent" ref="107835671"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1738</int>
+ <reference key="object" ref="919512780"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="133660147"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1739</int>
+ <reference key="object" ref="133660147"/>
+ <reference key="parent" ref="919512780"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1740</int>
+ <reference key="object" ref="187965597"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="983858855"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1741</int>
+ <reference key="object" ref="983858855"/>
+ <reference key="parent" ref="187965597"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -9045,7 +9455,6 @@ AQAAAAA</bytes>
<string>102.IBPluginDependency</string>
<string>102.ImportedFromIB2</string>
<string>1034.IBPluginDependency</string>
- <string>1035.IBPluginDependency</string>
<string>1036.IBPluginDependency</string>
<string>1037.IBPluginDependency</string>
<string>1039.IBPluginDependency</string>
@@ -9068,7 +9477,6 @@ AQAAAAA</bytes>
<string>1055.IBPluginDependency</string>
<string>1057.IBPluginDependency</string>
<string>1058.IBPluginDependency</string>
- <string>1059.IBPluginDependency</string>
<string>1060.IBPluginDependency</string>
<string>1083.IBPluginDependency</string>
<string>1084.IBPluginDependency</string>
@@ -9276,6 +9684,7 @@ AQAAAAA</bytes>
<string>1672.IBPluginDependency</string>
<string>1673.IBAttributePlaceholdersKey</string>
<string>1673.IBPluginDependency</string>
+ <string>1674.IBAttributePlaceholdersKey</string>
<string>1674.IBPluginDependency</string>
<string>1682.IBPluginDependency</string>
<string>1683.IBPluginDependency</string>
@@ -9288,6 +9697,39 @@ AQAAAAA</bytes>
<string>17.IBEditorWindowLastContentRect</string>
<string>17.IBPluginDependency</string>
<string>17.IBUserGuides</string>
+ <string>1708.IBAttributePlaceholdersKey</string>
+ <string>1708.IBPluginDependency</string>
+ <string>1709.IBPluginDependency</string>
+ <string>1710.IBEditorWindowLastContentRect</string>
+ <string>1710.IBPluginDependency</string>
+ <string>1712.IBPluginDependency</string>
+ <string>1716.IBEditorWindowLastContentRect</string>
+ <string>1716.IBPluginDependency</string>
+ <string>1716.IBWindowTemplateEditedContentRect</string>
+ <string>1716.ImportedFromIB2</string>
+ <string>1716.windowTemplate.hasMaxSize</string>
+ <string>1716.windowTemplate.hasMinSize</string>
+ <string>1716.windowTemplate.maxSize</string>
+ <string>1716.windowTemplate.minSize</string>
+ <string>1717.IBPluginDependency</string>
+ <string>1717.ImportedFromIB2</string>
+ <string>1718.IBPluginDependency</string>
+ <string>1718.ImportedFromIB2</string>
+ <string>1721.IBPluginDependency</string>
+ <string>1721.ImportedFromIB2</string>
+ <string>1722.IBPluginDependency</string>
+ <string>1722.ImportedFromIB2</string>
+ <string>1723.IBPluginDependency</string>
+ <string>1723.ImportedFromIB2</string>
+ <string>1724.IBPluginDependency</string>
+ <string>1725.IBPluginDependency</string>
+ <string>1726.IBPluginDependency</string>
+ <string>1730.IBPluginDependency</string>
+ <string>1738.IBPluginDependency</string>
+ <string>1739.IBPluginDependency</string>
+ <string>1740.IBAttributePlaceholdersKey</string>
+ <string>1740.IBPluginDependency</string>
+ <string>1741.IBPluginDependency</string>
<string>2.IBPluginDependency</string>
<string>24.IBPluginDependency</string>
<string>24.ImportedFromIB2</string>
@@ -9555,7 +9997,6 @@ AQAAAAA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -9585,7 +10026,6 @@ AQAAAAA</bytes>
<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 class="NSMutableDictionary">
<string key="NS.key.0">InitialTabViewItem</string>
<object class="IBInitialTabViewItemAttribute" key="NS.object.0">
@@ -9791,22 +10231,31 @@ AQAAAAA</bytes>
<object class="IBToolTipAttribute" key="NS.object.0">
<string key="name">ToolTip</string>
<reference key="object" ref="748242000"/>
- <string key="toolTip">Export/Import Color Scheme</string>
+ <string key="toolTip">Manage Color Theme</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{214, 248}, {184, 71}}</string>
+ <string>{{127, 100}, {220, 115}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="726637834"/>
+ <string key="toolTip">Export the current set color theme as 'spTheme' to disk</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="62630352"/>
+ <string key="toolTip">Import a theme saved as 'spTheme' or 'tmTheme' (TextMate™) file</string>
+ </object>
+ </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -9826,6 +10275,53 @@ AQAAAAA</bytes>
<int key="affinity">0</int>
</object>
</object>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="1505"/>
+ <string key="toolTip">Save the current set color theme by providing an unique name into Sequel Pro's Application Support folder</string>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{352, 158}, {64, 6}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{202, 175}, {216, 104}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{202, 175}, {216, 104}}</string>
+ <integer value="1"/>
+ <boolean value="YES"/>
+ <boolean value="YES"/>
+ <string>{216, 104}</string>
+ <string>{216, 104}</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>
+ <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>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="187965597"/>
+ <string key="toolTip">The name of the current set color theme</string>
+ </object>
+ </object>
+ <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"/>
@@ -10106,7 +10602,7 @@ AQAAAAA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{286, 395}, {580, 361}}</string>
+ <string>{{118, 168}, {580, 361}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableArray">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -10159,7 +10655,7 @@ AQAAAAA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">1707</int>
+ <int key="maxID">1755</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -10667,6 +11163,7 @@ AQAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addFavorite:</string>
<string>changeFont:</string>
+ <string>closePanelSheet:</string>
<string>displayAutoUpdatePreferences:</string>
<string>displayEditorPreferences:</string>
<string>displayFavoritePreferences:</string>
@@ -10678,9 +11175,11 @@ AQAAAAA</bytes>
<string>exportColorScheme:</string>
<string>favoriteTypeDidChange:</string>
<string>importColorScheme:</string>
+ <string>loadColorScheme:</string>
<string>makeSelectedFavoriteDefault:</string>
<string>removeFavorite:</string>
<string>reverseFavoritesSortOrder:</string>
+ <string>saveColorScheme:</string>
<string>setDefaultColors:</string>
<string>showCustomQueryFontPanel:</string>
<string>showGlobalResultTableFontPanel:</string>
@@ -10710,6 +11209,9 @@ AQAAAAA</bytes>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
@@ -10718,6 +11220,7 @@ AQAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>addFavorite:</string>
<string>changeFont:</string>
+ <string>closePanelSheet:</string>
<string>displayAutoUpdatePreferences:</string>
<string>displayEditorPreferences:</string>
<string>displayFavoritePreferences:</string>
@@ -10729,9 +11232,11 @@ AQAAAAA</bytes>
<string>exportColorScheme:</string>
<string>favoriteTypeDidChange:</string>
<string>importColorScheme:</string>
+ <string>loadColorScheme:</string>
<string>makeSelectedFavoriteDefault:</string>
<string>removeFavorite:</string>
<string>reverseFavoritesSortOrder:</string>
+ <string>saveColorScheme:</string>
<string>setDefaultColors:</string>
<string>showCustomQueryFontPanel:</string>
<string>showGlobalResultTableFontPanel:</string>
@@ -10749,6 +11254,10 @@ AQAAAAA</bytes>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
+ <string key="name">closePanelSheet:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">displayAutoUpdatePreferences:</string>
<string key="candidateClassName">id</string>
</object>
@@ -10793,6 +11302,10 @@ AQAAAAA</bytes>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
+ <string key="name">loadColorScheme:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">makeSelectedFavoriteDefault:</string>
<string key="candidateClassName">id</string>
</object>
@@ -10805,6 +11318,10 @@ AQAAAAA</bytes>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
+ <string key="name">saveColorScheme:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">setDefaultColors:</string>
<string key="candidateClassName">id</string>
</object>
@@ -10832,9 +11349,14 @@ AQAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>autoUpdateView</string>
<string>colorSettingTableView</string>
+ <string>colorThemeName</string>
+ <string>colorThemeNameLabel</string>
<string>defaultFavoritePopup</string>
<string>editorFontName</string>
<string>editorView</string>
+ <string>enterNameInputField</string>
+ <string>enterNameLabel</string>
+ <string>enterNameWindow</string>
<string>favoriteHostTextField</string>
<string>favoriteHostTextFieldSSH</string>
<string>favoriteNameTextField</string>
@@ -10858,16 +11380,23 @@ AQAAAAA</bytes>
<string>standardPasswordField</string>
<string>tableCell</string>
<string>tablesView</string>
+ <string>themeNameSaveButton</string>
+ <string>themeSelectionMenu</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSView</string>
<string>NSTableView</string>
+ <string>NSTextField</string>
+ <string>NSTextField</string>
<string>NSPopUpButton</string>
<string>NSTextField</string>
<string>NSView</string>
<string>NSTextField</string>
<string>NSTextField</string>
+ <string>NSWindow</string>
+ <string>NSTextField</string>
+ <string>NSTextField</string>
<string>NSTextField</string>
<string>NSTextField</string>
<string>NSTextField</string>
@@ -10889,6 +11418,8 @@ AQAAAAA</bytes>
<string>NSSecureTextField</string>
<string>id</string>
<string>NSView</string>
+ <string>id</string>
+ <string>NSMenu</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -10897,9 +11428,14 @@ AQAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>autoUpdateView</string>
<string>colorSettingTableView</string>
+ <string>colorThemeName</string>
+ <string>colorThemeNameLabel</string>
<string>defaultFavoritePopup</string>
<string>editorFontName</string>
<string>editorView</string>
+ <string>enterNameInputField</string>
+ <string>enterNameLabel</string>
+ <string>enterNameWindow</string>
<string>favoriteHostTextField</string>
<string>favoriteHostTextFieldSSH</string>
<string>favoriteNameTextField</string>
@@ -10923,6 +11459,8 @@ AQAAAAA</bytes>
<string>standardPasswordField</string>
<string>tableCell</string>
<string>tablesView</string>
+ <string>themeNameSaveButton</string>
+ <string>themeSelectionMenu</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -10935,6 +11473,14 @@ AQAAAAA</bytes>
<string key="candidateClassName">NSTableView</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">colorThemeName</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">colorThemeNameLabel</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">defaultFavoritePopup</string>
<string key="candidateClassName">NSPopUpButton</string>
</object>
@@ -10947,6 +11493,18 @@ AQAAAAA</bytes>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">enterNameInputField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">enterNameLabel</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">enterNameWindow</string>
+ <string key="candidateClassName">NSWindow</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">favoriteHostTextField</string>
<string key="candidateClassName">NSTextField</string>
</object>
@@ -11038,6 +11596,14 @@ AQAAAAA</bytes>
<string key="name">tablesView</string>
<string key="candidateClassName">NSView</string>
</object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">themeNameSaveButton</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">themeSelectionMenu</string>
+ <string key="candidateClassName">NSMenu</string>
+ </object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 58630aa6..9086128a 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -296,6 +296,7 @@ extern NSString *SPCustomQueryEditorTabStopWidth;
extern NSString *SPCustomQueryAutoComplete;
extern NSString *SPCustomQueryAutoCompleteDelay;
extern NSString *SPCustomQueryFunctionCompletionInsertsArguments;
+extern NSString *SPCustomQueryEditorThemeName;
// AutoUpdate Prefpane
extern NSString *SPLastUsedVersion;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index f9865eb6..8fa5aadd 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -119,6 +119,7 @@ NSString *SPCustomQueryEditorTabStopWidth = @"CustomQueryEditorTabStopWid
NSString *SPCustomQueryAutoComplete = @"CustomQueryAutoComplete";
NSString *SPCustomQueryAutoCompleteDelay = @"CustomQueryAutoCompleteDelay";
NSString *SPCustomQueryFunctionCompletionInsertsArguments = @"CustomQueryFunctionCompletionInsertsArguments";
+NSString *SPCustomQueryEditorThemeName = @"CustomQueryEditorThemeName";
// AutoUpdate Prefpane
NSString *SPLastUsedVersion = @"LastUsedVersion";
diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h
index 428bfd6d..8dae6077 100644
--- a/Source/SPPreferenceController.h
+++ b/Source/SPPreferenceController.h
@@ -59,9 +59,17 @@
IBOutlet NSTextField *favoriteHostTextFieldSSH;
IBOutlet NSMenuItem *favoritesSortByMenuItem;
+ IBOutlet NSWindow *enterNameWindow;
+ IBOutlet NSTextField *enterNameLabel;
+ IBOutlet NSTextField *enterNameInputField;
+ IBOutlet NSTextField *colorThemeName;
+ IBOutlet NSTextField *colorThemeNameLabel;
+ IBOutlet id themeNameSaveButton;
+
IBOutlet id tableCell;
IBOutlet NSTableView *colorSettingTableView;
+ IBOutlet NSMenu *themeSelectionMenu;
NSArray *editorColors;
NSArray *editorNameForColors;
NSUInteger colorRow;
@@ -92,6 +100,8 @@
BOOL reverseFavoritesSort;
SPFavoritesSortItem previousSortItem, currentSortItem;
+
+ NSString *themePath;
}
- (void)applyRevisionChanges;
@@ -109,6 +119,9 @@
- (IBAction)makeSelectedFavoriteDefault:(id)sender;
- (IBAction)exportColorScheme:(id)sender;
- (IBAction)importColorScheme:(id)sender;
+- (IBAction)saveColorScheme:(id)sender;
+- (IBAction)loadColorScheme:(id)sender;
+- (IBAction)closePanelSheet:(id)sender;
// Toolbar item IBAction methods
@@ -126,5 +139,11 @@
- (void)changeFont:(id)sender;
- (IBAction)favoriteTypeDidChange:(id)sender;
- (void)updateFavoritePasswordsFromField:(NSControl *)passwordControl;
+- (void)updateColorSchemeSelectionMenu;
+- (void)saveColorThemeAtPath:(NSString*)path;
+- (BOOL)loadColorSchemeFromFile:(NSString*)filename;
+- (BOOL)checkForUnsavedTheme;
+- (void)updateDisplayColorThemeName;
+- (NSArray *)getAvailableThemes;
@end
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index ad8d6bb8..19cfbfd0 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -60,9 +60,13 @@
favoriteType = 0;
fontChangeTarget = 0;
reverseFavoritesSort = NO;
-
+
previousSortItem = SPFavoritesSortNameItem;
+
[NSColor setIgnoresAlpha:NO];
+
+ themePath = [[[NSString stringWithString:@"~/Library/Application Support/Sequel Pro/Themes"] stringByExpandingTildeInPath] retain];
+
}
return self;
@@ -568,6 +572,10 @@
- (IBAction)importColorScheme:(id)sender
{
+
+ if(![self checkForUnsavedTheme]) return;
+
+
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanSelectHiddenExtension:YES];
[panel setDelegate:self];
@@ -584,6 +592,39 @@
}
+- (IBAction)loadColorScheme:(id)sender
+{
+
+ if(![self checkForUnsavedTheme]) return;
+
+ if([self loadColorSchemeFromFile:[NSString stringWithFormat:@"%@/%@.%@", themePath, [sender title], SPColorThemeFileExtension]]) {
+ [prefs setObject:[sender title] forKey:SPCustomQueryEditorThemeName];
+ [self updateDisplayColorThemeName];
+ }
+
+}
+
+- (IBAction)saveColorScheme:(id)sender
+{
+
+ [[NSColorPanel sharedColorPanel] close];
+
+ [enterNameLabel setStringValue:NSLocalizedString(@"Theme Name:", @"theme name label")];
+
+ [NSApp beginSheet:enterNameWindow
+ modalForWindow:[self window]
+ modalDelegate:self
+ didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
+ contextInfo:@"saveTheme"];
+
+}
+
+- (IBAction)closePanelSheet:(id)sender
+{
+ [NSApp endSheet:[sender window] returnCode:[sender tag]];
+ [[sender window] orderOut:self];
+}
+
#pragma mark -
#pragma mark Toolbar item IBAction methods
@@ -618,6 +659,10 @@
// -------------------------------------------------------------------------------
- (IBAction)displayEditorPreferences:(id)sender
{
+
+ [self updateColorSchemeSelectionMenu];
+ [self updateDisplayColorThemeName];
+
[[self window] setMinSize:NSMakeSize(0, 0)];
[[self window] setShowsResizeIndicator:NO];
@@ -1041,6 +1086,27 @@
- (void)controlTextDidChange:(NSNotification *)aNotification
{
id field = [aNotification object];
+
+ // Validate 'Save' button for entering a valid theme name
+ if(field == enterNameInputField) {
+ NSString *name = [[enterNameInputField stringValue] lowercaseString];
+
+ if(![name length] || [name isEqualToString:@"default"] || [name isEqualToString:@"user-defined"]) {
+ [themeNameSaveButton setEnabled:NO];
+ } else {
+ BOOL enable = YES;
+ for(NSString* item in [self getAvailableThemes]) {
+ if([[item lowercaseString] isEqualToString:name]) {
+ enable = NO;
+ break;
+ }
+ }
+ [themeNameSaveButton setEnabled:enable];
+ }
+
+ return;
+
+ }
BOOL nameFieldIsEmpty = (
[[favoritesController valueForKeyPath:@"selection.name"] isEqualToString:@""]
@@ -1279,7 +1345,22 @@
[self updateDefaultFavoritePopup];
}
+ } else if([contextInfo isEqualToString:@"saveTheme"]) {
+ if (returnCode == NSOKButton) {
+ NSFileManager *fm = [NSFileManager defaultManager];
+ if(![fm fileExistsAtPath:themePath isDirectory:nil]) {
+ if(![fm createDirectoryAtPath:themePath withIntermediateDirectories:YES attributes:nil error:nil]) {
+ NSBeep();
+ return;
+ }
+ }
+ [self saveColorThemeAtPath:[NSString stringWithFormat:@"%@/%@.%@", themePath, [enterNameInputField stringValue], SPColorThemeFileExtension]];
+ [self updateColorSchemeSelectionMenu];
+ [prefs setObject:[enterNameInputField stringValue] forKey:SPCustomQueryEditorThemeName];
+ [self updateDisplayColorThemeName];
+ }
}
+
}
- (void)setGrowlEnabled:(BOOL)value
@@ -1300,7 +1381,82 @@
return [prefs boolForKey:SPGrowlEnabled];
}
+- (void)editThemeList
+{
+ NSAlert *alert = [NSAlert alertWithMessageText:@"Not yet implemented. Please be patient."
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:@""];
+
+ [alert setAlertStyle:NSCriticalAlertStyle];
+ [alert runModal];
+}
+
+- (NSArray *)getAvailableThemes
+{
+ // Read ~/Library/Application Support/Sequel Pro/Themes
+ NSFileManager *fm = [NSFileManager defaultManager];
+ if([fm fileExistsAtPath:themePath isDirectory:nil]) {
+ NSArray *allItemsRaw = [fm contentsOfDirectoryAtPath:themePath error:NULL];
+ if(!allItemsRaw) return [NSArray array];
+
+ // Filter out all themes
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH %@", [NSString stringWithFormat:@".%@", SPColorThemeFileExtension]];
+ NSMutableArray *allItems = [NSMutableArray arrayWithArray:allItemsRaw];
+ [allItems filterUsingPredicate:predicate];
+
+ allItemsRaw = [NSArray arrayWithArray:allItems];
+ [allItems removeAllObjects];
+
+ // Remove file extension
+ for(NSString* item in allItemsRaw)
+ [allItems addObject:[item substringToIndex:[item length]-[SPColorThemeFileExtension length]-1]];
+
+ return (NSArray *)allItems;
+ }
+ return [NSArray array];
+}
+
+- (void)updateColorSchemeSelectionMenu
+{
+
+ // Build theme selection submenu
+ [themeSelectionMenu removeAllItems];
+ [themeSelectionMenu setAutoenablesItems:YES];
+ [themeSelectionMenu setShowsStateColumn:YES];
+ [themeSelectionMenu addItemWithTitle:NSLocalizedString(@"Default", @"default color scheme label") action:@selector(setDefaultColors:) keyEquivalent:@""];
+ [themeSelectionMenu addItem:[NSMenuItem separatorItem]];
+
+ NSArray *foundThemes = [self getAvailableThemes];
+ if([foundThemes count]) {
+ for(NSString* item in foundThemes)
+ [themeSelectionMenu addItemWithTitle:item action:@selector(loadColorScheme:) keyEquivalent:@""];
+ [themeSelectionMenu addItem:[NSMenuItem separatorItem]];
+ }
+ [themeSelectionMenu addItemWithTitle:NSLocalizedString(@"Edit Theme List…", @"edit theme list label") action:@selector(editThemeList) keyEquivalent:@""];
+
+}
+- (void)updateDisplayColorThemeName
+{
+
+ if(![prefs objectForKey:SPCustomQueryEditorThemeName]) {
+ [colorThemeName setHidden:YES];
+ [colorThemeNameLabel setHidden:YES];
+ return;
+ }
+
+ if([[[prefs objectForKey:SPCustomQueryEditorThemeName] lowercaseString] isEqualToString:@"user-defined"]) {
+ [colorThemeName setHidden:YES];
+ [colorThemeNameLabel setHidden:YES];
+ return;
+ }
+
+ [colorThemeName setHidden:NO];
+ [colorThemeNameLabel setHidden:NO];
+
+}
// -------------------------------------------------------------------------------
// updateDefaultFavoritePopup:
//
@@ -1375,7 +1531,11 @@
// reset syntax highlighting colors
- (IBAction)setDefaultColors:(id)sender
{
+
+ if(![self checkForUnsavedTheme]) return;
+
[[NSColorPanel sharedColorPanel] close];
+ [prefs setObject:@"Default" forKey:SPCustomQueryEditorThemeName];
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithDeviceRed:0.000 green:0.455 blue:0.000 alpha:1.000]] forKey:SPCustomQueryEditorCommentColor];
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithDeviceRed:0.769 green:0.102 blue:0.086 alpha:1.000]] forKey:SPCustomQueryEditorQuoteColor];
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithDeviceRed:0.200 green:0.250 blue:1.000 alpha:1.000]] forKey:SPCustomQueryEditorSQLKeywordColor];
@@ -1388,6 +1548,7 @@
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor blackColor]] forKey:SPCustomQueryEditorCaretColor];
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]] forKey:SPCustomQueryEditorBackgroundColor];
[colorSettingTableView reloadData];
+ [self updateDisplayColorThemeName];
}
- (void)colorClick:(id)sender
@@ -1409,6 +1570,8 @@
if(![[NSColorPanel sharedColorPanel] isVisible]) return;
[prefs setObject:[NSArchiver archivedDataWithRootObject:[sender color]] forKey:[editorColors objectAtIndex:colorRow]];
[colorSettingTableView reloadData];
+ [prefs setObject:@"User-defined" forKey:SPCustomQueryEditorThemeName];
+ [self updateDisplayColorThemeName];
}
@@ -1473,226 +1636,260 @@
return YES;
}
-/**
- * Save panel did end method.
- */
-- (void)panelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
+- (void)saveColorThemeAtPath:(NSString*)path
{
+ // Build plist dictionary
+ NSMutableDictionary *scheme = [NSMutableDictionary dictionary];
+ NSMutableDictionary *mainsettings = [NSMutableDictionary dictionary];
+ NSMutableArray *settings = [NSMutableArray array];
- if([contextInfo isEqualToString:@"exportColorScheme"]) {
- if (returnCode == NSOKButton) {
+ CGFloat red, green, blue, alpha;
+ NSInteger redInt, greenInt, blueInt, alphaInt;
+ NSString *redHexValue, *greenHexValue, *blueHexValue, *alphaHexValue;
+
+ [prefs synchronize];
- // Build plist dictionary
- NSMutableDictionary *scheme = [NSMutableDictionary dictionary];
- NSMutableDictionary *mainsettings = [NSMutableDictionary dictionary];
- NSMutableArray *settings = [NSMutableArray array];
+ NSColor *aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]];
+ [mainsettings setObject:[aColor rgbHexString] forKey:@"background"];
- CGFloat red, green, blue, alpha;
- NSInteger redInt, greenInt, blueInt, alphaInt;
- NSString *redHexValue, *greenHexValue, *blueHexValue, *alphaHexValue;
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCaretColor]];
+ [mainsettings setObject:[aColor rgbHexString] forKey:@"caret"];
- [prefs synchronize];
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]];
+ [mainsettings setObject:[aColor rgbHexString] forKey:@"foreground"];
- NSColor *aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]];
- [mainsettings setObject:[aColor rgbHexString] forKey:@"background"];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCaretColor]];
- [mainsettings setObject:[aColor rgbHexString] forKey:@"caret"];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]];
- [mainsettings setObject:[aColor rgbHexString] forKey:@"foreground"];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorHighlightQueryColor]];
- [mainsettings setObject:[aColor rgbHexString] forKey:@"lineHighlight"];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSelectionColor]];
- [mainsettings setObject:[aColor rgbHexString] forKey:@"selection"];
-
- [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:mainsettings, @"settings", nil]];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCommentColor]];
- [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"Comment", @"name",
- [NSDictionary dictionaryWithObjectsAndKeys:
- [aColor rgbHexString], @"foreground",
- nil
- ], @"settings",
- nil
- ]];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorQuoteColor]];
- [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"String", @"name",
- [NSDictionary dictionaryWithObjectsAndKeys:
- [aColor rgbHexString], @"foreground",
- nil
- ], @"settings",
- nil
- ]];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSQLKeywordColor]];
- [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"Keyword", @"name",
- [NSDictionary dictionaryWithObjectsAndKeys:
- [aColor rgbHexString], @"foreground",
- nil
- ], @"settings",
- nil
- ]];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBacktickColor]];
- [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"User-defined constant", @"name",
- [NSDictionary dictionaryWithObjectsAndKeys:
- [aColor rgbHexString], @"foreground",
- nil
- ], @"settings",
- nil
- ]];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorNumericColor]];
- [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"Number", @"name",
- [NSDictionary dictionaryWithObjectsAndKeys:
- [aColor rgbHexString], @"foreground",
- nil
- ], @"settings",
- nil
- ]];
-
- aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorVariableColor]];
- [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"Variable", @"name",
- [NSDictionary dictionaryWithObjectsAndKeys:
- [aColor rgbHexString], @"foreground",
- nil
- ], @"settings",
- nil
- ]];
-
- [scheme setObject:settings forKey:@"settings"];
-
- NSString *err = nil;
- NSData *plist = [NSPropertyListSerialization dataFromPropertyList:scheme
- format:NSPropertyListXMLFormat_v1_0
- errorDescription:&err];
-
- if(err != nil) {
- NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while converting color scheme data", @"error while converting color scheme data")]
- defaultButton:NSLocalizedString(@"OK", @"OK button")
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:err];
-
- [alert setAlertStyle:NSCriticalAlertStyle];
- [alert runModal];
- return;
- }
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorHighlightQueryColor]];
+ [mainsettings setObject:[aColor rgbHexString] forKey:@"lineHighlight"];
+
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSelectionColor]];
+ [mainsettings setObject:[aColor rgbHexString] forKey:@"selection"];
+
+ [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:mainsettings, @"settings", nil]];
+
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCommentColor]];
+ [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ @"Comment", @"name",
+ [NSDictionary dictionaryWithObjectsAndKeys:
+ [aColor rgbHexString], @"foreground",
+ nil
+ ], @"settings",
+ nil
+ ]];
+
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorQuoteColor]];
+ [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ @"String", @"name",
+ [NSDictionary dictionaryWithObjectsAndKeys:
+ [aColor rgbHexString], @"foreground",
+ nil
+ ], @"settings",
+ nil
+ ]];
+
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSQLKeywordColor]];
+ [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ @"Keyword", @"name",
+ [NSDictionary dictionaryWithObjectsAndKeys:
+ [aColor rgbHexString], @"foreground",
+ nil
+ ], @"settings",
+ nil
+ ]];
- NSError *error = nil;
- [plist writeToFile:[panel filename] options:NSAtomicWrite error:&error];
- if (error) [[NSAlert alertWithError:error] runModal];
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBacktickColor]];
+ [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ @"User-defined constant", @"name",
+ [NSDictionary dictionaryWithObjectsAndKeys:
+ [aColor rgbHexString], @"foreground",
+ nil
+ ], @"settings",
+ nil
+ ]];
+
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorNumericColor]];
+ [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ @"Number", @"name",
+ [NSDictionary dictionaryWithObjectsAndKeys:
+ [aColor rgbHexString], @"foreground",
+ nil
+ ], @"settings",
+ nil
+ ]];
+
+ aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorVariableColor]];
+ [settings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ @"Variable", @"name",
+ [NSDictionary dictionaryWithObjectsAndKeys:
+ [aColor rgbHexString], @"foreground",
+ nil
+ ], @"settings",
+ nil
+ ]];
+
+ [scheme setObject:settings forKey:@"settings"];
+
+ NSString *err = nil;
+ NSData *plist = [NSPropertyListSerialization dataFromPropertyList:scheme
+ format:NSPropertyListXMLFormat_v1_0
+ errorDescription:&err];
+
+ if(err != nil) {
+ NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while converting color scheme data", @"error while converting color scheme data")]
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:err];
+
+ [alert setAlertStyle:NSCriticalAlertStyle];
+ [alert runModal];
+ return;
+ }
+
+ NSError *error = nil;
+ [plist writeToFile:path options:NSAtomicWrite error:&error];
+ if (error) [[NSAlert alertWithError:error] runModal];
+}
+
+- (BOOL)checkForUnsavedTheme
+{
+ if(![prefs objectForKey:SPCustomQueryEditorThemeName] || [[[prefs objectForKey:SPCustomQueryEditorThemeName] lowercaseString] isEqualToString:@"user-defined"]) {
+
+ NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+ [alert addButtonWithTitle:NSLocalizedString(@"Proceed", @"proceed button")];
+ [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"cancel button")];
+ [alert setMessageText:NSLocalizedString(@"Current color theme is unsaved. Do you want to proceed without saving it?", @"Current color theme is unsaved. Do you want to proceed without saving it message")];
+ [alert setInformativeText:@""];
+ [alert setAlertStyle:NSWarningAlertStyle];
+ NSInteger choice = [[alert onMainThread] runModal];
+ if(choice == NSAlertFirstButtonReturn) {
+ [[NSColorPanel sharedColorPanel] close];
+ return YES;
}
+
+ return NO;
}
- else if([contextInfo isEqualToString:@"importColorScheme"]) {
- if (returnCode == NSOKButton) {
- NSString *filename = [[panel filenames] objectAtIndex:0];
- NSError *readError = nil;
- NSString *convError = nil;
- NSPropertyListFormat format;
+ [[NSColorPanel sharedColorPanel] close];
+ return YES;
+}
- NSDictionary *theme = nil;
+- (BOOL)loadColorSchemeFromFile:(NSString*)filename
+{
+ NSError *readError = nil;
+ NSString *convError = nil;
+ NSPropertyListFormat format;
- NSData *pData = [NSData dataWithContentsOfFile:filename options:NSUncachedRead error:&readError];
+ NSDictionary *theme = nil;
- theme = [[NSPropertyListSerialization propertyListFromData:pData
- mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
+ NSData *pData = [NSData dataWithContentsOfFile:filename options:NSUncachedRead error:&readError];
- if(!theme || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
- NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")]
- defaultButton:NSLocalizedString(@"OK", @"OK button")
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"File couldn't be read.", @"error while reading data file")];
+ theme = [[NSPropertyListSerialization propertyListFromData:pData
+ mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
- [alert setAlertStyle:NSCriticalAlertStyle];
- [alert runModal];
- if (theme) [theme release];
- return;
- }
+ if(!theme || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
+ NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")]
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:NSLocalizedString(@"File couldn't be read.", @"error while reading data file")];
- if([theme objectForKey:@"settings"]
- && [[theme objectForKey:@"settings"] isKindOfClass:[NSArray class]]
- && [[theme objectForKey:@"settings"] count]
- && [[[theme objectForKey:@"settings"] objectAtIndex:0] isKindOfClass:[NSDictionary class]]
- && [[[theme objectForKey:@"settings"] objectAtIndex:0] objectForKey:@"settings"]) {
-
- NSInteger counter = 0;
- for(NSDictionary *dict in [theme objectForKey:@"settings"]) {
- if(counter == 0) {
- if([dict objectForKey:@"settings"]) {
- NSDictionary *dic = [dict objectForKey:@"settings"];
- if([dic objectForKey:@"background"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"background"]]] forKey:SPCustomQueryEditorBackgroundColor];
- if([dic objectForKey:@"caret"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"caret"]]] forKey:SPCustomQueryEditorCaretColor];
- if([dic objectForKey:@"foreground"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"foreground"]]] forKey:SPCustomQueryEditorTextColor];
- if([dic objectForKey:@"lineHighlight"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"lineHighlight"]]] forKey:SPCustomQueryEditorHighlightQueryColor];
- if([dic objectForKey:@"selection"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"selection"]]] forKey:SPCustomQueryEditorSelectionColor];
- } else {
- continue;
- }
- } else {
- if([dict objectForKey:@"name"] && [dict objectForKey:@"settings"] && [[dict objectForKey:@"settings"] isKindOfClass:[NSDictionary class]] && [[dict objectForKey:@"settings"] objectForKey:@"foreground"]) {
- if([[dict objectForKey:@"name"] isEqualToString:@"Comment"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:
- [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
- forKey:SPCustomQueryEditorCommentColor];
- else if([[dict objectForKey:@"name"] isEqualToString:@"String"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:
- [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
- forKey:SPCustomQueryEditorQuoteColor];
- else if([[dict objectForKey:@"name"] isEqualToString:@"Keyword"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:
- [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
- forKey:SPCustomQueryEditorSQLKeywordColor];
- else if([[dict objectForKey:@"name"] isEqualToString:@"User-defined constant"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:
- [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
- forKey:SPCustomQueryEditorBacktickColor];
- else if([[dict objectForKey:@"name"] isEqualToString:@"Number"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:
- [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
- forKey:SPCustomQueryEditorNumericColor];
- else if([[dict objectForKey:@"name"] isEqualToString:@"Variable"])
- [prefs setObject:[NSArchiver archivedDataWithRootObject:
- [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
- forKey:SPCustomQueryEditorVariableColor];
- }
- }
- counter++;
+ [alert setAlertStyle:NSCriticalAlertStyle];
+ [alert runModal];
+ if (theme) [theme release];
+ return NO;
+ }
+
+ if([theme objectForKey:@"settings"]
+ && [[theme objectForKey:@"settings"] isKindOfClass:[NSArray class]]
+ && [[theme objectForKey:@"settings"] count]
+ && [[[theme objectForKey:@"settings"] objectAtIndex:0] isKindOfClass:[NSDictionary class]]
+ && [[[theme objectForKey:@"settings"] objectAtIndex:0] objectForKey:@"settings"]) {
+
+ NSInteger counter = 0;
+ for(NSDictionary *dict in [theme objectForKey:@"settings"]) {
+ if(counter == 0) {
+ if([dict objectForKey:@"settings"]) {
+ NSDictionary *dic = [dict objectForKey:@"settings"];
+ if([dic objectForKey:@"background"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"background"]]] forKey:SPCustomQueryEditorBackgroundColor];
+ if([dic objectForKey:@"caret"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"caret"]]] forKey:SPCustomQueryEditorCaretColor];
+ if([dic objectForKey:@"foreground"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"foreground"]]] forKey:SPCustomQueryEditorTextColor];
+ if([dic objectForKey:@"lineHighlight"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"lineHighlight"]]] forKey:SPCustomQueryEditorHighlightQueryColor];
+ if([dic objectForKey:@"selection"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithRGBHexString:[dic objectForKey:@"selection"]]] forKey:SPCustomQueryEditorSelectionColor];
+ } else {
+ continue;
}
+ } else {
+ if([dict objectForKey:@"name"] && [dict objectForKey:@"settings"] && [[dict objectForKey:@"settings"] isKindOfClass:[NSDictionary class]] && [[dict objectForKey:@"settings"] objectForKey:@"foreground"]) {
+ if([[dict objectForKey:@"name"] isEqualToString:@"Comment"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:
+ [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
+ forKey:SPCustomQueryEditorCommentColor];
+ else if([[dict objectForKey:@"name"] isEqualToString:@"String"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:
+ [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
+ forKey:SPCustomQueryEditorQuoteColor];
+ else if([[dict objectForKey:@"name"] isEqualToString:@"Keyword"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:
+ [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
+ forKey:SPCustomQueryEditorSQLKeywordColor];
+ else if([[dict objectForKey:@"name"] isEqualToString:@"User-defined constant"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:
+ [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
+ forKey:SPCustomQueryEditorBacktickColor];
+ else if([[dict objectForKey:@"name"] isEqualToString:@"Number"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:
+ [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
+ forKey:SPCustomQueryEditorNumericColor];
+ else if([[dict objectForKey:@"name"] isEqualToString:@"Variable"])
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:
+ [NSColor colorWithRGBHexString:[[dict objectForKey:@"settings"] objectForKey:@"foreground"]]]
+ forKey:SPCustomQueryEditorVariableColor];
+ }
+ }
+ counter++;
+ }
- [theme release];
- [colorSettingTableView reloadData];
+ [theme release];
+ [colorSettingTableView reloadData];
- } else {
+ } else {
- NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")]
- defaultButton:NSLocalizedString(@"OK", @"OK button")
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"No color theme data found.", @"error that no color theme found")];
+ NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")]
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:NSLocalizedString(@"No color theme data found.", @"error that no color theme found")];
- [alert setAlertStyle:NSInformationalAlertStyle];
- [alert runModal];
- [theme release];
- return;
+ [alert setAlertStyle:NSInformationalAlertStyle];
+ [alert runModal];
+ [theme release];
+ return NO;
+
+ }
+ return YES;
+}
+/**
+ * Save panel did end method.
+ */
+- (void)panelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
+{
+
+ if([contextInfo isEqualToString:@"exportColorScheme"]) {
+ if (returnCode == NSOKButton) {
+ [self saveColorThemeAtPath:[panel filename]];
+ }
+ }
+ else if([contextInfo isEqualToString:@"importColorScheme"]) {
+ if (returnCode == NSOKButton) {
+ if([self loadColorSchemeFromFile:[[panel filenames] objectAtIndex:0]]) {
+ [prefs setObject:@"User-defined" forKey:SPCustomQueryEditorThemeName];
+ [self updateDisplayColorThemeName];
}
}
}
@@ -1704,6 +1901,7 @@
*/
- (void)dealloc
{
+ if(themePath) [themePath release], themePath = nil;
if(editorColors) [editorColors release], editorColors = nil;
if(editorNameForColors) [editorNameForColors release], editorNameForColors = nil;
if (keychain) [keychain release], keychain = nil;