[longomatch] Add support for moving timenodes as a whole
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add support for moving timenodes as a whole
- Date: Tue, 28 Oct 2014 09:56:34 +0000 (UTC)
commit f844123d6fbfa6f464db9b71f996df2c97c11620
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Oct 28 08:07:30 2014 +0100
Add support for moving timenodes as a whole
LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs | 37 ++++++++++---------
LongoMatch.Drawing/Widgets/TimersTimeline.cs | 4 ++-
2 files changed, 22 insertions(+), 19 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
b/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
index 599fc33..d818a2e 100644
--- a/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TimeNodeObject.cs
@@ -37,7 +37,7 @@ namespace LongoMatch.Drawing.CanvasObjects
SelectWhole = true;
LineColor = Config.Style.PaletteBackgroundLight;
}
-
+
protected override void Dispose (bool disposing)
{
base.Dispose (disposing);
@@ -76,7 +76,7 @@ namespace LongoMatch.Drawing.CanvasObjects
get;
set;
}
-
+
public double Height {
get {
return StyleConf.TimelineCategoryHeight;
@@ -149,23 +149,24 @@ namespace LongoMatch.Drawing.CanvasObjects
switch (sel.Position) {
case SelectionPosition.Left:
- {
- if (newTime.MSeconds + MAX_TIME_SPAN > TimeNode.Stop.MSeconds) {
- TimeNode.Start.MSeconds = TimeNode.Stop.MSeconds -
MAX_TIME_SPAN;
- } else {
- TimeNode.Start = newTime;
- }
- break;
+ if (newTime.MSeconds + MAX_TIME_SPAN > TimeNode.Stop.MSeconds) {
+ TimeNode.Start.MSeconds = TimeNode.Stop.MSeconds - MAX_TIME_SPAN;
+ } else {
+ TimeNode.Start = newTime;
}
+ break;
case SelectionPosition.Right:
- {
- if (newTime.MSeconds - MAX_TIME_SPAN < TimeNode.Start.MSeconds) {
- TimeNode.Stop.MSeconds = TimeNode.Start.MSeconds +
MAX_TIME_SPAN;
- } else {
- TimeNode.Stop = newTime;
- }
- break;
+ if (newTime.MSeconds - MAX_TIME_SPAN < TimeNode.Start.MSeconds) {
+ TimeNode.Stop.MSeconds = TimeNode.Start.MSeconds + MAX_TIME_SPAN;
+ } else {
+ TimeNode.Stop = newTime;
}
+ break;
+ case SelectionPosition.All:
+ Time diff = Utils.PosToTime (new Point (p.X - start.X, p.Y), SecondsPerPixel);
+ TimeNode.Start += diff;
+ TimeNode.Stop += diff;
+ break;
}
movingPos = sel.Position;
}
@@ -219,14 +220,14 @@ namespace LongoMatch.Drawing.CanvasObjects
tk.End ();
}
}
-
+
public class TimerTimeNodeObject: TimeNodeObject
{
public TimerTimeNodeObject (Timer t, TimeNode tn): base (tn)
{
Timer = t;
}
-
+
public Timer Timer {
get;
set;
diff --git a/LongoMatch.Drawing/Widgets/TimersTimeline.cs b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
index 09bda17..39ef2b9 100644
--- a/LongoMatch.Drawing/Widgets/TimersTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
@@ -97,7 +97,9 @@ namespace LongoMatch.Drawing.Widgets
if (sel == null)
return;
- if (sel.Position != SelectionPosition.All) {
+ if (sel.Position == SelectionPosition.All) {
+ widget.SetCursor (CursorType.Selection);
+ } else {
widget.SetCursor (CursorType.DoubleArrow);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]