Eclipse SUMO - Simulation of Urban MObility
GUIGlChildWindow.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-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20//
21/****************************************************************************/
22#include <config.h>
23
33
34#include "GUIGlChildWindow.h"
35
36
37// ===========================================================================
38// FOX callback mapping
39// ===========================================================================
40FXDEFMAP(GUIGlChildWindow) GUIGlChildWindowMap[] = {
45 FXMAPFUNC(SEL_COMMAND, MID_ZOOM_STYLE, GUIGlChildWindow::onCmdZoomStyle),
48};
49
50FXIMPLEMENT(GUIGlChildWindow, FXMDIChild, GUIGlChildWindowMap, ARRAYNUMBER(GUIGlChildWindowMap))
51
52
53// ===========================================================================
54// member method definitions
55// ===========================================================================
56GUIGlChildWindow::GUIGlChildWindow(FXMDIClient* p, GUIMainWindow* parentWindow, FXMDIMenu* mdimenu,
57 const FXString& name, FXMenuBar* gripNavigationToolbar, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
58 FXMDIChild(p, name, ic, mdimenu, opts, x, y, w, h),
59 myParent(parentWindow),
60 myGripNavigationToolbar(gripNavigationToolbar),
61 myStaticNavigationToolBar(nullptr),
62 myView(nullptr) {
63 // Make MDI Window Menu
64 setTracking();
65 // create a vertical frame to add elements
66 myChildWindowContentFrame = new FXVerticalFrame(this, GUIDesignChildWindowContentFrame);
67 // if menuBarGripElements isn't NULL, use it to create a grip navigation elements. In other cas, create a static FXToolbar
68 if (myGripNavigationToolbar == nullptr) {
69 myStaticNavigationToolBar = new FXToolBar(myChildWindowContentFrame, GUIDesignToolbarMenuBar);
70 }
71 // build the tool bars
72 buildNavigationToolBar(); // always there (recenter)
73 buildColoringToolBar(); // always there (coloring)
74 buildScreenshotToolBar(); // always there (screenshot)
75}
76
77
79 delete myLocatorPopup;
80 // only delete static navigation bar if it was created
83 }
84}
85
86
87void
89 FXMDIChild::create();
90 // only create static navigation bar if it was created
93 } else {
95 }
96 myLocatorPopup->create();
97 myView->create();
98}
99
100
103 return myView;
104}
105
106
109 return myParent;
110}
111
112
113void
115 // build the view settings
116 // recenter view
118 myParent->getStaticTooltipMenu(), "\tRecenter View\tRecenter view to the simulated area.",
120 // add viewport button
122 myParent->getStaticTooltipMenu(), "\tEdit Viewport\tOpens a menu which lets you edit the viewport. (Ctrl+I)",
124 // toggle button for zooming style
126 myParent->getStaticTooltipMenu(), "\tToggle Zooming Style\tToggles whether zooming is based at cursor position or at the center of the view.",
128 myZoomStyle->setChecked(getApp()->reg().readIntEntry("gui", "zoomAtCenter", 0) != 1);
129 // build the locator popup
131 // build locator button
133 myParent->getStaticTooltipMenu(), "\tLocate Structures\tLocate structures within the network.",
135 // add toggle button for tooltips in view on/off (by default unchecked)
137 myParent->getStaticTooltipMenu(), "\tToggle View Tooltips\tToggles whether tooltips in the view shall be shown.",
141 // add toggle button for tooltips in menu on/off (by default checked)
143 myParent->getStaticTooltipMenu(), "\tToggle Menu Tooltips\tToggles whether tooltips in the menu shall be shown.",
145 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry("gui", "menuToolTips", 0) != 1);
147}
148
149
150void
152 // Create Vertical separator
154 // build coloring tools
157 // editor
159 myParent->getStaticTooltipMenu(), "\tEdit Coloring Schemes\tOpens a menu which lets you edit the coloring schemes. (F9)",
161}
162
163
164void
166 // Create Vertical separator
168 // snapshot
170 myParent->getStaticTooltipMenu(), "\tMake Snapshot\tMakes a snapshot of the view.",
172}
173
174
175FXGLCanvas*
177 return myView;
178}
179
180
181FXToolBar*
184}
185
186
187FXPopup*
189 return myLocatorPopup;
190}
191
192
193FXComboBox*
195 return myColoringSchemes;
196}
197
198
199long
200GUIGlChildWindow::onCmdRecenterView(FXObject*, FXSelector, void*) {
202 myView->update();
203 return 1;
204}
205
206
207long
208GUIGlChildWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
210 return 1;
211}
212
213
214long
215GUIGlChildWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
217 return 1;
218}
219
220
221long
222GUIGlChildWindow::onCmdShowToolTipsView(FXObject*, FXSelector, void*) {
223 // toggle check
225 // enable/disable static tooltip
227 update();
228 return 1;
229}
230
231
232long
233GUIGlChildWindow::onCmdShowToolTipsMenu(FXObject*, FXSelector, void*) {
234 // toggle check
236 // enable/disable static tooltip
238 // save in registry
239 getApp()->reg().writeIntEntry("gui", "menuToolTips", myShowToolTipsMenu->amChecked() ? 0 : 1);
240 update();
241 return 1;
242}
243
244
245long
246GUIGlChildWindow::onCmdZoomStyle(FXObject*, FXSelector, void*) {
248 getApp()->reg().writeIntEntry("gui", "zoomAtCenter", myZoomStyle->amChecked() ? 0 : 1);
249 update();
250 myView->update();
251 return 1;
252}
253
254
255long
256GUIGlChildWindow::onCmdChangeColorScheme(FXObject*, FXSelector, void* ptr) {
257 myView->setColorScheme((char*) ptr);
258 return 1;
259}
260
261
262void
264 // this is used by the locator widget. zooming to bounding box
265 myView->centerTo(id, true, -1);
266 myView->update();
267}
268
269
270bool
272 return gSelected.isSelected(o->getType(), o->getGlID());
273}
274
275
276/****************************************************************************/
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition: GUIAppEnum.h:385
@ MID_ZOOM_STYLE
toggle zooming style
Definition: GUIAppEnum.h:387
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition: GUIAppEnum.h:205
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition: GUIAppEnum.h:91
@ MID_SHOWTOOLTIPS_MENU
Show tool tips in menus - button.
Definition: GUIAppEnum.h:383
@ MID_SHOWTOOLTIPS_VIEW
Show tool tips in view - button.
Definition: GUIAppEnum.h:381
@ MID_COLOURSCHEMECHANGE
Change coloring scheme - combo.
Definition: GUIAppEnum.h:417
@ MID_RECENTERVIEW
Recenter view - button.
Definition: GUIAppEnum.h:353
#define GUIDesignComboBoxStatic
Combo box static (not editable)
Definition: GUIDesigns.h:309
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:321
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:115
#define GUIDesignVerticalSeparator
vertical separator
Definition: GUIDesigns.h:455
#define GUIDesignChildWindowContentFrame
design for the main content frame of every frame/dialog
Definition: GUIDesigns.h:385
#define GUIDesignMFXCheckableButtonSquare
Definition: GUIDesigns.h:129
#define GUIDesignToolbarMenuBar
Definition: GUIDesigns.h:420
#define GUIDesignButtonToolbarLocator
little checkable button with icon placed in navigation toolbar used specify for Locator
Definition: GUIDesigns.h:121
FXDEFMAP(GUIGlChildWindow) GUIGlChildWindowMap[]
unsigned int GUIGlID
Definition: GUIGlObject.h:43
GUISelectedStorage gSelected
A global holder of selected objects.
@ EDITVIEWPORT
@ SHOWTOOLTIPS_MENU
@ SHOWTOOLTIPS_VIEW
@ RECENTERVIEW
virtual void create()
create GUIGlChildWindow
long onCmdShowToolTipsView(FXObject *sender, FXSelector, void *)
MFXCheckableButton * myShowToolTipsView
menu for tooltips view
GUISUMOAbstractView * myView
The view.
long onCmdChangeColorScheme(FXObject *, FXSelector sel, void *)
FXComboBox * myColoringSchemes
The coloring schemes.
long onCmdEditViewScheme(FXObject *, FXSelector, void *)
virtual ~GUIGlChildWindow()
destructor
long onCmdEditViewport(FXObject *, FXSelector, void *)
FXToolBar * getNavigationToolBar(GUISUMOAbstractView &v)
return a reference to navigation toolbar
FXPopup * myLocatorPopup
The locator menu.
void setView(GUIGlID id)
Centers the view onto the given artifact.
long onCmdZoomStyle(FXObject *sender, FXSelector, void *)
FXComboBox * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world....
MFXMenuButtonTooltip * myLocatorButton
The locator button.
void buildColoringToolBar()
build coloring toolbar
MFXCheckableButton * myZoomStyle
Zoom but.
void buildScreenshotToolBar()
build screenshot toolbar
virtual bool isSelected(GUIGlObject *o) const
true if the object is selected (may include extra logic besides calling gSelected)
long onCmdRecenterView(FXObject *, FXSelector, void *)
FXPopup * getLocatorPopup()
@ brief return a pointer to locator popup
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
GUIMainWindow * myParent
FOX needs this.
virtual FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas
MFXCheckableButton * myShowToolTipsMenu
menu for tooltips menu
FXToolBar * myStaticNavigationToolBar
The static navigation tool bar.
void buildNavigationToolBar()
build navigation toolbar
long onCmdShowToolTipsMenu(FXObject *sender, FXSelector, void *)
GUIMainWindow * getParent()
Returns the main window.
FXMenuBar * myGripNavigationToolbar
The grip navigation tool bar.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:154
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:102
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXStaticToolTip * getStaticTooltipView() const
get static toolTip for view
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
void showViewschemeEditor()
show viewsscheme editor
virtual void recenterView()
recenters the view
virtual void showViewportEditor()
show viewport editor
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
virtual bool setColorScheme(const std::string &)
set color scheme
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
bool amChecked() const
check if this MFXCheckableButton is checked
void setChecked(bool val)
check or uncheck this MFXCheckableButton
void enableStaticToolTip(const bool value)
enable/disable static tooltip