virtual Fill:: and Outline:: methods so that Canvas::Items that cache image rendering...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 17 Apr 2013 00:38:10 +0000 (20:38 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 17 Apr 2013 00:38:10 +0000 (20:38 -0400)
libs/canvas/canvas/fill.h
libs/canvas/canvas/item.h
libs/canvas/canvas/outline.h
libs/canvas/canvas/wave_view.h
libs/canvas/fill.cc
libs/canvas/item.cc
libs/canvas/outline.cc
libs/canvas/wave_view.cc

index 3a69e6deb8b89438775c7c5d55fde38698ce7e69..fa6b12e9f8d5d3ddfece8e5407c19cbf6685c76b 100644 (file)
@@ -30,14 +30,16 @@ class Fill : virtual public Item
 public:
        Fill (Group *);
 
+       virtual void set_fill_color (Color);
+       virtual void set_fill (bool);
+
        Color fill_color () const {
                return _fill_color;
        }
-       void set_fill_color (Color);
+
        bool fill () const {
                return _fill;
        }
-       void set_fill (bool);
        
 protected:
        void setup_fill_context (Cairo::RefPtr<Cairo::Context>) const;
index 76a93d2c054c0066550e779985627d9bc46f1f5d..b4ea5671c7fe6d499ec0a3d10668bcc304518d35 100644 (file)
@@ -168,8 +168,22 @@ public:
 
 protected:
 
+        /** To be called at the beginning of any property change that
+        *  may alter the bounding box of this item
+        */
        void begin_change ();
+        /** To be called at the endof any property change that
+        *  may alter the bounding box of this item
+        */
        void end_change ();
+        /** To be called at the beginning of any property change that
+        *  does NOT alter the bounding box of this item
+        */
+       void begin_visual_change ();
+        /** To be called at the endof any property change that
+        *  does NOT alter the bounding box of this item
+        */
+       void end_visual_change ();
 
        Canvas* _canvas;
        /** parent group; may be 0 if we are the root group or if we have been unparent()ed */
index d97c3e023f30c0f461a890a74497442b690809bc..c315da874c815e9a640bb6d03331d5efc5d9feb9 100644 (file)
@@ -48,7 +48,7 @@ public:
                return _outline;
        }
 
-       void set_outline (bool);
+       virtual void set_outline (bool);
 
 #ifdef CANVAS_COMPATIBILITY
        int& property_first_arrowhead () {
index 94db1fe61fe2b04c9fb95eabb8b12a6873734b61..44cc6f6f705db23aad21f07780461da6cadd4001 100644 (file)
@@ -60,6 +60,9 @@ public:
        void set_height (Distance);
        void set_channel (int);
        void set_region_start (ARDOUR::frameoffset_t);
+
+        void set_fill_color (Color);
+        void set_outline_color (Color);
        
        void region_resized ();
 
index 00f69ccefd99591de7a64be1e4d1561227364317..da475a988197ff4c7c8cff3cd68882295c0d088c 100644 (file)
@@ -39,21 +39,21 @@ Fill::Fill (Group* parent)
 void
 Fill::set_fill_color (Color color)
 {
-       begin_change ();
+       begin_visual_change ();
        
        _fill_color = color;
 
-       end_change ();
+       end_visual_change ();
 }
 
 void
 Fill::set_fill (bool fill)
 {
-       begin_change ();
+       begin_visual_change ();
        
        _fill = fill;
 
-       end_change ();
+       end_visual_change ();
 }
 
 void
index 7991b3aaafa15a3cdd66ec881ba6472c912c3427..da551fade6e5609b930d6f11bfd666cf5a7c04e0 100644 (file)
@@ -295,7 +295,6 @@ Item::width () const
        return 0;
 }
 
-/* XXX may be called even if bbox is not changing ... bit grotty */
 void
 Item::begin_change ()
 {
@@ -312,6 +311,17 @@ Item::end_change ()
        }
 }
 
+void
+Item::begin_visual_change ()
+{
+}
+
+void
+Item::end_visual_change ()
+{
+       _canvas->item_visual_property_changed (this);
+}
+
 void
 Item::move (Duple movement)
 {
index 5da6e3d0806df6e2ed80871ab1214a742d29911a..15ea4776b6d3aa2b4235f74c9a540ec441e4157c 100644 (file)
@@ -41,11 +41,11 @@ Outline::Outline (Group* parent)
 void
 Outline::set_outline_color (Color color)
 {
-       begin_change ();
+       begin_visual_change ();
        
        _outline_color = color;
 
-       end_change ();
+       end_visual_change ();
 }
 
 void
index e1923cd2f8539d80c3d3674373c5b8adb472777c..f420c73980583cb611903f4ebc8bb5052278ecc0 100644 (file)
@@ -88,6 +88,20 @@ WaveView::handle_visual_property_change ()
        }
 }
 
+void
+WaveView::set_fill_color (Color c)
+{
+       invalidate_image_cache ();
+       Fill::set_fill_color (c);
+}
+
+void
+WaveView::set_outline_color (Color c)
+{
+       invalidate_image_cache ();
+       Outline::set_outline_color (c);
+}
+
 void
 WaveView::set_samples_per_pixel (double samples_per_pixel)
 {
@@ -475,7 +489,7 @@ WaveView::CacheEntry::image ()
                        double stops[3];
                        
                        double r, g, b, a;
-                       
+
                        if (_wave_view->_shape == Rectified) {
                                stops[0] = 0.1;
                                stops[0] = 0.3;