13
0

triggerboxUI: skeleton for triggerbox bindings and actions, include triggering of scene 1

This commit is contained in:
Paul Davis 2021-11-01 12:10:15 -06:00
parent 07a98734f3
commit b7ce131557
5 changed files with 44 additions and 1 deletions

View File

@ -54,6 +54,7 @@
#include "rc_option_editor.h"
#include "route_params_ui.h"
#include "time_info_box.h"
#include "triggerbox_ui.h"
#include "step_entry.h"
#include "opts.h"
#include "utils.h"
@ -89,6 +90,7 @@ ARDOUR_UI::we_have_dependents ()
*/
ProcessorBox::register_actions ();
StepEntry::setup_actions_and_bindings ();
TriggerBoxUI::setup_actions_and_bindings ();
/* Global, editor, mixer, processor box actions are defined now. Link
them with any bindings, so that GTK does not get a chance to define

View File

@ -1118,6 +1118,7 @@ Editor::access_action (const std::string& action_group, const std::string& actio
try {
act = ActionManager::get_action (action_group.c_str(), action_item.c_str());
if (act) {
cerr << "firing up " << action_item << endl;
act->activate();
}
} catch ( ActionManager::MissingActionException const& e) {

View File

@ -30,6 +30,7 @@
#include "canvas/polygon.h"
#include "canvas/text.h"
#include "gtkmm2ext/actions.h"
#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/utils.h"
@ -253,6 +254,9 @@ TriggerEntry::prop_change (PropertyChange const & change)
/* ---------------------------- */
Gtkmm2ext::Bindings* TriggerBoxUI::bindings = 0;
Glib::RefPtr<Gtk::ActionGroup> TriggerBoxUI::trigger_actions;
TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
: Table (parent)
, _triggerbox (tb)
@ -272,6 +276,33 @@ TriggerBoxUI::~TriggerBoxUI ()
update_connection.disconnect ();
}
void
TriggerBoxUI::setup_actions_and_bindings ()
{
load_bindings ();
register_actions ();
}
void
TriggerBoxUI::load_bindings ()
{
bindings = Bindings::get_bindings (X_("Triggers"));
}
void
TriggerBoxUI::register_actions ()
{
trigger_actions = ActionManager::create_action_group (bindings, X_("Triggers"));
ActionManager::register_toggle_action (trigger_actions, "trigger-scene-1", _("Scene 1"), sigc::bind (sigc::ptr_fun (TriggerBoxUI::trigger_scene), 1));
}
void
TriggerBoxUI::trigger_scene (int32_t n)
{
TriggerBox::scene_bang (n);
}
void
TriggerBoxUI::build ()
{

View File

@ -86,6 +86,11 @@ class TriggerBoxUI : public ArdourCanvas::Table
void start_updating ();
void stop_updating ();
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
static void setup_actions_and_bindings ();
static void trigger_scene (int32_t);
private:
ARDOUR::TriggerBox& _triggerbox;
typedef std::vector<TriggerEntry*> Slots;
@ -94,6 +99,10 @@ class TriggerBoxUI : public ArdourCanvas::Table
sigc::connection file_chooser_connection;
Gtk::Menu* _context_menu;
static Gtkmm2ext::Bindings* bindings;
static void load_bindings ();
static void register_actions ();
bool bang (GdkEvent*, uint64_t);
bool text_event (GdkEvent*, uint64_t);
bool event (GdkEvent*, uint64_t);

View File

@ -912,7 +912,7 @@ def build(bld):
for b in [ 'ardour' ] :
obj = bld(
target = b + '.keys',
source = [ b + '.keys.in', 'mixer.bindings', 'processor_box.bindings', 'step_editing.bindings', 'monitor.bindings' ],
source = [ b + '.keys.in', 'mixer.bindings', 'processor_box.bindings', 'step_editing.bindings', 'monitor.bindings', 'trigger.bindings' ],
rule = a_rule
)
obj.install_path = bld.env['CONFDIR']