[longomatch] Add event to notify about camera selection changes.
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add event to notify about camera selection changes.
- Date: Wed, 18 Mar 2015 14:43:33 +0000 (UTC)
commit 5ba6244c7bd28f534eee30e77c70fa14667c7643
Author: Julien Moutte <julien fluendo com>
Date: Sat Mar 14 13:50:18 2015 +0100
Add event to notify about camera selection changes.
This will be useful to optimise the behaviour of the ProjectPeriods widget.
LongoMatch.Drawing/Widgets/CamerasTimeline.cs | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Drawing/Widgets/CamerasTimeline.cs b/LongoMatch.Drawing/Widgets/CamerasTimeline.cs
index c389c10..6e3d227 100644
--- a/LongoMatch.Drawing/Widgets/CamerasTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/CamerasTimeline.cs
@@ -15,6 +15,7 @@
// 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.Linq;
using LongoMatch.Core.Store;
using LongoMatch.Drawing.CanvasObjects;
@@ -30,6 +31,7 @@ namespace LongoMatch.Drawing.Widgets
{
// For cameras
public event CameraDraggedHandler CameraDragged;
+ public event EventHandler SelectedCameraChanged;
// And periods
public event TimeNodeChangedHandler TimeNodeChanged;
public event ShowTimerMenuHandler ShowTimerMenuEvent;
@@ -86,6 +88,17 @@ namespace LongoMatch.Drawing.Widgets
}
}
+ public CameraObject SelectedCamera {
+ get {
+ Selection sel = Selections.FirstOrDefault ();
+
+ if (sel != null && sel.Drawable is CameraObject)
+ return sel.Drawable as CameraObject;
+ else
+ return null;
+ }
+ }
+
void Update ()
{
double width;
@@ -168,6 +181,14 @@ namespace LongoMatch.Drawing.Widgets
}
}
+ protected override void SelectionChanged (List<Selection> sel)
+ {
+ // Fire an event
+ if (SelectedCameraChanged != null) {
+ SelectedCameraChanged (this, new EventArgs ());
+ }
+ }
+
protected override void ShowMenu (Point coords)
{
if (ShowTimerMenuEvent != null) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]