Search
lxdream.org :: lxdream/src/cocoaui/cocoa_prefs.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cocoaui/cocoa_prefs.c
changeset 770:429ff505c450
prev765:4cd066048203
next849:bbe26d798fc2
author nkeynes
date Mon Jul 28 04:47:28 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Fix some consistency issues between the cocoa + gtk menus
file annotate diff log raw
1.1 --- a/src/cocoaui/cocoa_prefs.c Wed Jul 23 11:11:30 2008 +0000
1.2 +++ b/src/cocoaui/cocoa_prefs.c Mon Jul 28 04:47:28 2008 +0000
1.3 @@ -23,17 +23,6 @@
1.4 static LxdreamPrefsPanel *prefs_panel = NULL;
1.5
1.6 @implementation LxdreamPrefsPane
1.7 -- (NSTextField *)addLabel: (NSString *)text withFrame: (NSRect)frame
1.8 -{
1.9 - NSTextField *label = [[NSTextField alloc] initWithFrame: frame];
1.10 - [label setStringValue: text];
1.11 - [label setBordered: NO];
1.12 - [label setDrawsBackground: NO];
1.13 - [label setEditable: NO];
1.14 - [label setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];
1.15 - [self addSubview: label];
1.16 - return label;
1.17 -}
1.18 - (int)contentHeight
1.19 {
1.20 return [self frame].size.height - headerHeight;
1.21 @@ -49,9 +38,9 @@
1.22 NSFont *titleFont = [NSFont fontWithName: @"Helvetica-Bold" size: 16.0];
1.23 NSRect fontRect = [titleFont boundingRectForFont];
1.24 int titleHeight = fontRect.size.height + [titleFont descender];
1.25 - NSTextField *label = [self addLabel: title withFrame:
1.26 + NSTextField *label = cocoa_gui_add_label(self, title,
1.27 NSMakeRect( TEXT_GAP, height-titleHeight,
1.28 - frameRect.size.width - (TEXT_GAP*2), titleHeight )];
1.29 + frameRect.size.width - (TEXT_GAP*2), titleHeight ));
1.30 [label setFont: titleFont];
1.31 height -= (titleHeight + TEXT_GAP);
1.32
1.33 @@ -67,6 +56,7 @@
1.34 }
1.35 @end
1.36
1.37 +/**************************** Main preferences window ************************/
1.38
1.39 @interface LxdreamPrefsPanel (Private)
1.40 - (void) initToolbar;
1.41 @@ -93,18 +83,37 @@
1.42 } else {
1.43 [self setTitle: NS_("Preferences")];
1.44 [self setDelegate: self];
1.45 + [self setMinSize: NSMakeSize(400,300)];
1.46 [self initToolbar];
1.47 - path_pane = [LxdreamPrefsPathPane new];
1.48 - ctrl_pane = [LxdreamPrefsControllerPane new];
1.49 -
1.50 + path_pane = cocoa_gui_create_prefs_path_pane();
1.51 + ctrl_pane = cocoa_gui_create_prefs_controller_pane();
1.52 + binding_editor = nil;
1.53 [self setContentView: path_pane];
1.54 return self;
1.55 }
1.56 }
1.57 +- (void)dealloc
1.58 +{
1.59 + if( binding_editor != nil ) {
1.60 + [binding_editor release];
1.61 + binding_editor = nil;
1.62 + }
1.63 + [super dealloc];
1.64 +}
1.65 - (void)windowWillClose: (NSNotification *)notice
1.66 {
1.67 prefs_panel = NULL;
1.68 }
1.69 +- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)view
1.70 +{
1.71 + if( [view isKindOfClass: [KeyBindingField class]] ) {
1.72 + if( binding_editor == nil ) {
1.73 + binding_editor = [[[KeyBindingEditor alloc] init] retain];
1.74 + }
1.75 + return binding_editor;
1.76 + }
1.77 + return nil;
1.78 +}
1.79 - (void) initToolbar
1.80 {
1.81 NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"LxdreamPrefsToolbar"];
.