@@ -62,13 +62,14 @@ FXIMPLEMENT_ABSTRACT(GNEOptionsEditorRow::OptionFilename, GNEOptionsEditorRow:
6262// ---------------------------------------------------------------------------
6363
6464GNEOptionsEditorRow::OptionRow::OptionRow(GNEOptionsEditor* optionsEditor, FXComposite* parent, const std::string& topic,
65- const std::string& name, const std::string& description, const std::string& defaultValue) :
65+ const std::string& name, const std::string& description, const std::string& defaultValue, const bool editable ) :
6666 FXHorizontalFrame(parent, GUIDesignAuxiliarHorizontalFrame),
6767 myOptionsEditor(optionsEditor),
6868 myTopic(topic),
6969 myName(name),
7070 myDescription(description),
71- myDefaultValue(defaultValue) {
71+ myDefaultValue(defaultValue),
72+ myEditable(editable) {
7273 // build label with name (default width 150)
7374 myNameLabel = new MFXLabelTooltip (this , myOptionsEditor->myDialog ->getApplicationWindow ()->getStaticTooltipMenu (),
7475 name.c_str (), nullptr , GUIDesignLabelThickedFixed (MINNAMEWIDTH));
@@ -122,10 +123,14 @@ GNEOptionsEditorRow::OptionRow::updateResetButton() {
122123// ---------------------------------------------------------------------------
123124
124125GNEOptionsEditorRow::OptionString::OptionString (GNEOptionsEditor* optionsEditor, FXComposite* parent,
125- const std::string& topic, const std::string& name, const std::string& description, const std::string& defaultValue) :
126- OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
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) {
127129 myStringTextField = new FXTextField (myContentFrame, GUIDesignTextFieldNCol, this , MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
128130 myStringTextField->setText (myOptionsEditor->myOptionsContainer .getString (name).c_str ());
131+ if (!editable) {
132+ myStringTextField->disable ();
133+ }
129134 updateOption ();
130135}
131136
@@ -169,9 +174,13 @@ GNEOptionsEditorRow::OptionString::getValue() const {
169174
170175
171176GNEOptionsEditorRow::OptionStringVector::OptionStringVector (GNEOptionsEditor* optionsEditor, FXComposite* parent,
172- const std::string& topic, const std::string& name, const std::string& description, const std::string& defaultValue) :
173- OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
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) {
174180 myStringVectorTextField = new FXTextField (myContentFrame, GUIDesignTextFieldNCol, this , MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
181+ if (!editable) {
182+ myStringVectorTextField->disable ();
183+ }
175184 updateOption ();
176185}
177186
@@ -218,9 +227,13 @@ GNEOptionsEditorRow::OptionStringVector::getValue() const {
218227// ---------------------------------------------------------------------------
219228
220229GNEOptionsEditorRow::OptionBool::OptionBool (GNEOptionsEditor* optionsEditor, FXComposite* parent,
221- const std::string& topic, const std::string& name, const std::string& description, const std::string& defaultValue) :
222- OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
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) {
223233 myCheckButton = new FXCheckButton (myContentFrame, " " , this , MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
234+ if (!editable) {
235+ myCheckButton->disable ();
236+ }
224237 updateOption ();
225238}
226239
@@ -301,9 +314,13 @@ GNEOptionsEditorRow::OptionBool::getValue() const {
301314// ---------------------------------------------------------------------------
302315
303316GNEOptionsEditorRow::OptionInt::OptionInt (GNEOptionsEditor* optionsEditor, FXComposite* parent,
304- const std::string& topic, const std::string& name, const std::string& description, const std::string& defaultValue) :
305- OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
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) {
306320 myIntTextField = new FXTextField (myContentFrame, GUIDesignTextFieldNCol, this , MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted (TEXTFIELD_INTEGER));
321+ if (!editable) {
322+ myIntTextField->disable ();
323+ }
307324 updateOption ();
308325}
309326
@@ -354,10 +371,14 @@ GNEOptionsEditorRow::OptionInt::getValue() const {
354371// ---------------------------------------------------------------------------
355372
356373GNEOptionsEditorRow::OptionIntVector::OptionIntVector (GNEOptionsEditor* optionsEditor, FXComposite* parent,
357- const std::string& topic, const std::string& name, const std::string& description, const std::string& defaultValue) :
358- OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
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) {
359377 myIntVectorTextField = new FXTextField (myContentFrame, GUIDesignTextFieldNCol, this , MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
360378 myIntVectorTextField->setText (toString (myOptionsEditor->myOptionsContainer .getIntVector (name)).c_str ());
379+ if (!editable) {
380+ myIntVectorTextField->disable ();
381+ }
361382 updateOption ();
362383}
363384
@@ -413,11 +434,15 @@ GNEOptionsEditorRow::OptionIntVector::getValue() const {
413434// GNEOptionsEditorRow::OptionFloat - methods
414435// ---------------------------------------------------------------------------
415436
416- GNEOptionsEditorRow::OptionFloat::OptionFloat (GNEOptionsEditor* optionsEditor, FXComposite* parent, const std::string& topic,
417- const std::string& name, const std::string& description, const std::string& defaultValue) :
418- OptionRow(optionsEditor, parent, topic, name, description, parseFloat(defaultValue)) {
437+ GNEOptionsEditorRow::OptionFloat::OptionFloat (GNEOptionsEditor* optionsEditor, FXComposite* parent,
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) {
419441 myFloatTextField = new FXTextField (myContentFrame, GUIDesignTextFieldNCol, this , MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted (TEXTFIELD_REAL));
420442 myFloatTextField->setText (toString (myOptionsEditor->myOptionsContainer .getFloat (name)).c_str ());
443+ if (!editable) {
444+ myFloatTextField->disable ();
445+ }
421446 updateOption ();
422447}
423448
@@ -478,11 +503,15 @@ GNEOptionsEditorRow::OptionFloat::parseFloat(const std::string& value) const {
478503// GNEOptionsEditorRow::OptionTime - methods
479504// ---------------------------------------------------------------------------
480505
481- GNEOptionsEditorRow::OptionTime::OptionTime (GNEOptionsEditor* optionsEditor, FXComposite* parent, const std::string& topic,
482- const std::string& name, const std::string& description, const std::string& defaultValue) :
483- OptionRow(optionsEditor, parent, topic, name, description, parseTime(defaultValue)) {
506+ GNEOptionsEditorRow::OptionTime::OptionTime (GNEOptionsEditor* optionsEditor, FXComposite* parent,
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) {
484510 myTimeTextField = new FXTextField (myContentFrame, GUIDesignTextFieldNCol, this , MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
485511 myTimeTextField->setText (toString (myOptionsEditor->myOptionsContainer .getString (name)).c_str ());
512+ if (!editable) {
513+ myTimeTextField->disable ();
514+ }
486515 updateOption ();
487516}
488517
@@ -544,11 +573,15 @@ GNEOptionsEditorRow::OptionTime::parseTime(const std::string& value) const {
544573// ---------------------------------------------------------------------------
545574
546575GNEOptionsEditorRow::OptionFilename::OptionFilename (GNEOptionsEditor* optionsEditor, FXComposite* parent, const std::string& topic,
547- const std::string& name, const std::string& description, const std::string& defaultValue) :
548- OptionRow(optionsEditor, parent, topic, name, description, defaultValue) {
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 ) {
549578 myOpenFilenameButton = GUIDesigns::buildFXButton (myContentFrame, " " , " " , TL (" Select filename" ),
550579 GUIIconSubSys::getIcon (GUIIcon::OPEN), this , MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonIcon);
551580 myFilenameTextField = new FXTextField (myContentFrame, GUIDesignTextFieldNCol, this , MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
581+ if (!editable) {
582+ myOpenFilenameButton->disable ();
583+ myFilenameTextField->disable ();
584+ }
552585 updateOption ();
553586}
554587
0 commit comments