From e7b10fc37d2a2502532d330136034a0dab063ced Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 12 Nov 2024 10:47:08 -0700 Subject: [PATCH] virtualize editing connections to parameter changes --- gtk2_ardour/editing_context.cc | 16 ++++++++++++++++ gtk2_ardour/editing_context.h | 4 ++++ gtk2_ardour/editor.cc | 5 ++--- gtk2_ardour/editor_actions.cc | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 7fb0732fe4..938a280f6e 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -209,12 +209,28 @@ EditingContext::EditingContext (std::string const & name) /* handle escape */ ARDOUR_UI::instance()->Escape.connect (escape_connection, MISSING_INVALIDATOR, std::bind (&EditingContext::escape, this), gui_context()); + + Config->ParameterChanged.connect (parameter_connections, MISSING_INVALIDATOR, std::bind (&EditingContext::parameter_changed, this, _1), gui_context()); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &EditingContext::ui_parameter_changed)); } EditingContext::~EditingContext() { } +void +EditingContext::ui_parameter_changed (string parameter) +{ + if (parameter == "sound-midi-note") { + } +} + + +void +EditingContext::parameter_changed (string parameter) +{ +} + void EditingContext::set_session (ARDOUR::Session* s) { diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index 8daf7b5b00..562f5379b9 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -686,6 +686,10 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider uint32_t autoscroll_cnt; ArdourCanvas::Rect autoscroll_boundary; + PBD::ScopedConnectionList parameter_connections; + virtual void parameter_changed (std::string); + virtual void ui_parameter_changed (std::string); + bool _mouse_changed_selection; ArdourMarker* entered_marker; TimeAxisView* entered_track; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index fd99fe9c96..fe42462bb8 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -744,9 +744,6 @@ Editor::Editor () Session::AskAboutPlaylistDeletion.connect_same_thread (*this, std::bind (&Editor::playlist_deletion_dialog, this, _1)); Route::PluginSetup.connect_same_thread (*this, std::bind (&Editor::plugin_setup, this, _1, _2, _3)); - Config->ParameterChanged.connect (*this, invalidator (*this), std::bind (&Editor::parameter_changed, this, _1), gui_context()); - UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &Editor::ui_parameter_changed)); - TimeAxisView::CatchDeletion.connect (*this, invalidator (*this), std::bind (&Editor::timeaxisview_deleted, this, _1), gui_context()); _ignore_region_action = false; @@ -5672,6 +5669,8 @@ Editor::zoom_vertical_modifier_released() void Editor::ui_parameter_changed (string parameter) { + EditingContext::ui_parameter_changed (parameter); + if (parameter == "icon-set") { while (!_cursor_stack.empty()) { _cursor_stack.pop_back(); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 7276bc8d2f..a5982c1d67 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1097,7 +1097,7 @@ Editor::marker_click_behavior_chosen (Editing::MarkerClickBehavior m) void Editor::parameter_changed (std::string p) { - ENSURE_GUI_THREAD (*this, &Editor::parameter_changed, p) + EditingContext::parameter_changed (p); if (p == "auto-loop") { update_loop_range_view ();