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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // The application-settings dialog
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
35 #include <gui/GUIGlobals.h>
36 #include "GUIDialog_AppSettings.h"
37 
38 
39 // ===========================================================================
40 // FOX callback mapping
41 // ===========================================================================
42 FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[] = {
44  FXMAPFUNC(SEL_COMMAND, MID_AUTOSTART, GUIDialog_AppSettings::onCmdSelect),
45  FXMAPFUNC(SEL_COMMAND, MID_DEMO, GUIDialog_AppSettings::onCmdSelect),
47  FXMAPFUNC(SEL_COMMAND, MID_LOCATELINKS, GUIDialog_AppSettings::onCmdSelect),
48  FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_AppSettings::onCmdOk),
50 };
51 
52 FXIMPLEMENT(GUIDialog_AppSettings, FXDialogBox, GUIDialog_AppSettingsMap, ARRAYNUMBER(GUIDialog_AppSettingsMap))
53 
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
59  : FXDialogBox(parent, "Application Settings"),
60  myAppQuitOnEnd(GUIGlobals::gQuitOnEnd),
61  myAppAutoStart(GUIGlobals::gRunAfterLoad),
62  myAppDemo(GUIGlobals::gDemoAutoReload),
63  myAllowTextures(GUITexturesHelper::texturesAllowed()),
64  myLocateLinks(GUIMessageWindow::locateLinksEnabled()) {
65  FXCheckButton* b = 0;
66  FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
67  b = new FXCheckButton(f1, "Quit on Simulation End", this, MID_QUITONSIMEND);
68  b->setCheck(myAppQuitOnEnd);
69  b = new FXCheckButton(f1, "Autostart Simulation on Load and Reload", this, MID_AUTOSTART);
70  b->setCheck(myAppAutoStart);
71  b = new FXCheckButton(f1, "Reload Simulation after finish (Demo mode)", this, MID_DEMO);
72  b->setCheck(myAppDemo);
73  b = new FXCheckButton(f1, "Locate elements when clicking on messages", this, MID_LOCATELINKS);
74  b->setCheck(myLocateLinks);
75  new FXHorizontalSeparator(f1, SEPARATOR_GROOVE | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X);
76  b = new FXCheckButton(f1, "Allow Textures", this , MID_ALLOWTEXTURES);
77  b->setCheck(myAllowTextures);
78  FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5);
79  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);
80  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);
81  initial->setFocus();
83 }
84 
85 
87 
88 
89 long
90 GUIDialog_AppSettings::onCmdOk(FXObject*, FXSelector, void*) {
97  destroy();
98  return 1;
99 }
100 
101 
102 long
103 GUIDialog_AppSettings::onCmdCancel(FXObject*, FXSelector, void*) {
104  destroy();
105  return 1;
106 }
107 
108 
109 long
110 GUIDialog_AppSettings::onCmdSelect(FXObject*, FXSelector sel, void*) {
111  switch (FXSELID(sel)) {
112  case MID_QUITONSIMEND:
114  break;
115  case MID_AUTOSTART:
117  break;
118  case MID_DEMO:
119  myAppDemo = !myAppDemo;
120  break;
121  case MID_LOCATELINKS:
123  break;
124  case MID_ALLOWTEXTURES:
126  break;
127  }
128  return 1;
129 }
130 
131 
132 /****************************************************************************/
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:51
long onCmdCancel(FXObject *, FXSelector, void *)
Called on Cancel-button pressure.
Demo mode - Option.
Definition: GUIAppEnum.h:314
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition: GUIGlobals.h:57
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
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.
Start simulation when loaded - Option.
Definition: GUIAppEnum.h:312
Ok-button was pushed.
Definition: GUIAppEnum.h:300
Close simulation at end - Option.
Definition: GUIAppEnum.h:310
Cancel-button was pushed.
Definition: GUIAppEnum.h:302
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition: GUIGlobals.h:54
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.
static void allowTextures(const bool val)
switch texture drawing on and off
Allow textures - Option.
Definition: GUIAppEnum.h:316
Locate links in messages - Option.
Definition: GUIAppEnum.h:318
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