32#include <xercesc/parsers/SAXParser.hpp>
39#define TREELISTWIDTH 200
59FXIMPLEMENT(
GNEOptionsDialog, FXDialogBox, GUIDialogOptionsMap, ARRAYNUMBER(GUIDialogOptionsMap))
68 auto result = std::make_pair(optionsDialog->execute(), optionsDialog->
myOptionsModified);
77 auto result = std::make_pair(optionsDialog->execute(), optionsDialog->
myOptionsModified);
90 entry->onCmdResetOption(
nullptr, 0,
nullptr);
93 return handle(
this, FXSEL(SEL_COMMAND, ID_CANCEL),
nullptr);
101 entry->onCmdResetOption(
nullptr, 0,
nullptr);
110 handle(
this, FXSEL(SEL_COMMAND, ID_ACCEPT),
nullptr);
159 if (file.size() > 0) {
176 entry->updateOption();
187 entry->restoreOption();
196 myOriginalOptionsContainer(
OptionsCont::EMPTY_OPTIONS) {
204 if (treeItemTopic.first->isSelected()) {
207 if (entry->getTopic() == treeItemTopic.second) {
234 if (searchText.empty()) {
237 }
else if (entry->getNameLower().find(searchText) != std::string::npos) {
240 (entry->getDescriptionLower().find(searchText) != std::string::npos)) {
256 XERCES_CPP_NAMESPACE::SAXParser parser;
257 parser.setValidationScheme(XERCES_CPP_NAMESPACE::SAXParser::Val_Never);
258 parser.setDisableDefaultEntityResolution(
true);
262 parser.setDocumentHandler(&handler);
263 parser.setErrorHandler(&handler);
266 WRITE_ERROR(
TL(
"Could not load configuration '") + file +
"'.");
269 }
catch (
const XERCES_CPP_NAMESPACE::XMLException& e) {
280 const OptionsCont& originalOptionsContainer,
const char* titleName,
const bool runDialog) :
283 myOptionsContainer(optionsContainer),
284 myOriginalOptionsContainer(originalOptionsContainer) {
292 myGNEApp->
getStaticTooltipMenu(), (std::string(
"\t") +
TL(
"Toggle Menu Tooltips") + std::string(
"\t") +
TL(
"Toggles whether tooltips in the menu shall be shown.")).c_str(),
296 saveFile->setTipText(
TL(
"Save configuration file"));
299 loadFile->setTipText(
TL(
"Load configuration file"));
302 resetDefault->setTipText(
TL(
"Reset all options to default"));
304 new FXSeparator(contentFrame);
319 FXScrollWindow* scrollTabEntries =
new FXScrollWindow(groupBoxOptions->
getCollapsableFrame(), LAYOUT_FILL_X | LAYOUT_FILL_Y);
330 for (
const auto& entry : entries) {
342 }
else if (type ==
"TIME") {
344 }
else if ((type ==
"FILE") || (type ==
"NETWORK") || (type ==
"ADDITIONAL") || (type ==
"ROUTE") || (type ==
"DATA")) {
346 }
else if (type ==
"BOOL") {
348 }
else if (type ==
"INT") {
350 }
else if (type ==
"FLOAT") {
352 }
else if (type ==
"INT[]") {
354 }
else if (type ==
"STR[]") {
368 new FXSeparator(contentFrame);
385 entry->adjustNameSize();
FXDEFMAP(GNEOptionsDialog) GUIDialogOptionsMap[]
@ MID_GNE_RUNNETGENERATE
run netgenerate tool
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CANCEL
Cancel-button pressed.
@ MID_CHOOSEN_SAVE
Save set.
@ MID_SHOWTOOLTIPS_MENU
Show tool tips in menus - button.
@ MID_GNE_SEARCH_USEDESCRIPTION
use search description
@ MID_GNE_BUTTON_DEFAULT
default button
@ MID_CHOOSEN_LOAD
Load set.
@ MID_GNE_SELECT
select element
@ MID_GNE_RESET
reset element
@ MID_MTEXTFIELDSEARCH_UPDATED
callback for MFXTextFieldSearch
#define GUIDesignCheckButtonThick
checkButton placed in left position
#define GUIDesignContentsFrame
design for the main content frame of every frame/dialog with padding and spacing
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignButtonConfiguration
Configuration Button.
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignTreeListFixedWidth
#define GUIDesignButtonOK
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignMFXCheckableButtonSquare
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
#define GUIDesignHorizontalFrameNoPadding
Horizontal frame extended over frame parent without padding and spacing.
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
#define GUIDesignDialogBoxExplicitStretchable(width, height)
design for dialog box with specific width and height that can be stretched (But not shrunk)
GUIIcon
An enumeration of icons used by the gui applications.
#define WRITE_MESSAGE(msg)
int GUIDesignHeight
the default size for GUI elements
The main window of Netedit.
GNEViewNet * getViewNet()
get pointer to viewNet
long onCmdSaveOptions(FXObject *, FXSelector, void *)
save options
FXTreeItem * myRootItem
root item
FXTreeList * myTopicsTreeList
Topics elements tree.
void updateVisibleEntriesBySearch(std::string searchText)
update visible entries by search
MFXCheckableButton * myShowToolTipsMenu
checkable button for show toolTips
long onCmdCancel(FXObject *, FXSelector, void *)
called when user press cancel button
const std::set< std::string > myIgnoredEntries
ignores entries
long onCmdSelectTopic(FXObject *, FXSelector, void *)
called when user select a topic in the list
std::vector< GNEOptionsDialogElements::InputOption * > myInputOptionEntries
Input option entries.
const std::set< std::string > myIgnoredTopics
ignores topics
long onCmdReset(FXObject *, FXSelector, void *)
called when user press reset button
std::map< FXTreeItem *, std::string > myTreeItemTopics
map with topics and their associated FXTreeItem
GNEApplicationWindow * myGNEApp
pointer to main window parent
~GNEOptionsDialog()
Destructor.
MFXTextFieldSearch * mySearchButton
search button
static std::pair< int, bool > Run(GNEApplicationWindow *GNEApp, GUIIcon icon, OptionsCont &optionsContainer, const OptionsCont &originalOptionsContainer, const char *titleName)
Constructor for run dialogs.
bool loadConfiguration(const std::string &file)
load configuration
static std::pair< int, bool > Options(GNEApplicationWindow *GNEApp, GUIIcon icon, OptionsCont &optionsContainer, const OptionsCont &originalOptionsContainer, const char *titleName)
Constructor for options dialogs.
OptionsCont & myOptionsContainer
reference to edited Option container
FXVerticalFrame * myEntriesFrame
vertical frame for entries
MFXCheckButtonTooltip * myDescriptionSearchCheckButton
checkbox for enable/disable search by description
long onCmdShowToolTipsMenu(FXObject *, FXSelector, void *)
enable/disable show toolTip
long onCmdResetDefault(FXObject *, FXSelector, void *)
reset default
long onCmdSearch(FXObject *, FXSelector, void *)
called when user searches
long onCmdLoadOptions(FXObject *, FXSelector, void *)
load options
bool myOptionsModified
flag for check if options was modified
bool updateVisibleEntriesByTopic()
update visible entries by selected topic
GNEOptionsDialog()
FOX needs this.
long onCmdRunNetgenerate(FXObject *, FXSelector, void *)
called when user press reset button
GNEViewParent * getViewParent() const
get the net object
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
MFXCheckableButton * getShowToolTipsMenu() const
get menu for tooltips menu
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
FXString getText() const
Get the text for this label.
FXTextFieldIcon (based on FXTextFieldIcon)
A storage for options typed value containers)
const std::vector< std::string > & getSubTopics() const
return the list of subtopics
std::string getTypeName(const std::string name)
return the type name for the given option
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false) const
Writes the configuration.
std::string getValueString(const std::string &name) const
Returns the string-value of the named option (all options)
const std::string & getDescription(const std::string &name) const
Returns the option description.
void resetWritable()
Resets all options to be writeable.
std::vector< std::string > getSubTopicsEntries(const std::string &subtopic) const
return the list of entries for the given subtopic
A SAX-Handler for loading options.
bool errorOccurred() const
Returns the information whether an error occurred.
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static std::string transcode(const XMLCh *const data)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
static std::string openOptionFileDialog(FXWindow *window, bool save)
open option dialog