remove all use of NO_PLUGIN_STATE #ifdef

We determined several years that we should never ever do this,
and changed the basis for the free/demo copy because of that.
This commit is contained in:
Paul Davis 2019-09-29 10:00:23 -06:00
parent bc3b658349
commit f470d3e856
12 changed files with 10 additions and 146 deletions

View file

@ -551,50 +551,6 @@ ARDOUR_UI::starting ()
} }
} }
#ifdef NO_PLUGIN_STATE
ARDOUR::RecentSessions rs;
ARDOUR::read_recent_sessions (rs);
string path = Glib::build_filename (user_config_directory(), ".iknowaboutfreeversion");
if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS) && !rs.empty()) {
/* already used Ardour, have sessions ... warn about plugin state */
ArdourDialog d (_("Free/Demo Version Warning"), true);
Label l;
Button b (string_compose (_("Subscribe and support development of %1"), PROGRAM_NAME));
CheckButton c (_("Don't warn me about this again"));
l.set_markup (string_compose (_("<span weight=\"bold\" size=\"large\">%1</span>\n\n<b>%2</b>\n\n<i>%3</i>\n\n%4"),
string_compose (_("This is a free/demo version of %1"), PROGRAM_NAME),
_("It will not restore OR save any plugin settings"),
_("If you load an existing session with plugin settings\n"
"they will not be used and will be lost."),
_("To get full access to updates without this limitation\n"
"consider becoming a subscriber for a low cost every month.")));
l.set_justify (JUSTIFY_CENTER);
b.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::launch_subscribe));
d.get_vbox()->pack_start (l, true, true);
d.get_vbox()->pack_start (b, false, false, 12);
d.get_vbox()->pack_start (c, false, false, 12);
d.add_button (_("Quit now"), RESPONSE_CANCEL);
d.add_button (string_compose (_("Continue using %1"), PROGRAM_NAME), RESPONSE_OK);
d.show_all ();
c.signal_toggled().connect (sigc::hide_return (sigc::bind (sigc::ptr_fun (toggle_file_existence), path)));
if (d.run () != RESPONSE_OK) {
_exit (EXIT_SUCCESS);
}
}
#endif
/* go get a session */ /* go get a session */
const bool new_session_required = (ARDOUR_COMMAND_LINE::new_session || (!ARDOUR::Profile->get_mixbus() && brand_new_user)); const bool new_session_required = (ARDOUR_COMMAND_LINE::new_session || (!ARDOUR::Profile->get_mixbus() && brand_new_user));

View file

@ -633,27 +633,9 @@ PlugUIBase::preset_selected (Plugin::PresetRecord preset)
} }
} }
#ifdef NO_PLUGIN_STATE
static bool seen_saving_message = false;
static void show_no_plugin_message()
{
info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a full version"),
PROGRAM_NAME)
<< endmsg;
info << _("To get full access to updates without this limitation\n"
"consider becoming a subscriber for a low cost every month.")
<< endmsg;
info << X_("https://community.ardour.org/s/subscribe")
<< endmsg;
ARDOUR_UI::instance()->popup_error(_("Plugin presets are not supported in this build, see the Log window for more information."));
}
#endif
void void
PlugUIBase::add_plugin_setting () PlugUIBase::add_plugin_setting ()
{ {
#ifndef NO_PLUGIN_STATE
NewPluginPresetDialog d (plugin, _("New Preset")); NewPluginPresetDialog d (plugin, _("New Preset"));
switch (d.run ()) { switch (d.run ()) {
@ -672,43 +654,23 @@ PlugUIBase::add_plugin_setting ()
} }
break; break;
} }
#else
if (!seen_saving_message) {
seen_saving_message = true;
show_no_plugin_message();
}
#endif
} }
void void
PlugUIBase::save_plugin_setting () PlugUIBase::save_plugin_setting ()
{ {
#ifndef NO_PLUGIN_STATE
string const name = _preset_combo.get_text (); string const name = _preset_combo.get_text ();
plugin->remove_preset (name); plugin->remove_preset (name);
Plugin::PresetRecord const r = plugin->save_preset (name); Plugin::PresetRecord const r = plugin->save_preset (name);
if (!r.uri.empty ()) { if (!r.uri.empty ()) {
plugin->load_preset (r); plugin->load_preset (r);
} }
#else
if (!seen_saving_message) {
seen_saving_message = true;
show_no_plugin_message();
}
#endif
} }
void void
PlugUIBase::delete_plugin_setting () PlugUIBase::delete_plugin_setting ()
{ {
#ifndef NO_PLUGIN_STATE
plugin->remove_preset (_preset_combo.get_text ()); plugin->remove_preset (_preset_combo.get_text ());
#else
if (!seen_saving_message) {
seen_saving_message = true;
show_no_plugin_message();
}
#endif
} }
void void

View file

@ -2061,7 +2061,6 @@ AUPlugin::set_state(const XMLNode& node, int version)
return -1; return -1;
} }
#ifndef NO_PLUGIN_STATE
if (node.children().empty()) { if (node.children().empty()) {
return -1; return -1;
} }
@ -2097,7 +2096,6 @@ AUPlugin::set_state(const XMLNode& node, int version)
} }
CFRelease (propertyList); CFRelease (propertyList);
} }
#endif
Plugin::set_state (node, version); Plugin::set_state (node, version);
return ret; return ret;
@ -2593,7 +2591,7 @@ AUPluginInfo::get_presets (bool user_only) const
{ {
std::vector<Plugin::PresetRecord> p; std::vector<Plugin::PresetRecord> p;
boost::shared_ptr<CAComponent> comp; boost::shared_ptr<CAComponent> comp;
#ifndef NO_PLUGIN_STATE
try { try {
comp = boost::shared_ptr<CAComponent>(new CAComponent(*descriptor)); comp = boost::shared_ptr<CAComponent>(new CAComponent(*descriptor));
if (!comp->IsValid()) { if (!comp->IsValid()) {
@ -2664,7 +2662,6 @@ AUPluginInfo::get_presets (bool user_only) const
CFRelease (presets); CFRelease (presets);
unit->Uninitialize (); unit->Uninitialize ();
#endif // NO_PLUGIN_STATE
return p; return p;
} }

View file

@ -375,19 +375,15 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
return set_state_2X (node, version); return set_state_2X (node, version);
} }
#ifndef NO_PLUGIN_STATE
XMLNodeList nodes; XMLNodeList nodes;
XMLNodeConstIterator iter; XMLNodeConstIterator iter;
XMLNode *child; XMLNode *child;
#endif
if (node.name() != state_node_name()) { if (node.name() != state_node_name()) {
error << _("Bad node sent to LadspaPlugin::set_state") << endmsg; error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
return -1; return -1;
} }
#ifndef NO_PLUGIN_STATE
nodes = node.children ("Port"); nodes = node.children ("Port");
for (iter = nodes.begin(); iter != nodes.end(); ++iter) { for (iter = nodes.begin(); iter != nodes.end(); ++iter) {
@ -409,7 +405,6 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
set_parameter (port_id, value); set_parameter (port_id, value);
} }
#endif
latency_compute_run (); latency_compute_run ();
@ -419,7 +414,6 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
int int
LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */) LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
{ {
#ifndef NO_PLUGIN_STATE
XMLNodeList nodes; XMLNodeList nodes;
XMLProperty const * prop; XMLProperty const * prop;
XMLNodeConstIterator iter; XMLNodeConstIterator iter;
@ -427,7 +421,6 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
const char *port; const char *port;
const char *data; const char *data;
uint32_t port_id; uint32_t port_id;
#endif
LocaleGuard lg; LocaleGuard lg;
if (node.name() != state_node_name()) { if (node.name() != state_node_name()) {
@ -435,7 +428,6 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
return -1; return -1;
} }
#ifndef NO_PLUGIN_STATE
nodes = node.children ("port"); nodes = node.children ("port");
for(iter = nodes.begin(); iter != nodes.end(); ++iter){ for(iter = nodes.begin(); iter != nodes.end(); ++iter){
@ -460,7 +452,6 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
} }
latency_compute_run (); latency_compute_run ();
#endif
return 0; return 0;
} }
@ -721,7 +712,7 @@ std::vector<Plugin::PresetRecord>
LadspaPluginInfo::get_presets (bool /*user_only*/) const LadspaPluginInfo::get_presets (bool /*user_only*/) const
{ {
std::vector<Plugin::PresetRecord> p; std::vector<Plugin::PresetRecord> p;
#if (defined HAVE_LRDF && !defined NO_PLUGIN_STATE) #ifdef HAVE_LRDF
if (!isdigit (unique_id[0])) { if (!isdigit (unique_id[0])) {
return p; return p;
} }

View file

@ -848,11 +848,9 @@ LuaProc::set_script_from_state (const XMLNode& node)
int int
LuaProc::set_state (const XMLNode& node, int version) LuaProc::set_state (const XMLNode& node, int version)
{ {
#ifndef NO_PLUGIN_STATE
XMLNodeList nodes; XMLNodeList nodes;
XMLNodeConstIterator iter; XMLNodeConstIterator iter;
XMLNode *child; XMLNode *child;
#endif
if (_script.empty ()) { if (_script.empty ()) {
if (set_script_from_state (node)) { if (set_script_from_state (node)) {
@ -860,7 +858,6 @@ LuaProc::set_state (const XMLNode& node, int version)
} }
} }
#ifndef NO_PLUGIN_STATE
if (node.name() != state_node_name()) { if (node.name() != state_node_name()) {
error << _("Bad node sent to LuaProc::set_state") << endmsg; error << _("Bad node sent to LuaProc::set_state") << endmsg;
return -1; return -1;
@ -885,7 +882,6 @@ LuaProc::set_state (const XMLNode& node, int version)
set_parameter (port_id, value); set_parameter (port_id, value);
} }
#endif
return Plugin::set_state (node, version); return Plugin::set_state (node, version);
} }

View file

@ -2128,8 +2128,6 @@ LV2Plugin::set_state(const XMLNode& node, int version)
return -1; return -1;
} }
#ifndef NO_PLUGIN_STATE
if (version < 3000) { if (version < 3000) {
nodes = node.children("port"); nodes = node.children("port");
} else { } else {
@ -2210,7 +2208,6 @@ LV2Plugin::set_state(const XMLNode& node, int version)
if (_session.loading ()) { if (_session.loading ()) {
latency_compute_run(); latency_compute_run();
} }
#endif
return Plugin::set_state(node, version); return Plugin::set_state(node, version);
} }
@ -3425,7 +3422,7 @@ std::vector<Plugin::PresetRecord>
LV2PluginInfo::get_presets (bool /*user_only*/) const LV2PluginInfo::get_presets (bool /*user_only*/) const
{ {
std::vector<Plugin::PresetRecord> p; std::vector<Plugin::PresetRecord> p;
#ifndef NO_PLUGIN_STATE
const LilvPlugin* lp = NULL; const LilvPlugin* lp = NULL;
try { try {
PluginPtr plugin; PluginPtr plugin;
@ -3468,7 +3465,7 @@ LV2PluginInfo::get_presets (bool /*user_only*/) const
lilv_node_free(rdfs_label); lilv_node_free(rdfs_label);
lilv_node_free(pset_Preset); lilv_node_free(pset_Preset);
lilv_node_free(lv2_appliesTo); lilv_node_free(lv2_appliesTo);
#endif
return p; return p;
} }

View file

@ -108,7 +108,7 @@ std::vector<Plugin::PresetRecord>
LXVSTPluginInfo::get_presets (bool user_only) const LXVSTPluginInfo::get_presets (bool user_only) const
{ {
std::vector<Plugin::PresetRecord> p; std::vector<Plugin::PresetRecord> p;
#ifndef NO_PLUGIN_STATE
if (!Config->get_use_lxvst()) { if (!Config->get_use_lxvst()) {
return p; return p;
} }
@ -163,9 +163,8 @@ LXVSTPluginInfo::get_presets (bool user_only) const
} }
} }
} }
delete t;
#endif
delete t;
return p; return p;
} }

View file

@ -113,7 +113,7 @@ std::vector<Plugin::PresetRecord>
MacVSTPluginInfo::get_presets (bool user_only) const MacVSTPluginInfo::get_presets (bool user_only) const
{ {
std::vector<Plugin::PresetRecord> p; std::vector<Plugin::PresetRecord> p;
#ifndef NO_PLUGIN_STATE
if (!Config->get_use_macvst ()) { if (!Config->get_use_macvst ()) {
return p; return p;
} }
@ -169,8 +169,6 @@ MacVSTPluginInfo::get_presets (bool user_only) const
} }
} }
delete t; delete t;
#endif
return p; return p;
} }

View file

@ -80,11 +80,6 @@ using namespace PBD;
namespace ARDOUR { class AudioEngine; } namespace ARDOUR { class AudioEngine; }
#ifdef NO_PLUGIN_STATE
static bool seen_get_state_message = false;
static bool seen_set_state_message = false;
#endif
PBD::Signal2<void, std::string, Plugin*> Plugin::PresetsChanged; PBD::Signal2<void, std::string, Plugin*> Plugin::PresetsChanged;
bool bool
@ -321,12 +316,11 @@ Plugin::possible_output () const
const Plugin::PresetRecord * const Plugin::PresetRecord *
Plugin::preset_by_label (const string& label) Plugin::preset_by_label (const string& label)
{ {
#ifndef NO_PLUGIN_STATE
if (!_have_presets) { if (!_have_presets) {
find_presets (); find_presets ();
_have_presets = true; _have_presets = true;
} }
#endif
// FIXME: O(n) // FIXME: O(n)
for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) { for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) {
if (i->second.label == label) { if (i->second.label == label) {
@ -340,12 +334,11 @@ Plugin::preset_by_label (const string& label)
const Plugin::PresetRecord * const Plugin::PresetRecord *
Plugin::preset_by_uri (const string& uri) Plugin::preset_by_uri (const string& uri)
{ {
#ifndef NO_PLUGIN_STATE
if (!_have_presets) { if (!_have_presets) {
find_presets (); find_presets ();
_have_presets = true; _have_presets = true;
} }
#endif
map<string, PresetRecord>::const_iterator pr = _presets.find (uri); map<string, PresetRecord>::const_iterator pr = _presets.find (uri);
if (pr != _presets.end()) { if (pr != _presets.end()) {
return &pr->second; return &pr->second;
@ -425,7 +418,6 @@ Plugin::get_presets ()
{ {
vector<PresetRecord> p; vector<PresetRecord> p;
#ifndef NO_PLUGIN_STATE
if (!_have_presets) { if (!_have_presets) {
find_presets (); find_presets ();
_have_presets = true; _have_presets = true;
@ -434,14 +426,6 @@ Plugin::get_presets ()
for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) { for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) {
p.push_back (i->second); p.push_back (i->second);
} }
#else
if (!seen_set_state_message) {
info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a full version"),
PROGRAM_NAME)
<< endmsg;
seen_set_state_message = true;
}
#endif
return p; return p;
} }
@ -511,16 +495,7 @@ Plugin::get_state ()
root->set_property (X_("last-preset-label"), _last_preset.label); root->set_property (X_("last-preset-label"), _last_preset.label);
root->set_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset); root->set_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset);
#ifndef NO_PLUGIN_STATE
add_state (root); add_state (root);
#else
if (!seen_get_state_message) {
info << string_compose (_("Saving plugin settings is not supported in this build of %1. Consider paying for the full version"),
PROGRAM_NAME)
<< endmsg;
seen_get_state_message = true;
}
#endif
return *root; return *root;
} }

View file

@ -2507,7 +2507,6 @@ PluginInsert::set_control_ids (const XMLNode& node, int version)
/* this may create the new controllable */ /* this may create the new controllable */
boost::shared_ptr<Evoral::Control> c = control (Evoral::Parameter (PluginAutomation, 0, p)); boost::shared_ptr<Evoral::Control> c = control (Evoral::Parameter (PluginAutomation, 0, p));
#ifndef NO_PLUGIN_STATE
if (!c) { if (!c) {
continue; continue;
} }
@ -2515,7 +2514,6 @@ PluginInsert::set_control_ids (const XMLNode& node, int version)
if (ac) { if (ac) {
ac->set_state (**iter, version); ac->set_state (**iter, version);
} }
#endif
} }
} }

View file

@ -314,8 +314,6 @@ VSTPlugin::set_state (const XMLNode& node, int version)
{ {
LocaleGuard lg; LocaleGuard lg;
int ret = -1; int ret = -1;
#ifndef NO_PLUGIN_STATE
XMLNode* child; XMLNode* child;
if ((child = find_named_node (node, X_("chunk"))) != 0) { if ((child = find_named_node (node, X_("chunk"))) != 0) {
@ -353,7 +351,6 @@ VSTPlugin::set_state (const XMLNode& node, int version)
ret = 0; ret = 0;
} }
#endif
Plugin::set_state (node, version); Plugin::set_state (node, version);
return ret; return ret;

View file

@ -106,7 +106,7 @@ std::vector<Plugin::PresetRecord>
WindowsVSTPluginInfo::get_presets (bool user_only) const WindowsVSTPluginInfo::get_presets (bool user_only) const
{ {
std::vector<Plugin::PresetRecord> p; std::vector<Plugin::PresetRecord> p;
#ifndef NO_PLUGIN_STATE
if (!Config->get_use_lxvst()) { if (!Config->get_use_lxvst()) {
return p; return p;
} }
@ -130,8 +130,6 @@ WindowsVSTPluginInfo::get_presets (bool user_only) const
} }
} }
delete t; delete t;
#endif
return p; return p;
} }