Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIGlChildWindow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 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
34
35#include "GUIGlChildWindow.h"
36
37
38// ===========================================================================
39// FOX callback mapping
40// ===========================================================================
41
51
52FXIMPLEMENT(GUIGlChildWindow, FXMDIChild, GUIGlChildWindowMap, ARRAYNUMBER(GUIGlChildWindowMap))
53
54// ===========================================================================
55// member method definitions
56// ===========================================================================
57
58GUIGlChildWindow::GUIGlChildWindow(FXMDIClient* p, GUIMainWindow* GUIMainWindowParent, FXMDIMenu* mdimenu,
59 const FXString& name, FXMenuBar* gripNavigationToolbar, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
60 FXMDIChild(p, name, ic, mdimenu, opts, x, y, w, h),
61 myGUIMainWindowParent(GUIMainWindowParent),
62 myGripNavigationToolbar(gripNavigationToolbar),
63 myStaticNavigationToolBar(nullptr),
64 myView(nullptr) {
65 // Make MDI Window Menu
66 setTracking();
67 // create a vertical frame to add elements
68 myChildWindowContentFrame = new FXVerticalFrame(this, GUIDesignChildWindowContentFrame);
69 // if menuBarGripElements isn't NULL, use it to create a grip navigation elements. In other cas, create a static FXToolbar
70 if (myGripNavigationToolbar == nullptr) {
71 myStaticNavigationToolBar = new FXToolBar(myChildWindowContentFrame, GUIDesignToolbarMenuBar);
72 }
73 // build the tool bars
74 buildNavigationToolBar(); // always there (recenter)
75 buildColoringToolBar(); // always there (coloring)
76 buildScreenshotToolBar(); // always there (screenshot)
77}
78
79
81 delete myLocatorPopup;
82 // only delete static navigation bar if it was created
85 }
86}
87
88
89void
91 FXMDIChild::create();
92 // only create static navigation bar if it was created
95 } else {
97 }
98 myLocatorPopup->create();
99 myView->create();
100}
101
102
105 return myView;
106}
107
108
113
114
115void
117 // build the view settings
118 // recenter view
120 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Recenter View") + std::string("\t") + TL("Recenter view to the simulated area.")).c_str(),
122 // add viewport button
124 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TLC("Labels", "Edit Viewport") + std::string("\t") + TL("Opens a menu which lets you edit the viewport. (Ctrl+I)")).c_str(),
126 // toggle button for zooming style
128 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Toggle Zooming Style") + std::string("\t") + TL("Toggles whether zooming is based at cursor position or at the center of the view.")).c_str(),
130 myZoomStyle->setChecked(getApp()->reg().readIntEntry("gui", "zoomAtCenter", 0) != 1);
131 // build the locator popup
133 // build locator button
135 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Locate Structures") + std::string("\t") + TL("Locate structures within the network.")).c_str(),
137 if (myGripNavigationToolbar != nullptr) {
138 // add toggle button for tooltips in view on/off (by default unchecked)
140 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Toggle View Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the view shall be shown.")).c_str(),
142 myShowToolTipsView->setChecked(getApp()->reg().readIntEntry("gui", "viewToolTips", 0) == 1);
144 // add toggle button for tooltips in menu on/off (by default checked)
146 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Toggle Menu Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the menu shall be shown.")).c_str(),
148 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry("gui", "menuToolTips", 0) != 1);
150 }
151}
152
153
154void
156 // Create Vertical separator
158 // build coloring tools
161 // editor
163 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Edit Coloring Schemes") + std::string("\t") + TL("Opens a menu which lets you edit the coloring schemes. (F9)")).c_str(),
165}
166
167
168void
170 // Create Vertical separator
172 // snapshot
174 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Make Snapshot") + std::string("\t") + TL("Makes a snapshot of the view.")).c_str(),
176}
177
178
179FXGLCanvas*
183
184
185FXToolBar*
189
190
191FXPopup*
195
196
201
202
207
208
213
214
215long
216GUIGlChildWindow::onCmdRecenterView(FXObject*, FXSelector, void*) {
218 myView->update();
219 return 1;
220}
221
222
223long
224GUIGlChildWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
226 return 1;
227}
228
229
230long
231GUIGlChildWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
233 return 1;
234}
235
236
237long
238GUIGlChildWindow::onCmdShowToolTipsView(FXObject*, FXSelector, void*) {
239 if (myShowToolTipsView != nullptr) {
240 // toggle check
242 // enable/disable static tooltip
244 // save in registry
245 getApp()->reg().writeIntEntry("gui", "viewToolTips", myShowToolTipsView->amChecked() ? 1 : 0);
246 update();
247 }
248 return 1;
249}
250
251
252long
253GUIGlChildWindow::onCmdShowToolTipsMenu(FXObject*, FXSelector, void*) {
254 if (myShowToolTipsMenu != nullptr) {
255 // toggle check
257 // enable/disable static tooltip
259 // save in registry
260 getApp()->reg().writeIntEntry("gui", "menuToolTips", myShowToolTipsMenu->amChecked() ? 0 : 1);
261 update();
262 }
263 return 1;
264}
265
266
267long
268GUIGlChildWindow::onCmdZoomStyle(FXObject*, FXSelector, void*) {
270 getApp()->reg().writeIntEntry("gui", "zoomAtCenter", myZoomStyle->amChecked() ? 0 : 1);
271 update();
272 myView->update();
273 return 1;
274}
275
276
277long
278GUIGlChildWindow::onCmdChangeColorScheme(FXObject*, FXSelector, void* ptr) {
279 myView->setColorScheme((char*) ptr);
280 return 1;
281}
282
283
284void
286 // this is used by the locator widget. zooming to bounding box
287 myView->centerTo(id, true, -1);
288 myView->update();
289}
290
291
292bool
296
297/****************************************************************************/
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition GUIAppEnum.h:395
@ MID_ZOOM_STYLE
toggle zooming style
Definition GUIAppEnum.h:397
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition GUIAppEnum.h:248
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:99
@ MID_SHOWTOOLTIPS_MENU
Show tool tips in menus - button.
Definition GUIAppEnum.h:393
@ MID_COLORSCHEMECHANGE
Change coloring scheme - combo.
Definition GUIAppEnum.h:428
@ MID_SHOWTOOLTIPS_VIEW
Show tool tips in view - button.
Definition GUIAppEnum.h:391
@ MID_RECENTERVIEW
Recenter view - button.
Definition GUIAppEnum.h:387
#define GUIDesignComboBoxStatic
Combo box static (not editable)
Definition GUIDesigns.h:298
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:144
#define GUIDesignVerticalSeparator
vertical separator
Definition GUIDesigns.h:497
#define GUIDesignComboBoxVisibleItems
Definition GUIDesigns.h:64
#define GUIDesignChildWindowContentFrame
design for the main content frame of every frame/dialog
Definition GUIDesigns.h:403
#define GUIDesignMFXCheckableButtonSquare
Definition GUIDesigns.h:158
#define GUIDesignToolbarMenuBar
Definition GUIDesigns.h:459
#define GUIDesignButtonToolbarLocator
little checkable button with icon placed in navigation toolbar used specify for Locator
Definition GUIDesigns.h:150
FXDEFMAP(GUIGlChildWindow) GUIGlChildWindowMap[]
unsigned int GUIGlID
Definition GUIGlObject.h:44
GUISelectedStorage gSelected
A global holder of selected objects.
@ EDITVIEWPORT
@ SHOWTOOLTIPS_MENU
@ SHOWTOOLTIPS_VIEW
@ RECENTERVIEW
#define TL(string)
Definition MsgHandler.h:304
#define TLC(context, string)
Definition Translation.h:47
MFXComboBoxIcon * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world....
GUIMainWindow * myGUIMainWindowParent
FOX needs this.
virtual void create()
create GUIGlChildWindow
long onCmdShowToolTipsView(FXObject *sender, FXSelector, void *)
MFXCheckableButton * myShowToolTipsView
menu for tooltips view
MFXCheckableButton * getShowToolTipsMenu() const
get menu for tooltips menu
GUISUMOAbstractView * myView
The view.
long onCmdChangeColorScheme(FXObject *, FXSelector sel, void *)
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.
MFXComboBoxIcon * myColoringSchemes
The coloring schemes.
long onCmdZoomStyle(FXObject *sender, FXSelector, void *)
MFXMenuButtonTooltip * myLocatorButton
The locator button.
MFXCheckableButton * getShowToolTipsView() const
get menu for tooltips view
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 * getGUIMainWindowParent()
Returns the GUIMainWindow parent.
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 *)
FXMenuBar * myGripNavigationToolbar
The grip navigation tool bar.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
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, const bool inform=false)
check or uncheck this MFXCheckableButton
void enableStaticToolTip(const bool value)
enable/disable static tooltip