diff --git a/Track.cpp b/Track.cpp index bf80b949..645bbb89 100644 --- a/Track.cpp +++ b/Track.cpp @@ -2364,6 +2364,19 @@ TTrack::export_as_text_( std::ostream &Output ) const { << "\n"; } +// Returns the tooltip of this Track, which may contain a list of isolations if the track belongs to any. +std::string TTrack::tooltip() const +{ + std::string tooltip = this->name(); + if (!Isolated.empty()) + { + tooltip += "\nIsolated:"; + for (const auto isolation : Isolated) + tooltip += " " + isolation->asName; + } + return tooltip; +} + // locates specified profile in the profile database, potentially loading it from a file // returns: pair std::pair diff --git a/Track.h b/Track.h index ccecc6ea..f29b3b37 100644 --- a/Track.h +++ b/Track.h @@ -316,6 +316,7 @@ public: void ConnectionsLog(); bool DoubleSlip() const; static void fetch_default_profiles(); + std::string tooltip() const override; private: // types diff --git a/drivermode.cpp b/drivermode.cpp index 784e11a5..d8f5dc58 100644 --- a/drivermode.cpp +++ b/drivermode.cpp @@ -341,12 +341,10 @@ driver_mode::update() { set_tooltip( ( cabcontrol ? cabcontrol->pName : "" ) ); } } - if( ( true == Global.ControlPicking ) && ( true == FreeFlyModeFlag ) && ( true == DebugModeFlag ) ) { - auto const scenerynode = GfxRenderer->Pick_Node(); - set_tooltip( - ( scenerynode ? - scenerynode->name() : - "" ) ); + if( Global.ControlPicking && FreeFlyModeFlag && DebugModeFlag ) { + const auto sceneryNode = GfxRenderer->Pick_Node(); + const std::string content = sceneryNode ? sceneryNode->tooltip() : ""; + set_tooltip(content); } runonce = true; diff --git a/editoruilayer.cpp b/editoruilayer.cpp index 0af6d525..d8ac95fc 100644 --- a/editoruilayer.cpp +++ b/editoruilayer.cpp @@ -30,14 +30,10 @@ editor_ui::update() { set_tooltip( "" ); - if( ( true == Global.ControlPicking ) - && ( true == DebugModeFlag ) ) { - - auto const scenerynode = GfxRenderer->Pick_Node(); - set_tooltip( - ( scenerynode ? - scenerynode->name() : - "" ) ); + if( Global.ControlPicking && DebugModeFlag ) { + const auto sceneryNode = GfxRenderer->Pick_Node(); + const std::string content = sceneryNode ? sceneryNode->tooltip() : ""; + set_tooltip(content); } ui_layer::update(); diff --git a/scenenode.h b/scenenode.h index a63bd2a0..fbd16977 100644 --- a/scenenode.h +++ b/scenenode.h @@ -330,6 +330,7 @@ public: export_as_text( std::string &Output ) const; std::string const & name() const; + virtual std::string tooltip() const; void location( glm::dvec3 const Location ); glm::dvec3 const & @@ -379,6 +380,13 @@ basic_node::name() const { return m_name; } +// Returns the tooltip of this Node when hovered with the mouse cursor. +inline +std::string basic_node::tooltip() const +{ + return m_name; +} + inline void basic_node::location( glm::dvec3 const Location ) {