Author: jackson
Date: 2007-06-09 10:00:19 -0400 (Sat, 09 Jun 2007)
New Revision: 79045
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/runtime.cpp
trunk/moon/src/transform.cpp
trunk/moon/src/transform.h
trunk/moon/src/value.h
Log:
* value.h:
* runtime.cpp:
* transform.cpp|h: Impplement transform groups and transform
collections.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-06-09 13:29:19 UTC (rev 79044)
+++ trunk/moon/src/ChangeLog 2007-06-09 14:00:19 UTC (rev 79045)
@@ -1,6 +1,13 @@
2007-06-09 Jackson Harper <[EMAIL PROTECTED]>
* value.h:
+ * runtime.cpp:
+ * transform.cpp|h: Impplement transform groups and transform
+ collections.
+
+2007-06-09 Jackson Harper <[EMAIL PROTECTED]>
+
+ * value.h:
* runtime.cpp|h: Use the new collection classes for triggers and
actions. These are unsettable, so don't register them as
DependencyProperties.
Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp 2007-06-09 13:29:19 UTC (rev 79044)
+++ trunk/moon/src/runtime.cpp 2007-06-09 14:00:19 UTC (rev 79045)
@@ -402,6 +402,7 @@
AS_DEP_SUBCLASS_IMPL(VISUAL_COLLECTION, VisualCollection)
AS_DEP_SUBCLASS_IMPL(TRIGGER_COLLECTION, TriggerCollection)
AS_DEP_SUBCLASS_IMPL(TRIGGERACTION_COLLECTION, TriggerActionCollection)
+AS_DEP_SUBCLASS_IMPL(TRANSFORM_COLLECTION, TransformCollection)
Modified: trunk/moon/src/transform.cpp
===================================================================
--- trunk/moon/src/transform.cpp 2007-06-09 13:29:19 UTC (rev 79044)
+++ trunk/moon/src/transform.cpp 2007-06-09 14:00:19 UTC (rev 79045)
@@ -244,6 +244,81 @@
}
void
+TransformCollection::Add (void *data)
+{
+ TransformGroup *tfg = (TransformGroup *) closure;
+
+ Value *v = (Value *) data;
+ Transform *transform = v->AsTransform ();
+
+ Collection::Add (transform);
+}
+
+void
+TransformCollection::Remove (void *data)
+{
+ TransformGroup *tfg = (TransformGroup *) closure;
+
+ Value *v = (Value *) data;
+ Transform *transform = v->AsTransform ();
+
+ Collection::Remove (transform);
+}
+
+DependencyProperty* TransformGroup::ChildrenProperty;
+
+TransformGroup::TransformGroup ()
+{
+ children = NULL;
+ TransformCollection *c = new TransformCollection ();
+
+ this->SetValue (TransformGroup::ChildrenProperty, Value (c));
+
+ // Ensure that the callback OnPropertyChanged was called.
+ g_assert (c == children);
+}
+
+void
+TransformGroup::OnPropertyChanged (DependencyProperty *prop)
+{
+ Transform::OnPropertyChanged (prop);
+
+ if (prop == ChildrenProperty){
+ // The new value has already been set, so unref the old
collection
+
+ TransformCollection *newcol = GetValue
(prop)->AsTransformCollection();
+
+ if (newcol != children){
+ if (children){
+ for (GSList *l = children->list; l != NULL; l =
l->next){
+ DependencyObject *dob =
(DependencyObject *) l->data;
+
+ base_unref (dob);
+ }
+ base_unref (children);
+ g_slist_free (children->list);
+ }
+
+ children = newcol;
+ if (children->closure)
+ printf ("Warning we attached a property that
was already attached\n");
+ children->closure = this;
+
+ base_ref (children);
+ }
+ }
+}
+
+void
+TransformGroup::GetTransform (cairo_matrix_t *value)
+{
+ for (GSList *w = children->list; w != NULL; w = w->next) {
+ Transform *t = (Transform *) w->data;
+ t->GetTransform (value);
+ }
+}
+
+void
transform_init ()
{
/* RotateTransform fields */
@@ -262,4 +337,7 @@
ScaleTransform::CenterYProperty = DependencyObject::Register
(Value::SCALETRANSFORM, "CenterY", new Value (0.0));
/* XXX MatrixTransform fields */
+
+ /* TransformGroup fields */
+ TransformGroup::ChildrenProperty = DependencyObject::Register
(Value::TRANSFORMGROUP, "Children", Value::TRANSFORM_COLLECTION);
}
Modified: trunk/moon/src/transform.h
===================================================================
--- trunk/moon/src/transform.h 2007-06-09 13:29:19 UTC (rev 79044)
+++ trunk/moon/src/transform.h 2007-06-09 14:00:19 UTC (rev 79045)
@@ -108,8 +108,27 @@
cairo_matrix_t matrix_transform_get_matrix (MatrixTransform *t);
+class TransformCollection : public Collection {
+ public:
+ TransformCollection () {}
+ virtual Value::Kind GetObjectType () { return
Value::TRANSFORM_COLLECTION; }
+
+ virtual void Add (void *data);
+ virtual void Remove (void *data);
+};
+
class TransformGroup : public Transform {
+public:
+ static DependencyProperty* ChildrenProperty;
+
+ TransformCollection *children;
+
+ TransformGroup ();
Value::Kind GetObjectType() { return Value::TRANSFORMGROUP; };
+
+
+ virtual void OnPropertyChanged (DependencyProperty *prop);
+ virtual void GetTransform (cairo_matrix_t *value);
};
G_END_DECLS
Modified: trunk/moon/src/value.h
===================================================================
--- trunk/moon/src/value.h 2007-06-09 13:29:19 UTC (rev 79044)
+++ trunk/moon/src/value.h 2007-06-09 14:00:19 UTC (rev 79045)
@@ -76,6 +76,7 @@
class VisualCollection;
class TriggerCollection;
class TriggerActionCollection;
+class TransformCollection;
struct Value {
public:
@@ -298,7 +299,7 @@
VisualCollection* AsVisualCollection ();
TriggerCollection* AsTriggerCollection ();
TriggerActionCollection* AsTriggerActionCollection ();
-
+ TransformCollection* AsTransformCollection ();
Kind k;
private:
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches