diff --git a/Hardware/3rdparty/bugui b/Hardware/3rdparty/bugui index 556ec86..5641128 160000 --- a/Hardware/3rdparty/bugui +++ b/Hardware/3rdparty/bugui @@ -1 +1 @@ -Subproject commit 556ec861b06f04f97bc80480b23286589a8390f9 +Subproject commit 5641128efec62c92f12ff5082f2bee505c502a17 diff --git a/Hardware/Controller.cpp b/Hardware/Controller.cpp index 91de040..8ccb640 100644 --- a/Hardware/Controller.cpp +++ b/Hardware/Controller.cpp @@ -13,10 +13,6 @@ Controller::Controller(const score::DocumentContext& document, : bugui::controller{device_name} , doc{document} , interval{&interval} - , h_ofset{0.} // initial horizontal ofset - , v_ofset{0.} // initial verticalal ofset - , h_zoom{.125} // initial horizontal zoom - , v_zoom{1.1} // initial verticalal zoom { // Connet interval signals // adapted from @@ -47,14 +43,22 @@ void Controller::paint(bugui::painter& painter) const for(const Scenario::IntervalModel& c : scnr->intervals) { - auto def = c.duration.defaultDuration().sec() * h_zoom; - auto st = (c.date().sec() * h_zoom) - h_ofset; - auto y = (c.heightPercentage() * v_zoom) + v_ofset; + int def = c.duration.defaultDuration().sec(); + // auto def = c.duration.defaultDuration().sec() * h_zoom; + int st = c.date().sec() - h_ofset; + // auto st = (c.date().sec() * h_zoom) - h_ofset; + int y = (c.heightPercentage() * height()) + v_ofset; + // auto y = (c.heightPercentage() * v_zoom) + v_ofset; painter.draw_line({st, y}, {st + def, y}); } } -void Controller::play(bool pressed) +void Controller::on_grid(float x, float y, bool pressed) +{ + qDebug() << "x: " << x << " y: " << y << " pressed: " << pressed; +} + +void Controller::on_play(bool pressed) { if (m_shift) doc.app.actions.action().action()->trigger(); @@ -62,7 +66,7 @@ void Controller::play(bool pressed) doc.app.actions.action().action()->trigger(); } -void Controller::stop(bool pressed) +void Controller::on_stop(bool pressed) { if (m_shift) doc.app.actions.action().action()->trigger(); @@ -70,16 +74,16 @@ void Controller::stop(bool pressed) doc.app.actions.action().action()->trigger(); } -void Controller::shift(bool pressed) +void Controller::on_shift(bool pressed) { m_shift = pressed; } -void Controller::up(bool pressed) +void Controller::on_up(bool pressed) { if (m_shift) { - v_zoom += .2; + v_scale += .2; update(); } else @@ -89,13 +93,13 @@ void Controller::up(bool pressed) } } -void Controller::down(bool pressed) +void Controller::on_down(bool pressed) { if (m_shift) { - if (v_zoom > .2) + if (v_scale > .2) { - v_zoom -= .2; + v_scale -= .2; update(); } } @@ -106,13 +110,13 @@ void Controller::down(bool pressed) } } -void Controller::left(bool pressed) +void Controller::on_left(bool pressed) { if (m_shift) { - if (h_zoom > .02) + if (h_scale > .02) { - h_zoom -= .02; + h_scale -= .02; update(); } } @@ -126,11 +130,11 @@ void Controller::left(bool pressed) } } -void Controller::right(bool pressed) +void Controller::on_right(bool pressed) { if (m_shift) { - h_zoom += .02; + h_scale += .02; update(); } else @@ -140,7 +144,7 @@ void Controller::right(bool pressed) } } -} +} // namespace hardware #include W_OBJECT_IMPL(Hardware::Controller) diff --git a/Hardware/Controller.hpp b/Hardware/Controller.hpp index f174a1e..f3c4217 100644 --- a/Hardware/Controller.hpp +++ b/Hardware/Controller.hpp @@ -23,13 +23,15 @@ public: void paint(bugui::painter& painter) const override; - void play(bool pressed); - void stop(bool pressed); - void shift(bool pressed); - void up(bool pressed); - void down(bool pressed); - void left(bool pressed); - void right(bool pressed); + void on_play(bool pressed); + void on_stop(bool pressed); + void on_shift(bool pressed); + void on_up(bool pressed); + void on_down(bool pressed); + void on_left(bool pressed); + void on_right(bool pressed); + + void on_grid(float x, float y, bool pressed); private: void on_interval_changed(const Scenario::IntervalModel&); @@ -38,11 +40,6 @@ private: const score::DocumentContext& doc; bool m_shift{false}; - - float h_ofset; - float v_ofset; - float h_zoom; - float v_zoom; }; } diff --git a/score_addon_hardware.hpp b/score_addon_hardware.hpp index 5ee637a..badcf7f 100644 --- a/score_addon_hardware.hpp +++ b/score_addon_hardware.hpp @@ -8,7 +8,6 @@ #include -#include #include class score_addon_hardware final