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.
This commit is contained in:
Ben Loftis 2022-09-16 14:07:39 -05:00
parent 7f06beda50
commit 7cad01ae1e
2 changed files with 14 additions and 0 deletions

View File

@ -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 ()
{

View File

@ -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;