17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 01:30:16 +01:00

feat(editor): the fields of the features switched off in the build are shown greyed with the reason instead of hidden

The frog, movable nose and 3D sleeper and timber fields of the track properties and the frog chips of the switch panel stay
in place while track_features::crossings or track_features::sleepers are off, greyed, with a tooltip saying the feature is
switched off in this build; nothing changes them, copying and pasting the properties leaves them out.
This commit is contained in:
maj00r
2026-10-21 17:34:41 +02:00
parent 4db3dd70d3
commit d0ff7be1c2
3 changed files with 23 additions and 10 deletions

View File

@@ -1081,18 +1081,21 @@ void editor_mode::render_turnout_ui()
drive_ui(*track);
if (set.has_value())
drive_ui(*set->second);
if (track_features::crossings)
{
bool frogs{track->SwitchExtension->m_frogs};
bool movable{track->SwitchExtension->m_movablenose};
char const *const frogtip{"Cuts the rails of the switch at its frog and lays wing rails and check rails.\n"
"Off for a switch whose include has its own model of them"};
char const *const nosetip{"The nose of the frog moves with the blades over to the wing rail of the track set, leaving no gap; the frog has no check rails"};
ImGui::BeginDisabled(false == track_features::crossings);
if (frogs)
toggle_chips("switchfrogs", {{STR_C("Frog and check rails made from the rails"), &frogs, frogtip}, {STR_C("Movable nose"), &movable, nosetip}});
else
toggle_chips("switchfrogs", {{STR_C("Frog and check rails made from the rails"), &frogs, frogtip}});
if (frogs != track->SwitchExtension->m_frogs || movable != track->SwitchExtension->m_movablenose)
ImGui::EndDisabled();
if (false == track_features::crossings && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
ImGui::SetTooltip("%s", STR_C("Switched off in this build of the simulator"));
if (track_features::crossings && (frogs != track->SwitchExtension->m_frogs || movable != track->SwitchExtension->m_movablenose))
{
auto const before{editor_track::capture(*track)};
track->SwitchExtension->m_frogs = frogs;