mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 23:25:43 +01:00
Postpone RoutePropertiesBox plugin refill until idle
This fixes an issue with some plugin UIs being initially empty. e.g. GMSynth.lv2 or ACE-Fluidsynth. The UI depends on the plugin provided MIDNAM and bank/patch information which is only loaded after the plugin is instantiated.
This commit is contained in:
parent
09216ef5d5
commit
32df0a8ff6
2 changed files with 28 additions and 2 deletions
|
|
@ -46,6 +46,7 @@ using namespace ARDOUR;
|
|||
using namespace ArdourWidgets;
|
||||
|
||||
RoutePropertiesBox::RoutePropertiesBox ()
|
||||
: _idle_refill_processors_id (-1)
|
||||
{
|
||||
_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER);
|
||||
_scroller.add (_box);
|
||||
|
|
@ -80,7 +81,7 @@ RoutePropertiesBox::set_route (std::shared_ptr<Route> r)
|
|||
_route = r;
|
||||
_route_connections.drop_connections ();
|
||||
|
||||
_route->processors_changed.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::refill_processors, this), gui_context());
|
||||
_route->processors_changed.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::idle_refill_processors, this), gui_context());
|
||||
_route->PropertyChanged.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::property_changed, this, _1), gui_context ());
|
||||
_route->DropReferences.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::drop_route, this), gui_context());
|
||||
refill_processors ();
|
||||
|
|
@ -132,7 +133,11 @@ RoutePropertiesBox::add_processor_to_display (std::weak_ptr<Processor> w)
|
|||
}
|
||||
#endif
|
||||
GenericPluginUI* plugin_ui = new GenericPluginUI (pib, true, true);
|
||||
pib->DropReferences.connect (_processor_connections, invalidator (*this), std::bind (&RoutePropertiesBox::refill_processors, this), gui_context());
|
||||
if (plugin_ui->empty ()) {
|
||||
delete plugin_ui;
|
||||
return;
|
||||
}
|
||||
//pib->DropReferences.connect (_processor_connections, invalidator (*this), std::bind (&RoutePropertiesBox::refill_processors, this), gui_context());
|
||||
_proc_uis.push_back (plugin_ui);
|
||||
|
||||
ArdourWidgets::Frame* frame = new ArdourWidgets::Frame ();
|
||||
|
|
@ -143,6 +148,21 @@ RoutePropertiesBox::add_processor_to_display (std::weak_ptr<Processor> w)
|
|||
plugin_ui->show ();
|
||||
}
|
||||
|
||||
int
|
||||
RoutePropertiesBox::_idle_refill_processors (gpointer arg)
|
||||
{
|
||||
static_cast<RoutePropertiesBox*>(arg)->refill_processors ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
RoutePropertiesBox::idle_refill_processors ()
|
||||
{
|
||||
if (_idle_refill_processors_id) {
|
||||
_idle_refill_processors_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 10, _idle_refill_processors, this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RoutePropertiesBox::refill_processors ()
|
||||
{
|
||||
|
|
@ -165,4 +185,5 @@ RoutePropertiesBox::refill_processors ()
|
|||
_box.set_size_request (-1, h);
|
||||
_scroller.show_all ();
|
||||
}
|
||||
_idle_refill_processors_id = -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ private:
|
|||
void drop_plugin_uis ();
|
||||
void refill_processors ();
|
||||
void add_processor_to_display (std::weak_ptr<ARDOUR::Processor> w);
|
||||
void idle_refill_processors ();
|
||||
|
||||
static int _idle_refill_processors (gpointer);
|
||||
|
||||
Gtk::ScrolledWindow _scroller;
|
||||
Gtk::HBox _box;
|
||||
|
|
@ -58,6 +61,8 @@ private:
|
|||
std::shared_ptr<ARDOUR::Route> _route;
|
||||
std::vector <GenericPluginUI*> _proc_uis;
|
||||
|
||||
int _idle_refill_processors_id;
|
||||
|
||||
PBD::ScopedConnectionList _processor_connections;
|
||||
PBD::ScopedConnectionList _route_connections;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue