[longomatch] Add a new widget to record periods
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add a new widget to record periods
- Date: Mon, 7 Jul 2014 11:27:12 +0000 (UTC)
commit ec2c0371d31b2e74a92e60f9c16e790d2e1aa488
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Jun 4 12:47:19 2014 +0200
Add a new widget to record periods
LongoMatch.GUI/Gui/Component/PeriodsRecoder.cs | 94 ++++++++++++++++
LongoMatch.GUI/LongoMatch.GUI.mdp | 2 +
.../LongoMatch.Gui.Component.PeriodsRecoder.cs | 116 ++++++++++++++++++++
LongoMatch.GUI/gtk-gui/gui.stetic | 69 ++++++++++++
LongoMatch.GUI/gtk-gui/objects.xml | 4 +
5 files changed, 285 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/PeriodsRecoder.cs b/LongoMatch.GUI/Gui/Component/PeriodsRecoder.cs
new file mode 100644
index 0000000..8c3d0f4
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Component/PeriodsRecoder.cs
@@ -0,0 +1,94 @@
+//
+// Copyright (C) 2014 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;
+
+namespace LongoMatch.Gui.Component
+{
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class PeriodsRecoder : Gtk.Bin
+ {
+ int currentPeriod;
+ uint timeoutID;
+ DateTime currentPeriodStart;
+
+ public PeriodsRecoder ()
+ {
+ this.Build ();
+ startbutton.Visible = true;
+ stopbutton.Visible = false;
+ startbutton.Clicked += HandleStartClicked;;
+ stopbutton.Clicked += HandleStopClicked;
+ closebutton.Clicked += HandleCloseClicked;
+ currentPeriod = 0;
+ }
+
+ public List<string> GamePeriods {
+ set;
+ get;
+ }
+
+ public Period Period {
+ set;
+ get;
+ }
+
+ Time CurrentTime {
+ get {
+ return (new Time ((int)(DateTime.UtcNow -
currentPeriodStart).TotalMilliseconds));
+ }
+ }
+
+ void HandleStopClicked (object sender, EventArgs e)
+ {
+ GLib.Source.Remove (timeoutID);
+ Period.Stop (CurrentTime);
+
+ startbutton.Visible = false;
+ stopbutton.Visible = true;
+ }
+
+ void HandleStartClicked (object sender, EventArgs e)
+ {
+ string periodName;
+
+ startbutton.Visible = false;
+ stopbutton.Visible = true;
+
+ if (GamePeriods != null && GamePeriods.Count > currentPeriod) {
+ periodName = GamePeriods[currentPeriod];
+ } else {
+ periodName = (currentPeriod + 1).ToString ();
+ }
+ Period.Start (new Time (0), periodName);
+ currentPeriodStart = DateTime.UtcNow;
+ timeoutID = GLib.Timeout.Add (200, UpdateTime);
+ }
+
+ bool UpdateTime () {
+ timelabel.Markup = CurrentTime.ToMSecondsString ();
+ return true;
+ }
+
+ void HandleCloseClicked (object sender, EventArgs e)
+ {
+ Config.EventsBroker.EmitCloseOpenedProject ();
+ }
+ }
+}
\ No newline at end of file
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index 618dfdd..24103aa 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -188,6 +188,8 @@
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.CodingWidget.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Component/ProjectPeriods.cs" />
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.ProjectPeriods.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Component/PeriodsRecoder.cs" />
+ <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.PeriodsRecoder.cs" />
</Contents>
<References>
<ProjectReference type="Package" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral,
PublicKeyToken=35e10195dab3c99f" />
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PeriodsRecoder.cs
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PeriodsRecoder.cs
new file mode 100644
index 0000000..240c693
--- /dev/null
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PeriodsRecoder.cs
@@ -0,0 +1,116 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Component
+{
+ public partial class PeriodsRecoder
+ {
+ private global::Gtk.HBox hbox1;
+ private global::Gtk.Label timelabel;
+ private global::Gtk.Button stopbutton;
+ private global::Gtk.Button startbutton;
+ private global::Gtk.Button closebutton;
+
+ protected virtual void Build ()
+ {
+ global::Stetic.Gui.Initialize (this);
+ // Widget LongoMatch.Gui.Component.PeriodsRecoder
+ global::Stetic.BinContainer.Attach (this);
+ this.Name = "LongoMatch.Gui.Component.PeriodsRecoder";
+ // Container child
LongoMatch.Gui.Component.PeriodsRecoder.Gtk.Container+ContainerChild
+ this.hbox1 = new global::Gtk.HBox ();
+ this.hbox1.Name = "hbox1";
+ this.hbox1.Spacing = 6;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.timelabel = new global::Gtk.Label ();
+ this.timelabel.Name = "timelabel";
+ this.hbox1.Add (this.timelabel);
+ global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox1
[this.timelabel]));
+ w1.Position = 0;
+ w1.Expand = false;
+ w1.Fill = false;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.stopbutton = new global::Gtk.Button ();
+ this.stopbutton.CanFocus = true;
+ this.stopbutton.Name = "stopbutton";
+ this.stopbutton.UseUnderline = true;
+ // Container child stopbutton.Gtk.Container+ContainerChild
+ global::Gtk.Alignment w2 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ global::Gtk.HBox w3 = new global::Gtk.HBox ();
+ w3.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Image w4 = new global::Gtk.Image ();
+ w4.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-stop",
global::Gtk.IconSize.Dialog);
+ w3.Add (w4);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Label w6 = new global::Gtk.Label ();
+ w6.LabelProp = global::Mono.Unix.Catalog.GetString ("Stop period");
+ w6.UseUnderline = true;
+ w3.Add (w6);
+ w2.Add (w3);
+ this.stopbutton.Add (w2);
+ this.hbox1.Add (this.stopbutton);
+ global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox1
[this.stopbutton]));
+ w10.Position = 1;
+ w10.Expand = false;
+ w10.Fill = false;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.startbutton = new global::Gtk.Button ();
+ this.startbutton.CanFocus = true;
+ this.startbutton.Name = "startbutton";
+ this.startbutton.UseUnderline = true;
+ // Container child startbutton.Gtk.Container+ContainerChild
+ global::Gtk.Alignment w11 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ global::Gtk.HBox w12 = new global::Gtk.HBox ();
+ w12.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Image w13 = new global::Gtk.Image ();
+ w13.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-record",
global::Gtk.IconSize.Dialog);
+ w12.Add (w13);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Label w15 = new global::Gtk.Label ();
+ w15.LabelProp = global::Mono.Unix.Catalog.GetString ("New period");
+ w15.UseUnderline = true;
+ w12.Add (w15);
+ w11.Add (w12);
+ this.startbutton.Add (w11);
+ this.hbox1.Add (this.startbutton);
+ global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.hbox1
[this.startbutton]));
+ w19.Position = 2;
+ w19.Expand = false;
+ w19.Fill = false;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.closebutton = new global::Gtk.Button ();
+ this.closebutton.CanFocus = true;
+ this.closebutton.Name = "closebutton";
+ this.closebutton.UseUnderline = true;
+ // Container child closebutton.Gtk.Container+ContainerChild
+ global::Gtk.Alignment w20 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ global::Gtk.HBox w21 = new global::Gtk.HBox ();
+ w21.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Image w22 = new global::Gtk.Image ();
+ w22.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-close",
global::Gtk.IconSize.Dialog);
+ w21.Add (w22);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Label w24 = new global::Gtk.Label ();
+ w24.LabelProp = global::Mono.Unix.Catalog.GetString ("Stop project");
+ w24.UseUnderline = true;
+ w21.Add (w24);
+ w20.Add (w21);
+ this.closebutton.Add (w20);
+ this.hbox1.Add (this.closebutton);
+ global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.hbox1
[this.closebutton]));
+ w28.Position = 3;
+ w28.Expand = false;
+ w28.Fill = false;
+ this.Add (this.hbox1);
+ if ((this.Child != null)) {
+ this.Child.ShowAll ();
+ }
+ this.Hide ();
+ }
+ }
+}
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index ca2cce6..26986b3 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -10381,4 +10381,73 @@ Click 2 players to swap them</property>
</widget>
</child>
</widget>
+ <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.PeriodsRecoder" design-size="522 98">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <child>
+ <widget class="Gtk.HBox" id="hbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="timelabel">
+ <property name="MemberName" />
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="stopbutton">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-stop Dialog</property>
+ <property name="Label" translatable="yes">Stop period</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="startbutton">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-record Dialog</property>
+ <property name="Label" translatable="yes">New period</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>
+ <child>
+ <widget class="Gtk.Button" id="closebutton">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-close Dialog</property>
+ <property name="Label" translatable="yes">Stop project</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">3</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </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 c159207..f5483b8 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -408,4 +408,8 @@
<itemgroups />
<signals />
</object>
+ <object type="LongoMatch.Gui.Component.PeriodsRecoder" palette-category="General" allow-children="false"
base-type="Gtk.Bin">
+ <itemgroups />
+ <signals />
+ </object>
</objects>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]