Some abstractions to make the display look good in the plugin gui

This commit is contained in:
Johannes Mueller 2017-07-21 00:37:07 +02:00 committed by Robin Gareus
parent a61ae46c82
commit 4a60c277db
4 changed files with 23 additions and 3 deletions

View 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);
}

View 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;

View 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)

View 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;
};