13
0

trigger_ui: allow grabbing() for Gate + Repeat (TODO: Repeat is borked)

This commit is contained in:
Ben Loftis 2022-01-08 09:33:20 -06:00
parent a44ce7c075
commit 4f5779e67d
2 changed files with 16 additions and 3 deletions

View File

@ -66,6 +66,7 @@ using namespace PBD;
TriggerEntry::TriggerEntry (Item* item, TriggerReference tr)
: ArdourCanvas::Rectangle (item)
, _grabbed (false)
{
set_layout_sensitive (true); // why???
@ -642,7 +643,14 @@ TriggerEntry::play_button_event (GdkEvent* ev)
case GDK_BUTTON_PRESS:
switch (ev->button.button) {
case 1:
if (trigger()->launch_style () == Trigger::Gate ||
trigger()->launch_style () == Trigger::Repeat) {
trigger()->bang ();
_grabbed = true;
play_button->grab();
} else {
trigger()->bang ();
}
return true;
default:
break;
@ -651,9 +659,10 @@ TriggerEntry::play_button_event (GdkEvent* ev)
case GDK_BUTTON_RELEASE:
switch (ev->button.button) {
case 1:
if (trigger()->launch_style () == Trigger::Gate ||
trigger()->launch_style () == Trigger::Repeat) {
if (_grabbed) {
trigger()->unbang ();
play_button->ungrab();
_grabbed = false;
}
break;
case 3:

View File

@ -73,6 +73,8 @@ public:
bool follow_button_event (GdkEvent*);
private:
bool _grabbed;
double _poly_size;
double _poly_margin;
@ -109,6 +111,8 @@ private:
void drag_leave (Glib::RefPtr<Gdk::DragContext> const&, guint);
void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, guint, guint);
bool triggerbox_event (GdkEvent*);
uint64_t slot_at_y (int) const;
sigc::connection _update_connection;