![]() |
Eclipse SUMO - Simulation of Urban MObility
|
Some helper functions for FOX. More...
#include <MFXUtils.h>
Static Public Member Functions | |
static FXString | assureExtension (const FXFileDialog &openDialog) |
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 &extensions, 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 std::vector< FXString > | parseExtensions (FXString patternText) |
parse extensions | |
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] | openDialog | the opened dialog |
Definition at line 70 of file MFXUtils.cpp.
References parseExtensions().
Referenced by getFilename2Write(), GUIApplicationWindow::onCmdSaveConfig(), and GUIApplicationWindow::onCmdSaveState().
|
static |
Deletes all children of the given window.
[in] | w | The window to delete all of his children |
Definition at line 31 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 55 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 |
[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 116 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(), GNEParametersDialog::ParametersOperations::onCmdSaveParameters(), GNETLSEditorFrame::TLSFile::onCmdSaveTLSProgram(), GUIDialog_ViewSettings::onCmdSaveXMLDecals(), and GNEFixElementsDialog< T >::FixOptions::saveContents().
|
static |
converts FXColor to RGBColor
Definition at line 145 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(), GNEColorDialog::GNEColorDialog(), 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(), GNEColorDialog::onCmdReset(), GUIDialog_ViewSettings::rebuildColorMatrix(), GNEColorDialog::runInternalTest(), GNETLSEditorFrame::TLSAttributes::setOffset(), GNETLSEditorFrame::TLSAttributes::setParameters(), GNETAZFrame::TAZEdgesGraphic::TAZEdgesGraphic(), and GUIDialog_ViewSettings::NamePanel::update().
|
static |
converts FXColor to RGBColor
Definition at line 139 of file MFXUtils.cpp.
Referenced by GNEColorDialog::getColor(), GUIDialog_ViewSettings::NamePanel::getSettings(), GUIDialog_ViewSettings::onCmdColorChange(), 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 61 of file MFXUtils.cpp.
References getDocumentName().
Referenced by GUIApplicationWindow::closeAllWindows(), GUIApplicationWindow::dependentBuild(), GNEApplicationWindow::handleEvent_NetworkLoaded(), GUIApplicationWindow::handleEvent_SimulationLoaded(), and GNEApplicationWindow::onCmdSaveNetworkAs().
|
static |
parse extensions
[in] | patternText | the patternText used in dialog |
Definition at line 97 of file MFXUtils.cpp.
References StringTokenizer::getVector().
Referenced by assureExtension().
|
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 40 of file MFXUtils.cpp.
References TL.
Referenced by getFilename2Write(), GUISUMOViewParent::onCmdMakeSnapshot(), GNEViewParent::onCmdMakeSnapshot(), GUIApplicationWindow::onCmdSaveConfig(), and GUIApplicationWindow::onCmdSaveState().