37#define MINNAMEWIDTH 200
65 const
std::
string& name, const
std::
string& description, const
std::
string& defaultValue, const
bool editable) :
67 myOptionsEditor(optionsEditor),
70 myDescription(description),
71 myDefaultValue(defaultValue),
72 myEditable(editable) {
74 myNameLabel =
new MFXLabelTooltip(
this, myOptionsEditor->myDialog->getApplicationWindow()->getStaticTooltipMenu(),
77 myNameLabel->setTipText(description.c_str());
114 if (getValue() != myDefaultValue) {
115 myResetButton->enable();
117 myResetButton->disable();
126 const std::string& topic,
const std::string& name,
const std::string& description,
127 const std::string& defaultValue,
const bool editable) :
128 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
140 myStringTextField->setText(myOptionsEditor->myOptionsContainer.getString(myName).c_str());
147 myStringTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getString(myName).c_str());
148 onCmdSetOption(
nullptr, 0,
nullptr);
154 myOptionsEditor->myOptionsContainer.resetWritable();
155 myOptionsEditor->myOptionsContainer.set(myName, myStringTextField->getText().text());
156 myOptionsEditor->myOptionsModified =
true;
164 myStringTextField->setText(myDefaultValue.c_str());
172 return myStringTextField->getText().text();
177 const std::string& topic,
const std::string& name,
const std::string& description,
178 const std::string& defaultValue,
const bool editable) :
179 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
190 myStringVectorTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getStringVector(myName)).c_str());
197 myStringVectorTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getStringVector(myName)).c_str());
198 onCmdSetOption(
nullptr, 0,
nullptr);
204 myOptionsEditor->myOptionsContainer.resetWritable();
205 myOptionsEditor->myOptionsContainer.set(myName, myStringVectorTextField->getText().text());
206 myOptionsEditor->myOptionsModified =
true;
214 myStringVectorTextField->setText(myDefaultValue.c_str());
222 return myStringVectorTextField->getText().text();
230 const std::string& topic,
const std::string& name,
const std::string& description,
231 const std::string& defaultValue,
const bool editable) :
232 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
243 if (myOptionsEditor->myOptionsContainer.getBool(myName)) {
244 myCheckButton->setCheck(TRUE);
245 myCheckButton->setText(
TL(
"true"));
247 myCheckButton->setCheck(FALSE);
248 myCheckButton->setText(
TL(
"false"));
256 if (myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
257 myCheckButton->setCheck(TRUE);
258 myCheckButton->setText(
TL(
"true"));
260 myCheckButton->setCheck(FALSE);
261 myCheckButton->setText(
TL(
"false"));
263 onCmdSetOption(
nullptr, 0,
nullptr);
269 myOptionsEditor->myOptionsContainer.resetWritable();
270 if (myCheckButton->getCheck()) {
271 myOptionsEditor->myOptionsContainer.set(myName,
"true");
272 myCheckButton->setText(
TL(
"true"));
274 myOptionsEditor->myOptionsContainer.set(myName,
"false");
275 myCheckButton->setText(
TL(
"false"));
277 myOptionsEditor->myOptionsModified =
true;
279 if ((myName ==
"gui-testing-debug") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug")) {
282 if ((myName ==
"gui-testing-debug-gl") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug-gl")) {
292 if (myDefaultValue.empty()) {
293 myCheckButton->setCheck(FALSE);
294 myCheckButton->setText(
TL(
"false"));
296 myCheckButton->setCheck(TRUE);
297 myCheckButton->setText(
TL(
"true"));
299 myCheckButton->setCheck(FALSE);
300 myCheckButton->setText(
TL(
"false"));
309 return myCheckButton->getCheck() ?
"true" :
"false";
317 const std::string& topic,
const std::string& name,
const std::string& description,
318 const std::string& defaultValue,
const bool editable) :
319 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
330 myIntTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getInt(myName)).c_str());
337 myIntTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getInt(myName)).c_str());
338 onCmdSetOption(
nullptr, 0,
nullptr);
344 if (myIntTextField->getText().empty()) {
345 myIntTextField->setText(myDefaultValue.c_str());
347 myOptionsEditor->myOptionsContainer.resetWritable();
348 myOptionsEditor->myOptionsContainer.set(myName, myIntTextField->getText().text());
349 myOptionsEditor->myOptionsModified =
true;
358 myIntTextField->setText(myDefaultValue.c_str());
366 return myIntTextField->getText().text();
374 const std::string& topic,
const std::string& name,
const std::string& description,
375 const std::string& defaultValue,
const bool editable) :
376 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
388 myIntVectorTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getIntVector(myName)).c_str());
395 myIntVectorTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getIntVector(myName)).c_str());
396 onCmdSetOption(
nullptr, 0,
nullptr);
405 for (
const auto& intValue : intVector) {
408 myOptionsEditor->myOptionsContainer.resetWritable();
409 myOptionsEditor->myOptionsContainer.set(myName, myIntVectorTextField->getText().text());
411 myOptionsEditor->myOptionsModified =
true;
422 myIntVectorTextField->setText(myDefaultValue.c_str());
430 return myIntVectorTextField->getText().text();
438 const std::string& topic,
const std::string& name,
const std::string& description,
439 const std::string& defaultValue,
const bool editable) :
440 OptionRow(optionsEditor, parent, topic, name, description, parseFloat(defaultValue), editable) {
452 myFloatTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getFloat(myName)).c_str());
459 myFloatTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getFloat(myName)).c_str());
460 onCmdSetOption(
nullptr, 0,
nullptr);
467 if (myFloatTextField->getText().empty()) {
468 myFloatTextField->setText(myDefaultValue.c_str());
470 myOptionsEditor->myOptionsContainer.resetWritable();
471 myOptionsEditor->myOptionsContainer.set(myName, myFloatTextField->getText().text());
472 myOptionsEditor->myOptionsModified =
true;
481 myFloatTextField->setText(myDefaultValue.c_str());
489 return myFloatTextField->getText().text();
507 const std::string& topic,
const std::string& name,
const std::string& description,
508 const std::string& defaultValue,
const bool editable) :
509 OptionRow(optionsEditor, parent, topic, name, description, parseTime(defaultValue), editable) {
521 myTimeTextField->setText(
toString(myOptionsEditor->myOptionsContainer.getString(myName)).c_str());
528 myTimeTextField->setText(
toString(myOptionsEditor->myOriginalOptionsContainer.getString(myName)).c_str());
529 onCmdSetOption(
nullptr, 0,
nullptr);
536 if (myTimeTextField->getText().empty()) {
537 myTimeTextField->setText(myDefaultValue.c_str());
539 myOptionsEditor->myOptionsContainer.resetWritable();
540 myOptionsEditor->myOptionsContainer.set(myName, myTimeTextField->getText().text());
541 myOptionsEditor->myOptionsModified =
true;
550 myTimeTextField->setText(myDefaultValue.c_str());
558 return myTimeTextField->getText().text();
576 const std::string& name,
const std::string& description,
const std::string& defaultValue,
const bool editable) :
577 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
591 myFilenameTextField->setText(myOptionsEditor->myOptionsContainer.getString(myName).c_str());
598 myFilenameTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getString(myName).c_str());
599 onCmdSetOption(
nullptr, 0,
nullptr);
608 const GNEFileDialog XMLFileDialog(myOptionsEditor->myDialog->getApplicationWindow(), myOptionsEditor->myDialog,
614 myFilenameTextField->setText(XMLFileDialog.
getFilename().c_str(), TRUE);
624 myOptionsEditor->myOptionsContainer.resetWritable();
625 myOptionsEditor->myOptionsContainer.set(myName, myFilenameTextField->getText().text());
627 myOptionsEditor->myOptionsModified =
true;
638 myFilenameTextField->setText(myDefaultValue.c_str());
649 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)
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.
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
OptionBool(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable)
constructor
void restoreOption()
restore option
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
FXCheckButton * myCheckButton
menu check
void updateOption()
update option
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
OptionFloat(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable)
constructor
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
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, const bool editable)
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
void updateOption()
update option
std::string getValue() const
get value
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
OptionIntVector(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable)
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
OptionString(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable)
constructor
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
void restoreOption()
restore option
std::string getValue() const
get value
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
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
void restoreOption()
restore option
void updateOption()
update option
OptionStringVector(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable)
constructor
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
OptionTime(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable)
constructor
void updateOption()
update option
long onCmdResetOption(FXObject *, FXSelector, void *)
called when user press reset button
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