82 #ifdef CHECK_MEMORY_LEAKS
109 FXMAPFUNC(SEL_COMMAND,
MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
145 const std::
string& configPattern)
147 myLoadThread(0), myRunThread(0),
150 myRecentNets(a, "nets"), myConfigPattern(configPattern),
151 hadDependentBuild(false) {
170 LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED);
181 myStatusbar =
new FXStatusBar(
this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X | FRAME_RAISED);
185 0, 0, 20, 0, 0, 0, 0, 0, 0, 0);
189 0, 0, 20, 0, 0, 0, 0, 0, 0, 0);
195 SPLITTER_REVERSED | SPLITTER_VERTICAL | LAYOUT_FILL_X | LAYOUT_FILL_Y | SPLITTER_TRACKING | FRAME_RAISED | FRAME_THICK);
197 LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK);
200 FXMDIClient::ID_MDI_MENUWINDOW, LAYOUT_LEFT);
202 FXMDIClient::ID_MDI_MENUCLOSE, FRAME_RAISED | LAYOUT_RIGHT);
204 FXMDIClient::ID_MDI_MENURESTORE, FRAME_RAISED | LAYOUT_RIGHT);
206 FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED | LAYOUT_RIGHT);
238 if (getApp()->reg().readIntEntry(
"SETTINGS",
"maximized", 0) == 0) {
239 setX(getApp()->reg().readIntEntry(
"SETTINGS",
"x", 150));
240 setY(getApp()->reg().readIntEntry(
"SETTINGS",
"y", 150));
241 setWidth(getApp()->reg().readIntEntry(
"SETTINGS",
"width", 600));
242 setHeight(getApp()->reg().readIntEntry(
"SETTINGS",
"height", 400));
244 gCurrentFolder = getApp()->reg().readStringEntry(
"SETTINGS",
"basedir",
"");
245 FXMainWindow::create();
255 FXint width = getApp()->getNormalFont()->getTextWidth(
"8", 1) * 24;
259 show(PLACEMENT_SCREEN);
260 if (getApp()->reg().readIntEntry(
"SETTINGS",
"maximized", 0) == 1) {
296 FXMainWindow::detach();
308 "&Open Simulation...\tCtl-O\tOpen a simulation (Configuration file).",
311 "Open &Network...\tCtl-N\tOpen a network.",
314 "&Reload\tCtl-R\tReloads the simulation / the network.",
318 "&Close\tCtl-W\tClose the simulation.",
321 FXMenuSeparator* sep1 =
new FXMenuSeparator(
myFileMenu);
323 sep1->setSelector(FXRecentFiles::ID_ANYFILES);
337 FXMenuSeparator* sep2 =
new FXMenuSeparator(
myFileMenu);
339 sep2->setSelector(FXRecentFiles::ID_ANYFILES);
355 "&Quit\tCtl-Q\tQuit the Application.",
362 "Edit Chosen...\t\tOpens a Dialog for editing the List of chosen Items.",
366 "Edit Breakpoints...\t\tOpens a Dialog for editing breakpoints.",
373 "Application Settings...\t\tOpen a Dialog for Application Settings editing.",
376 "Gaming Mode\t\tToggle gaming mode on/off.",
379 "Locate Internal Structures\t\tList internal junctions and streets in the object locator.",
386 "Show Status Line\t\tToggle this Status Bar on/off.",
389 "Show Message Window\t\tToggle the Message Window on/off.",
392 "Show Simulation Time\t\tToggle the Simulation Time on/off.",
395 "Show Simulation Delay\t\tToggle the Simulation Delay Entry on/off.",
412 sep1->setSelector(FXMDIClient::ID_MDI_ANY);
420 "Clear Message Window\t\tClear the message window.",
438 LAYOUT_DOCK_NEXT | LAYOUT_SIDE_TOP | FRAME_RAISED);
444 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
447 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
450 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
456 LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
461 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
464 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
467 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
473 LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
489 LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED | LAYOUT_FILL_Y);
495 LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_Y);
505 LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
511 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
515 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
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());
527 getApp()->reg().writeStringEntry(
"SETTINGS",
"basedir",
gCurrentFolder.text());
529 getApp()->reg().writeIntEntry(
"SETTINGS",
"maximized", 1);
531 getApp()->reg().writeIntEntry(
"SETTINGS",
"maximized", 0);
560 FXFileDialog opendialog(
this,
"Open Simulation Configuration");
562 opendialog.setSelectMode(SELECTFILE_EXISTING);
567 if (opendialog.execute()) {
569 std::string file = opendialog.getFilename().text();
580 FXFileDialog opendialog(
this,
"Open Network");
582 opendialog.setSelectMode(SELECTFILE_EXISTING);
583 opendialog.setPatternList(
"SUMO nets (*.net.xml)\nAll files (*)");
587 if (opendialog.execute()) {
589 std::string file = opendialog.getFilename().text();
599 load(
"",
false,
true);
607 myStatusbar->getStatusLine()->setText(
"Already loading!");
610 std::string file((
const char*)data);
626 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
636 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
645 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
655 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
665 myStatusbar->getStatusLine()->setText(
"No simulation loaded!");
689 myStatusbar->getStatusLine()->setText(
"No simulation loaded!");
713 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
723 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
733 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
743 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
753 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
763 d->show(PLACEMENT_OWNER);
794 GUIApplicationWindow::onCmdNewOSG(
FXObject*, FXSelector,
void*) {
806 about->show(PLACEMENT_OWNER);
812 FXEvent*
event = (FXEvent*)ptr;
814 setDNDData(FROM_CLIPBOARD, event->target,
string);
871 if (ec->
myNet != 0) {
873 std::map<int, traci::TraCIServer::CmdExecutor> execs;
888 if (ec->
myNet == 0) {
906 for (std::vector<std::string>::const_iterator it = ec->
mySettingsFiles.begin();
920 std::string settingsName = settings.
addSettings(view);
936 setTitle(
"SUMO Traffic Light Game");
950 getApp()->endWaitCursor();
990 FXMessageBox::warning(
this, MBOX_OK,
"Simulation ended",
"%s", text.c_str());
998 getApp()->beginWaitCursor();
1016 myStatusbar->getStatusLine()->setText(
"No simulation loaded!");
1020 FXuint opts = MDI_TRACKING;
1086 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
1104 myStatusbar->getStatusLine()->setText(text.c_str());
1105 myStatusbar->getStatusLine()->setNormalText(text.c_str());