53 FXMainWindow(app,
"sumo-gui main window", nullptr, nullptr, DECOR_ALL, 20, 20, 600, 400),
54 myAmFullScreen(false),
56 myGLVisual(new FXGLVisual(app, VISUAL_DOUBLEBUFFER)),
58 myListInternal(false),
60 myListTeleporting(false) {
66 app->getNormalFont()->getFontDesc(fdesc);
67 const double uiScale = app->reg().readRealEntry(
"SETTINGS",
"uiscale", 1);
68 fdesc.size = (FXushort)(fdesc.size * uiScale);
71 fdesc.weight = FXFont::Bold;
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);
145std::vector<std::string>
147 std::vector<std::string> ret;
150 ret.push_back(window->getTitle().text());
160 if (std::string(window->getTitle().text()) == id) {
171 if (window !=
nullptr) {
188std::vector<GUIGlChildWindow*>
198 myMDIClient->forallWindows(
this, FXSEL(SEL_COMMAND, msg),
nullptr);
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)) {
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) {
261 std::string clean = s;
262 for (
char& c : clean) {
263 if (c ==
',' || c ==
';' || c ==
'/' || c ==
'\t') {
268 std::vector<double> vals;
270 std::string token = st.
next();
273 double v = std::stod(token, &idx);
274 if (idx == token.size()) {
279 if (vals.size() >= 2) {
282 if (std::abs(v1) > 90.0 && std::abs(v2) <= 90.0) {
285 }
else if (std::abs(v2) > 90.0 && std::abs(v1) <= 90.0) {
292 if (lat >= -90.0 && lat <= 90.0 && lon >= -180.0 && lon <= 180.0) {
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)) {
311 x = std::stod(xMatch[1]);
312 y = std::stod(yMatch[1]);
318 std::string clean = s;
319 for (
char& c : clean) {
320 if (c ==
',' || c ==
';' || c ==
'/' || c ==
'\t') {
325 std::vector<double> vals;
327 std::string token = st.
next();
330 double v = std::stod(token, &idx);
331 if (idx == token.size()) {
336 if (vals.size() >= 2) {
400 FXTextField* tf =
dynamic_cast<FXTextField*
>(sender);
401 if (tf && tf->isEnabled()) {
402 tf->setBackColor(FXRGB(255, 255, 255));
411 FXTextField* tf =
dynamic_cast<FXTextField*
>(sender);
412 if (tf && tf->getParent()) {
413 tf->setBackColor(tf->getParent()->getBackColor());
460 throw ProcessError(
"A GUIMainWindow instance was not yet constructed.");
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) {
495 if (oc.
isSet(
"window-size") || getApp()->reg().readIntEntry(
"SETTINGS",
"maximized", 0) == 0 || oc.
isSet(
"window-pos")) {
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")) {
501 if (windowPos.size() != 2) {
513 resize(windowWidth, windowHeight);
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());
564 switch (FXSELID(sel)) {
571 lang =
TL(
"spanish");
575 lang =
TL(
"portuguese");
583 lang =
TL(
"italian");
587 lang =
TL(
"simplified chinese");
591 lang =
TL(
"traditional chinese");
595 lang =
TL(
"turkish");
599 lang =
TL(
"japanese");
607 lang =
TL(
"english");
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") +
621 TL(
"For the Debug build you might also need to set the LANG environment variable.") + std::string(
"\n") +
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());
628 std::string appKey = getApp()->reg().getAppKey().text();
629 if (appKey ==
"SUMO GUI") {
631 getApp()->reg().writeStringEntry(
"gui",
"language", langID.c_str());
633 FXRegistry reg(
"SUMO GUI",
"sumo-gui");
635 reg.writeStringEntry(
"gui",
"language", langID.c_str());
646 FXMenuCommand* menuCommand =
dynamic_cast<FXMenuCommand*
>(obj);
@ 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)
#define GUIDesignTextColorBlack
black color (for correct text)
@ LANGUAGE_EN
icons for languages
#define WRITE_MESSAGE(msg)
std::string gLanguage
the language for GUI elements and messages
int GUIDesignHeight
the default height for GUI elements
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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
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
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...
A storage for options typed value containers)
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.
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,...