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