From de937d9d25b110120226618bf4e184e547daa274 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 29 Sep 2015 12:46:09 +0000 Subject: [PATCH] fixing invalid colors due to static initialization dependency refs #457 git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk@18964 afbd958f-9f77-42d5-a016-97a22340ccf4 --- sumo/src/netedit/GNEConnector.cpp | 17 ++++++++++++----- sumo/src/netedit/GNEConnector.h | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/sumo/src/netedit/GNEConnector.cpp b/sumo/src/netedit/GNEConnector.cpp index cfc5744af80b..c5d17e26af0a 100644 --- a/sumo/src/netedit/GNEConnector.cpp +++ b/sumo/src/netedit/GNEConnector.cpp @@ -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 @@ -150,6 +150,13 @@ GNEConnector::GNEConnector(FXComposite* parent, GNEViewNet* updateTarget, GNEUnd // Selection Hint new FXLabel(myContentFrame, "Hold 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); diff --git a/sumo/src/netedit/GNEConnector.h b/sumo/src/netedit/GNEConnector.h index d4026c1cba25..e83896b07e36 100644 --- a/sumo/src/netedit/GNEConnector.h +++ b/sumo/src/netedit/GNEConnector.h @@ -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;