diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-08-17 19:39:14 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-08-17 19:39:14 +0000 |
commit | cb3f168082f921bdfd65eecec7d21eaf4e8bd79e (patch) | |
tree | 82e44241baf24f06a7b8fb4f157973828b9cf189 | |
parent | 86c687edf1b91e18b55389200ea363ebd1f29058 (diff) | |
download | sequelpro-cb3f168082f921bdfd65eecec7d21eaf4e8bd79e.tar.gz sequelpro-cb3f168082f921bdfd65eecec7d21eaf4e8bd79e.tar.bz2 sequelpro-cb3f168082f921bdfd65eecec7d21eaf4e8bd79e.zip |
• Editor color setting in Pref pane displays the color names using the Editor's font
- added some logic for closing the NSColorPanel
- some GUI tweaks
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 36 | ||||
-rw-r--r-- | Source/SPPreferenceController.m | 20 | ||||
-rw-r--r-- | Source/SPTextView.m | 6 |
3 files changed, 39 insertions, 23 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index f900f44d..f44b75b9 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -21,7 +21,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="802"/> + <integer value="1682"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -604,7 +604,7 @@ <reference key="NSNextResponder" ref="594324362"/> <int key="NSvFlags">12</int> <string key="NSFrame">{{202.5, 176}, {360, 5}}</string> - <string key="NSBounds">{{3, 0}, {354, 5}}</string> + <string key="NSBounds">{{4, 0}, {352, 5}}</string> <reference key="NSSuperview" ref="594324362"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -3292,7 +3292,7 @@ AQAAAAA</bytes> <object class="NSTableView" id="953919633"> <reference key="NSNextResponder" ref="25515031"/> <int key="NSvFlags">256</int> - <string key="NSFrameSize">{194, 242}</string> + <string key="NSFrameSize">{220, 242}</string> <reference key="NSSuperview" ref="25515031"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> @@ -3304,7 +3304,7 @@ AQAAAAA</bytes> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTableColumn" id="1021385850"> <string key="NSIdentifier">name</string> - <double key="NSWidth">142</double> + <double key="NSWidth">168</double> <double key="NSMinWidth">40</double> <double key="NSMaxWidth">1000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> @@ -3319,8 +3319,8 @@ AQAAAAA</bytes> <reference key="NSTextColor" ref="263643234"/> </object> <object class="NSTextFieldCell" key="NSDataCell" id="208478618"> - <int key="NSCellFlags">337772096</int> - <int key="NSCellFlags2">2048</int> + <int key="NSCellFlags">69336641</int> + <int key="NSCellFlags2">1073747968</int> <string key="NSContents">Text Cell</string> <reference key="NSSupport" ref="320262838"/> <reference key="NSControlView" ref="953919633"/> @@ -3334,9 +3334,9 @@ AQAAAAA</bytes> </object> <object class="NSTableColumn" id="78796435"> <string key="NSIdentifier">color</string> - <double key="NSWidth">40</double> - <double key="NSMinWidth">40</double> - <double key="NSMaxWidth">1000</double> + <double key="NSWidth">45</double> + <double key="NSMinWidth">45</double> + <double key="NSMaxWidth">45</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628096</int> <int key="NSCellFlags2">2048</int> @@ -3364,7 +3364,7 @@ AQAAAAA</bytes> <reference key="NSBackgroundColor" ref="887465699"/> <reference key="NSGridColor" ref="651588562"/> <double key="NSRowHeight">20</double> - <int key="NSTvFlags">304087040</int> + <int key="NSTvFlags">1377828864</int> <reference key="NSDelegate"/> <reference key="NSDataSource"/> <int key="NSColumnAutoresizingStyle">0</int> @@ -3374,7 +3374,7 @@ AQAAAAA</bytes> <int key="NSTableViewDraggingDestinationStyle">0</int> </object> </object> - <string key="NSFrame">{{1, 1}, {194, 242}}</string> + <string key="NSFrame">{{1, 1}, {220, 242}}</string> <reference key="NSSuperview" ref="288292400"/> <reference key="NSNextKeyView" ref="953919633"/> <reference key="NSDocView" ref="953919633"/> @@ -3401,7 +3401,7 @@ AQAAAAA</bytes> <double key="NSPercent">0.57142859697341919</double> </object> </object> - <string key="NSFrame">{{32, 20}, {196, 244}}</string> + <string key="NSFrame">{{20, 20}, {222, 244}}</string> <reference key="NSSuperview" ref="1033452264"/> <reference key="NSNextKeyView" ref="25515031"/> <int key="NSsFlags">2</int> @@ -4112,10 +4112,6 @@ AQAAAAA</bytes> <string key="NSClassName">NSView</string> </object> <object class="NSUserDefaultsController" id="151174232"> - <object class="NSMutableArray" key="NSDeclaredKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>GlobalResultTableFont</string> - </object> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSArrayController" id="937123943"> @@ -7300,9 +7296,9 @@ AQAAAAA</bytes> <reference ref="774563613"/> <reference ref="782193237"/> <reference ref="742042283"/> - <reference ref="288292400"/> <reference ref="462361579"/> <reference ref="748242000"/> + <reference ref="288292400"/> </object> <reference key="parent" ref="0"/> <string key="objectName">Editor</string> @@ -10110,13 +10106,13 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{286, 419}, {580, 361}}</string> + <string>{{286, 395}, {580, 361}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBUserGuide"> <reference key="view" ref="1033452264"/> - <double key="location">195</double> + <double key="location">147</double> <int key="affinity">0</int> </object> <object class="IBUserGuide"> @@ -10163,7 +10159,7 @@ AQAAAAA</bytes> </object> </object> <nil key="sourceID"/> - <int key="maxID">1699</int> + <int key="maxID">1707</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 4f249723..ad8d6bb8 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -106,9 +106,12 @@ } - NSTableColumn* column; - SPColorWellCell* colorCell; - + NSTableColumn *column; + SPColorWellCell *colorCell; + NSTextFieldCell *textCell; + column = [[colorSettingTableView tableColumns] objectAtIndex: 0]; + textCell = [[[NSTextFieldCell alloc] init] autorelease]; + [textCell setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]]; column = [[colorSettingTableView tableColumns] objectAtIndex: 1]; colorCell = [[[SPColorWellCell alloc] init] autorelease]; [colorCell setEditable: YES]; @@ -857,6 +860,8 @@ if(tableView == colorSettingTableView && [[tableColumn identifier] isEqualToString:@"name"]) { if ([cell isKindOfClass:[NSTextFieldCell class]]) { [cell setDrawsBackground:YES]; + NSFont *nf = [NSFont fontWithName:[[[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]] fontName] size:13.0f]; + [cell setFont:nf]; switch(index) { case 1: [cell setTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]]; @@ -1202,6 +1207,9 @@ // ------------------------------------------------------------------------------- - (void)windowWillClose:(NSNotification *)notification { + + [[NSColorPanel sharedColorPanel] close]; + // Mark the currently selected field in the window as having finished editing, to trigger saves. if ([preferencesWindow firstResponder]) [preferencesWindow endEditingFor:[preferencesWindow firstResponder]]; @@ -1214,6 +1222,9 @@ // ------------------------------------------------------------------------------- - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize { + + [[NSColorPanel sharedColorPanel] close]; + if ([sender showsResizeIndicator]) return frameSize; else @@ -1364,6 +1375,7 @@ // reset syntax highlighting colors - (IBAction)setDefaultColors:(id)sender { + [[NSColorPanel sharedColorPanel] close]; [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]; @@ -1393,6 +1405,7 @@ - (void)colorChanged:(id)sender { + if(![[NSColorPanel sharedColorPanel] isVisible]) return; [prefs setObject:[NSArchiver archivedDataWithRootObject:[sender color]] forKey:[editorColors objectAtIndex:colorRow]]; [colorSettingTableView reloadData]; @@ -1423,6 +1436,7 @@ [editorFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]]; break; } + [colorSettingTableView reloadData]; } /** diff --git a/Source/SPTextView.m b/Source/SPTextView.m index a4ed1adc..a045a4ad 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -3317,6 +3317,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSLog(@"%@ ‘%@’.", NSLocalizedString(@"Couldn't read the file content of", @"Couldn't read the file content of"), aPath); } +// Do nothing if NSColorPanel was opened from the NSTextView +- (void)changeColor:(id)sender +{ + return; +} + - (void)changeFont:(id)sender { if (prefs && [self font] != nil) { |