SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUIDialog_AppSettings.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // The application-settings dialog
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
36 #include <gui/GUIGlobals.h>
37 #include "GUIDialog_AppSettings.h"
38 
39 #ifdef CHECK_MEMORY_LEAKS
40 #include <foreign/nvwa/debug_new.h>
41 #endif // CHECK_MEMORY_LEAKS
42 
43 
44 // ===========================================================================
45 // FOX callback mapping
46 // ===========================================================================
47 FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[] = {
49  FXMAPFUNC(SEL_COMMAND, MID_AUTOSTART, GUIDialog_AppSettings::onCmdSelect),
50  FXMAPFUNC(SEL_COMMAND, MID_DEMO, GUIDialog_AppSettings::onCmdSelect),
52  FXMAPFUNC(SEL_COMMAND, MID_LOCATELINKS, GUIDialog_AppSettings::onCmdSelect),
53  FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_AppSettings::onCmdOk),
55 };
56 
57 FXIMPLEMENT(GUIDialog_AppSettings, FXDialogBox, GUIDialog_AppSettingsMap, ARRAYNUMBER(GUIDialog_AppSettingsMap))
58 
59 
60 // ===========================================================================
61 // method definitions
62 // ===========================================================================
64  : FXDialogBox(parent, "Application Settings"),
65  myAppQuitOnEnd(GUIGlobals::gQuitOnEnd),
66  myAppAutoStart(GUIGlobals::gRunAfterLoad),
67  myAppDemo(GUIGlobals::gDemoAutoReload),
68  myAllowTextures(GUITexturesHelper::texturesAllowed()),
69  myLocateLinks(GUIMessageWindow::locateLinksEnabled()) {
70  FXCheckButton* b = 0;
71  FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
72  b = new FXCheckButton(f1, "Quit on Simulation End", this, MID_QUITONSIMEND);
73  b->setCheck(myAppQuitOnEnd);
74  b = new FXCheckButton(f1, "Autostart Simulation on Load and Reload", this, MID_AUTOSTART);
75  b->setCheck(myAppAutoStart);
76  b = new FXCheckButton(f1, "Reload Simulation after finish (Demo mode)", this, MID_DEMO);
77  b->setCheck(myAppDemo);
78  b = new FXCheckButton(f1, "Locate elements when clicking on messages", this, MID_LOCATELINKS);
79  b->setCheck(myLocateLinks);
80  new FXHorizontalSeparator(f1, SEPARATOR_GROOVE | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X);
81  b = new FXCheckButton(f1, "Allow Textures", this , MID_ALLOWTEXTURES);
82  b->setCheck(myAllowTextures);
83  FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
84  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);
85  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);
86  initial->setFocus();
88 }
89 
90 
92 
93 
94 long
95 GUIDialog_AppSettings::onCmdOk(FXObject*, FXSelector, void*) {
102  destroy();
103  return 1;
104 }
105 
106 
107 long
108 GUIDialog_AppSettings::onCmdCancel(FXObject*, FXSelector, void*) {
109  destroy();
110  return 1;
111 }
112 
113 
114 long
115 GUIDialog_AppSettings::onCmdSelect(FXObject*, FXSelector sel, void*) {
116  switch (FXSELID(sel)) {
117  case MID_QUITONSIMEND:
119  break;
120  case MID_AUTOSTART:
122  break;
123  case MID_DEMO:
124  myAppDemo = !myAppDemo;
125  break;
126  case MID_LOCATELINKS:
128  break;
129  case MID_ALLOWTEXTURES:
131  break;
132  }
133  return 1;
134 }
135 
136 
137 /****************************************************************************/
bool myAllowTextures
Information whether textures may be used.
bool myAppDemo
Information whether the simulation restarts after ending (demo mode)
long onCmdOk(FXObject *, FXSelector, void *)
Called on OK-button pressure.
Allow textures - Option.
Definition: GUIAppEnum.h:317
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:52
Locate links in messages - Option.
Definition: GUIAppEnum.h:319
long onCmdCancel(FXObject *, FXSelector, void *)
Called on Cancel-button pressure.
Close simulation at end - Option.
Definition: GUIAppEnum.h:311
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition: GUIGlobals.h:58
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
Cancel-button was pushed.
Definition: GUIAppEnum.h:303
bool myAppAutoStart
Information whether the simulation shall start directly after loading.
Ok-button was pushed.
Definition: GUIAppEnum.h:301
The dialog to change the application (gui) settings.
bool myAppQuitOnEnd
Information whether the application shall be quit.
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition: GUIGlobals.h:55
static void enableLocateLinks(const bool val)
switch locate links on and off
long onCmdSelect(FXObject *, FXSelector sel, void *)
Called on button change.
Demo mode - Option.
Definition: GUIAppEnum.h:315
Global storage for textures; manages and draws them.
static void allowTextures(const bool val)
switch texture drawing on and off
bool myLocateLinks
Information whether locate links appear in messages.
A logging window for the gui.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Start simulation when loaded - Option.
Definition: GUIAppEnum.h:313