35#include <xercesc/parsers/SAXParser.hpp>
43#define TREELISTWIDTH 200
60FXIMPLEMENT(
GNEOptionsEditor, FXVerticalFrame, GNEOptionsEditorMap, ARRAYNUMBER(GNEOptionsEditorMap))
74 auto staticTooltipMenu = dialog->getApplicationWindow()->getStaticTooltipMenu();
78 (std::string(
"\t") +
TL(
"Toggle Menu Tooltips") + std::string(
"\t") +
TL(
"Toggles whether tooltips in the menu shall be shown.")).c_str(),
80 auto saveFile =
new MFXButtonTooltip(buttonsFrame, staticTooltipMenu,
TL(
"Save options"),
82 saveFile->setTipText(
TL(
"Save configuration file"));
83 auto loadFile =
new MFXButtonTooltip(buttonsFrame, staticTooltipMenu,
TL(
"Load options"),
85 loadFile->setTipText(
TL(
"Load configuration file"));
86 auto resetDefault =
new MFXButtonTooltip(buttonsFrame, staticTooltipMenu,
TL(
"Default options"),
88 resetDefault->setTipText(
TL(
"Reset all options to default"));
90 new FXSeparator(
this);
105 FXScrollWindow* scrollTabEntries =
new FXScrollWindow(groupBoxOptions->
getCollapsableFrame(), LAYOUT_FILL_X | LAYOUT_FILL_Y);
117 const std::vector<std::string> entries =
myOptionsContainer.getSubTopicsEntries(topic);
118 for (
const auto& entry : entries) {
132 }
else if (type ==
"TIME") {
134 }
else if ((type ==
"FILE") || (type ==
"NETWORK") || (type ==
"ADDITIONAL") || (type ==
"ROUTE") || (type ==
"DATA")) {
136 }
else if (type ==
"BOOL") {
138 }
else if (type ==
"INT") {
140 }
else if (type ==
"FLOAT") {
142 }
else if (type ==
"INT[]") {
144 }
else if (type ==
"STR[]") {
159 entry->adjustNameSize();
162 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry(
"gui",
"menuToolTips", 0) != 1);
192 entry->onCmdResetOption(
nullptr, 0,
nullptr);
222 auto viewNet =
myDialog->getApplicationWindow()->getViewNet();
226 viewNet->getViewParent()->getShowToolTipsMenu()->setChecked(
myShowToolTipsMenu->amChecked());
227 viewNet->getViewParent()->getShowToolTipsMenu()->update();
232 getApp()->reg().writeIntEntry(
"gui",
"menuToolTips",
myShowToolTipsMenu->amChecked() ? 0 : 1);
269 entry->updateOption();
280 if (entry->isEditable()) {
281 entry->restoreOption();
298 if (treeItemTopic.first->isSelected()) {
301 if (entry->getTopic() == treeItemTopic.second) {
328 if (searchText.empty()) {
331 }
else if (entry->getNameLower().find(searchText) != std::string::npos) {
334 (entry->getDescriptionLower().find(searchText) != std::string::npos)) {
350 XERCES_CPP_NAMESPACE::SAXParser parser;
351 parser.setValidationScheme(XERCES_CPP_NAMESPACE::SAXParser::Val_Never);
352 parser.setDisableDefaultEntityResolution(
true);
356 parser.setDocumentHandler(&handler);
357 parser.setErrorHandler(&handler);
360 WRITE_ERROR(
TL(
"Could not load configuration '") + file +
"'.");
363 }
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
Result getResult() const
get result to indicate if this dialog was closed accepting or rejecting changes
std::string getFilename() const
Return file name, if any.
GNEGroupBoxModule (based on FXGroupBox).
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
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
bool requireSaveNetwork() const
check if option require save network
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
bool myRequireSaveNetwork
flag for check if options require save network
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
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, int length=-1)
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