Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIMainWindow.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
24#include <string>
25#include <algorithm>
27// fx3d includes windows.h so we need to guard against macro pollution
28#include <fx3d.h>
38#include <regex>
39#include "GUIMainWindow.h"
40#include "GUIGlChildWindow.h"
41#include "GUISUMOAbstractView.h"
42
43
44// ===========================================================================
45// static member definitions
46// ===========================================================================
48
49// ===========================================================================
50// member method definitions
51// ===========================================================================
53 FXMainWindow(app, "sumo-gui main window", nullptr, nullptr, DECOR_ALL, 20, 20, 600, 400),
54 myAmFullScreen(false),
55 myTrackerLock(true),
56 myGLVisual(new FXGLVisual(app, VISUAL_DOUBLEBUFFER)),
57 myAmGaming(false),
58 myListInternal(false),
59 myListParking(true),
60 myListTeleporting(false) {
61 // build static tooltips
64 // build bold font
65 FXFontDesc fdesc;
66 app->getNormalFont()->getFontDesc(fdesc);
67 const double uiScale = app->reg().readRealEntry("SETTINGS", "uiscale", 1);
68 fdesc.size = (FXushort)(fdesc.size * uiScale);
69 myNormalFont = new FXFont(app, fdesc);
70 app->setNormalFont(myNormalFont);
71 fdesc.weight = FXFont::Bold;
72 GUIDesignHeight = (int)(fdesc.size / 90.0 * 18) + 5;
73 myBoldFont = new FXFont(app, fdesc);
74 // https://en.wikipedia.org/wiki/Noto_fonts should be widely available
75 myFallbackFont = new FXFont(app, "Noto Sans CJK JP");
76 // build docks
77 myTopDock = new FXDockSite(this, LAYOUT_SIDE_TOP | LAYOUT_FILL_X);
78 myBottomDock = new FXDockSite(this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X);
79 myLeftDock = new FXDockSite(this, LAYOUT_SIDE_LEFT | LAYOUT_FILL_Y);
80 myRightDock = new FXDockSite(this, LAYOUT_SIDE_RIGHT | LAYOUT_FILL_Y);
81 // avoid instance Windows twice
82 if (myInstance != nullptr) {
83 throw ProcessError("MainWindow initialized twice");
84 }
85 myInstance = this;
86 //myGLVisual->setStencilSize(8); // enable stencil buffer
87}
88
89
93 delete myNormalFont;
94 delete myBoldFont;
95 delete myFallbackFont;
96 delete myTopDock;
97 delete myBottomDock;
98 delete myLeftDock;
99 delete myRightDock;
100 myInstance = nullptr;
101}
102
103
104
105void
107 FXMutexLock lock(myGLWindowsLock);
108 myGLWindows.push_back(child);
109}
110
111
112void
114 FXMutexLock lock(myGLWindowsLock);
115 std::vector<GUIGlChildWindow*>::iterator i = std::find(myGLWindows.begin(), myGLWindows.end(), child);
116 if (i != myGLWindows.end()) {
117 myGLWindows.erase(i);
118 }
119}
120
121
122void
123GUIMainWindow::addChild(FXMainWindow* child) {
124 myTrackerLock.lock();
125 myTrackerWindows.push_back(child);
126 myTrackerLock.unlock();
127}
128
129
130void
131GUIMainWindow::removeChild(FXMainWindow* child) {
132 myTrackerLock.lock();
133 std::vector<FXMainWindow*>::iterator i = std::find(myTrackerWindows.begin(), myTrackerWindows.end(), child);
134 myTrackerWindows.erase(i);
135 myTrackerLock.unlock();
136}
137
138
139FXDockSite*
143
144
145std::vector<std::string>
147 std::vector<std::string> ret;
148 FXMutexLock lock(myGLWindowsLock);
149 for (GUIGlChildWindow* const window : myGLWindows) {
150 ret.push_back(window->getTitle().text());
151 }
152 return ret;
153}
154
155
157GUIMainWindow::getViewByID(const std::string& id) const {
158 FXMutexLock lock(myGLWindowsLock);
159 for (GUIGlChildWindow* const window : myGLWindows) {
160 if (std::string(window->getTitle().text()) == id) {
161 return window;
162 }
163 }
164 return nullptr;
165}
166
167
168void
169GUIMainWindow::removeViewByID(const std::string& id) {
170 GUIGlChildWindow* const window = getViewByID(id);
171 if (window != nullptr) {
172 window->close();
173 removeGLChild(window);
174 }
175}
176
177
178FXFont*
182
183FXFont*
187
188std::vector<GUIGlChildWindow*>
190 FXMutexLock lock(myGLWindowsLock);
191 return myGLWindows;
192}
193
194
195void
197 // inform views
198 myMDIClient->forallWindows(this, FXSEL(SEL_COMMAND, msg), nullptr);
199 // inform other windows
200 myTrackerLock.lock();
201 for (int i = 0; i < (int)myTrackerWindows.size(); i++) {
202 myTrackerWindows[i]->handle(this, FXSEL(SEL_COMMAND, msg), nullptr);
203 }
204 myTrackerLock.unlock();
205}
206
207
208FXGLVisual*
210 return myGLVisual;
211}
212
213
218
219
224
225
226FXTextField*
230
231
232FXTextField*
236
237
238bool
239GUIMainWindow::parseGeoCoordinate(const std::string& text, double& lat, double& lon) {
240 std::string s = StringUtils::to_lower_case(StringUtils::prune(text));
241 if (s.empty()) {
242 return false;
243 }
244 std::regex latRegex(R"((?:lat(?:itude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
245 std::regex lonRegex(R"((?:lon(?:gitude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
246 std::smatch latMatch, lonMatch;
247 if (std::regex_search(s, latMatch, latRegex) && std::regex_search(s, lonMatch, lonRegex)) {
248 try {
249 double l1 = std::stod(latMatch[1]);
250 double l2 = std::stod(lonMatch[1]);
251 if (l1 >= -90.0 && l1 <= 90.0 && l2 >= -180.0 && l2 <= 180.0) {
252 lat = l1;
253 lon = l2;
254 return true;
255 }
256 } catch (...) {
257 return false;
258 }
259 return false;
260 }
261 std::string clean = s;
262 for (char& c : clean) {
263 if (c == ',' || c == ';' || c == '/' || c == '\t') {
264 c = ' ';
265 }
266 }
267 StringTokenizer st(clean, " ");
268 std::vector<double> vals;
269 while (st.hasNext()) {
270 std::string token = st.next();
271 try {
272 size_t idx = 0;
273 double v = std::stod(token, &idx);
274 if (idx == token.size()) {
275 vals.push_back(v);
276 }
277 } catch (...) {}
278 }
279 if (vals.size() >= 2) {
280 double v1 = vals[0];
281 double v2 = vals[1];
282 if (std::abs(v1) > 90.0 && std::abs(v2) <= 90.0) {
283 lon = v1;
284 lat = v2;
285 } else if (std::abs(v2) > 90.0 && std::abs(v1) <= 90.0) {
286 lat = v1;
287 lon = v2;
288 } else {
289 lat = v1;
290 lon = v2;
291 }
292 if (lat >= -90.0 && lat <= 90.0 && lon >= -180.0 && lon <= 180.0) {
293 return true;
294 }
295 }
296 return false;
297}
298
299
300bool
301GUIMainWindow::parseCartesianCoordinate(const std::string& text, double& x, double& y) {
302 std::string s = StringUtils::to_lower_case(StringUtils::prune(text));
303 if (s.empty()) {
304 return false;
305 }
306 std::regex xRegex(R"((?:x)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
307 std::regex yRegex(R"((?:y)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
308 std::smatch xMatch, yMatch;
309 if (std::regex_search(s, xMatch, xRegex) && std::regex_search(s, yMatch, yRegex)) {
310 try {
311 x = std::stod(xMatch[1]);
312 y = std::stod(yMatch[1]);
313 return true;
314 } catch (...) {
315 return false;
316 }
317 }
318 std::string clean = s;
319 for (char& c : clean) {
320 if (c == ',' || c == ';' || c == '/' || c == '\t') {
321 c = ' ';
322 }
323 }
324 StringTokenizer st(clean, " ");
325 std::vector<double> vals;
326 while (st.hasNext()) {
327 std::string token = st.next();
328 try {
329 size_t idx = 0;
330 double v = std::stod(token, &idx);
331 if (idx == token.size()) {
332 vals.push_back(v);
333 }
334 } catch (...) {}
335 }
336 if (vals.size() >= 2) {
337 x = vals[0];
338 y = vals[1];
339 return true;
340 }
341 return false;
342}
343
344
345long
346GUIMainWindow::onCmdSetGeoCoordinate(FXObject*, FXSelector, void*) {
347 if (myGeoCoordinate) {
348 myGeoCoordinate->killFocus();
349 if (!GeoConvHelper::getFinal().usingGeoProjection()) {
350 setStatusBarText(TL("No projection defined"));
351 myGeoCoordinate->setText(TL("(No projection defined)"));
352 myGeoCoordinate->disable();
353 myGeoCoordinate->setEditable(false);
354 return 1;
355 }
356 const std::string text = myGeoCoordinate->getText().text();
357 double lat, lon;
358 if (parseGeoCoordinate(text, lat, lon)) {
359 Position p(lon, lat);
360 if (GeoConvHelper::getFinal().x2cartesian_const(p)) {
362 if (view) {
363 view->centerToPos(p, false);
364 view->update();
365 setStatusBarText(TLF("Centered view on %. Geo coordinates: lat %, lon %", toString(p), toString(lat, gPrecisionGeo), toString(lon, gPrecisionGeo)));
366 return 1;
367 }
368 }
369 }
370 setStatusBarText(TL("Invalid geo coordinate. Use 'lat, lon' or 'lat:... lon:...'"));
371 }
372 return 1;
373}
374
375
376long
377GUIMainWindow::onCmdSetCartesianCoordinate(FXObject*, FXSelector, void*) {
379 myCartesianCoordinate->killFocus();
380 const std::string text = myCartesianCoordinate->getText().text();
381 double x, y;
382 if (parseCartesianCoordinate(text, x, y)) {
383 Position p(x, y);
385 if (view) {
386 view->centerToPos(p, false);
387 view->update();
388 setStatusBarText(TLF("Centered view on x: %, y: %", toString(x), toString(y)));
389 return 1;
390 }
391 }
392 setStatusBarText(TL("Invalid cartesian coordinate. Use 'x, y' or 'x:... y:...'"));
393 }
394 return 1;
395}
396
397
398long
399GUIMainWindow::onCmdFocusCoordinate(FXObject* sender, FXSelector, void*) {
400 FXTextField* tf = dynamic_cast<FXTextField*>(sender);
401 if (tf && tf->isEnabled()) {
402 tf->setBackColor(FXRGB(255, 255, 255));
403 tf->selectAll();
404 }
405 return 1;
406}
407
408
409long
410GUIMainWindow::onCmdUnfocusCoordinate(FXObject* sender, FXSelector, void*) {
411 FXTextField* tf = dynamic_cast<FXTextField*>(sender);
412 if (tf && tf->getParent()) {
413 tf->setBackColor(tf->getParent()->getBackColor());
414 }
415 return 1;
416}
417
418
419FXLabel*
423
424
425FXHorizontalFrame*
429
430
431bool
433 return myAmGaming;
434}
435
436
437bool
441
442
443bool
445 return myListParking;
446}
447
448
449bool
453
454
457 if (myInstance != nullptr) {
458 return myInstance;
459 }
460 throw ProcessError("A GUIMainWindow instance was not yet constructed.");
461}
462
463
466 GUIGlChildWindow* w = dynamic_cast<GUIGlChildWindow*>(myMDIClient->getActiveChild());
467 if (w != nullptr) {
468 return w->getView();
469 }
470 if (!myGLWindows.empty()) {
471 return myGLWindows.front()->getView();
472 }
473 return nullptr;
474}
475
476
477void
479 int windowWidth = getApp()->reg().readIntEntry("SETTINGS", "width", 600);
480 int windowHeight = getApp()->reg().readIntEntry("SETTINGS", "height", 400);
482 if (oc.isSet("window-size")) {
483 std::vector<std::string> windowSize = oc.getStringVector("window-size");
484 if (windowSize.size() != 2) {
485 WRITE_ERROR(TL("option window-size requires INT,INT"));
486 } else {
487 try {
488 windowWidth = StringUtils::toInt(windowSize[0]);
489 windowHeight = StringUtils::toInt(windowSize[1]);
490 } catch (NumberFormatException& e) {
491 WRITE_ERROR("option window-size requires INT,INT " + toString(e.what()));
492 }
493 }
494 }
495 if (oc.isSet("window-size") || getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0 || oc.isSet("window-pos")) {
496 // when restoring previous pos, make sure the window fits fully onto the current screen
497 int x = MAX2(0, MIN2(getApp()->reg().readIntEntry("SETTINGS", "x", 150), getApp()->getRootWindow()->getWidth() - windowWidth));
498 int y = MAX2(50, MIN2(getApp()->reg().readIntEntry("SETTINGS", "y", 150), getApp()->getRootWindow()->getHeight() - windowHeight));
499 if (oc.isSet("window-pos")) {
500 std::vector<std::string> windowPos = oc.getStringVector("window-pos");
501 if (windowPos.size() != 2) {
502 WRITE_ERROR(TL("option window-pos requires INT,INT"));
503 } else {
504 try {
505 x = StringUtils::toInt(windowPos[0]);
506 y = StringUtils::toInt(windowPos[1]);
507 } catch (NumberFormatException& e) {
508 WRITE_ERROR("option window-pos requires INT,INT " + toString(e.what()));
509 }
510 }
511 }
512 move(x, y);
513 resize(windowWidth, windowHeight);
514 }
515}
516
517void
519 if (!myAmFullScreen) {
520 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
521 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
522 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
523 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
524 }
525}
526
527
528void
530 myLanguageMenu = new FXMenuPane(this);
531 GUIDesigns::buildFXMenuTitle(menuBar, TL("Langua&ge"), nullptr, myLanguageMenu);
532
533 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "English", "", TL("Change language to english. (en)"),
535 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Deutsch", "", TL("Change language to german. (de)"),
537 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Español", "", TL("Change language to spanish. (es)"),
539 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Português", "", TL("Change language to portuguese. (pt)"),
541 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Français", "", TL("Change language to french. (fr)"),
543 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Italiano", "", TL("Change language to italian. (it)"),
545 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "简体中文", "", TL("简体中文 (zh)"),
547 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "繁體中文", "", TL("繁體中文 (zh-Hant)"),
549 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Türkçe", "", TL("Change language to turkish. (tr)"),
551 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "日本語", "", TL("Change language to japanese. (ja)"),
553 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "한국어", "", TL("Change language to korean. (ko)"),
555}
556
557
558long
559GUIMainWindow::onCmdChangeLanguage(FXObject*, FXSelector sel, void*) {
560 // set language
561 std::string langID;
562 std::string lang;
563 // continue depending of called button
564 switch (FXSELID(sel)) {
565 case MID_LANGUAGE_DE:
566 langID = "de";
567 lang = TL("german");
568 break;
569 case MID_LANGUAGE_ES:
570 langID = "es";
571 lang = TL("spanish");
572 break;
573 case MID_LANGUAGE_PT:
574 langID = "pt";
575 lang = TL("portuguese");
576 break;
577 case MID_LANGUAGE_FR:
578 langID = "fr";
579 lang = TL("french");
580 break;
581 case MID_LANGUAGE_IT:
582 langID = "it";
583 lang = TL("italian");
584 break;
585 case MID_LANGUAGE_ZH:
586 langID = "zh";
587 lang = TL("simplified chinese");
588 break;
589 case MID_LANGUAGE_ZHT:
590 langID = "zh-Hant";
591 lang = TL("traditional chinese");
592 break;
593 case MID_LANGUAGE_TR:
594 langID = "tr";
595 lang = TL("turkish");
596 break;
597 case MID_LANGUAGE_JA:
598 langID = "ja";
599 lang = TL("japanese");
600 break;
601 case MID_LANGUAGE_KO:
602 langID = "ko";
603 lang = TL("korean");
604 break;
605 default:
606 langID = "C";
607 lang = TL("english");
608 break;
609 }
610 // check if change language
611 if (langID != gLanguage) {
612 // update language
613 gLanguage = langID;
614 // show info
615 WRITE_MESSAGE(TL("Language changed to ") + lang);
616 // show dialog
617 const std::string header = TL("Restart needed");
618 const std::string body = TL("Changing display language needs restart to take effect.") + std::string("\n") +
619#ifdef DEBUG
620#ifdef WIN32
621 TL("For the Debug build you might also need to set the LANG environment variable.") + std::string("\n") +
622#endif
623#endif
624 TL("Under development. You can help to improve the translation at:") + std::string("\n") +
625 "https://hosted.weblate.org/projects/eclipse-sumo/";
626 FXMessageBox::information(getApp(), MBOX_OK, header.c_str(), "%s", body.c_str());
627 // update language in registry (common for sumo and netedit)
628 std::string appKey = getApp()->reg().getAppKey().text();
629 if (appKey == "SUMO GUI") {
630 // registry is written again later so we have to modify the "live" version
631 getApp()->reg().writeStringEntry("gui", "language", langID.c_str());
632 } else {
633 FXRegistry reg("SUMO GUI", "sumo-gui");
634 reg.read();
635 reg.writeStringEntry("gui", "language", langID.c_str());
636 reg.write();
637 }
638 }
639 return 1;
640}
641
642
643long
644GUIMainWindow::onUpdChangeLanguage(FXObject* obj, FXSelector, void*) {
645 // get language menu command
646 FXMenuCommand* menuCommand = dynamic_cast<FXMenuCommand*>(obj);
647 if (menuCommand) {
648 // check if change color
649 if ((gLanguage == "C") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_EN))) {
650 menuCommand->setTextColor(GUIDesignTextColorBlue);
651 } else if ((gLanguage == "de") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_DE))) {
652 menuCommand->setTextColor(GUIDesignTextColorBlue);
653 } else if ((gLanguage == "es") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ES))) {
654 menuCommand->setTextColor(GUIDesignTextColorBlue);
655 } else if ((gLanguage == "pt") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_PT))) {
656 menuCommand->setTextColor(GUIDesignTextColorBlue);
657 } else if ((gLanguage == "fr") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_FR))) {
658 menuCommand->setTextColor(GUIDesignTextColorBlue);
659 } else if ((gLanguage == "it") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_IT))) {
660 menuCommand->setTextColor(GUIDesignTextColorBlue);
661 } else if ((gLanguage == "zh") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ZH))) {
662 menuCommand->setTextColor(GUIDesignTextColorBlue);
663 } else if ((gLanguage == "zh-Hant") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ZHT))) {
664 menuCommand->setTextColor(GUIDesignTextColorBlue);
665 } else if ((gLanguage == "tr") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_TR))) {
666 menuCommand->setTextColor(GUIDesignTextColorBlue);
667 } else if ((gLanguage == "ja") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_JA))) {
668 menuCommand->setTextColor(GUIDesignTextColorBlue);
669 } else if ((gLanguage == "ko") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_KO))) {
670 menuCommand->setTextColor(GUIDesignTextColorBlue);
671 } else {
672 menuCommand->setTextColor(GUIDesignTextColorBlack);
673 }
674 }
675 return 1;
676}
677
678
679/****************************************************************************/
@ MID_LANGUAGE_PT
change language to portuguese
@ MID_LANGUAGE_TR
change language to turkish
@ MID_LANGUAGE_ZHT
change language to chinese (traditional)
@ MID_LANGUAGE_ES
change language to spanish
@ MID_LANGUAGE_IT
change language to italian
@ MID_LANGUAGE_EN
change language to english
@ MID_LANGUAGE_DE
change language to german
@ MID_LANGUAGE_JA
change language to japanese
@ MID_LANGUAGE_ZH
change language to chinese (simplified)
@ MID_LANGUAGE_FR
change language to french
@ MID_LANGUAGE_KO
change language to korean
#define GUIDesignTextColorBlue
blue color (for default text)
Definition GUIDesigns.h:41
#define GUIDesignTextColorBlack
black color (for correct text)
Definition GUIDesigns.h:38
@ LANGUAGE_ZHT
@ LANGUAGE_EN
icons for languages
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:288
#define WRITE_ERROR(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
std::string gLanguage
the language for GUI elements and messages
Definition StdDefs.cpp:39
int gPrecisionGeo
Definition StdDefs.cpp:29
int GUIDesignHeight
the default height for GUI elements
Definition StdDefs.cpp:41
T MIN2(T a, T b)
Definition StdDefs.h:80
T MAX2(T a, T b)
Definition StdDefs.h:86
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
static FXMenuCommand * buildFXMenuCommandShortcut(FXComposite *p, const std::string &text, const std::string &shortcut, const std::string &info, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
bool myListParking
information whether the locator should list parking vehicles
static GUIMainWindow * myInstance
the singleton window instance
FXTextField * getGeoLabel()
get geo coordinate field
virtual ~GUIMainWindow()
destructor
FXDockSite * myRightDock
void removeViewByID(const std::string &id)
long onCmdUnfocusCoordinate(FXObject *, FXSelector, void *)
called when a coordinate field in the status bar loses focus
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXTextField * getCartesianLabel()
get cartesian coordinate field
MFXStaticToolTip * getStaticTooltipView() const
get static toolTip for view
FXFont * myFallbackFont
Fallback font for extended characters support.
std::vector< std::string > getViewIDs() const
get view IDs
std::vector< GUIGlChildWindow * > getViews() const
get (a copy of the list of) views
FXMenuPane * myLanguageMenu
Language menu common to all applications.
GUISUMOAbstractView * getActiveView() const
get the active view or 0
long onCmdSetGeoCoordinate(FXObject *, FXSelector, void *)
called when user enters a geo coordinate in the status bar
bool isGaming() const
return whether the gui is in gaming mode
bool myListTeleporting
information whether the locator should list teleporting vehicles
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
long onCmdSetCartesianCoordinate(FXObject *, FXSelector, void *)
called when user enters a cartesian coordinate in the status bar
FXFont * getBoldFont()
get bold front
FXDockSite * myLeftDock
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
bool listTeleporting() const
return whether to list teleporting vehicles
FXLabel * getTestLabel()
get test label
MFXStaticToolTip * myStaticTooltipView
static toolTip used in view
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
FXFont * myBoldFont
Font used for popup-menu titles.
virtual void setStatusBarText(const std::string &)
get status bar text (can be implemented in children)
static GUIMainWindow * getInstance()
get instance
bool listParking() const
return whether to list parking vehicles
FXTextField * myCartesianCoordinate
Coordinate fields for the current cartesian, geo-coordinate and test coordinates.
FXDockSite * myBottomDock
bool listInternal() const
return whether to list internal structures
FXHorizontalFrame * myTestFrame
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list (GUIGlChildWindow)
FXLabel * myTestCoordinate
FXFont * myNormalFont
default Font (after scaling)
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
FXMutex myGLWindowsLock
A lock to make the access to the GLWindows thread safe (they are also accessed by the simulation thre...
void storeWindowSizeAndPos()
record window position and size in registry
long onCmdFocusCoordinate(FXObject *, FXSelector, void *)
called when user focuses a coordinate field in the status bar
FXGLVisual * getGLVisual() const
get GL Visual
bool myAmFullScreen
FOX need this.
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list (GUIGlChildWindow)
FXDockSite * getTopDock()
get top dock
FXHorizontalFrame * getTestFrame()
get test frame
FXFont * getFallbackFont()
get fallback front
static bool parseCartesianCoordinate(const std::string &text, double &x, double &y)
parse cartesian coordinate string ("x, y" or "x:... y:...")
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXTextField * myGeoCoordinate
FXGLVisual * myGLVisual
The gl-visual used.
static bool parseGeoCoordinate(const std::string &text, double &lat, double &lon)
parse geo coordinate string ("lat, lon" or "lat:... lon:...")
bool myAmGaming
information whether the gui is currently in gaming mode
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
GUIMainWindow(FXApp *app)
constructor
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)
virtual void centerToPos(const Position &pos, bool applyZoom, double zoomDist=20)
centers to the chosen position
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
MFXStaticToolTip (based on FXToolTip)
A storage for options typed value containers)
Definition OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...