diff options
author | Robin Gareus <robin@gareus.org> | 2019-08-27 13:43:09 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-08-27 13:43:09 +0200 |
commit | 79ac8215e92326cc10455cae267fa6ec79c06e80 (patch) | |
tree | cb117f9de2771f7ce849c09ae7d0710d0f8cb719 /libs/ardour/plugin_manager.cc | |
parent | 37caa11b52b05e0222e0d1b77ba82fd316e301d3 (diff) |
Update Plugin-Tag policy
* Don't store tags from plugin's own metadata
Those are set during plugin-scan every time
* Save user-tags even if they're not new
* Reset tags to factory-file tag (if any)
Old user tag files (prior to this commit) are interpreted
as "factory-file". This will auto-correct after the
first save_tags().
Diffstat (limited to 'libs/ardour/plugin_manager.cc')
-rw-r--r-- | libs/ardour/plugin_manager.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index f6bf3acbcc..905a3bcc18 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -1574,8 +1574,8 @@ PluginManager::save_tags () } } #endif - if ((*i).tagtype == FromFactoryFile || (*i).tagtype == FromUserFile) { - /* user file should contain only plugins that are (a) newly user-tagged or (b) previously unknown */ + if ((*i).tagtype <= FromFactoryFile) { + /* user file should contain only plugins that are user-tagged */ continue; } XMLNode* node = new XMLNode (X_("Plugin")); @@ -1583,9 +1583,7 @@ PluginManager::save_tags () node->set_property (X_("id"), (*i).unique_id); node->set_property (X_("tags"), (*i).tags); node->set_property (X_("name"), (*i).name); - if ((*i).tagtype >= FromUserFile) { - node->set_property (X_("user-set"), "1"); - } + node->set_property (X_("user-set"), "1"); root->add_child_nocopy (*node); } @@ -1650,6 +1648,12 @@ PluginManager::set_tags (PluginType t, string id, string tag, std::string name, ptags.erase (ps); ptags.insert (ps); } + if (ttype == FromFactoryFile) { + if (find (ftags.begin(), ftags.end(), ps) != ftags.end()) { + ftags.erase (ps); + } + ftags.insert (ps); + } if (ttype == FromGui) { PluginTagChanged (t, id, sanitized); /* EMIT SIGNAL */ } @@ -1660,11 +1664,16 @@ PluginManager::reset_tags (PluginInfoPtr const& pi) { PluginTag ps (pi->type, pi->unique_id, pi->category, pi->name, FromPlug); + PluginTagList::const_iterator j = find (ftags.begin(), ftags.end(), ps); + if (j != ftags.end()) { + ps = *j; + } + PluginTagList::const_iterator i = find (ptags.begin(), ptags.end(), ps); if (i != ptags.end()) { ptags.erase (ps); ptags.insert (ps); - PluginTagChanged (pi->type, pi->unique_id, pi->category); /* EMIT SIGNAL */ + PluginTagChanged (ps.type, ps.unique_id, ps.tags); /* EMIT SIGNAL */ } } |