From acb5feec4a1de215c8e241edb0aadc89b07fba8d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 8 Jun 2024 23:55:41 +0200 Subject: [PATCH 1/5] Show master bus comment on session load #9718 --- gtk2_ardour/mixer_strip.cc | 9 +++++++++ gtk2_ardour/route_ui.cc | 2 +- gtk2_ardour/route_ui.h | 3 ++- gtk2_ardour/session_option_editor.cc | 9 +++++++++ libs/ardour/ardour/session_configuration_vars.h | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 6c4c1464aa..bd8e82f159 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -174,6 +174,15 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, std::shared_ptr rt, { init (); set_route (rt); + + if (is_master () && !_route->comment().empty () && _session->config.get_show_master_bus_comment_on_load () && self_destruct) { + open_comment_editor (); + _comment_window->hide (); + _comment_window->set_position (Gtk::WIN_POS_CENTER_ON_PARENT); + _comment_window->present (); + /* show only once */ + _session->config.set_show_master_bus_comment_on_load (false); + } } void diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 340f945be3..225d26e5f8 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -127,9 +127,9 @@ RouteUI::RouteUI (ARDOUR::Session* sess) , solo_menu(0) , sends_menu(0) , playlist_action_menu (0) + , _comment_window(0) , _playlist_selector(0) , _record_menu(0) - , _comment_window(0) , _comment_area(0) , _invert_menu(0) { diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 6c738117aa..4f93829f4e 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -268,6 +268,8 @@ protected: ARDOUR::SoloMuteRelease* _solo_release; ARDOUR::SoloMuteRelease* _mute_release; + ArdourWindow* _comment_window; + private: void invert_menu_toggled (uint32_t); bool invert_press (GdkEventButton*); @@ -322,7 +324,6 @@ private: PlaylistSelector* _playlist_selector; Gtk::Menu* _record_menu; - ArdourWindow* _comment_window; Gtk::TextView* _comment_area; Gtk::CheckMenuItem* _step_edit_item; diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index 42dcb88398..416a113096 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -436,6 +436,15 @@ SessionOptionEditor::SessionOptionEditor (Session* s) sigc::mem_fun (*_session_config, &SessionConfiguration::set_count_in) )); + add_option (_("Misc"), new OptionEditorHeading (_("Project Banner"))); + + add_option (_("Misc"), new BoolOption ( + "show-master-bus-comment-on-load", + _("Show master bus comment window on session load (once)"), + sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_master_bus_comment_on_load), + sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_master_bus_comment_on_load) + )); + add_option (_("Misc"), new OptionEditorHeading (_("Defaults"))); Gtk::Button* btn = Gtk::manage (new Gtk::Button (_("Use these settings as defaults"))); diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index f28dbb776e..720c3497cf 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -92,6 +92,7 @@ CONFIG_VARIABLE (bool, show_monitor_on_meterbridge, "show-monitor-on-meterbridge CONFIG_VARIABLE (bool, show_name_on_meterbridge, "show-name-on-meterbridge", true) CONFIG_VARIABLE (bool, show_fader_on_meterbridge, "show-fader-on-meterbridge", false) CONFIG_VARIABLE (uint32_t, meterbridge_label_height, "meterbridge-label-height", 0) +CONFIG_VARIABLE (bool, show_master_bus_comment_on_load, "show-master-bus-comment-on-load", false) /* If the user changes the session default_time_domain, we also stash that in rc_config as a global preference, where it is used to initialize the session timebase menu during new session creation From 1660ad3ed9aefb06f4105808a7ed992a8c91f1c6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 10 Jun 2024 10:47:07 -0600 Subject: [PATCH 2/5] always center the new session dialog --- gtk2_ardour/ardour_ui_session.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk2_ardour/ardour_ui_session.cc b/gtk2_ardour/ardour_ui_session.cc index 47498fef28..e0dc6788dd 100644 --- a/gtk2_ardour/ardour_ui_session.cc +++ b/gtk2_ardour/ardour_ui_session.cc @@ -152,6 +152,7 @@ ARDOUR_UI::start_session_load (bool create_new) SessionDialog* session_dialog = new SessionDialog (create_new, string(), Config->get_default_session_parent_dir(), string(), true); session_dialog->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::session_dialog_response_handler), session_dialog)); + session_dialog->set_position (WIN_POS_CENTER); session_dialog->present (); } From d06072b2853025d234718b4d00745a5c2d9a8ce0 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 10 Jun 2024 19:52:49 +0200 Subject: [PATCH 3/5] Add checkbox to master-bus comment editor #9718 --- gtk2_ardour/route_ui.cc | 26 ++++++++++++++++++++++++-- gtk2_ardour/session_option_editor.cc | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 225d26e5f8..2b46c538e5 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -76,6 +76,7 @@ #include "keyboard.h" #include "mixer_strip.h" #include "mixer_ui.h" +#include "option_editor.h" #include "opts.h" #include "patch_change_widget.h" #include "playlist_selector.h" @@ -1780,10 +1781,15 @@ RouteUI::open_comment_editor () void RouteUI::setup_comment_editor () { + const float scale = std::max(1.f, UIConfiguration::instance().get_ui_scale()); + _comment_window = new ArdourWindow (""); // title will be reset to show route _comment_window->set_skip_taskbar_hint (true); _comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing)); - _comment_window->set_default_size (400, 200); + _comment_window->set_default_size (400 * scale, 200 * scale); + + VBox* vbox = manage (new VBox ()); + vbox->show (); _comment_area = manage (new TextView()); _comment_area->set_name ("MixerTrackCommentArea"); @@ -1792,7 +1798,23 @@ RouteUI::setup_comment_editor () _comment_area->get_buffer()->set_text (_route->comment()); _comment_area->show (); - _comment_window->add (*_comment_area); + vbox->pack_start (*_comment_area); + + if (is_master ()) { + BoolOption* bo = new BoolOption ( + "show-master-bus-comment-on-load", + _("Show this comment on next session load"), + sigc::mem_fun (_session->config, &SessionConfiguration::get_show_master_bus_comment_on_load), + sigc::mem_fun (_session->config, &SessionConfiguration::set_show_master_bus_comment_on_load) + ); + + vbox->pack_start (bo->tip_widget (), false, false, 4); + bo->tip_widget ().show_all (); + bo->parameter_changed ("show-master-bus-comment-on-load"); + vbox->signal_unrealize().connect ([bo]() { delete bo; }); + _session->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&BoolOption::parameter_changed, bo, _1), gui_context()); + } + _comment_window->add (*vbox); } void diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index 416a113096..754d518825 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -440,7 +440,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s) add_option (_("Misc"), new BoolOption ( "show-master-bus-comment-on-load", - _("Show master bus comment window on session load (once)"), + _("Show master bus comment window on session load"), sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_master_bus_comment_on_load), sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_master_bus_comment_on_load) )); From 66ef68d46a19a638eb64c4899c9212925170e6e0 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 10 Jun 2024 20:49:02 +0200 Subject: [PATCH 4/5] amend 16fb29d57 (ADM content creation) --- libs/ardour/surround_return.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ardour/surround_return.cc b/libs/ardour/surround_return.cc index 35f0c45870..e72e4bae1e 100644 --- a/libs/ardour/surround_return.cc +++ b/libs/ardour/surround_return.cc @@ -514,7 +514,7 @@ SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_ timepos_t end (end_sample + latency); timepos_t next (start_sample + latency - 1); - while (!content_creation) { + while (true) { Evoral::ControlEvent next_event (timepos_t (Temporal::AudioTime), 0.0f); if (!p->find_next_event (next, end, next_event)) { break; From 6bf6c82f7a121639982a182ea6a101cb15ae32e7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 11 Jun 2024 04:25:47 +0200 Subject: [PATCH 5/5] Add a Lua script to select region(s) under the playhead --- share/scripts/select_regions_at_playhead.lua | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 share/scripts/select_regions_at_playhead.lua diff --git a/share/scripts/select_regions_at_playhead.lua b/share/scripts/select_regions_at_playhead.lua new file mode 100644 index 0000000000..239227d720 --- /dev/null +++ b/share/scripts/select_regions_at_playhead.lua @@ -0,0 +1,45 @@ +ardour { ["type"] = "EditorAction", name = "Select Regions at the Playhead", + license = "MIT", + author = "Ardour Team", + description = [[Select regions under the playhead on selected track(s)]] +} + +function factory (params) return function () + + local loc = Session:locations () -- all marker locations + + -- get the playhead postion + local playhead = Temporal.timepos_t (Session:transport_sample ()) + + local sl = ArdourUI.SelectionList () -- empty selection list + + -- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:Selection + local sel = Editor:get_selection () + + -- Track/Bus Selection -- iterate over all Editor-GUI selected tracks + -- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:TrackSelection + for r in sel.tracks:routelist ():iter () do + -- each of the items 'r' is-a + -- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route + + local track = r:to_track () -- see if it's a track + if track:isnil () then + -- if not, skip it + goto continue + end + + -- get track's playlist + -- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Playlist + local playlist = track:playlist () + + for region in playlist:regions_at (playhead):iter () do + local rv = Editor:regionview_from_region (region) + sl:push_back (rv); + end + + ::continue:: + end + + -- set/replace current selection in the editor + Editor:set_selection (sl, ArdourUI.SelectionOp.Set); +end end