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

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

The first step of taking the tools out of editor_mode: a tool keeps its
own state and reaches the editor through editor_services, the few things
it needs from it, instead of through every member of the editor. The
editor holds its tools in a list for the hooks they share: a deleted
node is forgotten by all of them in one place, and a self-test command
the editor doesn't know goes to each of them.

The gauge moves with its state, its window and its self-test command;
the ImGui ids and the texts stay the same, and the self-test gives the
same hits on the test scenery as before.
This commit is contained in:
maj00r
2026-10-21 09:00:59 +02:00
parent a168e2ccfc
commit 3c9c90b468
9 changed files with 232 additions and 123 deletions

View File

@@ -396,21 +396,6 @@ editor_mode::selftest_result editor_mode::selftest_sweep(std::string const &comm
ui()->expand_bend();
return selftest_result::handled;
}
if (command == "gauge")
{
std::string name;
words >> name;
if (auto *track{simulation::Paths.find(name)})
{
scan_gauge(*track);
WriteLog(format("SELFTEST gauge %s: %d hits", name.c_str(), static_cast<int>(m_gauge.line.hits.size())));
for (auto const &hit : m_gauge.line.hits)
WriteLog(format("SELFTEST gauge hit %s depth %.3f at %.2f %.2f %.2f", hit.model.c_str(), hit.depth, hit.point.x, hit.point.y, hit.point.z));
}
else
WriteLog("SELFTEST gauge " + name + ": no such track");
return selftest_result::handled;
}
if (command == "ttincludes")
{
std::string name;