13
0

visualize # of channels in processor-box splitting icon

This commit is contained in:
Robin Gareus 2013-12-30 15:55:17 +01:00
parent c284823413
commit 7e857b2264
2 changed files with 19 additions and 5 deletions

View File

@ -618,6 +618,7 @@ void
PluginInsertProcessorEntry::plugin_insert_splitting_changed ()
{
if (_plugin_insert->splitting ()) {
_splitting_icon.set_branches(_plugin_insert->output_streams().n_audio());
_splitting_icon.show ();
} else {
_splitting_icon.hide ();
@ -675,17 +676,27 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
Gdk::Color const fg = get_style()->get_fg (STATE_NORMAL);
cairo_set_source_rgb (cr, fg.get_red_p (), fg.get_green_p (), fg.get_blue_p ());
const float si_l = rint(width * 0.3) + .5;
const float si_c = rint(width * 0.5) + .5;
const float si_r = rint(width * 0.7) + .5;
const float si_m = rint(height * 0.5) + .5;
const float si_l = rintf(width * 0.2) + .5f;
const float si_c = rintf(width * 0.5) + .5f;
const float si_r = rintf(width * 0.8) + .5f;
const float si_m = rintf(height * 0.5) + .5f;
cairo_move_to (cr, si_l, height);
cairo_line_to (cr, si_l, si_m);
cairo_line_to (cr, si_r, si_m);
cairo_line_to (cr, si_r, height);
cairo_stroke (cr);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
for (uint32_t i = 2; i < _branches; ++i) {
//const float si_b = rintf((width * .2f) + (i - 1.f) * width * .6f / (_branches - 1.f)) + .5f;
const float si_b = rintf(width * (.2f + .6f * (i - 1.f) / (_branches - 1.f))) + .5f;
cairo_move_to (cr, si_b, height);
cairo_line_to (cr, si_b, si_m);
cairo_stroke (cr);
}
cairo_move_to (cr, si_c, si_m);
cairo_line_to (cr, si_c, 0);
cairo_stroke (cr);

View File

@ -223,10 +223,13 @@ private:
void setup_visuals ();
void plugin_insert_splitting_changed ();
/* XXX: this seems a little ridiculous just for a simple scaleable icon */
class SplittingIcon : public Gtk::DrawingArea {
public:
SplittingIcon() { _branches = 2; }
void set_branches(uint32_t const branches) { _branches = branches; }
private:
bool on_expose_event (GdkEventExpose *);
uint32_t _branches;
};
boost::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;