GLUI: support space bar toggle play in inst edit params window
authorStefan Westerfeld <stefan@space.twc.de>
Thu, 14 Mar 2019 15:10:50 +0000 (16:10 +0100)
committerStefan Westerfeld <stefan@space.twc.de>
Thu, 14 Mar 2019 15:10:50 +0000 (16:10 +0100)
Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
glui/sminsteditparams.hh
glui/sminsteditwindow.hh

index 6cb60e0..207ac18 100644 (file)
@@ -6,6 +6,7 @@
 #include "smcheckbox.hh"
 #include "smparamlabel.hh"
 #include "smbutton.hh"
+#include "smshortcut.hh"
 
 namespace SpectMorph
 {
@@ -46,6 +47,9 @@ public:
     window->add_child_window (this);
     set_close_callback ([this,window]() { window->remove_child_window (this); });
 
+    Shortcut *play_shortcut = new Shortcut (this, ' ');
+    connect (play_shortcut->signal_activated, [this]() { signal_toggle_play(); });
+
     FixedGrid grid;
     grid.add_widget (scroll_view = new ScrollView (this), 1, 1, width / 8 - 2, height / 8 - 2);
     scroll_widget = new Widget (scroll_view);
@@ -366,6 +370,7 @@ public:
 
     instrument->set_encoder_config (enc_cfg);
   }
+  Signal<> signal_toggle_play;
 };
 
 }
index afe2977..bfc4002 100644 (file)
@@ -419,7 +419,10 @@ public:
     auto_volume_checkbox->set_checked (instrument.auto_volume().enabled);
     auto_volume_details_button->set_enabled (instrument.auto_volume().enabled);
 
-    connect (auto_volume_details_button->signal_clicked, [&]() { new InstEditParams (this, &instrument); });
+    connect (auto_volume_details_button->signal_clicked, [&]() {
+      auto ie_params = new InstEditParams (this, &instrument);
+      connect (ie_params->signal_toggle_play, this, &InstEditWindow::on_toggle_play);
+    });
 
     auto_tune_checkbox = new CheckBox (this, "Auto Tune");
     grid.add_widget (auto_tune_checkbox, 60, 61.5, 20, 2);