diff --git a/src/netedit/frames/GNEAttributesEditor.cpp b/src/netedit/frames/GNEAttributesEditor.cpp index 05da2ceac07..7527ba0fd3d 100644 --- a/src/netedit/frames/GNEAttributesEditor.cpp +++ b/src/netedit/frames/GNEAttributesEditor.cpp @@ -118,27 +118,56 @@ GNEAttributesEditor::hideAttributesEditor() { void GNEAttributesEditor::refreshAttributesEditor() { if (myEditedACs.size() > 0) { + const auto& tagProperty = myEditedACs.front()->getTagProperty(); // Iterate over tag property of first AC and show row for every attribute int itRows = 0; - for (const auto& attrProperty : myEditedACs.front()->getTagProperty()) { - // check if avoid show extended attributes - if (((myEditorOptions & EditorOptions::EXTENDED_ATTRIBUTES) == 0) && attrProperty.isExtended()) { - continue; + // check if show netedit attributes + if ((myEditorOptions & EditorOptions::NETEDIT_ATTRIBUTES) != 0) { + // front button + if (tagProperty.isDrawable()) { + myFrontButton->show(); + } else { + myFrontButton->hide(); } - // check if force show flow attributes - if (((myEditorOptions & EditorOptions::FLOW_ATTRIBUTES) == 0) && attrProperty.isFlow()) { - continue; - } else if (((myEditorOptions & EditorOptions::FLOW_ATTRIBUTES) != 0) && !attrProperty.isFlow()) { - continue; + // edit dialog + if (tagProperty.hasDialog()) { + // set text and icon + myOpenDialogButton->setText(TLF("Open % dialog", tagProperty.getTagStr()).c_str()); + myOpenDialogButton->setIcon(GUIIconSubSys::getIcon(tagProperty.getGUIIcon())); + myOpenDialogButton->show(); + } else { + myOpenDialogButton->hide(); } - // check if force show GEO attributes - if (((myEditorOptions & EditorOptions::GEO_ATTRIBUTES) == 0) && attrProperty.isGEO()) { - continue; - } else if (((myEditorOptions & EditorOptions::GEO_ATTRIBUTES) != 0) && !attrProperty.isGEO()) { - continue; + // extended attributes dialog + if (tagProperty.hasExtendedAttributes()) { + // set icon + myOpenExtendedAttributesButton->setIcon(GUIIconSubSys::getIcon(tagProperty.getGUIIcon())); + myOpenExtendedAttributesButton->show(); + } else { + myOpenExtendedAttributesButton->hide(); + } + } + // check if show basic attributes + if ((myEditorOptions & EditorOptions::BASIC_ATTRIBUTES) != 0) { + for (const auto& attrProperty : tagProperty) { + bool showAttributeRow = true; + // check show conditions + if (attrProperty.isExtended()) { + showAttributeRow = false; + } else if (((myEditorOptions & EditorOptions::FLOW_ATTRIBUTES) == 0) && attrProperty.isFlow()) { + showAttributeRow = false; + } else if (((myEditorOptions & EditorOptions::FLOW_ATTRIBUTES) != 0) && !attrProperty.isFlow()) { + showAttributeRow = false; + } else if (((myEditorOptions & EditorOptions::GEO_ATTRIBUTES) == 0) && attrProperty.isGEO()) { + showAttributeRow = false; + } else if (((myEditorOptions & EditorOptions::GEO_ATTRIBUTES) != 0) && !attrProperty.isGEO()) { + showAttributeRow = false; + } + if (showAttributeRow) { + myAttributesEditorRows[itRows]->showAttributeRow(attrProperty); + itRows++; + } } - myAttributesEditorRows[itRows]->showAttributeRow(attrProperty); - itRows++; } // hide rest of rows before showing table for (int i = itRows; i < MAX_ATTR; i++) { @@ -176,6 +205,8 @@ GNEAttributesEditor::onCmdOpenElementDialog(FXObject*, FXSelector, void*) { long GNEAttributesEditor::onCmdOpenExtendedAttributesDialog(FXObject*, FXSelector, void*) { + // open GNEAttributesCreator extended dialog + myFrameParent->attributesEditorExtendedDialogOpened(); return 1; } diff --git a/src/netedit/frames/GNEAttributesEditor.h b/src/netedit/frames/GNEAttributesEditor.h index afc196d1259..0e47974dade 100644 --- a/src/netedit/frames/GNEAttributesEditor.h +++ b/src/netedit/frames/GNEAttributesEditor.h @@ -47,10 +47,9 @@ class GNEAttributesEditor : public MFXGroupBoxModule { /// @brief Options for filter attributes enum EditorOptions { BASIC_ATTRIBUTES = 1 << 0, - EXTENDED_ATTRIBUTES = 1 << 1, - FLOW_ATTRIBUTES = 1 << 2, - GEO_ATTRIBUTES = 1 << 3, - NETEDIT_ATTRIBUTES = 1 << 4, // this include front, additional dialog and extended dialog + FLOW_ATTRIBUTES = 1 << 1, + GEO_ATTRIBUTES = 1 << 2, + NETEDIT_ATTRIBUTES = 1 << 3, // this include front, additional dialog and extended dialog }; /// @brief constructor diff --git a/src/netedit/frames/GNEFrameAttributeModules.cpp b/src/netedit/frames/GNEFrameAttributeModules.cpp index 3d99bce6689..027e295c1ae 100644 --- a/src/netedit/frames/GNEFrameAttributeModules.cpp +++ b/src/netedit/frames/GNEFrameAttributeModules.cpp @@ -43,10 +43,6 @@ // FOX callback mapping // =========================================================================== -FXDEFMAP(GNEFrameAttributeModules::AttributesEditorExtended) AttributesEditorExtendedMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_DIALOG, GNEFrameAttributeModules::AttributesEditorExtended::onCmdOpenDialog) -}; - FXDEFMAP(GNEFrameAttributeModules::GenericDataAttributes) GenericDataAttributesMap[] = { FXMAPFUNC(SEL_COMMAND, MID_GNE_OPEN_PARAMETERS_DIALOG, GNEFrameAttributeModules::GenericDataAttributes::onCmdEditParameters), FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE, GNEFrameAttributeModules::GenericDataAttributes::onCmdSetParameters) @@ -58,49 +54,13 @@ FXDEFMAP(GNEFrameAttributeModules::ParametersEditor) ParametersEditorMap[] = { }; // Object implementation -FXIMPLEMENT(GNEFrameAttributeModules::AttributesEditorExtended, MFXGroupBoxModule, AttributesEditorExtendedMap, ARRAYNUMBER(AttributesEditorExtendedMap)) FXIMPLEMENT(GNEFrameAttributeModules::GenericDataAttributes, MFXGroupBoxModule, GenericDataAttributesMap, ARRAYNUMBER(GenericDataAttributesMap)) FXIMPLEMENT(GNEFrameAttributeModules::ParametersEditor, MFXGroupBoxModule, ParametersEditorMap, ARRAYNUMBER(ParametersEditorMap)) - // =========================================================================== // method definitions // =========================================================================== -// --------------------------------------------------------------------------- -// GNEFrameAttributeModules::AttributesEditorExtended- methods -// --------------------------------------------------------------------------- - -GNEFrameAttributeModules::AttributesEditorExtended::AttributesEditorExtended(GNEFrame* frameParent) : - MFXGroupBoxModule(frameParent, TL("Extended attributes")), - myFrameParent(frameParent) { - // Create open dialog button - GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Open attributes editor"), "", "", nullptr, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButton); -} - - -GNEFrameAttributeModules::AttributesEditorExtended::~AttributesEditorExtended() {} - - -void -GNEFrameAttributeModules::AttributesEditorExtended::showAttributesEditorExtendedModule() { - show(); -} - - -void -GNEFrameAttributeModules::AttributesEditorExtended::hideAttributesEditorExtendedModule() { - hide(); -} - - -long -GNEFrameAttributeModules::AttributesEditorExtended::onCmdOpenDialog(FXObject*, FXSelector, void*) { - // open GNEAttributesCreator extended dialog - myFrameParent->attributesEditorExtendedDialogOpened(); - return 1; -} - // --------------------------------------------------------------------------- // GNEFrameAttributeModules::GenericDataAttributes - methods // --------------------------------------------------------------------------- diff --git a/src/netedit/frames/GNEFrameAttributeModules.h b/src/netedit/frames/GNEFrameAttributeModules.h index b90bf0546ca..5b72a2e8b9c 100644 --- a/src/netedit/frames/GNEFrameAttributeModules.h +++ b/src/netedit/frames/GNEFrameAttributeModules.h @@ -51,42 +51,6 @@ class GNEFrameAttributeModules { // =========================================================================== class AttributesEditor; - class AttributesEditorFlow; - - // =========================================================================== - // class AttributesEditorExtended - // =========================================================================== - - class AttributesEditorExtended : public MFXGroupBoxModule { - /// @brief FOX-declaration - FXDECLARE(GNEFrameAttributeModules::AttributesEditorExtended) - - public: - /// @brief constructor - AttributesEditorExtended(GNEFrame* frameParent); - - /// @brief destructor - ~AttributesEditorExtended(); - - /// @brief show AttributesEditorExtended modul - void showAttributesEditorExtendedModule(); - - /// @brief hide group box - void hideAttributesEditorExtendedModule(); - - /// @name FOX-callbacks - /// @{ - /// @brief Called when open dialog button is clicked - long onCmdOpenDialog(FXObject*, FXSelector, void*); - /// @} - - protected: - FOX_CONSTRUCTOR(AttributesEditorExtended) - - private: - /// @brief pointer to Frame Parent - GNEFrame* myFrameParent = nullptr; - }; // =========================================================================== // class GenericDataAttributes diff --git a/src/netedit/frames/demand/GNETypeFrame.cpp b/src/netedit/frames/demand/GNETypeFrame.cpp index d4f7049714c..44783c4f70d 100644 --- a/src/netedit/frames/demand/GNETypeFrame.cpp +++ b/src/netedit/frames/demand/GNETypeFrame.cpp @@ -148,7 +148,7 @@ GNETypeFrame::TypeSelector::refreshTypeSelector(const bool updateModuls) { myTypeFrameParent->myTypeEditor->refreshTypeEditorModule(); // show modules myTypeFrameParent->myTypeAttributesEditor->showAttributesEditor(myCurrentType); - myTypeFrameParent->myAttributesEditorExtended->showAttributesEditorExtendedModule(); + myTypeFrameParent->myAttributesEditorExtended->showAttributesEditor(myCurrentType); myTypeFrameParent->myParametersEditor->refreshParametersEditor(); } } @@ -167,7 +167,7 @@ GNETypeFrame::TypeSelector::onCmdSelectItem(FXObject*, FXSelector, void*) { myTypeFrameParent->myTypeEditor->refreshTypeEditorModule(); // show modules if selected item is valid myTypeFrameParent->myTypeAttributesEditor->showAttributesEditor(myCurrentType); - myTypeFrameParent->myAttributesEditorExtended->showAttributesEditorExtendedModule(); + myTypeFrameParent->myAttributesEditorExtended->showAttributesEditor(myCurrentType); myTypeFrameParent->myParametersEditor->refreshParametersEditor(); // Write Warning in console if we're in testing mode WRITE_DEBUG(("Selected item '" + myTypeComboBox->getText() + "' in TypeSelector").text()); @@ -181,7 +181,7 @@ GNETypeFrame::TypeSelector::onCmdSelectItem(FXObject*, FXSelector, void*) { myTypeFrameParent->myTypeEditor->refreshTypeEditorModule(); // hide all modules if selected item isn't valid myTypeFrameParent->myTypeAttributesEditor->hideAttributesEditor(); - myTypeFrameParent->myAttributesEditorExtended->hideAttributesEditorExtendedModule(); + myTypeFrameParent->myAttributesEditorExtended->hideAttributesEditor(); // set color of myTypeMatchBox to red (invalid) myTypeComboBox->setTextColor(FXRGB(255, 0, 0)); // Write Warning in console if we're in testing mode @@ -397,7 +397,7 @@ GNETypeFrame::GNETypeFrame(GNEViewParent* viewParent, GNEViewNet* viewNet) : myTypeAttributesEditor = new GNEAttributesEditor(this, TL("Attributes"), GNEAttributesEditor::EditorOptions::BASIC_ATTRIBUTES); // create module for open extended attributes dialog - myAttributesEditorExtended = new GNEFrameAttributeModules::AttributesEditorExtended(this); + myAttributesEditorExtended = new GNEAttributesEditor(this, TL("Extended attributes"), GNEAttributesEditor::EditorOptions::NETEDIT_ATTRIBUTES); /// create module for edit parameters myParametersEditor = new GNEFrameAttributeModules::ParametersEditor(this); @@ -416,7 +416,7 @@ GNETypeFrame::show() { myTypeSelector->refreshTypeSelector(true); // show modules myTypeAttributesEditor->showAttributesEditor(myTypeSelector->getCurrentType()); - myAttributesEditorExtended->showAttributesEditorExtendedModule(); + myAttributesEditorExtended->showAttributesEditor(myTypeSelector->getCurrentType()); // show frame GNEFrame::show(); } diff --git a/src/netedit/frames/demand/GNETypeFrame.h b/src/netedit/frames/demand/GNETypeFrame.h index 88d2bf4b79c..a65a3e19c72 100644 --- a/src/netedit/frames/demand/GNETypeFrame.h +++ b/src/netedit/frames/demand/GNETypeFrame.h @@ -175,8 +175,8 @@ class GNETypeFrame : public GNEFrame { /// @brief editorinternal vehicle type attributes GNEAttributesEditor* myTypeAttributesEditor = nullptr; - /// @brief modul for open extended attributes dialog - GNEFrameAttributeModules::AttributesEditorExtended* myAttributesEditorExtended = nullptr; + /// @brief attributes editor extended + GNEAttributesEditor* myAttributesEditorExtended = nullptr; /// @brief Parameters editor inspector GNEFrameAttributeModules::ParametersEditor* myParametersEditor;