[coordinates] move from relative to absolute coordinates, in number of cells
This commit is contained in:
parent
662345625f
commit
62e2e2539f
4 changed files with 35 additions and 35 deletions
2
Hardware/3rdparty/bugui
vendored
2
Hardware/3rdparty/bugui
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 556ec861b06f04f97bc80480b23286589a8390f9
|
||||
Subproject commit 5641128efec62c92f12ff5082f2bee505c502a17
|
|
@ -13,10 +13,6 @@ Controller::Controller(const score::DocumentContext& document,
|
|||
: bugui::controller<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<Actions::PlayGlobal>().action()->trigger();
|
||||
|
@ -62,7 +66,7 @@ void Controller::play(bool pressed)
|
|||
doc.app.actions.action<Actions::Play>().action()->trigger();
|
||||
}
|
||||
|
||||
void Controller::stop(bool pressed)
|
||||
void Controller::on_stop(bool pressed)
|
||||
{
|
||||
if (m_shift)
|
||||
doc.app.actions.action<Actions::Reinitialize>().action()->trigger();
|
||||
|
@ -70,16 +74,16 @@ void Controller::stop(bool pressed)
|
|||
doc.app.actions.action<Actions::Stop>().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 <wobjectimpl.h>
|
||||
W_OBJECT_IMPL(Hardware::Controller)
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class score_addon_hardware final
|
||||
|
|
Loading…
Add table
Reference in a new issue