34#include <xercesc/parsers/SAXParser.hpp>
42#define TREELISTWIDTH 200
59FXIMPLEMENT(
GNEOptionsEditor, FXVerticalFrame, GNEOptionsEditorMap, ARRAYNUMBER(GNEOptionsEditorMap))
73 auto staticTooltipMenu = dialog->getApplicationWindow()->getStaticTooltipMenu();
77 (std::string(
"\t") +
TL(
"Toggle Menu Tooltips") + std::string(
"\t") +
TL(
"Toggles whether tooltips in the menu shall be shown.")).c_str(),
79 auto saveFile =
new MFXButtonTooltip(buttonsFrame, staticTooltipMenu,
TL(
"Save options"),
81 saveFile->setTipText(
TL(
"Save configuration file"));
82 auto loadFile =
new MFXButtonTooltip(buttonsFrame, staticTooltipMenu,
TL(
"Load options"),
84 loadFile->setTipText(
TL(
"Load configuration file"));
85 auto resetDefault =
new MFXButtonTooltip(buttonsFrame, staticTooltipMenu,
TL(
"Default options"),
87 resetDefault->setTipText(
TL(
"Reset all options to default"));
89 new FXSeparator(
this);
104 FXScrollWindow* scrollTabEntries =
new FXScrollWindow(groupBoxOptions->
getCollapsableFrame(), LAYOUT_FILL_X | LAYOUT_FILL_Y);
114 const std::vector<std::string> entries =
myOptionsContainer.getSubTopicsEntries(topic);
115 for (
const auto& entry : entries) {
127 }
else if (type ==
"TIME") {
129 }
else if ((type ==
"FILE") || (type ==
"NETWORK") || (type ==
"ADDITIONAL") || (type ==
"ROUTE") || (type ==
"DATA")) {
131 }
else if (type ==
"BOOL") {
133 }
else if (type ==
"INT") {
135 }
else if (type ==
"FLOAT") {
137 }
else if (type ==
"INT[]") {
139 }
else if (type ==
"STR[]") {
154 entry->adjustNameSize();
157 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry(
"gui",
"menuToolTips", 0) != 1);
180 entry->onCmdResetOption(
nullptr, 0,
nullptr);
209 auto viewNet =
myDialog->getApplicationWindow()->getViewNet();
213 viewNet->getViewParent()->getShowToolTipsMenu()->setChecked(
myShowToolTipsMenu->amChecked());
214 viewNet->getViewParent()->getShowToolTipsMenu()->update();
219 getApp()->reg().writeIntEntry(
"gui",
"menuToolTips",
myShowToolTipsMenu->amChecked() ? 0 : 1);
237 myOptionsContainer.writeConfiguration(out,
true,
false,
false, optionsFileDialog.getFilename(),
true);
256 entry->updateOption();
267 entry->restoreOption();
283 if (treeItemTopic.first->isSelected()) {
286 if (entry->getTopic() == treeItemTopic.second) {
313 if (searchText.empty()) {
316 }
else if (entry->getNameLower().find(searchText) != std::string::npos) {
319 (entry->getDescriptionLower().find(searchText) != std::string::npos)) {
335 XERCES_CPP_NAMESPACE::SAXParser parser;
336 parser.setValidationScheme(XERCES_CPP_NAMESPACE::SAXParser::Val_Never);
337 parser.setDisableDefaultEntityResolution(
true);
341 parser.setDocumentHandler(&handler);
342 parser.setErrorHandler(&handler);
345 WRITE_ERROR(
TL(
"Could not load configuration '") + file +
"'.");
348 }
catch (
const XERCES_CPP_NAMESPACE::XMLException& e) {
FXDEFMAP(GNEOptionsEditor) GNEOptionsEditorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ 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_MTEXTFIELDSEARCH_UPDATED
callback for MFXTextFieldSearch
#define GUIDesignCheckButtonThick
checkButton placed in left position
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignButtonConfiguration
Configuration Button.
#define GUIDesignTreeListFixedWidth
#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 WRITE_MESSAGE(msg)
int GUIDesignHeight
the default height for GUI elements
long onCmdSaveOptions(FXObject *, FXSelector, void *)
save options
void resetAllOptions()
reset options
bool loadConfiguration(const std::string &file)
load configuration
long onCmdShowToolTipsMenu(FXObject *, FXSelector, void *)
enable/disable show toolTip
FXVerticalFrame * myEntriesFrame
vertical frame for entries
long onCmdSearch(FXObject *, FXSelector, void *)
called when user searches
const OptionsCont & myOriginalOptionsContainer
reference to original Option container, used for restoring
long onCmdLoadOptions(FXObject *, FXSelector, void *)
load options
MFXTextFieldSearch * mySearchButton
search button
GNEDialog * myDialog
reference to dialog
OptionsCont & myOptionsContainer
reference to edited Option container
bool myOptionsModified
flag for check if options was modified
MFXCheckButtonTooltip * myDescriptionSearchCheckButton
checkbox for enable/disable search by description
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
long onCmdResetDefault(FXObject *, FXSelector, void *)
reset default
MFXCheckableButton * myShowToolTipsMenu
checkable button for show toolTips
long onCmdSelectTopic(FXObject *, FXSelector, void *)
called when user select a topic in the list
OptionsCont * myCopyOfOptionsContainer
copy of edited Option container, used for reset
GNEOptionsEditor()
FOX needs this.
const std::set< std::string > myIgnoredEntries
ignores entries
FXTreeItem * myRootItem
root item
GNEOptionsEditor(GNEDialog *dialog, const std::string &titleName, OptionsCont &optionsContainer, const OptionsCont &originalOptionsContainer)
Constructor.
std::map< FXTreeItem *, std::string > myTreeItemTopics
map with topics and their associated FXTreeItem
const std::set< std::string > myIgnoredTopics
ignores topics
bool updateVisibleEntriesByTopic()
update visible entries by selected topic
void updateVisibleEntriesBySearch(std::string searchText)
update visible entries by search
bool isOptionModified() const
check if option was modified
std::vector< GNEOptionsEditorRow::OptionRow * > myOptionRowEntries
Input option entries.
~GNEOptionsEditor()
Destructor.
FXTreeList * myTopicsTreeList
Topics elements tree.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
dialog arguments, used for certain modal dialogs that can not be edited using tab
MFXGroupBoxModule (based on FXGroupBox).
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
FXTextFieldIcon (based on FXTextFieldIcon).
A storage for options typed value containers).
A SAX-Handler for loading options.
bool errorOccurred() const
Returns the information whether an error occurred.
static StringBijection< XMLFileExtension > XMLFileExtensions
XML file Extensions.
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