Skip to content

Commit

Permalink
Renamed GNEAttributeRow to GNEAttributesEditorRow. Refs #15776
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Nov 28, 2024
1 parent ec466e2 commit 9d12099
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 63 deletions.
4 changes: 2 additions & 2 deletions src/netedit/frames/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ set(netedit_frames_SRCS
GNEPlanCreator.cpp
GNEPlanCreatorLegend.h
GNEPlanCreatorLegend.cpp
GNEAttributeRow.h
GNEAttributeRow.cpp
GNEAttributesEditorRow.h
GNEAttributesEditorRow.cpp
GNEAttributesEditor.h
GNEAttributesEditor.cpp
)
Expand Down
16 changes: 8 additions & 8 deletions src/netedit/frames/GNEAttributesEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
/****************************************************************************/
/// @file GNEAttributeRow.cpp
/// @file GNEAttributesEditorRow.cpp
/// @author Pablo Alvarez Lopez
/// @date Nov 2024
///
Expand Down Expand Up @@ -42,7 +42,7 @@
#include <utils/foxtools/MFXLabelTooltip.h>

#include "GNEAttributesEditor.h"
#include "GNEAttributeRow.h"
#include "GNEAttributesEditorRow.h"

// ===========================================================================
// FOX callback mapping
Expand All @@ -66,10 +66,10 @@ GNEAttributesEditor::GNEAttributesEditor(GNEFrame* frameParent, const int editor
MFXGroupBoxModule(frameParent, TL("Internal attributes")),
myFrameParent(frameParent),
myEditorOptions(editorOptions) {
// resize myAttributeRows and fill it with attribute rows
myAttributeRows.resize(MAX_ATTR);
// resize myAttributesEditorRows and fill it with attribute rows
myAttributesEditorRows.resize(MAX_ATTR);
for (int i = 0; i < MAX_ATTR; i++) {
myAttributeRows[i] = new GNEAttributeRow(this);
myAttributesEditorRows[i] = new GNEAttributesEditorRow(this);
}
// Create help button
myHelpButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Help"), "", "", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
Expand Down Expand Up @@ -98,7 +98,7 @@ void
GNEAttributesEditor::hideAttributeTableModule() {
myEditedACs.clear();
// hide all rows before hidding table
for (const auto& row : myAttributeRows) {
for (const auto& row : myAttributesEditorRows) {
row->hideAttributeRow();
}
hide();
Expand All @@ -119,12 +119,12 @@ GNEAttributesEditor::refreshAttributeTable() {
if (((myEditorOptions & EditorOptions::FLOW_ATTRIBUTES) == 0) && attrProperty.isFlow()) {
continue;
}
myAttributeRows[itRows]->showAttributeRow(attrProperty);
myAttributesEditorRows[itRows]->showAttributeRow(attrProperty);
itRows++;
}
// hide rest of rows before showing table
for (int i = itRows; i < MAX_ATTR; i++) {
myAttributeRows[i]->hideAttributeRow();
myAttributesEditorRows[i]->hideAttributeRow();
}
show();
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/netedit/frames/GNEAttributesEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class GNEFrame;
class GNEAttributeCarrier;
class GNEAttributeRow;
class GNEAttributesEditorRow;

// ===========================================================================
// class GNEAttributesEditor
Expand All @@ -40,7 +40,7 @@ class GNEAttributesEditor : public MFXGroupBoxModule {
FXDECLARE(GNEAttributesEditor)

/// @brief declare friend class
friend class GNEAttributeRow;
friend class GNEAttributesEditorRow;

public:

Expand Down Expand Up @@ -101,8 +101,8 @@ class GNEAttributesEditor : public MFXGroupBoxModule {
/// @brief current edited ACs
std::vector<GNEAttributeCarrier*> myEditedACs;

/// @brief list of attribute rows
std::vector<GNEAttributeRow*> myAttributeRows;
/// @brief list of attributes editor rows
std::vector<GNEAttributesEditorRow*> myAttributesEditorRows;

/// @brief button for help
FXButton* myHelpButton = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
/****************************************************************************/
/// @file GNEAttributesEditor.cpp
/// @file GNEAttributesEditorRow.h
/// @author Pablo Alvarez Lopez
/// @date Nov 2024
///
// Table used for pack GNEAttributeRows
// Row used for edit attributes in GNEAttributesEditor
/****************************************************************************/
#include <config.h>

Expand All @@ -36,24 +36,24 @@
#include <utils/gui/images/POIIcons.h>
#include <utils/gui/windows/GUIAppEnum.h>

#include "GNEAttributeRow.h"
#include "GNEAttributesEditorRow.h"

// ===========================================================================
// FOX callback mapping
// ===========================================================================

FXDEFMAP(GNEAttributeRow) GNEAttributeRowMap[] = {
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE, GNEAttributeRow::onCmdSetAttribute),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_BOOL, GNEAttributeRow::onCmdToogleEnableAttribute),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_COLOR, GNEAttributeRow::onCmdOpenColorDialog),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_ALLOW, GNEAttributeRow::onCmdOpenAllowDialog),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_INSPECTPARENT, GNEAttributeRow::onCmdInspectParent),
FXMAPFUNC(SEL_COMMAND, MID_GNE_MOVELANE_UP, GNEAttributeRow::onCmdMoveElementLaneUp),
FXMAPFUNC(SEL_COMMAND, MID_GNE_MOVELANE_DOWN, GNEAttributeRow::onCmdMoveElementLaneDown)
FXDEFMAP(GNEAttributesEditorRow) GNEAttributeRowMap[] = {
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE, GNEAttributesEditorRow::onCmdSetAttribute),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_BOOL, GNEAttributesEditorRow::onCmdToogleEnableAttribute),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_COLOR, GNEAttributesEditorRow::onCmdOpenColorDialog),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_ALLOW, GNEAttributesEditorRow::onCmdOpenAllowDialog),
FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE_INSPECTPARENT, GNEAttributesEditorRow::onCmdInspectParent),
FXMAPFUNC(SEL_COMMAND, MID_GNE_MOVELANE_UP, GNEAttributesEditorRow::onCmdMoveElementLaneUp),
FXMAPFUNC(SEL_COMMAND, MID_GNE_MOVELANE_DOWN, GNEAttributesEditorRow::onCmdMoveElementLaneDown)
};

// Object implementation
FXIMPLEMENT(GNEAttributeRow, FXHorizontalFrame, GNEAttributeRowMap, ARRAYNUMBER(GNEAttributeRowMap))
FXIMPLEMENT(GNEAttributesEditorRow, FXHorizontalFrame, GNEAttributeRowMap, ARRAYNUMBER(GNEAttributeRowMap))

// ===========================================================================
// defines
Expand All @@ -69,7 +69,7 @@ FXIMPLEMENT(GNEAttributeRow, FXHorizontalFrame, GNEAttributeRowMap
// method definitions
// ===========================================================================

GNEAttributeRow::GNEAttributeRow(GNEAttributesEditor* attributeTable) :
GNEAttributesEditorRow::GNEAttributesEditorRow(GNEAttributesEditor* attributeTable) :
FXHorizontalFrame(attributeTable->getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame),
myAttributeTable(attributeTable) {
// get static tooltip menu
Expand Down Expand Up @@ -130,7 +130,7 @@ GNEAttributeRow::GNEAttributeRow(GNEAttributesEditor* attributeTable) :


void
GNEAttributeRow::showAttributeRow(const GNEAttributeProperties& attrProperty) {
GNEAttributesEditorRow::showAttributeRow(const GNEAttributeProperties& attrProperty) {
const auto multipleEditedACs = (myAttributeTable->myEditedACs.size() > 1);
const auto& tagProperty = attrProperty.getTagPropertyParent();
myAttribute = attrProperty.getAttr();
Expand Down Expand Up @@ -202,26 +202,26 @@ GNEAttributeRow::showAttributeRow(const GNEAttributeProperties& attrProperty) {
myValueLaneUpButton->hide();
myValueLaneDownButton->hide();
}
// Show GNEAttributeRow
// Show GNEAttributesEditorRow
show();
}
}


void
GNEAttributeRow::hideAttributeRow() {
GNEAttributesEditorRow::hideAttributeRow() {
hide();
}


bool
GNEAttributeRow::isAttributeRowShown() const {
GNEAttributesEditorRow::isAttributeRowShown() const {
return shown();
}


bool
GNEAttributeRow::isCurrentValueValid() const {
GNEAttributesEditorRow::isCurrentValueValid() const {
if (myValueCheckButton->shown()) {
// check box have always a valid Value
return true;
Expand All @@ -236,7 +236,7 @@ GNEAttributeRow::isCurrentValueValid() const {


long
GNEAttributeRow::onCmdOpenColorDialog(FXObject*, FXSelector, void*) {
GNEAttributesEditorRow::onCmdOpenColorDialog(FXObject*, FXSelector, void*) {
const auto& attrProperty = myAttributeTable->myEditedACs.front()->getTagProperty().getAttributeProperties(myAttribute);
// create FXColorDialog
FXColorDialog colordialog(this, TL("Color Dialog"));
Expand All @@ -259,7 +259,7 @@ GNEAttributeRow::onCmdOpenColorDialog(FXObject*, FXSelector, void*) {


long
GNEAttributeRow::onCmdOpenAllowDialog(FXObject*, FXSelector, void*) {
GNEAttributesEditorRow::onCmdOpenAllowDialog(FXObject*, FXSelector, void*) {
// declare values to be modified
std::string allowedVehicles = myValueTextField->getText().text();
// declare accept changes
Expand All @@ -275,28 +275,28 @@ GNEAttributeRow::onCmdOpenAllowDialog(FXObject*, FXSelector, void*) {


long
GNEAttributeRow::onCmdInspectParent(FXObject*, FXSelector, void*) {
GNEAttributesEditorRow::onCmdInspectParent(FXObject*, FXSelector, void*) {
myAttributeTable->inspectParent();
return 1;
}


long
GNEAttributeRow::onCmdMoveElementLaneUp(FXObject*, FXSelector, void*) {
GNEAttributesEditorRow::onCmdMoveElementLaneUp(FXObject*, FXSelector, void*) {
myAttributeTable->moveLaneUp();
return 1;
}


long
GNEAttributeRow::onCmdMoveElementLaneDown(FXObject*, FXSelector, void*) {
GNEAttributesEditorRow::onCmdMoveElementLaneDown(FXObject*, FXSelector, void*) {
myAttributeTable->moveLaneDown();
return 1;
}


long
GNEAttributeRow::onCmdSetAttribute(FXObject* obj, FXSelector, void*) {
GNEAttributesEditorRow::onCmdSetAttribute(FXObject* obj, FXSelector, void*) {
const auto& editedAC = myAttributeTable->myEditedACs.front();
const auto& attrProperties = editedAC->getTagProperty().getAttributeProperties(myAttribute);
// continue depending of clicked object
Expand Down Expand Up @@ -378,19 +378,19 @@ GNEAttributeRow::onCmdSetAttribute(FXObject* obj, FXSelector, void*) {


long
GNEAttributeRow::onCmdToogleEnableAttribute(FXObject*, FXSelector, void*) {
GNEAttributesEditorRow::onCmdToogleEnableAttribute(FXObject*, FXSelector, void*) {
myAttributeTable->toggleEnableAttribute(myAttribute, myAttributeCheckButton->getCheck() == TRUE);
return 0;
}


GNEAttributeRow::GNEAttributeRow() :
GNEAttributesEditorRow::GNEAttributesEditorRow() :
myAttributeTable(nullptr) {
}


const std::string
GNEAttributeRow::getAttributeValue(const GNEAttributeProperties& attrProperty) const {
GNEAttributesEditorRow::getAttributeValue(const GNEAttributeProperties& attrProperty) const {
// Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
std::set<std::string> values;
// iterate over edited attributes and insert every value in set
Expand All @@ -413,7 +413,7 @@ GNEAttributeRow::getAttributeValue(const GNEAttributeProperties& attrProperty) c


void
GNEAttributeRow::showAttributeCheckButton(const GNEAttributeProperties& attrProperty, const bool enabled) {
GNEAttributesEditorRow::showAttributeCheckButton(const GNEAttributeProperties& attrProperty, const bool enabled) {
myAttributeCheckButton->setText(attrProperty.getAttrStr().c_str());
myAttributeCheckButton->setCheck(enabled);
myAttributeCheckButton->show();
Expand All @@ -428,7 +428,7 @@ GNEAttributeRow::showAttributeCheckButton(const GNEAttributeProperties& attrProp


void
GNEAttributeRow::showAttributeParent(const GNEAttributeProperties& attrProperty, const bool enabled) {
GNEAttributesEditorRow::showAttributeParent(const GNEAttributeProperties& attrProperty, const bool enabled) {
// set icon and text
myAttributeParentButton->setIcon(GUIIconSubSys::getIcon(attrProperty.getTagPropertyParent().getGUIIcon()));
myAttributeParentButton->setText(attrProperty.getAttrStr().c_str());
Expand All @@ -449,7 +449,7 @@ GNEAttributeRow::showAttributeParent(const GNEAttributeProperties& attrProperty,


void
GNEAttributeRow::showAttributeVClass(const GNEAttributeProperties& attrProperty, const bool enabled) {
GNEAttributesEditorRow::showAttributeVClass(const GNEAttributeProperties& attrProperty, const bool enabled) {
// set icon and text
myAttributeVClassButton->setText(attrProperty.getAttrStr().c_str());
if (enabled) {
Expand All @@ -469,7 +469,7 @@ GNEAttributeRow::showAttributeVClass(const GNEAttributeProperties& attrProperty,


void
GNEAttributeRow::showAttributeColor(const GNEAttributeProperties& attrProperty, const bool enabled) {
GNEAttributesEditorRow::showAttributeColor(const GNEAttributeProperties& attrProperty, const bool enabled) {
myAttributeColorButton->setText(attrProperty.getAttrStr().c_str());
myAttributeColorButton->show();
if (enabled) {
Expand All @@ -488,7 +488,7 @@ GNEAttributeRow::showAttributeColor(const GNEAttributeProperties& attrProperty,


void
GNEAttributeRow::showAttributeLabel(const GNEAttributeProperties& attrProperty) {
GNEAttributesEditorRow::showAttributeLabel(const GNEAttributeProperties& attrProperty) {
myAttributeLabel->setText(attrProperty.getAttrStr().c_str());
myAttributeLabel->show();
// hide other elements
Expand All @@ -502,8 +502,8 @@ GNEAttributeRow::showAttributeLabel(const GNEAttributeProperties& attrProperty)


void
GNEAttributeRow::showValueCheckButton(const GNEAttributeProperties& attrProperty, const std::string& value,
const bool computed, const bool enabled) {
GNEAttributesEditorRow::showValueCheckButton(const GNEAttributeProperties& attrProperty, const std::string& value,
const bool computed, const bool enabled) {
// first we need to check if all boolean values are equal
bool allValuesEqual = true;
// declare boolean vector
Expand Down Expand Up @@ -550,8 +550,8 @@ GNEAttributeRow::showValueCheckButton(const GNEAttributeProperties& attrProperty


void
GNEAttributeRow::showValueComboBox(const GNEAttributeProperties& attrProperty, const std::string& value,
const bool computed, const bool enabled) {
GNEAttributesEditorRow::showValueComboBox(const GNEAttributeProperties& attrProperty, const std::string& value,
const bool computed, const bool enabled) {
// first we need to check if all boolean values are equal
bool allValuesEqual = true;
// declare boolean vector
Expand Down Expand Up @@ -653,8 +653,8 @@ GNEAttributeRow::showValueComboBox(const GNEAttributeProperties& attrProperty, c


void
GNEAttributeRow::showValueString(const GNEAttributeProperties& attrProperty, const std::string& value,
const bool enabled, const bool computed) {
GNEAttributesEditorRow::showValueString(const GNEAttributeProperties& attrProperty, const std::string& value,
const bool enabled, const bool computed) {
// clear and enable comboBox
myValueTextField->setText(value.c_str());
if (computed) {
Expand All @@ -678,7 +678,7 @@ GNEAttributeRow::showValueString(const GNEAttributeProperties& attrProperty, con


void
GNEAttributeRow::showMoveLaneButtons(const std::string& laneID) {
GNEAttributesEditorRow::showMoveLaneButtons(const std::string& laneID) {
// retrieve lane
const auto lane = myAttributeTable->myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(laneID, false);
// check lane
Expand All @@ -704,7 +704,7 @@ GNEAttributeRow::showMoveLaneButtons(const std::string& laneID) {


void
GNEAttributeRow::enableDependingOfSupermode(const GNEAttributeProperties& attrProperty) {
GNEAttributesEditorRow::enableDependingOfSupermode(const GNEAttributeProperties& attrProperty) {
const auto& editModes = myAttributeTable->myFrameParent->getViewNet()->getEditModes();
const auto& tagProperty = attrProperty.getTagPropertyParent();
// by default we assume that elements are disabled
Expand Down Expand Up @@ -760,7 +760,7 @@ GNEAttributeRow::enableDependingOfSupermode(const GNEAttributeProperties& attrPr

/*
bool
GNEAttributeRow::mergeJunction(SumoXMLAttr attr, const std::string& newVal) const {
GNEAttributesEditorRow::mergeJunction(SumoXMLAttr attr, const std::string& newVal) const {
const auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
const auto& inspectedElements = viewNet->getInspectedElements();
// check if we're editing junction position
Expand Down
Loading

0 comments on commit 9d12099

Please sign in to comment.