Allow ctrl-surfaces to show/hide plugin UIs.
authorRobin Gareus <robin@gareus.org>
Sat, 1 Jul 2017 23:59:24 +0000 (01:59 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 1 Jul 2017 23:59:24 +0000 (01:59 +0200)
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h

index aa5d6380dfe8d3870e76b21eccaf8a75db6f942d..61b80116cacc7e7244a47e35e2e8510bc00328c6 100644 (file)
@@ -4209,14 +4209,18 @@ ProcessorWindowProxy::ProcessorWindowProxy (string const & name, ProcessorBox* b
        : WM::ProxyBase (name, string())
        , _processor_box (box)
        , _processor (processor)
-       , is_custom (false)
-       , want_custom (false)
+       , is_custom (true)
+       , want_custom (true)
 {
        boost::shared_ptr<Processor> p = _processor.lock ();
        if (!p) {
                return;
        }
        p->DropReferences.connect (going_away_connection, MISSING_INVALIDATOR, boost::bind (&ProcessorWindowProxy::processor_going_away, this), gui_context());
+
+       p->ToggleUI.connect (gui_connections, invalidator (*this), boost::bind (&ProcessorWindowProxy::show_the_right_window, this, false), gui_context());
+       p->ShowUI.connect (gui_connections, invalidator (*this), boost::bind (&ProcessorWindowProxy::show_the_right_window, this, true), gui_context());
+       p->HideUI.connect (gui_connections, invalidator (*this), boost::bind (&ProcessorWindowProxy::hide, this), gui_context());
 }
 
 ProcessorWindowProxy::~ProcessorWindowProxy()
@@ -4231,6 +4235,7 @@ ProcessorWindowProxy::~ProcessorWindowProxy()
 void
 ProcessorWindowProxy::processor_going_away ()
 {
+       gui_connections.drop_connections ();
        delete _window;
        _window = 0;
        WM::Manager::instance().remove (this);
@@ -4308,13 +4313,16 @@ ProcessorWindowProxy::get (bool create)
 }
 
 void
-ProcessorWindowProxy::show_the_right_window ()
+ProcessorWindowProxy::show_the_right_window (bool show_not_toggle)
 {
        if (_window && (is_custom != want_custom)) {
                /* drop existing window - wrong type */
                set_state_mask (Gtkmm2ext::WindowProxy::StateMask (state_mask () & ~WindowProxy::Size));
                drop_window ();
        }
+       if (_window && fully_visible () && show_not_toggle) {
+               return;
+       }
        toggle ();
 }
 
index 1074d1091458c533b7033f90d062c8c8f98058d6..331848efc16f9d9c6249f02511b00cdaddb0bb65 100644 (file)
@@ -91,7 +91,7 @@ public:
        }
 
        ARDOUR::SessionHandlePtr* session_handle();
-       void show_the_right_window ();
+       void show_the_right_window (bool show_not_toggle = false);
        void set_custom_ui_mode(bool use_custom) { want_custom = use_custom; }
 
        int set_state (const XMLNode&, int);
@@ -105,6 +105,7 @@ private:
 
        void processor_going_away ();
        PBD::ScopedConnection going_away_connection;
+       PBD::ScopedConnectionList gui_connections;
 };