37#define MINNAMEWIDTH 200
65 const
std::
string& name, const
std::
string& description, const
std::
string& defaultValue, const
bool editable,
66 const
bool drawRed, const
bool requireSaveNetwork) :
68 myOptionsEditor(optionsEditor),
71 myDescription(description),
72 myDefaultValue(defaultValue),
74 myRequireSaveNetwork(requireSaveNetwork) {
76 myNameLabel =
new MFXLabelTooltip(
this, myOptionsEditor->myDialog->getApplicationWindow()->getStaticTooltipMenu(),
79 myNameLabel->setTipText(description.c_str());
125 if (getValue() != myDefaultValue) {
126 myResetButton->enable();
128 myResetButton->disable();
137 const std::string& topic,
const std::string& name,
const std::string& description,
138 const std::string& defaultValue,
const bool editable,
const bool drawRed,
const bool requireSaveNetwork) :
139 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, drawRed, requireSaveNetwork) {
151 myStringTextField->setText(myOptionsEditor->myOptionsContainer.getString(myName).c_str());
158 myStringTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getString(myName).c_str());
159 onCmdSetOption(
nullptr, 0,
nullptr);
165 myOptionsEditor->myOptionsContainer.resetWritable();
167 if (myStringTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getString(myName)) {
168 myOptionsEditor->myOptionsContainer.resetDefault(myName);
170 myOptionsEditor->myOptionsContainer.set(myName, myStringTextField->getText().text());
172 myOptionsEditor->myOptionsModified =
true;
173 if (myRequireSaveNetwork) {
174 myOptionsEditor->myRequireSaveNetwork =
true;
183 myStringTextField->setText(myDefaultValue.c_str());
191 return myStringTextField->getText().text();
196 const std::string& topic,
const std::string& name,
const std::string& description,
197 const std::string& defaultValue,
const bool editable,
const bool drawRed,
const bool requireSaveNetwork) :
198 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, drawRed, requireSaveNetwork) {
209 myStringVectorTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
216 myStringVectorTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
217 onCmdSetOption(
nullptr, 0,
nullptr);
223 myOptionsEditor->myOptionsContainer.resetWritable();
225 if (myStringVectorTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
226 myOptionsEditor->myOptionsContainer.resetDefault(myName);
228 myOptionsEditor->myOptionsContainer.set(myName, myStringVectorTextField->getText().text());
230 myOptionsEditor->myOptionsModified =
true;
231 if (myRequireSaveNetwork) {
232 myOptionsEditor->myRequireSaveNetwork =
true;
241 myStringVectorTextField->setText(myDefaultValue.c_str());
249 return myStringVectorTextField->getText().text();
257 const std::string& topic,
const std::string& name,
const std::string& description,
258 const std::string& defaultValue,
const bool editable,
const bool drawRed,
const bool requireSaveNetwork) :
259 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, drawRed, requireSaveNetwork) {
270 if (myOptionsEditor->myOptionsContainer.getBool(myName)) {
271 myCheckButton->setCheck(TRUE);
272 myCheckButton->setText(
TL(
"true"));
274 myCheckButton->setCheck(FALSE);
275 myCheckButton->setText(
TL(
"false"));
283 if (myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
284 myCheckButton->setCheck(TRUE);
285 myCheckButton->setText(
TL(
"true"));
287 myCheckButton->setCheck(FALSE);
288 myCheckButton->setText(
TL(
"false"));
290 onCmdSetOption(
nullptr, 0,
nullptr);
296 myOptionsEditor->myOptionsContainer.resetWritable();
298 const bool check = myCheckButton->getCheck() == TRUE;
299 if (check == myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
300 myOptionsEditor->myOptionsContainer.resetDefault(myName);
302 myOptionsEditor->myOptionsContainer.set(myName,
"true");
304 myOptionsEditor->myOptionsContainer.set(myName,
"false");
308 myCheckButton->setText(
TL(
"true"));
310 myCheckButton->setText(
TL(
"false"));
312 myOptionsEditor->myOptionsModified =
true;
313 if (myRequireSaveNetwork) {
314 myOptionsEditor->myRequireSaveNetwork =
true;
317 if ((myName ==
"gui-testing-debug") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug")) {
320 if ((myName ==
"gui-testing-debug-gl") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug-gl")) {
330 if (myDefaultValue.empty()) {
331 myCheckButton->setCheck(FALSE);
332 myCheckButton->setText(
TL(
"false"));
334 myCheckButton->setCheck(TRUE);
335 myCheckButton->setText(
TL(
"true"));
337 myCheckButton->setCheck(FALSE);
338 myCheckButton->setText(
TL(
"false"));
347 return myCheckButton->getCheck() ?
"true" :
"false";
355 const std::string& topic,
const std::string& name,
const std::string& description,
356 const std::string& defaultValue,
const bool editable,
const bool drawRed,
const bool requireSaveNetwork) :
357 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, drawRed, requireSaveNetwork) {
368 myIntTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
375 myIntTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
376 onCmdSetOption(
nullptr, 0,
nullptr);
382 if (myIntTextField->getText().empty()) {
383 myIntTextField->setText(myDefaultValue.c_str());
385 myOptionsEditor->myOptionsContainer.resetWritable();
387 if (myIntTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
388 myOptionsEditor->myOptionsContainer.resetDefault(myName);
390 myOptionsEditor->myOptionsContainer.set(myName, myIntTextField->getText().text());
392 myOptionsEditor->myOptionsModified =
true;
393 if (myRequireSaveNetwork) {
394 myOptionsEditor->myRequireSaveNetwork =
true;
404 myIntTextField->setText(myDefaultValue.c_str());
412 return myIntTextField->getText().text();
420 const std::string& topic,
const std::string& name,
const std::string& description,
421 const std::string& defaultValue,
const bool editable,
const bool drawRed,
const bool requireSaveNetwork) :
422 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, drawRed, requireSaveNetwork) {
434 myIntVectorTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
441 myIntVectorTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
442 onCmdSetOption(
nullptr, 0,
nullptr);
451 for (
const auto& intValue : intVector) {
454 myOptionsEditor->myOptionsContainer.resetWritable();
456 if (myIntVectorTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getString(myName)) {
457 myOptionsEditor->myOptionsContainer.resetDefault(myName);
459 myOptionsEditor->myOptionsContainer.set(myName, myIntVectorTextField->getText().text());
462 myOptionsEditor->myOptionsModified =
true;
463 if (myRequireSaveNetwork) {
464 myOptionsEditor->myRequireSaveNetwork =
true;
476 myIntVectorTextField->setText(myDefaultValue.c_str());
484 return myIntVectorTextField->getText().text();
492 const std::string& topic,
const std::string& name,
const std::string& description,
493 const std::string& defaultValue,
const bool editable,
const bool drawRed,
const bool requireSaveNetwork) :
494 OptionRow(optionsEditor, parent, topic, name, description, parseFloat(defaultValue), editable, drawRed, requireSaveNetwork) {
506 myFloatTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
513 myFloatTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
514 onCmdSetOption(
nullptr, 0,
nullptr);
521 if (myFloatTextField->getText().empty()) {
522 myFloatTextField->setText(myDefaultValue.c_str());
524 myOptionsEditor->myOptionsContainer.resetWritable();
526 if (myFloatTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
527 myOptionsEditor->myOptionsContainer.resetDefault(myName);
529 myOptionsEditor->myOptionsContainer.set(myName, myFloatTextField->getText().text());
531 myOptionsEditor->myOptionsModified =
true;
532 if (myRequireSaveNetwork) {
533 myOptionsEditor->myRequireSaveNetwork =
true;
543 myFloatTextField->setText(myDefaultValue.c_str());
551 return myFloatTextField->getText().text();
569 const std::string& topic,
const std::string& name,
const std::string& description,
570 const std::string& defaultValue,
const bool editable,
const bool drawRed,
const bool requireSaveNetwork) :
571 OptionRow(optionsEditor, parent, topic, name, description, parseTime(defaultValue), editable, drawRed, requireSaveNetwork) {
583 myTimeTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
590 myTimeTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
591 onCmdSetOption(
nullptr, 0,
nullptr);
598 if (myTimeTextField->getText().empty()) {
599 myTimeTextField->setText(myDefaultValue.c_str());
601 myOptionsEditor->myOptionsContainer.resetWritable();
603 if (myTimeTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
604 myOptionsEditor->myOptionsContainer.resetDefault(myName);
606 myOptionsEditor->myOptionsContainer.set(myName, myTimeTextField->getText().text());
608 myOptionsEditor->myOptionsModified =
true;
609 if (myRequireSaveNetwork) {
610 myOptionsEditor->myRequireSaveNetwork =
true;
620 myTimeTextField->setText(myDefaultValue.c_str());
628 return myTimeTextField->getText().text();
646 const std::string& name,
const std::string& description,
const std::string& defaultValue,
const bool editable,
const bool drawRed,
647 const bool requireSaveNetwork) :
648 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, drawRed, requireSaveNetwork) {
662 myFilenameTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
669 myFilenameTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
670 onCmdSetOption(
nullptr, 0,
nullptr);
678 if (myName.find(
"output") != std::string::npos || myName.find(
"log") != std::string::npos) {
680 }
else if (myName.find(
"files") != std::string::npos) {
684 const GNEFileDialog XMLFileDialog(myOptionsEditor->myDialog->getApplicationWindow(), myOptionsEditor->myDialog,
702 myOptionsEditor->myOptionsContainer.resetWritable();
704 if (myFilenameTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
705 myOptionsEditor->myOptionsContainer.resetDefault(myName);
707 myOptionsEditor->myOptionsContainer.set(myName, myFilenameTextField->getText().text());
710 myOptionsEditor->myOptionsModified =
true;
711 if (myRequireSaveNetwork) {
712 myOptionsEditor->myRequireSaveNetwork =
true;
724 myFilenameTextField->setText(myDefaultValue.c_str());
735 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
OptionBool(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable, const bool drawRed, const bool requireSaveNetwork)
constructor
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
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, const bool editable, const bool drawRed, const bool requireSaveNetwork)
constructor
void restoreOption()
restore option
FXTextField * myIntTextField
text field
void restoreOption()
restore option
OptionInt(GNEOptionsEditor *optionsEditor, FXComposite *parent, const std::string &topic, const std::string &name, const std::string &description, const std::string &defaultValue, const bool editable, const bool drawRed, const bool requireSaveNetwork)
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 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
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, const bool editable, const bool drawRed, const bool requireSaveNetwork)
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
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, const bool editable, const bool drawRed, const bool requireSaveNetwork)
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
long onCmdSetOption(FXObject *, FXSelector, void *)
called when user set value in textField/button/checkBox
void restoreOption()
restore 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, const bool drawRed, const bool requireSaveNetwork)
constructor
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, const bool editable, const bool drawRed, const bool requireSaveNetwork)
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
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