[longomatch] Redraw dashboard buttons when the properties change
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Redraw dashboard buttons when the properties change
- Date: Tue, 14 Oct 2014 15:47:00 +0000 (UTC)
commit bc283e91f650faa6659dd4b0be13d59772e68ae5
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Oct 13 14:48:17 2014 +0200
Redraw dashboard buttons when the properties change
LongoMatch.Drawing/Widgets/DashboardCanvas.cs | 21 +++++++++++++++++++--
LongoMatch.GUI/Gui/Component/DashboardWidget.cs | 11 ++++++++---
2 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
index a8ce982..d51ae71 100644
--- a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
+++ b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
@@ -42,6 +42,7 @@ namespace LongoMatch.Drawing.Widgets
Time currentTime;
int templateWidth, templateHeight;
FitMode fitMode;
+ bool modeChanged;
public DashboardCanvas (IWidget widget): base (widget)
{
@@ -97,6 +98,7 @@ namespace LongoMatch.Drawing.Widgets
public TagMode TagMode {
set {
+ modeChanged = true;
tagMode = value;
ObjectsCanMove = tagMode == TagMode.Edit;
foreach (TaggerObject to in Objects) {
@@ -113,12 +115,23 @@ namespace LongoMatch.Drawing.Widgets
set {
fitMode = value;
Refresh ();
+ modeChanged = true;
}
get {
return fitMode;
}
}
+ public void RedrawButton (DashboardButton b)
+ {
+ if (b is AnalysisEventButton) {
+ CategoryObject co = Objects.OfType<CategoryObject> ().FirstOrDefault (o =>
o.Button == b);
+ if (co != null) {
+ co.ReDraw ();
+ }
+ }
+ }
+
public void Refresh (DashboardButton b = null)
{
TaggerObject to;
@@ -263,6 +276,7 @@ namespace LongoMatch.Drawing.Widgets
void SizeChanged ()
{
+ FitMode prevFitMode = FitMode;
templateHeight = template.CanvasHeight + 10;
templateWidth = template.CanvasWidth + 10;
/* When going from Original to Fill or Fit, we can't know the new
@@ -281,8 +295,11 @@ namespace LongoMatch.Drawing.Widgets
(int)widget.Width, (int)widget.Height,
out scaleX, out scaleY, out translation);
}
- foreach (TaggerObject to in Objects) {
- to.ResetDrawArea ();
+ if (modeChanged) {
+ modeChanged = false;
+ foreach (TaggerObject to in Objects) {
+ to.ResetDrawArea ();
+ }
}
widget.ReDraw ();
}
diff --git a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
index 111ad2b..bf34a42 100644
--- a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
@@ -75,7 +75,7 @@ namespace LongoMatch.Gui.Component
resetfieldbutton.Clicked += HandleResetField;
resethfieldbutton.Clicked += HandleResetField;
resetgoalbutton.Clicked += HandleResetField;
- tagproperties.EditedEvent += (sender, e) => {drawingarea.QueueDraw();};
+ tagproperties.EditedEvent += HandlePropertiedEditedEvent;
addcatbutton.Clicked += HandleAddClicked;
addtimerbutton.Clicked += HandleAddClicked;
addscorebutton.Clicked += HandleAddClicked;
@@ -121,7 +121,6 @@ namespace LongoMatch.Gui.Component
dashscrolledwindow.VscrollbarPolicy = PolicyType.Never;
}
tagger.FitMode = value;
- drawingarea.QueueResize ();
ignoreChanges = false;
}
}
@@ -333,7 +332,6 @@ namespace LongoMatch.Gui.Component
void HandleTick (Time currentTime)
{
tagger.CurrentTime = currentTime;
- drawingarea.QueueDraw ();
}
void HandleKeyPressEvent (object o, KeyPressEventArgs args)
@@ -435,5 +433,12 @@ namespace LongoMatch.Gui.Component
}
}
+
+ void HandlePropertiedEditedEvent (object sender, EventArgs e)
+ {
+ if (selected != null) {
+ tagger.RedrawButton (selected);
+ }
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]