int OptionsXScreen::handleMessage( unsigned long message, unsigned long who) { if ( aMSG_LEFTMOUSEDOWN == message ) { switch ( who ) { case MSB_TAB0: case MSB_TAB1: case MSB_TAB2: case MSB_TAB3: { for ( int i = MSB_TAB0; i < MSB_TAB3+1; i++ ) getButton( i )->press( 0 ); getButton( who )->press( true ); curTab = who - MSB_TAB0; } break; case YES: { int oldRes = prefs.resolution; int oldDepth = prefs.bitDepth; for ( int i = 0; i < 4; i++ ) tabAreas[i]->end(); prefs.save(); prefs.applyPrefs(0); LoadScreenWrapper::changeRes(); int newRes = prefs.resolution; int newDepth = prefs.bitDepth; if ( newRes != oldRes || newDepth != oldDepth ) { LogisticsOneButtonDialog::instance()->setText( IDS_SWAP_RESOLUTION_WARNING, IDS_DIALOG_OK, IDS_DIALOG_OK ); LogisticsOneButtonDialog::instance()->begin(); bShowWarning = true; } else bDone = true; return 1; } break; case NO: { (dynamic_cast<OptionsGamePlay *>(tabAreas[2]))->resetCamera(); prefs.load(); prefs.applyPrefs(0); bDone = true; return 1; } break; } } return 0; }
void OptionsXScreen::init(FitIniFile* file) { LogisticsScreen::init( *file, "Static", "Text", "Rect", "Button", "Edit" ); const char* fileNames[4] = { "mcl_optionsgraphics", "mcl_optionsaudio", "mcl_optionsgameplay", "mcl_optionshotkeys" }; OptionsGraphics* pGraphics = new OptionsGraphics; tabAreas[0] = pGraphics; OptionsAudio* pAudio = new OptionsAudio; tabAreas[1] = pAudio; OptionsGamePlay* pPlay = new OptionsGamePlay; tabAreas[2] = pPlay; OptionsHotKeys* pKeys = new OptionsHotKeys; tabAreas[3] = pKeys; FullPathFileName path; for ( int i = 0; i < 4;i++ ) { path.init( artPath, fileNames[i], ".fit" ); FitIniFile tmpFile; if ( NO_ERR != tmpFile.open( path ) ) { char error[256]; sprintf( error, "couldn't open file %s", path ); Assert( 0, 0, error ); return; } tabAreas[i]->init( tmpFile, "Static", "Text", "Rect", "Button", "Edit" ); tabAreas[i]->moveTo( rects[2].x(), rects[2].y() ); } // 640: offset x = -80, y = -90 // 800: offset none // 1024: offset x = 113, y = 54 // 1280: offset x = 240, y = 182 // 1600: offset x = 400, y = 270 long xOffset = 0; long yOffset = 0; switch (Environment.screenWidth) { case 640: xOffset = -80; yOffset = -90; break; case 1024: xOffset = 13; yOffset = 54; break; case 1280: xOffset = 240; yOffset = 182; break; case 1600: xOffset = 400; yOffset = 270; break; } move( xOffset, yOffset ); pGraphics->init(xOffset, yOffset); pAudio->init(xOffset, yOffset); pPlay->init(xOffset, yOffset); pKeys->init(xOffset, yOffset); //Needs to be 8.3 or it won't go on the CD!! originalSettings.load( "OrgPrefs" ); prefs.load(); for ( i = 0; i < 4; i++ ) tabAreas[i]->begin(); if ( mission && strlen( mission->getMissionFileName() ) ) { getButton( MSB_TAB2 )->disable( true ); } for ( i = 0; i < buttonCount; i++ ) { if ( MSB_TAB0 > buttons[i].getID() || MSB_TAB3 < buttons[i].getID() ) buttons[i].setMessageOnRelease( ); } getButton( MSB_TAB0 )->press( true ); bShowWarning = 0; }