[longomatch] Added extra keyboard shortcuts to the video player
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Added extra keyboard shortcuts to the video player
- Date: Thu, 25 Mar 2010 20:49:59 +0000 (UTC)
commit 767223d4e071a71143dbc135b6e5b77729ecbf41
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sat Mar 20 21:17:59 2010 +0100
Added extra keyboard shortcuts to the video player
CesarPlayer/Gui/PlayerBin.cs | 35 ++++++++++++++++--
CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs | 12 +++---
CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs | 39 ++++++++++----------
CesarPlayer/gtk-gui/gui.stetic | 3 +-
LongoMatch/Common/Constants.cs | 15 ++++++++
LongoMatch/Gui/MainWindow.cs | 27 ++++++++++++--
...LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs | 12 +++++-
7 files changed, 106 insertions(+), 37 deletions(-)
---
diff --git a/CesarPlayer/Gui/PlayerBin.cs b/CesarPlayer/Gui/PlayerBin.cs
index a62e1e3..65ac177 100644
--- a/CesarPlayer/Gui/PlayerBin.cs
+++ b/CesarPlayer/Gui/PlayerBin.cs
@@ -71,7 +71,7 @@ namespace LongoMatch.Gui
vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
controlsbox.Visible = false;
UnSensitive();
- timescale.Adjustment.PageIncrement = 0.0001;
+ timescale.Adjustment.PageIncrement = 0.01;
timescale.Adjustment.StepIncrement = 0.0001;
}
@@ -173,6 +173,13 @@ namespace LongoMatch.Gui
player.Pause();
}
+ public void TogglePlay(){
+ if (player.Playing)
+ Pause();
+ else
+ Play();
+ }
+
public void SetLogo (string filename){
player.Logo=filename;
}
@@ -243,6 +250,28 @@ namespace LongoMatch.Gui
}
}
+ public void StepForward(){
+ seeking = true;
+ timescale.Adjustment.Value += timescale.Adjustment.PageIncrement;
+ OnTimescaleAdjustBounds(null, null);
+ seeking = false;
+ }
+
+ public void StepBackward(){
+ seeking = true;
+ timescale.Adjustment.Value -= timescale.Adjustment.PageIncrement;
+ OnTimescaleAdjustBounds(null, null);
+ seeking = false;
+ }
+
+ public void FramerateUp(){
+ vscale1.Adjustment.Value += vscale1.Adjustment.StepIncrement;
+ }
+
+ public void FramerateDown(){
+ vscale1.Adjustment.Value -= vscale1.Adjustment.StepIncrement;
+ }
+
public void UpdateSegmentStartTime (long start){
segmentStartTime = start;
player.SegmentStartUpdate(start, GetRateFromScale());
@@ -326,7 +355,7 @@ namespace LongoMatch.Gui
playerWidget = (Widget)player;
playerWidget.ButtonPressEvent += new ButtonPressEventHandler(OnVideoboxButtonPressEvent);
playerWidget.Show();
- videobox.Add(playerWidget);
+ videobox.Add(playerWidget);
}
@@ -385,7 +414,7 @@ namespace LongoMatch.Gui
protected virtual void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
{
float pos;
-
+
if (!seeking){
seeking = true;
IsPlayingPrevState = player.Playing;
diff --git a/CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs b/CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs
index ab24958..ffc5372 100644
--- a/CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs
+++ b/CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs
@@ -92,14 +92,14 @@ namespace LongoMatch.Gui {
this.pausebutton.UseUnderline = true;
// Container child pausebutton.Gtk.Container+ContainerChild
Gtk.Alignment w12 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment1.Gtk.Container+ContainerChild
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
Gtk.HBox w13 = new Gtk.HBox();
w13.Spacing = 2;
- // Container child GtkHBox1.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Image w14 = new Gtk.Image();
w14.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-pause", Gtk.IconSize.Dialog, 48);
w13.Add(w14);
- // Container child GtkHBox1.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Label w16 = new Gtk.Label();
w13.Add(w16);
w12.Add(w13);
@@ -116,14 +116,14 @@ namespace LongoMatch.Gui {
this.stopbutton.UseUnderline = true;
// Container child stopbutton.Gtk.Container+ContainerChild
Gtk.Alignment w21 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment2.Gtk.Container+ContainerChild
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
Gtk.HBox w22 = new Gtk.HBox();
w22.Spacing = 2;
- // Container child GtkHBox2.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Image w23 = new Gtk.Image();
w23.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-stop", Gtk.IconSize.Dialog, 48);
w22.Add(w23);
- // Container child GtkHBox2.Gtk.Container+ContainerChild
+ // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Label w25 = new Gtk.Label();
w22.Add(w25);
w21.Add(w22);
diff --git a/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
index 614fc41..b47308e 100644
--- a/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
+++ b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
@@ -106,14 +106,14 @@ namespace LongoMatch.Gui {
this.drawbutton.UseUnderline = true;
// Container child drawbutton.Gtk.Container+ContainerChild
Gtk.Alignment w11 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment.Gtk.Container+ContainerChild
+ // Container child GtkAlignment1.Gtk.Container+ContainerChild
Gtk.HBox w12 = new Gtk.HBox();
w12.Spacing = 2;
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox1.Gtk.Container+ContainerChild
Gtk.Image w13 = new Gtk.Image();
w13.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-select-color", Gtk.IconSize.Menu, 16);
w12.Add(w13);
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox1.Gtk.Container+ContainerChild
Gtk.Label w15 = new Gtk.Label();
w12.Add(w15);
w11.Add(w12);
@@ -131,14 +131,14 @@ namespace LongoMatch.Gui {
this.playbutton.Relief = ((Gtk.ReliefStyle)(2));
// Container child playbutton.Gtk.Container+ContainerChild
Gtk.Alignment w20 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment.Gtk.Container+ContainerChild
+ // Container child GtkAlignment2.Gtk.Container+ContainerChild
Gtk.HBox w21 = new Gtk.HBox();
w21.Spacing = 2;
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox2.Gtk.Container+ContainerChild
Gtk.Image w22 = new Gtk.Image();
w22.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-play", Gtk.IconSize.Button, 20);
w21.Add(w22);
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox2.Gtk.Container+ContainerChild
Gtk.Label w24 = new Gtk.Label();
w21.Add(w24);
w20.Add(w21);
@@ -156,14 +156,14 @@ namespace LongoMatch.Gui {
this.pausebutton.Relief = ((Gtk.ReliefStyle)(2));
// Container child pausebutton.Gtk.Container+ContainerChild
Gtk.Alignment w29 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment.Gtk.Container+ContainerChild
+ // Container child GtkAlignment3.Gtk.Container+ContainerChild
Gtk.HBox w30 = new Gtk.HBox();
w30.Spacing = 2;
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox3.Gtk.Container+ContainerChild
Gtk.Image w31 = new Gtk.Image();
w31.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-pause", Gtk.IconSize.Button, 20);
w30.Add(w31);
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox3.Gtk.Container+ContainerChild
Gtk.Label w33 = new Gtk.Label();
w30.Add(w33);
w29.Add(w30);
@@ -181,14 +181,14 @@ namespace LongoMatch.Gui {
this.prevbutton.Relief = ((Gtk.ReliefStyle)(2));
// Container child prevbutton.Gtk.Container+ContainerChild
Gtk.Alignment w38 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment.Gtk.Container+ContainerChild
+ // Container child GtkAlignment4.Gtk.Container+ContainerChild
Gtk.HBox w39 = new Gtk.HBox();
w39.Spacing = 2;
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox4.Gtk.Container+ContainerChild
Gtk.Image w40 = new Gtk.Image();
w40.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-previous", Gtk.IconSize.Button, 20);
w39.Add(w40);
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox4.Gtk.Container+ContainerChild
Gtk.Label w42 = new Gtk.Label();
w39.Add(w42);
w38.Add(w39);
@@ -207,14 +207,14 @@ namespace LongoMatch.Gui {
this.nextbutton.Relief = ((Gtk.ReliefStyle)(2));
// Container child nextbutton.Gtk.Container+ContainerChild
Gtk.Alignment w47 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment.Gtk.Container+ContainerChild
+ // Container child GtkAlignment5.Gtk.Container+ContainerChild
Gtk.HBox w48 = new Gtk.HBox();
w48.Spacing = 2;
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox5.Gtk.Container+ContainerChild
Gtk.Image w49 = new Gtk.Image();
w49.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-next", Gtk.IconSize.Button, 20);
w48.Add(w49);
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox5.Gtk.Container+ContainerChild
Gtk.Label w51 = new Gtk.Label();
w48.Add(w51);
w47.Add(w48);
@@ -240,12 +240,12 @@ namespace LongoMatch.Gui {
w57.Fill = false;
// Container child controlsbox.Gtk.Box+BoxChild
this.timescale = new Gtk.HScale(null);
- this.timescale.CanFocus = true;
this.timescale.Name = "timescale";
this.timescale.UpdatePolicy = ((Gtk.UpdateType)(1));
this.timescale.Adjustment.Upper = 1;
this.timescale.Adjustment.PageIncrement = 1;
this.timescale.Adjustment.StepIncrement = 1;
+ this.timescale.Adjustment.Value = 1;
this.timescale.DrawValue = false;
this.timescale.Digits = 0;
this.timescale.ValuePos = ((Gtk.PositionType)(2));
@@ -267,14 +267,14 @@ namespace LongoMatch.Gui {
this.volumebutton.Relief = ((Gtk.ReliefStyle)(2));
// Container child volumebutton.Gtk.Container+ContainerChild
Gtk.Alignment w60 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
- // Container child GtkAlignment.Gtk.Container+ContainerChild
+ // Container child GtkAlignment6.Gtk.Container+ContainerChild
Gtk.HBox w61 = new Gtk.HBox();
w61.Spacing = 2;
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox6.Gtk.Container+ContainerChild
Gtk.Image w62 = new Gtk.Image();
w62.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_volume", Gtk.IconSize.Button, 20);
w61.Add(w62);
- // Container child GtkHBox.Gtk.Container+ContainerChild
+ // Container child GtkHBox6.Gtk.Container+ContainerChild
Gtk.Label w64 = new Gtk.Label();
w61.Add(w64);
w60.Add(w61);
@@ -299,7 +299,6 @@ namespace LongoMatch.Gui {
this.vscale1 = new Gtk.VScale(null);
this.vscale1.WidthRequest = 45;
this.vscale1.Sensitive = false;
- this.vscale1.CanFocus = true;
this.vscale1.Name = "vscale1";
this.vscale1.UpdatePolicy = ((Gtk.UpdateType)(1));
this.vscale1.Inverted = true;
diff --git a/CesarPlayer/gtk-gui/gui.stetic b/CesarPlayer/gtk-gui/gui.stetic
index cab74b0..b828c04 100644
--- a/CesarPlayer/gtk-gui/gui.stetic
+++ b/CesarPlayer/gtk-gui/gui.stetic
@@ -237,11 +237,11 @@
<child>
<widget class="Gtk.HScale" id="timescale">
<property name="MemberName" />
- <property name="CanFocus">True</property>
<property name="UpdatePolicy">Discontinuous</property>
<property name="Upper">1</property>
<property name="PageIncrement">1</property>
<property name="StepIncrement">1</property>
+ <property name="Value">1</property>
<property name="DrawValue">False</property>
<property name="Digits">0</property>
<property name="ValuePos">Top</property>
@@ -303,7 +303,6 @@
<property name="MemberName" />
<property name="WidthRequest">45</property>
<property name="Sensitive">False</property>
- <property name="CanFocus">True</property>
<property name="UpdatePolicy">Discontinuous</property>
<property name="Inverted">True</property>
<property name="Lower">1</property>
diff --git a/LongoMatch/Common/Constants.cs b/LongoMatch/Common/Constants.cs
index 9eadbc0..624891c 100644
--- a/LongoMatch/Common/Constants.cs
+++ b/LongoMatch/Common/Constants.cs
@@ -17,6 +17,7 @@
//
using System;
+using Gdk;
namespace LongoMatch.Common
{
@@ -48,5 +49,19 @@ Matej UrbanÄ?iÄ? (sl)";
public const int THUMBNAIL_MAX_HEIGHT = 100;
public const string WEBSITE = "http://www.longomatch.ylatuya.es";
+
+ public const Key PREV_FRAME = Gdk.Key.z;
+
+ public const Key NEXT_FRAME = Gdk.Key.x;
+
+ public const Key STEP_BACKWARD = Gdk.Key.a;
+
+ public const Key STEP_FORWARD = Gdk.Key.s;
+
+ public const Key FRAMERATE_UP = Gdk.Key.n;
+
+ public const Key FRAMERATE_DOWN = Gdk.Key.m;
+
+ public const Key TOGGLE_PLAY = Gdk.Key.space;
}
}
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index b7aa3a7..c962066 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -465,10 +465,29 @@ namespace LongoMatch.Gui
{
if (openedProject != null && evnt.State == ModifierType.None) {
Gdk.Key key = evnt.Key;
- if (key == Gdk.Key.z)
- playerbin1.SeekToPreviousFrame(selectedTimeNode != null);
- if (key == Gdk.Key.x)
- playerbin1.SeekToNextFrame(selectedTimeNode != null);
+ switch (key){
+ case Constants.PREV_FRAME:
+ playerbin1.SeekToPreviousFrame(selectedTimeNode != null);
+ break;
+ case Constants.NEXT_FRAME:
+ playerbin1.SeekToNextFrame(selectedTimeNode != null);
+ break;
+ case Constants.STEP_FORWARD:
+ playerbin1.StepForward();
+ break;
+ case Constants.STEP_BACKWARD:
+ playerbin1.StepBackward();
+ break;
+ case Constants.FRAMERATE_UP:
+ playerbin1.FramerateUp();
+ break;
+ case Constants.FRAMERATE_DOWN:
+ playerbin1.FramerateDown();
+ break;
+ case Constants.TOGGLE_PLAY:
+ playerbin1.TogglePlay();
+ break;
+ }
}
return base.OnKeyPressEvent(evnt);
}
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs
index 4920c4f..1280df1 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectSelectionDialog.cs
@@ -59,6 +59,7 @@ namespace LongoMatch.Gui.Dialog {
// Container child hbox1.Gtk.Box+BoxChild
this.image61 = new Gtk.Image();
this.image61.Name = "image61";
+ this.image61.Pixbuf = Gdk.Pixbuf.LoadFromResource("video.png");
this.hbox1.Add(this.image61);
Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.image61]));
w2.Position = 0;
@@ -67,6 +68,7 @@ namespace LongoMatch.Gui.Dialog {
// Container child hbox1.Gtk.Box+BoxChild
this.label1 = new Gtk.Label();
this.label1.Name = "label1";
+ this.label1.Xalign = 0F;
this.label1.LabelProp = Mono.Unix.Catalog.GetString("New project using a video file");
this.hbox1.Add(this.label1);
Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1]));
@@ -75,8 +77,10 @@ namespace LongoMatch.Gui.Dialog {
this.fromfileradiobutton = new Gtk.RadioButton("");
this.fromfileradiobutton.CanFocus = true;
this.fromfileradiobutton.Name = "fromfileradiobutton";
+ this.fromfileradiobutton.Active = true;
this.fromfileradiobutton.DrawIndicator = true;
this.fromfileradiobutton.UseUnderline = true;
+ this.fromfileradiobutton.FocusOnClick = false;
this.fromfileradiobutton.Group = new GLib.SList(System.IntPtr.Zero);
this.hbox1.Add(this.fromfileradiobutton);
Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.hbox1[this.fromfileradiobutton]));
@@ -95,6 +99,7 @@ namespace LongoMatch.Gui.Dialog {
// Container child hbox2.Gtk.Box+BoxChild
this.image62 = new Gtk.Image();
this.image62.Name = "image62";
+ this.image62.Pixbuf = Gdk.Pixbuf.LoadFromResource("camera-video.png");
this.hbox2.Add(this.image62);
Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox2[this.image62]));
w6.Position = 0;
@@ -103,6 +108,7 @@ namespace LongoMatch.Gui.Dialog {
// Container child hbox2.Gtk.Box+BoxChild
this.label2 = new Gtk.Label();
this.label2.Name = "label2";
+ this.label2.Xalign = 0F;
this.label2.LabelProp = Mono.Unix.Catalog.GetString("Live project using a fake capture device");
this.hbox2.Add(this.label2);
Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2]));
@@ -127,6 +133,8 @@ namespace LongoMatch.Gui.Dialog {
w1.Add(this.vbox2);
Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(w1[this.vbox2]));
w10.Position = 0;
+ w10.Expand = false;
+ w10.Fill = false;
// Internal child LongoMatch.Gui.Dialog.ProjectSelectionDialog.ActionArea
Gtk.HButtonBox w11 = this.ActionArea;
w11.Name = "dialog1_ActionArea";
@@ -161,8 +169,8 @@ namespace LongoMatch.Gui.Dialog {
if ((this.Child != null)) {
this.Child.ShowAll();
}
- this.DefaultWidth = 400;
- this.DefaultHeight = 186;
+ this.DefaultWidth = 355;
+ this.DefaultHeight = 138;
this.Show();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]