Annotation of hatari/src/gui-osx/PrefsController.m, revision 1.1.1.9

1.1       root        1: /*
                      2:   Hatari - PrefsController.m
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   your option any later version. Read the file gpl.txt for details.
                      6: 
                      7:   Preferences window controller implementation file
                      8: 
                      9:   Feb-Mar 2006, Sébastien Molines - Created
1.1.1.2   root       10:   Jan 2006, Sébastien Molines - Updated for recent emulator updates
1.1       root       11: */
                     12: 
                     13: // TODO: Set the default paths to MacOS-friendly values
                     14: // TODO: Move hardcoded string to localizable resources (e.g. string "Reset the emulator?")
                     15: 
                     16: 
                     17: #import "PrefsController.h"
                     18: #import "Shared.h"
                     19: 
                     20: #include "main.h"
                     21: #include "configuration.h"
1.1.1.3   root       22: #include "change.h"
1.1       root       23: #include "dialog.h"
                     24: #include "file.h"
                     25: #include "floppy.h"
                     26: #include "screen.h"
                     27: #include "sdlgui.h"
                     28: 
                     29: // Macros to transfer data between Cocoa controls and Hatari data structures
                     30: #define EXPORT_TEXTFIELD(nstextfield, target) GuiOsx_ExportPathString([nstextfield stringValue], target, sizeof((target)))
1.1.1.6   root       31: #define EXPORT_NTEXTFIELD(nstextfield, target) target = [nstextfield intValue]
1.1       root       32: #define EXPORT_SWITCH(nsbutton, target) target = ([(nsbutton) state] == NSOnState)
                     33: #define EXPORT_RADIO(nsmatrix, target) target = [[(nsmatrix) selectedCell] tag]
                     34: #define EXPORT_DROPDOWN(nspopupbutton, target) target = [[(nspopupbutton) selectedItem] tag]
1.1.1.3   root       35: #define EXPORT_SLIDER(nsslider, target) target = [(nsslider) intValue]
                     36: 
1.1.1.6   root       37: #define IMPORT_TEXTFIELD(nstextfield, source) [(nstextfield) setStringValue:[[NSString stringWithCString:(source) encoding:NSASCIIStringEncoding] stringByAbbreviatingWithTildeInPath]]
                     38: #define IMPORT_NTEXTFIELD(nstextfield, source) [(nstextfield) setIntValue:(source)]
1.1       root       39: #define IMPORT_SWITCH(nsbutton, source) [(nsbutton) setState:((source))? NSOnState : NSOffState]
                     40: #define IMPORT_RADIO(nsmatrix, source) [(nsmatrix) selectCellWithTag:(source)]
                     41: #define IMPORT_DROPDOWN(nspopupbutton, source) [(nspopupbutton) selectItemAtIndex:[(nspopupbutton) indexOfItemWithTag:(source)]]
1.1.1.3   root       42: #define IMPORT_SLIDER(nsslider,source) [(nsslider) setIntValue:source]
                     43: 
                     44: 
                     45: // Back up of the current configuration parameters
                     46: CNF_PARAMS CurrentParams;
                     47: 
1.1       root       48: 
                     49: // Keys to be listed in the Joysticks dropdowns
                     50: SDLKey Preferences_KeysForJoysticks[] =
                     51: {
                     52:        SDLK_BACKSPACE,
                     53:        SDLK_TAB,
                     54:        SDLK_CLEAR,
                     55:        SDLK_RETURN,
                     56:        SDLK_PAUSE,
                     57:        SDLK_ESCAPE,
                     58:        SDLK_SPACE,
                     59:        SDLK_EXCLAIM,
                     60:        SDLK_QUOTEDBL,
                     61:        SDLK_HASH,
                     62:        SDLK_DOLLAR,
                     63:        SDLK_AMPERSAND,
                     64:        SDLK_QUOTE,
                     65:        SDLK_LEFTPAREN,
                     66:        SDLK_RIGHTPAREN,
                     67:        SDLK_ASTERISK,
                     68:        SDLK_PLUS,
                     69:        SDLK_COMMA,
                     70:        SDLK_MINUS,
                     71:        SDLK_PERIOD,
                     72:        SDLK_SLASH,
                     73:        SDLK_0,
                     74:        SDLK_1,
                     75:        SDLK_2,
                     76:        SDLK_3,
                     77:        SDLK_4,
                     78:        SDLK_5,
                     79:        SDLK_6,
                     80:        SDLK_7,
                     81:        SDLK_8,
                     82:        SDLK_9,
                     83:        SDLK_COLON,
                     84:        SDLK_SEMICOLON,
                     85:        SDLK_LESS,
                     86:        SDLK_EQUALS,
                     87:        SDLK_GREATER,
                     88:        SDLK_QUESTION,
                     89:        SDLK_AT,
                     90:        SDLK_LEFTBRACKET,
                     91:        SDLK_BACKSLASH,
                     92:        SDLK_RIGHTBRACKET,
                     93:        SDLK_CARET,
                     94:        SDLK_UNDERSCORE,
                     95:        SDLK_BACKQUOTE,
                     96:        SDLK_a,
                     97:        SDLK_b,
                     98:        SDLK_c,
                     99:        SDLK_d,
                    100:        SDLK_e,
                    101:        SDLK_f,
                    102:        SDLK_g,
                    103:        SDLK_h,
                    104:        SDLK_i,
                    105:        SDLK_j,
                    106:        SDLK_k,
                    107:        SDLK_l,
                    108:        SDLK_m,
                    109:        SDLK_n,
                    110:        SDLK_o,
                    111:        SDLK_p,
                    112:        SDLK_q,
                    113:        SDLK_r,
                    114:        SDLK_s,
                    115:        SDLK_t,
                    116:        SDLK_u,
                    117:        SDLK_v,
                    118:        SDLK_w,
                    119:        SDLK_x,
                    120:        SDLK_y,
                    121:        SDLK_z,
                    122:        SDLK_DELETE,
                    123:        SDLK_KP0,
                    124:        SDLK_KP1,
                    125:        SDLK_KP2,
                    126:        SDLK_KP3,
                    127:        SDLK_KP4,
                    128:        SDLK_KP5,
                    129:        SDLK_KP6,
                    130:        SDLK_KP7,
                    131:        SDLK_KP8,
                    132:        SDLK_KP9,
                    133:        SDLK_KP_PERIOD,
                    134:        SDLK_KP_DIVIDE,
                    135:        SDLK_KP_MULTIPLY,
                    136:        SDLK_KP_MINUS,
                    137:        SDLK_KP_PLUS,
                    138:        SDLK_KP_ENTER,
                    139:        SDLK_KP_EQUALS,
                    140:        SDLK_UP,
                    141:        SDLK_DOWN,
                    142:        SDLK_RIGHT,
                    143:        SDLK_LEFT,
                    144:        SDLK_INSERT,
                    145:        SDLK_HOME,
                    146:        SDLK_END,
                    147:        SDLK_PAGEUP,
                    148:        SDLK_PAGEDOWN,
                    149:        SDLK_F1,
                    150:        SDLK_F2,
                    151:        SDLK_F3,
                    152:        SDLK_F4,
                    153:        SDLK_F5,
                    154:        SDLK_F6,
                    155:        SDLK_F7,
                    156:        SDLK_F8,
                    157:        SDLK_F9,
                    158:        SDLK_F10,
                    159:        SDLK_F11,
                    160:        SDLK_F12,
                    161:        SDLK_F13,
                    162:        SDLK_F14,
                    163:        SDLK_F15,
                    164:        SDLK_NUMLOCK,
                    165:        SDLK_CAPSLOCK,
                    166:        SDLK_SCROLLOCK,
                    167:        SDLK_RSHIFT,
                    168:        SDLK_LSHIFT,
                    169:        SDLK_RCTRL,
                    170:        SDLK_LCTRL,
                    171:        SDLK_RALT,
                    172:        SDLK_LALT,
                    173:        SDLK_RMETA,
                    174:        SDLK_LMETA,
                    175:        SDLK_LSUPER,
                    176:        SDLK_RSUPER,
                    177:        SDLK_MODE,
                    178:        SDLK_COMPOSE,
                    179:        SDLK_HELP,
                    180:        SDLK_PRINT,
                    181:        SDLK_SYSREQ,
                    182:        SDLK_BREAK,
                    183:        SDLK_MENU,
                    184:        SDLK_POWER,
                    185:        SDLK_EURO,
                    186:        SDLK_UNDO
                    187: };
                    188: 
                    189: size_t Preferences_cKeysForJoysticks = sizeof(Preferences_KeysForJoysticks) / sizeof(Preferences_KeysForJoysticks[0]);
                    190: 
1.1.1.6   root      191: #define DLGSOUND_11KHZ      0
                    192: #define DLGSOUND_12KHZ      1
                    193: #define DLGSOUND_16KHZ      2
                    194: #define DLGSOUND_22KHZ      3
                    195: #define DLGSOUND_25KHZ      4
                    196: #define DLGSOUND_32KHZ      5
                    197: #define DLGSOUND_44KHZ      6
                    198: #define DLGSOUND_48KHZ      7
                    199: #define DLGSOUND_50KHZ      8
                    200: 
                    201: static const int nSoundFreqs[] =
                    202: {
                    203:        11025,
                    204:        12517,
                    205:        16000,
                    206:        22050,
                    207:        25033,
                    208:        32000,
                    209:        44100,
                    210:        48000,
                    211:        50066
                    212: };
1.1       root      213: 
                    214: @implementation PrefsController
                    215: 
                    216: 
                    217: /*-----------------------------------------------------------------------*/
                    218: /*
                    219:   Helper method for Choose buttons
                    220:   Returns: TRUE is the user selected a path, FALSE if he/she aborted
                    221: */
                    222: - (BOOL)choosePathForControl:(NSTextField*)textField chooseDirectories:(bool)chooseDirectories defaultInitialDir:(NSString*)defaultInitialDir
                    223: {
                    224:        // Create and configure an OpenPanel
                    225:     NSOpenPanel *openPanel = [NSOpenPanel openPanel];
                    226:        [openPanel setCanChooseDirectories: chooseDirectories];
                    227:        [openPanel setCanChooseFiles: !chooseDirectories];
                    228: 
                    229:        NSString *directoryToOpen;
                    230:        NSString *fileToPreselect;
                    231:        NSString *oldPath = [textField stringValue];
                    232:        if ((oldPath != nil) && ([oldPath length] > 0))
                    233:        {
                    234:                // There is existing path: we will open its directory with its file pre-selected.
                    235:                directoryToOpen = [oldPath stringByDeletingLastPathComponent];
                    236:                fileToPreselect = [oldPath lastPathComponent];
                    237:        }
                    238:        else
                    239:        {
                    240:                // Currently no path: we will open the user's directory with no file selected.
                    241:                directoryToOpen = [defaultInitialDir stringByExpandingTildeInPath];
                    242:                fileToPreselect = nil;
                    243:        }
                    244:        
                    245:        // Run the OpenPanel, then check if the user clicked OK and selected at least one file
                    246:     if ( (NSOKButton == [openPanel runModalForDirectory:directoryToOpen file:fileToPreselect types:nil] )
                    247:            && ([[openPanel filenames] count] > 0) )
                    248:        {
                    249:                // Get the path to the selected file
                    250:                NSString *path = [[openPanel filenames] objectAtIndex:0];
                    251:                
                    252:                // Set the control to it (abbreviated if possible)
                    253:                [textField setStringValue:[path stringByAbbreviatingWithTildeInPath]];
                    254:                
                    255:                // Signal completion
1.1.1.5   root      256:                return true;
1.1       root      257:     }
                    258:        
                    259:        // Signal that the selection was aborted
                    260:        return FALSE;
                    261: }
                    262: 
                    263: 
                    264: /*-----------------------------------------------------------------------*/
                    265: /*
                    266:   Helper method to insert a floppy image
                    267:   TODO: Add code to restrict to known file types
                    268: */
                    269: - (void)insertFloppyImageIntoDrive:(int)drive forTextField:(NSTextField*)floppyTextField
                    270: {
                    271:        if ([self choosePathForControl:floppyTextField chooseDirectories:FALSE defaultInitialDir:[defaultImagesLocation stringValue]])
                    272:        {
                    273:                // Get the full path to the selected file
                    274:                NSString *path = [[floppyTextField stringValue] stringByExpandingTildeInPath];
                    275:                
                    276:                // Make a non-const C string out of it
1.1.1.6   root      277:                const char* constSzPath = [path cStringUsingEncoding:NSASCIIStringEncoding];
1.1       root      278:                size_t cbPath = strlen(constSzPath) + 1;
                    279:                char szPath[cbPath];
                    280:                strncpy(szPath, constSzPath, cbPath);
                    281: 
                    282:                // Insert the floppy image at this path
1.1.1.3   root      283:                Floppy_SetDiskFileName(drive, szPath, NULL);
1.1       root      284:        }
                    285: }
                    286: 
                    287: 
                    288: /*-----------------------------------------------------------------------*/
                    289: /*
                    290:   Methods for all the "Choose" buttons
                    291: */
                    292: - (IBAction)chooseCartridgeImage:(id)sender;
                    293: {
                    294:        [self choosePathForControl: cartridgeImage chooseDirectories:FALSE defaultInitialDir:@"~"];
                    295: }
                    296: 
                    297: - (IBAction)chooseDefaultImagesLocation:(id)sender
                    298: {
                    299:        [self choosePathForControl: defaultImagesLocation chooseDirectories:TRUE defaultInitialDir:@"~"];
                    300: }
                    301: 
                    302: - (IBAction)chooseFloppyImageA:(id)sender
                    303: {
                    304:        [self insertFloppyImageIntoDrive:0 forTextField: floppyImageA];
                    305: }
                    306: 
                    307: - (IBAction)chooseFloppyImageB:(id)sender
                    308: {
                    309:        [self insertFloppyImageIntoDrive:1 forTextField: floppyImageB];
                    310: }
                    311: 
                    312: - (IBAction)chooseGemdosImage:(id)sender
                    313: {
                    314:        [self choosePathForControl: gemdosImage chooseDirectories:TRUE defaultInitialDir:@"~"];
                    315: }
                    316: 
                    317: - (IBAction)chooseHdImage:(id)sender
                    318: {
                    319:        [self choosePathForControl: hdImage chooseDirectories:FALSE defaultInitialDir:@"~"];
                    320: }
                    321: 
1.1.1.6   root      322: - (IBAction)chooseIdeMasterHdImage:(id)sender
                    323: {
                    324:        [self choosePathForControl: ideMasterHdImage chooseDirectories:FALSE defaultInitialDir:@"~"];
                    325: }
                    326: 
                    327: - (IBAction)chooseIdeSlaveHdImage:(id)sender
1.1.1.5   root      328: {
1.1.1.6   root      329:        [self choosePathForControl: ideSlaveHdImage chooseDirectories:FALSE defaultInitialDir:@"~"];
1.1.1.5   root      330: }
                    331: 
1.1       root      332: - (IBAction)chooseKeyboardMappingFile:(id)sender
                    333: {
                    334:        [self choosePathForControl: keyboardMappingFile chooseDirectories:FALSE defaultInitialDir:@"~"];
                    335: }
                    336: 
                    337: - (IBAction)chooseMidiOutputFile:(id)sender
                    338: {
                    339:        [self choosePathForControl: writeMidiToFile chooseDirectories:FALSE defaultInitialDir:@"~"];
                    340: }
                    341: 
                    342: - (IBAction)choosePrintToFile:(id)sender
                    343: {
                    344:        [self choosePathForControl: printToFile chooseDirectories:FALSE defaultInitialDir:@"~"];
                    345: }
                    346: 
                    347: - (IBAction)chooseRS232InputFile:(id)sender
                    348: {
                    349:        [self choosePathForControl: readRS232FromFile chooseDirectories:FALSE defaultInitialDir:@"~"];
                    350: }
                    351: 
                    352: - (IBAction)chooseRS232OutputFile:(id)sender
                    353: {
                    354:        [self choosePathForControl: writeRS232ToFile chooseDirectories:FALSE defaultInitialDir:@"~"];
                    355: }
                    356: 
                    357: - (IBAction)chooseTosImage:(id)sender;
                    358: {
                    359:        [self choosePathForControl: tosImage chooseDirectories:FALSE defaultInitialDir:@"~"];
                    360: }
                    361: 
                    362: 
                    363: /*-----------------------------------------------------------------------*/
                    364: /*
                    365:   Methods for the "Eject" buttons
                    366: */
                    367: - (IBAction)ejectFloppyA:(id)sender
                    368: {
1.1.1.3   root      369:        Floppy_SetDiskFileNameNone(0);
1.1       root      370:        
                    371:        // Refresh the control
                    372:        [floppyImageA setStringValue:@""];
                    373: }
                    374: 
                    375: - (IBAction)ejectFloppyB:(id)sender
                    376: {
1.1.1.3   root      377:        Floppy_SetDiskFileNameNone(1);
1.1       root      378: 
                    379:        // Refresh the control
                    380:        [floppyImageB setStringValue:@""];
                    381: }
                    382: 
                    383: - (IBAction)ejectGemdosImage:(id)sender
                    384: {
1.1.1.3   root      385:        // Clear the control. Later. saveAllControls will set the ConfigureParams accordingly to signal this is ejected
1.1       root      386:        [gemdosImage setStringValue:@""];
                    387: }
                    388: 
                    389: - (IBAction)ejectHdImage:(id)sender
                    390: {
1.1.1.3   root      391:        // Clear the control. Later. saveAllControls will set the ConfigureParams accordingly to signal this is ejected
1.1       root      392:        [hdImage setStringValue:@""];
                    393: }
                    394: 
1.1.1.6   root      395: - (IBAction)ejectIdeMasterHdImage:(id)sender
1.1.1.5   root      396: {
                    397:        // Clear the control. Later. saveAllControls will set the ConfigureParams accordingly to signal this is ejected
1.1.1.6   root      398:        [ideMasterHdImage setStringValue:@""];
1.1.1.5   root      399: }
                    400: 
1.1.1.6   root      401: - (IBAction)ejectIdeSlaveHdImage:(id)sender
                    402: {
                    403:        // Clear the control. Later. saveAllControls will set the ConfigureParams accordingly to signal this is ejected
                    404:        [ideSlaveHdImage setStringValue:@""];
                    405: }
1.1       root      406: 
                    407: /*-----------------------------------------------------------------------*/
1.1.1.3   root      408: /**
                    409:  * Methods for the "Load Config" button
                    410:  */
                    411: 
                    412: - (IBAction)loadConfigFrom:(id)sender
                    413: {
1.1.1.6   root      414:     NSString *ConfigFile = [NSString stringWithCString:(sConfigFileName) encoding:NSASCIIStringEncoding];
1.1.1.3   root      415:     NSOpenPanel *openPanel = [ NSOpenPanel openPanel ];
                    416:     
                    417:     if ( [ openPanel runModalForDirectory:nil file:ConfigFile types:nil ] )
                    418:        {
                    419:         ConfigFile = [ [ openPanel filenames ] objectAtIndex:0 ];
                    420:     }
                    421:        else
                    422:        {
                    423:                ConfigFile = nil;
                    424:        }
                    425: 
                    426:        if (ConfigFile != nil)
                    427:        {
                    428:                // Make a non-const C string out of it
1.1.1.6   root      429:                const char* constSzPath = [ConfigFile cStringUsingEncoding:NSASCIIStringEncoding];
1.1.1.3   root      430:                size_t cbPath = strlen(constSzPath) + 1;
                    431:                char szPath[cbPath];
                    432:                strncpy(szPath, constSzPath, cbPath);   
                    433: 
                    434:                // Load the config into ConfigureParams
                    435:                Configuration_Load(szPath);
                    436:                strcpy(sConfigFileName,szPath);
                    437:                // Refresh all the controls to match ConfigureParams
                    438:                [self setAllControls];
                    439:        }
1.1       root      440: }
                    441: 
1.1.1.3   root      442: /**
                    443:  * Methods for the "Load Config" button
                    444:  */
                    445: - (IBAction)saveConfigAs:(id)sender
1.1       root      446: {
1.1.1.3   root      447:        char splitpath[FILENAME_MAX], splitname[FILENAME_MAX];
                    448: 
                    449:        // Update the ConfigureParams from the controls
1.1       root      450:        [self saveAllControls];
                    451: 
1.1.1.3   root      452:        File_SplitPath(sConfigFileName, splitpath, splitname, NULL);
                    453: 
                    454:     NSSavePanel *savePanel = [ NSSavePanel savePanel ];
                    455: 
1.1.1.6   root      456:        NSString* defaultDir = [NSString stringWithCString:splitpath encoding:NSASCIIStringEncoding];
                    457:     NSString *ConfigFile = [NSString stringWithCString:splitname encoding:NSASCIIStringEncoding];
1.1.1.3   root      458:     
                    459:     if ( ![ savePanel runModalForDirectory:defaultDir file:ConfigFile ] )
                    460:        {
                    461:                return;
                    462:        }
                    463: 
                    464:     ConfigFile = [ savePanel filename ];
                    465:     
                    466:        if (ConfigFile != nil)
                    467:        {
                    468:                // Make a non-const C string out of it
1.1.1.6   root      469:                const char* constSzPath = [ConfigFile cStringUsingEncoding:NSASCIIStringEncoding];
1.1.1.3   root      470:                size_t cbPath = strlen(constSzPath) + 1;
                    471:                char szPath[cbPath];
                    472:                strncpy(szPath, constSzPath, cbPath);   
                    473: 
                    474:                // Save the config from ConfigureParams
                    475:                strcpy(sConfigFileName, szPath);
                    476:                Configuration_Save();
                    477:        }
1.1       root      478: }
                    479: 
                    480: 
                    481: /*-----------------------------------------------------------------------*/
                    482: /*
                    483:   Commits and closes
                    484: */
                    485: - (IBAction)commitAndClose:(id)sender
                    486: {
1.1.1.5   root      487:        BOOL applyChanges = true;
1.1       root      488: 
                    489:        // The user clicked OK
                    490:        [self saveAllControls];
                    491:        
                    492:        // If a reset is required, ask the user first
1.1.1.3   root      493:        if (Change_DoNeedReset(&CurrentParams, &ConfigureParams))
1.1       root      494:        {
1.1.1.6   root      495:                applyChanges = ( 0 == NSRunAlertPanel (
                    496:                                                                                           NSLocalizedStringFromTable(@"Reset the emulator",@"Localizable",@"comment"), 
                    497:                                                                                           NSLocalizedStringFromTable(@"Must be reset",@"Localizable",@"comment"),
                    498:                                                                                           NSLocalizedStringFromTable(@"Don't reset",@"Localizable",@"comment"), 
                    499:                                                                                           NSLocalizedStringFromTable(@"Reset",@"Localizable",@"comment"), nil) );
1.1       root      500:        }
                    501:        
                    502:        // Commit the new configuration
                    503:        if (applyChanges)
                    504:        {
1.1.1.5   root      505:                Change_CopyChangedParamsToConfiguration(&CurrentParams, &ConfigureParams, false);
1.1.1.3   root      506:        }
                    507:        else
                    508:        {
                    509:                ConfigureParams = CurrentParams;
1.1       root      510:        }
                    511: 
                    512:        // Close the window
                    513:        [window close]; 
                    514: }
                    515: 
                    516: - (void)initKeysDropDown:(NSPopUpButton*)dropDown
                    517: {
                    518:        [dropDown removeAllItems];
1.1.1.7   root      519:        unsigned int i;
1.1       root      520:        for (i = 0; i < Preferences_cKeysForJoysticks; i++)
                    521:        {
                    522:                SDLKey key = Preferences_KeysForJoysticks[i];
                    523:                const char* szKeyName = SDL_GetKeyName(key);
1.1.1.6   root      524:                [dropDown addItemWithTitle:[[NSString stringWithCString:szKeyName encoding:NSASCIIStringEncoding] capitalizedString]];  
1.1       root      525:                [[dropDown lastItem] setTag:key];
                    526:        }
                    527: }
                    528: 
                    529: 
                    530: /*-----------------------------------------------------------------------*/
                    531: /*
                    532:   Displays the Preferences dialog
                    533: */
                    534: - (IBAction)loadPrefs:(id)sender
                    535: {
                    536:        if (!bInitialized)
                    537:        {
                    538:                // Note: These inits cannot be done in awakeFromNib as by this time SDL is not yet initialized.
                    539: 
                    540:                // Fill the keyboard dropdowns
                    541:                [self initKeysDropDown:joystickUp];
                    542:                [self initKeysDropDown:joystickRight];
                    543:                [self initKeysDropDown:joystickDown];
                    544:                [self initKeysDropDown:joystickLeft];           
                    545:                [self initKeysDropDown:joystickFire];
                    546:                
                    547:                // Get and store the number of real joysticks
                    548:                cRealJoysticks = SDL_NumJoysticks();
                    549: 
                    550:                // Fill the real joysticks dropdown, if any are available
                    551:                if (cRealJoysticks > 0)
                    552:                {
                    553:                        [realJoystick removeAllItems];
                    554:                        int i;
                    555:                        for (i = 0; i < cRealJoysticks; i++)
                    556:                        {
                    557:                                const char* szJoystickName = SDL_JoystickName(i);
1.1.1.6   root      558:                                [realJoystick addItemWithTitle:[[NSString stringWithCString:szJoystickName encoding:NSASCIIStringEncoding] capitalizedString]]; 
1.1       root      559:                                [[realJoystick lastItem] setTag:i];     
                    560:                        }
                    561:                }
                    562:                else    // No real joysticks: Disable the controls
                    563:                {
                    564:                        [[joystickMode cellWithTag:1] setEnabled:FALSE];
                    565:                        [realJoystick setEnabled:FALSE];
                    566:                }
                    567:                
1.1.1.5   root      568:                bInitialized = true;
1.1       root      569:        }
                    570: 
                    571: 
1.1.1.3   root      572:        // Backup of configuration settings to CurrentParams (which we will only
                    573:        // commit back to the configuration settings if choosing OK)
                    574:        CurrentParams = ConfigureParams;
1.1       root      575: 
                    576:        [self setAllControls];
                    577: 
                    578:        // Display the window
1.1.1.9 ! root      579:        ModalWrapper *mw=[[ModalWrapper alloc] init];
        !           580:        
        !           581:        [mw runModal:window];
        !           582:        
        !           583:        [mw release];
        !           584:        
        !           585:        //GuiOsx_Pause();
        !           586:        
        !           587:        //[[NSApplication sharedApplication] runModalForWindow:window];
        !           588: 
1.1       root      589: }
                    590: 
                    591: 
                    592: /*-----------------------------------------------------------------------*/
                    593: /*
                    594:   Updates the controls following a change in the joystick selection
                    595: */
                    596: - (IBAction)changeViewedJoystick:(id)sender
                    597: {
                    598:        // Save the pre-joystick controls, as we are about to change them
                    599:        [self saveJoystickControls];
                    600:        
                    601:        // Refresh the per-joystick controls
                    602:        [self setJoystickControls];
                    603:        
                    604:        // Update the controls' enabled states
                    605:        [self updateEnabledStates:self];
                    606: }
                    607: 
                    608: 
                    609: /*-----------------------------------------------------------------------*/
                    610: /*
                    611:   Initializes all controls
                    612: */
                    613: - (void)setAllControls
                    614: {
                    615:        // Import the floppy paths into their controls.
1.1.1.3   root      616:        IMPORT_TEXTFIELD(floppyImageA, ConfigureParams.DiskImage.szDiskFileName[0]); 
                    617:        IMPORT_TEXTFIELD(floppyImageB, ConfigureParams.DiskImage.szDiskFileName[1]); 
1.1       root      618:        
                    619:        // Import all the preferences into their controls
1.1.1.3   root      620:        IMPORT_SWITCH(autoInsertB, ConfigureParams.DiskImage.bAutoInsertDiskB);
                    621:     IMPORT_SWITCH(blitter, ConfigureParams.System.bBlitter);
                    622:        IMPORT_SWITCH(bootFromHD, ConfigureParams.HardDisk.bBootFromHardDisk);  
1.1.1.7   root      623:     IMPORT_SWITCH(captureOnChange, ConfigureParams.Screen.bCrop);
1.1.1.3   root      624:     IMPORT_TEXTFIELD(cartridgeImage, ConfigureParams.Rom.szCartridgeImageFileName);
                    625:     IMPORT_RADIO(colorDepth, ConfigureParams.Screen.nVdiColors);
                    626:     IMPORT_SWITCH(compatibleCpu, ConfigureParams.System.bCompatibleCpu);
                    627:     IMPORT_RADIO(cpuClock, ConfigureParams.System.nCpuFreq);
                    628:     IMPORT_RADIO(cpuType, ConfigureParams.System.nCpuLevel);
                    629:        IMPORT_TEXTFIELD(defaultImagesLocation, ConfigureParams.DiskImage.szDiskImageDirectory);
                    630:     IMPORT_SWITCH(enableMidi, ConfigureParams.Midi.bEnableMidi);
                    631:     IMPORT_SWITCH(enablePrinter, ConfigureParams.Printer.bEnablePrinting);
                    632:     IMPORT_SWITCH(enableRS232, ConfigureParams.RS232.bEnableRS232);
                    633:     IMPORT_SWITCH(enableSound, ConfigureParams.Sound.bEnableSound);
                    634:     IMPORT_DROPDOWN(frameSkip, ConfigureParams.Screen.nFrameSkips);
                    635:     IMPORT_RADIO(keyboardMapping, ConfigureParams.Keyboard.nKeymapType);
                    636:     IMPORT_TEXTFIELD(keyboardMappingFile, ConfigureParams.Keyboard.szMappingFileName);
                    637:     IMPORT_RADIO(machineType, ConfigureParams.System.nMachineType);
                    638:     IMPORT_RADIO(monitor, ConfigureParams.Screen.nMonitorType);
                    639:     IMPORT_SWITCH(patchTimerD, ConfigureParams.System.bPatchTimerD);
                    640:     IMPORT_TEXTFIELD(printToFile, ConfigureParams.Printer.szPrintToFileName);
                    641:     IMPORT_RADIO(ramSize, ConfigureParams.Memory.nMemorySize);
                    642:     IMPORT_TEXTFIELD(readRS232FromFile, ConfigureParams.RS232.szInFileName);
                    643:     IMPORT_SWITCH(realTime, ConfigureParams.System.bRealTimeClock);
1.1.1.8   root      644:     IMPORT_SWITCH(fastFDC, ConfigureParams.DiskImage.FastFloppy);
1.1.1.3   root      645:     IMPORT_TEXTFIELD(tosImage, ConfigureParams.Rom.szTosImageFileName);
                    646:     IMPORT_SWITCH(useBorders, ConfigureParams.Screen.bAllowOverscan);
                    647:     IMPORT_SWITCH(useVDIResolution, ConfigureParams.Screen.bUseExtVdiResolutions);
1.1.1.4   root      648:     IMPORT_TEXTFIELD(writeMidiToFile, ConfigureParams.Midi.sMidiOutFileName);
1.1.1.9 ! root      649:        IMPORT_RADIO(floppyWriteProtection, ConfigureParams.DiskImage.nWriteProtection);
        !           650:        IMPORT_RADIO(HDWriteProtection, ConfigureParams.HardDisk.nWriteProtection);
1.1.1.3   root      651:     IMPORT_TEXTFIELD(writeRS232ToFile, ConfigureParams.RS232.szOutFileName);
1.1.1.6   root      652:     // IMPORT_SWITCH(zoomSTLowRes, ConfigureParams.Screen.bZoomLowRes);
1.1.1.3   root      653:        IMPORT_SWITCH(showStatusBar, ConfigureParams.Screen.bShowStatusbar);
                    654:        IMPORT_DROPDOWN(enableDSP,ConfigureParams.System.nDSPType);
                    655:        IMPORT_TEXTFIELD(configFile, sConfigFileName);
1.1.1.2   root      656: 
1.1.1.6   root      657:        // 12/04/2010
                    658:        IMPORT_SWITCH(falconTTRatio, ConfigureParams.Screen.bAspectCorrect);
                    659:        IMPORT_SWITCH(fullScreen, ConfigureParams.Screen.bFullScreen);
                    660:        IMPORT_SWITCH(ledDisks, ConfigureParams.Screen.bShowDriveLed);
1.1.1.9 ! root      661:        IMPORT_SWITCH(keepDesktopResolution, ConfigureParams.Screen.bKeepResolution);
        !           662:        
        !           663:        //v1.6.1
        !           664:        IMPORT_SWITCH(FastBootPatch,ConfigureParams.System.bFastBoot);
        !           665:        IMPORT_RADIO(YMVoicesMixing,ConfigureParams.Sound.YmVolumeMixing);
1.1.1.6   root      666:        
                    667:        //deal with the Max Zoomed Stepper
                    668:        IMPORT_NTEXTFIELD(maxZoomedWidth, ConfigureParams.Screen.nMaxWidth);
                    669:        IMPORT_NTEXTFIELD(maxZoomedHeight, ConfigureParams.Screen.nMaxHeight);
                    670:        
1.1.1.9 ! root      671:        [widthStepper setDoubleValue:[maxZoomedWidth intValue]];
        !           672:        [heightStepper setDoubleValue:[maxZoomedHeight intValue]];
1.1.1.6   root      673:        
                    674:        
                    675:        
                    676:        
1.1.1.3   root      677:        [(force8bpp) setState:((ConfigureParams.Screen.nForceBpp==8))? NSOnState : NSOffState];
1.1.1.2   root      678: 
1.1.1.6   root      679:        
                    680:        int i;
                    681:        
                    682:        for (i = 0; i <= DLGSOUND_50KHZ-DLGSOUND_11KHZ; i++)
                    683:        {
                    684:                if (ConfigureParams.Sound.nPlaybackFreq > nSoundFreqs[i]-500
                    685:                    && ConfigureParams.Sound.nPlaybackFreq < nSoundFreqs[i]+500)
                    686:                {
                    687:                        [playbackQuality selectCellWithTag:(i)];
                    688:                        break;
                    689:                }
                    690:        }
                    691:        
                    692:        
1.1.1.3   root      693:        if (ConfigureParams.Screen.nVdiWidth >= 1024)
1.1.1.2   root      694:                [resolution selectCellWithTag:(2)];
1.1.1.3   root      695:        else if (ConfigureParams.Screen.nVdiWidth >= 768)
1.1.1.2   root      696:                [resolution selectCellWithTag:(1)];
                    697:        else
                    698:                [resolution selectCellWithTag:(0)];
                    699: 
1.1       root      700:        // If the HD flag is set, load the HD path, otherwise make it blank
1.1.1.3   root      701:        if (ConfigureParams.HardDisk.bUseHardDiskImage)
1.1       root      702:        {
1.1.1.3   root      703:                IMPORT_TEXTFIELD(hdImage, ConfigureParams.HardDisk.szHardDiskImage);    
1.1       root      704:        }
                    705:        else
                    706:        {
                    707:                [hdImage setStringValue:@""];
                    708:        }
                    709:        
1.1.1.5   root      710:        // If the IDE HD flag is set, load the IDE HD path, otherwise make it blank
1.1.1.6   root      711:        //Master
                    712:        if (ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage)
1.1.1.5   root      713:        {
1.1.1.6   root      714:                IMPORT_TEXTFIELD(ideMasterHdImage, ConfigureParams.HardDisk.szIdeMasterHardDiskImage);  
1.1.1.5   root      715:        }
                    716:        else
                    717:        {
1.1.1.6   root      718:                [ideMasterHdImage setStringValue:@""];
                    719:        }
                    720:        //Slave
                    721:        if (ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage)
                    722:        {
                    723:                IMPORT_TEXTFIELD(ideSlaveHdImage, ConfigureParams.HardDisk.szIdeSlaveHardDiskImage);    
                    724:        }
                    725:        else
                    726:        {
                    727:                [ideSlaveHdImage setStringValue:@""];
1.1.1.5   root      728:        }
                    729:        
1.1       root      730:        // If the Gemdos flag is set, load the Gemdos path, otherwise make it blank
1.1.1.3   root      731:        if (ConfigureParams.HardDisk.bUseHardDiskDirectories)
1.1       root      732:        {
1.1.1.3   root      733:                IMPORT_TEXTFIELD(gemdosImage, ConfigureParams.HardDisk.szHardDiskDirectories[0]);
1.1       root      734:        }
                    735:        else
                    736:        {
                    737:                [gemdosImage setStringValue:@""];
                    738:        }
                    739:        
                    740:        // Set the per-joystick controls                
                    741:        [self setJoystickControls];
                    742:        
                    743:        // Update the controls' enabled states
                    744:        [self updateEnabledStates:self];        
                    745: }
                    746: 
                    747: 
                    748: /*-----------------------------------------------------------------------*/
                    749: /*
                    750:   Updates the enabled states of controls who depend on other controls
                    751: */
                    752: - (IBAction)updateEnabledStates:(id)sender
                    753: {
                    754:        // Joystick key controls are only enabled if "Use keyboard" is selected
                    755:        int nJoystickMode;
                    756:        EXPORT_RADIO(joystickMode, nJoystickMode);
                    757:        BOOL bUsingKeyboard = (nJoystickMode == JOYSTICK_KEYBOARD);
                    758:        [joystickUp setEnabled:bUsingKeyboard];         
                    759:        [joystickRight setEnabled:bUsingKeyboard];              
                    760:        [joystickDown setEnabled:bUsingKeyboard];               
                    761:        [joystickLeft setEnabled:bUsingKeyboard];               
                    762:        [joystickFire setEnabled:bUsingKeyboard];               
                    763: 
                    764:        // Resolution and colour depth depend on Extended GEM VDI resolution
                    765:        BOOL bUsingVDI;
                    766:        EXPORT_SWITCH(useVDIResolution, bUsingVDI);
                    767:        [resolution setEnabled:bUsingVDI];              
                    768:        [colorDepth setEnabled:bUsingVDI];
                    769:        
                    770:        // Playback quality depends on enable sound
                    771:        BOOL bSoundEnabled;
                    772:     EXPORT_SWITCH(enableSound, bSoundEnabled);
                    773:        [playbackQuality setEnabled:bSoundEnabled];
                    774: }
                    775: 
                    776: 
                    777: /*-----------------------------------------------------------------------*/
                    778: /*
                    779:   Updates the joystick controls to match the new joystick selection
                    780: */
                    781: - (void)setJoystickControls
                    782: {
                    783:        // Get and persist the ID of the newly selected joystick
                    784:        EXPORT_DROPDOWN(currentJoystick, nCurrentJoystick);
                    785: 
                    786:        // Data validation: If the JoyID is out of bounds, correct it and, if set to use real joystick, change to disabled
1.1.1.3   root      787:        if ( (ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoyId < 0)
                    788:        || (ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoyId >= cRealJoysticks) )
1.1       root      789:        {
1.1.1.3   root      790:                ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoyId = 0;
                    791:                if (ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoystickMode == JOYSTICK_REALSTICK)
1.1       root      792:                {
1.1.1.3   root      793:                        ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoystickMode = JOYSTICK_DISABLED;
1.1       root      794:                }       
                    795:        }
                    796: 
                    797:        // Don't change the realJoystick dropdown if none is available (to keep "(None available)" selected)
                    798:        if (cRealJoysticks > 0)
                    799:        {
1.1.1.3   root      800:                IMPORT_DROPDOWN(realJoystick, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoyId);
1.1       root      801:        }
                    802: 
1.1.1.3   root      803:        IMPORT_RADIO(joystickMode, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoystickMode);
                    804:        IMPORT_DROPDOWN(joystickUp, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeUp);
                    805:        IMPORT_DROPDOWN(joystickRight, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeRight);
                    806:        IMPORT_DROPDOWN(joystickDown, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeDown);
                    807:        IMPORT_DROPDOWN(joystickLeft, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeLeft);
                    808:        IMPORT_DROPDOWN(joystickFire, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeFire);
                    809:        IMPORT_SWITCH(enableAutoFire, ConfigureParams.Joysticks.Joy[nCurrentJoystick].bEnableAutoFire);
1.1       root      810: }
                    811: 
                    812: 
                    813: /*-----------------------------------------------------------------------*/
                    814: /*
                    815:   Saves the setting for the joystick currently being viewed
                    816: */
                    817: - (void)saveJoystickControls
                    818: {
1.1.1.3   root      819:        EXPORT_RADIO(joystickMode, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoystickMode);      
                    820:        EXPORT_DROPDOWN(realJoystick, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nJoyId);
                    821:        EXPORT_DROPDOWN(joystickUp, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeUp);
                    822:        EXPORT_DROPDOWN(joystickRight, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeRight);
                    823:        EXPORT_DROPDOWN(joystickDown, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeDown);
                    824:        EXPORT_DROPDOWN(joystickLeft, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeLeft);
                    825:        EXPORT_DROPDOWN(joystickFire, ConfigureParams.Joysticks.Joy[nCurrentJoystick].nKeyCodeFire);
                    826:        EXPORT_SWITCH(enableAutoFire, ConfigureParams.Joysticks.Joy[nCurrentJoystick].bEnableAutoFire);
1.1       root      827: }
                    828: 
                    829: 
                    830: /*-----------------------------------------------------------------------*/
                    831: /*
                    832:   Saves the settings for all controls
                    833: */
                    834: - (void)saveAllControls
                    835: {
                    836:        // Export the preference controls into their vars
1.1.1.3   root      837:        EXPORT_SWITCH(autoInsertB, ConfigureParams.DiskImage.bAutoInsertDiskB);
                    838:     EXPORT_SWITCH(blitter, ConfigureParams.System.bBlitter);
                    839:        EXPORT_SWITCH(bootFromHD, ConfigureParams.HardDisk.bBootFromHardDisk);
1.1.1.7   root      840:     EXPORT_SWITCH(captureOnChange, ConfigureParams.Screen.bCrop);
1.1.1.3   root      841:     EXPORT_TEXTFIELD(cartridgeImage, ConfigureParams.Rom.szCartridgeImageFileName);
                    842:     EXPORT_RADIO(colorDepth, ConfigureParams.Screen.nVdiColors);
                    843:     EXPORT_SWITCH(compatibleCpu, ConfigureParams.System.bCompatibleCpu);
                    844:     EXPORT_RADIO(cpuClock, ConfigureParams.System.nCpuFreq);
                    845:     EXPORT_RADIO(cpuType, ConfigureParams.System.nCpuLevel);
                    846:        EXPORT_TEXTFIELD(defaultImagesLocation, ConfigureParams.DiskImage.szDiskImageDirectory);
                    847:     EXPORT_SWITCH(enableMidi, ConfigureParams.Midi.bEnableMidi);
                    848:     EXPORT_SWITCH(enablePrinter, ConfigureParams.Printer.bEnablePrinting);
                    849:     EXPORT_SWITCH(enableRS232, ConfigureParams.RS232.bEnableRS232);
                    850:     EXPORT_SWITCH(enableSound, ConfigureParams.Sound.bEnableSound);
                    851:     EXPORT_DROPDOWN(frameSkip, ConfigureParams.Screen.nFrameSkips);
                    852:     EXPORT_RADIO(keyboardMapping, ConfigureParams.Keyboard.nKeymapType);
                    853:     EXPORT_TEXTFIELD(keyboardMappingFile, ConfigureParams.Keyboard.szMappingFileName);
                    854:     EXPORT_RADIO(machineType, ConfigureParams.System.nMachineType);
                    855:     EXPORT_RADIO(monitor, ConfigureParams.Screen.nMonitorType);
                    856:     EXPORT_SWITCH(patchTimerD, ConfigureParams.System.bPatchTimerD);
                    857:     EXPORT_TEXTFIELD(printToFile, ConfigureParams.Printer.szPrintToFileName);
                    858:     EXPORT_RADIO(ramSize, ConfigureParams.Memory.nMemorySize);
                    859:     EXPORT_TEXTFIELD(readRS232FromFile, ConfigureParams.RS232.szInFileName);
                    860:     EXPORT_SWITCH(realTime, ConfigureParams.System.bRealTimeClock);
1.1.1.8   root      861:     EXPORT_SWITCH(fastFDC, ConfigureParams.DiskImage.FastFloppy);
1.1.1.3   root      862:     EXPORT_TEXTFIELD(tosImage, ConfigureParams.Rom.szTosImageFileName);
                    863:     EXPORT_SWITCH(useBorders, ConfigureParams.Screen.bAllowOverscan);
                    864:     EXPORT_SWITCH(useVDIResolution, ConfigureParams.Screen.bUseExtVdiResolutions);
1.1.1.4   root      865:     EXPORT_TEXTFIELD(writeMidiToFile, ConfigureParams.Midi.sMidiOutFileName);
1.1.1.9 ! root      866:        EXPORT_RADIO(floppyWriteProtection, ConfigureParams.DiskImage.nWriteProtection);
        !           867:     EXPORT_RADIO(HDWriteProtection, ConfigureParams.HardDisk.nWriteProtection);
        !           868:        EXPORT_TEXTFIELD(writeRS232ToFile, ConfigureParams.RS232.szOutFileName);
1.1.1.6   root      869:     // EXPORT_SWITCH(zoomSTLowRes, ConfigureParams.Screen.bZoomLowRes);
1.1.1.3   root      870:        EXPORT_SWITCH(showStatusBar,ConfigureParams.Screen.bShowStatusbar);
                    871:        EXPORT_DROPDOWN(enableDSP,ConfigureParams.System.nDSPType);
1.1.1.6   root      872:        
                    873:        EXPORT_SWITCH(falconTTRatio, ConfigureParams.Screen.bAspectCorrect);
                    874:        EXPORT_SWITCH(fullScreen, ConfigureParams.Screen.bFullScreen);
1.1.1.9 ! root      875:        EXPORT_SWITCH(ledDisks, ConfigureParams.Screen.bShowDriveLed);
        !           876:        EXPORT_SWITCH(keepDesktopResolution, ConfigureParams.Screen.bKeepResolution);
        !           877:        
        !           878:        //v1.6.1
        !           879:        EXPORT_SWITCH(FastBootPatch,ConfigureParams.System.bFastBoot);
        !           880:        EXPORT_RADIO(YMVoicesMixing,ConfigureParams.Sound.YmVolumeMixing);
1.1.1.6   root      881:        
                    882:        EXPORT_NTEXTFIELD(maxZoomedWidth, ConfigureParams.Screen.nMaxWidth);
                    883:        EXPORT_NTEXTFIELD(maxZoomedHeight, ConfigureParams.Screen.nMaxHeight);
1.1.1.2   root      884: 
1.1.1.6   root      885:        ConfigureParams.Screen.nForceBpp = ([force8bpp state] == NSOnState) ? 8 : 0;
1.1.1.5   root      886: 
1.1.1.6   root      887:        ConfigureParams.Sound.nPlaybackFreq = nSoundFreqs[[[playbackQuality selectedCell] tag]];
                    888:                        
1.1.1.2   root      889:        switch ([[resolution selectedCell] tag])
                    890:        {
                    891:         case 0:
1.1.1.3   root      892:                ConfigureParams.Screen.nVdiWidth = 640;
                    893:                ConfigureParams.Screen.nVdiHeight = 480;
1.1.1.2   root      894:                break;
                    895:         case 1:
1.1.1.3   root      896:                ConfigureParams.Screen.nVdiWidth = 800;
                    897:                ConfigureParams.Screen.nVdiHeight = 600;
1.1.1.2   root      898:                break;
                    899:         case 2:
1.1.1.3   root      900:                ConfigureParams.Screen.nVdiWidth = 1024;
                    901:                ConfigureParams.Screen.nVdiHeight = 768;
1.1.1.2   root      902:                break;
                    903:        }
1.1       root      904: 
                    905:        // Define the HD flag, and export the HD path if one is selected
                    906:        if ([[hdImage stringValue] length] > 0)
                    907:        {
1.1.1.3   root      908:                EXPORT_TEXTFIELD(hdImage, ConfigureParams.HardDisk.szHardDiskImage);
1.1.1.5   root      909:                ConfigureParams.HardDisk.bUseHardDiskImage = true;
                    910:        }
                    911:        else
                    912:        {
                    913:                ConfigureParams.HardDisk.bUseHardDiskImage = false;
                    914:        }
                    915:        
                    916:        // Define the IDE HD flag, and export the IDE HD path if one is selected
1.1.1.6   root      917:        if ([[ideMasterHdImage stringValue] length] > 0)
                    918:        {
                    919:                EXPORT_TEXTFIELD(ideMasterHdImage, ConfigureParams.HardDisk.szIdeMasterHardDiskImage);
                    920:                ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage = true;
                    921:        }
                    922:        else
1.1.1.5   root      923:        {
1.1.1.6   root      924:                ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage = false;
                    925:        }
                    926:        
                    927:        // IDE Slave
                    928:        if ([[ideSlaveHdImage stringValue] length] > 0)
                    929:        {
                    930:                EXPORT_TEXTFIELD(ideSlaveHdImage, ConfigureParams.HardDisk.szIdeSlaveHardDiskImage);
                    931:                ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage = true;
1.1       root      932:        }
                    933:        else
                    934:        {
1.1.1.6   root      935:                ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage = false;
1.1       root      936:        }
                    937:        
                    938:        // Define the Gemdos flag, and export the Gemdos path if one is selected
                    939:        if ([[gemdosImage stringValue] length] > 0)
                    940:        {
1.1.1.3   root      941:                EXPORT_TEXTFIELD(gemdosImage, ConfigureParams.HardDisk.szHardDiskDirectories[0]);
1.1.1.5   root      942:                ConfigureParams.HardDisk.bUseHardDiskDirectories = true;
1.1       root      943:        }
                    944:        else
                    945:        {
1.1.1.5   root      946:                ConfigureParams.HardDisk.bUseHardDiskDirectories = false;
1.1       root      947:        }
                    948:        
                    949:        // Save the per-joystick controls               
                    950:        [self saveJoystickControls];    
                    951: }
                    952: 
1.1.1.6   root      953: // Max Zoomed Adjust
                    954: 
                    955: - (IBAction) setWidth:(id)sender;
                    956: {
                    957:        NSLog(@"Change Max Zoom width: %ld", [sender intValue]);
                    958:     [maxZoomedWidth setIntValue: [sender intValue]];
                    959: }
                    960: 
                    961: - (IBAction) setHeight:(id)sender;
                    962: {
                    963:        NSLog(@"Change Max Zoom height: %ld", [sender intValue]);
                    964:     [maxZoomedHeight setIntValue: [sender intValue]];
                    965: }
                    966: 
1.1.1.9 ! root      967: +(PrefsController*)prefs
        !           968: {
        !           969:        static PrefsController* prefs = nil;
        !           970:        if (!prefs)
        !           971:                prefs = [[PrefsController alloc] init];
        !           972:        
        !           973:        return prefs;
        !           974: }
        !           975: 
        !           976: 
1.1.1.6   root      977: 
1.1       root      978: @end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.