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-2024 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// ===========================================================================
40
50
51FXIMPLEMENT(GUIGlChildWindow, FXMDIChild, GUIGlChildWindowMap, ARRAYNUMBER(GUIGlChildWindowMap))
52
53// ===========================================================================
54// member method definitions
55// ===========================================================================
56
57GUIGlChildWindow::GUIGlChildWindow(FXMDIClient* p, GUIMainWindow* GUIMainWindowParent, FXMDIMenu* mdimenu,
58 const FXString& name, FXMenuBar* gripNavigationToolbar, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
59 FXMDIChild(p, name, ic, mdimenu, opts, x, y, w, h),
60 myGUIMainWindowParent(GUIMainWindowParent),
61 myGripNavigationToolbar(gripNavigationToolbar),
62 myStaticNavigationToolBar(nullptr),
63 myView(nullptr) {
64 // Make MDI Window Menu
65 setTracking();
66 // create a vertical frame to add elements
67 myChildWindowContentFrame = new FXVerticalFrame(this, GUIDesignChildWindowContentFrame);
68 // if menuBarGripElements isn't NULL, use it to create a grip navigation elements. In other cas, create a static FXToolbar
69 if (myGripNavigationToolbar == nullptr) {
70 myStaticNavigationToolBar = new FXToolBar(myChildWindowContentFrame, GUIDesignToolbarMenuBar);
71 }
72 // build the tool bars
73 buildNavigationToolBar(); // always there (recenter)
74 buildColoringToolBar(); // always there (coloring)
75 buildScreenshotToolBar(); // always there (screenshot)
76}
77
78
80 delete myLocatorPopup;
81 // only delete static navigation bar if it was created
84 }
85}
86
87
88void
90 FXMDIChild::create();
91 // only create static navigation bar if it was created
94 } else {
96 }
97 myLocatorPopup->create();
98 myView->create();
99}
100
101
104 return myView;
105}
106
107
112
113
114void
116 // build the view settings
117 // recenter view
119 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Recenter View") + std::string("\t") + TL("Recenter view to the simulated area.")).c_str(),
121 // add viewport button
123 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(),
125 // toggle button for zooming style
127 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(),
129 myZoomStyle->setChecked(getApp()->reg().readIntEntry("gui", "zoomAtCenter", 0) != 1);
130 // build the locator popup
132 // build locator button
134 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Locate Structures") + std::string("\t") + TL("Locate structures within the network.")).c_str(),
136 // add toggle button for tooltips in view on/off (by default unchecked)
138 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 // add toggle button for tooltips in menu on/off (by default checked)
144 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Toggle Menu Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the menu shall be shown.")).c_str(),
146 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry("gui", "menuToolTips", 0) != 1);
148}
149
150
151void
163
164
165void
167 // Create Vertical separator
169 // snapshot
171 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Make Snapshot") + std::string("\t") + TL("Makes a snapshot of the view.")).c_str(),
173}
174
175
176FXGLCanvas*
180
181
182FXToolBar*
186
187
188FXPopup*
192
193
198
199
204
205
206long
207GUIGlChildWindow::onCmdRecenterView(FXObject*, FXSelector, void*) {
209 myView->update();
210 return 1;
211}
212
213
214long
215GUIGlChildWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
217 return 1;
218}
219
220
221long
222GUIGlChildWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
224 return 1;
225}
226
227
228long
229GUIGlChildWindow::onCmdShowToolTipsView(FXObject*, FXSelector, void*) {
230 // toggle check
232 // enable/disable static tooltip
234 update();
235 return 1;
236}
237
238
239long
240GUIGlChildWindow::onCmdShowToolTipsMenu(FXObject*, FXSelector, void*) {
241 // toggle check
243 // enable/disable static tooltip
245 // save in registry
246 getApp()->reg().writeIntEntry("gui", "menuToolTips", myShowToolTipsMenu->amChecked() ? 0 : 1);
247 update();
248 return 1;
249}
250
251
252long
253GUIGlChildWindow::onCmdZoomStyle(FXObject*, FXSelector, void*) {
255 getApp()->reg().writeIntEntry("gui", "zoomAtCenter", myZoomStyle->amChecked() ? 0 : 1);
256 update();
257 myView->update();
258 return 1;
259}
260
261
262long
263GUIGlChildWindow::onCmdChangeColorScheme(FXObject*, FXSelector, void* ptr) {
264 myView->setColorScheme((char*) ptr);
265 return 1;
266}
267
268
269void
271 // this is used by the locator widget. zooming to bounding box
272 myView->centerTo(id, true, -1);
273 myView->update();
274}
275
276
277bool
281
282/****************************************************************************/
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition GUIAppEnum.h:389
@ MID_ZOOM_STYLE
toggle zooming style
Definition GUIAppEnum.h:391
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition GUIAppEnum.h:246
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:99
@ MID_SHOWTOOLTIPS_MENU
Show tool tips in menus - button.
Definition GUIAppEnum.h:387
@ MID_COLORSCHEMECHANGE
Change coloring scheme - combo.
Definition GUIAppEnum.h:422
@ MID_SHOWTOOLTIPS_VIEW
Show tool tips in view - button.
Definition GUIAppEnum.h:385
@ MID_RECENTERVIEW
Recenter view - button.
Definition GUIAppEnum.h:381
#define GUIDesignComboBoxStatic
Combo box static (not editable)
Definition GUIDesigns.h:296
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:311
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:123
#define GUIDesignVerticalSeparator
vertical separator
Definition GUIDesigns.h:466
#define GUIDesignComboBoxVisibleItems
Definition GUIDesigns.h:49
#define GUIDesignChildWindowContentFrame
design for the main content frame of every frame/dialog
Definition GUIDesigns.h:384
#define GUIDesignMFXCheckableButtonSquare
Definition GUIDesigns.h:137
#define GUIDesignToolbarMenuBar
Definition GUIDesigns.h:428
#define GUIDesignButtonToolbarLocator
little checkable button with icon placed in navigation toolbar used specify for Locator
Definition GUIDesigns.h:129
FXDEFMAP(GUIGlChildWindow) GUIGlChildWindowMap[]
unsigned int GUIGlID
Definition GUIGlObject.h:43
GUISelectedStorage gSelected
A global holder of selected objects.
@ EDITVIEWPORT
@ SHOWTOOLTIPS_MENU
@ SHOWTOOLTIPS_VIEW
@ RECENTERVIEW
#define TL(string)
Definition MsgHandler.h:315
#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.
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
ComboBox with icon.
void enableStaticToolTip(const bool value)
enable/disable static tooltip