[longomatch] Make the seek bar behave correctly
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Make the seek bar behave correctly
- Date: Mon, 22 Dec 2014 11:46:40 +0000 (UTC)
commit ef8cfa90a44b3def64a75ca98b93afa611249583
Author: Jorge Zapata <jorgeluis zapata gmail com>
Date: Wed Dec 17 18:30:44 2014 +0100
Make the seek bar behave correctly
When mouse's main button is clicked the video jumps to the pointed position
We adapt the seek bar to work continuously so we can handle press/release/value-changed
set of signals instead of the adjust bounds.
LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs | 42 +++++++------------
.../gtk-gui/LongoMatch.Gui.PlayerBin.cs | 1 -
LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic | 1 -
3 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index ad9c30c..7b685ae 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -494,7 +494,6 @@ namespace LongoMatch.Gui
drawbutton.Clicked += OnDrawButtonClicked;
volumebutton.Clicked += OnVolumebuttonClicked;
timescale.ValueChanged += OnTimescaleValueChanged;
- timescale.AdjustBounds += OnTimescaleAdjustBounds;
timescale.ButtonPressEvent += OnTimescaleButtonPress;
timescale.ButtonReleaseEvent += OnTimescaleButtonRelease;
vscale1.FormatValue += OnVscale1FormatValue;
@@ -776,6 +775,13 @@ namespace LongoMatch.Gui
} else {
GtkGlue.EventButtonSetButton(args.Event, 1);
}
+
+ if (!seeking) {
+ seeking = true;
+ IsPlayingPrevState = player.Playing;
+ ignoreTick = true;
+ Pause ();
+ }
}
[GLib.ConnectBefore]
@@ -787,38 +793,22 @@ namespace LongoMatch.Gui
} else {
GtkGlue.EventButtonSetButton(args.Event, 1);
}
- }
-
- void OnTimescaleAdjustBounds (object o, Gtk.AdjustBoundsArgs args)
- {
- double pos;
- if (!seeking) {
- seeking = true;
- IsPlayingPrevState = player.Playing;
- ignoreTick = true;
- Pause ();
- seeksQueue [0] = -1;
- seeksQueue [1] = -1;
+ if (seeking) {
+ seeking = false;
+ ignoreTick = false;
+ if (IsPlayingPrevState)
+ Play ();
}
-
- pos = timescale.Value;
- seeksQueue [0] = seeksQueue [1];
- seeksQueue [1] = pos;
-
- SeekFromTimescale (pos);
}
void OnTimescaleValueChanged (object sender, System.EventArgs e)
{
if (seeking) {
- /* Releasing the timescale always report value different from the real one.
- * We need to cache previous position and seek again to the this position */
- SeekFromTimescale (seeksQueue [0] != -1 ? seeksQueue [0] : seeksQueue [1]);
- seeking = false;
- ignoreTick = false;
- if (IsPlayingPrevState)
- Play ();
+ double pos;
+
+ pos = timescale.Value;
+ SeekFromTimescale (pos);
}
}
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
index 19f7326..ab17238 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
@@ -269,7 +269,6 @@ namespace LongoMatch.Gui
// Container child controlsbox.Gtk.Box+BoxChild
this.timescale = new global::Gtk.HScale (null);
this.timescale.Name = "timescale";
- this.timescale.UpdatePolicy = ((global::Gtk.UpdateType)(1));
this.timescale.Adjustment.Upper = 1;
this.timescale.Adjustment.PageIncrement = 1;
this.timescale.Adjustment.StepIncrement = 1;
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index b957052..07ec842 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -372,7 +372,6 @@
<child>
<widget class="Gtk.HScale" id="timescale">
<property name="MemberName" />
- <property name="UpdatePolicy">Discontinuous</property>
<property name="Upper">1</property>
<property name="PageIncrement">1</property>
<property name="StepIncrement">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]