Thread: [Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [255] branches/fusegl/fuse/fusepb
Brought to you by:
fredm
From: <fr...@us...> - 2006-12-19 11:26:36
|
Revision: 255 http://svn.sourceforge.net/fuse-for-macosx/?rev=255&view=rev Author: fredm Date: 2006-12-19 03:26:36 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Remove obsolete files. Removed Paths: ------------- branches/fusegl/fuse/fusepb/SDLMain.h branches/fusegl/fuse/fusepb/SDLMain.mm Deleted: branches/fusegl/fuse/fusepb/SDLMain.h =================================================================== --- branches/fusegl/fuse/fusepb/SDLMain.h 2006-12-19 11:02:48 UTC (rev 254) +++ branches/fusegl/fuse/fusepb/SDLMain.h 2006-12-19 11:26:36 UTC (rev 255) @@ -1,13 +0,0 @@ -/* SDLMain.m - main entry point for our Cocoa-ized SDL app - Initial Version: Darrell Walisser <dwa...@pu...> - Non-NIB-Code & other changes: Max Horn <ma...@qu...> - - Feel free to customize this file to suit your needs -*/ - -#import <Cocoa/Cocoa.h> - -@interface SDLMain : NSObject -+(void)loadFile:(NSString *)filename; -+(void)initialize; -@end Deleted: branches/fusegl/fuse/fusepb/SDLMain.mm =================================================================== --- branches/fusegl/fuse/fusepb/SDLMain.mm 2006-12-19 11:02:48 UTC (rev 254) +++ branches/fusegl/fuse/fusepb/SDLMain.mm 2006-12-19 11:26:36 UTC (rev 255) @@ -1,567 +0,0 @@ -/* SDLMain.m - main entry point for our Cocoa-ized SDL app - Initial Version: Darrell Walisser <dwa...@pu...> - Non-NIB-Code & other changes: Max Horn <ma...@qu...> - - Feel free to customize this file to suit your needs - - Customised for Fuse by Fredrick Meunier <fr...@sp...> -*/ - -#import "ScalerNameToIdTransformer.h" -#import "MachineScalerIsEnabled.h" -#import "MachineNameToIdTransformer.h" -#import "VolumeSliderToPrefTransformer.h" - -extern "C" { -#import "SDL.h" -#import "SDLMain.h" -#import <sys/param.h> /* for MAXPATHLEN */ -#import <unistd.h> -#include <sys/types.h> -#include <sys/mman.h> -#include <libspectrum.h> -#include <config.h> -#include "dck.h" -#include "display.h" -#include "fuse.h" -#include "if2.h" -#include "machines/specplus3.h" -#include "rzx.h" -#include "screenshot.h" -#include "settings.h" -#include "snapshot.h" -#include "tape.h" -#include "trdos.h" -#include "utils.h" -}; - -/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, - but the method still is there and works. To avoid warnings, we declare - it ourselves here. */ -@interface NSApplication(SDL_Missing_Methods) -- (void)setAppleMenu:(NSMenu *)menu; -@end - -/* Use this flag to determine whether we use SDLMain.nib or not */ -#define SDL_USE_NIB_FILE 1 - -/* Use this flag to determine whether we use CPS (docking) or not */ -#define SDL_USE_CPS 1 -#ifdef SDL_USE_CPS -/* Portions of CPS.h */ -typedef struct CPSProcessSerNum -{ - UInt32 lo; - UInt32 hi; -} CPSProcessSerNum; - -extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); -extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); -extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); - -#endif /* SDL_USE_CPS */ - -static int gArgc; -static char **gArgv; -static BOOL gFinderLaunch; -static BOOL gCalledAppMainline = FALSE; - -static NSString *getApplicationName(void) -{ - NSDictionary *dict; - NSString *appName = 0; - - /* Determine the application name */ - dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); - if (dict) - appName = [dict objectForKey: @"CFBundleName"]; - - if (![appName length]) - appName = [[NSProcessInfo processInfo] processName]; - - return appName; -} - -#if SDL_USE_NIB_FILE -/* A helper category for NSString */ -@interface NSString (ReplaceSubString) -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; -@end -#endif - -@interface SDLApplication : NSApplication -@end - -@implementation SDLApplication -/* Invoked from the Quit menu item */ -- (void)terminate:(id)sender -{ - /* Post a SDL_QUIT event */ - SDL_Event event; - event.type = SDL_QUIT; - SDL_PushEvent(&event); -} -@end - - -/* The main class of the application, the application's delegate */ -@implementation SDLMain - -/* Set the working directory to the .app's parent directory */ -- (void) setupWorkingDirectory:(BOOL)shouldChdir -{ - - if (shouldChdir) - { - char parentdir[MAXPATHLEN]; - CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); - if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) { - assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ - } - CFRelease(url); - CFRelease(url2); - } - -} - -#if SDL_USE_NIB_FILE - -/* Fix menu to contain the real app name instead of "SDL App" */ -- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName -{ - NSRange aRange; - NSEnumerator *enumerator; - NSMenuItem *menuItem; - - aRange = [[aMenu title] rangeOfString:@"SDL App"]; - if (aRange.length != 0) - [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; - - enumerator = [[aMenu itemArray] objectEnumerator]; - while ((menuItem = [enumerator nextObject])) - { - aRange = [[menuItem title] rangeOfString:@"SDL App"]; - if (aRange.length != 0) - [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; - if ([menuItem hasSubmenu]) - [self fixMenu:[menuItem submenu] withAppName:appName]; - } - [ aMenu sizeToFit ]; -} - -#else - -static void setApplicationMenu(void) -{ - /* warning: this code is very odd */ - NSMenu *appleMenu; - NSMenuItem *menuItem; - NSString *title; - NSString *appName; - - appName = getApplicationName(); - appleMenu = [[NSMenu alloc] initWithTitle:@""]; - - /* Add menu items */ - title = [@"About " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Hide " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; - - menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; - - [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Quit " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; - - - /* Put menu into the menubar */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:appleMenu]; - [[NSApp mainMenu] addItem:menuItem]; - - /* Tell the application object that this is now the application menu */ - [NSApp setAppleMenu:appleMenu]; - - /* Finally give up our references to the objects */ - [appleMenu release]; - [menuItem release]; -} - -/* Create a window menu */ -static void setupWindowMenu(void) -{ - NSMenu *windowMenu; - NSMenuItem *windowMenuItem; - NSMenuItem *menuItem; - - windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - - /* "Minimize" item */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; - [windowMenu addItem:menuItem]; - [menuItem release]; - - /* Put menu into the menubar */ - windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; - [windowMenuItem setSubmenu:windowMenu]; - [[NSApp mainMenu] addItem:windowMenuItem]; - - /* Tell the application object that this is now the window menu */ - [NSApp setWindowsMenu:windowMenu]; - - /* Finally give up our references to the objects */ - [windowMenu release]; - [windowMenuItem release]; -} - -/* Replacement for NSApplicationMain */ -static void CustomApplicationMain (int argc, char **argv) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - SDLMain *sdlMain; - - /* Ensure the application object is initialised */ - [SDLApplication sharedApplication]; - -#ifdef SDL_USE_CPS - { - CPSProcessSerNum PSN; - /* Tell the dock about us */ - if (!CPSGetCurrentProcess(&PSN)) - if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) - if (!CPSSetFrontProcess(&PSN)) - [SDLApplication sharedApplication]; - } -#endif /* SDL_USE_CPS */ - - /* Set up the menubar */ - [NSApp setMainMenu:[[NSMenu alloc] init]]; - setApplicationMenu(); - setupWindowMenu(); - - /* Create SDLMain and make it the app delegate */ - sdlMain = [[SDLMain alloc] init]; - [NSApp setDelegate:sdlMain]; - - /* Start the main event loop */ - [NSApp run]; - - [sdlMain release]; - [pool release]; -} - -#endif - -/* Called when the internal event loop has just started running */ -- (void) applicationDidFinishLaunching: (NSNotification *) note -{ - int status; - - /* Set the working directory to the .app's parent directory */ - [self setupWorkingDirectory:gFinderLaunch]; - -#if SDL_USE_NIB_FILE - /* Set the main menu to contain the real app name instead of "SDL App" */ - [self fixMenu:[NSApp mainMenu] withAppName:[[NSProcessInfo processInfo] processName]]; -#endif - - /* Hand off to main application code */ - gCalledAppMainline = TRUE; - status = SDL_main (gArgc, gArgv); - - /* We're done, thank you for playing */ - exit(status); -} - -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename -{ - utils_file file; libspectrum_id_t type; - libspectrum_class_t lsclass; - char fsrep[MAXPATHLEN+1]; - - if ( display_ui_initialised ) - [SDLMain loadFile:filename]; - else { - [filename getFileSystemRepresentation:fsrep maxLength:MAXPATHLEN]; - - if( utils_read_file( fsrep, &file ) ) fuse_abort(); - - if( libspectrum_identify_file( &type, fsrep, file.buffer, file.length ) ) { - utils_close_file( &file ); - fuse_abort(); - } - - if( libspectrum_identify_class( &lsclass, type ) ) fuse_abort(); - - switch( lsclass ) { - - case LIBSPECTRUM_CLASS_UNKNOWN: - fprintf( stderr, "%s: couldn't identify `%s'\n", fuse_progname, fsrep ); - case LIBSPECTRUM_CLASS_SCREENSHOT: - utils_close_file( &file ); - return NO; - - case LIBSPECTRUM_CLASS_RECORDING: - settings_current.playback_file = strdup( fsrep ); - break; - - case LIBSPECTRUM_CLASS_SNAPSHOT: - settings_current.snapshot = strdup( fsrep ); - break; - - case LIBSPECTRUM_CLASS_TAPE: - settings_current.tape_file = strdup( fsrep ); - break; - - case LIBSPECTRUM_CLASS_DISK_PLUS3: - settings_current.plus3disk_file = strdup( fsrep ); - break; - - case LIBSPECTRUM_CLASS_DISK_TRDOS: - settings_current.trdosdisk_file = strdup( fsrep ); - break; - - case LIBSPECTRUM_CLASS_CARTRIDGE_TIMEX: - settings_current.dck_file = strdup( fsrep ); - break; - - case LIBSPECTRUM_CLASS_CARTRIDGE_IF2: - settings_current.if2_file = strdup( fsrep ); - break; - - case LIBSPECTRUM_CLASS_HARDDISK: - if( settings_current.zxcf_active ) { - settings_current.zxcf_pri_file = strdup( fsrep ); - } else if( settings_current.zxatasp_active ) { - settings_current.zxatasp_master_file = strdup( fsrep ); - } else if( settings_current.simpleide_active ) { - settings_current.simpleide_master_file = strdup( fsrep ); - } else { - /* No IDE interface active, so activate the ZXCF */ - settings_current.zxcf_active = 1; - settings_current.zxcf_pri_file = strdup( fsrep ); - } - break; - - default: - fprintf( stderr, "%s: loadFile: unknown class %d!\n", - fuse_progname, type ); - } - - if( utils_close_file( &file ) ) fuse_abort(); - } - - return YES; -} - -+(void)loadFile:(NSString *)filename -{ - utils_file file; libspectrum_id_t type; - libspectrum_class_t lsclass; - int error = 0; - char fsrep[MAXPATHLEN+1]; - - [filename getFileSystemRepresentation:fsrep maxLength:MAXPATHLEN]; - - if( utils_read_file( fsrep, &file ) ) fuse_abort(); - - if( libspectrum_identify_file( &type, fsrep, file.buffer, file.length ) ) { - utils_close_file( &file ); - fuse_abort(); - } - - if( libspectrum_identify_class( &lsclass, type ) ) fuse_abort(); - - switch( lsclass ) { - - case LIBSPECTRUM_CLASS_UNKNOWN: - fprintf( stderr, "%s: couldn't identify `%s'\n", fuse_progname, - fsrep ); - utils_close_file( &file ); - fuse_abort(); - - case LIBSPECTRUM_CLASS_RECORDING: - error = rzx_start_playback_from_buffer( file.buffer, file.length ); - break; - - case LIBSPECTRUM_CLASS_SNAPSHOT: - error = snapshot_read_buffer( file.buffer, file.length, type ); - break; - - case LIBSPECTRUM_CLASS_TAPE: - error = tape_read_buffer( file.buffer, file.length, type, fsrep, - settings_current.auto_load ); - break; - - case LIBSPECTRUM_CLASS_SCREENSHOT: - error = screenshot_scr_read( fsrep ); - break; - - case LIBSPECTRUM_CLASS_DISK_PLUS3: - error = machine_select( LIBSPECTRUM_MACHINE_PLUS3 ); - - if( !error ) - error = specplus3_disk_insert_default_autoload( SPECPLUS3_DRIVE_A, - fsrep ); - break; - - case LIBSPECTRUM_CLASS_DISK_TRDOS: - error = machine_select( LIBSPECTRUM_MACHINE_PENT ); - - if( !error ) - error = trdos_disk_insert_default_autoload( TRDOS_DRIVE_A, fsrep ); - break; - - case LIBSPECTRUM_CLASS_CARTRIDGE_TIMEX: - error = dck_insert( fsrep ); - - if( !error ) - error = machine_select( LIBSPECTRUM_MACHINE_TC2068 ); - break; - - case LIBSPECTRUM_CLASS_CARTRIDGE_IF2: - error = if2_insert( fsrep ); - break; - - default: - fprintf( stderr, "%s: loadFile: unknown class %d!\n", fuse_progname, type ); - fuse_abort(); - } - - if( utils_close_file( &file ) ) fuse_abort(); -} - -+(void)initialize -{ - ScalerNameToIdTransformer *sNToITransformer; - MachineScalerIsEnabled *machineScalerIsEnabled; - MachineNameToIdTransformer *mToITransformer; - VolumeSliderToPrefTransformer *vsToPTransformer; - - sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:sNToITransformer - forName:@"ScalerNameToIdTransformer"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:1] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsEnabled"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:0] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsDisabled"]; - - mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:mToITransformer - forName:@"MachineNameToIdTransformer"]; - - vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:vsToPTransformer - forName:@"VolumeSliderToPrefTransformer"]; - -} - -@end - - -@implementation NSString (ReplaceSubString) - -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString -{ - unsigned int bufferSize; - unsigned int selfLen = [self length]; - unsigned int aStringLen = [aString length]; - unichar *buffer; - NSRange localRange; - NSString *result; - - bufferSize = selfLen + aStringLen - aRange.length; - buffer = static_cast<unichar*>(NSAllocateMemoryPages(bufferSize*sizeof(unichar))); - - /* Get first part into buffer */ - localRange.location = 0; - localRange.length = aRange.location; - [self getCharacters:buffer range:localRange]; - - /* Get middle part into buffer */ - localRange.location = 0; - localRange.length = aStringLen; - [aString getCharacters:(buffer+aRange.location) range:localRange]; - - /* Get last part into buffer */ - localRange.location = aRange.location + aRange.length; - localRange.length = selfLen - localRange.location; - [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; - - /* Build output string */ - result = [NSString stringWithCharacters:buffer length:bufferSize]; - - NSDeallocateMemoryPages(buffer, bufferSize); - - return result; -} - -@end - - - -#ifdef main -# undef main -#endif - - -/* Main entry point to executable - should *not* be SDL_main! */ -int main (int argc, char *argv[]) -{ - int error; - - /* Copy the arguments into a global variable */ - int i; - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - /* This is passed if we are launched by double-clicking */ - if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { - gArgc = 1; - gFinderLaunch = YES; - } else { - gArgc = argc; - gFinderLaunch = NO; - } - gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1)); - assert (gArgv != NULL); - for (i = 0; i < gArgc; i++) - gArgv[i] = argv[i]; - gArgv[i] = NULL; - - error = settings_defaults( &settings_current ); - if( error ) return error; - -#if SDL_USE_NIB_FILE - [SDLApplication poseAsClass:[NSApplication class]]; - NSApplicationMain (argc, const_cast<const char**>(argv)); -#else - CustomApplicationMain (argc, argv); -#endif - - [pool release]; - - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2006-12-25 01:32:18
|
Revision: 263 http://svn.sourceforge.net/fuse-for-macosx/?rev=263&view=rev Author: fredm Date: 2006-12-24 17:32:17 -0800 (Sun, 24 Dec 2006) Log Message: ----------- * Prevent error on opening Fuse from Finder * Make Fuse exit when application window is closed * Restore exit confirmation dialogs Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.h branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/main.mm branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib Removed Paths: ------------- branches/fusegl/fuse/fusepb/sdlui.h Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.h =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.h 2006-12-24 13:35:50 UTC (rev 262) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.h 2006-12-25 01:32:17 UTC (rev 263) @@ -70,6 +70,7 @@ TapeBrowserController *tapeBrowserController; } + (FuseController *)singleton; + - (IBAction)cocoa_break:(id)sender; - (IBAction)disk_eject_a:(id)sender; - (IBAction)disk_eject_b:(id)sender; @@ -156,4 +157,7 @@ - (void)setTapePlayMenu:(ui_statusbar_state)state; +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication; +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; + @end Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2006-12-24 13:35:50 UTC (rev 262) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2006-12-25 01:32:17 UTC (rev 263) @@ -70,9 +70,10 @@ #include "zxatasp.h" #include "zxcf.h" -static char* aquaui_openpanel_get_filename( NSString *title, NSArray *fileTypes ); -static char* aquaui_savepanel_get_filename( NSString *title, NSArray *fileTypes ); -static void aquaui_disk_eject( specplus3_drive_number drive, int which ); +static char* cocoaui_openpanel_get_filename( NSString *title, NSArray *fileTypes ); +static char* cocoaui_savepanel_get_filename( NSString *title, NSArray *fileTypes ); +static void cocoaui_disk_eject( specplus3_drive_number drive, int which ); +static int cocoaui_confirm( const char *message ); static int dockEject = 0; static int if2Eject = 0; @@ -218,22 +219,22 @@ - (IBAction)disk_eject_a:(id)sender { - aquaui_disk_eject( SPECPLUS3_DRIVE_A, 0 ); + cocoaui_disk_eject( SPECPLUS3_DRIVE_A, 0 ); } - (IBAction)disk_eject_write_a:(id)sender { - aquaui_disk_eject( SPECPLUS3_DRIVE_A, 1 ); + cocoaui_disk_eject( SPECPLUS3_DRIVE_A, 1 ); } - (IBAction)disk_eject_b:(id)sender { - aquaui_disk_eject( SPECPLUS3_DRIVE_B, 0 ); + cocoaui_disk_eject( SPECPLUS3_DRIVE_B, 0 ); } - (IBAction)disk_eject_write_b:(id)sender { - aquaui_disk_eject( SPECPLUS3_DRIVE_B, 1 ); + cocoaui_disk_eject( SPECPLUS3_DRIVE_B, 1 ); } - (IBAction)disk_open_a:(id)sender @@ -253,7 +254,7 @@ fuse_emulation_pause(); - filename = aquaui_openpanel_get_filename( @"Insert Timex dock cartridge", dckFileTypes ); + filename = cocoaui_openpanel_get_filename( @"Insert Timex dock cartridge", dckFileTypes ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -284,7 +285,7 @@ fuse_emulation_pause(); - filename = aquaui_openpanel_get_filename( @"Insert Interface II cartridge", romFileTypes ); + filename = cocoaui_openpanel_get_filename( @"Insert Interface II cartridge", romFileTypes ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -315,7 +316,7 @@ fuse_emulation_pause(); - filename = aquaui_openpanel_get_filename( @"Insert hard disk file", ideFileTypes ); + filename = cocoaui_openpanel_get_filename( @"Insert hard disk file", ideFileTypes ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -380,7 +381,7 @@ fuse_emulation_pause(); - filename = aquaui_openpanel_get_filename( @"Insert microdrive disk file", mdrFileTypes ); + filename = cocoaui_openpanel_get_filename( @"Insert microdrive disk file", mdrFileTypes ); if( !filename ) { fuse_emulation_unpause(); return; } if1_mdr_insert( filename, [sender tag] - 30 ); @@ -400,7 +401,7 @@ fuse_emulation_pause(); - filename = aquaui_savepanel_get_filename( @"Write Microdrive Cartridge As", [NSArray arrayWithObjects:@"mdr", nil] ); + filename = cocoaui_savepanel_get_filename( @"Write Microdrive Cartridge As", [NSArray arrayWithObjects:@"mdr", nil] ); if( !filename ) { fuse_emulation_unpause(); return; } if1_mdr_sync( filename, [sender tag] - 30 ); @@ -420,7 +421,7 @@ fuse_emulation_pause(); - filename = aquaui_savepanel_get_filename( @"Write Microdrive Cartridge As", [NSArray arrayWithObjects:@"mdr", nil] ); + filename = cocoaui_savepanel_get_filename( @"Write Microdrive Cartridge As", [NSArray arrayWithObjects:@"mdr", nil] ); if( !filename ) { fuse_emulation_unpause(); return; } if1_mdr_eject( filename, [sender tag] - 30 ); @@ -445,7 +446,7 @@ fuse_emulation_pause(); - filename = aquaui_openpanel_get_filename( @"Open Spectrum File", allFileTypes ); + filename = cocoaui_openpanel_get_filename( @"Open Spectrum File", allFileTypes ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -487,7 +488,7 @@ fuse_emulation_pause(); - recording = aquaui_openpanel_get_filename( @"Start Replay", rzxFileTypes ); + recording = cocoaui_openpanel_get_filename( @"Start Replay", rzxFileTypes ); if( !recording ) { fuse_emulation_unpause(); return; } @@ -553,7 +554,7 @@ fuse_emulation_pause(); - recording = aquaui_savepanel_get_filename( @"Start Recording", [NSArray arrayWithObjects:@"rzx", nil] ); + recording = cocoaui_savepanel_get_filename( @"Start Recording", [NSArray arrayWithObjects:@"rzx", nil] ); if( !recording ) { fuse_emulation_unpause(); return; } rzx_start_recording( recording, 1 ); @@ -573,10 +574,10 @@ fuse_emulation_pause(); - snap = aquaui_openpanel_get_filename( @"Load Snapshot", snapFileTypes ); + snap = cocoaui_openpanel_get_filename( @"Load Snapshot", snapFileTypes ); if( !snap ) { fuse_emulation_unpause(); return; } - recording = aquaui_savepanel_get_filename( @"Start Recording", [NSArray arrayWithObjects:@"rzx", nil] ); + recording = cocoaui_savepanel_get_filename( @"Start Recording", [NSArray arrayWithObjects:@"rzx", nil] ); if( !recording ) { free( snap ); fuse_emulation_unpause(); return; } if( snapshot_read( snap ) ) { @@ -610,7 +611,7 @@ fuse_emulation_pause(); - psgfile = aquaui_savepanel_get_filename( @"Start AY Sound Recording", [NSArray arrayWithObjects:@"psg", nil] ); + psgfile = cocoaui_savepanel_get_filename( @"Start AY Sound Recording", [NSArray arrayWithObjects:@"psg", nil] ); if( !psgfile ) { fuse_emulation_unpause(); return; } psg_start_recording( psgfile ); @@ -638,7 +639,7 @@ fuse_emulation_pause(); - filename = aquaui_savepanel_get_filename( @"Save Snapshot As", [NSArray arrayWithObjects:@"szx", @"z80", @"sna", nil] ); + filename = cocoaui_savepanel_get_filename( @"Save Snapshot As", [NSArray arrayWithObjects:@"szx", @"z80", @"sna", nil] ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -660,7 +661,7 @@ fuse_emulation_pause(); - filename = aquaui_openpanel_get_filename( @"Open SCR Screenshot", scrFileType ); + filename = cocoaui_openpanel_get_filename( @"Open SCR Screenshot", scrFileType ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -686,7 +687,7 @@ fuse_emulation_pause(); - filename = aquaui_savepanel_get_filename( @"Save Profile Data As", [NSArray arrayWithObjects:@"profile", nil] ); + filename = cocoaui_savepanel_get_filename( @"Save Profile Data As", [NSArray arrayWithObjects:@"profile", nil] ); if( !filename ) { fuse_emulation_unpause(); return; } profile_finish( filename ); @@ -702,7 +703,7 @@ fuse_emulation_pause(); - filename = aquaui_savepanel_get_filename( @"Save Screenshot As", [NSArray arrayWithObjects:@"scr", nil] ); + filename = cocoaui_savepanel_get_filename( @"Save Screenshot As", [NSArray arrayWithObjects:@"scr", nil] ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -724,7 +725,7 @@ fuse_emulation_pause(); - filename = aquaui_savepanel_get_filename( @"Export Screenshot", [NSArray arrayWithObjects:@"png", @"tiff", @"bmp", @"jpg", @"gif", nil] ); + filename = cocoaui_savepanel_get_filename( @"Export Screenshot", [NSArray arrayWithObjects:@"png", @"tiff", @"bmp", @"jpg", @"gif", nil] ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -770,7 +771,7 @@ fuse_emulation_pause(); - filename = aquaui_openpanel_get_filename( @"Open Tape", tapeFileTypes ); + filename = cocoaui_openpanel_get_filename( @"Open Tape", tapeFileTypes ); if( !filename ) { fuse_emulation_unpause(); return; } @@ -1283,7 +1284,7 @@ fileTypes = trdosFileTypes; } - filename = aquaui_openpanel_get_filename( + filename = cocoaui_openpanel_get_filename( ( drive == SPECPLUS3_DRIVE_A ? @"Insert disk into drive A:" : @"Insert disk into drive B:" ), fileTypes ); @@ -1308,10 +1309,25 @@ [tapePlay setTitle:state == UI_STATUSBAR_STATE_ACTIVE ? @"Pause" : @"Play"]; } +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication +{ + return YES; +} + +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender +{ + if( cocoaui_confirm( "Exit Fuse?" ) ) { + int error = tape_close(); if( error ) return NSTerminateCancel; + + return NSTerminateNow; + } + return NSTerminateCancel; +} + @end static char* -aquaui_openpanel_get_filename( NSString *title, NSArray *fileTypes ) +cocoaui_openpanel_get_filename( NSString *title, NSArray *fileTypes ) { char buffer[PATH_MAX+1]; char *filename = NULL; @@ -1332,7 +1348,7 @@ } static char* -aquaui_savepanel_get_filename( NSString *title, NSArray *fileTypes ) +cocoaui_savepanel_get_filename( NSString *title, NSArray *fileTypes ) { char buffer[PATH_MAX+1]; char *filename = NULL; @@ -1363,7 +1379,7 @@ } static void -aquaui_disk_eject( specplus3_drive_number drive, int write ) +cocoaui_disk_eject( specplus3_drive_number drive, int write ) { if( machine_current->machine == LIBSPECTRUM_MACHINE_PLUS3 ) { specplus3_disk_eject( drive, write ); @@ -1378,7 +1394,7 @@ char *filename; int error; - filename = aquaui_openpanel_get_filename( @"Load Snapshot", snapFileTypes ); + filename = cocoaui_openpanel_get_filename( @"Load Snapshot", snapFileTypes ); if( !filename ) return -1; @@ -1562,7 +1578,7 @@ fuse_emulation_pause(); - filename = aquaui_savepanel_get_filename( @"Write Tape As", [NSArray arrayWithObjects:@"tzx", @"tap", nil] ); + filename = cocoaui_savepanel_get_filename( @"Write Tape As", [NSArray arrayWithObjects:@"tzx", @"tap", nil] ); if( !filename ) { fuse_emulation_unpause(); return 1; } @@ -1592,7 +1608,7 @@ fuse_emulation_pause(); NSString *title = [NSString stringWithFormat:@"Write +3 Disk %c: As", drive]; - filename = aquaui_savepanel_get_filename( title, [NSArray arrayWithObjects:@"dsk", nil] ); + filename = cocoaui_savepanel_get_filename( title, [NSArray arrayWithObjects:@"dsk", nil] ); if( !filename ) { fuse_emulation_unpause(); return 1; } @@ -1623,7 +1639,7 @@ fuse_emulation_pause(); NSString *title = [NSString stringWithFormat:@"Write TR-DOS Disk %c: As", drive]; - filename = aquaui_savepanel_get_filename( title, [NSArray arrayWithObjects:@"trd", nil] ); + filename = cocoaui_savepanel_get_filename( title, [NSArray arrayWithObjects:@"trd", nil] ); if( !filename ) { fuse_emulation_unpause(); return 1; } @@ -1756,8 +1772,8 @@ return confirm; } -int -sdlui_confirm( const char *message ) +static int +cocoaui_confirm( const char *message ) { int confirm = 0; int result; Modified: branches/fusegl/fuse/fusepb/main.mm =================================================================== --- branches/fusegl/fuse/fusepb/main.mm 2006-12-24 13:35:50 UTC (rev 262) +++ branches/fusegl/fuse/fusepb/main.mm 2006-12-25 01:32:17 UTC (rev 263) @@ -26,6 +26,8 @@ #import <Cocoa/Cocoa.h> +#include <stdlib.h> + extern "C" { #include "fuse.h" #include "main.h" @@ -37,7 +39,7 @@ int main(int argc, char *argv[]) { - int retval; + int retval, i; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @@ -51,12 +53,21 @@ return 1; } #endif + + /* This is passed if we are launched by double-clicking */ + if ( argc >= 2 && strncmp( argv[1], "-psn", 4 ) == 0 ) { + ac = 1; + } else { + ac = argc; + } + av = (char**) malloc( sizeof(*av) * (ac+1) ); + for( i = 0; i < ac; i++ ) + av[i] = argv[i]; + av[i] = NULL; + if( settings_current.show_help || settings_current.show_version ) return 0; - ac = argc; - av = argv; - retval = NSApplicationMain( argc, const_cast<const char**>(argv) ); fuse_end(); Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Deleted: branches/fusegl/fuse/fusepb/sdlui.h =================================================================== --- branches/fusegl/fuse/fusepb/sdlui.h 2006-12-24 13:35:50 UTC (rev 262) +++ branches/fusegl/fuse/fusepb/sdlui.h 2006-12-25 01:32:17 UTC (rev 263) @@ -1,33 +0,0 @@ -/* sdlui.h: Routines for dealing with the SDL UI - Copyright (c) 2004 Fredrick Meunier - - $Id: sdlui.h,v 1.2 2004/08/24 09:30:51 fred Exp $ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: pak...@sr... - Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England - -*/ - -#ifndef FUSE_SDLUI_H -#define FUSE_SDLUI_H - -void sdlui_quit( void ); -int sdlui_confirm( const char *message ); - -#endif /* #ifndef FUSE_SDLUI_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2006-12-27 12:14:21
|
Revision: 267 http://svn.sourceforge.net/fuse-for-macosx/?rev=267&view=rev Author: fredm Date: 2006-12-27 04:14:20 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Remove references to SDL joysticks, the HID looks nasty though :/ Modified Paths: -------------- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj branches/fusegl/fuse/fusepb/controllers/PreferencesController.m branches/fusegl/fuse/fusepb/nibs/Preferences.nib/info.nib branches/fusegl/fuse/fusepb/nibs/Preferences.nib/keyedobjects.nib Added Paths: ----------- branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.h branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.m Removed Paths: ------------- branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.h branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.m Modified: branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj =================================================================== --- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-26 12:43:45 UTC (rev 266) +++ branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-27 12:14:20 UTC (rev 267) @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */ = {isa = PBXBuildFile; fileRef = B615BFE50B4261E50082D535 /* HIDJoysticks.h */; }; + B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */ = {isa = PBXBuildFile; fileRef = B615BFE60B4261E50082D535 /* HIDJoysticks.m */; }; B61F459309121DF100C8096C /* Fuse Help in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6F905ED05CDA24300C2F10D /* Fuse Help */; }; B61F459409121DF100C8096C /* disk_plus3.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F2076596C700DE7E81 /* disk_plus3.szx */; }; B61F459509121DF100C8096C /* tape_16.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F4076596FD00DE7E81 /* tape_16.szx */; }; @@ -94,7 +96,6 @@ B61F45F309121DF100C8096C /* MachineNameToIdTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = B67F3CC307EE0A130045339F /* MachineNameToIdTransformer.h */; }; B61F45F409121DF100C8096C /* CAMachines.h in Headers */ = {isa = PBXBuildFile; fileRef = B6CC82FF0800E408006EFFB9 /* CAMachines.h */; }; B61F45F509121DF100C8096C /* Joysticks.h in Headers */ = {isa = PBXBuildFile; fileRef = B6C740D90810BB0500AB170C /* Joysticks.h */; }; - B61F45F609121DF100C8096C /* SDLJoysticks.h in Headers */ = {isa = PBXBuildFile; fileRef = B6C741110810C4A500AB170C /* SDLJoysticks.h */; }; B61F45F709121DF100C8096C /* VolumeSliderToPrefTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = B66D6C9608115FC200FAE6F3 /* VolumeSliderToPrefTransformer.h */; }; B61F45F809121DF100C8096C /* ScalerNameToIdTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = B67F3C1407ED1C9D0045339F /* ScalerNameToIdTransformer.h */; }; B61F45F909121DF100C8096C /* profile.h in Headers */ = {isa = PBXBuildFile; fileRef = B6E811F1084B5117008CF718 /* profile.h */; }; @@ -234,7 +235,6 @@ B61F468E09121DF100C8096C /* MachineNameToIdTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = B67F3CC407EE0A130045339F /* MachineNameToIdTransformer.m */; }; B61F468F09121DF100C8096C /* CAMachines.m in Sources */ = {isa = PBXBuildFile; fileRef = B6CC83000800E408006EFFB9 /* CAMachines.m */; }; B61F469009121DF100C8096C /* Joysticks.m in Sources */ = {isa = PBXBuildFile; fileRef = B6C740DA0810BB0500AB170C /* Joysticks.m */; }; - B61F469109121DF100C8096C /* SDLJoysticks.m in Sources */ = {isa = PBXBuildFile; fileRef = B6C741120810C4A500AB170C /* SDLJoysticks.m */; }; B61F469209121DF100C8096C /* VolumeSliderToPrefTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = B66D6C9708115FC200FAE6F3 /* VolumeSliderToPrefTransformer.m */; }; B61F469309121DF100C8096C /* profile.c in Sources */ = {isa = PBXBuildFile; fileRef = B6E811F0084B5117008CF718 /* profile.c */; }; B61F469409121DF100C8096C /* ide.c in Sources */ = {isa = PBXBuildFile; fileRef = B6E811F4084B5148008CF718 /* ide.c */; }; @@ -357,6 +357,8 @@ B611190206A1FA12006D2711 /* JoystickConfigurationController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JoystickConfigurationController.h; path = controllers/JoystickConfigurationController.h; sourceTree = SOURCE_ROOT; }; B611190306A1FA12006D2711 /* JoystickConfigurationController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = JoystickConfigurationController.m; path = controllers/JoystickConfigurationController.m; sourceTree = SOURCE_ROOT; }; B611196806A1FBB6006D2711 /* JoystickConfiguration.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = JoystickConfiguration.nib; path = nibs/JoystickConfiguration.nib; sourceTree = "<group>"; }; + B615BFE50B4261E50082D535 /* HIDJoysticks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = HIDJoysticks.h; path = content_arrays/HIDJoysticks.h; sourceTree = "<group>"; }; + B615BFE60B4261E50082D535 /* HIDJoysticks.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = HIDJoysticks.m; path = content_arrays/HIDJoysticks.m; sourceTree = "<group>"; }; B619FC2E090D9BC200344F94 /* SavePanelAccessoryView.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SavePanelAccessoryView.nib; path = nibs/SavePanelAccessoryView.nib; sourceTree = "<group>"; }; B61EF5B905FED7930081DF70 /* hq3x.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = hq3x.cpp; path = scaler/hq3x.cpp; sourceTree = SOURCE_ROOT; }; B61F46A909121DF100C8096C /* Info-Fuse.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info-Fuse.plist"; sourceTree = "<group>"; }; @@ -487,8 +489,6 @@ B6C691B704C20A42005EE041 /* joystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = joystick.c; path = ../joystick.c; sourceTree = SOURCE_ROOT; }; B6C740D90810BB0500AB170C /* Joysticks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Joysticks.h; path = content_arrays/Joysticks.h; sourceTree = SOURCE_ROOT; }; B6C740DA0810BB0500AB170C /* Joysticks.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = Joysticks.m; path = content_arrays/Joysticks.m; sourceTree = SOURCE_ROOT; }; - B6C741110810C4A500AB170C /* SDLJoysticks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDLJoysticks.h; path = content_arrays/SDLJoysticks.h; sourceTree = SOURCE_ROOT; }; - B6C741120810C4A500AB170C /* SDLJoysticks.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SDLJoysticks.m; path = content_arrays/SDLJoysticks.m; sourceTree = SOURCE_ROOT; }; B6C8696A06561155003000A6 /* hq2x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hq2x.h; path = scaler/hq2x.h; sourceTree = SOURCE_ROOT; }; B6C8696B06561155003000A6 /* hq3x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hq3x.h; path = scaler/hq3x.h; sourceTree = SOURCE_ROOT; }; B6C86978065611B3003000A6 /* intern.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = intern.h; path = scaler/intern.h; sourceTree = SOURCE_ROOT; }; @@ -950,10 +950,10 @@ children = ( B6CC82FF0800E408006EFFB9 /* CAMachines.h */, B6CC83000800E408006EFFB9 /* CAMachines.m */, + B615BFE50B4261E50082D535 /* HIDJoysticks.h */, + B615BFE60B4261E50082D535 /* HIDJoysticks.m */, B6C740D90810BB0500AB170C /* Joysticks.h */, B6C740DA0810BB0500AB170C /* Joysticks.m */, - B6C741110810C4A500AB170C /* SDLJoysticks.h */, - B6C741120810C4A500AB170C /* SDLJoysticks.m */, ); name = "Content Arrays"; sourceTree = "<group>"; @@ -1213,7 +1213,6 @@ B61F45F309121DF100C8096C /* MachineNameToIdTransformer.h in Headers */, B61F45F409121DF100C8096C /* CAMachines.h in Headers */, B61F45F509121DF100C8096C /* Joysticks.h in Headers */, - B61F45F609121DF100C8096C /* SDLJoysticks.h in Headers */, B61F45F709121DF100C8096C /* VolumeSliderToPrefTransformer.h in Headers */, B61F45F809121DF100C8096C /* ScalerNameToIdTransformer.h in Headers */, B61F45F909121DF100C8096C /* profile.h in Headers */, @@ -1227,6 +1226,7 @@ B6CE7F440B2830A300EB65B3 /* cocoaui.h in Headers */, B6CE7FCD0B28FBD600EB65B3 /* DisplayOpenGLView.h in Headers */, B6A6F11F0B3EA737000B88E9 /* cocoascreenshot.h in Headers */, + B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1446,7 +1446,6 @@ B61F468E09121DF100C8096C /* MachineNameToIdTransformer.m in Sources */, B61F468F09121DF100C8096C /* CAMachines.m in Sources */, B61F469009121DF100C8096C /* Joysticks.m in Sources */, - B61F469109121DF100C8096C /* SDLJoysticks.m in Sources */, B61F469209121DF100C8096C /* VolumeSliderToPrefTransformer.m in Sources */, B61F469309121DF100C8096C /* profile.c in Sources */, B61F469409121DF100C8096C /* ide.c in Sources */, @@ -1464,6 +1463,7 @@ B6A6F0DA0B3D141B000B88E9 /* cocoaui.m in Sources */, B6A6F10E0B3D6360000B88E9 /* cocoaerror.m in Sources */, B6A6F1200B3EA737000B88E9 /* cocoascreenshot.m in Sources */, + B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Copied: branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.h (from rev 265, branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.h) =================================================================== --- branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.h (rev 0) +++ branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.h 2006-12-27 12:14:20 UTC (rev 267) @@ -0,0 +1,46 @@ +/* HIDJoysticks.h: Object encapsulating SDL joysticks + Copyright (c) 2005 Fredrick Meunier + + $Id: HIDJoysticks.h,v 1.1 2005/04/18 02:55:20 fred Exp $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Author contact information: + + E-mail: pak...@sr... + Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England + +*/ + +#import <Cocoa/Cocoa.h> + +@interface HIDJoystick : NSObject <NSCoding> +{ + NSString *name; + int type; +} + ++ (NSArray *)allJoysticks; ++ (id)joystickWithName:(NSString *)aTitle andType:(int)aValue; ++ (HIDJoystick *)joystickForName:(NSString *)theName; ++ (HIDJoystick *)joystickForType:(int)theType; +- (int)joystickType; +- (void)setJoystickType:(int)aValue; +- (NSString *)joystickName; +- (void)setJoystickName:(NSString *)aName; + +- (id)copyWithZone:(NSZone *)zone; +- (id)valueForUndefinedKey:(NSString *)key; +@end Copied: branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.m (from rev 265, branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.m) =================================================================== --- branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.m (rev 0) +++ branches/fusegl/fuse/fusepb/content_arrays/HIDJoysticks.m 2006-12-27 12:14:20 UTC (rev 267) @@ -0,0 +1,170 @@ +/* HIDJoysticks.m: Object encapsulating Mac OS X HID joysticks + Copyright (c) 2005 Fredrick Meunier + + $Id: HIDJoysticks.m,v 1.1 2005/04/18 02:55:20 fred Exp $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Author contact information: + + E-mail: pak...@sr... + Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England + +*/ + +#import "HIDJoysticks.h" + +#include <libspectrum.h> + +#include "joystick.h" + +@implementation HIDJoystick + +// Predefined global list of joysticks ++ (NSArray *)allJoysticks +{ + static NSMutableArray *joysticks; + if (!joysticks) { + size_t i; + + joysticks = [NSMutableArray arrayWithCapacity:joysticks_supported+1]; + + [joysticks addObject:[HIDJoystick joystickWithName:@"None" andType:0]]; +#if 0 + if( joysticks_supported > 0 ){ + for( i=0; i<joysticks_supported; i++ ) { + [joysticks addObject: + [HIDJoystick joystickWithName:[NSString stringWithUTF8String: + HID_JoystickName(i)] + andType:i+1] + ]; + } + } +#endif + } + return joysticks; +} + +// Retrieve joystick with given name from 'allHIDJoysticks' +// (see NSCoding methods). ++ (HIDJoystick *)joystickForName:(NSString *)theName +{ + NSEnumerator *joystickEnumerator = [[HIDJoystick allJoysticks] objectEnumerator]; + HIDJoystick *joystick; + while ((joystick = [joystickEnumerator nextObject])) { + if ([[joystick joystickName] isEqual:theName]) { + return joystick; + } + } + return nil; +} + +// Retrieve joystick with given type from 'allJoysticks' +// (see NSCoding methods). ++ (HIDJoystick *)joystickForType:(int)theType +{ + NSEnumerator *joystickEnumerator = [[HIDJoystick allJoysticks] objectEnumerator]; + HIDJoystick *joystick; + while ((joystick = [joystickEnumerator nextObject])) { + if (theType == [joystick joystickType]) { + return joystick; + } + } + return nil; +} + + +// Convenience constructor ++ (id)joystickWithName:(NSString *)aName andType:(int)aValue +{ + id newJoystick = [[[self alloc] init] autorelease]; + [newJoystick setJoystickName:aName]; + [newJoystick setJoystickType:aValue]; + + return newJoystick; +} + +/* + NSCoding methods + To encode, simply save 'type'; on decode, replace self with + the existing instance from 'allJoysticks' with the same type + */ +- (void)encodeWithCoder:(NSCoder *)encoder +{ + if ( [encoder allowsKeyedCoding] ) { + [encoder encodeInt: type forKey:@"priority"]; + } else { + [encoder encodeValueOfObjCType:@encode(int) at:&type]; + } +} + +- (id)initWithCoder:(NSCoder *)decoder +{ + int theType = 0; + if ( [decoder allowsKeyedCoding] ) { + theType = [decoder decodeIntForKey:@"type"]; + } else { + [decoder decodeValueOfObjCType:@encode(int) at:&type]; + } + [self autorelease]; + // returning "static" object from init method -- ensure retain count maintained + return [[HIDJoystick joystickForType:theType] retain]; +} + + +// Accessors +- (NSString *)joystickName +{ + return name; +} + +- (void)setJoystickName:(NSString *)aName +{ + if (name != aName) { + [name release]; + name = [aName copy]; + } + return; +} + +- (int)joystickType +{ + return type; +} + +- (void)setJoystickType:(int)aValue +{ + type = aValue; +} + +- (void)dealloc +{ + [self setJoystickName:nil]; + [super dealloc]; +} + +- (id)copyWithZone:(NSZone *)zone +{ + [self retain]; + return self; +} + +- (id)valueForUndefinedKey:(NSString *)key +{ +fprintf(stderr,"Undefined key:'%s'\n",[key UTF8String]); +return nil; +} + +@end Deleted: branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.h =================================================================== --- branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.h 2006-12-26 12:43:45 UTC (rev 266) +++ branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.h 2006-12-27 12:14:20 UTC (rev 267) @@ -1,46 +0,0 @@ -/* SDLJoysticks.h: Object encapsulating SDL joysticks - Copyright (c) 2005 Fredrick Meunier - - $Id: SDLJoysticks.h,v 1.1 2005/04/18 02:55:20 fred Exp $ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: pak...@sr... - Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England - -*/ - -#import <Cocoa/Cocoa.h> - -@interface SDLJoystick : NSObject <NSCoding> -{ - NSString *name; - int type; -} - -+ (NSArray *)allJoysticks; -+ (id)joystickWithName:(NSString *)aTitle andType:(int)aValue; -+ (SDLJoystick *)joystickForName:(NSString *)theName; -+ (SDLJoystick *)joystickForType:(int)theType; -- (int)joystickType; -- (void)setJoystickType:(int)aValue; -- (NSString *)joystickName; -- (void)setJoystickName:(NSString *)aName; - -- (id)copyWithZone:(NSZone *)zone; -- (id)valueForUndefinedKey:(NSString *)key; -@end Deleted: branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.m =================================================================== --- branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.m 2006-12-26 12:43:45 UTC (rev 266) +++ branches/fusegl/fuse/fusepb/content_arrays/SDLJoysticks.m 2006-12-27 12:14:20 UTC (rev 267) @@ -1,172 +0,0 @@ -/* SDLJoysticks.m: Object encapsulating libspectrum joysticks - Copyright (c) 2005 Fredrick Meunier - - $Id: SDLJoysticks.m,v 1.1 2005/04/18 02:55:20 fred Exp $ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: pak...@sr... - Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England - -*/ - -//#include <SDL.h> - -#import "SDLJoysticks.h" - -#include <libspectrum.h> - -#include "joystick.h" - -@implementation SDLJoystick - -// Predefined global list of joysticks -+ (NSArray *)allJoysticks -{ - static NSMutableArray *joysticks; - if (!joysticks) { - size_t i; - - joysticks = [NSMutableArray arrayWithCapacity:joysticks_supported+1]; - - [joysticks addObject:[SDLJoystick joystickWithName:@"None" andType:0]]; -#if 0 - if( joysticks_supported > 0 ){ - for( i=0; i<joysticks_supported; i++ ) { - [joysticks addObject: - [SDLJoystick joystickWithName:[NSString stringWithUTF8String: - SDL_JoystickName(i)] - andType:i+1] - ]; - } - } -#endif - } - return joysticks; -} - -// Retrieve joystick with given name from 'allSDLJoysticks' -// (see NSCoding methods). -+ (SDLJoystick *)joystickForName:(NSString *)theName -{ - NSEnumerator *joystickEnumerator = [[SDLJoystick allJoysticks] objectEnumerator]; - SDLJoystick *joystick; - while ((joystick = [joystickEnumerator nextObject])) { - if ([[joystick joystickName] isEqual:theName]) { - return joystick; - } - } - return nil; -} - -// Retrieve joystick with given type from 'allJoysticks' -// (see NSCoding methods). -+ (SDLJoystick *)joystickForType:(int)theType -{ - NSEnumerator *joystickEnumerator = [[SDLJoystick allJoysticks] objectEnumerator]; - SDLJoystick *joystick; - while ((joystick = [joystickEnumerator nextObject])) { - if (theType == [joystick joystickType]) { - return joystick; - } - } - return nil; -} - - -// Convenience constructor -+ (id)joystickWithName:(NSString *)aName andType:(int)aValue -{ - id newJoystick = [[[self alloc] init] autorelease]; - [newJoystick setJoystickName:aName]; - [newJoystick setJoystickType:aValue]; - - return newJoystick; -} - -/* - NSCoding methods - To encode, simply save 'type'; on decode, replace self with - the existing instance from 'allJoysticks' with the same type - */ -- (void)encodeWithCoder:(NSCoder *)encoder -{ - if ( [encoder allowsKeyedCoding] ) { - [encoder encodeInt: type forKey:@"priority"]; - } else { - [encoder encodeValueOfObjCType:@encode(int) at:&type]; - } -} - -- (id)initWithCoder:(NSCoder *)decoder -{ - int theType = 0; - if ( [decoder allowsKeyedCoding] ) { - theType = [decoder decodeIntForKey:@"type"]; - } else { - [decoder decodeValueOfObjCType:@encode(int) at:&type]; - } - [self autorelease]; - // returning "static" object from init method -- ensure retain count maintained - return [[SDLJoystick joystickForType:theType] retain]; -} - - -// Accessors -- (NSString *)joystickName -{ - return name; -} - -- (void)setJoystickName:(NSString *)aName -{ - if (name != aName) { - [name release]; - name = [aName copy]; - } - return; -} - -- (int)joystickType -{ - return type; -} - -- (void)setJoystickType:(int)aValue -{ - type = aValue; -} - -- (void)dealloc -{ - [self setJoystickName:nil]; - [super dealloc]; -} - -- (id)copyWithZone:(NSZone *)zone -{ - [self retain]; - return self; -} - -- (id)valueForUndefinedKey:(NSString *)key -{ -fprintf(stderr,"Undefined key:'%s'\n",[key UTF8String]); -return nil; -} - -@end Modified: branches/fusegl/fuse/fusepb/controllers/PreferencesController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2006-12-26 12:43:45 UTC (rev 266) +++ branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2006-12-27 12:14:20 UTC (rev 267) @@ -34,7 +34,7 @@ #import "PreferencesController.h" #import "CAMachines.h" #import "Joysticks.h" -#import "SDLJoysticks.h" +#import "HIDJoysticks.h" #include "fuse.h" #include "joystick.h" @@ -186,7 +186,7 @@ - (NSArray *)sdlJoysticks { - return [SDLJoystick allJoysticks]; + return [HIDJoystick allJoysticks]; } - (IBAction)chooseROMFile:(id)sender Modified: branches/fusegl/fuse/fusepb/nibs/Preferences.nib/info.nib =================================================================== --- branches/fusegl/fuse/fusepb/nibs/Preferences.nib/info.nib 2006-12-26 12:43:45 UTC (rev 266) +++ branches/fusegl/fuse/fusepb/nibs/Preferences.nib/info.nib 2006-12-27 12:14:20 UTC (rev 267) @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>112 18 356 240 0 0 1440 878 </string> + <string>100 79 356 240 0 0 1440 878 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBGroupedObjects</key> @@ -25,7 +25,7 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>8J2135</string> + <string>8L2127</string> <key>IBUsesTextArchiving</key> <true/> </dict> Modified: branches/fusegl/fuse/fusepb/nibs/Preferences.nib/keyedobjects.nib =================================================================== --- branches/fusegl/fuse/fusepb/nibs/Preferences.nib/keyedobjects.nib 2006-12-26 12:43:45 UTC (rev 266) +++ branches/fusegl/fuse/fusepb/nibs/Preferences.nib/keyedobjects.nib 2006-12-27 12:14:20 UTC (rev 267) @@ -142,7 +142,7 @@ <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>75</integer> </dict> <key>NS.objects</key> <array> @@ -641,12 +641,12 @@ <key>$class</key> <dict> <key>CF$UID</key> - <integer>197</integer> + <integer>118</integer> </dict> <key>NSFrame</key> <dict> <key>CF$UID</key> - <integer>323</integer> + <integer>308</integer> </dict> <key>NSNextResponder</key> <dict> @@ -656,7 +656,7 @@ <key>NSSubviews</key> <dict> <key>CF$UID</key> - <integer>253</integer> + <integer>207</integer> </dict> </dict> <string>{{18, 103}, {105, 18}}</string> @@ -1163,7 +1163,7 @@ <key>$class</key> <dict> <key>CF$UID</key> - <integer>197</integer> + <integer>118</integer> </dict> <key>NSFrame</key> <dict> @@ -1185,7 +1185,7 @@ <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>75</integer> </dict> <key>NS.objects</key> <array> @@ -1221,7 +1221,7 @@ <key>NSFrame</key> <dict> <key>CF$UID</key> - <integer>249</integer> + <integer>203</integer> </dict> <key>NSNextResponder</key> <dict> @@ -1231,7 +1231,7 @@ <key>NSSelectedTabViewItem</key> <dict> <key>CF$UID</key> - <integer>363</integer> + <integer>540</integer> </dict> <key>NSSubviews</key> <dict> @@ -1246,7 +1246,7 @@ <key>NSTabViewItems</key> <dict> <key>CF$UID</key> - <integer>250</integer> + <integer>204</integer> </dict> <key>NSTvFlags</key> <integer>4</integer> @@ -1255,7 +1255,7 @@ <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>75</integer> </dict> <key>NS.objects</key> <array> @@ -1269,12 +1269,12 @@ <key>$class</key> <dict> <key>CF$UID</key> - <integer>197</integer> + <integer>118</integer> </dict> <key>NSFrame</key> <dict> <key>CF$UID</key> - <integer>248</integer> + <integer>202</integer> </dict> <key>NSNextResponder</key> <dict> @@ -1296,7 +1296,7 @@ <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>75</integer> </dict> <key>NS.objects</key> <array> @@ -1306,109 +1306,140 @@ </dict> <dict> <key>CF$UID</key> - <integer>56</integer> + <integer>129</integer> </dict> <dict> <key>CF$UID</key> - <integer>60</integer> + <integer>172</integer> </dict> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>208</integer> - </dict> </array> </dict> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>23</integer> + <integer>128</integer> </dict> - <key>NSCell</key> + <key>NSBorderType</key> + <integer>3</integer> + <key>NSBoxType</key> + <integer>0</integer> + <key>NSContentView</key> <dict> <key>CF$UID</key> <integer>54</integer> </dict> - <key>NSEnabled</key> - <true/> <key>NSFrame</key> <dict> <key>CF$UID</key> - <integer>53</integer> + <integer>119</integer> </dict> <key>NSNextResponder</key> <dict> <key>CF$UID</key> <integer>50</integer> </dict> + <key>NSOffsets</key> + <dict> + <key>CF$UID</key> + <integer>120</integer> + </dict> + <key>NSSubviews</key> + <dict> + <key>CF$UID</key> + <integer>53</integer> + </dict> <key>NSSuperview</key> <dict> <key>CF$UID</key> <integer>50</integer> </dict> - <key>NSvFlags</key> - <integer>256</integer> + <key>NSTitleCell</key> + <dict> + <key>CF$UID</key> + <integer>121</integer> + </dict> + <key>NSTitlePosition</key> + <integer>2</integer> + <key>NSTransparent</key> + <false/> </dict> - <string>{{378, 263}, {198, 18}}</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>22</integer> + <integer>75</integer> </dict> - <key>NSAlternateContents</key> + <key>NS.objects</key> + <array> + <dict> + <key>CF$UID</key> + <integer>54</integer> + </dict> + </array> + </dict> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>21</integer> + <integer>118</integer> </dict> - <key>NSAlternateImage</key> + <key>NSFrame</key> <dict> <key>CF$UID</key> - <integer>18</integer> + <integer>117</integer> </dict> - <key>NSButtonFlags</key> - <integer>1211912703</integer> - <key>NSButtonFlags2</key> - <integer>2</integer> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> + <key>NSNextResponder</key> <dict> <key>CF$UID</key> - <integer>55</integer> + <integer>52</integer> </dict> - <key>NSControlView</key> + <key>NSSubviews</key> <dict> <key>CF$UID</key> - <integer>52</integer> + <integer>55</integer> </dict> - <key>NSKeyEquivalent</key> + <key>NSSuperview</key> <dict> <key>CF$UID</key> - <integer>21</integer> + <integer>52</integer> </dict> - <key>NSPeriodicDelay</key> - <integer>200</integer> - <key>NSPeriodicInterval</key> - <integer>25</integer> - <key>NSSupport</key> + </dict> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>15</integer> + <integer>75</integer> </dict> + <key>NS.objects</key> + <array> + <dict> + <key>CF$UID</key> + <integer>56</integer> + </dict> + <dict> + <key>CF$UID</key> + <integer>79</integer> + </dict> + <dict> + <key>CF$UID</key> + <integer>94</integer> + </dict> + <dict> + <key>CF$UID</key> + <integer>108</integer> + </dict> + <dict> + <key>CF$UID</key> + <integer>112</integer> + </dict> + </array> </dict> - <string>Kempston joystick interface</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>23</integer> + <integer>78</integer> </dict> <key>NSCell</key> <dict> @@ -1425,46 +1456,45 @@ <key>NSNextResponder</key> <dict> <key>CF$UID</key> - <integer>50</integer> + <integer>54</integer> </dict> <key>NSSuperview</key> <dict> <key>CF$UID</key> - <integer>50</integer> + <integer>54</integer> </dict> <key>NSvFlags</key> <integer>256</integer> </dict> - <string>{{378, 219}, {138, 18}}</string> + <string>{{144, 44}, {249, 26}}</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>22</integer> + <integer>77</integer> </dict> <key>NSAlternateContents</key> <dict> <key>CF$UID</key> - <integer>21</integer> + <integer>60</integer> </dict> <key>NSAlternateImage</key> <dict> <key>CF$UID</key> - <integer>18</integer> + <integer>59</integer> </dict> + <key>NSAltersState</key> + <true/> + <key>NSArrowPosition</key> + <integer>1</integer> <key>NSButtonFlags</key> - <integer>1211912703</integer> + <integer>109199615</integer> <key>NSButtonFlags2</key> - <integer>2</integer> + <integer>1</integer> <key>NSCellFlags</key> - <integer>67239424</integer> + <integer>-2076049856</integer> <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>59</integer> - </dict> + <integer>134218752</integer> <key>NSControlView</key> <dict> <key>CF$UID</key> @@ -1473,1424 +1503,1180 @@ <key>NSKeyEquivalent</key> <dict> <key>CF$UID</key> - <integer>21</integer> + <integer>61</integer> </dict> + <key>NSMenu</key> + <dict> + <key>CF$UID</key> + <integer>63</integer> + </dict> + <key>NSMenuItem</key> + <dict> + <key>CF$UID</key> + <integer>62</integer> + </dict> <key>NSPeriodicDelay</key> - <integer>200</integer> + <integer>400</integer> <key>NSPeriodicInterval</key> - <integer>25</integer> + <integer>75</integer> + <key>NSPreferredEdge</key> + <integer>3</integer> <key>NSSupport</key> <dict> <key>CF$UID</key> <integer>15</integer> </dict> + <key>NSUsesItemFromMenu</key> + <true/> </dict> - <string>Interface II</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>23</integer> + <integer>17</integer> </dict> - <key>NSCell</key> + <key>NSName</key> <dict> <key>CF$UID</key> - <integer>62</integer> + <integer>16</integer> </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> + <key>NSSize</key> + <real>13</real> + <key>NSfFlags</key> + <integer>16</integer> + </dict> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>61</integer> + <integer>45</integer> </dict> - <key>NSNextResponder</key> + <key>NS.string</key> + <string></string> + </dict> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>50</integer> + <integer>45</integer> </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>50</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> + <key>NS.string</key> + <string></string> </dict> - <string>{{378, 241}, {187, 18}}</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>22</integer> + <integer>72</integer> </dict> - <key>NSAlternateContents</key> + <key>NSAction</key> <dict> <key>CF$UID</key> - <integer>21</integer> + <integer>71</integer> </dict> - <key>NSAlternateImage</key> + <key>NSKeyEquiv</key> <dict> <key>CF$UID</key> - <integer>18</integer> + <integer>21</integer> </dict> - <key>NSButtonFlags</key> - <integer>1211912703</integer> - <key>NSButtonFlags2</key> - <integer>2</integer> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> + <key>NSKeyEquivModMask</key> + <integer>1048576</integer> + <key>NSMenu</key> <dict> <key>CF$UID</key> <integer>63</integer> </dict> - <key>NSControlView</key> + <key>NSMixedImage</key> <dict> <key>CF$UID</key> - <integer>60</integer> + <integer>69</integer> </dict> - <key>NSKeyEquivalent</key> + <key>NSMnemonicLoc</key> + <integer>2147483647</integer> + <key>NSOnImage</key> <dict> <key>CF$UID</key> - <integer>21</integer> + <integer>65</integer> </dict> - <key>NSPeriodicDelay</key> - <integer>200</integer> - <key>NSPeriodicInterval</key> - <integer>25</integer> - <key>NSSupport</key> + <key>NSState</key> + <integer>1</integer> + <key>NSTarget</key> <dict> <key>CF$UID</key> - <integer>15</integer> + <integer>58</integer> </dict> + <key>NSTitle</key> + <dict> + <key>CF$UID</key> + <integer>64</integer> + </dict> </dict> - <string>Kempston mouse</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>207</integer> + <integer>76</integer> </dict> - <key>NSBorderType</key> - <integer>3</integer> - <key>NSBoxType</key> - <integer>0</integer> - <key>NSContentView</key> + <key>NSMenuItems</key> <dict> <key>CF$UID</key> - <integer>66</integer> + <integer>74</integer> </dict> - <key>NSFrame</key> + <key>NSTitle</key> <dict> <key>CF$UID</key> - <integer>198</integer> + <integer>73</integer> </dict> - <key>NSNextResponder</key> + </dict> + <string>Item1</string> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>50</integer> + <integer>68</integer> </dict> - <key>NSOffsets</key> + <key>NSClassName</key> <dict> <key>CF$UID</key> - <integer>199</integer> + <integer>66</integer> </dict> - <key>NSSubviews</key> + <key>NSResourceName</key> <dict> <key>CF$UID</key> - <integer>65</integer> + <integer>67</integer> </dict> - <key>NSSuperview</key> + </dict> + <string>NSImage</string> + <string>NSMenuCheckmark</string> + <dict> + <key>$classes</key> + <array> + <string>NSCustomResource</string> + <string>%NSCustomResource</string> + <string>NSObject</string> + </array> + <key>$classname</key> + <string>NSCustomResource</string> + </dict> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>50</integer> + <integer>68</integer> </dict> - <key>NSTitleCell</key> + <key>NSClassName</key> <dict> <key>CF$UID</key> - <integer>200</integer> + <integer>66</integer> </dict> - <key>NSTitlePosition</key> - <integer>2</integer> - <key>NSTransparent</key> - <false/> + <key>NSResourceName</key> + <dict> + <key>CF$UID</key> + <integer>70</integer> + </dict> </dict> + <string>NSMenuMixedState</string> + <string>_popUpItemAction:</string> <dict> + <key>$classes</key> + <array> + <string>NSMenuItem</string> + <string>NSObject</string> + </array> + <key>$classname</key> + <string>NSMenuItem</string> + </dict> + <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>45</integer> </dict> + <key>NS.string</key> + <string>OtherViews</string> + </dict> + <dict> + <key>$class</key> + <dict> + <key>CF$UID</key> + <integer>75</integer> + </dict> <key>NS.objects</key> <array> <dict> <key>CF$UID</key> - <integer>66</integer> + <integer>62</integer> </dict> </array> </dict> <dict> + <key>$classes</key> + <array> + <string>NSMutableArray</string> + <string>NSArray</string> + <string>NSObject</string> + </array> + <key>$classname</key> + <string>NSMutableArray</string> + </dict> + <dict> + <key>$classes</key> + <array> + <string>NSMenu</string> + <string>NSObject</string> + </array> + <key>$classname</key> + <string>NSMenu</string> + </dict> + <dict> + <key>$classes</key> + <array> + <string>NSPopUpButtonCell</string> + <string>NSMenuItemCell</string> + <string>NSButtonCell</string> + <string>%NSButtonCell</string> + <string>NSActionCell</string> + <string>NSCell</string> + <string>NSObject</string> + </array> + <key>$classname</key> + <string>NSPopUpButtonCell</string> + </dict> + <dict> + <key>$classes</key> + <array> + <string>NSPopUpButton</string> + <string>NSButton</string> + <string>NSControl</string> + <string>NSView</string> + <string>NSResponder</string> + <string>NSObject</string> + </array> + <key>$classname</key> + <string>NSPopUpButton</string> + </dict> + <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>197</integer> + <integer>78</integer> </dict> - <key>NSFrame</key> + <key>NSCell</key> <dict> <key>CF$UID</key> - <integer>196</integer> + <integer>81</integer> </dict> - <key>NSNextResponder</key> + <key>NSEnabled</key> + <true/> + <key>NSFrame</key> <dict> <key>CF$UID</key> - <integer>64</integer> + <integer>80</integer> </dict> - <key>NSSubviews</key> + <key>NSNextResponder</key> <dict> <key>CF$UID</key> - <integer>67</integer> + <integer>54</integer> </dict> <key>NSSuperview</key> <dict> <key>CF$UID</key> - <integer>64</integer> + <integer>54</integer> </dict> + <key>NSvFlags</key> + <integer>256</integer> </dict> + <string>{{144, 12}, {125, 26}}</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>77</integer> </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>68</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>132</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>136</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>140</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>144</integer> - </dict> - </array> + <key>NSAlternateContents</key> + <dict> + <key>CF$UID</key> + <integer>21</integer> + </dict> + <key>NSAlternateImage</key> + <dict> + <key>CF$UID</key> + <integer>59</integer> + </dict> + <key>NSAltersState</key> + <true/> + <key>NSArrowPosition</key> + <integer>1</integer> + <key>NSButtonFlags</key> + <integer>109199615</integer> + <key>NSButtonFlags2</key> + <integer>1</integer> + <key>NSCellFlags</key> + <integer>-2076049856</integer> + <key>NSCellFlags2</key> + <integer>134218752</integer> + <key>NSControlView</key> + <dict> + <key>CF$UID</key> + <integer>79</integer> + </dict> + <key>NSKeyEquivalent</key> + <dict> + <key>CF$UID</key> + <integer>82</integer> + </dict> + <key>NSMenu</key> + <dict> + <key>CF$UID</key> + <integer>84</integer> + </dict> + <key>NSMenuItem</key> + <dict> + <key>CF$UID</key> + <integer>83</integer> + </dict> + <key>NSPeriodicDelay</key> + <integer>400</integer> + <key>NSPeriodicInterval</key> + <integer>75</integer> + <key>NSPreferredEdge</key> + <integer>3</integer> + <key>NSSupport</key> + <dict> + <key>CF$UID</key> + <integer>15</integer> + </dict> + <key>NSUsesItemFromMenu</key> + <true/> </dict> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>127</integer> + <integer>45</integer> </dict> - <key>NSBackgroundColor</key> + <key>NS.string</key> + <string></string> + </dict> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>122</integer> + <integer>72</integer> </dict> - <key>NSCellBackgroundColor</key> + <key>NSAction</key> <dict> <key>CF$UID</key> - <integer>126</integer> + <integer>85</integer> </dict> - <key>NSCellClass</key> + <key>NSKeyEquiv</key> <dict> <key>CF$UID</key> - <integer>119</integer> + <integer>21</integer> </dict> - <key>NSCellSize</key> + <key>NSKeyEquivModMask</key> + <integer>1048576</integer> + <key>NSMenu</key> <dict> <key>CF$UID</key> - <integer>117</integer> + <integer>84</integer> </dict> - <key>NSCells</key> + <key>NSMixedImage</key> <dict> <key>CF$UID</key> - <integer>70</integer> + <integer>69</integer> </dict> - <key>NSEnabled</key> - <true/> - <key>NSFont</key> + <key>NSMnemonicLoc</key> + <integer>2147483647</integer> + <key>NSOnImage</key> <dict> <key>CF$UID</key> - <integer>15</integer> + <integer>65</integer> </dict> - <key>NSFrame</key> + <key>NSState</key> + <integer>1</integer> + <key>NSTarget</key> <dict> <key>CF$UID</key> - <integer>69</integer> + <integer>81</integer> </dict> - <key>NSIntercellSpacing</key> + <key>NSTitle</key> <dict> <key>CF$UID</key> - <integer>118</integer> + <integer>64</integer> </dict> - <key>NSMatrixFlags</key> - <integer>1076363264</integer> - <key>NSNextResponder</key> + </dict> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>66</integer> + <integer>76</integer> </dict> - <key>NSNumCols</key> - <integer>1</integer> - <key>NSNumRows</key> - <integer>6</integer> - <key>NSProtoCell</key> + <key>NSMenuItems</key> <dict> <key>CF$UID</key> - <integer>120</integer> + <integer>87</integer> </dict> - <key>NSSelectedCell</key> + <key>NSTitle</key> <dict> <key>CF$UID</key> - <integer>71</integer> + <integer>86</integer> </dict> - <key>NSSuperview</key> + </dict> + <string>_popUpItemAction:</string> + <dict> + <key>$class</key> <dict> <key>CF$UID</key> - <integer>66</integer> + <integer>45</integer> </dict> - <key>NSvFlags</key> - <integer>256</integer> + <key>NS.string</key> + <string>OtherViews</string> </dict> - <string>{{18, 9}, {138, 118}}</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>75</integer> </dict> <key>NS.objects</key> <array> <dict> <key>CF$UID</key> - <integer>71</integer> + <integer>83</integer> </dict> <dict> <key>CF$UID</key> - <integer>75</integer> + <integer>88</integer> </dict> <dict> <key>CF$UID</key> - <integer>78</integer> + <integer>91</integer> </dict> - <dict> - <key>CF$UID</key> - <integer>93</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>101</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>109</integer> - </dict> </array> </dict> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>22</integer> + <integer>72</integer> </dict> - <key>NSAlternateContents</key> + <key>NSAction</key> <dict> <key>CF$UID</key> + <integer>90</integer> + </dict> + <key>NSKeyEquiv</key> + <dict> + <key>CF$UID</key> <integer>21</integer> </dict> - <key>NSAlternateImage</key> + <key>NSKeyEquivModMask</key> + <integer>1048576</integer> + <key>NSMenu</key> <dict> <key>CF$UID</key> - <integer>73</integer> + <integer>84</integer> </dict> - <key>NSButtonFlags</key> - <integer>1211912703</integer> - <key>NSButtonFlags2</key> - <integer>2</integer> - <key>NSCellFlags</key> - <integer>-2080244224</integer> - <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> + <key>NSMixedImage</key> <dict> <key>CF$UID</key> - <integer>72</integer> + <integer>69</integer> </dict> - <key>NSControlView</key> + <key>NSMnemonicLoc</key> + <integer>2147483647</integer> + <key>NSOnImage</key> <dict> <key>CF$UID</key> - <integer>68</integer> + <integer>65</integer> </dict> - <key>NSKeyEquivalent</key> + <key>NSTarget</key> <dict> <key>CF$UID</key> - <integer>21</integer> + <integer>81</integer> </dict> - <key>NSPeriodicDelay</key> - <integer>200</integer> - <key>NSPeriodicInterval</key> - <integer>25</integer> - <key>NSSupport</key> + <key>NSTitle</key> <dict> <key>CF$UID</key> - <integer>15</integer> + <integer>89</integer> </dict> </dict> - <string>None</string> + <string>Item2</string> + <string>_popUpItemAction:</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>20</integer> + <integer>72</integer> </dict> - <key>NSImageName</key> + <key>NSAction</key> <dict> <key>CF$UID</key> - <integer>74</integer> + <integer>93</integer> </dict> - </dict> - <string>NSRadioButton</string> - <dict> - <key>$class</key> + <key>NSKeyEquiv</key> <dict> <key>CF$UID</key> - <integer>22</integer> + <integer>21</integer> </dict> - <key>NSAlternateContents</key> + <key>NSKeyEquivModMask</key> + <integer>1048576</integer> + <key>NSMenu</key> <dict> <key>CF$UID</key> - <integer>77</integer> + <integer>84</integer> </dict> - <key>NSAlternateImage</key> + <key>NSMixedImage</key> <dict> <key>CF$UID</key> - <integer>73</integer> + <integer>69</integer> </dict> - <key>NSButtonFlags</key> - <integer>1211912703</integer> - <key>NSButtonFlags2</key> - <integer>0</integer> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> + <key>NSMnemonicLoc</key> + <integer>2147483647</integer> + <key>NSOnImage</key> <dict> <key>CF$UID</key> - <integer>76</integer> + <integer>65</integer> </dict> - <key>NSControlView</key> + <key>NSTarget</key> <dict> <key>CF$UID</key> - <integer>68</integer> + <integer>81</integer> </dict> - <key>NSKeyEquivalent</key> + <key>NSTitle</key> <dict> <key>CF$UID</key> - <integer>77</integer> + <integer>92</integer> </dict> - <key>NSPeriodicDelay</key> - <integer>200</integer> - <key>NSPeriodicInterval</key> - <integer>25</integer> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>15</integer> - </dict> - <key>NSTag</key> - <integer>1</integer> </dict> - <string>Interface I</string> + <string>Item3</string> + <string>_popUpItemAction:</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>45</integer> + <integer>107</integer> </dict> - <key>NS.string</key> - <string></string> + <key>NSCell</key> + <dict> + <key>CF$UID</key> + <integer>96</integer> + </dict> + <key>NSEnabled</key> + <true/> + <key>NSFrame</key> + <dict> + <key>CF$UID</key> + <integer>95</integer> + </dict> + <key>NSNextResponder</key> + <dict> + <key>CF$UID</key> + <integer>54</integer> + </dict> + <key>NSSuperview</key> + <dict> + <key>CF$UID</key> + <integer>54</integer> + </dict> + <key>NSvFlags</key> + <integer>256</integer> </dict> + <string>{{11, 50}, {114, 17}}</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>22</integer> + <integer>106</integer> </dict> - <key>NSAlternateImage</key> + <key>NSBackgroundColor</key> <dict> <key>CF$UID</key> - <integer>73</integer> + <integer>98</integer> </dict> - <key>NSButtonFlags</key> - <integer>1211912703</integer> - <key>NSButtonFlags2</key> - <integer>0</integer> <key>NSCellFlags</key> <integer>67239424</integer> <key>NSCellFlags2</key> - <integer>0</integer> + <integer>4194304</integer> <key>NSContents</key> <dict> <key>CF$UID</key> - <integer>79</integer> + <integer>97</integer> </dict> <key>NSControlView</key> <dict> <key>CF$UID</key> - <integer>68</integer> + <integer>94</integer> </dict> - <key>NSNormalImage</key> + <key>NSSupport</key> <dict> <key>CF$UID</key> - <integer>80</integer> + <integer>15</integer> </dict> - <key>NSPeriodicDelay</key> - <integer>400</integer> - <key>NSPeriodicInterval</key> - <integer>75</integer> - <key>NSSupport</key> + <key>NSTextColor</key> <dict> <key>CF$UID</key> - <integer>15</integer> + <integer>103</integer> </dict> - <key>NSTag</key> - <integer>2</integer> </dict> - <string>Simple 8-bit IDE</string> + <string>Real device: +</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>92</integer> + <integer>102</integer> </dict> - <key>NSColor</key> + <key>NSCatalogName</key> <dict> <key>CF$UID</key> - <integer>90</integer> + <integer>99</integer> </dict> - <key>NSImageFlags</key> - <integer>549453824</integer> - <key>NSReps</key> + <key>NSColor</key> <dict> <key>CF$UID</key> - <integer>82</integer> + <integer>101</integer> </dict> - <key>NSSize</key> + <key>NSColorName</key> <dict> <key>CF$UID</key> - <integer>81</integer> + <integer>100</integer> </dict> + <key>NSColorSpace</key> + <integer>6</integer> </dict> - <string>{18, 18}</string> + <string>System</string> + <string>controlColor</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>89</integer> + <integer>102</integer> </dict> - <key>NS.objects</key> + <key>NSColorSpace</key> + <integer>3</integer> + <key>NSWhite</key> + <data> + MC42NjY2NjY2OQA= + </data> + </dict> + <dict> + <key>$classes</key> <array> - <dict> - <key>CF$UID</key> - <integer>83</integer> - </dict> + <string>NSColor</string> + <string>NSObject</string> </array> + <key>$classname</key> + <string>NSColor</string> </dict> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>88</integer> + <integer>102</integer> </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>84</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>85</integer> - </dict> - </array> - </dict> - <integer>0</integer> - <dict> - <key>$class</key> + <key>NSCatalogName</key> <dict> <key>CF$UID</key> - <integer>87</integer> + <integer>99</integer> </dict> - <key>NSTIFFRepresentation</key> + <key>NSColor</key> <dict> <key>CF$UID</key> - <integer>86</integer> + <integer>105</integer> </dict> + <key>NSColorName</key> + <dict> + <key>CF$UID</key> + <integer>104</integer> + </dict> + <key>NSColorSpace</key> + <integer>6</integer> </dict> - <data> - TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMA - AAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXwIyMjyRwcHIsJCQk8AAAA - AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ - 29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAUZGRl5dXV198PDw//8/Pz///////////////////////// - ///U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAAAAAAAxEREUZqamrmtbW1 - /+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG - AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z - 8/P/9fX1//Ly8v/u7u7/0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4 - eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/7e3t/+3t7f/i4uL/zs7O - /8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ - 5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMA - AAADAAAALrCwsPrW1tb/3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn - 5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAADAAAALp2dnezg4OD/5eXl - /+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns - AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5 - +fn/9/f3//b29v/x8fH/6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4u - LpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7//v7+//v7+//19fX/8PDw - /8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ - ///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAA - AAAAAAAAAwAAABcAAABlYmJi3NLS0v3///////////////////////////// - ///V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAAAAAAAAAAAAUAAAAfAAAA - ZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMA - AACzAAAAnwAAAHcAAABDAAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAuAAAAJAAAABcAAAAKAAAA - AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - DQEAAAMAAAABABIAAAEBAAMAAAABABIAAAECAAMAAAAEAAAFugEDAAMAAAAB - AAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAESAAMAAAABAAEAAAEVAAMA - AAABAAQAAAEWAAMAAAABBxwAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS - AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQAB - </data> + <string>controlTextColor</string> <dict> - <key>$classes</key> - <array> - <string>NSBitmapImageRep</string> - <string>NSImageRep</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSBitmapImageRep</string> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSArray</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSArray</string> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSMutableArray</string> - <string>NSArray</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSMutableArray</string> - </dict> - <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>91</integer> + <integer>102</integer> </dict> <key>NSColorSpace</key> <integer>3</integer> <key>NSWhite</key> <data> - MCAwAA== + MAA= </data> </dict> <dict> <key>$classes</key> <array> - <string>NSColor</string> + <string>NSTextFieldCell</string> + <string>NSActionCell</string> + <string>NSCell</string> <string>NSObject</string> </array> <key>$classname</key> - <string>NSColor</string> + <string>NSTextFieldCell</string> </dict> <dict> <key>$classes</key> <array> - <string>NSImage</string> - <string>%NSImage</string> + <string>NSTextField</string> + <string>%NSTextField</string> + <string>NSControl</string> + <string>NSView</string> + <string>NSResponder</string> <string>NSObject</string> </array> <key>$classname</key> - <string>NSImage</string> + <string>NSTextField</string> </dict> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>22</integer> + <integer>107</integer> </dict> - <key>NSAlternateImage</key> + <key>NSCell</key> <dict> <key>CF$UID</key> - <integer>73</integer> + <integer>110</integer> </dict> - <key>NSButtonFlags</key> - <integer>1211912703</integer> - <key>NSButtonFlags2</key> - <integer>0</integer> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> + <key>NSEnabled</key> + <true/> + <key>NSFrame</key> <dict> <key>CF$UID</key> - <integer>94</integer> + <integer>109</integer> </dict> - <key>NSControlView</key> + <key>NSNextResponder</key> <dict> <key>CF$UID</key> - <integer>68</integer> + <integer>54</integer> </dict> - <key>NSNormalImage</key> + <key>NSSuperview</key> <dict> <key>CF$UID</key> - <integer>95</integer> + <integer>54</integer> </dict> - <key>NSPeriodicDelay</key> - <integer>400</integer> - <key>NSPeriodicInterval</key> - <integer>75</integer> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>15</integer> - </dict> - <key>NSTag</key> - <integer>3</integer> + <key>NSvFlags</key> + <integer>256</integer> </dict> - <string>ZXATASP interface</string> + <string>{{11, 18}, {122, 17}}</string> <dict> <key>$class</key> <dict> <key>CF$UID</key> - <integer>92</integer> + <integer>106</integer> </dict> - <key>NSColor</key> + <key>NSBackgroundColor</key> <dict> <key>CF$UID</key> - <integer>90</integer> + <integer>98</integer> </dict> - <key>NSImageFlags</key> - <integer>549453824</integer> - <key>NSReps</key> - <dict> - <key>CF$UID</key> - <integer>97</integer> - </dict> - <key>NSSize</key> - <dict> - <key>CF$UID</key> - <integer>96</integer> - </dict> - </dict> - <string>{18, 18}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>89</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>98</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>88</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>84</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>99</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>87</integer> - </dict> - <key>NSTIFFRepresentation</key> - <dict> - <key>CF$UID</key> - <integer>100</integer> - </dict> - </dict> - <data> - TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMA - AAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAwAAADwRE... [truncated message content] |
From: <fr...@us...> - 2006-12-29 12:30:00
|
Revision: 269 http://svn.sourceforge.net/fuse-for-macosx/?rev=269&view=rev Author: fredm Date: 2006-12-29 04:29:57 -0800 (Fri, 29 Dec 2006) Log Message: ----------- Some refactoring around the DisplayOpenGLView class. Modified Paths: -------------- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj branches/fusegl/fuse/fusepb/controllers/FuseController.h branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/controllers/PreferencesController.h branches/fusegl/fuse/fusepb/controllers/PreferencesController.m branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Added Paths: ----------- branches/fusegl/fuse/fusepb/views/DisplayController.h branches/fusegl/fuse/fusepb/views/DisplayController.m Modified: branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj =================================================================== --- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-29 12:29:57 UTC (rev 269) @@ -9,6 +9,8 @@ /* Begin PBXBuildFile section */ B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */ = {isa = PBXBuildFile; fileRef = B615BFE50B4261E50082D535 /* HIDJoysticks.h */; }; B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */ = {isa = PBXBuildFile; fileRef = B615BFE60B4261E50082D535 /* HIDJoysticks.m */; }; + B615C0130B45159B0082D535 /* DisplayController.h in Headers */ = {isa = PBXBuildFile; fileRef = B615C0110B45159B0082D535 /* DisplayController.h */; }; + B615C0140B45159B0082D535 /* DisplayController.m in Sources */ = {isa = PBXBuildFile; fileRef = B615C0120B45159B0082D535 /* DisplayController.m */; }; B61F459309121DF100C8096C /* Fuse Help in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6F905ED05CDA24300C2F10D /* Fuse Help */; }; B61F459409121DF100C8096C /* disk_plus3.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F2076596C700DE7E81 /* disk_plus3.szx */; }; B61F459509121DF100C8096C /* tape_16.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F4076596FD00DE7E81 /* tape_16.szx */; }; @@ -359,6 +361,8 @@ B611196806A1FBB6006D2711 /* JoystickConfiguration.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = JoystickConfiguration.nib; path = nibs/JoystickConfiguration.nib; sourceTree = "<group>"; }; B615BFE50B4261E50082D535 /* HIDJoysticks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = HIDJoysticks.h; path = content_arrays/HIDJoysticks.h; sourceTree = "<group>"; }; B615BFE60B4261E50082D535 /* HIDJoysticks.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = HIDJoysticks.m; path = content_arrays/HIDJoysticks.m; sourceTree = "<group>"; }; + B615C0110B45159B0082D535 /* DisplayController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DisplayController.h; sourceTree = "<group>"; }; + B615C0120B45159B0082D535 /* DisplayController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DisplayController.m; sourceTree = "<group>"; }; B619FC2E090D9BC200344F94 /* SavePanelAccessoryView.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SavePanelAccessoryView.nib; path = nibs/SavePanelAccessoryView.nib; sourceTree = "<group>"; }; B61EF5B905FED7930081DF70 /* hq3x.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = hq3x.cpp; path = scaler/hq3x.cpp; sourceTree = SOURCE_ROOT; }; B61F46A909121DF100C8096C /* Info-Fuse.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info-Fuse.plist"; sourceTree = "<group>"; }; @@ -919,6 +923,8 @@ B6CE7FCF0B28FBEC00EB65B3 /* Views */ = { isa = PBXGroup; children = ( + B615C0110B45159B0082D535 /* DisplayController.h */, + B615C0120B45159B0082D535 /* DisplayController.m */, B6CE7FCB0B28FBD600EB65B3 /* DisplayOpenGLView.h */, B6CE7FCC0B28FBD600EB65B3 /* DisplayOpenGLView.m */, ); @@ -1227,6 +1233,7 @@ B6CE7FCD0B28FBD600EB65B3 /* DisplayOpenGLView.h in Headers */, B6A6F11F0B3EA737000B88E9 /* cocoascreenshot.h in Headers */, B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */, + B615C0130B45159B0082D535 /* DisplayController.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1464,6 +1471,7 @@ B6A6F10E0B3D6360000B88E9 /* cocoaerror.m in Sources */, B6A6F1200B3EA737000B88E9 /* cocoascreenshot.m in Sources */, B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */, + B615C0140B45159B0082D535 /* DisplayController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.h =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.h 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.h 2006-12-29 12:29:57 UTC (rev 269) @@ -71,6 +71,8 @@ } + (FuseController *)singleton; +-(void) awakeFromNib; + - (IBAction)cocoa_break:(id)sender; - (IBAction)disk_eject_a:(id)sender; - (IBAction)disk_eject_b:(id)sender; Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2006-12-29 12:29:57 UTC (rev 269) @@ -45,6 +45,7 @@ #include "divide.h" #include "event.h" #include "fuse.h" +#include "fusepb/main.h" #include "if1.h" #include "if2.h" #include "libspectrum.h" @@ -217,6 +218,14 @@ return singleton; } +-(void) awakeFromNib +{ + /* FIXME: Don't really like the argc, argv stuff being here... */ + if( fuse_init( ac, av ) ) { + fprintf( stderr, "%s: error initialising -- giving up!\n", fuse_progname ); + } +} + - (IBAction)disk_eject_a:(id)sender { cocoaui_disk_eject( SPECPLUS3_DRIVE_A, 0 ); Modified: branches/fusegl/fuse/fusepb/controllers/PreferencesController.h =================================================================== --- branches/fusegl/fuse/fusepb/controllers/PreferencesController.h 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/controllers/PreferencesController.h 2006-12-29 12:29:57 UTC (rev 269) @@ -40,6 +40,7 @@ NSMutableArray *machineRoms; } ++ (void)initialize; - (void)awakeFromNib; - (void)windowDidLoad; - (void)windowDidMove:(NSNotification *)aNotification; Modified: branches/fusegl/fuse/fusepb/controllers/PreferencesController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2006-12-29 12:29:57 UTC (rev 269) @@ -28,13 +28,17 @@ #include <string.h> +#import "PreferencesController.h" + +#import "CAMachines.h" #import "FuseController.h" -#import "DisplayOpenGLView.h" +#import "HIDJoysticks.h" #import "JoystickConfigurationController.h" -#import "PreferencesController.h" -#import "CAMachines.h" #import "Joysticks.h" -#import "HIDJoysticks.h" +#import "MachineNameToIdTransformer.h" +#import "MachineScalerIsEnabled.h" +#import "ScalerNameToIdTransformer.h" +#import "VolumeSliderToPrefTransformer.h" #include "fuse.h" #include "joystick.h" @@ -51,6 +55,44 @@ @implementation PreferencesController ++(void) initialize +{ + ScalerNameToIdTransformer *sNToITransformer; + MachineScalerIsEnabled *machineScalerIsEnabled; + MachineNameToIdTransformer *mToITransformer; + VolumeSliderToPrefTransformer *vsToPTransformer; + + sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:sNToITransformer + forName:@"ScalerNameToIdTransformer"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:1] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsEnabled"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:0] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsDisabled"]; + + mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:mToITransformer + forName:@"MachineNameToIdTransformer"]; + + vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:vsToPTransformer + forName:@"VolumeSliderToPrefTransformer"]; + +} + - (void)awakeFromNib { } @@ -122,10 +164,6 @@ [machineRoms release]; fuse_emulation_unpause(); - - /* If we've enabled sound we want to put some data in the buffers before - too long to avoid glitches */ - if( sound_enabled ) [[DisplayOpenGLView instance] updateEmulationForTimeDelta:0]; } - (IBAction)chooseFile:(id)sender Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib =================================================================== --- branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib 2006-12-29 12:29:57 UTC (rev 269) @@ -1,6 +1,12 @@ { IBClasses = ( - {CLASS = DisplayOpenGLView; LANGUAGE = ObjC; SUPERCLASS = NSOpenGLView; }, + {CLASS = DisplayController; LANGUAGE = ObjC; SUPERCLASS = NSResponder; }, + { + CLASS = DisplayOpenGLView; + LANGUAGE = ObjC; + OUTLETS = {controller = NSResponder; }; + SUPERCLASS = NSOpenGLView; + }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = { Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Copied: branches/fusegl/fuse/fusepb/views/DisplayController.h (from rev 268, branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h) =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayController.h (rev 0) +++ branches/fusegl/fuse/fusepb/views/DisplayController.h 2006-12-29 12:29:57 UTC (rev 269) @@ -0,0 +1,60 @@ +/* DisplayController.h: Implementation for the DisplayController class + Copyright (c) 2006 Fredrick Meunier + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Author contact information: + + E-mail: fr...@sp... + Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia + +*/ + +#import <Cocoa/Cocoa.h> + +#include <libspectrum.h> + +#include "input.h" + +@interface DisplayController : NSResponder +{ + GHashTable *unicode_keysyms_hash; + + BOOL optDown; + BOOL ctrlDown; + BOOL shiftDown; + + int cocoakeyboard_caps_shift_pressed; + int cocoakeyboard_symbol_shift_pressed; + input_key unicode_keysym; +} +-(void) awakeFromNib; + +-(void) mouseMoved:(NSEvent *)theEvent; +-(void) mouseDown:(NSEvent *)theEvent; +-(void) mouseUp:(NSEvent *)theEvent; +-(void) rightMouseDown:(NSEvent *)theEvent; +-(void) rightMouseUp:(NSEvent *)theEvent; +-(void) otherMouseDown:(NSEvent *)theEvent; +-(void) otherMouseUp:(NSEvent *)theEvent; + +-(void) initKeyboard; +-(void) flagsChanged:(NSEvent *)theEvent; +-(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash; +-(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type; +-(void) keyDown:(NSEvent *)theEvent; +-(void) keyUp:(NSEvent *)theEvent; + +@end Copied: branches/fusegl/fuse/fusepb/views/DisplayController.m (from rev 268, branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m) =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayController.m (rev 0) +++ branches/fusegl/fuse/fusepb/views/DisplayController.m 2006-12-29 12:29:57 UTC (rev 269) @@ -0,0 +1,192 @@ +/* DisplayController.m: Implementation for the DisplayController class + Copyright (c) 2006 Fredrick Meunier + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Author contact information: + + E-mail: fr...@sp... + Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia + +*/ + +#import "DisplayController.h" + +#include "event.h" +#include "keyboard.h" +#include "ui/ui.h" + +extern keysyms_map_t unicode_keysyms_map[]; + +@implementation DisplayController + +-(void) awakeFromNib +{ + optDown = NO; + ctrlDown = NO; + shiftDown = NO; + + cocoakeyboard_caps_shift_pressed = 0; + cocoakeyboard_symbol_shift_pressed = 0; + unicode_keysym = INPUT_KEY_NONE; + + [self initKeyboard]; +} + +-(void) mouseMoved:(NSEvent *)theEvent +{ + if( ui_mouse_grabbed ) { + int dx = [theEvent deltaX]; + int dy = [theEvent deltaY]; + + if( dx < -128 ) dx = -128; + else if( dx > 128 ) dx = 128; + + if( dy < -128 ) dy = -128; + else if( dy > 128 ) dy = 128; + + ui_mouse_motion( dx, dy ); + } +} + +-(void) mouseDown:(NSEvent *)theEvent +{ + ui_mouse_button( 1, 1 ); +} + +-(void) mouseUp:(NSEvent *)theEvent +{ + ui_mouse_button( 1, 0 ); +} + +-(void) rightMouseDown:(NSEvent *)theEvent +{ + ui_mouse_button( 3, 1 ); +} + +-(void) rightMouseUp:(NSEvent *)theEvent +{ + ui_mouse_button( 3, 0 ); +} + +-(void) otherMouseDown:(NSEvent *)theEvent +{ + ui_mouse_button( 2, 1 ); +} + +-(void) otherMouseUp:(NSEvent *)theEvent +{ + ui_mouse_button( 2, 0 ); +} + +-(void) initKeyboard +{ + keysyms_map_t *ptr3; + + unicode_keysyms_hash = g_hash_table_new( g_int_hash, g_int_equal ); + + for( ptr3 = (keysyms_map_t *)unicode_keysyms_map; ptr3->ui; ptr3++ ) + g_hash_table_insert( unicode_keysyms_hash, &( ptr3->ui ), + &( ptr3->fuse ) ); +} + +-(void) modifierChange:(input_event_type)theType oldState:(BOOL)old newState:(BOOL)new +{ + if( old != new ) { + input_event_t fuse_event; + fuse_event.types.key.spectrum_key = theType; + if( new == YES ) + fuse_event.type = INPUT_EVENT_KEYPRESS; + else + fuse_event.type = INPUT_EVENT_KEYRELEASE; + input_event( &fuse_event ); + } +} + +-(void) flagsChanged:(NSEvent *)theEvent +{ + int flags = [theEvent modifierFlags]; + BOOL optDownNew = (flags & NSAlternateKeyMask) ? YES : NO; + BOOL ctrlDownNew = (flags & NSControlKeyMask) ? YES : NO; + BOOL shiftDownNew = ( flags & NSShiftKeyMask ) ? YES : NO; + + [self modifierChange:INPUT_KEY_Alt_L oldState:optDown newState:optDownNew]; + [self modifierChange:INPUT_KEY_Control_L oldState:ctrlDown newState:ctrlDownNew]; + [self modifierChange:INPUT_KEY_Shift_L oldState:shiftDown newState:shiftDownNew]; + + optDown = optDownNew; + ctrlDown = ctrlDownNew; + shiftDown = shiftDownNew; +} + +-(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash +{ + const input_key *ptr; + + ptr = g_hash_table_lookup( hash, &ui_keysym ); + + return ptr ? *ptr : INPUT_KEY_NONE; +} + +-(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type +{ + unsigned short keyCode = [theEvent keyCode]; + NSString *characters = [theEvent charactersIgnoringModifiers]; + if ([characters length]) { + input_key fuse_keysym; + input_event_t fuse_event; + + fuse_keysym = keysyms_remap( keyCode ); + if( fuse_keysym == INPUT_KEY_NONE ) { + fuse_keysym = [self otherKeysymsRemap:[characters characterAtIndex:0] + inHash:unicode_keysyms_hash]; + if( fuse_keysym != INPUT_KEY_NONE ) { + unicode_keysym = fuse_keysym; + /* record current values of caps and symbol shift. We will temoprarily + * override these for the duration of the unicoded simulated keypresses + */ + if( ( cocoakeyboard_caps_shift_pressed = keyboard_state( KEYBOARD_Caps ) ) ) + { + keyboard_release( KEYBOARD_Caps ); + } + if( ( cocoakeyboard_symbol_shift_pressed = + keyboard_state( KEYBOARD_Symbol ) ) ) { + keyboard_release( KEYBOARD_Symbol ); + } + } + } + + fuse_event.type = type; + if( unicode_keysym == INPUT_KEY_NONE ) + fuse_event.types.key.native_key = fuse_keysym; + else + fuse_event.types.key.native_key = unicode_keysym; + fuse_event.types.key.spectrum_key = fuse_keysym; + + input_event( &fuse_event ); + } +} + +-(void) keyDown:(NSEvent *)theEvent +{ + [self keyChange:theEvent type:INPUT_EVENT_KEYPRESS]; +} + +-(void) keyUp:(NSEvent *)theEvent +{ + [self keyChange:theEvent type:INPUT_EVENT_KEYRELEASE]; +} + +@end Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-29 12:29:57 UTC (rev 269) @@ -42,20 +42,12 @@ BOOL screenTexInitialised; - GHashTable *unicode_keysyms_hash; - - BOOL optDown; - BOOL ctrlDown; - BOOL shiftDown; - - int cocoakeyboard_caps_shift_pressed; - int cocoakeyboard_symbol_shift_pressed; - input_key unicode_keysym; - CFAbsoluteTime time; + + /* Controller */ + IBOutlet NSResponder *controller; } +(DisplayOpenGLView *) instance; -+(void) initialize; -(void) createTexture:(Cocoa_Texture*)newScreen; -(void) destroyTexture; @@ -74,11 +66,7 @@ -(void) otherMouseDown:(NSEvent *)theEvent; -(void) otherMouseUp:(NSEvent *)theEvent; --(void) initKeyboard; --(void) modifierChange:(input_event_type)theType oldState:(BOOL)old newState:(BOOL)new; -(void) flagsChanged:(NSEvent *)theEvent; --(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash; --(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type; -(void) keyDown:(NSEvent *)theEvent; -(void) keyUp:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-27 12:55:52 UTC (rev 268) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-29 12:29:57 UTC (rev 269) @@ -23,25 +23,16 @@ */ #import "DisplayOpenGLView.h" -#import "ScalerNameToIdTransformer.h" -#import "MachineScalerIsEnabled.h" -#import "MachineNameToIdTransformer.h" -#import "VolumeSliderToPrefTransformer.h" #include "event.h" #include "fuse.h" -#include "fusepb/main.h" -#include "keyboard.h" #include "settings.h" #include "sound.h" -extern keysyms_map_t unicode_keysyms_map[]; - #include <CoreAudio/AudioHardware.h> #include "sound/sfifo.h" extern sfifo_t sound_fifo; -extern AudioStreamBasicDescription deviceFormat; @implementation DisplayOpenGLView @@ -52,44 +43,6 @@ return instance; } -+(void) initialize -{ - ScalerNameToIdTransformer *sNToITransformer; - MachineScalerIsEnabled *machineScalerIsEnabled; - MachineNameToIdTransformer *mToITransformer; - VolumeSliderToPrefTransformer *vsToPTransformer; - - sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:sNToITransformer - forName:@"ScalerNameToIdTransformer"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:1] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsEnabled"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:0] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsDisabled"]; - - mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:mToITransformer - forName:@"MachineNameToIdTransformer"]; - - vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:vsToPTransformer - forName:@"VolumeSliderToPrefTransformer"]; - -} - -(id) initWithFrame:(NSRect)frameRect { /* Init pixel format attribs */ @@ -127,14 +80,6 @@ screenTexInitialised = NO; - optDown = NO; - ctrlDown = NO; - shiftDown = NO; - - cocoakeyboard_caps_shift_pressed = 0; - cocoakeyboard_symbol_shift_pressed = 0; - unicode_keysym = INPUT_KEY_NONE; - return self; } @@ -143,13 +88,6 @@ /* keep the window in the standard aspect ratio if the user resizes */ [[self window] setContentAspectRatio:NSMakeSize(4.0,3.0)]; - /* FIXME: Don't really like the argc, argv stuff being here... */ - if( fuse_init( ac, av ) ) { - fprintf( stderr, "%s: error initialising -- giving up!\n", fuse_progname ); - } - - [self initKeyboard]; - time = CFAbsoluteTimeGetCurrent(); /* set emulation time start time */ } @@ -336,146 +274,62 @@ -(void) mouseMoved:(NSEvent *)theEvent { - if( ui_mouse_grabbed ) { - int dx = [theEvent deltaX]; - int dy = [theEvent deltaY]; - - if( dx < -128 ) dx = -128; - else if( dx > 128 ) dx = 128; - - if( dy < -128 ) dy = -128; - else if( dy > 128 ) dy = 128; - - ui_mouse_motion( dx, dy ); - } + /* Delegate to our controller object. */ + [controller mouseMoved:theEvent]; } -(void) mouseDown:(NSEvent *)theEvent { - ui_mouse_button( 1, 1 ); + /* Delegate to our controller object. */ + [controller mouseDown:theEvent]; } -(void) mouseUp:(NSEvent *)theEvent { - ui_mouse_button( 1, 0 ); + /* Delegate to our controller object. */ + [controller mouseUp:theEvent]; } -(void) rightMouseDown:(NSEvent *)theEvent { - ui_mouse_button( 3, 1 ); + /* Delegate to our controller object. */ + [controller rightMouseDown:theEvent]; } -(void) rightMouseUp:(NSEvent *)theEvent { - ui_mouse_button( 3, 0 ); + /* Delegate to our controller object. */ + [controller rightMouseUp:theEvent]; } -(void) otherMouseDown:(NSEvent *)theEvent { - ui_mouse_button( 2, 1 ); + /* Delegate to our controller object. */ + [controller otherMouseDown:theEvent]; } -(void) otherMouseUp:(NSEvent *)theEvent { - ui_mouse_button( 2, 0 ); + /* Delegate to our controller object. */ + [controller otherMouseUp:theEvent]; } --(void) initKeyboard -{ - keysyms_map_t *ptr3; - - unicode_keysyms_hash = g_hash_table_new( g_int_hash, g_int_equal ); - - for( ptr3 = (keysyms_map_t *)unicode_keysyms_map; ptr3->ui; ptr3++ ) - g_hash_table_insert( unicode_keysyms_hash, &( ptr3->ui ), - &( ptr3->fuse ) ); -} - --(void) modifierChange:(input_event_type)theType oldState:(BOOL)old newState:(BOOL)new -{ - if( old != new ) { - input_event_t fuse_event; - fuse_event.types.key.spectrum_key = theType; - if( new == YES ) - fuse_event.type = INPUT_EVENT_KEYPRESS; - else - fuse_event.type = INPUT_EVENT_KEYRELEASE; - input_event( &fuse_event ); - } -} - -(void) flagsChanged:(NSEvent *)theEvent { - int flags = [theEvent modifierFlags]; - BOOL optDownNew = (flags & NSAlternateKeyMask) ? YES : NO; - BOOL ctrlDownNew = (flags & NSControlKeyMask) ? YES : NO; - BOOL shiftDownNew = ( flags & NSShiftKeyMask ) ? YES : NO; - - [self modifierChange:INPUT_KEY_Alt_L oldState:optDown newState:optDownNew]; - [self modifierChange:INPUT_KEY_Control_L oldState:ctrlDown newState:ctrlDownNew]; - [self modifierChange:INPUT_KEY_Shift_L oldState:shiftDown newState:shiftDownNew]; - - optDown = optDownNew; - ctrlDown = ctrlDownNew; - shiftDown = shiftDownNew; + /* Delegate to our controller object. */ + [controller flagsChanged:theEvent]; } --(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash -{ - const input_key *ptr; - - ptr = g_hash_table_lookup( hash, &ui_keysym ); - - return ptr ? *ptr : INPUT_KEY_NONE; -} - --(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type -{ - unsigned short keyCode = [theEvent keyCode]; - NSString *characters = [theEvent charactersIgnoringModifiers]; - if ([characters length]) { - input_key fuse_keysym; - input_event_t fuse_event; - - fuse_keysym = keysyms_remap( keyCode ); - if( fuse_keysym == INPUT_KEY_NONE ) { - fuse_keysym = [self otherKeysymsRemap:[characters characterAtIndex:0] - inHash:unicode_keysyms_hash]; - if( fuse_keysym != INPUT_KEY_NONE ) { - unicode_keysym = fuse_keysym; - /* record current values of caps and symbol shift. We will temoprarily - * override these for the duration of the unicoded simulated keypresses - */ - if( ( cocoakeyboard_caps_shift_pressed = keyboard_state( KEYBOARD_Caps ) ) ) - { - keyboard_release( KEYBOARD_Caps ); - } - if( ( cocoakeyboard_symbol_shift_pressed = - keyboard_state( KEYBOARD_Symbol ) ) ) { - keyboard_release( KEYBOARD_Symbol ); - } - } - } - - fuse_event.type = type; - if( unicode_keysym == INPUT_KEY_NONE ) - fuse_event.types.key.native_key = fuse_keysym; - else - fuse_event.types.key.native_key = unicode_keysym; - fuse_event.types.key.spectrum_key = fuse_keysym; - - input_event( &fuse_event ); - } -} - -(void) keyDown:(NSEvent *)theEvent { - [self keyChange:theEvent type:INPUT_EVENT_KEYPRESS]; + /* Delegate to our controller object. */ + [controller keyDown:theEvent]; } -(void) keyUp:(NSEvent *)theEvent { - [self keyChange:theEvent type:INPUT_EVENT_KEYRELEASE]; + /* Delegate to our controller object. */ + [controller keyUp:theEvent]; } -(BOOL) acceptsFirstResponder This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2006-12-29 13:50:19
|
Revision: 270 http://svn.sourceforge.net/fuse-for-macosx/?rev=270&view=rev Author: fredm Date: 2006-12-29 05:50:18 -0800 (Fri, 29 Dec 2006) Log Message: ----------- Refactor drawing to DisplayScene object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj branches/fusegl/fuse/fusepb/FuseMenus.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Added Paths: ----------- branches/fusegl/fuse/fusepb/views/DisplayScene.h branches/fusegl/fuse/fusepb/views/DisplayScene.m Modified: branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj =================================================================== --- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-29 12:29:57 UTC (rev 269) +++ branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-29 13:50:18 UTC (rev 270) @@ -11,6 +11,8 @@ B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */ = {isa = PBXBuildFile; fileRef = B615BFE60B4261E50082D535 /* HIDJoysticks.m */; }; B615C0130B45159B0082D535 /* DisplayController.h in Headers */ = {isa = PBXBuildFile; fileRef = B615C0110B45159B0082D535 /* DisplayController.h */; }; B615C0140B45159B0082D535 /* DisplayController.m in Sources */ = {isa = PBXBuildFile; fileRef = B615C0120B45159B0082D535 /* DisplayController.m */; }; + B615C02B0B454A7F0082D535 /* DisplayScene.h in Headers */ = {isa = PBXBuildFile; fileRef = B615C0290B454A7E0082D535 /* DisplayScene.h */; }; + B615C02C0B454A7F0082D535 /* DisplayScene.m in Sources */ = {isa = PBXBuildFile; fileRef = B615C02A0B454A7F0082D535 /* DisplayScene.m */; }; B61F459309121DF100C8096C /* Fuse Help in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6F905ED05CDA24300C2F10D /* Fuse Help */; }; B61F459409121DF100C8096C /* disk_plus3.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F2076596C700DE7E81 /* disk_plus3.szx */; }; B61F459509121DF100C8096C /* tape_16.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F4076596FD00DE7E81 /* tape_16.szx */; }; @@ -363,6 +365,8 @@ B615BFE60B4261E50082D535 /* HIDJoysticks.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = HIDJoysticks.m; path = content_arrays/HIDJoysticks.m; sourceTree = "<group>"; }; B615C0110B45159B0082D535 /* DisplayController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DisplayController.h; sourceTree = "<group>"; }; B615C0120B45159B0082D535 /* DisplayController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DisplayController.m; sourceTree = "<group>"; }; + B615C0290B454A7E0082D535 /* DisplayScene.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DisplayScene.h; sourceTree = "<group>"; }; + B615C02A0B454A7F0082D535 /* DisplayScene.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DisplayScene.m; sourceTree = "<group>"; }; B619FC2E090D9BC200344F94 /* SavePanelAccessoryView.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SavePanelAccessoryView.nib; path = nibs/SavePanelAccessoryView.nib; sourceTree = "<group>"; }; B61EF5B905FED7930081DF70 /* hq3x.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = hq3x.cpp; path = scaler/hq3x.cpp; sourceTree = SOURCE_ROOT; }; B61F46A909121DF100C8096C /* Info-Fuse.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info-Fuse.plist"; sourceTree = "<group>"; }; @@ -923,6 +927,8 @@ B6CE7FCF0B28FBEC00EB65B3 /* Views */ = { isa = PBXGroup; children = ( + B615C0290B454A7E0082D535 /* DisplayScene.h */, + B615C02A0B454A7F0082D535 /* DisplayScene.m */, B615C0110B45159B0082D535 /* DisplayController.h */, B615C0120B45159B0082D535 /* DisplayController.m */, B6CE7FCB0B28FBD600EB65B3 /* DisplayOpenGLView.h */, @@ -1234,6 +1240,7 @@ B6A6F11F0B3EA737000B88E9 /* cocoascreenshot.h in Headers */, B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */, B615C0130B45159B0082D535 /* DisplayController.h in Headers */, + B615C02B0B454A7F0082D535 /* DisplayScene.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1472,6 +1479,7 @@ B6A6F1200B3EA737000B88E9 /* cocoascreenshot.m in Sources */, B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */, B615C0140B45159B0082D535 /* DisplayController.m in Sources */, + B615C02C0B454A7F0082D535 /* DisplayScene.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: branches/fusegl/fuse/fusepb/FuseMenus.m =================================================================== --- branches/fusegl/fuse/fusepb/FuseMenus.m 2006-12-29 12:29:57 UTC (rev 269) +++ branches/fusegl/fuse/fusepb/FuseMenus.m 2006-12-29 13:50:18 UTC (rev 270) @@ -28,6 +28,7 @@ */ #import "DisplayOpenGLView.h" +#import "DisplayScene.h" #import "FuseController.h" #import "FuseMenus.h" @@ -48,12 +49,12 @@ void CreateTexture(Cocoa_Texture* new_screen) { - [[DisplayOpenGLView instance] createTexture:new_screen]; + [[[DisplayOpenGLView instance] scene] createTexture:new_screen]; } void DestroyTexture(void) { - [[DisplayOpenGLView instance] destroyTexture]; + [[[DisplayOpenGLView instance] scene] destroyTexture]; } void SetEmulationHz( float hz ) Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-29 12:29:57 UTC (rev 269) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-29 13:50:18 UTC (rev 270) @@ -24,35 +24,26 @@ #import <Cocoa/Cocoa.h> -#include <OpenGL/gl.h> -#include <OpenGL/glext.h> -#include <OpenGL/glu.h> +@class DisplayScene; -#include <libspectrum.h> - -#include "input.h" -#include "ui/cocoa/cocoadisplay.h" - @interface DisplayOpenGLView : NSOpenGLView { NSTimer* timer; - - /* Need texture size and dimensions and two backing textures */ - Cocoa_Texture screenTex; /* Screen texture */ - - BOOL screenTexInitialised; - CFAbsoluteTime time; + /* Model */ + DisplayScene *scene; + /* Controller */ IBOutlet NSResponder *controller; } +(DisplayOpenGLView *) instance; --(void) createTexture:(Cocoa_Texture*)newScreen; --(void) destroyTexture; +- (void)dealloc; --(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime; +- (DisplayScene *)scene; + +-(void) emulationTimerFired:(NSTimer *)timer; -(void) setEmulationHz:(float)hz; -(id) initWithFrame:(NSRect)frameRect; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-29 12:29:57 UTC (rev 269) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-29 13:50:18 UTC (rev 270) @@ -24,16 +24,8 @@ #import "DisplayOpenGLView.h" -#include "event.h" -#include "fuse.h" -#include "settings.h" -#include "sound.h" +#import "DisplayScene.h" -#include <CoreAudio/AudioHardware.h> -#include "sound/sfifo.h" - -extern sfifo_t sound_fifo; - @implementation DisplayOpenGLView static DisplayOpenGLView *instance = nil; @@ -65,6 +57,9 @@ self = instance; } else { self = [super initWithFrame:frameRect pixelFormat:pixFmt]; + if (self) { + scene = [[DisplayScene alloc] init]; + } instance = self; } @@ -72,15 +67,18 @@ timer = nil; - /* Setup some basic OpenGL stuff */ - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + return self; +} - screenTexInitialised = NO; +- (void)dealloc +{ + [scene release]; + [super dealloc]; +} - return self; +- (DisplayScene *)scene +{ + return scene; } -(void) awakeFromNib @@ -91,184 +89,41 @@ time = CFAbsoluteTimeGetCurrent(); /* set emulation time start time */ } --(void) drawRect:(NSRect)aRect +-(void) emulationTimerFired:(NSTimer *)timer { CFTimeInterval nowTime = CFAbsoluteTimeGetCurrent(); CFTimeInterval deltaTime = nowTime - time; if (deltaTime <= 1.0) { /* skip pauses */ - [self updateEmulationForTimeDelta:deltaTime]; + [scene updateEmulationForTimeDelta:deltaTime]; } time = nowTime; - if( NO == screenTexInitialised ) return; + [self setNeedsDisplay:YES]; +} - /* Need to draw texture to screen here */ - memcpy(screenTex.pixels, screen.pixels, screenTex.pitch*screenTex.full_height); +-(void) drawRect:(NSRect)aRect +{ + /* Delegate to our scene object for rendering. */ + [scene render]; - [[self openGLContext] makeCurrentContext]; - - /* Bind, update and draw new image */ - glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 1); - - glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, screenTex.full_width, - screenTex.full_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - screenTex.pixels); - - glBegin(GL_QUADS); - - glTexCoord2f((float)screenTex.image_width, (float)(screenTex.image_xoffset)); - glVertex2f(1.0f, 1.0f); - - glTexCoord2f((float)screenTex.image_width, (float)screenTex.image_height); - glVertex2f(1.0f, -1.0f); - - glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_height); - glVertex2f(-1.0f, -1.0f); - - glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_yoffset); - glVertex2f(-1.0f, 1.0f); - - glEnd(); - - /* FIXME: Probably still need to glFlush() in fullscreen mode */ - //glFlush(); - /* Swap buffer to screen */ [[self openGLContext] flushBuffer]; } -/* moved or resized */ --(void) update -{ - NSRect rect; - - [super update]; - - [[self openGLContext] makeCurrentContext]; - [[self openGLContext] update]; - - rect = [self bounds]; - - glViewport(0, 0, (int) rect.size.width, (int) rect.size.height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - [self setNeedsDisplay:true]; -} - /* scrolled, moved or resized */ -(void) reshape { - NSRect rect; - - [super reshape]; - - [[self openGLContext] makeCurrentContext]; - [[self openGLContext] update]; - - rect = [self bounds]; - - glViewport(0, 0, (int) rect.size.width, (int) rect.size.height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - [self setNeedsDisplay:true]; + /* Delegate to our scene object to update for a change in the view size. */ + [scene setViewportRect:[self bounds]]; } --(void) destroyTexture -{ - GLuint i; - - if( screenTexInitialised == NO) return; - /* FIXME: May want to have a double buffered texture later */ - for(i = 0; i < 1; i++) { - GLint dt = i+1; - glDeleteTextures(1, &dt); - } - screenTexInitialised = NO; -} - --(void) createTexture:(Cocoa_Texture*)newScreen; -{ - GLint i; - - screenTex.full_width = newScreen->full_width; - screenTex.full_height = newScreen->full_height; - screenTex.image_width = newScreen->image_width; - screenTex.image_height = newScreen->image_height; - screenTex.image_xoffset = newScreen->image_xoffset; - screenTex.image_yoffset = newScreen->image_yoffset; - screenTex.pixels = calloc(screenTex.full_width*screenTex.full_height, sizeof(uint32_t)); - if( !screenTex.pixels ) { - fprintf( stderr, "%s: couldn't create screenTex.pixels\n", fuse_progname ); - return; - } - screenTex.pitch = screenTex.full_width * sizeof(uint32_t); - - [[self openGLContext] makeCurrentContext]; - [[self openGLContext] update]; - - /* FIXME: May want to have a double buffered texture later */ - for(i = 0; i < 1; i++) - { - glDisable(GL_TEXTURE_2D); - glEnable(GL_TEXTURE_RECTANGLE_EXT); - glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i+1); - - glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, - screenTex.full_width*screenTex.pitch, - screenTex.pixels ); - - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE, - GL_STORAGE_CACHED_APPLE); - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE ); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - - glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, screenTex.full_width, - screenTex.full_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - screenTex.pixels ); - } - screenTexInitialised = YES; -} - -/* given a delta time in seconds, update overall emulation state */ --(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime -{ - if( sound_enabled ) { - /* emulate until fifo is full */ - while( sfifo_space( &sound_fifo ) >= (sound_stereo+1) * 2 * sound_framesiz ) { - event_do_frame(); - } - } else { - float speed = ( settings_current.emulation_speed < 1 ? - 100.0 : - settings_current.emulation_speed ) / 100.0; - libspectrum_dword time_tstates = deltaTime * - machine_current->timings.processor_speed * - speed + 0.5; - event_do_timer( time_tstates ); - } -} - -(void) setEmulationHz:(float)hz { [timer invalidate]; [timer release]; timer = [[NSTimer scheduledTimerWithTimeInterval: (1.0f / hz) - target:self selector:@selector(drawRect:) + target:self selector:@selector(emulationTimerFired:) userInfo:self repeats:true] retain]; } Copied: branches/fusegl/fuse/fusepb/views/DisplayScene.h (from rev 269, branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h) =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayScene.h (rev 0) +++ branches/fusegl/fuse/fusepb/views/DisplayScene.h 2006-12-29 13:50:18 UTC (rev 270) @@ -0,0 +1,44 @@ +/* DisplayScene.h: Implementation for the DisplayScene class + Copyright (c) 2006 Fredrick Meunier + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Author contact information: + + E-mail: fr...@sp... + Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia + +*/ + +#import <Cocoa/Cocoa.h> + +#include "ui/cocoa/cocoadisplay.h" + +@interface DisplayScene : NSObject +{ + /* Need texture size and dimensions and two backing textures */ + Cocoa_Texture screenTex; /* Screen texture */ + + BOOL screenTexInitialised; +} +-(void) setViewportRect:(NSRect)bounds; +-(void) render; + +-(void) createTexture:(Cocoa_Texture*)newScreen; +-(void) destroyTexture; + +-(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime; + +@end Copied: branches/fusegl/fuse/fusepb/views/DisplayScene.m (from rev 269, branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m) =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayScene.m (rev 0) +++ branches/fusegl/fuse/fusepb/views/DisplayScene.m 2006-12-29 13:50:18 UTC (rev 270) @@ -0,0 +1,176 @@ +/* DisplayScene.m: Implementation for the DisplayScene class + Copyright (c) 2006 Fredrick Meunier + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Author contact information: + + E-mail: fr...@sp... + Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia + +*/ + +#import "DisplayScene.h" + +#include <OpenGL/gl.h> +#include <OpenGL/glext.h> +#include <OpenGL/glu.h> + +#include "event.h" +#include "fuse.h" +#include "settings.h" +#include "sound.h" +#include "sound/sfifo.h" + +extern sfifo_t sound_fifo; + +@implementation DisplayScene + +- (void)dealloc +{ + [self destroyTexture]; + [super dealloc]; +} + +-(void) setViewportRect:(NSRect)bounds +{ + glViewport(0, 0, (int) bounds.size.width, (int) bounds.size.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +-(void) render +{ + if( NO == screenTexInitialised ) return; + + /* Need to draw texture to screen here */ + memcpy(screenTex.pixels, screen.pixels, screenTex.pitch*screenTex.full_height); + + /* Setup some basic OpenGL stuff */ + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + /* Bind, update and draw new image */ + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 1); + + glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, screenTex.full_width, + screenTex.full_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + screenTex.pixels); + + glBegin(GL_QUADS); + + glTexCoord2f((float)screenTex.image_width, (float)(screenTex.image_xoffset)); + glVertex2f(1.0f, 1.0f); + + glTexCoord2f((float)screenTex.image_width, (float)screenTex.image_height); + glVertex2f(1.0f, -1.0f); + + glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_height); + glVertex2f(-1.0f, -1.0f); + + glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_yoffset); + glVertex2f(-1.0f, 1.0f); + + glEnd(); + + // Flush out any unfinished rendering before swapping. + //glFinish(); +} + +-(void) destroyTexture +{ + GLuint i; + + if( screenTexInitialised == NO) return; + /* FIXME: May want to have a double buffered texture later */ + for(i = 0; i < 1; i++) { + GLint dt = i+1; + glDeleteTextures(1, &dt); + free( screenTex.pixels ); + screenTex.pixels = NULL; + } + screenTexInitialised = NO; +} + +-(void) createTexture:(Cocoa_Texture*)newScreen; +{ + GLint i; + + screenTex.full_width = newScreen->full_width; + screenTex.full_height = newScreen->full_height; + screenTex.image_width = newScreen->image_width; + screenTex.image_height = newScreen->image_height; + screenTex.image_xoffset = newScreen->image_xoffset; + screenTex.image_yoffset = newScreen->image_yoffset; + screenTex.pixels = calloc(screenTex.full_width*screenTex.full_height, sizeof(uint32_t)); + if( !screenTex.pixels ) { + fprintf( stderr, "%s: couldn't create screenTex.pixels\n", fuse_progname ); + return; + } + screenTex.pitch = screenTex.full_width * sizeof(uint32_t); + + /* FIXME: May want to have a double buffered texture later */ + for(i = 0; i < 1; i++) + { + glDisable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_RECTANGLE_EXT); + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i+1); + + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, + screenTex.full_width*screenTex.pitch, + screenTex.pixels ); + + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE, + GL_STORAGE_CACHED_APPLE); + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE ); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + + glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, screenTex.full_width, + screenTex.full_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + screenTex.pixels ); + } + screenTexInitialised = YES; +} + +/* given a delta time in seconds, update overall emulation state */ +-(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime +{ + if( sound_enabled ) { + /* emulate until fifo is full */ + while( sfifo_space( &sound_fifo ) >= (sound_stereo+1) * 2 * sound_framesiz ) { + event_do_frame(); + } + } else { + float speed = ( settings_current.emulation_speed < 1 ? + 100.0 : + settings_current.emulation_speed ) / 100.0; + libspectrum_dword time_tstates = deltaTime * + machine_current->timings.processor_speed * + speed + 0.5; + event_do_timer( time_tstates ); + } +} + +@end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2006-12-29 15:18:47
|
Revision: 271 http://svn.sourceforge.net/fuse-for-macosx/?rev=271&view=rev Author: fredm Date: 2006-12-29 07:18:45 -0800 (Fri, 29 Dec 2006) Log Message: ----------- Move emulation timer to DisplayController class. Modified Paths: -------------- branches/fusegl/fuse/fusepb/FuseMenus.m branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib branches/fusegl/fuse/fusepb/views/DisplayController.h branches/fusegl/fuse/fusepb/views/DisplayController.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m branches/fusegl/fuse/fusepb/views/DisplayScene.h branches/fusegl/fuse/fusepb/views/DisplayScene.m Modified: branches/fusegl/fuse/fusepb/FuseMenus.m =================================================================== --- branches/fusegl/fuse/fusepb/FuseMenus.m 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/FuseMenus.m 2006-12-29 15:18:45 UTC (rev 271) @@ -27,7 +27,7 @@ */ -#import "DisplayOpenGLView.h" +#import "DisplayController.h" #import "DisplayScene.h" #import "FuseController.h" #import "FuseMenus.h" @@ -49,17 +49,17 @@ void CreateTexture(Cocoa_Texture* new_screen) { - [[[DisplayOpenGLView instance] scene] createTexture:new_screen]; + [[DisplayScene singleton] createTexture:new_screen]; } void DestroyTexture(void) { - [[[DisplayOpenGLView instance] scene] destroyTexture]; + [[DisplayScene singleton] destroyTexture]; } void SetEmulationHz( float hz ) { - [[DisplayOpenGLView instance] setEmulationHz:hz]; + [[DisplayController singleton] setEmulationHz:hz]; } void Hide(void) Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib =================================================================== --- branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib 2006-12-29 15:18:45 UTC (rev 271) @@ -1,7 +1,12 @@ { IBClasses = ( - {CLASS = DisplayController; LANGUAGE = ObjC; SUPERCLASS = NSResponder; }, { + CLASS = DisplayController; + LANGUAGE = ObjC; + OUTLETS = {openGLView = DisplayOpenGLView; }; + SUPERCLASS = NSResponder; + }, + { CLASS = DisplayOpenGLView; LANGUAGE = ObjC; OUTLETS = {controller = NSResponder; }; Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: branches/fusegl/fuse/fusepb/views/DisplayController.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayController.h 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/views/DisplayController.h 2006-12-29 15:18:45 UTC (rev 271) @@ -28,8 +28,17 @@ #include "input.h" +@class DisplayOpenGLView; + @interface DisplayController : NSResponder { + /* Model */ + NSTimer* timer; + CFAbsoluteTime time; + + /* Views */ + IBOutlet DisplayOpenGLView *openGLView; + GHashTable *unicode_keysyms_hash; BOOL optDown; @@ -40,7 +49,7 @@ int cocoakeyboard_symbol_shift_pressed; input_key unicode_keysym; } --(void) awakeFromNib; ++(DisplayController *) singleton; -(void) mouseMoved:(NSEvent *)theEvent; -(void) mouseDown:(NSEvent *)theEvent; @@ -57,4 +66,7 @@ -(void) keyDown:(NSEvent *)theEvent; -(void) keyUp:(NSEvent *)theEvent; +-(void) emulationTimerFired:(NSTimer *)timer; +-(void) setEmulationHz:(float)hz; + @end Modified: branches/fusegl/fuse/fusepb/views/DisplayController.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayController.m 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/views/DisplayController.m 2006-12-29 15:18:45 UTC (rev 271) @@ -23,6 +23,8 @@ */ #import "DisplayController.h" +#import "DisplayOpenGLView.h" +#import "DisplayScene.h" #include "event.h" #include "keyboard.h" @@ -32,17 +34,37 @@ @implementation DisplayController --(void) awakeFromNib +static DisplayController *singleton = nil; + ++ (DisplayController *)singleton { - optDown = NO; - ctrlDown = NO; - shiftDown = NO; + return singleton ? singleton : [[self alloc] init]; +} - cocoakeyboard_caps_shift_pressed = 0; - cocoakeyboard_symbol_shift_pressed = 0; - unicode_keysym = INPUT_KEY_NONE; +-(id) init +{ + if ( singleton ) { + [self dealloc]; + } else { + self = [super init]; + singleton = self; - [self initKeyboard]; + optDown = NO; + ctrlDown = NO; + shiftDown = NO; + + cocoakeyboard_caps_shift_pressed = 0; + cocoakeyboard_symbol_shift_pressed = 0; + unicode_keysym = INPUT_KEY_NONE; + + [self initKeyboard]; + + timer = nil; + + time = CFAbsoluteTimeGetCurrent(); /* set emulation time start time */ + } + + return singleton; } -(void) mouseMoved:(NSEvent *)theEvent @@ -189,4 +211,27 @@ [self keyChange:theEvent type:INPUT_EVENT_KEYRELEASE]; } +-(void) emulationTimerFired:(NSTimer *)timer +{ + CFTimeInterval nowTime = CFAbsoluteTimeGetCurrent(); + CFTimeInterval deltaTime = nowTime - time; + if (deltaTime <= 1.0) { /* skip pauses */ + DisplayScene *scene = [openGLView scene]; + [scene updateEmulationForTimeDelta:deltaTime]; + } + time = nowTime; + + [openGLView setNeedsDisplay:YES]; +} + +-(void) setEmulationHz:(float)hz +{ + [timer invalidate]; + [timer release]; + + timer = [[NSTimer scheduledTimerWithTimeInterval: (1.0f / hz) + target:self selector:@selector(emulationTimerFired:) + userInfo:self repeats:true] retain]; +} + @end Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-29 15:18:45 UTC (rev 271) @@ -28,24 +28,16 @@ @interface DisplayOpenGLView : NSOpenGLView { - NSTimer* timer; - CFAbsoluteTime time; - /* Model */ DisplayScene *scene; /* Controller */ IBOutlet NSResponder *controller; } -+(DisplayOpenGLView *) instance; - - (void)dealloc; - (DisplayScene *)scene; --(void) emulationTimerFired:(NSTimer *)timer; --(void) setEmulationHz:(float)hz; - -(id) initWithFrame:(NSRect)frameRect; -(void) awakeFromNib; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-29 15:18:45 UTC (rev 271) @@ -28,13 +28,6 @@ @implementation DisplayOpenGLView -static DisplayOpenGLView *instance = nil; - -+(DisplayOpenGLView *) instance -{ - return instance; -} - -(id) initWithFrame:(NSRect)frameRect { /* Init pixel format attribs */ @@ -52,27 +45,18 @@ exit(1); } - if ( instance ) { - [self dealloc]; - self = instance; - } else { self = [super initWithFrame:frameRect pixelFormat:pixFmt]; if (self) { - scene = [[DisplayScene alloc] init]; + scene = [DisplayScene singleton]; } - instance = self; - } [[self openGLContext] makeCurrentContext]; - timer = nil; - return self; } - (void)dealloc { - [scene release]; [super dealloc]; } @@ -85,22 +69,8 @@ { /* keep the window in the standard aspect ratio if the user resizes */ [[self window] setContentAspectRatio:NSMakeSize(4.0,3.0)]; - - time = CFAbsoluteTimeGetCurrent(); /* set emulation time start time */ } --(void) emulationTimerFired:(NSTimer *)timer -{ - CFTimeInterval nowTime = CFAbsoluteTimeGetCurrent(); - CFTimeInterval deltaTime = nowTime - time; - if (deltaTime <= 1.0) { /* skip pauses */ - [scene updateEmulationForTimeDelta:deltaTime]; - } - time = nowTime; - - [self setNeedsDisplay:YES]; -} - -(void) drawRect:(NSRect)aRect { /* Delegate to our scene object for rendering. */ @@ -117,16 +87,6 @@ [scene setViewportRect:[self bounds]]; } --(void) setEmulationHz:(float)hz -{ - [timer invalidate]; - [timer release]; - - timer = [[NSTimer scheduledTimerWithTimeInterval: (1.0f / hz) - target:self selector:@selector(emulationTimerFired:) - userInfo:self repeats:true] retain]; -} - -(void) mouseMoved:(NSEvent *)theEvent { /* Delegate to our controller object. */ Modified: branches/fusegl/fuse/fusepb/views/DisplayScene.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayScene.h 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/views/DisplayScene.h 2006-12-29 15:18:45 UTC (rev 271) @@ -33,6 +33,8 @@ BOOL screenTexInitialised; } ++(DisplayScene *) singleton; + -(void) setViewportRect:(NSRect)bounds; -(void) render; Modified: branches/fusegl/fuse/fusepb/views/DisplayScene.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayScene.m 2006-12-29 13:50:18 UTC (rev 270) +++ branches/fusegl/fuse/fusepb/views/DisplayScene.m 2006-12-29 15:18:45 UTC (rev 271) @@ -38,9 +38,29 @@ @implementation DisplayScene +static DisplayScene *singleton = nil; + ++ (DisplayScene *)singleton +{ + return singleton ? singleton : [[self alloc] init]; +} + +- (id)init +{ + if ( singleton ) { + [self dealloc]; + } else { + [super init]; + singleton = self; + } + + return singleton; +} + - (void)dealloc { [self destroyTexture]; + singleton = nil; [super dealloc]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-01-01 07:24:18
|
Revision: 275 http://svn.sourceforge.net/fuse-for-macosx/?rev=275&view=rev Author: fredm Date: 2006-12-31 23:24:18 -0800 (Sun, 31 Dec 2006) Log Message: ----------- Move transformer intantiation back to PreferencesController. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/PreferencesController.h branches/fusegl/fuse/fusepb/controllers/PreferencesController.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/PreferencesController.h =================================================================== --- branches/fusegl/fuse/fusepb/controllers/PreferencesController.h 2007-01-01 07:15:54 UTC (rev 274) +++ branches/fusegl/fuse/fusepb/controllers/PreferencesController.h 2007-01-01 07:24:18 UTC (rev 275) @@ -40,7 +40,8 @@ NSMutableArray *machineRoms; } -- (void)awakeFromNib; ++ (void)initialize; + - (void)windowDidLoad; - (void)windowDidMove:(NSNotification *)aNotification; - (void)showWindow:(id)sender; Modified: branches/fusegl/fuse/fusepb/controllers/PreferencesController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2007-01-01 07:15:54 UTC (rev 274) +++ branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2007-01-01 07:24:18 UTC (rev 275) @@ -36,6 +36,11 @@ #import "Joysticks.h" #import "HIDJoysticks.h" +#import "ScalerNameToIdTransformer.h" +#import "MachineScalerIsEnabled.h" +#import "MachineNameToIdTransformer.h" +#import "VolumeSliderToPrefTransformer.h" + #include "fuse.h" #include "joystick.h" #include "printer.h" @@ -51,8 +56,42 @@ @implementation PreferencesController -- (void)awakeFromNib ++(void) initialize { + ScalerNameToIdTransformer *sNToITransformer; + MachineScalerIsEnabled *machineScalerIsEnabled; + MachineNameToIdTransformer *mToITransformer; + VolumeSliderToPrefTransformer *vsToPTransformer; + + sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:sNToITransformer + forName:@"ScalerNameToIdTransformer"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:1] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsEnabled"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:0] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsDisabled"]; + + mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:mToITransformer + forName:@"MachineNameToIdTransformer"]; + + vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:vsToPTransformer + forName:@"VolumeSliderToPrefTransformer"]; + } - (void)windowDidLoad Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-01-01 07:15:54 UTC (rev 274) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-01-01 07:24:18 UTC (rev 275) @@ -24,10 +24,6 @@ #import <Cocoa/Cocoa.h> -#include <OpenGL/gl.h> -#include <OpenGL/glext.h> -#include <OpenGL/glu.h> - #include <libspectrum.h> #include "input.h" @@ -60,7 +56,6 @@ float target_ratio; } +(DisplayOpenGLView *) instance; -+(void) initialize; -(IBAction) fullscreen:(id)sender; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-01-01 07:15:54 UTC (rev 274) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-01-01 07:24:18 UTC (rev 275) @@ -23,11 +23,11 @@ */ #import "DisplayOpenGLView.h" -#import "ScalerNameToIdTransformer.h" -#import "MachineScalerIsEnabled.h" -#import "MachineNameToIdTransformer.h" -#import "VolumeSliderToPrefTransformer.h" +#include <OpenGL/gl.h> +#include <OpenGL/glext.h> +#include <OpenGL/glu.h> + #include "event.h" #include "fuse.h" #include "fusepb/main.h" @@ -50,44 +50,6 @@ return instance; } -+(void) initialize -{ - ScalerNameToIdTransformer *sNToITransformer; - MachineScalerIsEnabled *machineScalerIsEnabled; - MachineNameToIdTransformer *mToITransformer; - VolumeSliderToPrefTransformer *vsToPTransformer; - - sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:sNToITransformer - forName:@"ScalerNameToIdTransformer"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:1] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsEnabled"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:0] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsDisabled"]; - - mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:mToITransformer - forName:@"MachineNameToIdTransformer"]; - - vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:vsToPTransformer - forName:@"VolumeSliderToPrefTransformer"]; - -} - -(IBAction) fullscreen:(id)sender { if( settings_current.full_screen == 1 ) { // we need to go back to non-full screen This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-01-01 07:53:05
|
Revision: 276 http://svn.sourceforge.net/fuse-for-macosx/?rev=276&view=rev Author: fredm Date: 2006-12-31 23:53:04 -0800 (Sun, 31 Dec 2006) Log Message: ----------- Make minimised appication have an screen image. Modified Paths: -------------- branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-01-01 07:24:18 UTC (rev 275) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-01-01 07:53:04 UTC (rev 276) @@ -519,4 +519,49 @@ return YES; } +- (BOOL)isFlipped +{ + return YES; +} + +- (void)copyGLToBackingStore +{ + [[self openGLContext] makeCurrentContext]; + + NSSize size = [self bounds].size; + + void *buffer = malloc(size.width * size.height * 4); + + glReadPixels( 0, + 0, + size.width, + size.height, + GL_RGBA, + GL_UNSIGNED_BYTE, + buffer ); + + [self lockFocus]; + + NSDrawBitmap( [self bounds], + size.width, + size.height, + 8, + 4, + 32, + size.width * 4, + NO, + NO, + NSDeviceRGBColorSpace, + (unsigned char const **)&buffer ); + + [self unlockFocus]; + + free(buffer); +} + +-(void) windowWillMiniaturize:(NSNotification *)aNotification +{ + [self copyGLToBackingStore]; +} + @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-01-01 06:54:22
|
Revision: 272 http://svn.sourceforge.net/fuse-for-macosx/?rev=272&view=rev Author: fredm Date: 2006-12-31 22:54:20 -0800 (Sun, 31 Dec 2006) Log Message: ----------- Rollback refactoring for second take on fullscreen mode. Modified Paths: -------------- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj branches/fusegl/fuse/fusepb/FuseMenus.m branches/fusegl/fuse/fusepb/controllers/FuseController.h branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/controllers/PreferencesController.h branches/fusegl/fuse/fusepb/controllers/PreferencesController.m branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Removed Paths: ------------- branches/fusegl/fuse/fusepb/views/DisplayController.h branches/fusegl/fuse/fusepb/views/DisplayController.m branches/fusegl/fuse/fusepb/views/DisplayScene.h branches/fusegl/fuse/fusepb/views/DisplayScene.m Modified: branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj =================================================================== --- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2007-01-01 06:54:20 UTC (rev 272) @@ -9,10 +9,6 @@ /* Begin PBXBuildFile section */ B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */ = {isa = PBXBuildFile; fileRef = B615BFE50B4261E50082D535 /* HIDJoysticks.h */; }; B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */ = {isa = PBXBuildFile; fileRef = B615BFE60B4261E50082D535 /* HIDJoysticks.m */; }; - B615C0130B45159B0082D535 /* DisplayController.h in Headers */ = {isa = PBXBuildFile; fileRef = B615C0110B45159B0082D535 /* DisplayController.h */; }; - B615C0140B45159B0082D535 /* DisplayController.m in Sources */ = {isa = PBXBuildFile; fileRef = B615C0120B45159B0082D535 /* DisplayController.m */; }; - B615C02B0B454A7F0082D535 /* DisplayScene.h in Headers */ = {isa = PBXBuildFile; fileRef = B615C0290B454A7E0082D535 /* DisplayScene.h */; }; - B615C02C0B454A7F0082D535 /* DisplayScene.m in Sources */ = {isa = PBXBuildFile; fileRef = B615C02A0B454A7F0082D535 /* DisplayScene.m */; }; B61F459309121DF100C8096C /* Fuse Help in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6F905ED05CDA24300C2F10D /* Fuse Help */; }; B61F459409121DF100C8096C /* disk_plus3.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F2076596C700DE7E81 /* disk_plus3.szx */; }; B61F459509121DF100C8096C /* tape_16.szx in CopyFiles */ = {isa = PBXBuildFile; fileRef = B650C3F4076596FD00DE7E81 /* tape_16.szx */; }; @@ -363,10 +359,6 @@ B611196806A1FBB6006D2711 /* JoystickConfiguration.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = JoystickConfiguration.nib; path = nibs/JoystickConfiguration.nib; sourceTree = "<group>"; }; B615BFE50B4261E50082D535 /* HIDJoysticks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = HIDJoysticks.h; path = content_arrays/HIDJoysticks.h; sourceTree = "<group>"; }; B615BFE60B4261E50082D535 /* HIDJoysticks.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = HIDJoysticks.m; path = content_arrays/HIDJoysticks.m; sourceTree = "<group>"; }; - B615C0110B45159B0082D535 /* DisplayController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DisplayController.h; sourceTree = "<group>"; }; - B615C0120B45159B0082D535 /* DisplayController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DisplayController.m; sourceTree = "<group>"; }; - B615C0290B454A7E0082D535 /* DisplayScene.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DisplayScene.h; sourceTree = "<group>"; }; - B615C02A0B454A7F0082D535 /* DisplayScene.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DisplayScene.m; sourceTree = "<group>"; }; B619FC2E090D9BC200344F94 /* SavePanelAccessoryView.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = SavePanelAccessoryView.nib; path = nibs/SavePanelAccessoryView.nib; sourceTree = "<group>"; }; B61EF5B905FED7930081DF70 /* hq3x.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = hq3x.cpp; path = scaler/hq3x.cpp; sourceTree = SOURCE_ROOT; }; B61F46A909121DF100C8096C /* Info-Fuse.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info-Fuse.plist"; sourceTree = "<group>"; }; @@ -927,10 +919,6 @@ B6CE7FCF0B28FBEC00EB65B3 /* Views */ = { isa = PBXGroup; children = ( - B615C0290B454A7E0082D535 /* DisplayScene.h */, - B615C02A0B454A7F0082D535 /* DisplayScene.m */, - B615C0110B45159B0082D535 /* DisplayController.h */, - B615C0120B45159B0082D535 /* DisplayController.m */, B6CE7FCB0B28FBD600EB65B3 /* DisplayOpenGLView.h */, B6CE7FCC0B28FBD600EB65B3 /* DisplayOpenGLView.m */, ); @@ -1239,8 +1227,6 @@ B6CE7FCD0B28FBD600EB65B3 /* DisplayOpenGLView.h in Headers */, B6A6F11F0B3EA737000B88E9 /* cocoascreenshot.h in Headers */, B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */, - B615C0130B45159B0082D535 /* DisplayController.h in Headers */, - B615C02B0B454A7F0082D535 /* DisplayScene.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1478,8 +1464,6 @@ B6A6F10E0B3D6360000B88E9 /* cocoaerror.m in Sources */, B6A6F1200B3EA737000B88E9 /* cocoascreenshot.m in Sources */, B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */, - B615C0140B45159B0082D535 /* DisplayController.m in Sources */, - B615C02C0B454A7F0082D535 /* DisplayScene.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: branches/fusegl/fuse/fusepb/FuseMenus.m =================================================================== --- branches/fusegl/fuse/fusepb/FuseMenus.m 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/FuseMenus.m 2007-01-01 06:54:20 UTC (rev 272) @@ -27,8 +27,7 @@ */ -#import "DisplayController.h" -#import "DisplayScene.h" +#import "DisplayOpenGLView.h" #import "FuseController.h" #import "FuseMenus.h" @@ -49,17 +48,17 @@ void CreateTexture(Cocoa_Texture* new_screen) { - [[DisplayScene singleton] createTexture:new_screen]; + [[DisplayOpenGLView instance] createTexture:new_screen]; } void DestroyTexture(void) { - [[DisplayScene singleton] destroyTexture]; + [[DisplayOpenGLView instance] destroyTexture]; } void SetEmulationHz( float hz ) { - [[DisplayController singleton] setEmulationHz:hz]; + [[DisplayOpenGLView instance] setEmulationHz:hz]; } void Hide(void) Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.h =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.h 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.h 2007-01-01 06:54:20 UTC (rev 272) @@ -71,8 +71,6 @@ } + (FuseController *)singleton; --(void) awakeFromNib; - - (IBAction)cocoa_break:(id)sender; - (IBAction)disk_eject_a:(id)sender; - (IBAction)disk_eject_b:(id)sender; Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-01-01 06:54:20 UTC (rev 272) @@ -45,7 +45,6 @@ #include "divide.h" #include "event.h" #include "fuse.h" -#include "fusepb/main.h" #include "if1.h" #include "if2.h" #include "libspectrum.h" @@ -218,14 +217,6 @@ return singleton; } --(void) awakeFromNib -{ - /* FIXME: Don't really like the argc, argv stuff being here... */ - if( fuse_init( ac, av ) ) { - fprintf( stderr, "%s: error initialising -- giving up!\n", fuse_progname ); - } -} - - (IBAction)disk_eject_a:(id)sender { cocoaui_disk_eject( SPECPLUS3_DRIVE_A, 0 ); Modified: branches/fusegl/fuse/fusepb/controllers/PreferencesController.h =================================================================== --- branches/fusegl/fuse/fusepb/controllers/PreferencesController.h 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/controllers/PreferencesController.h 2007-01-01 06:54:20 UTC (rev 272) @@ -40,7 +40,6 @@ NSMutableArray *machineRoms; } -+ (void)initialize; - (void)awakeFromNib; - (void)windowDidLoad; - (void)windowDidMove:(NSNotification *)aNotification; Modified: branches/fusegl/fuse/fusepb/controllers/PreferencesController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/controllers/PreferencesController.m 2007-01-01 06:54:20 UTC (rev 272) @@ -28,17 +28,13 @@ #include <string.h> -#import "PreferencesController.h" - -#import "CAMachines.h" #import "FuseController.h" -#import "HIDJoysticks.h" +#import "DisplayOpenGLView.h" #import "JoystickConfigurationController.h" +#import "PreferencesController.h" +#import "CAMachines.h" #import "Joysticks.h" -#import "MachineNameToIdTransformer.h" -#import "MachineScalerIsEnabled.h" -#import "ScalerNameToIdTransformer.h" -#import "VolumeSliderToPrefTransformer.h" +#import "HIDJoysticks.h" #include "fuse.h" #include "joystick.h" @@ -55,44 +51,6 @@ @implementation PreferencesController -+(void) initialize -{ - ScalerNameToIdTransformer *sNToITransformer; - MachineScalerIsEnabled *machineScalerIsEnabled; - MachineNameToIdTransformer *mToITransformer; - VolumeSliderToPrefTransformer *vsToPTransformer; - - sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:sNToITransformer - forName:@"ScalerNameToIdTransformer"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:1] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsEnabled"]; - - machineScalerIsEnabled = [[MachineScalerIsEnabled - machineScalerIsEnabledWithInt:0] - autorelease]; - - [NSValueTransformer setValueTransformer:machineScalerIsEnabled - forName:@"MachineTimexIsDisabled"]; - - mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:mToITransformer - forName:@"MachineNameToIdTransformer"]; - - vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; - - [NSValueTransformer setValueTransformer:vsToPTransformer - forName:@"VolumeSliderToPrefTransformer"]; - -} - - (void)awakeFromNib { } @@ -164,6 +122,10 @@ [machineRoms release]; fuse_emulation_unpause(); + + /* If we've enabled sound we want to put some data in the buffers before + too long to avoid glitches */ + if( sound_enabled ) [[DisplayOpenGLView instance] updateEmulationForTimeDelta:0]; } - (IBAction)chooseFile:(id)sender Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib =================================================================== --- branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/classes.nib 2007-01-01 06:54:20 UTC (rev 272) @@ -1,17 +1,6 @@ { IBClasses = ( - { - CLASS = DisplayController; - LANGUAGE = ObjC; - OUTLETS = {openGLView = DisplayOpenGLView; }; - SUPERCLASS = NSResponder; - }, - { - CLASS = DisplayOpenGLView; - LANGUAGE = ObjC; - OUTLETS = {controller = NSResponder; }; - SUPERCLASS = NSOpenGLView; - }, + {CLASS = DisplayOpenGLView; LANGUAGE = ObjC; SUPERCLASS = NSOpenGLView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = { Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Deleted: branches/fusegl/fuse/fusepb/views/DisplayController.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayController.h 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/views/DisplayController.h 2007-01-01 06:54:20 UTC (rev 272) @@ -1,72 +0,0 @@ -/* DisplayController.h: Implementation for the DisplayController class - Copyright (c) 2006 Fredrick Meunier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: fr...@sp... - Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia - -*/ - -#import <Cocoa/Cocoa.h> - -#include <libspectrum.h> - -#include "input.h" - -@class DisplayOpenGLView; - -@interface DisplayController : NSResponder -{ - /* Model */ - NSTimer* timer; - CFAbsoluteTime time; - - /* Views */ - IBOutlet DisplayOpenGLView *openGLView; - - GHashTable *unicode_keysyms_hash; - - BOOL optDown; - BOOL ctrlDown; - BOOL shiftDown; - - int cocoakeyboard_caps_shift_pressed; - int cocoakeyboard_symbol_shift_pressed; - input_key unicode_keysym; -} -+(DisplayController *) singleton; - --(void) mouseMoved:(NSEvent *)theEvent; --(void) mouseDown:(NSEvent *)theEvent; --(void) mouseUp:(NSEvent *)theEvent; --(void) rightMouseDown:(NSEvent *)theEvent; --(void) rightMouseUp:(NSEvent *)theEvent; --(void) otherMouseDown:(NSEvent *)theEvent; --(void) otherMouseUp:(NSEvent *)theEvent; - --(void) initKeyboard; --(void) flagsChanged:(NSEvent *)theEvent; --(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash; --(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type; --(void) keyDown:(NSEvent *)theEvent; --(void) keyUp:(NSEvent *)theEvent; - --(void) emulationTimerFired:(NSTimer *)timer; --(void) setEmulationHz:(float)hz; - -@end Deleted: branches/fusegl/fuse/fusepb/views/DisplayController.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayController.m 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/views/DisplayController.m 2007-01-01 06:54:20 UTC (rev 272) @@ -1,237 +0,0 @@ -/* DisplayController.m: Implementation for the DisplayController class - Copyright (c) 2006 Fredrick Meunier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: fr...@sp... - Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia - -*/ - -#import "DisplayController.h" -#import "DisplayOpenGLView.h" -#import "DisplayScene.h" - -#include "event.h" -#include "keyboard.h" -#include "ui/ui.h" - -extern keysyms_map_t unicode_keysyms_map[]; - -@implementation DisplayController - -static DisplayController *singleton = nil; - -+ (DisplayController *)singleton -{ - return singleton ? singleton : [[self alloc] init]; -} - --(id) init -{ - if ( singleton ) { - [self dealloc]; - } else { - self = [super init]; - singleton = self; - - optDown = NO; - ctrlDown = NO; - shiftDown = NO; - - cocoakeyboard_caps_shift_pressed = 0; - cocoakeyboard_symbol_shift_pressed = 0; - unicode_keysym = INPUT_KEY_NONE; - - [self initKeyboard]; - - timer = nil; - - time = CFAbsoluteTimeGetCurrent(); /* set emulation time start time */ - } - - return singleton; -} - --(void) mouseMoved:(NSEvent *)theEvent -{ - if( ui_mouse_grabbed ) { - int dx = [theEvent deltaX]; - int dy = [theEvent deltaY]; - - if( dx < -128 ) dx = -128; - else if( dx > 128 ) dx = 128; - - if( dy < -128 ) dy = -128; - else if( dy > 128 ) dy = 128; - - ui_mouse_motion( dx, dy ); - } -} - --(void) mouseDown:(NSEvent *)theEvent -{ - ui_mouse_button( 1, 1 ); -} - --(void) mouseUp:(NSEvent *)theEvent -{ - ui_mouse_button( 1, 0 ); -} - --(void) rightMouseDown:(NSEvent *)theEvent -{ - ui_mouse_button( 3, 1 ); -} - --(void) rightMouseUp:(NSEvent *)theEvent -{ - ui_mouse_button( 3, 0 ); -} - --(void) otherMouseDown:(NSEvent *)theEvent -{ - ui_mouse_button( 2, 1 ); -} - --(void) otherMouseUp:(NSEvent *)theEvent -{ - ui_mouse_button( 2, 0 ); -} - --(void) initKeyboard -{ - keysyms_map_t *ptr3; - - unicode_keysyms_hash = g_hash_table_new( g_int_hash, g_int_equal ); - - for( ptr3 = (keysyms_map_t *)unicode_keysyms_map; ptr3->ui; ptr3++ ) - g_hash_table_insert( unicode_keysyms_hash, &( ptr3->ui ), - &( ptr3->fuse ) ); -} - --(void) modifierChange:(input_event_type)theType oldState:(BOOL)old newState:(BOOL)new -{ - if( old != new ) { - input_event_t fuse_event; - fuse_event.types.key.spectrum_key = theType; - if( new == YES ) - fuse_event.type = INPUT_EVENT_KEYPRESS; - else - fuse_event.type = INPUT_EVENT_KEYRELEASE; - input_event( &fuse_event ); - } -} - --(void) flagsChanged:(NSEvent *)theEvent -{ - int flags = [theEvent modifierFlags]; - BOOL optDownNew = (flags & NSAlternateKeyMask) ? YES : NO; - BOOL ctrlDownNew = (flags & NSControlKeyMask) ? YES : NO; - BOOL shiftDownNew = ( flags & NSShiftKeyMask ) ? YES : NO; - - [self modifierChange:INPUT_KEY_Alt_L oldState:optDown newState:optDownNew]; - [self modifierChange:INPUT_KEY_Control_L oldState:ctrlDown newState:ctrlDownNew]; - [self modifierChange:INPUT_KEY_Shift_L oldState:shiftDown newState:shiftDownNew]; - - optDown = optDownNew; - ctrlDown = ctrlDownNew; - shiftDown = shiftDownNew; -} - --(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash -{ - const input_key *ptr; - - ptr = g_hash_table_lookup( hash, &ui_keysym ); - - return ptr ? *ptr : INPUT_KEY_NONE; -} - --(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type -{ - unsigned short keyCode = [theEvent keyCode]; - NSString *characters = [theEvent charactersIgnoringModifiers]; - if ([characters length]) { - input_key fuse_keysym; - input_event_t fuse_event; - - fuse_keysym = keysyms_remap( keyCode ); - if( fuse_keysym == INPUT_KEY_NONE ) { - fuse_keysym = [self otherKeysymsRemap:[characters characterAtIndex:0] - inHash:unicode_keysyms_hash]; - if( fuse_keysym != INPUT_KEY_NONE ) { - unicode_keysym = fuse_keysym; - /* record current values of caps and symbol shift. We will temoprarily - * override these for the duration of the unicoded simulated keypresses - */ - if( ( cocoakeyboard_caps_shift_pressed = keyboard_state( KEYBOARD_Caps ) ) ) - { - keyboard_release( KEYBOARD_Caps ); - } - if( ( cocoakeyboard_symbol_shift_pressed = - keyboard_state( KEYBOARD_Symbol ) ) ) { - keyboard_release( KEYBOARD_Symbol ); - } - } - } - - fuse_event.type = type; - if( unicode_keysym == INPUT_KEY_NONE ) - fuse_event.types.key.native_key = fuse_keysym; - else - fuse_event.types.key.native_key = unicode_keysym; - fuse_event.types.key.spectrum_key = fuse_keysym; - - input_event( &fuse_event ); - } -} - --(void) keyDown:(NSEvent *)theEvent -{ - [self keyChange:theEvent type:INPUT_EVENT_KEYPRESS]; -} - --(void) keyUp:(NSEvent *)theEvent -{ - [self keyChange:theEvent type:INPUT_EVENT_KEYRELEASE]; -} - --(void) emulationTimerFired:(NSTimer *)timer -{ - CFTimeInterval nowTime = CFAbsoluteTimeGetCurrent(); - CFTimeInterval deltaTime = nowTime - time; - if (deltaTime <= 1.0) { /* skip pauses */ - DisplayScene *scene = [openGLView scene]; - [scene updateEmulationForTimeDelta:deltaTime]; - } - time = nowTime; - - [openGLView setNeedsDisplay:YES]; -} - --(void) setEmulationHz:(float)hz -{ - [timer invalidate]; - [timer release]; - - timer = [[NSTimer scheduledTimerWithTimeInterval: (1.0f / hz) - target:self selector:@selector(emulationTimerFired:) - userInfo:self repeats:true] retain]; -} - -@end Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-01-01 06:54:20 UTC (rev 272) @@ -24,20 +24,45 @@ #import <Cocoa/Cocoa.h> -@class DisplayScene; +#include <OpenGL/gl.h> +#include <OpenGL/glext.h> +#include <OpenGL/glu.h> +#include <libspectrum.h> + +#include "input.h" +#include "ui/cocoa/cocoadisplay.h" + @interface DisplayOpenGLView : NSOpenGLView { - /* Model */ - DisplayScene *scene; + NSTimer* timer; - /* Controller */ - IBOutlet NSResponder *controller; + /* Need texture size and dimensions and two backing textures */ + Cocoa_Texture screenTex; /* Screen texture */ + + BOOL screenTexInitialised; + + GHashTable *unicode_keysyms_hash; + + BOOL optDown; + BOOL ctrlDown; + BOOL shiftDown; + + int cocoakeyboard_caps_shift_pressed; + int cocoakeyboard_symbol_shift_pressed; + input_key unicode_keysym; + + CFAbsoluteTime time; } -- (void)dealloc; ++(DisplayOpenGLView *) instance; ++(void) initialize; -- (DisplayScene *)scene; +-(void) createTexture:(Cocoa_Texture*)newScreen; +-(void) destroyTexture; +-(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime; +-(void) setEmulationHz:(float)hz; + -(id) initWithFrame:(NSRect)frameRect; -(void) awakeFromNib; @@ -49,7 +74,11 @@ -(void) otherMouseDown:(NSEvent *)theEvent; -(void) otherMouseUp:(NSEvent *)theEvent; +-(void) initKeyboard; +-(void) modifierChange:(input_event_type)theType oldState:(BOOL)old newState:(BOOL)new; -(void) flagsChanged:(NSEvent *)theEvent; +-(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash; +-(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type; -(void) keyDown:(NSEvent *)theEvent; -(void) keyUp:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-01-01 06:54:20 UTC (rev 272) @@ -23,11 +23,73 @@ */ #import "DisplayOpenGLView.h" +#import "ScalerNameToIdTransformer.h" +#import "MachineScalerIsEnabled.h" +#import "MachineNameToIdTransformer.h" +#import "VolumeSliderToPrefTransformer.h" -#import "DisplayScene.h" +#include "event.h" +#include "fuse.h" +#include "fusepb/main.h" +#include "keyboard.h" +#include "settings.h" +#include "sound.h" +extern keysyms_map_t unicode_keysyms_map[]; + +#include <CoreAudio/AudioHardware.h> +#include "sound/sfifo.h" + +extern sfifo_t sound_fifo; +extern AudioStreamBasicDescription deviceFormat; + @implementation DisplayOpenGLView +static DisplayOpenGLView *instance = nil; + ++(DisplayOpenGLView *) instance +{ + return instance; +} + ++(void) initialize +{ + ScalerNameToIdTransformer *sNToITransformer; + MachineScalerIsEnabled *machineScalerIsEnabled; + MachineNameToIdTransformer *mToITransformer; + VolumeSliderToPrefTransformer *vsToPTransformer; + + sNToITransformer = [[[ScalerNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:sNToITransformer + forName:@"ScalerNameToIdTransformer"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:1] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsEnabled"]; + + machineScalerIsEnabled = [[MachineScalerIsEnabled + machineScalerIsEnabledWithInt:0] + autorelease]; + + [NSValueTransformer setValueTransformer:machineScalerIsEnabled + forName:@"MachineTimexIsDisabled"]; + + mToITransformer = [[[MachineNameToIdTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:mToITransformer + forName:@"MachineNameToIdTransformer"]; + + vsToPTransformer = [[[VolumeSliderToPrefTransformer alloc] init] autorelease]; + + [NSValueTransformer setValueTransformer:vsToPTransformer + forName:@"VolumeSliderToPrefTransformer"]; + +} + -(id) initWithFrame:(NSRect)frameRect { /* Init pixel format attribs */ @@ -45,106 +107,375 @@ exit(1); } + if ( instance ) { + [self dealloc]; + self = instance; + } else { self = [super initWithFrame:frameRect pixelFormat:pixFmt]; - if (self) { - scene = [DisplayScene singleton]; - } + instance = self; + } [[self openGLContext] makeCurrentContext]; - return self; -} + timer = nil; -- (void)dealloc -{ - [super dealloc]; -} + /* Setup some basic OpenGL stuff */ + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -- (DisplayScene *)scene -{ - return scene; + screenTexInitialised = NO; + + optDown = NO; + ctrlDown = NO; + shiftDown = NO; + + cocoakeyboard_caps_shift_pressed = 0; + cocoakeyboard_symbol_shift_pressed = 0; + unicode_keysym = INPUT_KEY_NONE; + + return self; } -(void) awakeFromNib { /* keep the window in the standard aspect ratio if the user resizes */ [[self window] setContentAspectRatio:NSMakeSize(4.0,3.0)]; + + /* FIXME: Don't really like the argc, argv stuff being here... */ + if( fuse_init( ac, av ) ) { + fprintf( stderr, "%s: error initialising -- giving up!\n", fuse_progname ); + } + + [self initKeyboard]; + + time = CFAbsoluteTimeGetCurrent(); /* set emulation time start time */ } -(void) drawRect:(NSRect)aRect { - /* Delegate to our scene object for rendering. */ - [scene render]; + CFTimeInterval nowTime = CFAbsoluteTimeGetCurrent(); + CFTimeInterval deltaTime = nowTime - time; + if (deltaTime <= 1.0) { /* skip pauses */ + [self updateEmulationForTimeDelta:deltaTime]; + } + time = nowTime; + if( NO == screenTexInitialised ) return; + + /* Need to draw texture to screen here */ + memcpy(screenTex.pixels, screen.pixels, screenTex.pitch*screenTex.full_height); + + [[self openGLContext] makeCurrentContext]; + + /* Bind, update and draw new image */ + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 1); + + glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, screenTex.full_width, + screenTex.full_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + screenTex.pixels); + + glBegin(GL_QUADS); + + glTexCoord2f((float)screenTex.image_width, (float)(screenTex.image_xoffset)); + glVertex2f(1.0f, 1.0f); + + glTexCoord2f((float)screenTex.image_width, (float)screenTex.image_height); + glVertex2f(1.0f, -1.0f); + + glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_height); + glVertex2f(-1.0f, -1.0f); + + glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_yoffset); + glVertex2f(-1.0f, 1.0f); + + glEnd(); + + /* FIXME: Probably still need to glFlush() in fullscreen mode */ + //glFlush(); + /* Swap buffer to screen */ [[self openGLContext] flushBuffer]; } +/* moved or resized */ +-(void) update +{ + NSRect rect; + + [super update]; + + [[self openGLContext] makeCurrentContext]; + [[self openGLContext] update]; + + rect = [self bounds]; + + glViewport(0, 0, (int) rect.size.width, (int) rect.size.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + [self setNeedsDisplay:true]; +} + /* scrolled, moved or resized */ -(void) reshape { - /* Delegate to our scene object to update for a change in the view size. */ - [scene setViewportRect:[self bounds]]; + NSRect rect; + + [super reshape]; + + [[self openGLContext] makeCurrentContext]; + [[self openGLContext] update]; + + rect = [self bounds]; + + glViewport(0, 0, (int) rect.size.width, (int) rect.size.height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + [self setNeedsDisplay:true]; } +-(void) destroyTexture +{ + GLuint i; + + if( screenTexInitialised == NO) return; + /* FIXME: May want to have a double buffered texture later */ + for(i = 0; i < 1; i++) { + GLint dt = i+1; + glDeleteTextures(1, &dt); + } + screenTexInitialised = NO; +} + +-(void) createTexture:(Cocoa_Texture*)newScreen; +{ + GLint i; + + screenTex.full_width = newScreen->full_width; + screenTex.full_height = newScreen->full_height; + screenTex.image_width = newScreen->image_width; + screenTex.image_height = newScreen->image_height; + screenTex.image_xoffset = newScreen->image_xoffset; + screenTex.image_yoffset = newScreen->image_yoffset; + screenTex.pixels = calloc(screenTex.full_width*screenTex.full_height, sizeof(uint32_t)); + if( !screenTex.pixels ) { + fprintf( stderr, "%s: couldn't create screenTex.pixels\n", fuse_progname ); + return; + } + screenTex.pitch = screenTex.full_width * sizeof(uint32_t); + + [[self openGLContext] makeCurrentContext]; + [[self openGLContext] update]; + + /* FIXME: May want to have a double buffered texture later */ + for(i = 0; i < 1; i++) + { + glDisable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_RECTANGLE_EXT); + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i+1); + + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, + screenTex.full_width*screenTex.pitch, + screenTex.pixels ); + + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE, + GL_STORAGE_CACHED_APPLE); + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE ); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + + glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, screenTex.full_width, + screenTex.full_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + screenTex.pixels ); + } + screenTexInitialised = YES; +} + +/* given a delta time in seconds, update overall emulation state */ +-(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime +{ + if( sound_enabled ) { + /* emulate until fifo is full */ + while( sfifo_space( &sound_fifo ) >= (sound_stereo+1) * 2 * sound_framesiz ) { + event_do_frame(); + } + } else { + float speed = ( settings_current.emulation_speed < 1 ? + 100.0 : + settings_current.emulation_speed ) / 100.0; + libspectrum_dword time_tstates = deltaTime * + machine_current->timings.processor_speed * + speed + 0.5; + event_do_timer( time_tstates ); + } +} + +-(void) setEmulationHz:(float)hz +{ + [timer invalidate]; + [timer release]; + + timer = [[NSTimer scheduledTimerWithTimeInterval: (1.0f / hz) + target:self selector:@selector(drawRect:) + userInfo:self repeats:true] retain]; +} + -(void) mouseMoved:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller mouseMoved:theEvent]; + if( ui_mouse_grabbed ) { + int dx = [theEvent deltaX]; + int dy = [theEvent deltaY]; + + if( dx < -128 ) dx = -128; + else if( dx > 128 ) dx = 128; + + if( dy < -128 ) dy = -128; + else if( dy > 128 ) dy = 128; + + ui_mouse_motion( dx, dy ); + } } -(void) mouseDown:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller mouseDown:theEvent]; + ui_mouse_button( 1, 1 ); } -(void) mouseUp:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller mouseUp:theEvent]; + ui_mouse_button( 1, 0 ); } -(void) rightMouseDown:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller rightMouseDown:theEvent]; + ui_mouse_button( 3, 1 ); } -(void) rightMouseUp:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller rightMouseUp:theEvent]; + ui_mouse_button( 3, 0 ); } -(void) otherMouseDown:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller otherMouseDown:theEvent]; + ui_mouse_button( 2, 1 ); } -(void) otherMouseUp:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller otherMouseUp:theEvent]; + ui_mouse_button( 2, 0 ); } +-(void) initKeyboard +{ + keysyms_map_t *ptr3; + + unicode_keysyms_hash = g_hash_table_new( g_int_hash, g_int_equal ); + + for( ptr3 = (keysyms_map_t *)unicode_keysyms_map; ptr3->ui; ptr3++ ) + g_hash_table_insert( unicode_keysyms_hash, &( ptr3->ui ), + &( ptr3->fuse ) ); +} + +-(void) modifierChange:(input_event_type)theType oldState:(BOOL)old newState:(BOOL)new +{ + if( old != new ) { + input_event_t fuse_event; + fuse_event.types.key.spectrum_key = theType; + if( new == YES ) + fuse_event.type = INPUT_EVENT_KEYPRESS; + else + fuse_event.type = INPUT_EVENT_KEYRELEASE; + input_event( &fuse_event ); + } +} + -(void) flagsChanged:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller flagsChanged:theEvent]; + int flags = [theEvent modifierFlags]; + BOOL optDownNew = (flags & NSAlternateKeyMask) ? YES : NO; + BOOL ctrlDownNew = (flags & NSControlKeyMask) ? YES : NO; + BOOL shiftDownNew = ( flags & NSShiftKeyMask ) ? YES : NO; + + [self modifierChange:INPUT_KEY_Alt_L oldState:optDown newState:optDownNew]; + [self modifierChange:INPUT_KEY_Control_L oldState:ctrlDown newState:ctrlDownNew]; + [self modifierChange:INPUT_KEY_Shift_L oldState:shiftDown newState:shiftDownNew]; + + optDown = optDownNew; + ctrlDown = ctrlDownNew; + shiftDown = shiftDownNew; } +-(input_key) otherKeysymsRemap:(libspectrum_dword)ui_keysym inHash:(GHashTable*)hash +{ + const input_key *ptr; + + ptr = g_hash_table_lookup( hash, &ui_keysym ); + + return ptr ? *ptr : INPUT_KEY_NONE; +} + +-(void) keyChange:(NSEvent *)theEvent type:(input_event_type)type +{ + unsigned short keyCode = [theEvent keyCode]; + NSString *characters = [theEvent charactersIgnoringModifiers]; + if ([characters length]) { + input_key fuse_keysym; + input_event_t fuse_event; + + fuse_keysym = keysyms_remap( keyCode ); + if( fuse_keysym == INPUT_KEY_NONE ) { + fuse_keysym = [self otherKeysymsRemap:[characters characterAtIndex:0] + inHash:unicode_keysyms_hash]; + if( fuse_keysym != INPUT_KEY_NONE ) { + unicode_keysym = fuse_keysym; + /* record current values of caps and symbol shift. We will temoprarily + * override these for the duration of the unicoded simulated keypresses + */ + if( ( cocoakeyboard_caps_shift_pressed = keyboard_state( KEYBOARD_Caps ) ) ) + { + keyboard_release( KEYBOARD_Caps ); + } + if( ( cocoakeyboard_symbol_shift_pressed = + keyboard_state( KEYBOARD_Symbol ) ) ) { + keyboard_release( KEYBOARD_Symbol ); + } + } + } + + fuse_event.type = type; + if( unicode_keysym == INPUT_KEY_NONE ) + fuse_event.types.key.native_key = fuse_keysym; + else + fuse_event.types.key.native_key = unicode_keysym; + fuse_event.types.key.spectrum_key = fuse_keysym; + + input_event( &fuse_event ); + } +} + -(void) keyDown:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller keyDown:theEvent]; + [self keyChange:theEvent type:INPUT_EVENT_KEYPRESS]; } -(void) keyUp:(NSEvent *)theEvent { - /* Delegate to our controller object. */ - [controller keyUp:theEvent]; + [self keyChange:theEvent type:INPUT_EVENT_KEYRELEASE]; } -(BOOL) acceptsFirstResponder Deleted: branches/fusegl/fuse/fusepb/views/DisplayScene.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayScene.h 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/views/DisplayScene.h 2007-01-01 06:54:20 UTC (rev 272) @@ -1,46 +0,0 @@ -/* DisplayScene.h: Implementation for the DisplayScene class - Copyright (c) 2006 Fredrick Meunier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: fr...@sp... - Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia - -*/ - -#import <Cocoa/Cocoa.h> - -#include "ui/cocoa/cocoadisplay.h" - -@interface DisplayScene : NSObject -{ - /* Need texture size and dimensions and two backing textures */ - Cocoa_Texture screenTex; /* Screen texture */ - - BOOL screenTexInitialised; -} -+(DisplayScene *) singleton; - --(void) setViewportRect:(NSRect)bounds; --(void) render; - --(void) createTexture:(Cocoa_Texture*)newScreen; --(void) destroyTexture; - --(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime; - -@end Deleted: branches/fusegl/fuse/fusepb/views/DisplayScene.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayScene.m 2006-12-29 15:18:45 UTC (rev 271) +++ branches/fusegl/fuse/fusepb/views/DisplayScene.m 2007-01-01 06:54:20 UTC (rev 272) @@ -1,196 +0,0 @@ -/* DisplayScene.m: Implementation for the DisplayScene class - Copyright (c) 2006 Fredrick Meunier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Author contact information: - - E-mail: fr...@sp... - Postal address: 3/66 Roslyn Gardens, Ruscutters Bay, NSW 2011, Australia - -*/ - -#import "DisplayScene.h" - -#include <OpenGL/gl.h> -#include <OpenGL/glext.h> -#include <OpenGL/glu.h> - -#include "event.h" -#include "fuse.h" -#include "settings.h" -#include "sound.h" -#include "sound/sfifo.h" - -extern sfifo_t sound_fifo; - -@implementation DisplayScene - -static DisplayScene *singleton = nil; - -+ (DisplayScene *)singleton -{ - return singleton ? singleton : [[self alloc] init]; -} - -- (id)init -{ - if ( singleton ) { - [self dealloc]; - } else { - [super init]; - singleton = self; - } - - return singleton; -} - -- (void)dealloc -{ - [self destroyTexture]; - singleton = nil; - [super dealloc]; -} - --(void) setViewportRect:(NSRect)bounds -{ - glViewport(0, 0, (int) bounds.size.width, (int) bounds.size.height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - --(void) render -{ - if( NO == screenTexInitialised ) return; - - /* Need to draw texture to screen here */ - memcpy(screenTex.pixels, screen.pixels, screenTex.pitch*screenTex.full_height); - - /* Setup some basic OpenGL stuff */ - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - /* Bind, update and draw new image */ - glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 1); - - glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, screenTex.full_width, - screenTex.full_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - screenTex.pixels); - - glBegin(GL_QUADS); - - glTexCoord2f((float)screenTex.image_width, (float)(screenTex.image_xoffset)); - glVertex2f(1.0f, 1.0f); - - glTexCoord2f((float)screenTex.image_width, (float)screenTex.image_height); - glVertex2f(1.0f, -1.0f); - - glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_height); - glVertex2f(-1.0f, -1.0f); - - glTexCoord2f((float)screenTex.image_xoffset, (float)screenTex.image_yoffset); - glVertex2f(-1.0f, 1.0f); - - glEnd(); - - // Flush out any unfinished rendering before swapping. - //glFinish(); -} - --(void) destroyTexture -{ - GLuint i; - - if( screenTexInitialised == NO) return; - /* FIXME: May want to have a double buffered texture later */ - for(i = 0; i < 1; i++) { - GLint dt = i+1; - glDeleteTextures(1, &dt); - free( screenTex.pixels ); - screenTex.pixels = NULL; - } - screenTexInitialised = NO; -} - --(void) createTexture:(Cocoa_Texture*)newScreen; -{ - GLint i; - - screenTex.full_width = newScreen->full_width; - screenTex.full_height = newScreen->full_height; - screenTex.image_width = newScreen->image_width; - screenTex.image_height = newScreen->image_height; - screenTex.image_xoffset = newScreen->image_xoffset; - screenTex.image_yoffset = newScreen->image_yoffset; - screenTex.pixels = calloc(screenTex.full_width*screenTex.full_height, sizeof(uint32_t)); - if( !screenTex.pixels ) { - fprintf( stderr, "%s: couldn't create screenTex.pixels\n", fuse_progname ); - return; - } - screenTex.pitch = screenTex.full_width * sizeof(uint32_t); - - /* FIXME: May want to have a double buffered texture later */ - for(i = 0; i < 1; i++) - { - glDisable(GL_TEXTURE_2D); - glEnable(GL_TEXTURE_RECTANGLE_EXT); - glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i+1); - - glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, - screenTex.full_width*screenTex.pitch, - screenTex.pixels ); - - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE, - GL_STORAGE_CACHED_APPLE); - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE ); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - - glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, screenTex.full_width, - screenTex.full_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - screenTex.pixels ); - } - screenTexInitialised = YES; -} - -/* given a delta time in seconds, update overall emulation state */ --(void) updateEmulationForTimeDelta:(CFAbsoluteTime)deltaTime -{ - if( sound_enabled ) { - /* emulate until fifo is full */ - while( sfifo_space( &sound_fifo ) >= (sound_stereo+1) * 2 * sound_framesiz ) { - event_do_frame(); - } - } else { - float speed = ( settings_current.emulation_speed < 1 ? - 100.0 : - settings_current.emulation_speed ) / 100.0; - libspectrum_dword time_tstates = deltaTime * - machine_current->timings.processor_speed * - speed + 0.5; - event_do_timer( time_tstates ); - } -} - -@end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 09:28:10
|
Revision: 314 http://svn.sourceforge.net/fuse-for-macosx/?rev=314&view=rev Author: fredm Date: 2007-04-03 02:28:08 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move interface 2 cartridge menus to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 09:27:23 UTC (rev 313) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 09:28:08 UTC (rev 314) @@ -47,7 +47,6 @@ #include "event.h" #include "fuse.h" #include "if1.h" -#include "if2.h" #include "libspectrum.h" #include "profile.h" #include "psg.h" @@ -286,7 +285,7 @@ if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } - error = if2_insert( filename ); + error = [[DisplayOpenGLView instance] if2Insert:filename]; if(error) goto error; [self addRecentSnapshot:filename]; @@ -301,7 +300,7 @@ { [[DisplayOpenGLView instance] pause]; - if2_eject(); + [[DisplayOpenGLView instance] if2Eject]; [[DisplayOpenGLView instance] unpause]; } Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 09:27:23 UTC (rev 313) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 09:28:08 UTC (rev 314) @@ -71,6 +71,9 @@ -(void) pause; -(void) unpause; +-(int) if2Insert:(const char *)filename; +-(void) if2Eject; + -(void) mouseMoved:(NSEvent *)theEvent; -(void) mouseDown:(NSEvent *)theEvent; -(void) mouseUp:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 09:27:23 UTC (rev 313) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 09:28:08 UTC (rev 314) @@ -29,6 +29,7 @@ #include "event.h" #include "fuse.h" #include "fusepb/main.h" +#include "if2.h" #include "keyboard.h" #include "machine.h" #include "settings.h" @@ -205,6 +206,16 @@ } } +-(int) if2Insert:(const char *)filename +{ + return if2_insert( filename ); +} + +-(void) if2Eject +{ + if2_eject(); +} + -(BOOL) isEmulating { return isEmulating; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 09:27:23 UTC (rev 313) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 09:28:08 UTC (rev 314) @@ -107,6 +107,9 @@ -(void) pause; -(void) unpause; +-(int) if2Insert:(const char *)filename; +-(void) if2Eject; + -(void) setDiskState:(NSNumber*)state; -(void) setTapeState:(NSNumber*)state; -(void) setMdrState:(NSNumber*)state; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 09:27:23 UTC (rev 313) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 09:28:08 UTC (rev 314) @@ -599,6 +599,16 @@ [proxy_emulator unpause]; } +-(int) if2Insert:(const char *)filename +{ + return [proxy_emulator if2Insert:filename]; +} + +-(void) if2Eject +{ + [proxy_emulator if2Eject]; +} + -(void) setDiskState:(NSNumber*)state { disk_state = [state unsignedCharValue]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 09:34:25
|
Revision: 315 http://svn.sourceforge.net/fuse-for-macosx/?rev=315&view=rev Author: fredm Date: 2007-04-03 02:34:24 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move reset menu to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 09:28:08 UTC (rev 314) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 09:34:24 UTC (rev 315) @@ -459,7 +459,7 @@ { [[DisplayOpenGLView instance] pause]; - machine_reset(); + [[DisplayOpenGLView instance] reset]; [[DisplayOpenGLView instance] unpause]; } Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 09:28:08 UTC (rev 314) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 09:34:24 UTC (rev 315) @@ -70,6 +70,7 @@ -(void) cocoaBreak; -(void) pause; -(void) unpause; +-(void) reset; -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 09:28:08 UTC (rev 314) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 09:34:24 UTC (rev 315) @@ -206,6 +206,11 @@ } } +-(void) reset +{ + machine_reset(); +} + -(int) if2Insert:(const char *)filename { return if2_insert( filename ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 09:28:08 UTC (rev 314) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 09:34:24 UTC (rev 315) @@ -106,6 +106,7 @@ -(void) cocoaBreak; -(void) pause; -(void) unpause; +-(void) reset; -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 09:28:08 UTC (rev 314) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 09:34:24 UTC (rev 315) @@ -599,6 +599,11 @@ [proxy_emulator unpause]; } +-(void) reset +{ + [proxy_emulator reset]; +} + -(int) if2Insert:(const char *)filename { return [proxy_emulator if2Insert:filename]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 09:41:01
|
Revision: 316 http://svn.sourceforge.net/fuse-for-macosx/?rev=316&view=rev Author: fredm Date: 2007-04-03 02:41:00 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move dck menus over to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 09:34:24 UTC (rev 315) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 09:41:00 UTC (rev 316) @@ -42,7 +42,6 @@ #import "DisplayOpenGLView.h" -#include "dck.h" #include "divide.h" #include "event.h" #include "fuse.h" @@ -254,7 +253,7 @@ if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } - error = dck_insert( filename ); + error = [[DisplayOpenGLView instance] dckInsert:filename]; if(error) goto error; [self addRecentSnapshot:filename]; @@ -269,7 +268,7 @@ { [[DisplayOpenGLView instance] pause]; - dck_eject(); + [[DisplayOpenGLView instance] dckEject]; [[DisplayOpenGLView instance] unpause]; } Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 09:34:24 UTC (rev 315) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 09:41:00 UTC (rev 316) @@ -75,6 +75,9 @@ -(int) if2Insert:(const char *)filename; -(void) if2Eject; +-(int) dckInsert:(const char *)filename; +-(void) dckEject; + -(void) mouseMoved:(NSEvent *)theEvent; -(void) mouseDown:(NSEvent *)theEvent; -(void) mouseUp:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 09:34:24 UTC (rev 315) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 09:41:00 UTC (rev 316) @@ -25,6 +25,7 @@ #import "DisplayOpenGLView.h" #import "Emulator.h" +#include "dck.h" #include "debugger/debugger.h" #include "event.h" #include "fuse.h" @@ -221,6 +222,16 @@ if2_eject(); } +-(int) dckInsert:(const char *)filename +{ + return dck_insert( filename ); +} + +-(void) dckEject +{ + dck_eject(); +} + -(BOOL) isEmulating { return isEmulating; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 09:34:24 UTC (rev 315) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 09:41:00 UTC (rev 316) @@ -111,6 +111,9 @@ -(int) if2Insert:(const char *)filename; -(void) if2Eject; +-(int) dckInsert:(const char *)filename; +-(void) dckEject; + -(void) setDiskState:(NSNumber*)state; -(void) setTapeState:(NSNumber*)state; -(void) setMdrState:(NSNumber*)state; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 09:34:24 UTC (rev 315) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 09:41:00 UTC (rev 316) @@ -614,6 +614,16 @@ [proxy_emulator if2Eject]; } +-(int) dckInsert:(const char *)filename +{ + return [proxy_emulator dckInsert:filename]; +} + +-(void) dckEject +{ + [proxy_emulator dckEject]; +} + -(void) setDiskState:(NSNumber*)state { disk_state = [state unsignedCharValue]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 11:05:12
|
Revision: 317 http://svn.sourceforge.net/fuse-for-macosx/?rev=317&view=rev Author: fredm Date: 2007-04-03 04:05:10 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move psg menus to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 09:41:00 UTC (rev 316) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:05:10 UTC (rev 317) @@ -48,10 +48,10 @@ #include "if1.h" #include "libspectrum.h" #include "profile.h" -#include "psg.h" #include "rzx.h" #include "screenshot.h" #include "ui/cocoa/cocoascreenshot.h" +#include "psg.h" #include "settings.h" #include "settings_cocoa.h" #include "simpleide.h" @@ -609,7 +609,7 @@ psgfile = cocoaui_savepanel_get_filename( @"Start AY Sound Recording", [NSArray arrayWithObjects:@"psg", nil] ); if( !psgfile ) { [[DisplayOpenGLView instance] unpause]; return; } - psg_start_recording( psgfile ); + [[DisplayOpenGLView instance] psgStart:psgfile]; free( psgfile ); @@ -623,7 +623,7 @@ - (IBAction)psg_stop:(id)sender { if ( !psg_recording ) return; - psg_stop_recording(); + [[DisplayOpenGLView instance] psgStop]; ui_menu_activate( UI_MENU_ITEM_AY_LOGGING, 0 ); } Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 09:41:00 UTC (rev 316) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:05:10 UTC (rev 317) @@ -78,6 +78,9 @@ -(int) dckInsert:(const char *)filename; -(void) dckEject; +-(void) psgStart:(const char *)psgfile; +-(void) psgStop; + -(void) mouseMoved:(NSEvent *)theEvent; -(void) mouseDown:(NSEvent *)theEvent; -(void) mouseUp:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 09:41:00 UTC (rev 316) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:05:10 UTC (rev 317) @@ -33,6 +33,7 @@ #include "if2.h" #include "keyboard.h" #include "machine.h" +#include "psg.h" #include "settings.h" #include "sound.h" #include "tape.h" @@ -232,6 +233,16 @@ dck_eject(); } +-(void) psgStart:(const char *)psgfile +{ + psg_start_recording( psgfile ); +} + +-(void) psgStop +{ + psg_stop_recording(); +} + -(BOOL) isEmulating { return isEmulating; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 09:41:00 UTC (rev 316) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:05:10 UTC (rev 317) @@ -114,6 +114,9 @@ -(int) dckInsert:(const char *)filename; -(void) dckEject; +-(void) psgStart:(const char *)psgfile; +-(void) psgStop; + -(void) setDiskState:(NSNumber*)state; -(void) setTapeState:(NSNumber*)state; -(void) setMdrState:(NSNumber*)state; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 09:41:00 UTC (rev 316) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:05:10 UTC (rev 317) @@ -624,6 +624,16 @@ [proxy_emulator dckEject]; } +-(void) psgStart:(const char *)psgfile +{ + [proxy_emulator psgStart:psgfile]; +} + +-(void) psgStop +{ + [proxy_emulator psgStop]; +} + -(void) setDiskState:(NSNumber*)state { disk_state = [state unsignedCharValue]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 11:11:41
|
Revision: 318 http://svn.sourceforge.net/fuse-for-macosx/?rev=318&view=rev Author: fredm Date: 2007-04-03 04:11:42 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move tape clear menu to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:05:10 UTC (rev 317) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:11:42 UTC (rev 318) @@ -757,7 +757,7 @@ - (IBAction)tape_clear:(id)sender { - tape_close(); + [[DisplayOpenGLView instance] tapeClear]; } - (IBAction)tape_open:(id)sender Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:05:10 UTC (rev 317) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:11:42 UTC (rev 318) @@ -66,6 +66,7 @@ -(void) openFile:(const char *)filename; -(void) tapeTogglePlay; -(void) tapeRewind; +-(void) tapeClear; -(void) tapeWindowInitialise; -(void) cocoaBreak; -(void) pause; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:05:10 UTC (rev 317) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:11:42 UTC (rev 318) @@ -178,6 +178,11 @@ tape_select_block( 0 ); } +-(void) tapeClear +{ + tape_close(); +} + -(void) tapeWindowInitialise { ui_tape_browser_update( UI_TAPE_BROWSER_NEW_TAPE, NULL ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:05:10 UTC (rev 317) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:11:42 UTC (rev 318) @@ -102,6 +102,7 @@ -(void) openFile:(const char *)filename; -(void) tapeTogglePlay; -(void) tapeRewind; +-(void) tapeClear; -(void) tapeWindowInitialise; -(void) cocoaBreak; -(void) pause; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:05:10 UTC (rev 317) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:11:42 UTC (rev 318) @@ -578,6 +578,11 @@ [proxy_emulator tapeRewind]; } +-(void) tapeClear +{ + [proxy_emulator tapeClear]; +} + -(void) tapeWindowInitialise { [proxy_emulator tapeWindowInitialise]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 11:17:14
|
Revision: 319 http://svn.sourceforge.net/fuse-for-macosx/?rev=319&view=rev Author: fredm Date: 2007-04-03 04:17:12 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move tape open menu to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:11:42 UTC (rev 318) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:17:12 UTC (rev 319) @@ -770,7 +770,7 @@ if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } - tape_open_default_autoload( filename, NULL ); + [[DisplayOpenGLView instance] tapeOpen:filename]; [self addRecentSnapshot:filename]; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:11:42 UTC (rev 318) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:17:12 UTC (rev 319) @@ -64,6 +64,7 @@ -(id) init; -(void) openFile:(const char *)filename; +-(void) tapeOpen:(const char *)filename; -(void) tapeTogglePlay; -(void) tapeRewind; -(void) tapeClear; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:11:42 UTC (rev 318) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:17:12 UTC (rev 319) @@ -168,6 +168,11 @@ display_refresh_all(); } +-(void) tapeOpen:(const char *)filename +{ + tape_open_default_autoload( filename, NULL ); +} + -(void) tapeTogglePlay { tape_toggle_play( 0 ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:11:42 UTC (rev 318) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:17:12 UTC (rev 319) @@ -100,6 +100,7 @@ -(void) setNeedsDisplayYes; -(void) openFile:(const char *)filename; +-(void) tapeOpen:(const char *)filename; -(void) tapeTogglePlay; -(void) tapeRewind; -(void) tapeClear; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:11:42 UTC (rev 318) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:17:12 UTC (rev 319) @@ -568,6 +568,11 @@ [proxy_emulator openFile:filename]; } +-(void) tapeOpen:(const char *)filename +{ + [proxy_emulator tapeOpen:filename]; +} + -(void) tapeTogglePlay { [proxy_emulator tapeTogglePlay]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 11:21:49
|
Revision: 320 http://svn.sourceforge.net/fuse-for-macosx/?rev=320&view=rev Author: fredm Date: 2007-04-03 04:21:50 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move tape write menu to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:17:12 UTC (rev 319) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:21:50 UTC (rev 320) @@ -1675,7 +1675,7 @@ if( !filename ) { [[DisplayOpenGLView instance] unpause]; return 1; } - tape_write( filename ); + [[DisplayOpenGLView instance] tapeWrite:filename]; [[FuseController singleton] addRecentSnapshot:filename]; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:17:12 UTC (rev 319) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:21:50 UTC (rev 320) @@ -65,6 +65,7 @@ -(void) openFile:(const char *)filename; -(void) tapeOpen:(const char *)filename; +-(void) tapeWrite:(const char *)filename; -(void) tapeTogglePlay; -(void) tapeRewind; -(void) tapeClear; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:17:12 UTC (rev 319) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:21:50 UTC (rev 320) @@ -173,6 +173,11 @@ tape_open_default_autoload( filename, NULL ); } +-(void) tapeWrite:(const char *)filename; +{ + tape_write( filename ); +} + -(void) tapeTogglePlay { tape_toggle_play( 0 ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:17:12 UTC (rev 319) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:21:50 UTC (rev 320) @@ -101,6 +101,7 @@ -(void) openFile:(const char *)filename; -(void) tapeOpen:(const char *)filename; +-(void) tapeWrite:(const char *)filename; -(void) tapeTogglePlay; -(void) tapeRewind; -(void) tapeClear; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:17:12 UTC (rev 319) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:21:50 UTC (rev 320) @@ -573,6 +573,11 @@ [proxy_emulator tapeOpen:filename]; } +-(void) tapeWrite:(const char *)filename; +{ + [proxy_emulator tapeWrite:filename]; +} + -(void) tapeTogglePlay { [proxy_emulator tapeTogglePlay]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 11:44:08
|
Revision: 321 http://svn.sourceforge.net/fuse-for-macosx/?rev=321&view=rev Author: fredm Date: 2007-04-03 04:43:54 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move tape close and if1 mdr new menus to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:21:50 UTC (rev 320) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:43:54 UTC (rev 321) @@ -56,7 +56,6 @@ #include "settings_cocoa.h" #include "simpleide.h" #include "snapshot.h" -#include "tape.h" #include "thumbnail.h" #include "trdos.h" #include "ui.h" @@ -367,7 +366,7 @@ - (IBAction)mdr_insert_new:(id)sender { - if1_mdr_new( [sender tag] - 30 ); + [[DisplayOpenGLView instance] if1MdrNew:[sender tag] - 30]; } - (IBAction)mdr_insert:(id)sender @@ -1321,7 +1320,8 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { if( cocoaui_confirm( "Exit Fuse?" ) ) { - int error = tape_close(); if( error ) return NSTerminateCancel; + int error = [[DisplayOpenGLView instance] tapeClose]; + if( error ) return NSTerminateCancel; return NSTerminateNow; } Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:21:50 UTC (rev 320) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:43:54 UTC (rev 321) @@ -69,12 +69,15 @@ -(void) tapeTogglePlay; -(void) tapeRewind; -(void) tapeClear; +-(int) tapeClose; -(void) tapeWindowInitialise; -(void) cocoaBreak; -(void) pause; -(void) unpause; -(void) reset; +-(void) if1MdrNew:(int)drive; + -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:21:50 UTC (rev 320) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:43:54 UTC (rev 321) @@ -30,6 +30,7 @@ #include "event.h" #include "fuse.h" #include "fusepb/main.h" +#include "if1.h" #include "if2.h" #include "keyboard.h" #include "machine.h" @@ -193,6 +194,11 @@ tape_close(); } +-(int) tapeClose +{ + return tape_close(); +} + -(void) tapeWindowInitialise { ui_tape_browser_update( UI_TAPE_BROWSER_NEW_TAPE, NULL ); @@ -228,6 +234,11 @@ machine_reset(); } +-(void) if1MdrNew:(int)drive +{ + if1_mdr_new( drive ); +} + -(int) if2Insert:(const char *)filename { return if2_insert( filename ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:21:50 UTC (rev 320) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:43:54 UTC (rev 321) @@ -105,12 +105,15 @@ -(void) tapeTogglePlay; -(void) tapeRewind; -(void) tapeClear; +-(int) tapeClose; -(void) tapeWindowInitialise; -(void) cocoaBreak; -(void) pause; -(void) unpause; -(void) reset; +-(void) if1MdrNew:(int)drive; + -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:21:50 UTC (rev 320) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:43:54 UTC (rev 321) @@ -593,6 +593,11 @@ [proxy_emulator tapeClear]; } +-(int) tapeClose +{ + return [proxy_emulator tapeClose]; +} + -(void) tapeWindowInitialise { [proxy_emulator tapeWindowInitialise]; @@ -619,6 +624,11 @@ [proxy_emulator reset]; } +-(void) if1MdrNew:(int)drive +{ + [proxy_emulator if1MdrNew:drive]; +} + -(int) if2Insert:(const char *)filename { return [proxy_emulator if2Insert:filename]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 12:55:26
|
Revision: 322 http://svn.sourceforge.net/fuse-for-macosx/?rev=322&view=rev Author: fredm Date: 2007-04-03 05:55:27 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move mdr insert and sync to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 11:43:54 UTC (rev 321) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 12:55:27 UTC (rev 322) @@ -378,7 +378,7 @@ filename = cocoaui_openpanel_get_filename( @"Insert microdrive disk file", mdrFileTypes ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } - if1_mdr_insert( filename, [sender tag] - 30 ); + [[DisplayOpenGLView instance] if1MdrInsert:filename inDrive:[sender tag] - 30]; [self addRecentSnapshot:filename]; @@ -391,14 +391,15 @@ { char *filename = NULL; - if( !if1_mdr_sync( NULL, [sender tag] - 30 ) ) return; + if( ![[DisplayOpenGLView instance] if1MdrSync:NULL inDrive:[sender tag] - 30] ) + return; [[DisplayOpenGLView instance] pause]; filename = cocoaui_savepanel_get_filename( @"Write Microdrive Cartridge As", [NSArray arrayWithObjects:@"mdr", nil] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } - if1_mdr_sync( filename, [sender tag] - 30 ); + [[DisplayOpenGLView instance] if1MdrSync:filename inDrive:[sender tag] - 30]; [self addRecentSnapshot:filename]; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 11:43:54 UTC (rev 321) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 12:55:27 UTC (rev 322) @@ -77,6 +77,8 @@ -(void) reset; -(void) if1MdrNew:(int)drive; +-(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; +-(int) if1MdrSync:(const char *)filename inDrive:(int)drive; -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 11:43:54 UTC (rev 321) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 12:55:27 UTC (rev 322) @@ -239,6 +239,16 @@ if1_mdr_new( drive ); } +-(void) if1MdrInsert:(const char *)filename inDrive:(int)drive +{ + if1_mdr_insert( filename, drive ); +} + +-(int) if1MdrSync:(const char *)filename inDrive:(int)drive +{ + return if1_mdr_sync( filename, drive ); +} + -(int) if2Insert:(const char *)filename { return if2_insert( filename ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 11:43:54 UTC (rev 321) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 12:55:27 UTC (rev 322) @@ -113,6 +113,8 @@ -(void) reset; -(void) if1MdrNew:(int)drive; +-(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; +-(int) if1MdrSync:(const char *)filename inDrive:(int)drive; -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 11:43:54 UTC (rev 321) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 12:55:27 UTC (rev 322) @@ -629,6 +629,16 @@ [proxy_emulator if1MdrNew:drive]; } +-(void) if1MdrInsert:(const char *)filename inDrive:(int)drive +{ + [proxy_emulator if1MdrInsert:filename inDrive:drive]; +} + +-(int) if1MdrSync:(const char *)filename inDrive:(int)drive +{ + return [proxy_emulator if1MdrSync:filename inDrive:drive]; +} + -(int) if2Insert:(const char *)filename { return [proxy_emulator if2Insert:filename]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 12:59:42
|
Revision: 323 http://svn.sourceforge.net/fuse-for-macosx/?rev=323&view=rev Author: fredm Date: 2007-04-03 05:59:44 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move mdr eject to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 12:55:27 UTC (rev 322) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 12:59:44 UTC (rev 323) @@ -412,14 +412,15 @@ { char *filename = NULL; - if( !if1_mdr_eject( NULL, [sender tag] - 30 ) ) return; + if( ![[DisplayOpenGLView instance] if1MdrEject:NULL inDrive:[sender tag] - 30] ) + return; [[DisplayOpenGLView instance] pause]; filename = cocoaui_savepanel_get_filename( @"Write Microdrive Cartridge As", [NSArray arrayWithObjects:@"mdr", nil] ); if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } - if1_mdr_eject( filename, [sender tag] - 30 ); + [[DisplayOpenGLView instance] if1MdrEject:filename inDrive:[sender tag] - 30]; [self addRecentSnapshot:filename]; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 12:55:27 UTC (rev 322) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 12:59:44 UTC (rev 323) @@ -79,6 +79,7 @@ -(void) if1MdrNew:(int)drive; -(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; -(int) if1MdrSync:(const char *)filename inDrive:(int)drive; +-(int) if1MdrEject:(const char *)filename inDrive:(int)drive; -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 12:55:27 UTC (rev 322) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 12:59:44 UTC (rev 323) @@ -249,6 +249,11 @@ return if1_mdr_sync( filename, drive ); } +-(int) if1MdrEject:(const char *)filename inDrive:(int)drive +{ + return if1_mdr_eject( filename, drive ); +} + -(int) if2Insert:(const char *)filename { return if2_insert( filename ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 12:55:27 UTC (rev 322) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 12:59:44 UTC (rev 323) @@ -115,6 +115,7 @@ -(void) if1MdrNew:(int)drive; -(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; -(int) if1MdrSync:(const char *)filename inDrive:(int)drive; +-(int) if1MdrEject:(const char *)filename inDrive:(int)drive; -(int) if2Insert:(const char *)filename; -(void) if2Eject; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 12:55:27 UTC (rev 322) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 12:59:44 UTC (rev 323) @@ -639,6 +639,11 @@ return [proxy_emulator if1MdrSync:filename inDrive:drive]; } +-(int) if1MdrEject:(const char *)filename inDrive:(int)drive +{ + return [proxy_emulator if1MdrEject:filename inDrive:drive]; +} + -(int) if2Insert:(const char *)filename { return [proxy_emulator if2Insert:filename]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 13:13:48
|
Revision: 324 http://svn.sourceforge.net/fuse-for-macosx/?rev=324&view=rev Author: fredm Date: 2007-04-03 06:13:49 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move mdr write protect and divide insert to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 12:59:44 UTC (rev 323) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:13:49 UTC (rev 324) @@ -45,7 +45,6 @@ #include "divide.h" #include "event.h" #include "fuse.h" -#include "if1.h" #include "libspectrum.h" #include "profile.h" #include "rzx.h" @@ -320,8 +319,8 @@ case 43: error = zxatasp_insert( filename, LIBSPECTRUM_IDE_MASTER ); break; case 44: error = zxatasp_insert( filename, LIBSPECTRUM_IDE_SLAVE ); break; case 45: error = zxcf_insert( filename ); break; - case 46: error = divide_insert( filename, LIBSPECTRUM_IDE_MASTER ); break; - case 47: error = divide_insert( filename, LIBSPECTRUM_IDE_SLAVE ); break; + case 46: error = [[DisplayOpenGLView instance] divideInsert:filename inUnit:LIBSPECTRUM_IDE_MASTER]; break; + case 47: error = [[DisplayOpenGLView instance] divideInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; } if(error) goto error; @@ -433,7 +432,7 @@ { int no = [sender tag] - 30; - if1_mdr_writep( no & 0xf0, ( no & 0x0f ) ); + [[DisplayOpenGLView instance] if1MdrWriteProtect:no & 0xf0 inDrive:( no & 0x0f )]; } - (IBAction)open:(id)sender Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 12:59:44 UTC (rev 323) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:13:49 UTC (rev 324) @@ -80,6 +80,7 @@ -(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; -(int) if1MdrSync:(const char *)filename inDrive:(int)drive; -(int) if1MdrEject:(const char *)filename inDrive:(int)drive; +-(void) if1MdrWriteProtect:(int)w inDrive:(int)drive; -(int) if2Insert:(const char *)filename; -(void) if2Eject; @@ -90,6 +91,8 @@ -(void) psgStart:(const char *)psgfile; -(void) psgStop; +-(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; + -(void) mouseMoved:(NSEvent *)theEvent; -(void) mouseDown:(NSEvent *)theEvent; -(void) mouseUp:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 12:59:44 UTC (rev 323) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:13:49 UTC (rev 324) @@ -27,6 +27,7 @@ #include "dck.h" #include "debugger/debugger.h" +#include "divide.h" #include "event.h" #include "fuse.h" #include "fusepb/main.h" @@ -254,6 +255,11 @@ return if1_mdr_eject( filename, drive ); } +-(void) if1MdrWriteProtect:(int)w inDrive:(int)drive +{ + if1_mdr_writep( w, drive ); +} + -(int) if2Insert:(const char *)filename { return if2_insert( filename ); @@ -284,6 +290,11 @@ psg_stop_recording(); } +-(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit +{ + return divide_insert( filename, unit ); +} + -(BOOL) isEmulating { return isEmulating; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 12:59:44 UTC (rev 323) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:13:49 UTC (rev 324) @@ -116,6 +116,7 @@ -(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; -(int) if1MdrSync:(const char *)filename inDrive:(int)drive; -(int) if1MdrEject:(const char *)filename inDrive:(int)drive; +-(void) if1MdrWriteProtect:(int)w inDrive:(int)drive; -(int) if2Insert:(const char *)filename; -(void) if2Eject; @@ -126,6 +127,8 @@ -(void) psgStart:(const char *)psgfile; -(void) psgStop; +-(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; + -(void) setDiskState:(NSNumber*)state; -(void) setTapeState:(NSNumber*)state; -(void) setMdrState:(NSNumber*)state; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 12:59:44 UTC (rev 323) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:13:49 UTC (rev 324) @@ -644,6 +644,11 @@ return [proxy_emulator if1MdrEject:filename inDrive:drive]; } +-(void) if1MdrWriteProtect:(int)w inDrive:(int)drive +{ + [proxy_emulator if1MdrWriteProtect:w inDrive:drive]; +} + -(int) if2Insert:(const char *)filename { return [proxy_emulator if2Insert:filename]; @@ -674,6 +679,11 @@ [proxy_emulator psgStop]; } +-(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit +{ + return [proxy_emulator divideInsert:filename inUnit:unit]; +} + -(void) setDiskState:(NSNumber*)state { disk_state = [state unsignedCharValue]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 13:18:15
|
Revision: 325 http://svn.sourceforge.net/fuse-for-macosx/?rev=325&view=rev Author: fredm Date: 2007-04-03 06:18:17 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move divide commit to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:13:49 UTC (rev 324) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:18:17 UTC (rev 325) @@ -343,8 +343,8 @@ case 53: zxatasp_commit( LIBSPECTRUM_IDE_MASTER ); break; case 54: zxatasp_commit( LIBSPECTRUM_IDE_SLAVE ); break; case 55: zxcf_commit(); break; - case 56: divide_commit( LIBSPECTRUM_IDE_MASTER ); break; - case 57: divide_commit( LIBSPECTRUM_IDE_SLAVE ); break; + case 56: [[DisplayOpenGLView instance] divideCommit:LIBSPECTRUM_IDE_MASTER]; break; + case 57: [[DisplayOpenGLView instance] divideCommit:LIBSPECTRUM_IDE_SLAVE]; break; } [[DisplayOpenGLView instance] unpause]; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:13:49 UTC (rev 324) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:18:17 UTC (rev 325) @@ -92,6 +92,7 @@ -(void) psgStop; -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; +-(int) divideCommit:(libspectrum_ide_unit)unit; -(void) mouseMoved:(NSEvent *)theEvent; -(void) mouseDown:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:13:49 UTC (rev 324) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:18:17 UTC (rev 325) @@ -295,6 +295,11 @@ return divide_insert( filename, unit ); } +-(int) divideCommit:(libspectrum_ide_unit)unit +{ + return divide_commit( unit ); +} + -(BOOL) isEmulating { return isEmulating; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:13:49 UTC (rev 324) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:18:17 UTC (rev 325) @@ -128,6 +128,7 @@ -(void) psgStop; -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; +-(int) divideCommit:(libspectrum_ide_unit)unit; -(void) setDiskState:(NSNumber*)state; -(void) setTapeState:(NSNumber*)state; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:13:49 UTC (rev 324) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:18:17 UTC (rev 325) @@ -684,6 +684,11 @@ return [proxy_emulator divideInsert:filename inUnit:unit]; } +-(int) divideCommit:(libspectrum_ide_unit)unit +{ + return [proxy_emulator divideCommit:unit]; +} + -(void) setDiskState:(NSNumber*)state { disk_state = [state unsignedCharValue]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 13:21:47
|
Revision: 326 http://svn.sourceforge.net/fuse-for-macosx/?rev=326&view=rev Author: fredm Date: 2007-04-03 06:21:48 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move divide eject to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:18:17 UTC (rev 325) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:21:48 UTC (rev 326) @@ -42,7 +42,6 @@ #import "DisplayOpenGLView.h" -#include "divide.h" #include "event.h" #include "fuse.h" #include "libspectrum.h" @@ -358,8 +357,8 @@ case 63: zxatasp_eject( LIBSPECTRUM_IDE_MASTER ); break; case 64: zxatasp_eject( LIBSPECTRUM_IDE_SLAVE ); break; case 65: zxcf_eject(); break; - case 66: divide_eject( LIBSPECTRUM_IDE_MASTER ); break; - case 67: divide_eject( LIBSPECTRUM_IDE_SLAVE ); break; + case 66: [[DisplayOpenGLView instance] divideEject:LIBSPECTRUM_IDE_MASTER]; break; + case 67: [[DisplayOpenGLView instance] divideEject:LIBSPECTRUM_IDE_SLAVE]; break; } } Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:18:17 UTC (rev 325) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:21:48 UTC (rev 326) @@ -93,6 +93,7 @@ -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; +-(int) divideEject:(libspectrum_ide_unit)unit; -(void) mouseMoved:(NSEvent *)theEvent; -(void) mouseDown:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:18:17 UTC (rev 325) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:21:48 UTC (rev 326) @@ -300,6 +300,11 @@ return divide_commit( unit ); } +-(int) divideEject:(libspectrum_ide_unit)unit +{ + return divide_eject( unit ); +} + -(BOOL) isEmulating { return isEmulating; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:18:17 UTC (rev 325) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:21:48 UTC (rev 326) @@ -129,6 +129,7 @@ -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; +-(int) divideEject:(libspectrum_ide_unit)unit; -(void) setDiskState:(NSNumber*)state; -(void) setTapeState:(NSNumber*)state; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:18:17 UTC (rev 325) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:21:48 UTC (rev 326) @@ -689,6 +689,11 @@ return [proxy_emulator divideCommit:unit]; } +-(int) divideEject:(libspectrum_ide_unit)unit +{ + return [proxy_emulator divideEject:unit]; +} + -(void) setDiskState:(NSNumber*)state { disk_state = [state unsignedCharValue]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 13:49:20
|
Revision: 327 http://svn.sourceforge.net/fuse-for-macosx/?rev=327&view=rev Author: fredm Date: 2007-04-03 06:49:21 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move simpleide menus over to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:21:48 UTC (rev 326) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:49:21 UTC (rev 327) @@ -52,7 +52,6 @@ #include "psg.h" #include "settings.h" #include "settings_cocoa.h" -#include "simpleide.h" #include "snapshot.h" #include "thumbnail.h" #include "trdos.h" @@ -313,8 +312,8 @@ if( !filename ) { [[DisplayOpenGLView instance] unpause]; return; } switch( [sender tag] ) { - case 41: error = simpleide_insert( filename, LIBSPECTRUM_IDE_MASTER ); break; - case 42: error = simpleide_insert( filename, LIBSPECTRUM_IDE_SLAVE ); break; + case 41: error = [[DisplayOpenGLView instance] simpleideInsert:filename inUnit:LIBSPECTRUM_IDE_MASTER]; break; + case 42: error = [[DisplayOpenGLView instance] simpleideInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; case 43: error = zxatasp_insert( filename, LIBSPECTRUM_IDE_MASTER ); break; case 44: error = zxatasp_insert( filename, LIBSPECTRUM_IDE_SLAVE ); break; case 45: error = zxcf_insert( filename ); break; @@ -337,8 +336,8 @@ [[DisplayOpenGLView instance] pause]; switch( [sender tag] ) { - case 51: simpleide_commit( LIBSPECTRUM_IDE_MASTER ); break; - case 52: simpleide_commit( LIBSPECTRUM_IDE_SLAVE ); break; + case 51: [[DisplayOpenGLView instance] simpleideCommit:LIBSPECTRUM_IDE_MASTER]; break; + case 52: [[DisplayOpenGLView instance] simpleideCommit:LIBSPECTRUM_IDE_SLAVE]; break; case 53: zxatasp_commit( LIBSPECTRUM_IDE_MASTER ); break; case 54: zxatasp_commit( LIBSPECTRUM_IDE_SLAVE ); break; case 55: zxcf_commit(); break; @@ -352,8 +351,8 @@ - (IBAction)ide_eject:(id)sender { switch( [sender tag] ) { - case 61: simpleide_eject( LIBSPECTRUM_IDE_MASTER ); break; - case 62: simpleide_eject( LIBSPECTRUM_IDE_SLAVE ); break; + case 61: [[DisplayOpenGLView instance] simpleideEject:LIBSPECTRUM_IDE_MASTER]; break; + case 62: [[DisplayOpenGLView instance] simpleideEject:LIBSPECTRUM_IDE_SLAVE]; break; case 63: zxatasp_eject( LIBSPECTRUM_IDE_MASTER ); break; case 64: zxatasp_eject( LIBSPECTRUM_IDE_SLAVE ); break; case 65: zxcf_eject(); break; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:21:48 UTC (rev 326) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:49:21 UTC (rev 327) @@ -91,6 +91,10 @@ -(void) psgStart:(const char *)psgfile; -(void) psgStop; +-(int) simpleideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; +-(int) simpleideCommit:(libspectrum_ide_unit)unit; +-(int) simpleideEject:(libspectrum_ide_unit)unit; + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; -(int) divideEject:(libspectrum_ide_unit)unit; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:21:48 UTC (rev 326) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:49:21 UTC (rev 327) @@ -37,6 +37,7 @@ #include "machine.h" #include "psg.h" #include "settings.h" +#include "simpleide.h" #include "sound.h" #include "tape.h" #include "ui/ui.h" @@ -290,6 +291,21 @@ psg_stop_recording(); } +-(int) simpleideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit +{ + return simpleide_insert( filename, unit ); +} + +-(int) simpleideCommit:(libspectrum_ide_unit)unit +{ + return simpleide_commit( unit ); +} + +-(int) simpleideEject:(libspectrum_ide_unit)unit +{ + return simpleide_eject( unit ); +} + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit { return divide_insert( filename, unit ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:21:48 UTC (rev 326) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:49:21 UTC (rev 327) @@ -127,6 +127,10 @@ -(void) psgStart:(const char *)psgfile; -(void) psgStop; +-(int) simpleideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; +-(int) simpleideCommit:(libspectrum_ide_unit)unit; +-(int) simpleideEject:(libspectrum_ide_unit)unit; + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; -(int) divideEject:(libspectrum_ide_unit)unit; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:21:48 UTC (rev 326) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:49:21 UTC (rev 327) @@ -679,6 +679,21 @@ [proxy_emulator psgStop]; } +-(int) simpleideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit +{ + return [proxy_emulator simpleideInsert:filename inUnit:unit]; +} + +-(int) simpleideCommit:(libspectrum_ide_unit)unit +{ + return [proxy_emulator simpleideCommit:unit]; +} + +-(int) simpleideEject:(libspectrum_ide_unit)unit +{ + return [proxy_emulator simpleideEject:unit]; +} + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit { return [proxy_emulator divideInsert:filename inUnit:unit]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 13:58:35
|
Revision: 328 http://svn.sourceforge.net/fuse-for-macosx/?rev=328&view=rev Author: fredm Date: 2007-04-03 06:58:32 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move zxatasp menus to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:49:21 UTC (rev 327) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:58:32 UTC (rev 328) @@ -58,7 +58,6 @@ #include "ui.h" #include "uidisplay.h" #include "utils.h" -#include "zxatasp.h" #include "zxcf.h" static char* cocoaui_openpanel_get_filename( NSString *title, NSArray *fileTypes ); @@ -314,8 +313,8 @@ switch( [sender tag] ) { case 41: error = [[DisplayOpenGLView instance] simpleideInsert:filename inUnit:LIBSPECTRUM_IDE_MASTER]; break; case 42: error = [[DisplayOpenGLView instance] simpleideInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; - case 43: error = zxatasp_insert( filename, LIBSPECTRUM_IDE_MASTER ); break; - case 44: error = zxatasp_insert( filename, LIBSPECTRUM_IDE_SLAVE ); break; + case 43: error = [[DisplayOpenGLView instance] zxataspInsert:filename inUnit:LIBSPECTRUM_IDE_MASTER]; break; + case 44: error = [[DisplayOpenGLView instance] zxataspInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; case 45: error = zxcf_insert( filename ); break; case 46: error = [[DisplayOpenGLView instance] divideInsert:filename inUnit:LIBSPECTRUM_IDE_MASTER]; break; case 47: error = [[DisplayOpenGLView instance] divideInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; @@ -338,8 +337,8 @@ switch( [sender tag] ) { case 51: [[DisplayOpenGLView instance] simpleideCommit:LIBSPECTRUM_IDE_MASTER]; break; case 52: [[DisplayOpenGLView instance] simpleideCommit:LIBSPECTRUM_IDE_SLAVE]; break; - case 53: zxatasp_commit( LIBSPECTRUM_IDE_MASTER ); break; - case 54: zxatasp_commit( LIBSPECTRUM_IDE_SLAVE ); break; + case 53: [[DisplayOpenGLView instance] zxataspCommit:LIBSPECTRUM_IDE_MASTER]; break; + case 54: [[DisplayOpenGLView instance] zxataspCommit:LIBSPECTRUM_IDE_SLAVE]; break; case 55: zxcf_commit(); break; case 56: [[DisplayOpenGLView instance] divideCommit:LIBSPECTRUM_IDE_MASTER]; break; case 57: [[DisplayOpenGLView instance] divideCommit:LIBSPECTRUM_IDE_SLAVE]; break; @@ -353,8 +352,8 @@ switch( [sender tag] ) { case 61: [[DisplayOpenGLView instance] simpleideEject:LIBSPECTRUM_IDE_MASTER]; break; case 62: [[DisplayOpenGLView instance] simpleideEject:LIBSPECTRUM_IDE_SLAVE]; break; - case 63: zxatasp_eject( LIBSPECTRUM_IDE_MASTER ); break; - case 64: zxatasp_eject( LIBSPECTRUM_IDE_SLAVE ); break; + case 63: [[DisplayOpenGLView instance] zxataspEject:LIBSPECTRUM_IDE_MASTER]; break; + case 64: [[DisplayOpenGLView instance] zxataspEject:LIBSPECTRUM_IDE_SLAVE]; break; case 65: zxcf_eject(); break; case 66: [[DisplayOpenGLView instance] divideEject:LIBSPECTRUM_IDE_MASTER]; break; case 67: [[DisplayOpenGLView instance] divideEject:LIBSPECTRUM_IDE_SLAVE]; break; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:49:21 UTC (rev 327) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:58:32 UTC (rev 328) @@ -95,6 +95,10 @@ -(int) simpleideCommit:(libspectrum_ide_unit)unit; -(int) simpleideEject:(libspectrum_ide_unit)unit; +-(int) zxataspInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; +-(int) zxataspCommit:(libspectrum_ide_unit)unit; +-(int) zxataspEject:(libspectrum_ide_unit)unit; + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; -(int) divideEject:(libspectrum_ide_unit)unit; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:49:21 UTC (rev 327) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:58:32 UTC (rev 328) @@ -42,6 +42,7 @@ #include "tape.h" #include "ui/ui.h" #include "utils.h" +#include "zxatasp.h" extern keysyms_map_t unicode_keysyms_map[]; @@ -306,6 +307,21 @@ return simpleide_eject( unit ); } +-(int) zxataspInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit +{ + return zxatasp_insert( filename, unit ); +} + +-(int) zxataspCommit:(libspectrum_ide_unit)unit +{ + return zxatasp_commit( unit ); +} + +-(int) zxataspEject:(libspectrum_ide_unit)unit +{ + return zxatasp_eject( unit ); +} + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit { return divide_insert( filename, unit ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:49:21 UTC (rev 327) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:58:32 UTC (rev 328) @@ -131,6 +131,10 @@ -(int) simpleideCommit:(libspectrum_ide_unit)unit; -(int) simpleideEject:(libspectrum_ide_unit)unit; +-(int) zxataspInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; +-(int) zxataspCommit:(libspectrum_ide_unit)unit; +-(int) zxataspEject:(libspectrum_ide_unit)unit; + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; -(int) divideEject:(libspectrum_ide_unit)unit; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:49:21 UTC (rev 327) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:58:32 UTC (rev 328) @@ -694,6 +694,21 @@ return [proxy_emulator simpleideEject:unit]; } +-(int) zxataspInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit +{ + return [proxy_emulator zxataspInsert:filename inUnit:unit]; +} + +-(int) zxataspCommit:(libspectrum_ide_unit)unit +{ + return [proxy_emulator zxataspCommit:unit]; +} + +-(int) zxataspEject:(libspectrum_ide_unit)unit +{ + return [proxy_emulator zxataspEject:unit]; +} + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit { return [proxy_emulator divideInsert:filename inUnit:unit]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2007-04-03 22:11:33
|
Revision: 329 http://svn.sourceforge.net/fuse-for-macosx/?rev=329&view=rev Author: fredm Date: 2007-04-03 15:11:30 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move zxcf and nmi menus to Emulator object. Modified Paths: -------------- branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/models/Emulator.h branches/fusegl/fuse/fusepb/models/Emulator.m branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 13:58:32 UTC (rev 328) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2007-04-03 22:11:30 UTC (rev 329) @@ -58,7 +58,6 @@ #include "ui.h" #include "uidisplay.h" #include "utils.h" -#include "zxcf.h" static char* cocoaui_openpanel_get_filename( NSString *title, NSArray *fileTypes ); static char* cocoaui_savepanel_get_filename( NSString *title, NSArray *fileTypes ); @@ -315,7 +314,7 @@ case 42: error = [[DisplayOpenGLView instance] simpleideInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; case 43: error = [[DisplayOpenGLView instance] zxataspInsert:filename inUnit:LIBSPECTRUM_IDE_MASTER]; break; case 44: error = [[DisplayOpenGLView instance] zxataspInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; - case 45: error = zxcf_insert( filename ); break; + case 45: error = [[DisplayOpenGLView instance] zxcfInsert:filename]; break; case 46: error = [[DisplayOpenGLView instance] divideInsert:filename inUnit:LIBSPECTRUM_IDE_MASTER]; break; case 47: error = [[DisplayOpenGLView instance] divideInsert:filename inUnit:LIBSPECTRUM_IDE_SLAVE]; break; } @@ -339,7 +338,7 @@ case 52: [[DisplayOpenGLView instance] simpleideCommit:LIBSPECTRUM_IDE_SLAVE]; break; case 53: [[DisplayOpenGLView instance] zxataspCommit:LIBSPECTRUM_IDE_MASTER]; break; case 54: [[DisplayOpenGLView instance] zxataspCommit:LIBSPECTRUM_IDE_SLAVE]; break; - case 55: zxcf_commit(); break; + case 55: [[DisplayOpenGLView instance] zxcfCommit]; break; case 56: [[DisplayOpenGLView instance] divideCommit:LIBSPECTRUM_IDE_MASTER]; break; case 57: [[DisplayOpenGLView instance] divideCommit:LIBSPECTRUM_IDE_SLAVE]; break; } @@ -354,7 +353,7 @@ case 62: [[DisplayOpenGLView instance] simpleideEject:LIBSPECTRUM_IDE_SLAVE]; break; case 63: [[DisplayOpenGLView instance] zxataspEject:LIBSPECTRUM_IDE_MASTER]; break; case 64: [[DisplayOpenGLView instance] zxataspEject:LIBSPECTRUM_IDE_SLAVE]; break; - case 65: zxcf_eject(); break; + case 65: [[DisplayOpenGLView instance] zxcfEject]; break; case 66: [[DisplayOpenGLView instance] divideEject:LIBSPECTRUM_IDE_MASTER]; break; case 67: [[DisplayOpenGLView instance] divideEject:LIBSPECTRUM_IDE_SLAVE]; break; } @@ -466,7 +465,7 @@ [[DisplayOpenGLView instance] pause]; - error = event_add( 0, EVENT_TYPE_NMI ); + error = [[DisplayOpenGLView instance] nmi]; /* Complain if( error ) return error; */ [[DisplayOpenGLView instance] unpause]; Modified: branches/fusegl/fuse/fusepb/models/Emulator.h =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 13:58:32 UTC (rev 328) +++ branches/fusegl/fuse/fusepb/models/Emulator.h 2007-04-03 22:11:30 UTC (rev 329) @@ -75,6 +75,7 @@ -(void) pause; -(void) unpause; -(void) reset; +-(int) nmi; -(void) if1MdrNew:(int)drive; -(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; @@ -99,6 +100,10 @@ -(int) zxataspCommit:(libspectrum_ide_unit)unit; -(int) zxataspEject:(libspectrum_ide_unit)unit; +-(int) zxcfInsert:(const char *)filename; +-(int) zxcfCommit; +-(int) zxcfEject; + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; -(int) divideEject:(libspectrum_ide_unit)unit; Modified: branches/fusegl/fuse/fusepb/models/Emulator.m =================================================================== --- branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 13:58:32 UTC (rev 328) +++ branches/fusegl/fuse/fusepb/models/Emulator.m 2007-04-03 22:11:30 UTC (rev 329) @@ -43,6 +43,7 @@ #include "ui/ui.h" #include "utils.h" #include "zxatasp.h" +#include "zxcf.h" extern keysyms_map_t unicode_keysyms_map[]; @@ -237,6 +238,11 @@ machine_reset(); } +-(int) nmi +{ + return event_add( 0, EVENT_TYPE_NMI ); +} + -(void) if1MdrNew:(int)drive { if1_mdr_new( drive ); @@ -322,6 +328,21 @@ return zxatasp_eject( unit ); } +-(int) zxcfInsert:(const char *)filename +{ + return zxcf_insert( filename ); +} + +-(int) zxcfCommit +{ + return zxcf_commit(); +} + +-(int) zxcfEject +{ + return zxcf_eject(); +} + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit { return divide_insert( filename, unit ); Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 13:58:32 UTC (rev 328) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2007-04-03 22:11:30 UTC (rev 329) @@ -111,6 +111,7 @@ -(void) pause; -(void) unpause; -(void) reset; +-(int) nmi; -(void) if1MdrNew:(int)drive; -(void) if1MdrInsert:(const char *)filename inDrive:(int)drive; @@ -135,6 +136,10 @@ -(int) zxataspCommit:(libspectrum_ide_unit)unit; -(int) zxataspEject:(libspectrum_ide_unit)unit; +-(int) zxcfInsert:(const char *)filename; +-(int) zxcfCommit; +-(int) zxcfEject; + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit; -(int) divideCommit:(libspectrum_ide_unit)unit; -(int) divideEject:(libspectrum_ide_unit)unit; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 13:58:32 UTC (rev 328) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-04-03 22:11:30 UTC (rev 329) @@ -624,6 +624,11 @@ [proxy_emulator reset]; } +-(int) nmi +{ + return [proxy_emulator nmi]; +} + -(void) if1MdrNew:(int)drive { [proxy_emulator if1MdrNew:drive]; @@ -709,6 +714,21 @@ return [proxy_emulator zxataspEject:unit]; } +-(int) zxcfInsert:(const char *)filename +{ + return [proxy_emulator zxcfInsert:filename]; +} + +-(int) zxcfCommit +{ + return [proxy_emulator zxcfCommit]; +} + +-(int) zxcfEject +{ + return [proxy_emulator zxcfEject]; +} + -(int) divideInsert:(const char *)filename inUnit:(libspectrum_ide_unit)unit { return [proxy_emulator divideInsert:filename inUnit:unit]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |