visualize # of channels in processor-box splitting icon
authorRobin Gareus <robin@gareus.org>
Mon, 30 Dec 2013 14:55:17 +0000 (15:55 +0100)
committerRobin Gareus <robin@gareus.org>
Mon, 30 Dec 2013 14:55:17 +0000 (15:55 +0100)
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h

index b549fd15ac06365536b61ecbbf9b0560e493bed3..99ba5c5f1ad557d4a708c036023b64f09833a1d2 100644 (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);
index 41bc68281f8fcb0ae184687fbf2deac1a23b1464..cacb5be77c2fc64a9a4a70b123e83af23f88953f 100644 (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;