From c16062babbe8da294e8a45007a8bc717de15d27e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 5 Feb 2009 15:35:54 -0500 Subject: [PATCH] Implement a toolbar for the preferences window * Source/AppDelegate.m: (showPreferences:): Don't call methods on the [prefs window] anymore, but [showPreferencesWindow] * Source/PreferencesController.m+h: Add toolbar outlet ivars (showPreferencesWindow): New method (showGeneral:): New method (toolbarSelectableItemIdentifiers:): New method --- English.lproj/Preferences.xib | 623 +++++++++++++++++++++++---------- Source/AppDelegate.m | 2 +- Source/PreferencesController.h | 10 +- Source/PreferencesController.m | 33 ++ 4 files changed, 473 insertions(+), 195 deletions(-) diff --git a/English.lproj/Preferences.xib b/English.lproj/Preferences.xib index 91daf55..37816bf 100644 --- a/English.lproj/Preferences.xib +++ b/English.lproj/Preferences.xib @@ -2,13 +2,14 @@ 1050 - 9E17 - 670 - 949.33 - 352.00 + 9G55 + 672 + 949.43 + 353.00 YES - + + YES @@ -27,140 +28,138 @@ NSApplication - 7 + 3 2 - {{196, 388}, {421, 122}} - 1610612736 + {{196, 388}, {420, 120}} + 1610613760 Preferences NSWindow - - {3.40282e+38, 3.40282e+38} - - - 256 - + + + 8C3684D1-F400-4CBB-897D-0889A0E1CBC8 + + + YES + YES + NO + NO + 1 + 1 + YES - - - 268 - {{77, 84}, {86, 17}} - - YES - - 68288064 - 272630784 - Xdebug Port: - - LucidaGrande - 1.300000e+01 - 1044 - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2OQA - + + YES + 6AEED900-187C-4FE3-B185-35C4C2105744 + NSToolbarFlexibleSpaceItem + NSToolbarSpaceItem + + + YES + + + 6AEED900-187C-4FE3-B185-35C4C2105744 - - 6 - System - controlTextColor - - 3 - MAA - + General + General + + + + NSImage + NSPreferencesGeneral + + + {0, 0} + {0, 0} + YES + NO + -1 + YES + 0 - - - - 268 - {{168, 82}, {60, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - 6 - System - textBackgroundColor - - 3 - MQA + + NSToolbarFlexibleSpaceItem + + Flexible Space + + + + + + {1, 5} + {20000, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState - - 6 - System - textColor - - - - - - - 268 - {{55, 52}, {108, 17}} - - YES - - 68288064 - 272630784 - Xdebug IDE Key: - - - - - - - - - 268 - {{168, 50}, {210, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - 268 - {{17, 14}, {387, 28}} - - YES - - 67239424 - 272629760 - You must close and reopen MacGDBp before these preference values take effect. - - LucidaGrande - 1.100000e+01 - 16 + + NSToolbarSpaceItem + + Space + + + + + + {32, 5} + {32, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + - - - - {421, 122} + + YES + + + + + + YES + + + + + + YES + + + {3.40282e+38, 3.40282e+38} + + + 256 + {420, 120} {{0, 0}, {1680, 1028}} @@ -175,6 +174,135 @@ YES + + + 268 + + YES + + + 268 + {{77, 80}, {86, 17}} + + YES + + 68288064 + 272630784 + Xdebug Port: + + LucidaGrande + 1.300000e+01 + 1044 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 268 + {{168, 78}, {60, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + + + + + + 268 + {{55, 48}, {108, 17}} + + YES + + 68288064 + 272630784 + Xdebug IDE Key: + + + + + + + + + 268 + {{168, 46}, {210, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + + 268 + {{17, 10}, {387, 28}} + + YES + + 67239424 + 272629760 + You must close and reopen MacGDBp before these preference values take effect. + + LucidaGrande + 1.100000e+01 + 16 + + + + + + + + {420, 120} + + NSView + @@ -187,13 +315,29 @@ 3 + + + generalPreferencesView + + + + 42 + + + + generalPreferencesItem + + + + 44 + value: values.Port - + - + value: values.Port value @@ -201,15 +345,15 @@ 2 - 15 + 45 value: values.IDEKey - + - + value: values.IDEKey value @@ -217,7 +361,31 @@ 2 - 17 + 46 + + + + delegate + + + + 47 + + + + toolbar + + + + 48 + + + + showGeneral: + + + + 49 @@ -255,6 +423,7 @@ YES + @@ -263,88 +432,123 @@ YES - - - - - - 4 - + 13 + + + + + 20 + YES - + + + - + - 5 - - + 25 + + + + + 26 + + + + + 29 + + + YES + + + + + + + + GeneralPreferences - 6 - + 32 + YES - + - + - 7 - - + 33 + + + YES + + + - 8 - + 34 + YES - + - + - 9 - - + 35 + + + YES + + + - 10 - + 36 + YES - + - + - 11 - - + 37 + + - 13 - - + 38 + + - 18 - - - YES - - - + 39 + + + + + 40 + + - 19 - - + 41 + + + + + 43 + + @@ -363,32 +567,46 @@ 1.NSWindowTemplate.visibleAtLaunch 1.WindowOrigin 1.editorWindowContentRectSynchronizationRect - 10.IBPluginDependency - 11.IBPluginDependency - 18.IBPluginDependency - 19.IBPluginDependency 2.IBPluginDependency - 4.IBPluginDependency - 5.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency + 20.IBEditorWindowLastContentRect + 20.IBPluginDependency + 25.IBPluginDependency + 26.IBPluginDependency + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 32.IBPluginDependency + 33.IBPluginDependency + 34.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency + 37.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency + 40.IBPluginDependency + 41.IBPluginDependency + 43.IBPluginDependency YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit - {{462, 546}, {421, 122}} + {{647, 290}, {420, 120}} com.apple.InterfaceBuilder.CocoaPlugin - - - {{462, 546}, {421, 122}} - + + + {{647, 290}, {420, 120}} + {196, 240} {{202, 428}, {480, 270}} com.apple.InterfaceBuilder.CocoaPlugin + {{549, 410}, {616, 0}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{369, 249}, {420, 120}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -421,7 +639,7 @@ - 19 + 49 @@ -443,6 +661,25 @@ PreferencesController NSWindowController + + showGeneral: + id + + + YES + + YES + generalPreferencesItem + generalPreferencesView + toolbar + + + YES + NSToolbarItem + NSView + NSToolbar + + IBProjectSource Source/PreferencesController.h diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index db3a2d5..adc6596 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -72,7 +72,7 @@ if (!prefs) prefs = [[PreferencesController alloc] init]; - [[prefs window] makeKeyAndOrderFront:self]; + [prefs showPreferencesWindow]; } /** diff --git a/Source/PreferencesController.h b/Source/PreferencesController.h index 0aca5f9..3f680cc 100644 --- a/Source/PreferencesController.h +++ b/Source/PreferencesController.h @@ -19,7 +19,15 @@ @interface PreferencesController : NSWindowController { - + IBOutlet NSToolbar *toolbar; + + IBOutlet NSView *generalPreferencesView; + IBOutlet NSToolbarItem *generalPreferencesItem; } +- (void)showPreferencesWindow; + +// panel switching +- (IBAction)showGeneral:(id)sender; + @end diff --git a/Source/PreferencesController.m b/Source/PreferencesController.m index 87332aa..620048a 100644 --- a/Source/PreferencesController.m +++ b/Source/PreferencesController.m @@ -30,4 +30,37 @@ return self; } +/** + * Shows the preferences controller window + */ +- (void)showPreferencesWindow +{ + [self showGeneral:self]; + [[self window] makeKeyAndOrderFront:self]; +} + +#pragma mark Panel Switching + +/** + * Shows the general panel + */ +- (IBAction)showGeneral:(id)sender +{ + if ([[self window] contentView] == generalPreferencesView) + return; + + [[self window] setContentView:generalPreferencesView]; + [toolbar setSelectedItemIdentifier:[generalPreferencesItem itemIdentifier]]; +} + +#pragma mark NSToolbar Delegate + +/** + * Returns the selection names + */ +- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar +{ + return [NSArray arrayWithObjects:[generalPreferencesItem itemIdentifier], nil]; +} + @end -- 2.43.5