mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 05:05:43 +01:00
redesign plugin selection process to fix multiple-addition problem
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3420 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b7f48adb56
commit
79ab090830
4 changed files with 49 additions and 57 deletions
|
|
@ -327,18 +327,14 @@ PluginSelector::au_refiller (const std::string& filterstr)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
PluginSelector::use_plugin (PluginInfoPtr pi)
|
||||
PluginPtr
|
||||
PluginSelector::load_plugin (PluginInfoPtr pi)
|
||||
{
|
||||
if (session == 0) {
|
||||
return;
|
||||
return PluginPtr();
|
||||
}
|
||||
|
||||
PluginPtr plugin = pi->load (*session);
|
||||
|
||||
if (plugin) {
|
||||
PluginCreated (plugin);
|
||||
}
|
||||
return pi->load (*session);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -404,6 +400,7 @@ PluginSelector::run ()
|
|||
{
|
||||
ResponseType r;
|
||||
TreeModel::Children::iterator i;
|
||||
SelectedPlugins plugins;
|
||||
|
||||
r = (ResponseType) Dialog::run ();
|
||||
|
||||
|
|
@ -411,24 +408,26 @@ PluginSelector::run ()
|
|||
case RESPONSE_APPLY:
|
||||
for (i = amodel->children().begin(); i != amodel->children().end(); ++i) {
|
||||
PluginInfoPtr pp = (*i)[acols.plugin];
|
||||
use_plugin (pp);
|
||||
PluginPtr p = load_plugin (pp);
|
||||
if (p) {
|
||||
plugins.push_back (p);
|
||||
}
|
||||
}
|
||||
if (interested_object && !plugins.empty()) {
|
||||
interested_object->use_plugins (plugins);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
cleanup ();
|
||||
|
||||
return (int) r;
|
||||
}
|
||||
|
||||
void
|
||||
PluginSelector::cleanup ()
|
||||
{
|
||||
hide();
|
||||
amodel->clear();
|
||||
interested_object = 0;
|
||||
|
||||
return (int) r;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -551,7 +550,15 @@ PluginSelector::plugin_menu()
|
|||
void
|
||||
PluginSelector::plugin_chosen_from_menu (const PluginInfoPtr& pi)
|
||||
{
|
||||
use_plugin (pi);
|
||||
PluginPtr p = load_plugin (pi);
|
||||
|
||||
if (p && interested_object) {
|
||||
SelectedPlugins plugins;
|
||||
plugins.push_back (p);
|
||||
interested_object->use_plugins (plugins);
|
||||
}
|
||||
|
||||
interested_object = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -596,3 +603,9 @@ PluginSelector::show_manager ()
|
|||
show_all();
|
||||
run ();
|
||||
}
|
||||
|
||||
void
|
||||
PluginSelector::set_interested_object (PluginInterestedObject& obj)
|
||||
{
|
||||
interested_object = &obj;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <gtkmm2ext/selector.h>
|
||||
|
||||
#include <ardour/plugin.h>
|
||||
#include "plugin_interest.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class Session;
|
||||
|
|
@ -36,8 +37,9 @@ class PluginSelector : public ArdourDialog
|
|||
{
|
||||
public:
|
||||
PluginSelector (ARDOUR::PluginManager *);
|
||||
sigc::signal<void,boost::shared_ptr<ARDOUR::Plugin> > PluginCreated;
|
||||
|
||||
void set_interested_object (PluginInterestedObject&);
|
||||
|
||||
int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
|
||||
|
||||
void set_session (ARDOUR::Session*);
|
||||
|
|
@ -46,8 +48,10 @@ class PluginSelector : public ArdourDialog
|
|||
Gtk::Menu& plugin_menu ();
|
||||
|
||||
private:
|
||||
PluginInterestedObject* interested_object;
|
||||
|
||||
ARDOUR::Session* session;
|
||||
Gtk::ScrolledWindow scroller; // Available plugins
|
||||
Gtk::ScrolledWindow scroller; // Available plugins
|
||||
Gtk::ScrolledWindow ascroller; // Added plugins
|
||||
|
||||
Gtk::ComboBoxText filter_mode;
|
||||
|
|
@ -112,8 +116,7 @@ class PluginSelector : public ArdourDialog
|
|||
void added_list_selection_changed();
|
||||
void display_selection_changed();
|
||||
void btn_apply_clicked();
|
||||
void use_plugin (ARDOUR::PluginInfoPtr);
|
||||
void cleanup ();
|
||||
ARDOUR::PluginPtr load_plugin (ARDOUR::PluginInfoPtr);
|
||||
bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&);
|
||||
void setup_filter_string (std::string&);
|
||||
|
||||
|
|
|
|||
|
|
@ -147,10 +147,6 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, boost::shared_ptr<Rout
|
|||
redirect_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::redirect_button_press_event), false);
|
||||
redirect_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::redirect_button_release_event));
|
||||
|
||||
using_plugin_selector = false;
|
||||
_plugin_selector.signal_hide().connect (mem_fun (*this, &RedirectBox::plugin_selector_hidden));
|
||||
_plugin_selector.signal_show().connect (mem_fun (*this, &RedirectBox::plugin_selector_shown));
|
||||
|
||||
/* start off as a passthru strip. we'll correct this, if necessary,
|
||||
in update_diskstream_display().
|
||||
*/
|
||||
|
|
@ -395,33 +391,28 @@ RedirectBox::deselect_all_redirects ()
|
|||
void
|
||||
RedirectBox::choose_plugin ()
|
||||
{
|
||||
newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen));
|
||||
// Gtk::Menu& m = _plugin_selector.plugin_menu();
|
||||
// m.popup (1, 0);
|
||||
_plugin_selector.set_interested_object (*this);
|
||||
}
|
||||
|
||||
void
|
||||
RedirectBox::insert_plugin_chosen (boost::shared_ptr<Plugin> plugin)
|
||||
RedirectBox::use_plugins (const SelectedPlugins& plugins)
|
||||
{
|
||||
if (plugin) {
|
||||
for (SelectedPlugins::const_iterator p = plugins.begin(); p != plugins.end(); ++p) {
|
||||
|
||||
boost::shared_ptr<Redirect> redirect (new PluginInsert (_session, *p, _placement));
|
||||
|
||||
boost::shared_ptr<Redirect> redirect (new PluginInsert (_session, plugin, _placement));
|
||||
|
||||
uint32_t err_streams;
|
||||
|
||||
|
||||
if (_route->add_redirect (redirect, this, &err_streams)) {
|
||||
weird_plugin_dialog (*plugin, err_streams, _route);
|
||||
weird_plugin_dialog (**p, err_streams, _route);
|
||||
} else {
|
||||
|
||||
if (Profile->get_sae()) {
|
||||
redirect->set_active (true, 0);
|
||||
}
|
||||
redirect->active_changed.connect (bind (mem_fun (*this, &RedirectBox::show_redirect_active_r), boost::weak_ptr<Redirect>(redirect)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!using_plugin_selector) {
|
||||
newplug_connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1413,15 +1404,3 @@ RedirectBox::generate_redirect_title (boost::shared_ptr<PluginInsert> pi)
|
|||
return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker);
|
||||
}
|
||||
|
||||
void
|
||||
RedirectBox::plugin_selector_hidden ()
|
||||
{
|
||||
newplug_connection.disconnect();
|
||||
using_plugin_selector = false;
|
||||
}
|
||||
|
||||
void
|
||||
RedirectBox::plugin_selector_shown ()
|
||||
{
|
||||
using_plugin_selector = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include <pbd/fastlog.h>
|
||||
|
||||
#include "plugin_interest.h"
|
||||
#include "route_ui.h"
|
||||
#include "io_selector.h"
|
||||
#include "enums.h"
|
||||
|
|
@ -62,7 +63,7 @@ namespace ARDOUR {
|
|||
class Session;
|
||||
}
|
||||
|
||||
class RedirectBox : public Gtk::HBox
|
||||
class RedirectBox : public Gtk::HBox, public PluginInterestedObject
|
||||
{
|
||||
public:
|
||||
RedirectBox (ARDOUR::Placement, ARDOUR::Session&,
|
||||
|
|
@ -144,11 +145,7 @@ class RedirectBox : public Gtk::HBox
|
|||
void send_io_finished (IOSelector::Result, boost::weak_ptr<ARDOUR::Redirect>, IOSelectorWindow*);
|
||||
void choose_insert ();
|
||||
void choose_plugin ();
|
||||
void insert_plugin_chosen (boost::shared_ptr<ARDOUR::Plugin>);
|
||||
sigc::connection newplug_connection;
|
||||
bool using_plugin_selector;
|
||||
void plugin_selector_hidden ();
|
||||
void plugin_selector_shown ();
|
||||
void use_plugins (const SelectedPlugins&);
|
||||
|
||||
bool no_redirect_redisplay;
|
||||
bool ignore_delete;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue