59 FXMainWindow(app,
"sumo-gui main window", nullptr, nullptr, DECOR_ALL, 20, 20, 600, 400),
60 myAmFullScreen(false),
62 myGLVisual(new FXGLVisual(app, VISUAL_DOUBLEBUFFER)),
64 myListInternal(false),
66 myListTeleporting(false) {
72 app->getNormalFont()->getFontDesc(fdesc);
73 const double uiScale = app->reg().readRealEntry(
"SETTINGS",
"uiscale", 1);
74 fdesc.size = (FXushort)(fdesc.size * uiScale);
77 fdesc.weight = FXFont::Bold;
83 myTopDock =
new FXDockSite(
this, LAYOUT_SIDE_TOP | LAYOUT_FILL_X);
84 myBottomDock =
new FXDockSite(
this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X);
85 myLeftDock =
new FXDockSite(
this, LAYOUT_SIDE_LEFT | LAYOUT_FILL_Y);
86 myRightDock =
new FXDockSite(
this, LAYOUT_SIDE_RIGHT | LAYOUT_FILL_Y);
149std::vector<std::string>
151 std::vector<std::string> ret;
153 ret.push_back(window->getTitle().text());
162 if (std::string(window->getTitle().text()) == id) {
173 if (std::string(window->getTitle().text()) == id) {
192const std::vector<GUIGlChildWindow*>&
201 myMDIClient->forallWindows(
this, FXSEL(SEL_COMMAND, msg),
nullptr);
247 std::regex latRegex(R
"((?:lat(?:itude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
248 std::regex lonRegex(R"((?:lon(?:gitude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
249 std::smatch latMatch, lonMatch;
250 if (std::regex_search(s, latMatch, latRegex) && std::regex_search(s, lonMatch, lonRegex)) {
252 double l1 = std::stod(latMatch[1]);
253 double l2 = std::stod(lonMatch[1]);
254 if (l1 >= -90.0 && l1 <= 90.0 && l2 >= -180.0 && l2 <= 180.0) {
264 std::string clean = s;
265 for (
char& c : clean) {
266 if (c ==
',' || c ==
';' || c ==
'/' || c ==
'\t') {
271 std::vector<double> vals;
273 std::string token = st.
next();
276 double v = std::stod(token, &idx);
277 if (idx == token.size()) {
282 if (vals.size() >= 2) {
285 if (std::abs(v1) > 90.0 && std::abs(v2) <= 90.0) {
288 }
else if (std::abs(v2) > 90.0 && std::abs(v1) <= 90.0) {
295 if (lat >= -90.0 && lat <= 90.0 && lon >= -180.0 && lon <= 180.0) {
309 std::regex xRegex(R
"((?:x)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
310 std::regex yRegex(R"((?:y)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
311 std::smatch xMatch, yMatch;
312 if (std::regex_search(s, xMatch, xRegex) && std::regex_search(s, yMatch, yRegex)) {
314 x = std::stod(xMatch[1]);
315 y = std::stod(yMatch[1]);
321 std::string clean = s;
322 for (
char& c : clean) {
323 if (c ==
',' || c ==
';' || c ==
'/' || c ==
'\t') {
328 std::vector<double> vals;
330 std::string token = st.
next();
333 double v = std::stod(token, &idx);
334 if (idx == token.size()) {
339 if (vals.size() >= 2) {
403 FXTextField* tf =
dynamic_cast<FXTextField*
>(sender);
404 if (tf && tf->isEnabled()) {
405 tf->setBackColor(FXRGB(255, 255, 255));
414 FXTextField* tf =
dynamic_cast<FXTextField*
>(sender);
415 if (tf && tf->getParent()) {
416 tf->setBackColor(tf->getParent()->getBackColor());
463 throw ProcessError(
"A GUIMainWindow instance was not yet constructed.");
482 int windowWidth = getApp()->reg().readIntEntry(
"SETTINGS",
"width", 600);
483 int windowHeight = getApp()->reg().readIntEntry(
"SETTINGS",
"height", 400);
485 if (oc.
isSet(
"window-size")) {
486 std::vector<std::string> windowSize = oc.
getStringVector(
"window-size");
487 if (windowSize.size() != 2) {
498 if (oc.
isSet(
"window-size") || getApp()->reg().readIntEntry(
"SETTINGS",
"maximized", 0) == 0 || oc.
isSet(
"window-pos")) {
500 int x =
MAX2(0,
MIN2(getApp()->reg().readIntEntry(
"SETTINGS",
"x", 150), getApp()->getRootWindow()->getWidth() - windowWidth));
501 int y =
MAX2(50,
MIN2(getApp()->reg().readIntEntry(
"SETTINGS",
"y", 150), getApp()->getRootWindow()->getHeight() - windowHeight));
502 if (oc.
isSet(
"window-pos")) {
504 if (windowPos.size() != 2) {
516 resize(windowWidth, windowHeight);
523 getApp()->reg().writeIntEntry(
"SETTINGS",
"x", getX());
524 getApp()->reg().writeIntEntry(
"SETTINGS",
"y", getY());
525 getApp()->reg().writeIntEntry(
"SETTINGS",
"width", getWidth());
526 getApp()->reg().writeIntEntry(
"SETTINGS",
"height", getHeight());
567 switch (FXSELID(sel)) {
574 lang =
TL(
"spanish");
578 lang =
TL(
"portuguese");
586 lang =
TL(
"italian");
590 lang =
TL(
"simplified chinese");
594 lang =
TL(
"traditional chinese");
598 lang =
TL(
"turkish");
602 lang =
TL(
"japanese");
610 lang =
TL(
"english");
620 const std::string header =
TL(
"Restart needed");
621 const std::string body =
TL(
"Changing display language needs restart to take effect.") + std::string(
"\n") +
624 TL(
"For the Debug build you might also need to set the LANG environment variable.") + std::string(
"\n") +
627 TL(
"Under development. You can help to improve the translation at:") + std::string(
"\n") +
628 "https://hosted.weblate.org/projects/eclipse-sumo/";
629 FXMessageBox::information(getApp(), MBOX_OK, header.c_str(),
"%s", body.c_str());
631 std::string appKey = getApp()->reg().getAppKey().text();
632 if (appKey ==
"SUMO GUI") {
634 getApp()->reg().writeStringEntry(
"gui",
"language", langID.c_str());
636 FXRegistry reg(
"SUMO GUI",
"sumo-gui");
638 reg.writeStringEntry(
"gui",
"language", langID.c_str());
649 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
const std::vector< GUIGlChildWindow * > & getViews() const
get views
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
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
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,...