mistelix r14 - in trunk: . extensions/SlideTransitions extensions/SlideTransitions/BarWipe extensions/SlideTransitions/Fade extensions/SlideTransitions/OpaqueLines src src/core src/datamodel src/dialogs src/widgets



Author: jmas
Date: Thu Apr  9 16:08:29 2009
New Revision: 14
URL: http://svn.gnome.org/viewvc/mistelix?rev=14&view=rev

Log:
2009-04-09 Jordi Mas <jmas softcatala org>

	* dialogs/PreferencesDialog.cs: Transitions process single images
	* dialogs/AddSlideDialog.cs: Transitions process single images
	* mistelix.cs: Transitions process single images
	* widgets/SlideShowImageView.cs	: Transitions process single images
	* core/TransitionManager.cs: Transitions process single images
	* core/EffectManager.cs: Transitions process single images
	* core/SlideShow.cs: Transitions process single images	
	* core/SlideImage.cs: Transitions process single images
	* core/NoneTransition.cs: Transitions process single images
	* Makefile.am: Transitions process single images
	* datamodel/Transition.cs: Transitions process single images	
	* datamodel/SlideShowProjectElement.cs: Transitions process one image 
	* datamodel/ITransition.cs: Transitions process single images
	* mistelix.addin.xml: Transitions process single images



Added:
   trunk/extensions/SlideTransitions/BarWipe/   (props changed)
      - copied from r13, /trunk/extensions/SlideTransitions/OpaqueLines/
   trunk/extensions/SlideTransitions/BarWipe/BarWipe.addin.xml   (contents, props changed)
      - copied, changed from r13, /trunk/extensions/SlideTransitions/OpaqueLines/OpaqueLines.addin.xml
   trunk/extensions/SlideTransitions/BarWipe/BarWipeTop.cs   (contents, props changed)
      - copied, changed from r13, /trunk/extensions/SlideTransitions/OpaqueLines/OpaqueLines.cs
   trunk/src/datamodel/Transition.cs   (contents, props changed)
      - copied, changed from r12, /trunk/src/datamodel/ITransition.cs
Removed:
   trunk/extensions/SlideTransitions/BarWipe/OpaqueLines.addin.xml
   trunk/extensions/SlideTransitions/BarWipe/OpaqueLines.cs
   trunk/extensions/SlideTransitions/OpaqueLines/
   trunk/src/datamodel/ITransition.cs
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/extensions/SlideTransitions/BarWipe/Makefile.am
   trunk/extensions/SlideTransitions/Fade/Fade.cs
   trunk/extensions/SlideTransitions/Makefile.am
   trunk/src/Makefile.am
   trunk/src/core/EffectManager.cs
   trunk/src/core/NoneTransition.cs
   trunk/src/core/SlideImage.cs
   trunk/src/core/SlideShow.cs
   trunk/src/core/TransitionManager.cs
   trunk/src/datamodel/SlideShowProjectElement.cs
   trunk/src/dialogs/AddSlideDialog.cs
   trunk/src/dialogs/PreferencesDialog.cs
   trunk/src/mistelix.addin.xml
   trunk/src/mistelix.cs
   trunk/src/widgets/SlideShowImageView.cs

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Thu Apr  9 16:08:29 2009
@@ -133,7 +133,7 @@
 extensions/Makefile
 extensions/SlideTransitions/Makefile
 extensions/SlideTransitions/Fade/Makefile
-extensions/SlideTransitions/OpaqueLines/Makefile
+extensions/SlideTransitions/BarWipe/Makefile
 extensions/Effects/Makefile
 extensions/Effects/RotateImage/Makefile
 extensions/Effects/Brightness/Makefile

Copied: trunk/extensions/SlideTransitions/BarWipe/BarWipe.addin.xml (from r13, /trunk/extensions/SlideTransitions/OpaqueLines/OpaqueLines.addin.xml)
==============================================================================
--- /trunk/extensions/SlideTransitions/OpaqueLines/OpaqueLines.addin.xml	(original)
+++ trunk/extensions/SlideTransitions/BarWipe/BarWipe.addin.xml	Thu Apr  9 16:08:29 2009
@@ -12,6 +12,7 @@
 	</Dependencies>
 
 	<Extension path="/Mistelix/SlideTransitions">
-		<SlideTransitions type="Mistelix.Transitions.OpaqueLines" />
+		<SlideTransitions type="Mistelix.Transitions.BarWipeTop" />
+		<SlideTransitions type="Mistelix.Transitions.BarWipeLeft" />
 	</Extension>
 </Addin>

Copied: trunk/extensions/SlideTransitions/BarWipe/BarWipeTop.cs (from r13, /trunk/extensions/SlideTransitions/OpaqueLines/OpaqueLines.cs)
==============================================================================
--- /trunk/extensions/SlideTransitions/OpaqueLines/OpaqueLines.cs	(original)
+++ trunk/extensions/SlideTransitions/BarWipe/BarWipeTop.cs	Thu Apr  9 16:08:29 2009
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2008 Jordi Mas i Hernandez, jmas softcatala org
+// Copyright (C) 2009 Jordi Mas i Hernandez, jmas softcatala org
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -27,70 +27,60 @@
 namespace Mistelix.Transitions
 {
 	//
-	// Goes black from the bottom to the top
+	// Reveals the image from top to bottom
 	//
-	public class OpaqueLines: ITransition
+	public class BarWipeTop: Transition
 	{
-		// TODO: Wipe?
-		public string DisplayName {
-			get { return ("Opaque Lines"); }
+		public override string DisplayName {
+			get { return ("Bar Wipe (top to bottom)"); }
 		}
 
-		public string Name {
-			get { return ("opaquelines"); }
+		public override string Name {
+			get { return ("barwipetop"); }
 		}
 
-		public SlideImage[] Effect (SlideImage o, SlideImage trg, int frames_per_sec, int sec)
+		public override object Current { 
+			get {
+				return CreateImage ();
+			}
+		}
+
+		public SlideImage CreateImage ()
 		{
-			int frames = frames_per_sec * sec;
-			SlideImage [] images = new SlideImage [frames];
+			SlideImage image;
 			int pos;
-			SlideImage org = o;
-
-			// Go to black in N frames
-			for (int f = 0; f < frames - 1; f++)
+	
+			image = new SlideImage ();
+			image.CopyProperties (Source);
+			image.Pixels = new byte [Source.Stride * Source.Height];
+
+			// N frames from target image
+			int h;
+			for (h = 0; h < Target.Height * ((double) CurrentFrame / (double) Frames); h++)
 			{
-				images[f] = new SlideImage ();
-				images[f].CopyProperties (org);
-				images[f].Pixels = new byte [org.Stride * org.Height];
-
-				// Black
-				int h;
-				for (h = 0; h < org.Height * (double) ((double)f / (double)frames); h++)
+				pos = h * Target.Stride;
+				for (int w = 0; w < Target.Width; w++)
 				{
-					pos = h *  org.Stride;
-					for (int w = 0; w < org.Width; w++)
-					{
-						for (int c = 0; c < org.Channels; c++)
-							images[f].Pixels[pos + c] = 0;
- 
-						pos += org.Channels;
-					}
+					for (int c = 0; c < Target.Channels; c++)
+						image.Pixels[pos + c] = Target.Pixels[pos + c];
+
+					pos += Source.Channels;
 				}
-				
-				// Rest of the image not get blacked
-				for (; h < org.Height; h++)
+			}
+			
+			// Rest from the source image
+			for (; h < Source.Height; h++)
+			{
+				pos = h *  Source.Stride;
+				for (int w = 0; w < Source.Width; w++)
 				{
-					pos = h *  org.Stride;
-					for (int w = 0; w < org.Width; w++)
-					{
-						for (int c = 0; c < org.Channels; c++)
-							images[f].Pixels[pos + c] = (byte) (org.Pixels[pos + c]); 
-						pos += org.Channels;
-					}
+					for (int c = 0; c < Source.Channels; c++)
+						image.Pixels[pos + c] = Source.Pixels[pos + c];
+					pos += Source.Channels;
 				}
-				org = images[f];
 			}
 
-			images[frames - 1] = new SlideImage ();
-			images[frames - 1].CopyProperties (org);
-			images[frames - 1].Pixels = new byte [org.Stride * org.Height];
-
-			for (int i = 0; i < org.Stride * org.Height; i++)
-				images[frames - 1].Pixels[i] = trg.Pixels[i];
-
-			return images;
+			return image;
 		}
 	}
 }
-

Modified: trunk/extensions/SlideTransitions/BarWipe/Makefile.am
==============================================================================
--- /trunk/extensions/SlideTransitions/OpaqueLines/Makefile.am	(original)
+++ trunk/extensions/SlideTransitions/BarWipe/Makefile.am	Thu Apr  9 16:08:29 2009
@@ -1,11 +1,12 @@
-PLUGIN_NAME = OpaqueLines
+PLUGIN_NAME = BarWipe
 
 PLUGIN_MANIFEST = $(PLUGIN_NAME).addin.xml
 
 PLUGIN_ASSEMBLY = $(PLUGIN_NAME).dll
 
 PLUGIN_SOURCES =			\
-	$(srcdir)/OpaqueLines.cs
+	$(srcdir)/BarWipeTop.cs	\
+	$(srcdir)/BarWipeLeft.cs
 
 REFS =					\
 	-r:$(top_builddir)/src/mistelix.exe

Modified: trunk/extensions/SlideTransitions/Fade/Fade.cs
==============================================================================
--- trunk/extensions/SlideTransitions/Fade/Fade.cs	(original)
+++ trunk/extensions/SlideTransitions/Fade/Fade.cs	Thu Apr  9 16:08:29 2009
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2008 Jordi Mas i Hernandez, jmas softcatala org
+// Copyright (C) 2008-2009 Jordi Mas i Hernandez, jmas softcatala org
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -27,52 +27,46 @@
 
 namespace Mistelix.Transitions
 {
-	public class Fade: ITransition
+	public class Fade: Transition
 	{
-		public string DisplayName {
+		public override string DisplayName {
 			get { return ( Catalog.GetString ("Fade")); }
 		}
 
-		public string Name {
+		public override string Name {
 			get { return ("fade"); }
 		}
 
-		public SlideImage[] Effect (SlideImage o, SlideImage trg, int frames_per_sec, int sec)
+		public override object Current { 
+			get {
+				return CreateImage ();
+			}
+		}
+
+		public SlideImage CreateImage ()
 		{
-			int frames = frames_per_sec * sec;
-			SlideImage [] images = new SlideImage [frames];
+			double percentage;
+			SlideImage image;
 			int pos;
-			double percentage = 1d - (1d / frames);
-			SlideImage org = o;
 
-			// Go to black in N frames
-			for (int f = 0; f < frames - 1; f++)
-			{
-				images[f] = new SlideImage ();
-				images[f].CopyProperties (org);
-				images[f].Pixels = new byte [org.Stride * org.Height];
+			percentage = 1d - ((1d / Frames) * CurrentFrame);
+			image = new SlideImage ();
+			image.CopyProperties (Source);
+			image.Pixels = new byte [Source.Stride * Source.Height];
 
-				for (int h = 0; h < org.Height; h++)
+			for (int h = 0; h < Source.Height; h++)
+			{
+				pos = h * Source.Stride;
+				for (int w = 0; w < Source.Width; w++)
 				{
-					pos = h *  org.Stride;
-					for (int w = 0; w < org.Width; w++)
-					{
-						for (int c = 0; c < org.Channels; c++)
-							images[f].Pixels[pos + c] = (byte) (org.Pixels[pos + c] * percentage); 
-						pos += org.Channels;
-					}
+					for (int c = 0; c < Source.Channels; c++)
+						image.Pixels [pos + c] = (byte) (Source.Pixels[pos + c] * percentage);
+
+					pos += Source.Channels;
 				}
-				org = images[f];
 			}
-
-			images[frames - 1] = new SlideImage ();
-			images[frames - 1].CopyProperties (org);
-			images[frames - 1].Pixels = new byte [org.Stride * org.Height];
-
-			for (int i = 0; i < org.Stride * org.Height; i++)
-				images[frames - 1].Pixels[i] = trg.Pixels[i];
-
-			return images;
+	
+			return image;
 		}
 	}
 }

Modified: trunk/extensions/SlideTransitions/Makefile.am
==============================================================================
--- trunk/extensions/SlideTransitions/Makefile.am	(original)
+++ trunk/extensions/SlideTransitions/Makefile.am	Thu Apr  9 16:08:29 2009
@@ -1,3 +1,3 @@
 SUBDIRS = 			\
 	Fade	\
-	OpaqueLines
+	BarWipe

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Thu Apr  9 16:08:29 2009
@@ -35,7 +35,7 @@
 	$(srcdir)/dialogs/ThemeSelectionDialog.cs	\
 	$(srcdir)/backends/Spumux.cs		\
 	$(srcdir)/backends/DvdAuthor.cs		\
-	$(srcdir)/datamodel/ITransition.cs	\
+	$(srcdir)/datamodel/Transition.cs	\
 	$(srcdir)/core/MistelixLib.cs \
 	$(srcdir)/core/NoneTransition.cs	\
 	$(srcdir)/core/TransitionManager.cs	\

Modified: trunk/src/core/EffectManager.cs
==============================================================================
--- trunk/src/core/EffectManager.cs	(original)
+++ trunk/src/core/EffectManager.cs	Thu Apr  9 16:08:29 2009
@@ -49,7 +49,7 @@
 			}
 		}
 
-		static public Effect CreateEffectFromName (string name)
+		static public Effect CreateFromName (string name)
 		{
 			if (mapping == null) {
 				mapping = new Dictionary <string, TypeExtensionNode> ();

Modified: trunk/src/core/NoneTransition.cs
==============================================================================
--- trunk/src/core/NoneTransition.cs	(original)
+++ trunk/src/core/NoneTransition.cs	Thu Apr  9 16:08:29 2009
@@ -22,44 +22,47 @@
 //
 
 using System;
-using Mistelix.DataModel;
 using Mono.Unix;
+using Mono.Addins;
+
+using Mistelix.DataModel;
 
 // Default built-in transition
 namespace Mistelix.Transitions
 {
 	// This transition does nothing
-	public class None: ITransition
+	public class None: Transition
 	{
-		public string DisplayName {
+		SlideImage cloned;
+
+		public None ()
+		{
+			
+		}
+
+		public override string DisplayName {
 			get { return (Catalog.GetString ("<None>")); }
 		}
 
-		public string Name {
+		public override string Name {
 			get { return ("none"); }
 		}
 
-		public SlideImage[] Effect (SlideImage o, SlideImage trg, int frames_per_sec, int sec)
-		{
-			int frames = frames_per_sec * sec;
-			SlideImage [] images = new SlideImage [frames];
-			SlideImage org = o;
-
-			for (int f = 0; f < frames - 1; f++)
-			{
-				images[f] = new SlideImage ();
-				images[f].CopyProperties (org);
-				images[f].Pixels = new byte [org.Stride * org.Height];	
-				Array.Copy (org.Pixels, images[f].Pixels, org.Stride * org.Height);
+		public override object Current { 
+			get {
+				if (cloned == null)
+					CreateClone (Source);
+	
+				return cloned;
 			}
+		}
 
-			images[frames - 1] = new SlideImage ();
-			images[frames - 1].CopyProperties (org);
-			images[frames - 1].Pixels = new byte [org.Stride * org.Height];
-			Array.Copy (trg.Pixels, images[frames - 1].Pixels, trg.Stride * trg.Height);
-
-			return images;
+		void CreateClone (SlideImage src)
+		{
+			cloned = new SlideImage ();
+			cloned.CopyProperties (Source);
+			cloned.Pixels = new byte [src.Stride * src.Height];
+			Array.Copy (src.Pixels, cloned.Pixels, src.Stride * src.Height);
 		}
 	}
 }
-

Modified: trunk/src/core/SlideImage.cs
==============================================================================
--- trunk/src/core/SlideImage.cs	(original)
+++ trunk/src/core/SlideImage.cs	Thu Apr  9 16:08:29 2009
@@ -131,11 +131,8 @@
 		[System.Xml.Serialization.XmlIgnoreAttribute]
 		public byte[] Pixels {
 			get {
-				if (pixels == null) {
-					LoadAndScaleImage ();
-					ProcessEffects ();
-					ProcessImage ();
-				}
+				if (pixels == null)
+					LoadSlide ();
 
 				return pixels;
 			}
@@ -144,6 +141,16 @@
 			}
 		}
 
+		public void LoadSlide ()
+		{
+			if (pixels != null)
+				return;
+
+			LoadAndScaleImage ();
+			ProcessEffects ();
+			ProcessImage ();
+		}
+
 		[System.Xml.Serialization.XmlIgnoreAttribute]
 		public Project Project {
 			set { project = value; }

Modified: trunk/src/core/SlideShow.cs
==============================================================================
--- trunk/src/core/SlideShow.cs	(original)
+++ trunk/src/core/SlideShow.cs	Thu Apr  9 16:08:29 2009
@@ -75,9 +75,12 @@
 			}
 
 			// TODO: Select the transition for the slide
-			ITransition transition;
+			Transition transition;
 			Logger.Debug ("SlideShow.GenerateMPEG ->Images.Count {0}", images.Count);
-			
+
+			// We need to make sure that source and target slides are loaded. Here we make sure that source is loaded
+			((SlideImage) images[0]).LoadSlide ();
+
 			for (int i = 0;  i < images.Count - 1; i++) {
 
 				if (progress != null) {
@@ -86,16 +89,22 @@
 				}
 
 				Logger.Debug ("SlideShow.GenerateMPEG ->Send Fixed image {0}, time {1} (frames)", i, (uint) (frames_sec * images[i].ShowTime));
-				transition = TransitionManager.FromName (images[i].Transition);
+				transition = TransitionManager.CreateFromName (images[i].Transition);
 				lib.SlideShowAddImageFixed (((SlideImage)images[i]), (uint) (frames_sec * images[i].ShowTime));
 		
 				// Transition between two images
 				Logger.Debug ("SlideShow.GenerateMPEG ->Generate transition for frames_sec {0} and time {1}", frames_sec, images[i].TransitionTime);
-				images_transition = transition.Effect (((SlideImage)images[i]), ((SlideImage)images[i + 1]), frames_sec, images[i].TransitionTime);
-				for (int j = 0; j < images_transition.Length; j++) {
-					Logger.Debug ("   Sending subimage {0}", j);
-					lib.SlideShowAddImage (images_transition [j]);
-				}
+
+				// We need to make sure that source and target slides are loaded. Here we make sure that target is loaded
+				((SlideImage) images[i + 1]).LoadSlide (); // Here we do target
+
+				transition.Source = (SlideImage) images[i];
+				transition.Target = (SlideImage) images[i + 1];
+				transition.Frames = frames_sec * images[i].TransitionTime;
+				foreach (SlideImage img in transition)
+					lib.SlideShowAddImage (img);
+
+				Logger.Debug ("Sending subimage completed");
 				((SlideImage) images[i]).ReleasePixels ();
 			}
 

Modified: trunk/src/core/TransitionManager.cs
==============================================================================
--- trunk/src/core/TransitionManager.cs	(original)
+++ trunk/src/core/TransitionManager.cs	Thu Apr  9 16:08:29 2009
@@ -27,50 +27,75 @@
 
 namespace Mistelix.Core
 {
-	// Manages all the available transitions
+	// Manages all available transitions
 	public static class TransitionManager
 	{
+		public struct TransitionName
+		{
+			string name;
+			string display_name;
+			TypeExtensionNode node;
+
+			public TransitionName (string name, string display_name, TypeExtensionNode node)
+			{
+				this.name = name;
+				this.display_name = display_name;
+				this.node = node;	
+			}
+
+			public string Name {
+				get { return name; }
+			}
+
+			public string DisplayName {
+				get { return display_name; }
+			}
+
+			public TypeExtensionNode Node {
+				get { return node; }
+			}
+		}
+
 		static None none;
+		static TransitionName[] names;
+		
 		static TransitionManager ()
 		{
-		}
 
-		static public ITransition None {
-			get {
-				if (none == null)
-					none = new None ();
+		}
 
-				return none;
-			}
+		static public TransitionName None {
+			get { return NameList [0]; }
 		}
 
-		// Get default none transition + the ones provides by pluggins
-		static public ITransition[] List {
+		static public TransitionName[] NameList {
 			get {
-				ITransition[] transitions;
-				int pos = 0;
-				ExtensionNodeList addins = AddinManager.GetExtensionNodes ("/Mistelix/SlideTransitions");
-				transitions = new ITransition [addins.Count + 1];
-	
-				transitions[pos++] = new None ();
-
-				foreach (TypeExtensionNode node in addins) {
-					transitions[pos++] =  (ITransition) node.CreateInstance ();
+				if (names == null) {
+					int pos = 0;
+					Transition transition;
+					ExtensionNodeList addins = AddinManager.GetExtensionNodes ("/Mistelix/SlideTransitions");
+
+					names = new TransitionName [addins.Count];
+					foreach (TypeExtensionNode node in addins) {
+						transition = (Transition) node.CreateInstance ();
+						names[pos++] = new TransitionName (transition.Name, transition.DisplayName, node);
+					}
 				}
 
-				return transitions;
+				return names;
 			}
 		}
 
-		static public ITransition FromName (string val) 
+		static public Transition CreateFromName (string name) 
 		{
-			foreach (ITransition transition in List)
+			foreach (TransitionName transition in NameList)
 			{
-				if (transition.Name.Equals (val))
-					return transition;
+				if (transition.Name.Equals (name))
+					return (Transition) transition.Node.CreateInstance ();
 			}
-			Logger.Debug (String.Format ("TransitionManager.FromName -> transition {0} not found", val));
-			return None;
+			
+			Logger.Debug (String.Format ("TransitionManager.FromName -> transition {0} not found", name));
+			return (Transition) NameList[0].Node.CreateInstance ();
 		}
 	}
 }

Modified: trunk/src/datamodel/SlideShowProjectElement.cs
==============================================================================
--- trunk/src/datamodel/SlideShowProjectElement.cs	(original)
+++ trunk/src/datamodel/SlideShowProjectElement.cs	Thu Apr  9 16:08:29 2009
@@ -122,7 +122,7 @@
 
 					foreach (Effect.Storage stored in value)
 					{
-						effect = EffectManager.CreateEffectFromName (stored.Name);
+						effect = EffectManager.CreateFromName (stored.Name);
 	
 						if (effect == null) {
 							Logger.Error ("SlideShowProjectElement.Storage-> No class found to handle effect {0}", stored.Name);

Copied: trunk/src/datamodel/Transition.cs (from r12, /trunk/src/datamodel/ITransition.cs)
==============================================================================
--- /trunk/src/datamodel/ITransition.cs	(original)
+++ trunk/src/datamodel/Transition.cs	Thu Apr  9 16:08:29 2009
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2008 Jordi Mas i Hernandez, jmas softcatala org
+// Copyright (C) 2008-2009 Jordi Mas i Hernandez, jmas softcatala org
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -22,24 +22,75 @@
 //
 
 using System;
+using System.Collections;
+
 using Mistelix.DataModel;
 
 namespace Mistelix.Transitions
 {
 	//
-	// Interface that defines transitions between slideshows
+	// Defines transitions between slideshows
 	//
-	public interface ITransition
+	public abstract class Transition : IEnumerator, IEnumerable
 	{
-		SlideImage[] Effect (SlideImage o, SlideImage trg, int frames_per_sec, int sec);
+		SlideImage source, target;
+		int frames, current_frame;
+
+		public Transition ()
+		{
 
-		string DisplayName {
+		}
+		
+		public abstract string DisplayName {
 			get;
 		}
 
-		string Name {
+		public abstract string Name {
 			get;
 		}
+
+		public int Frames {
+			get {return frames;}
+			set {frames = value;}
+		}
+
+		public int CurrentFrame {
+			get { return current_frame;}
+			set { current_frame = value;}
+		}
+
+		public SlideImage Source {
+			get {return source;}
+			set {source = value;}
+		}
+
+		public SlideImage Target {
+			get {return target;}
+			set {target = value;}
+		}
+
+		public virtual object Current {
+			get { return null;}
+		}
+
+		public virtual bool MoveNext ()
+		{
+			if (current_frame >= Frames)
+				return false;
+			
+			current_frame++;
+			return true;
+		}
+
+		public virtual void Reset ()
+		{
+			current_frame = -1;
+		}
+
+		public IEnumerator GetEnumerator ()
+		{
+			return this;
+		}
 	}
 }
 

Modified: trunk/src/dialogs/AddSlideDialog.cs
==============================================================================
--- trunk/src/dialogs/AddSlideDialog.cs	(original)
+++ trunk/src/dialogs/AddSlideDialog.cs	Thu Apr  9 16:08:29 2009
@@ -172,11 +172,8 @@
 
 		void LoadTransitionsIntoCombo ()
 		{
-			ITransition[] transitions = TransitionManager.List;
-
-			foreach (ITransition transition in transitions) {
-				transition_store.AppendValues (transition.DisplayName, transition.Name);
-			}
+			foreach (TransitionManager.TransitionName name in  TransitionManager.NameList)
+				transition_store.AppendValues (name.DisplayName, name.Name);	
 		}
 
 		void TimeValueChanged (object source, System.EventArgs args)
@@ -356,9 +353,10 @@
 		Cairo.ImageSurface img_b;
 		SlideImage slide_a;
 		SlideImage slide_b;
-		SlideImage[] images_transition;
+		Transition images_transition;
 		SlideImage img;
 		int idx;
+		bool next;
 		System.Timers.Timer timer;
 
 		public TransitionPreview ()
@@ -393,31 +391,25 @@
 
 		public void UpdateTransitionType (string type)
 		{
-			ITransition transition;
-
-			if (images_transition != null) {
-				for (int i = 0; i < images_transition.Length; i++)
-					images_transition[i].ReleasePixels ();
-			}
-
-			if (type == string.Empty) 
-				transition = TransitionManager.None;
-			else
-				transition = TransitionManager.FromName (type);
-
-			if (transition.GetType () == typeof (None)) {
+			if (type == string.Empty || type.Equals (TransitionManager.None.Name)) {
 				timer.Enabled = false;
 				images_transition = null;
+				return;
 			}
-			else {
-				timer.Enabled = true;
-				images_transition = transition.Effect (slide_a, slide_b, 25, 3);
-			}
+			
+			images_transition = TransitionManager.CreateFromName (type);
+
+			timer.Enabled = true;
+			images_transition.Source = slide_a;
+			images_transition.Target = slide_b;
+			images_transition.Frames = 25 * 3;
+			images_transition.Reset ();
 			QueueDraw ();
 		}
 
 		void TimerUpdater (object source, ElapsedEventArgs e)
 		{
+			next = images_transition.MoveNext ();
 			Application.Invoke (delegate { QueueDraw (); });
 		}
 
@@ -431,13 +423,13 @@
 
 			byte[] pixels;
 
-			if (idx == -1) {
+			// Starting this preview, update time short
+			if (images_transition.CurrentFrame == 0) {		
 				timer.Interval = 40;
 				timer.Enabled = true;
 			}
 
-			idx++;
-			img = images_transition[idx];
+			img = (SlideImage) images_transition.Current;
 			pixels = img.Pixels;
 			// TODO: To change to the right signature when the new Mono.Cairo is wide spread. Fixed in Mono.Cairo r120299
 			ImageSurface img_sur = new ImageSurface (ref pixels, Cairo.Format.Argb32, img.Width, img.Height, img.Stride);
@@ -449,8 +441,9 @@
 			cc.Restore ();
 			img_sur.Destroy ();
 
-			if (idx >= images_transition.Length - 1) {
-				idx = -1;
+			if (next == false) {
+				// Preview finished, repetition starts 3 seconds
+				images_transition.Reset ();
 				timer.Interval = 3000;
 				timer.Enabled = true;
 			}

Modified: trunk/src/dialogs/PreferencesDialog.cs
==============================================================================
--- trunk/src/dialogs/PreferencesDialog.cs	(original)
+++ trunk/src/dialogs/PreferencesDialog.cs	Thu Apr  9 16:08:29 2009
@@ -160,11 +160,8 @@
 
 		void LoadTransitionsIntoCombo ()
 		{
-			ITransition[] transitions = TransitionManager.List;
-
-			foreach (ITransition transition in transitions) {
-				transition_store.AppendValues (transition.DisplayName, transition.Name);
-			}
+			foreach (TransitionManager.TransitionName name in  TransitionManager.NameList)
+				transition_store.AppendValues (name.DisplayName, name.Name);
 		}
 
 		void LoadThumbnailsIntoCombo ()

Modified: trunk/src/mistelix.addin.xml
==============================================================================
--- trunk/src/mistelix.addin.xml	(original)
+++ trunk/src/mistelix.addin.xml	Thu Apr  9 16:08:29 2009
@@ -5,12 +5,17 @@
 	</Runtime>
 
 	<ExtensionPoint path="/Mistelix/SlideTransitions">
-		<ExtensionNode name="SlideTransitions" objectType="Mistelix.Transitions.ITransition" />
+		<ExtensionNode name="SlideTransitions" objectType="Mistelix.Transitions.Transition" />
 	</ExtensionPoint>
 
 	<ExtensionPoint path="/Mistelix/Effects">
 		<ExtensionNode name="Effects" objectType="Mistelix.Effects.Effect" />
 	</ExtensionPoint>
+
+	<Extension path="/Mistelix/SlideTransitions">
+		<SlideTransitions type="Mistelix.Transitions.None" />
+	</Extension>
+
 </Addin>
 
 

Modified: trunk/src/mistelix.cs
==============================================================================
--- trunk/src/mistelix.cs	(original)
+++ trunk/src/mistelix.cs	Thu Apr  9 16:08:29 2009
@@ -72,6 +72,12 @@
 		static Mistelix ()
 		{
 			base_dir = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), Defines.APPNAME_LOWER);
+
+			// Mono addins
+			AddinManager.Initialize (base_dir);
+			AddinManager.Registry.Update (null);
+			SetupService setupService = new SetupService (AddinManager.Registry);
+
 			preferences = new Preferences ();
 
 			if (String.Compare (Environment.GetEnvironmentVariable ("MISTELIX_DEBUG"), "true", false) == 0) { 
@@ -79,7 +85,6 @@
 				Logger.LogLevel = Level.DEBUG;
 				Logger.LogDevice = new FileLogger ();
 			}
-
 		}
 
 		public Mistelix (string [] args, params object [] props)
@@ -93,11 +98,6 @@
 			Glade.XML gXML = new Glade.XML (null, "mistelix.glade", "mistelix", null);
 			gXML.Autoconnect (this);
 
-			// Mono addins
-			AddinManager.Initialize (base_dir);
-			AddinManager.Registry.Update (null);
-			SetupService setupService = new SetupService (AddinManager.Registry);
-
 			foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes ("/Mistelix/SlideTransitions")) {
 				Logger.Info ("Extension:" + node.CreateInstance ());
 			}

Modified: trunk/src/widgets/SlideShowImageView.cs
==============================================================================
--- trunk/src/widgets/SlideShowImageView.cs	(original)
+++ trunk/src/widgets/SlideShowImageView.cs	Thu Apr  9 16:08:29 2009
@@ -670,7 +670,7 @@
 				image_effect = image.FindEffect (effect.Name);
 
 				if (image_effect == null) {
-					image_effect = EffectManager.CreateEffectFromName (effect.Name);
+					image_effect = EffectManager.CreateFromName (effect.Name);
 					image.AddEffect (image_effect);
 				}
 				



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