allow creating plugin-presets by dragging a plugin to the sidebar
This commit is contained in:
parent
0aba08594c
commit
4758de37cd
|
@ -207,6 +207,7 @@ Mixer_UI::Mixer_UI ()
|
|||
favorite_plugins_display.set_drag_column (favorite_plugins_columns.name.index());
|
||||
favorite_plugins_display.signal_row_activated().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_activated));
|
||||
favorite_plugins_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_button_press), false);
|
||||
favorite_plugins_display.signal_drop.connect (sigc::mem_fun (*this, &Mixer_UI::plugin_drop));
|
||||
|
||||
favorite_plugins_scroller.add (favorite_plugins_display);
|
||||
favorite_plugins_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
||||
|
@ -2500,3 +2501,19 @@ PluginTreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest, const
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data)
|
||||
{
|
||||
if (data.get_target() != "PluginPresetPtr") {
|
||||
return;
|
||||
}
|
||||
const void *d = data.get_data();
|
||||
const PluginPresetPtr ppp = *(static_cast<const PluginPresetPtr*> (d));
|
||||
|
||||
PluginManager::PluginStatusType status = PluginManager::Favorite;
|
||||
PluginManager& manager (PluginManager::instance());
|
||||
|
||||
manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
|
||||
manager.save_statuses ();
|
||||
}
|
||||
|
|
|
@ -201,6 +201,7 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR
|
|||
void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
|
||||
bool plugin_row_button_press (GdkEventButton*);
|
||||
void popup_note_context_menu (GdkEventButton*);
|
||||
void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
|
||||
|
||||
enum ProcessorPosition {
|
||||
AddTop,
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "send_ui.h"
|
||||
#include "timers.h"
|
||||
#include "tooltips.h"
|
||||
#include "new_plugin_preset_dialog.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
@ -132,6 +133,12 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
|
|||
_button.set_elements(ArdourButton::Element(_button.elements() & ~ArdourButton::Indicator));
|
||||
_unknown_processor = true;
|
||||
}
|
||||
{
|
||||
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
|
||||
if (pi && pi->plugin()) {
|
||||
_plugin_preset_pointer = PluginPresetPtr (new PluginPreset (pi->plugin()->get_info()));
|
||||
}
|
||||
}
|
||||
if (_processor) {
|
||||
|
||||
_vbox.pack_start (_routing_icon);
|
||||
|
@ -211,6 +218,41 @@ ProcessorEntry::drag_text () const
|
|||
{
|
||||
return name (Wide);
|
||||
}
|
||||
bool
|
||||
ProcessorEntry::drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &data)
|
||||
{
|
||||
if (data.get_target() == "PluginPresetPtr" && _plugin_preset_pointer) {
|
||||
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
|
||||
boost::shared_ptr<ARDOUR::Plugin> plugin = pi->plugin();
|
||||
assert (plugin);
|
||||
NewPluginPresetDialog d (plugin);
|
||||
|
||||
_plugin_preset_pointer->_preset.valid = false;
|
||||
|
||||
switch (d.run ()) {
|
||||
case Gtk::RESPONSE_ACCEPT:
|
||||
if (d.name().empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (d.replace ()) {
|
||||
plugin->remove_preset (d.name ());
|
||||
}
|
||||
|
||||
Plugin::PresetRecord const r = plugin->save_preset (d.name());
|
||||
|
||||
if (!r.uri.empty ()) {
|
||||
_plugin_preset_pointer->_preset.uri = r.uri;
|
||||
_plugin_preset_pointer->_preset.label = r.label;
|
||||
_plugin_preset_pointer->_preset.user = r.user;
|
||||
_plugin_preset_pointer->_preset.valid = r.valid;
|
||||
}
|
||||
}
|
||||
data.set (data.get_target(), 8, (const guchar *) &_plugin_preset_pointer, sizeof (PluginPresetPtr));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ProcessorEntry::set_position (Position p, uint32_t num)
|
||||
|
|
|
@ -119,6 +119,8 @@ public:
|
|||
bool is_selectable() const {return _selectable;}
|
||||
void set_selectable(bool s) { _selectable = s; }
|
||||
|
||||
bool drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &);
|
||||
|
||||
enum Position {
|
||||
PreFader,
|
||||
Fader,
|
||||
|
@ -165,6 +167,7 @@ private:
|
|||
PBD::ScopedConnection active_connection;
|
||||
PBD::ScopedConnection name_connection;
|
||||
PBD::ScopedConnection config_connection;
|
||||
ARDOUR::PluginPresetPtr _plugin_preset_pointer;
|
||||
|
||||
class Control : public sigc::trackable {
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue