[longomatch/gameunits] Add a timescale for game units
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/gameunits] Add a timescale for game units
- Date: Wed, 23 Nov 2011 23:11:46 +0000 (UTC)
commit 8a331122555a502c929bae200c8f47576d1dc2b3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Nov 24 00:10:01 2011 +0100
Add a timescale for game units
LongoMatch.Core/Handlers/Handlers.cs | 6 ++
LongoMatch.GUI/Gui/Component/GameUnitTimeScale.cs | 85 +++++++++++++++++++++
LongoMatch.GUI/LongoMatch.GUI.mdp | 1 +
LongoMatch.GUI/Makefile.am | 1 +
LongoMatch.GUI/gtk-gui/objects.xml | 17 ++---
5 files changed, 100 insertions(+), 10 deletions(-)
---
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index b2b6c75..25b52ab 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -121,4 +121,10 @@ namespace LongoMatch.Handlers
/* Start/Stop/Cancel game units */
public delegate void GameUnitHandler(GameUnit gameUnit, GameUnitEventType eType);
+
+ public delegate void UnitChangeHandler (TimelineNode unit, Time time);
+ public delegate void UnitSelectedHandler (TimelineNode unit);
+ public delegate void UnitAddedHandler (GameUnit gameUnit, int frame);
+ public delegate void UnitsDeletedHandler (List<TimelineNode> unit);
+
}
diff --git a/LongoMatch.GUI/Gui/Component/GameUnitTimeScale.cs b/LongoMatch.GUI/Gui/Component/GameUnitTimeScale.cs
new file mode 100644
index 0000000..b229541
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Component/GameUnitTimeScale.cs
@@ -0,0 +1,85 @@
+// TimeScale.cs
+//
+// Copyright (C) 2007-2009 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 Cairo;
+using Gdk;
+using Gtk;
+using Pango;
+using Mono.Unix;
+using LongoMatch.Common;
+using LongoMatch.Gui.Base;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+
+
+namespace LongoMatch.Gui.Component
+{
+
+
+ [System.ComponentModel.Category("LongoMatch")]
+ [System.ComponentModel.ToolboxItem(true)]
+ public class GameUnitTimeScale : TimeScaleBase<TimelineNode>
+ {
+
+ public event UnitChangeHandler UnitChanged;
+ public event UnitSelectedHandler UnitSelected;
+ public event UnitsDeletedHandler UnitDeleted;
+ public event UnitAddedHandler UnitAdded;
+
+ GameUnit gameUnit;
+
+ public GameUnitTimeScale(GameUnit gameUnit, uint frames): base(gameUnit, frames)
+ {
+ this.gameUnit = gameUnit;
+ elementName = Catalog.GetString("play");
+ }
+
+ public void AddUnit(TimelineNode unit) {
+ AddTimeNode(unit);
+ }
+
+ public void RemoveUnit(TimelineNode unit) {
+ RemoveTimeNode(unit);
+ }
+
+ override protected void HandleTimeNodeChanged(TimelineNode unit, Time time) {
+ if (UnitChanged != null)
+ UnitChanged(unit, time);
+ }
+
+ override protected void HandleTimeNodeSelected(TimelineNode unit) {
+ if (UnitSelected != null)
+ UnitSelected(unit);
+ }
+
+ override protected void HandleTimeNodeDeleted(List<TimelineNode> units) {
+ if (UnitDeleted != null)
+ UnitDeleted(units);
+ }
+
+ override protected void AddNewTimeNode() {
+ if (UnitAdded != null)
+ UnitAdded(gameUnit, cursorFrame);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index 84ec357..91e3bad 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -146,6 +146,7 @@
<File subtype="Code" buildaction="Compile" name="Gui/Base/TemplatesEditorBase.cs" />
<File subtype="Directory" buildaction="Compile" name="Gui/Component" />
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Base.TemplatesEditorBase.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Component/GameUnitTimeScale.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 f42755c..1248a13 100644
--- a/LongoMatch.GUI/Makefile.am
+++ b/LongoMatch.GUI/Makefile.am
@@ -62,6 +62,7 @@ SOURCES = \
Gui/Component/DrawingWidget.cs \
Gui/Component/GameUnitsEditor.cs \
Gui/Component/GameUnitsTagger.cs \
+ Gui/Component/GameUnitsTimeline.cs \
Gui/Component/GameUnitWidget.cs \
Gui/Component/NotesWidget.cs \
Gui/Component/PlayerProperties.cs \
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index ac16f53..22f1bc7 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -266,23 +266,20 @@
</object>
<object type="LongoMatch.Gui.Base.TemplatesEditorWidget" palette-category="General" allow-children="false" base-type="Gtk.Bin">
<itemgroups>
- <itemgroup label="TemplatesEditorBase Properties">
- <property name="CanExport" />
- <property name="Edited" />
- </itemgroup>
</itemgroups>
<signals />
</object>
- <object type="LongoMatch.Gui.Base.TemplatesEditorBase" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
+ <object type="LongoMatch.Gui.Component.CategoriesTemplateEditorWidget" palette-category="General" allow-children="false" base-type="Gtk.Bin">
<itemgroups>
- <itemgroup label="TemplatesEditorBase Properties">
- <property name="CanExport" />
- <property name="Edited" />
- </itemgroup>
</itemgroups>
<signals />
</object>
- <object type="LongoMatch.Gui.Component.CategoriesTemplateEditorWidget" palette-category="General" allow-children="false" base-type="Gtk.Bin">
+ <object type="LongoMatch.Gui.Component.TeamTemplateEditorWidget" palette-category="General" allow-children="false" base-type="LongoMatch.Gui.Base.TemplatesEditorBase">
+ <itemgroups>
+ </itemgroups>
+ <signals />
+ </object>
+ <object type="LongoMatch.Gui.Base.TemplatesEditorBase" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
<itemgroups>
<itemgroup label="TemplatesEditorBase Properties">
<property name="CanExport" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]