Further defer changes of plugin Tags+Status, and consolidate code to call PluginListChanged only once.

This commit is contained in:
Ben Loftis 2018-02-02 19:25:01 -06:00
parent 3aacdd79ae
commit b69d818ce9
6 changed files with 30 additions and 39 deletions

View file

@ -68,10 +68,12 @@ PluginSelector::PluginSelector (PluginManager& mgr)
_plugin_menu = 0;
in_row_change = false;
//anytime the list changes ( Status, Tags, or scanned plugins ) we need to rebuild redirect-box plugin selector menu
manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::refill, this), gui_context());
manager.PluginStatusesChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::plugin_status_changed, this, _1, _2, _3), gui_context());
manager.PluginTagsChanged.connect(plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::tags_changed, this, _1, _2, _3), gui_context());
//these are used to update the info of specific entries, while they are being edited
manager.PluginStatusChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::plugin_status_changed, this, _1, _2, _3), gui_context());
manager.PluginTagChanged.connect(plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::tags_changed, this, _1, _2, _3), gui_context());
plugin_model = Gtk::ListStore::create (plugin_columns);
plugin_display.set_model (plugin_model);
@ -818,8 +820,8 @@ PluginSelector::run ()
manager.save_statuses();
}
if (_need_menu_rebuild) {
build_plugin_menu();
if ( _need_tag_save || _need_status_save || _need_menu_rebuild ) {
manager.PluginListChanged(); //emit signal
}
return (int) r;
@ -840,6 +842,7 @@ PluginSelector::tag_reset_button_clicked ()
manager.reset_tags (pi);
display_selection_changed ();
_need_tag_save = true;
_need_menu_rebuild = true;
}
}
@ -862,6 +865,7 @@ PluginSelector::tag_entry_changed ()
manager.set_tags (pi->type, pi->unique_id, tag_entry->get_text(), false);
_need_tag_save = true;
_need_menu_rebuild = true;
}
}
@ -876,11 +880,6 @@ PluginSelector::tags_changed (PluginType t, std::string unique_id, std::string t
}
row[plugin_columns.tags] = tags;
}
/* A plugin's tags change while the user is entering them.
* defer a rebuilding of the "tag" menu until the dialog is closed.
*/
_need_menu_rebuild = true;
}
void
@ -906,9 +905,6 @@ PluginSelector::plugin_status_changed (PluginType t, std::string uid, PluginMana
plugin_model->erase(i);
}
/* plugin menu must be re-built to accommodate Hidden and Favorite plugins */
build_plugin_menu();
return;
}
}
@ -1156,12 +1152,11 @@ PluginSelector::create_by_tags_menu (ARDOUR::PluginInfoList& all_plugs)
Gtk::Menu* submenu;
if ((x = tags_submenu_map.find (*t)) != tags_submenu_map.end()) {
submenu = x->second;
} else {
string typ = GetPluginTypeStr(*i);
MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
elem.get_child()->set_use_underline (false);
submenu->items().push_back (elem);
}
string typ = GetPluginTypeStr(*i);
MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
elem.get_child()->set_use_underline (false);
submenu->items().push_back (elem);
}
}
return by_tags;
@ -1209,6 +1204,7 @@ PluginSelector::favorite_changed (const std::string& path)
manager.set_status (pi->type, pi->unique_id, status);
_need_status_save = true;
_need_menu_rebuild = true;
}
in_row_change = false;
}
@ -1241,6 +1237,7 @@ PluginSelector::hidden_changed (const std::string& path)
manager.set_status (pi->type, pi->unique_id, status);
_need_status_save = true;
_need_menu_rebuild = true;
}
in_row_change = false;
}