[ease] [editor] Better handling of transition times in inspector.



commit 759eae084815a5456497db0bed6a20a6edb5a9f2
Author: Nate Stedman <natesm gmail com>
Date:   Tue Aug 24 04:49:16 2010 -0400

    [editor] Better handling of transition times in inspector.
    
    When the user switches away from the "none" transition, a default
    time will be set (if the time isn't already non-zero). The time
    spin button is now disabled when the "none" transition is
    selected.
    
    When the user sets the slide to automatically advance, a default
    time will also be set, once again if the time for that property
    isn't already non-zero.
    
    Fixed "None" transition playing the "Fade" transition if a
    transition time greater than 0 was set.
    
    Fixes second half of bug 627800

 ease/ease-inspector-transition-pane.vala |   34 ++++++++++++++++++++++++++++-
 ease/ease-player.vala                    |    3 +-
 2 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/ease/ease-inspector-transition-pane.vala b/ease/ease-inspector-transition-pane.vala
index 533f030..3794020 100644
--- a/ease/ease-inspector-transition-pane.vala
+++ b/ease/ease-inspector-transition-pane.vala
@@ -42,6 +42,8 @@ internal class Ease.InspectorTransitionPane : InspectorPane
 	// constants
 	private const int PREVIEW_HEIGHT = 150;
 	private const uint PREVIEW_DELAY = 500;
+	private const int DEFAULT_TRANSITION_TIME = 1;
+	private const int DEFAULT_ADVANCE_DELAY = 5;
 	
 	// silence undo if needed
 	private bool silence_undo;
@@ -141,7 +143,6 @@ internal class Ease.InspectorTransitionPane : InspectorPane
 			// allow the user to undo the change
 			var action = new UndoAction(slide, "transition");
 			action.add(slide, "variant");
-			if (!silence_undo) slide.undo(action);
 			
 			var already_silenced = silence_undo;
 			silence_undo = true;
@@ -152,11 +153,35 @@ internal class Ease.InspectorTransitionPane : InspectorPane
 			{
 				Transition transition;
 				sender.model.get(itr, 1, out transition);
+				
+				// set transition time if required
+				if (transition == Transition.NONE)
+				{
+					transition_time.set_value(slide.transition_time);
+					transition_time.sensitive = false;
+					action.add(slide, "transition-time");
+				}
+				else if (slide.transition == Transition.NONE)
+				{
+					if (slide.transition_time == 0)
+					{
+						slide.transition_time = DEFAULT_TRANSITION_TIME;
+					}
+					transition_time.set_value(slide.transition_time);
+					transition_time.sensitive = true;
+					action.add(slide, "transition-time");
+				}
+				
+				// set the slide's transition
 				slide.transition = transition;
+				
+				// with this all successful, send the UndoAction
+				if (!already_silenced) slide.undo(action);
 			}
 			else
 			{
 				critical("Transition not found in model");
+				action.apply();
 			}
 			
 			// get the variants for the new transition
@@ -215,6 +240,10 @@ internal class Ease.InspectorTransitionPane : InspectorPane
 			{
 				delay.sensitive = true;
 				slide.automatically_advance = true;
+				if (slide.advance_delay == 0)
+				{
+					slide.advance_delay = DEFAULT_ADVANCE_DELAY;
+				}
 			}
 		});
 		
@@ -260,7 +289,7 @@ internal class Ease.InspectorTransitionPane : InspectorPane
 	
 	private void animate_preview_start()
 	{
-		if (slide.transition_msecs == 0)
+		if (slide.transition_msecs == 0 || slide.transition == Transition.NONE)
 		{
 			animate_preview();
 			return;
@@ -379,6 +408,7 @@ internal class Ease.InspectorTransitionPane : InspectorPane
 		
 		// set transition time box
 		transition_time.set_value(slide.transition_time);
+		transition_time.sensitive = slide.transition != Transition.NONE;
 		
 		// set effect and variant combo boxes
 		Gtk.TreeIter itr;
diff --git a/ease/ease-player.vala b/ease/ease-player.vala
index 41aec84..29a09a1 100644
--- a/ease/ease-player.vala
+++ b/ease/ease-player.vala
@@ -283,7 +283,8 @@ internal class Ease.Player : Gtk.Window
 			slide.request_advance.connect(on_request_advance);
 			container.add_actor(current_slide);
 			
-			if (old_slide.slide.transition_time > 0)
+			if (old_slide.slide.transition_time > 0 &&
+			    old_slide.slide.transition != Transition.NONE)
 			{
 				old_slide.transition(current_slide, container);
 				old_slide.animation_time.completed.connect(animation_complete);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]