long GUISUMOViewParent::onCmdMakeSnapshot(FXObject* sender, FXSelector, void*) { MFXCheckableButton* button = static_cast<MFXCheckableButton*>(sender); if (button->amChecked()) { myView->endSnapshot(); button->setChecked(false); return 1; } // get the new file name FXFileDialog opendialog(this, "Save Snapshot"); opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY)); opendialog.setSelectMode(SELECTFILE_ANY); opendialog.setPatternList("All Image Files (*.gif, *.bmp, *.xpm, *.pcx, *.ico, *.rgb, *.xbm, *.tga, *.png, *.jpg, *.jpeg, *.tif, *.tiff, *.ps, *.eps, *.pdf, *.svg, *.tex, *.pgf)\n" "GIF Image (*.gif)\nBMP Image (*.bmp)\nXPM Image (*.xpm)\nPCX Image (*.pcx)\nICO Image (*.ico)\n" "RGB Image (*.rgb)\nXBM Image (*.xbm)\nTARGA Image (*.tga)\nPNG Image (*.png)\n" "JPEG Image (*.jpg, *.jpeg)\nTIFF Image (*.tif, *.tiff)\n" "Postscript (*.ps)\nEncapsulated Postscript (*.eps)\nPortable Document Format (*.pdf)\n" "Scalable Vector Graphics (*.svg)\nLATEX text strings (*.tex)\nPortable LaTeX Graphics (*.pgf)\n" "All Files (*)"); if (gCurrentFolder.length() != 0) { opendialog.setDirectory(gCurrentFolder); } if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) { return 1; } gCurrentFolder = opendialog.getDirectory(); std::string file = opendialog.getFilename().text(); std::string error = myView->makeSnapshot(file); if (error == "video") { button->setChecked(!button->amChecked()); } else if (error != "") { FXMessageBox::error(this, MBOX_OK, "Saving failed.", "%s", error.c_str()); } return 1; }
void GUIGlChildWindow::buildNavigationToolBar() { myNavigationToolBar = new FXToolBar(myContentFrame, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED); // build the view settings // recenter view new FXButton(myNavigationToolBar, "\tRecenter View\tRecenter view to the simulated area.", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_RECENTERVIEW, ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); // add viewport button new FXButton(myNavigationToolBar, "\tEdit Viewport...\tOpens a menu which lets you edit the viewport.", GUIIconSubSys::getIcon(ICON_EDITVIEWPORT), this, MID_EDITVIEWPORT, ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); // toggle button for zooming style MFXCheckableButton* zoomBut = new MFXCheckableButton(false, myNavigationToolBar, "\tToggles Zooming Style\tToggles whether zooming is based at cursor position or at the center of the view.", GUIIconSubSys::getIcon(ICON_ZOOMSTYLE), this, MID_ZOOM_STYLE, BUTTON_NORMAL | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT, 0, 0, 23, 23); zoomBut->setChecked(getApp()->reg().readIntEntry("gui", "zoomAtCenter", 1) != 1); // build the locator popup myLocatorPopup = new FXPopup(myNavigationToolBar, POPUP_VERTICAL); myLocatorButton = new FXMenuButton(myNavigationToolBar, "\tLocate Structures\tLocate structures within the network.", GUIIconSubSys::getIcon(ICON_LOCATE), myLocatorPopup, MENUBUTTON_RIGHT | LAYOUT_TOP | BUTTON_TOOLBAR | FRAME_RAISED | FRAME_THICK); // add toggle button for tool-tips on/off new MFXCheckableButton(false, myNavigationToolBar, "\tToggles Tool Tips\tToggles whether tool tips shall be shown.", GUIIconSubSys::getIcon(ICON_SHOWTOOLTIPS), this, MID_SHOWTOOLTIPS, BUTTON_NORMAL | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT, 0, 0, 23, 23); }
long GUIGlChildWindow::onCmdShowToolTips(FXObject* sender, FXSelector, void*) { MFXCheckableButton* button = static_cast<MFXCheckableButton*>(sender); button->setChecked(!button->amChecked()); myView->showToolTips(button->amChecked()); update(); myView->update(); return 1; }
long GUIGlChildWindow::onCmdZoomStyle(FXObject* sender, FXSelector, void*) { MFXCheckableButton* button = static_cast<MFXCheckableButton*>(sender); button->setChecked(!button->amChecked()); getApp()->reg().writeIntEntry("gui", "zoomAtCenter", button->amChecked() ? 0 : 1); update(); myView->update(); return 1; }