Small fixes to port matrix rendering, mostly visible when using the bundle manager.
authorCarl Hetherington <carl@carlh.net>
Thu, 5 Feb 2009 12:56:12 +0000 (12:56 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 5 Feb 2009 12:56:12 +0000 (12:56 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4491 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/port_group.cc
gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix_body.cc
gtk2_ardour/port_matrix_body.h
gtk2_ardour/port_matrix_component.cc
gtk2_ardour/port_matrix_labels.cc

index 05bd3153b775ebfc7b1563a7b6ff4ecaf8936c01..52d6d6a089bde1fd5985e494b66a3609c7f3fba4 100644 (file)
@@ -110,7 +110,6 @@ PortGroup::total_ports () const
        
 /** PortGroupList constructor.
  */
-
 PortGroupList::PortGroupList ()
        : _type (ARDOUR::DataType::AUDIO), _bundles_dirty (true)
 {
index 196381820339f77f1273b8b3dffc4c1a7b1e48ba..6c04b8feb4bdc8573267ca050df4e65ee66d0c78 100644 (file)
@@ -88,6 +88,7 @@ PortMatrix::reconnect_to_routes ()
        for (std::vector<sigc::connection>::iterator i = _route_connections.begin(); i != _route_connections.end(); ++i) {
                i->disconnect ();
        }
+       _route_connections.clear ();
 
        boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes ();
        for (ARDOUR::RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
@@ -119,7 +120,6 @@ PortMatrix::setup ()
                /* we've set up before, so we need to clean up before re-setting-up */
                /* XXX: we ought to be able to do this by just getting a list of children
                   from each container widget, but I couldn't make that work */
-
                
                for (std::vector<Gtk::CheckButton*>::iterator i = _column_visibility_buttons.begin(); i != _column_visibility_buttons.end(); ++i) {
                        _column_visibility_box.remove (**i);
@@ -431,4 +431,3 @@ PortMatrix::rename_channel_proxy (boost::weak_ptr<ARDOUR::Bundle> b, uint32_t c)
 
        rename_channel (ARDOUR::BundleChannel (sb, c));
 }
-
index 81c332da86e58ee2eaa573fd9144143491b1e809..4d7720207b8bc4dfeaf76a785e8137a34d24ee92 100644 (file)
@@ -56,14 +56,19 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event)
                );
 
        bool intersects;
+       
        Gdk::Rectangle r = exposure;
+       /* the get_pixmap call may cause things to be rerendered and sizes to change,
+          so fetch the pixmaps before calculating where to put it */
+       GdkPixmap* p = _column_labels->get_pixmap (get_window()->gobj());
        r.intersect (_column_labels->parent_rectangle(), intersects);
 
        if (intersects) {
+
                gdk_draw_drawable (
                        get_window()->gobj(),
                        get_style()->get_fg_gc (Gtk::STATE_NORMAL)->gobj(),
-                       _column_labels->get_pixmap (get_window()->gobj()),
+                       p,
                        _column_labels->parent_to_component_x (r.get_x()),
                        _column_labels->parent_to_component_y (r.get_y()),
                        r.get_x(),
@@ -74,13 +79,14 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event)
        }
 
        r = exposure;
+       p = _row_labels->get_pixmap (get_window()->gobj());
        r.intersect (_row_labels->parent_rectangle(), intersects);
 
        if (intersects) {
                gdk_draw_drawable (
                        get_window()->gobj(),
                        get_style()->get_fg_gc (Gtk::STATE_NORMAL)->gobj(),
-                       _row_labels->get_pixmap (get_window()->gobj()),
+                       p,
                        _row_labels->parent_to_component_x (r.get_x()),
                        _row_labels->parent_to_component_y (r.get_y()),
                        r.get_x(),
@@ -91,13 +97,14 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event)
        }
 
        r = exposure;
+       p = _grid->get_pixmap (get_window()->gobj());
        r.intersect (_grid->parent_rectangle(), intersects);
 
        if (intersects) {
                gdk_draw_drawable (
                        get_window()->gobj(),
                        get_style()->get_fg_gc (Gtk::STATE_NORMAL)->gobj(),
-                       _grid->get_pixmap (get_window()->gobj()),
+                       p,
                        _grid->parent_to_component_x (r.get_x()),
                        _grid->parent_to_component_y (r.get_y()),
                        r.get_x(),
@@ -489,3 +496,11 @@ PortMatrixBody::set_cairo_clip (cairo_t* cr, Gdk::Rectangle const & r) const
        cairo_rectangle (cr, r.get_x(), r.get_y(), r.get_width(), r.get_height());
        cairo_clip (cr);
 }
+
+void
+PortMatrixBody::component_size_changed ()
+{
+       compute_rectangles ();
+       _matrix->setup_scrollbars ();
+}
+
index 50a656522af05463cf39db9e69d893aeb14fbe74..c905a98dc48d4d53859b61e1fd30b735409c6b32 100644 (file)
@@ -62,6 +62,7 @@ public:
        }
 
        void highlight_associated_channels (int, uint32_t);
+       void component_size_changed ();
 
 protected:
        bool on_expose_event (GdkEventExpose *);
@@ -78,7 +79,7 @@ private:
        void rebuild_and_draw_row_labels ();
        void update_bundles ();
        void set_cairo_clip (cairo_t *, Gdk::Rectangle const &) const;
-       
+
        PortMatrix* _matrix;
        PortMatrixColumnLabels* _column_labels;
        PortMatrixRowLabels* _row_labels;
index 02d754f5cefa8a323fba87edf1f42bdd3dec5cd5..a68e21730df92fec43bdb3db39e304edf47727b7 100644 (file)
@@ -17,8 +17,9 @@
 
 */
 
-#include <iostream>
 #include "port_matrix_component.h"
+#include "port_matrix.h"
+#include "port_matrix_body.h"
 
 /** Constructor.
  *  @param p Port matrix that we're in.
@@ -56,6 +57,7 @@ PortMatrixComponent::get_pixmap (GdkDrawable *drawable)
                if (_dimension_computation_required) {
                        compute_dimensions ();
                        _dimension_computation_required = false;
+                       _body->component_size_changed ();
                }
 
                /* we may be zero width or height; if so, just
@@ -102,6 +104,7 @@ PortMatrixComponent::dimensions ()
        if (_dimension_computation_required) {
                compute_dimensions ();
                _dimension_computation_required = false;
+               _body->component_size_changed ();
        }
 
        return std::make_pair (_width, _height);
index 3a50edb7c6e10becd16f543e75647f5979c40e32..2734a193efddfca0cffe2cbe1c56803e69bcf22c 100644 (file)
@@ -24,7 +24,7 @@ void
 PortMatrixLabels::draw_extra (cairo_t* cr)
 {
        for (std::vector<ARDOUR::BundleChannel>::const_iterator i = _channel_highlights.begin(); i != _channel_highlights.end(); ++i) {
-               
+
                render_channel_name (
                        cr,
                        highlighted_channel_colour(),