Eclipse SUMO - Simulation of Urban MObility
GUIDialog_AppSettings.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The application-settings dialog
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
28 #include <gui/GUIGlobals.h>
29 #include "GUIDialog_AppSettings.h"
30 
31 
32 // ===========================================================================
33 // FOX callback mapping
34 // ===========================================================================
35 FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[] = {
37  FXMAPFUNC(SEL_COMMAND, MID_AUTOSTART, GUIDialog_AppSettings::onCmdSelect),
38  FXMAPFUNC(SEL_COMMAND, MID_DEMO, GUIDialog_AppSettings::onCmdSelect),
40  FXMAPFUNC(SEL_COMMAND, MID_LOCATELINKS, GUIDialog_AppSettings::onCmdSelect),
41  FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_AppSettings::onCmdOk),
43 };
44 
45 FXIMPLEMENT(GUIDialog_AppSettings, FXDialogBox, GUIDialog_AppSettingsMap, ARRAYNUMBER(GUIDialog_AppSettingsMap))
46 
47 
48 // ===========================================================================
49 // method definitions
50 // ===========================================================================
52  : FXDialogBox(parent, "Application Settings"),
53  myAppQuitOnEnd(GUIGlobals::gQuitOnEnd),
54  myAppAutoStart(GUIGlobals::gRunAfterLoad),
55  myAppDemo(GUIGlobals::gDemoAutoReload),
56  myAllowTextures(GUITexturesHelper::texturesAllowed()),
57  myLocateLinks(GUIMessageWindow::locateLinksEnabled()) {
58  FXCheckButton* b = nullptr;
59  FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
60  b = new FXCheckButton(f1, "Quit on Simulation End", this, MID_QUITONSIMEND);
61  b->setCheck(myAppQuitOnEnd);
62  b = new FXCheckButton(f1, "Autostart Simulation on Load and Reload", this, MID_AUTOSTART);
63  b->setCheck(myAppAutoStart);
64  b = new FXCheckButton(f1, "Reload Simulation after finish (Demo mode)", this, MID_DEMO);
65  b->setCheck(myAppDemo);
66  b = new FXCheckButton(f1, "Locate elements when clicking on messages", this, MID_LOCATELINKS);
67  b->setCheck(myLocateLinks);
68  new FXHorizontalSeparator(f1, SEPARATOR_GROOVE | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X);
69  b = new FXCheckButton(f1, "Allow Textures", this, MID_ALLOWTEXTURES);
70  b->setCheck(myAllowTextures);
71  FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
72  FXButton* initial = new FXButton(f2, "&OK", nullptr, 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);
73  new FXButton(f2, "&Cancel", nullptr, 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);
74  initial->setFocus();
76 }
77 
78 
80 
81 
82 long
83 GUIDialog_AppSettings::onCmdOk(FXObject*, FXSelector, void*) {
90  destroy();
91  return 1;
92 }
93 
94 
95 long
96 GUIDialog_AppSettings::onCmdCancel(FXObject*, FXSelector, void*) {
97  destroy();
98  return 1;
99 }
100 
101 
102 long
103 GUIDialog_AppSettings::onCmdSelect(FXObject*, FXSelector sel, void*) {
104  switch (FXSELID(sel)) {
105  case MID_QUITONSIMEND:
107  break;
108  case MID_AUTOSTART:
110  break;
111  case MID_DEMO:
112  myAppDemo = !myAppDemo;
113  break;
114  case MID_LOCATELINKS:
116  break;
117  case MID_ALLOWTEXTURES:
119  break;
120  }
121  return 1;
122 }
123 
124 
125 /****************************************************************************/
MID_SETTINGS_CANCEL
Cancel-button was pushed.
Definition: GUIAppEnum.h:468
GUIDialog_AppSettings::myAppQuitOnEnd
bool myAppQuitOnEnd
Information whether the application shall be quit.
Definition: GUIDialog_AppSettings.h:68
GUIDialog_AppSettings::myAppAutoStart
bool myAppAutoStart
Information whether the simulation shall start directly after loading.
Definition: GUIDialog_AppSettings.h:71
GUIMessageWindow
A logging window for the gui.
Definition: GUIMessageWindow.h:53
ICON_EMPTY
Definition: GUIIcons.h:41
GUIIconSubSys::getIcon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition: GUIIconSubSys.cpp:609
GUIAppEnum.h
GUIDialog_AppSettings::onCmdSelect
long onCmdSelect(FXObject *, FXSelector sel, void *)
Called on button change.
Definition: GUIDialog_AppSettings.cpp:103
GUIDialog_AppSettings::myLocateLinks
bool myLocateLinks
Information whether locate links appear in messages.
Definition: GUIDialog_AppSettings.h:80
GUIDialog_AppSettings::~GUIDialog_AppSettings
~GUIDialog_AppSettings()
Destructor.
Definition: GUIDialog_AppSettings.cpp:79
GUITexturesHelper.h
MID_QUITONSIMEND
Close simulation at end - Option.
Definition: GUIAppEnum.h:476
GUIGlobals.h
GUIGlobals
Definition: GUIGlobals.h:41
GUIDialog_AppSettings.h
GUIDialog_AppSettings::myAppDemo
bool myAppDemo
Information whether the simulation restarts after ending (demo mode)
Definition: GUIDialog_AppSettings.h:74
GUIDialog_AppSettings
The dialog to change the application (gui) settings.
Definition: GUIDialog_AppSettings.h:36
GUITexturesHelper::allowTextures
static void allowTextures(const bool val)
switch texture drawing on and off
Definition: GUITexturesHelper.h:61
GUIGlobals::gQuitOnEnd
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition: GUIGlobals.h:47
GUIDialog_AppSettings::myAllowTextures
bool myAllowTextures
Information whether textures may be used.
Definition: GUIDialog_AppSettings.h:77
GUIDialog_AppSettings::onCmdOk
long onCmdOk(FXObject *, FXSelector, void *)
Called on OK-button pressure.
Definition: GUIDialog_AppSettings.cpp:83
MID_ALLOWTEXTURES
Allow textures - Option.
Definition: GUIAppEnum.h:482
MID_AUTOSTART
Start simulation when loaded - Option.
Definition: GUIAppEnum.h:478
GUIMessageWindow.h
GUIIconSubSys.h
GUIMessageWindow::enableLocateLinks
static void enableLocateLinks(const bool val)
switch locate links on and off
Definition: GUIMessageWindow.h:90
MID_DEMO
Demo mode - Option.
Definition: GUIAppEnum.h:480
MID_SETTINGS_OK
Ok-button was pushed.
Definition: GUIAppEnum.h:466
GUIGlobals::gDemoAutoReload
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition: GUIGlobals.h:50
config.h
GUIDialog_AppSettings::onCmdCancel
long onCmdCancel(FXObject *, FXSelector, void *)
Called on Cancel-button pressure.
Definition: GUIDialog_AppSettings.cpp:96
GUIGlobals::gRunAfterLoad
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:44
MID_LOCATELINKS
Locate links in messages - Option.
Definition: GUIAppEnum.h:484
FXDEFMAP
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
GUITexturesHelper
Global storage for textures; manages and draws them.
Definition: GUITexturesHelper.h:38