[longomatch] Fix updating drawings miniatures



commit 7291dc8ff4a63321ab53b3cff596cf8f11813ceb
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Dec 1 01:32:20 2014 +0100

    Fix updating drawings miniatures

 LongoMatch.Core/Store/FrameDrawing.cs    |    5 +++++
 LongoMatch.Core/Store/TimelineEvent.cs   |    9 +++++++++
 LongoMatch.GUI/Gui/Dialog/DrawingTool.cs |    7 ++++---
 LongoMatch.GUI/Gui/Menu/PlaysMenu.cs     |    1 +
 4 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Core/Store/FrameDrawing.cs b/LongoMatch.Core/Store/FrameDrawing.cs
index 1731e56..e95882f 100644
--- a/LongoMatch.Core/Store/FrameDrawing.cs
+++ b/LongoMatch.Core/Store/FrameDrawing.cs
@@ -42,6 +42,11 @@ namespace LongoMatch.Core.Store
                        Drawables = new List<Drawable> ();
                }
                
+               public Image Miniature {
+                       get;
+                       set;
+               }
+
                public Image Freehand {
                        get;
                        set;
diff --git a/LongoMatch.Core/Store/TimelineEvent.cs b/LongoMatch.Core/Store/TimelineEvent.cs
index a57365c..298f2f4 100644
--- a/LongoMatch.Core/Store/TimelineEvent.cs
+++ b/LongoMatch.Core/Store/TimelineEvent.cs
@@ -181,6 +181,15 @@ namespace LongoMatch.Core.Store
                        }
                }
 
+               public void UpdateMiniature ()
+               {
+                       if (Drawings.Count == 0) {
+                               Miniature = null;
+                       } else {
+                               Miniature = Drawings[0].Miniature;
+                       }
+               }
+
                public void AddDefaultPositions ()
                {
                        if (EventType.TagFieldPosition) {
diff --git a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
index aa3a784..e82825b 100644
--- a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
@@ -395,9 +395,10 @@ namespace LongoMatch.Gui.Dialog
                        if (!play.Drawings.Contains (drawing)) {
                                play.Drawings.Add (drawing);
                        }
-                       play.Miniature = blackboard.Save ();
-                       play.Miniature.ScaleInplace (Constants.MAX_THUMBNAIL_SIZE,
-                                                    Constants.MAX_THUMBNAIL_SIZE);
+                       drawing.Miniature = blackboard.Save ();
+                       drawing.Miniature.ScaleInplace (Constants.MAX_THUMBNAIL_SIZE,
+                                                       Constants.MAX_THUMBNAIL_SIZE);
+                       play.UpdateMiniature ();
                        drawing = null;
                        Respond (ResponseType.Accept);
                }
diff --git a/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs b/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
index 74efd21..542201b 100644
--- a/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
+++ b/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
@@ -142,6 +142,7 @@ namespace LongoMatch.Gui.Menus
                                        }; 
                                        deleteItem.Activated += (sender, e) => {
                                                plays [0].Drawings.RemoveAt (index);
+                                               plays [0].UpdateMiniature ();
                                        }; 
                                        drawingItem.Submenu = drawingMenu;
                                        drawingMenu.ShowAll ();


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