mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
refine add preset/favorite dialog
dedicated "Add to Favorites only" mode.
This commit is contained in:
parent
8e1a9f0ada
commit
9283e97435
5 changed files with 25 additions and 5 deletions
|
|
@ -2508,6 +2508,9 @@ Mixer_UI::plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::Selecti
|
|||
if (data.get_target() != "PluginPresetPtr") {
|
||||
return;
|
||||
}
|
||||
if (data.get_length() != sizeof (PluginPresetPtr)) {
|
||||
return;
|
||||
}
|
||||
const void *d = data.get_data();
|
||||
const PluginPresetPtr ppp = *(static_cast<const PluginPresetPtr*> (d));
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
using namespace std;
|
||||
using namespace Gtk;
|
||||
|
||||
NewPluginPresetDialog::NewPluginPresetDialog (boost::shared_ptr<ARDOUR::Plugin> p)
|
||||
: ArdourDialog (_("New Preset"))
|
||||
NewPluginPresetDialog::NewPluginPresetDialog (boost::shared_ptr<ARDOUR::Plugin> p, std::string title, bool favorite_btn)
|
||||
: ArdourDialog (title)
|
||||
, _replace (_("Replace existing preset with this name"))
|
||||
{
|
||||
HBox* h = manage (new HBox);
|
||||
|
|
@ -40,10 +40,14 @@ NewPluginPresetDialog::NewPluginPresetDialog (boost::shared_ptr<ARDOUR::Plugin>
|
|||
get_vbox()->pack_start (_replace);
|
||||
|
||||
add_button (Stock::CANCEL, RESPONSE_CANCEL);
|
||||
if (favorite_btn) {
|
||||
add_button (_("New Favorite Only"), RESPONSE_NO);
|
||||
}
|
||||
_add = add_button (Stock::ADD, RESPONSE_ACCEPT);
|
||||
set_default_response (RESPONSE_ACCEPT);
|
||||
_name.set_activates_default(true);
|
||||
|
||||
|
||||
show_all ();
|
||||
|
||||
_presets = p->get_presets ();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
class NewPluginPresetDialog : public ArdourDialog
|
||||
{
|
||||
public:
|
||||
NewPluginPresetDialog (boost::shared_ptr<ARDOUR::Plugin>);
|
||||
NewPluginPresetDialog (boost::shared_ptr<ARDOUR::Plugin>, std::string, bool fav = false);
|
||||
|
||||
std::string name () const;
|
||||
bool replace () const;
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ void
|
|||
PlugUIBase::add_plugin_setting ()
|
||||
{
|
||||
#ifndef NO_PLUGIN_STATE
|
||||
NewPluginPresetDialog d (plugin);
|
||||
NewPluginPresetDialog d (plugin, _("New Preset"));
|
||||
|
||||
switch (d.run ()) {
|
||||
case Gtk::RESPONSE_ACCEPT:
|
||||
|
|
|
|||
|
|
@ -225,11 +225,24 @@ ProcessorEntry::drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::Select
|
|||
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
|
||||
boost::shared_ptr<ARDOUR::Plugin> plugin = pi->plugin();
|
||||
assert (plugin);
|
||||
NewPluginPresetDialog d (plugin);
|
||||
|
||||
PluginManager& manager (PluginManager::instance());
|
||||
bool fav = manager.get_status (_plugin_preset_pointer->_pip) == PluginManager::Favorite;
|
||||
|
||||
NewPluginPresetDialog d (plugin,
|
||||
string_compose(_("New Favorite Preset for \"%1\""),_plugin_preset_pointer->_pip->name), !fav);
|
||||
|
||||
_plugin_preset_pointer->_preset.valid = false;
|
||||
|
||||
switch (d.run ()) {
|
||||
case Gtk::RESPONSE_CANCEL:
|
||||
data.set (data.get_target(), 8, NULL, 0);
|
||||
return true;
|
||||
break;
|
||||
|
||||
case Gtk::RESPONSE_NO:
|
||||
break;
|
||||
|
||||
case Gtk::RESPONSE_ACCEPT:
|
||||
if (d.name().empty()) {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue