Author: alanmc
Date: 2007-08-24 18:43:18 -0400 (Fri, 24 Aug 2007)
New Revision: 84833

Modified:
   trunk/lunareclipse/ChangeLog
   trunk/lunareclipse/Controls/TimeLine/AnimationTimeline.cs
   trunk/lunareclipse/Model/StoryboardManager.cs
Log:
* Model/StoryboardManager.cs: Resetting the shapes to their original
  values before replaying the animation
* Controls/TimeLine/AnimationTimeline.cs: Update for logic behind
  adding a keyframe to a property which hasn't been previously
  animated to have a more logical affect

Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog        2007-08-24 22:39:52 UTC (rev 84832)
+++ trunk/lunareclipse/ChangeLog        2007-08-24 22:43:18 UTC (rev 84833)
@@ -1,5 +1,13 @@
 2007-08-24  Alan McGovern <[EMAIL PROTECTED]> 
 
+       * Model/StoryboardManager.cs: Resetting the shapes to their original 
values
+         before replaying the animation
+       * Controls/TimeLine/AnimationTimeline.cs: Update for logic behind 
adding a
+         keyframe to a property which hasn't been previously animated to have a
+         more logical affect
+
+2007-08-24  Alan McGovern <[EMAIL PROTECTED]> 
+
        * Model/Draw/Selector.cs: Using the toolbox global event so alerts are
          passed out for changing the angle
        * Controller/MoonlightController.cs: Cleaning up before serializing so

Modified: trunk/lunareclipse/Controls/TimeLine/AnimationTimeline.cs
===================================================================
--- trunk/lunareclipse/Controls/TimeLine/AnimationTimeline.cs   2007-08-24 
22:39:52 UTC (rev 84832)
+++ trunk/lunareclipse/Controls/TimeLine/AnimationTimeline.cs   2007-08-24 
22:43:18 UTC (rev 84833)
@@ -203,6 +203,16 @@
                        PlaceDivisions();
                }
                
+               public TimeSpan GetKeyframeBefore(TimeSpan span)
+               {
+                       TimeSpan prev = TimeSpan.Zero;
+                       for(int i=0; i < this.keyframeMarkers.Count; i++)
+                               if(keyframeMarkers[i].Time > prev && 
keyframeMarkers[i].Time < span)
+                                       prev = keyframeMarkers[i].Time;
+                       
+                       return prev;
+               }
+               
                private void MouseUp(object sender, MouseEventArgs e)
                {
                        if(!started)
@@ -234,11 +244,9 @@
                        // If we already have a marker at the same time for the 
same timeline, 
                        // do not add another keyframe marker
                        foreach(KeyframeMarker m in keyframeMarkers)
-                       {
-                               Console.WriteLine("timeline: {0}, Time: {1}", 
m.Timeline.Name, m.Time);
                                if(m.Time.Equals(marker.Time))
                                        return;
-                       }
+                       
                        marker.Time = time;
                        marker.Width = 15;
                        marker.Height = 15;

Modified: trunk/lunareclipse/Model/StoryboardManager.cs
===================================================================
--- trunk/lunareclipse/Model/StoryboardManager.cs       2007-08-24 22:39:52 UTC 
(rev 84832)
+++ trunk/lunareclipse/Model/StoryboardManager.cs       2007-08-24 22:43:18 UTC 
(rev 84833)
@@ -36,7 +36,7 @@
                private Storyboard current;               // The currently 
active storyboard
                private bool recording;                   // True if we are 
currently recording
                private List<Storyboard> storyboards;     // The list of 
storyboards that are declared
-               //private UndoGroup undos;
+               private UndoGroup initialValues;
 
 #endregion Member Variables
                
@@ -73,7 +73,7 @@
                        controller.DrawChanged += new 
EventHandler<DrawChangeEventArgs>(AfterDrawChange);
                        controller.Timeline.CurrentPositionChanged += new 
EventHandler(TimeChanged);
                        controller.Timeline.KeyframeMoved += new 
EventHandler<LunarEclipse.Controls.KeyframeEventArgs>(KeyframeMoved);
-                       //undos = new UndoGroup();
+                       initialValues = new UndoGroup();
                        LoadFromResources(controller.Canvas);
                }
                
@@ -202,10 +202,12 @@
                        // a time other than 0:00, things will move correctly.
                        if(timeline.KeyFrames.Count == 0)
                        {
+                               TimeSpan previous = 
controller.Timeline.GetKeyframeBefore(controller.Timeline.CurrentPosition);
                                LinearDoubleKeyFrame kf = new 
LinearDoubleKeyFrame();
-                               kf.KeyTime = TimeSpan.Zero;
+                               kf.KeyTime = previous;
                                kf.Value = Convert.ToDouble(target == e.Target 
? e.OldValue : target.GetValue(property));
                                timeline.KeyFrames.Add(kf);
+                               initialValues.Add(new 
UndoPropertyChange(target, property, kf.Value, kf.Value, true));
                        }
                        
                        // For each of the keyframes, if any of them have 
exactly the same time
@@ -282,6 +284,7 @@
                
                public void Play()
                {
+                       initialValues.Undo();
                        if(Current != null)
                                Current.Begin();
                }
@@ -293,6 +296,7 @@
                
                public void Seek(TimeSpan time)
                {
+                       initialValues.Undo();
                        if(Current == null)
                                return;
                        

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

Reply via email to