Skip to content

Commit

Permalink
Renamed defines. Refs #15776
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Nov 28, 2024
1 parent df0b0a8 commit f60ec5c
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/netedit/frames/GNEAttributeRow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ FXIMPLEMENT(GNEAttributeRow, FXHorizontalFrame, GNEAttributeRowMap
// defines
// ===========================================================================

#define TEXTBLACK FXRGB(0, 0, 0)
#define TEXTBLUE FXRGB(0, 0, 255)
#define TEXTRED FXRGB(255, 0, 0)
#define BACKGROUND_RED FXRGBA(255, 213, 213, 255)
#define BACKGROUND_WHITE FXRGB(255, 255, 255)
#define TEXTCOLOR_BLACK FXRGB(0, 0, 0)
#define TEXTCOLOR_BLUE FXRGB(0, 0, 255)
#define TEXTCOLOR_RED FXRGB(255, 0, 0)
#define TEXTCOLOR_BACKGROUND_RED FXRGBA(255, 213, 213, 255)
#define TEXTCOLOR_BACKGROUND_WHITE FXRGB(255, 255, 255)

// ===========================================================================
// method definitions
Expand Down Expand Up @@ -226,9 +226,9 @@ GNEAttributeRow::isCurrentValueValid() const {
// check box have always a valid Value
return true;
} else if (myValueTextField->shown()) {
return ((myValueTextField->getTextColor() == TEXTBLACK) || (myValueTextField->getTextColor() == TEXTBLUE));
return ((myValueTextField->getTextColor() == TEXTCOLOR_BLACK) || (myValueTextField->getTextColor() == TEXTCOLOR_BLUE));
} else if (myValueComboBox->shown()) {
return ((myValueComboBox->getTextColor() == TEXTBLACK) || (myValueComboBox->getTextColor() == TEXTBLUE));
return ((myValueComboBox->getTextColor() == TEXTCOLOR_BLACK) || (myValueComboBox->getTextColor() == TEXTCOLOR_BLUE));
} else {
return false;
}
Expand Down Expand Up @@ -313,18 +313,23 @@ GNEAttributeRow::onCmdSetAttribute(FXObject* obj, FXSelector, void*) {
// check if the new comboBox value is valid
if (editedAC->isValid(myAttribute, newValue)) {
myAttributeTable->setAttribute(myAttribute, newValue);
myValueComboBox->setTextColor(TEXTBLACK);
myValueComboBox->setBackColor(BACKGROUND_WHITE);
myValueComboBox->setTextColor(TEXTCOLOR_BLACK);
myValueComboBox->setBackColor(TEXTCOLOR_BACKGROUND_WHITE);
} else {
// edit colors
myValueComboBox->setTextColor(TEXTRED);
myValueComboBox->setTextColor(TEXTCOLOR_RED);
if (newValue.empty()) {
myValueComboBox->setBackColor(BACKGROUND_RED);
myValueComboBox->setBackColor(TEXTCOLOR_BACKGROUND_RED);
}
// Write Warning in console if we're in testing mode
WRITE_DEBUG(TLF("ComboBox value '%' for attribute % of % isn't valid", newValue, attrProperties.getAttrStr(), attrProperties.getTagPropertyParent().getTagStr()));
}
} else if (obj == myValueTextField) {
// check if we're merging junction
//if (!mergeJunction(myACAttr.getAttr(), newVal)) {
// if its valid for the first AC than its valid for all (of the same type)


// first check if set default value
if (myValueTextField->getText().empty() && attrProperties.hasDefaultValue()) {
// update text field without notify
Expand Down Expand Up @@ -357,12 +362,12 @@ GNEAttributeRow::onCmdSetAttribute(FXObject* obj, FXSelector, void*) {
// check if the new textField value is valid
if (editedAC->isValid(myAttribute, newValue)) {
myAttributeTable->setAttribute(myAttribute, newValue);
myValueTextField->setTextColor(TEXTBLACK);
myValueTextField->setTextColor(TEXTCOLOR_BLACK);
} else {
// edit colors
myValueTextField->setTextColor(TEXTRED);
myValueTextField->setTextColor(TEXTCOLOR_RED);
if (newValue.empty()) {
myValueTextField->setBackColor(BACKGROUND_RED);
myValueTextField->setBackColor(TEXTCOLOR_BACKGROUND_RED);
}
// Write Warning in console if we're in testing mode
WRITE_DEBUG(TLF("TextField value '%' for attribute % of % isn't valid", newValue, attrProperties.getAttrStr(), attrProperties.getTagPropertyParent().getTagStr()));
Expand Down Expand Up @@ -565,8 +570,8 @@ GNEAttributeRow::showValueComboBox(const GNEAttributeProperties& attrProperty, c
if (allValuesEqual) {
// clear and enable comboBox
myValueComboBox->clearItems();
myValueComboBox->setTextColor(TEXTBLACK);
myValueComboBox->setBackColor(BACKGROUND_WHITE);
myValueComboBox->setTextColor(TEXTCOLOR_BLACK);
myValueComboBox->setBackColor(TEXTCOLOR_BACKGROUND_WHITE);
if (enabled) {
myValueComboBox->enable();
} else {
Expand Down Expand Up @@ -653,9 +658,9 @@ GNEAttributeRow::showValueString(const GNEAttributeProperties& attrProperty, con
// clear and enable comboBox
myValueTextField->setText(value.c_str());
if (computed) {
myValueTextField->setTextColor(TEXTBLUE);
myValueTextField->setTextColor(TEXTCOLOR_BLUE);
} else {
myValueTextField->setTextColor(TEXTBLACK);
myValueTextField->setTextColor(TEXTCOLOR_BLACK);
}
if (enabled) {
myValueTextField->enable();
Expand Down

0 comments on commit f60ec5c

Please sign in to comment.