[longomatch/redesign: 16/23] Make use of the new API



commit 6f1f510fff51513555fb36f123510e657a9be6c2
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Nov 21 17:01:49 2010 +0100

    Make use of the new API

 LongoMatch/Handlers/HotKeysManager.cs       |   21 +++++++++++----------
 LongoMatch/Handlers/VideoDrawingsManager.cs |   10 +++++-----
 2 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/LongoMatch/Handlers/HotKeysManager.cs b/LongoMatch/Handlers/HotKeysManager.cs
index e584c03..0977532 100644
--- a/LongoMatch/Handlers/HotKeysManager.cs
+++ b/LongoMatch/Handlers/HotKeysManager.cs
@@ -31,24 +31,24 @@ namespace LongoMatch.Handlers
 
 	public class HotKeysManager
 	{
-		private Dictionary<HotKey,int> dic;
+		private Dictionary<HotKey, Category> dic;
 		public event NewMarkEventHandler newMarkEvent;
 
 		public HotKeysManager()
 		{
-			dic = new Dictionary<HotKey,int>();
+			dic = new Dictionary<HotKey,Category>();
 		}
 
 		// Set the active Hotkeys for the current project
-		public Sections Sections {
+		public Categories Categories {
 			set {
 				dic.Clear();
 				if (value == null)
 					return;
-				for (int i=0;i<value.Count;i++) {
-					if (value.GetHotKey(i).Defined &&
-					                !dic.ContainsKey(value.GetHotKey(i)))
-						dic.Add(value.GetHotKey(i),i);
+				foreach (Category cat in value.CategoriesList) {
+					if (cat.HotKey.Defined &&
+					                !dic.ContainsKey(cat.HotKey))
+						dic.Add(cat.HotKey, cat);
 				}
 			}
 		}
@@ -56,13 +56,14 @@ namespace LongoMatch.Handlers
 		// Listen to key press events and fire a newMarkEvent event if the key combination
 		// is associated to a Category
 		public void KeyListener(object sender, KeyPressEventArgs args) {
-			int section=-1;
+			Category cat = null;
 			HotKey hotkey = new HotKey();
+			
 			hotkey.Key=args.Event.Key;
 			hotkey.Modifier=args.Event.State & (ModifierType.Mod1Mask | ModifierType.Mod5Mask | ModifierType.ShiftMask);
-			if (dic.TryGetValue(hotkey,out section)) {
+			if (dic.TryGetValue(hotkey, out cat)) {
 				if (newMarkEvent != null) {
-					newMarkEvent(section);
+					newMarkEvent(cat);
 				}
 			}
 		}
diff --git a/LongoMatch/Handlers/VideoDrawingsManager.cs b/LongoMatch/Handlers/VideoDrawingsManager.cs
index c354899..34b0af0 100644
--- a/LongoMatch/Handlers/VideoDrawingsManager.cs
+++ b/LongoMatch/Handlers/VideoDrawingsManager.cs
@@ -36,7 +36,7 @@ namespace LongoMatch.Handlers
 		private uint timeout;
 		private bool inKeyFrame;
 		private bool canStop;
-		private MediaTimeNode loadedPlay;
+		private Play loadedPlay;
 
 		public VideoDrawingsManager(PlayerBin player)
 		{
@@ -48,7 +48,7 @@ namespace LongoMatch.Handlers
 			StopClock();
 		}
 
-		public MediaTimeNode Play {
+		public Play Play {
 			set {
 				loadedPlay = value;
 				inKeyFrame = false;
@@ -90,7 +90,7 @@ namespace LongoMatch.Handlers
 		}
 
 		private int NextStopTime() {
-			return Drawing.StopTime;
+			return Drawing.RenderTime;
 		}
 
 		private void PrintDrawing() {
@@ -98,7 +98,7 @@ namespace LongoMatch.Handlers
 			Pixbuf drawing = null;
 
 			player.Pause();
-			player.SeekInSegment(Drawing.StopTime);
+			player.SeekInSegment(Drawing.RenderTime);
 			while (frame == null)
 				frame = player.CurrentFrame;
 			player.LogoPixbuf = frame;
@@ -145,7 +145,7 @@ namespace LongoMatch.Handlers
 				ResetPlayerWindow();
 				inKeyFrame = false;
 			}
-			canStop = time < Drawing.StopTime;
+			canStop = time < Drawing.RenderTime;
 			if (canStop)
 				StartClock();
 			else StopClock();



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