Author: miguel
Date: 2007-06-10 15:52:12 -0400 (Sun, 10 Jun 2007)
New Revision: 79127

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/runtime.cpp
   trunk/moon/src/runtime.h
   trunk/moon/src/shape.cpp
   trunk/moon/src/shape.h
   trunk/moon/src/xaml.cpp
Log:
2007-06-10  Miguel de Icaza  <[EMAIL PROTECTED]>

        * shape.cpp (OnPropertyChanged): Implement this property for most
        shapes: if the property is set, we need to invalidate and
        repaint.

        * runtime.h (FullInvalidate): A method to perform a queue to
        redraw the underlying region, update the bounds and queue an
        update for the new region.




Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-06-10 19:29:01 UTC (rev 79126)
+++ trunk/moon/src/ChangeLog    2007-06-10 19:52:12 UTC (rev 79127)
@@ -13,6 +13,14 @@
 
 2007-06-10  Miguel de Icaza  <[EMAIL PROTECTED]>
 
+       * shape.cpp (OnPropertyChanged): Implement this property for most
+       shapes: if the property is set, we need to invalidate and
+       repaint. 
+
+       * runtime.h (FullInvalidate): A method to perform a queue to
+       redraw the underlying region, update the bounds and queue an
+       update for the new region.
+
        * runtime.h (Base): make destructor virtual so that base_unref can
        call delete (Base *) p.   Exposed by the managed code when the
        first base_unref ran for the first time :-)

Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp  2007-06-10 19:29:01 UTC (rev 79126)
+++ trunk/moon/src/runtime.cpp  2007-06-10 19:52:12 UTC (rev 79127)
@@ -571,19 +571,32 @@
 UIElement::OnSubPropertyChanged (DependencyProperty *prop, DependencyProperty 
*subprop)
 {
        if (prop == UIElement::RenderTransformProperty ||
-           prop == UIElement::OpacityProperty ||
-           prop == UIElement::ClipProperty ||
-           prop == UIElement::OpacityMaskProperty ||
-           prop == UIElement::RenderTransformOriginProperty ||
-           prop == UIElement::VisibilityProperty){
-               item_invalidate (this);
-               update_xform ();
-               getbounds ();
-               item_invalidate (this);
+           prop == UIElement::RenderTransformOriginProperty)
+               FullInvalidate (TRUE);
+       else if (prop == UIElement::OpacityProperty ||
+                prop == UIElement::ClipProperty ||
+                prop == UIElement::OpacityMaskProperty ||
+                prop == UIElement::VisibilityProperty){
+               FullInvalidate (FALSE);
        }
 }
 
+//
+// Queues the invalidate for the current region, performs any 
+// updates to the RenderTransform (optional) and queues a 
+// new redraw with the new bounding box
+//
 void
+UIElement::FullInvalidate (bool rendertransform)
+{
+       item_invalidate (this);
+       if (rendertransform)
+               update_xform ();
+       item_update_bounds (this);
+       item_invalidate (this);
+}
+
+void
 item_set_render_transform (UIElement *item, Transform *transform)
 {
        item->SetValue (UIElement::RenderTransformProperty, Value(transform));

Modified: trunk/moon/src/runtime.h
===================================================================
--- trunk/moon/src/runtime.h    2007-06-10 19:29:01 UTC (rev 79126)
+++ trunk/moon/src/runtime.h    2007-06-10 19:52:12 UTC (rev 79127)
@@ -512,6 +512,12 @@
        //   implemented by containers
 
        virtual void get_xform_for (UIElement *item, cairo_matrix_t *result);
+
+       //
+       // Recomputes the bounding box, requests redraws, 
+       // the parameter determines if we should also update the transformation
+       //
+       void FullInvalidate (bool render_xform);
        
        //
        // gencenter:

Modified: trunk/moon/src/shape.cpp
===================================================================
--- trunk/moon/src/shape.cpp    2007-06-10 19:29:01 UTC (rev 79126)
+++ trunk/moon/src/shape.cpp    2007-06-10 19:52:12 UTC (rev 79127)
@@ -211,6 +211,16 @@
        x_cairo_matrix_transform_bounding_box (&absolute_xform, &x1, &y1, &x2, 
&y2);
 }
 
+void
+Shape::OnPropertyChanged (DependencyProperty *prop)
+{
+       if (prop->type == Value::SHAPE){
+               FullInvalidate (FALSE);
+               return;
+       }
+       FrameworkElement::OnPropertyChanged (prop);
+}
+
 Brush*
 shape_get_fill (Shape *shape)
 {
@@ -419,6 +429,16 @@
                framework_element_get_height (this) * user_xform_origin.y);
 }
 
+void
+Rectangle::OnPropertyChanged (DependencyProperty *prop)
+{
+       if (prop->type == Value::RECTANGLE){
+               FullInvalidate (FALSE);
+               return;
+       }
+       Shape::OnPropertyChanged (prop);
+}
+
 double
 rectangle_get_radius_x (Rectangle *rectangle)
 {
@@ -476,6 +496,16 @@
                      y1 + (line_get_y2 (this) - y1) * user_xform_origin.y);
 }
 
+void
+Line::OnPropertyChanged (DependencyProperty *prop)
+{
+       if (prop->type == Value::LINE){
+               FullInvalidate (FALSE);
+               return;
+       }
+       Shape::OnPropertyChanged (prop);
+}
+
 double
 line_get_x1 (Line *line)
 {
@@ -562,6 +592,16 @@
        cairo_close_path (s->cairo);
 }
 
+void
+Polygon::OnPropertyChanged (DependencyProperty *prop)
+{
+       if (prop->type == Value::POLYGON){
+               FullInvalidate (FALSE);
+               return;
+       }
+       Shape::OnPropertyChanged (prop);
+}
+
 FillRule
 polygon_get_fill_rule (Polygon *polygon)
 {
@@ -629,6 +669,16 @@
        }
 }
 
+void
+Polyline::OnPropertyChanged (DependencyProperty *prop)
+{
+       if (prop->type == Value::POLYLINE){
+               FullInvalidate (FALSE);
+               return;
+       }
+       Shape::OnPropertyChanged (prop);
+}
+
 FillRule
 polyline_get_fill_rule (Polyline *polyline)
 {
@@ -698,6 +748,16 @@
        return (data ? data->CanFill () : false);
 }
 
+void
+Path::OnPropertyChanged (DependencyProperty *prop)
+{
+       if (prop->type == Value::PATH){
+               FullInvalidate (FALSE);
+               return;
+       }
+       Shape::OnPropertyChanged (prop);
+}
+
 Geometry*
 path_get_data (Path *path)
 {

Modified: trunk/moon/src/shape.h
===================================================================
--- trunk/moon/src/shape.h      2007-06-10 19:29:01 UTC (rev 79126)
+++ trunk/moon/src/shape.h      2007-06-10 19:52:12 UTC (rev 79127)
@@ -63,6 +63,8 @@
        // if they are both set.   It will also be called to compute the 
bounding box.
        //
        virtual void Draw (Surface *s) = 0;
+
+       virtual void OnPropertyChanged (DependencyProperty *prop);
 };
 
 Brush          *shape_get_fill                 (Shape *shape);
@@ -114,6 +116,7 @@
        void Draw (Surface *s);
 
        virtual Point getxformorigin ();
+       virtual void OnPropertyChanged (DependencyProperty *prop);
 };
 Rectangle *rectangle_new          ();
 double     rectangle_get_radius_x (Rectangle *rectangle);
@@ -139,6 +142,7 @@
        virtual Point getxformorigin ();
 
        virtual bool CanFill () { return false; }
+       virtual void OnPropertyChanged (DependencyProperty *prop);
 };
 Line *line_new  ();
 double line_get_x1 (Line *line);
@@ -162,6 +166,7 @@
        Value::Kind GetObjectType () { return Value::POLYGON; };
 
        void Draw (Surface *s);
+       virtual void OnPropertyChanged (DependencyProperty *prop);
 };
 Polygon                *polygon_new ();
 FillRule       polygon_get_fill_rule   (Polygon *polygon);
@@ -183,6 +188,7 @@
        void Draw (Surface *s);
 
        virtual bool CanFill () { return false; }
+       virtual void OnPropertyChanged (DependencyProperty *prop);
 };
 Polyline       *polyline_new           ();
 FillRule       polyline_get_fill_rule  (Polyline *polyline);
@@ -202,6 +208,7 @@
        void Draw (Surface *s);
 
        virtual bool CanFill ();
+       virtual void OnPropertyChanged (DependencyProperty *prop);
 };
 Path *path_new ();
 Geometry* path_get_data (Path *path);

Modified: trunk/moon/src/xaml.cpp
===================================================================
--- trunk/moon/src/xaml.cpp     2007-06-10 19:29:01 UTC (rev 79126)
+++ trunk/moon/src/xaml.cpp     2007-06-10 19:52:12 UTC (rev 79127)
@@ -183,7 +183,7 @@
                }
                break;
        case XamlElementInstance::PROPERTY:
-
+               printf ("Property %s\n", el);
                GList *walk = info->current_element->children;
                while (walk) {
                        XamlElementInstance *child = (XamlElementInstance *) 
walk->data;
@@ -426,7 +426,6 @@
        inst->element_name = i->name;
        inst->element_type = XamlElementInstance::ELEMENT;
        inst->item = i->create_item ();
-
        return inst;
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to