From 6d0423b58a34c96cf524e01e671db0cfe27b87a9 Mon Sep 17 00:00:00 2001 From: maj00r Date: Thu, 15 Oct 2026 17:00:11 +0200 Subject: [PATCH] feat(editor): friendlier track editing: the point labels of a path are translated, a selected switch says that the turnout tool sets its geometry and offers Edit the switch (T), the geometry of its paths starts collapsed, the gizmo options show only on the tabs that use the gizmo, cancelling a laying clears its status and the status of a laying counts pieces and metres --- application/editormode.cpp | 3 ++- application/editormodetrack.cpp | 18 +++++++++++++----- lang/editor_pl.po | 26 +++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/application/editormode.cpp b/application/editormode.cpp index 27aa1a4a..509f273d 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -4787,7 +4787,8 @@ void editor_mode::render_gizmo_options() if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", STR_C("Wheel zooms. Hold the wheel and drag to pan.")); } - if (ui()->mode() == nodebank_panel::TRACK && track_plan_tab()) + if (ui()->mode() == nodebank_panel::TRACK && m_track_tab != track_tab::path && m_track_tab != track_tab::turnout && m_track_tab != track_tab::turntable && m_track_tab != track_tab::signals && + m_track_tab != track_tab::lineside) return; ImGui::Checkbox(STR_C("Enabled"), &m_gizmo_enabled); if (!m_gizmo_enabled) diff --git a/application/editormodetrack.cpp b/application/editormodetrack.cpp index e822dac8..225507fd 100644 --- a/application/editormodetrack.cpp +++ b/application/editormodetrack.cpp @@ -114,10 +114,10 @@ char const *point_label(editor_track::point_kind const Kind) { switch (Kind) { - case editor_track::point_kind::start: return "Start"; - case editor_track::point_kind::control1: return "Control 1"; - case editor_track::point_kind::control2: return "Control 2"; - default: return "End"; + case editor_track::point_kind::start: return STR_C("Start"); + case editor_track::point_kind::control1: return STR_C("Control 1"); + case editor_track::point_kind::control2: return STR_C("Control 2"); + default: return STR_C("End"); } } @@ -1494,6 +1494,13 @@ void editor_mode::render_path_ui() bool const geometry = editor_track::can_edit_geometry(*track, reason); if (false == geometry) ImGui::TextColored(ImVec4(1.0f, 0.6f, 0.2f, 1.0f), STR_C("Geometry locked: %s"), reason.c_str()); + if (track->eType == tt_Switch) + { + ImGui::TextWrapped("%s", STR_C("A switch: the turnout tool sets its geometry, side and drive")); + if (ImGui::Button(STR_C("Edit the switch (T)"))) + show_track_tab(track_tab::turnout); + item_tooltip("Opens the turnout tool with this switch"); + } auto const before = editor_track::capture(*track); enum class rebuild { none, parameters, geometry }; @@ -1512,7 +1519,7 @@ void editor_mode::render_path_ui() } }; - if (ImGui::CollapsingHeader(STR_C("Geometry"), ImGuiTreeNodeFlags_DefaultOpen)) + if (ImGui::CollapsingHeader(track->eType == tt_Switch ? STR_C("Geometry of the paths") : STR_C("Geometry"), track->eType == tt_Switch ? 0 : ImGuiTreeNodeFlags_DefaultOpen)) { for (int i = 0; i < static_cast(track->m_paths.size()); ++i) { @@ -5188,6 +5195,7 @@ void editor_mode::lay_cancel() tool.start = {}; tool.chain.clear(); tool.preview.clear(); + tool.status.clear(); } void editor_mode::lay_after_history(bool const Undo) diff --git a/lang/editor_pl.po b/lang/editor_pl.po index 5d2c3725..7e47b164 100644 --- a/lang/editor_pl.po +++ b/lang/editor_pl.po @@ -915,6 +915,30 @@ msgstr "Odcinek %d" msgid "(+) joined with another track, (-) a free end" msgstr "(+) połączony z innym torem, (-) wolny koniec" +msgid "Start" +msgstr "Początek" + +msgid "Control 1" +msgstr "Wektor 1" + +msgid "Control 2" +msgstr "Wektor 2" + +msgid "End" +msgstr "Koniec" + +msgid "A switch: the turnout tool sets its geometry, side and drive" +msgstr "To rozjazd: geometrię, stronę i napęd ustawia narzędzie Rozjazd" + +msgid "Edit the switch (T)" +msgstr "Edytuj rozjazd (T)" + +msgid "Opens the turnout tool with this switch" +msgstr "Otwiera narzędzie Rozjazd z tym rozjazdem" + +msgid "Geometry of the paths" +msgstr "Geometria odcinków" + msgid "Start (%.2f, %.2f, %.2f) End (%.2f, %.2f, %.2f)" msgstr "Początek (%.2f, %.2f, %.2f) Koniec (%.2f, %.2f, %.2f)" @@ -1270,7 +1294,7 @@ msgid "Click at least two points" msgstr "Kliknij co najmniej dwa punkty" msgid "Laid %zu paths, %.1f m" -msgstr "Ułożono %zu torów, %.1f m" +msgstr "Ułożone odcinki: %zu, razem %.1f m" msgid "The curvature changes abruptly where the track joins, there's no room for a transition curve" msgstr "Na styku z torem krzywizna zmienia się skokowo, nie ma miejsca na krzywą przejściową"