From 7cad01ae1e6ef7d107b000932e566a02ef51fa2c Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Fri, 16 Sep 2022 14:07:39 -0500 Subject: [PATCH] clip list: add a Refresh button to the file list It is tempting to update the list automatically when the dire contents change, but this can lead to the list changing while the user is clicking to audition or drag. Instead, we should sensitize the button only when the dir contents have changed. --- gtk2_ardour/trigger_clip_picker.cc | 12 ++++++++++++ gtk2_ardour/trigger_clip_picker.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/gtk2_ardour/trigger_clip_picker.cc b/gtk2_ardour/trigger_clip_picker.cc index a004f53864..ff585bc394 100644 --- a/gtk2_ardour/trigger_clip_picker.cc +++ b/gtk2_ardour/trigger_clip_picker.cc @@ -112,6 +112,10 @@ TriggerClipPicker::TriggerClipPicker () _open_library_btn.signal_clicked.connect (sigc::mem_fun (*this, &TriggerClipPicker::open_library)); _open_library_btn.set_no_show_all (); + _refresh_btn.set_name ("generic button"); + _refresh_btn.set_icon (ArdourWidgets::ArdourIcon::TransportLoop); + _refresh_btn.signal_clicked.connect (sigc::mem_fun (*this, &TriggerClipPicker::refresh_library)); + _show_plugin_btn.set_name ("generic button"); _show_plugin_btn.set_icon (ArdourWidgets::ArdourIcon::PsetBrowse); _show_plugin_btn.signal_clicked.connect (sigc::mem_fun (*this, &TriggerClipPicker::audition_show_plugin_ui)); @@ -129,6 +133,7 @@ TriggerClipPicker::TriggerClipPicker () ArdourWidgets::set_tooltip (_play_btn, _("Audition selected clip")); ArdourWidgets::set_tooltip (_stop_btn, _("Stop the audition")); ArdourWidgets::set_tooltip (_open_library_btn, _("Open clip library folder")); + ArdourWidgets::set_tooltip (_refresh_btn, _("Refresh clip list")); ArdourWidgets::set_tooltip (_auditioner_combo, _("Select the Synth used for auditioning")); ArdourWidgets::set_tooltip (_show_plugin_btn, _("Show the GUI for the Auditioner Synth")); ArdourWidgets::set_tooltip (_clip_dir_menu, _("Click to select a clip folder and edit your available clip folders")); @@ -161,6 +166,7 @@ TriggerClipPicker::TriggerClipPicker () dir_table->set_spacings(4); dir_table->attach (_clip_dir_menu, 0, 1, 0, 1, EXPAND | FILL, SHRINK); dir_table->attach (_open_library_btn, 1, 2, 0, 1, SHRINK, SHRINK); + dir_table->attach (_refresh_btn, 2, 3, 0, 1, SHRINK, SHRINK); pack_start (*dir_table, false, false); pack_start (_scroller); @@ -785,6 +791,12 @@ TriggerClipPicker::list_dir (std::string const& path, Gtk::TreeNodeChildren cons } } +void +TriggerClipPicker::refresh_library () +{ + list_dir(_current_path); +} + void TriggerClipPicker::open_library () { diff --git a/gtk2_ardour/trigger_clip_picker.h b/gtk2_ardour/trigger_clip_picker.h index aff52c9d1d..8de4d7e739 100644 --- a/gtk2_ardour/trigger_clip_picker.h +++ b/gtk2_ardour/trigger_clip_picker.h @@ -82,6 +82,7 @@ private: void audition_show_plugin_ui (); void stop_audition (); void autoplay_toggled (); + void refresh_library (); void open_library (); bool seek_button_press (GdkEventButton*); bool seek_button_release (GdkEventButton*); @@ -112,6 +113,7 @@ private: ArdourWidgets::ArdourButton _play_btn; ArdourWidgets::ArdourButton _stop_btn; ArdourWidgets::ArdourButton _open_library_btn; + ArdourWidgets::ArdourButton _refresh_btn; ArdourWidgets::ArdourButton _show_plugin_btn; Gtk::HScale _seek_slider; Gtk::CheckButton _autoplay_btn;