Some abstractions to make the display look good in the plugin gui
authorJohannes Mueller <github@johannes-mueller.org>
Thu, 20 Jul 2017 22:37:07 +0000 (00:37 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 31 Jul 2017 19:31:22 +0000 (21:31 +0200)
gtk2_ardour/plugin_display.cc
gtk2_ardour/plugin_display.h
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h

index ed95e9aa5ae7b1f0dfdf738a75b3871aab237582..b04eb271b75fa8d83c7ddf435223abca047218d5 100644 (file)
@@ -153,7 +153,7 @@ PluginDisplay::on_expose_event (GdkEventExpose* ev)
 
        cairo_save (cr);
        cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-       Gtkmm2ext::rounded_rectangle (cr, .5, -1.5, width - 1, height + 1, 7);
+       display_frame(cr, width, height);
        cairo_clip (cr);
        cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
@@ -176,12 +176,22 @@ PluginDisplay::on_expose_event (GdkEventExpose* ev)
        std::string name = get_name();
        Gtkmm2ext::Color fill_color = UIConfiguration::instance().color (string_compose ("%1: fill active", name), &failed);
 
-       Gtkmm2ext::rounded_rectangle (cr, .5, -1.5, width - 1, height + 1, 7);
+       display_frame(cr, width, height);
        cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
        cairo_set_line_width(cr, 1.0);
-       Gtkmm2ext::set_source_rgb_a (cr, fill_color, 1.0);
+       if (failed) {
+               cairo_set_source_rgba (cr, .75, .75, .75, 1.0);
+       } else {
+               Gtkmm2ext::set_source_rgb_a (cr, fill_color, 1.0);
+       }
        cairo_stroke (cr);
 
        cairo_destroy(cr);
        return true;
 }
+
+void
+PluginDisplay::display_frame (cairo_t* cr, double w, double h)
+{
+       cairo_rectangle (cr, 0.0, 0.0, w, h);
+}
index 4828ee77394f0fc39fbf831e716fe5a915578afd..4a2587e79f08f7f371e5528f54a890ece0fa7ca8 100644 (file)
@@ -43,6 +43,8 @@ protected:
        void update_height_alloc (uint32_t inline_height);
        virtual uint32_t render_inline (cairo_t *, uint32_t width);
 
+       virtual void display_frame (cairo_t* cr, double w, double h);
+
        boost::shared_ptr<ARDOUR::Plugin> _plug;
        PBD::ScopedConnection _qdraw_connection;
        PBD::ScopedConnection _death_connection;
index 476d6c099520c12a0da648a4ef3c82dc4c163c76..a25ac0de401d4514e5b7b1f8be4d67765ef86644 100644 (file)
@@ -1646,6 +1646,12 @@ ProcessorEntry::PluginInlineDisplay::update_height_alloc (uint32_t inline_height
        _scroll = sc;
 }
 
+void
+ProcessorEntry::PluginInlineDisplay::display_frame (cairo_t* cr, double w, double h)
+{
+       Gtkmm2ext::rounded_rectangle (cr, .5, -1.5, w - 1, h + 1, 7);
+}
+
 ProcessorEntry::LuaPluginDisplay::LuaPluginDisplay (ProcessorEntry& e, boost::shared_ptr<ARDOUR::LuaProc> p, uint32_t max_height)
        : PluginInlineDisplay (e, p, max_height)
        , _luaproc (p)
index 34fac115ca6951cfd856c1f1d9a989fe3b42f3e8..400b9fafc9da2c8febf9ee331d3865f4d09bfb83 100644 (file)
@@ -255,6 +255,8 @@ private:
                bool on_button_press_event (GdkEventButton *ev);
                void update_height_alloc (uint32_t inline_height);
 
+               void display_frame (cairo_t* cr, double w, double h);
+
                ProcessorEntry& _entry;
                bool _scroll;
        };