36#define MINNAMEWIDTH 200
64 const
std::
string& name, const
std::
string& description, const
std::
string& defaultValue) :
66 myOptionsEditor(optionsEditor),
69 myDescription(description),
70 myDefaultValue(defaultValue) {
72 myNameLabel =
new MFXLabelTooltip(
this, myOptionsEditor->myDialog->getApplicationWindow()->getStaticTooltipMenu(),
75 myNameLabel->setTipText(description.c_str());
112 if (getValue() != myDefaultValue) {
113 myResetButton->enable();
115 myResetButton->disable();
124 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
125 OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
134 myStringTextField->setText(myOptionsEditor->myOptionsContainer.getString(myName).c_str());
141 myStringTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getString(myName).c_str());
142 onCmdSetOption(
nullptr, 0,
nullptr);
148 myOptionsEditor->myOptionsContainer.resetWritable();
149 myOptionsEditor->myOptionsContainer.set(myName, myStringTextField->getText().text());
150 myOptionsEditor->myOptionsModified =
true;
158 myStringTextField->setText(myDefaultValue.c_str());
166 return myStringTextField->getText().text();
171 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
172 OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
180 myStringVectorTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getStringVector(myName)).c_str());
187 myStringVectorTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getStringVector(myName)).c_str());
188 onCmdSetOption(
nullptr, 0,
nullptr);
194 myOptionsEditor->myOptionsContainer.resetWritable();
195 myOptionsEditor->myOptionsContainer.set(myName, myStringVectorTextField->getText().text());
196 myOptionsEditor->myOptionsModified =
true;
204 myStringVectorTextField->setText(myDefaultValue.c_str());
212 return myStringVectorTextField->getText().text();
220 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
221 OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
229 if (myOptionsEditor->myOptionsContainer.getBool(myName)) {
230 myCheckButton->setCheck(TRUE);
231 myCheckButton->setText(
TL(
"true"));
233 myCheckButton->setCheck(FALSE);
234 myCheckButton->setText(
TL(
"false"));
242 if (myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
243 myCheckButton->setCheck(TRUE);
244 myCheckButton->setText(
TL(
"true"));
246 myCheckButton->setCheck(FALSE);
247 myCheckButton->setText(
TL(
"false"));
249 onCmdSetOption(
nullptr, 0,
nullptr);
255 myOptionsEditor->myOptionsContainer.resetWritable();
256 if (myCheckButton->getCheck()) {
257 myOptionsEditor->myOptionsContainer.set(myName,
"true");
258 myCheckButton->setText(
TL(
"true"));
260 myOptionsEditor->myOptionsContainer.set(myName,
"false");
261 myCheckButton->setText(
TL(
"false"));
263 myOptionsEditor->myOptionsModified =
true;
265 if ((myName ==
"gui-testing-debug") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug")) {
268 if ((myName ==
"gui-testing-debug-gl") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug-gl")) {
278 if (myDefaultValue.empty()) {
279 myCheckButton->setCheck(FALSE);
280 myCheckButton->setText(
TL(
"false"));
282 myCheckButton->setCheck(TRUE);
283 myCheckButton->setText(
TL(
"true"));
285 myCheckButton->setCheck(FALSE);
286 myCheckButton->setText(
TL(
"false"));
295 return myCheckButton->getCheck() ?
"true" :
"false";
303 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
304 OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
312 myIntTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getInt(myName)).c_str());
319 myIntTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getInt(myName)).c_str());
320 onCmdSetOption(
nullptr, 0,
nullptr);
326 if (myIntTextField->getText().empty()) {
327 myIntTextField->setText(myDefaultValue.c_str());
329 myOptionsEditor->myOptionsContainer.resetWritable();
330 myOptionsEditor->myOptionsContainer.set(myName, myIntTextField->getText().text());
331 myOptionsEditor->myOptionsModified =
true;
340 myIntTextField->setText(myDefaultValue.c_str());
348 return myIntTextField->getText().text();
356 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
357 OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
366 myIntVectorTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getIntVector(myName)).c_str());
373 myIntVectorTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getIntVector(myName)).c_str());
374 onCmdSetOption(
nullptr, 0,
nullptr);
383 for (
const auto& intValue : intVector) {
386 myOptionsEditor->myOptionsContainer.resetWritable();
387 myOptionsEditor->myOptionsContainer.set(myName, myIntVectorTextField->getText().text());
389 myOptionsEditor->myOptionsModified =
true;
400 myIntVectorTextField->setText(myDefaultValue.c_str());
408 return myIntVectorTextField->getText().text();
416 const std::string& name,
const std::string& description,
const std::string& defaultValue) :
417 OptionRow(optionsEditor, parent, topic, name, description, parseFloat(defaultValue)) {
426 myFloatTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getFloat(myName)).c_str());
433 myFloatTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getFloat(myName)).c_str());
434 onCmdSetOption(
nullptr, 0,
nullptr);
441 if (myFloatTextField->getText().empty()) {
442 myFloatTextField->setText(myDefaultValue.c_str());
444 myOptionsEditor->myOptionsContainer.resetWritable();
445 myOptionsEditor->myOptionsContainer.set(myName, myFloatTextField->getText().text());
446 myOptionsEditor->myOptionsModified =
true;
455 myFloatTextField->setText(myDefaultValue.c_str());
463 return myFloatTextField->getText().text();
481 const std::string& name,
const std::string& description,
const std::string& defaultValue) :
482 OptionRow(optionsEditor, parent, topic, name, description, parseTime(defaultValue)) {
491 myTimeTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getString(myName)).c_str());
498 myTimeTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getString(myName)).c_str());
499 onCmdSetOption(
nullptr, 0,
nullptr);
506 if (myTimeTextField->getText().empty()) {
507 myTimeTextField->setText(myDefaultValue.c_str());
509 myOptionsEditor->myOptionsContainer.resetWritable();
510 myOptionsEditor->myOptionsContainer.set(myName, myTimeTextField->getText().text());
511 myOptionsEditor->myOptionsModified =
true;
520 myTimeTextField->setText(myDefaultValue.c_str());
528 return myTimeTextField->getText().text();
546 const std::string& name,
const std::string& description,
const std::string& defaultValue) :
547 OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
557 myFilenameTextField->setText(myOptionsEditor->myOptionsContainer.getString(myName).c_str());
564 myFilenameTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getString(myName).c_str());
565 onCmdSetOption(
nullptr, 0,
nullptr);
574 const auto XMLFileDialog =
GNEFileDialog(myOptionsEditor->myDialog->getApplicationWindow(),
TL(
"XML file"),
579 myFilenameTextField->setText(XMLFileDialog.getFilename().c_str(), TRUE);
589 myOptionsEditor->myOptionsContainer.resetWritable();
590 myOptionsEditor->myOptionsContainer.set(myName, myFilenameTextField->getText().text());
592 myOptionsEditor->myOptionsModified =
true;
603 myFilenameTextField->setText(myDefaultValue.c_str());
614 return myFilenameTextField->getText().text();
FXDEFMAP(GNEOptionsEditorRow::OptionRow) OptionRowMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
@ MID_GNE_RESET
reset element
#define GUIDesignTextColorRed
red color (for invalid text)
#define GUIDesignButtonIcon
button only with icon
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignTextColorBlack
black color (for correct text)
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
OptionsCont & myOptionsContainer
reference to edited Option container
std::string getValue() const
get value
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
void restoreOption()
restore option
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
FXCheckButton * myCheckButton
menu check
void updateOption()
update option
OptionBool(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue)
constructor
FXButton * myOpenFilenameButton
open filename button
OptionFilename()
FOX needs this.
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
std::string getValue() const
get value
void restoreOption()
restore option
void updateOption()
update option
long onCmdOpenDialog(FXObject *, FXSelector, void *)
called when user press open dialog button
FXTextField * myFilenameTextField
text field
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
std::string parseFloat(const std::string &value) const
parse float xx to xx.00
std::string getValue() const
get value
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
void updateOption()
update option
FXTextField * myFloatTextField
text field
OptionFloat(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue)
constructor
void restoreOption()
restore option
FXTextField * myIntTextField
text field
void restoreOption()
restore option
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
OptionInt(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue)
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
void updateOption()
update option
std::string getValue() const
get value
OptionIntVector(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue)
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
void restoreOption()
restore option
std::string getValue() const
get value
void updateOption()
update option
FXTextField * myIntVectorTextField
text field
GNEOptionsEditor * myOptionsEditor
FOX needs this.
MFXLabelTooltip * myNameLabel
tooltip label for name
const std::string getDescriptionLower() const
get description (Lower)
const std::string & getTopic() const
get topic
void updateResetButton()
update reset button
virtual long onCmdSetOption(FXObject *, FXSelector, void *)=0
called when user set value in textField/button/checkBox
const std::string getNameLower() const
get name (Lower)
FXHorizontalFrame * myContentFrame
content frame
void adjustNameSize()
adjust input name size
virtual long onCmdResetOption(FXObject *, FXSelector, void *)=0
called when user press reset button
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
void updateOption()
update option
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
void restoreOption()
restore option
std::string getValue() const
get value
OptionString(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue)
constructor
FXTextField * myStringTextField
text field
FXTextField * myStringVectorTextField
text field
std::string getValue() const
get value
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
OptionStringVector(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue)
constructor
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
void restoreOption()
restore option
void updateOption()
update option
FXTextField * myTimeTextField
text field
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
std::string getValue() const
get value
std::string parseTime(const std::string &value) const
parse float xx to xx.00
void restoreOption()
restore option
void updateOption()
update option
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
OptionTime(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue)
constructor
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
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void enableDebugGLMessages(bool enable)
enable/disable gl-debug messages
static void enableDebugMessages(bool enable)
enable/disable debug messages
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
const IntVector & getIntVector(const std::string &name) const
Returns the list of integer-value of the named option (only for Option_IntVector)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static StringBijection< XMLFileExtension > XMLFileExtensions
XML file Extensions.
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name)
std::vector< std::string > getVector()
return vector of strings
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter