diff options
author | André Nusser <andre.nusser@googlemail.com> | 2018-06-16 12:52:48 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-08-12 11:13:53 +0200 |
commit | 8ad5f7c39db55cab3f78fdefab323435261941fd (patch) | |
tree | fb5a3f4a29716a83e18a96b70ec9162d9e93b8c6 /plugingui/drumkittab.h | |
parent | 20bdae6c72192c87bf95c6ac86c8cc049aa1ab5a (diff) |
Add hovering to visualization.
Diffstat (limited to 'plugingui/drumkittab.h')
-rw-r--r-- | plugingui/drumkittab.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugingui/drumkittab.h b/plugingui/drumkittab.h index 1c99e6d..e42eb93 100644 --- a/plugingui/drumkittab.h +++ b/plugingui/drumkittab.h @@ -30,6 +30,8 @@ #include <memory> #include <string> +#include <grid.h> + #include "image.h" #include "label.h" #include "widget.h" @@ -55,6 +57,7 @@ public: void resize(std::size_t width, std::size_t height) override; void buttonEvent(ButtonEvent* buttonEvent) override; void scrollEvent(ScrollEvent* scrollEvent) override; + void mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) override; void mouseLeaveEvent() override; void init(std::string const& image_file, std::string const& map_file); @@ -62,9 +65,15 @@ public: private: float current_velocity{.5}; std::string current_instrument{""}; + int current_index{-1}; + + using IndexGrid = Grid<int>; + using Position = IndexGrid::Pos; + using Positions = std::vector<Position>; std::vector<Colour> colours; - std::vector<int> pos_to_colour_index; + IndexGrid pos_to_colour_index; + std::vector<Positions> colour_index_to_positions; std::vector<std::string> to_instrument_name; struct ColourInstrumentPair @@ -95,9 +104,10 @@ private: // SettingsNotifier& settings_notifier; // Config& config; - void triggerAudition(int x, int y, bool show_hit = true); + void triggerAudition(int x, int y); + void highlightInstrument(int index); void updateVelocityLabel(); - void updateInstrumentLabel(); + void updateInstrumentLabel(int index); }; } // GUI:: |