|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // The application-settings dialog 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 00020 00021 // =========================================================================== 00022 // included modules 00023 // =========================================================================== 00024 #ifdef _MSC_VER 00025 #include <windows_config.h> 00026 #else 00027 #include <config.h> 00028 #endif 00029 00030 #include "GUIDialog_AppSettings.h" 00031 #include <utils/gui/windows/GUIAppEnum.h> 00032 #include <gui/GUIGlobals.h> 00033 #include <utils/gui/images/GUIIconSubSys.h> 00034 #include <utils/gui/images/GUITexturesHelper.h> 00035 00036 #ifdef CHECK_MEMORY_LEAKS 00037 #include <foreign/nvwa/debug_new.h> 00038 #endif // CHECK_MEMORY_LEAKS 00039 00040 00041 // =========================================================================== 00042 // FOX callback mapping 00043 // =========================================================================== 00044 FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]= { 00045 FXMAPFUNC(SEL_COMMAND, MID_QUITONSIMEND, GUIDialog_AppSettings::onCmdQuitOnEnd), 00046 FXMAPFUNC(SEL_COMMAND, MID_ALLOWTEXTURES, GUIDialog_AppSettings::onCmdAllowTextures), 00047 FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_AppSettings::onCmdOk), 00048 FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_CANCEL, GUIDialog_AppSettings::onCmdCancel), 00049 }; 00050 00051 FXIMPLEMENT(GUIDialog_AppSettings, FXDialogBox, GUIDialog_AppSettingsMap, ARRAYNUMBER(GUIDialog_AppSettingsMap)) 00052 00053 00054 // =========================================================================== 00055 // method definitions 00056 // =========================================================================== 00057 GUIDialog_AppSettings::GUIDialog_AppSettings(FXMainWindow* parent) throw() 00058 : FXDialogBox(parent, "Application Settings"), 00059 myAppQuitOnEnd(gQuitOnEnd), 00060 myAllowTextures(gAllowTextures) { 00061 FXCheckButton* b = 0; 00062 FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0); 00063 b = new FXCheckButton(f1, "Quit on Simulation End", this ,MID_QUITONSIMEND); 00064 b->setCheck(myAppQuitOnEnd); 00065 new FXHorizontalSeparator(f1,SEPARATOR_GROOVE|LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FILL_X); 00066 b = new FXCheckButton(f1, "Allow Textures", this ,MID_ALLOWTEXTURES); 00067 b->setCheck(myAllowTextures); 00068 b->disable(); 00069 FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,0,0,0,0, 10,10,5,5); 00070 FXButton* initial=new FXButton(f2,"&OK",NULL,this,MID_SETTINGS_OK,BUTTON_INITIAL|BUTTON_DEFAULT|FRAME_RAISED|FRAME_THICK|LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_CENTER_X,0,0,0,0, 30,30,4,4); 00071 new FXButton(f2,"&Cancel",NULL,this,MID_SETTINGS_CANCEL,BUTTON_DEFAULT|FRAME_RAISED|FRAME_THICK|LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_CENTER_X,0,0,0,0, 30,30,4,4); 00072 initial->setFocus(); 00073 setIcon(GUIIconSubSys::getIcon(ICON_EMPTY)); 00074 } 00075 00076 00077 GUIDialog_AppSettings::~GUIDialog_AppSettings() throw() {} 00078 00079 00080 long 00081 GUIDialog_AppSettings::onCmdOk(FXObject*,FXSelector,void*) { 00082 gQuitOnEnd = myAppQuitOnEnd; 00083 gAllowTextures = myAllowTextures; 00084 destroy(); 00085 return 1; 00086 } 00087 00088 00089 long 00090 GUIDialog_AppSettings::onCmdCancel(FXObject*,FXSelector,void*) { 00091 destroy(); 00092 return 1; 00093 } 00094 00095 00096 long 00097 GUIDialog_AppSettings::onCmdQuitOnEnd(FXObject*,FXSelector,void*) { 00098 myAppQuitOnEnd = !myAppQuitOnEnd; 00099 return 1; 00100 } 00101 00102 00103 long 00104 GUIDialog_AppSettings::onCmdAllowTextures(FXObject*,FXSelector,void*) { 00105 myAllowTextures = !myAllowTextures; 00106 return 1; 00107 } 00108 00109 00110 00111 /****************************************************************************/ 00112