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

View File

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