[longomatch] Add tagger for game units
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add tagger for game units
- Date: Sun, 18 Dec 2011 21:39:39 +0000 (UTC)
commit 9248ffccdb7afdca03c86dc0e7152d7d2dc1bc41
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Nov 22 21:34:12 2011 +0100
Add tagger for game units
LongoMatch.Core/Common/Enums.cs | 6 +
LongoMatch.Core/Handlers/Handlers.cs | 3 +
LongoMatch.Core/Store/Project.cs | 16 ++-
LongoMatch.GUI/Gui/Component/GameUnitWidget.cs | 121 ++++++++++++++++++++
LongoMatch.GUI/Gui/Component/GameUnitsTagger.cs | 71 ++++++++++++
LongoMatch.GUI/Gui/MainWindow.cs | 26 ++++-
LongoMatch.GUI/LongoMatch.GUI.mdp | 4 +
LongoMatch.GUI/Makefile.am | 4 +
.../LongoMatch.Gui.Component.GameUnitWidget.cs | 52 +++++++++
.../LongoMatch.Gui.Component.GameUnitsTagger.cs | 26 ++++
.../gtk-gui/LongoMatch.Gui.MainWindow.cs | 51 +++++----
LongoMatch.GUI/gtk-gui/gui.stetic | 63 ++++++++++-
LongoMatch.GUI/gtk-gui/objects.xml | 54 ++++++----
LongoMatch.Services/LongoMatch.Services.mdp | 5 +-
LongoMatch.Services/Makefile.am | 1 +
LongoMatch.Services/Services/Core.cs | 6 +
LongoMatch.Services/Services/GameUnitsManager.cs | 107 +++++++++++++++++
17 files changed, 567 insertions(+), 49 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Enums.cs b/LongoMatch.Core/Common/Enums.cs
index ddfd87f..afaa61a 100644
--- a/LongoMatch.Core/Common/Enums.cs
+++ b/LongoMatch.Core/Common/Enums.cs
@@ -111,4 +111,10 @@ namespace LongoMatch.Common
Audio,
DV
}
+
+ public enum GameUnitEventType {
+ Start,
+ Stop,
+ Cancel
+ }
}
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index 8122c55..b2b6c75 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -118,4 +118,7 @@ namespace LongoMatch.Handlers
/* A list of projects have been selected */
public delegate void ProjectsSelectedHandler(List<ProjectDescription> projects);
+
+ /* Start/Stop/Cancel game units */
+ public delegate void GameUnitHandler(GameUnit gameUnit, GameUnitEventType eType);
}
diff --git a/LongoMatch.Core/Store/Project.cs b/LongoMatch.Core/Store/Project.cs
index ca0ae45..fdb303b 100644
--- a/LongoMatch.Core/Store/Project.cs
+++ b/LongoMatch.Core/Store/Project.cs
@@ -48,9 +48,9 @@ namespace LongoMatch.Store
public class Project : IComparable
{
- private readonly Guid _UUID;
- private ProjectDescription description;
- private List<Play> timeline;
+ readonly Guid _UUID;
+ ProjectDescription description;
+ List<Play> timeline;
#region Constructors
public Project() {
@@ -106,7 +106,15 @@ namespace LongoMatch.Store
get;
set;
}
-
+
+ public GameUnitsList GameUnits {
+ set {
+ Categories.GameUnits = value;
+ }
+ get {
+ return Categories.GameUnits;
+ }
+ }
#endregion
#region Public Methods
diff --git a/LongoMatch.GUI/Gui/Component/GameUnitWidget.cs b/LongoMatch.GUI/Gui/Component/GameUnitWidget.cs
new file mode 100644
index 0000000..9618af0
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Component/GameUnitWidget.cs
@@ -0,0 +1,121 @@
+//
+// Copyright (C) 2011 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using System.Collections.Generic;
+using Gtk;
+using Mono.Unix;
+
+using LongoMatch.Common;
+using LongoMatch.Store;
+using LongoMatch.Handlers;
+
+namespace LongoMatch.Gui.Component
+{
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class GameUnitWidget : Gtk.Frame
+ {
+ public event GameUnitHandler GameUnitEvent;
+
+ GameUnit gameUnit;
+ Button startButton, stopButton, cancelButton;
+ Label label;
+ Time start;
+ Time current;
+
+ public GameUnitWidget (GameUnit gameUnit){
+ AddGameUnitButton();
+ GameUnit = gameUnit;
+ CurrentTime = new Time {MSeconds = 0};
+ }
+
+ public GameUnit GameUnit{
+ set {
+ gameUnit = value;
+ Label = gameUnit.Name;
+ }
+ get {
+ return gameUnit;
+ }
+ }
+
+ public Time CurrentTime {
+ set {
+ current = value;
+ if (start != null)
+ label.Text = Catalog.GetString("Time" + ": " + (value-start).ToSecondsString());
+ else label.Text = "";
+ }
+ }
+
+ private void AddGameUnitButton() {
+ HBox box = new HBox();
+ startButton = new Button("gtk-media-record");
+ label = new Label("");
+ stopButton = new Button("gtk-media-stop");
+ cancelButton = new Button("gtk-cancel");
+
+ startButton.Clicked += OnButtonClicked;
+ stopButton.Clicked += OnButtonClicked;
+ cancelButton.Clicked += OnButtonClicked;
+
+ box.PackStart(startButton, false, true, 0);
+ box.PackStart(label, false, true, 0);
+ box.PackStart(stopButton, false, true, 0);
+ box.PackStart(cancelButton, false, true, 0);
+ Add(box);
+
+ startButton.Show();
+ stopButton.Show();
+ cancelButton.Show();
+ label.Show();
+ box.Show();
+
+ SetMode(true);
+ }
+
+ public void SetMode(bool tagging) {
+ startButton.Visible = tagging;
+ stopButton.Visible = !tagging;
+ cancelButton.Visible = !tagging;
+ label.Visible = !tagging;
+ }
+
+ void EmitGameUnitEvent (GameUnitEventType eType) {
+ if (GameUnitEvent != null)
+ GameUnitEvent(GameUnit, eType);
+ }
+
+ void OnButtonClicked (object sender, EventArgs args)
+ {
+ GameUnitEventType eType;
+
+ SetMode(sender != startButton);
+ if (sender == startButton) {
+ start = current;
+ eType = GameUnitEventType.Start;
+ }
+ else if (sender == stopButton)
+ eType = GameUnitEventType.Stop;
+ else
+ eType = GameUnitEventType.Cancel;
+
+ EmitGameUnitEvent(eType);
+ }
+ }
+}
+
diff --git a/LongoMatch.GUI/Gui/Component/GameUnitsTagger.cs b/LongoMatch.GUI/Gui/Component/GameUnitsTagger.cs
new file mode 100644
index 0000000..8c46a08
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Component/GameUnitsTagger.cs
@@ -0,0 +1,71 @@
+//
+// Copyright (C) 2011 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using System.Collections.Generic;
+
+using LongoMatch.Store;
+using LongoMatch.Handlers;
+
+namespace LongoMatch.Gui.Component
+{
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class GameUnitsTagger : Gtk.Bin
+ {
+ public event GameUnitHandler GameUnitEvent;
+
+ List<GameUnitWidget> widgets;
+
+ public GameUnitsTagger ()
+ {
+ this.Build ();
+ widgets = new List<GameUnitWidget>();
+ }
+
+ public GameUnitsList GameUnits {
+ set {
+ if (widgets.Count != 0) {
+ foreach (var widget in widgets) {
+ gameunitsbox1.Remove(widget);
+ widget.Destroy();
+ }
+ widgets.Clear();
+ }
+ SetGameUnitsWidgets(value);
+ }
+ }
+
+ public Time CurrentTime {
+ set{
+ foreach (GameUnitWidget guw in widgets)
+ guw.CurrentTime = value;
+ }
+ }
+
+ private void SetGameUnitsWidgets(GameUnitsList gameUnits) {
+ foreach (GameUnit gameUnit in gameUnits) {
+ GameUnitWidget guw = new GameUnitWidget(gameUnit);
+ guw.GameUnit = gameUnit;
+ widgets.Add(guw);
+ guw.GameUnitEvent += (g, t) => {GameUnitEvent(g, t);};
+ guw.Show();
+ gameunitsbox1.PackStart(guw, false , true, 0);
+ }
+ }
+ }
+}
+
diff --git a/LongoMatch.GUI/Gui/MainWindow.cs b/LongoMatch.GUI/Gui/MainWindow.cs
index 9a89fc5..6081c11 100644
--- a/LongoMatch.GUI/Gui/MainWindow.cs
+++ b/LongoMatch.GUI/Gui/MainWindow.cs
@@ -80,6 +80,9 @@ namespace LongoMatch.Gui
public event ManageCategoriesHandler ManageCategoriesEvent;
public event ManageProjects ManageProjectsEvent;
public event ApplyCurrentRateHandler ApplyRateEvent;
+
+ /* Game Units events */
+ public event GameUnitHandler GameUnitEvent;
private static Project openedProject;
private ProjectType projectType;
@@ -164,6 +167,16 @@ namespace LongoMatch.Gui
return playlist;
}
}
+
+ public void UpdateGameUnits (GameUnitsList gameUnits) {
+ if (gameUnits == null) {
+ gameunitstaggerwidget1.Visible = false;
+ return;
+ }
+ gameunitstaggerwidget1.Visible = true;
+ gameunitstaggerwidget1.GameUnits = gameUnits;
+ }
+
#endregion
#region Private Methods
@@ -224,6 +237,9 @@ namespace LongoMatch.Gui
renderingstatebar1.ManageJobs += (e, o) => {EmitManageJobs();};
openAction.Activated += (sender, e) => {EmitSaveProject();};
+
+ /* Game Units event */
+ gameunitstaggerwidget1.GameUnitEvent += EmitGameUnitEvent;
}
private void ConnectMenuSignals() {
@@ -333,8 +349,10 @@ namespace LongoMatch.Gui
private void ShowWidgets() {
leftbox.Show();
- if(TaggingViewAction.Active || ManualTaggingViewAction.Active)
+ if(TaggingViewAction.Active || ManualTaggingViewAction.Active) {
buttonswidget.Show();
+ gameunitstaggerwidget1.Show();
+ }
else
timeline.Show();
}
@@ -344,6 +362,7 @@ namespace LongoMatch.Gui
rightvbox.Hide();
buttonswidget.Hide();
timeline.Hide();
+ gameunitstaggerwidget1.Hide();
}
private void ClearWidgets() {
@@ -731,6 +750,11 @@ namespace LongoMatch.Gui
if (SavePlaylistEvent != null)
SavePlaylistEvent();
}
+
+ private void EmitGameUnitEvent(GameUnit gameUnit, GameUnitEventType eType) {
+ if (GameUnitEvent != null)
+ GameUnitEvent(gameUnit, eType);
+ }
#endregion
}
}
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index 0f4fd83..f204889 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -139,6 +139,10 @@
<File subtype="Code" buildaction="EmbedAsResource" name="../images/camera-video.png" />
<File subtype="Code" buildaction="Compile" name="Gui/Component/GameUnitsEditor.cs" />
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.GameUnitsEditor.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Component/GameUnitWidget.cs" />
+ <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.GameUnitWidget.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Component/GameUnitsTagger.cs" />
+ <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.GameUnitsTagger.cs" />
</Contents>
<MonoDevelop.Autotools.MakefileInfo RelativeMakefileName="../CesarPlayer/Makefile.am" RelativeConfigureInPath="../">
<BuildFilesVar Name="FILES" />
diff --git a/LongoMatch.GUI/Makefile.am b/LongoMatch.GUI/Makefile.am
index 30a807b..79c9260 100644
--- a/LongoMatch.GUI/Makefile.am
+++ b/LongoMatch.GUI/Makefile.am
@@ -10,6 +10,8 @@ SOURCES = \
gtk-gui/LongoMatch.Gui.Component.DrawingToolBox.cs \
gtk-gui/LongoMatch.Gui.Component.DrawingWidget.cs \
gtk-gui/LongoMatch.Gui.Component.GameUnitsEditor.cs \
+ gtk-gui/LongoMatch.Gui.Component.GameUnitsTagger.cs \
+ gtk-gui/LongoMatch.Gui.Component.GameUnitWidget.cs \
gtk-gui/LongoMatch.Gui.Component.NotesWidget.cs \
gtk-gui/LongoMatch.Gui.Component.PlayerProperties.cs \
gtk-gui/LongoMatch.Gui.Component.PlayersListTreeWidget.cs \
@@ -57,6 +59,8 @@ SOURCES = \
Gui/Component/DrawingToolBox.cs \
Gui/Component/DrawingWidget.cs \
Gui/Component/GameUnitsEditor.cs \
+ Gui/Component/GameUnitsTagger.cs \
+ Gui/Component/GameUnitWidget.cs \
Gui/Component/NotesWidget.cs \
Gui/Component/PlayerProperties.cs \
Gui/Component/PlayersListTreeWidget.cs \
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GameUnitWidget.cs b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GameUnitWidget.cs
new file mode 100644
index 0000000..e0162ee
--- /dev/null
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GameUnitWidget.cs
@@ -0,0 +1,52 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Component
+{
+ public partial class GameUnitWidget
+ {
+ private global::Gtk.HBox gameunitsbox;
+ private global::Gtk.Button button1;
+
+ protected virtual void Build ()
+ {
+ global::Stetic.Gui.Initialize (this);
+ // Widget LongoMatch.Gui.Component.GameUnitWidget
+ global::Stetic.BinContainer.Attach (this);
+ this.Name = "LongoMatch.Gui.Component.GameUnitWidget";
+ // Container child LongoMatch.Gui.Component.GameUnitWidget.Gtk.Container+ContainerChild
+ this.gameunitsbox = new global::Gtk.HBox ();
+ this.gameunitsbox.Name = "gameunitsbox";
+ this.gameunitsbox.Spacing = 6;
+ // Container child gameunitsbox.Gtk.Box+BoxChild
+ this.button1 = new global::Gtk.Button ();
+ this.button1.CanFocus = true;
+ this.button1.Name = "button1";
+ this.button1.UseUnderline = true;
+ // Container child button1.Gtk.Container+ContainerChild
+ global::Gtk.Alignment w1 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ global::Gtk.HBox w2 = new global::Gtk.HBox ();
+ w2.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Image w3 = new global::Gtk.Image ();
+ w2.Add (w3);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Label w5 = new global::Gtk.Label ();
+ w5.LabelProp = global::Mono.Unix.Catalog.GetString ("GtkButton");
+ w5.UseUnderline = true;
+ w2.Add (w5);
+ w1.Add (w2);
+ this.button1.Add (w1);
+ this.gameunitsbox.Add (this.button1);
+ global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.gameunitsbox [this.button1]));
+ w9.Position = 2;
+ w9.Expand = false;
+ w9.Fill = false;
+ this.Add (this.gameunitsbox);
+ if ((this.Child != null)) {
+ this.Child.ShowAll ();
+ }
+ this.Hide ();
+ }
+ }
+}
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GameUnitsTagger.cs b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GameUnitsTagger.cs
new file mode 100644
index 0000000..8a9a9a4
--- /dev/null
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GameUnitsTagger.cs
@@ -0,0 +1,26 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Component
+{
+ public partial class GameUnitsTagger
+ {
+ private global::Gtk.HBox gameunitsbox1;
+
+ protected virtual void Build ()
+ {
+ global::Stetic.Gui.Initialize (this);
+ // Widget LongoMatch.Gui.Component.GameUnitsTagger
+ global::Stetic.BinContainer.Attach (this);
+ this.Name = "LongoMatch.Gui.Component.GameUnitsTagger";
+ // Container child LongoMatch.Gui.Component.GameUnitsTagger.Gtk.Container+ContainerChild
+ this.gameunitsbox1 = new global::Gtk.HBox ();
+ this.gameunitsbox1.Name = "gameunitsbox1";
+ this.gameunitsbox1.Spacing = 6;
+ this.Add (this.gameunitsbox1);
+ if ((this.Child != null)) {
+ this.Child.ShowAll ();
+ }
+ this.Hide ();
+ }
+ }
+}
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
index 976c774..030c9c6 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
@@ -50,6 +50,7 @@ namespace LongoMatch.Gui
private global::LongoMatch.Gui.CapturerBin capturer;
private global::LongoMatch.Gui.Component.TimeLineWidget timeline;
private global::LongoMatch.Gui.Component.ButtonsWidget buttonswidget;
+ private global::LongoMatch.Gui.Component.GameUnitsTagger gameunitstaggerwidget1;
private global::Gtk.VBox rightvbox;
private global::LongoMatch.Gui.Component.NotesWidget notes;
private global::LongoMatch.Gui.Component.PlayListWidget playlist;
@@ -302,10 +303,18 @@ namespace LongoMatch.Gui
global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.buttonswidget]));
w15.Position = 2;
w15.Expand = false;
+ // Container child vbox5.Gtk.Box+BoxChild
+ this.gameunitstaggerwidget1 = new global::LongoMatch.Gui.Component.GameUnitsTagger ();
+ this.gameunitstaggerwidget1.Events = ((global::Gdk.EventMask)(256));
+ this.gameunitstaggerwidget1.Name = "gameunitstaggerwidget1";
+ this.vbox5.Add (this.gameunitstaggerwidget1);
+ global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.gameunitstaggerwidget1]));
+ w16.Position = 3;
+ w16.Expand = false;
this.hpaned1.Add (this.vbox5);
- global::Gtk.Paned.PanedChild w16 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.vbox5]));
- w16.Resize = false;
- w16.Shrink = false;
+ global::Gtk.Paned.PanedChild w17 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.vbox5]));
+ w17.Resize = false;
+ w17.Shrink = false;
// Container child hpaned1.Gtk.Paned+PanedChild
this.rightvbox = new global::Gtk.VBox ();
this.rightvbox.WidthRequest = 100;
@@ -316,27 +325,27 @@ namespace LongoMatch.Gui
this.notes.Events = ((global::Gdk.EventMask)(256));
this.notes.Name = "notes";
this.rightvbox.Add (this.notes);
- global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.rightvbox [this.notes]));
- w17.Position = 0;
+ global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.rightvbox [this.notes]));
+ w18.Position = 0;
// Container child rightvbox.Gtk.Box+BoxChild
this.playlist = new global::LongoMatch.Gui.Component.PlayListWidget ();
this.playlist.WidthRequest = 100;
this.playlist.Events = ((global::Gdk.EventMask)(256));
this.playlist.Name = "playlist";
this.rightvbox.Add (this.playlist);
- global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.rightvbox [this.playlist]));
- w18.Position = 1;
+ global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.rightvbox [this.playlist]));
+ w19.Position = 1;
this.hpaned1.Add (this.rightvbox);
- global::Gtk.Paned.PanedChild w19 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.rightvbox]));
- w19.Resize = false;
- w19.Shrink = false;
- this.hpaned.Add (this.hpaned1);
- global::Gtk.Paned.PanedChild w20 = ((global::Gtk.Paned.PanedChild)(this.hpaned [this.hpaned1]));
+ global::Gtk.Paned.PanedChild w20 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.rightvbox]));
w20.Resize = false;
w20.Shrink = false;
+ this.hpaned.Add (this.hpaned1);
+ global::Gtk.Paned.PanedChild w21 = ((global::Gtk.Paned.PanedChild)(this.hpaned [this.hpaned1]));
+ w21.Resize = false;
+ w21.Shrink = false;
this.vbox1.Add (this.hpaned);
- global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hpaned]));
- w21.Position = 1;
+ global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hpaned]));
+ w22.Position = 1;
// Container child vbox1.Gtk.Box+BoxChild
this.statusbar1 = new global::Gtk.Statusbar ();
this.statusbar1.Name = "statusbar1";
@@ -347,21 +356,21 @@ namespace LongoMatch.Gui
this.renderingstatebar1.Name = "renderingstatebar1";
this.renderingstatebar1.Fraction = 0;
this.statusbar1.Add (this.renderingstatebar1);
- global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.statusbar1 [this.renderingstatebar1]));
- w22.Position = 2;
- w22.Expand = false;
- w22.Fill = false;
- this.vbox1.Add (this.statusbar1);
- global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.statusbar1]));
+ global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.statusbar1 [this.renderingstatebar1]));
w23.Position = 2;
w23.Expand = false;
w23.Fill = false;
+ this.vbox1.Add (this.statusbar1);
+ global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.statusbar1]));
+ w24.Position = 2;
+ w24.Expand = false;
+ w24.Fill = false;
this.Add (this.vbox1);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultWidth = 1259;
- this.DefaultHeight = 860;
+ this.DefaultHeight = 887;
this.leftbox.Hide ();
this.drawingtoolbox1.Hide ();
this.timeline.Hide ();
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index c83ad97..b152063 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -1587,7 +1587,7 @@
</widget>
</child>
</widget>
- <widget class="Gtk.Window" id="LongoMatch.Gui.MainWindow" design-size="1259 860">
+ <widget class="Gtk.Window" id="LongoMatch.Gui.MainWindow" design-size="1259 887">
<action-group name="Default">
<action id="FileAction">
<property name="Type">Action</property>
@@ -2005,6 +2005,17 @@
<property name="Expand">False</property>
</packing>
</child>
+ <child>
+ <widget class="LongoMatch.Gui.Component.GameUnitsTagger" id="gameunitstaggerwidget1">
+ <property name="MemberName" />
+ <property name="Events">ButtonPressMask</property>
+ </widget>
+ <packing>
+ <property name="Position">3</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="Resize">False</property>
@@ -6737,4 +6748,54 @@ Defining <b> Game Units </b> will help you during the analysis to in
</widget>
</child>
</widget>
+ <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.GameUnitWidget" design-size="644 57">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <child>
+ <widget class="Gtk.HBox" id="gameunitsbox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="button1">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Label" translatable="yes">GtkButton</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.GameUnitsTagger" design-size="727 74">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <child>
+ <widget class="Gtk.HBox" id="gameunitsbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ </widget>
+ </child>
+ </widget>
</stetic-interface>
\ No newline at end of file
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index 6f883de..b6f32fd 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -259,23 +259,6 @@
</itemgroup>
</signals>
</object>
- <object type="LongoMatch.Gui.Component.ProjectDetailsWidget" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
- <itemgroups>
- <itemgroup label="ProjectDetailsWidget Properties">
- <property name="Edited" />
- <property name="Season" />
- <property name="Competition" />
- <property name="LocalGoals" />
- <property name="VisitorGoals" />
- <property name="Date" />
- </itemgroup>
- </itemgroups>
- <signals>
- <itemgroup label="ProjectDetailsWidget Signals">
- <signal name="EditedEvent" />
- </itemgroup>
- </signals>
- </object>
<object type="LongoMatch.Gui.Component.PlaysListTreeWidget" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
<itemgroups />
<signals>
@@ -305,10 +288,6 @@
</itemgroup>
</signals>
</object>
- <object type="LongoMatch.Gui.Component.GameUnitsEditor" palette-category="General" allow-children="false" base-type="Gtk.Bin">
- <itemgroups />
- <signals />
- </object>
<object type="LongoMatch.Gui.Component.TemplatesEditorBase" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
<itemgroups>
<itemgroup label="TemplatesEditorBase Properties">
@@ -318,8 +297,41 @@
</itemgroups>
<signals />
</object>
+ <object type="LongoMatch.Gui.Component.GameUnitsTagger" palette-category="General" allow-children="false" base-type="Gtk.Bin">
+ <itemgroups />
+ <signals>
+ <itemgroup label="GameUnitsTagger Signals">
+ <signal name="GameUnitEvent" />
+ </itemgroup>
+ </signals>
+ </object>
+ <object type="LongoMatch.Gui.Component.ProjectDetailsWidget" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
+ <itemgroups>
+ <itemgroup label="ProjectDetailsWidget Properties">
+ <property name="Edited" />
+ <property name="Season" />
+ <property name="Competition" />
+ <property name="LocalGoals" />
+ <property name="VisitorGoals" />
+ <property name="Date" />
+ </itemgroup>
+ </itemgroups>
+ <signals>
+ <itemgroup label="ProjectDetailsWidget Signals">
+ <signal name="EditedEvent" />
+ </itemgroup>
+ </signals>
+ </object>
<object type="LongoMatch.Gui.Component.GameUnitsEditor" palette-category="General" allow-children="false" base-type="Gtk.Bin">
<itemgroups />
<signals />
</object>
+ <object type="LongoMatch.Gui.Component.GameUnitWidget" palette-category="General" allow-children="false" base-type="Gtk.Frame">
+ <itemgroups />
+ <signals>
+ <itemgroup label="GameUnitWidget Signals">
+ <signal name="GameUnitEvent" />
+ </itemgroup>
+ </signals>
+ </object>
</objects>
\ No newline at end of file
diff --git a/LongoMatch.Services/LongoMatch.Services.mdp b/LongoMatch.Services/LongoMatch.Services.mdp
index 9bca3ed..d8d8fb4 100644
--- a/LongoMatch.Services/LongoMatch.Services.mdp
+++ b/LongoMatch.Services/LongoMatch.Services.mdp
@@ -24,6 +24,9 @@
<File subtype="Code" buildaction="Compile" name="Services/VideoDrawingsManager.cs" />
<File subtype="Code" buildaction="Compile" name="Services/PlaylistManager.cs" />
<File subtype="Code" buildaction="Compile" name="Services/ProjectsManager.cs" />
+ <File subtype="Directory" buildaction="Compile" name="." />
+ <File subtype="Code" buildaction="Compile" name="Services/GameUnitsManager.cs" />
+ <File subtype="Directory" buildaction="Compile" name="." />
</Contents>
<References>
<ProjectReference type="Project" localcopy="True" refto="LongoMatch.Core" />
@@ -36,4 +39,4 @@
<ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
</References>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/LongoMatch.Services/Makefile.am b/LongoMatch.Services/Makefile.am
index 3579540..9dd3942 100644
--- a/LongoMatch.Services/Makefile.am
+++ b/LongoMatch.Services/Makefile.am
@@ -4,6 +4,7 @@ TARGET = library
LINK = $(REF_DEP_LONGOMATCH_SERVICES)
SOURCES = \
+ Services/GameUnitsManager.cs \
Services/PlaylistManager.cs \
Services/VideoDrawingsManager.cs \
Services/ProjectsManager.cs \
diff --git a/LongoMatch.Services/Services/Core.cs b/LongoMatch.Services/Services/Core.cs
index d26f853..e93b4de 100644
--- a/LongoMatch.Services/Services/Core.cs
+++ b/LongoMatch.Services/Services/Core.cs
@@ -33,6 +33,7 @@ namespace LongoMatch.Services
static TemplatesService ts;
static EventsManager eManager;
static HotKeysManager hkManager;
+ static GameUnitsManager guManager;
static MainWindow mainWindow;
public static void Init()
@@ -80,6 +81,9 @@ namespace LongoMatch.Services
mainWindow.RenderPlaylistEvent += (playlist) => {
videoRenderer.AddJob(RenderingJobsManager.ConfigureRenderingJob(playlist, mainWindow));};
+ /* Start Game Units manager */
+ guManager = new GameUnitsManager(mainWindow, mainWindow.Player);
+
projectsManager = new ProjectsManager(mainWindow);
projectsManager.OpenedProjectChanged += OnOpenedProjectChanged;
}
@@ -133,6 +137,8 @@ namespace LongoMatch.Services
eManager.OpenedProject = project;
eManager.OpenedProjectType = projectType;
+
+ guManager.OpenedProject = project;
}
private static void SetupBaseDir() {
diff --git a/LongoMatch.Services/Services/GameUnitsManager.cs b/LongoMatch.Services/Services/GameUnitsManager.cs
new file mode 100644
index 0000000..26ebdef
--- /dev/null
+++ b/LongoMatch.Services/Services/GameUnitsManager.cs
@@ -0,0 +1,107 @@
+//
+// Copyright (C) 2011 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using System.Collections.Generic;
+
+using LongoMatch.Common;
+using LongoMatch.Gui;
+using LongoMatch.Store;
+
+namespace LongoMatch.Services
+{
+ public class GameUnitsManager
+ {
+ MainWindow mainWindow;
+ PlayerBin player;
+ Project openedProject;
+ Dictionary<GameUnit, Time> gameUnitsStarted;
+
+
+ public GameUnitsManager (MainWindow mainWindow, PlayerBin player)
+ {
+ this.mainWindow = mainWindow;
+ this.player = player;
+ gameUnitsStarted = new Dictionary<GameUnit, Time>();
+ }
+
+ public Project OpenedProject{
+ set {
+ openedProject = value;
+ gameUnitsStarted.Clear();
+ if (openedProject != null)
+ mainWindow.UpdateGameUnits(value.GameUnits);
+ }
+ }
+
+ private void ConnectSignals() {
+ mainWindow.GameUnitEvent += HandleMainWindowGameUnitEvent;
+ }
+
+ private void StartGameUnit(GameUnit gameUnit) {
+ if (gameUnitsStarted.ContainsKey(gameUnit)){
+ Log.Warning("Trying to start a game unit that was already started");
+ } else {
+ }
+ }
+
+ private void CancelGameUnit(GameUnit gameUnit) {
+ if (gameUnitsStarted.ContainsKey(gameUnit)) {
+ gameUnitsStarted.Remove(gameUnit);
+ } else {
+ Log.Warning("Tryed to cancel a game unit that was not started: " + gameUnit);
+ }
+ }
+
+ private void StopGameUnit(GameUnit gameUnit) {
+ TimeNode timeInfo;
+ GameUnit projectGameUnit;
+ Time start, stop;
+
+ if (gameUnitsStarted.ContainsKey(gameUnit))
+ Log.Warning("Tryed to stop a game unit that was not started: " + gameUnit);
+
+ start = gameUnitsStarted[gameUnit];
+ stop = new Time{MSeconds=(int)player.CurrentTime};
+ timeInfo = new TimeNode {Start=start, Stop=stop};
+
+ gameUnit.Add(timeInfo);
+ gameUnitsStarted.Remove(gameUnit);
+ }
+
+ void HandleMainWindowGameUnitEvent (GameUnit gameUnit, LongoMatch.Common.GameUnitEventType eType)
+ {
+ switch (eType) {
+ case GameUnitEventType.Start:
+ {
+ StartGameUnit(gameUnit);
+ break;
+ }
+ case GameUnitEventType.Cancel:
+ {
+ CancelGameUnit(gameUnit);
+ break;
+ }
+ case GameUnitEventType.Stop:
+ {
+ StopGameUnit(gameUnit);
+ break;
+ }
+ }
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]