mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
Add isolation list to track tooltips
If a track is hovered when debug mode is on, it will now also show the names of isolated circuits the track belongs to, if any.
This commit is contained in:
13
Track.cpp
13
Track.cpp
@@ -2364,6 +2364,19 @@ TTrack::export_as_text_( std::ostream &Output ) const {
|
|||||||
<< "\n";
|
<< "\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
|
// locates specified profile in the profile database, potentially loading it from a file
|
||||||
// returns: pair <profile name, profile handle>
|
// returns: pair <profile name, profile handle>
|
||||||
std::pair<std::string, int>
|
std::pair<std::string, int>
|
||||||
|
|||||||
1
Track.h
1
Track.h
@@ -316,6 +316,7 @@ public:
|
|||||||
void ConnectionsLog();
|
void ConnectionsLog();
|
||||||
bool DoubleSlip() const;
|
bool DoubleSlip() const;
|
||||||
static void fetch_default_profiles();
|
static void fetch_default_profiles();
|
||||||
|
std::string tooltip() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// types
|
// types
|
||||||
|
|||||||
@@ -341,12 +341,10 @@ driver_mode::update() {
|
|||||||
set_tooltip( ( cabcontrol ? cabcontrol->pName : "" ) );
|
set_tooltip( ( cabcontrol ? cabcontrol->pName : "" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( ( true == Global.ControlPicking ) && ( true == FreeFlyModeFlag ) && ( true == DebugModeFlag ) ) {
|
if( Global.ControlPicking && FreeFlyModeFlag && DebugModeFlag ) {
|
||||||
auto const scenerynode = GfxRenderer->Pick_Node();
|
const auto sceneryNode = GfxRenderer->Pick_Node();
|
||||||
set_tooltip(
|
const std::string content = sceneryNode ? sceneryNode->tooltip() : "";
|
||||||
( scenerynode ?
|
set_tooltip(content);
|
||||||
scenerynode->name() :
|
|
||||||
"" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runonce = true;
|
runonce = true;
|
||||||
|
|||||||
@@ -30,14 +30,10 @@ editor_ui::update() {
|
|||||||
|
|
||||||
set_tooltip( "" );
|
set_tooltip( "" );
|
||||||
|
|
||||||
if( ( true == Global.ControlPicking )
|
if( Global.ControlPicking && DebugModeFlag ) {
|
||||||
&& ( true == DebugModeFlag ) ) {
|
const auto sceneryNode = GfxRenderer->Pick_Node();
|
||||||
|
const std::string content = sceneryNode ? sceneryNode->tooltip() : "";
|
||||||
auto const scenerynode = GfxRenderer->Pick_Node();
|
set_tooltip(content);
|
||||||
set_tooltip(
|
|
||||||
( scenerynode ?
|
|
||||||
scenerynode->name() :
|
|
||||||
"" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_layer::update();
|
ui_layer::update();
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ public:
|
|||||||
export_as_text( std::string &Output ) const;
|
export_as_text( std::string &Output ) const;
|
||||||
std::string const &
|
std::string const &
|
||||||
name() const;
|
name() const;
|
||||||
|
virtual std::string tooltip() const;
|
||||||
void
|
void
|
||||||
location( glm::dvec3 const Location );
|
location( glm::dvec3 const Location );
|
||||||
glm::dvec3 const &
|
glm::dvec3 const &
|
||||||
@@ -379,6 +380,13 @@ basic_node::name() const {
|
|||||||
return m_name;
|
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
|
inline
|
||||||
void
|
void
|
||||||
basic_node::location( glm::dvec3 const Location ) {
|
basic_node::location( glm::dvec3 const Location ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user