Skip to content

Commit

Permalink
fixing invalid colors due to static initialization dependency refs #457
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk@18964 afbd958f-9f77-42d5-a016-97a22340ccf4
  • Loading branch information
namdre committed Sep 29, 2015
1 parent 89fabbe commit de937d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
17 changes: 12 additions & 5 deletions sumo/src/netedit/GNEConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ FXIMPLEMENT(GNEConnector, FXScrollWindow, GNEConnectorMap, ARRAYNUMBER(GNEConnec
// static members
// ===========================================================================
const int GNEConnector::WIDTH = 140;
const RGBColor GNEConnector::sourceColor(RGBColor::CYAN);
const RGBColor GNEConnector::potentialTargetColor(RGBColor(0, 64, 0, 255));
const RGBColor GNEConnector::targetColor(RGBColor::GREEN);
const RGBColor GNEConnector::targetPassColor(RGBColor::MAGENTA);
const RGBColor GNEConnector::conflictColor(RGBColor::YELLOW);
RGBColor GNEConnector::sourceColor;
RGBColor GNEConnector::potentialTargetColor;
RGBColor GNEConnector::targetColor;
RGBColor GNEConnector::targetPassColor;
RGBColor GNEConnector::conflictColor;

// ===========================================================================
// method definitions
Expand Down Expand Up @@ -150,6 +150,13 @@ GNEConnector::GNEConnector(FXComposite* parent, GNEViewNet* updateTarget, GNEUnd
// Selection Hint
new FXLabel(myContentFrame, "Hold <SHIFT> while\nclicking to create\nunyielding conn's.\n", 0, JUSTIFY_LEFT);
// Legend
// init colors here to avoid static order fiasco (https://isocpp.org/wiki/faq/ctors#static-init-order)
sourceColor = RGBColor::CYAN;
potentialTargetColor = RGBColor(0, 64, 0, 255);
targetColor = RGBColor::GREEN;
targetPassColor = RGBColor::MAGENTA;
conflictColor = RGBColor::YELLOW;

new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
FXLabel* l;
new FXLabel(myContentFrame, "Color Legend:", 0, JUSTIFY_LEFT);
Expand Down
10 changes: 5 additions & 5 deletions sumo/src/netedit/GNEConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ class GNEConnector : public FXScrollWindow {
static const int WIDTH;

/// @brief color for the from-lane of a connection
static const RGBColor sourceColor;
static RGBColor sourceColor;
/// @brief color for the to-lane of a connection
static const RGBColor targetColor;
static RGBColor targetColor;
/// @brief color for a to-lane that cannot be used because another connection conflicts
static const RGBColor conflictColor;
static RGBColor conflictColor;
/// @brief color for the to-lane of a connection with pass attribute
static const RGBColor targetPassColor;
static RGBColor targetPassColor;
/// @brief color for potential to-lane targets (currently unconnected)
static const RGBColor potentialTargetColor;
static RGBColor potentialTargetColor;

private:
void updateDescription() const;
Expand Down

0 comments on commit de937d9

Please sign in to comment.