17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-18 14:59:19 +02:00

feat(editor): the toolbar as buttons with icons and names, the chosen tool standing out as the chosen field of work does, the names left out when the row is too narrow for them; the fields of work with icons of their own (surroundings, tracks, roads, terrain) and both rows captioned at their left end (work modes, tools); the tools of the toolbar and of the left edge of the 3d view from one list; Polish translation

This commit is contained in:
2026-10-09 12:49:45 +02:00
parent 1bf687b4c9
commit 3e3317d26f
10 changed files with 299 additions and 203 deletions

View File

@@ -814,45 +814,6 @@ void editor_mode::render_track_selection()
render_path_ui();
}
void editor_mode::render_track_toolbar()
{
auto const &modes{track_modes()};
auto const vehicle{m_track_tab == track_tab::lineside && m_vehicle.open};
// a tool chosen again gives way to the select one
auto const tool = [&](track_tab const Tab) {
auto const found{std::find_if(modes.begin(), modes.end(), [&](track_mode const &Mode) { return Mode.tab == Tab; })};
if (found == modes.end())
return;
auto const chosen{m_track_tab == Tab && false == (Tab == track_tab::lineside && vehicle)};
auto const label{std::string{STR_C(found->label)} + "###tracktool" + std::to_string(static_cast<int>(found - modes.begin()))};
if (ImGui::MenuItem(label.c_str(), nullptr, chosen))
show_track_tab(chosen ? track_tab::path : Tab);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s [%s]", STR_C(found->tooltip), found->key);
};
// building the track, what goes by it, the checks
for (auto const tab : {track_tab::path, track_tab::lay, track_tab::turnout, track_tab::straights, track_tab::route, track_tab::turntable})
tool(tab);
ImGui::Separator();
tool(track_tab::signals);
tool(track_tab::lineside);
// the vehicle to drive is one of the objects along the track
if (ImGui::MenuItem(STR_C("Vehicle"), nullptr, vehicle))
{
show_track_tab(vehicle ? track_tab::path : track_tab::lineside);
m_vehicle.expand = false == vehicle;
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("A vehicle to drive, put on the selected track; it isn't written to the scenery files"));
ImGui::Separator();
for (auto const tab : {track_tab::profile, track_tab::speed, track_tab::joints, track_tab::infra})
tool(tab);
if (ImGui::MenuItem(STR_C("Structure gauge"), nullptr, m_gauge.open))
m_gauge.open = !m_gauge.open;
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", STR_C("Checks which models enter the structure gauge of the tracks and the clearance over the roads (skrajnia budowli)"));
}
void editor_mode::render_track_guide()
{
auto const hints{track_key_hints(false)};