[longomatch] Add some new events to inform about video window dragging.
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add some new events to inform about video window dragging.
- Date: Mon, 27 Apr 2015 22:20:57 +0000 (UTC)
commit a56771920d9d233ef0f9e9a6320e7b5c3a06be84
Author: Julien Moutte <julien fluendo com>
Date: Thu Apr 23 19:10:20 2015 +0200
Add some new events to inform about video window dragging.
We will use those to move the ROI.
LongoMatch.GUI.Multimedia/Gui/VideoWindow.cs | 50 +++++++++++++++++++++++-
LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic | 2 +
LongoMatch.GUI.Multimedia/gtk-gui/objects.xml | 4 ++
3 files changed, 53 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.GUI.Multimedia/Gui/VideoWindow.cs b/LongoMatch.GUI.Multimedia/Gui/VideoWindow.cs
index efac1c4..5b66dbb 100644
--- a/LongoMatch.GUI.Multimedia/Gui/VideoWindow.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/VideoWindow.cs
@@ -28,32 +28,47 @@ namespace LongoMatch.Gui
{
AspectFrame frame;
DrawingArea drawingWindow;
+ bool dragStarted;
public event EventHandler ReadyEvent;
public new event ExposeEventHandler ExposeEvent;
public new event ButtonPressEventHandler ButtonPressEvent;
+ public new event ButtonReleaseEventHandler ButtonReleaseEvent;
public new event ScrollEventHandler ScrollEvent;
+ public event ButtonPressEventHandler VideoDragStarted;
+ public event ButtonReleaseEventHandler VideoDragStopped;
+ public new event MotionNotifyEventHandler VideoDragged;
public VideoWindow ()
{
this.Build ();
+
frame = new AspectFrame (null, 0.5f, 0.5f, 1f, false);
frame.Shadow = ShadowType.None;
messageLabel.NoShowAll = true;
+
drawingWindow = new DrawingArea ();
drawingWindow.DoubleBuffered = false;
drawingWindow.ExposeEvent += HandleExposeEvent;
+ drawingWindow.MotionNotifyEvent += HandleMotionNotifyEvent;
+ drawingWindow.ButtonPressEvent += HandleButtonPressEvent;
+ drawingWindow.ButtonReleaseEvent += HandleButtonReleaseEvent;
+ drawingWindow.AddEvents ((int)(Gdk.EventMask.ButtonPressMask |
Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.ScrollMask));
+
videoeventbox.ButtonPressEvent += HandleButtonPressEvent;
+ videoeventbox.ButtonReleaseEvent += HandleButtonReleaseEvent;
videoeventbox.ScrollEvent += HandleScrollEvent;
videoeventbox.BorderWidth = 0;
if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
// Workaround for GTK bugs on Windows not showing the video window
videoeventbox.VisibilityNotifyEvent += HandleVisibilityNotifyEvent;
}
+
frame.Add (drawingWindow);
videoeventbox.Add (frame);
videoeventbox.ShowAll ();
+
MessageVisible = false;
}
@@ -111,12 +126,20 @@ namespace LongoMatch.Gui
set;
}
+ void HandleMotionNotifyEvent (object o, MotionNotifyEventArgs args)
+ {
+ if (dragStarted == true) {
+ if (VideoDragged != null) {
+ VideoDragged (this, args);
+ }
+ }
+ }
+
void HandleScrollEvent (object o, ScrollEventArgs args)
{
if (ScrollEvent != null) {
ScrollEvent (this, args);
}
-
}
void HandleExposeEvent (object o, ExposeEventArgs args)
@@ -134,8 +157,29 @@ namespace LongoMatch.Gui
void HandleButtonPressEvent (object o, ButtonPressEventArgs args)
{
- if (ButtonPressEvent != null) {
- ButtonPressEvent (this, args);
+ if (o == drawingWindow) {
+ dragStarted = true;
+ if (VideoDragStarted != null) {
+ VideoDragStarted (this, args);
+ }
+ } else {
+ if (ButtonPressEvent != null) {
+ ButtonPressEvent (this, args);
+ }
+ }
+ }
+
+ void HandleButtonReleaseEvent (object o, ButtonReleaseEventArgs args)
+ {
+ if (o == drawingWindow) {
+ dragStarted = false;
+ if (VideoDragStopped != null) {
+ VideoDragStopped (this, args);
+ }
+ } else {
+ if (ButtonReleaseEvent != null) {
+ ButtonReleaseEvent (this, args);
+ }
}
}
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index 648adfa..963c278 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -93,6 +93,7 @@
<property name="MemberName" />
<property name="Visible">False</property>
<property name="Events">ButtonPressMask</property>
+ <property name="Ratio">0</property>
<property name="Ready">False</property>
</widget>
<packing>
@@ -437,6 +438,7 @@
<property name="MemberName" />
<property name="Visible">False</property>
<property name="Events">ButtonPressMask</property>
+ <property name="Ratio">0</property>
<property name="Ready">False</property>
</widget>
<packing>
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml b/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
index 98ea6dc..53e3a2c 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
@@ -27,6 +27,10 @@
<signal name="ExposeEvent" />
<signal name="ButtonPressEvent" />
<signal name="ScrollEvent" />
+ <signal name="ButtonReleaseEvent" />
+ <signal name="VideoDragged" />
+ <signal name="VideoDragStarted" />
+ <signal name="VideoDragStopped" />
</itemgroup>
</signals>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]