[longomatch/redesign3] Add tagger widget for Teams
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/redesign3] Add tagger widget for Teams
- Date: Mon, 22 Aug 2011 19:03:55 +0000 (UTC)
commit 7ad9c7b1808125d078f4823dbf75d3ab3ffd426e
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Aug 22 21:03:13 2011 +0200
Add tagger widget for Teams
LongoMatch/Gui/Component/TaggerWidget.cs | 9 +++
LongoMatch/Gui/Component/TeamTaggerWidget.cs | 77 ++++++++++++++++++++
LongoMatch/Gui/Dialog/TaggerDialog.cs | 14 ++++-
LongoMatch/Handlers/EventsManager.cs | 2 +-
LongoMatch/LongoMatch.mdp | 2 +
LongoMatch/Makefile.am | 2 +
.../LongoMatch.Gui.Component.TeamTaggerWidget.cs | 47 ++++++++++++
...LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs | 1 -
LongoMatch/gtk-gui/gui.stetic | 43 +++++++++++
LongoMatch/gtk-gui/objects.xml | 4 +
10 files changed, 198 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/TaggerWidget.cs b/LongoMatch/Gui/Component/TaggerWidget.cs
index c0f36f1..ebe803a 100644
--- a/LongoMatch/Gui/Component/TaggerWidget.cs
+++ b/LongoMatch/Gui/Component/TaggerWidget.cs
@@ -42,5 +42,14 @@ namespace LongoMatch.Gui.Component
table1.NRows ++;
tagger.Show();
}
+
+ public void AddTeamSubCategory(TeamSubCategory subcat, TeamsTagStore tags,
+ string localTeam, string visitorTeam){
+ TeamTaggerWidget tagger = new TeamTaggerWidget(subcat, tags,
+ localTeam, visitorTeam);
+ table1.Attach(tagger,0, 1, table1.NRows-1, table1.NRows);
+ table1.NRows ++;
+ tagger.Show();
+ }
}
}
\ No newline at end of file
diff --git a/LongoMatch/Gui/Component/TeamTaggerWidget.cs b/LongoMatch/Gui/Component/TeamTaggerWidget.cs
new file mode 100644
index 0000000..4f09310
--- /dev/null
+++ b/LongoMatch/Gui/Component/TeamTaggerWidget.cs
@@ -0,0 +1,77 @@
+//
+// 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 LongoMatch.Common;
+using LongoMatch.Store;
+
+namespace LongoMatch.Gui.Component
+{
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class TeamTaggerWidget : Gtk.Bin
+ {
+ private Dictionary<TeamTag, CheckButton> dict;
+ private TeamSubCategory subcat;
+ private TeamsTagStore tags;
+ private string subcategory, localTeam, visitorTeam;
+
+
+ public TeamTaggerWidget (TeamSubCategory subcat, TeamsTagStore tags,
+ string localTeam, string visitorTeam)
+ {
+ this.Build ();
+ this.subcat = subcat;
+ this.tags = tags;
+ this.localTeam = localTeam;
+ this.visitorTeam = visitorTeam;
+ Title = subcat.Name;
+ dict = new Dictionary<TeamTag, CheckButton>();
+ AddTagWidget(new TeamTag{Value=Team.LOCAL, SubCategory=subcat});
+ AddTagWidget(new TeamTag{Value=Team.VISITOR, SubCategory=subcat});
+ UpdateTags();
+ }
+
+ private void UpdateTags () {
+ foreach (var tag in tags.GetTags(subcat)) {
+ if (dict.ContainsKey(tag))
+ dict[tag].Active = true;
+ }
+ }
+
+ private void AddTagWidget (TeamTag tag){
+ CheckButton button = new CheckButton(tag.Value == Team.LOCAL ? localTeam : visitorTeam );
+ button.Toggled += delegate(object sender, EventArgs e) {
+ if (button.Active) {
+ tags.Add(tag);
+ } else
+ tags.Remove(tag);
+ };
+ dict.Add(tag, button);
+ buttonsbox.PackStart(button, false, false, 0);
+ button.ShowAll();
+ }
+
+ private string Title {
+ set {
+ titlelabel.Markup = "<b>" + value + "</b>";
+ }
+ }
+ }
+}
+
diff --git a/LongoMatch/Gui/Dialog/TaggerDialog.cs b/LongoMatch/Gui/Dialog/TaggerDialog.cs
index 5698731..865737b 100644
--- a/LongoMatch/Gui/Dialog/TaggerDialog.cs
+++ b/LongoMatch/Gui/Dialog/TaggerDialog.cs
@@ -34,7 +34,7 @@ namespace LongoMatch.Gui.Dialog
private TeamTemplate localTeamTemplate;
private TeamTemplate visitorTeamTemplate;
- public TaggerDialog(Category cat, StringTagStore tags, PlayersTagStore players,
+ public TaggerDialog(Category cat, StringTagStore tags, PlayersTagStore players, TeamsTagStore teams,
TeamTemplate localTeamTemplate, TeamTemplate visitorTeamTemplate)
{
this.Build();
@@ -54,10 +54,22 @@ namespace LongoMatch.Gui.Dialog
} else if (subcat is PlayerSubCategory) {
var tagcat = subcat as PlayerSubCategory;
AddPlayerSubcategory(tagcat, players);
+ } else if (subcat is TeamSubCategory) {
+ var tagcat = subcat as TeamSubCategory;
+ AddTeamSubcategory(tagcat, teams,
+ localTeamTemplate.TeamName,
+ visitorTeamTemplate.TeamName);
}
}
}
+ public void AddTeamSubcategory (TeamSubCategory subcat, TeamsTagStore tags,
+ string localTeam, string visitorTeam){
+ /* the notebook starts invisible */
+ tagsnotebook.Visible = true;
+ taggerwidget1.AddTeamSubCategory(subcat, tags, localTeam, visitorTeam);
+ }
+
public void AddTagSubcategory (TagSubCategory subcat, StringTagStore tags){
/* the notebook starts invisible */
tagsnotebook.Visible = true;
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index d7c11b1..b1b2d94 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -277,7 +277,7 @@ namespace LongoMatch
}
private void LaunchPlayTagger(Play play) {
- TaggerDialog tg = new TaggerDialog(play.Category, play.Tags, play.Players,
+ TaggerDialog tg = new TaggerDialog(play.Category, play.Tags, play.Players, play.Teams,
openedProject.LocalTeamTemplate, openedProject.VisitorTeamTemplate);
tg.TransientFor = (Gtk.Window)treewidget.Toplevel;
tg.Run();
diff --git a/LongoMatch/LongoMatch.mdp b/LongoMatch/LongoMatch.mdp
index db2eec2..b1ee43e 100644
--- a/LongoMatch/LongoMatch.mdp
+++ b/LongoMatch/LongoMatch.mdp
@@ -187,6 +187,8 @@
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.TemplatesManager.cs" />
<File subtype="Code" buildaction="Compile" name="Services/DataBase.cs" />
<File subtype="Code" buildaction="Compile" name="Store/TagStore.cs" />
+ <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.TeamTaggerWidget.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Component/TeamTaggerWidget.cs" />
<File subtype="Code" buildaction="Compile" name="Interfaces/ITag.cs" />
</Contents>
<References>
diff --git a/LongoMatch/Makefile.am b/LongoMatch/Makefile.am
index 8ef7445..e38b961 100644
--- a/LongoMatch/Makefile.am
+++ b/LongoMatch/Makefile.am
@@ -29,6 +29,7 @@ SOURCES = \
gtk-gui/LongoMatch.Gui.Component.StringTaggerWidget.cs \
gtk-gui/LongoMatch.Gui.Component.TaggerWidget.cs \
gtk-gui/LongoMatch.Gui.Component.TagsTreeWidget.cs \
+ gtk-gui/LongoMatch.Gui.Component.TeamTaggerWidget.cs \
gtk-gui/LongoMatch.Gui.Component.TemplatesEditorBase.cs \
gtk-gui/LongoMatch.Gui.Component.TimeLineWidget.cs \
gtk-gui/LongoMatch.Gui.Dialog.BusyDialog.cs \
@@ -71,6 +72,7 @@ SOURCES = \
Gui/Component/StringTaggerWidget.cs \
Gui/Component/TaggerWidget.cs \
Gui/Component/TagsTreeWidget.cs \
+ Gui/Component/TeamTaggerWidget.cs \
Gui/Component/TemplatesEditorBase.cs \
Gui/Component/TimeLineWidget.cs \
Gui/Component/TimeReferenceWidget.cs \
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.TeamTaggerWidget.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.TeamTaggerWidget.cs
new file mode 100644
index 0000000..51a30c8
--- /dev/null
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.TeamTaggerWidget.cs
@@ -0,0 +1,47 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Component
+{
+ public partial class TeamTaggerWidget
+ {
+ private global::Gtk.Frame frame;
+
+ private global::Gtk.Alignment GtkAlignment;
+
+ private global::Gtk.HBox buttonsbox;
+
+ private global::Gtk.Label titlelabel;
+
+ protected virtual void Build ()
+ {
+ global::Stetic.Gui.Initialize (this);
+ // Widget LongoMatch.Gui.Component.TeamTaggerWidget
+ global::Stetic.BinContainer.Attach (this);
+ this.Name = "LongoMatch.Gui.Component.TeamTaggerWidget";
+ // Container child LongoMatch.Gui.Component.TeamTaggerWidget.Gtk.Container+ContainerChild
+ this.frame = new global::Gtk.Frame ();
+ this.frame.Name = "frame";
+ this.frame.ShadowType = ((global::Gtk.ShadowType)(2));
+ // Container child frame.Gtk.Container+ContainerChild
+ this.GtkAlignment = new global::Gtk.Alignment (0f, 0f, 1f, 1f);
+ this.GtkAlignment.Name = "GtkAlignment";
+ this.GtkAlignment.LeftPadding = ((uint)(12));
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ this.buttonsbox = new global::Gtk.HBox ();
+ this.buttonsbox.Name = "buttonsbox";
+ this.buttonsbox.Spacing = 6;
+ this.GtkAlignment.Add (this.buttonsbox);
+ this.frame.Add (this.GtkAlignment);
+ this.titlelabel = new global::Gtk.Label ();
+ this.titlelabel.Name = "titlelabel";
+ this.titlelabel.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>GtkFrame</b>");
+ this.titlelabel.UseMarkup = true;
+ this.frame.LabelWidget = this.titlelabel;
+ this.Add (this.frame);
+ if ((this.Child != null)) {
+ this.Child.ShowAll ();
+ }
+ this.Hide ();
+ }
+ }
+}
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs
index 72e5557..56ed755 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs
@@ -56,7 +56,6 @@ namespace LongoMatch.Gui.Dialog
this.fromfileradiobutton = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("New project using a video file"));
this.fromfileradiobutton.CanFocus = true;
this.fromfileradiobutton.Name = "fromfileradiobutton";
- this.fromfileradiobutton.Active = true;
this.fromfileradiobutton.DrawIndicator = true;
this.fromfileradiobutton.UseUnderline = true;
this.fromfileradiobutton.FocusOnClick = false;
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index de84e9d..62a3d37 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -6381,4 +6381,47 @@ You can continue with the current capture, cancel it or save your project.
</widget>
</child>
</widget>
+ <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.TeamTaggerWidget" design-size="300 25">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <child>
+ <widget class="Gtk.Frame" id="frame">
+ <property name="MemberName" />
+ <property name="ShadowType">Out</property>
+ <child>
+ <widget class="Gtk.Alignment" id="GtkAlignment">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="Yalign">0</property>
+ <property name="LeftPadding">12</property>
+ <child>
+ <widget class="Gtk.HBox" id="buttonsbox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="titlelabel">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes"><b>GtkFrame</b></property>
+ <property name="UseMarkup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</stetic-interface>
\ No newline at end of file
diff --git a/LongoMatch/gtk-gui/objects.xml b/LongoMatch/gtk-gui/objects.xml
index e75aab2..07b38c8 100644
--- a/LongoMatch/gtk-gui/objects.xml
+++ b/LongoMatch/gtk-gui/objects.xml
@@ -278,4 +278,8 @@
<itemgroups />
<signals />
</object>
+ <object type="LongoMatch.Gui.Component.TeamTaggerWidget" 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]