Some small-ish port matrix rendering improvements.
authorCarl Hetherington <carl@carlh.net>
Thu, 22 Jan 2009 03:38:40 +0000 (03:38 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 22 Jan 2009 03:38:40 +0000 (03:38 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4430 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix_body.cc
gtk2_ardour/port_matrix_body.h
gtk2_ardour/port_matrix_column_labels.cc
gtk2_ardour/port_matrix_component.h

index 66d9f41be0041ab3c1c46352f6a4692b8123ae87..97e3c5b3ce2c58f0eb6b9d47f4b47cbd2a2ef005 100644 (file)
@@ -217,5 +217,5 @@ PortMatrix::disassociate_all ()
                }
        }
 
-       _body.repaint_grid ();
+       _body.rebuild_and_draw_grid ();
 }
index 3a69c4ccf21fd3b59a53e5f1006940990a7814b7..8ce1d8b6351e3b51a7f774312fa50eb0342b8fe3 100644 (file)
@@ -232,14 +232,14 @@ PortMatrixBody::setup (
        for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _row_bundles.begin(); i != _row_bundles.end(); ++i) {
                
                _bundle_connections.push_back (
-                       (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::repaint_row_labels))
+                       (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_row_labels))
                        );
                
        }
 
        for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _column_bundles.begin(); i != _column_bundles.end(); ++i) {
                _bundle_connections.push_back (
-                       (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::repaint_column_labels))
+                       (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_column_labels))
                        );
        }
        
@@ -318,22 +318,22 @@ PortMatrixBody::on_button_press_event (GdkEventButton* ev)
 }
 
 void
-PortMatrixBody::repaint_grid ()
+PortMatrixBody::rebuild_and_draw_grid ()
 {
-       _grid.require_render ();
+       _grid.require_rebuild ();
        queue_draw ();
 }
 
 void
-PortMatrixBody::repaint_column_labels ()
+PortMatrixBody::rebuild_and_draw_column_labels ()
 {
-       _column_labels.require_render ();
+       _column_labels.require_rebuild ();
        queue_draw ();
 }
 
 void
-PortMatrixBody::repaint_row_labels ()
+PortMatrixBody::rebuild_and_draw_row_labels ()
 {
-       _row_labels.require_render ();
+       _row_labels.require_rebuild ();
        queue_draw ();
 }
index bb2d592fe8329ab1914b78636e9c3809b2c60027..753f4f70969dd6e6a80b7a20e95cb585e4ae4d77 100644 (file)
@@ -63,7 +63,7 @@ public:
        void set_xoffset (uint32_t);
        void set_yoffset (uint32_t);
 
-       void repaint_grid ();
+       void rebuild_and_draw_grid ();
 
 protected:
        bool on_expose_event (GdkEventExpose *);
@@ -73,8 +73,8 @@ protected:
 
 private:
        void compute_rectangles ();
-       void repaint_column_labels ();
-       void repaint_row_labels ();
+       void rebuild_and_draw_column_labels ();
+       void rebuild_and_draw_row_labels ();
        
        PortMatrix* _port_matrix;
        PortMatrixColumnLabels _column_labels;
index 90099eb1e5a398dbaef1fda9b6eace9720cdea71..72954d1627c8cd19eb636f1bec434320488cd92b 100644 (file)
@@ -167,8 +167,7 @@ PortMatrixColumnLabels::render (cairo_t* cr)
                
                for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
 
-                       double const lc = _longest_channel_name + (2 * name_pad());
-                       double const lb = _longest_bundle_name + (2 * name_pad());
+                       double const lc = _longest_channel_name + name_pad();
                        double const w = column_width();
 
                        if (_location == BOTTOM) {
@@ -179,8 +178,8 @@ PortMatrixColumnLabels::render (cairo_t* cr)
                                cairo_move_to (cr, x_, y_);
                                x_ -= w;
                                cairo_line_to (cr, x_, y_);
-                               x_ -= lb * cos (angle());
-                               y_ += lb * sin (angle());
+                               x_ -= lc * cos (angle());
+                               y_ += lc * sin (angle());
                                cairo_line_to (cr, x_, y_);
                                x_ += w * pow (sin (angle()), 2);
                                y_ += w * sin (angle()) * cos (angle());
index a041c807e86b2e27cf443b7a33d0dda6f874a902..cd836f82eec0ac89348e65835b68cfe5bc01e94c 100644 (file)
@@ -36,9 +36,15 @@ public:
        void setup ();
        GdkPixmap* get_pixmap (GdkDrawable *);
        std::pair<uint32_t, uint32_t> dimensions ();
+
        void require_render () {
                _render_required = true;
        }
+       
+       void require_rebuild () {
+               _dimension_computation_required = true;
+               _render_required = true;
+       }
 
        /** @return width of columns in the grid */
        static uint32_t column_width () {