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 /****************************************************************************/
16 // The application-settings dialog
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
29 #include <gui/GUIGlobals.h>
30 #include "GUIDialog_AppSettings.h"
31 
32 
33 // ===========================================================================
34 // FOX callback mapping
35 // ===========================================================================
36 FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[] = {
38  FXMAPFUNC(SEL_COMMAND, MID_AUTOSTART, GUIDialog_AppSettings::onCmdSelect),
39  FXMAPFUNC(SEL_COMMAND, MID_DEMO, GUIDialog_AppSettings::onCmdSelect),
41  FXMAPFUNC(SEL_COMMAND, MID_LOCATELINKS, GUIDialog_AppSettings::onCmdSelect),
42  FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_AppSettings::onCmdOk),
44 };
45 
46 FXIMPLEMENT(GUIDialog_AppSettings, FXDialogBox, GUIDialog_AppSettingsMap, ARRAYNUMBER(GUIDialog_AppSettingsMap))
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
53  : FXDialogBox(parent, "Application Settings"),
54  myAppQuitOnEnd(GUIGlobals::gQuitOnEnd),
55  myAppAutoStart(GUIGlobals::gRunAfterLoad),
56  myAppDemo(GUIGlobals::gDemoAutoReload),
57  myAllowTextures(GUITexturesHelper::texturesAllowed()),
58  myLocateLinks(GUIMessageWindow::locateLinksEnabled()) {
59  FXCheckButton* b = nullptr;
60  FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
61  b = new FXCheckButton(f1, "Quit on Simulation End", this, MID_QUITONSIMEND);
62  b->setCheck(myAppQuitOnEnd);
63  b = new FXCheckButton(f1, "Autostart Simulation on Load and Reload", this, MID_AUTOSTART);
64  b->setCheck(myAppAutoStart);
65  b = new FXCheckButton(f1, "Reload Simulation after finish (Demo mode)", this, MID_DEMO);
66  b->setCheck(myAppDemo);
67  b = new FXCheckButton(f1, "Locate elements when clicking on messages", this, MID_LOCATELINKS);
68  b->setCheck(myLocateLinks);
69  new FXHorizontalSeparator(f1, SEPARATOR_GROOVE | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X);
70  b = new FXCheckButton(f1, "Allow Textures", this, MID_ALLOWTEXTURES);
71  b->setCheck(myAllowTextures);
72  FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
73  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);
74  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);
75  initial->setFocus();
77 }
78 
79 
81 
82 
83 long
84 GUIDialog_AppSettings::onCmdOk(FXObject*, FXSelector, void*) {
91  destroy();
92  return 1;
93 }
94 
95 
96 long
97 GUIDialog_AppSettings::onCmdCancel(FXObject*, FXSelector, void*) {
98  destroy();
99  return 1;
100 }
101 
102 
103 long
104 GUIDialog_AppSettings::onCmdSelect(FXObject*, FXSelector sel, void*) {
105  switch (FXSELID(sel)) {
106  case MID_QUITONSIMEND:
108  break;
109  case MID_AUTOSTART:
111  break;
112  case MID_DEMO:
113  myAppDemo = !myAppDemo;
114  break;
115  case MID_LOCATELINKS:
117  break;
118  case MID_ALLOWTEXTURES:
120  break;
121  }
122  return 1;
123 }
124 
125 
126 /****************************************************************************/
bool myAllowTextures
Information whether textures may be used.
bool myAppDemo
Information whether the simulation restarts after ending (demo mode)
Demo mode - Option.
Definition: GUIAppEnum.h:465
Ok-button was pushed.
Definition: GUIAppEnum.h:451
Allow textures - Option.
Definition: GUIAppEnum.h:467
long onCmdOk(FXObject *, FXSelector, void *)
Called on OK-button pressure.
Locate links in messages - Option.
Definition: GUIAppEnum.h:469
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:45
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:51
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
bool myAppAutoStart
Information whether the simulation shall start directly after loading.
Start simulation when loaded - Option.
Definition: GUIAppEnum.h:463
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:48
static void enableLocateLinks(const bool val)
switch locate links on and off
long onCmdSelect(FXObject *, FXSelector sel, void *)
Called on button change.
Global storage for textures; manages and draws them.
Cancel-button was pushed.
Definition: GUIAppEnum.h:453
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
Close simulation at end - Option.
Definition: GUIAppEnum.h:461