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-2023 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") + TL("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 // add toggle button for tooltips in view on/off (by default unchecked)
139 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Toggle View Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the view shall be shown.")).c_str(),
143 // add toggle button for tooltips in menu on/off (by default checked)
145 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Toggle Menu Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the menu shall be shown.")).c_str(),
147 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry("gui", "menuToolTips", 0) != 1);
149}
150
151
152void
164
165
166void
168 // Create Vertical separator
170 // snapshot
172 myGUIMainWindowParent->getStaticTooltipMenu(), (std::string("\t") + TL("Make Snapshot") + std::string("\t") + TL("Makes a snapshot of the view.")).c_str(),
174}
175
176
177FXGLCanvas*
181
182
183FXToolBar*
187
188
189FXPopup*
193
194
195FXComboBox*
199
200
205
206
207long
208GUIGlChildWindow::onCmdRecenterView(FXObject*, FXSelector, void*) {
210 myView->update();
211 return 1;
212}
213
214
215long
216GUIGlChildWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
218 return 1;
219}
220
221
222long
223GUIGlChildWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
225 return 1;
226}
227
228
229long
230GUIGlChildWindow::onCmdShowToolTipsView(FXObject*, FXSelector, void*) {
231 // toggle check
233 // enable/disable static tooltip
235 update();
236 return 1;
237}
238
239
240long
241GUIGlChildWindow::onCmdShowToolTipsMenu(FXObject*, FXSelector, void*) {
242 // toggle check
244 // enable/disable static tooltip
246 // save in registry
247 getApp()->reg().writeIntEntry("gui", "menuToolTips", myShowToolTipsMenu->amChecked() ? 0 : 1);
248 update();
249 return 1;
250}
251
252
253long
254GUIGlChildWindow::onCmdZoomStyle(FXObject*, FXSelector, void*) {
256 getApp()->reg().writeIntEntry("gui", "zoomAtCenter", myZoomStyle->amChecked() ? 0 : 1);
257 update();
258 myView->update();
259 return 1;
260}
261
262
263long
264GUIGlChildWindow::onCmdChangeColorScheme(FXObject*, FXSelector, void* ptr) {
265 myView->setColorScheme((char*) ptr);
266 return 1;
267}
268
269
270void
272 // this is used by the locator widget. zooming to bounding box
273 myView->centerTo(id, true, -1);
274 myView->update();
275}
276
277
278bool
282
283/****************************************************************************/
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition GUIAppEnum.h:384
@ MID_ZOOM_STYLE
toggle zooming style
Definition GUIAppEnum.h:386
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition GUIAppEnum.h:243
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:97
@ MID_SHOWTOOLTIPS_MENU
Show tool tips in menus - button.
Definition GUIAppEnum.h:382
@ MID_SHOWTOOLTIPS_VIEW
Show tool tips in view - button.
Definition GUIAppEnum.h:380
@ MID_COLOURSCHEMECHANGE
Change coloring scheme - combo.
Definition GUIAppEnum.h:417
@ MID_RECENTERVIEW
Recenter view - button.
Definition GUIAppEnum.h:376
#define GUIDesignComboBoxStatic
Combo box static (not editable)
Definition GUIDesigns.h:291
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:306
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:118
#define GUIDesignVerticalSeparator
vertical separator
Definition GUIDesigns.h:455
#define GUIDesignChildWindowContentFrame
design for the main content frame of every frame/dialog
Definition GUIDesigns.h:379
#define GUIDesignMFXCheckableButtonSquare
Definition GUIDesigns.h:132
#define GUIDesignToolbarMenuBar
Definition GUIDesigns.h:420
#define GUIDesignButtonToolbarLocator
little checkable button with icon placed in navigation toolbar used specify for Locator
Definition GUIDesigns.h:124
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:287
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 *)
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 * 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