diff options
author | Robin Gareus <robin@gareus.org> | 2016-05-10 20:11:08 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-05-10 20:54:11 +0200 |
commit | cc0abf4ef57a1211ea856e6ddd869d3953bef86d (patch) | |
tree | 218cf3c2db0758e95ce1ef4d4158749ab1005796 /gtk2_ardour/route_ui.cc | |
parent | d53d9b01abd5f2000554846c44c791b82f30dc00 (diff) |
add route-ui pin-manager
Diffstat (limited to 'gtk2_ardour/route_ui.cc')
-rw-r--r-- | gtk2_ardour/route_ui.cc | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 29ccc647be..4064069291 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -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(); + } +} |