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

refactor(editor): the trainset is a tool of its own

The fourth tool out of editor_mode. The track under the cursor and the
first steps of the tutorial become types of their own, which the editor
gives to the tools, and a tool shown as a tab of the lineside panel keeps
its open and expanded flags in a tool_tab. The trainsets waiting for the
save are handed to the editor by the tool, which hears back when they
were written. The self-test command trainset moves with it.
This commit is contained in:
maj00r
2026-10-21 09:44:17 +02:00
parent 8ba8345faf
commit c45c4713d6
11 changed files with 188 additions and 121 deletions

View File

@@ -160,7 +160,7 @@ void editor_mode::work_area_tools(std::vector<tool_button> &Buttons)
}
case work_area::tracks:
{
auto const vehicle{m_track_tab == track_tab::lineside && m_vehicle.open};
auto const vehicle{m_track_tab == track_tab::lineside && m_vehicle.tab().open};
auto const add = [&](track_tab const Tab, bool const Group) {
auto const &modes{track_modes()};
auto const found{std::find_if(modes.begin(), modes.end(), [&](track_mode const &Mode) { return Mode.tab == Tab; })};
@@ -191,7 +191,7 @@ void editor_mode::work_area_tools(std::vector<tool_button> &Buttons)
add(track_tab::lineside, false);
Buttons.push_back({icon::vehicle, STR_C("Trainset"), nullptr, STR_C("A trainset on the selected track: written to the scenery on save, and to drive at once"), vehicle, [this, vehicle]() {
show_track_tab(vehicle ? track_tab::path : track_tab::lineside);
m_vehicle.expand = false == vehicle;
m_vehicle.tab().expand = false == vehicle;
}});
Buttons.back().accent = family_colour(1);
add(track_tab::profile, true);