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 */
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
PlugUIBase::add_plugin_setting ()
{
#ifndef NO_PLUGIN_STATE
NewPluginPresetDialog d (plugin, _("New Preset"));
switch (d.run ()) {
@ -672,43 +654,23 @@ PlugUIBase::add_plugin_setting ()
}
break;
}
#else
if (!seen_saving_message) {
seen_saving_message = true;
show_no_plugin_message();
}
#endif
}
void
PlugUIBase::save_plugin_setting ()
{
#ifndef NO_PLUGIN_STATE
string const name = _preset_combo.get_text ();
plugin->remove_preset (name);
Plugin::PresetRecord const r = plugin->save_preset (name);
if (!r.uri.empty ()) {
plugin->load_preset (r);
}
#else
if (!seen_saving_message) {
seen_saving_message = true;
show_no_plugin_message();
}
#endif
}
void
PlugUIBase::delete_plugin_setting ()
{
#ifndef NO_PLUGIN_STATE
plugin->remove_preset (_preset_combo.get_text ());
#else
if (!seen_saving_message) {
seen_saving_message = true;
show_no_plugin_message();
}
#endif
}
void

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -80,11 +80,6 @@ using namespace PBD;
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;
bool
@ -321,12 +316,11 @@ Plugin::possible_output () const
const Plugin::PresetRecord *
Plugin::preset_by_label (const string& label)
{
#ifndef NO_PLUGIN_STATE
if (!_have_presets) {
find_presets ();
_have_presets = true;
}
#endif
// FIXME: O(n)
for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) {
if (i->second.label == label) {
@ -340,12 +334,11 @@ Plugin::preset_by_label (const string& label)
const Plugin::PresetRecord *
Plugin::preset_by_uri (const string& uri)
{
#ifndef NO_PLUGIN_STATE
if (!_have_presets) {
find_presets ();
_have_presets = true;
}
#endif
map<string, PresetRecord>::const_iterator pr = _presets.find (uri);
if (pr != _presets.end()) {
return &pr->second;
@ -425,7 +418,6 @@ Plugin::get_presets ()
{
vector<PresetRecord> p;
#ifndef NO_PLUGIN_STATE
if (!_have_presets) {
find_presets ();
_have_presets = true;
@ -434,14 +426,6 @@ Plugin::get_presets ()
for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) {
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;
}
@ -511,16 +495,7 @@ Plugin::get_state ()
root->set_property (X_("last-preset-label"), _last_preset.label);
root->set_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset);
#ifndef NO_PLUGIN_STATE
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;
}

View file

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

View file

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

View file

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