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());
120 if (getValue() != myDefaultValue) {
121 myResetButton->enable();
123 myResetButton->disable();
132 const std::string& topic,
const std::string& name,
const std::string& description,
133 const std::string& defaultValue,
const bool editable) :
134 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
146 myStringTextField->setText(myOptionsEditor->myOptionsContainer.getString(myName).c_str());
153 myStringTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getString(myName).c_str());
154 onCmdSetOption(
nullptr, 0,
nullptr);
160 myOptionsEditor->myOptionsContainer.resetWritable();
162 if (myStringTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getString(myName)) {
163 myOptionsEditor->myOptionsContainer.resetDefault(myName);
165 myOptionsEditor->myOptionsContainer.set(myName, myStringTextField->getText().text());
167 myOptionsEditor->myOptionsModified =
true;
175 myStringTextField->setText(myDefaultValue.c_str());
183 return myStringTextField->getText().text();
188 const std::string& topic,
const std::string& name,
const std::string& description,
189 const std::string& defaultValue,
const bool editable) :
190 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
201 myStringVectorTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
208 myStringVectorTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
209 onCmdSetOption(
nullptr, 0,
nullptr);
215 myOptionsEditor->myOptionsContainer.resetWritable();
217 if (myStringVectorTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
218 myOptionsEditor->myOptionsContainer.resetDefault(myName);
220 myOptionsEditor->myOptionsContainer.set(myName, myStringVectorTextField->getText().text());
222 myOptionsEditor->myOptionsModified =
true;
230 myStringVectorTextField->setText(myDefaultValue.c_str());
238 return myStringVectorTextField->getText().text();
246 const std::string& topic,
const std::string& name,
const std::string& description,
247 const std::string& defaultValue,
const bool editable) :
248 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
259 if (myOptionsEditor->myOptionsContainer.getBool(myName)) {
260 myCheckButton->setCheck(TRUE);
261 myCheckButton->setText(
TL(
"true"));
263 myCheckButton->setCheck(FALSE);
264 myCheckButton->setText(
TL(
"false"));
272 if (myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
273 myCheckButton->setCheck(TRUE);
274 myCheckButton->setText(
TL(
"true"));
276 myCheckButton->setCheck(FALSE);
277 myCheckButton->setText(
TL(
"false"));
279 onCmdSetOption(
nullptr, 0,
nullptr);
285 myOptionsEditor->myOptionsContainer.resetWritable();
287 if (myCheckButton->getCheck() == myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
288 myOptionsEditor->myOptionsContainer.resetDefault(myName);
289 }
else if (myCheckButton->getCheck()) {
290 myOptionsEditor->myOptionsContainer.set(myName,
"true");
292 myOptionsEditor->myOptionsContainer.set(myName,
"false");
295 if (myCheckButton->getCheck()) {
296 myCheckButton->setText(
TL(
"true"));
298 myCheckButton->setText(
TL(
"false"));
300 myOptionsEditor->myOptionsModified =
true;
302 if ((myName ==
"gui-testing-debug") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug")) {
305 if ((myName ==
"gui-testing-debug-gl") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug-gl")) {
315 if (myDefaultValue.empty()) {
316 myCheckButton->setCheck(FALSE);
317 myCheckButton->setText(
TL(
"false"));
319 myCheckButton->setCheck(TRUE);
320 myCheckButton->setText(
TL(
"true"));
322 myCheckButton->setCheck(FALSE);
323 myCheckButton->setText(
TL(
"false"));
332 return myCheckButton->getCheck() ?
"true" :
"false";
340 const std::string& topic,
const std::string& name,
const std::string& description,
341 const std::string& defaultValue,
const bool editable) :
342 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
353 myIntTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
360 myIntTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
361 onCmdSetOption(
nullptr, 0,
nullptr);
367 if (myIntTextField->getText().empty()) {
368 myIntTextField->setText(myDefaultValue.c_str());
370 myOptionsEditor->myOptionsContainer.resetWritable();
372 if (myIntTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
373 myOptionsEditor->myOptionsContainer.resetDefault(myName);
375 myOptionsEditor->myOptionsContainer.set(myName, myIntTextField->getText().text());
377 myOptionsEditor->myOptionsModified =
true;
386 myIntTextField->setText(myDefaultValue.c_str());
394 return myIntTextField->getText().text();
402 const std::string& topic,
const std::string& name,
const std::string& description,
403 const std::string& defaultValue,
const bool editable) :
404 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
416 myIntVectorTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
423 myIntVectorTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
424 onCmdSetOption(
nullptr, 0,
nullptr);
433 for (
const auto& intValue : intVector) {
436 myOptionsEditor->myOptionsContainer.resetWritable();
438 if (myIntVectorTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getString(myName)) {
439 myOptionsEditor->myOptionsContainer.resetDefault(myName);
441 myOptionsEditor->myOptionsContainer.set(myName, myIntVectorTextField->getText().text());
444 myOptionsEditor->myOptionsModified =
true;
455 myIntVectorTextField->setText(myDefaultValue.c_str());
463 return myIntVectorTextField->getText().text();
471 const std::string& topic,
const std::string& name,
const std::string& description,
472 const std::string& defaultValue,
const bool editable) :
473 OptionRow(optionsEditor, parent, topic, name, description, parseFloat(defaultValue), editable) {
485 myFloatTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
492 myFloatTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
493 onCmdSetOption(
nullptr, 0,
nullptr);
500 if (myFloatTextField->getText().empty()) {
501 myFloatTextField->setText(myDefaultValue.c_str());
503 myOptionsEditor->myOptionsContainer.resetWritable();
505 if (myFloatTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
506 myOptionsEditor->myOptionsContainer.resetDefault(myName);
508 myOptionsEditor->myOptionsContainer.set(myName, myFloatTextField->getText().text());
510 myOptionsEditor->myOptionsModified =
true;
519 myFloatTextField->setText(myDefaultValue.c_str());
527 return myFloatTextField->getText().text();
545 const std::string& topic,
const std::string& name,
const std::string& description,
546 const std::string& defaultValue,
const bool editable) :
547 OptionRow(optionsEditor, parent, topic, name, description, parseTime(defaultValue), editable) {
559 myTimeTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
566 myTimeTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
567 onCmdSetOption(
nullptr, 0,
nullptr);
574 if (myTimeTextField->getText().empty()) {
575 myTimeTextField->setText(myDefaultValue.c_str());
577 myOptionsEditor->myOptionsContainer.resetWritable();
579 if (myTimeTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
580 myOptionsEditor->myOptionsContainer.resetDefault(myName);
582 myOptionsEditor->myOptionsContainer.set(myName, myTimeTextField->getText().text());
584 myOptionsEditor->myOptionsModified =
true;
593 myTimeTextField->setText(myDefaultValue.c_str());
601 return myTimeTextField->getText().text();
619 const std::string& name,
const std::string& description,
const std::string& defaultValue,
const bool editable) :
620 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable) {
634 myFilenameTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
641 myFilenameTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
642 onCmdSetOption(
nullptr, 0,
nullptr);
650 if (myName.find(
"output") != std::string::npos || myName.find(
"log") != std::string::npos) {
652 }
else if (myName.find(
"files") != std::string::npos) {
656 const GNEFileDialog XMLFileDialog(myOptionsEditor->myDialog->getApplicationWindow(), myOptionsEditor->myDialog,
674 myOptionsEditor->myOptionsContainer.resetWritable();
676 if (myFilenameTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
677 myOptionsEditor->myOptionsContainer.resetDefault(myName);
679 myOptionsEditor->myOptionsContainer.set(myName, myFilenameTextField->getText().text());
682 myOptionsEditor->myOptionsModified =
true;
693 myFilenameTextField->setText(myDefaultValue.c_str());
704 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 joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
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::vector< std::string > getFilenames() const
Return empty-string terminated list of selected file names, or NULL if none selected.
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
bool isEditable() const
check if option is editable
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
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
std::string getValueString(const std::string &name) const
Returns the string-value of the named option (all options)
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