[longomatch/test: 9/10] WIP



commit 735f22cabf488d1f23106ae6d926279cdd4dc3f3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Nov 16 20:24:52 2010 +0100

    WIP

 LongoMatch/Common/Constants.cs       |    2 +-
 LongoMatch/Handlers/EventsManager.cs |    1 +
 LongoMatch/Time/PixbufTimeNode.cs    |    9 ++--
 LongoMatch/Time/Play.cs              |   81 ++++++++++++++++++----------------
 LongoMatch/Time/PlayListPlay.cs      |   40 ++++++-----------
 LongoMatch/Time/Tag.cs               |    6 +--
 LongoMatch/Time/Time.cs              |   53 ++++++----------------
 LongoMatch/Time/TimeNode.cs          |   43 ++++++------------
 8 files changed, 93 insertions(+), 142 deletions(-)
---
diff --git a/LongoMatch/Common/Constants.cs b/LongoMatch/Common/Constants.cs
index 6535fcd..326ca79 100644
--- a/LongoMatch/Common/Constants.cs
+++ b/LongoMatch/Common/Constants.cs
@@ -26,7 +26,7 @@ namespace LongoMatch.Common
 		
 		public const string PROJECT_NAME = SOFTWARE_NAME + " project";
 		
-		public const string DB_FILE = "longomatch.db";
+		public const string DB_FILE = "longomatch.1.db";
 		
 		public const string COPYRIGHT =  "Copyright ©2007-2010 Andoni Morales Alastruey";
 		
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index 2cb1da8..660ab00 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -234,6 +234,7 @@ namespace LongoMatch
 
 		protected virtual void OnNewMarkAtFrame(Category category, int frame) {
 			Time pos = new Time(frame*1000/openedProject.Description.File.Fps);
+			player.CloseActualSegment();
 			player.SeekTo ((long)pos.MSeconds, true);
 			ProcessNewMarkEvent(category,pos);
 		}
diff --git a/LongoMatch/Time/PixbufTimeNode.cs b/LongoMatch/Time/PixbufTimeNode.cs
index d790d0b..8cf1544 100644
--- a/LongoMatch/Time/PixbufTimeNode.cs
+++ b/LongoMatch/Time/PixbufTimeNode.cs
@@ -25,8 +25,8 @@ namespace LongoMatch.TimeNodes
 {
 
 	/// <summary>
-	/// I am the base class for all the video segments.
-	/// I have a <see cref="Pixbuf"/> with a thumbnail of the video segment I represent
+	/// Base class for all the video segments containing a snapshot
+	/// It has a <see cref="Gdk.Pixbuf"/> with a thumbnail of the video segment.
 	/// </summary>
 	[Serializable]
 	public class PixbufTimeNode : TimeNode
@@ -40,9 +40,9 @@ namespace LongoMatch.TimeNodes
 		#endregion
 
 		#region Properties
-		/// <value>
+		/// <summary>
 		/// Segment thumbnail
-		/// </value>
+		/// </summary>
 		public Pixbuf Miniature {
 			get {
 				if (thumbnailBuf != null)
@@ -54,7 +54,6 @@ namespace LongoMatch.TimeNodes
 				else thumbnailBuf = null;
 			}
 		}
-
 		#endregion
 
 		private void ScaleAndSave(Pixbuf pixbuf) {
diff --git a/LongoMatch/Time/Play.cs b/LongoMatch/Time/Play.cs
index 0dc8b52..b995557 100644
--- a/LongoMatch/Time/Play.cs
+++ b/LongoMatch/Time/Play.cs
@@ -29,11 +29,7 @@ namespace LongoMatch.TimeNodes
 {
 
 	/// <summary>
-	/// I represent a Play in the game, that's why I'm probably the most
-	/// important object of the database.
-	/// I have a name to describe the play as well as a start and a stop { LongoMatch TimeNode Time},
-	/// which sets the play's position in the game's time line.
-	/// I also stores a list a { LongoMatch TimeNode Player} tagged to this play.
+	/// Represents a Play in the game.
 	/// </summary>
 
 	[Serializable]
@@ -49,40 +45,43 @@ namespace LongoMatch.TimeNodes
 
 		#region Properties
 		
+		/// <summary>
+		/// Category in which this play is tagged 
+		/// </summary>
 		public Category Category {
 			get;
 			set;
 		}
 		
-		/// <value>
-		/// Play's notes
-		/// </value>
+		/// <summary>
+		/// A strng with the play's notes
+		/// </summary>
 		public string Notes {
 			get;
 			set;
 		}
 
-		/// <value>
+		/// <summary>
 		/// The <see cref="LongoMatch.TimeNode.Team"/> associated to this play
-		/// </value>
+		/// </summary>
 		public Team Team {
 			get;
 			set;
 		}
 
-		/// <value>
-		/// Video frameratein frames per second. This value is taken from the
+		/// <summary>
+		/// Video framerate in frames per second. This value is taken from the
 		/// video file properties and used to translate from seconds
 		/// to frames: second 100 is equivalent to frame 100*fps
-		/// </value>
+		/// </summary>
 		public uint Fps {
 			get;
 			set;
 		}
 
-		/// <value>
+		/// <summary>
 		/// Start frame number
-		/// </value>
+		/// </summary>
 		public uint StartFrame {
 			get {
 				return (uint) (Start.MSeconds * Fps / 1000);
@@ -92,9 +91,9 @@ namespace LongoMatch.TimeNodes
 			}
 		}
 
-		/// <value>
+		/// <summary>
 		/// Stop frame number
-		/// </value>
+		/// </summary>
 		public uint StopFrame {
 			get {
 				return (uint) (Stop.MSeconds * Fps / 1000);
@@ -104,9 +103,9 @@ namespace LongoMatch.TimeNodes
 			}
 		}
 
-		/// <value>
+		/// <summary>
 		/// Get the key frame number if this play as key frame drawing or 0
-		/// </value>
+		/// </summary>
 		public uint KeyFrame {
 			get {
 				if (HasKeyFrame)
@@ -115,22 +114,25 @@ namespace LongoMatch.TimeNodes
 			}
 		}
 
-		/// <value>
-		/// Get/Set wheter this play is actually loaded. Used in { LongoMatch Gui Component TimeScale}
-		/// </value>
+		/// <summary>
+		/// Get/Set wheter this play is actually loaded. Used in  <see cref="LongoMatch.Gui.Component.TimeScale">
+		/// </summary>
 		public bool Selected {
 			get;
 			set;
 		}
 
-		/// <value>
+		/// <summary>
 		/// Get/Set a list of the players tagged to this play
-		/// </value>
+		/// </summary>
 		public List<Player> Players {
 			get;
 			set;
 		}
-		
+	
+		/// <summary>
+		/// Gets a list of players for the local team 
+		/// </summary>
 		public List<Player> LocalPlayers {
 			get{
 				return 
@@ -140,7 +142,10 @@ namespace LongoMatch.TimeNodes
 					 ).ToList();
 			}
 		}
-		
+	
+		/// <summary>
+		/// Gets a list of players for the visitor team 
+		/// </summary>
 		public List<Player> VisitorPlayers {
 			get{
 				return 
@@ -151,44 +156,44 @@ namespace LongoMatch.TimeNodes
 			}
 		}
 
-		/// <value>
+		/// <summary>
 		/// Get/Set the key frame's <see cref="LongoMatch.TimeNodes.Drawing"/>
-		/// </value>
+		/// </summary>
 		public Drawing KeyFrameDrawing {
 			get;
 			set;
 		}
 
-		/// <value>
-		/// Get wether the play has as defined a key frame
-		/// </value>
+		/// <summary>
+		/// Get wether the play has defined a key frame
+		/// </summary>
 		public bool HasKeyFrame {
 			get {
 				return KeyFrameDrawing != null;
 			}
 		}
 		
-		/// <value>
+		/// <summary>
 		/// Central frame number using (stopFrame-startFrame)/2
-		/// </value>
+		/// </summary>
 		public uint CentralFrame {
 			get {
 				return StopFrame-((TotalFrames)/2);
 			}
 		}
 
-		/// <value>
+		/// <summary>
 		/// Number of frames inside the play's boundaries
-		/// </value>
+		/// </summary>
 		public uint TotalFrames {
 			get {
 				return StopFrame-StartFrame;
 			}
 		}
 
-		//// <value>
+		//// <summary>
 		/// Play's tags 
-		/// </value>
+		/// </summary>
 		public List<Tag> Tags{
 			get;
 			set;
@@ -197,7 +202,7 @@ namespace LongoMatch.TimeNodes
 
 		#region Public methods
 		/// <summary>
-		/// Check the frame number is inside the play boundaries
+		/// Check if the frame number is inside the play boundaries
 		/// </summary>
 		/// <param name="frame">
 		/// A <see cref="System.Int32"/> with the frame number
diff --git a/LongoMatch/Time/PlayListPlay.cs b/LongoMatch/Time/PlayListPlay.cs
index 0d8865d..b6e8e72 100644
--- a/LongoMatch/Time/PlayListPlay.cs
+++ b/LongoMatch/Time/PlayListPlay.cs
@@ -25,51 +25,39 @@ using LongoMatch.Video.Utils;
 namespace LongoMatch.TimeNodes
 {
 	/// <summary>
-	/// I am a special video segment used by <see cref="LongoMatch.Playlist.Playlist"/>.
-	/// I stores the information of the video file I belong to and that's why I am independent of any context.
+	/// Represents a video segment used by <see cref="LongoMatch.Playlist.Playlist"/>.
+	/// It stores the information of the video file so that it can be used outside a project.
 	/// </summary>
 	[Serializable]
 	public class PlayListPlay : TimeNode
 	{
-		private MediaFile mediaFile;
+		private PreviewMediaFile mediaFile;
 
 		#region Constructors
-		public PlayListPlay() {
+		public PlayListPlay()
+		{
 		}
 		#endregion
 
 		#region  Properties
-		/// <value>
-		/// My video file
+		/// <summary>
+		/// Video file with snapshot preview
 		/// </value>
-		public MediaFile MediaFile {
-			set {
-				//PlayListTimeNode is serializable and only primary classes
-				//can be serialiazed. In case it's a PreviewMidaFile we create
-				//a new MediaFile object.
-				if (value is PreviewMediaFile) {
-					MediaFile mf  = new MediaFile(value.FilePath,value.Length,value.Fps,
-					                              value.HasAudio,value.HasVideo,value.VideoCodec,
-					                              value.VideoCodec,value.VideoWidth,value.VideoHeight);
-					this.mediaFile= mf;
-				}
-				else this.mediaFile = value;
-			}
-			get {
-				return this.mediaFile;
-			}
+		public PreviewMediaFile MediaFile {
+			set;
+			get;
 		}
 
-		/// <value>
-		/// My play rate
-		/// </value>
+		/// <summary>
+		/// Play rate
+		/// </summary>
 		public float Rate {
 			get;
 			set;
 		}
 
 		//// <value>
-		/// I wont't be valid if my file doesn't exists
+		/// Defines it the file exists and thus, it can be used in the playlist
 		/// </value>
 		public bool Valid {
 			get;
diff --git a/LongoMatch/Time/Tag.cs b/LongoMatch/Time/Tag.cs
index a230107..a8a4a61 100644
--- a/LongoMatch/Time/Tag.cs
+++ b/LongoMatch/Time/Tag.cs
@@ -24,12 +24,10 @@ namespace LongoMatch.TimeNodes
 	[Serializable]
 	public class Tag
 	{
-		
-		public Tag()
-		{
+		public Tag() {
 		}
 
-		public string TagCategory {
+		public string SubCategory {
 			get;
 			set;
 		}
diff --git a/LongoMatch/Time/Time.cs b/LongoMatch/Time/Time.cs
index e4b6d0a..f6e5f39 100644
--- a/LongoMatch/Time/Time.cs
+++ b/LongoMatch/Time/Time.cs
@@ -24,52 +24,35 @@ namespace LongoMatch.TimeNodes
 {
 
 	/// <summary>
-	/// I represent a time instant. Other objects uses me to maintain time units consitency.
-	/// I am expressed in miliseconds and I provide some helper methods for time conversion and representation
+	/// Represents a time instant. Other objects uses it to keep consistency in the time units consitency.
+	/// It's expressed in miliseconds and provide some helper methods for time conversion and representation
 	/// </summary>
 	[Serializable]
 	public class Time :  IComparable
 	{
-		private int time;
 		private const int MS = 1000000 ;
 		public const int SECONDS_TO_TIME = 1000;
-
+	
 		#region Constructors
 		public Time() {
-			this.time = 0;
-		}
-
-		/// <summary>
-		/// Creates a new time instant
-		/// </summary>
-		/// <param name="time">
-		/// A <see cref="System.Int32"/> with the time expressed in miliseconds
-		/// </param>
-		public Time(int time)
-		{
-			this.time = time;
 		}
 		#endregion
 
-		//// <value>
+		//// <summary>
 		/// Time in miliseconds
-		/// </value>
+		/// </summary>
 		#region Properties
 		public int MSeconds {
-			get {
-				return time;
-			}
-			set {
-				time = value;
-			}
+			get;
+			set;
 		}
 
-		/// <value>
+		/// <summary>
 		/// Time in seconds
-		/// </value>
+		/// </summary>
 		public int Seconds {
 			get {
-				return time/SECONDS_TO_TIME;
+				return MSeconds/SECONDS_TO_TIME;
 			}
 		}
 		#endregion
@@ -85,7 +68,7 @@ namespace LongoMatch.TimeNodes
 		{
 			int _h, _m, _s, _time;
 
-			_time = time / 1000;
+			_time = MSeconds / 1000;
 			_h = (_time / 3600);
 			_m = ((_time % 3600) / 60);
 			_s = ((_time % 3600) % 60);
@@ -105,18 +88,10 @@ namespace LongoMatch.TimeNodes
 		/// </returns>
 		public  string ToMSecondsString()
 		{
-			int _h, _m, _s,_ms,_time;
-			_time = time / 1000;
-			_h = (_time / 3600);
-			_m = ((_time % 3600) / 60);
-			_s = ((_time % 3600) % 60);
-			_ms = ((time % 3600000)%60000)%1000;
-
-			//if (_h > 0)
-			return String.Format("{0}:{1}:{2},{3}", _h, _m.ToString("d2"),
-			                     _s.ToString("d2"),_ms.ToString("d3"));
+			int _ms ;
+			_ms = ((MSeconds % 3600000)%60000)%1000;
 
-			//return String.Format ("{0}:{1},{2}", _m, _s.ToString ("d2"),_ms.ToString("d3"));
+			return String.Format("{0},{1}", ToSecondsString(), _ms.ToString("d3"));
 		}
 
 		public override bool Equals(object o)
diff --git a/LongoMatch/Time/TimeNode.cs b/LongoMatch/Time/TimeNode.cs
index 88f3c02..dc0e096 100644
--- a/LongoMatch/Time/TimeNode.cs
+++ b/LongoMatch/Time/TimeNode.cs
@@ -26,8 +26,8 @@ namespace LongoMatch.TimeNodes
 {
 
 	/// <summary>
-	/// I am the base class for the time span related objects in the database.
-	/// I have a name that describe me and a start and stop <see cref="LongoMatch.TimeNodes.Time"/>
+	/// Base class for all the time span related objects in the database.
+	/// It has a name that describe it and a start and stop <see cref="LongoMatch.TimeNodes.Time"/>
 	/// </summary>
 	[Serializable]
 	public class TimeNode
@@ -38,33 +38,33 @@ namespace LongoMatch.TimeNodes
 		#endregion
 
 		#region Properties
-		/// <value>
-		/// A short description of myself
-		/// </value>
+		/// <summary>
+		/// A short description of the time node
+		/// </summary>
 		public string Name {
 			get;
 			set;
 		}
 
-		//// <value>
-		/// My start time
-		/// </value>
+		/// <summary>
+		/// Start Time
+		/// </summary>
 		public Time Start {
 			get;
 			set;
 		}
 
-		/// <value>
-		/// My stop time
-		/// </value>
+		/// <summary>
+		/// Stop time
+		/// </summary>
 		public Time Stop {
 			get;
 			set;
 		}
 
-		/// <value>
-		/// My duration
-		/// </value>
+		/// <summary>
+		/// Duration (stop_time - start_time)
+		/// </summary>
 		public Time Duration {
 			get {
 				return Stop-Start;
@@ -72,20 +72,5 @@ namespace LongoMatch.TimeNodes
 		}
 		#endregion
 
-		#region Public methods
-		/// <summary>
-		/// Change my boundaries
-		/// </summary>
-		/// <param name="start">
-		/// My new start <see cref="Time"/>
-		/// </param>
-		/// <param name="stop">
-		/// My new stop <see cref="Time"/>
-		/// </param>
-		public void ChangeStartStop(Time start, Time stop) {
-			Start = start;
-			Stop = stop;
-		}
-		#endregion
 	}
 }



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