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>
40#include <regex>
41#include "GUIMainWindow.h"
42#include "GUIGlChildWindow.h"
43#include "GUINewsFeed.h"
44#include "GUISUMOAbstractView.h"
45
46
47// ===========================================================================
48// static member definitions
49// ===========================================================================
51
52// ===========================================================================
53// member method definitions
54// ===========================================================================
56 FXMainWindow(app, "sumo-gui main window", nullptr, nullptr, DECOR_ALL, 20, 20, 600, 400),
57 myAmFullScreen(false),
58 myTrackerLock(true),
59 myGLVisual(new FXGLVisual(app, VISUAL_DOUBLEBUFFER)),
60 myAmGaming(false),
61 myListInternal(false),
62 myListParking(true),
63 myListTeleporting(false) {
64 // build static tooltips
67 // build bold font
68 FXFontDesc fdesc;
69 app->getNormalFont()->getFontDesc(fdesc);
70 const double uiScale = app->reg().readRealEntry("SETTINGS", "uiscale", 1);
71 fdesc.size = (FXushort)(fdesc.size * uiScale);
72 myNormalFont = new FXFont(app, fdesc);
73 app->setNormalFont(myNormalFont);
74 fdesc.weight = FXFont::Bold;
75 GUIDesignHeight = (int)(fdesc.size / 90.0 * 18) + 5;
76 myBoldFont = new FXFont(app, fdesc);
77 // https://en.wikipedia.org/wiki/Noto_fonts should be widely available
78 myFallbackFont = new FXFont(app, "Noto Sans CJK JP");
79 // build docks
80 myTopDock = new FXDockSite(this, LAYOUT_SIDE_TOP | LAYOUT_FILL_X);
81 myBottomDock = new FXDockSite(this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X);
82 myLeftDock = new FXDockSite(this, LAYOUT_SIDE_LEFT | LAYOUT_FILL_Y);
83 myRightDock = new FXDockSite(this, LAYOUT_SIDE_RIGHT | LAYOUT_FILL_Y);
84 // avoid instance Windows twice
85 if (myInstance != nullptr) {
86 throw ProcessError("MainWindow initialized twice");
87 }
88 myInstance = this;
89 //myGLVisual->setStencilSize(8); // enable stencil buffer
90}
91
92
94 delete myNewsFeed;
97 delete myNormalFont;
98 delete myBoldFont;
99 delete myFallbackFont;
100 delete myTopDock;
101 delete myBottomDock;
102 delete myLeftDock;
103 delete myRightDock;
104 myInstance = nullptr;
105}
106
107
108void
111 if (oc.exists("gui-testing") && oc.getBool("gui-testing")) {
112 return;
113 }
114 if (myNewsFeed == nullptr) {
115 myNewsFeed = new GUINewsFeed(getApp(), this, myStatusbar);
116 }
118}
119
120
121long
122GUIMainWindow::onCmdNews(FXObject*, FXSelector, void*) {
123 if (myNewsFeed == nullptr) {
124 myNewsFeed = new GUINewsFeed(getApp(), this, myStatusbar);
125 }
127 return 1;
128}
129
130
131
132void
134 FXMutexLock lock(myGLWindowsLock);
135 myGLWindows.push_back(child);
136}
137
138
139void
141 FXMutexLock lock(myGLWindowsLock);
142 std::vector<GUIGlChildWindow*>::iterator i = std::find(myGLWindows.begin(), myGLWindows.end(), child);
143 if (i != myGLWindows.end()) {
144 myGLWindows.erase(i);
145 }
146 if (myGLWindows.empty() && myAmFullScreen) {
147 // the full screen mode cannot be left without a view
148 getApp()->addChore(this, MID_HOTKEY_CTRL_F_FULSCREENMODE);
149 }
150}
151
152
153void
154GUIMainWindow::addChild(FXMainWindow* child) {
155 myTrackerLock.lock();
156 myTrackerWindows.push_back(child);
157 myTrackerLock.unlock();
158}
159
160
161void
162GUIMainWindow::removeChild(FXMainWindow* child) {
163 myTrackerLock.lock();
164 std::vector<FXMainWindow*>::iterator i = std::find(myTrackerWindows.begin(), myTrackerWindows.end(), child);
165 myTrackerWindows.erase(i);
166 myTrackerLock.unlock();
167}
168
169
170FXDockSite*
174
175
176std::vector<std::string>
178 std::vector<std::string> ret;
179 FXMutexLock lock(myGLWindowsLock);
180 for (GUIGlChildWindow* const window : myGLWindows) {
181 ret.push_back(window->getTitle().text());
182 }
183 return ret;
184}
185
186
188GUIMainWindow::getViewByID(const std::string& id) const {
189 FXMutexLock lock(myGLWindowsLock);
190 for (GUIGlChildWindow* const window : myGLWindows) {
191 if (std::string(window->getTitle().text()) == id) {
192 return window;
193 }
194 }
195 return nullptr;
196}
197
198
199void
200GUIMainWindow::removeViewByID(const std::string& id) {
201 GUIGlChildWindow* const window = getViewByID(id);
202 if (window != nullptr) {
203 window->close();
204 removeGLChild(window);
205 }
206}
207
208
209FXFont*
213
214FXFont*
218
219std::vector<GUIGlChildWindow*>
221 FXMutexLock lock(myGLWindowsLock);
222 return myGLWindows;
223}
224
225
226void
228 // inform views
229 myMDIClient->forallWindows(this, FXSEL(SEL_COMMAND, msg), nullptr);
230 // inform other windows
231 myTrackerLock.lock();
232 for (int i = 0; i < (int)myTrackerWindows.size(); i++) {
233 myTrackerWindows[i]->handle(this, FXSEL(SEL_COMMAND, msg), nullptr);
234 }
235 myTrackerLock.unlock();
236}
237
238
239FXGLVisual*
241 return myGLVisual;
242}
243
244
249
250
255
256
257FXTextField*
261
262
263FXTextField*
267
268
269bool
270GUIMainWindow::parseGeoCoordinate(const std::string& text, double& lat, double& lon) {
271 std::string s = StringUtils::to_lower_case(StringUtils::prune(text));
272 if (s.empty()) {
273 return false;
274 }
275 std::regex latRegex(R"((?:lat(?:itude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
276 std::regex lonRegex(R"((?:lon(?:gitude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
277 std::smatch latMatch, lonMatch;
278 if (std::regex_search(s, latMatch, latRegex) && std::regex_search(s, lonMatch, lonRegex)) {
279 try {
280 double l1 = std::stod(latMatch[1]);
281 double l2 = std::stod(lonMatch[1]);
282 if (l1 >= -90.0 && l1 <= 90.0 && l2 >= -180.0 && l2 <= 180.0) {
283 lat = l1;
284 lon = l2;
285 return true;
286 }
287 } catch (...) {
288 return false;
289 }
290 return false;
291 }
292 std::string clean = s;
293 for (char& c : clean) {
294 if (c == ',' || c == ';' || c == '/' || c == '\t') {
295 c = ' ';
296 }
297 }
298 StringTokenizer st(clean, " ");
299 std::vector<double> vals;
300 while (st.hasNext()) {
301 std::string token = st.next();
302 try {
303 size_t idx = 0;
304 double v = std::stod(token, &idx);
305 if (idx == token.size()) {
306 vals.push_back(v);
307 }
308 } catch (...) {}
309 }
310 if (vals.size() >= 2) {
311 double v1 = vals[0];
312 double v2 = vals[1];
313 if (std::abs(v1) > 90.0 && std::abs(v2) <= 90.0) {
314 lon = v1;
315 lat = v2;
316 } else if (std::abs(v2) > 90.0 && std::abs(v1) <= 90.0) {
317 lat = v1;
318 lon = v2;
319 } else {
320 lat = v1;
321 lon = v2;
322 }
323 if (lat >= -90.0 && lat <= 90.0 && lon >= -180.0 && lon <= 180.0) {
324 return true;
325 }
326 }
327 return false;
328}
329
330
331bool
332GUIMainWindow::parseCartesianCoordinate(const std::string& text, double& x, double& y) {
333 std::string s = StringUtils::to_lower_case(StringUtils::prune(text));
334 if (s.empty()) {
335 return false;
336 }
337 std::regex xRegex(R"((?:x)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
338 std::regex yRegex(R"((?:y)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
339 std::smatch xMatch, yMatch;
340 if (std::regex_search(s, xMatch, xRegex) && std::regex_search(s, yMatch, yRegex)) {
341 try {
342 x = std::stod(xMatch[1]);
343 y = std::stod(yMatch[1]);
344 return true;
345 } catch (...) {
346 return false;
347 }
348 }
349 std::string clean = s;
350 for (char& c : clean) {
351 if (c == ',' || c == ';' || c == '/' || c == '\t') {
352 c = ' ';
353 }
354 }
355 StringTokenizer st(clean, " ");
356 std::vector<double> vals;
357 while (st.hasNext()) {
358 std::string token = st.next();
359 try {
360 size_t idx = 0;
361 double v = std::stod(token, &idx);
362 if (idx == token.size()) {
363 vals.push_back(v);
364 }
365 } catch (...) {}
366 }
367 if (vals.size() >= 2) {
368 x = vals[0];
369 y = vals[1];
370 return true;
371 }
372 return false;
373}
374
375
376long
377GUIMainWindow::onCmdSetGeoCoordinate(FXObject*, FXSelector, void*) {
378 if (myGeoCoordinate) {
379 myGeoCoordinate->killFocus();
380 if (!GeoConvHelper::getFinal().usingGeoProjection()) {
381 setStatusBarText(TL("No projection defined"));
382 myGeoCoordinate->setText(TL("(No projection defined)"));
383 myGeoCoordinate->disable();
384 myGeoCoordinate->setEditable(false);
385 return 1;
386 }
387 const std::string text = myGeoCoordinate->getText().text();
388 double lat, lon;
389 if (parseGeoCoordinate(text, lat, lon)) {
390 Position p(lon, lat);
391 if (GeoConvHelper::getFinal().x2cartesian_const(p)) {
393 if (view) {
394 view->centerToPos(p, false);
395 view->update();
396 setStatusBarText(TLF("Centered view on %. Geo coordinates: lat %, lon %", toString(p), toString(lat, gPrecisionGeo), toString(lon, gPrecisionGeo)));
397 return 1;
398 }
399 }
400 }
401 setStatusBarText(TL("Invalid geo coordinate. Use 'lat, lon' or 'lat:... lon:...'"));
402 }
403 return 1;
404}
405
406
407long
408GUIMainWindow::onCmdSetCartesianCoordinate(FXObject*, FXSelector, void*) {
410 myCartesianCoordinate->killFocus();
411 const std::string text = myCartesianCoordinate->getText().text();
412 double x, y;
413 if (parseCartesianCoordinate(text, x, y)) {
414 Position p(x, y);
416 if (view) {
417 view->centerToPos(p, false);
418 view->update();
419 setStatusBarText(TLF("Centered view on x: %, y: %", toString(x), toString(y)));
420 return 1;
421 }
422 }
423 setStatusBarText(TL("Invalid cartesian coordinate. Use 'x, y' or 'x:... y:...'"));
424 }
425 return 1;
426}
427
428
429long
430GUIMainWindow::onCmdFocusCoordinate(FXObject* sender, FXSelector, void*) {
431 FXTextField* tf = dynamic_cast<FXTextField*>(sender);
432 if (tf && tf->isEnabled()) {
433 tf->setBackColor(FXRGB(255, 255, 255));
434 tf->selectAll();
435 }
436 return 1;
437}
438
439
440long
441GUIMainWindow::onCmdUnfocusCoordinate(FXObject* sender, FXSelector, void*) {
442 FXTextField* tf = dynamic_cast<FXTextField*>(sender);
443 if (tf && tf->getParent()) {
444 tf->setBackColor(tf->getParent()->getBackColor());
445 }
446 return 1;
447}
448
449
450FXLabel*
454
455
456FXHorizontalFrame*
460
461
462bool
464 return myAmGaming;
465}
466
467
468bool
472
473
474bool
476 return myListParking;
477}
478
479
480bool
484
485
488 if (myInstance != nullptr) {
489 return myInstance;
490 }
491 throw ProcessError("A GUIMainWindow instance was not yet constructed.");
492}
493
494
497 GUIGlChildWindow* w = dynamic_cast<GUIGlChildWindow*>(myMDIClient->getActiveChild());
498 if (w != nullptr) {
499 return w->getView();
500 }
501 if (!myGLWindows.empty()) {
502 return myGLWindows.front()->getView();
503 }
504 return nullptr;
505}
506
507
508void
510 int windowWidth = getApp()->reg().readIntEntry("SETTINGS", "width", 600);
511 int windowHeight = getApp()->reg().readIntEntry("SETTINGS", "height", 400);
513 if (oc.isSet("window-size")) {
514 std::vector<std::string> windowSize = oc.getStringVector("window-size");
515 if (windowSize.size() != 2) {
516 WRITE_ERROR(TL("option window-size requires INT,INT"));
517 } else {
518 try {
519 windowWidth = StringUtils::toInt(windowSize[0]);
520 windowHeight = StringUtils::toInt(windowSize[1]);
521 } catch (NumberFormatException& e) {
522 WRITE_ERROR("option window-size requires INT,INT " + toString(e.what()));
523 }
524 }
525 }
526 if (oc.isSet("window-size") || getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0 || oc.isSet("window-pos")) {
527 // when restoring previous pos, make sure the window fits fully onto the current screen
528 int x = MAX2(0, MIN2(getApp()->reg().readIntEntry("SETTINGS", "x", 150), getApp()->getRootWindow()->getWidth() - windowWidth));
529 int y = MAX2(50, MIN2(getApp()->reg().readIntEntry("SETTINGS", "y", 150), getApp()->getRootWindow()->getHeight() - windowHeight));
530 if (oc.isSet("window-pos")) {
531 std::vector<std::string> windowPos = oc.getStringVector("window-pos");
532 if (windowPos.size() != 2) {
533 WRITE_ERROR(TL("option window-pos requires INT,INT"));
534 } else {
535 try {
536 x = StringUtils::toInt(windowPos[0]);
537 y = StringUtils::toInt(windowPos[1]);
538 } catch (NumberFormatException& e) {
539 WRITE_ERROR("option window-pos requires INT,INT " + toString(e.what()));
540 }
541 }
542 }
543 move(x, y);
544 resize(windowWidth, windowHeight);
545 }
546}
547
548void
550 if (!myAmFullScreen) {
551 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
552 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
553 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
554 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
555 }
556}
557
558
559void
561 if (messageWindow == nullptr || myStatusbar == nullptr) {
562 return;
563 }
564 if (messageWindow->shown()) {
565 messageWindow->hide();
566 myStatusbar->hide();
567 } else {
568 messageWindow->show();
569 myStatusbar->show();
570 }
571 recalc();
572}
573
574
575void
577 myLanguageMenu = new FXMenuPane(this);
578 GUIDesigns::buildFXMenuTitle(menuBar, TL("Langua&ge"), nullptr, myLanguageMenu);
579
580 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "English", "", TL("Change language to english. (en)"),
582 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Deutsch", "", TL("Change language to german. (de)"),
584 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Español", "", TL("Change language to spanish. (es)"),
586 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Português", "", TL("Change language to portuguese. (pt)"),
588 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Français", "", TL("Change language to french. (fr)"),
590 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Italiano", "", TL("Change language to italian. (it)"),
592 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "简体中文", "", TL("简体中文 (zh)"),
594 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "繁體中文", "", TL("繁體中文 (zh-Hant)"),
596 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Türkçe", "", TL("Change language to turkish. (tr)"),
598 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "日本語", "", TL("Change language to japanese. (ja)"),
600 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "한국어", "", TL("Change language to korean. (ko)"),
602}
603
604
605long
606GUIMainWindow::onCmdChangeLanguage(FXObject*, FXSelector sel, void*) {
607 // set language
608 std::string langID;
609 std::string lang;
610 // continue depending of called button
611 switch (FXSELID(sel)) {
612 case MID_LANGUAGE_DE:
613 langID = "de";
614 lang = TL("german");
615 break;
616 case MID_LANGUAGE_ES:
617 langID = "es";
618 lang = TL("spanish");
619 break;
620 case MID_LANGUAGE_PT:
621 langID = "pt";
622 lang = TL("portuguese");
623 break;
624 case MID_LANGUAGE_FR:
625 langID = "fr";
626 lang = TL("french");
627 break;
628 case MID_LANGUAGE_IT:
629 langID = "it";
630 lang = TL("italian");
631 break;
632 case MID_LANGUAGE_ZH:
633 langID = "zh";
634 lang = TL("simplified chinese");
635 break;
636 case MID_LANGUAGE_ZHT:
637 langID = "zh-Hant";
638 lang = TL("traditional chinese");
639 break;
640 case MID_LANGUAGE_TR:
641 langID = "tr";
642 lang = TL("turkish");
643 break;
644 case MID_LANGUAGE_JA:
645 langID = "ja";
646 lang = TL("japanese");
647 break;
648 case MID_LANGUAGE_KO:
649 langID = "ko";
650 lang = TL("korean");
651 break;
652 default:
653 langID = "C";
654 lang = TL("english");
655 break;
656 }
657 // check if change language
658 if (langID != gLanguage) {
659 // update language
660 gLanguage = langID;
661 // show info
662 WRITE_MESSAGE(TL("Language changed to ") + lang);
663 // show dialog
664 const std::string header = TL("Restart needed");
665 const std::string body = TL("Changing display language needs restart to take effect.") + std::string("\n") +
666#ifdef DEBUG
667#ifdef WIN32
668 TL("For the Debug build you might also need to set the LANG environment variable.") + std::string("\n") +
669#endif
670#endif
671 TL("Under development. You can help to improve the translation at:");
672 const std::string url = "https://hosted.weblate.org/projects/eclipse-sumo/";
673 FXDialogBox dialog(this, header.c_str(), GUIDesignDialogBox);
675 FXHorizontalFrame* contentFrame = new FXHorizontalFrame(&dialog, GUIDesignHorizontalFrame);
677 FXVerticalFrame* textFrame = new FXVerticalFrame(contentFrame, GUIDesignAuxiliarFrame);
678 new FXLabel(textFrame, body.c_str(), nullptr, GUIDesignLabelAboutInfo);
679 (new MFXLinkLabel(textFrame, url.c_str(), nullptr, GUIDesignLabelAboutInfo))->setTipText(url.c_str());
680 FXHorizontalFrame* buttonFrame = new FXHorizontalFrame(&dialog, GUIDesignHorizontalFrame);
681 new FXHorizontalFrame(buttonFrame, GUIDesignAuxiliarHorizontalFrame);
682 GUIDesigns::buildFXButton(buttonFrame, TL("OK"), "", "", GUIIconSubSys::getIcon(GUIIcon::ACCEPT), &dialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonDialog);
683 new FXHorizontalFrame(buttonFrame, GUIDesignAuxiliarHorizontalFrame);
684 dialog.create();
685 dialog.execute(PLACEMENT_OWNER);
686 // update language in registry (common for sumo and netedit)
687 std::string appKey = getApp()->reg().getAppKey().text();
688 if (appKey == "SUMO GUI") {
689 // registry is written again later so we have to modify the "live" version
690 getApp()->reg().writeStringEntry("gui", "language", langID.c_str());
691 } else {
692 FXRegistry reg("SUMO GUI", "sumo-gui");
693 reg.read();
694 reg.writeStringEntry("gui", "language", langID.c_str());
695 reg.write();
696 }
697 }
698 return 1;
699}
700
701
702long
703GUIMainWindow::onUpdChangeLanguage(FXObject* obj, FXSelector, void*) {
704 // get language menu command
705 FXMenuCommand* menuCommand = dynamic_cast<FXMenuCommand*>(obj);
706 if (menuCommand) {
707 // check if change color
708 if ((gLanguage == "C") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_EN))) {
709 menuCommand->setTextColor(GUIDesignTextColorBlue);
710 } else if ((gLanguage == "de") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_DE))) {
711 menuCommand->setTextColor(GUIDesignTextColorBlue);
712 } else if ((gLanguage == "es") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ES))) {
713 menuCommand->setTextColor(GUIDesignTextColorBlue);
714 } else if ((gLanguage == "pt") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_PT))) {
715 menuCommand->setTextColor(GUIDesignTextColorBlue);
716 } else if ((gLanguage == "fr") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_FR))) {
717 menuCommand->setTextColor(GUIDesignTextColorBlue);
718 } else if ((gLanguage == "it") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_IT))) {
719 menuCommand->setTextColor(GUIDesignTextColorBlue);
720 } else if ((gLanguage == "zh") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ZH))) {
721 menuCommand->setTextColor(GUIDesignTextColorBlue);
722 } else if ((gLanguage == "zh-Hant") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ZHT))) {
723 menuCommand->setTextColor(GUIDesignTextColorBlue);
724 } else if ((gLanguage == "tr") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_TR))) {
725 menuCommand->setTextColor(GUIDesignTextColorBlue);
726 } else if ((gLanguage == "ja") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_JA))) {
727 menuCommand->setTextColor(GUIDesignTextColorBlue);
728 } else if ((gLanguage == "ko") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_KO))) {
729 menuCommand->setTextColor(GUIDesignTextColorBlue);
730 } else {
731 menuCommand->setTextColor(GUIDesignTextColorBlack);
732 }
733 }
734 return 1;
735}
736
737
738/****************************************************************************/
@ 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_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition GUIAppEnum.h:93
@ 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 GUIDesignLabelIcon
design for label with icon
Definition GUIDesigns.h:275
#define GUIDesignLabelAboutInfo
label extended over frame without thick and with text justify to left
Definition GUIDesigns.h:260
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:430
#define GUIDesignDialogBox
Definition GUIDesigns.h:630
#define GUIDesignTextColorBlue
blue color (for default text)
Definition GUIDesigns.h:41
#define GUIDesignTextColorBlack
black color (for correct text)
Definition GUIDesigns.h:38
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:409
#define GUIDesignButtonDialog
Definition GUIDesigns.h:174
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
Definition GUIDesigns.h:347
@ LANGUAGE_ZHT
@ INFORMATION_SMALL
@ INFORMATION_LARGE
@ LANGUAGE_EN
icons for languages
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:300
#define WRITE_ERROR(msg)
Definition MsgHandler.h:307
#define TL(string)
Definition MsgHandler.h:316
#define TLF(string,...)
Definition MsgHandler.h:318
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 FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
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.
void checkNews()
fetch the release news feed in the background if it was not accessed recently
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
GUINewsFeed * myNewsFeed
fetcher for the release news
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
long onCmdNews(FXObject *, FXSelector, void *)
show the latest release news (fetching them if necessary)
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.
void toggleMessageWindowAndStatusBar(FXWindow *messageWindow)
FOX need this.
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
whether to show the window in full screen mode
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list (GUIGlChildWindow)
FXDockSite * getTopDock()
get top dock
FXHorizontalFrame * getTestFrame()
get test frame
FXStatusBar * myStatusbar
The status bar.
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)
Periodically fetches an RSS feed with news about upcoming releases.
Definition GUINewsFeed.h:47
void showLatest()
shows the latest items, downloading them first if necessary
bool startCheck(const bool force=false)
starts a download if enabled, curl is available and the last access is long enough ago
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:92
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
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,...