From 487cc8e31b4487c5d85817e9ff73d24dbaeedd74 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 17 Aug 2010 12:10:54 +0000 Subject: =?UTF-8?q?=E2=80=A2=C2=A0initial=20commit=20to=20set=20the=20Edit?= =?UTF-8?q?or's=20colors=20by=20using=20a=20table=20approach=20containing?= =?UTF-8?q?=20SPColorWellCells=20-=20further=20improvements=20will=20follo?= =?UTF-8?q?w=20soon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interfaces/English.lproj/Preferences.xib | 1221 +++++++----------------------- Source/SPColorWellCell.h | 32 + Source/SPColorWellCell.m | 51 ++ Source/SPPreferenceController.h | 9 +- Source/SPPreferenceController.m | 163 +++- sequel-pro.xcodeproj/project.pbxproj | 6 + 6 files changed, 521 insertions(+), 961 deletions(-) create mode 100644 Source/SPColorWellCell.h create mode 100644 Source/SPColorWellCell.m diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index 82a09c77..f900f44d 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -604,7 +604,7 @@ 12 {{202.5, 176}, {360, 5}} - {{2.5, 0}, {355, 5}} + {{3, 0}, {354, 5}} {0, 0} @@ -1798,7 +1798,7 @@ MC44MzkyMTU2OTU5IDAuODY2NjY2Njc0NiAwLjg5ODAzOTIyMTgAA - + 6 System gridColor @@ -3279,10 +3279,141 @@ AQAAAAA 268 YES + + + 268 + + YES + + + 2304 + + YES + + + 256 + {194, 242} + + YES + + + -2147483392 + {{224, 0}, {16, 17}} + + + YES + + name + 142 + 40 + 1000 + + 75628096 + 2048 + + + + 3 + MC4zMzMzMzI5ODU2AA + + + + + 337772096 + 2048 + Text Cell + + + + + + 3 + YES + YES + + + + color + 40 + 40 + 1000 + + 75628096 + 2048 + + + + + + + 337772096 + 2048 + Text Cell + + + + + + 3 + YES + + + + 3 + 2 + + + 20 + 304087040 + + + 0 + 15 + 0 + YES + 0 + + + {{1, 1}, {194, 242}} + + + + + 2 + + + + -2147483392 + {{-100, -100}, {15, 102}} + + + _doScroller: + 0.99658703804016113 + + + + -2147483392 + {{-100, -100}, {223, 15}} + + 1 + + _doScroller: + 0.57142859697341919 + + + {{32, 20}, {196, 244}} + + + 2 + + + + QSAAAEEgAABBsAAAQbAAAA + 268 - {{32, 20}, {24, 24}} + {{204, 275}, {24, 24}} YES @@ -3355,7 +3486,7 @@ AQAAAAA 268 - {{407, 88}, {23, 19}} + {{407, 21}, {23, 19}} YES @@ -3427,7 +3558,7 @@ AQAAAAA 268 - {{269, 90}, {133, 17}} + {{269, 23}, {133, 17}} YES @@ -3443,7 +3574,7 @@ AQAAAAA 268 - {{437, 86}, {15, 22}} + {{437, 19}, {15, 22}} YES @@ -3458,378 +3589,10 @@ AQAAAAA YES - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 232}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 261}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 174}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 145}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 319}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 203}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 116}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 58}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - {{17, 62}, {181, 17}} - - YES - - 68288064 - 71304192 - Selection: - - - - - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 87}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 348}, {44, 23}} - - YES - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - - YES - - YES - NSColor pasteboard type - - - {{204, 290}, {44, 23}} - - YES - - 1 - MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA - - - - - 268 - {{17, 235}, {182, 17}} - - YES - - 68288064 - 71304192 - Keyword: - - - - - - - - - 268 - {{17, 206}, {182, 17}} - - YES - - 68288064 - 71304192 - Numeric: - - - - - - - - - 268 - {{17, 264}, {182, 17}} - - YES - - 68288064 - 71304192 - Comment: - - - - - - - - - 268 - {{17, 119}, {182, 17}} - - YES - - 68288064 - 71304192 - Variable: - - - - - - - - - 268 - {{17, 91}, {181, 17}} - - YES - - 68288064 - 71304192 - Query Background: - - - - - - - - - 268 - {{17, 177}, {182, 17}} - - YES - - 68288064 - 71304192 - Quote: - - - - - - - - - 268 - {{17, 351}, {182, 17}} - - YES - - 68288064 - 71304192 - Text: - - - - - - - - - 268 - {{17, 148}, {182, 17}} - - YES - - 68288064 - 71304192 - Backtick Quote: - - - - - - - - - 268 - {{17, 322}, {182, 17}} - - YES - - 68288064 - 71304192 - Background: - - - - - - 268 - {{17, 390}, {182, 17}} + {{17, 323}, {182, 17}} YES @@ -3845,7 +3608,7 @@ AQAAAAA 268 - {{69, 14}, {185, 32}} + {{26, 269}, {176, 32}} YES @@ -3865,7 +3628,7 @@ AQAAAAA 268 - {{433, 380}, {133, 32}} + {{433, 313}, {133, 32}} YES @@ -3885,7 +3648,7 @@ AQAAAAA 268 - {{204, 388}, {207, 19}} + {{204, 321}, {207, 19}} YES @@ -3899,26 +3662,10 @@ AQAAAAA - - - 268 - {{17, 293}, {182, 17}} - - YES - - 605158976 - 71304192 - Caret: - - - - - - 268 - {{270, 350}, {292, 18}} + {{270, 283}, {292, 18}} YES @@ -3940,7 +3687,7 @@ AQAAAAA 268 - {{270, 321}, {292, 18}} + {{270, 254}, {292, 18}} YES @@ -3962,7 +3709,7 @@ AQAAAAA 268 - {{270, 263}, {292, 18}} + {{270, 196}, {292, 18}} YES @@ -3984,7 +3731,7 @@ AQAAAAA 268 - {{270, 292}, {292, 18}} + {{270, 225}, {292, 18}} YES @@ -4006,7 +3753,7 @@ AQAAAAA 268 - {{270, 206}, {292, 18}} + {{270, 139}, {292, 18}} YES @@ -4028,7 +3775,7 @@ AQAAAAA 268 - {{270, 119}, {292, 18}} + {{270, 52}, {292, 18}} YES @@ -4050,7 +3797,7 @@ AQAAAAA 268 - {{270, 177}, {292, 18}} + {{270, 110}, {292, 18}} YES @@ -4072,7 +3819,7 @@ AQAAAAA 268 - {{370, 152}, {29, 19}} + {{370, 85}, {29, 19}} YES @@ -4145,7 +3892,7 @@ AQAAAAA 268 - {{269, 154}, {96, 14}} + {{269, 87}, {96, 14}} YES @@ -4161,7 +3908,7 @@ AQAAAAA 268 - {{405, 150}, {15, 22}} + {{405, 83}, {15, 22}} YES @@ -4179,7 +3926,7 @@ AQAAAAA 268 - {{423, 154}, {140, 14}} + {{423, 87}, {140, 14}} YES @@ -4195,7 +3942,7 @@ AQAAAAA -2147483380 - {{270, 57}, {292, 18}} + {{270, -10}, {292, 18}} YES @@ -4217,7 +3964,7 @@ AQAAAAA 268 - {{370, 238}, {29, 19}} + {{370, 171}, {29, 19}} YES @@ -4290,7 +4037,7 @@ AQAAAAA 268 - {{269, 240}, {96, 14}} + {{269, 173}, {96, 14}} YES @@ -4306,7 +4053,7 @@ AQAAAAA 268 - {{405, 236}, {15, 22}} + {{405, 169}, {15, 22}} YES @@ -4324,7 +4071,7 @@ AQAAAAA 268 - {{423, 240}, {140, 14}} + {{423, 173}, {140, 14}} YES @@ -4340,7 +4087,7 @@ AQAAAAA 12 - {{204, 377}, {356, 5}} + {{204, 310}, {356, 5}} {0, 0} @@ -4360,14 +4107,14 @@ AQAAAAA NO - {580, 428} + {580, 361} NSView YES - CustomQueryEditorSelectionColor + GlobalResultTableFont YES @@ -4944,204 +4691,44 @@ AQAAAAA YES - YES - NSDeletesObjectsOnRemove - NSHandlesContentAsCompoundValue - - - YES - - - - - 2 - - - 782 - - - - value: values.CustomQueryMaxHistoryItems - - - - - - value: values.CustomQueryMaxHistoryItems - value - values.CustomQueryMaxHistoryItems - 2 - - - 800 - - - - delegate - - - - 801 - - - - value: values.CustomQueryEditorCommentColor - - - - - - value: values.CustomQueryEditorCommentColor - value - values.CustomQueryEditorCommentColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - - - 841 - - - - value: values.CustomQueryEditorNumericColor - - - - - - value: values.CustomQueryEditorNumericColor - value - values.CustomQueryEditorNumericColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - - - 842 - - - - value: values.CustomQueryEditorSQLKeywordColor - - - - - - value: values.CustomQueryEditorSQLKeywordColor - value - values.CustomQueryEditorSQLKeywordColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - - - 843 - - - - value: values.CustomQueryEditorVariableColor - - - - - - value: values.CustomQueryEditorVariableColor - value - values.CustomQueryEditorVariableColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - - - 844 - - - - value: values.CustomQueryEditorQuoteColor - - - - - - value: values.CustomQueryEditorQuoteColor - value - values.CustomQueryEditorQuoteColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - - - 845 - - - - value: values.CustomQueryEditorBacktickColor - - - - - - value: values.CustomQueryEditorBacktickColor - value - values.CustomQueryEditorBacktickColor - - NSValueTransformerName - NSUnarchiveFromData + YES + NSDeletesObjectsOnRemove + NSHandlesContentAsCompoundValue + + + YES + + + 2 - 846 + 782 - value: values.CustomQueryEditorBackgroundColor - + value: values.CustomQueryMaxHistoryItems + - + - value: values.CustomQueryEditorBackgroundColor + value: values.CustomQueryMaxHistoryItems value - values.CustomQueryEditorBackgroundColor - - NSValueTransformerName - NSUnarchiveFromData - + values.CustomQueryMaxHistoryItems 2 - 847 + 800 - - value: values.CustomQueryEditorTextColor - - - - - - value: values.CustomQueryEditorTextColor - value - values.CustomQueryEditorTextColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - + + delegate + + - 848 + 801 @@ -5203,26 +4790,6 @@ AQAAAAA 961 - - - value: values.CustomQueryEditorCaretColor - - - - - - value: values.CustomQueryEditorCaretColor - value - values.CustomQueryEditorCaretColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - - - 1007 - setDefaultColors: @@ -5479,26 +5046,6 @@ AQAAAAA 1134 - - - value: values.CustomQueryEditorHighlightQueryColor - - - - - - value: values.CustomQueryEditorHighlightQueryColor - value - values.CustomQueryEditorHighlightQueryColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - - - 1136 - value: values.ConsoleEnableLogging @@ -6788,24 +6335,28 @@ AQAAAAA 1676 - - value: values.CustomQueryEditorSelectionColor - - - - - - value: values.CustomQueryEditorSelectionColor - value - values.CustomQueryEditorSelectionColor - - NSValueTransformerName - NSUnarchiveFromData - - 2 - + + delegate + + + + 1691 + + + + dataSource + + + + 1692 + + + + colorSettingTableView + + - 1681 + 1693 @@ -7729,24 +7280,6 @@ AQAAAAA - - - - - - - - - - - - - - - - - - @@ -7754,10 +7287,7 @@ AQAAAAA - - - @@ -7770,43 +7300,13 @@ AQAAAAA + + - - Editor - - 803 - - - - - 804 - - - - - 805 - - - - - 806 - - - - - 807 - - - - - 823 - - - 950 @@ -7835,65 +7335,6 @@ AQAAAAA - - 1000 - - - - - 1026 - - - YES - - - - - - 1027 - - - YES - - - - - - 1028 - - - YES - - - - - - 1029 - - - YES - - - - - - 1030 - - - YES - - - - - - 1032 - - - YES - - - - 1034 @@ -7930,15 +7371,6 @@ AQAAAAA - - 1038 - - - YES - - - - 1039 @@ -8009,11 +7441,6 @@ AQAAAAA - - 1056 - - - 1057 @@ -8034,36 +7461,6 @@ AQAAAAA - - 1062 - - - - - 1064 - - - - - 1065 - - - - - 1066 - - - - - 1067 - - - - - 1068 - - - 1046 @@ -8115,44 +7512,6 @@ AQAAAAA - - 1033 - - - YES - - - - - - 1061 - - - - - 1031 - - - YES - - - - - - 1063 - - - - - 808 - - - - - 822 - - - 1083 @@ -8172,25 +7531,6 @@ AQAAAAA - - 1125 - - - - - 1126 - - - YES - - - - - - 1127 - - - 1128 @@ -9630,23 +8970,63 @@ AQAAAAA - 1677 - + 1682 + YES - + + + - 1678 - - + 1683 + + - 1679 - - + 1684 + + + + + 1685 + + + YES + + + + + + + 1687 + + + YES + + + + + + 1688 + + + YES + + + + + + 1689 + + + + + 1690 + + @@ -9665,23 +9045,13 @@ AQAAAAA 1.windowTemplate.minSize 100.IBPluginDependency 100.ImportedFromIB2 - 1000.IBPluginDependency 101.IBPluginDependency 102.IBPluginDependency 102.ImportedFromIB2 - 1026.IBPluginDependency - 1027.IBPluginDependency - 1028.IBPluginDependency - 1029.IBPluginDependency - 1030.IBPluginDependency - 1031.IBPluginDependency - 1032.IBPluginDependency - 1033.IBPluginDependency 1034.IBPluginDependency 1035.IBPluginDependency 1036.IBPluginDependency 1037.IBPluginDependency - 1038.IBPluginDependency 1039.IBPluginDependency 1040.IBPluginDependency 1041.IBPluginDependency @@ -9700,27 +9070,15 @@ AQAAAAA 1053.IBPluginDependency 1054.IBPluginDependency 1055.IBPluginDependency - 1056.IBPluginDependency 1057.IBPluginDependency 1058.IBPluginDependency 1059.IBPluginDependency 1060.IBPluginDependency - 1061.IBPluginDependency - 1062.IBPluginDependency - 1063.IBPluginDependency - 1064.IBPluginDependency - 1065.IBPluginDependency - 1066.IBPluginDependency - 1067.IBPluginDependency - 1068.IBPluginDependency 1083.IBPluginDependency 1084.IBPluginDependency 1085.IBPluginDependency 110.IBPluginDependency 111.IBPluginDependency - 1125.IBPluginDependency - 1126.IBPluginDependency - 1127.IBPluginDependency 1128.IBPluginDependency 1129.IBPluginDependency 1143.IBPluginDependency @@ -9923,9 +9281,14 @@ AQAAAAA 1673.IBAttributePlaceholdersKey 1673.IBPluginDependency 1674.IBPluginDependency - 1677.IBPluginDependency - 1678.IBPluginDependency - 1679.IBPluginDependency + 1682.IBPluginDependency + 1683.IBPluginDependency + 1684.IBPluginDependency + 1685.IBPluginDependency + 1687.IBPluginDependency + 1688.IBPluginDependency + 1689.IBPluginDependency + 1690.IBPluginDependency 17.IBEditorWindowLastContentRect 17.IBPluginDependency 17.IBUserGuides @@ -10151,14 +9514,6 @@ AQAAAAA 802.IBEditorWindowLastContentRect 802.IBPluginDependency 802.IBUserGuides - 803.IBPluginDependency - 804.IBPluginDependency - 805.IBPluginDependency - 806.IBPluginDependency - 807.IBPluginDependency - 808.IBPluginDependency - 822.IBPluginDependency - 823.IBPluginDependency 94.IBPluginDependency 94.ImportedFromIB2 95.IBPluginDependency @@ -10189,7 +9544,6 @@ AQAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -10206,15 +9560,6 @@ AQAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -10245,18 +9590,6 @@ AQAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin InitialTabViewItem @@ -10482,6 +9815,11 @@ AQAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{194, 257}, {580, 300}} com.apple.InterfaceBuilder.CocoaPlugin @@ -10772,7 +10110,7 @@ AQAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1328, 433}, {580, 428}} + {{286, 419}, {580, 361}} com.apple.InterfaceBuilder.CocoaPlugin YES @@ -10788,14 +10126,6 @@ AQAAAAA com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -10833,7 +10163,7 @@ AQAAAAA - 1681 + 1699 @@ -11505,6 +10835,7 @@ AQAAAAA YES autoUpdateView + colorSettingTableView defaultFavoritePopup editorFontName editorView @@ -11535,6 +10866,7 @@ AQAAAAA YES NSView + NSTableView NSPopUpButton NSTextField NSView @@ -11568,6 +10900,7 @@ AQAAAAA YES autoUpdateView + colorSettingTableView defaultFavoritePopup editorFontName editorView @@ -11601,6 +10934,10 @@ AQAAAAA autoUpdateView NSView + + colorSettingTableView + NSTableView + defaultFavoritePopup NSPopUpButton @@ -11864,14 +11201,6 @@ AQAAAAA AppKit.framework/Headers/NSCell.h - - NSColorWell - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSColorWell.h - - NSControl NSView diff --git a/Source/SPColorWellCell.h b/Source/SPColorWellCell.h new file mode 100644 index 00000000..9be65828 --- /dev/null +++ b/Source/SPColorWellCell.h @@ -0,0 +1,32 @@ +// +// $Id$ +// +// SPColorWellCell.h +// sequel-pro +// +// Created by Hans-Jörg Bibiko on August 17, 2010 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + + +@interface SPColorWellCell : NSActionCell { + +} + +@end diff --git a/Source/SPColorWellCell.m b/Source/SPColorWellCell.m new file mode 100644 index 00000000..d7f50006 --- /dev/null +++ b/Source/SPColorWellCell.m @@ -0,0 +1,51 @@ +// +// $Id$ +// +// SPColorWellCell.m +// sequel-pro +// +// Created by Hans-Jörg Bibiko on August 17, 2010 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import "SPColorWellCell.h" + + +@implementation SPColorWellCell + +- (void) drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView +{ + NSRect square = NSInsetRect (cellFrame, 0.5, 0.5); + + if (square.size.height < square.size.width) { + square.size.width = square.size.height; + square.origin.x = square.origin.x + (cellFrame.size.width - + square.size.width) / 2.0; + } else { + square.size.height = square.size.width; + square.origin.y = square.origin.y + (cellFrame.size.height - + square.size.height) / 2.0; + } + + [[NSColor blackColor] set]; + [NSBezierPath strokeRect: square]; + + [(NSColor*) [self objectValue] set]; + [NSBezierPath fillRect: NSInsetRect (square, 2.0, 2.0)]; +} + +@end diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h index d5e22fd5..428bfd6d 100644 --- a/Source/SPPreferenceController.h +++ b/Source/SPPreferenceController.h @@ -60,7 +60,12 @@ IBOutlet NSMenuItem *favoritesSortByMenuItem; IBOutlet id tableCell; - + + IBOutlet NSTableView *colorSettingTableView; + NSArray *editorColors; + NSArray *editorNameForColors; + NSUInteger colorRow; + IBOutlet NSTextField *editorFontName; IBOutlet NSTextField *globalResultTableFontName; @@ -68,7 +73,7 @@ SPKeychain *keychain; NSDictionary *currentFavorite; - + NSToolbar *toolbar; NSToolbarItem *generalItem; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 3985681c..4f249723 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -30,6 +30,7 @@ #import "SPDatabaseDocument.h" #import "SPConnectionController.h" #import "SPColorAdditions.h" +#import "SPColorWellCell.h" @interface SPPreferenceController (PrivateAPI) @@ -103,6 +104,47 @@ if (currentSortItem > -1) { [self _sortFavorites]; } + + + NSTableColumn* column; + SPColorWellCell* colorCell; + + column = [[colorSettingTableView tableColumns] objectAtIndex: 1]; + colorCell = [[[SPColorWellCell alloc] init] autorelease]; + [colorCell setEditable: YES]; + [colorCell setTarget: self]; + [colorCell setAction:@selector(colorClick:)]; + [column setDataCell:colorCell]; + + editorColors = [[NSArray arrayWithObjects: + SPCustomQueryEditorTextColor, + SPCustomQueryEditorBackgroundColor, + SPCustomQueryEditorCaretColor, + SPCustomQueryEditorCommentColor, + SPCustomQueryEditorSQLKeywordColor, + SPCustomQueryEditorNumericColor, + SPCustomQueryEditorQuoteColor, + SPCustomQueryEditorBacktickColor, + SPCustomQueryEditorVariableColor, + SPCustomQueryEditorHighlightQueryColor, + SPCustomQueryEditorSelectionColor, + nil + ] retain]; + editorNameForColors = [[NSArray arrayWithObjects: + NSLocalizedString(@"Text",@"text lable for color table"), + NSLocalizedString(@"Background",@"background lable for color table"), + NSLocalizedString(@"Caret",@"caret lable for color table"), + NSLocalizedString(@"Comment",@"comment lable for color table"), + NSLocalizedString(@"Keyword",@"keyword lable for color table"), + NSLocalizedString(@"Numeric",@"numeric lable for color table"), + NSLocalizedString(@"Quote",@"quote lable for color table"), + NSLocalizedString(@"Backtick Quote",@"backtick quote lable for color table"), + NSLocalizedString(@"Variable",@"variable lable for color table"), + NSLocalizedString(@"Query Background",@"query background lable for color table"), + NSLocalizedString(@"Selection",@"selection lable for color table"), + nil + ] retain]; + } #pragma mark - @@ -646,6 +688,9 @@ // ------------------------------------------------------------------------------- - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { + if(aTableView == colorSettingTableView) + return [editorColors count]; + return [[favoritesController arrangedObjects] count]; } @@ -654,14 +699,23 @@ // ------------------------------------------------------------------------------- - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex { - if ([[tableColumn identifier] isEqualToString:@"default"] && (rowIndex == [prefs integerForKey:SPDefaultFavorite])) { - return [NSImage imageNamed:@"blue-tick"]; - } - else { - return [[[favoritesController arrangedObjects] objectAtIndex:rowIndex] objectForKey:[tableColumn identifier]]; + if(tableView == colorSettingTableView) { + if ([[tableColumn identifier] isEqualToString:@"name"]) + return [editorNameForColors objectAtIndex:rowIndex]; + else + return [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:[editorColors objectAtIndex:rowIndex]]]; + } else { + if ([[tableColumn identifier] isEqualToString:@"default"] && (rowIndex == [prefs integerForKey:SPDefaultFavorite])) { + return [NSImage imageNamed:@"blue-tick"]; + } + else { + return [[[favoritesController arrangedObjects] objectAtIndex:rowIndex] objectForKey:[tableColumn identifier]]; + } } + return nil; } + #pragma mark - #pragma mark TableView drag & drop delegate methods @@ -670,6 +724,9 @@ // ------------------------------------------------------------------------------- - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rows toPasteboard:(NSPasteboard*)pboard { + + if(aTableView == colorSettingTableView) return; + if ([rows count] == 1) { [pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:nil]; [pboard setString:[[NSNumber numberWithInteger:[rows firstIndex]] stringValue] forType:SPFavoritesPasteboardDragType]; @@ -686,6 +743,9 @@ // ------------------------------------------------------------------------------- - (NSDragOperation)tableView:(NSTableView *)tv validateDrop:(id )info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation { + + if(tv == colorSettingTableView) return NSDragOperationNone; + NSInteger originalRow; NSArray *pboardTypes = [[info draggingPasteboard] types]; @@ -707,6 +767,9 @@ // ------------------------------------------------------------------------------- - (BOOL)tableView:(NSTableView *)tv acceptDrop:(id )info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation { + + if(tv == colorSettingTableView) return NO; + NSInteger originalRow; NSInteger destinationRow; NSInteger lastFavoriteIndexCached; @@ -763,20 +826,66 @@ #pragma mark - #pragma mark TableView delegate methods + +- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex +{ + if(aTableView == colorSettingTableView) { + + NSColorPanel* panel; + + colorRow = rowIndex; + panel = [NSColorPanel sharedColorPanel]; + [panel setTarget:self]; + [panel setAction:@selector(colorChanged:)]; + [panel setColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:[editorColors objectAtIndex:colorRow]]]]; + [colorSettingTableView deselectAll:nil]; + [panel makeKeyAndOrderFront:self]; + + return NO; + + } + return YES; +} + // ------------------------------------------------------------------------------- // tableView:willDisplayCell:forTableColumn:row: // ------------------------------------------------------------------------------- - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)index { - if ([cell isKindOfClass:[SPFavoriteTextFieldCell class]]) { - [cell setFavoriteName:[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"name"]]; + + if(tableView == colorSettingTableView && [[tableColumn identifier] isEqualToString:@"name"]) { + if ([cell isKindOfClass:[NSTextFieldCell class]]) { + [cell setDrawsBackground:YES]; + switch(index) { + case 1: + [cell setTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]]; + [cell setBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]]]; + break; + case 9: + [cell setTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]]; + [cell setBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorHighlightQueryColor]]]; + break; + case 10: + [cell setTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]]; + [cell setBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSelectionColor]]]; + break; + default: + [cell setTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:[editorColors objectAtIndex:index]]]]; + [cell setBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]]]; + } + } + } else { + + if ([cell isKindOfClass:[SPFavoriteTextFieldCell class]]) { + [cell setFavoriteName:[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"name"]]; - if ([[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"type"] integerValue] == SPSocketConnection) { - [cell setFavoriteHost:@"localhost"]; - } - else { - [cell setFavoriteHost:[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"host"]]; + if ([[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"type"] integerValue] == SPSocketConnection) { + [cell setFavoriteHost:@"localhost"]; + } + else { + [cell setFavoriteHost:[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"host"]]; + } } } } @@ -786,8 +895,11 @@ // ------------------------------------------------------------------------------- - (void)tableViewSelectionDidChange:(NSNotification *)notification { + + if([notification object] == colorSettingTableView) return; + if ([[favoritesTableView selectedRowIndexes] count] > 0) { - [favoritesController setSelectionIndexes:[favoritesTableView selectedRowIndexes]]; + [favoritesController setSelectionIndexes:[favoritesTableView selectedRowIndexes]]; } // If no selection is present, blank the password fields (which can't use bindings) @@ -1263,6 +1375,28 @@ [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor blackColor]] forKey:SPCustomQueryEditorTextColor]; [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor blackColor]] forKey:SPCustomQueryEditorCaretColor]; [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]] forKey:SPCustomQueryEditorBackgroundColor]; + [colorSettingTableView reloadData]; +} + +- (void)colorClick:(id)sender +{ + NSColorPanel* panel; + + colorRow = [sender clickedRow]; + panel = [NSColorPanel sharedColorPanel]; + [panel setTarget:self]; + [panel setAction:@selector(colorChanged:)]; + [panel setColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:[editorColors objectAtIndex:colorRow]]]]; + [colorSettingTableView deselectAll:nil]; + [panel makeKeyAndOrderFront:self]; +} + +- (void)colorChanged:(id)sender +{ + if(![[NSColorPanel sharedColorPanel] isVisible]) return; + [prefs setObject:[NSArchiver archivedDataWithRootObject:[sender color]] forKey:[editorColors objectAtIndex:colorRow]]; + [colorSettingTableView reloadData]; + } // Set font panel's valid modes @@ -1530,6 +1664,7 @@ } [theme release]; + [colorSettingTableView reloadData]; } else { @@ -1555,6 +1690,8 @@ */ - (void)dealloc { + if(editorColors) [editorColors release], editorColors = nil; + if(editorNameForColors) [editorNameForColors release], editorNameForColors = nil; if (keychain) [keychain release], keychain = nil; if (currentFavorite) [currentFavorite release]; diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 8b6c7445..8bb17489 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -354,6 +354,7 @@ BC6D709D120C4C97008027B5 /* SPEditorTokens.h in Headers */ = {isa = PBXBuildFile; fileRef = 179F15040F7C433C00579954 /* SPEditorTokens.h */; }; BC6D709E120C4C9F008027B5 /* SPEditorTokens.l in Sources */ = {isa = PBXBuildFile; fileRef = 179F15050F7C433C00579954 /* SPEditorTokens.l */; }; BC85F5D012193B7D00E255B5 /* SPColorAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC85F5CF12193B7D00E255B5 /* SPColorAdditions.m */; }; + BC878A71121A836F00AE5066 /* SPColorWellCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BC878A70121A836F00AE5066 /* SPColorWellCell.m */; }; BC8B0DAF104004F900FC02EC /* EncodingPopupView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC8B0DAD104004F900FC02EC /* EncodingPopupView.xib */; }; BC8C8532100E0A8000D7A129 /* SPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8C8531100E0A8000D7A129 /* SPTableView.m */; }; BC93FBBD11514ADE005F1D9F /* Navigator.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC93FBBB11514ADE005F1D9F /* Navigator.xib */; }; @@ -988,6 +989,8 @@ BC675A16107203BA00C5ACD4 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/ContentFilterManager.xib; sourceTree = ""; }; BC85F5CE12193B7D00E255B5 /* SPColorAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPColorAdditions.h; sourceTree = ""; }; BC85F5CF12193B7D00E255B5 /* SPColorAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPColorAdditions.m; sourceTree = ""; }; + BC878A6F121A836F00AE5066 /* SPColorWellCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPColorWellCell.h; sourceTree = ""; }; + BC878A70121A836F00AE5066 /* SPColorWellCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPColorWellCell.m; sourceTree = ""; }; BC8B0DAE104004F900FC02EC /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/EncodingPopupView.xib; sourceTree = ""; }; BC8C8530100E0A8000D7A129 /* SPTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableView.h; sourceTree = ""; }; BC8C8531100E0A8000D7A129 /* SPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableView.m; sourceTree = ""; }; @@ -1699,6 +1702,8 @@ BC05F1C4101241DF008A97F8 /* YRKSpinningProgressIndicator.m */, 584094CC1107BD0500260CFD /* SPAlertSheets.h */, 584095181107CB6600260CFD /* SPAlertSheets.m */, + BC878A6F121A836F00AE5066 /* SPColorWellCell.h */, + BC878A70121A836F00AE5066 /* SPColorWellCell.m */, ); name = GUI; sourceTree = ""; @@ -2749,6 +2754,7 @@ 17F90E481210B42700274C98 /* SPExportFile.m in Sources */, 17F90E4B1210B43A00274C98 /* SPExportFileUtilities.m in Sources */, BC85F5D012193B7D00E255B5 /* SPColorAdditions.m in Sources */, + BC878A71121A836F00AE5066 /* SPColorWellCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3