SUMO - Simulation of Urban MObility
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-2017 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 
40 // ===========================================================================
41 // FOX callback mapping
42 // ===========================================================================
43 FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[] = {
45  FXMAPFUNC(SEL_COMMAND, MID_AUTOSTART, GUIDialog_AppSettings::onCmdSelect),
46  FXMAPFUNC(SEL_COMMAND, MID_DEMO, GUIDialog_AppSettings::onCmdSelect),
48  FXMAPFUNC(SEL_COMMAND, MID_LOCATELINKS, GUIDialog_AppSettings::onCmdSelect),
49  FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_AppSettings::onCmdOk),
51 };
52 
53 FXIMPLEMENT(GUIDialog_AppSettings, FXDialogBox, GUIDialog_AppSettingsMap, ARRAYNUMBER(GUIDialog_AppSettingsMap))
54 
55 
56 // ===========================================================================
57 // method definitions
58 // ===========================================================================
60  : FXDialogBox(parent, "Application Settings"),
61  myAppQuitOnEnd(GUIGlobals::gQuitOnEnd),
62  myAppAutoStart(GUIGlobals::gRunAfterLoad),
63  myAppDemo(GUIGlobals::gDemoAutoReload),
64  myAllowTextures(GUITexturesHelper::texturesAllowed()),
65  myLocateLinks(GUIMessageWindow::locateLinksEnabled()) {
66  FXCheckButton* b = 0;
67  FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
68  b = new FXCheckButton(f1, "Quit on Simulation End", this, MID_QUITONSIMEND);
69  b->setCheck(myAppQuitOnEnd);
70  b = new FXCheckButton(f1, "Autostart Simulation on Load and Reload", this, MID_AUTOSTART);
71  b->setCheck(myAppAutoStart);
72  b = new FXCheckButton(f1, "Reload Simulation after finish (Demo mode)", this, MID_DEMO);
73  b->setCheck(myAppDemo);
74  b = new FXCheckButton(f1, "Locate elements when clicking on messages", this, MID_LOCATELINKS);
75  b->setCheck(myLocateLinks);
76  new FXHorizontalSeparator(f1, SEPARATOR_GROOVE | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X);
77  b = new FXCheckButton(f1, "Allow Textures", this , MID_ALLOWTEXTURES);
78  b->setCheck(myAllowTextures);
79  FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
80  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);
81  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);
82  initial->setFocus();
84 }
85 
86 
88 
89 
90 long
91 GUIDialog_AppSettings::onCmdOk(FXObject*, FXSelector, void*) {
98  destroy();
99  return 1;
100 }
101 
102 
103 long
104 GUIDialog_AppSettings::onCmdCancel(FXObject*, FXSelector, void*) {
105  destroy();
106  return 1;
107 }
108 
109 
110 long
111 GUIDialog_AppSettings::onCmdSelect(FXObject*, FXSelector sel, void*) {
112  switch (FXSELID(sel)) {
113  case MID_QUITONSIMEND:
115  break;
116  case MID_AUTOSTART:
118  break;
119  case MID_DEMO:
120  myAppDemo = !myAppDemo;
121  break;
122  case MID_LOCATELINKS:
124  break;
125  case MID_ALLOWTEXTURES:
127  break;
128  }
129  return 1;
130 }
131 
132 
133 /****************************************************************************/
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.
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:52
Close simulation at end - Option.
Definition: GUIAppEnum.h:313
long onCmdCancel(FXObject *, FXSelector, void *)
Called on Cancel-button pressure.
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition: GUIGlobals.h:58
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
Start simulation when loaded - Option.
Definition: GUIAppEnum.h:315
bool myAppAutoStart
Information whether the simulation shall start directly after loading.
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
Cancel-button was pushed.
Definition: GUIAppEnum.h:305
Allow textures - Option.
Definition: GUIAppEnum.h:319
static void enableLocateLinks(const bool val)
switch locate links on and off
long onCmdSelect(FXObject *, FXSelector sel, void *)
Called on button change.
Ok-button was pushed.
Definition: GUIAppEnum.h:303
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.
Demo mode - Option.
Definition: GUIAppEnum.h:317
A logging window for the gui.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Locate links in messages - Option.
Definition: GUIAppEnum.h:321