implement plugin-scan cancel-button sensitivity

This commit is contained in:
Robin Gareus 2014-02-25 14:52:57 +01:00
parent 0708721b4f
commit d8329d855d
7 changed files with 14 additions and 12 deletions

View File

@ -306,7 +306,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
ARDOUR::FileSource::AmbiguousFileName.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::ambiguous_file, this, _1, _2));
/* also plugin scan messages */
ARDOUR::PluginScanMessage.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::plugin_scan_dialog, this, _1, _2), gui_context());
ARDOUR::PluginScanMessage.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::plugin_scan_dialog, this, _1, _2, _3), gui_context());
ARDOUR::GUIIdle.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::gui_idle_handler, this), gui_context());
@ -3805,16 +3805,17 @@ ARDOUR_UI::cancel_plugin_scan ()
static MessageDialog *scan_dlg = NULL;
void
ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin)
ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin, bool can_cancel)
{
if (!Config->get_show_plugin_scan_window()) { return; }
static Gtk::Button *cancel_button;
if (!scan_dlg) {
scan_dlg = new MessageDialog("", false, MESSAGE_INFO, BUTTONS_NONE);
VBox* vbox = scan_dlg->get_vbox();
vbox->set_size_request(400,-1);
scan_dlg->set_title (_("Scanning for plugins"));
Gtk::Button *cancel_button = manage(new Gtk::Button(_("Cancel plugin scan")));
cancel_button = manage(new Gtk::Button(_("Cancel plugin scan")));
cancel_button->set_name ("EditorGTKButton");
cancel_button->signal_clicked().connect ( mem_fun (*this, &ARDOUR_UI::cancel_plugin_scan) );
@ -3827,6 +3828,7 @@ ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin)
scan_dlg->set_message(type + ": " + Glib::path_get_basename(plugin));
scan_dlg->show_all();
}
cancel_button->set_sensitive(can_cancel);
/* due to idle calls, gtk_events_pending() may always return true */
int timeout = 30;

View File

@ -669,7 +669,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void gui_idle_handler ();
void cancel_plugin_scan ();
void plugin_scan_dialog (std::string type, std::string plugin);
void plugin_scan_dialog (std::string type, std::string plugin, bool);
void session_format_mismatch (std::string, std::string);

View File

@ -50,7 +50,7 @@ namespace ARDOUR {
class AudioEngine;
extern LIBARDOUR_API PBD::Signal1<void,std::string> BootMessage;
extern LIBARDOUR_API PBD::Signal2<void,std::string,std::string> PluginScanMessage;
extern LIBARDOUR_API PBD::Signal3<void,std::string,std::string,bool> PluginScanMessage;
extern LIBARDOUR_API PBD::Signal0<void> GUIIdle;
/**

View File

@ -2278,7 +2278,7 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
}
AUPluginInfo::get_names (temp, info->name, info->creator);
ARDOUR::PluginScanMessage(_("AU"), info->name);
ARDOUR::PluginScanMessage(_("AU"), info->name, false);
info->type = ARDOUR::AudioUnit;
info->unique_id = stringify_descriptor (*info->descriptor);

View File

@ -125,7 +125,7 @@ mix_buffers_with_gain_t ARDOUR::mix_buffers_with_gain = 0;
mix_buffers_no_gain_t ARDOUR::mix_buffers_no_gain = 0;
PBD::Signal1<void,std::string> ARDOUR::BootMessage;
PBD::Signal2<void,std::string,std::string> ARDOUR::PluginScanMessage;
PBD::Signal3<void,std::string,std::string,bool> ARDOUR::PluginScanMessage;
PBD::Signal0<void> ARDOUR::GUIIdle;
namespace ARDOUR {

View File

@ -2110,7 +2110,7 @@ LV2PluginInfo::discover()
info->name = string(lilv_node_as_string(name));
lilv_node_free(name);
ARDOUR::PluginScanMessage(_("LV2"), info->name);
ARDOUR::PluginScanMessage(_("LV2"), info->name, false);
const LilvPluginClass* pclass = lilv_plugin_get_class(p);
const LilvNode* label = lilv_plugin_class_get_label(pclass);

View File

@ -210,7 +210,7 @@ PluginManager::refresh (bool cache_only)
#endif
PluginListChanged (); /* EMIT SIGNAL */
PluginScanMessage(X_("closeme"), "");
PluginScanMessage(X_("closeme"), "", false);
cancel_scan = false;
}
@ -351,7 +351,7 @@ PluginManager::ladspa_refresh ()
dll_extension_pattern, ladspa_modules);
for (vector<std::string>::iterator i = ladspa_modules.begin(); i != ladspa_modules.end(); ++i) {
ARDOUR::PluginScanMessage(_("LADSPA"), *i);
ARDOUR::PluginScanMessage(_("LADSPA"), *i, false);
ladspa_discover (*i);
}
}
@ -664,7 +664,7 @@ PluginManager::windows_vst_discover_from_path (string path, bool cache_only)
if (plugin_objects) {
for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
if (cancelled()) break;
ARDOUR::PluginScanMessage(_("VST"), **x);
ARDOUR::PluginScanMessage(_("VST"), **x, !cache_only);
windows_vst_discover (**x, cache_only);
}
@ -804,7 +804,7 @@ PluginManager::lxvst_discover_from_path (string path, bool cache_only)
if (plugin_objects) {
for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
if (cancelled()) break;
ARDOUR::PluginScanMessage(_("LXVST"), **x);
ARDOUR::PluginScanMessage(_("LXVST"), **x, !cache_only);
lxvst_discover (**x, cache_only);
}