filename | src/cocoaui/cocoa_prefs.m |
changeset | 1072:d82e04e6d497 |
prev | 1034:7044e01148f0 |
next | 1298:d0eb2307b847 |
author | nkeynes |
date | Sun Feb 12 16:30:26 2012 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Add -Werror for mregparm check, so it actually fails if mregparm isn't accepted |
file | annotate | diff | log | raw |
1.1 --- a/src/cocoaui/cocoa_prefs.m Wed Jun 24 02:41:12 2009 +00001.2 +++ b/src/cocoaui/cocoa_prefs.m Sun Feb 12 16:30:26 2012 +10001.3 @@ -54,6 +54,29 @@1.4 return self;1.5 }1.6 }1.7 +1.8 +- (id)initWithFrame: (NSRect)frameRect title:(NSString *)title configGroup: (lxdream_config_group_t)group scrollable: (BOOL)scroll1.9 +{1.10 + if( [self initWithFrame: frameRect title: title] == nil ) {1.11 + return nil;1.12 + }1.13 + ConfigurationView *view = [[ConfigurationView alloc] initWithFrame: frameRect1.14 + configGroup: group ];1.15 + [view setAutoresizingMask: (NSViewWidthSizable|NSViewMinYMargin)];1.16 + if( scroll ) {1.17 + NSScrollView *scrollView = [[NSScrollView alloc] initWithFrame: NSMakeRect(0,0,frameRect.size.width,[self contentHeight]+TEXT_GAP)];1.18 + [scrollView setAutoresizingMask: (NSViewWidthSizable|NSViewHeightSizable)];1.19 + [scrollView setDocumentView: view];1.20 + [scrollView setDrawsBackground: NO];1.21 + [scrollView setHasVerticalScroller: YES];1.22 + [scrollView setAutohidesScrollers: YES];1.23 + [self addSubview: scrollView];1.24 +// [view scrollRectToVisible: NSMakeRect(0,0,1,1)];1.25 + } else {1.26 + [self addSubview: view];1.27 + }1.28 + return self;1.29 +}1.30 @end1.32 /**************************** Main preferences window ************************/1.33 @@ -85,10 +108,18 @@1.34 [self setDelegate: self];1.35 [self setMinSize: NSMakeSize(400,300)];1.36 [self initToolbar];1.37 - path_pane = cocoa_gui_create_prefs_path_pane();1.38 - ctrl_pane = cocoa_gui_create_prefs_controller_pane();1.39 + config_panes[0] = [[LxdreamPrefsPane alloc] initWithFrame: NSMakeRect(0,0,600,400)1.40 + title: NS_("Paths")1.41 + configGroup: lxdream_get_config_group(CONFIG_GROUP_GLOBAL)1.42 + scrollable: YES];1.43 + config_panes[1] = cocoa_gui_create_prefs_controller_pane();1.44 + config_panes[2] = [[LxdreamPrefsPane alloc] initWithFrame: NSMakeRect(0,0,600,400)1.45 + title: NS_("Hotkeys")1.46 + configGroup: lxdream_get_config_group(CONFIG_GROUP_HOTKEYS)1.47 + scrollable: YES];1.48 +1.49 binding_editor = nil;1.50 - [self setContentView: path_pane];1.51 + [self setContentView: config_panes[0]];1.52 return self;1.53 }1.54 }1.55 @@ -124,9 +155,12 @@1.56 NSToolbarItem *ctrls = [self createToolbarItem: @"Controllers" label: @"Controllers"1.57 tooltip: @"Configure controllers" icon: @"tb-ctrls"1.58 action: @selector(controllers_action:)];1.59 - toolbar_ids = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];1.60 - toolbar_defaults = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];1.61 - NSArray *values = [NSArray arrayWithObjects: paths, ctrls, nil ];1.62 + NSToolbarItem *hotkeys=[self createToolbarItem: @"Hotkeys" label: @"Hotkeys"1.63 + tooltip: @"Configure hotkeys" icon: @"tb-ctrls"1.64 + action: @selector(hotkeys_action:)];1.65 + toolbar_ids = [NSArray arrayWithObjects: @"Paths", @"Controllers", @"Hotkeys", nil ];1.66 + toolbar_defaults = [NSArray arrayWithObjects: @"Paths", @"Controllers", @"Hotkeys", nil ];1.67 + NSArray *values = [NSArray arrayWithObjects: paths, ctrls, hotkeys, nil ];1.68 toolbar_items = [NSDictionary dictionaryWithObjects: values forKeys: toolbar_ids];1.70 [toolbar setDelegate: self];1.71 @@ -138,11 +172,15 @@1.73 - (void)paths_action: (id)sender1.74 {1.75 - [self setContentView: path_pane];1.76 + [self setContentView: config_panes[0]];1.77 }1.78 - (void)controllers_action: (id)sender1.79 {1.80 - [self setContentView: ctrl_pane];1.81 + [self setContentView: config_panes[1]];1.82 +}1.83 +- (void)hotkeys_action: (id)sender1.84 +{1.85 + [self setContentView: config_panes[2]];1.86 }1.88 /***************************** Toolbar methods ***************************/1.89 @@ -171,7 +209,7 @@1.91 - (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar1.92 {1.93 - return [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];1.94 + return [NSArray arrayWithObjects: @"Paths", @"Controllers", @"Hotkeys", nil ];1.95 }1.97 - (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier1.98 @@ -187,4 +225,7 @@1.99 prefs_panel = [[LxdreamPrefsPanel alloc] initWithContentRect: NSMakeRect(0,0,640,540)];1.100 }1.101 [prefs_panel makeKeyAndOrderFront: prefs_panel];1.102 -}1.103 \ No newline at end of file1.104 +}1.105 +1.106 +/**************************** Simple config panels ***************************/1.107 +
.