Author: miguel
Date: 2007-06-14 10:00:33 -0400 (Thu, 14 Jun 2007)
New Revision: 79546
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/Makefile.am
trunk/moon/src/animation.cpp
trunk/moon/src/animation.h
trunk/moon/src/brush.h
trunk/moon/src/clock.cpp
trunk/moon/src/clock.h
trunk/moon/src/geometry.h
trunk/moon/src/media.h
trunk/moon/src/runtime.cpp
trunk/moon/src/runtime.h
trunk/moon/src/shape.h
trunk/moon/src/text.h
trunk/moon/src/transform.h
Log:
2007-06-14 Miguel de Icaza <[EMAIL PROTECTED]>
* Improve the destruction scenario to release the resources that
we have acquired, we are now up to the point of stopping clocks
properly, but more work is going to be needed in the long term to
properly track refs and objects.
Ensured that all virtual GetObjectType are flagged with virtual.
* Makefile.am: Put runtime.cpp at the top, to improve
compile/test cycle.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/ChangeLog 2007-06-14 14:00:33 UTC (rev 79546)
@@ -1,3 +1,15 @@
+2007-06-14 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * Improve the destruction scenario to release the resources that
+ we have acquired, we are now up to the point of stopping clocks
+ properly, but more work is going to be needed in the long term to
+ properly track refs and objects.
+
+ Ensured that all virtual GetObjectType are flagged with virtual.
+
+ * Makefile.am: Put runtime.cpp at the top, to improve
+ compile/test cycle.
+
2007-06-14 Sebastien Pouliot <[EMAIL PROTECTED]>
* brush.cpp|h: One step closer for RadialGradientBrush
Modified: trunk/moon/src/Makefile.am
===================================================================
--- trunk/moon/src/Makefile.am 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/Makefile.am 2007-06-14 14:00:33 UTC (rev 79546)
@@ -5,6 +5,7 @@
INCLUDES = $(MOON_CFLAGS)
libmoon_la_SOURCES = \
+ runtime.cpp \
animation.cpp \
animation.h \
brush.cpp \
@@ -20,7 +21,6 @@
media.h \
rsvg.cpp \
rsvg.h \
- runtime.cpp \
runtime.h \
shape.cpp \
shape.h \
Modified: trunk/moon/src/animation.cpp
===================================================================
--- trunk/moon/src/animation.cpp 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/animation.cpp 2007-06-14 14:00:33 UTC (rev 79546)
@@ -51,10 +51,14 @@
delete current_value;
}
+AnimationStorage::~AnimationStorage ()
+{
+}
AnimationClock::AnimationClock (Animation/*Timeline*/ *timeline)
: timeline(timeline),
- Clock (timeline)
+ Clock (timeline),
+ storage(NULL)
{
}
@@ -70,8 +74,12 @@
return timeline->GetCurrentValue (defaultOriginValue,
defaultDestinationValue, this);
}
+AnimationClock::~AnimationClock ()
+{
+ if (storage)
+ delete storage;
+}
-
Value*
Animation/*Timeline*/::GetCurrentValue (Value* defaultOriginValue, Value*
defaultDestinationValue,
AnimationClock* animationClock)
@@ -248,6 +256,13 @@
return v == NULL ? NULL : v->AsString();
}
+Storyboard::~Storyboard ()
+{
+ Stop ();
+ TimeManager::Instance()->RemoveChild (root_clock);
+ printf ("Unrefing %p\n", root_clock);
+ base_unref (root_clock);
+}
DependencyProperty* BeginStoryboard::StoryboardProperty;
@@ -273,6 +288,13 @@
return GetValue (BeginStoryboard::StoryboardProperty)->AsStoryboard();
}
+BeginStoryboard::~BeginStoryboard ()
+{
+ Storyboard *sb = GetStoryboard ();
+ if (sb != NULL)
+ base_unref (sb);
+}
+
BeginStoryboard *
begin_storyboard_new ()
{
Modified: trunk/moon/src/animation.h
===================================================================
--- trunk/moon/src/animation.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/animation.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -97,6 +97,8 @@
public:
AnimationStorage (AnimationClock *clock, Animation/*Timeline*/
*timeline,
DependencyObject *targetobj, DependencyProperty
*targetprop);
+ ~AnimationStorage ();
+
private:
void UpdatePropertyValue ();
static void update_property_value (gpointer data);
@@ -117,7 +119,8 @@
class AnimationClock : public Clock {
public:
AnimationClock (Animation/*Timeline*/ *timeline);
- Value::Kind GetObjectType () { return Value::ANIMATIONCLOCK; };
+ ~AnimationClock ();
+ virtual Value::Kind GetObjectType () { return Value::ANIMATIONCLOCK; };
Value *GetCurrentValue (Value *defaultOriginValue, Value
*defaultDestinationValue);
@@ -136,7 +139,7 @@
public:
Animation/*Timeline*/ () { };
- Value::Kind GetObjectType () { return Value::ANIMATION; };
+ virtual Value::Kind GetObjectType () { return Value::ANIMATION; };
virtual Clock *AllocateClock () { return new AnimationClock (this); }
@@ -176,7 +179,7 @@
public:
DoubleAnimation ();
- Value::Kind GetObjectType () { return Value::DOUBLEANIMATION; };
+ virtual Value::Kind GetObjectType () { return Value::DOUBLEANIMATION; };
static DependencyProperty* ByProperty;
static DependencyProperty* FromProperty;
@@ -200,7 +203,7 @@
public:
ColorAnimation ();
- Value::Kind GetObjectType () { return Value::COLORANIMATION; };
+ virtual Value::Kind GetObjectType () { return Value::COLORANIMATION; };
static DependencyProperty* ByProperty;
static DependencyProperty* FromProperty;
@@ -224,7 +227,7 @@
public:
PointAnimation () {};
- Value::Kind GetObjectType () { return Value::POINTANIMATION; };
+ virtual Value::Kind GetObjectType () { return Value::POINTANIMATION; };
static DependencyProperty* ByProperty;
static DependencyProperty* FromProperty;
@@ -247,7 +250,7 @@
class KeyFrame : public DependencyObject {
public:
KeyFrame ();
- Value::Kind GetObjectType () { return Value::KEYFRAME; };
+ virtual Value::Kind GetObjectType () { return Value::KEYFRAME; };
KeyTime *GetKeyTime();
void SetKeyTime (KeyTime keytime);
@@ -281,7 +284,7 @@
class DoubleKeyFrame : public KeyFrame {
public:
DoubleKeyFrame ();
- Value::Kind GetObjectType() { return Value::DOUBLEKEYFRAME; };
+ virtual Value::Kind GetObjectType() { return Value::DOUBLEKEYFRAME; };
NULLABLE_GETSET_DECL (Value, double);
static DependencyProperty *ValueProperty;
@@ -292,7 +295,7 @@
class ColorKeyFrame : public KeyFrame {
public:
ColorKeyFrame ();
- Value::Kind GetObjectType () { return Value::COLORKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return Value::COLORKEYFRAME; };
NULLABLE_GETSET_DECL(Value, Color);
@@ -303,7 +306,7 @@
class PointKeyFrame : public KeyFrame {
public:
PointKeyFrame ();
- Value::Kind GetObjectType () { return Value::POINTKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return Value::POINTKEYFRAME; };
NULLABLE_GETSET_DECL(Value, Point);
@@ -316,7 +319,7 @@
class DiscreteDoubleKeyFrame : public DoubleKeyFrame {
public:
DiscreteDoubleKeyFrame () { }
- Value::Kind GetObjectType () { return Value::DISCRETEDOUBLEKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return
Value::DISCRETEDOUBLEKEYFRAME; };
virtual Value *InterpolateValue (Value *baseValue, double
keyFrameProgress);
};
@@ -328,7 +331,7 @@
class DiscreteColorKeyFrame : public ColorKeyFrame {
public:
DiscreteColorKeyFrame () { }
- Value::Kind GetObjectType () { return Value::DISCRETECOLORKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return
Value::DISCRETECOLORKEYFRAME; };
virtual Value *InterpolateValue (Value *baseValue, double
keyFrameProgress);
};
@@ -340,7 +343,7 @@
class DiscretePointKeyFrame : public PointKeyFrame {
public:
DiscretePointKeyFrame () { }
- Value::Kind GetObjectType () { return Value::DISCRETEPOINTKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return
Value::DISCRETEPOINTKEYFRAME; };
virtual Value *InterpolateValue (Value *baseValue, double
keyFrameProgress);
};
@@ -353,7 +356,7 @@
class LinearDoubleKeyFrame : public DoubleKeyFrame {
public:
LinearDoubleKeyFrame () { }
- Value::Kind GetObjectType () { return Value::LINEARDOUBLEKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return
Value::LINEARDOUBLEKEYFRAME; };
virtual Value *InterpolateValue (Value *baseValue, double
keyFrameProgress);
};
@@ -363,7 +366,7 @@
class LinearColorKeyFrame : public ColorKeyFrame {
public:
LinearColorKeyFrame () { }
- Value::Kind GetObjectType () { return Value::LINEARCOLORKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return
Value::LINEARCOLORKEYFRAME; };
virtual Value *InterpolateValue (Value *baseValue, double
keyFrameProgress);
};
@@ -376,7 +379,7 @@
class LinearPointKeyFrame : public PointKeyFrame {
public:
LinearPointKeyFrame () { }
- Value::Kind GetObjectType () { return Value::LINEARPOINTKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return
Value::LINEARPOINTKEYFRAME; };
virtual Value *InterpolateValue (Value *baseValue, double
keyFrameProgress);
};
@@ -387,7 +390,7 @@
class SplineDoubleKeyFrame : public DoubleKeyFrame {
public:
SplineDoubleKeyFrame () { }
- Value::Kind GetObjectType () { return Value::SPLINEDOUBLEKEYFRAME; };
+ virtual Value::Kind GetObjectType () { return
Value::SPLINEDOUBLEKEYFRAME; };
virtual Value *InterpolateValue (Value *baseValue, double
keyFrameProgress);
@@ -401,7 +404,7 @@
class DoubleAnimationUsingKeyFrames : public DoubleAnimation {
public:
DoubleAnimationUsingKeyFrames ();
- Value::Kind GetObjectType () { return
Value::DOUBLEANIMATIONUSINGKEYFRAMES; };
+ virtual Value::Kind GetObjectType () { return
Value::DOUBLEANIMATIONUSINGKEYFRAMES; };
void AddKeyFrame (DoubleKeyFrame *frame);
void RemoveKeyFrame (DoubleKeyFrame *frame);
@@ -423,7 +426,7 @@
class ColorAnimationUsingKeyFrames : public ColorAnimation {
public:
ColorAnimationUsingKeyFrames ();
- Value::Kind GetObjectType () { return
Value::COLORANIMATIONUSINGKEYFRAMES; };
+ virtual Value::Kind GetObjectType () { return
Value::COLORANIMATIONUSINGKEYFRAMES; };
void AddKeyFrame (ColorKeyFrame *frame);
void RemoveKeyFrame (ColorKeyFrame *frame);
@@ -446,7 +449,7 @@
class PointAnimationUsingKeyFrames : public PointAnimation {
public:
PointAnimationUsingKeyFrames ();
- Value::Kind GetObjectType () { return
Value::POINTANIMATIONUSINGKEYFRAMES; };
+ virtual Value::Kind GetObjectType () { return
Value::POINTANIMATIONUSINGKEYFRAMES; };
void AddKeyFrame (PointKeyFrame *frame);
void RemoveKeyFrame (PointKeyFrame *frame);
@@ -468,13 +471,14 @@
class Storyboard : public ParallelTimeline {
public:
Storyboard ();
- Value::Kind GetObjectType () { return Value::STORYBOARD; };
+ virtual Value::Kind GetObjectType () { return Value::STORYBOARD; };
void Begin ();
void Pause ();
void Resume ();
void Seek (TimeSpan timespan);
void Stop ();
+ ~Storyboard ();
static DependencyProperty* TargetNameProperty;
static DependencyProperty* TargetPropertyProperty;
@@ -508,7 +512,9 @@
public:
BeginStoryboard () { }
- Value::Kind GetObjectType () { return Value::BEGINSTORYBOARD; };
+ ~BeginStoryboard ();
+
+ virtual Value::Kind GetObjectType () { return Value::BEGINSTORYBOARD; };
void Fire ();
Modified: trunk/moon/src/brush.h
===================================================================
--- trunk/moon/src/brush.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/brush.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -29,7 +29,7 @@
static DependencyProperty* TransformProperty;
Brush () { }
- Value::Kind GetObjectType () { return Value::BRUSH; };
+ virtual Value::Kind GetObjectType () { return Value::BRUSH; };
virtual void SetupBrush (cairo_t *cairo, UIElement *uielement) = 0;
virtual void SetupPattern (cairo_pattern_t *pattern);
@@ -49,7 +49,7 @@
SolidColorBrush () { };
- Value::Kind GetObjectType () { return Value::SOLIDCOLORBRUSH; };
+ virtual Value::Kind GetObjectType () { return Value::SOLIDCOLORBRUSH; };
virtual void SetupBrush (cairo_t *cairo, UIElement *uielement);
};
@@ -69,7 +69,7 @@
GradientStopCollection *children;
GradientBrush ();
- Value::Kind GetObjectType () { return Value::GRADIENTBRUSH; }
+ virtual Value::Kind GetObjectType () { return Value::GRADIENTBRUSH; }
virtual void OnPropertyChanged (DependencyProperty *prop);
virtual void SetupPattern (cairo_pattern_t *pattern);
@@ -85,15 +85,15 @@
void gradient_brush_set_spread (GradientBrush *brush, GradientSpreadMethod
method);
class TileBrush : public Brush {
- Value::Kind GetObjectType () { return Value::TILEBRUSH; }
+ virtual Value::Kind GetObjectType () { return Value::TILEBRUSH; }
};
class ImageBrush : public TileBrush {
- Value::Kind GetObjectType () { return Value::IMAGEBRUSH; }
+ virtual Value::Kind GetObjectType () { return Value::IMAGEBRUSH; }
};
class VideoBrush : public TileBrush {
- Value::Kind GetObjectType () { return Value::VIDEOBRUSH; }
+ virtual Value::Kind GetObjectType () { return Value::VIDEOBRUSH; }
};
class LinearGradientBrush : public GradientBrush {
@@ -102,7 +102,7 @@
static DependencyProperty* StartPointProperty;
LinearGradientBrush () {};
- Value::Kind GetObjectType () { return Value::LINEARGRADIENTBRUSH; }
+ virtual Value::Kind GetObjectType () { return
Value::LINEARGRADIENTBRUSH; }
virtual void SetupBrush (cairo_t *cairo, UIElement *uielement);
};
@@ -121,7 +121,7 @@
static DependencyProperty* RadiusYProperty;
RadialGradientBrush () {};
- Value::Kind GetObjectType () { return Value::RADIALGRADIENTBRUSH; }
+ virtual Value::Kind GetObjectType () { return
Value::RADIALGRADIENTBRUSH; }
virtual void SetupBrush (cairo_t *cairo, UIElement *uielement);
};
@@ -151,7 +151,7 @@
static DependencyProperty* ColorProperty;
static DependencyProperty* OffsetProperty;
- Value::Kind GetObjectType () { return Value::GRADIENTSTOP; }
+ virtual Value::Kind GetObjectType () { return Value::GRADIENTSTOP; }
};
GradientStop* gradient_stop_new ();
Modified: trunk/moon/src/clock.cpp
===================================================================
--- trunk/moon/src/clock.cpp 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/clock.cpp 2007-06-14 14:00:33 UTC (rev 79546)
@@ -309,12 +309,14 @@
ClockGroup::AddChild (Clock *clock)
{
child_clocks = g_list_append (child_clocks, clock);
+ base_ref (clock);
}
void
ClockGroup::RemoveChild (Clock *clock)
{
child_clocks = g_list_remove (child_clocks, clock);
+ base_unref (clock);
}
void
@@ -371,7 +373,18 @@
}
}
+ClockGroup::~ClockGroup ()
+{
+ GList *l;
+ for (l = child_clocks; l; l = l->next){
+ Clock *clock = (Clock *) l->data;
+
+ base_unref (clock);
+ }
+ g_list_free (l);
+}
+
/* timeline */
DependencyProperty* Timeline::AutoReverseProperty;
@@ -515,6 +528,11 @@
{
}
+TimelineGroup::~TimelineGroup ()
+{
+ base_unref (child_timelines);
+}
+
Duration
ParallelTimeline::GetNaturalDurationCore (Clock *clock)
{
Modified: trunk/moon/src/clock.h
===================================================================
--- trunk/moon/src/clock.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/clock.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -195,7 +195,7 @@
};
Clock (Timeline *timeline);
- Value::Kind GetObjectType () { return Value::CLOCK; };
+ virtual Value::Kind GetObjectType () { return Value::CLOCK; };
virtual void SpeedChanged () { };
@@ -248,7 +248,8 @@
class ClockGroup : public Clock {
public:
ClockGroup (TimelineGroup *timeline);
- Value::Kind GetObjectType () { return Value::CLOCKGROUP; };
+ ~ClockGroup ();
+ virtual Value::Kind GetObjectType () { return Value::CLOCKGROUP; };
virtual void Begin (TimeSpan parent_time);
@@ -271,7 +272,7 @@
class Timeline : public DependencyObject {
public:
Timeline ();
- Value::Kind GetObjectType () { return Value::TIMELINE; };
+ virtual Value::Kind GetObjectType () { return Value::TIMELINE; };
static DependencyProperty* AutoReverseProperty;
static DependencyProperty* BeginTimeProperty;
@@ -309,7 +310,9 @@
class TimelineGroup : public Timeline {
public:
TimelineGroup ();
- Value::Kind GetObjectType () { return Value::TIMELINEGROUP; };
+ ~TimelineGroup ();
+
+ virtual Value::Kind GetObjectType () { return Value::TIMELINEGROUP; };
static DependencyProperty* ChildrenProperty;
@@ -333,7 +336,7 @@
class ParallelTimeline : public TimelineGroup {
public:
ParallelTimeline () { }
- Value::Kind GetObjectType () { return Value::PARALLELTIMELINE; };
+ virtual Value::Kind GetObjectType () { return Value::PARALLELTIMELINE;
};
virtual Duration GetNaturalDurationCore (Clock *clock);
};
Modified: trunk/moon/src/geometry.h
===================================================================
--- trunk/moon/src/geometry.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/geometry.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -29,7 +29,7 @@
static DependencyProperty* TransformProperty;
Geometry () { };
- Value::Kind GetObjectType () { return Value::GEOMETRY; };
+ virtual Value::Kind GetObjectType () { return Value::GEOMETRY; };
virtual void Draw (Surface *s);
@@ -60,7 +60,7 @@
GeometryCollection *children;
GeometryGroup ();
- Value::Kind GetObjectType () { return Value::GEOMETRYGROUP; };
+ virtual Value::Kind GetObjectType () { return Value::GEOMETRYGROUP; };
virtual void OnPropertyChanged (DependencyProperty *prop);
virtual void Draw (Surface *s);
@@ -79,7 +79,7 @@
static DependencyProperty* RadiusYProperty;
EllipseGeometry () { };
- Value::Kind GetObjectType () { return Value::ELLIPSEGEOMETRY; };
+ virtual Value::Kind GetObjectType () { return Value::ELLIPSEGEOMETRY; };
virtual void Draw (Surface *s);
};
@@ -100,7 +100,7 @@
static DependencyProperty* StartPointProperty;
LineGeometry () { };
- Value::Kind GetObjectType () { return Value::LINEGEOMETRY; };
+ virtual Value::Kind GetObjectType () { return Value::LINEGEOMETRY; };
virtual void Draw (Surface *s);
};
@@ -130,7 +130,7 @@
PathFigureCollection *children;
PathGeometry ();
- Value::Kind GetObjectType () { return Value::PATHGEOMETRY; };
+ virtual Value::Kind GetObjectType () { return Value::PATHGEOMETRY; };
virtual void OnPropertyChanged (DependencyProperty *prop);
virtual void Draw (Surface *s);
@@ -152,7 +152,7 @@
static DependencyProperty* RectProperty;
RectangleGeometry () { };
- Value::Kind GetObjectType () { return Value::RECTANGLEGEOMETRY; };
+ virtual Value::Kind GetObjectType () { return Value::RECTANGLEGEOMETRY;
};
virtual void Draw (Surface *s);
};
@@ -187,7 +187,7 @@
PathSegmentCollection *children;
PathFigure ();
- Value::Kind GetObjectType () { return Value::PATHFIGURE; };
+ virtual Value::Kind GetObjectType () { return Value::PATHFIGURE; };
virtual void OnPropertyChanged (DependencyProperty *prop);
virtual void Draw (Surface *s);
@@ -208,7 +208,7 @@
class PathSegment : public DependencyObject {
public:
virtual void Draw (Surface *s) {}
- Value::Kind GetObjectType () { return Value::PATHSEGMENT; };
+ virtual Value::Kind GetObjectType () { return Value::PATHSEGMENT; };
};
//
@@ -223,7 +223,7 @@
static DependencyProperty* SweepDirectionProperty;
ArcSegment () { }
- Value::Kind GetObjectType () { return Value::ARCSEGMENT; };
+ virtual Value::Kind GetObjectType () { return Value::ARCSEGMENT; };
virtual void Draw (Surface *s);
};
@@ -249,7 +249,7 @@
static DependencyProperty* Point3Property;
BezierSegment () { }
- Value::Kind GetObjectType () { return Value::BEZIERSEGMENT; };
+ virtual Value::Kind GetObjectType () { return Value::BEZIERSEGMENT; };
virtual void Draw (Surface *s);
};
@@ -269,7 +269,7 @@
static DependencyProperty* PointProperty;
LineSegment () { }
- Value::Kind GetObjectType () { return Value::LINESEGMENT; };
+ virtual Value::Kind GetObjectType () { return Value::LINESEGMENT; };
virtual void Draw (Surface *s);
};
@@ -286,7 +286,7 @@
static DependencyProperty* PointsProperty;
PolyBezierSegment () { }
- Value::Kind GetObjectType () { return Value::POLYBEZIERSEGMENT; };
+ virtual Value::Kind GetObjectType () { return Value::POLYBEZIERSEGMENT;
};
virtual void Draw (Surface *s);
};
@@ -303,7 +303,7 @@
static DependencyProperty* PointsProperty;
PolyLineSegment () { }
- Value::Kind GetObjectType () { return Value::POLYLINESEGMENT; };
+ virtual Value::Kind GetObjectType () { return Value::POLYLINESEGMENT; };
virtual void Draw (Surface *s);
};
@@ -320,7 +320,7 @@
static DependencyProperty* PointsProperty;
PolyQuadraticBezierSegment () { }
- Value::Kind GetObjectType () { return
Value::POLYQUADRATICBEZIERSEGMENT; };
+ virtual Value::Kind GetObjectType () { return
Value::POLYQUADRATICBEZIERSEGMENT; };
virtual void Draw (Surface *s);
};
@@ -338,7 +338,7 @@
static DependencyProperty* Point2Property;
QuadraticBezierSegment () { }
- Value::Kind GetObjectType () { return Value::QUADRATICBEZIERSEGMENT; };
+ virtual Value::Kind GetObjectType () { return
Value::QUADRATICBEZIERSEGMENT; };
virtual void Draw (Surface *s);
};
Modified: trunk/moon/src/media.h
===================================================================
--- trunk/moon/src/media.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/media.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -14,7 +14,7 @@
static DependencyProperty *ValueProperty;
MediaAttribute () { }
- Value::Kind GetObjectType () { return Value::MEDIAATTRIBUTE; };
+ virtual Value::Kind GetObjectType () { return Value::MEDIAATTRIBUTE; };
};
@@ -24,7 +24,7 @@
static DependencyProperty *StretchProperty;
MediaBase () { }
- Value::Kind GetObjectType () { return Value::MEDIABASE; };
+ virtual Value::Kind GetObjectType () { return Value::MEDIABASE; };
};
char *media_base_get_source (MediaBase *media);
@@ -55,7 +55,7 @@
static DependencyProperty *AttributesProperty;
MediaElement () { }
- Value::Kind GetObjectType () { return Value::MEDIAELEMENT; };
+ virtual Value::Kind GetObjectType () { return Value::MEDIAELEMENT; };
void SetSource (DependencyObject *downloader, char *name);
Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/runtime.cpp 2007-06-14 14:00:33 UTC (rev 79546)
@@ -105,6 +105,8 @@
for (sl = list; sl != NULL; sl = sl->next){
base_unref ((Base *) sl->data);
}
+ g_slist_free (list);
+ list = NULL;
}
void
@@ -533,16 +535,8 @@
TriggerCollection *newcol = v ? v->AsTriggerCollection() :
NULL;
if (newcol != triggers){
- if (triggers){
- for (GSList *l = triggers->list; l != NULL; l =
l->next){
- DependencyObject *dob =
(DependencyObject *) l->data;
-
- printf ("Unrefing a %d\n",
dob->GetObjectType ());
- base_unref (dob);
- }
+ if (triggers)
base_unref (triggers);
- g_slist_free (triggers->list);
- }
triggers = newcol;
if (triggers){
@@ -768,6 +762,11 @@
g_assert (c == children);
}
+Panel::~Panel ()
+{
+ base_unref (children);
+}
+
//
// Intercept any changes to the children property and mirror that into our
// own variable
@@ -1286,7 +1285,7 @@
Value *current_value = (Value*)g_hash_table_lookup (current_values,
property->name);
if (current_value != NULL && current_value->k >=
Value::DEPENDENCY_OBJECT) {
- printf ("Setting null: SetValue\n");
+ // Setting a null.
current_value->AsDependencyObject ()->SetParent (NULL);
}
if (value != NULL && value->k >= Value::DEPENDENCY_OBJECT) {
@@ -1406,6 +1405,20 @@
this->parent = NULL;
}
+static void
+dump (gpointer key, gpointer value, gpointer data)
+{
+ printf ("%s\n", key);
+}
+
+Value::Kind
+DependencyObject::GetObjectType ()
+{
+ g_warning ("%p This class is missing an override of GetObjectType ()",
this);
+ g_hash_table_foreach (current_values, dump, NULL);
+ return Value::DEPENDENCY_OBJECT;
+}
+
DependencyObject::~DependencyObject ()
{
g_hash_table_destroy (current_values);
@@ -1622,10 +1635,16 @@
}
static void
+deleter (gpointer data)
+{
+ delete (EventClosure *) data;
+}
+
+static void
free_closure_list (gpointer key, gpointer data, gpointer userdata)
{
g_free (key);
- g_list_foreach ((GList*)data, (GFunc)g_free, NULL);
+ g_list_foreach ((GList*)data, (GFunc)deleter, NULL);
}
EventObject::~EventObject ()
@@ -1741,6 +1760,7 @@
{
FrameworkElement *fwe = (FrameworkElement *) closure;
+ printf ("Adding %p\n", data);
EventTrigger *trigger = (EventTrigger *) data;
Collection::Add (trigger);
@@ -1868,6 +1888,11 @@
target->events->RemoveHandler ("Loaded", (EventHandler)
event_trigger_fire_actions, this);
}
+EventTrigger::~EventTrigger ()
+{
+ base_unref (actions);
+}
+
EventTrigger *
event_trigger_new ()
{
Modified: trunk/moon/src/runtime.h
===================================================================
--- trunk/moon/src/runtime.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/runtime.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -237,11 +237,7 @@
virtual void OnSubPropertyChanged (DependencyProperty *prop,
DependencyProperty *subprop) { }
virtual bool OnChildPropertyChanged (DependencyProperty *prop,
DependencyObject *child) { return FALSE; }
- virtual Value::Kind GetObjectType ()
- {
- g_warning ("This class is missing an override of GetObjectType
()");
- return Value::DEPENDENCY_OBJECT;
- };
+ virtual Value::Kind GetObjectType ();
Type* GetType ()
{
return Type::Find (GetObjectType ());
@@ -287,7 +283,7 @@
NameScope ();
~NameScope ();
- Value::Kind GetObjectType () { return Value::NAMESCOPE; }
+ virtual Value::Kind GetObjectType () { return Value::NAMESCOPE; }
void RegisterName (const char *name, DependencyObject *object);
void UnregisterName (const char *name);
@@ -306,7 +302,7 @@
class Downloader : public DependencyObject {
public:
Downloader () {};
- Value::Kind GetObjectType () { return Value::DOWNLOADER; };
+ virtual Value::Kind GetObjectType () { return Value::DOWNLOADER; };
static DependencyProperty *DownloadProgressProperty;
static DependencyProperty *ResponseTextProperty;
@@ -318,7 +314,7 @@
class Visual : public DependencyObject {
public:
Visual () {};
- Value::Kind GetObjectType () { return Value::VISUAL; };
+ virtual Value::Kind GetObjectType () { return Value::VISUAL; };
};
enum ErrorType {
@@ -521,7 +517,7 @@
public:
TriggerAction () { };
- Value::Kind GetObjectType () { return Value::TRIGGERACTION; };
+ virtual Value::Kind GetObjectType () { return Value::TRIGGERACTION; };
virtual void Fire () = 0;
};
@@ -532,9 +528,10 @@
TriggerActionCollection *actions;
EventTrigger ();
+ ~EventTrigger ();
+
+ virtual Value::Kind GetObjectType () { return Value::EVENTTRIGGER; };
- Value::Kind GetObjectType () { return Value::EVENTTRIGGER; };
-
void SetTarget (DependencyObject *target);
void RemoveTarget (DependencyObject *target);
@@ -557,7 +554,7 @@
UIElement ();
- Value::Kind GetObjectType () { return Value::UIELEMENT; };
+ virtual Value::Kind GetObjectType () { return Value::UIELEMENT; };
UIElement *parent;
@@ -679,7 +676,7 @@
static DependencyProperty* WidthProperty;
FrameworkElement ();
- Value::Kind GetObjectType () { return Value::FRAMEWORKELEMENT; }
+ virtual Value::Kind GetObjectType () { return Value::FRAMEWORKELEMENT; }
virtual bool inside_object (Surface *s, double x, double y);
};
@@ -697,7 +694,8 @@
VisualCollection *children;
Panel ();
- Value::Kind GetObjectType () { return Value::PANEL; }
+ ~Panel ();
+ virtual Value::Kind GetObjectType () { return Value::PANEL; }
static DependencyProperty* ChildrenProperty;
static DependencyProperty* BackgroundProperty;
@@ -717,7 +715,7 @@
Canvas ();
Surface *surface;
- Value::Kind GetObjectType () { return Value::CANVAS; }
+ virtual Value::Kind GetObjectType () { return Value::CANVAS; }
virtual Point getxformorigin () { return Point (0, 0); }
Modified: trunk/moon/src/shape.h
===================================================================
--- trunk/moon/src/shape.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/shape.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -42,7 +42,7 @@
static DependencyProperty* StrokeThicknessProperty;
Shape () { }
- Value::Kind GetObjectType () { return Value::SHAPE; };
+ virtual Value::Kind GetObjectType () { return Value::SHAPE; };
//
// Overrides from UIElement.
@@ -98,7 +98,7 @@
class Ellipse : public Shape {
public:
Ellipse () { };
- Value::Kind GetObjectType () { return Value::ELLIPSE; };
+ virtual Value::Kind GetObjectType () { return Value::ELLIPSE; };
void Draw (Surface *s);
};
@@ -113,7 +113,7 @@
static DependencyProperty* RadiusYProperty;
Rectangle () { };
- Value::Kind GetObjectType () { return Value::RECTANGLE; };
+ virtual Value::Kind GetObjectType () { return Value::RECTANGLE; };
void Draw (Surface *s);
@@ -137,7 +137,7 @@
static DependencyProperty* Y2Property;
Line () { };
- Value::Kind GetObjectType () { return Value::LINE; };
+ virtual Value::Kind GetObjectType () { return Value::LINE; };
void Draw (Surface *s);
@@ -165,7 +165,7 @@
static DependencyProperty* PointsProperty;
Polygon () { };
- Value::Kind GetObjectType () { return Value::POLYGON; };
+ virtual Value::Kind GetObjectType () { return Value::POLYGON; };
void Draw (Surface *s);
virtual void OnPropertyChanged (DependencyProperty *prop);
@@ -185,7 +185,7 @@
static DependencyProperty* PointsProperty;
Polyline () { };
- Value::Kind GetObjectType () { return Value::POLYLINE; };
+ virtual Value::Kind GetObjectType () { return Value::POLYLINE; };
void Draw (Surface *s);
@@ -206,7 +206,7 @@
static DependencyProperty* DataProperty;
Path () {};
- Value::Kind GetObjectType () { return Value::PATH; };
+ virtual Value::Kind GetObjectType () { return Value::PATH; };
void Draw (Surface *s);
Modified: trunk/moon/src/text.h
===================================================================
--- trunk/moon/src/text.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/text.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -68,7 +68,7 @@
static DependencyProperty *TextDecorationsProperty;
Inline () { }
- Value::Kind GetObjectType () { return Value::INLINE; }
+ virtual Value::Kind GetObjectType () { return Value::INLINE; }
};
char *inline_get_font_family (Inline *inline_);
@@ -109,7 +109,7 @@
static DependencyProperty *TextWrappingProperty;
TextBlock () { }
- Value::Kind GetObjectType () { return Value::TEXTBLOCK; };
+ virtual Value::Kind GetObjectType () { return Value::TEXTBLOCK; };
void SetFontSource (DependencyObject *downloader);
@@ -173,7 +173,7 @@
static DependencyProperty *UnicodeStringProperty;
Glyphs () { }
- Value::Kind GetObjectType () { return Value::GLYPHS; };
+ virtual Value::Kind GetObjectType () { return Value::GLYPHS; };
};
Brush *glyphs_get_fill (Glyphs *glyphs);
Modified: trunk/moon/src/transform.h
===================================================================
--- trunk/moon/src/transform.h 2007-06-14 13:56:40 UTC (rev 79545)
+++ trunk/moon/src/transform.h 2007-06-14 14:00:33 UTC (rev 79546)
@@ -10,8 +10,8 @@
class Transform : public DependencyObject {
protected:
Transform () { }
- Value::Kind GetObjectType () { return Value::TRANSFORM; };
public:
+ virtual Value::Kind GetObjectType () { return Value::TRANSFORM; };
virtual void OnPropertyChanged (DependencyProperty *prop);
virtual void GetTransform (cairo_matrix_t *value) = 0;
};
@@ -22,7 +22,7 @@
public:
RotateTransform () { }
- Value::Kind GetObjectType () { return Value::ROTATETRANSFORM; };
+ virtual Value::Kind GetObjectType () { return Value::ROTATETRANSFORM; };
static DependencyProperty* AngleProperty;
static DependencyProperty* CenterXProperty;
@@ -46,7 +46,7 @@
public:
TranslateTransform () { }
- Value::Kind GetObjectType () { return Value::TRANSLATETRANSFORM; };
+ virtual Value::Kind GetObjectType () { return
Value::TRANSLATETRANSFORM; };
static DependencyProperty* XProperty;
static DependencyProperty* YProperty;
@@ -66,7 +66,7 @@
public:
ScaleTransform () { }
- Value::Kind GetObjectType () { return Value::SCALETRANSFORM; };
+ virtual Value::Kind GetObjectType () { return Value::SCALETRANSFORM; };
static DependencyProperty* ScaleXProperty;
static DependencyProperty* ScaleYProperty;
@@ -94,7 +94,7 @@
public:
SkewTransform () { }
- Value::Kind GetObjectType () { return Value::SKEWTRANSFORM; };
+ virtual Value::Kind GetObjectType () { return Value::SKEWTRANSFORM; };
static DependencyProperty* AngleXProperty;
static DependencyProperty* AngleYProperty;
@@ -122,7 +122,7 @@
static DependencyProperty* MatrixProperty;
MatrixTransform () { }
- Value::Kind GetObjectType () { return Value::MATRIXTRANSFORM; };
+ virtual Value::Kind GetObjectType () { return Value::MATRIXTRANSFORM; };
/* these are dependency properties
Matrix matrix;
@@ -149,7 +149,7 @@
TransformCollection *children;
TransformGroup ();
- Value::Kind GetObjectType() { return Value::TRANSFORMGROUP; };
+ virtual Value::Kind GetObjectType() { return Value::TRANSFORMGROUP; };
virtual void OnPropertyChanged (DependencyProperty *prop);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches