mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-31 23:59:03 +01:00
refactor(editor): the tools get the roles of the editor they need, not all of it
editor_services was growing into one interface every tool depended on whole. It splits into the roles the editor plays for its tools: the selection, the view, the undo history, the templates by the track, the ground with the terrain model, the track design and the guide of the first steps. Each tool is handed only the roles it uses, so what it depends on can be read from its constructor; editor_services stays as the sum of the roles the editor implements.
This commit is contained in:
@@ -31,7 +31,7 @@ class joints_tool final : public editor_tool
|
||||
double value{0.0}; // m, deg, mm, per mille; m of the track over the terrain model
|
||||
bool fixed{false};
|
||||
};
|
||||
explicit joints_tool(editor_services &Services) : m_services{Services} {}
|
||||
joints_tool(editor_selection &Selection, editor_view &View, editor_history &History, editor_ground &Ground) : m_selection{Selection}, m_view{View}, m_history{History}, m_ground{Ground} {}
|
||||
void update() override;
|
||||
void draw_overlay() const override;
|
||||
void render_options() override;
|
||||
@@ -40,7 +40,10 @@ class joints_tool final : public editor_tool
|
||||
double kink_angle() const { return m_joints.angle; }
|
||||
|
||||
private:
|
||||
editor_services &m_services;
|
||||
editor_selection &m_selection;
|
||||
editor_view &m_view;
|
||||
editor_history &m_history;
|
||||
editor_ground &m_ground;
|
||||
// joints of the paths: ends which almost meet, steps, kinks, jumps of the cant and of the grade
|
||||
struct joints_state
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user