Don't close the plugin manager when an incompatible plugin is selected. Fixes #1194.

git-svn-id: svn://localhost/ardour2/branches/3.0@7006 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-04-27 19:58:31 +00:00
parent 47de938e99
commit 0bc6a319f1
4 changed files with 34 additions and 23 deletions

View file

@ -30,7 +30,7 @@ class PluginInterestedObject {
PluginInterestedObject() {} PluginInterestedObject() {}
virtual ~PluginInterestedObject() {} virtual ~PluginInterestedObject() {}
virtual void use_plugins (const SelectedPlugins&) = 0; virtual bool use_plugins (const SelectedPlugins&) = 0;
}; };
#endif /* __gtkardour_plugin_interest_h__ */ #endif /* __gtkardour_plugin_interest_h__ */

View file

@ -63,7 +63,7 @@ static const char* _filter_mode_strings[] = {
}; };
PluginSelector::PluginSelector (PluginManager *mgr) PluginSelector::PluginSelector (PluginManager *mgr)
: ArdourDialog (_("ardour: plugins"), true, false), : ArdourDialog (_("Plugin Manager"), true, false),
filter_button (Stock::CLEAR) filter_button (Stock::CLEAR)
{ {
set_position (Gtk::WIN_POS_MOUSE); set_position (Gtk::WIN_POS_MOUSE);
@ -442,29 +442,36 @@ PluginSelector::run ()
{ {
ResponseType r; ResponseType r;
TreeModel::Children::iterator i; TreeModel::Children::iterator i;
SelectedPlugins plugins;
r = (ResponseType) Dialog::run (); bool finish = false;
switch (r) { while (!finish) {
case RESPONSE_APPLY:
for (i = amodel->children().begin(); i != amodel->children().end(); ++i) { SelectedPlugins plugins;
PluginInfoPtr pp = (*i)[acols.plugin]; r = (ResponseType) Dialog::run ();
PluginPtr p = load_plugin (pp);
if (p) { switch (r) {
plugins.push_back (p); case RESPONSE_APPLY:
for (i = amodel->children().begin(); i != amodel->children().end(); ++i) {
PluginInfoPtr pp = (*i)[acols.plugin];
PluginPtr p = load_plugin (pp);
if (p) {
plugins.push_back (p);
}
}
if (interested_object && !plugins.empty()) {
finish = !interested_object->use_plugins (plugins);
} }
}
if (interested_object && !plugins.empty()) {
interested_object->use_plugins (plugins);
}
break; break;
default: default:
break; finish = true;
break;
}
} }
hide(); hide();
amodel->clear(); amodel->clear();
interested_object = 0; interested_object = 0;

View file

@ -742,7 +742,8 @@ ProcessorBox::choose_plugin ()
_get_plugin_selector()->set_interested_object (*this); _get_plugin_selector()->set_interested_object (*this);
} }
void /** @return true if an error occurred, otherwise false */
bool
ProcessorBox::use_plugins (const SelectedPlugins& plugins) ProcessorBox::use_plugins (const SelectedPlugins& plugins)
{ {
for (SelectedPlugins::const_iterator p = plugins.begin(); p != plugins.end(); ++p) { for (SelectedPlugins::const_iterator p = plugins.begin(); p != plugins.end(); ++p) {
@ -757,6 +758,7 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins)
if (_route->add_processor (processor, _placement, &err_streams)) { if (_route->add_processor (processor, _placement, &err_streams)) {
weird_plugin_dialog (**p, err_streams); weird_plugin_dialog (**p, err_streams);
return true;
// XXX SHAREDPTR delete plugin here .. do we even need to care? // XXX SHAREDPTR delete plugin here .. do we even need to care?
} else { } else {
@ -765,12 +767,14 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins)
} }
} }
} }
return false;
} }
void void
ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams) ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams)
{ {
ArdourDialog dialog (_("ardour: weird plugin dialog")); ArdourDialog dialog (_("Plugin Incompatibility"));
Label label; Label label;
string text = string_compose(_("You attempted to add the plugin \"%1\" at index %2.\n"), string text = string_compose(_("You attempted to add the plugin \"%1\" at index %2.\n"),

View file

@ -197,7 +197,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
void return_io_finished (IOSelector::Result, boost::weak_ptr<ARDOUR::Processor>, IOSelectorWindow*); void return_io_finished (IOSelector::Result, boost::weak_ptr<ARDOUR::Processor>, IOSelectorWindow*);
void choose_insert (); void choose_insert ();
void choose_plugin (); void choose_plugin ();
void use_plugins (const SelectedPlugins&); bool use_plugins (const SelectedPlugins&);
bool no_processor_redisplay; bool no_processor_redisplay;