37#define MINNAMEWIDTH 200
65 const
std::
string& name, const
std::
string& description, const
std::
string& defaultValue, const
bool editable,
66 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());
122 if (getValue() != myDefaultValue) {
123 myResetButton->enable();
125 myResetButton->disable();
134 const std::string& topic,
const std::string& name,
const std::string& description,
135 const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
136 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, requireSaveNetwork) {
148 myStringTextField->setText(myOptionsEditor->myOptionsContainer.getString(myName).c_str());
155 myStringTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getString(myName).c_str());
156 onCmdSetOption(
nullptr, 0,
nullptr);
162 myOptionsEditor->myOptionsContainer.resetWritable();
164 if (myStringTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getString(myName)) {
165 myOptionsEditor->myOptionsContainer.resetDefault(myName);
167 myOptionsEditor->myOptionsContainer.set(myName, myStringTextField->getText().text());
169 myOptionsEditor->myOptionsModified =
true;
170 if (myRequireSaveNetwork) {
171 myOptionsEditor->myRequireSaveNetwork =
true;
180 myStringTextField->setText(myDefaultValue.c_str());
188 return myStringTextField->getText().text();
193 const std::string& topic,
const std::string& name,
const std::string& description,
194 const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
195 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, requireSaveNetwork) {
206 myStringVectorTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
213 myStringVectorTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
214 onCmdSetOption(
nullptr, 0,
nullptr);
220 myOptionsEditor->myOptionsContainer.resetWritable();
222 if (myStringVectorTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
223 myOptionsEditor->myOptionsContainer.resetDefault(myName);
225 myOptionsEditor->myOptionsContainer.set(myName, myStringVectorTextField->getText().text());
227 myOptionsEditor->myOptionsModified =
true;
228 if (myRequireSaveNetwork) {
229 myOptionsEditor->myRequireSaveNetwork =
true;
238 myStringVectorTextField->setText(myDefaultValue.c_str());
246 return myStringVectorTextField->getText().text();
254 const std::string& topic,
const std::string& name,
const std::string& description,
255 const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
256 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, requireSaveNetwork) {
267 if (myOptionsEditor->myOptionsContainer.getBool(myName)) {
268 myCheckButton->setCheck(TRUE);
269 myCheckButton->setText(
TL(
"true"));
271 myCheckButton->setCheck(FALSE);
272 myCheckButton->setText(
TL(
"false"));
280 if (myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
281 myCheckButton->setCheck(TRUE);
282 myCheckButton->setText(
TL(
"true"));
284 myCheckButton->setCheck(FALSE);
285 myCheckButton->setText(
TL(
"false"));
287 onCmdSetOption(
nullptr, 0,
nullptr);
293 myOptionsEditor->myOptionsContainer.resetWritable();
295 if (myCheckButton->getCheck() == myOptionsEditor->myOriginalOptionsContainer.getBool(myName)) {
296 myOptionsEditor->myOptionsContainer.resetDefault(myName);
297 }
else if (myCheckButton->getCheck()) {
298 myOptionsEditor->myOptionsContainer.set(myName,
"true");
300 myOptionsEditor->myOptionsContainer.set(myName,
"false");
303 if (myCheckButton->getCheck()) {
304 myCheckButton->setText(
TL(
"true"));
306 myCheckButton->setText(
TL(
"false"));
308 myOptionsEditor->myOptionsModified =
true;
309 if (myRequireSaveNetwork) {
310 myOptionsEditor->myRequireSaveNetwork =
true;
313 if ((myName ==
"gui-testing-debug") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug")) {
316 if ((myName ==
"gui-testing-debug-gl") && myOptionsEditor->myOptionsContainer.isSet(
"gui-testing-debug-gl")) {
326 if (myDefaultValue.empty()) {
327 myCheckButton->setCheck(FALSE);
328 myCheckButton->setText(
TL(
"false"));
330 myCheckButton->setCheck(TRUE);
331 myCheckButton->setText(
TL(
"true"));
333 myCheckButton->setCheck(FALSE);
334 myCheckButton->setText(
TL(
"false"));
343 return myCheckButton->getCheck() ?
"true" :
"false";
351 const std::string& topic,
const std::string& name,
const std::string& description,
352 const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
353 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, requireSaveNetwork) {
364 myIntTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
371 myIntTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
372 onCmdSetOption(
nullptr, 0,
nullptr);
378 if (myIntTextField->getText().empty()) {
379 myIntTextField->setText(myDefaultValue.c_str());
381 myOptionsEditor->myOptionsContainer.resetWritable();
383 if (myIntTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
384 myOptionsEditor->myOptionsContainer.resetDefault(myName);
386 myOptionsEditor->myOptionsContainer.set(myName, myIntTextField->getText().text());
388 myOptionsEditor->myOptionsModified =
true;
389 if (myRequireSaveNetwork) {
390 myOptionsEditor->myRequireSaveNetwork =
true;
400 myIntTextField->setText(myDefaultValue.c_str());
408 return myIntTextField->getText().text();
416 const std::string& topic,
const std::string& name,
const std::string& description,
417 const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
418 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, requireSaveNetwork) {
430 myIntVectorTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
437 myIntVectorTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
438 onCmdSetOption(
nullptr, 0,
nullptr);
447 for (
const auto& intValue : intVector) {
450 myOptionsEditor->myOptionsContainer.resetWritable();
452 if (myIntVectorTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getString(myName)) {
453 myOptionsEditor->myOptionsContainer.resetDefault(myName);
455 myOptionsEditor->myOptionsContainer.set(myName, myIntVectorTextField->getText().text());
458 myOptionsEditor->myOptionsModified =
true;
459 if (myRequireSaveNetwork) {
460 myOptionsEditor->myRequireSaveNetwork =
true;
472 myIntVectorTextField->setText(myDefaultValue.c_str());
480 return myIntVectorTextField->getText().text();
488 const std::string& topic,
const std::string& name,
const std::string& description,
489 const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
490 OptionRow(optionsEditor, parent, topic, name, description, parseFloat(defaultValue), editable, requireSaveNetwork) {
502 myFloatTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
509 myFloatTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
510 onCmdSetOption(
nullptr, 0,
nullptr);
517 if (myFloatTextField->getText().empty()) {
518 myFloatTextField->setText(myDefaultValue.c_str());
520 myOptionsEditor->myOptionsContainer.resetWritable();
522 if (myFloatTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
523 myOptionsEditor->myOptionsContainer.resetDefault(myName);
525 myOptionsEditor->myOptionsContainer.set(myName, myFloatTextField->getText().text());
527 myOptionsEditor->myOptionsModified =
true;
528 if (myRequireSaveNetwork) {
529 myOptionsEditor->myRequireSaveNetwork =
true;
539 myFloatTextField->setText(myDefaultValue.c_str());
547 return myFloatTextField->getText().text();
565 const std::string& topic,
const std::string& name,
const std::string& description,
566 const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
567 OptionRow(optionsEditor, parent, topic, name, description, parseTime(defaultValue), editable, requireSaveNetwork) {
579 myTimeTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
586 myTimeTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
587 onCmdSetOption(
nullptr, 0,
nullptr);
594 if (myTimeTextField->getText().empty()) {
595 myTimeTextField->setText(myDefaultValue.c_str());
597 myOptionsEditor->myOptionsContainer.resetWritable();
599 if (myTimeTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
600 myOptionsEditor->myOptionsContainer.resetDefault(myName);
602 myOptionsEditor->myOptionsContainer.set(myName, myTimeTextField->getText().text());
604 myOptionsEditor->myOptionsModified =
true;
605 if (myRequireSaveNetwork) {
606 myOptionsEditor->myRequireSaveNetwork =
true;
616 myTimeTextField->setText(myDefaultValue.c_str());
624 return myTimeTextField->getText().text();
642 const std::string& name,
const std::string& description,
const std::string& defaultValue,
const bool editable,
const bool requireSaveNetwork) :
643 OptionRow(optionsEditor, parent, topic, name, description, defaultValue, editable, requireSaveNetwork) {
657 myFilenameTextField->setText(myOptionsEditor->myOptionsContainer.getValueString(myName).c_str());
664 myFilenameTextField->setText(myOptionsEditor->myOriginalOptionsContainer.getValueString(myName).c_str());
665 onCmdSetOption(
nullptr, 0,
nullptr);
673 if (myName.find(
"output") != std::string::npos || myName.find(
"log") != std::string::npos) {
675 }
else if (myName.find(
"files") != std::string::npos) {
679 const GNEFileDialog XMLFileDialog(myOptionsEditor->myDialog->getApplicationWindow(), myOptionsEditor->myDialog,
697 myOptionsEditor->myOptionsContainer.resetWritable();
699 if (myFilenameTextField->getText().text() == myOptionsEditor->myOriginalOptionsContainer.getValueString(myName)) {
700 myOptionsEditor->myOptionsContainer.resetDefault(myName);
702 myOptionsEditor->myOptionsContainer.set(myName, myFilenameTextField->getText().text());
705 myOptionsEditor->myOptionsModified =
true;
706 if (myRequireSaveNetwork) {
707 myOptionsEditor->myRequireSaveNetwork =
true;
719 myFilenameTextField->setText(myDefaultValue.c_str());
730 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 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
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 requireSaveNetwork)
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, const bool requireSaveNetwork)
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 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
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 requireSaveNetwork)
constructor
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
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
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 requireSaveNetwork)
constructor
void restoreOption()
restore option
void updateOption()
update 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, const bool requireSaveNetwork)
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
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