Search
lxdream.org :: lxdream/src/cocoaui/cocoaui.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cocoaui/cocoaui.c
changeset 736:a02d1475ccfd
prev725:4d4018e8eeb8
next738:0cbff49086b8
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/cocoaui/cocoaui.c Sun Jul 06 03:18:55 2008 +0000
1.2 +++ b/src/cocoaui/cocoaui.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -36,11 +36,11 @@
1.4 uint32_t cocoa_gui_run_slice( uint32_t nanosecs );
1.5
1.6 struct dreamcast_module cocoa_gui_module = { "gui", NULL,
1.7 - cocoa_gui_update,
1.8 - cocoa_gui_start,
1.9 - cocoa_gui_run_slice,
1.10 - cocoa_gui_stop,
1.11 - NULL, NULL };
1.12 + cocoa_gui_update,
1.13 + cocoa_gui_start,
1.14 + cocoa_gui_run_slice,
1.15 + cocoa_gui_stop,
1.16 + NULL, NULL };
1.17
1.18 /**
1.19 * Count of running nanoseconds - used to cut back on the GUI runtime
1.20 @@ -61,17 +61,17 @@
1.21 NSMenuItem *menuItem;
1.22 NSString *title;
1.23 NSString *appName;
1.24 -
1.25 +
1.26 appName = @"Lxdream";
1.27 appleMenu = [[NSMenu alloc] initWithTitle:@""];
1.28
1.29 /* Add menu items */
1.30 title = [@"About " stringByAppendingString:appName];
1.31 [appleMenu addItemWithTitle:title action:@selector(about_action:) keyEquivalent:@""];
1.32 -
1.33 -// [appleMenu addItem:[NSMenuItem separatorItem]];
1.34 -// [appleMenu addItemWithTitle: NS_("Preferences...") action:@selector(preferences_action:) keyEquivalent:@","];
1.35 -
1.36 +
1.37 + // [appleMenu addItem:[NSMenuItem separatorItem]];
1.38 + // [appleMenu addItemWithTitle: NS_("Preferences...") action:@selector(preferences_action:) keyEquivalent:@","];
1.39 +
1.40 // Services Menu
1.41 [appleMenu addItem:[NSMenuItem separatorItem]];
1.42 services = [[[NSMenu alloc] init] autorelease];
1.43 @@ -84,8 +84,8 @@
1.44
1.45 // Hide Others
1.46 menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others"
1.47 - action:@selector(hideOtherApplications:)
1.48 - keyEquivalent:@"h"];
1.49 + action:@selector(hideOtherApplications:)
1.50 + keyEquivalent:@"h"];
1.51 [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
1.52
1.53 // Show All
1.54 @@ -101,9 +101,9 @@
1.55 [menuItem setSubmenu: appleMenu];
1.56 NSMenu *menu = [NSMenu new];
1.57 [menu addItem: menuItem];
1.58 -
1.59 +
1.60 NSMenu *gdromMenu = cocoa_gdrom_menu_new();
1.61 -
1.62 +
1.63 NSMenu *fileMenu = [[NSMenu alloc] initWithTitle: NS_("File")];
1.64 [fileMenu addItemWithTitle: NS_("Load Binary") action: @selector(load_binary_action:) keyEquivalent: @"b"];
1.65 [[fileMenu addItemWithTitle: NS_("GD-Rom") action: nil keyEquivalent: @""]
1.66 @@ -116,11 +116,11 @@
1.67 [fileMenu addItem: [NSMenuItem separatorItem]];
1.68 [fileMenu addItemWithTitle: NS_("Load State") action: @selector(load_action:) keyEquivalent: @"o"];
1.69 [fileMenu addItemWithTitle: NS_("Save State") action: @selector(save_action:) keyEquivalent: @"s"];
1.70 -
1.71 +
1.72 menuItem = [[NSMenuItem alloc] initWithTitle:NS_("File") action: nil keyEquivalent: @""];
1.73 [menuItem setSubmenu: fileMenu];
1.74 [menu addItem: menuItem];
1.75 -
1.76 +
1.77 /* Tell the application object that this is now the application menu */
1.78 [NSApp setMainMenu: menu];
1.79 [NSApp setAppleMenu: appleMenu];
1.80 @@ -235,9 +235,9 @@
1.81 gboolean gui_parse_cmdline( int *argc, char **argv[] )
1.82 {
1.83 /* If started from the finder, the first (and only) arg will look something like
1.84 - * -psn_0_... - we want to remove this so that lxdream doesn't try to process it
1.85 - * normally
1.86 - */
1.87 + * -psn_0_... - we want to remove this so that lxdream doesn't try to process it
1.88 + * normally
1.89 + */
1.90 if( *argc == 2 && strncmp((*argv)[1], "-psn_", 5) == 0 ) {
1.91 *argc = 1;
1.92 }
1.93 @@ -247,10 +247,10 @@
1.94 gboolean gui_init( gboolean withDebug )
1.95 {
1.96 dreamcast_register_module( &cocoa_gui_module );
1.97 -
1.98 +
1.99 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1.100 [NSApplication sharedApplication];
1.101 -
1.102 +
1.103 LxdreamDelegate *delegate = [[LxdreamDelegate alloc] init];
1.104 [NSApp setDelegate: delegate];
1.105 NSString *iconFile = [[NSBundle mainBundle] pathForResource:@"dcemu" ofType:@"gif"];
1.106 @@ -261,7 +261,7 @@
1.107 NSWindow *window = cocoa_gui_create_main_window();
1.108 [window makeKeyAndOrderFront: nil];
1.109 [NSApp activateIgnoringOtherApps: YES];
1.110 -
1.111 +
1.112 [pool release];
1.113 }
1.114
1.115 @@ -271,8 +271,8 @@
1.116 cocoa_gui_autorun = YES;
1.117 }
1.118 cocoa_gui_is_running = YES;
1.119 - [NSApp run];
1.120 - cocoa_gui_is_running = NO;
1.121 + [NSApp run];
1.122 + cocoa_gui_is_running = NO;
1.123 }
1.124
1.125 void gui_update_state(void)
1.126 @@ -352,7 +352,7 @@
1.127
1.128 void cocoa_gui_update( void )
1.129 {
1.130 -
1.131 +
1.132 }
1.133
1.134 void cocoa_gui_start( void )
1.135 @@ -375,8 +375,8 @@
1.136 void cocoa_gui_run_later( void )
1.137 {
1.138 [[NSRunLoop currentRunLoop] performSelector: @selector(run_immediate)
1.139 - target: [NSApp delegate] argument: nil order: 1
1.140 - modes: [NSArray arrayWithObject: NSDefaultRunLoopMode] ];
1.141 + target: [NSApp delegate] argument: nil order: 1
1.142 + modes: [NSArray arrayWithObject: NSDefaultRunLoopMode] ];
1.143 }
1.144
1.145 NSImage *NSImage_new_from_framebuffer( frame_buffer_t buffer )
1.146 @@ -384,11 +384,11 @@
1.147 NSBitmapImageRep *rep =
1.148 [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: &buffer->data
1.149 pixelsWide: buffer->width pixelsHigh: buffer->height
1.150 - bitsPerSample: 8 samplesPerPixel: 3
1.151 - hasAlpha: NO isPlanar: NO
1.152 - colorSpaceName: NSDeviceRGBColorSpace bitmapFormat: 0
1.153 - bytesPerRow: buffer->rowstride bitsPerPixel: 24];
1.154 -
1.155 + bitsPerSample: 8 samplesPerPixel: 3
1.156 + hasAlpha: NO isPlanar: NO
1.157 + colorSpaceName: NSDeviceRGBColorSpace bitmapFormat: 0
1.158 + bytesPerRow: buffer->rowstride bitsPerPixel: 24];
1.159 +
1.160 NSImage *image = [[NSImage alloc] initWithSize: NSMakeSize(0.0,0.0)];
1.161 [image addRepresentation: rep];
1.162 return image;
.