Search
lxdream.org :: lxdream :: r725:4d4018e8eeb8
lxdream 0.9.1
released Jun 29
Download Now
changeset725:4d4018e8eeb8
parent724:f2bc1c7cca14
child726:802567cb38f2
authornkeynes
dateSun Jul 06 03:18:55 2008 +0000 (11 years ago)
Add slightly more detailed about dialog
Add (currently empty) preferences dialog (WIP)
src/Makefile.am
src/Makefile.in
src/cocoaui/cocoa_prefs.c
src/cocoaui/cocoaui.c
src/cocoaui/cocoaui.h
1.1 --- a/src/Makefile.am Sun Jul 06 03:17:32 2008 +0000
1.2 +++ b/src/Makefile.am Sun Jul 06 03:18:55 2008 +0000
1.3 @@ -72,7 +72,8 @@
1.4
1.5 if GUI_COCOA
1.6 lxdream_SOURCES += cocoaui/cocoaui.c cocoaui/cocoaui.h \
1.7 - cocoaui/cocoa_win.c cocoaui/cocoa_gd.c drivers/video_osx.c drivers/mac_keymap.h
1.8 + cocoaui/cocoa_win.c cocoaui/cocoa_gd.c cocoaui/cocoa_prefs.c \
1.9 + drivers/video_osx.c drivers/mac_keymap.h
1.10 endif
1.11
1.12 if VIDEO_OSMESA
2.1 --- a/src/Makefile.in Sun Jul 06 03:17:32 2008 +0000
2.2 +++ b/src/Makefile.in Sun Jul 06 03:18:55 2008 +0000
2.3 @@ -53,7 +53,8 @@
2.4 @GUI_GTK_TRUE@ drivers/video_gtk.c drivers/video_gtk.h
2.5
2.6 @GUI_COCOA_TRUE@am__append_4 = cocoaui/cocoaui.c cocoaui/cocoaui.h \
2.7 -@GUI_COCOA_TRUE@ cocoaui/cocoa_win.c cocoaui/cocoa_gd.c drivers/video_osx.c drivers/mac_keymap.h
2.8 +@GUI_COCOA_TRUE@ cocoaui/cocoa_win.c cocoaui/cocoa_gd.c cocoaui/cocoa_prefs.c \
2.9 +@GUI_COCOA_TRUE@ drivers/video_osx.c drivers/mac_keymap.h
2.10
2.11 @VIDEO_OSMESA_TRUE@am__append_5 = drivers/video_gdk.c drivers/video_gdk.h
2.12 @VIDEO_GLX_TRUE@am__append_6 = drivers/video_glx.c drivers/video_glx.h
2.13 @@ -117,12 +118,13 @@
2.14 gtkui/dump_win.c gtkui/ctrl_dlg.c gtkui/path_dlg.c \
2.15 gtkui/gdrom_menu.c drivers/video_gtk.c drivers/video_gtk.h \
2.16 cocoaui/cocoaui.c cocoaui/cocoaui.h cocoaui/cocoa_win.c \
2.17 - cocoaui/cocoa_gd.c drivers/video_osx.c drivers/mac_keymap.h \
2.18 - drivers/video_gdk.c drivers/video_gdk.h drivers/video_glx.c \
2.19 - drivers/video_glx.h drivers/video_nsgl.c drivers/video_nsgl.h \
2.20 - drivers/audio_osx.c drivers/audio_pulse.c drivers/audio_esd.c \
2.21 - drivers/audio_alsa.c drivers/cd_linux.c drivers/cd_osx.c \
2.22 - drivers/osx_iokit.c drivers/cd_none.c drivers/joy_linux.c
2.23 + cocoaui/cocoa_gd.c cocoaui/cocoa_prefs.c drivers/video_osx.c \
2.24 + drivers/mac_keymap.h drivers/video_gdk.c drivers/video_gdk.h \
2.25 + drivers/video_glx.c drivers/video_glx.h drivers/video_nsgl.c \
2.26 + drivers/video_nsgl.h drivers/audio_osx.c drivers/audio_pulse.c \
2.27 + drivers/audio_esd.c drivers/audio_alsa.c drivers/cd_linux.c \
2.28 + drivers/cd_osx.c drivers/osx_iokit.c drivers/cd_none.c \
2.29 + drivers/joy_linux.c
2.30 @BUILD_SH4X86_TRUE@am__objects_1 = sh4x86.$(OBJEXT) sh4trans.$(OBJEXT) \
2.31 @BUILD_SH4X86_TRUE@ x86dasm.$(OBJEXT) i386-dis.$(OBJEXT) \
2.32 @BUILD_SH4X86_TRUE@ dis-init.$(OBJEXT) dis-buf.$(OBJEXT)
2.33 @@ -132,7 +134,8 @@
2.34 @GUI_GTK_TRUE@ ctrl_dlg.$(OBJEXT) path_dlg.$(OBJEXT) \
2.35 @GUI_GTK_TRUE@ gdrom_menu.$(OBJEXT) video_gtk.$(OBJEXT)
2.36 @GUI_COCOA_TRUE@am__objects_3 = cocoaui.$(OBJEXT) cocoa_win.$(OBJEXT) \
2.37 -@GUI_COCOA_TRUE@ cocoa_gd.$(OBJEXT) video_osx.$(OBJEXT)
2.38 +@GUI_COCOA_TRUE@ cocoa_gd.$(OBJEXT) cocoa_prefs.$(OBJEXT) \
2.39 +@GUI_COCOA_TRUE@ video_osx.$(OBJEXT)
2.40 @VIDEO_OSMESA_TRUE@am__objects_4 = video_gdk.$(OBJEXT)
2.41 @VIDEO_GLX_TRUE@am__objects_5 = video_glx.$(OBJEXT)
2.42 @VIDEO_NSGL_TRUE@am__objects_6 = video_nsgl.$(OBJEXT)
2.43 @@ -521,6 +524,7 @@
2.44 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cd_osx.Po@am__quote@
2.45 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi.Po@am__quote@
2.46 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cocoa_gd.Po@am__quote@
2.47 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cocoa_prefs.Po@am__quote@
2.48 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cocoa_win.Po@am__quote@
2.49 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cocoaui.Po@am__quote@
2.50 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@
2.51 @@ -1567,6 +1571,20 @@
2.52 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.53 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_gd.obj `if test -f 'cocoaui/cocoa_gd.c'; then $(CYGPATH_W) 'cocoaui/cocoa_gd.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_gd.c'; fi`
2.54
2.55 +cocoa_prefs.o: cocoaui/cocoa_prefs.c
2.56 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_prefs.o -MD -MP -MF "$(DEPDIR)/cocoa_prefs.Tpo" -c -o cocoa_prefs.o `test -f 'cocoaui/cocoa_prefs.c' || echo '$(srcdir)/'`cocoaui/cocoa_prefs.c; \
2.57 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_prefs.Tpo" "$(DEPDIR)/cocoa_prefs.Po"; else rm -f "$(DEPDIR)/cocoa_prefs.Tpo"; exit 1; fi
2.58 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_prefs.c' object='cocoa_prefs.o' libtool=no @AMDEPBACKSLASH@
2.59 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.60 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_prefs.o `test -f 'cocoaui/cocoa_prefs.c' || echo '$(srcdir)/'`cocoaui/cocoa_prefs.c
2.61 +
2.62 +cocoa_prefs.obj: cocoaui/cocoa_prefs.c
2.63 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cocoa_prefs.obj -MD -MP -MF "$(DEPDIR)/cocoa_prefs.Tpo" -c -o cocoa_prefs.obj `if test -f 'cocoaui/cocoa_prefs.c'; then $(CYGPATH_W) 'cocoaui/cocoa_prefs.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_prefs.c'; fi`; \
2.64 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cocoa_prefs.Tpo" "$(DEPDIR)/cocoa_prefs.Po"; else rm -f "$(DEPDIR)/cocoa_prefs.Tpo"; exit 1; fi
2.65 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cocoaui/cocoa_prefs.c' object='cocoa_prefs.obj' libtool=no @AMDEPBACKSLASH@
2.66 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.67 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cocoa_prefs.obj `if test -f 'cocoaui/cocoa_prefs.c'; then $(CYGPATH_W) 'cocoaui/cocoa_prefs.c'; else $(CYGPATH_W) '$(srcdir)/cocoaui/cocoa_prefs.c'; fi`
2.68 +
2.69 video_osx.o: drivers/video_osx.c
2.70 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_osx.o -MD -MP -MF "$(DEPDIR)/video_osx.Tpo" -c -o video_osx.o `test -f 'drivers/video_osx.c' || echo '$(srcdir)/'`drivers/video_osx.c; \
2.71 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_osx.Tpo" "$(DEPDIR)/video_osx.Po"; else rm -f "$(DEPDIR)/video_osx.Tpo"; exit 1; fi
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/src/cocoaui/cocoa_prefs.c Sun Jul 06 03:18:55 2008 +0000
3.3 @@ -0,0 +1,127 @@
3.4 +/**
3.5 + * $Id: cocoa_win.c 723 2008-06-25 00:39:02Z nkeynes $
3.6 + *
3.7 + * Construct and manage the preferences panel under cocoa.
3.8 + *
3.9 + * Copyright (c) 2008 Nathan Keynes.
3.10 + *
3.11 + * This program is free software; you can redistribute it and/or modify
3.12 + * it under the terms of the GNU General Public License as published by
3.13 + * the Free Software Foundation; either version 2 of the License, or
3.14 + * (at your option) any later version.
3.15 + *
3.16 + * This program is distributed in the hope that it will be useful,
3.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.19 + * GNU General Public License for more details.
3.20 + */
3.21 +
3.22 +#include "cocoaui/cocoaui.h"
3.23 +#include "lxdream.h"
3.24 +#include "config.h"
3.25 +
3.26 +@interface LxdreamPrefsToolbarDelegate : NSObject {
3.27 + NSArray *identifiers;
3.28 + NSArray *defaults;
3.29 + NSDictionary *items;
3.30 +}
3.31 +- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label
3.32 + tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action;
3.33 +@end
3.34 +
3.35 +@implementation LxdreamPrefsToolbarDelegate
3.36 +- (id) init
3.37 +{
3.38 + NSToolbarItem *paths = [self createToolbarItem: @"Paths" label: @"Paths"
3.39 + tooltip: @"Configure system paths" icon: @"tb-paths"
3.40 + action: @selector(paths_action:)];
3.41 + NSToolbarItem *ctrls = [self createToolbarItem: @"Controllers" label: @"Controllers"
3.42 + tooltip: @"Configure controllers" icon: @"tb-ctrls"
3.43 + action: @selector(controllers_action:)];
3.44 + identifiers = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];
3.45 + defaults = [NSArray arrayWithObjects: @"Paths", @"Controllers", nil ];
3.46 + NSArray *values = [NSArray arrayWithObjects: paths, ctrls, nil ];
3.47 + items = [NSDictionary dictionaryWithObjects: values forKeys: identifiers];
3.48 + return self;
3.49 +}
3.50 +
3.51 +- (NSToolbarItem *) createToolbarItem: (NSString *)id label: (NSString *) label
3.52 + tooltip: (NSString *)tooltip icon: (NSString *)icon action: (SEL) action
3.53 +{
3.54 + NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier: id];
3.55 + [item setLabel: label];
3.56 + [item setToolTip: tooltip];
3.57 + [item setTarget: self];
3.58 + NSString *iconFile = [[NSBundle mainBundle] pathForResource:icon ofType:@"png"];
3.59 + NSImage *image = [[NSImage alloc] initWithContentsOfFile: iconFile];
3.60 + [item setImage: image];
3.61 + [item setAction: action];
3.62 + return item;
3.63 +}
3.64 +
3.65 +- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
3.66 +{
3.67 + return identifiers;
3.68 +}
3.69 +
3.70 +- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
3.71 +{
3.72 + return defaults;
3.73 +}
3.74 +
3.75 +- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar
3.76 +{
3.77 + return [NSArray arrayWithObjects: @"Paths", @"Controllers", nil];
3.78 +}
3.79 +
3.80 +- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier
3.81 + willBeInsertedIntoToolbar:(BOOL)flag
3.82 +{
3.83 + return [items objectForKey: itemIdentifier];
3.84 +}
3.85 +- (void)paths_action: (id)sender
3.86 +{
3.87 +}
3.88 +- (void)controllers_action: (id)sender
3.89 +{
3.90 +}
3.91 +@end
3.92 +
3.93 +@implementation LxdreamPrefsPanel
3.94 +- (NSView *)createPathsPane
3.95 +{
3.96 + NSView *pane = [NSView new];
3.97 + int i;
3.98 + for( i=0; i<=CONFIG_KEY_MAX; i++ ) {
3.99 + lxdream_config_entry_t entry = lxdream_get_config_entry(i);
3.100 + if( entry->label != NULL ) {
3.101 + }
3.102 + }
3.103 + return pane;
3.104 +}
3.105 +- (id)initWithContentRect:(NSRect)contentRect
3.106 +{
3.107 + if( [super initWithContentRect: contentRect
3.108 + styleMask: ( NSTitledWindowMask | NSClosableWindowMask |
3.109 + NSMiniaturizableWindowMask | NSResizableWindowMask |
3.110 + NSUnifiedTitleAndToolbarWindowMask )
3.111 + backing: NSBackingStoreBuffered defer: NO ] == nil ) {
3.112 + return nil;
3.113 + } else {
3.114 + [self setTitle: NS_("Preferences")];
3.115 + [self setDelegate: self];
3.116 + NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"LxdreamPrefsToolbar"];
3.117 + [toolbar setDelegate: [[LxdreamPrefsToolbarDelegate alloc] init]];
3.118 + [toolbar setDisplayMode: NSToolbarDisplayModeIconOnly];
3.119 + [toolbar setSizeMode: NSToolbarSizeModeSmall];
3.120 + [toolbar setSelectedItemIdentifier: @"Paths"];
3.121 + [self setToolbar: toolbar];
3.122 + [self setContentView: [self createPathsPane]];
3.123 + return self;
3.124 + }
3.125 +}
3.126 +- (void)windowWillClose: (NSNotification *)notice
3.127 +{
3.128 + [NSApp stopModal];
3.129 +}
3.130 +@end
4.1 --- a/src/cocoaui/cocoaui.c Sun Jul 06 03:17:32 2008 +0000
4.2 +++ b/src/cocoaui/cocoaui.c Sun Jul 06 03:18:55 2008 +0000
4.3 @@ -3,7 +3,7 @@
4.4 *
4.5 * Core Cocoa-based user interface
4.6 *
4.7 - * Copyright (c) 2005 Nathan Keynes.
4.8 + * Copyright (c) 2008 Nathan Keynes.
4.9 *
4.10 * This program is free software; you can redistribute it and/or modify
4.11 * it under the terms of the GNU General Public License as published by
4.12 @@ -67,10 +67,13 @@
4.13
4.14 /* Add menu items */
4.15 title = [@"About " stringByAppendingString:appName];
4.16 - [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
4.17 + [appleMenu addItemWithTitle:title action:@selector(about_action:) keyEquivalent:@""];
4.18 +
4.19 +// [appleMenu addItem:[NSMenuItem separatorItem]];
4.20 +// [appleMenu addItemWithTitle: NS_("Preferences...") action:@selector(preferences_action:) keyEquivalent:@","];
4.21 +
4.22 + // Services Menu
4.23 [appleMenu addItem:[NSMenuItem separatorItem]];
4.24 -
4.25 - // Services Menu
4.26 services = [[[NSMenu alloc] init] autorelease];
4.27 [appleMenu addItemWithTitle:@"Services" action:nil keyEquivalent:@""];
4.28 [appleMenu setSubmenu: services forItem: [appleMenu itemWithTitle: @"Services"]];
4.29 @@ -145,6 +148,20 @@
4.30 cocoa_gui_run_later();
4.31 }
4.32 }
4.33 +- (void) about_action: (id)sender
4.34 +{
4.35 + NSArray *keys = [NSArray arrayWithObjects: @"Version", @"Copyright", nil];
4.36 + NSArray *values = [NSArray arrayWithObjects: @APP_VERSION, @"Copyright (C) 2005-2008 Nathan Keynes", nil];
4.37 +
4.38 + NSDictionary *options= [NSDictionary dictionaryWithObjects: values forKeys: keys];
4.39 +
4.40 + [NSApp orderFrontStandardAboutPanelWithOptions: options];
4.41 +}
4.42 +- (void) preferences_action: (id)sender
4.43 +{
4.44 + LxdreamPrefsPanel *panel = [[LxdreamPrefsPanel alloc] initWithContentRect: NSMakeRect(0,0,600,400)];
4.45 + [NSApp runModalForWindow: panel];
4.46 +}
4.47 - (void) load_action: (id)sender
4.48 {
4.49 NSOpenPanel *panel = [NSOpenPanel openPanel];
4.50 @@ -238,6 +255,7 @@
4.51 [NSApp setDelegate: delegate];
4.52 NSString *iconFile = [[NSBundle mainBundle] pathForResource:@"dcemu" ofType:@"gif"];
4.53 NSImage *iconImage = [[NSImage alloc] initWithContentsOfFile: iconFile];
4.54 + [iconImage setName: @"NSApplicationIcon"];
4.55 [NSApp setApplicationIconImage: iconImage];
4.56 cocoa_gui_create_menu();
4.57 NSWindow *window = cocoa_gui_create_main_window();
5.1 --- a/src/cocoaui/cocoaui.h Sun Jul 06 03:17:32 2008 +0000
5.2 +++ b/src/cocoaui/cocoaui.h Sun Jul 06 03:18:55 2008 +0000
5.3 @@ -41,5 +41,10 @@
5.4 - (void)setIsGrabbed:(BOOL)grab;
5.5 @end
5.6
5.7 +@interface LxdreamPrefsPanel : NSPanel
5.8 +{
5.9 +}
5.10 +- (id)initWithContentRect:(NSRect)contentRect;
5.11 +@end
5.12
5.13 #endif /* lxdream_cocoaui_H */
5.14 \ No newline at end of file
.