56 FXMainWindow(app,
"sumo-gui main window", nullptr, nullptr, DECOR_ALL, 20, 20, 600, 400),
57 myAmFullScreen(false),
59 myGLVisual(new FXGLVisual(app, VISUAL_DOUBLEBUFFER)),
61 myListInternal(false),
63 myListTeleporting(false) {
69 app->getNormalFont()->getFontDesc(fdesc);
70 const double uiScale = app->reg().readRealEntry(
"SETTINGS",
"uiscale", 1);
71 fdesc.size = (FXushort)(fdesc.size * uiScale);
74 fdesc.weight = FXFont::Bold;
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);
176std::vector<std::string>
178 std::vector<std::string> ret;
181 ret.push_back(window->getTitle().text());
191 if (std::string(window->getTitle().text()) == id) {
202 if (window !=
nullptr) {
219std::vector<GUIGlChildWindow*>
229 myMDIClient->forallWindows(
this, FXSEL(SEL_COMMAND, msg),
nullptr);
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)) {
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) {
292 std::string clean = s;
293 for (
char& c : clean) {
294 if (c ==
',' || c ==
';' || c ==
'/' || c ==
'\t') {
299 std::vector<double> vals;
301 std::string token = st.
next();
304 double v = std::stod(token, &idx);
305 if (idx == token.size()) {
310 if (vals.size() >= 2) {
313 if (std::abs(v1) > 90.0 && std::abs(v2) <= 90.0) {
316 }
else if (std::abs(v2) > 90.0 && std::abs(v1) <= 90.0) {
323 if (lat >= -90.0 && lat <= 90.0 && lon >= -180.0 && lon <= 180.0) {
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)) {
342 x = std::stod(xMatch[1]);
343 y = std::stod(yMatch[1]);
349 std::string clean = s;
350 for (
char& c : clean) {
351 if (c ==
',' || c ==
';' || c ==
'/' || c ==
'\t') {
356 std::vector<double> vals;
358 std::string token = st.
next();
361 double v = std::stod(token, &idx);
362 if (idx == token.size()) {
367 if (vals.size() >= 2) {
431 FXTextField* tf =
dynamic_cast<FXTextField*
>(sender);
432 if (tf && tf->isEnabled()) {
433 tf->setBackColor(FXRGB(255, 255, 255));
442 FXTextField* tf =
dynamic_cast<FXTextField*
>(sender);
443 if (tf && tf->getParent()) {
444 tf->setBackColor(tf->getParent()->getBackColor());
491 throw ProcessError(
"A GUIMainWindow instance was not yet constructed.");
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) {
526 if (oc.
isSet(
"window-size") || getApp()->reg().readIntEntry(
"SETTINGS",
"maximized", 0) == 0 || oc.
isSet(
"window-pos")) {
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")) {
532 if (windowPos.size() != 2) {
544 resize(windowWidth, windowHeight);
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());
561 if (messageWindow ==
nullptr ||
myStatusbar ==
nullptr) {
564 if (messageWindow->shown()) {
565 messageWindow->hide();
568 messageWindow->show();
611 switch (FXSELID(sel)) {
618 lang =
TL(
"spanish");
622 lang =
TL(
"portuguese");
630 lang =
TL(
"italian");
634 lang =
TL(
"simplified chinese");
638 lang =
TL(
"traditional chinese");
642 lang =
TL(
"turkish");
646 lang =
TL(
"japanese");
654 lang =
TL(
"english");
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") +
668 TL(
"For the Debug build you might also need to set the LANG environment variable.") + std::string(
"\n") +
671 TL(
"Under development. You can help to improve the translation at:");
672 const std::string url =
"https://hosted.weblate.org/projects/eclipse-sumo/";
685 dialog.execute(PLACEMENT_OWNER);
687 std::string appKey = getApp()->reg().getAppKey().text();
688 if (appKey ==
"SUMO GUI") {
690 getApp()->reg().writeStringEntry(
"gui",
"language", langID.c_str());
692 FXRegistry reg(
"SUMO GUI",
"sumo-gui");
694 reg.writeStringEntry(
"gui",
"language", langID.c_str());
705 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_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
@ 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
#define GUIDesignLabelAboutInfo
label extended over frame without thick and with text justify to left
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignDialogBox
#define GUIDesignTextColorBlue
blue color (for default text)
#define GUIDesignTextColorBlack
black color (for correct text)
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
#define GUIDesignButtonDialog
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
@ 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 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
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
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.
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...
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.
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.
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,...