implement plugin-scan cancel-button sensitivity
authorRobin Gareus <robin@gareus.org>
Tue, 25 Feb 2014 13:52:57 +0000 (14:52 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 25 Feb 2014 13:57:59 +0000 (14:57 +0100)
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
libs/ardour/ardour/ardour.h
libs/ardour/audio_unit.cc
libs/ardour/globals.cc
libs/ardour/lv2_plugin.cc
libs/ardour/plugin_manager.cc

index 55572ad39247b6b5faf6581d4aa67c57cc021024..31e401a0fd7dc7a80c7bbbd9c642e1c7a3068619 100644 (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;
index 395833fbad10d15a5065f342122bba61ca3db607..69ff876dc854bf40891284f55f7fa393caa5a9b9 100644 (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);
 
index 38d8a9a6a2aa2b31129ccd993f707f1d278aeb00..003f05ca5d1e1f6f23e86fec0b4938e44238bab4 100644 (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;
 
        /**
index 332f50546fa2a3f64c17ec9c586a7059039a96cd..9e461c63466515cfa63aff5d12384b7b1f8083e0 100644 (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);
index f04ffe691dfc4df4b093834c4703377943fb8cf8..71d65a60f37a317f7024a614907b28be72bd6385 100644 (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 {
index a9b21924ed0cde5d0b081861e35b6d84d1532658..345c1a47ddf937744295c3d77adff96c3e921457 100644 (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);
index c145fd3aa4116778819fac7ee880aaf5f6b193a1..fc27a34255eb45a33c628247f53086623ccdfc30 100644 (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);
                }