add route-ui pin-manager
This commit is contained in:
parent
d53d9b01ab
commit
cc0abf4ef5
@ -1600,8 +1600,12 @@ MixerStrip::build_route_ops_menu ()
|
||||
i->signal_activate().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*_route, &Route::set_strict_io), !_route->strict_io())));
|
||||
}
|
||||
|
||||
items.push_back (SeparatorElem());
|
||||
if (1 /* TODO IFF >= 1 plugin-insert */) {
|
||||
items.push_back (SeparatorElem());
|
||||
items.push_back (MenuElem (_("Pin Connections..."), sigc::mem_fun (*this, &RouteUI::manage_pins)));
|
||||
}
|
||||
|
||||
items.push_back (SeparatorElem());
|
||||
items.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
|
||||
|
||||
items.push_back (SeparatorElem());
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <gtkmm/table.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
||||
#include "pbd/replace_all.h"
|
||||
@ -1982,18 +1981,79 @@ PluginPinWidget::Control::control_changed ()
|
||||
_ignore_ui_adjustment = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PluginPinDialog::PluginPinDialog (boost::shared_ptr<ARDOUR::PluginInsert> pi)
|
||||
: ArdourWindow (string_compose (_("Pin Configuration: %1"), pi->name ()))
|
||||
, ppw (pi)
|
||||
{
|
||||
add (ppw);
|
||||
ppw.push_back (PluginPinWidgetPtr(new PluginPinWidget (pi)));
|
||||
add (*ppw.back());
|
||||
}
|
||||
|
||||
PluginPinDialog::~PluginPinDialog () { }
|
||||
|
||||
PluginPinDialog::PluginPinDialog (boost::shared_ptr<ARDOUR::Route> r)
|
||||
: ArdourWindow (string_compose (_("Pin Configuration: %1"), r->name ()))
|
||||
, _route (r)
|
||||
{
|
||||
vbox = manage (new VBox ());
|
||||
add (*vbox);
|
||||
vbox->show ();
|
||||
|
||||
_route->foreach_processor (sigc::mem_fun (*this, &PluginPinDialog::add_processor));
|
||||
|
||||
_route->processors_changed.connect (
|
||||
_route_connections, invalidator (*this), boost::bind (&PluginPinDialog::route_processors_changed, this, _1), gui_context()
|
||||
);
|
||||
|
||||
_route->DropReferences.connect (
|
||||
_route_connections, invalidator (*this), boost::bind (&PluginPinDialog::route_going_away, this), gui_context()
|
||||
);
|
||||
}
|
||||
void
|
||||
PluginPinDialog::set_session (ARDOUR::Session *s)
|
||||
{
|
||||
SessionHandlePtr::set_session (s);
|
||||
ppw.set_session (s);
|
||||
for (PluginPinWidgetList::iterator i = ppw.begin(); i != ppw.end(); ++i) {
|
||||
(*i)->set_session (s);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PluginPinDialog::route_processors_changed (ARDOUR::RouteProcessorChange)
|
||||
{
|
||||
ppw.clear ();
|
||||
remove ();
|
||||
vbox = manage (new VBox ());
|
||||
add (*vbox);
|
||||
vbox->show ();
|
||||
_route->foreach_processor (sigc::mem_fun (*this, &PluginPinDialog::add_processor));
|
||||
}
|
||||
|
||||
void
|
||||
PluginPinDialog::route_going_away ()
|
||||
{
|
||||
ppw.clear ();
|
||||
_route.reset ();
|
||||
remove ();
|
||||
}
|
||||
|
||||
void
|
||||
PluginPinDialog::add_processor (boost::weak_ptr<Processor> p)
|
||||
{
|
||||
boost::shared_ptr<Processor> proc = p.lock ();
|
||||
if (!proc || !proc->display_to_user ()) {
|
||||
return;
|
||||
}
|
||||
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (proc);
|
||||
if (pi) {
|
||||
ppw.push_back (PluginPinWidgetPtr(new PluginPinWidget (pi)));
|
||||
vbox->pack_start (*ppw.back());
|
||||
} else {
|
||||
HBox* hbox = manage (new HBox ());
|
||||
hbox->pack_start (*manage (new HSeparator ()));
|
||||
hbox->pack_start (*manage (new Label (proc->display_name ())));
|
||||
hbox->pack_start (*manage (new HSeparator ()));
|
||||
vbox->pack_start (*hbox);
|
||||
hbox->show_all ();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "ardour/plugin_insert.h"
|
||||
#include "ardour/route.h"
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
#include "gtkmm2ext/pixfader.h"
|
||||
#include "gtkmm2ext/persistent_tooltip.h"
|
||||
#include "gtkmm2ext/slider_controller.h"
|
||||
@ -221,12 +223,21 @@ class PluginPinDialog : public ArdourWindow
|
||||
{
|
||||
public:
|
||||
PluginPinDialog (boost::shared_ptr<ARDOUR::PluginInsert>);
|
||||
~PluginPinDialog ();
|
||||
PluginPinDialog (boost::shared_ptr<ARDOUR::Route>);
|
||||
|
||||
void set_session (ARDOUR::Session *);
|
||||
private:
|
||||
PluginPinWidget ppw;
|
||||
Gtk::VBox *vbox;
|
||||
typedef boost::shared_ptr<PluginPinWidget> PluginPinWidgetPtr;
|
||||
typedef std::vector<PluginPinWidgetPtr> PluginPinWidgetList;
|
||||
|
||||
void route_going_away ();
|
||||
void route_processors_changed (ARDOUR::RouteProcessorChange);
|
||||
void add_processor (boost::weak_ptr<ARDOUR::Processor>);
|
||||
|
||||
boost::shared_ptr<ARDOUR::Route> _route;
|
||||
PluginPinWidgetList ppw;
|
||||
PBD::ScopedConnectionList _route_connections;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "ardour_button.h"
|
||||
#include "keyboard.h"
|
||||
#include "utils.h"
|
||||
#include "plugin_pin_dialog.h"
|
||||
#include "prompter.h"
|
||||
#include "gui_thread.h"
|
||||
#include "ardour_dialog.h"
|
||||
@ -328,6 +329,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
|
||||
blink_rec_display(true); // set initial rec-en button state
|
||||
}
|
||||
|
||||
maybe_add_route_print_mgr ();
|
||||
route_color_changed();
|
||||
}
|
||||
|
||||
@ -2250,3 +2252,91 @@ RouteUI::route_group() const
|
||||
{
|
||||
return _route->route_group();
|
||||
}
|
||||
|
||||
|
||||
RoutePinWindowProxy::RoutePinWindowProxy(std::string const &name, boost::shared_ptr<ARDOUR::Route> route)
|
||||
: WM::ProxyBase (name, string())
|
||||
, _route (boost::weak_ptr<Route> (route))
|
||||
{
|
||||
route->DropReferences.connect (going_away_connection, MISSING_INVALIDATOR, boost::bind (&RoutePinWindowProxy::route_going_away, this), gui_context());
|
||||
}
|
||||
|
||||
RoutePinWindowProxy::~RoutePinWindowProxy()
|
||||
{
|
||||
_window = 0;
|
||||
}
|
||||
|
||||
ARDOUR::SessionHandlePtr*
|
||||
RoutePinWindowProxy::session_handle ()
|
||||
{
|
||||
ArdourWindow* aw = dynamic_cast<ArdourWindow*> (_window);
|
||||
if (aw) { return aw; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
Gtk::Window*
|
||||
RoutePinWindowProxy::get (bool create)
|
||||
{
|
||||
boost::shared_ptr<Route> r = _route.lock ();
|
||||
if (!r) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_window) {
|
||||
if (!create) {
|
||||
return 0;
|
||||
}
|
||||
_window = new PluginPinDialog (r);
|
||||
ArdourWindow* aw = dynamic_cast<ArdourWindow*> (_window);
|
||||
if (aw) {
|
||||
aw->set_session (_session);
|
||||
}
|
||||
_window->show_all ();
|
||||
}
|
||||
return _window;
|
||||
}
|
||||
|
||||
void
|
||||
RoutePinWindowProxy::route_going_away ()
|
||||
{
|
||||
delete _window;
|
||||
_window = 0;
|
||||
WM::Manager::instance().remove (this);
|
||||
going_away_connection.disconnect();
|
||||
}
|
||||
|
||||
void
|
||||
RouteUI::maybe_add_route_print_mgr ()
|
||||
{
|
||||
if (_route->pinmgr_proxy ()) {
|
||||
return;
|
||||
}
|
||||
RoutePinWindowProxy* wp = new RoutePinWindowProxy (
|
||||
string_compose ("RPM-%1", _route->id()), _route);
|
||||
wp->set_session (_session);
|
||||
|
||||
const XMLNode* ui_xml = _session->extra_xml (X_("UI"));
|
||||
if (ui_xml) {
|
||||
wp->set_state (*ui_xml, 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void* existing_ui = _route->pinmgr_proxy ();
|
||||
if (existing_ui) {
|
||||
wp->use_window (*(reinterpret_cast<Gtk::Window*>(existing_ui)));
|
||||
}
|
||||
#endif
|
||||
_route->set_pingmgr_proxy (wp);
|
||||
|
||||
WM::Manager::instance().register_window (wp);
|
||||
}
|
||||
|
||||
void
|
||||
RouteUI::manage_pins ()
|
||||
{
|
||||
RoutePinWindowProxy* proxy = _route->pinmgr_proxy ();
|
||||
if (proxy) {
|
||||
proxy->get (true);
|
||||
proxy->present();
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "axis_view.h"
|
||||
#include "selectable.h"
|
||||
#include "window_manager.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class AudioTrack;
|
||||
@ -55,6 +56,22 @@ class ArdourButton;
|
||||
class ArdourWindow;
|
||||
class IOSelectorWindow;
|
||||
|
||||
class RoutePinWindowProxy : public WM::ProxyBase
|
||||
{
|
||||
public:
|
||||
RoutePinWindowProxy (std::string const &, boost::shared_ptr<ARDOUR::Route>);
|
||||
~RoutePinWindowProxy();
|
||||
|
||||
Gtk::Window* get (bool create = false);
|
||||
ARDOUR::SessionHandlePtr* session_handle();
|
||||
|
||||
private:
|
||||
boost::weak_ptr<ARDOUR::Route> _route;
|
||||
|
||||
void route_going_away ();
|
||||
PBD::ScopedConnection going_away_connection;
|
||||
};
|
||||
|
||||
class RouteUI : public virtual AxisView
|
||||
{
|
||||
public:
|
||||
@ -189,6 +206,9 @@ class RouteUI : public virtual AxisView
|
||||
|
||||
void route_rename();
|
||||
|
||||
void manage_pins ();
|
||||
void maybe_add_route_print_mgr ();
|
||||
|
||||
virtual void property_changed (const PBD::PropertyChange&);
|
||||
void route_removed ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user