Eclipse SUMO - Simulation of Urban MObility
|
Some helper functions for FOX. More...
#include <MFXUtils.h>
Static Public Member Functions | |
static FXString | assureExtension (const FXString &filename, const FXString &defaultExtension) |
Corrects missing extension. | |
static void | deleteChildren (FXWindow *w) |
Deletes all children of the given window. | |
static FXString | getDocumentName (const FXString &filename) |
Returns the document name. | |
static FXString | getFilename2Write (FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder) |
Returns the file name to write. | |
static FXColor | getFXColor (const RGBColor &col) |
converts FXColor to RGBColor | |
static RGBColor | getRGBColor (FXColor col) |
converts FXColor to RGBColor | |
static FXString | getTitleText (const FXString &appname, FXString filename="") |
Returns the title text in dependence to an optional file name. | |
static FXbool | userPermitsOverwritingWhenFileExists (FXWindow *const parent, const FXString &file) |
Returns true if either the file given by its name does not exist or the user allows overwriting it. | |
Some helper functions for FOX.
Definition at line 37 of file MFXUtils.h.
|
static |
Corrects missing extension.
At first, the extension is determined. If there is none, the given default extension is appended to the file name/path. Otherwise the file name/path remains as is. The so obtained correct file name is returned.
[in] | filename | The filename to evaluate |
[in] | defaultExtension | The default extension to use |
Definition at line 69 of file MFXUtils.cpp.
Referenced by getFilename2Write(), GUIApplicationWindow::onCmdSaveConfig(), GUIApplicationWindow::onCmdSaveState(), and GNEApplicationWindowHelper::openFileDialog().
|
static |
Deletes all children of the given window.
[in] | w | The window to delete all of his children |
Definition at line 30 of file MFXUtils.cpp.
Referenced by GUIDialog_ViewSettings::rebuildColorMatrix(), and GUIDialog_ViewSettings::rebuildScaleMatrix().
|
static |
Returns the document name.
Removes the path first. Then, returns the part before the first '.' occurrence of the so obtained string.
[in] | filename | The file name (including the path) to obtain the name of |
Definition at line 54 of file MFXUtils.cpp.
Referenced by getTitleText().
|
static |
Returns the file name to write.
A somehow complete procedure for determining the file name of a file to write. Builds a file dialog, checks whether a file was chosen, if so, checks whether it's not existing or the user allows to overwrite it etc.
Returns an empty string if the file shall not be created, the filename if it shall.
[in] | parent | The window needed to display dialogs |
[in] | header | Title of the save-dialog |
[in] | extension | The extension the file should have (must be in the form '.xxx' |
[in] | icon | The icon the dialog should have |
[in] | currentFolder | The string into which the information about the current folder shall be saved |
Definition at line 82 of file MFXUtils.cpp.
References assureExtension(), and userPermitsOverwritingWhenFileExists().
Referenced by GUIDialog_ViewSettings::onCmdExportSetting(), GUIDialog_Breakpoints::onCmdSave(), GNESelectorFrame::SelectionOperation::onCmdSave(), GUIDialog_GLChosenEditor::onCmdSave(), GUIParameterTracker::onCmdSave(), GUIDialog_EditViewport::onCmdSave(), GNEMultipleParametersDialog::ParametersOperations::onCmdSaveParameters(), GNESingleParametersDialog::ParametersOperations::onCmdSaveParameters(), GNEVTypeDistributionsDialog::ParametersOperations::onCmdSaveParameters(), GNETLSEditorFrame::TLSFile::onCmdSaveTLSProgram(), GUIDialog_ViewSettings::onCmdSaveXMLDecals(), GNEFixDemandElements::FixOptions::saveContents(), and GNEFixNetworkElements::FixOptions::saveContents().
|
static |
converts FXColor to RGBColor
Definition at line 112 of file MFXUtils.cpp.
References RGBColor::alpha(), RGBColor::blue(), RGBColor::green(), and RGBColor::red().
Referenced by GUIDialog_ViewSettings::build3DFrame(), GUIDialog_ViewSettings::buildAdditionalsFrame(), GUIDialog_ViewSettings::buildBackgroundFrame(), GUIDialog_ViewSettings::buildDemandFrame(), GUIDialog_ViewSettings::buildPersonsFrame(), GNEFrame::buildRainbow(), GUIDialog_ViewSettings::buildSelectionFrame(), GNETLSEditorFrame::TLSAttributes::clearTLSAttributes(), GNEAdditionalFrame::E2MultilaneLegendModule::E2MultilaneLegendModule(), GUIPropertySchemeStorage< T >::fill(), GNEInternalLane::getPopUpMenu(), GNELane::getPopUpMenu(), GNEPathLegendModule::GNEPathLegendModule(), GNEPlanCreatorLegend::GNEPlanCreatorLegend(), GNECrossingFrame::Information::Information(), GNEMoveFrame::Information::Information(), GNETLSEditorFrame::TLSAttributes::initTLSAttributes(), GNETLSEditorFrame::TLSAttributes::isValidOffset(), GNETLSEditorFrame::TLSAttributes::isValidParameters(), GNEConnectorFrame::Legend::Legend(), GNEProhibitionFrame::Legend::Legend(), GNETAZRelDataFrame::Legend::Legend(), GUIDialog_ViewSettings::NamePanel::NamePanel(), GUIApplicationWindow::onCmdGaming(), GUIDialog_ViewSettings::onCmdNameChange(), GNEAttributesCreatorRow::onCmdOpenColorDialog(), GNEAttributesEditorRow::onCmdOpenColorDialog(), GNETAZFrame::TAZParameters::onCmdSetColorAttribute(), GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::openColorDialog(), GUIDialog_ViewSettings::rebuildColorMatrix(), GNETLSEditorFrame::TLSAttributes::setOffset(), GNETLSEditorFrame::TLSAttributes::setParameters(), GNETAZFrame::TAZEdgesGraphic::TAZEdgesGraphic(), and GUIDialog_ViewSettings::NamePanel::update().
|
static |
converts FXColor to RGBColor
Definition at line 106 of file MFXUtils.cpp.
Referenced by GUIDialog_ViewSettings::NamePanel::getSettings(), GUIDialog_ViewSettings::onCmdColorChange(), GNEAttributesCreatorRow::onCmdOpenColorDialog(), GNEAttributesEditorRow::onCmdOpenColorDialog(), GNETAZFrame::TAZParameters::onCmdSetColorAttribute(), GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::openColorDialog(), and GUIDialog_ViewSettings::updateColorRanges().
|
static |
Returns the title text in dependence to an optional file name.
The title is computed as default on windows: The application name only if no file name is given. If a file name is given, it is used without the extension, extended by the application name.
[in] | appname | The name of the application to return the title of |
[in] | appname | The name of the file loaded by the application |
Definition at line 60 of file MFXUtils.cpp.
References getDocumentName().
Referenced by GUIApplicationWindow::closeAllWindows(), GUIApplicationWindow::dependentBuild(), GNEApplicationWindow::handleEvent_NetworkLoaded(), GUIApplicationWindow::handleEvent_SimulationLoaded(), and GNEApplicationWindow::onCmdSaveNetworkAs().
|
static |
Returns true if either the file given by its name does not exist or the user allows overwriting it.
If the named file does not exist, true is returned. Otherwise, a message box is prompted that asks whether the file may be replaced. If the user answers "yes" in this case, true is returned. In any other cases ("no"/"cancel"), false.
[in] | parent | A parent window needed to prompt the dialog box |
[in] | file | The file to check whether it may be generated |
Definition at line 39 of file MFXUtils.cpp.
Referenced by getFilename2Write(), GUISUMOViewParent::onCmdMakeSnapshot(), GNEViewParent::onCmdMakeSnapshot(), GUIApplicationWindow::onCmdSaveConfig(), GUIApplicationWindow::onCmdSaveState(), and GNEApplicationWindowHelper::openFileDialog().