make PluginManager API more in line with other singletons; do initial plugin discovery before beginning to construct the UI, so that if plugins create GUIs (e.g for license verification) they don't cause a run loop to catch the UIManager in an inconsistent state with menus defined but actions missing
git-svn-id: svn://localhost/ardour2/branches/3.0@10586 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -68,10 +68,10 @@ vector<RefPtr<Gtk::Action> > ActionManager::edit_point_in_region_sensitive_actio
|
||||
void
|
||||
ActionManager::init ()
|
||||
{
|
||||
ui_manager = UIManager::create ();
|
||||
|
||||
sys::path ui_file;
|
||||
|
||||
ui_manager = UIManager::create ();
|
||||
|
||||
SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path();
|
||||
|
||||
find_file_in_search_path (spath, "ardour.menus", ui_file);
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/callback.h"
|
||||
#include "ardour/profile.h"
|
||||
#include "ardour/plugin_manager.h"
|
||||
#include "ardour/session_directory.h"
|
||||
#include "ardour/session_route.h"
|
||||
#include "ardour/session_state_utils.h"
|
||||
@@ -414,7 +415,10 @@ ARDOUR_UI::post_engine ()
|
||||
|
||||
ARDOUR::init_post_engine ();
|
||||
|
||||
/* load up the UI manager */
|
||||
|
||||
ActionManager::init ();
|
||||
|
||||
_tooltips.enable();
|
||||
|
||||
if (setup_windows ()) {
|
||||
|
||||
@@ -81,7 +81,6 @@ ARDOUR_UI::setup_windows ()
|
||||
|
||||
/* all other dialogs are created conditionally */
|
||||
|
||||
cerr << "WE HAVE DEPENDENTS\n";
|
||||
we_have_dependents ();
|
||||
|
||||
theme_manager->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleThemeManager")));
|
||||
@@ -116,7 +115,6 @@ ARDOUR_UI::setup_windows ()
|
||||
|
||||
setup_transport();
|
||||
|
||||
cerr << "BUILD MENU BAR\n";
|
||||
build_menu_bar ();
|
||||
|
||||
setup_tooltips ();
|
||||
|
||||
@@ -230,7 +230,7 @@ Mixer_UI::Mixer_UI ()
|
||||
MonitorSection::setup_knob_images ();
|
||||
|
||||
#ifndef DEFER_PLUGIN_SELECTOR_LOAD
|
||||
_plugin_selector = new PluginSelector (PluginManager::the_manager ());
|
||||
_plugin_selector = new PluginSelector (PluginManager::instance ());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1668,7 +1668,7 @@ Mixer_UI::plugin_selector()
|
||||
{
|
||||
#ifdef DEFER_PLUGIN_SELECTOR_LOAD
|
||||
if (!_plugin_selector)
|
||||
_plugin_selector = new PluginSelector (PluginManager::the_manager ());
|
||||
_plugin_selector = new PluginSelector (PluginManager::instance());
|
||||
#endif
|
||||
|
||||
return _plugin_selector;
|
||||
|
||||
@@ -62,19 +62,20 @@ static const char* _filter_mode_strings[] = {
|
||||
0
|
||||
};
|
||||
|
||||
PluginSelector::PluginSelector (PluginManager *mgr)
|
||||
: ArdourDialog (_("Plugin Manager"), true, false),
|
||||
filter_button (Stock::CLEAR)
|
||||
PluginSelector::PluginSelector (PluginManager& mgr)
|
||||
: ArdourDialog (_("Plugin Manager"), true, false)
|
||||
, filter_button (Stock::CLEAR)
|
||||
, manager (mgr)
|
||||
|
||||
{
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
set_name ("PluginSelectorWindow");
|
||||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
||||
|
||||
_plugin_menu = 0;
|
||||
manager = mgr;
|
||||
in_row_change = false;
|
||||
|
||||
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::build_plugin_menu, this), gui_context());
|
||||
build_plugin_menu ();
|
||||
|
||||
plugin_model = Gtk::ListStore::create (plugin_columns);
|
||||
@@ -212,11 +213,11 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string&
|
||||
std::string mode = filter_mode.get_active_text ();
|
||||
|
||||
if (mode == _("Favorites only")) {
|
||||
return manager->get_status (info) == PluginManager::Favorite;
|
||||
return manager.get_status (info) == PluginManager::Favorite;
|
||||
}
|
||||
|
||||
if (mode == _("Hidden only")) {
|
||||
return manager->get_status (info) == PluginManager::Hidden;
|
||||
return manager.get_status (info) == PluginManager::Hidden;
|
||||
}
|
||||
|
||||
if (!filterstr.empty()) {
|
||||
@@ -304,8 +305,8 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte
|
||||
if (show_this_plugin (*i, filterstr)) {
|
||||
|
||||
TreeModel::Row newrow = *(plugin_model->append());
|
||||
newrow[plugin_columns.favorite] = (manager->get_status (*i) == PluginManager::Favorite);
|
||||
newrow[plugin_columns.hidden] = (manager->get_status (*i) == PluginManager::Hidden);
|
||||
newrow[plugin_columns.favorite] = (manager.get_status (*i) == PluginManager::Favorite);
|
||||
newrow[plugin_columns.hidden] = (manager.get_status (*i) == PluginManager::Hidden);
|
||||
newrow[plugin_columns.name] = (*i)->name;
|
||||
newrow[plugin_columns.type_name] = type;
|
||||
newrow[plugin_columns.category] = (*i)->category;
|
||||
@@ -338,14 +339,14 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte
|
||||
void
|
||||
PluginSelector::ladspa_refiller (const std::string& filterstr)
|
||||
{
|
||||
refiller (manager->ladspa_plugin_info(), filterstr, "LADSPA");
|
||||
refiller (manager.ladspa_plugin_info(), filterstr, "LADSPA");
|
||||
}
|
||||
|
||||
void
|
||||
PluginSelector::lv2_refiller (const std::string& filterstr)
|
||||
{
|
||||
#ifdef LV2_SUPPORT
|
||||
refiller (manager->lv2_plugin_info(), filterstr, "LV2");
|
||||
refiller (manager.lv2_plugin_info(), filterstr, "LV2");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -357,7 +358,7 @@ PluginSelector::vst_refiller (const std::string&)
|
||||
#endif
|
||||
{
|
||||
#ifdef VST_SUPPORT
|
||||
refiller (manager->vst_plugin_info(), filterstr, "VST");
|
||||
refiller (manager.vst_plugin_info(), filterstr, "VST");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -369,7 +370,7 @@ PluginSelector::lxvst_refiller (const std::string&)
|
||||
#endif
|
||||
{
|
||||
#ifdef LXVST_SUPPORT
|
||||
refiller (manager->lxvst_plugin_info(), filterstr, "LXVST");
|
||||
refiller (manager.lxvst_plugin_info(), filterstr, "LXVST");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -381,7 +382,7 @@ PluginSelector::au_refiller (const std::string&)
|
||||
#endif
|
||||
{
|
||||
#ifdef AUDIOUNIT_SUPPORT
|
||||
refiller (manager->au_plugin_info(), filterstr, "AU");
|
||||
refiller (manager.au_plugin_info(), filterstr, "AU");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -429,7 +430,7 @@ PluginSelector::btn_remove_clicked()
|
||||
void
|
||||
PluginSelector::btn_update_clicked()
|
||||
{
|
||||
manager->refresh ();
|
||||
manager.refresh ();
|
||||
refill();
|
||||
}
|
||||
|
||||
@@ -597,18 +598,18 @@ PluginSelector::build_plugin_menu ()
|
||||
{
|
||||
PluginInfoList all_plugs;
|
||||
|
||||
all_plugs.insert (all_plugs.end(), manager->ladspa_plugin_info().begin(), manager->ladspa_plugin_info().end());
|
||||
all_plugs.insert (all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end());
|
||||
#ifdef VST_SUPPORT
|
||||
all_plugs.insert (all_plugs.end(), manager->vst_plugin_info().begin(), manager->vst_plugin_info().end());
|
||||
all_plugs.insert (all_plugs.end(), manager.vst_plugin_info().begin(), manager.vst_plugin_info().end());
|
||||
#endif
|
||||
#ifdef LXVST_SUPPORT
|
||||
all_plugs.insert (all_plugs.end(), manager->lxvst_plugin_info().begin(), manager->lxvst_plugin_info().end());
|
||||
all_plugs.insert (all_plugs.end(), manager.lxvst_plugin_info().begin(), manager.lxvst_plugin_info().end());
|
||||
#endif
|
||||
#ifdef AUDIOUNIT_SUPPORT
|
||||
all_plugs.insert (all_plugs.end(), manager->au_plugin_info().begin(), manager->au_plugin_info().end());
|
||||
all_plugs.insert (all_plugs.end(), manager.au_plugin_info().begin(), manager.au_plugin_info().end());
|
||||
#endif
|
||||
#ifdef LV2_SUPPORT
|
||||
all_plugs.insert (all_plugs.end(), manager->lv2_plugin_info().begin(), manager->lv2_plugin_info().end());
|
||||
all_plugs.insert (all_plugs.end(), manager.lv2_plugin_info().begin(), manager.lv2_plugin_info().end());
|
||||
#endif
|
||||
|
||||
using namespace Menu_Helpers;
|
||||
@@ -646,7 +647,7 @@ PluginSelector::create_favs_menu (PluginInfoList& all_plugs)
|
||||
all_plugs.sort (cmp_by_name);
|
||||
|
||||
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
||||
if (manager->get_status (*i) == PluginManager::Favorite) {
|
||||
if (manager.get_status (*i) == PluginManager::Favorite) {
|
||||
favs->items().push_back (MenuElem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))));
|
||||
}
|
||||
}
|
||||
@@ -670,7 +671,7 @@ PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs)
|
||||
|
||||
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
||||
|
||||
if (manager->get_status (*i) == PluginManager::Hidden) continue;
|
||||
if (manager.get_status (*i) == PluginManager::Hidden) continue;
|
||||
|
||||
string creator = (*i)->creator;
|
||||
|
||||
@@ -711,7 +712,7 @@ PluginSelector::create_by_category_menu (ARDOUR::PluginInfoList& all_plugs)
|
||||
|
||||
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
||||
|
||||
if (manager->get_status (*i) == PluginManager::Hidden) continue;
|
||||
if (manager.get_status (*i) == PluginManager::Hidden) continue;
|
||||
|
||||
string category = (*i)->category;
|
||||
|
||||
@@ -771,9 +772,9 @@ PluginSelector::favorite_changed (const std::string& path)
|
||||
|
||||
pi = (*iter)[plugin_columns.plugin];
|
||||
|
||||
manager->set_status (pi->type, pi->unique_id, status);
|
||||
manager.set_status (pi->type, pi->unique_id, status);
|
||||
|
||||
manager->save_statuses ();
|
||||
manager.save_statuses ();
|
||||
|
||||
build_plugin_menu ();
|
||||
}
|
||||
@@ -807,9 +808,9 @@ PluginSelector::hidden_changed (const std::string& path)
|
||||
|
||||
pi = (*iter)[plugin_columns.plugin];
|
||||
|
||||
manager->set_status (pi->type, pi->unique_id, status);
|
||||
manager.set_status (pi->type, pi->unique_id, status);
|
||||
|
||||
manager->save_statuses ();
|
||||
manager.save_statuses ();
|
||||
}
|
||||
in_row_change = false;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ARDOUR {
|
||||
class PluginSelector : public ArdourDialog
|
||||
{
|
||||
public:
|
||||
PluginSelector (ARDOUR::PluginManager *);
|
||||
PluginSelector (ARDOUR::PluginManager&);
|
||||
~PluginSelector ();
|
||||
|
||||
void set_interested_object (PluginInterestedObject&);
|
||||
@@ -116,7 +116,7 @@ class PluginSelector : public ArdourDialog
|
||||
void au_refiller (const std::string&);
|
||||
|
||||
Gtk::Menu* _plugin_menu;
|
||||
ARDOUR::PluginManager *manager;
|
||||
ARDOUR::PluginManager& manager;
|
||||
|
||||
void row_clicked(GdkEventButton *);
|
||||
void btn_add_clicked();
|
||||
|
||||
@@ -150,7 +150,7 @@ RouteParams_UI::RouteParams_UI ()
|
||||
|
||||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK);
|
||||
|
||||
_plugin_selector = new PluginSelector (PluginManager::the_manager());
|
||||
_plugin_selector = new PluginSelector (PluginManager::instance());
|
||||
_plugin_selector->signal_delete_event().connect (sigc::bind (ptr_fun (just_hide_it),
|
||||
static_cast<Window *> (_plugin_selector)));
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ class Plugin;
|
||||
|
||||
class PluginManager : public boost::noncopyable {
|
||||
public:
|
||||
PluginManager ();
|
||||
static PluginManager& instance();
|
||||
|
||||
~PluginManager ();
|
||||
|
||||
ARDOUR::PluginInfoList &vst_plugin_info ();
|
||||
@@ -54,8 +55,6 @@ class PluginManager : public boost::noncopyable {
|
||||
int add_vst_directory (std::string dirpath);
|
||||
int add_lxvst_directory (std::string dirpath);
|
||||
|
||||
static PluginManager* the_manager() { return _manager; }
|
||||
|
||||
enum PluginStatusType {
|
||||
Normal = 0,
|
||||
Favorite,
|
||||
@@ -134,7 +133,8 @@ class PluginManager : public boost::noncopyable {
|
||||
std::string get_ladspa_category (uint32_t id);
|
||||
std::vector<uint32_t> ladspa_plugin_whitelist;
|
||||
|
||||
static PluginManager* _manager; // singleton
|
||||
static PluginManager* _instance; // singleton
|
||||
PluginManager ();
|
||||
};
|
||||
|
||||
} /* namespace ARDOUR */
|
||||
|
||||
@@ -334,7 +334,7 @@ ARDOUR::init (bool use_vst, bool try_optimization)
|
||||
Analyser::init ();
|
||||
|
||||
/* singleton - first object is "it" */
|
||||
new PluginManager ();
|
||||
(void) PluginManager::instance();
|
||||
|
||||
ProcessThread::init ();
|
||||
BufferManager::init (10); // XX should be num_processors_for_dsp + 1 for the GUI thread
|
||||
@@ -374,6 +374,10 @@ ARDOUR::init_post_engine ()
|
||||
if ((node = Config->control_protocol_state()) != 0) {
|
||||
ControlProtocolManager::instance().set_state (*node, Stateful::loading_state_version);
|
||||
}
|
||||
|
||||
/* find plugins */
|
||||
|
||||
ARDOUR::PluginManager::instance().refresh ();
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -119,35 +119,35 @@ Plugin::save_preset (string name)
|
||||
PluginPtr
|
||||
ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
|
||||
{
|
||||
PluginManager *mgr = PluginManager::the_manager();
|
||||
PluginManager& mgr (PluginManager::instance());
|
||||
PluginInfoList plugs;
|
||||
|
||||
switch (type) {
|
||||
case ARDOUR::LADSPA:
|
||||
plugs = mgr->ladspa_plugin_info();
|
||||
plugs = mgr.ladspa_plugin_info();
|
||||
break;
|
||||
|
||||
#ifdef LV2_SUPPORT
|
||||
case ARDOUR::LV2:
|
||||
plugs = mgr->lv2_plugin_info();
|
||||
plugs = mgr.lv2_plugin_info();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef VST_SUPPORT
|
||||
case ARDOUR::VST:
|
||||
plugs = mgr->vst_plugin_info();
|
||||
plugs = mgr.vst_plugin_info();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef LXVST_SUPPORT
|
||||
case ARDOUR::LXVST:
|
||||
plugs = mgr->lxvst_plugin_info();
|
||||
plugs = mgr.lxvst_plugin_info();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef AUDIOUNIT_SUPPORT
|
||||
case ARDOUR::AudioUnit:
|
||||
plugs = mgr->au_plugin_info();
|
||||
plugs = mgr.au_plugin_info();
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -81,7 +81,16 @@ using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
using namespace std;
|
||||
|
||||
PluginManager* PluginManager::_manager = 0;
|
||||
PluginManager* PluginManager::_instance = 0;
|
||||
|
||||
PluginManager&
|
||||
PluginManager::instance()
|
||||
{
|
||||
if (!_instance) {
|
||||
_instance = new PluginManager;
|
||||
}
|
||||
return *_instance;
|
||||
}
|
||||
|
||||
PluginManager::PluginManager ()
|
||||
: _vst_plugin_info(0)
|
||||
@@ -133,8 +142,8 @@ PluginManager::PluginManager ()
|
||||
lxvst_path = s;
|
||||
}
|
||||
|
||||
if (_manager == 0) {
|
||||
_manager = this;
|
||||
if (_instance == 0) {
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
/* the plugin manager is constructed too early to use Profile */
|
||||
|
||||
@@ -78,18 +78,12 @@ RCConfiguration::~RCConfiguration ()
|
||||
int
|
||||
RCConfiguration::load_state ()
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
sys::path system_rc_file;
|
||||
struct stat statbuf;
|
||||
|
||||
/* load system configuration first */
|
||||
|
||||
if (find_file_in_search_path (ardour_search_path() + system_config_search_path(),
|
||||
"ardour_system.rc", system_rc_file) )
|
||||
{
|
||||
found = true;
|
||||
|
||||
if (find_file_in_search_path (ardour_search_path() + system_config_search_path(), "ardour_system.rc", system_rc_file)) {
|
||||
string rcfile = system_rc_file.to_string();
|
||||
|
||||
/* stupid XML Parser hates empty files */
|
||||
@@ -120,11 +114,7 @@ RCConfiguration::load_state ()
|
||||
|
||||
sys::path user_rc_file;
|
||||
|
||||
if (find_file_in_search_path (ardour_search_path() + user_config_directory(),
|
||||
"ardour.rc", user_rc_file))
|
||||
{
|
||||
found = true;
|
||||
|
||||
if (find_file_in_search_path (ardour_search_path() + user_config_directory(), "ardour.rc", user_rc_file)) {
|
||||
string rcfile = user_rc_file.to_string();
|
||||
|
||||
/* stupid XML parser hates empty files */
|
||||
@@ -151,9 +141,6 @@ RCConfiguration::load_state ()
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
error << string_compose (_("%1: could not find configuration file (ardour.rc), canvas will look broken."), PROGRAM_NAME) << endmsg;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
1
wscript
1
wscript
@@ -519,7 +519,6 @@ def configure(conf):
|
||||
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
|
||||
autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18')
|
||||
autowaf.check_pkg(conf, 'giomm-2.4', uselib_store='GIOMM', atleast_version='2.2')
|
||||
autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.3', mandatory=False)
|
||||
|
||||
for i in children:
|
||||
sub_config_and_use(conf, i)
|
||||
|
||||
Reference in New Issue
Block a user