[longomatch/redesign: 77/96] Format everything properly with astyle
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/redesign: 77/96] Format everything properly with astyle
- Date: Tue, 29 Mar 2011 18:22:13 +0000 (UTC)
commit 46d8184a3b3b7585fe5358cd382ff9d49a8f92ee
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Feb 10 01:11:24 2011 +0100
Format everything properly with astyle
CesarPlayer/Capturer/CaptureProperties.cs | 14 +-
CesarPlayer/Capturer/FakeCapturer.cs | 118 ++--
CesarPlayer/Capturer/GstCameraCapturer.cs | 316 ++++----
CesarPlayer/Capturer/ICapturer.cs | 44 +-
CesarPlayer/Capturer/LiveSourceTimer.cs | 60 +-
CesarPlayer/Capturer/ObjectManager.cs | 8 +-
CesarPlayer/Common/Constants.cs | 14 +-
CesarPlayer/Common/Enum.cs | 54 +-
CesarPlayer/Common/Handlers.cs | 62 +-
CesarPlayer/Editor/EditorState.cs | 14 +-
CesarPlayer/Editor/GstVideoSplitter.cs | 294 ++++----
CesarPlayer/Editor/IVideoEditor.cs | 66 +-
CesarPlayer/Editor/IVideoSplitter.cs | 56 +-
CesarPlayer/Editor/VideoSegment.cs | 68 +-
CesarPlayer/Gui/CapturerBin.cs | 228 +++---
CesarPlayer/Gui/PlayerBin.cs | 612 ++++++++--------
CesarPlayer/Gui/VolumeWindow.cs | 28 +-
CesarPlayer/MultimediaFactory.cs | 132 ++--
CesarPlayer/Player/GstDVDEvent.cs | 6 +-
CesarPlayer/Player/GstPlayer.cs | 602 ++++++++--------
CesarPlayer/Player/IPlayer.cs | 108 ++--
CesarPlayer/Player/ObjectManager.cs | 10 +-
CesarPlayer/Utils/Device.cs | 50 +-
CesarPlayer/Utils/FramesCapturer.cs | 68 +-
CesarPlayer/Utils/IFramesCapturer.cs | 8 +-
CesarPlayer/Utils/IMetadataReader.cs | 6 +-
CesarPlayer/Utils/MediaFile.cs | 197 +++--
CesarPlayer/Utils/PreviewMediaFile.cs | 92 ++--
CesarPlayer/Utils/TimeString.cs | 98 ++--
LongoMatch/Common/Cairo.cs | 32 +-
LongoMatch/Common/ConsoleCrayon.cs | 465 ++++++------
LongoMatch/Common/Constants.cs | 46 +-
LongoMatch/Common/Enums.cs | 10 +-
LongoMatch/Common/Log.cs | 788 ++++++++++----------
LongoMatch/Common/SerializableObject.cs | 10 +-
LongoMatch/DB/DataBase.cs | 68 +-
LongoMatch/Gui/Component/ButtonsWidget.cs | 42 +-
LongoMatch/Gui/Component/CategoriesScale.cs | 46 +-
LongoMatch/Gui/Component/CategoryProperties.cs | 14 +-
LongoMatch/Gui/Component/DrawingToolBox.cs | 26 +-
LongoMatch/Gui/Component/DrawingWidget.cs | 112 ++--
LongoMatch/Gui/Component/NotesWidget.cs | 6 +-
LongoMatch/Gui/Component/PlayListWidget.cs | 64 +-
LongoMatch/Gui/Component/PlayerProperties.cs | 34 +-
LongoMatch/Gui/Component/PlayersListTreeWidget.cs | 52 +-
LongoMatch/Gui/Component/PlaysListTreeWidget.cs | 74 +-
LongoMatch/Gui/Component/ProjectDetailsWidget.cs | 205 +++---
LongoMatch/Gui/Component/ProjectListWidget.cs | 50 +-
LongoMatch/Gui/Component/ProjectTemplateWidget.cs | 56 +-
LongoMatch/Gui/Component/TaggerWidget.cs | 76 +-
LongoMatch/Gui/Component/TagsTreeWidget.cs | 120 ++--
LongoMatch/Gui/Component/TeamTemplateWidget.cs | 2 +-
LongoMatch/Gui/Component/TimeAdjustWidget.cs | 4 +-
LongoMatch/Gui/Component/TimeLineWidget.cs | 84 +-
LongoMatch/Gui/Component/TimeReferenceWidget.cs | 24 +-
LongoMatch/Gui/Component/TimeScale.cs | 68 +-
LongoMatch/Gui/Dialog/BusyDialog.cs | 28 +-
LongoMatch/Gui/Dialog/DrawingTool.cs | 6 +-
LongoMatch/Gui/Dialog/EditCategoryDialog.cs | 4 +-
LongoMatch/Gui/Dialog/EndCaptureDialog.cs | 22 +-
LongoMatch/Gui/Dialog/EntryDialog.cs | 26 +-
.../Gui/Dialog/FramesCaptureProgressDialog.cs | 8 +-
LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs | 4 +-
LongoMatch/Gui/Dialog/Migrator.cs | 24 +-
LongoMatch/Gui/Dialog/NewProjectDialog.cs | 16 +-
LongoMatch/Gui/Dialog/OpenProjectDialog.cs | 10 +-
LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs | 12 +-
LongoMatch/Gui/Dialog/ProjectSelectionDialog.cs | 30 +-
.../Gui/Dialog/ProjectTemplateEditorDialog.cs | 6 +-
LongoMatch/Gui/Dialog/ProjectsManager.cs | 74 +-
LongoMatch/Gui/Dialog/TaggerDialog.cs | 18 +-
LongoMatch/Gui/Dialog/TemplatesEditor.cs | 64 +-
LongoMatch/Gui/Dialog/VideoEditionProperties.cs | 36 +-
LongoMatch/Gui/MainWindow.cs | 333 +++++----
LongoMatch/Gui/Popup/MessagePopup.cs | 2 +-
LongoMatch/Gui/TransparentDrawingArea.cs | 20 +-
LongoMatch/Gui/TreeView/CategoriesTreeView.cs | 16 +-
LongoMatch/Gui/TreeView/ListTreeViewBase.cs | 174 +++---
LongoMatch/Gui/TreeView/PlayListTreeView.cs | 22 +-
.../Gui/TreeView/PlayerPropertiesTreeView.cs | 18 +-
LongoMatch/Gui/TreeView/PlayersTreeView.cs | 92 ++--
LongoMatch/Gui/TreeView/PlaysTreeView.cs | 190 +++---
LongoMatch/Gui/TreeView/TagsTreeView.cs | 30 +-
LongoMatch/Handlers/DrawingManager.cs | 10 +-
LongoMatch/Handlers/EventsManager.cs | 172 +++---
LongoMatch/Handlers/Handlers.cs | 4 +-
LongoMatch/Handlers/HotKeysManager.cs | 12 +-
LongoMatch/Handlers/VideoDrawingsManager.cs | 18 +-
LongoMatch/IO/CSVExport.cs | 70 +-
LongoMatch/IO/XMLReader.cs | 10 +-
LongoMatch/Main.cs | 52 +-
LongoMatch/Playlist/IPlayList.cs | 22 +-
LongoMatch/Playlist/PlayList.cs | 20 +-
LongoMatch/Store/Category.cs | 72 +-
LongoMatch/Store/Drawing.cs | 16 +-
LongoMatch/Store/DrawingsList.cs | 8 +-
LongoMatch/Store/HotKey.cs | 12 +-
LongoMatch/Store/PixbufTimeNode.cs | 8 +-
LongoMatch/Store/Play.cs | 116 ++--
LongoMatch/Store/PlayListPlay.cs | 10 +-
LongoMatch/Store/Player.cs | 26 +-
LongoMatch/Store/Project.cs | 100 ++--
LongoMatch/Store/ProjectDescription.cs | 14 +-
LongoMatch/Store/SubCategory.cs | 50 +-
LongoMatch/Store/Tag.cs | 14 +-
LongoMatch/Store/Templates/CategoriesTemplate.cs | 22 +-
.../Store/Templates/SubCategoriesTemplate.cs | 6 +-
LongoMatch/Store/Templates/TeamTemplate.cs | 26 +-
LongoMatch/Store/Templates/Template.cs | 10 +-
LongoMatch/Store/Time.cs | 8 +-
LongoMatch/Updates/Updater.cs | 16 +-
LongoMatch/Updates/XmlUpdateParser.cs | 2 +-
LongoMatch/Utils/ProjectUtils.cs | 202 +++---
113 files changed, 4308 insertions(+), 4116 deletions(-)
---
diff --git a/CesarPlayer/Capturer/CaptureProperties.cs b/CesarPlayer/Capturer/CaptureProperties.cs
index cc6975e..01c661a 100644
--- a/CesarPlayer/Capturer/CaptureProperties.cs
+++ b/CesarPlayer/Capturer/CaptureProperties.cs
@@ -1,28 +1,28 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 LongoMatch.Video.Common;
namespace LongoMatch.Video.Capturer
{
-
-
+
+
public struct CapturePropertiesStruct
{
public CaptureSourceType CaptureSourceType;
diff --git a/CesarPlayer/Capturer/FakeCapturer.cs b/CesarPlayer/Capturer/FakeCapturer.cs
index 5e3cf88..2c142f4 100644
--- a/CesarPlayer/Capturer/FakeCapturer.cs
+++ b/CesarPlayer/Capturer/FakeCapturer.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 Mono.Unix;
@@ -24,96 +24,110 @@ using Gdk;
namespace LongoMatch.Video.Capturer
{
-
-
+
+
public class FakeCapturer : Gtk.Bin, ICapturer
{
public event EllpasedTimeHandler EllapsedTime;
public event ErrorHandler Error;
public event DeviceChangeHandler DeviceChange;
-
+
private LiveSourceTimer timer;
-
- public FakeCapturer(): base ()
+
+ public FakeCapturer(): base()
{
- timer = new LiveSourceTimer();
+ timer = new LiveSourceTimer();
timer.EllapsedTime += delegate(int ellapsedTime) {
- if (EllapsedTime!= null)
+ if(EllapsedTime!= null)
EllapsedTime(ellapsedTime);
};
}
-
- public int CurrentTime{
- get{
+
+ public int CurrentTime {
+ get {
return timer.CurrentTime;
}
}
-
- public void Run(){
+
+ public void Run() {
}
-
- public void Close(){
+
+ public void Close() {
}
-
- public void Start(){
+
+ public void Start() {
timer.Start();
}
-
- public void Stop(){
+
+ public void Stop() {
timer.Stop();
- }
-
- public void TogglePause(){
+ }
+
+ public void TogglePause() {
timer.TogglePause();
- }
-
+ }
+
public uint OutputWidth {
- get{return 0;}
- set{}
+ get {
+ return 0;
+ }
+ set {}
}
public uint OutputHeight {
- get{return 0;}
- set{}
+ get {
+ return 0;
+ }
+ set {}
}
-
+
public string OutputFile {
- get {return Catalog.GetString("Fake live source");}
+ get {
+ return Catalog.GetString("Fake live source");
+ }
set {}
}
-
+
public uint VideoBitrate {
- get {return 0;}
+ get {
+ return 0;
+ }
set {}
}
-
+
public uint AudioBitrate {
- get {return 0;}
+ get {
+ return 0;
+ }
set {}
- }
-
+ }
+
public Pixbuf CurrentFrame {
- get {return null;}
+ get {
+ return null;
+ }
}
-
+
public string DeviceID {
- get {return "";}
- set{}
+ get {
+ return "";
+ }
+ set {}
}
-
- public bool SetVideoEncoder(VideoEncoderType type){
+
+ public bool SetVideoEncoder(VideoEncoderType type) {
return true;
}
-
- public bool SetAudioEncoder(AudioEncoderType type){
+
+ public bool SetAudioEncoder(AudioEncoderType type) {
return true;
}
-
- public bool SetVideoMuxer(VideoMuxerType type){
+
+ public bool SetVideoMuxer(VideoMuxerType type) {
return true;
}
-
- public bool SetSource(CaptureSourceType type){
+
+ public bool SetSource(CaptureSourceType type) {
return true;
}
}
diff --git a/CesarPlayer/Capturer/GstCameraCapturer.cs b/CesarPlayer/Capturer/GstCameraCapturer.cs
index 4d1709c..2ad735d 100644
--- a/CesarPlayer/Capturer/GstCameraCapturer.cs
+++ b/CesarPlayer/Capturer/GstCameraCapturer.cs
@@ -9,7 +9,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -23,11 +23,11 @@ namespace LongoMatch.Video.Capturer {
using System.Runtime.InteropServices;
using LongoMatch.Video.Common;
-#region Autogenerated code
+ #region Autogenerated code
public class GstCameraCapturer : Gtk.HBox, LongoMatch.Video.Capturer.ICapturer {
-
+
public event EllpasedTimeHandler EllapsedTime;
-
+
private LiveSourceTimer timer;
[Obsolete]
@@ -37,295 +37,295 @@ namespace LongoMatch.Video.Capturer {
[DllImport("libcesarplayer.dll")]
static extern unsafe IntPtr gst_camera_capturer_new(IntPtr filename, out IntPtr err);
- public unsafe GstCameraCapturer (string filename) : base (IntPtr.Zero)
+ public unsafe GstCameraCapturer(string filename) : base(IntPtr.Zero)
{
- if (GetType () != typeof (GstCameraCapturer)) {
- throw new InvalidOperationException ("Can't override this constructor.");
+ if(GetType() != typeof(GstCameraCapturer)) {
+ throw new InvalidOperationException("Can't override this constructor.");
}
IntPtr error = IntPtr.Zero;
Raw = gst_camera_capturer_new(GLib.Marshaller.StringToPtrGStrdup(filename), out error);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
-
- timer = new LiveSourceTimer();
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
+
+ timer = new LiveSourceTimer();
timer.EllapsedTime += delegate(int ellapsedTime) {
- if (EllapsedTime!= null)
+ if(EllapsedTime!= null)
EllapsedTime(ellapsedTime);
- };
+ };
}
- [GLib.Property ("output_height")]
+ [GLib.Property("output_height")]
public uint OutputHeight {
get {
- GLib.Value val = GetProperty ("output_height");
+ GLib.Value val = GetProperty("output_height");
uint ret = (uint) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("output_height", val);
- val.Dispose ();
+ val.Dispose();
}
}
- [GLib.Property ("output_width")]
+ [GLib.Property("output_width")]
public uint OutputWidth {
get {
- GLib.Value val = GetProperty ("output_width");
+ GLib.Value val = GetProperty("output_width");
uint ret = (uint) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("output_width", val);
- val.Dispose ();
+ val.Dispose();
}
}
- [GLib.Property ("video_bitrate")]
+ [GLib.Property("video_bitrate")]
public uint VideoBitrate {
get {
- GLib.Value val = GetProperty ("video_bitrate");
+ GLib.Value val = GetProperty("video_bitrate");
uint ret = (uint) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("video_bitrate", val);
- val.Dispose ();
+ val.Dispose();
}
}
- [GLib.Property ("output_file")]
+ [GLib.Property("output_file")]
public string OutputFile {
get {
- GLib.Value val = GetProperty ("output_file");
+ GLib.Value val = GetProperty("output_file");
string ret = (string) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("output_file", val);
- val.Dispose ();
+ val.Dispose();
}
}
- [GLib.Property ("audio_bitrate")]
+ [GLib.Property("audio_bitrate")]
public uint AudioBitrate {
get {
- GLib.Value val = GetProperty ("audio_bitrate");
+ GLib.Value val = GetProperty("audio_bitrate");
uint ret = (uint) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("audio_bitrate", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
- [GLib.Property ("device_id")]
+
+ [GLib.Property("device_id")]
public string DeviceID {
get {
- GLib.Value val = GetProperty ("device_id");
+ GLib.Value val = GetProperty("device_id");
string ret = (string) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("device_id", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
+
#pragma warning disable 0169
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void ErrorSignalDelegate (IntPtr arg0, IntPtr arg1, IntPtr gch);
+ delegate void ErrorSignalDelegate(IntPtr arg0, IntPtr arg1, IntPtr gch);
- static void ErrorSignalCallback (IntPtr arg0, IntPtr arg1, IntPtr gch)
+ static void ErrorSignalCallback(IntPtr arg0, IntPtr arg1, IntPtr gch)
{
- ErrorArgs args = new ErrorArgs ();
+ ErrorArgs args = new ErrorArgs();
try {
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
- if (sig == null)
+ if(sig == null)
throw new Exception("Unknown signal GC handle received " + gch);
args.Args = new object[1];
- args.Args[0] = GLib.Marshaller.Utf8PtrToString (arg1);
+ args.Args[0] = GLib.Marshaller.Utf8PtrToString(arg1);
ErrorHandler handler = (ErrorHandler) sig.Handler;
- handler (GLib.Object.GetObject (arg0), args);
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ handler(GLib.Object.GetObject(arg0), args);
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void ErrorVMDelegate (IntPtr gcc, IntPtr message);
+ delegate void ErrorVMDelegate(IntPtr gcc, IntPtr message);
static ErrorVMDelegate ErrorVMCallback;
- static void error_cb (IntPtr gcc, IntPtr message)
+ static void error_cb(IntPtr gcc, IntPtr message)
{
try {
- GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
- gcc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstCameraCapturer gcc_managed = GLib.Object.GetObject(gcc, false) as GstCameraCapturer;
+ gcc_managed.OnError(GLib.Marshaller.Utf8PtrToString(message));
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideError (GLib.GType gtype)
+ private static void OverrideError(GLib.GType gtype)
{
- if (ErrorVMCallback == null)
- ErrorVMCallback = new ErrorVMDelegate (error_cb);
- OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+ if(ErrorVMCallback == null)
+ ErrorVMCallback = new ErrorVMDelegate(error_cb);
+ OverrideVirtualMethod(gtype, "error", ErrorVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideError")]
- protected virtual void OnError (string message)
+ protected virtual void OnError(string message)
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
GLib.Value[] vals = new GLib.Value [2];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- vals [1] = new GLib.Value (message);
- inst_and_params.Append (vals [1]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ vals [1] = new GLib.Value(message);
+ inst_and_params.Append(vals [1]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("error")]
public event ErrorHandler Error {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
+ sig.RemoveDelegate(value);
}
}
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void DeviceChangeSignalDelegate (IntPtr arg0, int arg1, IntPtr gch);
+ delegate void DeviceChangeSignalDelegate(IntPtr arg0, int arg1, IntPtr gch);
- static void DeviceChangeSignalCallback (IntPtr arg0, int arg1, IntPtr gch)
+ static void DeviceChangeSignalCallback(IntPtr arg0, int arg1, IntPtr gch)
{
- DeviceChangeArgs args = new DeviceChangeArgs ();
+ DeviceChangeArgs args = new DeviceChangeArgs();
try {
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
- if (sig == null)
+ if(sig == null)
throw new Exception("Unknown signal GC handle received " + gch);
args.Args = new object[1];
args.Args[0] = arg1;
DeviceChangeHandler handler = (DeviceChangeHandler) sig.Handler;
- handler (GLib.Object.GetObject (arg0), args);
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ handler(GLib.Object.GetObject(arg0), args);
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void DeviceChangeVMDelegate (IntPtr gcc, int deviceChange);
+ delegate void DeviceChangeVMDelegate(IntPtr gcc, int deviceChange);
static DeviceChangeVMDelegate DeviceChangeVMCallback;
- static void device_change_cb (IntPtr gcc, int deviceChange)
+ static void device_change_cb(IntPtr gcc, int deviceChange)
{
try {
- GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
- gcc_managed.OnDeviceChange (deviceChange);
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstCameraCapturer gcc_managed = GLib.Object.GetObject(gcc, false) as GstCameraCapturer;
+ gcc_managed.OnDeviceChange(deviceChange);
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideDeviceChange (GLib.GType gtype)
+ private static void OverrideDeviceChange(GLib.GType gtype)
{
- if (DeviceChangeVMCallback == null)
- DeviceChangeVMCallback = new DeviceChangeVMDelegate (device_change_cb);
- OverrideVirtualMethod (gtype, "device_change", DeviceChangeVMCallback);
+ if(DeviceChangeVMCallback == null)
+ DeviceChangeVMCallback = new DeviceChangeVMDelegate(device_change_cb);
+ OverrideVirtualMethod(gtype, "device_change", DeviceChangeVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideDeviceChange")]
- protected virtual void OnDeviceChange (int deviceChange)
+ protected virtual void OnDeviceChange(int deviceChange)
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
GLib.Value[] vals = new GLib.Value [2];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- vals [1] = new GLib.Value (deviceChange);
- inst_and_params.Append (vals [1]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ vals [1] = new GLib.Value(deviceChange);
+ inst_and_params.Append(vals [1]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("device_change")]
public event DeviceChangeHandler DeviceChange {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
+ sig.RemoveDelegate(value);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void EosVMDelegate (IntPtr gcc);
+ delegate void EosVMDelegate(IntPtr gcc);
static EosVMDelegate EosVMCallback;
- static void eos_cb (IntPtr gcc)
+ static void eos_cb(IntPtr gcc)
{
try {
- GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
- gcc_managed.OnEos ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstCameraCapturer gcc_managed = GLib.Object.GetObject(gcc, false) as GstCameraCapturer;
+ gcc_managed.OnEos();
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideEos (GLib.GType gtype)
+ private static void OverrideEos(GLib.GType gtype)
{
- if (EosVMCallback == null)
- EosVMCallback = new EosVMDelegate (eos_cb);
- OverrideVirtualMethod (gtype, "eos", EosVMCallback);
+ if(EosVMCallback == null)
+ EosVMCallback = new EosVMDelegate(eos_cb);
+ OverrideVirtualMethod(gtype, "eos", EosVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideEos")]
- protected virtual void OnEos ()
+ protected virtual void OnEos()
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
GLib.Value[] vals = new GLib.Value [1];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("eos")]
public event System.EventHandler Eos {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "eos");
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "eos");
+ sig.RemoveDelegate(value);
}
}
#pragma warning restore 0169
@@ -347,7 +347,7 @@ namespace LongoMatch.Video.Capturer {
gst_camera_capturer_stop(Handle);
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void gst_camera_capturer_toggle_pause(IntPtr raw);
@@ -355,9 +355,9 @@ namespace LongoMatch.Video.Capturer {
timer.TogglePause();
gst_camera_capturer_toggle_pause(Handle);
}
-
- public int CurrentTime{
- get{
+
+ public int CurrentTime {
+ get {
return timer.CurrentTime;
}
}
@@ -377,33 +377,33 @@ namespace LongoMatch.Video.Capturer {
public void Run() {
gst_camera_capturer_run(Handle);
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void gst_camera_capturer_close(IntPtr raw);
public void Close() {
gst_camera_capturer_close(Handle);
- }
-
+ }
+
[DllImport("libcesarplayer.dll")]
static extern bool gst_camera_capturer_set_video_muxer(IntPtr raw, int type, out IntPtr error);
public bool SetVideoMuxer(VideoMuxerType type) {
IntPtr error = IntPtr.Zero;
bool raw_ret = gst_camera_capturer_set_video_muxer(Handle, (int) type, out error);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
bool ret = raw_ret;
return ret;
}
-
+
[DllImport("libcesarplayer.dll")]
static extern bool gst_camera_capturer_set_video_encoder(IntPtr raw, int type, out IntPtr error);
public bool SetVideoEncoder(VideoEncoderType type) {
IntPtr error = IntPtr.Zero;
bool raw_ret = gst_camera_capturer_set_video_encoder(Handle, (int) type, out error);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
bool ret = raw_ret;
return ret;
}
@@ -412,78 +412,78 @@ namespace LongoMatch.Video.Capturer {
static extern bool gst_camera_capturer_set_audio_encoder(IntPtr raw, int type, out IntPtr error);
public bool SetAudioEncoder(AudioEncoderType type) {
- IntPtr error = IntPtr.Zero;
+ IntPtr error = IntPtr.Zero;
bool raw_ret = gst_camera_capturer_set_audio_encoder(Handle, (int) type, out error);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
bool ret = raw_ret;
return ret;
}
-
+
[DllImport("libcesarplayer.dll")]
static extern bool gst_camera_capturer_set_source(IntPtr raw, int type, out IntPtr error);
public bool SetSource(CaptureSourceType type) {
- IntPtr error = IntPtr.Zero;
+ IntPtr error = IntPtr.Zero;
bool raw_ret = gst_camera_capturer_set_source(Handle, (int) type, out error);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
bool ret = raw_ret;
return ret;
- }
-
+ }
+
[DllImport("libcesarplayer.dll")]
static extern IntPtr gst_camera_capturer_get_type();
- public static new GLib.GType GType {
+ public static new GLib.GType GType {
get {
IntPtr raw_ret = gst_camera_capturer_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
- }
-
+ }
+
[DllImport("libcesarplayer.dll")]
static extern IntPtr gst_camera_capturer_enum_audio_devices();
- public static string[] AudioDevices {
+ public static string[] AudioDevices {
get {
IntPtr raw_ret = gst_camera_capturer_enum_audio_devices();
return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, false, typeof(String));
}
}
-
+
[DllImport("libcesarplayer.dll")]
static extern IntPtr gst_camera_capturer_enum_video_devices();
- public static string[] VideoDevices {
+ public static string[] VideoDevices {
get {
IntPtr raw_ret = gst_camera_capturer_enum_video_devices();
- return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, false, typeof(String));
+ return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, false, typeof(String));
}
}
-
-
+
+
[DllImport("libcesarplayer.dll")]
static extern IntPtr gst_camera_capturer_get_current_frame(IntPtr raw);
[DllImport("libcesarplayer.dll")]
static extern IntPtr gst_camera_capturer_unref_pixbuf(IntPtr raw);
-
+
public Gdk.Pixbuf CurrentFrame {
get {
- IntPtr raw_ret = gst_camera_capturer_get_current_frame (Handle);
- Gdk.Pixbuf p = GLib.Object.GetObject (raw_ret) as Gdk.Pixbuf;
+ IntPtr raw_ret = gst_camera_capturer_get_current_frame(Handle);
+ Gdk.Pixbuf p = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
/* The refcount for p is now 2. We need to decrease the counter to 1
* so that p.Dipose() sets it to 0 and triggers the pixbuf destroy function
- * that frees the associated data*/
- gst_camera_capturer_unref_pixbuf (raw_ret);
+ * that frees the associated data*/
+ gst_camera_capturer_unref_pixbuf(raw_ret);
return p;
}
- }
-
- static GstCameraCapturer ()
+ }
+
+ static GstCameraCapturer()
{
- LongoMatch.GtkSharp.Capturer.ObjectManager.Initialize ();
+ LongoMatch.GtkSharp.Capturer.ObjectManager.Initialize();
}
-#endregion
-
+ #endregion
+
}
}
diff --git a/CesarPlayer/Capturer/ICapturer.cs b/CesarPlayer/Capturer/ICapturer.cs
index 5c7a06e..a5ef4dd 100644
--- a/CesarPlayer/Capturer/ICapturer.cs
+++ b/CesarPlayer/Capturer/ICapturer.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -24,14 +24,14 @@ using Gdk;
namespace LongoMatch.Video.Capturer
{
-
-
+
+
public interface ICapturer
- {
+ {
event EllpasedTimeHandler EllapsedTime;
event ErrorHandler Error;
event DeviceChangeHandler DeviceChange;
-
+
uint OutputWidth {
get ;
set ;
@@ -41,53 +41,53 @@ namespace LongoMatch.Video.Capturer
get;
set ;
}
-
- string OutputFile {
+
+ string OutputFile {
get ;
set ;
}
-
+
uint VideoBitrate {
get;
set ;
}
-
+
uint AudioBitrate {
get ;
set ;
}
-
+
int CurrentTime {
get ;
}
-
+
Pixbuf CurrentFrame {
get;
}
-
+
string DeviceID {
set;
get;
}
-
+
bool SetVideoEncoder(VideoEncoderType type);
-
+
bool SetAudioEncoder(AudioEncoderType type);
-
+
bool SetVideoMuxer(VideoMuxerType type);
-
+
bool SetSource(CaptureSourceType type);
-
+
void TogglePause();
-
+
void Start();
-
+
void Stop();
-
+
void Run();
-
+
void Close();
-
+
void Dispose();
}
}
diff --git a/CesarPlayer/Capturer/LiveSourceTimer.cs b/CesarPlayer/Capturer/LiveSourceTimer.cs
index 47fd043..3ff3ac2 100644
--- a/CesarPlayer/Capturer/LiveSourceTimer.cs
+++ b/CesarPlayer/Capturer/LiveSourceTimer.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 LongoMatch.Video.Common;
@@ -22,18 +22,18 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Video.Capturer
{
-
-
+
+
public class LiveSourceTimer
{
public event EllpasedTimeHandler EllapsedTime;
-
+
private DateTime lastStart;
private TimeSpan ellapsed;
private bool playing;
private bool started;
private uint timerID;
-
+
public LiveSourceTimer()
{
lastStart = DateTime.Now;
@@ -41,45 +41,45 @@ namespace LongoMatch.Video.Capturer
playing = false;
started = false;
}
-
- public int CurrentTime{
- get{
- if (!started)
+
+ public int CurrentTime {
+ get {
+ if(!started)
return 0;
- else if (playing)
+ else if(playing)
return (int)(ellapsed + (DateTime.Now - lastStart)).TotalMilliseconds;
else
- return (int)ellapsed.TotalMilliseconds;
+ return (int)ellapsed.TotalMilliseconds;
}
}
-
- public void TogglePause(){
- if (!started)
+
+ public void TogglePause() {
+ if(!started)
return;
-
- if (playing){
+
+ if(playing) {
playing = false;
- ellapsed += DateTime.Now - lastStart;
+ ellapsed += DateTime.Now - lastStart;
}
- else{
+ else {
playing = true;
lastStart = DateTime.Now;
}
}
-
- public void Start(){
+
+ public void Start() {
timerID = GLib.Timeout.Add(100, OnTick);
lastStart = DateTime.Now;
playing = true;
started = true;
}
-
- public void Stop(){
+
+ public void Stop() {
GLib.Source.Remove(timerID);
- }
-
- protected virtual bool OnTick(){
- if (EllapsedTime != null)
+ }
+
+ protected virtual bool OnTick() {
+ if(EllapsedTime != null)
EllapsedTime(CurrentTime);
return true;
}
diff --git a/CesarPlayer/Capturer/ObjectManager.cs b/CesarPlayer/Capturer/ObjectManager.cs
index 1e4ff83..2c052bc 100644
--- a/CesarPlayer/Capturer/ObjectManager.cs
+++ b/CesarPlayer/Capturer/ObjectManager.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -26,14 +26,14 @@ namespace LongoMatch.GtkSharp.Capturer {
static bool initialized = false;
// Call this method from the appropriate module init function.
- public static void Initialize ()
+ public static void Initialize()
{
- if (initialized)
+ if(initialized)
return;
initialized = true;
- GLib.GType.Register (LongoMatch.Video.Capturer.GstCameraCapturer.GType, typeof (LongoMatch.Video.Capturer.GstCameraCapturer));
+ GLib.GType.Register(LongoMatch.Video.Capturer.GstCameraCapturer.GType, typeof(LongoMatch.Video.Capturer.GstCameraCapturer));
}
}
}
diff --git a/CesarPlayer/Common/Constants.cs b/CesarPlayer/Common/Constants.cs
index 0053eec..057bfce 100644
--- a/CesarPlayer/Common/Constants.cs
+++ b/CesarPlayer/Common/Constants.cs
@@ -1,27 +1,27 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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;
namespace LongoMatch.Video.Common
{
-
- class Constants{
+
+ class Constants {
public const string DV1394SRC_PROP = "guid";
public const string DSHOWVIDEOSINK_PROP = "device-name";
}
diff --git a/CesarPlayer/Common/Enum.cs b/CesarPlayer/Common/Enum.cs
index 6331834..e63162b 100644
--- a/CesarPlayer/Common/Enum.cs
+++ b/CesarPlayer/Common/Enum.cs
@@ -1,27 +1,27 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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;
namespace LongoMatch.Video.Common
{
-
-
+
+
public enum Error {
AudioPlugin,
NoPluginForFile,
@@ -45,8 +45,8 @@ namespace LongoMatch.Video.Common
ReadError,
PluginLoad,
EmptyFile,
- }
-
+ }
+
public enum VideoEncoderType {
Mpeg4,
Xvid,
@@ -55,26 +55,26 @@ namespace LongoMatch.Video.Common
Mpeg2,
VP8,
}
-
+
public enum AudioEncoderType {
Mp3,
Aac,
Vorbis,
}
-
+
public enum VideoMuxerType {
Avi,
- Mp4,
+ Mp4,
Matroska,
Ogg,
MpegPS,
WebM,
- }
-
- public enum CapturerType{
+ }
+
+ public enum CapturerType {
Fake,
Live,
- }
+ }
public enum VideoFormat {
PORTABLE=0,
@@ -83,14 +83,14 @@ namespace LongoMatch.Video.Common
HD720p=3,
HD1080p=4
}
-
+
public enum VideoQuality {
Low = 1000,
Normal = 3000,
Good = 5000,
Extra = 7000,
}
-
+
public enum AudioQuality
{
Low = 32000,
@@ -99,29 +99,29 @@ namespace LongoMatch.Video.Common
Extra = 256000,
copy,
}
-
+
public enum PlayerUseType {
Video,
Audio,
Capture,
Metadata,
}
-
+
public enum VideoProperty {
Brightness,
Contrast,
Saturation,
Hue,
- }
-
+ }
+
public enum AspectRatio {
Auto,
Square,
Fourbythree,
Anamorphic,
Dvb,
- }
-
+ }
+
public enum AudioOutType {
Stereo,
Channel4,
@@ -130,7 +130,7 @@ namespace LongoMatch.Video.Common
Channel51,
Ac3passthru,
}
-
+
public enum MetadataType {
Title,
Artist,
@@ -152,13 +152,13 @@ namespace LongoMatch.Video.Common
AudioSampleRate,
AudioChannels,
}
-
+
public enum DeviceType {
Video,
Audio,
DV
}
-
+
public enum CaptureSourceType {
None,
DV,
diff --git a/CesarPlayer/Common/Handlers.cs b/CesarPlayer/Common/Handlers.cs
index ae02ad6..59f9e41 100644
--- a/CesarPlayer/Common/Handlers.cs
+++ b/CesarPlayer/Common/Handlers.cs
@@ -1,59 +1,59 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 Gdk;
namespace LongoMatch.Video.Common
{
-
- public delegate void PlayListSegmentDoneHandler ();
+
+ public delegate void PlayListSegmentDoneHandler();
public delegate void SegmentClosedHandler();
public delegate void SegmentDoneHandler();
public delegate void SeekEventHandler(long pos);
- public delegate void VolumeChangedHandler (double level);
- public delegate void NextButtonClickedHandler ();
- public delegate void PrevButtonClickedHandler ();
- public delegate void ProgressHandler (float progress);
- public delegate void FramesProgressHandler (int actual, int total,Pixbuf frame);
- public delegate void DrawFrameHandler (int time);
- public delegate void EllpasedTimeHandler (int ellapsedTime);
-
-
+ public delegate void VolumeChangedHandler(double level);
+ public delegate void NextButtonClickedHandler();
+ public delegate void PrevButtonClickedHandler();
+ public delegate void ProgressHandler(float progress);
+ public delegate void FramesProgressHandler(int actual, int total,Pixbuf frame);
+ public delegate void DrawFrameHandler(int time);
+ public delegate void EllpasedTimeHandler(int ellapsedTime);
+
+
public delegate void ErrorHandler(object o, ErrorArgs args);
public delegate void PercentCompletedHandler(object o, PercentCompletedArgs args);
public delegate void StateChangeHandler(object o, StateChangeArgs args);
public delegate void TickHandler(object o, TickArgs args);
public delegate void DeviceChangeHandler(object o, DeviceChangeArgs args);
-
-
-
+
+
+
public class ErrorArgs : GLib.SignalArgs {
- public string Message{
+ public string Message {
get {
return (string) Args[0];
}
}
- }
+ }
public class PercentCompletedArgs : GLib.SignalArgs {
- public float Percent{
+ public float Percent {
get {
return (float) Args[0];
}
@@ -62,45 +62,45 @@ namespace LongoMatch.Video.Common
}
public class StateChangeArgs : GLib.SignalArgs {
- public bool Playing{
+ public bool Playing {
get {
return (bool) Args[0];
}
}
- }
+ }
public class TickArgs : GLib.SignalArgs {
- public long CurrentTime{
+ public long CurrentTime {
get {
return (long) Args[0];
}
}
- public long StreamLength{
+ public long StreamLength {
get {
return (long) Args[1];
}
}
- public float CurrentPosition{
+ public float CurrentPosition {
get {
return (float) Args[2];
}
}
- public bool Seekable{
+ public bool Seekable {
get {
return (bool) Args[3];
}
}
- }
+ }
public class DeviceChangeArgs : GLib.SignalArgs {
- public int DeviceChange{
+ public int DeviceChange {
get {
return (int) Args[0];
}
}
- }
+ }
}
diff --git a/CesarPlayer/Editor/EditorState.cs b/CesarPlayer/Editor/EditorState.cs
index 31b4438..7e1198a 100644
--- a/CesarPlayer/Editor/EditorState.cs
+++ b/CesarPlayer/Editor/EditorState.cs
@@ -1,27 +1,27 @@
-//
+//
// Copyright (C) 2007-2009 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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;
namespace LongoMatch.Video.Editor
{
-
-
+
+
public enum EditorState
{
START = 0,
diff --git a/CesarPlayer/Editor/GstVideoSplitter.cs b/CesarPlayer/Editor/GstVideoSplitter.cs
index 7c298a9..9c22e7e 100644
--- a/CesarPlayer/Editor/GstVideoSplitter.cs
+++ b/CesarPlayer/Editor/GstVideoSplitter.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -32,249 +32,249 @@ namespace LongoMatch.Video.Editor {
static extern unsafe IntPtr gst_video_editor_new(out IntPtr err);
public event ProgressHandler Progress;
-
- public unsafe GstVideoSplitter () : base (IntPtr.Zero)
+
+ public unsafe GstVideoSplitter() : base(IntPtr.Zero)
{
- if (GetType () != typeof (GstVideoSplitter)) {
- throw new InvalidOperationException ("Can't override this constructor.");
+ if(GetType() != typeof(GstVideoSplitter)) {
+ throw new InvalidOperationException("Can't override this constructor.");
}
IntPtr error = IntPtr.Zero;
Raw = gst_video_editor_new(out error);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
PercentCompleted += delegate(object o, PercentCompletedArgs args) {
- if (Progress!= null)
- Progress (args.Percent);
+ if(Progress!= null)
+ Progress(args.Percent);
};
}
#region Properties
-
- [GLib.Property ("enable-audio")]
+
+ [GLib.Property("enable-audio")]
public bool EnableAudio {
get {
- GLib.Value val = GetProperty ("enable-audio");
+ GLib.Value val = GetProperty("enable-audio");
bool ret = (bool) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("enable-audio", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
- [GLib.Property ("enable-title")]
+
+ [GLib.Property("enable-title")]
public bool EnableTitle {
get {
- GLib.Value val = GetProperty ("enable-title");
+ GLib.Value val = GetProperty("enable-title");
bool ret = (bool) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("enable-title", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
- [GLib.Property ("video_bitrate")]
+
+ [GLib.Property("video_bitrate")]
public int VideoBitrate {
get {
- GLib.Value val = GetProperty ("video_bitrate");
+ GLib.Value val = GetProperty("video_bitrate");
int ret = (int) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("video_bitrate", val);
- val.Dispose ();
+ val.Dispose();
}
}
- [GLib.Property ("audio_bitrate")]
+ [GLib.Property("audio_bitrate")]
public int AudioBitrate {
get {
- GLib.Value val = GetProperty ("audio_bitrate");
+ GLib.Value val = GetProperty("audio_bitrate");
int ret = (int) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("audio_bitrate", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
- [GLib.Property ("width")]
+
+ [GLib.Property("width")]
public int Width {
get {
- GLib.Value val = GetProperty ("width");
+ GLib.Value val = GetProperty("width");
int ret = (int) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("width", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
- [GLib.Property ("height")]
+
+ [GLib.Property("height")]
public int Height {
get {
- GLib.Value val = GetProperty ("height");
+ GLib.Value val = GetProperty("height");
int ret = (int) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("height", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
- [GLib.Property ("output_file")]
+
+ [GLib.Property("output_file")]
public string OutputFile {
get {
- GLib.Value val = GetProperty ("output_file");
+ GLib.Value val = GetProperty("output_file");
string ret = (string) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
- GLib.Value val = new GLib.Value(value);
+ GLib.Value val = new GLib.Value(value);
SetProperty("output_file", val);
- val.Dispose ();
+ val.Dispose();
}
}
-
+
#endregion
-
-
+
+
#region GSignals
#pragma warning disable 0169
[GLib.CDeclCallback]
- delegate void ErrorVMDelegate (IntPtr gvc, IntPtr message);
+ delegate void ErrorVMDelegate(IntPtr gvc, IntPtr message);
static ErrorVMDelegate ErrorVMCallback;
- static void error_cb (IntPtr gvc, IntPtr message)
+ static void error_cb(IntPtr gvc, IntPtr message)
{
try {
- GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
- gvc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstVideoSplitter gvc_managed = GLib.Object.GetObject(gvc, false) as GstVideoSplitter;
+ gvc_managed.OnError(GLib.Marshaller.Utf8PtrToString(message));
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideError (GLib.GType gtype)
+ private static void OverrideError(GLib.GType gtype)
{
- if (ErrorVMCallback == null)
- ErrorVMCallback = new ErrorVMDelegate (error_cb);
- OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+ if(ErrorVMCallback == null)
+ ErrorVMCallback = new ErrorVMDelegate(error_cb);
+ OverrideVirtualMethod(gtype, "error", ErrorVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverrideError")]
- protected virtual void OnError (string message)
+ protected virtual void OnError(string message)
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
GLib.Value[] vals = new GLib.Value [2];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- vals [1] = new GLib.Value (message);
- inst_and_params.Append (vals [1]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ vals [1] = new GLib.Value(message);
+ inst_and_params.Append(vals [1]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("error")]
public event ErrorHandler Error {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "error", typeof(ErrorArgs));
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "error", typeof(ErrorArgs));
+ sig.RemoveDelegate(value);
}
}
-
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void PercentCompletedVMDelegate (IntPtr gvc, float percent);
+ delegate void PercentCompletedVMDelegate(IntPtr gvc, float percent);
static PercentCompletedVMDelegate PercentCompletedVMCallback;
- static void percentcompleted_cb (IntPtr gvc, float percent)
+ static void percentcompleted_cb(IntPtr gvc, float percent)
{
try {
- GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
- gvc_managed.OnPercentCompleted (percent);
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstVideoSplitter gvc_managed = GLib.Object.GetObject(gvc, false) as GstVideoSplitter;
+ gvc_managed.OnPercentCompleted(percent);
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverridePercentCompleted (GLib.GType gtype)
+ private static void OverridePercentCompleted(GLib.GType gtype)
{
- if (PercentCompletedVMCallback == null)
- PercentCompletedVMCallback = new PercentCompletedVMDelegate (percentcompleted_cb);
- OverrideVirtualMethod (gtype, "percent_completed", PercentCompletedVMCallback);
+ if(PercentCompletedVMCallback == null)
+ PercentCompletedVMCallback = new PercentCompletedVMDelegate(percentcompleted_cb);
+ OverrideVirtualMethod(gtype, "percent_completed", PercentCompletedVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverridePercentCompleted")]
- protected virtual void OnPercentCompleted (float percent)
+ protected virtual void OnPercentCompleted(float percent)
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
GLib.Value[] vals = new GLib.Value [2];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- vals [1] = new GLib.Value (percent);
- inst_and_params.Append (vals [1]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ vals [1] = new GLib.Value(percent);
+ inst_and_params.Append(vals [1]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("percent_completed")]
public event PercentCompletedHandler PercentCompleted {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "percent_completed", typeof(PercentCompletedArgs));
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "percent_completed", typeof(PercentCompletedArgs));
+ sig.RemoveDelegate(value);
}
}
#pragma warning restore 0169
#endregion
-
+
#region Public Methods
[DllImport("libcesarplayer.dll")]
static extern IntPtr gst_video_editor_get_type();
- public static new GLib.GType GType {
+ public static new GLib.GType GType {
get {
IntPtr raw_ret = gst_video_editor_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}
-
-
+
+
[DllImport("libcesarplayer.dll")]
static extern void gst_video_editor_clear_segments_list(IntPtr raw);
@@ -282,66 +282,66 @@ namespace LongoMatch.Video.Editor {
public void ClearList() {
gst_video_editor_clear_segments_list(Handle);
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void gst_video_editor_add_segment(IntPtr raw, string file_path, long start, long duration, double rate, IntPtr title, bool hasAudio);
public void AddSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) {
- if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+ if(Environment.OSVersion.Platform == PlatformID.Win32NT)
filePath="file:///"+filePath;
gst_video_editor_add_segment(Handle, filePath, start, duration, rate, GLib.Marshaller.StringToPtrGStrdup(title), hasAudio);
}
-
-
+
+
[DllImport("libcesarplayer.dll")]
static extern void gst_video_editor_start(IntPtr raw);
public void Start() {
gst_video_editor_start(Handle);
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void gst_video_editor_cancel(IntPtr raw);
public void Cancel() {
// The handle might have already been dealocated
- try{
+ try {
gst_video_editor_cancel(Handle);
- }catch{
+ } catch {
}
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void gst_video_editor_set_video_encoder(IntPtr raw, out IntPtr error_ptr, int type);
public void SetVideoEncoder(out string error, VideoEncoderType codec) {
IntPtr error_ptr = IntPtr.Zero;
gst_video_editor_set_video_encoder(Handle,out error_ptr,(int)codec);
- if (error_ptr != IntPtr.Zero)
+ if(error_ptr != IntPtr.Zero)
error = GLib.Marshaller.Utf8PtrToString(error_ptr);
else
error = null;
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void gst_video_editor_set_audio_encoder(IntPtr raw, out IntPtr error_ptr, int type);
public void SetAudioEncoder(out string error, AudioEncoderType codec) {
IntPtr error_ptr = IntPtr.Zero;
gst_video_editor_set_audio_encoder(Handle,out error_ptr,(int)codec);
- if (error_ptr != IntPtr.Zero)
+ if(error_ptr != IntPtr.Zero)
error = GLib.Marshaller.Utf8PtrToString(error_ptr);
else
error = null;
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void gst_video_editor_set_video_muxer(IntPtr raw, out IntPtr error_ptr, int type);
public void SetVideoMuxer(out string error, VideoMuxerType muxer) {
IntPtr error_ptr = IntPtr.Zero;
gst_video_editor_set_video_muxer(Handle,out error_ptr,(int)muxer);
- if (error_ptr != IntPtr.Zero)
+ if(error_ptr != IntPtr.Zero)
error = GLib.Marshaller.Utf8PtrToString(error_ptr);
else
error = null;
@@ -355,79 +355,85 @@ namespace LongoMatch.Video.Editor {
gst_video_editor_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
return argc;
}
-
-
- public void SetSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio){
+
+
+ public void SetSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) {
ClearList();
AddSegment(filePath, start, duration, rate, title,hasAudio);
}
-
- public VideoQuality VideoQuality{
- set{VideoBitrate=(int)value;}
+
+ public VideoQuality VideoQuality {
+ set {
+ VideoBitrate=(int)value;
+ }
}
-
- public AudioQuality AudioQuality{
- set{AudioBitrate = (int)value;}
+
+ public AudioQuality AudioQuality {
+ set {
+ AudioBitrate = (int)value;
+ }
}
-
- public VideoFormat VideoFormat{
- set{
- if (value == VideoFormat.PORTABLE){
+
+ public VideoFormat VideoFormat {
+ set {
+ if(value == VideoFormat.PORTABLE) {
Height = 240;
Width = 320;
}
- else if (value == VideoFormat.VGA){
+ else if(value == VideoFormat.VGA) {
Height = 480 ;
Width = 640;
}
- else if (value == VideoFormat.TV){
+ else if(value == VideoFormat.TV) {
Height = 576;
Width = 720;
}
- else if (value == VideoFormat.HD720p){
+ else if(value == VideoFormat.HD720p) {
Height = 720;
Width = 1280;
}
- else if (value == VideoFormat.HD1080p){
+ else if(value == VideoFormat.HD1080p) {
Height = 1080;
Width = 1920;
}
}
}
-
- public AudioEncoderType AudioEncoder{
- set{
+
+ public AudioEncoderType AudioEncoder {
+ set {
string error;
SetAudioEncoder(out error,value);
- if (error != null)
+ if(error != null)
throw new Exception(error);
}
}
-
- public VideoEncoderType VideoEncoder{
- set{
+
+ public VideoEncoderType VideoEncoder {
+ set {
string error;
SetVideoEncoder(out error, value);
- if (error != null)
+ if(error != null)
throw new Exception(error);
}
}
-
- public VideoMuxerType VideoMuxer{
- set{
+
+ public VideoMuxerType VideoMuxer {
+ set {
string error;
SetVideoMuxer(out error,value);
- if (error != null)
+ if(error != null)
throw new Exception(error);
}
}
-
- public string TempDir{
- set{;}
+
+ public string TempDir {
+ set {
+ ;
+ }
}
-
+
#endregion
-
+
}
}
diff --git a/CesarPlayer/Editor/IVideoEditor.cs b/CesarPlayer/Editor/IVideoEditor.cs
index 0bc4c1b..f177384 100644
--- a/CesarPlayer/Editor/IVideoEditor.cs
+++ b/CesarPlayer/Editor/IVideoEditor.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -24,60 +24,60 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Video.Editor
{
-
-
+
+
public interface IVideoEditor
{
- event ProgressHandler Progress;
-
- VideoQuality VideoQuality{
+ event ProgressHandler Progress;
+
+ VideoQuality VideoQuality {
set;
}
-
- AudioQuality AudioQuality{
+
+ AudioQuality AudioQuality {
set;
}
-
- VideoFormat VideoFormat{
+
+ VideoFormat VideoFormat {
set;
}
-
- AudioEncoderType AudioEncoder{
+
+ AudioEncoderType AudioEncoder {
set;
}
-
- VideoEncoderType VideoEncoder{
+
+ VideoEncoderType VideoEncoder {
set;
}
-
- VideoMuxerType VideoMuxer{
+
+ VideoMuxerType VideoMuxer {
set;
- }
-
- string OutputFile{
+ }
+
+ string OutputFile {
set;
}
-
- string TempDir{
+
+ string TempDir {
set;
}
-
- bool EnableTitle{
+
+ bool EnableTitle {
set;
}
-
- bool EnableAudio{
+
+ bool EnableAudio {
set;
}
-
-
- void AddSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio) ;
-
+
+
+ void AddSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) ;
+
void ClearList();
-
- void Start();
-
+
+ void Start();
+
void Cancel();
-
+
}
}
diff --git a/CesarPlayer/Editor/IVideoSplitter.cs b/CesarPlayer/Editor/IVideoSplitter.cs
index 9f5a76c..c527353 100644
--- a/CesarPlayer/Editor/IVideoSplitter.cs
+++ b/CesarPlayer/Editor/IVideoSplitter.cs
@@ -1,84 +1,84 @@
-//
+//
// Copyright (C) 2007-2009 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 LongoMatch.Video.Common;
namespace LongoMatch.Video.Editor
{
-
-
+
+
public interface IVideoSplitter
{
- event PercentCompletedHandler PercentCompleted;
+ event PercentCompletedHandler PercentCompleted;
event ErrorHandler Error;
-
- bool EnableAudio{
+
+ bool EnableAudio {
set;
get;
- }
-
- bool EnableTitle{
+ }
+
+ bool EnableTitle {
set;
get;
}
-
+
int VideoBitrate {
set;
get;
}
-
+
int AudioBitrate {
set;
get;
}
-
+
int Width {
get ;
set;
}
-
+
int Height {
get ;
set ;
}
-
+
string OutputFile {
get ;
set;
}
-
+
void SetSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio);
-
- AudioEncoderType AudioEncoder{
+
+ AudioEncoderType AudioEncoder {
set;
}
-
- VideoEncoderType VideoEncoder{
+
+ VideoEncoderType VideoEncoder {
set;
}
-
- VideoMuxerType VideoMuxer{
+
+ VideoMuxerType VideoMuxer {
set;
- }
-
+ }
+
void Start();
-
+
void Cancel();
}
}
diff --git a/CesarPlayer/Editor/VideoSegment.cs b/CesarPlayer/Editor/VideoSegment.cs
index 542bead..ca77d87 100644
--- a/CesarPlayer/Editor/VideoSegment.cs
+++ b/CesarPlayer/Editor/VideoSegment.cs
@@ -1,27 +1,27 @@
-//
+//
// Copyright (C) 2007-2009 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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;
namespace LongoMatch.Video.Editor
{
-
-
+
+
public class VideoSegment
{
private string filePath;
@@ -30,7 +30,7 @@ namespace LongoMatch.Video.Editor
private double rate;
private string title;
private bool hasAudio;
-
+
public VideoSegment(string filePath, long start, long duration, double rate, string title,bool hasAudio)
{
this.filePath = filePath;
@@ -40,31 +40,43 @@ namespace LongoMatch.Video.Editor
this.title = title;
this.hasAudio= hasAudio;
}
-
- public string FilePath{
- get{ return filePath;}
+
+ public string FilePath {
+ get {
+ return filePath;
+ }
}
-
- public string Title{
- get{ return title;}
+
+ public string Title {
+ get {
+ return title;
+ }
}
-
- public long Start{
- get{ return start;}
+
+ public long Start {
+ get {
+ return start;
+ }
}
-
- public long Duration{
- get { return duration;}
+
+ public long Duration {
+ get {
+ return duration;
+ }
}
-
- public double Rate{
- get{ return rate;}
+
+ public double Rate {
+ get {
+ return rate;
+ }
}
-
- public bool HasAudio{
- get{return hasAudio;}
+
+ public bool HasAudio {
+ get {
+ return hasAudio;
+ }
}
-
-
+
+
}
}
diff --git a/CesarPlayer/Gui/CapturerBin.cs b/CesarPlayer/Gui/CapturerBin.cs
index bc4fd1c..1987e15 100644
--- a/CesarPlayer/Gui/CapturerBin.cs
+++ b/CesarPlayer/Gui/CapturerBin.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -30,24 +30,24 @@ using Mono.Unix;
namespace LongoMatch.Gui
{
-
-
+
+
[System.ComponentModel.Category("CesarPlayer")]
[System.ComponentModel.ToolboxItem(true)]
public partial class CapturerBin : Gtk.Bin
{
public event EventHandler CaptureFinished;
public event ErrorHandler Error;
-
+
private Pixbuf logopix;
private CapturePropertiesStruct captureProps;
private CapturerType capturerType;
private bool captureStarted;
private bool capturing;
- private const int THUMBNAIL_MAX_WIDTH = 100;
-
+ private const int THUMBNAIL_MAX_WIDTH = 100;
+
ICapturer capturer;
-
+
public CapturerBin()
{
this.Build();
@@ -62,17 +62,17 @@ namespace LongoMatch.Gui
captureProps.OutputFile = "";
captureProps.CaptureSourceType = CaptureSourceType.Raw;
Type = CapturerType.Fake;
- }
-
+ }
+
public CapturerType Type {
set {
/* Close any previous instance of the capturer */
Close();
MultimediaFactory factory = new MultimediaFactory();
- capturer = factory.getCapturer(value);
+ capturer = factory.getCapturer(value);
capturer.EllapsedTime += OnTick;
- if (value != CapturerType.Fake){
+ if(value != CapturerType.Fake) {
capturer.Error += OnError;
capturer.DeviceChange += OnDeviceChange;
capturerhbox.Add((Widget)capturer);
@@ -80,7 +80,7 @@ namespace LongoMatch.Gui
capturerhbox.Visible = true;
logodrawingarea.Visible = false;
}
- else{
+ else {
logodrawingarea.Visible = true;
capturerhbox.Visible = false;
}
@@ -89,41 +89,41 @@ namespace LongoMatch.Gui
}
}
-
- public string Logo{
- set{
- try{
+
+ public string Logo {
+ set {
+ try {
this.logopix = new Pixbuf(value);
- }catch{
+ } catch {
/* FIXME: Add log */
}
}
}
-
+
public int CurrentTime {
get {
- if (capturer == null)
+ if(capturer == null)
return -1;
return capturer.CurrentTime;
}
}
-
- public bool Capturing{
- get{
+
+ public bool Capturing {
+ get {
return capturing;
}
}
-
- public CapturePropertiesStruct CaptureProperties{
- set{
+
+ public CapturePropertiesStruct CaptureProperties {
+ set {
captureProps = value;
}
}
-
- public void Start(){
- if (capturer == null)
+
+ public void Start() {
+ if(capturer == null)
return;
-
+
capturing = true;
captureStarted = true;
recbutton.Visible = false;
@@ -131,30 +131,30 @@ namespace LongoMatch.Gui
stopbutton.Visible = true;
capturer.Start();
}
-
- public void TogglePause(){
- if (capturer == null)
+
+ public void TogglePause() {
+ if(capturer == null)
return;
-
+
capturing = !capturing;
recbutton.Visible = !capturing;
pausebutton.Visible = capturing;
capturer.TogglePause();
}
-
+
public void Stop() {
- if (capturer != null){
+ if(capturer != null) {
capturing = false;
capturer.Stop();
}
}
-
- public void Run(){
- if (capturer != null)
+
+ public void Run() {
+ if(capturer != null)
capturer.Run();
}
- public void Close(){
+ public void Close() {
/* resetting common properties */
pausebutton.Visible = false;
stopbutton.Visible = false;
@@ -162,171 +162,171 @@ namespace LongoMatch.Gui
captureStarted = false;
capturing = false;
OnTick(0);
-
- if (capturer == null)
- return;
-
+
+ if(capturer == null)
+ return;
+
/* stopping and closing capturer */
try {
capturer.Stop();
capturer.Close();
- if (capturerType == CapturerType.Live){
+ if(capturerType == CapturerType.Live) {
/* release and dispose live capturer */
capturer.Error -= OnError;
capturer.DeviceChange += OnDeviceChange;
capturerhbox.Remove(capturer as Gtk.Widget);
capturer.Dispose();
}
- } catch (Exception e) {}
+ } catch(Exception e) {}
capturer = null;
}
-
+
public Pixbuf CurrentMiniatureFrame {
get {
int h, w;
double rate;
Pixbuf scaled_pix;
Pixbuf pix;
-
- if (capturer == null)
+
+ if(capturer == null)
return null;
-
+
pix = capturer.CurrentFrame;
-
- if (pix == null)
+
+ if(pix == null)
return null;
-
+
w = pix.Width;
h = pix.Height;
rate = (double)w / (double)h;
-
- if (h > w) {
+
+ if(h > w) {
w = (int)(THUMBNAIL_MAX_WIDTH * rate);
h = THUMBNAIL_MAX_WIDTH;
} else {
h = (int)(THUMBNAIL_MAX_WIDTH / rate);
w = THUMBNAIL_MAX_WIDTH;
}
- scaled_pix = pix.ScaleSimple (w, h, Gdk.InterpType.Bilinear);
+ scaled_pix = pix.ScaleSimple(w, h, Gdk.InterpType.Bilinear);
pix.Dispose();
-
- return scaled_pix;
+
+ return scaled_pix;
}
}
-
- private void SetProperties(){
- if (capturer == null)
+
+ private void SetProperties() {
+ if(capturer == null)
return;
-
+
capturer.DeviceID = captureProps.DeviceID;
capturer.OutputFile = captureProps.OutputFile;
capturer.OutputHeight = captureProps.Height;
capturer.OutputWidth = captureProps.Width;
capturer.SetVideoEncoder(captureProps.VideoEncoder);
capturer.SetAudioEncoder(captureProps.AudioEncoder);
- capturer.SetVideoMuxer(captureProps.Muxer);
+ capturer.SetVideoMuxer(captureProps.Muxer);
capturer.SetSource(captureProps.CaptureSourceType);
capturer.VideoBitrate = captureProps.VideoBitrate;
capturer.AudioBitrate = captureProps.AudioBitrate;
}
- protected virtual void OnRecbuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnRecbuttonClicked(object sender, System.EventArgs e)
{
- if (capturer == null)
+ if(capturer == null)
return;
-
- if (captureStarted == true){
- if (capturing)
+
+ if(captureStarted == true) {
+ if(capturing)
return;
TogglePause();
}
else
- Start();
+ Start();
}
- protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnPausebuttonClicked(object sender, System.EventArgs e)
{
- if (capturer != null && capturing)
- TogglePause();
+ if(capturer != null && capturing)
+ TogglePause();
}
- protected virtual void OnStopbuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
{
int res;
-
- if (capturer == null)
+
+ if(capturer == null)
return;
-
+
MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
Catalog.GetString("You are going to stop and finish the current capture."+"\n"+
- "Do you want to proceed?"));
+ "Do you want to proceed?"));
res = md.Run();
md.Destroy();
- if (res == (int)ResponseType.Yes){
+ if(res == (int)ResponseType.Yes) {
md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
- Catalog.GetString("Finalizing file. This can take a while"));
+ Catalog.GetString("Finalizing file. This can take a while"));
md.Show();
Stop();
md.Destroy();
recbutton.Visible = true;
pausebutton.Visible = false;
stopbutton.Visible = false;
- if (CaptureFinished != null)
+ if(CaptureFinished != null)
CaptureFinished(this, new EventArgs());
}
- }
-
- protected virtual void OnTick (int ellapsedTime){
+ }
+
+ protected virtual void OnTick(int ellapsedTime) {
timelabel.Text = "Time: " + TimeString.MSecondsToSecondsString(CurrentTime);
}
-
- protected virtual void OnError (object o, ErrorArgs args)
+
+ protected virtual void OnError(object o, ErrorArgs args)
{
- if (Error != null)
- Error (o, args);
-
+ if(Error != null)
+ Error(o, args);
+
Close();
}
-
- protected virtual void OnDeviceChange (object o, DeviceChangeArgs args)
+
+ protected virtual void OnDeviceChange(object o, DeviceChangeArgs args)
{
/* device disconnected, pause capture */
- if (args.DeviceChange == -1){
- if (capturing)
+ if(args.DeviceChange == -1) {
+ if(capturing)
TogglePause();
-
+
recbutton.Sensitive = false;
-
+
MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
MessageType.Question, ButtonsType.Ok,
Catalog.GetString("Device disconnected. " +
- "The capture will be paused"));
+ "The capture will be paused"));
md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
md.Run();
- md.Destroy();
+ md.Destroy();
} else {
recbutton.Sensitive = true;
MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
MessageType.Question, ButtonsType.YesNo,
Catalog.GetString("Device reconnected." +
- "Do you want to restart the capture?"));
+ "Do you want to restart the capture?"));
md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
- if (md.Run() == (int)ResponseType.Yes){
- Console.WriteLine ("Accepted to toggle pause");
+ if(md.Run() == (int)ResponseType.Yes) {
+ Console.WriteLine("Accepted to toggle pause");
TogglePause();
}
md.Destroy();
- }
+ }
}
-
- protected virtual void OnLogodrawingareaExposeEvent (object o, Gtk.ExposeEventArgs args)
- {
+
+ protected virtual void OnLogodrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
+ {
Gdk.Window win;
Pixbuf frame;
int width, height, allocWidth, allocHeight, logoX, logoY;
float ratio;
-
- if (logopix == null)
+
+ if(logopix == null)
return;
win = logodrawingarea.GdkWindow;
@@ -334,27 +334,27 @@ namespace LongoMatch.Gui
height = logopix.Height;
allocWidth = logodrawingarea.Allocation.Width;
allocHeight = logodrawingarea.Allocation.Height;
-
+
/* Checking if allocated space is smaller than our logo */
- if ((float) allocWidth / width > (float) allocHeight / height) {
+ if((float) allocWidth / width > (float) allocHeight / height) {
ratio = (float) allocHeight / height;
} else {
ratio = (float) allocWidth / width;
}
- width = (int) (width * ratio);
- height = (int) (height * ratio);
-
+ width = (int)(width * ratio);
+ height = (int)(height * ratio);
+
logoX = (allocWidth / 2) - (width / 2);
logoY = (allocHeight / 2) - (height / 2);
/* Drawing our frame */
frame = new Pixbuf(Colorspace.Rgb, false, 8, allocWidth, allocHeight);
- logopix.Composite(frame, 0, 0, allocWidth, allocHeight, logoX, logoY,
+ logopix.Composite(frame, 0, 0, allocWidth, allocHeight, logoX, logoY,
ratio, ratio, InterpType.Bilinear, 255);
-
- win.DrawPixbuf (this.Style.BlackGC, frame, 0, 0,
- 0, 0, allocWidth, allocHeight,
- RgbDither.Normal, 0, 0);
+
+ win.DrawPixbuf(this.Style.BlackGC, frame, 0, 0,
+ 0, 0, allocWidth, allocHeight,
+ RgbDither.Normal, 0, 0);
frame.Dispose();
return;
}
diff --git a/CesarPlayer/Gui/PlayerBin.cs b/CesarPlayer/Gui/PlayerBin.cs
index caa4675..242c7d7 100644
--- a/CesarPlayer/Gui/PlayerBin.cs
+++ b/CesarPlayer/Gui/PlayerBin.cs
@@ -1,4 +1,4 @@
-// PlayerBin.cs
+// PlayerBin.cs
//
// Copyright (C) 2007-2009 Andoni Morales Alastruey
//
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
//Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -31,10 +31,10 @@ namespace LongoMatch.Gui
{
[System.ComponentModel.Category("LongoMatch")]
[System.ComponentModel.ToolboxItem(true)]
-
+
public partial class PlayerBin : Gtk.Bin
{
-
+
public event SegmentClosedHandler SegmentClosedEvent;
public event TickHandler Tick;
public event ErrorHandler Error;
@@ -43,7 +43,7 @@ namespace LongoMatch.Gui
public event PrevButtonClickedHandler Prev;
public event DrawFrameHandler DrawFrame;
public event SeekEventHandler SeekEvent;
-
+
private const int THUMBNAIL_MAX_WIDTH = 100;
private TickHandler tickHandler;
private IPlayer player;
@@ -52,7 +52,7 @@ namespace LongoMatch.Gui
private long segmentStartTime;
private long segmentStopTime;
private bool seeking=false;
- private double[] seeksQueue;
+ private double[] seeksQueue;
private bool IsPlayingPrevState = false;
private float rate=1;
private double previousVLevel = 1;
@@ -61,16 +61,16 @@ namespace LongoMatch.Gui
//the player.mrl is diferent from the filename as it's an uri eg:file:///foo.avi
private string filename = null;
protected VolumeWindow vwin;
-
-
-#region Constructors
+
+
+ #region Constructors
public PlayerBin()
- {
+ {
this.Build();
PlayerInit();
vwin = new VolumeWindow();
vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
- controlsbox.Visible = false;
+ controlsbox.Visible = false;
UnSensitive();
timescale.Adjustment.PageIncrement = 0.01;
timescale.Adjustment.StepIncrement = 0.0001;
@@ -79,235 +79,265 @@ namespace LongoMatch.Gui
nextbutton.CanFocus = false;
volumebutton.CanFocus = false;
timescale.CanFocus = false;
- vscale1.CanFocus = false;
+ vscale1.CanFocus = false;
drawbutton.CanFocus = false;
seeksQueue = new double[2];
seeksQueue [0] = -1;
seeksQueue [1] = -1;
}
-
-#endregion
-
-#region Properties
-
- public IPlayer Player{
- get{return player;}
- }
-
- public long AccurateCurrentTime{
- get{return player.AccurateCurrentTime;}
- }
-
- public long CurrentTime{
- get{return player.CurrentTime;}
- }
-
- public long StreamLength{
- get{return player.StreamLength;}
- }
-
- public float Rate{
- get{return rate;}
- set{vscale1.Value = (int)(value*25);}
- }
-
- public bool FullScreen{
- set{
- if (value)
+
+ #endregion
+
+ #region Properties
+
+ public IPlayer Player {
+ get {
+ return player;
+ }
+ }
+
+ public long AccurateCurrentTime {
+ get {
+ return player.AccurateCurrentTime;
+ }
+ }
+
+ public long CurrentTime {
+ get {
+ return player.CurrentTime;
+ }
+ }
+
+ public long StreamLength {
+ get {
+ return player.StreamLength;
+ }
+ }
+
+ public float Rate {
+ get {
+ return rate;
+ }
+ set {
+ vscale1.Value = (int)(value*25);
+ }
+ }
+
+ public bool FullScreen {
+ set {
+ if(value)
GdkWindow.Fullscreen();
- else
- GdkWindow.Unfullscreen();
+ else
+ GdkWindow.Unfullscreen();
}
}
-
- public Pixbuf CurrentMiniatureFrame{
- get{
- Pixbuf pixbuf = player.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_WIDTH);
+
+ public Pixbuf CurrentMiniatureFrame {
+ get {
+ Pixbuf pixbuf = player.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_WIDTH);
return pixbuf;
}
}
-
- public Pixbuf CurrentFrame{
- get{return player.GetCurrentFrame();}
+
+ public Pixbuf CurrentFrame {
+ get {
+ return player.GetCurrentFrame();
+ }
}
-
- public Pixbuf LogoPixbuf{
- set{player.LogoPixbuf = value;}
+
+ public Pixbuf LogoPixbuf {
+ set {
+ player.LogoPixbuf = value;
+ }
}
-
+
public bool DrawingMode {
- set{player.DrawingMode= value;}
+ set {
+ player.DrawingMode= value;
+ }
}
-
+
public Pixbuf DrawingPixbuf {
- set{player.DrawingPixbuf=value;}
+ set {
+ player.DrawingPixbuf=value;
+ }
}
-
- public bool LogoMode{
- set{player.LogoMode = value;}
+
+ public bool LogoMode {
+ set {
+ player.LogoMode = value;
+ }
}
-
+
public bool ExpandLogo {
- get{return player.ExpandLogo;}
- set{player.ExpandLogo = value;}
+ get {
+ return player.ExpandLogo;
+ }
+ set {
+ player.ExpandLogo = value;
+ }
}
-
+
public bool Opened {
- get{return filename != null;}
+ get {
+ return filename != null;
+ }
}
-
- public Widget VideoWidget{
- get{return ((Gtk.EventBox)player);}
+
+ public Widget VideoWidget {
+ get {
+ return ((Gtk.EventBox)player);
+ }
}
-#endregion
-
-#region Public methods
-
- public void Open (string mrl){
+ #endregion
+
+ #region Public methods
+
+ public void Open(string mrl) {
filename = mrl;
ResetGui();
- CloseActualSegment();
- try{
- player.Open(mrl);
- }
- catch {
- //We handle this error async
- }
- }
-
- public void Play(){
- player.Play();
- float val = GetRateFromScale();
- if (segmentStartTime == 0 && segmentStopTime==0)
+ CloseActualSegment();
+ try {
+ player.Open(mrl);
+ }
+ catch {
+ //We handle this error async
+ }
+ }
+
+ public void Play() {
+ player.Play();
+ float val = GetRateFromScale();
+ if(segmentStartTime == 0 && segmentStopTime==0)
player.SetRate(val);
else
- player.SetRateInSegment(val,segmentStopTime);
+ player.SetRateInSegment(val,segmentStopTime);
}
-
- public void Pause(){
+
+ public void Pause() {
player.Pause();
- }
-
- public void TogglePlay(){
- if (player.Playing)
+ }
+
+ public void TogglePlay() {
+ if(player.Playing)
Pause();
- else
+ else
Play();
}
-
- public void SetLogo (string filename){
+
+ public void SetLogo(string filename) {
player.Logo=filename;
}
-
- public void ResetGui(){
+
+ public void ResetGui() {
closebutton.Hide();
SetSensitive();
timescale.Value=0;
timelabel.Text="";
- player.CancelProgramedStop();
+ player.CancelProgramedStop();
}
-
- public void SetPlayListElement(string fileName,long start, long stop, float rate, bool hasNext){
- if (hasNext)
+
+ public void SetPlayListElement(string fileName,long start, long stop, float rate, bool hasNext) {
+ if(hasNext)
nextbutton.Sensitive = true;
else
nextbutton.Sensitive = false;
-
- if (fileName != filename){
- Open(fileName);
+
+ if(fileName != filename) {
+ Open(fileName);
//Wait until the pipeline is prerolled and ready to seek
pendingSeek = new object[3] {start,stop,rate};
}
- else player.SegmentSeek(start,stop,rate);
-
+ else player.SegmentSeek(start,stop,rate);
+
segmentStartTime = start;
segmentStopTime = stop;
player.LogoMode = false;
Rate = rate;
}
-
- public void Close(){
+
+ public void Close() {
player.Close();
filename = null;
timescale.Value = 0;
UnSensitive();
}
-
- public void SeekTo(long time, bool accurate){
+
+ public void SeekTo(long time, bool accurate) {
player.SeekTime(time,1,accurate);
- if (SeekEvent != null)
+ if(SeekEvent != null)
SeekEvent(time);
}
-
- public void SeekInSegment(long pos){
+
+ public void SeekInSegment(long pos) {
player.SeekInSegment(pos, GetRateFromScale());
- if (SeekEvent != null)
+ if(SeekEvent != null)
SeekEvent(pos);
}
-
- public void SeekToNextFrame(bool in_segment){
+
+ public void SeekToNextFrame(bool in_segment) {
int currentTime = (int)player.CurrentTime;
- if (segmentStopTime==0 | currentTime < segmentStopTime){
- if (player.Playing)
+ if(segmentStopTime==0 | currentTime < segmentStopTime) {
+ if(player.Playing)
player.Pause();
- player.SeekToNextFrame( GetRateFromScale(), in_segment);
- if (SeekEvent != null)
- SeekEvent(currentTime );
+ player.SeekToNextFrame(GetRateFromScale(), in_segment);
+ if(SeekEvent != null)
+ SeekEvent(currentTime);
}
-
+
}
-
- public void SeekToPreviousFrame(bool in_segment){
+
+ public void SeekToPreviousFrame(bool in_segment) {
long currentTime = player.CurrentTime;
- if (currentTime> segmentStartTime){
- if (player.Playing)
+ if(currentTime> segmentStartTime) {
+ if(player.Playing)
player.Pause();
- player.SeekToPreviousFrame( GetRateFromScale(),in_segment);
- if (SeekEvent != null)
+ player.SeekToPreviousFrame(GetRateFromScale(),in_segment);
+ if(SeekEvent != null)
SeekEvent(currentTime);
}
}
-
- public void StepForward(){
+
+ public void StepForward() {
SeekFromTimescale(timescale.Value + timescale.Adjustment.PageIncrement);
}
-
- public void StepBackward(){
+
+ public void StepBackward() {
SeekFromTimescale(timescale.Value - timescale.Adjustment.PageIncrement);
}
-
- public void FramerateUp(){
+
+ public void FramerateUp() {
vscale1.Adjustment.Value += vscale1.Adjustment.StepIncrement;
}
-
- public void FramerateDown(){
+
+ public void FramerateDown() {
vscale1.Adjustment.Value -= vscale1.Adjustment.StepIncrement;
}
-
- public void UpdateSegmentStartTime (long start){
+
+ public void UpdateSegmentStartTime(long start) {
segmentStartTime = start;
player.SegmentStartUpdate(start, GetRateFromScale());
- if (SeekEvent != null)
+ if(SeekEvent != null)
SeekEvent(start);
}
-
- public void UpdateSegmentStopTime (long stop){
+
+ public void UpdateSegmentStopTime(long stop) {
segmentStopTime = stop;
- player.SegmentStopUpdate(stop, GetRateFromScale());
- if (SeekEvent != null)
+ player.SegmentStopUpdate(stop, GetRateFromScale());
+ if(SeekEvent != null)
SeekEvent(stop);
}
-
- public void SetStartStop(long start, long stop){
+
+ public void SetStartStop(long start, long stop) {
segmentStartTime = start;
segmentStopTime = stop;
closebutton.Show();
vscale1.Value = 25;
- player.SegmentSeek(start,stop, GetRateFromScale());
+ player.SegmentSeek(start,stop, GetRateFromScale());
player.Play();
}
-
- public void CloseActualSegment(){
+
+ public void CloseActualSegment() {
closebutton.Hide();
segmentStartTime = 0;
segmentStopTime = 0;
@@ -315,132 +345,132 @@ namespace LongoMatch.Gui
//timescale.Sensitive = true;
slength = TimeString.MSecondsToSecondsString(length);
SegmentClosedEvent();
- player.CancelProgramedStop();
+ player.CancelProgramedStop();
}
-
- public void SetSensitive(){
+
+ public void SetSensitive() {
controlsbox.Sensitive = true;
- vscale1.Sensitive = true;
+ vscale1.Sensitive = true;
}
-
- public void UnSensitive(){
+
+ public void UnSensitive() {
controlsbox.Sensitive = false;
- vscale1.Sensitive = false;
- }
-
-#endregion
-
-#region Private methods
-
- private float GetRateFromScale(){
+ vscale1.Sensitive = false;
+ }
+
+ #endregion
+
+ #region Private methods
+
+ private float GetRateFromScale() {
VScale scale= vscale1;
double val = scale.Value;
-
- if (val >25 ){
- val = val-25 ;
+
+ if(val >25) {
+ val = val-25 ;
}
- else if (val <=25){
+ else if(val <=25) {
val = val/25;
}
return (float)val;
}
-
- private bool InSegment(){
+
+ private bool InSegment() {
return !(segmentStopTime == 0 && segmentStartTime ==0) ;
}
-
- private void PlayerInit(){
+
+ private void PlayerInit() {
MultimediaFactory factory;
Widget playerWidget;
-
+
factory= new MultimediaFactory();
player = factory.getPlayer(320,280);
-
+
tickHandler = new TickHandler(OnTick);
player.Tick += tickHandler;
player.StateChange += new StateChangeHandler(OnStateChanged);
- player.Eos += new EventHandler (OnEndOfStream);
- player.Error += new ErrorHandler (OnError);
+ player.Eos += new EventHandler(OnEndOfStream);
+ player.Error += new ErrorHandler(OnError);
player.ReadyToSeek += new EventHandler(OnReadyToSeek);
-
+
playerWidget = (Widget)player;
playerWidget.ButtonPressEvent += OnVideoboxButtonPressEvent;
playerWidget.ScrollEvent += OnVideoboxScrollEvent;
playerWidget.Show();
- videobox.Add(playerWidget);
-
+ videobox.Add(playerWidget);
+
}
-
- private void SeekFromTimescale(double pos){
- if (InSegment()){
+
+ private void SeekFromTimescale(double pos) {
+ if(InSegment()) {
long seekPos = segmentStartTime + (long)(pos*(segmentStopTime-segmentStartTime));
- player.SeekInSegment(seekPos, GetRateFromScale());
- timelabel.Text= TimeString.MSecondsToSecondsString(seekPos) + "/" +
- TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
+ player.SeekInSegment(seekPos, GetRateFromScale());
+ timelabel.Text= TimeString.MSecondsToSecondsString(seekPos) + "/" +
+ TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
}
else {
player.Position = pos;
timelabel.Text= TimeString.MSecondsToSecondsString(player.CurrentTime) + "/" + slength;
- Rate = 1;
- }
- }
-
-#endregion
-
-#region Callbacks
- protected virtual void OnStateChanged(object o, StateChangeArgs args){
- if (args.Playing){
+ Rate = 1;
+ }
+ }
+
+ #endregion
+
+ #region Callbacks
+ protected virtual void OnStateChanged(object o, StateChangeArgs args) {
+ if(args.Playing) {
playbutton.Hide();
pausebutton.Show();
}
- else{
+ else {
playbutton.Show();
pausebutton.Hide();
}
- if (PlayStateChanged != null)
+ if(PlayStateChanged != null)
PlayStateChanged(this,args);
}
-
- protected void OnReadyToSeek(object o, EventArgs args){
- if (pendingSeek != null){
+
+ protected void OnReadyToSeek(object o, EventArgs args) {
+ if(pendingSeek != null) {
player.SegmentSeek((long)pendingSeek[0],
(long)pendingSeek[1],
(float)pendingSeek[2]);
player.Play();
pendingSeek = null;
-
+
}
}
-
- protected virtual void OnTick(object o,TickArgs args){
+
+ protected virtual void OnTick(object o,TickArgs args) {
long currentTime = args.CurrentTime;
- float currentposition = args.CurrentPosition;
- long streamLength = args.StreamLength;
-
+ float currentposition = args.CurrentPosition;
+ long streamLength = args.StreamLength;
+
//Console.WriteLine ("Current Time:{0}\n Length:{1}\n",currentTime, streamLength);
- if (length != streamLength){
+ if(length != streamLength) {
length = streamLength;
- slength = TimeString.MSecondsToSecondsString(length);
+ slength = TimeString.MSecondsToSecondsString(length);
}
-
- if (InSegment()){
+
+ if(InSegment()) {
currentTime -= segmentStartTime;
currentposition = (float)currentTime/(float)(segmentStopTime-segmentStartTime);
slength = TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
- }
-
- timelabel.Text = TimeString.MSecondsToSecondsString(currentTime) + "/" + slength;
+ }
+
+ timelabel.Text = TimeString.MSecondsToSecondsString(currentTime) + "/" + slength;
timescale.Value = currentposition;
- if (Tick != null)
+ if(Tick != null)
Tick(o,args);
-
+
}
-
+
protected virtual void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
{
- double pos;
-
- if (!seeking){
+ double pos;
+
+ if(!seeking) {
seeking = true;
IsPlayingPrevState = player.Playing;
player.Tick -= tickHandler;
@@ -448,30 +478,30 @@ namespace LongoMatch.Gui
seeksQueue [0] = -1;
seeksQueue [1] = -1;
}
-
- pos = timescale.Value;
+
+ pos = timescale.Value;
seeksQueue[0] = seeksQueue[1];
seeksQueue[1] = pos;
-
- SeekFromTimescale(pos);
- }
+
+ SeekFromTimescale(pos);
+ }
protected virtual 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 */
+ 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;
+ seeking=false;
player.Tick += tickHandler;
- if (IsPlayingPrevState)
+ if(IsPlayingPrevState)
player.Play();
}
}
protected virtual void OnPlaybuttonClicked(object sender, System.EventArgs e)
{
- Play();
+ Play();
}
protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
@@ -489,131 +519,131 @@ namespace LongoMatch.Gui
{
player.Dispose();
}
-
- protected virtual void OnVolumeChanged(double level){
+
+ protected virtual void OnVolumeChanged(double level) {
player.Volume = level;
- if (level == 0)
+ if(level == 0)
muted = true;
else
muted = false;
}
- protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
- {
+ protected virtual void OnPausebuttonClicked(object sender, System.EventArgs e)
+ {
player.Pause();
}
-
- protected virtual void OnEndOfStream (object o, EventArgs args){
+
+ protected virtual void OnEndOfStream(object o, EventArgs args) {
player.SeekInSegment(0, GetRateFromScale());
- player.Pause();
+ player.Pause();
}
-
-
- protected virtual void OnError (object o, ErrorArgs args){
+
+
+ protected virtual void OnError(object o, ErrorArgs args) {
if(Error != null)
Error(o,args);
}
- protected virtual void OnClosebuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnClosebuttonClicked(object sender, System.EventArgs e)
{
- CloseActualSegment();
+ CloseActualSegment();
}
- protected virtual void OnPrevbuttonClicked (object sender, System.EventArgs e)
- {
- if (Prev != null)
+ protected virtual void OnPrevbuttonClicked(object sender, System.EventArgs e)
+ {
+ if(Prev != null)
Prev();
}
- protected virtual void OnNextbuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnNextbuttonClicked(object sender, System.EventArgs e)
{
- if (Next != null)
- Next();
+ if(Next != null)
+ Next();
}
- protected virtual void OnVscale1FormatValue (object o, Gtk.FormatValueArgs args)
+ protected virtual void OnVscale1FormatValue(object o, Gtk.FormatValueArgs args)
{
double val = args.Value;
- if (val >25 ){
+ if(val >25) {
val = val-25 ;
args.RetVal = val +"X";
}
- else if (val ==25){
+ else if(val ==25) {
args.RetVal = "1X";
}
- else if (val <25){
+ else if(val <25) {
args.RetVal = "-"+val+"/25"+"X";
}
}
- protected virtual void OnVscale1ValueChanged (object sender, System.EventArgs e)
+ protected virtual void OnVscale1ValueChanged(object sender, System.EventArgs e)
{
float val = GetRateFromScale();
-
+
// Mute for rate != 1
- if (val != 1 && player.Volume != 0){
+ if(val != 1 && player.Volume != 0) {
previousVLevel = player.Volume;
player.Volume=0;
}
- else if (val != 1 && muted)
- previousVLevel = 0;
- else if (val ==1)
- player.Volume = previousVLevel;
-
- if (InSegment()){
+ else if(val != 1 && muted)
+ previousVLevel = 0;
+ else if(val ==1)
+ player.Volume = previousVLevel;
+
+ if(InSegment()) {
player.SetRateInSegment(val,segmentStopTime);
}
else
- player.SetRate(val);
+ player.SetRate(val);
rate = val;
}
- protected virtual void OnVideoboxButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
+ protected virtual void OnVideoboxButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
{
if(filename == null)
return;
/* FIXME: The pointer is grabbed when the event box is clicked.
* Make sure to ungrab it in order to avoid clicks outisde the window
- * triggering this callback. This should be fixed properly.*/
+ * triggering this callback. This should be fixed properly.*/
Pointer.Ungrab(Gtk.Global.CurrentEventTime);
- if (!player.Playing)
+ if(!player.Playing)
Play();
- else
- Pause();
+ else
+ Pause();
}
-
- protected virtual void OnVideoboxScrollEvent (object o, Gtk.ScrollEventArgs args)
+
+ protected virtual void OnVideoboxScrollEvent(object o, Gtk.ScrollEventArgs args)
{
- switch (args.Event.Direction){
- case ScrollDirection.Down:
- SeekToPreviousFrame(InSegment());
- break;
- case ScrollDirection.Up:
- SeekToNextFrame(InSegment());
- break;
- case ScrollDirection.Left:
- StepBackward();
- break;
- case ScrollDirection.Right:
- StepForward();
- break;
- }
- }
-
- protected virtual void OnDrawButtonClicked (object sender, System.EventArgs e)
+ switch(args.Event.Direction) {
+ case ScrollDirection.Down:
+ SeekToPreviousFrame(InSegment());
+ break;
+ case ScrollDirection.Up:
+ SeekToNextFrame(InSegment());
+ break;
+ case ScrollDirection.Left:
+ StepBackward();
+ break;
+ case ScrollDirection.Right:
+ StepForward();
+ break;
+ }
+ }
+
+ protected virtual void OnDrawButtonClicked(object sender, System.EventArgs e)
{
int currentTime;
-
+
currentTime = (int)AccurateCurrentTime;
// If the player has reached the end of the segment the current time
// will be unseekable and it's not possible to get a frame at this
- // instant. If we exceed the segment stop time, decrease in a
- // milisecond the position.
- if (InSegment() && currentTime >= segmentStopTime)
+ // instant. If we exceed the segment stop time, decrease in a
+ // milisecond the position.
+ if(InSegment() && currentTime >= segmentStopTime)
currentTime -= 1;
- if (DrawFrame != null)
+ if(DrawFrame != null)
DrawFrame(currentTime);
}
-#endregion
+ #endregion
}
}
diff --git a/CesarPlayer/Gui/VolumeWindow.cs b/CesarPlayer/Gui/VolumeWindow.cs
index ccd9706..c2bbe4e 100644
--- a/CesarPlayer/Gui/VolumeWindow.cs
+++ b/CesarPlayer/Gui/VolumeWindow.cs
@@ -1,4 +1,4 @@
-// VolumeWindow.cs
+// VolumeWindow.cs
//
// Copyright (C) 2007-2009 Andoni Morales Alastruey
//
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -22,25 +22,25 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Gui
{
-
-
+
+
public partial class VolumeWindow : Gtk.Window
{
-
-
+
+
public event VolumeChangedHandler VolumeChanged;
-
-
- public VolumeWindow() :
- base(Gtk.WindowType.Toplevel)
+
+
+ public VolumeWindow() :
+ base(Gtk.WindowType.Toplevel)
{
this.Build();
volumescale.Adjustment.PageIncrement = 0.0001;
volumescale.Adjustment.StepIncrement = 0.0001;
}
-
- public void SetLevel(double level){
+
+ public void SetLevel(double level) {
volumescale.Value = level ;
}
@@ -59,12 +59,12 @@ namespace LongoMatch.Gui
VolumeChanged(volumescale.Value);
}
- protected virtual void OnFocusOutEvent (object o, Gtk.FocusOutEventArgs args)
+ protected virtual void OnFocusOutEvent(object o, Gtk.FocusOutEventArgs args)
{
this.Hide();
}
-
+
}
}
diff --git a/CesarPlayer/MultimediaFactory.cs b/CesarPlayer/MultimediaFactory.cs
index 29730b9..613c1b5 100644
--- a/CesarPlayer/MultimediaFactory.cs
+++ b/CesarPlayer/MultimediaFactory.cs
@@ -1,4 +1,4 @@
-// PlayerMaker.cs
+// PlayerMaker.cs
//
// Copyright(C) 2007-2009 Andoni Morales Alastruey
//
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
//Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -27,82 +27,82 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Video
{
-
-
+
+
public class MultimediaFactory
{
-
+
OperatingSystem oS;
-
+
public MultimediaFactory()
{
- oS = Environment.OSVersion;
+ oS = Environment.OSVersion;
+ }
+
+ public IPlayer getPlayer(int width, int height) {
+ switch(oS.Platform) {
+ case PlatformID.Unix:
+ return new GstPlayer(width,height,PlayerUseType.Video);
+
+ case PlatformID.Win32NT:
+ return new GstPlayer(width,height,PlayerUseType.Video);
+
+ default:
+ return new GstPlayer(width,height,PlayerUseType.Video);
+ }
}
-
- public IPlayer getPlayer(int width, int height){
- switch (oS.Platform) {
- case PlatformID.Unix:
- return new GstPlayer(width,height,PlayerUseType.Video);
-
- case PlatformID.Win32NT:
- return new GstPlayer(width,height,PlayerUseType.Video);
-
- default:
- return new GstPlayer(width,height,PlayerUseType.Video);
- }
+
+ public IMetadataReader getMetadataReader() {
+
+ switch(oS.Platform) {
+ case PlatformID.Unix:
+ return new GstPlayer(1,1,PlayerUseType.Metadata);
+
+ case PlatformID.Win32NT:
+ return new GstPlayer(1,1,PlayerUseType.Metadata);
+
+ default:
+ return new GstPlayer(1,1,PlayerUseType.Metadata);
+ }
}
-
- public IMetadataReader getMetadataReader(){
-
- switch (oS.Platform) {
- case PlatformID.Unix:
- return new GstPlayer(1,1,PlayerUseType.Metadata);
-
- case PlatformID.Win32NT:
- return new GstPlayer(1,1,PlayerUseType.Metadata);
-
- default:
- return new GstPlayer(1,1,PlayerUseType.Metadata);
+
+ public IFramesCapturer getFramesCapturer() {
+ switch(oS.Platform) {
+ case PlatformID.Unix:
+ return new GstPlayer(1,1,PlayerUseType.Capture);
+
+ case PlatformID.Win32NT:
+ return new GstPlayer(1,1,PlayerUseType.Capture);
+
+ default:
+ return new GstPlayer(1,1,PlayerUseType.Capture);
}
}
-
- public IFramesCapturer getFramesCapturer(){
- switch (oS.Platform) {
- case PlatformID.Unix:
- return new GstPlayer(1,1,PlayerUseType.Capture);
-
- case PlatformID.Win32NT:
- return new GstPlayer(1,1,PlayerUseType.Capture);
-
- default:
- return new GstPlayer(1,1,PlayerUseType.Capture);
+
+ public IVideoEditor getVideoEditor() {
+ switch(oS.Platform) {
+ case PlatformID.Unix:
+ return new GstVideoSplitter();
+
+ case PlatformID.Win32NT:
+ return new GstVideoSplitter();
+
+ default:
+ return new GstVideoSplitter();
}
}
-
- public IVideoEditor getVideoEditor(){
- switch (oS.Platform) {
- case PlatformID.Unix:
- return new GstVideoSplitter();
-
- case PlatformID.Win32NT:
- return new GstVideoSplitter();
-
- default:
- return new GstVideoSplitter();
+
+ public ICapturer getCapturer(CapturerType type) {
+ switch(type) {
+ case CapturerType.Fake:
+ return new FakeCapturer();
+
+ case CapturerType.Live:
+ return new GstCameraCapturer("test.avi");
+
+ default:
+ return new FakeCapturer();
}
- }
-
- public ICapturer getCapturer(CapturerType type){
- switch (type) {
- case CapturerType.Fake:
- return new FakeCapturer();
-
- case CapturerType.Live:
- return new GstCameraCapturer("test.avi");
-
- default:
- return new FakeCapturer();
- }
}
}
}
\ No newline at end of file
diff --git a/CesarPlayer/Player/GstDVDEvent.cs b/CesarPlayer/Player/GstDVDEvent.cs
index bd66d5f..51dfdc3 100644
--- a/CesarPlayer/Player/GstDVDEvent.cs
+++ b/CesarPlayer/Player/GstDVDEvent.cs
@@ -9,7 +9,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -21,7 +21,7 @@ namespace LongoMatch.Video.Player {
using System;
using System.Runtime.InteropServices;
-#region Autogenerated code
+ #region Autogenerated code
public enum GstDVDEvent {
RootMenu,
@@ -42,5 +42,5 @@ namespace LongoMatch.Video.Player {
RootMenuRight,
RootMenuSelect,
}
-#endregion
+ #endregion
}
diff --git a/CesarPlayer/Player/GstPlayer.cs b/CesarPlayer/Player/GstPlayer.cs
index 6f51e51..d4d2ead 100644
--- a/CesarPlayer/Player/GstPlayer.cs
+++ b/CesarPlayer/Player/GstPlayer.cs
@@ -9,7 +9,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -24,8 +24,8 @@ namespace LongoMatch.Video.Player {
using LongoMatch.Video.Common;
using LongoMatch.Video.Utils;
-#region Autogenerated code
- public class GstPlayer : Gtk.EventBox,IPlayer, IMetadataReader, IFramesCapturer{
+ #region Autogenerated code
+ public class GstPlayer : Gtk.EventBox,IPlayer, IMetadataReader, IFramesCapturer {
[Obsolete]
protected GstPlayer(GLib.GType gtype) : base(gtype) {}
@@ -34,22 +34,22 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern unsafe IntPtr bacon_video_widget_new(int width, int height, int type, out IntPtr error);
- public unsafe GstPlayer (int width, int height, PlayerUseType type) : base (IntPtr.Zero)
+ public unsafe GstPlayer(int width, int height, PlayerUseType type) : base(IntPtr.Zero)
{
- if (GetType () != typeof (GstPlayer)) {
- throw new InvalidOperationException ("Can't override this constructor.");
+ if(GetType() != typeof(GstPlayer)) {
+ throw new InvalidOperationException("Can't override this constructor.");
}
IntPtr error = IntPtr.Zero;
Raw = bacon_video_widget_new(width, height, (int) type, out error);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
}
- [GLib.Property ("seekable")]
+ [GLib.Property("seekable")]
public bool Seekable {
get {
- GLib.Value val = GetProperty ("seekable");
+ GLib.Value val = GetProperty("seekable");
bool ret = (bool) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
}
@@ -60,7 +60,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_logo_mode(IntPtr raw, bool logo_mode);
- [GLib.Property ("logo_mode")]
+ [GLib.Property("logo_mode")]
public bool LogoMode {
get {
bool raw_ret = bacon_video_widget_get_logo_mode(Handle);
@@ -70,27 +70,27 @@ namespace LongoMatch.Video.Player {
set {
bacon_video_widget_set_logo_mode(Handle, value);
}
- }
-
- [GLib.Property ("expand_logo")]
+ }
+
+ [GLib.Property("expand_logo")]
public bool ExpandLogo {
get {
- GLib.Value val = GetProperty ("expand_logo");
+ GLib.Value val = GetProperty("expand_logo");
bool ret = (bool) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("expand_logo", val);
- val.Dispose ();
+ val.Dispose();
}
}
[DllImport("libcesarplayer.dll")]
static extern long bacon_video_widget_get_stream_length(IntPtr raw);
- [GLib.Property ("stream_length")]
+ [GLib.Property("stream_length")]
public long StreamLength {
get {
long raw_ret = bacon_video_widget_get_stream_length(Handle);
@@ -105,7 +105,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_volume(IntPtr raw, double volume);
- [GLib.Property ("volume")]
+ [GLib.Property("volume")]
public double Volume {
get {
double raw_ret = bacon_video_widget_get_volume(Handle);
@@ -117,27 +117,27 @@ namespace LongoMatch.Video.Player {
}
}
- [GLib.Property ("showcursor")]
+ [GLib.Property("showcursor")]
public bool Showcursor {
get {
- GLib.Value val = GetProperty ("showcursor");
+ GLib.Value val = GetProperty("showcursor");
bool ret = (bool) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("showcursor", val);
- val.Dispose ();
+ val.Dispose();
}
}
- [GLib.Property ("playing")]
+ [GLib.Property("playing")]
public bool Playing {
get {
- GLib.Value val = GetProperty ("playing");
+ GLib.Value val = GetProperty("playing");
bool ret = (bool) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
}
@@ -145,7 +145,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern double bacon_video_widget_get_position(IntPtr raw);
- [GLib.Property ("position")]
+ [GLib.Property("position")]
public double Position {
get {
double raw_ret = bacon_video_widget_get_position(Handle);
@@ -158,115 +158,115 @@ namespace LongoMatch.Video.Player {
}
- [GLib.Property ("mediadev")]
+ [GLib.Property("mediadev")]
public string Mediadev {
get {
- GLib.Value val = GetProperty ("mediadev");
+ GLib.Value val = GetProperty("mediadev");
string ret = (string) val;
- val.Dispose ();
+ val.Dispose();
return ret;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("mediadev", val);
- val.Dispose ();
+ val.Dispose();
}
}
#pragma warning disable 0169
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void ReadyToSeekVMDelegate (IntPtr bvw);
+ delegate void ReadyToSeekVMDelegate(IntPtr bvw);
static ReadyToSeekVMDelegate ReadyToSeekVMCallback;
- static void readytoseek_cb (IntPtr bvw)
+ static void readytoseek_cb(IntPtr bvw)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnReadyToSeek ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnReadyToSeek();
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideReadyToSeek (GLib.GType gtype)
+ private static void OverrideReadyToSeek(GLib.GType gtype)
{
- if (ReadyToSeekVMCallback == null)
- ReadyToSeekVMCallback = new ReadyToSeekVMDelegate (readytoseek_cb);
- OverrideVirtualMethod (gtype, "ready_to_seek", ReadyToSeekVMCallback);
+ if(ReadyToSeekVMCallback == null)
+ ReadyToSeekVMCallback = new ReadyToSeekVMDelegate(readytoseek_cb);
+ OverrideVirtualMethod(gtype, "ready_to_seek", ReadyToSeekVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideReadyToSeek")]
- protected virtual void OnReadyToSeek ()
+ protected virtual void OnReadyToSeek()
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
GLib.Value[] vals = new GLib.Value [1];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("ready_to_seek")]
public event System.EventHandler ReadyToSeek {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "ready_to_seek");
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "ready_to_seek");
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "ready_to_seek");
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "ready_to_seek");
+ sig.RemoveDelegate(value);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void StateChangeVMDelegate (IntPtr bvw, bool playing);
+ delegate void StateChangeVMDelegate(IntPtr bvw, bool playing);
static StateChangeVMDelegate StateChangeVMCallback;
- static void statechange_cb (IntPtr bvw, bool playing)
+ static void statechange_cb(IntPtr bvw, bool playing)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnStateChange (playing);
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnStateChange(playing);
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideStateChange (GLib.GType gtype)
+ private static void OverrideStateChange(GLib.GType gtype)
{
- if (StateChangeVMCallback == null)
- StateChangeVMCallback = new StateChangeVMDelegate (statechange_cb);
- OverrideVirtualMethod (gtype, "state_change", StateChangeVMCallback);
+ if(StateChangeVMCallback == null)
+ StateChangeVMCallback = new StateChangeVMDelegate(statechange_cb);
+ OverrideVirtualMethod(gtype, "state_change", StateChangeVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideStateChange")]
- protected virtual void OnStateChange (bool playing)
+ protected virtual void OnStateChange(bool playing)
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
GLib.Value[] vals = new GLib.Value [2];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- vals [1] = new GLib.Value (playing);
- inst_and_params.Append (vals [1]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ vals [1] = new GLib.Value(playing);
+ inst_and_params.Append(vals [1]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("state_change")]
public event StateChangeHandler StateChange {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "state_change", typeof (StateChangeArgs));
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "state_change", typeof(StateChangeArgs));
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "state_change", typeof (StateChangeArgs));
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "state_change", typeof(StateChangeArgs));
+ sig.RemoveDelegate(value);
}
}
@@ -320,145 +320,145 @@ namespace LongoMatch.Video.Player {
}*/
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void SegmentDoneVMDelegate (IntPtr bvw);
+ delegate void SegmentDoneVMDelegate(IntPtr bvw);
static SegmentDoneVMDelegate SegmentDoneVMCallback;
- static void segmentdone_cb (IntPtr bvw)
+ static void segmentdone_cb(IntPtr bvw)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnSegmentDone ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnSegmentDone();
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideSegmentDone (GLib.GType gtype)
+ private static void OverrideSegmentDone(GLib.GType gtype)
{
- if (SegmentDoneVMCallback == null)
- SegmentDoneVMCallback = new SegmentDoneVMDelegate (segmentdone_cb);
- OverrideVirtualMethod (gtype, "segment_done", SegmentDoneVMCallback);
+ if(SegmentDoneVMCallback == null)
+ SegmentDoneVMCallback = new SegmentDoneVMDelegate(segmentdone_cb);
+ OverrideVirtualMethod(gtype, "segment_done", SegmentDoneVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideSegmentDone")]
- protected virtual void OnSegmentDone ()
+ protected virtual void OnSegmentDone()
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
GLib.Value[] vals = new GLib.Value [1];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("segment_done")]
public event System.EventHandler SegmentDone {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "segment_done");
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "segment_done");
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "segment_done");
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "segment_done");
+ sig.RemoveDelegate(value);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void EosVMDelegate (IntPtr bvw);
+ delegate void EosVMDelegate(IntPtr bvw);
static EosVMDelegate EosVMCallback;
- static void eos_cb (IntPtr bvw)
+ static void eos_cb(IntPtr bvw)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnEos ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnEos();
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideEos (GLib.GType gtype)
+ private static void OverrideEos(GLib.GType gtype)
{
- if (EosVMCallback == null)
- EosVMCallback = new EosVMDelegate (eos_cb);
- OverrideVirtualMethod (gtype, "eos", EosVMCallback);
+ if(EosVMCallback == null)
+ EosVMCallback = new EosVMDelegate(eos_cb);
+ OverrideVirtualMethod(gtype, "eos", EosVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideEos")]
- protected virtual void OnEos ()
+ protected virtual void OnEos()
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
GLib.Value[] vals = new GLib.Value [1];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("eos")]
public event System.EventHandler Eos {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "eos");
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "eos");
+ sig.RemoveDelegate(value);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void ErrorVMDelegate (IntPtr bvw, IntPtr message);
+ delegate void ErrorVMDelegate(IntPtr bvw, IntPtr message);
static ErrorVMDelegate ErrorVMCallback;
- static void error_cb (IntPtr bvw, IntPtr message)
+ static void error_cb(IntPtr bvw, IntPtr message)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnError(GLib.Marshaller.Utf8PtrToString(message));
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideError (GLib.GType gtype)
+ private static void OverrideError(GLib.GType gtype)
{
- if (ErrorVMCallback == null)
- ErrorVMCallback = new ErrorVMDelegate (error_cb);
- OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+ if(ErrorVMCallback == null)
+ ErrorVMCallback = new ErrorVMDelegate(error_cb);
+ OverrideVirtualMethod(gtype, "error", ErrorVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideError")]
- protected virtual void OnError (string message)
+ protected virtual void OnError(string message)
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
GLib.Value[] vals = new GLib.Value [2];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- vals [1] = new GLib.Value (message);
- inst_and_params.Append (vals [1]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ vals [1] = new GLib.Value(message);
+ inst_and_params.Append(vals [1]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("error")]
public event ErrorHandler Error {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "error", typeof(ErrorArgs));
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "error", typeof(ErrorArgs));
+ sig.RemoveDelegate(value);
}
}
@@ -512,151 +512,151 @@ namespace LongoMatch.Video.Player {
}*/
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void ChannelsChangeVMDelegate (IntPtr bvw);
+ delegate void ChannelsChangeVMDelegate(IntPtr bvw);
static ChannelsChangeVMDelegate ChannelsChangeVMCallback;
- static void channelschange_cb (IntPtr bvw)
+ static void channelschange_cb(IntPtr bvw)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnChannelsChange ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnChannelsChange();
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideChannelsChange (GLib.GType gtype)
+ private static void OverrideChannelsChange(GLib.GType gtype)
{
- if (ChannelsChangeVMCallback == null)
- ChannelsChangeVMCallback = new ChannelsChangeVMDelegate (channelschange_cb);
- OverrideVirtualMethod (gtype, "channels-change", ChannelsChangeVMCallback);
+ if(ChannelsChangeVMCallback == null)
+ ChannelsChangeVMCallback = new ChannelsChangeVMDelegate(channelschange_cb);
+ OverrideVirtualMethod(gtype, "channels-change", ChannelsChangeVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideChannelsChange")]
- protected virtual void OnChannelsChange ()
+ protected virtual void OnChannelsChange()
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
GLib.Value[] vals = new GLib.Value [1];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("channels-change")]
public event System.EventHandler ChannelsChange {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "channels-change");
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "channels-change");
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "channels-change");
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "channels-change");
+ sig.RemoveDelegate(value);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void GotMetadataVMDelegate (IntPtr bvw);
+ delegate void GotMetadataVMDelegate(IntPtr bvw);
static GotMetadataVMDelegate GotMetadataVMCallback;
- static void gotmetadata_cb (IntPtr bvw)
+ static void gotmetadata_cb(IntPtr bvw)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnGotMetadata ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnGotMetadata();
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideGotMetadata (GLib.GType gtype)
+ private static void OverrideGotMetadata(GLib.GType gtype)
{
- if (GotMetadataVMCallback == null)
- GotMetadataVMCallback = new GotMetadataVMDelegate (gotmetadata_cb);
- OverrideVirtualMethod (gtype, "got-metadata", GotMetadataVMCallback);
+ if(GotMetadataVMCallback == null)
+ GotMetadataVMCallback = new GotMetadataVMDelegate(gotmetadata_cb);
+ OverrideVirtualMethod(gtype, "got-metadata", GotMetadataVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideGotMetadata")]
- protected virtual void OnGotMetadata ()
+ protected virtual void OnGotMetadata()
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
GLib.Value[] vals = new GLib.Value [1];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("got-metadata")]
public event System.EventHandler GotMetadata {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "got-metadata");
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "got-metadata");
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "got-metadata");
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "got-metadata");
+ sig.RemoveDelegate(value);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void TickVMDelegate (IntPtr bvw, long current_time, long stream_length, float current_position, bool seekable);
+ delegate void TickVMDelegate(IntPtr bvw, long current_time, long stream_length, float current_position, bool seekable);
static TickVMDelegate TickVMCallback;
- static void tick_cb (IntPtr bvw, long current_time, long stream_length, float current_position, bool seekable)
+ static void tick_cb(IntPtr bvw, long current_time, long stream_length, float current_position, bool seekable)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnTick (current_time, stream_length, current_position, seekable);
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnTick(current_time, stream_length, current_position, seekable);
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideTick (GLib.GType gtype)
+ private static void OverrideTick(GLib.GType gtype)
{
- if (TickVMCallback == null)
- TickVMCallback = new TickVMDelegate (tick_cb);
- OverrideVirtualMethod (gtype, "tick", TickVMCallback);
+ if(TickVMCallback == null)
+ TickVMCallback = new TickVMDelegate(tick_cb);
+ OverrideVirtualMethod(gtype, "tick", TickVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideTick")]
- protected virtual void OnTick (long current_time, long stream_length, float current_position, bool seekable)
+ protected virtual void OnTick(long current_time, long stream_length, float current_position, bool seekable)
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (5);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(5);
GLib.Value[] vals = new GLib.Value [5];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- vals [1] = new GLib.Value (current_time);
- inst_and_params.Append (vals [1]);
- vals [2] = new GLib.Value (stream_length);
- inst_and_params.Append (vals [2]);
- vals [3] = new GLib.Value (current_position);
- inst_and_params.Append (vals [3]);
- vals [4] = new GLib.Value (seekable);
- inst_and_params.Append (vals [4]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ vals [1] = new GLib.Value(current_time);
+ inst_and_params.Append(vals [1]);
+ vals [2] = new GLib.Value(stream_length);
+ inst_and_params.Append(vals [2]);
+ vals [3] = new GLib.Value(current_position);
+ inst_and_params.Append(vals [3]);
+ vals [4] = new GLib.Value(seekable);
+ inst_and_params.Append(vals [4]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("tick")]
public event TickHandler Tick {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "tick", typeof (TickArgs));
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "tick", typeof(TickArgs));
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "tick", typeof (TickArgs));
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "tick", typeof(TickArgs));
+ sig.RemoveDelegate(value);
}
}
@@ -710,49 +710,49 @@ namespace LongoMatch.Video.Player {
}*/
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void GotDurationVMDelegate (IntPtr bvw);
+ delegate void GotDurationVMDelegate(IntPtr bvw);
static GotDurationVMDelegate GotDurationVMCallback;
- static void gotduration_cb (IntPtr bvw)
+ static void gotduration_cb(IntPtr bvw)
{
try {
- GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
- bvw_managed.OnGotDuration ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
+ bvw_managed.OnGotDuration();
+ } catch(Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException(e, false);
}
}
- private static void OverrideGotDuration (GLib.GType gtype)
+ private static void OverrideGotDuration(GLib.GType gtype)
{
- if (GotDurationVMCallback == null)
- GotDurationVMCallback = new GotDurationVMDelegate (gotduration_cb);
- OverrideVirtualMethod (gtype, "got_duration", GotDurationVMCallback);
+ if(GotDurationVMCallback == null)
+ GotDurationVMCallback = new GotDurationVMDelegate(gotduration_cb);
+ OverrideVirtualMethod(gtype, "got_duration", GotDurationVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideGotDuration")]
- protected virtual void OnGotDuration ()
+ protected virtual void OnGotDuration()
{
GLib.Value ret = GLib.Value.Empty;
- GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
GLib.Value[] vals = new GLib.Value [1];
- vals [0] = new GLib.Value (this);
- inst_and_params.Append (vals [0]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
- foreach (GLib.Value v in vals)
- v.Dispose ();
+ vals [0] = new GLib.Value(this);
+ inst_and_params.Append(vals [0]);
+ g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
+ foreach(GLib.Value v in vals)
+ v.Dispose();
}
[GLib.Signal("got_duration")]
public event System.EventHandler GotDuration {
add {
- GLib.Signal sig = GLib.Signal.Lookup (this, "got_duration");
- sig.AddDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "got_duration");
+ sig.AddDelegate(value);
}
remove {
- GLib.Signal sig = GLib.Signal.Lookup (this, "got_duration");
- sig.RemoveDelegate (value);
+ GLib.Signal sig = GLib.Signal.Lookup(this, "got_duration");
+ sig.RemoveDelegate(value);
}
}
#pragma warning restore 0169
@@ -780,7 +780,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern bool bacon_video_widget_is_playing(IntPtr raw);
- public bool IsPlaying {
+ public bool IsPlaying {
get {
bool raw_ret = bacon_video_widget_is_playing(Handle);
bool ret = raw_ret;
@@ -794,7 +794,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_auto_resize(IntPtr raw, bool auto_resize);
- public bool AutoResize {
+ public bool AutoResize {
get {
bool raw_ret = bacon_video_widget_get_auto_resize(Handle);
bool ret = raw_ret;
@@ -820,7 +820,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_show_cursor(IntPtr raw, bool show_cursor);
- public bool ShowCursor {
+ public bool ShowCursor {
get {
bool raw_ret = bacon_video_widget_get_show_cursor(Handle);
bool ret = raw_ret;
@@ -853,7 +853,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_zoom(IntPtr raw, double zoom);
- public double Zoom {
+ public double Zoom {
get {
double raw_ret = bacon_video_widget_get_zoom(Handle);
double ret = raw_ret;
@@ -892,7 +892,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern bool bacon_video_widget_has_next_track(IntPtr raw);
- public bool HasNextTrack {
+ public bool HasNextTrack {
get {
bool raw_ret = bacon_video_widget_has_next_track(Handle);
bool ret = raw_ret;
@@ -903,11 +903,11 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_subtitle_font(IntPtr raw, IntPtr font);
- public string SubtitleFont {
+ public string SubtitleFont {
set {
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
bacon_video_widget_set_subtitle_font(Handle, native_value);
- GLib.Marshaller.Free (native_value);
+ GLib.Marshaller.Free(native_value);
}
}
@@ -915,17 +915,17 @@ namespace LongoMatch.Video.Player {
static extern bool bacon_video_widget_set_visuals(IntPtr raw, IntPtr name);
public bool SetVisuals(string name) {
- IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
+ IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
bool raw_ret = bacon_video_widget_set_visuals(Handle, native_name);
bool ret = raw_ret;
- GLib.Marshaller.Free (native_name);
+ GLib.Marshaller.Free(native_name);
return ret;
}
[DllImport("libcesarplayer.dll")]
static extern long bacon_video_widget_get_accurate_current_time(IntPtr raw);
- public long AccurateCurrentTime {
+ public long AccurateCurrentTime {
get {
long raw_ret = bacon_video_widget_get_accurate_current_time(Handle);
long ret = raw_ret;
@@ -948,7 +948,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_language(IntPtr raw, int language);
- public int Language {
+ public int Language {
get {
int raw_ret = bacon_video_widget_get_language(Handle);
int ret = raw_ret;
@@ -971,7 +971,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern bool bacon_video_widget_is_seekable(IntPtr raw);
- public bool IsSeekable {
+ public bool IsSeekable {
get {
bool raw_ret = bacon_video_widget_is_seekable(Handle);
bool ret = raw_ret;
@@ -986,14 +986,14 @@ namespace LongoMatch.Video.Player {
IntPtr error = IntPtr.Zero;
bool raw_ret = bacon_video_widget_can_get_frames(Handle, out error);
bool ret = raw_ret;
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
return ret;
}
[DllImport("libcesarplayer.dll")]
static extern long bacon_video_widget_get_current_time(IntPtr raw);
- public long CurrentTime {
+ public long CurrentTime {
get {
long raw_ret = bacon_video_widget_get_current_time(Handle);
long ret = raw_ret;
@@ -1013,7 +1013,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern IntPtr bacon_video_widget_get_type();
- public static new GLib.GType GType {
+ public static new GLib.GType GType {
get {
IntPtr raw_ret = bacon_video_widget_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
@@ -1024,7 +1024,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern IntPtr bacon_video_widget_get_languages(IntPtr raw);
- public GLib.List Languages {
+ public GLib.List Languages {
get {
IntPtr raw_ret = bacon_video_widget_get_languages(Handle);
GLib.List ret = new GLib.List(raw_ret);
@@ -1035,7 +1035,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_fullscreen(IntPtr raw, bool fullscreen);
- public bool Fullscreen {
+ public bool Fullscreen {
set {
bacon_video_widget_set_fullscreen(Handle, value);
}
@@ -1053,7 +1053,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern bool bacon_video_widget_has_previous_track(IntPtr raw);
- public bool HasPreviousTrack {
+ public bool HasPreviousTrack {
get {
bool raw_ret = bacon_video_widget_has_previous_track(Handle);
bool ret = raw_ret;
@@ -1064,12 +1064,12 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_logo_pixbuf(IntPtr raw, IntPtr logo);
- public Gdk.Pixbuf LogoPixbuf {
+ public Gdk.Pixbuf LogoPixbuf {
set {
bacon_video_widget_set_logo_pixbuf(Handle, value == null ? IntPtr.Zero : value.Handle);
}
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_drawing_pixbuf(IntPtr raw, IntPtr drawing_mode);
@@ -1078,7 +1078,7 @@ namespace LongoMatch.Video.Player {
bacon_video_widget_set_drawing_pixbuf(Handle, value == null ? IntPtr.Zero : value.Handle);
}
}
-
+
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_drawing_mode(IntPtr raw, bool drawing_mode);
@@ -1091,7 +1091,7 @@ namespace LongoMatch.Video.Player {
/*[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_visuals_quality(IntPtr raw, int quality);
- public GstVisualsQuality VisualsQuality {
+ public GstVisualsQuality VisualsQuality {
set {
bacon_video_widget_set_visuals_quality(Handle, (int) value);
}
@@ -1103,7 +1103,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_connection_speed(IntPtr raw, int speed);
- public int ConnectionSpeed {
+ public int ConnectionSpeed {
get {
int raw_ret = bacon_video_widget_get_connection_speed(Handle);
int ret = raw_ret;
@@ -1117,7 +1117,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern IntPtr bacon_video_widget_get_subtitles(IntPtr raw);
- public GLib.List Subtitles {
+ public GLib.List Subtitles {
get {
IntPtr raw_ret = bacon_video_widget_get_subtitles(Handle);
GLib.List ret = new GLib.List(raw_ret);
@@ -1127,26 +1127,26 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern IntPtr bacon_video_widget_get_current_frame(IntPtr raw);
-
+
[DllImport("libcesarplayer.dll")]
static extern IntPtr bacon_video_widget_unref_pixbuf(IntPtr raw);
- public Gdk.Pixbuf GetCurrentFrame(int outwidth, int outheight) {
+ public Gdk.Pixbuf GetCurrentFrame(int outwidth, int outheight) {
IntPtr raw_ret = bacon_video_widget_get_current_frame(Handle);
Gdk.Pixbuf unmanaged = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
- if (unmanaged == null)
+ if(unmanaged == null)
return null;
Gdk.Pixbuf managed;
int h = unmanaged.Height;
int w = unmanaged.Width;
double rate = (double)w/(double)h;
- if (outwidth == -1 || outheight == -1){
+ if(outwidth == -1 || outheight == -1) {
outwidth = w;
outheight = h;
- }else if (h>w){
+ } else if(h>w) {
outwidth = (int)(outheight*rate);
- }else{
+ } else {
outheight = (int)(outwidth/rate);
}
managed = unmanaged.ScaleSimple(outwidth,outheight,Gdk.InterpType.Bilinear);
@@ -1154,15 +1154,15 @@ namespace LongoMatch.Video.Player {
bacon_video_widget_unref_pixbuf(raw_ret);
return managed;
}
-
- public Gdk.Pixbuf GetCurrentFrame() {
+
+ public Gdk.Pixbuf GetCurrentFrame() {
return GetCurrentFrame(-1,-1);
}
[DllImport("libcesarplayer.dll")]
static extern IntPtr bacon_video_widget_get_visuals_list(IntPtr raw);
- public GLib.List VisualsList {
+ public GLib.List VisualsList {
get {
IntPtr raw_ret = bacon_video_widget_get_visuals_list(Handle);
GLib.List ret = new GLib.List(raw_ret);
@@ -1182,18 +1182,18 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_subtitle_encoding(IntPtr raw, IntPtr encoding);
- public string SubtitleEncoding {
+ public string SubtitleEncoding {
set {
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
bacon_video_widget_set_subtitle_encoding(Handle, native_value);
- GLib.Marshaller.Free (native_value);
+ GLib.Marshaller.Free(native_value);
}
}
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_aspect_ratio(IntPtr raw, int ratio);
- public AspectRatio AspectRatio {
+ public AspectRatio AspectRatio {
set {
bacon_video_widget_set_aspect_ratio(Handle, (int) value);
}
@@ -1212,7 +1212,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_deinterlacing(IntPtr raw, bool deinterlace);
- public bool Deinterlacing {
+ public bool Deinterlacing {
get {
bool raw_ret = bacon_video_widget_get_deinterlacing(Handle);
bool ret = raw_ret;
@@ -1237,10 +1237,10 @@ namespace LongoMatch.Video.Player {
public object GetMetadata(MetadataType type) {
GLib.Value val = new GLib.Value();
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (val);
+ IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc(val);
bacon_video_widget_get_metadata(Handle, (int) type, native_value);
- val = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ val = (GLib.Value) Marshal.PtrToStructure(native_value, typeof(GLib.Value));
+ Marshal.FreeHGlobal(native_value);
return val.Val;
}
@@ -1284,7 +1284,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_subtitle(IntPtr raw, int subtitle);
- public int Subtitle {
+ public int Subtitle {
get {
int raw_ret = bacon_video_widget_get_subtitle(Handle);
int ret = raw_ret;
@@ -1308,17 +1308,17 @@ namespace LongoMatch.Video.Player {
static extern unsafe bool bacon_video_widget_open(IntPtr raw, IntPtr mrl, IntPtr subtitle_uri, out IntPtr error);
public unsafe bool Open(string mrl, string subtitle_uri) {
- IntPtr native_mrl = GLib.Marshaller.StringToPtrGStrdup (mrl);
- IntPtr native_subtitle_uri = GLib.Marshaller.StringToPtrGStrdup (subtitle_uri);
+ IntPtr native_mrl = GLib.Marshaller.StringToPtrGStrdup(mrl);
+ IntPtr native_subtitle_uri = GLib.Marshaller.StringToPtrGStrdup(subtitle_uri);
IntPtr error = IntPtr.Zero;
bool raw_ret = bacon_video_widget_open(Handle, native_mrl, native_subtitle_uri, out error);
bool ret = raw_ret;
- GLib.Marshaller.Free (native_mrl);
- GLib.Marshaller.Free (native_subtitle_uri);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ GLib.Marshaller.Free(native_mrl);
+ GLib.Marshaller.Free(native_subtitle_uri);
+ if(error != IntPtr.Zero) throw new GLib.GException(error);
return ret;
}
-
+
[DllImport("libcesarplayer.dll")]
static extern bool bacon_video_widget_new_file_seek(IntPtr raw, long start,long stop,float rate);
@@ -1350,7 +1350,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_show_visuals(IntPtr raw, bool show_visuals);
- public bool ShowVisuals {
+ public bool ShowVisuals {
set {
bacon_video_widget_set_show_visuals(Handle, value);
}
@@ -1359,7 +1359,7 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_logo(IntPtr raw, IntPtr filename);
- public string Logo {
+ public string Logo {
set {
bacon_video_widget_set_logo(Handle, GLib.Marshaller.StringToPtrGStrdup(value));
}
@@ -1377,39 +1377,39 @@ namespace LongoMatch.Video.Player {
[DllImport("libcesarplayer.dll")]
static extern void bacon_video_widget_set_scale_ratio(IntPtr raw, float ratio);
- public float ScaleRatio {
+ public float ScaleRatio {
set {
bacon_video_widget_set_scale_ratio(Handle, value);
}
}
- static GstPlayer ()
+ static GstPlayer()
{
- LongoMatch.GtkSharp.Video.ObjectManager.Initialize ();
+ LongoMatch.GtkSharp.Video.ObjectManager.Initialize();
}
-#endregion
-
+ #endregion
+
public bool SeekTime(long time, bool accurate) {
return SeekTime(time,1,accurate);
}
-
-
- public void TogglePlay(){
- if(!this.Playing){
+
+
+ public void TogglePlay() {
+ if(!this.Playing) {
this.Play();
}
- else{
- this.Pause();
- }
+ else {
+ this.Pause();
+ }
}
-
- public bool Open(string mrl){
+
+ public bool Open(string mrl) {
return Open(mrl, null);
}
-
- public void CancelProgramedStop(){
- this.SegmentSeek(this.CurrentTime,this.StreamLength,1);
+
+ public void CancelProgramedStop() {
+ this.SegmentSeek(this.CurrentTime,this.StreamLength,1);
}
-
+
}
}
diff --git a/CesarPlayer/Player/IPlayer.cs b/CesarPlayer/Player/IPlayer.cs
index b24dbbf..f98a401 100644
--- a/CesarPlayer/Player/IPlayer.cs
+++ b/CesarPlayer/Player/IPlayer.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -25,15 +25,15 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Video.Player
-
+
{
public interface IPlayer
{
-
+
// Events
-
-
+
+
event ErrorHandler Error;
event System.EventHandler Eos;
event StateChangeHandler StateChange;
@@ -41,106 +41,106 @@ namespace LongoMatch.Video.Player
event System.EventHandler GotDuration;
event System.EventHandler SegmentDone;
event System.EventHandler ReadyToSeek;
-
-
- long StreamLength{
+
+
+ long StreamLength {
get;
}
-
-
-
- long CurrentTime{
+
+
+
+ long CurrentTime {
get;
-
+
}
-
- double Position{
+
+ double Position {
get;
set;
-
+
}
-
+
bool LogoMode {
get;
set;
}
-
+
bool DrawingMode {
set;
}
-
+
Pixbuf DrawingPixbuf {
set;
}
-
- bool ExpandLogo{
+
+ bool ExpandLogo {
get;
set;
}
-
- double Volume{
+
+ double Volume {
get;
set;
- }
-
+ }
+
bool Playing {
get;
}
-
+
string Logo {
set;
}
-
- Pixbuf LogoPixbuf{
+
+ Pixbuf LogoPixbuf {
set;
}
-
- long AccurateCurrentTime{
+
+ long AccurateCurrentTime {
get;
}
-
+
bool SeekTime(long time,float rate, bool accurate);
-
+
bool Play();
-
+
bool Open(string mrl);
-
+
bool SetRate(float rate);
-
+
bool SetRateInSegment(float rate, long stopTime);
-
-
-
+
+
+
void TogglePlay();
-
+
void Pause();
-
+
void Stop();
-
+
void Close();
-
-
+
+
void Dispose();
-
+
bool SegmentSeek(long start, long stop,float rate);
-
+
bool SeekInSegment(long pos,float rate);
-
+
bool NewFileSeek(long start, long stop,float rate);
-
+
bool SegmentStartUpdate(long start,float rate);
-
+
bool SegmentStopUpdate(long stop,float rate);
-
+
bool SeekToNextFrame(float rate,bool in_segment);
-
+
bool SeekToPreviousFrame(float rate,bool in_segment);
-
+
Pixbuf GetCurrentFrame(int outwidth, int outheight);
-
+
Pixbuf GetCurrentFrame();
-
+
void CancelProgramedStop();
-
+
}
}
diff --git a/CesarPlayer/Player/ObjectManager.cs b/CesarPlayer/Player/ObjectManager.cs
index 6fdbdcc..401cb05 100644
--- a/CesarPlayer/Player/ObjectManager.cs
+++ b/CesarPlayer/Player/ObjectManager.cs
@@ -10,7 +10,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -24,14 +24,14 @@ namespace LongoMatch.GtkSharp.Video {
static bool initialized = false;
// Call this method from the appropriate module init function.
- public static void Initialize ()
+ public static void Initialize()
{
- if (initialized)
+ if(initialized)
return;
initialized = true;
-
- GLib.GType.Register (LongoMatch.Video.Player.GstPlayer.GType, typeof (LongoMatch.Video.Player.GstPlayer));
+
+ GLib.GType.Register(LongoMatch.Video.Player.GstPlayer.GType, typeof(LongoMatch.Video.Player.GstPlayer));
}
}
diff --git a/CesarPlayer/Utils/Device.cs b/CesarPlayer/Utils/Device.cs
index c0fde57..63efda2 100644
--- a/CesarPlayer/Utils/Device.cs
+++ b/CesarPlayer/Utils/Device.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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.Collections.Generic;
@@ -28,8 +28,8 @@ namespace LongoMatch.Video.Utils
public class Device
{
- public Device () {
-
+ public Device() {
+
}
/// <summary>
@@ -41,49 +41,51 @@ namespace LongoMatch.Video.Utils
}
/// <summary>
- /// Device id, can be a human friendly name (for DirectShow devices),
- /// the de device name (/dev/video0) or the GUID (dv1394src)
+ /// Device id, can be a human friendly name (for DirectShow devices),
+ /// the de device name (/dev/video0) or the GUID (dv1394src)
/// </summary>
public string ID {
get;
set;
}
-
+
/// <summary>
/// The name of the gstreamer element property used to set the device
/// </summary>
-
+
public string IDProperty {
get;
set;
}
-
- static public List<Device> ListVideoDevices (){
+
+ static public List<Device> ListVideoDevices() {
List<Device> devicesList = new List<Device>();
-
+
/* Generate the list of devices and add the gconf one at the bottom
- * so that DV sources are always selected before, at least on Linux,
+ * so that DV sources are always selected before, at least on Linux,
* since on Windows both raw an dv sources are listed from the same
* source element (dshowvideosrc) */
- foreach (string devName in GstCameraCapturer.VideoDevices){
+ foreach(string devName in GstCameraCapturer.VideoDevices) {
string idProp;
-
- if (Environment.OSVersion.Platform == PlatformID.Unix)
+
+ if(Environment.OSVersion.Platform == PlatformID.Unix)
idProp = Constants.DV1394SRC_PROP;
- else
+ else
idProp = Constants.DSHOWVIDEOSINK_PROP;
-
+
devicesList.Add(new Device {
ID = devName,
IDProperty = idProp,
- DeviceType = DeviceType.DV});
+ DeviceType = DeviceType.DV
+ });
}
- if (Environment.OSVersion.Platform == PlatformID.Unix){
+ if(Environment.OSVersion.Platform == PlatformID.Unix) {
devicesList.Add(new Device {
ID = Catalog.GetString("Default device"),
IDProperty = "",
- DeviceType = DeviceType.Video});
- }
+ DeviceType = DeviceType.Video
+ });
+ }
return devicesList;
}
}
diff --git a/CesarPlayer/Utils/FramesCapturer.cs b/CesarPlayer/Utils/FramesCapturer.cs
index 189bed3..e918993 100644
--- a/CesarPlayer/Utils/FramesCapturer.cs
+++ b/CesarPlayer/Utils/FramesCapturer.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -28,8 +28,8 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Video.Utils
{
-
-
+
+
public class FramesSeriesCapturer
{
IFramesCapturer capturer;
@@ -42,9 +42,9 @@ namespace LongoMatch.Video.Utils
bool cancel;
private const int THUMBNAIL_MAX_HEIGHT=250;
private const int THUMBNAIL_MAX_WIDTH=300;
-
+
public event FramesProgressHandler Progress;
-
+
public FramesSeriesCapturer(string videoFile,long start, long stop, uint interval, string outputDir)
{
MultimediaFactory mf= new MultimediaFactory();
@@ -54,54 +54,58 @@ namespace LongoMatch.Video.Utils
this.stop = stop;
this.interval = interval;
this.outputDir = outputDir;
- this.seriesName = System.IO.Path.GetFileName(outputDir);
- this.totalFrames = (int)Math.Floor((double)((stop - start ) / interval))+1;
+ this.seriesName = System.IO.Path.GetFileName(outputDir);
+ this.totalFrames = (int)Math.Floor((double)((stop - start) / interval))+1;
}
-
- public void Cancel(){
- cancel = true;
+
+ public void Cancel() {
+ cancel = true;
}
-
- public void Start(){
+
+ public void Start() {
Thread thread = new Thread(new ThreadStart(CaptureFrames));
thread.Start();
}
-
- public void CaptureFrames(){
+
+ public void CaptureFrames() {
long pos;
Pixbuf frame;
Pixbuf scaledFrame=null;
- int i = 0;
-
- System.IO.Directory.CreateDirectory(outputDir);
-
- pos = start;
- if (Progress != null)
- Application.Invoke(delegate {Progress(0,totalFrames,null);});
- while (pos <= stop){
- if (!cancel){
- capturer.SeekTime(pos,true);
+ int i = 0;
+
+ System.IO.Directory.CreateDirectory(outputDir);
+
+ pos = start;
+ if(Progress != null)
+ Application.Invoke(delegate {
+ Progress(0,totalFrames,null);
+ });
+ while(pos <= stop) {
+ if(!cancel) {
+ capturer.SeekTime(pos,true);
capturer.Pause();
- frame = capturer.GetCurrentFrame();
- if (frame != null) {
+ frame = capturer.GetCurrentFrame();
+ if(frame != null) {
frame.Save(System.IO.Path.Combine(outputDir,seriesName+"_" + i +".png"),"png");
int h = frame.Height;
int w = frame.Width;
double rate = (double)w/(double)h;
- if (h>w)
+ if(h>w)
scaledFrame = frame.ScaleSimple((int)(THUMBNAIL_MAX_HEIGHT*rate),THUMBNAIL_MAX_HEIGHT,InterpType.Bilinear);
else
scaledFrame = frame.ScaleSimple(THUMBNAIL_MAX_WIDTH,(int)(THUMBNAIL_MAX_WIDTH/rate),InterpType.Bilinear);
- frame.Dispose();
+ frame.Dispose();
}
-
- if (Progress != null)
- Application.Invoke(delegate {Progress(i+1,totalFrames,scaledFrame);});
+
+ if(Progress != null)
+ Application.Invoke(delegate {
+ Progress(i+1,totalFrames,scaledFrame);
+ });
pos += interval;
i++;
}
else {
- System.IO.Directory.Delete(outputDir,true);
+ System.IO.Directory.Delete(outputDir,true);
cancel=false;
break;
}
diff --git a/CesarPlayer/Utils/IFramesCapturer.cs b/CesarPlayer/Utils/IFramesCapturer.cs
index 38ac0f3..be1b070 100644
--- a/CesarPlayer/Utils/IFramesCapturer.cs
+++ b/CesarPlayer/Utils/IFramesCapturer.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -23,8 +23,8 @@ using Gdk;
namespace LongoMatch.Video.Utils
{
-
-
+
+
public interface IFramesCapturer
{
bool Open(string mrl);
@@ -33,6 +33,6 @@ namespace LongoMatch.Video.Utils
void Dispose();
Pixbuf GetCurrentFrame(int outwidth, int outheight);
Pixbuf GetCurrentFrame();
-
+
}
}
diff --git a/CesarPlayer/Utils/IMetadataReader.cs b/CesarPlayer/Utils/IMetadataReader.cs
index c6126b2..13fad7a 100644
--- a/CesarPlayer/Utils/IMetadataReader.cs
+++ b/CesarPlayer/Utils/IMetadataReader.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -25,8 +25,8 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Video.Utils
{
-
-
+
+
public interface IMetadataReader
{
bool Open(string mrl);
diff --git a/CesarPlayer/Utils/MediaFile.cs b/CesarPlayer/Utils/MediaFile.cs
index f5d03f2..1c76a5f 100644
--- a/CesarPlayer/Utils/MediaFile.cs
+++ b/CesarPlayer/Utils/MediaFile.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -27,12 +27,12 @@ using LongoMatch.Video.Common;
namespace LongoMatch.Video.Utils
{
-
+
[Serializable]
-
+
public class MediaFile
{
-
+
string filePath;
long length; // In MSeconds
ushort fps;
@@ -42,18 +42,18 @@ namespace LongoMatch.Video.Utils
string audioCodec;
uint videoHeight;
uint videoWidth;
-
-
- public MediaFile(){}
-
+
+
+ public MediaFile() {}
+
public MediaFile(string filePath,
long length,
ushort fps,
- bool hasAudio,
- bool hasVideo,
- string videoCodec,
- string audioCodec,
- uint videoWidth,
+ bool hasAudio,
+ bool hasVideo,
+ string videoCodec,
+ string audioCodec,
+ uint videoWidth,
uint videoHeight)
{
this.filePath = filePath;
@@ -64,107 +64,142 @@ namespace LongoMatch.Video.Utils
this.audioCodec = audioCodec;
this.videoHeight = videoHeight;
this.videoWidth = videoWidth;
- if (fps == 0)
- //For audio Files
- this.fps=25;
- else
- this.fps = fps;
-
+ if(fps == 0)
+ //For audio Files
+ this.fps=25;
+ else
+ this.fps = fps;
+
+ }
+
+ public string FilePath {
+ get {
+ return this.filePath;
+ }
+ set {
+ this.filePath = value;
+ }
}
-
- public string FilePath{
- get {return this.filePath;}
- set {this.filePath = value;}
+
+ public long Length {
+ get {
+ return this.length;
+ }
+ set {
+ this.length = value;
+ }
}
-
- public long Length{
- get {return this.length;}
- set {this.length = value;}
+
+ public bool HasVideo {
+ get {
+ return this.hasVideo;
+ }
+ set {
+ this.hasVideo = value;
+ }
}
-
- public bool HasVideo{
- get { return this.hasVideo;}
- set{this.hasVideo = value;}
+
+ public bool HasAudio {
+ get {
+ return this.hasAudio;
+ }
+ set {
+ this.hasAudio = value;
+ }
}
-
- public bool HasAudio{
- get { return this.hasAudio;}
- set{this.hasAudio = value;}
+
+ public string VideoCodec {
+ get {
+ return this.videoCodec;
+ }
+ set {
+ this.videoCodec = value;
+ }
}
-
- public string VideoCodec{
- get {return this.videoCodec;}
- set {this.videoCodec = value;}
+
+ public string AudioCodec {
+ get {
+ return this.audioCodec;
+ }
+ set {
+ this.audioCodec = value;
+ }
}
-
- public string AudioCodec{
- get {return this.audioCodec;}
- set {this.audioCodec = value;}
- }
-
- public uint VideoWidth{
- get {return this.videoWidth;}
- set {this.videoWidth= value;}
+
+ public uint VideoWidth {
+ get {
+ return this.videoWidth;
+ }
+ set {
+ this.videoWidth= value;
+ }
}
-
- public uint VideoHeight{
- get {return this.videoHeight;}
- set {this.videoHeight= value;}
+
+ public uint VideoHeight {
+ get {
+ return this.videoHeight;
+ }
+ set {
+ this.videoHeight= value;
+ }
}
-
- public ushort Fps{
- get {return this.fps;}
+
+ public ushort Fps {
+ get {
+ return this.fps;
+ }
set {
- if (value == 0)
+ if(value == 0)
//For audio Files
this.fps=25;
else
- this.fps = value;}
+ this.fps = value;
+ }
}
-
- public uint GetFrames(){
- return (uint) (Fps*Length/1000);
+
+ public uint GetFrames() {
+ return (uint)(Fps*Length/1000);
}
-
-
-
- public static MediaFile GetMediaFile(string filePath){
- int duration, fps=0, height=0, width=0;
+
+
+
+ public static MediaFile GetMediaFile(string filePath) {
+ int duration, fps=0, height=0, width=0;
bool hasVideo, hasAudio;
string audioCodec = "", videoCodec = "";
MultimediaFactory factory;
IMetadataReader reader = null;
-
- try{
+
+ try {
factory = new MultimediaFactory();
reader = factory.getMetadataReader();
reader.Open(filePath);
- duration = (int)reader.GetMetadata(MetadataType.Duration);
+ duration = (int)reader.GetMetadata(MetadataType.Duration);
hasVideo = (bool) reader.GetMetadata(MetadataType.HasVideo);
hasAudio = (bool) reader.GetMetadata(MetadataType.HasAudio);
- if (hasAudio)
- audioCodec = (string) reader.GetMetadata(MetadataType.AudioEncoderType);
- if (hasVideo){
- videoCodec = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
+ if(hasAudio)
+ audioCodec = (string) reader.GetMetadata(MetadataType.AudioEncoderType);
+ if(hasVideo) {
+ videoCodec = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
fps = (int) reader.GetMetadata(MetadataType.Fps);
- }
+ }
height = (int) reader.GetMetadata(MetadataType.DimensionX);
- width = (int) reader.GetMetadata (MetadataType.DimensionY);
-
+ width = (int) reader.GetMetadata(MetadataType.DimensionY);
+
return new MediaFile(filePath,duration*1000,(ushort)fps,
hasAudio,hasVideo,videoCodec,audioCodec,
(uint)height,(uint)width);
-
+
}
- catch (GLib.GException ex){
- throw new Exception (Catalog.GetString("Invalid video file:")+"\n"+ex.Message);
+ catch(GLib.GException ex) {
+ throw new Exception(Catalog.GetString("Invalid video file:")+"\n"+ex.Message);
}
finally {
- reader.Close();
+ reader.Close();
reader.Dispose();
}
}
-
-
+
+
}
}
diff --git a/CesarPlayer/Utils/PreviewMediaFile.cs b/CesarPlayer/Utils/PreviewMediaFile.cs
index 0fd512d..f334842 100644
--- a/CesarPlayer/Utils/PreviewMediaFile.cs
+++ b/CesarPlayer/Utils/PreviewMediaFile.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2007-2009 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 LongoMatch.Video;
@@ -25,95 +25,95 @@ using Gdk;
namespace LongoMatch.Video.Utils
{
-
+
[Serializable]
public class PreviewMediaFile:MediaFile
{
-
+
private byte[] thumbnailBuf;
-
+
const int THUMBNAIL_MAX_HEIGHT=72;
const int THUMBNAIL_MAX_WIDTH=96;
-
- public PreviewMediaFile(){}
-
+
+ public PreviewMediaFile() {}
+
public PreviewMediaFile(string filePath,
- long length,
- ushort fps,
- bool hasAudio,
- bool hasVideo,
- string VideoEncoderType,
- string AudioEncoderType,
- uint videoWidth,
- uint videoHeight,
- Pixbuf preview):base (filePath,length,fps,hasAudio,hasVideo,VideoEncoderType,AudioEncoderType,videoWidth,videoHeight)
+ long length,
+ ushort fps,
+ bool hasAudio,
+ bool hasVideo,
+ string VideoEncoderType,
+ string AudioEncoderType,
+ uint videoWidth,
+ uint videoHeight,
+ Pixbuf preview):base(filePath,length,fps,hasAudio,hasVideo,VideoEncoderType,AudioEncoderType,videoWidth,videoHeight)
{
this.Preview=preview;
}
-
- public Pixbuf Preview{
- get{
- if (thumbnailBuf != null)
+
+ public Pixbuf Preview {
+ get {
+ if(thumbnailBuf != null)
return new Pixbuf(thumbnailBuf);
else return null;
}
- set{
- if (value != null){
+ set {
+ if(value != null) {
thumbnailBuf = value.SaveToBuffer("png");
value.Dispose();
}
else thumbnailBuf = null;
}
}
-
- public new static PreviewMediaFile GetMediaFile(string filePath){
- int duration=0;
+
+ public new static PreviewMediaFile GetMediaFile(string filePath) {
+ int duration=0;
bool hasVideo;
bool hasAudio;
string AudioEncoderType = "";
string VideoEncoderType = "";
int fps=0;
int height=0;
- int width=0;
+ int width=0;
Pixbuf preview=null;
MultimediaFactory factory;
IMetadataReader reader;
IFramesCapturer thumbnailer;
-
- try{
+
+ try {
factory = new MultimediaFactory();
reader = factory.getMetadataReader();
- reader.Open(filePath);
+ reader.Open(filePath);
hasVideo = (bool) reader.GetMetadata(MetadataType.HasVideo);
hasAudio = (bool) reader.GetMetadata(MetadataType.HasAudio);
- if (hasAudio){
- AudioEncoderType = (string) reader.GetMetadata(MetadataType.AudioEncoderType);
+ if(hasAudio) {
+ AudioEncoderType = (string) reader.GetMetadata(MetadataType.AudioEncoderType);
}
- if (hasVideo){
- VideoEncoderType = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
+ if(hasVideo) {
+ VideoEncoderType = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
fps = (int) reader.GetMetadata(MetadataType.Fps);
thumbnailer = factory.getFramesCapturer();
thumbnailer.Open(filePath);
thumbnailer.SeekTime(1000,false);
preview = thumbnailer.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
- duration =(int) ((thumbnailer as GstPlayer).StreamLength/1000); /* On Windows some formats report a 0 duration, try a last time with the reader */
- if (duration == 0)
+ duration =(int)((thumbnailer as GstPlayer).StreamLength/1000); /* On Windows some formats report a 0 duration, try a last time with the reader */
+ if(duration == 0)
duration = (int)reader.GetMetadata(MetadataType.Duration);
thumbnailer.Dispose();
- }
+ }
height = (int) reader.GetMetadata(MetadataType.DimensionX);
- width = (int) reader.GetMetadata (MetadataType.DimensionY);
- reader.Close();
- reader.Dispose();
-
+ width = (int) reader.GetMetadata(MetadataType.DimensionY);
+ reader.Close();
+ reader.Dispose();
+
return new PreviewMediaFile(filePath,duration*1000,
(ushort)fps,hasAudio,
hasVideo,VideoEncoderType,
AudioEncoderType,(uint)height,
(uint)width,preview);
}
- catch (GLib.GException ex){
- throw new Exception (Catalog.GetString("Invalid video file:")+"\n"+ex.Message);
+ catch(GLib.GException ex) {
+ throw new Exception(Catalog.GetString("Invalid video file:")+"\n"+ex.Message);
}
}
}
diff --git a/CesarPlayer/Utils/TimeString.cs b/CesarPlayer/Utils/TimeString.cs
index d4f755f..d2a0846 100644
--- a/CesarPlayer/Utils/TimeString.cs
+++ b/CesarPlayer/Utils/TimeString.cs
@@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -22,62 +22,62 @@ using System;
namespace LongoMatch.Video.Utils
{
-
-
+
+
public class TimeString
{
-
+
public TimeString()
{
}
-
- public static string SecondsToString (long time)
- {
- long _h, _m, _s;
- _h = (time / 3600);
- _m = ((time % 3600) / 60);
- _s = ((time % 3600) % 60);
+ public static string SecondsToString(long time)
+ {
+ long _h, _m, _s;
+
+ _h = (time / 3600);
+ _m = ((time % 3600) / 60);
+ _s = ((time % 3600) % 60);
+
+ if(_h > 0)
+ return String.Format("{0}:{1}:{2}", _h, _m.ToString("d2"),
+ _s.ToString("d2"));
+
+ return String.Format("{0}:{1}", _m, _s.ToString("d2"));
+ }
+ public static string MSecondsToMSecondsString(long time)
+ {
+ long _h, _m, _s,_ms,_time;
+ _time = time / 1000;
+ _h = (_time / 3600);
+ _m = ((_time % 3600) / 60);
+ _s = ((_time % 3600) % 60);
+ _ms = ((time % 3600000)%60000)%1000;
+
+ if(_h > 0)
+ return String.Format("{0}:{1}:{2},{3}", _h, _m.ToString("d2"),
+ _s.ToString("d2"),_ms.ToString("d3"));
+
+ return String.Format("{0}:{1},{2}", _m, _s.ToString("d2"),_ms.ToString("d3"));
+ }
+ public static string MSecondsToSecondsString(long time)
+ {
+ long _h, _m, _s,_time;
+ _time = time / 1000;
+ _h = (_time / 3600);
+ _m = ((_time % 3600) / 60);
+ _s = ((_time % 3600) % 60);
+
+ if(_h > 0)
+ return String.Format("{0}:{1}:{2}", _h, _m.ToString("d2"),
+ _s.ToString("d2"));
- if (_h > 0)
- return String.Format ("{0}:{1}:{2}", _h, _m.ToString ("d2"),
- _s.ToString ("d2"));
-
- return String.Format ("{0}:{1}", _m, _s.ToString ("d2"));
- }
- public static string MSecondsToMSecondsString (long time)
- {
- long _h, _m, _s,_ms,_time;
- _time = time / 1000;
- _h = (_time / 3600);
- _m = ((_time % 3600) / 60);
- _s = ((_time % 3600) % 60);
- _ms = ((time % 3600000)%60000)%1000;
-
- if (_h > 0)
- return String.Format ("{0}:{1}:{2},{3}", _h, _m.ToString ("d2"),
- _s.ToString ("d2"),_ms.ToString("d3"));
-
- return String.Format ("{0}:{1},{2}", _m, _s.ToString ("d2"),_ms.ToString("d3"));
- }
- public static string MSecondsToSecondsString (long time)
- {
- long _h, _m, _s,_time;
- _time = time / 1000;
- _h = (_time / 3600);
- _m = ((_time % 3600) / 60);
- _s = ((_time % 3600) % 60);
-
- if (_h > 0)
- return String.Format ("{0}:{1}:{2}", _h, _m.ToString ("d2"),
- _s.ToString ("d2"));
-
- return String.Format ("{0}:{1}", _m, _s.ToString ("d2"));
- }
- public static string FileName( string filename){
+ return String.Format("{0}:{1}", _m, _s.ToString("d2"));
+ }
+ public static string FileName(string filename) {
return System.IO.Path.GetFileName(filename);
}
-
-
+
+
}
}
diff --git a/LongoMatch/Common/Cairo.cs b/LongoMatch/Common/Cairo.cs
index 4643303..e396b2f 100644
--- a/LongoMatch/Common/Cairo.cs
+++ b/LongoMatch/Common/Cairo.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2011 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 Cairo;
@@ -22,13 +22,13 @@ namespace LongoMatch.Common
{
public class CairoUtils
{
- public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y,
+ public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y,
double width, double height, double radius,
Cairo.Color color, Cairo.Color borderColor)
{
gr.Save();
- if ((radius > height / 2) || (radius > width / 2))
+ if((radius > height / 2) || (radius > width / 2))
radius = Math.Min(height / 2, width / 2);
gr.MoveTo(x, y + radius);
@@ -41,17 +41,17 @@ namespace LongoMatch.Common
gr.Arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath();
gr.Restore();
-
+
gr.LineJoin = LineJoin.Round;
gr.Color = borderColor;
gr.StrokePreserve();
gr.Color = color;
gr.Fill();
}
-
- public static void DrawLine (Cairo.Context g, double x1, double y1,
- double x2, double y2,
- int width, Cairo.Color color) {
+
+ public static void DrawLine(Cairo.Context g, double x1, double y1,
+ double x2, double y2,
+ int width, Cairo.Color color) {
g.Color = color;
g.Operator = Operator.Over;
g.LineWidth = width;
@@ -59,9 +59,9 @@ namespace LongoMatch.Common
g.LineTo(x2,y2);
g.Stroke();
}
-
- public static void DrawTriangle(Cairo.Context g, double x, double y,
- int width, int height, Cairo.Color color){
+
+ public static void DrawTriangle(Cairo.Context g, double x, double y,
+ int width, int height, Cairo.Color color) {
g.Color = color;
g.MoveTo(x, y);
g.LineTo(x + width/2, y-height);
@@ -70,7 +70,7 @@ namespace LongoMatch.Common
g.Fill();
g.Stroke();
}
-
+
public static Cairo.Color RGBToCairoColor(Gdk.Color gdkColor) {
return new Cairo.Color((double)(gdkColor.Red)/ushort.MaxValue,
(double)(gdkColor.Green)/ushort.MaxValue,
diff --git a/LongoMatch/Common/ConsoleCrayon.cs b/LongoMatch/Common/ConsoleCrayon.cs
index 74a3c4f..44d06e4 100644
--- a/LongoMatch/Common/ConsoleCrayon.cs
+++ b/LongoMatch/Common/ConsoleCrayon.cs
@@ -30,222 +30,251 @@ using System;
namespace LongoMatch
{
- public static class ConsoleCrayon
- {
-
-#region Public API
-
- private static ConsoleColor foreground_color;
- public static ConsoleColor ForegroundColor {
- get { return foreground_color; }
- set {
- foreground_color = value;
- SetColor (foreground_color, true);
- }
- }
-
- private static ConsoleColor background_color;
- public static ConsoleColor BackgroundColor {
- get { return background_color; }
- set {
- background_color = value;
- SetColor (background_color, false);
- }
- }
-
- public static void ResetColor ()
- {
- if (XtermColors) {
- Console.Write (GetAnsiResetControlCode ());
- } else if (Environment.OSVersion.Platform != PlatformID.Unix && !RuntimeIsMono) {
- Console.ResetColor ();
- }
- }
-
- private static void SetColor (ConsoleColor color, bool isForeground)
- {
- if (color < ConsoleColor.Black || color > ConsoleColor.White) {
- throw new ArgumentOutOfRangeException ("color", "Not a ConsoleColor value.");
- }
-
- if (XtermColors) {
- Console.Write (GetAnsiColorControlCode (color, isForeground));
- } else if (Environment.OSVersion.Platform != PlatformID.Unix && !RuntimeIsMono) {
- if (isForeground) {
- Console.ForegroundColor = color;
- } else {
- Console.BackgroundColor = color;
- }
- }
- }
-
-#endregion
-
-#region Ansi/VT Code Calculation
-
- // Modified from Mono's System.TermInfoDriver
- // License: MIT/X11
- // Authors: Gonzalo Paniagua Javier <gonzalo ximian com>
- // (C) 2005-2006 Novell, Inc <http://www.novell.com>
-
- private static int TranslateColor (ConsoleColor desired, out bool light)
- {
- light = false;
- switch (desired) {
- // Dark colors
- case ConsoleColor.Black: return 0;
- case ConsoleColor.DarkRed: return 1;
- case ConsoleColor.DarkGreen: return 2;
- case ConsoleColor.DarkYellow: return 3;
- case ConsoleColor.DarkBlue: return 4;
- case ConsoleColor.DarkMagenta: return 5;
- case ConsoleColor.DarkCyan: return 6;
- case ConsoleColor.Gray: return 7;
-
- // Light colors
- case ConsoleColor.DarkGray: light = true; return 0;
- case ConsoleColor.Red: light = true; return 1;
- case ConsoleColor.Green: light = true; return 2;
- case ConsoleColor.Yellow: light = true; return 3;
- case ConsoleColor.Blue: light = true; return 4;
- case ConsoleColor.Magenta: light = true; return 5;
- case ConsoleColor.Cyan: light = true; return 6;
- case ConsoleColor.White: default: light = true; return 7;
- }
- }
-
- private static string GetAnsiColorControlCode (ConsoleColor color, bool isForeground)
- {
- // lighter fg colours are 90 -> 97 rather than 30 -> 37
- // lighter bg colours are 100 -> 107 rather than 40 -> 47
- bool light;
- int code = TranslateColor (color, out light) + (isForeground ? 30 : 40) + (light ? 60 : 0);
- return String.Format ("\x001b[{0}m", code);
- }
-
- private static string GetAnsiResetControlCode ()
- {
- return "\x001b[0m";
- }
-
-#endregion
-
-#region xterm Detection
-
- private static bool? xterm_colors = null;
- public static bool XtermColors {
- get {
- if (xterm_colors == null) {
- DetectXtermColors ();
- }
-
- return xterm_colors.Value;
- }
- }
-
- [System.Runtime.InteropServices.DllImport ("libc", EntryPoint="isatty")]
- private extern static int _isatty (int fd);
-
- private static bool isatty (int fd)
- {
- try {
- return _isatty (fd) == 1;
- } catch {
- return false;
- }
- }
-
- private static void DetectXtermColors ()
- {
- bool _xterm_colors = false;
-
- switch (Environment.GetEnvironmentVariable ("TERM")) {
- case "xterm":
- case "rxvt":
- case "rxvt-unicode":
- if (Environment.GetEnvironmentVariable ("COLORTERM") != null) {
- _xterm_colors = true;
- }
- break;
- case "xterm-color":
- _xterm_colors = true;
- break;
- }
-
- xterm_colors = _xterm_colors && isatty (1) && isatty (2);
- }
-
-#endregion
-
-#region Runtime Detection
-
- private static bool? runtime_is_mono;
- public static bool RuntimeIsMono {
- get {
- if (runtime_is_mono == null) {
- runtime_is_mono = Type.GetType ("System.MonoType") != null;
- }
-
- return runtime_is_mono.Value;
- }
- }
-
-#endregion
-
-#region Tests
-
- public static void Test ()
- {
- TestSelf ();
- Console.WriteLine ();
- TestAnsi ();
- Console.WriteLine ();
- TestRuntime ();
- }
-
- private static void TestSelf ()
- {
- Console.WriteLine ("==SELF TEST==");
- foreach (ConsoleColor color in Enum.GetValues (typeof (ConsoleColor))) {
- ForegroundColor = color;
- Console.Write (color);
- ResetColor ();
- Console.Write (" :: ");
- BackgroundColor = color;
- Console.Write (color);
- ResetColor ();
- Console.WriteLine ();
- }
- }
-
- private static void TestAnsi ()
- {
- Console.WriteLine ("==ANSI TEST==");
- foreach (ConsoleColor color in Enum.GetValues (typeof (ConsoleColor))) {
- string color_code_fg = GetAnsiColorControlCode (color, true);
- string color_code_bg = GetAnsiColorControlCode (color, false);
- Console.Write ("{0}{1}: {2}{3} :: {4}{1}: {5}{3}", color_code_fg, color, color_code_fg.Substring (2),
- GetAnsiResetControlCode (), color_code_bg, color_code_bg.Substring (2));
- Console.WriteLine ();
- }
- }
-
- private static void TestRuntime ()
- {
- Console.WriteLine ("==RUNTIME TEST==");
- foreach (ConsoleColor color in Enum.GetValues (typeof (ConsoleColor))) {
- Console.ForegroundColor = color;
- Console.Write (color);
- Console.ResetColor ();
- Console.Write (" :: ");
- Console.BackgroundColor = color;
- Console.Write (color);
- Console.ResetColor ();
- Console.WriteLine ();
- }
- }
-
-#endregion
-
- }
+ public static class ConsoleCrayon
+ {
+
+ #region Public API
+
+ private static ConsoleColor foreground_color;
+ public static ConsoleColor ForegroundColor {
+ get {
+ return foreground_color;
+ }
+ set {
+ foreground_color = value;
+ SetColor(foreground_color, true);
+ }
+ }
+
+ private static ConsoleColor background_color;
+ public static ConsoleColor BackgroundColor {
+ get {
+ return background_color;
+ }
+ set {
+ background_color = value;
+ SetColor(background_color, false);
+ }
+ }
+
+ public static void ResetColor()
+ {
+ if(XtermColors) {
+ Console.Write(GetAnsiResetControlCode());
+ } else if(Environment.OSVersion.Platform != PlatformID.Unix && !RuntimeIsMono) {
+ Console.ResetColor();
+ }
+ }
+
+ private static void SetColor(ConsoleColor color, bool isForeground)
+ {
+ if(color < ConsoleColor.Black || color > ConsoleColor.White) {
+ throw new ArgumentOutOfRangeException("color", "Not a ConsoleColor value.");
+ }
+
+ if(XtermColors) {
+ Console.Write(GetAnsiColorControlCode(color, isForeground));
+ } else if(Environment.OSVersion.Platform != PlatformID.Unix && !RuntimeIsMono) {
+ if(isForeground) {
+ Console.ForegroundColor = color;
+ } else {
+ Console.BackgroundColor = color;
+ }
+ }
+ }
+
+ #endregion
+
+ #region Ansi/VT Code Calculation
+
+ // Modified from Mono's System.TermInfoDriver
+ // License: MIT/X11
+ // Authors: Gonzalo Paniagua Javier <gonzalo ximian com>
+ // (C) 2005-2006 Novell, Inc <http://www.novell.com>
+
+ private static int TranslateColor(ConsoleColor desired, out bool light)
+ {
+ light = false;
+ switch(desired) {
+ // Dark colors
+ case ConsoleColor.Black:
+ return 0;
+ case ConsoleColor.DarkRed:
+ return 1;
+ case ConsoleColor.DarkGreen:
+ return 2;
+ case ConsoleColor.DarkYellow:
+ return 3;
+ case ConsoleColor.DarkBlue:
+ return 4;
+ case ConsoleColor.DarkMagenta:
+ return 5;
+ case ConsoleColor.DarkCyan:
+ return 6;
+ case ConsoleColor.Gray:
+ return 7;
+
+ // Light colors
+ case ConsoleColor.DarkGray:
+ light = true;
+ return 0;
+ case ConsoleColor.Red:
+ light = true;
+ return 1;
+ case ConsoleColor.Green:
+ light = true;
+ return 2;
+ case ConsoleColor.Yellow:
+ light = true;
+ return 3;
+ case ConsoleColor.Blue:
+ light = true;
+ return 4;
+ case ConsoleColor.Magenta:
+ light = true;
+ return 5;
+ case ConsoleColor.Cyan:
+ light = true;
+ return 6;
+ case ConsoleColor.White:
+ default:
+ light = true;
+ return 7;
+ }
+ }
+
+ private static string GetAnsiColorControlCode(ConsoleColor color, bool isForeground)
+ {
+ // lighter fg colours are 90 -> 97 rather than 30 -> 37
+ // lighter bg colours are 100 -> 107 rather than 40 -> 47
+ bool light;
+ int code = TranslateColor(color, out light) + (isForeground ? 30 : 40) + (light ? 60 : 0);
+ return String.Format("\x001b[{0}m", code);
+ }
+
+ private static string GetAnsiResetControlCode()
+ {
+ return "\x001b[0m";
+ }
+
+ #endregion
+
+ #region xterm Detection
+
+ private static bool? xterm_colors = null;
+ public static bool XtermColors {
+ get {
+ if(xterm_colors == null) {
+ DetectXtermColors();
+ }
+
+ return xterm_colors.Value;
+ }
+ }
+
+ [System.Runtime.InteropServices.DllImport("libc", EntryPoint="isatty")]
+ private extern static int _isatty(int fd);
+
+ private static bool isatty(int fd)
+ {
+ try {
+ return _isatty(fd) == 1;
+ } catch {
+ return false;
+ }
+ }
+
+ private static void DetectXtermColors()
+ {
+ bool _xterm_colors = false;
+
+ switch(Environment.GetEnvironmentVariable("TERM")) {
+ case "xterm":
+ case "rxvt":
+ case "rxvt-unicode":
+ if(Environment.GetEnvironmentVariable("COLORTERM") != null) {
+ _xterm_colors = true;
+ }
+ break;
+ case "xterm-color":
+ _xterm_colors = true;
+ break;
+ }
+
+ xterm_colors = _xterm_colors && isatty(1) && isatty(2);
+ }
+
+ #endregion
+
+ #region Runtime Detection
+
+ private static bool? runtime_is_mono;
+ public static bool RuntimeIsMono {
+ get {
+ if(runtime_is_mono == null) {
+ runtime_is_mono = Type.GetType("System.MonoType") != null;
+ }
+
+ return runtime_is_mono.Value;
+ }
+ }
+
+ #endregion
+
+ #region Tests
+
+ public static void Test()
+ {
+ TestSelf();
+ Console.WriteLine();
+ TestAnsi();
+ Console.WriteLine();
+ TestRuntime();
+ }
+
+ private static void TestSelf()
+ {
+ Console.WriteLine("==SELF TEST==");
+ foreach(ConsoleColor color in Enum.GetValues(typeof(ConsoleColor))) {
+ ForegroundColor = color;
+ Console.Write(color);
+ ResetColor();
+ Console.Write(" :: ");
+ BackgroundColor = color;
+ Console.Write(color);
+ ResetColor();
+ Console.WriteLine();
+ }
+ }
+
+ private static void TestAnsi()
+ {
+ Console.WriteLine("==ANSI TEST==");
+ foreach(ConsoleColor color in Enum.GetValues(typeof(ConsoleColor))) {
+ string color_code_fg = GetAnsiColorControlCode(color, true);
+ string color_code_bg = GetAnsiColorControlCode(color, false);
+ Console.Write("{0}{1}: {2}{3} :: {4}{1}: {5}{3}", color_code_fg, color, color_code_fg.Substring(2),
+ GetAnsiResetControlCode(), color_code_bg, color_code_bg.Substring(2));
+ Console.WriteLine();
+ }
+ }
+
+ private static void TestRuntime()
+ {
+ Console.WriteLine("==RUNTIME TEST==");
+ foreach(ConsoleColor color in Enum.GetValues(typeof(ConsoleColor))) {
+ Console.ForegroundColor = color;
+ Console.Write(color);
+ Console.ResetColor();
+ Console.Write(" :: ");
+ Console.BackgroundColor = color;
+ Console.Write(color);
+ Console.ResetColor();
+ Console.WriteLine();
+ }
+ }
+
+ #endregion
+
+ }
}
diff --git a/LongoMatch/Common/Constants.cs b/LongoMatch/Common/Constants.cs
index 8582073..467f5cb 100644
--- a/LongoMatch/Common/Constants.cs
+++ b/LongoMatch/Common/Constants.cs
@@ -21,19 +21,19 @@ using Gdk;
namespace LongoMatch.Common
{
- class Constants{
+ class Constants {
public const string SOFTWARE_NAME = "LongoMatch";
-
+
public const string PROJECT_NAME = SOFTWARE_NAME + " project";
-
+
public const string DB_FILE = "longomatch.1.db";
-
+
public const string COPYRIGHT = "Copyright ..2007-2010 Andoni Morales Alastruey";
-
+
public const string FAKE_PROJECT = "@Fake Project@";
-
+
public const string LICENSE =
-@"This program is free software; you can redistribute it and/or modify
+ @"This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@@ -42,9 +42,9 @@ This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.";
-
- public const string TRANSLATORS =
-@"Andoni Morales Alastruey (es)
+
+ public const string TRANSLATORS =
+ @"Andoni Morales Alastruey (es)
Aron Xu (cn_ZH)
Bruno Brouard (fr)
Daniel Nylander (sv)
@@ -64,27 +64,27 @@ Maurizio Napolitano (it)
Pavel B.írta (cs)
Petr Kovar (cs)
Xavier Queralt Mateu (ca)";
-
+
public const int THUMBNAIL_MAX_WIDTH = 100;
-
+
public const int THUMBNAIL_MAX_HEIGHT = 100;
-
+
public const string WEBSITE = "http://www.longomatch.ylatuya.es";
-
+
public const string MANUAL = "http://www.longomatch.ylatuya.es/documentation/manual.html";
-
+
public const ModifierType STEP = Gdk.ModifierType.ShiftMask;
-
+
public const Key SEEK_BACKWARD = Gdk.Key.Left;
-
- public const Key SEEK_FORWARD = Gdk.Key.Right;
-
+
+ public const Key SEEK_FORWARD = Gdk.Key.Right;
+
public const Key FRAMERATE_UP = Gdk.Key.Up;
-
+
public const Key FRAMERATE_DOWN = Gdk.Key.Down;
-
- public const Key TOGGLE_PLAY = Gdk.Key.space;
-
+
+ public const Key TOGGLE_PLAY = Gdk.Key.space;
+
/* Output formats */
public const string AVI = "AVI (XVID + MP3)";
public const string MP4 = "MP4 (H264 + AAC)";
diff --git a/LongoMatch/Common/Enums.cs b/LongoMatch/Common/Enums.cs
index 4ba72ee..dd8b5e4 100644
--- a/LongoMatch/Common/Enums.cs
+++ b/LongoMatch/Common/Enums.cs
@@ -29,25 +29,25 @@ namespace LongoMatch.Common
EditProject,
None,
}
-
+
public enum EndCaptureResponse {
Return = 234,
Quit = 235,
Save = 236
}
-
+
public enum TagMode {
Predifined,
Free
}
-
- public enum SortMethodType{
+
+ public enum SortMethodType {
SortByName = 0,
SortByStartTime = 1,
SortByStopTime = 2,
SortByDuration = 3
}
-
+
public enum Team {
NONE = 0,
LOCAL = 1,
diff --git a/LongoMatch/Common/Log.cs b/LongoMatch/Common/Log.cs
index c9fc165..0c0aadd 100644
--- a/LongoMatch/Common/Log.cs
+++ b/LongoMatch/Common/Log.cs
@@ -33,385 +33,411 @@ using System.Threading;
namespace LongoMatch
{
- public delegate void LogNotifyHandler (LogNotifyArgs args);
-
- public class LogNotifyArgs : EventArgs
- {
- private LogEntry entry;
-
- public LogNotifyArgs (LogEntry entry)
- {
- this.entry = entry;
- }
-
- public LogEntry Entry {
- get { return entry; }
- }
- }
-
- public enum LogEntryType
- {
- Debug,
- Warning,
- Error,
- Information
- }
-
- public class LogEntry
- {
- private LogEntryType type;
- private string message;
- private string details;
- private DateTime timestamp;
-
- internal LogEntry (LogEntryType type, string message, string details)
- {
- this.type = type;
- this.message = message;
- this.details = details;
- this.timestamp = DateTime.Now;
- }
-
- public LogEntryType Type {
- get { return type; }
- }
-
- public string Message {
- get { return message; }
- }
-
- public string Details {
- get { return details; }
- }
-
- public DateTime TimeStamp {
- get { return timestamp; }
- }
- }
-
- public static class Log
- {
- public static event LogNotifyHandler Notify;
-
- private static Dictionary<uint, DateTime> timers = new Dictionary<uint, DateTime> ();
- private static uint next_timer_id = 1;
-
- private static bool debugging = false;
- public static bool Debugging {
- get { return debugging; }
- set { debugging = value; }
- }
-
- public static void Commit (LogEntryType type, string message, string details, bool showUser)
- {
- if (type == LogEntryType.Debug && !Debugging) {
- return;
- }
-
- if (type != LogEntryType.Information || (type == LogEntryType.Information && !showUser)) {
- switch (type) {
- case LogEntryType.Error: ConsoleCrayon.ForegroundColor = ConsoleColor.Red; break;
- case LogEntryType.Warning: ConsoleCrayon.ForegroundColor = ConsoleColor.DarkYellow; break;
- case LogEntryType.Information: ConsoleCrayon.ForegroundColor = ConsoleColor.Green; break;
- case LogEntryType.Debug: ConsoleCrayon.ForegroundColor = ConsoleColor.Blue; break;
- }
-
- var thread_name = String.Empty;
- if (Debugging) {
- var thread = Thread.CurrentThread;
- thread_name = String.Format ("{0} ", thread.ManagedThreadId);
- }
-
- Console.Write ("[{5}{0} {1:00}:{2:00}:{3:00}.{4:000}]", TypeString (type), DateTime.Now.Hour,
- DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond, thread_name);
-
- ConsoleCrayon.ResetColor ();
-
- if (details != null) {
- Console.WriteLine (" {0} - {1}", message, details);
- } else {
- Console.WriteLine (" {0}", message);
- }
- }
-
- if (showUser) {
- OnNotify (new LogEntry (type, message, details));
- }
- }
-
- private static string TypeString (LogEntryType type)
- {
- switch (type) {
- case LogEntryType.Debug: return "Debug";
- case LogEntryType.Warning: return "Warn ";
- case LogEntryType.Error: return "Error";
- case LogEntryType.Information: return "Info ";
- }
- return null;
- }
-
- private static void OnNotify (LogEntry entry)
- {
- LogNotifyHandler handler = Notify;
- if (handler != null) {
- handler (new LogNotifyArgs (entry));
- }
- }
-
- #region Timer Methods
-
- public static uint DebugTimerStart (string message)
- {
- return TimerStart (message, false);
- }
-
- public static uint InformationTimerStart (string message)
- {
- return TimerStart (message, true);
- }
-
- private static uint TimerStart (string message, bool isInfo)
- {
- if (!Debugging && !isInfo) {
- return 0;
- }
-
- if (isInfo) {
- Information (message);
- } else {
- Debug (message);
- }
-
- return TimerStart (isInfo);
- }
-
- public static uint DebugTimerStart ()
- {
- return TimerStart (false);
- }
-
- public static uint InformationTimerStart ()
- {
- return TimerStart (true);
- }
-
- private static uint TimerStart (bool isInfo)
- {
- if (!Debugging && !isInfo) {
- return 0;
- }
-
- uint timer_id = next_timer_id++;
- timers.Add (timer_id, DateTime.Now);
- return timer_id;
- }
-
- public static void DebugTimerPrint (uint id)
- {
- if (!Debugging) {
- return;
- }
-
- TimerPrint (id, "Operation duration: {0}", false);
- }
-
- public static void DebugTimerPrint (uint id, string message)
- {
- if (!Debugging) {
- return;
- }
-
- TimerPrint (id, message, false);
- }
-
- public static void InformationTimerPrint (uint id)
- {
- TimerPrint (id, "Operation duration: {0}", true);
- }
-
- public static void InformationTimerPrint (uint id, string message)
- {
- TimerPrint (id, message, true);
- }
-
- private static void TimerPrint (uint id, string message, bool isInfo)
- {
- if (!Debugging && !isInfo) {
- return;
- }
-
- DateTime finish = DateTime.Now;
-
- if (!timers.ContainsKey (id)) {
- return;
- }
-
- TimeSpan duration = finish - timers[id];
- string d_message;
- if (duration.TotalSeconds < 60) {
- d_message = duration.TotalSeconds.ToString ();
- } else {
- d_message = duration.ToString ();
- }
-
- if (isInfo) {
- InformationFormat (message, d_message);
- } else {
- DebugFormat (message, d_message);
- }
- }
-
- #endregion
-
- #region Public Debug Methods
-
- public static void Debug (string message, string details)
- {
- if (Debugging) {
- Commit (LogEntryType.Debug, message, details, false);
- }
- }
-
- public static void Debug (string message)
- {
- if (Debugging) {
- Debug (message, null);
- }
- }
-
- public static void DebugFormat (string format, params object [] args)
- {
- if (Debugging) {
- Debug (String.Format (format, args));
- }
- }
-
- #endregion
-
- #region Public Information Methods
-
- public static void Information (string message)
- {
- Information (message, null);
- }
-
- public static void Information (string message, string details)
- {
- Information (message, details, false);
- }
-
- public static void Information (string message, string details, bool showUser)
- {
- Commit (LogEntryType.Information, message, details, showUser);
- }
-
- public static void Information (string message, bool showUser)
- {
- Information (message, null, showUser);
- }
-
- public static void InformationFormat (string format, params object [] args)
- {
- Information (String.Format (format, args));
- }
-
- #endregion
-
- #region Public Warning Methods
-
- public static void Warning (string message)
- {
- Warning (message, null);
- }
-
- public static void Warning (string message, string details)
- {
- Warning (message, details, false);
- }
-
- public static void Warning (string message, string details, bool showUser)
- {
- Commit (LogEntryType.Warning, message, details, showUser);
- }
-
- public static void Warning (string message, bool showUser)
- {
- Warning (message, null, showUser);
- }
-
- public static void WarningFormat (string format, params object [] args)
- {
- Warning (String.Format (format, args));
- }
-
- #endregion
-
- #region Public Error Methods
-
- public static void Error (string message)
- {
- Error (message, null);
- }
-
- public static void Error (string message, string details)
- {
- Error (message, details, false);
- }
-
- public static void Error (string message, string details, bool showUser)
- {
- Commit (LogEntryType.Error, message, details, showUser);
- }
-
- public static void Error (string message, bool showUser)
- {
- Error (message, null, showUser);
- }
-
- public static void ErrorFormat (string format, params object [] args)
- {
- Error (String.Format (format, args));
- }
-
- #endregion
-
- #region Public Exception Methods
-
- public static void DebugException (Exception e)
- {
- if (Debugging) {
- Exception (e);
- }
- }
-
- public static void Exception (Exception e)
- {
- Exception (null, e);
- }
-
- public static void Exception (string message, Exception e)
- {
- Stack<Exception> exception_chain = new Stack<Exception> ();
- StringBuilder builder = new StringBuilder ();
-
- while (e != null) {
- exception_chain.Push (e);
- e = e.InnerException;
- }
-
- while (exception_chain.Count > 0) {
- e = exception_chain.Pop ();
- builder.AppendFormat ("{0}: {1} (in `{2}')", e.GetType (), e.Message, e.Source).AppendLine ();
- builder.Append (e.StackTrace);
- if (exception_chain.Count > 0) {
- builder.AppendLine ();
- }
- }
-
- // FIXME: We should save these to an actual log file
- Log.Warning (message ?? "Caught an exception", builder.ToString (), false);
- }
-
- #endregion
- }
+ public delegate void LogNotifyHandler(LogNotifyArgs args);
+
+ public class LogNotifyArgs : EventArgs
+ {
+ private LogEntry entry;
+
+ public LogNotifyArgs(LogEntry entry)
+ {
+ this.entry = entry;
+ }
+
+ public LogEntry Entry {
+ get {
+ return entry;
+ }
+ }
+ }
+
+ public enum LogEntryType
+ {
+ Debug,
+ Warning,
+ Error,
+ Information
+ }
+
+ public class LogEntry
+ {
+ private LogEntryType type;
+ private string message;
+ private string details;
+ private DateTime timestamp;
+
+ internal LogEntry(LogEntryType type, string message, string details)
+ {
+ this.type = type;
+ this.message = message;
+ this.details = details;
+ this.timestamp = DateTime.Now;
+ }
+
+ public LogEntryType Type {
+ get {
+ return type;
+ }
+ }
+
+ public string Message {
+ get {
+ return message;
+ }
+ }
+
+ public string Details {
+ get {
+ return details;
+ }
+ }
+
+ public DateTime TimeStamp {
+ get {
+ return timestamp;
+ }
+ }
+ }
+
+ public static class Log
+ {
+ public static event LogNotifyHandler Notify;
+
+ private static Dictionary<uint, DateTime> timers = new Dictionary<uint, DateTime> ();
+ private static uint next_timer_id = 1;
+
+ private static bool debugging = false;
+ public static bool Debugging {
+ get {
+ return debugging;
+ }
+ set {
+ debugging = value;
+ }
+ }
+
+ public static void Commit(LogEntryType type, string message, string details, bool showUser)
+ {
+ if(type == LogEntryType.Debug && !Debugging) {
+ return;
+ }
+
+ if(type != LogEntryType.Information || (type == LogEntryType.Information && !showUser)) {
+ switch(type) {
+ case LogEntryType.Error:
+ ConsoleCrayon.ForegroundColor = ConsoleColor.Red;
+ break;
+ case LogEntryType.Warning:
+ ConsoleCrayon.ForegroundColor = ConsoleColor.DarkYellow;
+ break;
+ case LogEntryType.Information:
+ ConsoleCrayon.ForegroundColor = ConsoleColor.Green;
+ break;
+ case LogEntryType.Debug:
+ ConsoleCrayon.ForegroundColor = ConsoleColor.Blue;
+ break;
+ }
+
+ var thread_name = String.Empty;
+ if(Debugging) {
+ var thread = Thread.CurrentThread;
+ thread_name = String.Format("{0} ", thread.ManagedThreadId);
+ }
+
+ Console.Write("[{5}{0} {1:00}:{2:00}:{3:00}.{4:000}]", TypeString(type), DateTime.Now.Hour,
+ DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond, thread_name);
+
+ ConsoleCrayon.ResetColor();
+
+ if(details != null) {
+ Console.WriteLine(" {0} - {1}", message, details);
+ } else {
+ Console.WriteLine(" {0}", message);
+ }
+ }
+
+ if(showUser) {
+ OnNotify(new LogEntry(type, message, details));
+ }
+ }
+
+ private static string TypeString(LogEntryType type)
+ {
+ switch(type) {
+ case LogEntryType.Debug:
+ return "Debug";
+ case LogEntryType.Warning:
+ return "Warn ";
+ case LogEntryType.Error:
+ return "Error";
+ case LogEntryType.Information:
+ return "Info ";
+ }
+ return null;
+ }
+
+ private static void OnNotify(LogEntry entry)
+ {
+ LogNotifyHandler handler = Notify;
+ if(handler != null) {
+ handler(new LogNotifyArgs(entry));
+ }
+ }
+
+ #region Timer Methods
+
+ public static uint DebugTimerStart(string message)
+ {
+ return TimerStart(message, false);
+ }
+
+ public static uint InformationTimerStart(string message)
+ {
+ return TimerStart(message, true);
+ }
+
+ private static uint TimerStart(string message, bool isInfo)
+ {
+ if(!Debugging && !isInfo) {
+ return 0;
+ }
+
+ if(isInfo) {
+ Information(message);
+ } else {
+ Debug(message);
+ }
+
+ return TimerStart(isInfo);
+ }
+
+ public static uint DebugTimerStart()
+ {
+ return TimerStart(false);
+ }
+
+ public static uint InformationTimerStart()
+ {
+ return TimerStart(true);
+ }
+
+ private static uint TimerStart(bool isInfo)
+ {
+ if(!Debugging && !isInfo) {
+ return 0;
+ }
+
+ uint timer_id = next_timer_id++;
+ timers.Add(timer_id, DateTime.Now);
+ return timer_id;
+ }
+
+ public static void DebugTimerPrint(uint id)
+ {
+ if(!Debugging) {
+ return;
+ }
+
+ TimerPrint(id, "Operation duration: {0}", false);
+ }
+
+ public static void DebugTimerPrint(uint id, string message)
+ {
+ if(!Debugging) {
+ return;
+ }
+
+ TimerPrint(id, message, false);
+ }
+
+ public static void InformationTimerPrint(uint id)
+ {
+ TimerPrint(id, "Operation duration: {0}", true);
+ }
+
+ public static void InformationTimerPrint(uint id, string message)
+ {
+ TimerPrint(id, message, true);
+ }
+
+ private static void TimerPrint(uint id, string message, bool isInfo)
+ {
+ if(!Debugging && !isInfo) {
+ return;
+ }
+
+ DateTime finish = DateTime.Now;
+
+ if(!timers.ContainsKey(id)) {
+ return;
+ }
+
+ TimeSpan duration = finish - timers[id];
+ string d_message;
+ if(duration.TotalSeconds < 60) {
+ d_message = duration.TotalSeconds.ToString();
+ } else {
+ d_message = duration.ToString();
+ }
+
+ if(isInfo) {
+ InformationFormat(message, d_message);
+ } else {
+ DebugFormat(message, d_message);
+ }
+ }
+
+ #endregion
+
+ #region Public Debug Methods
+
+ public static void Debug(string message, string details)
+ {
+ if(Debugging) {
+ Commit(LogEntryType.Debug, message, details, false);
+ }
+ }
+
+ public static void Debug(string message)
+ {
+ if(Debugging) {
+ Debug(message, null);
+ }
+ }
+
+ public static void DebugFormat(string format, params object [] args)
+ {
+ if(Debugging) {
+ Debug(String.Format(format, args));
+ }
+ }
+
+ #endregion
+
+ #region Public Information Methods
+
+ public static void Information(string message)
+ {
+ Information(message, null);
+ }
+
+ public static void Information(string message, string details)
+ {
+ Information(message, details, false);
+ }
+
+ public static void Information(string message, string details, bool showUser)
+ {
+ Commit(LogEntryType.Information, message, details, showUser);
+ }
+
+ public static void Information(string message, bool showUser)
+ {
+ Information(message, null, showUser);
+ }
+
+ public static void InformationFormat(string format, params object [] args)
+ {
+ Information(String.Format(format, args));
+ }
+
+ #endregion
+
+ #region Public Warning Methods
+
+ public static void Warning(string message)
+ {
+ Warning(message, null);
+ }
+
+ public static void Warning(string message, string details)
+ {
+ Warning(message, details, false);
+ }
+
+ public static void Warning(string message, string details, bool showUser)
+ {
+ Commit(LogEntryType.Warning, message, details, showUser);
+ }
+
+ public static void Warning(string message, bool showUser)
+ {
+ Warning(message, null, showUser);
+ }
+
+ public static void WarningFormat(string format, params object [] args)
+ {
+ Warning(String.Format(format, args));
+ }
+
+ #endregion
+
+ #region Public Error Methods
+
+ public static void Error(string message)
+ {
+ Error(message, null);
+ }
+
+ public static void Error(string message, string details)
+ {
+ Error(message, details, false);
+ }
+
+ public static void Error(string message, string details, bool showUser)
+ {
+ Commit(LogEntryType.Error, message, details, showUser);
+ }
+
+ public static void Error(string message, bool showUser)
+ {
+ Error(message, null, showUser);
+ }
+
+ public static void ErrorFormat(string format, params object [] args)
+ {
+ Error(String.Format(format, args));
+ }
+
+ #endregion
+
+ #region Public Exception Methods
+
+ public static void DebugException(Exception e)
+ {
+ if(Debugging) {
+ Exception(e);
+ }
+ }
+
+ public static void Exception(Exception e)
+ {
+ Exception(null, e);
+ }
+
+ public static void Exception(string message, Exception e)
+ {
+ Stack<Exception> exception_chain = new Stack<Exception> ();
+ StringBuilder builder = new StringBuilder();
+
+ while(e != null) {
+ exception_chain.Push(e);
+ e = e.InnerException;
+ }
+
+ while(exception_chain.Count > 0) {
+ e = exception_chain.Pop();
+ builder.AppendFormat("{0}: {1} (in `{2}')", e.GetType(), e.Message, e.Source).AppendLine();
+ builder.Append(e.StackTrace);
+ if(exception_chain.Count > 0) {
+ builder.AppendLine();
+ }
+ }
+
+ // FIXME: We should save these to an actual log file
+ Log.Warning(message ?? "Caught an exception", builder.ToString(), false);
+ }
+
+ #endregion
+ }
}
diff --git a/LongoMatch/Common/SerializableObject.cs b/LongoMatch/Common/SerializableObject.cs
index 430d743..b4f3068 100644
--- a/LongoMatch/Common/SerializableObject.cs
+++ b/LongoMatch/Common/SerializableObject.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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.IO;
using System.Runtime.Serialization.Formatters.Binary;
diff --git a/LongoMatch/DB/DataBase.cs b/LongoMatch/DB/DataBase.cs
index 8c22e7e..bdab111 100644
--- a/LongoMatch/DB/DataBase.cs
+++ b/LongoMatch/DB/DataBase.cs
@@ -61,7 +61,7 @@ namespace LongoMatch.DB
public DataBase(string file)
{
this.file = file;
- if (!System.IO.File.Exists(file)) {
+ if(!System.IO.File.Exists(file)) {
// Create new DB and add version
IObjectContainer db = Db4oFactory.OpenFile(file);
try {
@@ -78,7 +78,7 @@ namespace LongoMatch.DB
IQuery query = db.Query();
query.Constrain(typeof(Version));
IObjectSet result = query.Execute();
- if (result.HasNext()) {
+ if(result.HasNext()) {
dbVersion = (Version)result.Next();
}
else {
@@ -113,7 +113,7 @@ namespace LongoMatch.DB
/// A <see cref="List"/>
/// </returns>
public List<ProjectDescription> GetAllProjects() {
- lock (this.locker) {
+ lock(this.locker) {
SetUpdateCascadeOptions();
List<ProjectDescription> list = new List<ProjectDescription>();
IObjectContainer db = Db4oFactory.OpenFile(file);
@@ -122,40 +122,40 @@ namespace LongoMatch.DB
IQuery query = db.Query();
query.Constrain(typeof(Project));
IObjectSet result = query.Execute();
- while (result.HasNext()) {
- try{
+ while(result.HasNext()) {
+ try {
Project p = (Project)result.Next();
ProjectDescription desc = p.Description;
db.Activate(desc,3);
- try{
+ try {
//FIXME: It happens that the project's File object is set to null?..?..
// In that case, reset the value to let the user change it with the
// projects manager.
- if (desc.File.FilePath == null){}
- }catch{
- MessagePopup.PopupMessage(null, MessageType.Warning,
+ if(desc.File.FilePath == null) {}
+ } catch {
+ MessagePopup.PopupMessage(null, MessageType.Warning,
Catalog.GetString("Error retrieving the file " +
- "info for project:")+
+ "info for project:")+
" "+ desc.Title+"\n"+
Catalog.GetString("This value will be reset. " +
- "Remember to change it later with the " +
- "projects manager"));
- desc.File = new PreviewMediaFile{
+ "Remember to change it later with the " +
+ "projects manager"));
+ desc.File = new PreviewMediaFile {
FilePath = Catalog.GetString("Change Me"),
VideoHeight = 0,
VideoWidth = 0,
HasVideo = false,
HasAudio = false,
Length = 0,
- Fps = 0,
+ Fps = 0,
VideoCodec = "",
AudioCodec = "",
Preview = null,
};
- db.Store(p);
+ db.Store(p);
}
list.Add(desc);
- }catch{
+ } catch {
Console.WriteLine("Error retreiving project. Skip");
}
}
@@ -180,7 +180,7 @@ namespace LongoMatch.DB
/// </returns>
public Project GetProject(String filename) {
Project ret;
- lock (this.locker) {
+ lock(this.locker) {
IObjectContainer db = Db4oFactory.OpenFile(file);
try {
IQuery query = GetQueryWithContrains(db, file);
@@ -202,11 +202,11 @@ namespace LongoMatch.DB
/// A <see cref="Project"/> to add
/// </param>
public void AddProject(Project project) {
- lock (this.locker) {
+ lock(this.locker) {
IObjectContainer db = Db4oFactory.OpenFile(file);
try
{
- if (!Exists(project.Description.File.FilePath,db)) {
+ if(!Exists(project.Description.File.FilePath,db)) {
db.Store(project);
db.Commit();
}
@@ -225,7 +225,7 @@ namespace LongoMatch.DB
/// A <see cref="System.String"/> with the project's video file path
/// </param>
public void RemoveProject(string filePath) {
- lock (this.locker) {
+ lock(this.locker) {
SetDeleteCascadeOptions();
IObjectContainer db = Db4oFactory.OpenFile(file);
try {
@@ -255,18 +255,18 @@ namespace LongoMatch.DB
/// A <see cref="System.String"/> with the old file path
/// </param>
public void UpdateProject(Project project, string previousFileName) {
- lock (this.locker) {
+ lock(this.locker) {
bool error = false;
// Configure db4o to cascade on delete for each one of the objects stored in a Project
SetDeleteCascadeOptions();
IObjectContainer db = Db4oFactory.OpenFile(file);
try {
// We look for a project with the same filename
- if (!Exists(project.Description.File.FilePath,db)) {
+ if(!Exists(project.Description.File.FilePath,db)) {
IQuery query = GetQueryWithContrains(db, file);
IObjectSet result = query.Execute();
//Get the stored project and replace it with the new one
- if (result.Count == 1){
+ if(result.Count == 1) {
Project fd = (Project)result.Next();
db.Delete(fd);
// Add the updated project
@@ -281,7 +281,7 @@ namespace LongoMatch.DB
}
finally {
CloseDB(db);
- if (error)
+ if(error)
throw new Exception();
}
}
@@ -294,7 +294,7 @@ namespace LongoMatch.DB
/// A <see cref="Project"/> to update
/// </param>
public void UpdateProject(Project project) {
- lock (this.locker) {
+ lock(this.locker) {
SetDeleteCascadeOptions();
IObjectContainer db = Db4oFactory.OpenFile(file);
try {
@@ -312,9 +312,9 @@ namespace LongoMatch.DB
}
}
}
-
+
/// <summary>
- /// Checks if a project already exists in the DataBase with the same file
+ /// Checks if a project already exists in the DataBase with the same file
/// </summary>
/// <param name="project">
/// A <see cref="Project"/> to compare
@@ -322,18 +322,18 @@ namespace LongoMatch.DB
/// <returns>
/// A <see cref="System.Boolean"/>
/// </returns>
- public bool Exists(Project project){
+ public bool Exists(Project project) {
IObjectContainer db = Db4oFactory.OpenFile(file);
- try{
+ try {
return Exists(project.Description.File.FilePath, db);
- }catch{
+ } catch {
return false;
- }finally{
+ } finally {
CloseDB(db);
- }
+ }
}
-
- private IQuery GetQueryWithContrains(IObjectContainer db, string filename){
+
+ private IQuery GetQueryWithContrains(IObjectContainer db, string filename) {
IQuery query = db.Query();
query.Constrain(typeof(Project));
query.Descend("description").Descend("file").Descend("filePath").Constrain(filename);
diff --git a/LongoMatch/Gui/Component/ButtonsWidget.cs b/LongoMatch/Gui/Component/ButtonsWidget.cs
index 37434a1..9b033f4 100644
--- a/LongoMatch/Gui/Component/ButtonsWidget.cs
+++ b/LongoMatch/Gui/Component/ButtonsWidget.cs
@@ -33,7 +33,7 @@ namespace LongoMatch.Gui.Component
public partial class ButtonsWidget : Gtk.Bin
{
- private Categories categories;
+ private Categories categories;
private TagMode tagMode;
private Dictionary<Widget, Category> buttonsDic;
@@ -48,34 +48,34 @@ namespace LongoMatch.Gui.Component
Mode = TagMode.Predifined;
buttonsDic = new Dictionary<Widget, Category>();
}
-
- public TagMode Mode{
- set{
+
+ public TagMode Mode {
+ set {
bool isPredef = (value == TagMode.Predifined);
table1.Visible = isPredef;
starttagbutton.Visible = !isPredef;
cancelbutton.Visible = false;
- tagMode = value;
+ tagMode = value;
}
}
public Categories Categories {
set {
- foreach (Widget w in table1.AllChildren) {
+ foreach(Widget w in table1.AllChildren) {
table1.Remove(w);
w.Destroy();
}
categories = value;
- if (value == null)
+ if(value == null)
return;
-
+
buttonsDic.Clear();
int sectionsCount = value.Count;
table1.NColumns =(uint) 10;
table1.NRows =(uint)(sectionsCount/10);
- for (int i=0;i<sectionsCount;i++) {
+ for(int i=0; i<sectionsCount; i++) {
Button b = new Button();
Label l = new Label();
Category cat = value[i];
@@ -94,7 +94,7 @@ namespace LongoMatch.Gui.Component
b.Name = i.ToString();
b.Clicked += new EventHandler(OnButtonClicked);
b.CanFocus = false;
-
+
l.Show();
b.Show();
@@ -107,35 +107,35 @@ namespace LongoMatch.Gui.Component
protected virtual void OnButtonClicked(object sender, System.EventArgs e)
{
- if (categories == null)
+ if(categories == null)
return;
Widget w = (Button)sender;
- if (tagMode == TagMode.Predifined){
- if (NewMarkEvent != null)
+ if(tagMode == TagMode.Predifined) {
+ if(NewMarkEvent != null)
NewMarkEvent(buttonsDic[w]);
} else {
starttagbutton.Visible = true;
table1.Visible = false;
cancelbutton.Visible = false;
- if (NewMarkStopEvent != null)
+ if(NewMarkStopEvent != null)
NewMarkStopEvent(buttonsDic[w]);
- }
+ }
}
- protected virtual void OnStartTagClicked (object sender, System.EventArgs e)
+ protected virtual void OnStartTagClicked(object sender, System.EventArgs e)
{
- if (categories == null)
+ if(categories == null)
return;
-
+
starttagbutton.Visible = false;
table1.Visible = true;
cancelbutton.Visible = true;
-
- if (NewMarkStartEvent != null)
+
+ if(NewMarkStartEvent != null)
NewMarkStartEvent();
}
- protected virtual void OnCancelbuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnCancelbuttonClicked(object sender, System.EventArgs e)
{
starttagbutton.Visible = true;
table1.Visible = false;
diff --git a/LongoMatch/Gui/Component/CategoriesScale.cs b/LongoMatch/Gui/Component/CategoriesScale.cs
index 226e32b..e406a7d 100644
--- a/LongoMatch/Gui/Component/CategoriesScale.cs
+++ b/LongoMatch/Gui/Component/CategoriesScale.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2011 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 Cairo;
using Gtk;
@@ -33,21 +33,21 @@ namespace LongoMatch.Gui.Component
private const int LINE_WIDTH = 2;
private double scroll;
Pango.Layout layout;
-
+
[System.ComponentModel.Category("LongoMatch")]
[System.ComponentModel.ToolboxItem(true)]
- public CategoriesScale ()
+ public CategoriesScale()
{
layout = new Pango.Layout(PangoContext);
layout.Wrap = Pango.WrapMode.Char;
layout.Alignment = Pango.Alignment.Left;
}
-
+
public Categories Categories {
get;
set;
- }
-
+ }
+
public double Scroll {
get {
return scroll;
@@ -57,34 +57,34 @@ namespace LongoMatch.Gui.Component
QueueDraw();
}
}
-
- private void DrawCairoText (string text, int x1, int y1) {
+
+ private void DrawCairoText(string text, int x1, int y1) {
layout.Width = Pango.Units.FromPixels(SECTION_WIDTH - 2);
layout.Ellipsize = EllipsizeMode.End;
layout.SetMarkup(text);
GdkWindow.DrawLayout(Style.TextGC(StateType.Normal),
x1 + 2, y1 ,layout);
}
-
+
private void DrawCategories(Gdk.Window win) {
int i = 0;
-
- if (Categories == null)
+
+ if(Categories == null)
return;
-
+
using(Cairo.Context g = Gdk.CairoHelper.Create(win)) {
- foreach (Category cat in Categories) {
+ foreach(Category cat in Categories) {
int y = LINE_WIDTH/2 + i * SECTION_HEIGHT - (int)Scroll;
- CairoUtils.DrawRoundedRectangle (g, 2, y + 3 , Allocation.Width - 3,
- SECTION_HEIGHT - 3, SECTION_HEIGHT/7,
- CairoUtils.RGBToCairoColor(cat.Color),
- CairoUtils.RGBToCairoColor(cat.Color));
- DrawCairoText (cat.Name, 0 + 3, y + SECTION_HEIGHT / 2 - 5);
+ CairoUtils.DrawRoundedRectangle(g, 2, y + 3 , Allocation.Width - 3,
+ SECTION_HEIGHT - 3, SECTION_HEIGHT/7,
+ CairoUtils.RGBToCairoColor(cat.Color),
+ CairoUtils.RGBToCairoColor(cat.Color));
+ DrawCairoText(cat.Name, 0 + 3, y + SECTION_HEIGHT / 2 - 5);
i++;
}
}
}
-
+
protected override bool OnExposeEvent(EventExpose evnt)
{
DrawCategories(evnt.Window);
diff --git a/LongoMatch/Gui/Component/CategoryProperties.cs b/LongoMatch/Gui/Component/CategoryProperties.cs
index f5a7d58..e4f54dc 100644
--- a/LongoMatch/Gui/Component/CategoryProperties.cs
+++ b/LongoMatch/Gui/Component/CategoryProperties.cs
@@ -44,7 +44,7 @@ namespace LongoMatch.Gui.Component
this.Build();
}
- public Category Category{
+ public Category Category {
set {
stn = value;
UpdateGui();
@@ -55,13 +55,13 @@ namespace LongoMatch.Gui.Component
}
private void UpdateGui() {
- if (stn != null) {
+ if(stn != null) {
nameentry.Text = stn.Name;
timeadjustwidget1.SetTimeNode(stn);
colorbutton1.Color = stn.Color;
sortmethodcombobox.Active = (int)stn.SortMethod;
- if (stn.HotKey.Defined) {
+ if(stn.HotKey.Defined) {
hotKeyLabel.Text = stn.HotKey.ToString();
}
else hotKeyLabel.Text = Catalog.GetString("none");
@@ -73,18 +73,18 @@ namespace LongoMatch.Gui.Component
HotKeySelectorDialog dialog = new HotKeySelectorDialog();
dialog.TransientFor=(Gtk.Window)this.Toplevel;
HotKey prevHotKey = stn.HotKey;
- if (dialog.Run() == (int)ResponseType.Ok) {
+ if(dialog.Run() == (int)ResponseType.Ok) {
stn.HotKey=dialog.HotKey;
UpdateGui();
}
dialog.Destroy();
- if (HotKeyChanged != null)
+ if(HotKeyChanged != null)
HotKeyChanged(prevHotKey,stn);
}
protected virtual void OnColorbutton1ColorSet(object sender, System.EventArgs e)
{
- if (stn != null)
+ if(stn != null)
stn.Color=colorbutton1.Color;
}
@@ -103,7 +103,7 @@ namespace LongoMatch.Gui.Component
stn.Name = nameentry.Text;
}
- protected virtual void OnSortmethodcomboboxChanged (object sender, System.EventArgs e)
+ protected virtual void OnSortmethodcomboboxChanged(object sender, System.EventArgs e)
{
stn.SortMethodString = sortmethodcombobox.ActiveText;
}
diff --git a/LongoMatch/Gui/Component/DrawingToolBox.cs b/LongoMatch/Gui/Component/DrawingToolBox.cs
index 461e09f..8c4c27b 100644
--- a/LongoMatch/Gui/Component/DrawingToolBox.cs
+++ b/LongoMatch/Gui/Component/DrawingToolBox.cs
@@ -44,7 +44,7 @@ namespace LongoMatch.Gui.Component
public bool DrawingVisibility {
set {
- if (VisibilityChanged != null)
+ if(VisibilityChanged != null)
VisibilityChanged(value);
}
}
@@ -65,7 +65,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnCombobox1Changed(object sender, System.EventArgs e)
{
int lineWidth;
- if (LineWidthChanged != null) {
+ if(LineWidthChanged != null) {
lineWidth = Int16.Parse(combobox1.ActiveText.Split(' ')[0]);
LineWidthChanged(lineWidth);
}
@@ -73,55 +73,55 @@ namespace LongoMatch.Gui.Component
protected virtual void OnCirclebuttonToggled(object sender, System.EventArgs e)
{
- if (DrawToolChanged != null && (sender as RadioButton).Active)
+ if(DrawToolChanged != null && (sender as RadioButton).Active)
DrawToolChanged(DrawTool.CIRCLE);
}
protected virtual void OnRectanglebuttonToggled(object sender, System.EventArgs e)
{
- if (DrawToolChanged != null && (sender as RadioButton).Active)
+ if(DrawToolChanged != null && (sender as RadioButton).Active)
DrawToolChanged(DrawTool.RECTANGLE);
}
protected virtual void OnLinebuttonToggled(object sender, System.EventArgs e)
{
- if (DrawToolChanged != null && (sender as RadioButton).Active)
+ if(DrawToolChanged != null && (sender as RadioButton).Active)
DrawToolChanged(DrawTool.LINE);
}
protected virtual void OnCrossbuttonToggled(object sender, System.EventArgs e)
{
- if (DrawToolChanged != null && (sender as RadioButton).Active)
+ if(DrawToolChanged != null && (sender as RadioButton).Active)
DrawToolChanged(DrawTool.CROSS);
}
protected virtual void OnEraserbuttonToggled(object sender, System.EventArgs e)
{
- if (DrawToolChanged != null && (sender as RadioButton).Active)
+ if(DrawToolChanged != null && (sender as RadioButton).Active)
DrawToolChanged(DrawTool.ERASER);
}
protected virtual void OnPenbuttonToggled(object sender, System.EventArgs e)
{
- if (DrawToolChanged != null && (sender as RadioButton).Active)
+ if(DrawToolChanged != null && (sender as RadioButton).Active)
DrawToolChanged(DrawTool.PEN);
}
protected virtual void OnClearbuttonClicked(object sender, System.EventArgs e)
{
- if (ClearDrawing != null)
+ if(ClearDrawing != null)
ClearDrawing();
}
protected virtual void OnSpinbutton1Changed(object sender, System.EventArgs e)
{
- if (TransparencyChanged != null)
+ if(TransparencyChanged != null)
TransparencyChanged(spinbutton1.Value/100);
}
-
- protected virtual void OnColorbuttonColorSet (object sender, System.EventArgs e)
+
+ protected virtual void OnColorbuttonColorSet(object sender, System.EventArgs e)
{
- if (ColorChanged != null)
+ if(ColorChanged != null)
ColorChanged(colorbutton.Color);
}
}
diff --git a/LongoMatch/Gui/Component/DrawingWidget.cs b/LongoMatch/Gui/Component/DrawingWidget.cs
index cb50c80..586c938 100644
--- a/LongoMatch/Gui/Component/DrawingWidget.cs
+++ b/LongoMatch/Gui/Component/DrawingWidget.cs
@@ -97,8 +97,8 @@ namespace LongoMatch.Gui.Component
}
drawingarea.WidthRequest=sourceWidth;
drawingarea.HeightRequest=sourceHeight;
- if (drawingarea.GdkWindow != null)
- drawingarea.GdkWindow.Resize(sourceWidth,sourceHeight);
+ if(drawingarea.GdkWindow != null)
+ drawingarea.GdkWindow.Resize(sourceWidth,sourceHeight);
value.Dispose();
loaded = true;
QueueDraw();
@@ -113,7 +113,7 @@ namespace LongoMatch.Gui.Component
public double Transparency {
set {
- if (value >=0 && value <=1) {
+ if(value >=0 && value <=1) {
transparency = value;
drawingarea.QueueDraw();
}
@@ -131,7 +131,7 @@ namespace LongoMatch.Gui.Component
public DrawTool DrawTool {
set {
this.selectedTool = value;
- switch (selectedTool) {
+ switch(selectedTool) {
case DrawTool.LINE:
case DrawTool.DASHED_LINE:
drawingarea.GdkWindow.Cursor = new Cursor(CursorType.DraftSmall);
@@ -187,11 +187,11 @@ namespace LongoMatch.Gui.Component
private void Save(string filename,bool bSource,bool bDrawings) {
Surface pngSurface = new ImageSurface(Format.ARGB32,sourceWidth,sourceHeight);
using(Context c = new Context(pngSurface)) {
- if (bSource) {
+ if(bSource) {
c.SetSourceSurface(source,0,0);
c.Paint();
}
- if (bDrawings) {
+ if(bDrawings) {
c.SetSourceSurface(drawings,0,0);
c.PaintWithAlpha(transparency);
}
@@ -202,21 +202,21 @@ namespace LongoMatch.Gui.Component
private void SetContextProperties(Context c, bool dashed) {
c.LineCap = LineCap.Round;
c.LineJoin = LineJoin.Round;
- if (selectedTool != DrawTool.ERASER) {
+ if(selectedTool != DrawTool.ERASER) {
c.Color = lineColor;
c.LineWidth = lineWidth;
c.Operator = Operator.Over;
- if (dashed)
- c.SetDash(new double[]{10, 10}, 10);
+ if(dashed)
+ c.SetDash(new double[] {10, 10}, 10);
} else {
c.Color = new Cairo.Color(0,0,0,0);
c.LineWidth = 20;
c.Operator = Operator.Source;
}
}
-
- private void ResetDash(Context c){
- c.SetDash(new Double[]{10,0}, 0);
+
+ private void ResetDash(Context c) {
+ c.SetDash(new Double[] {10,0}, 0);
}
private void DrawLine(Context c, bool dashed, double x1, double y1, double x2, double y2) {
@@ -276,57 +276,57 @@ namespace LongoMatch.Gui.Component
c.Fill();
ResetDash(c);
}
-
- private void Paint(Context c, double x1, double y1, double x2, double y2){
- switch (selectedTool) {
- case DrawTool.LINE:
- DrawLine(c, false, x1, y1, x2, y2);
- DrawArrow(c, x1, y1, x2, y2);
- break;
- case DrawTool.DASHED_LINE:
- DrawLine(c, true, x1, y1, x2, y2);
- DrawArrow(c, x1, y1, x2, y2);
- break;
- case DrawTool.RECTANGLE:
- DrawRectangle(c, false, x1, y1, x2, y2);
- break;
- case DrawTool.DASHED_RECTANGLE:
- DrawRectangle(c, true, x1, y1, x2, y2);
- break;
- case DrawTool.CIRCLE:
- DrawCircle(c, false, x1, y1, x2, y2);
- break;
- case DrawTool.DASHED_CIRCLE:
- DrawCircle(c, true, x1, y1, x2, y2);
- break;
- case DrawTool.CROSS:
- DrawCross(c, false, x1, y1, x2, y2);
- break;
- case DrawTool.DASHED_CROSS:
- DrawCross(c, true, x1, y1, x2, y2);
- break;
- default:
- //lastx=0;
- //lasty=0;
- break;
+
+ private void Paint(Context c, double x1, double y1, double x2, double y2) {
+ switch(selectedTool) {
+ case DrawTool.LINE:
+ DrawLine(c, false, x1, y1, x2, y2);
+ DrawArrow(c, x1, y1, x2, y2);
+ break;
+ case DrawTool.DASHED_LINE:
+ DrawLine(c, true, x1, y1, x2, y2);
+ DrawArrow(c, x1, y1, x2, y2);
+ break;
+ case DrawTool.RECTANGLE:
+ DrawRectangle(c, false, x1, y1, x2, y2);
+ break;
+ case DrawTool.DASHED_RECTANGLE:
+ DrawRectangle(c, true, x1, y1, x2, y2);
+ break;
+ case DrawTool.CIRCLE:
+ DrawCircle(c, false, x1, y1, x2, y2);
+ break;
+ case DrawTool.DASHED_CIRCLE:
+ DrawCircle(c, true, x1, y1, x2, y2);
+ break;
+ case DrawTool.CROSS:
+ DrawCross(c, false, x1, y1, x2, y2);
+ break;
+ case DrawTool.DASHED_CROSS:
+ DrawCross(c, true, x1, y1, x2, y2);
+ break;
+ default:
+ //lastx=0;
+ //lasty=0;
+ break;
}
}
-
+
protected virtual void OnDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
{
- if (!loaded)
+ if(!loaded)
return;
drawingarea.GdkWindow.Clear();
-
+
using(Context c = CairoHelper.Create(drawingarea.GdkWindow)) {
c.SetSourceSurface(source,xOffset,yOffset);
c.Paint();
- if (visible) {
+ if(visible) {
c.SetSourceSurface(drawings,xOffset,yOffset);
c.PaintWithAlpha(transparency);
}
//Preview
- if (preview)
+ if(preview)
Paint(c, initialPoint.X+xOffset,initialPoint.Y+yOffset,
finalPoint.X+xOffset,finalPoint.Y+yOffset);
}
@@ -337,11 +337,11 @@ namespace LongoMatch.Gui.Component
preview = true;
initialPoint = new Cairo.PointD(args.Event.X,args.Event.Y);
- if (selectedTool == DrawTool.PEN || selectedTool == DrawTool.ERASER) {
+ if(selectedTool == DrawTool.PEN || selectedTool == DrawTool.ERASER) {
lastx = args.Event.X;
lasty = args.Event.Y;
- if (args.Event.Button == 1) {
+ if(args.Event.Button == 1) {
using(Context c = new Context(drawings)) {
DrawLine(c,false, args.Event.X,args.Event.Y,args.Event.X,args.Event.Y);
}
@@ -354,7 +354,7 @@ namespace LongoMatch.Gui.Component
preview = false;
finalPoint = new Cairo.PointD(args.Event.X,args.Event.Y);
using(Context c = new Context(drawings)) {
- Paint (c, initialPoint.X,initialPoint.Y,finalPoint.X,finalPoint.Y);
+ Paint(c, initialPoint.X,initialPoint.Y,finalPoint.X,finalPoint.Y);
}
QueueDraw();
}
@@ -363,7 +363,7 @@ namespace LongoMatch.Gui.Component
{
finalPoint = new Cairo.PointD(args.Event.X,args.Event.Y);
- if (selectedTool == DrawTool.PEN || selectedTool == DrawTool.ERASER) {
+ if(selectedTool == DrawTool.PEN || selectedTool == DrawTool.ERASER) {
using(Context c = new Context(drawings)) {
DrawLine(c,false,lastx,lasty,args.Event.X,args.Event.Y);
}
@@ -377,12 +377,12 @@ namespace LongoMatch.Gui.Component
{
// Center the source in the drawing area if its size
// is smaller than the drawing area one
- if (args.Allocation.Width > sourceWidth)
+ if(args.Allocation.Width > sourceWidth)
xOffset = (Allocation.Width - sourceWidth) / 2;
else
xOffset = 0;
- if (args.Allocation.Height > sourceHeight)
+ if(args.Allocation.Height > sourceHeight)
yOffset = (Allocation.Height -sourceHeight) / 2;
else
yOffset = 0;
diff --git a/LongoMatch/Gui/Component/NotesWidget.cs b/LongoMatch/Gui/Component/NotesWidget.cs
index a94aa27..14aaea6 100644
--- a/LongoMatch/Gui/Component/NotesWidget.cs
+++ b/LongoMatch/Gui/Component/NotesWidget.cs
@@ -59,16 +59,16 @@ namespace LongoMatch.Gui.Component
}
protected virtual void OnEdition(object sender, EventArgs args) {
- if (Notes != play.Notes) {
+ if(Notes != play.Notes) {
savebutton.Sensitive = true;
}
}
protected virtual void OnSavebuttonClicked(object sender, System.EventArgs e)
{
- if (play != null) {
+ if(play != null) {
play.Notes=Notes;
- if (TimeNodeChanged != null)
+ if(TimeNodeChanged != null)
TimeNodeChanged(play,null);
savebutton.Sensitive = false;
}
diff --git a/LongoMatch/Gui/Component/PlayListWidget.cs b/LongoMatch/Gui/Component/PlayListWidget.cs
index ba254ab..3365c39 100644
--- a/LongoMatch/Gui/Component/PlayListWidget.cs
+++ b/LongoMatch/Gui/Component/PlayListWidget.cs
@@ -56,16 +56,16 @@ namespace LongoMatch.Gui.Component
private MultimediaFactory factory;
- public PlayListWidget ()
+ public PlayListWidget()
{
- this.Build ();
- lock_node = new System.Object ();
- factory = new MultimediaFactory ();
+ this.Build();
+ lock_node = new System.Object();
+ factory = new MultimediaFactory();
playlisttreeview1.Reorderable = true;
playlisttreeview1.RowActivated += OnPlaylisttreeview1RowActivated;
playlisttreeview1.ApplyCurrentRate += OnApplyRate;
savebutton.Sensitive = false;
-
+
newbutton.CanFocus = false;
openbutton.CanFocus = false;
savebutton.CanFocus = false;
@@ -103,18 +103,18 @@ namespace LongoMatch.Gui.Component
}
public void Add(PlayListPlay plNode) {
- if (playList!=null) {
+ if(playList!=null) {
Model.AppendValues(plNode);
playList.Add(plNode);
}
}
public PlayListPlay Next() {
- if (playList.HasNext()) {
+ if(playList.HasNext()) {
plNode = playList.Next();
playlisttreeview1.Selection.SelectPath(new TreePath(playList.GetCurrentIndex().ToString()));
playlisttreeview1.LoadedPlay = plNode;
- if (PlayListNodeSelected != null && plNode.Valid) {
+ if(PlayListNodeSelected != null && plNode.Valid) {
PlayListNodeSelected(plNode,playList.HasNext());
StartClock();
}
@@ -128,13 +128,13 @@ namespace LongoMatch.Gui.Component
}
public void Prev() {
- if ((player.AccurateCurrentTime - plNode.Start.MSeconds) < 500) {
+ if((player.AccurateCurrentTime - plNode.Start.MSeconds) < 500) {
//Seleccionando el elemento anterior si no han pasado m.ís 500ms
- if (playList.HasPrev()) {
+ if(playList.HasPrev()) {
plNode = playList.Prev();
playlisttreeview1.Selection.SelectPath(new TreePath(playList.GetCurrentIndex().ToString()));
playlisttreeview1.LoadedPlay = plNode;
- if (PlayListNodeSelected != null)
+ if(PlayListNodeSelected != null)
PlayListNodeSelected(plNode,playList.HasNext());
StartClock();
}
@@ -147,7 +147,7 @@ namespace LongoMatch.Gui.Component
}
public void StopEdition() {
- if (videoEditor != null)
+ if(videoEditor != null)
videoEditor.Cancel();
}
@@ -156,24 +156,24 @@ namespace LongoMatch.Gui.Component
}
void StartClock() {
- if (player!=null && !clock_started) {
+ if(player!=null && !clock_started) {
timeout = GLib.Timeout.Add(20,CheckStopTime);
clock_started=true;
}
}
private void StopClock() {
- if (clock_started) {
+ if(clock_started) {
GLib.Source.Remove(timeout);
clock_started = false;
}
}
private bool CheckStopTime() {
- lock (lock_node) {
- if (player != null) {
- if (player.AccurateCurrentTime >= plNode.Stop.MSeconds-200) {
- if (Next() == null)
+ lock(lock_node) {
+ if(player != null) {
+ if(player.AccurateCurrentTime >= plNode.Stop.MSeconds-200) {
+ if(Next() == null)
StopClock();
}
}
@@ -183,7 +183,7 @@ namespace LongoMatch.Gui.Component
private PlayListPlay SelectPlayListNode(TreePath path) {
plNode = playList.Select(Int32.Parse(path.ToString()));
- if (PlayListNodeSelected != null && plNode.Valid) {
+ if(PlayListNodeSelected != null && plNode.Valid) {
PlayListNodeSelected(plNode,playList.HasNext());
StartClock();
}
@@ -212,7 +212,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnSavebuttonClicked(object sender, System.EventArgs e)
{
- if (playList != null) {
+ if(playList != null) {
playList.Save();
}
}
@@ -227,7 +227,7 @@ namespace LongoMatch.Gui.Component
fChooser.SetCurrentFolder(MainClass.PlayListDir());
fChooser.AddFilter(FileFilter);
fChooser.DoOverwriteConfirmation = true;
- if (fChooser.Run() == (int)ResponseType.Accept)
+ if(fChooser.Run() == (int)ResponseType.Accept)
Load(fChooser.Filename);
fChooser.Destroy();
}
@@ -242,7 +242,7 @@ namespace LongoMatch.Gui.Component
fChooser.SetCurrentFolder(MainClass.PlayListDir());
fChooser.AddFilter(FileFilter);
- if (fChooser.Run() == (int)ResponseType.Accept)
+ if(fChooser.Run() == (int)ResponseType.Accept)
Load(fChooser.Filename);
fChooser.Destroy();
}
@@ -257,7 +257,7 @@ namespace LongoMatch.Gui.Component
VideoEditionProperties vep;
int response;
- if (playList.Count == 0) {
+ if(playList.Count == 0) {
MessagePopup.PopupMessage(this,MessageType.Warning,
Catalog.GetString("The playlist is empty!"));
return;
@@ -266,17 +266,17 @@ namespace LongoMatch.Gui.Component
vep = new VideoEditionProperties();
vep.TransientFor = (Gtk.Window)this.Toplevel;
response = vep.Run();
- while (response == (int)ResponseType.Ok && vep.Filename == "") {
+ while(response == (int)ResponseType.Ok && vep.Filename == "") {
MessagePopup.PopupMessage(this, MessageType.Warning,
Catalog.GetString("Please, select a video file."));
response=vep.Run();
}
- if (response ==(int)ResponseType.Ok) {
+ if(response ==(int)ResponseType.Ok) {
//FIXME:Create a new instance of the video editor until we fix the audio swith enable/disabled
LoadEditor();
//videoEditor.ClearList();
- foreach (PlayListPlay segment in playList) {
- if (segment.Valid)
+ foreach(PlayListPlay segment in playList) {
+ if(segment.Valid)
videoEditor.AddSegment(segment.MediaFile.FilePath,
segment.Start.MSeconds,
segment.Duration.MSeconds,
@@ -298,10 +298,10 @@ namespace LongoMatch.Gui.Component
closebutton.Show();
newvideobutton.Hide();
}
- catch (Exception ex) {
+ catch(Exception ex) {
MessagePopup.PopupMessage(this, MessageType.Error, Catalog.GetString(ex.Message));
}
- vep.Destroy();
+ vep.Destroy();
}
}
@@ -313,17 +313,17 @@ namespace LongoMatch.Gui.Component
}
protected virtual void OnProgress(float progress) {
- if (Progress!= null)
+ if(Progress!= null)
Progress(progress);
- if (progress ==1) {
+ if(progress ==1) {
closebutton.Hide();
newvideobutton.Show();
}
}
protected virtual void OnApplyRate(PlayListPlay plNode) {
- if (ApplyCurrentRate != null)
+ if(ApplyCurrentRate != null)
ApplyCurrentRate(plNode);
}
}
diff --git a/LongoMatch/Gui/Component/PlayerProperties.cs b/LongoMatch/Gui/Component/PlayerProperties.cs
index 7a8760b..45f86c0 100644
--- a/LongoMatch/Gui/Component/PlayerProperties.cs
+++ b/LongoMatch/Gui/Component/PlayerProperties.cs
@@ -42,7 +42,7 @@ namespace LongoMatch.Gui.Component
{
this.Build();
//HACK:The calendar dialog does not respond on win32
- if (Environment.OSVersion.Platform != PlatformID.Win32NT) {
+ if(Environment.OSVersion.Platform != PlatformID.Win32NT) {
cp = new CalendarPopup();
cp.Hide();
cp.DateSelectedEvent += delegate(DateTime selectedDate) {
@@ -93,17 +93,17 @@ namespace LongoMatch.Gui.Component
"gtk-cancel",ResponseType.Cancel,
"gtk-open",ResponseType.Accept);
fChooser.AddFilter(FileFilter);
- if (fChooser.Run() == (int)ResponseType.Accept) {
+ if(fChooser.Run() == (int)ResponseType.Accept) {
// For Win32 compatibility we need to open the image file
// using a StreamReader. Gdk.Pixbuf(string filePath) uses GLib to open the
// input file and doesn't support Win32 files path encoding
file = new StreamReader(fChooser.Filename);
pimage= new Gdk.Pixbuf(file.BaseStream);
- if (pimage != null) {
+ if(pimage != null) {
h = pimage.Height;
w = pimage.Width;
rate = (double)w/(double)h;
- if (h>w)
+ if(h>w)
player.Photo = pimage.ScaleSimple((int)(THUMBNAIL_MAX_HEIGHT*rate),THUMBNAIL_MAX_HEIGHT,InterpType.Bilinear);
else
player.Photo = pimage.ScaleSimple(THUMBNAIL_MAX_WIDTH,(int)(THUMBNAIL_MAX_WIDTH/rate),InterpType.Bilinear);
@@ -132,10 +132,10 @@ namespace LongoMatch.Gui.Component
{
player.Number =(int) numberspinbutton.Value;
}
-
- protected virtual void OnDatebuttonClicked (object sender, System.EventArgs e)
+
+ protected virtual void OnDatebuttonClicked(object sender, System.EventArgs e)
{
- if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
+ if(Environment.OSVersion.Platform == PlatformID.Win32NT) {
var win32CP = new Win32CalendarDialog();
win32CP.TransientFor = (Gtk.Window)this.Toplevel;
win32CP.Run();
@@ -148,27 +148,27 @@ namespace LongoMatch.Gui.Component
cp.Show();
}
}
-
- protected virtual void OnWeightspinbuttonValueChanged (object sender, System.EventArgs e)
+
+ protected virtual void OnWeightspinbuttonValueChanged(object sender, System.EventArgs e)
{
player.Weight = (int)weightspinbutton.Value;
}
-
- protected virtual void OnHeightspinbuttonValueChanged (object sender, System.EventArgs e)
+
+ protected virtual void OnHeightspinbuttonValueChanged(object sender, System.EventArgs e)
{
player.Height = (float)heightspinbutton.Value;
}
-
- protected virtual void OnNationalityentryChanged (object sender, System.EventArgs e)
+
+ protected virtual void OnNationalityentryChanged(object sender, System.EventArgs e)
{
player.Nationality = nationalityentry.Text;
}
-
- protected virtual void OnPlayscomboboxChanged (object sender, System.EventArgs e)
+
+ protected virtual void OnPlayscomboboxChanged(object sender, System.EventArgs e)
{
player.Playing = playscombobox.ActiveText == Catalog.GetString("Yes");
}
-
-
+
+
}
}
diff --git a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
index a1b411c..eff234c 100644
--- a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
@@ -43,9 +43,9 @@ namespace LongoMatch.Gui.Component
{
this.Build();
playerstreeview.TimeNodeChanged += OnTimeNodeChanged;
- playerstreeview.TimeNodeSelected += OnTimeNodeSelected;
- playerstreeview.PlayListNodeAdded += OnPlayListNodeAdded;
- playerstreeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
+ playerstreeview.TimeNodeSelected += OnTimeNodeSelected;
+ playerstreeview.PlayListNodeAdded += OnPlayListNodeAdded;
+ playerstreeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
}
public Team Team {
@@ -53,9 +53,9 @@ namespace LongoMatch.Gui.Component
playerstreeview.Team = value;
}
}
-
- public bool ProjectIsLive{
- set{
+
+ public bool ProjectIsLive {
+ set {
playerstreeview.ProjectIsLive = value;
}
}
@@ -64,27 +64,27 @@ namespace LongoMatch.Gui.Component
TreeIter iter, child;
TreeStore model;
List<TreeIter> removeIters;
-
- if (template == null)
+
+ if(template == null)
return;
-
+
removeIters = new List<TreeIter>();
model = (TreeStore)playerstreeview.Model;
model.GetIterFirst(out iter);
- do{
- if (!model.IterHasChild(iter))
+ do {
+ if(!model.IterHasChild(iter))
continue;
-
+
model.IterChildren(out child, iter);
do {
Play play = (Play) model.GetValue(child,0);
- if (plays.Contains(play)) {
+ if(plays.Contains(play)) {
removeIters.Add(child);
}
- } while (model.IterNext(ref child));
- } while (model.IterNext(ref iter));
-
- for (int i=0; i < removeIters.Count; i++){
+ } while(model.IterNext(ref child));
+ } while(model.IterNext(ref iter));
+
+ for(int i=0; i < removeIters.Count; i++) {
iter = removeIters[i];
model.Remove(ref iter);
}
@@ -94,17 +94,17 @@ namespace LongoMatch.Gui.Component
public void AddPlay(Play play, Player player) {
TreeIter iter;
TreeStore model;
-
- if (template == null)
+
+ if(template == null)
return;
model = (TreeStore)playerstreeview.Model;
model.GetIterFirst(out iter);
- do{
- if (model.GetValue(iter, 0) == player){
+ do {
+ if(model.GetValue(iter, 0) == player) {
model.AppendValues(iter, player);
break;
}
- } while (model.IterNext(ref iter));
+ } while(model.IterNext(ref iter));
}
public void SetTeam(TeamTemplate template, TreeStore model) {
@@ -128,25 +128,25 @@ namespace LongoMatch.Gui.Component
}
protected virtual void OnTimeNodeSelected(Play tNode) {
- if (TimeNodeSelected != null)
+ if(TimeNodeSelected != null)
TimeNodeSelected(tNode);
}
protected virtual void OnSnapshotSeriesEvent(Play tNode)
{
- if (SnapshotSeriesEvent != null)
+ if(SnapshotSeriesEvent != null)
SnapshotSeriesEvent(tNode);
}
protected virtual void OnTimeNodeChanged(TimeNode tNode, object val)
{
- if (TimeNodeChanged != null)
+ if(TimeNodeChanged != null)
TimeNodeChanged(tNode, val);
}
protected virtual void OnPlayListNodeAdded(Play tNode)
{
- if (PlayListNodeAdded != null)
+ if(PlayListNodeAdded != null)
PlayListNodeAdded(tNode);
}
diff --git a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
index a6306f8..b405a7d 100644
--- a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
@@ -50,43 +50,43 @@ namespace LongoMatch.Gui.Component
{
this.Build();
treeview.TimeNodeChanged += OnTimeNodeChanged;
- treeview.TimeNodeSelected += OnTimeNodeSelected;
- treeview.TimeNodeDeleted += OnTimeNodeDeleted;
- treeview.PlayListNodeAdded += OnPlayListNodeAdded;
- treeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
- treeview.PlayersTagged += OnPlayersTagged;
- treeview.TagPlay += OnTagPlay;
+ treeview.TimeNodeSelected += OnTimeNodeSelected;
+ treeview.TimeNodeDeleted += OnTimeNodeDeleted;
+ treeview.PlayListNodeAdded += OnPlayListNodeAdded;
+ treeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
+ treeview.PlayersTagged += OnPlayersTagged;
+ treeview.TagPlay += OnTagPlay;
}
public void RemovePlays(List<Play> plays) {
TreeIter iter, child;
TreeStore model;
List<TreeIter> removeIters;
-
- if (project == null)
+
+ if(project == null)
return;
-
+
removeIters = new List<TreeIter>();
model = (TreeStore)treeview.Model;
model.GetIterFirst(out iter);
- /* Scan all the tree and store the iter of each play
+ /* Scan all the tree and store the iter of each play
* we need to delete, but don't delete it yet so that
* we don't alter the tree */
- do{
- if (!model.IterHasChild(iter))
+ do {
+ if(!model.IterHasChild(iter))
continue;
-
+
model.IterChildren(out child, iter);
do {
Play play = (Play) model.GetValue(child,0);
- if (plays.Contains(play)) {
+ if(plays.Contains(play)) {
removeIters.Add(child);
}
- } while (model.IterNext(ref child));
- } while (model.IterNext(ref iter));
-
+ } while(model.IterNext(ref child));
+ } while(model.IterNext(ref iter));
+
/* Remove the selected iters now */
- for (int i=0; i < removeIters.Count; i++){
+ for(int i=0; i < removeIters.Count; i++) {
iter = removeIters[i];
model.Remove(ref iter);
}
@@ -94,22 +94,22 @@ namespace LongoMatch.Gui.Component
public void AddPlay(Play play) {
TreeIter categoryIter;
-
- if (project == null)
- return;
-
+
+ if(project == null)
+ return;
+
var cat = play.Category;
var model = (TreeStore)treeview.Model;
model.GetIterFromString(out categoryIter, CategoryPath(cat));
var playIter = model.AppendValues(categoryIter,play);
var playPath = model.GetPath(playIter);
- treeview.Selection.UnselectAll();
+ treeview.Selection.UnselectAll();
treeview.ExpandToPath(playPath);
treeview.Selection.SelectIter(playIter);
}
- public bool ProjectIsLive{
- set{
+ public bool ProjectIsLive {
+ set {
treeview.ProjectIsLive = value;
}
}
@@ -117,7 +117,7 @@ namespace LongoMatch.Gui.Component
public Project Project {
set {
project = value;
- if (project != null) {
+ if(project != null) {
treeview.Model = project.GetModel();
treeview.Colors = true;
treeview.VisitorTeam = project.Description.VisitorName;
@@ -134,47 +134,47 @@ namespace LongoMatch.Gui.Component
treeview.PlayListLoaded=value;
}
}
-
- private string CategoryPath(Category cat){
+
+ private string CategoryPath(Category cat) {
return project.Categories.IndexOf(cat).ToString();
}
protected virtual void OnTimeNodeChanged(TimeNode tNode,object val) {
- if (TimeNodeChanged != null)
+ if(TimeNodeChanged != null)
TimeNodeChanged(tNode,val);
}
protected virtual void OnTimeNodeSelected(Play tNode) {
- if (TimeNodeSelected != null)
+ if(TimeNodeSelected != null)
TimeNodeSelected(tNode);
}
- protected virtual void OnTimeNodeDeleted(List<Play> plays){
- if (TimeNodeDeleted != null)
+ protected virtual void OnTimeNodeDeleted(List<Play> plays) {
+ if(TimeNodeDeleted != null)
TimeNodeDeleted(plays);
}
protected virtual void OnPlayListNodeAdded(Play tNode)
{
- if (PlayListNodeAdded != null)
+ if(PlayListNodeAdded != null)
PlayListNodeAdded(tNode);
}
protected virtual void OnSnapshotSeriesEvent(LongoMatch.Store.Play tNode)
{
- if (SnapshotSeriesEvent != null)
+ if(SnapshotSeriesEvent != null)
SnapshotSeriesEvent(tNode);
}
protected virtual void OnPlayersTagged(LongoMatch.Store.Play tNode, Team team)
{
- if (PlayersTagged != null)
+ if(PlayersTagged != null)
PlayersTagged(tNode,team);
}
- protected virtual void OnTagPlay (LongoMatch.Store.Play tNode)
+ protected virtual void OnTagPlay(LongoMatch.Store.Play tNode)
{
- if (TagPlay != null)
+ if(TagPlay != null)
TagPlay(tNode);
}
}
diff --git a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
index 0f25914..7135ede 100644
--- a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
@@ -59,23 +59,23 @@ namespace LongoMatch.Gui.Component
private const string PAL_1_2_FORMAT = "360x288 (4:3)";
private const string DV_SOURCE = "DV Source";
private const string GCONF_SOURCE = "GConf Source";
-
-
+
+
public ProjectDetailsWidget()
{
this.Build();
//HACK:The calendar dialog does not respond on win32
- if (Environment.OSVersion.Platform != PlatformID.Win32NT) {
+ if(Environment.OSVersion.Platform != PlatformID.Win32NT) {
cp = new CalendarPopup();
cp.Hide();
cp.DateSelectedEvent += new DateSelectedHandler(OnDateSelected);
}
-
+
FillSections();
FillTeamsTemplate();
FillFormats();
-
+
videoDevices = new List<Device>();
Use=ProjectType.FileProject;
@@ -83,21 +83,21 @@ namespace LongoMatch.Gui.Component
public ProjectType Use {
set {
- bool visible1 = value == ProjectType.CaptureProject;
+ bool visible1 = value == ProjectType.CaptureProject;
bool visible2 = value != ProjectType.FakeCaptureProject;
bool visible3 = value != ProjectType.EditProject;
-
+
filelabel.Visible = visible2;
filehbox.Visible = visible2;
-
+
tagscombobox.Visible = visible3;
localcombobox.Visible = visible3;
visitorcombobox.Visible = visible3;
-
+
expander1.Visible = visible1;
device.Visible = visible1;
devicecombobox.Visible = visible1;
-
+
useType = value;
}
get {
@@ -231,15 +231,15 @@ namespace LongoMatch.Gui.Component
return visitorcombobox.ActiveText + ".tem";
}
}
-
- public CapturePropertiesStruct CaptureProperties{
- get{
+
+ public CapturePropertiesStruct CaptureProperties {
+ get {
CapturePropertiesStruct s = new CapturePropertiesStruct();
s.OutputFile = fileEntry.Text;
s.AudioBitrate = (uint)audiobitratespinbutton.Value;
s.VideoBitrate = (uint)videobitratespinbutton.Value;
- if (videoDevices[devicecombobox.Active].DeviceType == DeviceType.DV){
- if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+ if(videoDevices[devicecombobox.Active].DeviceType == DeviceType.DV) {
+ if(Environment.OSVersion.Platform == PlatformID.Win32NT)
s.CaptureSourceType = CaptureSourceType.DShow;
else
s.CaptureSourceType = CaptureSourceType.DV;
@@ -249,52 +249,52 @@ namespace LongoMatch.Gui.Component
}
s.DeviceID = videoDevices[devicecombobox.Active].ID;
/* Get size info */
- switch (sizecombobox.ActiveText){
+ switch(sizecombobox.ActiveText) {
/* FIXME: Don't harcode size values */
- case PAL_FORMAT:
- s.Width = 720;
- s.Height = 576;
- break;
- case PAL_3_4_FORMAT:
- s.Width = 540;
- s.Height = 432;
- break;
- case PAL_1_2_FORMAT:
- s.Width = 360;
- s.Height = 288;
- break;
- default:
- s.Width = 0;
- s.Height = 0;
- break;
+ case PAL_FORMAT:
+ s.Width = 720;
+ s.Height = 576;
+ break;
+ case PAL_3_4_FORMAT:
+ s.Width = 540;
+ s.Height = 432;
+ break;
+ case PAL_1_2_FORMAT:
+ s.Width = 360;
+ s.Height = 288;
+ break;
+ default:
+ s.Width = 0;
+ s.Height = 0;
+ break;
}
/* Get video compresion format info */
- switch (videoformatcombobox.ActiveText){
- case Constants.AVI:
- s.VideoEncoder = VideoEncoderType.Mpeg4;
- s.AudioEncoder = AudioEncoderType.Mp3;
- s.Muxer = VideoMuxerType.Avi;
- break;
- case Constants.MP4:
- s.VideoEncoder = VideoEncoderType.H264;
- s.AudioEncoder = AudioEncoderType.Aac;
- s.Muxer = VideoMuxerType.Mp4;
- break;
- case Constants.OGG:
- s.VideoEncoder = VideoEncoderType.Theora;
- s.AudioEncoder = AudioEncoderType.Vorbis;
- s.Muxer = VideoMuxerType.Ogg;
- break;
- case Constants.WEBM:
- s.VideoEncoder = VideoEncoderType.VP8;
- s.AudioEncoder = AudioEncoderType.Vorbis;
- s.Muxer = VideoMuxerType.WebM;
- break;
+ switch(videoformatcombobox.ActiveText) {
+ case Constants.AVI:
+ s.VideoEncoder = VideoEncoderType.Mpeg4;
+ s.AudioEncoder = AudioEncoderType.Mp3;
+ s.Muxer = VideoMuxerType.Avi;
+ break;
+ case Constants.MP4:
+ s.VideoEncoder = VideoEncoderType.H264;
+ s.AudioEncoder = AudioEncoderType.Aac;
+ s.Muxer = VideoMuxerType.Mp4;
+ break;
+ case Constants.OGG:
+ s.VideoEncoder = VideoEncoderType.Theora;
+ s.AudioEncoder = AudioEncoderType.Vorbis;
+ s.Muxer = VideoMuxerType.Ogg;
+ break;
+ case Constants.WEBM:
+ s.VideoEncoder = VideoEncoderType.VP8;
+ s.AudioEncoder = AudioEncoderType.Vorbis;
+ s.Muxer = VideoMuxerType.WebM;
+ break;
}
return s;
}
}
-
+
public void SetProject(Project project) {
this.project = project;
var desc = project.Description;
@@ -315,7 +315,7 @@ namespace LongoMatch.Gui.Component
public void UpdateProject() {
var desc = project.Description;
- desc.File= mFile;
+ desc.File= mFile;
desc.LocalName = localTeamEntry.Text;
desc.VisitorName = visitorTeamEntry.Text;
desc.LocalGoals = (int)localSpinButton.Value;
@@ -329,15 +329,15 @@ namespace LongoMatch.Gui.Component
}
public Project GetProject() {
- if (useType != ProjectType.EditProject) {
- if (Filename == "" && useType != ProjectType.FakeCaptureProject)
+ if(useType != ProjectType.EditProject) {
+ if(Filename == "" && useType != ProjectType.FakeCaptureProject)
return null;
else {
- if (useType == ProjectType.FakeCaptureProject){
+ if(useType == ProjectType.FakeCaptureProject) {
mFile = new PreviewMediaFile();
mFile.FilePath = Constants.FAKE_PROJECT;
mFile.Fps = 25;
- } else if (useType == ProjectType.CaptureProject){
+ } else if(useType == ProjectType.CaptureProject) {
mFile = new PreviewMediaFile();
mFile.FilePath = fileEntry.Text;
mFile.Fps = 25;
@@ -351,18 +351,19 @@ namespace LongoMatch.Gui.Component
LocalGoals = LocalGoals,
MatchDate = Date
};
-
- return new Project{
+
+ return new Project {
Description = desc,
Categories = Categories,
LocalTeamTemplate = LocalTeamTemplate,
- VisitorTeamTemplate = VisitorTeamTemplate};
- }
+ VisitorTeamTemplate = VisitorTeamTemplate
+ };
+ }
}
else {
// New imported project from a fake live analysis will have a null File
// return null to force selecting a new file.
- if (mFile == null)
+ if(mFile == null)
return null;
UpdateProject();
return project;
@@ -379,19 +380,19 @@ namespace LongoMatch.Gui.Component
mFile = null;
edited = false;
}
-
- public void FillDevices(List<Device> devices){
+
+ public void FillDevices(List<Device> devices) {
videoDevices = devices;
-
- foreach (Device device in devices){
+
+ foreach(Device device in devices) {
string deviceElement;
string deviceName;
- if (Environment.OSVersion.Platform == PlatformID.Unix){
- if (device.DeviceType == DeviceType.DV)
+ if(Environment.OSVersion.Platform == PlatformID.Unix) {
+ if(device.DeviceType == DeviceType.DV)
deviceElement = Catalog.GetString(DV_SOURCE);
- else
+ else
deviceElement = Catalog.GetString(GCONF_SOURCE);
- } else
+ } else
deviceElement = Catalog.GetString("DirectShow Source");
deviceName = (device.ID == "") ? Catalog.GetString("Unknown"): device.ID;
devicecombobox.AppendText(deviceName + " ("+deviceElement+")");
@@ -405,11 +406,11 @@ namespace LongoMatch.Gui.Component
int index = 0;
allFiles = System.IO.Directory.GetFiles(MainClass.TemplatesDir(),"*.sct");
- foreach (string filePath in allFiles) {
+ foreach(string filePath in allFiles) {
string fileName = System.IO .Path.GetFileNameWithoutExtension(filePath);
tagscombobox.AppendText(fileName);
//Setting the selected value to the default template
- if (fileName == "default")
+ if(fileName == "default")
index = i;
i++;
}
@@ -423,39 +424,39 @@ namespace LongoMatch.Gui.Component
int index = 0;
allFiles = System.IO.Directory.GetFiles(MainClass.TemplatesDir(),"*.tem");
- foreach (string filePath in allFiles) {
+ foreach(string filePath in allFiles) {
string fileName = System.IO .Path.GetFileNameWithoutExtension(filePath);
localcombobox.AppendText(fileName);
visitorcombobox.AppendText(fileName);
//Setting the selected value to the default template
- if (fileName == "default")
+ if(fileName == "default")
index = i;
i++;
}
localcombobox.Active = index;
visitorcombobox.Active = index;
LocalTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
- LocalTeamTemplateFile));
+ LocalTeamTemplateFile));
VisitorTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
- VisitorTeamTemplateFile));
+ VisitorTeamTemplateFile));
}
-
- private void FillFormats(){
- sizecombobox.AppendText (Catalog.GetString("Keep original size"));
+
+ private void FillFormats() {
+ sizecombobox.AppendText(Catalog.GetString("Keep original size"));
sizecombobox.AppendText(PAL_FORMAT);
sizecombobox.AppendText(PAL_3_4_FORMAT);
sizecombobox.AppendText(PAL_1_2_FORMAT);
sizecombobox.Active = 0;
-
+
videoformatcombobox.AppendText(Constants.AVI);
- if (Environment.OSVersion.Platform != PlatformID.Win32NT)
+ if(Environment.OSVersion.Platform != PlatformID.Win32NT)
videoformatcombobox.AppendText(Constants.WEBM);
videoformatcombobox.AppendText(Constants.OGG);
videoformatcombobox.AppendText(Constants.MP4);
videoformatcombobox.Active = 0;
}
-
+
protected virtual void OnDateSelected(DateTime dateTime) {
Date = dateTime;
}
@@ -464,7 +465,7 @@ namespace LongoMatch.Gui.Component
{
FileChooserDialog fChooser = null;
- if (useType == ProjectType.CaptureProject) {
+ if(useType == ProjectType.CaptureProject) {
fChooser = new FileChooserDialog(Catalog.GetString("Output file"),
(Gtk.Window)this.Toplevel,
FileChooserAction.Save,
@@ -472,7 +473,7 @@ namespace LongoMatch.Gui.Component
"gtk-save",ResponseType.Accept);
fChooser.SetCurrentFolder(MainClass.VideosDir());
fChooser.DoOverwriteConfirmation = true;
- if (fChooser.Run() == (int)ResponseType.Accept)
+ if(fChooser.Run() == (int)ResponseType.Accept)
fileEntry.Text = fChooser.Filename;
fChooser.Destroy();
@@ -485,7 +486,7 @@ namespace LongoMatch.Gui.Component
fChooser.SetCurrentFolder(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal));
- if (fChooser.Run() == (int)ResponseType.Accept) {
+ if(fChooser.Run() == (int)ResponseType.Accept) {
MessageDialog md=null;
string filename = fChooser.Filename;
fChooser.Destroy();
@@ -498,15 +499,15 @@ namespace LongoMatch.Gui.Component
md.Icon=Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog);
md.Show();
mFile = LongoMatch.Video.Utils.PreviewMediaFile.GetMediaFile(filename);
- if (!mFile.HasVideo || mFile.VideoCodec == "")
+ if(!mFile.HasVideo || mFile.VideoCodec == "")
throw new Exception(Catalog.GetString("This file doesn't contain a video stream."));
- if (mFile.HasVideo && mFile.Length == 0)
+ if(mFile.HasVideo && mFile.Length == 0)
throw new Exception(Catalog.GetString("This file contains a video stream but its length is 0."));
-
-
+
+
fileEntry.Text = filename;
}
- catch (Exception ex) {
+ catch(Exception ex) {
MessagePopup.PopupMessage(this, MessageType.Error,
ex.Message);
}
@@ -521,7 +522,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnCalendarbuttonClicked(object sender, System.EventArgs e)
{
- if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
+ if(Environment.OSVersion.Platform == PlatformID.Win32NT) {
win32CP = new Win32CalendarDialog();
win32CP.TransientFor = (Gtk.Window)this.Toplevel;
win32CP.Run();
@@ -541,15 +542,15 @@ namespace LongoMatch.Gui.Component
protected virtual void OnVisitorcomboboxChanged(object sender, System.EventArgs e)
{
- VisitorTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
- VisitorTeamTemplateFile));
+ VisitorTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
+ VisitorTeamTemplateFile));
}
protected virtual void OnLocalcomboboxChanged(object sender, System.EventArgs e)
{
- LocalTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
- LocalTeamTemplateFile));
+ LocalTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
+ LocalTeamTemplateFile));
}
protected virtual void OnEditbuttonClicked(object sender, System.EventArgs e)
@@ -559,7 +560,7 @@ namespace LongoMatch.Gui.Component
ted.Categories = Categories;
ted.Project = project;
ted.CanExport = Use == ProjectType.EditProject;
- if (ted.Run() == (int)ResponseType.Apply) {
+ if(ted.Run() == (int)ResponseType.Apply) {
Categories = ted.Categories;
}
ted.Destroy();
@@ -571,8 +572,8 @@ namespace LongoMatch.Gui.Component
tted.TransientFor = (Window)Toplevel;
tted.Title=Catalog.GetString("Local Team Template");
tted.SetTeamTemplate(LocalTeamTemplate);
-
- if (tted.Run() == (int)ResponseType.Apply) {
+
+ if(tted.Run() == (int)ResponseType.Apply) {
LocalTeamTemplate = tted.GetTeamTemplate();
}
tted.Destroy();
@@ -584,7 +585,7 @@ namespace LongoMatch.Gui.Component
tted.TransientFor = (Window)Toplevel;
tted.Title=Catalog.GetString("Visitor Team Template");
tted.SetTeamTemplate(VisitorTeamTemplate);
- if (tted.Run() == (int)ResponseType.Apply) {
+ if(tted.Run() == (int)ResponseType.Apply) {
VisitorTeamTemplate = tted.GetTeamTemplate();
}
tted.Destroy();
@@ -593,7 +594,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnEdited(object sender, System.EventArgs e) {
Edited = true;
- if (EditedEvent != null)
+ if(EditedEvent != null)
EditedEvent(this,null);
}
}
diff --git a/LongoMatch/Gui/Component/ProjectListWidget.cs b/LongoMatch/Gui/Component/ProjectListWidget.cs
index ffdf92a..dd7691b 100644
--- a/LongoMatch/Gui/Component/ProjectListWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectListWidget.cs
@@ -68,13 +68,13 @@ namespace LongoMatch.Gui.Component
treeview.EnableGridLines = TreeViewGridLines.Horizontal;
treeview.HeadersVisible = false;
}
-
+
public SelectionMode SelectionMode {
set {
treeview.Selection.Mode = value;
}
}
-
+
public void RemoveProjects(List<ProjectDescription> projects) {
/* FIXME: to delete projects from the treeview we need to remove the filter
* and clear everything, otherwise we have seen several crashes trying
@@ -82,16 +82,16 @@ namespace LongoMatch.Gui.Component
* it's safe. */
treeview.Model = projectsListStore;
projectsListStore.Clear();
- foreach (ProjectDescription project in projects)
+ foreach(ProjectDescription project in projects)
projectsList.Remove(project);
Fill(projectsList);
}
-
+
public void Fill(List<ProjectDescription> projects) {
projectsList = projects;
projectsList.Sort();
projectsListStore.Clear();
- foreach (ProjectDescription project in projectsList){
+ foreach(ProjectDescription project in projectsList) {
projectsListStore.AppendValues(project);
}
filter = new Gtk.TreeModelFilter(projectsListStore, null);
@@ -108,24 +108,24 @@ namespace LongoMatch.Gui.Component
private void RenderPixbuf(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
ProjectDescription project = (ProjectDescription) model.GetValue(iter, 0);
-
+
(cell as Gtk.CellRendererPixbuf).Pixbuf= project.File.Preview;
}
-
+
private void RenderProperties(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
string text;
ProjectDescription project = (ProjectDescription) model.GetValue(iter, 0);
-
- text = "\n"+"\n"+"\n"+"<b>"+Catalog.GetString("File length")+":</b> " +
- (new Time {MSeconds = (int)project.File.Length}).ToSecondsString();
+
+ text = "\n"+"\n"+"\n"+"<b>"+Catalog.GetString("File length")+":</b> " +
+ (new Time {MSeconds = (int)project.File.Length}).ToSecondsString();
text = text +"\n"+"<b>"+Catalog.GetString("Video codec")+":</b> " + project.File.VideoCodec;
text = text +"\n"+"<b>"+Catalog.GetString("Audio codec")+":</b> " + project.File.AudioCodec;
text = text +"\n"+"<b>"+Catalog.GetString("Format")+":</b> " + project.Format;
(cell as Gtk.CellRendererText).Markup = text;
}
-
+
private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
string text;
@@ -151,39 +151,39 @@ namespace LongoMatch.Gui.Component
{
ProjectDescription project =(ProjectDescription) model.GetValue(iter, 0);
- if (project == null)
+ if(project == null)
return true;
- if (filterEntry.Text == "")
+ if(filterEntry.Text == "")
return true;
- if (project.Title.IndexOf(filterEntry.Text) > -1)
+ if(project.Title.IndexOf(filterEntry.Text) > -1)
return true;
- else if (project.Season.IndexOf(filterEntry.Text) > -1)
+ else if(project.Season.IndexOf(filterEntry.Text) > -1)
return true;
- else if (project.Competition.IndexOf(filterEntry.Text) > -1)
+ else if(project.Competition.IndexOf(filterEntry.Text) > -1)
return true;
- else if (project.LocalName.IndexOf(filterEntry.Text) > -1)
+ else if(project.LocalName.IndexOf(filterEntry.Text) > -1)
return true;
- else if (project.VisitorName.IndexOf(filterEntry.Text) > -1)
+ else if(project.VisitorName.IndexOf(filterEntry.Text) > -1)
return true;
else
return false;
}
-
- protected virtual void OnSelectionChanged (object o, EventArgs args){
+
+ protected virtual void OnSelectionChanged(object o, EventArgs args) {
TreeIter iter;
List<ProjectDescription> list;
TreePath[] pathArray;
-
+
list = new List<ProjectDescription>();
pathArray = treeview.Selection.GetSelectedRows();
-
- for (int i=0; i< pathArray.Length; i++){
- treeview.Model.GetIterFromString (out iter, pathArray[i].ToString());
+
+ for(int i=0; i< pathArray.Length; i++) {
+ treeview.Model.GetIterFromString(out iter, pathArray[i].ToString());
list.Add((ProjectDescription) treeview.Model.GetValue(iter, 0));
}
- if (ProjectsSelected != null)
+ if(ProjectsSelected != null)
ProjectsSelected(list);
}
}
diff --git a/LongoMatch/Gui/Component/ProjectTemplateWidget.cs b/LongoMatch/Gui/Component/ProjectTemplateWidget.cs
index 70f2d03..f73a4e0 100644
--- a/LongoMatch/Gui/Component/ProjectTemplateWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectTemplateWidget.cs
@@ -48,9 +48,9 @@ namespace LongoMatch.Gui.Component
}
public Project Project {
- set{
+ set {
project = value;
- if (project != null)
+ if(project != null)
Categories = project.Categories;
}
}
@@ -64,8 +64,8 @@ namespace LongoMatch.Gui.Component
Edited = false;
Gtk.TreeStore categoriesListStore = new Gtk.TreeStore(typeof(Category));
hkList.Clear();
-
- foreach (var cat in categories){
+
+ foreach(var cat in categories) {
categoriesListStore.AppendValues(cat);
try {
hkList.Add(cat.HotKey);
@@ -76,8 +76,8 @@ namespace LongoMatch.Gui.Component
}
}
- public bool CanExport{
- set{
+ public bool CanExport {
+ set {
hseparator1.Visible = value;
exportbutton.Visible = value;
}
@@ -98,7 +98,7 @@ namespace LongoMatch.Gui.Component
Time start = new Time {MSeconds = 10*Time.SECONDS_TO_TIME};
Time stop = new Time {MSeconds = 10*Time.SECONDS_TO_TIME};
- tn = new Category{
+ tn = new Category {
Name = "New Section",
Start = start,
Stop = stop,
@@ -106,7 +106,7 @@ namespace LongoMatch.Gui.Component
Color = new Color(Byte.MaxValue,Byte.MinValue,Byte.MinValue)
};
- if (project != null) {
+ if(project != null) {
/* Editing a project template */
project.Categories.Insert(index,tn);
} else {
@@ -118,13 +118,13 @@ namespace LongoMatch.Gui.Component
}
private void RemoveSelectedCategories() {
- if (project!= null) {
+ if(project!= null) {
MessageDialog dialog = new MessageDialog((Gtk.Window)this.Toplevel,DialogFlags.Modal,MessageType.Question,
ButtonsType.YesNo,true,
Catalog.GetString("You are about to delete a category and all the plays added to this category. Do you want to proceed?"));
- if (dialog.Run() == (int)ResponseType.Yes){
+ if(dialog.Run() == (int)ResponseType.Yes) {
try {
- foreach (Category cat in selectedCategories)
+ foreach(Category cat in selectedCategories)
project.Categories.Remove(cat);
} catch {
MessagePopup.PopupMessage(this,MessageType.Warning,
@@ -134,11 +134,11 @@ namespace LongoMatch.Gui.Component
dialog.Destroy();
categories = project.Categories;
} else {
- foreach (Category cat in selectedCategories){
- if (categories.Count == 1){
+ foreach(Category cat in selectedCategories) {
+ if(categories.Count == 1) {
MessagePopup.PopupMessage(this,MessageType.Warning,
Catalog.GetString("A template needs at least one category"));
- } else
+ } else
categories.Remove(cat);
}
}
@@ -166,7 +166,7 @@ namespace LongoMatch.Gui.Component
dialog.Destroy();
Edited = true;
}
-
+
protected virtual void OnNewAfter(object sender, EventArgs args) {
AddCategory(categories.IndexOf(selectedCategories[0])+1);
}
@@ -188,12 +188,12 @@ namespace LongoMatch.Gui.Component
EditSelectedSection();
}
- protected virtual void OnCategoriestreeviewCategoriesSelected (List<Category> tNodesList)
+ protected virtual void OnCategoriestreeviewCategoriesSelected(List<Category> tNodesList)
{
selectedCategories = tNodesList;
- if (tNodesList.Count == 0)
+ if(tNodesList.Count == 0)
ButtonsSensitive = false;
- else if (tNodesList.Count == 1){
+ else if(tNodesList.Count == 1) {
ButtonsSensitive = true;
}
else {
@@ -206,35 +206,35 @@ namespace LongoMatch.Gui.Component
protected virtual void OnKeyPressEvent(object o, Gtk.KeyPressEventArgs args)
{
- if (args.Event.Key == Gdk.Key.Delete && selectedCategories != null)
+ if(args.Event.Key == Gdk.Key.Delete && selectedCategories != null)
RemoveSelectedCategories();
}
- protected virtual void OnExportbuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnExportbuttonClicked(object sender, System.EventArgs e)
{
EntryDialog dialog = new EntryDialog();
dialog.TransientFor = (Gtk.Window)this.Toplevel;
dialog.ShowCount = false;
dialog.Text = Catalog.GetString("New template");
- if (dialog.Run() == (int)ResponseType.Ok){
- if (dialog.Text == "")
+ if(dialog.Run() == (int)ResponseType.Ok) {
+ if(dialog.Text == "")
MessagePopup.PopupMessage(dialog, MessageType.Error,
Catalog.GetString("The template name is void."));
- else if (File.Exists(System.IO.Path.Combine(MainClass.TemplatesDir(),dialog.Text+".sct"))){
+ else if(File.Exists(System.IO.Path.Combine(MainClass.TemplatesDir(),dialog.Text+".sct"))) {
MessageDialog md = new MessageDialog(null,
DialogFlags.Modal,
MessageType.Question,
Gtk.ButtonsType.YesNo,
Catalog.GetString("The template already exists. " +
- "Do you want to overwrite it ?")
- );
- if (md.Run() == (int)ResponseType.Yes)
+ "Do you want to overwrite it ?")
+ );
+ if(md.Run() == (int)ResponseType.Yes)
Categories.Save(dialog.Text);
md.Destroy();
- }
+ }
else
Categories.Save(dialog.Text);
- }
+ }
dialog.Destroy();
}
}
diff --git a/LongoMatch/Gui/Component/TaggerWidget.cs b/LongoMatch/Gui/Component/TaggerWidget.cs
index f1ce579..86c15b3 100644
--- a/LongoMatch/Gui/Component/TaggerWidget.cs
+++ b/LongoMatch/Gui/Component/TaggerWidget.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2009 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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.Collections.Generic;
@@ -24,96 +24,96 @@ using LongoMatch.Store.Templates;
namespace LongoMatch.Gui.Component
{
-
-
+
+
[System.ComponentModel.ToolboxItem(true)]
public partial class TaggerWidget : Gtk.Bin
{
private Dictionary<Tag, CheckButton> tagsDict;
-
+
public TaggerWidget()
{
this.Build();
tagsDict = new Dictionary<Tag, CheckButton>();
table1.NColumns = 5;
}
-
-
- public List<Tag> Tags{
- set{
+
+
+ public List<Tag> Tags {
+ set {
CheckButton button = null;
- foreach (Tag tag in value){
- if (tagsDict.TryGetValue(tag, out button))
+ foreach(Tag tag in value) {
+ if(tagsDict.TryGetValue(tag, out button))
button.Active = true;
}
}
- get{
+ get {
List<Tag> list = new List<Tag>();
- foreach (KeyValuePair<Tag, CheckButton> pair in tagsDict){
- if (pair.Value.Active)
+ foreach(KeyValuePair<Tag, CheckButton> pair in tagsDict) {
+ if(pair.Value.Active)
list.Add(pair.Key);
}
return list;
}
}
-
- private void AddTag(string text, bool check){
+
+ private void AddTag(string text, bool check) {
Tag tag = new Tag {
Value = text,
};
- if (tagsDict.ContainsKey(tag))
+ if(tagsDict.ContainsKey(tag))
return;
AddTagWidget(tag, check);
}
-
- private void AddTagWidget(Tag tag, bool check){
+
+ private void AddTagWidget(Tag tag, bool check) {
CheckButton button = new CheckButton(tag.Value.ToString());
button.Name = tag.Value.ToString();
AddElementToTable(button);
button.Active = check;
tagsDict.Add(tag, button);
}
-
- private void AddElementToTable(CheckButton button){
+
+ private void AddElementToTable(CheckButton button) {
uint row_top,row_bottom,col_left,col_right;
int index = tagsDict.Count;
-
- table1.NRows =(uint) (index/5 + 1);
- row_top =(uint) (index/table1.NColumns);
+
+ table1.NRows =(uint)(index/5 + 1);
+ row_top =(uint)(index/table1.NColumns);
row_bottom = (uint) row_top+1 ;
col_left = (uint) index%table1.NColumns;
col_right = (uint) col_left+1 ;
-
- table1.Attach(button,col_left,col_right,row_top,row_bottom);
+
+ table1.Attach(button,col_left,col_right,row_top,row_bottom);
button.Show();
}
- protected virtual void OnTagbuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnTagbuttonClicked(object sender, System.EventArgs e)
{
Tag tag;
CheckButton button;
-
+
// Don't allow tags with void strings
- if (entry1.Text == "")
+ if(entry1.Text == "")
return;
// Check if it's the first tag and show the tags table
- if (tagsDict.Count == 0){
+ if(tagsDict.Count == 0) {
scrolledwindow1.Visible = true;
label1.Visible = false;
}
- tag = new Tag{
+ tag = new Tag {
Value = entry1.Text,
};
- if (tagsDict.TryGetValue(tag, out button))
+ if(tagsDict.TryGetValue(tag, out button))
button.Active = true;
else
- AddTag(entry1.Text, true);
+ AddTag(entry1.Text, true);
entry1.Text = "";
}
- protected virtual void OnEntry1Activated (object sender, System.EventArgs e)
+ protected virtual void OnEntry1Activated(object sender, System.EventArgs e)
{
tagbutton.Click();
- }
+ }
}
}
\ No newline at end of file
diff --git a/LongoMatch/Gui/Component/TagsTreeWidget.cs b/LongoMatch/Gui/Component/TagsTreeWidget.cs
index 925c64d..9fec3b4 100644
--- a/LongoMatch/Gui/Component/TagsTreeWidget.cs
+++ b/LongoMatch/Gui/Component/TagsTreeWidget.cs
@@ -57,22 +57,22 @@ namespace LongoMatch.Gui.Component
{
this.Build();
filterTags = new List<Tag>();
- model = new Gtk.ListStore(typeof(Play));
+ model = new Gtk.ListStore(typeof(Play));
filter = new Gtk.TreeModelFilter(model, null);
filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree);
treeview.Model = filter;
- filtercombobox.InsertText ((int)FilterType.OR, Catalog.GetString(orFilter));
- filtercombobox.InsertText ((int)FilterType.AND, Catalog.GetString(andFilter));
+ filtercombobox.InsertText((int)FilterType.OR, Catalog.GetString(orFilter));
+ filtercombobox.InsertText((int)FilterType.AND, Catalog.GetString(andFilter));
filtercombobox.Active = 0;
filterType = FilterType.OR;
treeview.TimeNodeChanged += OnTimeNodeChanged;
- treeview.TimeNodeSelected += OnTimeNodeSelected;
- treeview.PlayListNodeAdded += OnPlayListNodeAdded;
- treeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
-
+ treeview.TimeNodeSelected += OnTimeNodeSelected;
+ treeview.PlayListNodeAdded += OnPlayListNodeAdded;
+ treeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
+
}
-
- public void Clear(){
+
+ public void Clear() {
model.Clear();
filterTags.Clear();
filter.Refilter();
@@ -81,21 +81,21 @@ namespace LongoMatch.Gui.Component
public void RemovePlays(List<Play> plays) {
TreeIter iter;
List<TreeIter> removeIters;
-
- if (project == null)
+
+ if(project == null)
return;
-
+
removeIters = new List<TreeIter>();
model.GetIterFirst(out iter);
-
+
do {
Play play = (Play) model.GetValue(iter,0);
- if (plays.Contains(play)) {
+ if(plays.Contains(play)) {
removeIters.Add(iter);
}
- } while (model.IterNext(ref iter));
-
- for (int i=0; i < removeIters.Count; i++){
+ } while(model.IterNext(ref iter));
+
+ for(int i=0; i < removeIters.Count; i++) {
iter = removeIters[i];
model.Remove(ref iter);
}
@@ -105,9 +105,9 @@ namespace LongoMatch.Gui.Component
model.AppendValues(play);
filter.Refilter();
}
-
- public bool ProjectIsLive{
- set{
+
+ public bool ProjectIsLive {
+ set {
treeview.ProjectIsLive = value;
}
}
@@ -115,11 +115,11 @@ namespace LongoMatch.Gui.Component
public Project Project {
set {
project = value;
- if (project != null) {
+ if(project != null) {
model.Clear();
- foreach (Play play in value.AllPlays())
+ foreach(Play play in value.AllPlays())
model.AppendValues(play);
-
+
UpdateTagsList();
treeview.LocalTeam = project.Description.LocalName;
treeview.VisitorTeam = project.Description.VisitorName;
@@ -132,18 +132,18 @@ namespace LongoMatch.Gui.Component
treeview.PlayListLoaded=value;
}
}
-
- public void UpdateTagsList(){
+
+ public void UpdateTagsList() {
(tagscombobox.Model as ListStore).Clear();
- foreach (Tag tag in project.Tags)
+ foreach(Tag tag in project.Tags)
tagscombobox.AppendText(tag.Value.ToString());
}
-
- private void AddFilterWidget(Tag tag){
+
+ private void AddFilterWidget(Tag tag) {
HBox box;
Button b;
Label l;
-
+
box = new HBox();
box.Name = tag.Value.ToString();
b = new Button();
@@ -156,23 +156,23 @@ namespace LongoMatch.Gui.Component
tagsvbox.PackEnd(box);
box.ShowAll();
}
-
- protected virtual void OnDeleteClicked (object o, System.EventArgs e){
+
+ protected virtual void OnDeleteClicked(object o, System.EventArgs e) {
Widget parent = (o as Widget).Parent;
- tagscombobox.AppendText(parent.Name);
- filterTags.Remove(new Tag{Value = parent.Name});
+ tagscombobox.AppendText(parent.Name);
+ filterTags.Remove(new Tag {Value = parent.Name});
filter.Refilter();
tagsvbox.Remove(parent);
}
-
- protected virtual void OnAddFilter (object sender, System.EventArgs e)
+
+ protected virtual void OnAddFilter(object sender, System.EventArgs e)
{
string text = tagscombobox.ActiveText;
- if (text == null || text == "")
+ if(text == null || text == "")
return;
-
- Tag tag = new Tag{ Value = text};
- if (!filterTags.Contains(tag)){
+
+ Tag tag = new Tag { Value = text};
+ if(!filterTags.Contains(tag)) {
filterTags.Add(tag);
tagscombobox.RemoveText(tagscombobox.Active);
AddFilterWidget(tag);
@@ -180,70 +180,70 @@ namespace LongoMatch.Gui.Component
}
}
- protected virtual void OnClearbuttonClicked (object sender, System.EventArgs e)
+ protected virtual void OnClearbuttonClicked(object sender, System.EventArgs e)
{
filterTags.Clear();
filter.Refilter();
- foreach (Widget w in tagsvbox.Children)
+ foreach(Widget w in tagsvbox.Children)
tagsvbox.Remove(w);
UpdateTagsList();
}
-
+
private bool FilterTree(Gtk.TreeModel model, Gtk.TreeIter iter)
{
Play tNode;
-
- if (filterTags.Count == 0)
+
+ if(filterTags.Count == 0)
return true;
-
+
tNode = model.GetValue(iter, 0) as Play;
- if (tNode == null)
+ if(tNode == null)
return true;
- if (filterType == FilterType.OR){
- foreach (Tag tag in filterTags){
- if (tNode.Tags.Contains(tag))
+ if(filterType == FilterType.OR) {
+ foreach(Tag tag in filterTags) {
+ if(tNode.Tags.Contains(tag))
return true;
}
return false;
} else {
- foreach (Tag tag in filterTags){
- if (! tNode.Tags.Contains(tag))
+ foreach(Tag tag in filterTags) {
+ if(! tNode.Tags.Contains(tag))
return false;
}
return true;
}
}
-
+
protected virtual void OnTimeNodeChanged(TimeNode tNode,object val) {
- if (TimeNodeChanged != null)
+ if(TimeNodeChanged != null)
TimeNodeChanged(tNode,val);
}
protected virtual void OnTimeNodeSelected(Play tNode) {
- if (TimeNodeSelected != null)
+ if(TimeNodeSelected != null)
TimeNodeSelected(tNode);
}
protected virtual void OnPlayListNodeAdded(Play tNode)
{
- if (PlayListNodeAdded != null)
+ if(PlayListNodeAdded != null)
PlayListNodeAdded(tNode);
}
protected virtual void OnSnapshotSeriesEvent(LongoMatch.Store.Play tNode)
{
- if (SnapshotSeriesEvent != null)
+ if(SnapshotSeriesEvent != null)
SnapshotSeriesEvent(tNode);
}
-
- protected virtual void OnFiltercomboboxChanged (object sender, System.EventArgs e)
+
+ protected virtual void OnFiltercomboboxChanged(object sender, System.EventArgs e)
{
filterType = (FilterType) filtercombobox.Active;
filter.Refilter();
}
-
-
+
+
}
}
\ No newline at end of file
diff --git a/LongoMatch/Gui/Component/TeamTemplateWidget.cs b/LongoMatch/Gui/Component/TeamTemplateWidget.cs
index d591b70..c62ca31 100644
--- a/LongoMatch/Gui/Component/TeamTemplateWidget.cs
+++ b/LongoMatch/Gui/Component/TeamTemplateWidget.cs
@@ -45,7 +45,7 @@ namespace LongoMatch.Gui.Component
this.template= value;
edited = false;
Gtk.TreeStore playersListStore = new Gtk.TreeStore(typeof(Player));
- foreach (Player player in template)
+ foreach(Player player in template)
playersListStore.AppendValues(player);
playerpropertiestreeview1.Model=playersListStore;
}
diff --git a/LongoMatch/Gui/Component/TimeAdjustWidget.cs b/LongoMatch/Gui/Component/TimeAdjustWidget.cs
index a13bb6b..e210c0f 100644
--- a/LongoMatch/Gui/Component/TimeAdjustWidget.cs
+++ b/LongoMatch/Gui/Component/TimeAdjustWidget.cs
@@ -53,13 +53,13 @@ namespace LongoMatch.Gui.Component
protected virtual void OnSpinbutton1ValueChanged(object sender, System.EventArgs e)
{
- if (LeadTimeChanged != null)
+ if(LeadTimeChanged != null)
LeadTimeChanged(this,new EventArgs());
}
protected virtual void OnSpinbutton2ValueChanged(object sender, System.EventArgs e)
{
- if (LagTimeChanged != null)
+ if(LagTimeChanged != null)
LagTimeChanged(this,new EventArgs());
}
}
diff --git a/LongoMatch/Gui/Component/TimeLineWidget.cs b/LongoMatch/Gui/Component/TimeLineWidget.cs
index 3f704e3..cf25361 100644
--- a/LongoMatch/Gui/Component/TimeLineWidget.cs
+++ b/LongoMatch/Gui/Component/TimeLineWidget.cs
@@ -53,36 +53,36 @@ namespace LongoMatch.Gui.Component {
this.Build();
SetPixelRatio(10);
zoomscale.CanFocus = false;
-
+
GtkScrolledWindow.Vadjustment.ValueChanged += HandleScrollEvent;
GtkScrolledWindow.Hadjustment.ValueChanged += HandleScrollEvent;
-
+
GtkScrolledWindow.HScrollbar.SizeAllocated += OnSizeAllocated;
-
+
cs = new CategoriesScale();
cs.WidthRequest = 100;
categoriesbox.PackStart(cs, false, false, 0);
-
+
tr = new TimeReferenceWidget();
timescalebox.PackStart(tr,false,false,0);
-
- tr.HeightRequest = 50 - leftbox.Spacing;
+
+ tr.HeightRequest = 50 - leftbox.Spacing;
toolsbox.HeightRequest = 50 - leftbox.Spacing;
}
-
+
public Play SelectedTimeNode {
get {
return selected;
}
set {
- if (!hasProject)
+ if(!hasProject)
return;
-
+
selected = value;
- foreach (TimeScale ts in tsList.Values)
+ foreach(TimeScale ts in tsList.Values)
ts.SelectedTimeNode = value;
- if (selected != null) {
- if (SelectedTimeNode.StartFrame/pixelRatio < GtkScrolledWindow.Hadjustment.Value ||
+ if(selected != null) {
+ if(SelectedTimeNode.StartFrame/pixelRatio < GtkScrolledWindow.Hadjustment.Value ||
SelectedTimeNode.StartFrame/pixelRatio > GtkScrolledWindow.Hadjustment.Value +
GtkScrolledWindow.Allocation.Width - GtkScrolledWindow.VScrollbar.Allocation.Width)
AdjustPostion(SelectedTimeNode.StartFrame);
@@ -96,11 +96,11 @@ namespace LongoMatch.Gui.Component {
return currentFrame;
}
set {
- if (!hasProject)
+ if(!hasProject)
return;
-
+
currentFrame = value;
- foreach (TimeScale ts in tsList.Values)
+ foreach(TimeScale ts in tsList.Values)
ts.CurrentFrame = value;
tr.CurrentFrame = value;
QueueDraw();
@@ -112,12 +112,12 @@ namespace LongoMatch.Gui.Component {
int realWidth;
uint pos;
int scrollbarWidth;
- if (Visible) {
+ if(Visible) {
scrollbarWidth= GtkScrolledWindow.VScrollbar.Allocation.Width;
visibleWidth = GtkScrolledWindow.Allocation.Width-scrollbarWidth;
realWidth = vbox1.Allocation.Width;
pos = currentframe/pixelRatio;
- if (pos+visibleWidth < realWidth) {
+ if(pos+visibleWidth < realWidth) {
GtkScrolledWindow.Hadjustment.Value = pos;
}
else {
@@ -127,12 +127,12 @@ namespace LongoMatch.Gui.Component {
}
private void SetPixelRatio(uint pixelRatio) {
- if (!hasProject)
+ if(!hasProject)
return;
-
+
this.pixelRatio = pixelRatio;
tr.PixelRatio = pixelRatio;
- foreach (TimeScale ts in tsList.Values)
+ foreach(TimeScale ts in tsList.Values)
ts.PixelRatio = pixelRatio;
zoomscale.Value=pixelRatio;
}
@@ -141,7 +141,7 @@ namespace LongoMatch.Gui.Component {
set {
ResetGui();
- if (value == null) {
+ if(value == null) {
categories = null;
tsList.Clear();
tsList=null;
@@ -159,8 +159,8 @@ namespace LongoMatch.Gui.Component {
tr.Frames = frames;
tr.FrameRate = value.Description.File.Fps;
tr.Show();
-
- foreach (Category cat in categories) {
+
+ foreach(Category cat in categories) {
List<Play> playsList = value.PlaysInCategory(cat);
TimeScale ts = new TimeScale(cat, playsList,frames);
tsList[cat] = ts;
@@ -175,44 +175,44 @@ namespace LongoMatch.Gui.Component {
}
}
- public void AddPlay(Play play){
+ public void AddPlay(Play play) {
TimeScale ts;
- if (tsList.TryGetValue(play.Category, out ts))
+ if(tsList.TryGetValue(play.Category, out ts))
ts.AddPlay(play);
}
-
- public void RemovePlays (List<Play> plays){
+
+ public void RemovePlays(List<Play> plays) {
TimeScale ts;
- foreach (Play play in plays){
- if (tsList.TryGetValue(play.Category, out ts))
+ foreach(Play play in plays) {
+ if(tsList.TryGetValue(play.Category, out ts))
ts.RemovePlay(play);
}
-
+
}
private void ResetGui() {
//Unrealize all children
- foreach (Widget w in vbox1.AllChildren) {
+ foreach(Widget w in vbox1.AllChildren) {
vbox1.Remove(w);
w.Destroy();
}
}
protected virtual void OnNewMark(Category category, int frame) {
- if (NewMarkEvent != null)
+ if(NewMarkEvent != null)
NewMarkEvent(category,frame);
}
protected virtual void OnTimeNodeChanged(TimeNode tn, object val) {
- if (TimeNodeChanged != null)
+ if(TimeNodeChanged != null)
TimeNodeChanged(tn,val);
}
protected virtual void OnTimeNodeSelected(Play tn) {
- if (TimeNodeSelected != null)
+ if(TimeNodeSelected != null)
TimeNodeSelected(tn);
}
protected virtual void OnTimeNodeDeleted(List<Play> plays) {
- if (TimeNodeDeleted != null)
+ if(TimeNodeDeleted != null)
TimeNodeDeleted(plays);
}
@@ -227,19 +227,19 @@ namespace LongoMatch.Gui.Component {
QueueDraw();
AdjustPostion(currentFrame);
}
-
- protected virtual void HandleScrollEvent (object sender, System.EventArgs args)
+
+ protected virtual void HandleScrollEvent(object sender, System.EventArgs args)
{
- if (sender == GtkScrolledWindow.Vadjustment)
+ if(sender == GtkScrolledWindow.Vadjustment)
cs.Scroll = GtkScrolledWindow.Vadjustment.Value;
- else if (sender == GtkScrolledWindow.Hadjustment)
+ else if(sender == GtkScrolledWindow.Hadjustment)
tr.Scroll = GtkScrolledWindow.Hadjustment.Value;
}
-
- protected virtual void OnSizeAllocated (object sender, SizeAllocatedArgs e)
+
+ protected virtual void OnSizeAllocated(object sender, SizeAllocatedArgs e)
{
/* Align the categories list widget on top of the timeline's horizontal bar */
- if (sender == GtkScrolledWindow.HScrollbar)
+ if(sender == GtkScrolledWindow.HScrollbar)
categoriesalignment1.BottomPadding = (uint) GtkScrolledWindow.HScrollbar.Allocation.Height;
}
}
diff --git a/LongoMatch/Gui/Component/TimeReferenceWidget.cs b/LongoMatch/Gui/Component/TimeReferenceWidget.cs
index 8ac7237..84a72f0 100644
--- a/LongoMatch/Gui/Component/TimeReferenceWidget.cs
+++ b/LongoMatch/Gui/Component/TimeReferenceWidget.cs
@@ -45,7 +45,7 @@ namespace LongoMatch.Gui.Component
Frames = 1;
PixelRatio = 1;
FrameRate = 1;
-
+
this.HeightRequest= SECTION_HEIGHT;
layout = new Pango.Layout(this.PangoContext);
}
@@ -54,18 +54,18 @@ namespace LongoMatch.Gui.Component
get;
set;
}
-
+
public uint Frames {
- set{
+ set {
frames = value;
}
}
-
+
public ushort FrameRate {
set;
get;
}
-
+
public double Scroll {
get {
return scroll;
@@ -96,13 +96,13 @@ namespace LongoMatch.Gui.Component
win.Resize((int)(frames/pixelRatio), height);
win.GetSize(out width, out height);
- if (Environment.OSVersion.Platform == PlatformID.Unix)
+ if(Environment.OSVersion.Platform == PlatformID.Unix)
this.CairoDraw(evnt,height,width);
else
this.GdkDraw(evnt,height,width);
return base.OnExposeEvent(evnt);
}
-
+
private void CairoDraw(EventExpose evnt,int height,int width) {
Time time = new Time();
using(Cairo.Context g = Gdk.CairoHelper.Create(evnt.Window)) {
@@ -114,7 +114,7 @@ namespace LongoMatch.Gui.Component
g.MoveTo(new PointD(0-Scroll,height-20));
g.ShowText("0");
- for (int i=10*FrameRate; i<=frames/pixelRatio;) {
+ for(int i=10*FrameRate; i<=frames/pixelRatio;) {
CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll,
height-10, 2, color);
g.MoveTo(new PointD(i-Scroll-13,height-20));
@@ -122,14 +122,14 @@ namespace LongoMatch.Gui.Component
g.ShowText(time.ToSecondsString());
i=i+10*FrameRate;
}
- for (int i=0; i<=frames/pixelRatio;) {
+ for(int i=0; i<=frames/pixelRatio;) {
CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll,
height-5, 1, color);
i=i+FrameRate;
}
}
}
-
+
private void GdkDraw(EventExpose evnt,int height,int width) {
Time time = new Time();
layout.SetMarkup("0");
@@ -140,7 +140,7 @@ namespace LongoMatch.Gui.Component
Gdk.Point bottom= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll),height);
this.GdkWindow.DrawPolygon(this.Style.TextGC(StateType.Normal),true,new Gdk.Point[] {topL,topR,bottom});
- for (int i=10*FrameRate; i<=frames/pixelRatio;) {
+ for(int i=10*FrameRate; i<=frames/pixelRatio;) {
// Drawing separator line
evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-10);
time.MSeconds = (int)(i/FrameRate*pixelRatio);
@@ -150,7 +150,7 @@ namespace LongoMatch.Gui.Component
i=i+10*FrameRate;
}
- for (int i=0; i<=frames/pixelRatio;) {
+ for(int i=0; i<=frames/pixelRatio;) {
evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-5);
i=i+FrameRate;
}
diff --git a/LongoMatch/Gui/Component/TimeScale.cs b/LongoMatch/Gui/Component/TimeScale.cs
index 39b0e98..d5a0f4f 100644
--- a/LongoMatch/Gui/Component/TimeScale.cs
+++ b/LongoMatch/Gui/Component/TimeScale.cs
@@ -97,7 +97,7 @@ namespace LongoMatch.Gui.Component
return pixelRatio;
}
set {
- lock (locker) {
+ lock(locker) {
pixelRatio = value;
Size((int)(frames/pixelRatio),SECTION_HEIGHT);
}
@@ -129,7 +129,7 @@ namespace LongoMatch.Gui.Component
public void RemovePlay(Play play) {
list.Remove(play);
}
-
+
public void ReDraw() {
Gdk.Region region = GdkWindow.ClipRegion;
GdkWindow.InvalidateRegion(region,true);
@@ -153,7 +153,7 @@ namespace LongoMatch.Gui.Component
}
private void DrawTimeNodes(Gdk.Window win) {
- lock (locker) {
+ lock(locker) {
bool hasSelectedTimeNode=false;
using(Cairo.Context g = Gdk.CairoHelper.Create(win)) {
@@ -165,8 +165,8 @@ namespace LongoMatch.Gui.Component
g.Operator = Operator.Over;
- foreach (Play tn in list) {
- if (tn != selected) {
+ foreach(Play tn in list) {
+ if(tn != selected) {
Cairo.Color borderColor = new Cairo.Color(color.R+0.1, color.G+0.1,color.B+0.1, 1);
CairoUtils.DrawRoundedRectangle(g,tn.StartFrame/pixelRatio,3,
tn.TotalFrames/pixelRatio,height-6,
@@ -177,12 +177,12 @@ namespace LongoMatch.Gui.Component
}
}
//Then we draw the selected TimeNode over the others
- if (hasSelectedTimeNode) {
+ if(hasSelectedTimeNode) {
Cairo.Color borderColor = new Cairo.Color(0, 0, 0, 1);
CairoUtils.DrawRoundedRectangle(g,selected.StartFrame/pixelRatio,3,
selected.TotalFrames/pixelRatio,height-6,
SECTION_HEIGHT/7, color, borderColor);
- if (selected.HasDrawings) {
+ if(selected.HasDrawings) {
g.MoveTo(selected.KeyFrame/pixelRatio,3);
g.LineTo(selected.KeyFrame/pixelRatio,SECTION_HEIGHT-3);
g.StrokePreserve();
@@ -194,9 +194,9 @@ namespace LongoMatch.Gui.Component
}
private void DrawLines(Gdk.Window win, Cairo.Context g, int height, int width) {
- if (Environment.OSVersion.Platform == PlatformID.Unix) {
+ if(Environment.OSVersion.Platform == PlatformID.Unix) {
Cairo.Color color = new Cairo.Color(0,0,0);
- CairoUtils.DrawLine(g, currentFrame/pixelRatio,0,currentFrame/pixelRatio,height,
+ CairoUtils.DrawLine(g, currentFrame/pixelRatio,0,currentFrame/pixelRatio,height,
1, color);
CairoUtils.DrawLine(g,0 ,0, width, 0, 1, color);
CairoUtils.DrawLine(g,0 ,height, width, height, 1, color);
@@ -212,8 +212,8 @@ namespace LongoMatch.Gui.Component
private void DrawTimeNodesName() {
- lock (locker) {
- foreach (Play tn in list) {
+ lock(locker) {
+ foreach(Play tn in list) {
layout.Width = Pango.Units.FromPixels((int)(tn.TotalFrames/pixelRatio));
layout.SetMarkup(tn.Name);
GdkWindow.DrawLayout(Style.TextGC(StateType.Normal),
@@ -228,10 +228,10 @@ namespace LongoMatch.Gui.Component
deleteMenu = new Menu();
delete.Submenu=deleteMenu;
dic.Clear();
- foreach (Play tn in list) {
+ foreach(Play tn in list) {
//We scan all the time Nodes looking for one matching the cursor selectcio
//And we add them to the delete menu
- if (tn.HasFrame(cursorFrame)) {
+ if(tn.HasFrame(cursorFrame)) {
MenuItem del = new MenuItem(Catalog.GetString("Delete "+tn.Name));
del.Activated += new EventHandler(OnDelete);
deleteMenu.Append(del);
@@ -243,12 +243,12 @@ namespace LongoMatch.Gui.Component
}
private void ProcessButton1(EventButton evnt) {
- if (lastTime != evnt.Time) {
+ if(lastTime != evnt.Time) {
candidateTN = null;
- foreach (Play tn in list) {
+ foreach(Play tn in list) {
int pos = (int)(evnt.X*pixelRatio);
//Moving from the right side
- if (Math.Abs(pos-tn.StopFrame) < 3*pixelRatio) {
+ if(Math.Abs(pos-tn.StopFrame) < 3*pixelRatio) {
candidateStart = false;
candidateTN = tn;
movingLimit = true;
@@ -258,7 +258,7 @@ namespace LongoMatch.Gui.Component
break;
}
//Moving from the left side
- else if (Math.Abs(pos-tn.StartFrame) < 3*pixelRatio) {
+ else if(Math.Abs(pos-tn.StartFrame) < 3*pixelRatio) {
candidateStart =true;
candidateTN = tn;
movingLimit = true;
@@ -271,9 +271,9 @@ namespace LongoMatch.Gui.Component
}
//On Double Click
else {
- foreach (Play tn in list) {
+ foreach(Play tn in list) {
int pos = (int)(evnt.X*pixelRatio);
- if (TimeNodeSelected!= null && tn.HasFrame(pos)) {
+ if(TimeNodeSelected!= null && tn.HasFrame(pos)) {
TimeNodeSelected(tn);
break;
}
@@ -282,14 +282,14 @@ namespace LongoMatch.Gui.Component
}
protected void OnNewPlay(object obj, EventArgs args) {
- if (NewMarkAtFrameEvent != null)
+ if(NewMarkAtFrameEvent != null)
NewMarkAtFrameEvent(category,cursorFrame);
}
protected void OnDelete(object obj, EventArgs args) {
Play tNode;
dic.TryGetValue((MenuItem)obj, out tNode);
- if (TimeNodeDeleted != null && tNode != null) {
+ if(TimeNodeDeleted != null && tNode != null) {
var list = new List<Play>();
list.Add(tNode);
TimeNodeDeleted(list);
@@ -298,7 +298,7 @@ namespace LongoMatch.Gui.Component
protected override bool OnExposeEvent(EventExpose evnt)
{
- if (Visible) {
+ if(Visible) {
DrawTimeNodes(evnt.Window);
//We don't need the draw the Sections Names if we also draw the TimeNode name
//DrawSectionName();
@@ -312,26 +312,26 @@ namespace LongoMatch.Gui.Component
int pos = (int)(evnt.X*pixelRatio);
//If not moving don't do anything
- if (!movingLimit) {
+ if(!movingLimit) {
}
//Moving Start time
- else if (candidateStart) {
- if (candidateTN.HasDrawings && pos > 0 && pos > candidateTN.KeyFrame-10)
+ else if(candidateStart) {
+ if(candidateTN.HasDrawings && pos > 0 && pos > candidateTN.KeyFrame-10)
candidateTN.StartFrame = candidateTN.KeyFrame-10;
//Check not to go under start time nor 0
- else if (pos > 0 && pos < candidateTN.StopFrame-10)
+ else if(pos > 0 && pos < candidateTN.StopFrame-10)
candidateTN.StartFrame = (uint)pos;
- if (TimeNodeChanged != null)
+ if(TimeNodeChanged != null)
TimeNodeChanged(candidateTN,candidateTN.Start);
}
//Moving Stop time
- else if (!candidateStart) {
- if (candidateTN.HasDrawings && pos < candidateTN.KeyFrame+10)
+ else if(!candidateStart) {
+ if(candidateTN.HasDrawings && pos < candidateTN.KeyFrame+10)
candidateTN.StopFrame = candidateTN.KeyFrame+10;
//Check not to go under start time nor 0
- else if (pos < frames && pos > candidateTN.StartFrame+10)
+ else if(pos < frames && pos > candidateTN.StartFrame+10)
candidateTN.StopFrame = (uint) pos;
- if (TimeNodeChanged != null)
+ if(TimeNodeChanged != null)
TimeNodeChanged(candidateTN,candidateTN.Stop);
}
@@ -344,10 +344,10 @@ namespace LongoMatch.Gui.Component
protected override bool OnButtonPressEvent(EventButton evnt)
{
- if (evnt.Button == 1)
+ if(evnt.Button == 1)
ProcessButton1(evnt);
// On Right button pressed
- else if (evnt.Button == 3)
+ else if(evnt.Button == 3)
ProcessButton3(evnt.X);
lastTime = evnt.Time;
return base.OnButtonPressEvent(evnt);
@@ -355,7 +355,7 @@ namespace LongoMatch.Gui.Component
protected override bool OnButtonReleaseEvent(EventButton evnt)
{
- if (movingLimit) {
+ if(movingLimit) {
movingLimit = false;
candidateTN.Selected = false;
GdkWindow.Cursor = new Gdk.Cursor(CursorType.Arrow);
diff --git a/LongoMatch/Gui/Dialog/BusyDialog.cs b/LongoMatch/Gui/Dialog/BusyDialog.cs
index 9bca233..8edd2d4 100644
--- a/LongoMatch/Gui/Dialog/BusyDialog.cs
+++ b/LongoMatch/Gui/Dialog/BusyDialog.cs
@@ -1,43 +1,43 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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;
namespace LongoMatch.Gui.Dialog
{
-
-
+
+
public partial class BusyDialog : Gtk.Window
{
-
- public BusyDialog() :
- base(Gtk.WindowType.Toplevel)
+
+ public BusyDialog() :
+ base(Gtk.WindowType.Toplevel)
{
this.Build();
}
-
+
public string Message {
- set{
+ set {
messagelabel.Text = value;
}
}
-
- public void Pulse(){
+
+ public void Pulse() {
progressbar1.Pulse();
}
}
diff --git a/LongoMatch/Gui/Dialog/DrawingTool.cs b/LongoMatch/Gui/Dialog/DrawingTool.cs
index 022a3b8..14dae05 100644
--- a/LongoMatch/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch/Gui/Dialog/DrawingTool.cs
@@ -104,9 +104,9 @@ namespace LongoMatch.Gui.Dialog
fChooser.Filter = filter;
fChooser.DoOverwriteConfirmation = true;
- if (fChooser.Run() == (int)ResponseType.Accept) {
+ if(fChooser.Run() == (int)ResponseType.Accept) {
filename = fChooser.Filename;
- if (System.IO.Path.GetExtension(filename) != "png")
+ if(System.IO.Path.GetExtension(filename) != "png")
filename += ".png";
drawingwidget1.SaveAll(filename);
}
@@ -118,7 +118,7 @@ namespace LongoMatch.Gui.Dialog
string tempFile = System.IO.Path.GetTempFileName();
drawingwidget1.SaveDrawings(tempFile);
Pixbuf frame = new Pixbuf(tempFile);
- play.Drawings.Add(new Drawing{ Pixbuf=frame, RenderTime = stopTime});
+ play.Drawings.Add(new Drawing { Pixbuf=frame, RenderTime = stopTime});
drawingwidget1.SaveAll(tempFile);
frame.Dispose();
play.Miniature = new Pixbuf(tempFile);
diff --git a/LongoMatch/Gui/Dialog/EditCategoryDialog.cs b/LongoMatch/Gui/Dialog/EditCategoryDialog.cs
index 02801f3..892302a 100644
--- a/LongoMatch/Gui/Dialog/EditCategoryDialog.cs
+++ b/LongoMatch/Gui/Dialog/EditCategoryDialog.cs
@@ -52,13 +52,13 @@ namespace LongoMatch.Gui.Dialog
}
protected virtual void OnHotKeyChanged(HotKey prevHotKey, Category category) {
- if (hkList.Contains(category.HotKey)) {
+ if(hkList.Contains(category.HotKey)) {
MessagePopup.PopupMessage(this,MessageType.Warning,
Catalog.GetString("This hotkey is already in use."));
category.HotKey=prevHotKey;
timenodeproperties2.Category = category; //Update Gui
}
- else if (category.HotKey.Defined){
+ else if(category.HotKey.Defined) {
hkList.Remove(prevHotKey);
hkList.Add(category.HotKey);
}
diff --git a/LongoMatch/Gui/Dialog/EndCaptureDialog.cs b/LongoMatch/Gui/Dialog/EndCaptureDialog.cs
index ae1b84d..02d9f52 100644
--- a/LongoMatch/Gui/Dialog/EndCaptureDialog.cs
+++ b/LongoMatch/Gui/Dialog/EndCaptureDialog.cs
@@ -1,41 +1,41 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 LongoMatch.Common;
namespace LongoMatch.Gui.Dialog
{
-
-
+
+
public partial class EndCaptureDialog : Gtk.Dialog
{
-
+
public EndCaptureDialog()
{
this.Build();
}
- protected virtual void OnQuit (object sender, System.EventArgs e)
+ protected virtual void OnQuit(object sender, System.EventArgs e)
{
- if (sender == quitbutton)
+ if(sender == quitbutton)
Respond((int)EndCaptureResponse.Quit);
- else if (sender == savebutton)
+ else if(sender == savebutton)
Respond((int)EndCaptureResponse.Save);
else
Respond((int)EndCaptureResponse.Return);
diff --git a/LongoMatch/Gui/Dialog/EntryDialog.cs b/LongoMatch/Gui/Dialog/EntryDialog.cs
index 15b3f34..0595bba 100644
--- a/LongoMatch/Gui/Dialog/EntryDialog.cs
+++ b/LongoMatch/Gui/Dialog/EntryDialog.cs
@@ -31,7 +31,7 @@ namespace LongoMatch.Gui.Dialog
{
bool showCount;
-
+
public EntryDialog()
{
this.Build();
@@ -67,42 +67,42 @@ namespace LongoMatch.Gui.Dialog
return showCount;
}
}
-
+
public List<string> AvailableTemplates {
set {
- if (value.Count > 0){
- foreach (String text in value)
+ if(value.Count > 0) {
+ foreach(String text in value)
combobox.AppendText(text);
setAvailableTemplatesVisible(true);
combobox.Active = 0;
}
else
setAvailableTemplatesVisible(false);
- }
+ }
}
-
+
public string SelectedTemplate {
get {
- if (checkbutton.Active)
+ if(checkbutton.Active)
return combobox.ActiveText;
else return null;
}
}
-
- private void setAvailableTemplatesVisible(bool visible){
+
+ private void setAvailableTemplatesVisible(bool visible) {
combobox.Visible = visible;
existentemplatelabel.Visible = visible;
checkbutton.Visible = visible;
}
- protected virtual void OnCheckbuttonToggled (object sender, System.EventArgs e)
+ protected virtual void OnCheckbuttonToggled(object sender, System.EventArgs e)
{
bool active = checkbutton.Active;
- if (ShowCount){
+ if(ShowCount) {
playerslabel.Sensitive = !active;
- playersspinbutton.Sensitive = !active;
+ playersspinbutton.Sensitive = !active;
}
- combobox.Sensitive = active;
+ combobox.Sensitive = active;
}
}
}
diff --git a/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs b/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs
index 8c5bd29..6a630a2 100644
--- a/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs
+++ b/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs
@@ -44,16 +44,16 @@ namespace LongoMatch.Gui.Dialog
}
protected virtual void Update(int actual, int total,Pixbuf frame) {
- if (actual <= total) {
+ if(actual <= total) {
progressbar.Text= Catalog.GetString("Capturing frame: ")+actual+"/"+total;
progressbar.Fraction = (double)actual/(double)total;
- if (frame != null) {
- if (image.Pixbuf != null)
+ if(frame != null) {
+ if(image.Pixbuf != null)
image.Pixbuf.Dispose();
image.Pixbuf = frame;
}
}
- if (actual == total) {
+ if(actual == total) {
progressbar.Text= Catalog.GetString("Done");
cancelbutton.Visible = false;
okbutton.Visible = true;
diff --git a/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs b/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs
index f3e2ff2..dc66d95 100644
--- a/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs
+++ b/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs
@@ -54,12 +54,12 @@ namespace LongoMatch.Gui.Dialog
{
Gdk.Key key = evnt.Key;
ModifierType modifier = evnt.State;
-
+
// Only react to {Shift|Alt|Ctrl}+key
// Ctrl is a modifier to select single keys
// Combination are allowed with Alt and Shift (Ctrl is not allowed to avoid
// conflicts with menus shortcuts)
- if ((modifier & (ModifierType.Mod1Mask | ModifierType.ShiftMask | ModifierType.ControlMask)) != 0
+ if((modifier & (ModifierType.Mod1Mask | ModifierType.ShiftMask | ModifierType.ControlMask)) != 0
&& key != Gdk.Key.Shift_L
&& key != Gdk.Key.Shift_R
&& key != Gdk.Key.Alt_L
diff --git a/LongoMatch/Gui/Dialog/Migrator.cs b/LongoMatch/Gui/Dialog/Migrator.cs
index fff263d..92f5457 100644
--- a/LongoMatch/Gui/Dialog/Migrator.cs
+++ b/LongoMatch/Gui/Dialog/Migrator.cs
@@ -44,7 +44,7 @@ namespace LongoMatch.Gui.Dialog
private void CheckDataBase(string oldHomeFolder) {
string oldDBFile = System.IO.Path.Combine(oldHomeFolder,"db/db.yap");
- if (File.Exists(oldDBFile)) {
+ if(File.Exists(oldDBFile)) {
dbMigrator = new DatabaseMigrator(oldDBFile);
dbMigrator.ConversionProgressEvent += new ConversionProgressHandler(OnDBProgress);
dbMigrator.Start();
@@ -59,7 +59,7 @@ namespace LongoMatch.Gui.Dialog
string[] playlistFiles;
playlistFiles = Directory.GetFiles(System.IO.Path.Combine(oldHomeFolder,"playlists"),"*.lgm");
- if (playlistFiles.Length != 0) {
+ if(playlistFiles.Length != 0) {
plMigrator = new PlayListMigrator(playlistFiles);
plMigrator.ConversionProgressEvent += new ConversionProgressHandler(OnPLProgress);
plMigrator.Start();
@@ -74,7 +74,7 @@ namespace LongoMatch.Gui.Dialog
string[] templatesFiles;
templatesFiles = Directory.GetFiles(System.IO.Path.Combine(oldHomeFolder,"templates"),"*.sct");
- if (templatesFiles.Length != 0) {
+ if(templatesFiles.Length != 0) {
tpMigrator = new TemplatesMigrator(templatesFiles);
tpMigrator.ConversionProgressEvent += new ConversionProgressHandler(OnTPProgress);
tpMigrator.Start();
@@ -88,9 +88,9 @@ namespace LongoMatch.Gui.Dialog
protected void OnDBProgress(string progress) {
dbtextview.Buffer.Text+=progress+"\n";
- if (progress == DatabaseMigrator.DONE) {
+ if(progress == DatabaseMigrator.DONE) {
dbFinished = true;
- if (dbFinished && plFinished && tpFinished) {
+ if(dbFinished && plFinished && tpFinished) {
buttonCancel.Visible=false;
buttonOk.Visible=true;
}
@@ -99,9 +99,9 @@ namespace LongoMatch.Gui.Dialog
protected void OnPLProgress(string progress) {
pltextview.Buffer.Text+=progress+"\n";
- if (progress == PlayListMigrator.DONE) {
+ if(progress == PlayListMigrator.DONE) {
plFinished = true;
- if (dbFinished && plFinished && tpFinished) {
+ if(dbFinished && plFinished && tpFinished) {
buttonCancel.Visible=false;
buttonOk.Visible=true;
}
@@ -111,9 +111,9 @@ namespace LongoMatch.Gui.Dialog
protected void OnTPProgress(string progress) {
tptextview.Buffer.Text+=progress+"\n";
- if (progress == TemplatesMigrator.DONE) {
+ if(progress == TemplatesMigrator.DONE) {
tpFinished = true;
- if (dbFinished && plFinished && tpFinished) {
+ if(dbFinished && plFinished && tpFinished) {
buttonCancel.Visible=false;
buttonOk.Visible=true;
}
@@ -122,11 +122,11 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnButtonCancelClicked(object sender, System.EventArgs e)
{
- if (dbMigrator != null)
+ if(dbMigrator != null)
dbMigrator.Cancel();
- if (plMigrator != null)
+ if(plMigrator != null)
plMigrator.Cancel();
- if (tpMigrator != null)
+ if(tpMigrator != null)
tpMigrator.Cancel();
}
}
diff --git a/LongoMatch/Gui/Dialog/NewProjectDialog.cs b/LongoMatch/Gui/Dialog/NewProjectDialog.cs
index 1514d6a..82333bb 100644
--- a/LongoMatch/Gui/Dialog/NewProjectDialog.cs
+++ b/LongoMatch/Gui/Dialog/NewProjectDialog.cs
@@ -43,24 +43,24 @@ namespace LongoMatch.Gui.Dialog
fdwidget.Use = value;
}
}
-
- public Project Project{
+
+ public Project Project {
get {
return fdwidget.GetProject();
}
- set{
+ set {
fdwidget.SetProject(value);
}
}
-
+
public List<Device> Devices {
- set{
+ set {
fdwidget.FillDevices(value);
}
}
-
- public CapturePropertiesStruct CaptureProperties{
- get{
+
+ public CapturePropertiesStruct CaptureProperties {
+ get {
return fdwidget.CaptureProperties;
}
}
diff --git a/LongoMatch/Gui/Dialog/OpenProjectDialog.cs b/LongoMatch/Gui/Dialog/OpenProjectDialog.cs
index eadd516..08d4702 100644
--- a/LongoMatch/Gui/Dialog/OpenProjectDialog.cs
+++ b/LongoMatch/Gui/Dialog/OpenProjectDialog.cs
@@ -36,7 +36,7 @@ namespace LongoMatch.Gui.Dialog
this.Fill();
projectlistwidget.SelectionMode = SelectionMode.Single;
}
-
+
public ProjectDescription SelectedProject {
get;
set;
@@ -45,11 +45,11 @@ namespace LongoMatch.Gui.Dialog
public void Fill() {
projectlistwidget.Fill(MainClass.DB.GetAllProjects());
}
-
- protected virtual void OnProjectlistwidgetProjectsSelected (List<ProjectDescription> projects)
+
+ protected virtual void OnProjectlistwidgetProjectsSelected(List<ProjectDescription> projects)
{
- buttonOk.Sensitive = (projects.Count == 1);
- SelectedProject = projects[0];
+ buttonOk.Sensitive = (projects.Count == 1);
+ SelectedProject = projects[0];
}
}
}
\ No newline at end of file
diff --git a/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs b/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
index 1f587eb..805842d 100644
--- a/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
+++ b/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
@@ -41,16 +41,16 @@ namespace LongoMatch.Gui.Dialog
List<Player> playersList;
int i=0;
- if (this.template != null)
+ if(this.template != null)
return;
this.template = template;
playersList = template.PlayingPlayersList;
-
+
table1.NColumns =(uint)(playersList.Count/10);
table1.NRows =(uint) 10;
- foreach (Player player in playersList) {
+ foreach(Player player in playersList) {
button = new CheckButton();
button.Label = player.Number + "-" + player.Name;
button.Name = i.ToString();
@@ -69,13 +69,13 @@ namespace LongoMatch.Gui.Dialog
public List<Player> PlayersChecked {
set {
- foreach (var pair in checkButtonsDict)
+ foreach(var pair in checkButtonsDict)
pair.Key.Active = value.Contains(pair.Value);
}
get {
List<Player> playersList = new List<Player>();
- foreach (var pair in checkButtonsDict){
- if (pair.Key.Active)
+ foreach(var pair in checkButtonsDict) {
+ if(pair.Key.Active)
playersList.Add(pair.Value);
}
return playersList;
diff --git a/LongoMatch/Gui/Dialog/ProjectSelectionDialog.cs b/LongoMatch/Gui/Dialog/ProjectSelectionDialog.cs
index 9705910..e62a596 100644
--- a/LongoMatch/Gui/Dialog/ProjectSelectionDialog.cs
+++ b/LongoMatch/Gui/Dialog/ProjectSelectionDialog.cs
@@ -1,45 +1,45 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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 LongoMatch.Common;
namespace LongoMatch.Gui.Dialog
{
-
-
+
+
public partial class ProjectSelectionDialog : Gtk.Dialog
{
-
+
public ProjectSelectionDialog()
{
this.Build();
}
-
- public ProjectType ProjectType{
- get{
- if (fromfileradiobutton.Active)
+
+ public ProjectType ProjectType {
+ get {
+ if(fromfileradiobutton.Active)
return ProjectType.FileProject;
- else if (liveradiobutton.Active)
- return ProjectType.CaptureProject;
+ else if(liveradiobutton.Active)
+ return ProjectType.CaptureProject;
else
return ProjectType.FakeCaptureProject;
-
+
}
}
}
diff --git a/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs b/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs
index 0bb3d32..7445443 100644
--- a/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs
+++ b/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs
@@ -49,9 +49,9 @@ namespace LongoMatch.Gui.Dialog
return projecttemplatewidget.Categories;
}
}
-
- public bool CanExport{
- set{
+
+ public bool CanExport {
+ set {
projecttemplatewidget.CanExport = value;
}
}
diff --git a/LongoMatch/Gui/Dialog/ProjectsManager.cs b/LongoMatch/Gui/Dialog/ProjectsManager.cs
index cccda84..3bbf7c8 100644
--- a/LongoMatch/Gui/Dialog/ProjectsManager.cs
+++ b/LongoMatch/Gui/Dialog/ProjectsManager.cs
@@ -54,20 +54,20 @@ namespace LongoMatch.Gui.Dialog
Clear();
originalFilePath=null;
}
-
- private void Clear(){
+
+ private void Clear() {
projectdetails.Clear();
projectdetails.Sensitive = false;
saveButton.Sensitive = false;
deleteButton.Sensitive = false;
- exportbutton.Sensitive = false;
+ exportbutton.Sensitive = false;
}
-
- private void PromptToSaveEditedProject(){
+
+ private void PromptToSaveEditedProject() {
MessageDialog md = new MessageDialog((Window)this.Toplevel,DialogFlags.Modal,
MessageType.Question, ButtonsType.YesNo,
Catalog.GetString("The Project has been edited, do you want to save the changes?"));
- if (md.Run() == (int)ResponseType.Yes) {
+ if(md.Run() == (int)ResponseType.Yes) {
SaveProject();
projectdetails.Edited=false;
}
@@ -77,10 +77,10 @@ namespace LongoMatch.Gui.Dialog
private void SaveProject() {
Project project = projectdetails.GetProject();
- if (project == null)
+ if(project == null)
return;
- if (project.Description.File.FilePath == originalFilePath) {
+ if(project.Description.File.FilePath == originalFilePath) {
MainClass.DB.UpdateProject(project);
saveButton.Sensitive = false;
}
@@ -100,14 +100,14 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnDeleteButtonPressed(object sender, System.EventArgs e)
{
- List<ProjectDescription> deletedProjects = new List<ProjectDescription>();
-
- if (selectedProjects == null)
- return;
-
- foreach (ProjectDescription selectedProject in selectedProjects) {
- if (openedProject != null &&
- selectedProject.File.FilePath == openedProject.Description.File.FilePath) {
+ List<ProjectDescription> deletedProjects = new List<ProjectDescription>();
+
+ if(selectedProjects == null)
+ return;
+
+ foreach(ProjectDescription selectedProject in selectedProjects) {
+ if(openedProject != null &&
+ selectedProject.File.FilePath == openedProject.Description.File.FilePath) {
MessagePopup.PopupMessage(this, MessageType.Warning,
Catalog.GetString("This Project is actually in use.")+"\n"+
Catalog.GetString("Close it first to allow its removal from the database"));
@@ -118,13 +118,13 @@ namespace LongoMatch.Gui.Dialog
ButtonsType.YesNo,
Catalog.GetString("Do you really want to delete:")+
"\n"+selectedProject.Title);
- if (md.Run()== (int)ResponseType.Yes) {
+ if(md.Run()== (int)ResponseType.Yes) {
MainClass.DB.RemoveProject(selectedProject.File.FilePath);
- deletedProjects.Add (selectedProject);
- }
+ deletedProjects.Add(selectedProject);
+ }
md.Destroy();
}
- projectlistwidget1.RemoveProjects (deletedProjects);
+ projectlistwidget1.RemoveProjects(deletedProjects);
Clear();
}
@@ -138,7 +138,7 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
{
- if (projectdetails.Edited) {
+ if(projectdetails.Edited) {
PromptToSaveEditedProject();
}
this.Destroy();
@@ -147,32 +147,32 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnProjectlistwidget1ProjectsSelected(List<ProjectDescription> projects)
{
ProjectDescription project;
-
+
/* prompt tp save the opened project if has changes */
- if (projectdetails.Edited) {
+ if(projectdetails.Edited) {
PromptToSaveEditedProject();
}
-
+
selectedProjects = projects;
-
+
/* if no projects are selected clear everything */
- if (projects.Count == 0){
+ if(projects.Count == 0) {
Clear();
return;
- /* if more than one project is selected clear everything but keep
- * the delete button and the export button sensitives */
- } else if (projects.Count > 1){
+ /* if more than one project is selected clear everything but keep
+ * the delete button and the export button sensitives */
+ } else if(projects.Count > 1) {
Clear();
deleteButton.Sensitive = true;
exportbutton.Sensitive = true;
return;
- }
-
+ }
+
/* if only one project is selected try to load it in the editor */
project = projects[0];
-
- if (openedProject != null &&
- project.File.FilePath == openedProject.Description.File.FilePath) {
+
+ if(openedProject != null &&
+ project.File.FilePath == openedProject.Description.File.FilePath) {
MessagePopup.PopupMessage(this, MessageType.Warning,
Catalog.GetString("The Project you are trying to load is actually in use.")+"\n" +Catalog.GetString("Close it first to edit it"));
Clear();
@@ -191,8 +191,8 @@ namespace LongoMatch.Gui.Dialog
{
saveButton.Sensitive = true;
}
-
- protected virtual void OnExportbuttonClicked (object sender, System.EventArgs e)
+
+ protected virtual void OnExportbuttonClicked(object sender, System.EventArgs e)
{
FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Project"),
(Gtk.Window)Toplevel,
@@ -205,7 +205,7 @@ namespace LongoMatch.Gui.Dialog
filter.AddPattern("*.lpr");
fChooser.AddFilter(filter);
- if (fChooser.Run() == (int)ResponseType.Accept) {
+ if(fChooser.Run() == (int)ResponseType.Accept) {
Project.Export(projectdetails.GetProject(), fChooser.Filename);
}
fChooser.Destroy();
diff --git a/LongoMatch/Gui/Dialog/TaggerDialog.cs b/LongoMatch/Gui/Dialog/TaggerDialog.cs
index 70de8f3..85824e0 100644
--- a/LongoMatch/Gui/Dialog/TaggerDialog.cs
+++ b/LongoMatch/Gui/Dialog/TaggerDialog.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2009 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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.Collections.Generic;
@@ -23,16 +23,16 @@ using LongoMatch.Store.Templates;
namespace LongoMatch.Gui.Dialog
{
-
-
+
+
public partial class TaggerDialog : Gtk.Dialog
{
-
+
public TaggerDialog()
{
this.Build();
buttonOk.Visible = false;
}
-
+
}
}
diff --git a/LongoMatch/Gui/Dialog/TemplatesEditor.cs b/LongoMatch/Gui/Dialog/TemplatesEditor.cs
index fc7c76a..1aed71c 100644
--- a/LongoMatch/Gui/Dialog/TemplatesEditor.cs
+++ b/LongoMatch/Gui/Dialog/TemplatesEditor.cs
@@ -62,7 +62,7 @@ namespace LongoMatch.Gui.Dialog
public UseType Use {
set {
useType = value;
- if (useType == UseType.TeamTemplate) {
+ if(useType == UseType.TeamTemplate) {
fileExtension = ".tem";
teamtemplatewidget1.Visible = true;
@@ -81,7 +81,7 @@ namespace LongoMatch.Gui.Dialog
dataFileListStore = new Gtk.ListStore(typeof(string));
- foreach (string filePath in allFiles) {
+ foreach(string filePath in allFiles) {
dataFileListStore.AppendValues(filePath);
}
treeview.Model = dataFileListStore;
@@ -94,13 +94,13 @@ namespace LongoMatch.Gui.Dialog
}
public void SetCategoriesTemplate(Categories sections) {
- if (useType != UseType.CategoriesTemplate)
+ if(useType != UseType.CategoriesTemplate)
return;
sectionspropertieswidget1.Categories=sections;
}
public void SetTeamTemplate(TeamTemplate template) {
- if (useType != UseType.TeamTemplate)
+ if(useType != UseType.TeamTemplate)
return;
teamtemplatewidget1.TeamTemplate=template;
}
@@ -118,7 +118,7 @@ namespace LongoMatch.Gui.Dialog
}
private void SetSensitive(bool sensitive) {
- if (useType == UseType.CategoriesTemplate)
+ if(useType == UseType.CategoriesTemplate)
sectionspropertieswidget1.Sensitive = true;
else
teamtemplatewidget1.Sensitive = true;
@@ -132,9 +132,9 @@ namespace LongoMatch.Gui.Dialog
ListStore model = (ListStore)treeview.Model;
model.GetIterFirst(out iter);
- while (model.IterIsValid(iter)) {
+ while(model.IterIsValid(iter)) {
tName = System.IO.Path.GetFileNameWithoutExtension((string) model.GetValue(iter,0));
- if (tName == templateName) {
+ if(tName == templateName) {
//Do not delete 'this' as we want to change the class attribute
this.templateName = templateName = (string) this.dataFileListStore.GetValue(iter, 0);
treeview.SetCursor(model.GetPath(iter),null,false);
@@ -145,7 +145,7 @@ namespace LongoMatch.Gui.Dialog
}
private void SaveTemplate() {
- if (useType == UseType.CategoriesTemplate) {
+ if(useType == UseType.CategoriesTemplate) {
selectedCategoriesTemplate = sectionspropertieswidget1.Categories;
selectedCategoriesTemplate.Save(templateName);
}
@@ -158,7 +158,7 @@ namespace LongoMatch.Gui.Dialog
private void PromptForSave() {
MessageDialog mes = new MessageDialog(this,DialogFlags.Modal,MessageType.Question,ButtonsType.YesNo,
Catalog.GetString("The template has been modified. Do you want to save it? "));
- if (mes.Run() == (int)ResponseType.Yes) {
+ if(mes.Run() == (int)ResponseType.Yes) {
SaveTemplate();
}
mes.Destroy();
@@ -180,40 +180,40 @@ namespace LongoMatch.Gui.Dialog
EntryDialog ed= new EntryDialog();
ed.Title = Catalog.GetString("Template name");
-
- if (useType == UseType.TeamTemplate){
- ed.ShowCount=true;
+
+ if(useType == UseType.TeamTemplate) {
+ ed.ShowCount=true;
}
-
+
templates = System.IO.Directory.GetFiles(MainClass.TemplatesDir());
- foreach (String text in templates){
+ foreach(String text in templates) {
string templateName = System.IO.Path.GetFileName(text);
- if (templateName.EndsWith(fileExtension) && templateName != "default"+fileExtension)
- availableTemplates.Add(templateName);
+ if(templateName.EndsWith(fileExtension) && templateName != "default"+fileExtension)
+ availableTemplates.Add(templateName);
}
- ed.AvailableTemplates = availableTemplates;
+ ed.AvailableTemplates = availableTemplates;
- if (ed.Run() == (int)ResponseType.Ok) {
+ if(ed.Run() == (int)ResponseType.Ok) {
name = ed.Text;
count = ed.Count;
- if (name == "") {
+ if(name == "") {
MessagePopup.PopupMessage(ed, MessageType.Warning,
Catalog.GetString("You cannot create a template with a void name"));
ed.Destroy();
return;
}
- if (System.IO.File.Exists(System.IO.Path.Combine(MainClass.TemplatesDir(),name+fileExtension))) {
+ if(System.IO.File.Exists(System.IO.Path.Combine(MainClass.TemplatesDir(),name+fileExtension))) {
MessagePopup.PopupMessage(ed, MessageType.Warning,
Catalog.GetString("A template with this name already exists"));
ed.Destroy();
return;
- }
-
- if (ed.SelectedTemplate != null)
- System.IO.File.Copy(System.IO.Path.Combine(MainClass.TemplatesDir(),ed.SelectedTemplate),
- System.IO.Path.Combine(MainClass.TemplatesDir(),name+fileExtension));
- else if (useType == UseType.CategoriesTemplate){
+ }
+
+ if(ed.SelectedTemplate != null)
+ System.IO.File.Copy(System.IO.Path.Combine(MainClass.TemplatesDir(),ed.SelectedTemplate),
+ System.IO.Path.Combine(MainClass.TemplatesDir(),name+fileExtension));
+ else if(useType == UseType.CategoriesTemplate) {
Categories cat = Categories.DefaultTemplate();
cat.Save(name+fileExtension);
}
@@ -230,7 +230,7 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnDeletebuttonClicked(object sender, System.EventArgs e)
{
- if (System.IO.Path.GetFileNameWithoutExtension(templateName) =="default") {
+ if(System.IO.Path.GetFileNameWithoutExtension(templateName) =="default") {
MessagePopup.PopupMessage(this,MessageType.Warning,Catalog.GetString("You can't delete the 'default' template"));
return;
}
@@ -238,7 +238,7 @@ namespace LongoMatch.Gui.Dialog
MessageDialog mes = new MessageDialog(this,DialogFlags.Modal,MessageType.Warning,ButtonsType.YesNo,
Catalog.GetString("Do you really want to delete the template: ")+
System.IO.Path.GetFileNameWithoutExtension(templateName));
- if (mes.Run() == (int)ResponseType.Yes) {
+ if(mes.Run() == (int)ResponseType.Yes) {
System.IO.File.Delete(templateName);
this.Fill();
//The default template is always there so we select this one.
@@ -258,13 +258,13 @@ namespace LongoMatch.Gui.Dialog
{
TreeIter iter;
- if (sectionspropertieswidget1.Edited || teamtemplatewidget1.Edited)
+ if(sectionspropertieswidget1.Edited || teamtemplatewidget1.Edited)
PromptForSave();
treeview.Selection.GetSelected(out iter);
templateName = (string) this.dataFileListStore.GetValue(iter, 0);
- if (useType == UseType.CategoriesTemplate)
+ if(useType == UseType.CategoriesTemplate)
UpdateCategories();
else
@@ -273,14 +273,14 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
{
- if (sectionspropertieswidget1.Edited)
+ if(sectionspropertieswidget1.Edited)
PromptForSave();
this.Destroy();
}
protected virtual void OnTreeviewRowActivated(object o, Gtk.RowActivatedArgs args)
{
- if (useType == UseType.CategoriesTemplate)
+ if(useType == UseType.CategoriesTemplate)
UpdateCategories();
else
UpdateTeamTemplate();
diff --git a/LongoMatch/Gui/Dialog/VideoEditionProperties.cs b/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
index 5b5cae9..bfd2bc2 100644
--- a/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
+++ b/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
@@ -45,7 +45,7 @@ namespace LongoMatch.Gui.Dialog
this.Build();
formatcombobox.AppendText(Constants.MP4);
formatcombobox.AppendText(Constants.AVI);
- if (System.Environment.OSVersion.Platform != PlatformID.Win32NT) {
+ if(System.Environment.OSVersion.Platform != PlatformID.Win32NT) {
formatcombobox.AppendText(Constants.WEBM);
formatcombobox.AppendText(Constants.OGG);
formatcombobox.AppendText(Constants.DVD);
@@ -108,13 +108,13 @@ namespace LongoMatch.Gui.Dialog
#region Private Methods
private string GetExtension() {
- if (formatcombobox.ActiveText == Constants.MP4)
+ if(formatcombobox.ActiveText == Constants.MP4)
return "mp4";
- else if (formatcombobox.ActiveText == Constants.OGG)
+ else if(formatcombobox.ActiveText == Constants.OGG)
return "ogg";
- else if (formatcombobox.ActiveText == Constants.WEBM)
+ else if(formatcombobox.ActiveText == Constants.WEBM)
return "webm";
- else if (formatcombobox.ActiveText == Constants.AVI)
+ else if(formatcombobox.ActiveText == Constants.AVI)
return "avi";
else
return "mpg";
@@ -124,42 +124,42 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
{
- if (qualitycombobox.ActiveText == Catalog.GetString("Low")) {
+ if(qualitycombobox.ActiveText == Catalog.GetString("Low")) {
vq = VideoQuality.Low;
}
- else if (qualitycombobox.ActiveText == Catalog.GetString("Normal")) {
+ else if(qualitycombobox.ActiveText == Catalog.GetString("Normal")) {
vq = VideoQuality.Normal;
}
- else if (qualitycombobox.ActiveText == Catalog.GetString("Good")) {
+ else if(qualitycombobox.ActiveText == Catalog.GetString("Good")) {
vq = VideoQuality.Good;
}
- else if (qualitycombobox.ActiveText == Catalog.GetString("Extra")) {
+ else if(qualitycombobox.ActiveText == Catalog.GetString("Extra")) {
vq = VideoQuality.Extra;
}
vf = (VideoFormat)sizecombobox.Active;
- if (formatcombobox.ActiveText == Constants.MP4) {
+ if(formatcombobox.ActiveText == Constants.MP4) {
vcodec = VideoEncoderType.H264;
acodec = AudioEncoderType.Aac;
muxer = VideoMuxerType.Mp4;
}
- else if (formatcombobox.ActiveText == Constants.OGG) {
+ else if(formatcombobox.ActiveText == Constants.OGG) {
vcodec = VideoEncoderType.Theora;
acodec = AudioEncoderType.Vorbis;
muxer = VideoMuxerType.Ogg;
}
- else if (formatcombobox.ActiveText == Constants.WEBM) {
+ else if(formatcombobox.ActiveText == Constants.WEBM) {
vcodec = VideoEncoderType.VP8;
acodec = AudioEncoderType.Vorbis;
muxer = VideoMuxerType.WebM;
}
- else if (formatcombobox.ActiveText == Constants.AVI) {
+ else if(formatcombobox.ActiveText == Constants.AVI) {
vcodec = VideoEncoderType.Xvid;
acodec = AudioEncoderType.Mp3;
muxer = VideoMuxerType.Avi;
}
- else if (formatcombobox.ActiveText == Constants.DVD) {
+ else if(formatcombobox.ActiveText == Constants.DVD) {
vcodec = VideoEncoderType.Mpeg2;
acodec = AudioEncoderType.Mp3;
muxer = VideoMuxerType.MpegPS;
@@ -186,16 +186,16 @@ namespace LongoMatch.Gui.Dialog
filter.AddPattern("*.mpg");
filter.AddPattern("*.vob");
fChooser.Filter = filter;
- if (fChooser.Run() == (int)ResponseType.Accept) {
+ if(fChooser.Run() == (int)ResponseType.Accept) {
fileentry.Text = fChooser.Filename;
}
fChooser.Destroy();
}
- protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e)
+ protected virtual void OnButtonCancelClicked(object sender, System.EventArgs e)
{
this.Destroy();
}
-
-
+
+
}
}
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index 9b79117..19ee31e 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -49,8 +49,8 @@ namespace LongoMatch.Gui
private EventsManager eManager;
private HotKeysManager hkManager;
private KeyPressEventHandler hotkeysListener;
-
-
+
+
#region Constructors
public MainWindow() :
base("LongoMatch")
@@ -61,7 +61,7 @@ namespace LongoMatch.Gui
A
updater.NewVersion += new LongoMatch.Handlers.NewVersionHandler(OnUpdate);
updater.Run();*/
-
+
projectType = ProjectType.None;
eManager = new EventsManager(treewidget1,
@@ -88,12 +88,13 @@ namespace LongoMatch.Gui
playerbin1.SetLogo(System.IO.Path.Combine(MainClass.ImagesDir(),"background.png"));
playerbin1.LogoMode = true;
-
+
capturerBin.Visible = false;
capturerBin.Logo = System.IO.Path.Combine(MainClass.ImagesDir(),"background.png");
capturerBin.CaptureFinished += delegate {
- CloseCaptureProject();};
-
+ CloseCaptureProject();
+ };
+
buttonswidget1.Mode = TagMode.Predifined;
playlistwidget2.SetPlayer(playerbin1);
@@ -103,113 +104,113 @@ namespace LongoMatch.Gui
}
#endregion
-
+
#region Private Methods
- private void SetProject (Project project, ProjectType projectType, CapturePropertiesStruct props)
+ private void SetProject(Project project, ProjectType projectType, CapturePropertiesStruct props)
{
bool isLive = false;
-
- if (project == null)
+
+ if(project == null)
return;
-
- if (openedProject != null)
- CloseOpenedProject (true);
-
+
+ if(openedProject != null)
+ CloseOpenedProject(true);
+
openedProject = project;
this.projectType = projectType;
eManager.OpenedProject = project;
eManager.OpenedProjectType = projectType;
-
+
/* Update tabs labels */
/* FIXME 1.0: Teams should have default names */
var desc = project.Description;
- if (desc.VisitorName == "")
+ if(desc.VisitorName == "")
visitorteamlabel.Text = Catalog.GetString("Visitor Team");
else
visitorteamlabel.Text = desc.VisitorName;
- if (desc.LocalName == "")
+ if(desc.LocalName == "")
localteamlabel.Text = Catalog.GetString("Local Team");
else
localteamlabel.Text = desc.LocalName;
-
- if (projectType == ProjectType.FileProject) {
+
+ if(projectType == ProjectType.FileProject) {
// Check if the file associated to the project exists
- if (!File.Exists (desc.File.FilePath)) {
- MessagePopup.PopupMessage (this, MessageType.Warning,
- Catalog.GetString ("The file associated to this project doesn't exist.") + "\n"
- + Catalog.GetString ("If the location of the file has changed try to edit it with the database manager."));
- CloseOpenedProject (true);
+ if(!File.Exists(desc.File.FilePath)) {
+ MessagePopup.PopupMessage(this, MessageType.Warning,
+ Catalog.GetString("The file associated to this project doesn't exist.") + "\n"
+ + Catalog.GetString("If the location of the file has changed try to edit it with the database manager."));
+ CloseOpenedProject(true);
return;
}
- Title = System.IO.Path.GetFileNameWithoutExtension (desc.File.FilePath) +
- " - " + Constants.SOFTWARE_NAME;
+ Title = System.IO.Path.GetFileNameWithoutExtension(desc.File.FilePath) +
+ " - " + Constants.SOFTWARE_NAME;
try {
- playerbin1.Open (desc.File.FilePath);
+ playerbin1.Open(desc.File.FilePath);
}
- catch (GLib.GException ex) {
- MessagePopup.PopupMessage (this, MessageType.Error,
- Catalog.GetString ("An error occurred opening this project:") + "\n" + ex.Message);
- CloseOpenedProject (true);
- return;
+ catch(GLib.GException ex) {
+ MessagePopup.PopupMessage(this, MessageType.Error,
+ Catalog.GetString("An error occurred opening this project:") + "\n" + ex.Message);
+ CloseOpenedProject(true);
+ return;
}
playerbin1.LogoMode = false;
timelinewidget1.Project = project;
-
+
} else {
Title = Constants.SOFTWARE_NAME;
isLive = true;
- if (projectType == ProjectType.CaptureProject) {
+ if(projectType == ProjectType.CaptureProject) {
capturerBin.CaptureProperties = props;
try {
capturerBin.Type = CapturerType.Live;
- } catch (Exception ex) {
- MessagePopup.PopupMessage (this, MessageType.Error, ex.Message);
- CloseOpenedProject (false);
+ } catch(Exception ex) {
+ MessagePopup.PopupMessage(this, MessageType.Error, ex.Message);
+ CloseOpenedProject(false);
return;
}
} else
capturerBin.Type = CapturerType.Fake;
playerbin1.Visible = false;
capturerBin.Visible = true;
- capturerBin.Run ();
+ capturerBin.Run();
CaptureModeAction.Active = true;
}
-
+
treewidget1.ProjectIsLive = isLive;
localplayerslisttreewidget.ProjectIsLive = isLive;
visitorplayerslisttreewidget.ProjectIsLive = isLive;
tagstreewidget1.ProjectIsLive = isLive;
playlistwidget2.Stop();
treewidget1.Project=project;
- tagstreewidget1.Project = project;
+ tagstreewidget1.Project = project;
buttonswidget1.Categories = project.Categories;
hkManager.Categories=project.Categories;
KeyPressEvent += hotkeysListener;
MakeActionsSensitive(true,projectType);
ShowWidgets();
- }
-
- private void SaveCaptureProject(){
+ }
+
+ private void SaveCaptureProject() {
PreviewMediaFile file;
Project newProject = openedProject;
string filePath = openedProject.Description.File.FilePath;
-
+
MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
Catalog.GetString("Loading newly created project..."));
md.Show();
/* scan the new file to build a new PreviewMediaFile with all the metadata */
- try{
- file = PreviewMediaFile.GetMediaFile(filePath);
+ try {
+ file = PreviewMediaFile.GetMediaFile(filePath);
openedProject.Description.File = file;
MainClass.DB.AddProject(openedProject);
- } catch (Exception ex){
+ } catch(Exception ex) {
string projectFile = filePath + "-" + DateTime.Now;
Project.Export(openedProject, projectFile);
MessagePopup.PopupMessage(this, MessageType.Error,
Catalog.GetString("An error occured saving the project:\n")+ex.Message+ "\n\n"+
Catalog.GetString("The video file and a backup of the project has been "+
- "saved. Try to import it later:\n")+
+ "saved. Try to import it later:\n")+
filePath+"\n"+projectFile);
}
/* we need to set the opened project to null to avoid calling again CloseOpendProject() */
@@ -217,49 +218,49 @@ namespace LongoMatch.Gui
SetProject(newProject, ProjectType.FileProject, new CapturePropertiesStruct());
md.Destroy();
}
-
- private void CloseCaptureProject (){
- if (projectType == ProjectType.CaptureProject){
+
+ private void CloseCaptureProject() {
+ if(projectType == ProjectType.CaptureProject) {
capturerBin.Close();
playerbin1.Visible = true;
capturerBin.Visible = false;;
SaveCaptureProject();
- } else if (projectType == ProjectType.FakeCaptureProject){
+ } else if(projectType == ProjectType.FakeCaptureProject) {
CloseOpenedProject(true);
}
}
private void CloseOpenedProject(bool save) {
- if (save)
+ if(save)
SaveProject();
-
- if (projectType != ProjectType.FileProject)
+
+ if(projectType != ProjectType.FileProject)
capturerBin.Close();
- else
+ else
playerbin1.Close();
-
- if (openedProject != null)
+
+ if(openedProject != null)
openedProject.Clear();
openedProject = null;
projectType = ProjectType.None;
eManager.OpenedProject = null;
- eManager.OpenedProjectType = ProjectType.None;
+ eManager.OpenedProjectType = ProjectType.None;
ResetGUI();
}
-
- private void ResetGUI(){
- bool playlistVisible = playlistwidget2.Visible;
+
+ private void ResetGUI() {
+ bool playlistVisible = playlistwidget2.Visible;
Title = Constants.SOFTWARE_NAME;
playerbin1.Visible = true;
playerbin1.LogoMode = true;
capturerBin.Visible = false;
ClearWidgets();
- HideWidgets();
-
+ HideWidgets();
+
playlistwidget2.Visible = playlistVisible;
rightvbox.Visible = playlistVisible;
- noteswidget1.Visible = false;
+ noteswidget1.Visible = false;
selectedTimeNode = null;
MakeActionsSensitive(false, projectType);
hkManager.Categories = null;
@@ -279,7 +280,7 @@ namespace LongoMatch.Gui
private void ShowWidgets() {
leftbox.Show();
- if (CaptureModeAction.Active || FreeCaptureModeAction.Active)
+ if(CaptureModeAction.Active || FreeCaptureModeAction.Active)
buttonswidget1.Show();
else
timelinewidget1.Show();
@@ -302,63 +303,63 @@ namespace LongoMatch.Gui
}
private void SaveProject() {
- if (openedProject != null && projectType == ProjectType.FileProject) {
+ if(openedProject != null && projectType == ProjectType.FileProject) {
try {
MainClass.DB.UpdateProject(openedProject);
- } catch (Exception e){
+ } catch(Exception e) {
Log.Exception(e);
}
- } else if (projectType == ProjectType.FakeCaptureProject)
+ } else if(projectType == ProjectType.FakeCaptureProject)
ProjectUtils.SaveFakeLiveProject(openedProject, this);
}
-
- private bool PromptCloseProject(){
+
+ private bool PromptCloseProject() {
int res;
EndCaptureDialog dialog;
-
- if (openedProject == null)
+
+ if(openedProject == null)
return true;
-
- if (projectType == ProjectType.FileProject){
- MessageDialog md = new MessageDialog(this, DialogFlags.Modal,
+
+ if(projectType == ProjectType.FileProject) {
+ MessageDialog md = new MessageDialog(this, DialogFlags.Modal,
MessageType.Question, ButtonsType.OkCancel,
Catalog.GetString("Do you want to close the current project?"));
res = md.Run();
md.Destroy();
- if (res == (int)ResponseType.Ok){
+ if(res == (int)ResponseType.Ok) {
CloseOpenedProject(true);
return true;
}
return false;
}
-
+
dialog = new EndCaptureDialog();
- dialog.TransientFor = (Gtk.Window)this.Toplevel;
+ dialog.TransientFor = (Gtk.Window)this.Toplevel;
res = dialog.Run();
- dialog.Destroy();
-
+ dialog.Destroy();
+
/* Close project wihtout saving */
- if (res == (int)EndCaptureResponse.Quit){
+ if(res == (int)EndCaptureResponse.Quit) {
CloseOpenedProject(false);
return true;
- } else if (res == (int)EndCaptureResponse.Save){
+ } else if(res == (int)EndCaptureResponse.Save) {
/* Close and save project */
CloseOpenedProject(true);
return true;
} else
/* Continue with the current project */
- return false;
+ return false;
}
-
- private void CloseAndQuit(){
- if (!PromptCloseProject())
+
+ private void CloseAndQuit() {
+ if(!PromptCloseProject())
return;
playlistwidget2.StopEdition();
SaveProject();
playerbin1.Dispose();
Application.Quit();
}
- #endregion
+ #endregion
#region Callbacks
#region File
@@ -367,50 +368,50 @@ namespace LongoMatch.Gui
Project project;
ProjectType projectType;
CapturePropertiesStruct captureProps;
-
- if (!PromptCloseProject())
+
+ if(!PromptCloseProject())
return;
-
- ProjectUtils.CreateNewProject(this, out project, out projectType, out captureProps);
- if (project != null)
+
+ ProjectUtils.CreateNewProject(this, out project, out projectType, out captureProps);
+ if(project != null)
SetProject(project, projectType, captureProps);
}
-
+
protected virtual void OnOpenActivated(object sender, System.EventArgs e)
{
- if (!PromptCloseProject())
+ if(!PromptCloseProject())
return;
-
+
ProjectDescription project=null;
OpenProjectDialog opd = new OpenProjectDialog();
opd.TransientFor = this;
- if (opd.Run() == (int)ResponseType.Ok)
+ if(opd.Run() == (int)ResponseType.Ok)
project = opd.SelectedProject;
opd.Destroy();
- if (project != null)
+ if(project != null)
SetProject(MainClass.DB.GetProject(project.File.FilePath), ProjectType.FileProject, new CapturePropertiesStruct());
}
-
+
protected virtual void OnSaveProjectActionActivated(object sender, System.EventArgs e)
{
SaveProject();
}
-
+
protected virtual void OnCloseActivated(object sender, System.EventArgs e)
{
PromptCloseProject();
}
-
- protected virtual void OnImportProjectActionActivated (object sender, System.EventArgs e)
+
+ protected virtual void OnImportProjectActionActivated(object sender, System.EventArgs e)
{
ProjectUtils.ImportProject(this);
}
-
+
protected virtual void OnQuitActivated(object sender, System.EventArgs e)
{
CloseAndQuit();
- }
+ }
#endregion
#region Tools
protected virtual void OnDatabaseManagerActivated(object sender, System.EventArgs e)
@@ -419,7 +420,7 @@ namespace LongoMatch.Gui
pm.TransientFor = this;
pm.Show();
}
-
+
protected virtual void OnSectionsTemplatesManagerActivated(object sender, System.EventArgs e)
{
TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.CategoriesTemplate);
@@ -433,7 +434,7 @@ namespace LongoMatch.Gui
tManager.TransientFor = this;
tManager.Show();
}
-
+
protected virtual void OnExportProjectToCSVFileActionActivated(object sender, System.EventArgs e)
{
ProjectUtils.ExportToCSV(this, openedProject);
@@ -444,7 +445,7 @@ namespace LongoMatch.Gui
{
playerbin1.FullScreen = ((Gtk.ToggleAction)sender).Active;
}
-
+
protected virtual void OnPlaylistActionToggled(object sender, System.EventArgs e)
{
bool visible = ((Gtk.ToggleAction)sender).Active;
@@ -453,39 +454,39 @@ namespace LongoMatch.Gui
localplayerslisttreewidget.PlayListLoaded=visible;
visitorplayerslisttreewidget.PlayListLoaded=visible;
- if (!visible && !noteswidget1.Visible) {
+ if(!visible && !noteswidget1.Visible) {
rightvbox.Visible = false;
}
- else if (visible) {
+ else if(visible) {
rightvbox.Visible = true;
}
- }
-
+ }
+
protected virtual void OnHideAllWidgetsActionToggled(object sender, System.EventArgs e)
{
- if (openedProject != null) {
+ if(openedProject != null) {
leftbox.Visible = !((Gtk.ToggleAction)sender).Active;
timelinewidget1.Visible = !((Gtk.ToggleAction)sender).Active && AnalyzeModeAction.Active;
- buttonswidget1.Visible = !((Gtk.ToggleAction)sender).Active &&
- (CaptureModeAction.Active || CaptureModeAction.Active);
- if (((Gtk.ToggleAction)sender).Active)
+ buttonswidget1.Visible = !((Gtk.ToggleAction)sender).Active &&
+ (CaptureModeAction.Active || CaptureModeAction.Active);
+ if(((Gtk.ToggleAction)sender).Active)
rightvbox.Visible = false;
- else if (!((Gtk.ToggleAction)sender).Active && (playlistwidget2.Visible || noteswidget1.Visible))
+ else if(!((Gtk.ToggleAction)sender).Active && (playlistwidget2.Visible || noteswidget1.Visible))
rightvbox.Visible = true;
}
}
-
+
protected virtual void OnViewToggled(object sender, System.EventArgs e)
{
/* this callback is triggered by Capture and Free Capture */
ToggleAction view = (Gtk.ToggleAction)sender;
buttonswidget1.Visible = view.Active;
timelinewidget1.Visible = !view.Active;
- if (view == FreeCaptureModeAction)
+ if(view == FreeCaptureModeAction)
buttonswidget1.Mode = TagMode.Free;
- else
- buttonswidget1.Mode = TagMode.Predifined;
- }
+ else
+ buttonswidget1.Mode = TagMode.Predifined;
+ }
#endregion
#region Help
protected virtual void OnHelpAction1Activated(object sender, System.EventArgs e)
@@ -494,12 +495,12 @@ namespace LongoMatch.Gui
System.Diagnostics.Process.Start(Constants.MANUAL);
} catch {}
}
-
+
protected virtual void OnAboutActionActivated(object sender, System.EventArgs e)
{
Version version = Assembly.GetExecutingAssembly().GetName().Version;
Gtk.AboutDialog about = new AboutDialog();
- if (Environment.OSVersion.Platform == PlatformID.Unix)
+ if(Environment.OSVersion.Platform == PlatformID.Unix)
about.ProgramName = Constants.SOFTWARE_NAME;
about.Version = String.Format("{0}.{1}.{2}",version.Major,version.Minor,version.Build);
about.Copyright = Constants.COPYRIGHT;
@@ -518,13 +519,13 @@ namespace LongoMatch.Gui
about.Destroy();
}
- #endregion
+ #endregion
protected virtual void OnTimeprecisionadjustwidget1SizeRequested(object o, Gtk.SizeRequestedArgs args)
{
- if (args.Requisition.Width>= hpaned.Position)
+ if(args.Requisition.Width>= hpaned.Position)
hpaned.Position = args.Requisition.Width;
- }
+ }
protected virtual void OnPlayerbin1Error(object o, ErrorArgs args)
{
@@ -538,43 +539,43 @@ namespace LongoMatch.Gui
Gdk.Key key = evnt.Key;
Gdk.ModifierType modifier = evnt.State;
bool ret;
-
+
ret = base.OnKeyPressEvent(evnt);
- if (openedProject == null && !playerbin1.Opened)
+ if(openedProject == null && !playerbin1.Opened)
return ret;
-
- if (projectType != ProjectType.CaptureProject &&
- projectType != ProjectType.FakeCaptureProject){
- switch (key){
- case Constants.SEEK_FORWARD:
- if (modifier == Constants.STEP)
- playerbin1.StepForward();
- else
- playerbin1.SeekToNextFrame(selectedTimeNode != null);
- break;
- case Constants.SEEK_BACKWARD:
- if (modifier == Constants.STEP)
- playerbin1.StepBackward();
- else
- playerbin1.SeekToPreviousFrame(selectedTimeNode != null);
- break;
- case Constants.FRAMERATE_UP:
- playerbin1.FramerateUp();
- break;
- case Constants.FRAMERATE_DOWN:
- playerbin1.FramerateDown();
- break;
- case Constants.TOGGLE_PLAY:
- playerbin1.TogglePlay();
- break;
- }
+
+ if(projectType != ProjectType.CaptureProject &&
+ projectType != ProjectType.FakeCaptureProject) {
+ switch(key) {
+ case Constants.SEEK_FORWARD:
+ if(modifier == Constants.STEP)
+ playerbin1.StepForward();
+ else
+ playerbin1.SeekToNextFrame(selectedTimeNode != null);
+ break;
+ case Constants.SEEK_BACKWARD:
+ if(modifier == Constants.STEP)
+ playerbin1.StepBackward();
+ else
+ playerbin1.SeekToPreviousFrame(selectedTimeNode != null);
+ break;
+ case Constants.FRAMERATE_UP:
+ playerbin1.FramerateUp();
+ break;
+ case Constants.FRAMERATE_DOWN:
+ playerbin1.FramerateDown();
+ break;
+ case Constants.TOGGLE_PLAY:
+ playerbin1.TogglePlay();
+ break;
+ }
} else {
- switch (key){
- case Constants.TOGGLE_PLAY:
- capturerBin.TogglePause();
- break;
- }
+ switch(key) {
+ case Constants.TOGGLE_PLAY:
+ capturerBin.TogglePause();
+ break;
+ }
}
return ret;
}
@@ -586,7 +587,7 @@ namespace LongoMatch.Gui
protected virtual void OnSegmentClosedEvent()
{
- if (!playlistwidget2.Visible)
+ if(!playlistwidget2.Visible)
rightvbox.Visible=false;
}
@@ -603,19 +604,19 @@ namespace LongoMatch.Gui
drawingtoolbox1.Visible = DrawingToolAction.Active;
drawingtoolbox1.DrawingVisibility = DrawingToolAction.Active;
}
-
- protected override bool OnDeleteEvent (Gdk.Event evnt)
+
+ protected override bool OnDeleteEvent(Gdk.Event evnt)
{
- CloseAndQuit();
+ CloseAndQuit();
return true;
}
-
- protected virtual void OnCapturerBinError (object o, ErrorArgs args)
+
+ protected virtual void OnCapturerBinError(object o, ErrorArgs args)
{
MessagePopup.PopupMessage(this, MessageType.Info,
Catalog.GetString("An error occured in the video capturer and the current project will be closed:")+"\n" +args.Message);
CloseOpenedProject(true);
}
- #endregion
+ #endregion
}
}
diff --git a/LongoMatch/Gui/Popup/MessagePopup.cs b/LongoMatch/Gui/Popup/MessagePopup.cs
index acd0f64..5dd7b3b 100644
--- a/LongoMatch/Gui/Popup/MessagePopup.cs
+++ b/LongoMatch/Gui/Popup/MessagePopup.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Gui
public static void PopupMessage(Widget sender,MessageType type, String errorMessage) {
Window toplevel;
- if (sender != null)
+ if(sender != null)
toplevel = (Window)sender.Toplevel;
else
toplevel = null;
diff --git a/LongoMatch/Gui/TransparentDrawingArea.cs b/LongoMatch/Gui/TransparentDrawingArea.cs
index a3419b2..0d98622 100644
--- a/LongoMatch/Gui/TransparentDrawingArea.cs
+++ b/LongoMatch/Gui/TransparentDrawingArea.cs
@@ -79,14 +79,14 @@ namespace LongoMatch.Gui.Popup
}
public void ToggleGrab() {
- if (hardGrab)
+ if(hardGrab)
ReleaseGrab();
else
AcquireGrab();
}
public void ReleaseGrab() {
- if (hardGrab) {
+ if(hardGrab) {
hardGrab=false;
Pointer.Ungrab(Gtk.Global.CurrentEventTime);
}
@@ -94,7 +94,7 @@ namespace LongoMatch.Gui.Popup
public void AcquireGrab() {
GrabStatus stat;
- if (!hardGrab) {
+ if(!hardGrab) {
stat =Pointer.Grab(drawingarea.GdkWindow, false,
EventMask.ButtonMotionMask |
EventMask.ButtonPressMask |
@@ -102,7 +102,7 @@ namespace LongoMatch.Gui.Popup
targetWidget.GdkWindow,
new Gdk.Cursor(Gdk.CursorType.Pencil) /* data->paint_cursor */,
Gtk.Global.CurrentEventTime);
- if (stat == GrabStatus.Success) {
+ if(stat == GrabStatus.Success) {
hardGrab=true;
}
}
@@ -125,7 +125,7 @@ namespace LongoMatch.Gui.Popup
}
private bool Reshape() {
- if (modified)
+ if(modified)
{
ShapeCombineMask(shape, 0,0);
modified = false;
@@ -205,21 +205,21 @@ namespace LongoMatch.Gui.Popup
protected virtual void OnDrawingareaButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
{
- if (!hardGrab)
+ if(!hardGrab)
return;
lastx = args.Event.X;
lasty = args.Event.Y;
- if (args.Event.Button == 1)
+ if(args.Event.Button == 1)
DrawLine((int)args.Event.X, (int)args.Event.Y,(int) args.Event.X, (int)args.Event.Y);
}
protected virtual void OnDrawingareaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
{
- if (!hardGrab)
+ if(!hardGrab)
return;
- if (lastx==-1 || lasty==-1) {
+ if(lastx==-1 || lasty==-1) {
lastx = args.Event.X;
lasty = args.Event.Y;
}
@@ -245,7 +245,7 @@ namespace LongoMatch.Gui.Popup
protected override void OnShown() {
//Prevent a dirty flash when the
//Window is created and hidden
- if (targetWidget != null) {
+ if(targetWidget != null) {
base.OnShown();
timeoutId = GLib.Timeout.Add(20,Reshape);
}
diff --git a/LongoMatch/Gui/TreeView/CategoriesTreeView.cs b/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
index b4ccfdc..3c50a26 100644
--- a/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
+++ b/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
@@ -67,7 +67,7 @@ namespace LongoMatch.Gui.Component
hotKeyColumn.Title = Catalog.GetString("Hotkey");
Gtk.CellRendererText hotKeyCell = new Gtk.CellRendererText();
hotKeyColumn.PackStart(hotKeyCell, true);
-
+
Gtk.TreeViewColumn sortMethodColumn = new Gtk.TreeViewColumn();
sortMethodColumn.Title = Catalog.GetString("Sort Method");
Gtk.CellRendererText sortMethodCell = new Gtk.CellRendererText();
@@ -124,7 +124,7 @@ namespace LongoMatch.Gui.Component
(cell as Gtk.CellRendererText).Text = tNode.HotKey.ToString();
}
-
+
private void RenderSortMethod(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
Category tNode = (Category) Model.GetValue(iter, 0);
@@ -136,15 +136,15 @@ namespace LongoMatch.Gui.Component
TreeIter iter;
List<Category> list;
TreePath[] pathArray;
-
+
list = new List<Category>();
pathArray = Selection.GetSelectedRows();
-
- for (int i=0; i< pathArray.Length; i++){
- Model.GetIterFromString (out iter, pathArray[i].ToString());
+
+ for(int i=0; i< pathArray.Length; i++) {
+ Model.GetIterFromString(out iter, pathArray[i].ToString());
list.Add((Category) Model.GetValue(iter, 0));
}
- if (CategoriesSelected != null)
+ if(CategoriesSelected != null)
CategoriesSelected(list);
}
@@ -154,7 +154,7 @@ namespace LongoMatch.Gui.Component
Model.GetIter(out iter, args.Path);
Category tNode = (Category)Model.GetValue(iter, 0);
- if (CategoryClicked != null)
+ if(CategoryClicked != null)
CategoryClicked(tNode);
}
}
diff --git a/LongoMatch/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch/Gui/TreeView/ListTreeViewBase.cs
index 09ee894..66830fd 100644
--- a/LongoMatch/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch/Gui/TreeView/ListTreeViewBase.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
+//
using Gdk;
using Gtk;
@@ -45,8 +45,8 @@ namespace LongoMatch.Gui.Component
protected MenuItem players;
protected MenuItem localPlayers;
protected MenuItem visitorPlayers;
-
-
+
+
protected Gtk.CellRendererText nameCell;
protected Gtk.TreeViewColumn nameColumn;
protected String[] teams_name;
@@ -54,8 +54,8 @@ namespace LongoMatch.Gui.Component
protected bool projectIsLive;
protected const string LOCAL_TEAM = "Local Team";
- protected const string VISITOR_TEAM = "Visitor Team";
-
+ protected const string VISITOR_TEAM = "Visitor Team";
+
public event TimeNodeChangedHandler TimeNodeChanged;
public event TimeNodeSelectedHandler TimeNodeSelected;
public event TimeNodeDeletedHandler TimeNodeDeleted;
@@ -64,13 +64,13 @@ namespace LongoMatch.Gui.Component
public event PlayersTaggedHandler PlayersTagged;
public event TagPlayHandler TagPlay;
- public ListTreeViewBase ()
+ public ListTreeViewBase()
{
Selection.Mode = SelectionMode.Multiple;
Selection.SelectFunction = SelectFunction;
RowActivated += new RowActivatedHandler(OnTreeviewRowActivated);
HeadersVisible = false;
-
+
SetMenu();
ProjectIsLive = false;
PlayListLoaded = false;
@@ -79,8 +79,8 @@ namespace LongoMatch.Gui.Component
teams_name[(int)Team.NONE] = Catalog.GetString(Catalog.GetString("None"));
teams_name[(int)Team.LOCAL] = Catalog.GetString(Catalog.GetString(LOCAL_TEAM));
teams_name[(int)Team.VISITOR] = Catalog.GetString(Catalog.GetString(VISITOR_TEAM));
-
-
+
+
nameColumn = new Gtk.TreeViewColumn();
nameColumn.Title = "Name";
nameCell = new Gtk.CellRendererText();
@@ -96,41 +96,41 @@ namespace LongoMatch.Gui.Component
}
- public bool ProjectIsLive{
- set{
+ public bool ProjectIsLive {
+ set {
projectIsLive = value;
addPLN.Visible = !projectIsLive;
snapshot.Visible = !projectIsLive;
}
}
-
- public bool Colors{
+
+ public bool Colors {
get;
set;
}
-
+
public String LocalTeam {
- set{
+ set {
Label l1 = (local.Children[0] as Label);
Label l2 = (localPlayers.Children[0] as Label);
- if (value == "")
+ if(value == "")
l1.Text = l2.Text = Catalog.GetString(LOCAL_TEAM);
else {
l1.Text = l2.Text = value;
}
- teams_name[(int)Team.LOCAL] = l1.Text;
+ teams_name[(int)Team.LOCAL] = l1.Text;
}
}
-
+
public string VisitorTeam {
- set{
+ set {
Label l1 = (visitor.Children[0] as Label);
Label l2 = (visitorPlayers.Children[0] as Label);
- if (value == "")
+ if(value == "")
l1.Text = l2.Text = Catalog.GetString(VISITOR_TEAM);
- else
+ else
l1.Text = l2.Text = value;
- teams_name[(int)Team.VISITOR] = l1.Text;
+ teams_name[(int)Team.VISITOR] = l1.Text;
}
}
@@ -139,16 +139,16 @@ namespace LongoMatch.Gui.Component
addPLN.Sensitive = value;
}
}
-
- protected void EmitTimeNodeChanged(TimeNode tn, object o){
- if (TimeNodeChanged != null)
+
+ protected void EmitTimeNodeChanged(TimeNode tn, object o) {
+ if(TimeNodeChanged != null)
TimeNodeChanged(tn, o);
}
-
+
protected void SetMenu() {
Menu playersMenu;
MenuItem team;
-
+
teamMenu = new Menu();
local = new MenuItem(Catalog.GetString(LOCAL_TEAM));
visitor = new MenuItem(Catalog.GetString(VISITOR_TEAM));
@@ -164,7 +164,7 @@ namespace LongoMatch.Gui.Component
playersMenu.Append(visitorPlayers);
menu = new Menu();
-
+
name = new MenuItem(Catalog.GetString("Edit"));
team = new MenuItem(Catalog.GetString("Team Selection"));
team.Submenu = teamMenu;
@@ -198,35 +198,35 @@ namespace LongoMatch.Gui.Component
deleteKeyFrame.Activated += OnDeleteKeyFrame;
snapshot.Activated += OnSnapshot;
menu.ShowAll();
- }
+ }
- protected void MultiSelectMenu (bool enabled){
+ protected void MultiSelectMenu(bool enabled) {
name.Sensitive = !enabled;
snapshot.Sensitive = !enabled;
players.Sensitive = !enabled;
tag.Sensitive = !enabled;
}
-
- protected object GetValueFromPath(TreePath path){
+
+ protected object GetValueFromPath(TreePath path) {
Gtk.TreeIter iter;
Model.GetIter(out iter, path);
- return Model.GetValue(iter,0);
- }
-
+ return Model.GetValue(iter,0);
+ }
+
protected void RenderMiniature(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
var item = model.GetValue(iter, 0);
var c = cell as CellRendererPixbuf;
- if (item is Play){
+ if(item is Play) {
c.Pixbuf = (item as Play).Miniature;
- if (Colors) {
+ if(Colors) {
c.CellBackgroundGdk = (item as Play).Category.Color;
- } else{
+ } else {
c.CellBackground = "white";
}
}
- else if (item is Player){
+ else if(item is Player) {
c.Pixbuf= (item as Player).Photo;
c.CellBackground = "white";
}
@@ -235,62 +235,62 @@ namespace LongoMatch.Gui.Component
c.CellBackground = "white";
}
}
-
+
protected void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
object o = model.GetValue(iter, 0);
var c = cell as CellRendererText;
-
+
/* Handle special case in which we replace the text in the cell by the name of the TimeNode
* We need to check if we are editing and only change it for the path that's currently beeing edited */
- if (editing && Selection.IterIsSelected(iter)){
- if (o is Player)
+ if(editing && Selection.IterIsSelected(iter)) {
+ if(o is Player)
c.Markup = (o as Player).Name;
else
c.Markup = (o as TimeNode).Name;
return;
- }
-
- if (o is Play){
+ }
+
+ if(o is Play) {
var mtn = o as Play;
- if (Colors) {
+ if(Colors) {
Color col = mtn.Category.Color;
c.CellBackgroundGdk = col;
c.BackgroundGdk = col;
- } else{
+ } else {
c.Background = "white";
c.CellBackground = "white";
}
// FIXME
//c.Markup = mtn.ToString(teams_name[(int)mtn.Team]);
- }else if (o is Player) {
+ } else if(o is Player) {
c.Background = "white";
c.CellBackground = "white";
c.Markup = String.Format("{0} ({1})", (o as Player).Name, Model.IterNChildren(iter));
- }else if (o is Category) {
+ } else if(o is Category) {
c.Background = "white";
c.CellBackground = "white";
c.Markup = String.Format("{0} ({1})", (o as TimeNode).Name, Model.IterNChildren(iter));
}
- }
+ }
protected virtual void OnNameCellEdited(object o, Gtk.EditedArgs args)
{
Gtk.TreeIter iter;
object item;
-
+
Model.GetIter(out iter, new Gtk.TreePath(args.Path));
item = this.Model.GetValue(iter,0);
-
- if (item is TimeNode){
+
+ if(item is TimeNode) {
(item as TimeNode).Name = args.NewText;
EmitTimeNodeChanged((item as TimeNode), args.NewText);
- }else if (item is Player){
+ } else if(item is Player) {
(item as Player).Name = args.NewText;
}
editing = false;
nameCell.Editable=false;
-
+
}
protected virtual void OnTreeviewRowActivated(object o, Gtk.RowActivatedArgs args)
@@ -298,11 +298,11 @@ namespace LongoMatch.Gui.Component
Gtk.TreeIter iter;
this.Model.GetIter(out iter, args.Path);
object item = this.Model.GetValue(iter, 0);
-
- if (!(item is Play))
+
+ if(!(item is Play))
return;
- if (TimeNodeSelected != null && !projectIsLive)
+ if(TimeNodeSelected != null && !projectIsLive)
this.TimeNodeSelected(item as Play);
}
@@ -310,21 +310,21 @@ namespace LongoMatch.Gui.Component
List <Play> playsList = new List<Play>();
List <TreeIter> iters = new List<TreeIter>();
TreePath[] paths = Selection.GetSelectedRows();
-
+
/* Get the iter for all of the paths first, because the path changes
* each time a row is deleted */
- foreach (var path in paths) {
+ foreach(var path in paths) {
TreeIter iter;
Model.GetIter(out iter, path);
playsList.Add((Play)Model.GetValue(iter, 0));
iters.Add(iter);
}
/* Delete all the iters now */
- for (int i=0; i< iters.Count; i++){
+ for(int i=0; i< iters.Count; i++) {
TreeIter iter = iters[i];
(Model as TreeStore).Remove(ref iter);
}
- if (TimeNodeDeleted != null)
+ if(TimeNodeDeleted != null)
TimeNodeDeleted(playsList);
}
@@ -336,9 +336,9 @@ namespace LongoMatch.Gui.Component
false,
Catalog.GetString("Do you want to delete the key frame for this play?")
);
- if (md.Run() == (int)ResponseType.Yes){
+ if(md.Run() == (int)ResponseType.Yes) {
TreePath[] paths = Selection.GetSelectedRows();
- for (int i=0; i<paths.Length; i++){
+ for(int i=0; i<paths.Length; i++) {
Play tNode = (Play)GetValueFromPath(paths[i]);
tNode.Drawings.Clear();
}
@@ -350,7 +350,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnEdit(object obj, EventArgs args) {
TreePath[] paths = Selection.GetSelectedRows();
-
+
editing = true;
nameCell.Editable = true;
SetCursor(paths[0], nameColumn, true);
@@ -359,51 +359,51 @@ namespace LongoMatch.Gui.Component
protected void OnTeamSelection(object obj, EventArgs args) {
MenuItem sender = (MenuItem)obj;
Team team = Team.NONE;
- if (sender == local)
+ if(sender == local)
team = Team.LOCAL;
- else if (sender == visitor)
+ else if(sender == visitor)
team = Team.VISITOR;
- else if (sender == noTeam)
+ else if(sender == noTeam)
team = Team.NONE;
-
+
TreePath[] paths = Selection.GetSelectedRows();
- for (int i=0; i<paths.Length; i++){
- Play tNode = (Play)GetValueFromPath(paths[i]);
- //FIXME
- //tNode.Team = team;
+ for(int i=0; i<paths.Length; i++) {
+ Play tNode = (Play)GetValueFromPath(paths[i]);
+ //FIXME
+ //tNode.Team = team;
}
}
protected void OnAdded(object obj, EventArgs args) {
- if (PlayListNodeAdded != null){
+ if(PlayListNodeAdded != null) {
TreePath[] paths = Selection.GetSelectedRows();
- for (int i=0; i<paths.Length; i++){
+ for(int i=0; i<paths.Length; i++) {
Play tNode = (Play)GetValueFromPath(paths[i]);
PlayListNodeAdded(tNode);
}
}
}
-
- protected void OnTag (object obj, EventArgs args){
- if (TagPlay != null)
+
+ protected void OnTag(object obj, EventArgs args) {
+ if(TagPlay != null)
TagPlay((Play)GetValueFromPath(Selection.GetSelectedRows()[0]));
}
protected void OnSnapshot(object obj, EventArgs args) {
- if (SnapshotSeriesEvent != null)
+ if(SnapshotSeriesEvent != null)
SnapshotSeriesEvent((Play)GetValueFromPath(Selection.GetSelectedRows()[0]));
}
protected virtual void OnLocalPlayers(object o, EventArgs args) {
- if (PlayersTagged != null)
+ if(PlayersTagged != null)
PlayersTagged((Play)GetValueFromPath(Selection.GetSelectedRows()[0]), Team.LOCAL);
}
protected virtual void OnVisitorPlayers(object o, EventArgs args) {
- if (PlayersTagged != null)
+ if(PlayersTagged != null)
PlayersTagged((Play)GetValueFromPath(Selection.GetSelectedRows()[0]), Team.VISITOR);
}
-
+
protected abstract bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected);
}
}
diff --git a/LongoMatch/Gui/TreeView/PlayListTreeView.cs b/LongoMatch/Gui/TreeView/PlayListTreeView.cs
index 4c327ed..d54981c 100644
--- a/LongoMatch/Gui/TreeView/PlayListTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayListTreeView.cs
@@ -95,11 +95,11 @@ namespace LongoMatch.Gui.Component
protected override bool OnButtonPressEvent(EventButton evnt)
{
- if ((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
+ if((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
{
TreePath path;
GetPathAtPos((int)evnt.X,(int)evnt.Y,out path);
- if (path!=null) {
+ if(path!=null) {
ListStore list = ((ListStore)Model);
Model.GetIter(out selectedIter,path);
selectedTimeNode = (PlayListPlay)(list.GetValue(selectedIter,0));
@@ -114,7 +114,7 @@ namespace LongoMatch.Gui.Component
EntryDialog ed = new EntryDialog();
ed.Title = Catalog.GetString("Edit Title");
ed.Text = selectedTimeNode.Name;
- if (ed.Run() == (int)ResponseType.Ok) {
+ if(ed.Run() == (int)ResponseType.Ok) {
selectedTimeNode.Name = ed.Text;
this.QueueDraw();
}
@@ -128,7 +128,7 @@ namespace LongoMatch.Gui.Component
}
protected void OnApplyRate(object obj, EventArgs args) {
- if (ApplyCurrentRate != null)
+ if(ApplyCurrentRate != null)
ApplyCurrentRate(selectedTimeNode);
}
@@ -136,23 +136,23 @@ namespace LongoMatch.Gui.Component
{
PlayListPlay tNode = (PlayListPlay) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text = Catalog.GetString("Title")+": "+tNode.Name +"\n"+
- Catalog.GetString("Start")+": "+tNode.Start.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
- Catalog.GetString("Duration")+": "+tNode.Duration.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
- Catalog.GetString("Play Rate")+": "+tNode.Rate.ToString();
- if (!tNode.Valid) {
+ Catalog.GetString("Start")+": "+tNode.Start.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
+ Catalog.GetString("Duration")+": "+tNode.Duration.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
+ Catalog.GetString("Play Rate")+": "+tNode.Rate.ToString();
+ if(!tNode.Valid) {
(cell as Gtk.CellRendererText).Foreground = "red";
(cell as Gtk.CellRendererText).Text += "\n"+Catalog.GetString("File not found")+": "+tNode.MediaFile.FilePath;
}
- else if (tNode == loadedTimeNode)
+ else if(tNode == loadedTimeNode)
(cell as Gtk.CellRendererText).Foreground = "blue";
else
(cell as Gtk.CellRendererText).Foreground = "black";
}
- protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
+ protected override bool OnKeyPressEvent(Gdk.EventKey evnt)
{
return false;
- }
+ }
}
}
diff --git a/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs b/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
index 5e7468f..a52b001 100644
--- a/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
@@ -50,22 +50,22 @@ namespace LongoMatch.Gui.Component
nameColumn.Title = Catalog.GetString("Name");
Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
nameColumn.PackStart(nameCell, true);
-
+
Gtk.TreeViewColumn playsColumn = new Gtk.TreeViewColumn();
playsColumn.Title = Catalog.GetString("Play this match");
Gtk.CellRendererText playCell = new Gtk.CellRendererText();
playsColumn.PackStart(playCell, true);
-
+
Gtk.TreeViewColumn birthdayColumn = new Gtk.TreeViewColumn();
birthdayColumn.Title = Catalog.GetString("Date of Birth");
Gtk.CellRendererText birthdayCell = new Gtk.CellRendererText();
birthdayColumn.PackStart(birthdayCell, true);
-
+
Gtk.TreeViewColumn nationColumn = new Gtk.TreeViewColumn();
nationColumn.Title = Catalog.GetString("Nationality");
Gtk.CellRendererText nationCell = new Gtk.CellRendererText();
nationColumn.PackStart(nationCell, true);
-
+
Gtk.TreeViewColumn heightColumn = new Gtk.TreeViewColumn();
heightColumn.Title = Catalog.GetString("Height");
Gtk.CellRendererText heightCell = new Gtk.CellRendererText();
@@ -75,7 +75,7 @@ namespace LongoMatch.Gui.Component
weightColumn.Title = Catalog.GetString("Weight");
Gtk.CellRendererText weightCell = new Gtk.CellRendererText();
weightColumn.PackStart(weightCell, true);
-
+
Gtk.TreeViewColumn positionColumn = new Gtk.TreeViewColumn();
positionColumn.Title = Catalog.GetString("Position");
Gtk.CellRendererText positionCell = new Gtk.CellRendererText();
@@ -120,7 +120,7 @@ namespace LongoMatch.Gui.Component
(cell as Gtk.CellRendererText).Text = player.Name;
}
-
+
private void RenderPlay(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
Player player = (Player) model.GetValue(iter, 0);
@@ -155,14 +155,14 @@ namespace LongoMatch.Gui.Component
(cell as Gtk.CellRendererText).Text = player.Height.ToString();
}
-
+
private void RenderWeight(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
Player player = (Player) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text = player.Weight.ToString();
}
-
+
private void RenderBirthday(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
Player player = (Player) model.GetValue(iter, 0);
@@ -175,7 +175,7 @@ namespace LongoMatch.Gui.Component
Gtk.TreeIter iter;
Model.GetIter(out iter, args.Path);
Player player = (Player) Model.GetValue(iter, 0);
- if (PlayerClicked != null)
+ if(PlayerClicked != null)
PlayerClicked(player);
}
}
diff --git a/LongoMatch/Gui/TreeView/PlayersTreeView.cs b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
index a5bbbd7..28244db 100644
--- a/LongoMatch/Gui/TreeView/PlayersTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
@@ -45,66 +45,66 @@ namespace LongoMatch.Gui.Component
set;
get;
}
-
- new public TreeStore Model{
- set{
- if (value != null){
+
+ new public TreeStore Model {
+ set {
+ if(value != null) {
value.SetSortFunc(0, SortFunction);
value.SetSortColumnId(0,SortType.Ascending);
}
- base.Model = value;
+ base.Model = value;
}
- get{
+ get {
return base.Model as TreeStore;
}
}
- private void SetPlayersMenu(){
+ private void SetPlayersMenu() {
Action edit;
UIManager manager;
ActionGroup g;
-
+
manager= new UIManager();
g = new ActionGroup("PlayersMenuGroup");
-
+
edit = new Action("EditAction", Mono.Unix.Catalog.GetString("Edit name"), null, "gtk-edit");
-
+
g.Add(edit, null);
-
+
manager.InsertActionGroup(g,0);
-
+
manager.AddUiFromString("<ui>"+
" <popup action='PlayersMenu'>"+
" <menuitem action='EditAction'/>"+
" </popup>"+
"</ui>");
-
- playersMenu = manager.GetWidget("/PlayersMenu") as Menu;
-
+
+ playersMenu = manager.GetWidget("/PlayersMenu") as Menu;
+
edit.Activated += OnEdit;
}
-
- protected int SortFunction(TreeModel model, TreeIter a, TreeIter b){
+
+ protected int SortFunction(TreeModel model, TreeIter a, TreeIter b) {
object oa;
object ob;
-
- if (model == null)
- return 0;
-
- oa = model.GetValue (a, 0);
- ob = model.GetValue (b, 0);
-
- if (oa is Player)
+
+ if(model == null)
+ return 0;
+
+ oa = model.GetValue(a, 0);
+ ob = model.GetValue(b, 0);
+
+ if(oa is Player)
return (oa as Player).Number.CompareTo((ob as Player).Number);
- else
+ else
return (oa as TimeNode).Name.CompareTo((ob as TimeNode).Name);
}
-
- override protected bool OnKeyPressEvent (Gdk.EventKey evnt)
+
+ override protected bool OnKeyPressEvent(Gdk.EventKey evnt)
{
return false;
}
-
+
override protected void OnNameCellEdited(object o, Gtk.EditedArgs args)
{
base.OnNameCellEdited(o, args);
@@ -112,22 +112,22 @@ namespace LongoMatch.Gui.Component
}
override protected bool OnButtonPressEvent(EventButton evnt)
- {
+ {
TreePath[] paths = Selection.GetSelectedRows();
-
- if ((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
+
+ if((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
{
// We don't want to unselect the play when several
// plays are selected and we clik the right button
// For multiedition
- if (paths.Length <= 1){
+ if(paths.Length <= 1) {
base.OnButtonPressEvent(evnt);
paths = Selection.GetSelectedRows();
}
-
- if (paths.Length == 1) {
+
+ if(paths.Length == 1) {
TimeNode selectedTimeNode = GetValueFromPath(paths[0]) as TimeNode;
- if (selectedTimeNode is Play) {
+ if(selectedTimeNode is Play) {
deleteKeyFrame.Sensitive = (selectedTimeNode as Play).HasDrawings;
MultiSelectMenu(false);
menu.Popup();
@@ -135,23 +135,23 @@ namespace LongoMatch.Gui.Component
playersMenu.Popup();
}
}
- else if (paths.Length > 1){
+ else if(paths.Length > 1) {
MultiSelectMenu(true);
- menu.Popup();
+ menu.Popup();
}
}
- else
+ else
base.OnButtonPressEvent(evnt);
return true;
}
-
- override protected bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected){
+
+ override protected bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected) {
// Don't allow multiselection for Players
- if (!selected && selection.GetSelectedRows().Length > 0){
- if (selection.GetSelectedRows().Length == 1 &&
- GetValueFromPath(selection.GetSelectedRows()[0]) is Player)
- return false;
- return !(GetValueFromPath(path) is Player);
+ if(!selected && selection.GetSelectedRows().Length > 0) {
+ if(selection.GetSelectedRows().Length == 1 &&
+ GetValueFromPath(selection.GetSelectedRows()[0]) is Player)
+ return false;
+ return !(GetValueFromPath(path) is Player);
}
// Always unselect
else
diff --git a/LongoMatch/Gui/TreeView/PlaysTreeView.cs b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
index bf70cd7..879380e 100644
--- a/LongoMatch/Gui/TreeView/PlaysTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
@@ -37,54 +37,54 @@ namespace LongoMatch.Gui.Component
//Categories menu
private Menu categoriesMenu;
private RadioAction sortByName, sortByStart, sortByStop, sortByDuration;
-
+
public PlaysTreeView() {
SetCategoriesMenu();
}
-
- new public TreeStore Model{
- set{
- if (value != null){
+
+ new public TreeStore Model {
+ set {
+ if(value != null) {
value.SetSortFunc(0, SortFunction);
value.SetSortColumnId(0,SortType.Ascending);
}
- base.Model = value;
+ base.Model = value;
}
- get{
+ get {
return base.Model as TreeStore;
}
}
- private void SetCategoriesMenu(){
- Gtk.Action edit, sortMenu;
+ private void SetCategoriesMenu() {
+ Gtk.Action edit, sortMenu;
UIManager manager;
ActionGroup g;
-
+
manager= new UIManager();
g = new ActionGroup("CategoriesMenuGroup");
-
+
edit = new Gtk.Action("EditAction", Mono.Unix.Catalog.GetString("Edit name"), null, "gtk-edit");
sortMenu = new Gtk.Action("SortMenuAction", Mono.Unix.Catalog.GetString("Sort Method"), null, null);
sortByName = new Gtk.RadioAction("SortByNameAction", Mono.Unix.Catalog.GetString("Sort by name"), null, null, 1);
sortByStart = new Gtk.RadioAction("SortByStartAction", Mono.Unix.Catalog.GetString("Sort by start time"), null, null, 2);
sortByStop = new Gtk.RadioAction("SortByStopAction", Mono.Unix.Catalog.GetString("Sort by stop time"), null, null, 3);
sortByDuration = new Gtk.RadioAction("SortByDurationAction", Mono.Unix.Catalog.GetString("Sort by duration"), null, null, 3);
-
+
sortByName.Group = new GLib.SList(System.IntPtr.Zero);
sortByStart.Group = sortByName.Group;
sortByStop.Group = sortByName.Group;
- sortByDuration.Group = sortByName.Group;
-
-
+ sortByDuration.Group = sortByName.Group;
+
+
g.Add(edit, null);
g.Add(sortMenu, null);
g.Add(sortByName, null);
g.Add(sortByStart, null);
g.Add(sortByStop, null);
g.Add(sortByDuration, null);
-
+
manager.InsertActionGroup(g,0);
-
+
manager.AddUiFromString("<ui>"+
" <popup action='CategoryMenu'>"+
" <menuitem action='EditAction'/>"+
@@ -96,112 +96,112 @@ namespace LongoMatch.Gui.Component
" </menu>"+
" </popup>"+
"</ui>");
-
- categoriesMenu = manager.GetWidget("/CategoryMenu") as Menu;
-
+
+ categoriesMenu = manager.GetWidget("/CategoryMenu") as Menu;
+
edit.Activated += OnEdit;
sortByName.Activated += OnSortActivated;
sortByStart.Activated += OnSortActivated;
sortByStop.Activated += OnSortActivated;
sortByDuration.Activated += OnSortActivated;
}
-
- private void SetupSortMenu(SortMethodType sortMethod){
- switch (sortMethod) {
- case SortMethodType.SortByName:
- sortByName.Active = true;
- break;
- case SortMethodType.SortByStartTime:
- sortByStart.Active = true;
- break;
- case SortMethodType.SortByStopTime:
- sortByStop.Active = true;
- break;
- default:
- sortByDuration.Active = true;
- break;
+
+ private void SetupSortMenu(SortMethodType sortMethod) {
+ switch(sortMethod) {
+ case SortMethodType.SortByName:
+ sortByName.Active = true;
+ break;
+ case SortMethodType.SortByStartTime:
+ sortByStart.Active = true;
+ break;
+ case SortMethodType.SortByStopTime:
+ sortByStop.Active = true;
+ break;
+ default:
+ sortByDuration.Active = true;
+ break;
}
}
-
- protected int SortFunction(TreeModel model, TreeIter a, TreeIter b){
+
+ protected int SortFunction(TreeModel model, TreeIter a, TreeIter b) {
TreeStore store;
TimeNode tna, tnb;
TreeIter parent;
int depth;
Category category;
-
- if (model == null)
- return 0;
-
+
+ if(model == null)
+ return 0;
+
store = model as TreeStore;
-
+
// Retrieve the iter parent and its depth
// When a new play is inserted, one of the iters is not a valid
// in the model. Get the values from the valid one
- if (store.IterIsValid(a)){
+ if(store.IterIsValid(a)) {
store.IterParent(out parent, a);
depth = store.IterDepth(a);
}
- else{
+ else {
store.IterParent(out parent, b);
depth = store.IterDepth(b);
- }
-
+ }
+
// Dont't store categories
- if (depth == 0)
- return int.Parse(model.GetPath(a).ToString())
- - int.Parse(model.GetPath(b).ToString());
-
+ if(depth == 0)
+ return int.Parse(model.GetPath(a).ToString())
+ - int.Parse(model.GetPath(b).ToString());
+
category = model.GetValue(parent,0) as Category;
- tna = model.GetValue (a, 0)as TimeNode;
- tnb = model.GetValue (b, 0) as TimeNode;
-
- switch(category.SortMethod){
- case(SortMethodType.SortByName):
- return String.Compare(tna.Name, tnb.Name);
- case(SortMethodType.SortByStartTime):
- return (tna.Start - tnb.Start).MSeconds;
- case(SortMethodType.SortByStopTime):
- return (tna.Stop - tnb.Stop).MSeconds;
- case(SortMethodType.SortByDuration):
- return (tna.Duration - tnb.Duration).MSeconds;
- default:
- return 0;
- }
+ tna = model.GetValue(a, 0)as TimeNode;
+ tnb = model.GetValue(b, 0) as TimeNode;
+
+ switch(category.SortMethod) {
+ case(SortMethodType.SortByName):
+ return String.Compare(tna.Name, tnb.Name);
+ case(SortMethodType.SortByStartTime):
+ return (tna.Start - tnb.Start).MSeconds;
+ case(SortMethodType.SortByStopTime):
+ return (tna.Stop - tnb.Stop).MSeconds;
+ case(SortMethodType.SortByDuration):
+ return (tna.Duration - tnb.Duration).MSeconds;
+ default:
+ return 0;
+ }
}
-
- private void OnSortActivated (object o, EventArgs args){
+
+ private void OnSortActivated(object o, EventArgs args) {
Category category;
RadioAction sender;
-
+
sender = o as RadioAction;
category = GetValueFromPath(Selection.GetSelectedRows()[0]) as Category;
-
- if (sender == sortByName)
+
+ if(sender == sortByName)
category.SortMethod = SortMethodType.SortByName;
- else if (sender == sortByStart)
+ else if(sender == sortByStart)
category.SortMethod = SortMethodType.SortByStartTime;
- else if (sender == sortByStop)
+ else if(sender == sortByStop)
category.SortMethod = SortMethodType.SortByStopTime;
- else
+ else
category.SortMethod = SortMethodType.SortByDuration;
// Redorder plays
Model.SetSortFunc(0, SortFunction);
}
-
- override protected bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected){
+
+ override protected bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected) {
// Don't allow multiselect for categories
- if (!selected && selection.GetSelectedRows().Length > 0){
- if (selection.GetSelectedRows().Length == 1 &&
- GetValueFromPath(selection.GetSelectedRows()[0]) is Category)
- return false;
- return !(GetValueFromPath(path) is Category);
+ if(!selected && selection.GetSelectedRows().Length > 0) {
+ if(selection.GetSelectedRows().Length == 1 &&
+ GetValueFromPath(selection.GetSelectedRows()[0]) is Category)
+ return false;
+ return !(GetValueFromPath(path) is Category);
}
// Always unselect
else
return true;
}
-
+
override protected void OnNameCellEdited(object o, Gtk.EditedArgs args)
{
base.OnNameCellEdited(o, args);
@@ -209,44 +209,44 @@ namespace LongoMatch.Gui.Component
}
override protected bool OnButtonPressEvent(EventButton evnt)
- {
+ {
TreePath[] paths = Selection.GetSelectedRows();
-
- if ((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
+
+ if((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
{
// We don't want to unselect the play when several
// plays are selected and we clik the right button
// For multiedition
- if (paths.Length <= 1){
+ if(paths.Length <= 1) {
base.OnButtonPressEvent(evnt);
paths = Selection.GetSelectedRows();
}
-
- if (paths.Length == 1) {
+
+ if(paths.Length == 1) {
TimeNode selectedTimeNode = GetValueFromPath(paths[0]) as TimeNode;
- if (selectedTimeNode is Play) {
+ if(selectedTimeNode is Play) {
deleteKeyFrame.Sensitive = (selectedTimeNode as Play).HasDrawings;
MultiSelectMenu(false);
menu.Popup();
}
- else{
+ else {
SetupSortMenu((selectedTimeNode as Category).SortMethod);
categoriesMenu.Popup();
}
}
- else if (paths.Length > 1){
+ else if(paths.Length > 1) {
MultiSelectMenu(true);
- menu.Popup();
+ menu.Popup();
}
}
- else
+ else
base.OnButtonPressEvent(evnt);
return true;
}
-
- protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
+
+ protected override bool OnKeyPressEvent(Gdk.EventKey evnt)
{
return false;
- }
+ }
}
}
diff --git a/LongoMatch/Gui/TreeView/TagsTreeView.cs b/LongoMatch/Gui/TreeView/TagsTreeView.cs
index dfdcd02..9d5d0d1 100644
--- a/LongoMatch/Gui/TreeView/TagsTreeView.cs
+++ b/LongoMatch/Gui/TreeView/TagsTreeView.cs
@@ -31,47 +31,47 @@ namespace LongoMatch.Gui.Component
public class TagsTreeView : ListTreeViewBase
{
- public TagsTreeView() {
+ public TagsTreeView() {
tag.Visible = false;
players.Visible = false;
delete.Visible = false;
}
override protected bool OnButtonPressEvent(EventButton evnt)
- {
+ {
TreePath[] paths = Selection.GetSelectedRows();
-
- if ((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
+
+ if((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
{
// We don't want to unselect the play when several
// plays are selected and we clik the right button
// For multiedition
- if (paths.Length <= 1){
+ if(paths.Length <= 1) {
base.OnButtonPressEvent(evnt);
paths = Selection.GetSelectedRows();
}
-
- if (paths.Length == 1) {
+
+ if(paths.Length == 1) {
Play selectedTimeNode = GetValueFromPath(paths[0]) as Play;
deleteKeyFrame.Sensitive = selectedTimeNode.KeyFrameDrawing != null;
MultiSelectMenu(false);
menu.Popup();
}
- else if (paths.Length > 1){
+ else if(paths.Length > 1) {
MultiSelectMenu(true);
- menu.Popup();
+ menu.Popup();
}
}
- else
+ else
base.OnButtonPressEvent(evnt);
return true;
- }
-
- override protected bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected){
+ }
+
+ override protected bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected) {
return true;
}
-
- override protected bool OnKeyPressEvent (Gdk.EventKey evnt)
+
+ override protected bool OnKeyPressEvent(Gdk.EventKey evnt)
{
return false;
}
diff --git a/LongoMatch/Handlers/DrawingManager.cs b/LongoMatch/Handlers/DrawingManager.cs
index 1bcc117..c6bacab 100644
--- a/LongoMatch/Handlers/DrawingManager.cs
+++ b/LongoMatch/Handlers/DrawingManager.cs
@@ -46,15 +46,15 @@ namespace LongoMatch.Handlers
public void OnKeyPressEvent(object o, Gtk.KeyPressEventArgs args)
{
- if (!toolBox.Visible)
+ if(!toolBox.Visible)
return;
- if (args.Event.Key== Gdk.Key.d) {
+ if(args.Event.Key== Gdk.Key.d) {
drawingArea.ToggleGrab();
}
- else if (args.Event.Key== Gdk.Key.c) {
+ else if(args.Event.Key== Gdk.Key.c) {
drawingArea.Clear();
}
- else if (args.Event.Key== Gdk.Key.s) {
+ else if(args.Event.Key== Gdk.Key.s) {
drawingArea.ToggleVisibility();
}
}
@@ -69,7 +69,7 @@ namespace LongoMatch.Handlers
protected virtual void OnVisibilityChanged(bool visible) {
drawingArea.Visible = visible;
- if (!visible)
+ if(!visible)
drawingArea.Clear();
}
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index ad72e6f..a77a8c4 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -60,9 +60,9 @@ namespace LongoMatch
private ProjectType projectType;
private Time startTime;
- public EventsManager(PlaysListTreeWidget treewidget, PlayersListTreeWidget localPlayersList,
+ public EventsManager(PlaysListTreeWidget treewidget, PlayersListTreeWidget localPlayersList,
PlayersListTreeWidget visitorPlayersList, TagsTreeWidget tagsTreeWidget,
- ButtonsWidget buttonswidget, PlayListWidget playlist, PlayerBin player,
+ ButtonsWidget buttonswidget, PlayListWidget playlist, PlayerBin player,
TimeLineWidget timeline, ProgressBar videoprogressbar,NotesWidget notes,
CapturerBin capturer)
{
@@ -87,8 +87,8 @@ namespace LongoMatch
openedProject = value;
}
}
-
- public ProjectType OpenedProjectType{
+
+ public ProjectType OpenedProjectType {
set {
projectType = value;
}
@@ -101,7 +101,7 @@ namespace LongoMatch
buttonswidget.NewMarkEvent += OnNewMark;
buttonswidget.NewMarkStartEvent += OnNewMarkStart;
buttonswidget.NewMarkStopEvent += OnNewMarkStop;
-
+
/* Connect TimeNodeChanged events */
treewidget.TimeNodeChanged += OnTimeNodeChanged;
localPlayersList.TimeNodeChanged += OnTimeNodeChanged;
@@ -135,7 +135,7 @@ namespace LongoMatch
/* Connect tags events */
treewidget.PlayersTagged += OnPlayersTagged;
treewidget.TagPlay += OnTagPlay;
-
+
/* Connect SnapshotSeries events */
treewidget.SnapshotSeriesEvent += OnSnapshotSeries;
localPlayersList.SnapshotSeriesEvent += OnSnapshotSeries;
@@ -144,7 +144,7 @@ namespace LongoMatch
/* Connect timeline events */
timeline.NewMarkEvent += OnNewMarkAtFrame;
-
+
/* Connect player events */
player.Prev += OnPrev;
player.Next += OnNext;
@@ -154,11 +154,11 @@ namespace LongoMatch
}
private void ProcessNewMarkEvent(Category category,Time pos) {
- Time length, startTime, stopTime, start, stop, fStart, fStop;
-
- if (player == null || openedProject == null)
+ Time length, startTime, stopTime, start, stop, fStart, fStop;
+
+ if(player == null || openedProject == null)
return;
-
+
//Get the default lead and lag time for the section
startTime = category.Start;
stopTime = category.Stop;
@@ -166,33 +166,33 @@ namespace LongoMatch
start = pos - startTime;
stop = pos + stopTime;
fStart = (start < new Time {MSeconds =0}) ? new Time {MSeconds = 0} : start;
-
- if (projectType == ProjectType.FakeCaptureProject ||
- projectType == ProjectType.CaptureProject){
- fStop = stop;
+
+ if(projectType == ProjectType.FakeCaptureProject ||
+ projectType == ProjectType.CaptureProject) {
+ fStop = stop;
}
else {
length = new Time {MSeconds = (int)player.StreamLength};
fStop = (stop > length) ? length: stop;
- }
+ }
AddNewPlay(fStart, fStop, category);
}
-
- private void AddNewPlay(Time start, Time stop, Category category){
+
+ private void AddNewPlay(Time start, Time stop, Category category) {
Pixbuf miniature;
-
- if (projectType == ProjectType.CaptureProject){
- if (!capturer.Capturing){
+
+ if(projectType == ProjectType.CaptureProject) {
+ if(!capturer.Capturing) {
MessagePopup.PopupMessage(capturer, MessageType.Info,
Catalog.GetString("You can't create a new play if the capturer "+
- "is not recording."));
+ "is not recording."));
return;
}
miniature = capturer.CurrentMiniatureFrame;
}
- else if (projectType == ProjectType.FileProject)
+ else if(projectType == ProjectType.FileProject)
miniature = player.CurrentMiniatureFrame;
- else
+ else
miniature = null;
var play = openedProject.AddPlay(category, start, stop,miniature);
treewidget.AddPlay(play);
@@ -203,26 +203,26 @@ namespace LongoMatch
protected virtual void OnProgress(float progress) {
- if (progress > (float)EditorState.START && progress <= (float)EditorState.FINISHED && progress > videoprogressbar.Fraction) {
+ if(progress > (float)EditorState.START && progress <= (float)EditorState.FINISHED && progress > videoprogressbar.Fraction) {
videoprogressbar.Fraction = progress;
}
- if (progress == (float)EditorState.CANCELED) {
+ if(progress == (float)EditorState.CANCELED) {
videoprogressbar.Hide();
}
- else if (progress == (float)EditorState.START) {
+ else if(progress == (float)EditorState.START) {
videoprogressbar.Show();
videoprogressbar.Fraction = 0;
videoprogressbar.Text = "Creating new video";
}
- else if (progress == (float)EditorState.FINISHED) {
+ else if(progress == (float)EditorState.FINISHED) {
MessagePopup.PopupMessage(player, MessageType.Info, Catalog.GetString("The video edition has finished successfully."));
videoprogressbar.Hide();
}
- else if (progress == (float)EditorState.ERROR) {
+ else if(progress == (float)EditorState.ERROR) {
MessagePopup.PopupMessage(player, MessageType.Error,
Catalog.GetString("An error has occurred in the video editor.")
+Catalog.GetString("Please, try again."));
@@ -231,47 +231,47 @@ namespace LongoMatch
}
protected virtual void OnNewMarkAtFrame(Category category, int frame) {
- Time pos = new Time{ MSeconds = frame*1000/openedProject.Description.File.Fps};
+ Time pos = new Time { MSeconds = frame*1000/openedProject.Description.File.Fps};
player.CloseActualSegment();
- player.SeekTo ((long)pos.MSeconds, true);
+ player.SeekTo((long)pos.MSeconds, true);
ProcessNewMarkEvent(category,pos);
}
public virtual void OnNewMark(Category category) {
Time pos;
-
- if (projectType == ProjectType.FakeCaptureProject ||
- projectType == ProjectType.CaptureProject)
+
+ if(projectType == ProjectType.FakeCaptureProject ||
+ projectType == ProjectType.CaptureProject)
pos = new Time { MSeconds = (int)capturer.CurrentTime};
- else
+ else
pos = new Time {MSeconds = (int)player.CurrentTime};
ProcessNewMarkEvent(category,pos);
}
-
- public virtual void OnNewMarkStart(){
+
+ public virtual void OnNewMarkStart() {
startTime = new Time {MSeconds = (int)player.CurrentTime};
}
-
- public virtual void OnNewMarkStop(Category category){
+
+ public virtual void OnNewMarkStop(Category category) {
int diff;
Time stopTime = new Time {MSeconds = (int)player.CurrentTime};
-
+
diff = stopTime.MSeconds - startTime.MSeconds;
-
- if (diff < 0){
+
+ if(diff < 0) {
MessagePopup.PopupMessage(buttonswidget, MessageType.Warning,
Catalog.GetString("The stop time is smaller than the start time. "+
- "The play will not be added."));
+ "The play will not be added."));
return;
}
- if (diff < 500){
+ if(diff < 500) {
int correction = 500 - diff;
- if (startTime.MSeconds - correction > 0)
+ if(startTime.MSeconds - correction > 0)
startTime = startTime - correction;
- else
- stopTime = stopTime + correction;
- }
- AddNewPlay(startTime, stopTime, category);
+ else
+ stopTime = stopTime + correction;
+ }
+ AddNewPlay(startTime, stopTime, category);
}
protected virtual void OnTimeNodeSelected(Play tNode)
@@ -289,18 +289,18 @@ namespace LongoMatch
//Si hemos modificado el valor de un nodo de tiempo a trav..s del
//widget de ajuste de tiempo posicionamos el reproductor en el punto
//
- if (tNode is Play && val is Time) {
- if (tNode != selectedTimeNode)
+ if(tNode is Play && val is Time) {
+ if(tNode != selectedTimeNode)
OnTimeNodeSelected((Play)tNode);
Time pos = (Time)val;
- if (pos == tNode.Start) {
+ if(pos == tNode.Start) {
player.UpdateSegmentStartTime(pos.MSeconds);
}
else {
player.UpdateSegmentStopTime(pos.MSeconds);
}
}
- else if (tNode is Category) {
+ else if(tNode is Category) {
buttonswidget.Categories = openedProject.Categories;
}
}
@@ -315,16 +315,16 @@ namespace LongoMatch
visitorPlayersList.RemovePlays(plays);
openedProject.RemovePlays(plays);
- if (projectType == ProjectType.FileProject){
+ if(projectType == ProjectType.FileProject) {
this.player.CloseActualSegment();
MainClass.DB.UpdateProject(openedProject);
}
- timeline.QueueDraw();
+ timeline.QueueDraw();
}
protected virtual void OnPlayListNodeAdded(Play play)
{
- playlist.Add(new PlayListPlay{
+ playlist.Add(new PlayListPlay {
MediaFile = openedProject.Description.File,
Start = play.Start,
Stop = play.Stop,
@@ -335,8 +335,8 @@ namespace LongoMatch
protected virtual void OnPlayListNodeSelected(PlayListPlay plNode, bool hasNext)
{
- if (openedProject == null) {
- if (plNode.Valid) {
+ if(openedProject == null) {
+ if(plNode.Valid) {
player.SetPlayListElement(plNode.MediaFile.FilePath,plNode.Start.MSeconds,plNode.Stop.MSeconds,plNode.Rate,hasNext);
selectedTimeNode = plNode;
}
@@ -372,7 +372,7 @@ namespace LongoMatch
sd.TransientFor= (Gtk.Window) treewidget.Toplevel;
sd.Play = tNode.Name;
- if (sd.Run() == (int)ResponseType.Ok) {
+ if(sd.Run() == (int)ResponseType.Ok) {
sd.Destroy();
interval = sd.Interval;
seriesName = sd.SeriesName;
@@ -396,18 +396,18 @@ namespace LongoMatch
protected virtual void OnPrev()
{
- if (selectedTimeNode is Play)
+ if(selectedTimeNode is Play)
player.SeekInSegment(selectedTimeNode.Start.MSeconds);
- else if (selectedTimeNode is PlayListPlay)
+ else if(selectedTimeNode is PlayListPlay)
playlist.Prev();
- else if (selectedTimeNode == null)
+ else if(selectedTimeNode == null)
player.SeekTo(0,false);
}
protected virtual void OnTick(object o, TickArgs args)
{
- if (args.CurrentTime != 0 && timeline != null && openedProject != null)
- timeline.CurrentFrame=(uint)(args.CurrentTime *
+ if(args.CurrentTime != 0 && timeline != null && openedProject != null)
+ timeline.CurrentFrame=(uint)(args.CurrentTime *
openedProject.Description.File.Fps / 1000);
}
@@ -425,12 +425,12 @@ namespace LongoMatch
DrawingTool dialog = new DrawingTool();
player.SeekTo(time,true);
- while (pixbuf == null)
+ while(pixbuf == null)
pixbuf = player.CurrentFrame;
dialog.Image = pixbuf;
dialog.TransientFor = (Gtk.Window)player.Toplevel;
- if (selectedTimeNode != null)
+ if(selectedTimeNode != null)
dialog.SetPlay((selectedTimeNode as Play),
time);
player.Pause();
@@ -438,8 +438,8 @@ namespace LongoMatch
dialog.Run();
dialog.Destroy();
}
-
- protected virtual void OnTagPlay(Play tNode){
+
+ protected virtual void OnTagPlay(Play tNode) {
/*TaggerDialog tagger = new TaggerDialog();
tagger.ProjectTags = openedProject.Tags;
tagger.Tags = tNode.Tags;
@@ -454,27 +454,27 @@ namespace LongoMatch
}
protected virtual void OnPlayersTagged(Play tNode, Team team) {
- /*
- PlayersSelectionDialog dialog = new PlayersSelectionDialog();
- if (team == Team.LOCAL) {
- dialog.SetPlayersInfo(openedProject.LocalTeamTemplate);
- dialog.PlayersChecked = tNode.LocalPlayers;
- if (dialog.Run() == (int) ResponseType.Ok) {
- tNode.LocalPlayers = dialog.PlayersChecked;
- localPlayersList.UpdatePlaysList(openedProject.GetLocalTeamModel());
+ /*
+ PlayersSelectionDialog dialog = new PlayersSelectionDialog();
+ if (team == Team.LOCAL) {
+ dialog.SetPlayersInfo(openedProject.LocalTeamTemplate);
+ dialog.PlayersChecked = tNode.LocalPlayers;
+ if (dialog.Run() == (int) ResponseType.Ok) {
+ tNode.LocalPlayers = dialog.PlayersChecked;
+ localPlayersList.UpdatePlaysList(openedProject.GetLocalTeamModel());
+ }
}
- }
- else if (team == Team.VISITOR) {
- dialog.SetPlayersInfo(openedProject.VisitorTeamTemplate);
- dialog.PlayersChecked = tNode.VisitorPlayers;
- if (dialog.Run() == (int) ResponseType.Ok) {
- tNode.VisitorPlayers = dialog.PlayersChecked;
- visitorPlayersList.UpdatePlaysList(openedProject.GetVisitorTeamModel());
+ else if (team == Team.VISITOR) {
+ dialog.SetPlayersInfo(openedProject.VisitorTeamTemplate);
+ dialog.PlayersChecked = tNode.VisitorPlayers;
+ if (dialog.Run() == (int) ResponseType.Ok) {
+ tNode.VisitorPlayers = dialog.PlayersChecked;
+ visitorPlayersList.UpdatePlaysList(openedProject.GetVisitorTeamModel());
+ }
}
- }
- dialog.Destroy();
- */
+ dialog.Destroy();
+ */
}
}
}
diff --git a/LongoMatch/Handlers/Handlers.cs b/LongoMatch/Handlers/Handlers.cs
index 6d9f586..bbf0f3b 100644
--- a/LongoMatch/Handlers/Handlers.cs
+++ b/LongoMatch/Handlers/Handlers.cs
@@ -82,9 +82,9 @@ namespace LongoMatch.Handlers
//A new version of the software exists
public delegate void NewVersionHandler(Version version, string URL);
-
+
public delegate void CategoryHandler(Category category);
public delegate void CategoriesHandler(List<Category> categoriesList);
-
+
public delegate void ProjectsSelectedHandler(List<ProjectDescription> projects);
}
diff --git a/LongoMatch/Handlers/HotKeysManager.cs b/LongoMatch/Handlers/HotKeysManager.cs
index 236ce9f..2a57cf5 100644
--- a/LongoMatch/Handlers/HotKeysManager.cs
+++ b/LongoMatch/Handlers/HotKeysManager.cs
@@ -42,10 +42,10 @@ namespace LongoMatch.Handlers
public Categories Categories {
set {
dic.Clear();
- if (value == null)
+ if(value == null)
return;
- foreach (Category cat in value) {
- if (cat.HotKey.Defined &&
+ foreach(Category cat in value) {
+ if(cat.HotKey.Defined &&
!dic.ContainsKey(cat.HotKey))
dic.Add(cat.HotKey, cat);
}
@@ -57,11 +57,11 @@ namespace LongoMatch.Handlers
public void KeyListener(object sender, KeyPressEventArgs args) {
Category cat = null;
HotKey hotkey = new HotKey();
-
+
hotkey.Key=args.Event.Key;
hotkey.Modifier=args.Event.State & (ModifierType.Mod1Mask | ModifierType.Mod5Mask | ModifierType.ShiftMask);
- if (dic.TryGetValue(hotkey, out cat)) {
- if (newMarkEvent != null) {
+ if(dic.TryGetValue(hotkey, out cat)) {
+ if(newMarkEvent != null) {
newMarkEvent(cat);
}
}
diff --git a/LongoMatch/Handlers/VideoDrawingsManager.cs b/LongoMatch/Handlers/VideoDrawingsManager.cs
index 1f5be03..78497d1 100644
--- a/LongoMatch/Handlers/VideoDrawingsManager.cs
+++ b/LongoMatch/Handlers/VideoDrawingsManager.cs
@@ -66,12 +66,12 @@ namespace LongoMatch.Handlers
}
private void StartClock() {
- if (timeout ==0)
+ if(timeout ==0)
timeout = GLib.Timeout.Add(20,CheckStopTime);
}
private void StopClock() {
- if (timeout != 0) {
+ if(timeout != 0) {
GLib.Source.Remove(timeout);
timeout = 0;
}
@@ -99,7 +99,7 @@ namespace LongoMatch.Handlers
player.Pause();
player.SeekInSegment(Drawing.RenderTime);
- while (frame == null)
+ while(frame == null)
frame = player.CurrentFrame;
player.LogoPixbuf = frame;
drawing = Drawing.Pixbuf;
@@ -120,9 +120,9 @@ namespace LongoMatch.Handlers
private bool CheckStopTime() {
int currentTime = (int)player.AccurateCurrentTime;
- if (Drawing == null || !canStop)
+ if(Drawing == null || !canStop)
return true;
- if ((currentTime)>NextStopTime()) {
+ if((currentTime)>NextStopTime()) {
StopClock();
PrintDrawing();
}
@@ -132,21 +132,21 @@ namespace LongoMatch.Handlers
protected virtual void OnStateChanged(object sender, StateChangeArgs args) {
//Check if we are currently paused displaying the key frame waiting for the user to
//go in to Play. If so we can stop
- if (inKeyFrame) {
+ if(inKeyFrame) {
ResetPlayerWindow();
inKeyFrame = false;
}
}
protected virtual void OnSeekEvent(long time) {
- if (Drawing == null)
+ if(Drawing == null)
return;
- if (inKeyFrame) {
+ if(inKeyFrame) {
ResetPlayerWindow();
inKeyFrame = false;
}
canStop = time < Drawing.RenderTime;
- if (canStop)
+ if(canStop)
StartClock();
else StopClock();
}
diff --git a/LongoMatch/IO/CSVExport.cs b/LongoMatch/IO/CSVExport.cs
index 6856c67..42a57ea 100644
--- a/LongoMatch/IO/CSVExport.cs
+++ b/LongoMatch/IO/CSVExport.cs
@@ -59,21 +59,21 @@ namespace LongoMatch.IO
tx = new StreamWriter(outputFile);
list = project.GetDataArray();
sectionNames = project.GetSectionsNames();
-
+
tagsDic = new Dictionary<Tag, List<Play>>();
foreach (Tag tag in project.Tags)
tagsDic.Add(tag, new List<Play>());
-
+
localPlayersList = project.LocalTeamTemplate.GetPlayersList();
localPlayersDic = new Dictionary<Player, List<object[]>>();
foreach (Player player in localPlayersList)
localPlayersDic.Add(player, new List<object[]>());
-
+
visitorPlayersList = project.VisitorTeamTemplate.GetPlayersList();
visitorPlayersDic = new Dictionary<Player, List<object[]>>();
foreach (Player player in visitorPlayersList)
visitorPlayersDic.Add(player, new List<object[]>());
-
+
// Write catagories table
tx.WriteLine(String.Format("{0};{1};{2};{3};{4};{5}",
@@ -89,21 +89,21 @@ namespace LongoMatch.IO
// Parse Play's tags
foreach (Tag t in tn.Tags)
tagsDic[t].Add(tn);
-
+
// Parse Players data
foreach (int playerNumber in tn.LocalPlayers){
object[] o = new object[2];
o[0] = sectionName;
o[1] = tn;
localPlayersDic[localPlayersList[playerNumber]].Add(o);
- }
+ }
foreach (int playerNumber in tn.VisitorPlayers){
object[] o = new object[2];
o[0] = sectionName;
o[1] = tn;
visitorPlayersDic[visitorPlayersList[playerNumber]].Add(o);
}
-
+
tx.WriteLine("\""+sectionName+"\";\""+
tn.Name+"\";\""+
tn.Team+"\";\""+
@@ -113,46 +113,46 @@ namespace LongoMatch.IO
}
}
tx.WriteLine();
- tx.WriteLine();
-
+ tx.WriteLine();
+
WriteCatagoriesData(tx, tagsDic);
-
+
// Write local players data
WritePlayersData(tx, localPlayersDic);
WritePlayersData(tx, visitorPlayersDic);
-
+
tx.Close();
-
- MessagePopup.PopupMessage(null, MessageType.Info, Catalog.GetString("CSV exported successfully.")); */
+
+ MessagePopup.PopupMessage(null, MessageType.Info, Catalog.GetString("CSV exported successfully.")); */
}
#endregion
-
+
#region Private Methods
-
- private void WriteCatagoriesData(TextWriter tx, Dictionary<Tag, List<Play>> tagsDic){
+
+ private void WriteCatagoriesData(TextWriter tx, Dictionary<Tag, List<Play>> tagsDic) {
// Write Tags table
tx.WriteLine(String.Format("{0};{1};{2};{3};{4}",
- Catalog.GetString("Tag"),
- Catalog.GetString("Name"),
- Catalog.GetString("StartTime"),
- Catalog.GetString("StopTime"),
- Catalog.GetString("Duration")));
- foreach (KeyValuePair<Tag,List<Play>> pair in tagsDic){
- if (pair.Value.Count == 0)
- continue;
- foreach (Play tn in pair.Value) {
+ Catalog.GetString("Tag"),
+ Catalog.GetString("Name"),
+ Catalog.GetString("StartTime"),
+ Catalog.GetString("StopTime"),
+ Catalog.GetString("Duration")));
+ foreach(KeyValuePair<Tag,List<Play>> pair in tagsDic) {
+ if(pair.Value.Count == 0)
+ continue;
+ foreach(Play tn in pair.Value) {
tx.WriteLine("\""+pair.Key.Value+"\";\""+
tn.Name+"\";\""+
tn.Start.ToMSecondsString()+"\";\""+
tn.Stop.ToMSecondsString()+"\";\""+
(tn.Stop-tn.Start).ToMSecondsString()+"\"");
- }
+ }
}
tx.WriteLine();
- tx.WriteLine();
+ tx.WriteLine();
}
-
- private void WritePlayersData(TextWriter tx, Dictionary<Player, List<object[]>> playersDic){
+
+ private void WritePlayersData(TextWriter tx, Dictionary<Player, List<object[]>> playersDic) {
// Write Tags table
tx.WriteLine(String.Format("{0};{1};{2};{3};{4};{5};{6}",
Catalog.GetString("Player"),
@@ -162,10 +162,10 @@ namespace LongoMatch.IO
Catalog.GetString("StartTime"),
Catalog.GetString("StopTime"),
Catalog.GetString("Duration")));
- foreach (KeyValuePair<Player,List<object[]>> pair in playersDic){
- if (pair.Value.Count == 0)
- continue;
- foreach (object[] o in pair.Value) {
+ foreach(KeyValuePair<Player,List<object[]>> pair in playersDic) {
+ if(pair.Value.Count == 0)
+ continue;
+ foreach(object[] o in pair.Value) {
string sectionName = (string)o[0];
Play tn = (Play)o[1];
tx.WriteLine("\""+pair.Key.Name+"\";\""+
@@ -174,10 +174,10 @@ namespace LongoMatch.IO
tn.Start.ToMSecondsString()+"\";\""+
tn.Stop.ToMSecondsString()+"\";\""+
(tn.Stop-tn.Start).ToMSecondsString()+"\"");
- }
+ }
}
tx.WriteLine();
- tx.WriteLine();
+ tx.WriteLine();
}
#endregion
}
diff --git a/LongoMatch/IO/XMLReader.cs b/LongoMatch/IO/XMLReader.cs
index fd5ab4e..1aefc4b 100644
--- a/LongoMatch/IO/XMLReader.cs
+++ b/LongoMatch/IO/XMLReader.cs
@@ -34,7 +34,7 @@ namespace LongoMatch.IO
public XMLReader(string filePath)
{
configXml = new XmlDocument();
- if (!File.Exists(filePath)) {
+ if(!File.Exists(filePath)) {
//manejar el error!!!
}
@@ -47,7 +47,7 @@ namespace LongoMatch.IO
{
XmlNode n;
n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
- if (n!=null)
+ if(n!=null)
return (string)(n.Attributes["value"].Value);
else return null;
}
@@ -56,7 +56,7 @@ namespace LongoMatch.IO
{
XmlNode n;
n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
- if (n != null) {
+ if(n != null) {
object result = n.Attributes["value"].Value;
return int.Parse(result.ToString());
}
@@ -67,7 +67,7 @@ namespace LongoMatch.IO
XmlNode n;
n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
- if (n != null) {
+ if(n != null) {
object result = n.Attributes["value"].Value;
return bool.Parse(result.ToString());
@@ -77,7 +77,7 @@ namespace LongoMatch.IO
public ushort GetUShortValue(string section, string clave) {
XmlNode n;
n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
- if (n != null) {
+ if(n != null) {
object result = n.Attributes["value"].Value;
return ushort.Parse(result.ToString());
}
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 14d2f46..3ce9fb2 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -44,7 +44,7 @@ namespace LongoMatch
public static void Main(string[] args)
{
Log.Debugging = Debugging;
-
+
Log.Information("Starting " + Constants.SOFTWARE_NAME);
//Configuramos el directorio base de la ejecucui..n y el directorio HOME
baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"../../");
@@ -52,8 +52,8 @@ namespace LongoMatch
configDirectory = System.IO.Path.Combine(homeDirectory,".longomatch");
homeDirectory = System.IO.Path.Combine(homeDirectory,Constants.SOFTWARE_NAME);
-
- if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
+
+ if(Environment.OSVersion.Platform == PlatformID.Win32NT) {
SetUpWin32Config();
}
@@ -81,7 +81,7 @@ namespace LongoMatch
MainWindow win = new MainWindow();
win.Show();
Application.Run();
- } catch (Exception ex) {
+ } catch(Exception ex) {
ProcessExecutionError(ex);
}
}
@@ -123,32 +123,32 @@ namespace LongoMatch
}
public static void CheckDirs() {
- if (!System.IO.Directory.Exists(homeDirectory))
+ if(!System.IO.Directory.Exists(homeDirectory))
System.IO.Directory.CreateDirectory(homeDirectory);
- if (!System.IO.Directory.Exists(TemplatesDir()))
+ if(!System.IO.Directory.Exists(TemplatesDir()))
System.IO.Directory.CreateDirectory(TemplatesDir());
- if (!System.IO.Directory.Exists(SnapshotsDir()))
+ if(!System.IO.Directory.Exists(SnapshotsDir()))
System.IO.Directory.CreateDirectory(SnapshotsDir());
- if (!System.IO.Directory.Exists(PlayListDir()))
+ if(!System.IO.Directory.Exists(PlayListDir()))
System.IO.Directory.CreateDirectory(PlayListDir());
- if (!System.IO.Directory.Exists(DBDir()))
+ if(!System.IO.Directory.Exists(DBDir()))
System.IO.Directory.CreateDirectory(DBDir());
- if (!System.IO.Directory.Exists(VideosDir()))
+ if(!System.IO.Directory.Exists(VideosDir()))
System.IO.Directory.CreateDirectory(VideosDir());
- if (!System.IO.Directory.Exists(TempVideosDir()))
+ if(!System.IO.Directory.Exists(TempVideosDir()))
System.IO.Directory.CreateDirectory(TempVideosDir());
}
public static void CheckFiles() {
string fConfig;
fConfig = System.IO.Path.Combine(TemplatesDir(),"default.sct");
- if (!System.IO.File.Exists(fConfig)) {
+ if(!System.IO.File.Exists(fConfig)) {
Categories cat = Categories.DefaultTemplate();
cat.Save("default.sct");
}
fConfig = System.IO.Path.Combine(TemplatesDir(),"default.tem");
- if (!System.IO.File.Exists(fConfig)) {
+ if(!System.IO.File.Exists(fConfig)) {
TeamTemplate tt = TeamTemplate.DefaultTemplate(20);
tt.Save(fConfig);
}
@@ -158,7 +158,7 @@ namespace LongoMatch
string oldDBFile= System.IO.Path.Combine(homeDirectory, "db/db.yap");
//We supose that if the conversion as already be done successfully,
//old DB file has been renamed to db.yap.bak
- if (File.Exists(oldDBFile)) {
+ if(File.Exists(oldDBFile)) {
MessageDialog md = new MessageDialog(null,
DialogFlags.Modal,
MessageType.Question,
@@ -166,7 +166,7 @@ namespace LongoMatch
Catalog.GetString("Some elements from the previous version (database, templates and/or playlists) have been found.")+"\n"+
Catalog.GetString("Do you want to import them?"));
md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
- if (md.Run()==(int)ResponseType.Yes) {
+ if(md.Run()==(int)ResponseType.Yes) {
md.Destroy();
//Migrator migrator = new Migrator(homeDirectory);
//migrator.Run();
@@ -182,12 +182,12 @@ namespace LongoMatch
return db;
}
}
-
- private static bool? debugging = null;
+
+ private static bool? debugging = null;
public static bool Debugging {
get {
- if (debugging == null) {
- debugging = EnvironmentIsSet ("LGM_DEBUG");
+ if(debugging == null) {
+ debugging = EnvironmentIsSet("LGM_DEBUG");
}
return debugging.Value;
}
@@ -196,12 +196,12 @@ namespace LongoMatch
Log.Debugging = Debugging;
}
}
-
- public static bool EnvironmentIsSet (string env)
+
+ public static bool EnvironmentIsSet(string env)
{
- return !String.IsNullOrEmpty (Environment.GetEnvironmentVariable (env));
+ return !String.IsNullOrEmpty(Environment.GetEnvironmentVariable(env));
}
-
+
private static void SetUpWin32Config() {
Environment.SetEnvironmentVariable("GST_PLUGIN_PATH",RelativeToPrefix("lib\\gstreamer-0.10"));
baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"../");
@@ -210,7 +210,7 @@ namespace LongoMatch
StreamReader reader = new StreamReader(System.IO.Path.Combine(homeDirectory,WIN32_CONFIG_FILE));
homeDirectory = reader.ReadLine();
configDirectory = homeDirectory;
- if (!System.IO.Directory.Exists(homeDirectory))
+ if(!System.IO.Directory.Exists(homeDirectory))
System.IO.Directory.CreateDirectory(homeDirectory);
reader.Close();
}
@@ -236,7 +236,7 @@ namespace LongoMatch
logFile = logFile.Replace(":","-");
logFile = System.IO.Path.Combine(HomeDir(),logFile);
- if (ex.InnerException != null)
+ if(ex.InnerException != null)
message = String.Format("{0}\n{1}\n{2}\n{3}\n{4}",ex.Message,ex.InnerException.Message,ex.Source,ex.StackTrace,ex.InnerException.StackTrace);
else
message = String.Format("{0}\n{1}\n{2}",ex.Message,ex.Source,ex.StackTrace);
@@ -246,7 +246,7 @@ namespace LongoMatch
s.WriteLine("\n\n\nStackTrace:");
s.WriteLine(System.Environment.StackTrace);
}
- Log.Exception (ex);
+ Log.Exception(ex);
//TODO Add bug reports link
MessagePopup.PopupMessage(null, MessageType.Error,
Catalog.GetString("The application has finished with an unexpected error.")+"\n"+
diff --git a/LongoMatch/Playlist/IPlayList.cs b/LongoMatch/Playlist/IPlayList.cs
index 09336ef..8ba44ba 100644
--- a/LongoMatch/Playlist/IPlayList.cs
+++ b/LongoMatch/Playlist/IPlayList.cs
@@ -30,27 +30,27 @@ namespace LongoMatch.Playlist {
int Count {
get;
}
-
+
void Save(string path);
-
+
void Add(PlayListPlay play);
-
+
void Remove(PlayListPlay play);
-
+
PlayListPlay Next();
-
+
PlayListPlay Prev();
-
+
PlayListPlay Select(int index);
-
+
int GetCurrentIndex();
-
+
bool HasNext();
-
+
bool HasPrev();
-
+
ListStore GetModel();
-
+
IPlayList Copy();
}
}
diff --git a/LongoMatch/Playlist/PlayList.cs b/LongoMatch/Playlist/PlayList.cs
index cbeea59..d414618 100644
--- a/LongoMatch/Playlist/PlayList.cs
+++ b/LongoMatch/Playlist/PlayList.cs
@@ -49,7 +49,7 @@ namespace LongoMatch.Playlist
public PlayList(string file)
{
//For new Play List
- if (!System.IO.File.Exists(file)) {
+ if(!System.IO.File.Exists(file)) {
list = new List<PlayListPlay>();
filename = file;
}
@@ -82,18 +82,18 @@ namespace LongoMatch.Playlist
#endregion
#region Public methods
- public void Save(){
+ public void Save() {
Save(File);
}
- public void Save(string filePath){
+ public void Save(string filePath) {
Save(this, filePath);
}
-
+
public static PlayList Load(string filePath) {
return Load<PlayList>(filePath);
}
-
+
public bool isLoaded() {
return filename != null;
}
@@ -103,13 +103,13 @@ namespace LongoMatch.Playlist
}
public PlayListPlay Next() {
- if (HasNext())
+ if(HasNext())
indexSelection++;
return list[indexSelection];
}
public PlayListPlay Prev() {
- if (HasPrev())
+ if(HasPrev())
indexSelection--;
return list[indexSelection];
}
@@ -121,7 +121,7 @@ namespace LongoMatch.Playlist
public void Remove(PlayListPlay plNode) {
list.Remove(plNode);
- if (GetCurrentIndex() >= list.Count)
+ if(GetCurrentIndex() >= list.Count)
indexSelection --;
}
@@ -140,7 +140,7 @@ namespace LongoMatch.Playlist
public ListStore GetModel() {
Gtk.ListStore listStore = new ListStore(typeof(PlayListPlay));
- foreach (PlayListPlay plNode in list) {
+ foreach(PlayListPlay plNode in list) {
listStore.AppendValues(plNode);
}
return listStore;
@@ -151,7 +151,7 @@ namespace LongoMatch.Playlist
listStore.GetIterFirst(out iter);
list.Clear();
- while (listStore.IterIsValid(iter)) {
+ while(listStore.IterIsValid(iter)) {
list.Add(listStore.GetValue(iter, 0) as PlayListPlay);
listStore.IterNext(ref iter);
}
diff --git a/LongoMatch/Store/Category.cs b/LongoMatch/Store/Category.cs
index e479ff1..60a683d 100644
--- a/LongoMatch/Store/Category.cs
+++ b/LongoMatch/Store/Category.cs
@@ -35,22 +35,22 @@ namespace LongoMatch.Store
[Serializable]
public class Category:TimeNode, ISerializable
{
-
+
private Guid _UUID;
-
+
#region Constructors
#endregion
- public Category (){
+ public Category() {
_UUID = System.Guid.NewGuid();
SubCategories = new List<SubCategory>();
}
-
+
#region Properties
-
+
/// <summary>
- /// Unique ID for this category
+ /// Unique ID for this category
/// </summary>
- public Guid UUID{
+ public Guid UUID {
get {
return _UUID;
}
@@ -71,58 +71,58 @@ namespace LongoMatch.Store
get;
set;
}
-
+
//// <summary>
- /// Sort method used to sort plays for this category
+ /// Sort method used to sort plays for this category
/// </summary>
- public SortMethodType SortMethod{
+ public SortMethodType SortMethod {
get;
set;
}
-
+
/// <summary>
- /// Position of the category in the list of categories
+ /// Position of the category in the list of categories
/// </summary>
- public int Position{
+ public int Position {
get;
set;
}
-
+
public List<SubCategory> SubCategories {
get;
set;
}
-
+
/// <summary>
/// Sort method string used for the UI
/// </summary>
- public string SortMethodString{
- get{
- switch (SortMethod){
- case SortMethodType.SortByName:
- return Catalog.GetString("Sort by name");
- case SortMethodType.SortByStartTime:
- return Catalog.GetString("Sort by start time");
- case SortMethodType.SortByStopTime:
- return Catalog.GetString("Sort by stop time");
- case SortMethodType.SortByDuration:
- return Catalog.GetString("Sort by duration");
- default:
- return Catalog.GetString("Sort by name");
- }
+ public string SortMethodString {
+ get {
+ switch(SortMethod) {
+ case SortMethodType.SortByName:
+ return Catalog.GetString("Sort by name");
+ case SortMethodType.SortByStartTime:
+ return Catalog.GetString("Sort by start time");
+ case SortMethodType.SortByStopTime:
+ return Catalog.GetString("Sort by stop time");
+ case SortMethodType.SortByDuration:
+ return Catalog.GetString("Sort by duration");
+ default:
+ return Catalog.GetString("Sort by name");
+ }
}
- set{
- if (value == Catalog.GetString("Sort by start time"))
+ set {
+ if(value == Catalog.GetString("Sort by start time"))
SortMethod = SortMethodType.SortByStartTime;
- else if (value == Catalog.GetString("Sort by stop time"))
+ else if(value == Catalog.GetString("Sort by stop time"))
SortMethod = SortMethodType.SortByStopTime;
- else if (value == Catalog.GetString("Sort by duration"))
+ else if(value == Catalog.GetString("Sort by duration"))
SortMethod = SortMethodType.SortByDuration;
else
SortMethod = SortMethodType.SortByName;
}
}
-
+
// this constructor is automatically called during deserialization
public Category(SerializationInfo info, StreamingContext context) {
_UUID = (Guid)info.GetValue("uuid", typeof(Guid));
@@ -140,7 +140,7 @@ namespace LongoMatch.Store
c.Blue = (ushort)info.GetValue("blue", typeof(ushort));
Color = c;
}
-
+
// this method is automatically called during serialization
public void GetObjectData(SerializationInfo info, StreamingContext context) {
info.AddValue("uuid", UUID);
@@ -155,6 +155,6 @@ namespace LongoMatch.Store
info.AddValue("blue", Color.Blue);
info.AddValue("sort_method", SortMethod);
}
- #endregion
+ #endregion
}
}
diff --git a/LongoMatch/Store/Drawing.cs b/LongoMatch/Store/Drawing.cs
index c47126a..cae77a2 100644
--- a/LongoMatch/Store/Drawing.cs
+++ b/LongoMatch/Store/Drawing.cs
@@ -21,7 +21,7 @@ using Gdk;
namespace LongoMatch.Store
{
-
+
[Serializable]
public class Drawing
{
@@ -29,9 +29,9 @@ namespace LongoMatch.Store
/// <summary>
/// Represent a drawing in the database using a { Gdk Pixbuf} stored
- /// in a bytes array in PNG format for serialization. { Drawings}
- /// are used by { MediaTimeNodes} to store the key frame drawing
- /// which stop time is stored in a int value
+ /// in a bytes array in PNG format for serialization. { Drawings}
+ /// are used by { MediaTimeNodes} to store the key frame drawing
+ /// which stop time is stored in a int value
/// </summary>
public Drawing() {
}
@@ -41,18 +41,18 @@ namespace LongoMatch.Store
/// </summary>
public Pixbuf Pixbuf {
get {
- if (drawingBuf != null)
+ if(drawingBuf != null)
return new Pixbuf(drawingBuf);
else return null;
}
set {
- if (value != null)
+ if(value != null)
drawingBuf = value.SaveToBuffer("png");
else
drawingBuf = null;
}
}
-
+
/// <summary>
/// Render time of the drawing
/// </summary>
@@ -60,7 +60,7 @@ namespace LongoMatch.Store
get;
set;
}
-
+
/// <summary>
/// Time to pause the playback and display the drawing
/// </summary>
diff --git a/LongoMatch/Store/DrawingsList.cs b/LongoMatch/Store/DrawingsList.cs
index e95a874..d630608 100644
--- a/LongoMatch/Store/DrawingsList.cs
+++ b/LongoMatch/Store/DrawingsList.cs
@@ -27,25 +27,25 @@ namespace LongoMatch.Store
{
public DrawingsList() {}
-
+
/// <summary>
/// Adds a new drawing to the list
/// </summary>
/// <param name="drawing">
- /// The <see cref="Drawing"/> to add
+ /// The <see cref="Drawing"/> to add
/// </param>
/// <returns>
/// A <see cref="System.Boolean"/>: true if the frawing was added
/// </returns>
public bool Add(Drawing drawing) {
int renderTime = drawing.RenderTime;
- if (!ContainsKey(renderTime)) {
+ if(!ContainsKey(renderTime)) {
base.Add(renderTime,drawing);
return true;
}
else return false;
}
-
+
/// <summary>
/// Removes a drawing from the list
diff --git a/LongoMatch/Store/HotKey.cs b/LongoMatch/Store/HotKey.cs
index 43a416a..d3ff711 100644
--- a/LongoMatch/Store/HotKey.cs
+++ b/LongoMatch/Store/HotKey.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Store
/// <summary>
/// A key combination used to tag plays using the keyboard. <see cref="LongoMatch.Store.SectionsTimeNodes"/>
- /// It can only be used with the Shith and Alt modifiers to avoid interfering with ohter shortcuts.
+ /// It can only be used with the Shith and Alt modifiers to avoid interfering with ohter shortcuts.
/// 'key' and 'modifier' are set to -1 when it's initialized
/// </summary>
[Serializable]
@@ -106,7 +106,7 @@ namespace LongoMatch.Store
#region Overrides
public override bool Equals(object obj)
{
- if (obj is HotKey){
+ if(obj is HotKey) {
HotKey hotkey= obj as HotKey;
return Equals(hotkey);
}
@@ -122,17 +122,17 @@ namespace LongoMatch.Store
public override string ToString()
{
string modifierS;
- if (!Defined)
+ if(!Defined)
return Catalog.GetString("Not defined");
- if (Modifier == ModifierType.Mod1Mask)
+ if(Modifier == ModifierType.Mod1Mask)
modifierS = "<Alt>+";
- else if (Modifier == ModifierType.ShiftMask)
+ else if(Modifier == ModifierType.ShiftMask)
modifierS = "<Shift>+";
else
modifierS = "";
return string.Format("{0}{1}", modifierS,(Key.ToString()).ToLower());
}
- #endregion
+ #endregion
}
}
diff --git a/LongoMatch/Store/PixbufTimeNode.cs b/LongoMatch/Store/PixbufTimeNode.cs
index 14c8a0f..91032e6 100644
--- a/LongoMatch/Store/PixbufTimeNode.cs
+++ b/LongoMatch/Store/PixbufTimeNode.cs
@@ -45,10 +45,10 @@ namespace LongoMatch.Store
/// </summary>
public Pixbuf Miniature {
get {
- if (thumbnailBuf != null)
+ if(thumbnailBuf != null)
return new Pixbuf(thumbnailBuf);
else return null;
- }set {
+ } set {
ScaleAndSave(value);
}
}
@@ -62,9 +62,9 @@ namespace LongoMatch.Store
ow = MAX_WIDTH;
oh = MAX_HEIGHT;
- if (w>MAX_WIDTH || h>MAX_HEIGHT) {
+ if(w>MAX_WIDTH || h>MAX_HEIGHT) {
double rate = (double)w/(double)h;
- if (h>w)
+ if(h>w)
ow = (int)(oh * rate);
else
oh = (int)(ow / rate);
diff --git a/LongoMatch/Store/Play.cs b/LongoMatch/Store/Play.cs
index 7092967..ffa6feb 100644
--- a/LongoMatch/Store/Play.cs
+++ b/LongoMatch/Store/Play.cs
@@ -37,45 +37,62 @@ namespace LongoMatch.Store
{
#region Constructors
- public Play(){
+ public Play() {
Drawings = new DrawingsList();
Tags = new List<Tag>();
}
#endregion
#region Properties
-
+
/// <summary>
- /// Category in which this play is tagged
+ /// Category in which this play is tagged
/// </summary>
- public Category Category {get; set;}
-
+ public Category Category {
+ get;
+ set;
+ }
+
/// <summary>
/// A string with the play's notes
/// </summary>
- public string Notes {get; set;}
+ public string Notes {
+ get;
+ set;
+ }
/// <summary>
/// Video framerate in frames per second. This value is taken from the
/// video file properties and used to translate from seconds
/// to frames: second 100 is equivalent to frame 100*fps
/// </summary>
- public uint Fps {get; set;}
+ public uint Fps {
+ get;
+ set;
+ }
/// <summary>
/// Start frame number
/// </summary>
public uint StartFrame {
- get {return (uint) (Start.MSeconds * Fps / 1000);}
- set {Start = new Time {MSeconds = (int)(1000 * value / Fps)};}
+ get {
+ return (uint)(Start.MSeconds * Fps / 1000);
+ }
+ set {
+ Start = new Time {MSeconds = (int)(1000 * value / Fps)};
+ }
}
/// <summary>
/// Stop frame number
/// </summary>
public uint StopFrame {
- get {return (uint) (Stop.MSeconds * Fps / 1000);}
- set {Stop = new Time {MSeconds = (int)(1000 * value / Fps)};}
+ get {
+ return (uint)(Stop.MSeconds * Fps / 1000);
+ }
+ set {
+ Stop = new Time {MSeconds = (int)(1000 * value / Fps)};
+ }
}
/// <summary>
@@ -83,7 +100,7 @@ namespace LongoMatch.Store
/// </summary>
public uint KeyFrame {
get {
- if (HasDrawings)
+ if(HasDrawings)
return (uint) KeyFrameDrawing.RenderTime * Fps / 1000;
else return 0;
}
@@ -92,23 +109,29 @@ namespace LongoMatch.Store
/// <summary>
/// Get/Set wheter this play is actually loaded. Used in <see cref="LongoMatch.Gui.Component.TimeScale">
/// </summary>
- public bool Selected {get; set;}
-
+ public bool Selected {
+ get;
+ set;
+ }
+
/// <summary>
/// List of drawings for this play
/// </summary>
- public DrawingsList Drawings {get; set;}
-
+ public DrawingsList Drawings {
+ get;
+ set;
+ }
+
/* FIXME: Keep this until we support multiple drawings */
public Drawing KeyFrameDrawing {
- get{
- if (Drawings.Count > 0)
+ get {
+ if(Drawings.Count > 0)
return Drawings[0];
else
return null;
}
}
-
+
/// <summary>
/// Get wether the play has at least a frame drawing
/// </summary>
@@ -117,25 +140,32 @@ namespace LongoMatch.Store
return Drawings.Count > 0;
}
}
-
+
/// <summary>
/// Central frame number using (stopFrame-startFrame)/2
/// </summary>
public uint CentralFrame {
- get {return StopFrame-((TotalFrames)/2);}
+ get {
+ return StopFrame-((TotalFrames)/2);
+ }
}
/// <summary>
/// Number of frames inside the play's boundaries
/// </summary>
public uint TotalFrames {
- get {return StopFrame-StartFrame;}
+ get {
+ return StopFrame-StartFrame;
+ }
}
//// <summary>
- /// Play's tags
+ /// Play's tags
/// </summary>
- public List<Tag> Tags{get; set;}
+ public List<Tag> Tags {
+ get;
+ set;
+ }
#endregion
#region Public methods
@@ -153,29 +183,29 @@ namespace LongoMatch.Store
}
/// <summary>
- /// Adds a new tag to the play
+ /// Adds a new tag to the play
/// </summary>
/// <param name="tag">
/// A <see cref="Tag"/>: the tag to add
/// </param>
- public void AddTag(Tag tag){
- if (!Tags.Contains(tag))
+ public void AddTag(Tag tag) {
+ if(!Tags.Contains(tag))
Tags.Add(tag);
}
-
+
/// <summary>
/// Removes a tag to the play
/// </summary>
/// <param name="tag">
/// A <see cref="Tag"/>: the tag to remove
/// </param>
- public void RemoveTag(Tag tag){
- if (Tags.Contains(tag))
+ public void RemoveTag(Tag tag) {
+ if(Tags.Contains(tag))
Tags.Remove(tag);
}
-
+
/// <summary>
- /// Return True if the play contains a similar tag
+ /// Return True if the play contains a similar tag
/// </summary>
/// <param name="name">
/// A <see cref="String"/> with the tag name
@@ -187,22 +217,22 @@ namespace LongoMatch.Store
/// A <see cref="System.Boolean"/>
/// </returns>
public bool HasTag(String name, object val) {
- return (from tag in Tags
- where (tag.Name == (string)name) && (tag.Value == val)
- select tag).Count() > 0;
+ return (from tag in Tags
+ where(tag.Name == (string)name) && (tag.Value == val)
+ select tag).Count() > 0;
}
-
- public override string ToString ()
+
+ public override string ToString()
{
String[] tags = new String[Tags.Count];
-
- for (int i=0; i<Tags.Count; i++)
+
+ for(int i=0; i<Tags.Count; i++)
tags[i] = Tags[i].Value.ToString();
-
+
return "<b>"+Catalog.GetString("Name")+": </b>"+Name+"\n"+
- "<b>"+Catalog.GetString("Start")+": </b>"+Start.ToMSecondsString()+"\n"+
- "<b>"+Catalog.GetString("Stop")+": </b>"+Stop.ToMSecondsString()+"\n"+
- "<b>"+Catalog.GetString("Tags")+": </b>"+ String.Join(" ; ", tags);
+ "<b>"+Catalog.GetString("Start")+": </b>"+Start.ToMSecondsString()+"\n"+
+ "<b>"+Catalog.GetString("Stop")+": </b>"+Stop.ToMSecondsString()+"\n"+
+ "<b>"+Catalog.GetString("Tags")+": </b>"+ String.Join(" ; ", tags);
}
#endregion
}
diff --git a/LongoMatch/Store/PlayListPlay.cs b/LongoMatch/Store/PlayListPlay.cs
index eb5aea3..eb00b9c 100644
--- a/LongoMatch/Store/PlayListPlay.cs
+++ b/LongoMatch/Store/PlayListPlay.cs
@@ -40,13 +40,13 @@ namespace LongoMatch.Store
#region Properties
/// <summary>
- /// Media File
+ /// Media File
/// </summary>
public PreviewMediaFile MediaFile {
get;
set;
}
-
+
/// <summary>
/// Play rate
/// </summary>
@@ -62,14 +62,14 @@ namespace LongoMatch.Store
get;
set;
}
-
+
/// <summary>
- /// List of drawings to be displayed
+ /// List of drawings to be displayed
/// </summary>
public DrawingsList Drawings {
get;
set;
- }
+ }
#endregion
}
}
diff --git a/LongoMatch/Store/Player.cs b/LongoMatch/Store/Player.cs
index 3174dd6..57fd7b0 100644
--- a/LongoMatch/Store/Player.cs
+++ b/LongoMatch/Store/Player.cs
@@ -66,7 +66,7 @@ namespace LongoMatch.Store
/// </summary>
public Pixbuf Photo {
get {
- if (photo != null)
+ if(photo != null)
return new Pixbuf(photo);
else
return null;
@@ -75,27 +75,27 @@ namespace LongoMatch.Store
photo=value.SaveToBuffer("png");
}
}
-
+
/// <summary>
/// Date of birth
/// </summary>
- public DateTime Birthday{
+ public DateTime Birthday {
get;
set;
}
-
+
/// <summary>
/// Nationality
/// </summary>
- public String Nationality{
+ public String Nationality {
get;
set;
}
-
+
/// <summary>
/// Height
/// </summary>
- public float Height{
+ public float Height {
get;
set;
}
@@ -103,20 +103,20 @@ namespace LongoMatch.Store
/// <summary>
/// Weight
/// </summary>
- public int Weight{
+ public int Weight {
get;
set;
}
-
+
/// <summary>
- /// Whether this player is playing or not and shouldn't be added the
- /// list of taggable players
+ /// Whether this player is playing or not and shouldn't be added the
+ /// list of taggable players
/// </summary>
- public bool Playing{
+ public bool Playing {
get;
set;
}
-
+
#endregion
}
}
diff --git a/LongoMatch/Store/Project.cs b/LongoMatch/Store/Project.cs
index 7228e0f..2da09ed 100644
--- a/LongoMatch/Store/Project.cs
+++ b/LongoMatch/Store/Project.cs
@@ -52,7 +52,7 @@ namespace LongoMatch.Store
#region Constructors
- public Project(){
+ public Project() {
playsList = new List<Play>();
Categories = new Categories();
LocalTeamTemplate = new TeamTemplate();
@@ -61,7 +61,7 @@ namespace LongoMatch.Store
#endregion
#region Properties
-
+
public ProjectDescription Description {
get;
set;
@@ -90,7 +90,7 @@ namespace LongoMatch.Store
get;
set;
}
-
+
#endregion
#region Public Methods
@@ -152,7 +152,7 @@ namespace LongoMatch.Store
/// A <see cref="System.Int32"/>: category the play belongs to
/// </param>
public void RemovePlays(List<Play> plays) {
- foreach (Play play in plays)
+ foreach(Play play in plays)
playsList.Remove(play);
}
@@ -163,38 +163,38 @@ namespace LongoMatch.Store
/// A <see cref="System.Int32"/>: category index
/// </param>
public void RemoveCategory(Category category) {
- if (Categories.Count == 1)
+ if(Categories.Count == 1)
throw new Exception("You can't remove the last Section");
Categories.Remove(category);
-
+
/* query for all the plays with this Category */
- var plays =
- from play in playsList
- where play.Category.UUID == category.UUID
- select play;
+ var plays =
+ from play in playsList
+ where play.Category.UUID == category.UUID
+ select play;
/* Delete them */
- foreach (var play in plays)
+ foreach(var play in plays)
playsList.Remove(play);
}
-
- public List<Play> PlaysInCategory (Category category){
+
+ public List<Play> PlaysInCategory(Category category) {
return (from play in playsList
where play.Category.UUID == category.UUID
select play).ToList();
}
-
- public List<Play> AllPlays (){
+
+ public List<Play> AllPlays() {
return (from play in playsList
select play).ToList();
}
-
+
public List<Tag> Tags {
get {
/* FIXME: Fix that when I have decide what to do with tags*/
return new List<Tag>();
}
}
-
+
/// <summary>
/// Returns a <see cref="Gtk.TreeStore"/> in which project categories are
/// root nodes and their respectives plays child nodes
@@ -205,21 +205,21 @@ namespace LongoMatch.Store
public TreeStore GetModel() {
Dictionary<Category, TreeIter> itersDic = new Dictionary<Category, TreeIter>();
Gtk.TreeStore dataFileListStore = new Gtk.TreeStore(typeof(Play));
-
- IEnumerable<IGrouping<Category, Play>> queryPlaysByCategory =
- from play in playsList
- group play by play.Category;
-
- foreach (Category cat in Categories){
+
+ IEnumerable<IGrouping<Category, Play>> queryPlaysByCategory =
+ from play in playsList
+ group play by play.Category;
+
+ foreach(Category cat in Categories) {
Gtk.TreeIter iter = dataFileListStore.AppendValues(cat);
itersDic.Add(cat, iter);
- }
-
- foreach (var playsGroup in queryPlaysByCategory) {
+ }
+
+ foreach(var playsGroup in queryPlaysByCategory) {
Category cat = playsGroup.Key;
- if (!itersDic.ContainsKey(cat))
+ if(!itersDic.ContainsKey(cat))
continue;
- foreach (Play play in playsGroup) {
+ foreach(Play play in playsGroup) {
dataFileListStore.AppendValues(itersDic[cat],play);
}
}
@@ -227,26 +227,26 @@ namespace LongoMatch.Store
}
public bool Equals(Project project) {
- if (project == null)
+ if(project == null)
return false;
else
return Description.File.FilePath.Equals(project.Description.File.FilePath);
}
public int CompareTo(object obj) {
- if (obj is Project) {
+ if(obj is Project) {
Project project = (Project) obj;
return Description.File.FilePath.CompareTo(project.Description.File.FilePath);
}
else
throw new ArgumentException("object is not a Project and cannot be compared");
}
-
+
public static void Export(Project project, string file) {
file = Path.ChangeExtension(file,"lpr");
SerializableObject.Save(project, file);
}
-
+
public static Project Import(string file) {
try {
return SerializableObject.Load<Project>(file);
@@ -255,43 +255,43 @@ namespace LongoMatch.Store
throw new Exception(Catalog.GetString("The file you are trying to load " +
"is not a valid project"));
}
- }
+ }
#endregion
-
+
#region Private Methods
private void FillList<T>(List<T> options, String tagName, TreeStore store) {
- foreach (var tagValue in options){
+ foreach(var tagValue in options) {
/* Add a root in the tree with the option name */
var iter = store.AppendValues(tagName);
- var queryByTag =
- (from play in playsList
- where play.HasTag(tagName, tagValue) == true
- select play);
+ var queryByTag =
+ (from play in playsList
+ where play.HasTag(tagName, tagValue) == true
+ select play);
/* Then add as children of the Player in the tree */
- foreach (Play play in queryByTag)
+ foreach(Play play in queryByTag)
store.AppendValues(iter, play);
}
}
-
- private TreeStore GetSubCategoryModel(TagSubCategory subcat){
+
+ private TreeStore GetSubCategoryModel(TagSubCategory subcat) {
TreeStore dataFileListStore = new TreeStore(typeof(object));
-
- FillList (subcat.Options, subcat.Name, dataFileListStore);
+
+ FillList(subcat.Options, subcat.Name, dataFileListStore);
return dataFileListStore;
}
-
- private TreeStore GetSubCategoryModel(PlayerSubCategory subcat){
+
+ private TreeStore GetSubCategoryModel(PlayerSubCategory subcat) {
TreeStore dataFileListStore = new TreeStore(typeof(object));
TeamTemplate template;
-
- foreach (Team team in subcat.Options){
- if (team == Team.NONE)
+
+ foreach(Team team in subcat.Options) {
+ if(team == Team.NONE)
continue;
template = team == Team.LOCAL?LocalTeamTemplate:VisitorTeamTemplate;
FillList(template, subcat.Name, dataFileListStore);
}
return dataFileListStore;
}
-#endregion
+ #endregion
}
}
diff --git a/LongoMatch/Store/ProjectDescription.cs b/LongoMatch/Store/ProjectDescription.cs
index 0004ca5..ab6806e 100644
--- a/LongoMatch/Store/ProjectDescription.cs
+++ b/LongoMatch/Store/ProjectDescription.cs
@@ -29,7 +29,7 @@ namespace LongoMatch.Store
[Serializable]
public class ProjectDescription : IComparable
{
-
+
/// <summary>
/// Title of the project
/// </summary>
@@ -40,7 +40,7 @@ namespace LongoMatch.Store
}
/// <summary>
- /// Media file asigned to this project
+ /// Media file asigned to this project
/// </summary>
public PreviewMediaFile File {
get;
@@ -48,7 +48,7 @@ namespace LongoMatch.Store
}
/// <summary>
- /// Season of the game
+ /// Season of the game
/// </summary>
public String Season {
get;
@@ -108,14 +108,14 @@ namespace LongoMatch.Store
/// String representing the video format like "widhtxheight fps"
/// </summary>
public String Format {
- get{
- return String.Format("{0}x{1} {2}fps",
- File.VideoWidth, File.VideoHeight, File.Fps);
+ get {
+ return String.Format("{0}x{1} {2}fps",
+ File.VideoWidth, File.VideoHeight, File.Fps);
}
}
public int CompareTo(object obj) {
- if (obj is ProjectDescription) {
+ if(obj is ProjectDescription) {
ProjectDescription project = (ProjectDescription) obj;
return this.File.FilePath.CompareTo(project.File.FilePath);
diff --git a/LongoMatch/Store/SubCategory.cs b/LongoMatch/Store/SubCategory.cs
index 0df0da9..b734594 100644
--- a/LongoMatch/Store/SubCategory.cs
+++ b/LongoMatch/Store/SubCategory.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2011 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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.Collections.Generic;
using LongoMatch.Common;
@@ -23,24 +23,24 @@ namespace LongoMatch.Store
{
/// <summary>
/// A sub category is used to extend the tags of a category.
- /// In a complex analysis scenario, a category is not enough to tag
- /// a play and we need to use subcategories. For example we might want to
+ /// In a complex analysis scenario, a category is not enough to tag
+ /// a play and we need to use subcategories. For example we might want to
/// tag the type of goal, who scored, who did the passs and for which team.
/// * Goal
/// - Type: [Short Corner, Corner, Penalty, Penalty Corner, Field Goal]
/// - Scorer: Players List
/// - Assister: Players List
/// - Team: [Local Team, Visitor Team]
- ///
- /// A sub category with name Type and a list of options will be added to the
- /// Goal category to extends its tags.
+ ///
+ /// A sub category with name Type and a list of options will be added to the
+ /// Goal category to extends its tags.
/// </summary>
public class SubCategory
{
- public SubCategory (){
+ public SubCategory() {
Options = new List<object>();
}
-
+
/// <summary>
/// Name of the subcategory
/// </summary>
@@ -48,7 +48,7 @@ namespace LongoMatch.Store
get;
set;
}
-
+
/// <summary>
/// List of available options for the subcategory
/// </summary>
@@ -56,7 +56,7 @@ namespace LongoMatch.Store
get;
set;
}
-
+
/// <summary>
/// Wheter this subcategory allow multiple options.
/// eg: Team will only allow one option, because a goal can't be scored by 2 teams
@@ -65,38 +65,38 @@ namespace LongoMatch.Store
get;
set;
}
-
+
/// <summary>
/// Whether this SubCategory should be added to the tagging widget shown after
- /// creating a new play.
+ /// creating a new play.
/// </summary>
public bool FastTag {
get;
set;
}
}
-
+
public class TagSubCategory: SubCategory
{
- public TagSubCategory (){
+ public TagSubCategory() {
Options = new List<string>();
}
-
+
public new List<string> Options {
get;
set;
}
}
-
+
/// <summary>
/// SubCategory to tag Players
/// </summary>
public class PlayerSubCategory: SubCategory
{
- public PlayerSubCategory (){
+ public PlayerSubCategory() {
Options = new List<Team>();
}
-
+
/// <summary>
/// A list of options containing the teams to be shown in the options.
/// The teams LOCAL, VISITOR will be then mapped to a list of players
@@ -108,16 +108,16 @@ namespace LongoMatch.Store
set;
}
}
-
+
/// <summary>
/// SubCategory to tag teams
/// </summary>
public class TeamSubCategory: SubCategory
{
- public TeamSubCategory (){
+ public TeamSubCategory() {
Options = new List<Team>();
}
-
+
/// <summary>
/// A list of options containing the teams to be shown in the options.
/// The teams LOCAL, VISITOR and NONE are then mapped to real team names
diff --git a/LongoMatch/Store/Tag.cs b/LongoMatch/Store/Tag.cs
index 25a8ca5..0f6ccc2 100644
--- a/LongoMatch/Store/Tag.cs
+++ b/LongoMatch/Store/Tag.cs
@@ -32,13 +32,13 @@ namespace LongoMatch.Store
get;
set;
}
-
+
public object Value {
get;
set;
}
}
-
+
[Serializable]
public class StringTag
{
@@ -49,31 +49,31 @@ namespace LongoMatch.Store
get;
set;
}
-
+
public string Value {
get;
set;
}
}
-
+
[Serializable]
public class PlayerTag:Tag
{
public PlayerTag() {
}
-
+
public new Player Value {
get;
set;
}
}
-
+
[Serializable]
public class TeamTag:Tag
{
public TeamTag() {
}
-
+
public new Team Value {
get;
set;
diff --git a/LongoMatch/Store/Templates/CategoriesTemplate.cs b/LongoMatch/Store/Templates/CategoriesTemplate.cs
index 9ed678d..5f5b8f6 100644
--- a/LongoMatch/Store/Templates/CategoriesTemplate.cs
+++ b/LongoMatch/Store/Templates/CategoriesTemplate.cs
@@ -44,14 +44,14 @@ namespace LongoMatch.Store.Templates
/// </summary>
public Categories() {}
- public void Save(string filePath){
+ public void Save(string filePath) {
SerializableObject.Save(this, filePath);
}
-
+
public static Categories Load(string filePath) {
return SerializableObject.Load<Categories>(filePath);
}
-
+
public static Categories DefaultTemplate() {
Categories defaultTemplate = new Categories();
defaultTemplate.FillDefaultTemplate();
@@ -61,13 +61,13 @@ namespace LongoMatch.Store.Templates
private void FillDefaultTemplate() {
Color c = new Color((Byte)255, (Byte)0, (Byte)0);
HotKey h = new HotKey();
-
-
- for (int i=1; i<=20;i++) {
+
+
+ for(int i=1; i<=20; i++) {
PlayerSubCategory localplayers, visitorplayers;
TeamSubCategory team;
List<Team> teams, lplayers, vplayers;
-
+
teams = new List<Team>();
teams.Add(Team.NONE);
teams.Add(Team.LOCAL);
@@ -76,22 +76,22 @@ namespace LongoMatch.Store.Templates
Name = Catalog.GetString("Team"),
Options = teams
};
-
+
lplayers = new List<Team>();
lplayers.Add(Team.LOCAL);
localplayers = new PlayerSubCategory {
Name = Catalog.GetString("Local Team Players"),
Options = lplayers,
};
-
+
vplayers = new List<Team>();
vplayers.Add(Team.VISITOR);
visitorplayers = new PlayerSubCategory {
Name = Catalog.GetString("Visitor Team Players"),
Options = vplayers,
};
-
- Category cat = new Category{
+
+ Category cat = new Category {
Name = "Category " + i,
Color = c,
Start = new Time{Seconds = 10},
diff --git a/LongoMatch/Store/Templates/SubCategoriesTemplate.cs b/LongoMatch/Store/Templates/SubCategoriesTemplate.cs
index d5a1d98..384245d 100644
--- a/LongoMatch/Store/Templates/SubCategoriesTemplate.cs
+++ b/LongoMatch/Store/Templates/SubCategoriesTemplate.cs
@@ -27,13 +27,13 @@ namespace LongoMatch.Store.Templates
[Serializable]
public class SubCategoriesTemplate: List<SubCategory>
{
-
+
public SubCategoriesTemplate() {}
- public void Save(string filePath){
+ public void Save(string filePath) {
SerializableObject.Save(this, filePath);
}
-
+
public static SubCategoriesTemplate Load(string filePath) {
return SerializableObject.Load<SubCategoriesTemplate>(filePath);
}
diff --git a/LongoMatch/Store/Templates/TeamTemplate.cs b/LongoMatch/Store/Templates/TeamTemplate.cs
index ebb008a..17c44b7 100644
--- a/LongoMatch/Store/Templates/TeamTemplate.cs
+++ b/LongoMatch/Store/Templates/TeamTemplate.cs
@@ -28,40 +28,40 @@ namespace LongoMatch.Store.Templates
public class TeamTemplate: List<Player>
{
public TeamTemplate() {}
-
- public String TeamName{
+
+ public String TeamName {
get;
set;
}
- public List<Player> PlayingPlayersList{
+ public List<Player> PlayingPlayersList {
get {
- var players =
- from player in this
- where player.Playing == true
- select player;
+ var players =
+ from player in this
+ where player.Playing == true
+ select player;
return players.ToList() as List<Player>;
}
}
- public void Save(string filePath){
+ public void Save(string filePath) {
SerializableObject.Save(this, filePath);
}
-
+
public static TeamTemplate Load(string filePath) {
return SerializableObject.Load<TeamTemplate>(filePath);
}
-
+
public static TeamTemplate DefaultTemplate(int playersCount) {
TeamTemplate defaultTemplate = new TeamTemplate();
defaultTemplate.FillDefaultTemplate(playersCount);
return defaultTemplate;
}
-
+
private void FillDefaultTemplate(int playersCount) {
Clear();
- for (int i=1; i<=playersCount;i++) {
- Add(new Player{
+ for(int i=1; i<=playersCount; i++) {
+ Add(new Player {
Name = "Player " + i,
Birthday = new DateTime(),
Height = 1.80f,
diff --git a/LongoMatch/Store/Templates/Template.cs b/LongoMatch/Store/Templates/Template.cs
index 723a414..a320812 100644
--- a/LongoMatch/Store/Templates/Template.cs
+++ b/LongoMatch/Store/Templates/Template.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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.IO;
using System.Runtime.Serialization;
diff --git a/LongoMatch/Store/Time.cs b/LongoMatch/Store/Time.cs
index 9269816..43e9bd7 100644
--- a/LongoMatch/Store/Time.cs
+++ b/LongoMatch/Store/Time.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Store
{
private const int MS = 1000000 ;
public const int SECONDS_TO_TIME = 1000;
-
+
#region Constructors
public Time() {
}
@@ -76,7 +76,7 @@ namespace LongoMatch.Store
_m = ((_time % 3600) / 60);
_s = ((_time % 3600) % 60);
- if (_h > 0)
+ if(_h > 0)
return String.Format("{0}:{1}:{2}", _h, _m.ToString("d2"),
_s.ToString("d2"));
@@ -99,7 +99,7 @@ namespace LongoMatch.Store
public override bool Equals(object o)
{
- if (o is Time) {
+ if(o is Time) {
return ((Time)o).MSeconds == MSeconds;
}
else return false;
@@ -111,7 +111,7 @@ namespace LongoMatch.Store
}
public int CompareTo(object obj) {
- if (obj is Time)
+ if(obj is Time)
{
Time otherTime = (Time) obj;
return MSeconds.CompareTo(otherTime.MSeconds);
diff --git a/LongoMatch/Updates/Updater.cs b/LongoMatch/Updates/Updater.cs
index 567d906..235ddf3 100644
--- a/LongoMatch/Updates/Updater.cs
+++ b/LongoMatch/Updates/Updater.cs
@@ -54,7 +54,7 @@ namespace LongoMatch.Updates
update = parser.UpdateVersion;
downloadURL = parser.DownloadURL;
}
- catch (Exception ex) {
+ catch(Exception ex) {
Console.WriteLine("Error downloading version file:\n"+ex);
update = actual;
}
@@ -72,21 +72,23 @@ namespace LongoMatch.Updates
}
private bool IsOutDated() {
- if (update.Major > actual.Major)
+ if(update.Major > actual.Major)
return true;
- else if (update.Minor > actual.Minor)
+ else if(update.Minor > actual.Minor)
return true;
- else if (update.Build > actual.Build)
+ else if(update.Build > actual.Build)
return true;
else
return false;
}
private void CheckForUpdates() {
- if (ConexionExists())
+ if(ConexionExists())
this.FetchNewVersion();
- if (NewVersion != null && IsOutDated()) {
- Gtk.Application.Invoke(delegate {this.NewVersion(update,downloadURL);});
+ if(NewVersion != null && IsOutDated()) {
+ Gtk.Application.Invoke(delegate {
+ this.NewVersion(update,downloadURL);
+ });
}
}
#endregion
diff --git a/LongoMatch/Updates/XmlUpdateParser.cs b/LongoMatch/Updates/XmlUpdateParser.cs
index e44ade8..06b3577 100644
--- a/LongoMatch/Updates/XmlUpdateParser.cs
+++ b/LongoMatch/Updates/XmlUpdateParser.cs
@@ -35,7 +35,7 @@ namespace LongoMatch.Updates
#region Constructors
public XmlUpdateParser(string file)
{
- if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
+ if(System.Environment.OSVersion.Platform == PlatformID.Win32NT)
this.oSVersion = "win32";
else
this.oSVersion = "unix";
diff --git a/LongoMatch/Utils/ProjectUtils.cs b/LongoMatch/Utils/ProjectUtils.cs
index 76b8378..f3b0885 100644
--- a/LongoMatch/Utils/ProjectUtils.cs
+++ b/LongoMatch/Utils/ProjectUtils.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2010 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// 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.Collections.Generic;
@@ -32,21 +32,21 @@ using LongoMatch.Video.Utils;
namespace LongoMatch.Utils
{
-
-
+
+
public class ProjectUtils
{
-
- public static void SaveFakeLiveProject (Project project, Window window){
+
+ public static void SaveFakeLiveProject(Project project, Window window) {
int response;
MessageDialog md = new MessageDialog(window, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
Catalog.GetString("The project will be saved to a file. You can insert it later into the database using the "+
- "\"Import project\" function once you copied the video file to your computer"));
+ "\"Import project\" function once you copied the video file to your computer"));
response = md.Run();
md.Destroy();
- if (response == (int)ResponseType.Cancel)
- return;
-
+ if(response == (int)ResponseType.Cancel)
+ return;
+
FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Project"),
window,
FileChooserAction.Save,
@@ -58,15 +58,15 @@ namespace LongoMatch.Utils
filter.AddPattern("*.lpr");
fChooser.AddFilter(filter);
- if (fChooser.Run() == (int)ResponseType.Accept) {
+ if(fChooser.Run() == (int)ResponseType.Accept) {
Project.Export(project, fChooser.Filename);
- MessagePopup.PopupMessage(window, MessageType.Info,
- Catalog.GetString("Project saved successfully."));
+ MessagePopup.PopupMessage(window, MessageType.Info,
+ Catalog.GetString("Project saved successfully."));
}
fChooser.Destroy();
}
-
- public static void ImportProject(Window window){
+
+ public static void ImportProject(Window window) {
Project project;
bool isFake, exists;
int res;
@@ -74,68 +74,68 @@ namespace LongoMatch.Utils
FileFilter filter;
NewProjectDialog npd;
FileChooserDialog fChooser;
-
+
/* Show a file chooser dialog to select the file to import */
fChooser = new FileChooserDialog(Catalog.GetString("Import Project"),
- window,
- FileChooserAction.Open,
- "gtk-cancel",ResponseType.Cancel,
- "gtk-open",ResponseType.Accept);
+ window,
+ FileChooserAction.Open,
+ "gtk-cancel",ResponseType.Cancel,
+ "gtk-open",ResponseType.Accept);
fChooser.SetCurrentFolder(MainClass.HomeDir());
filter = new FileFilter();
filter.Name = Constants.PROJECT_NAME;
- filter.AddPattern("*.lpr");
+ filter.AddPattern("*.lpr");
fChooser.AddFilter(filter);
-
-
+
+
res = fChooser.Run();
- fileName = fChooser.Filename;
- fChooser.Destroy();
+ fileName = fChooser.Filename;
+ fChooser.Destroy();
/* return if the user cancelled */
- if (res != (int)ResponseType.Accept)
- return;
-
+ if(res != (int)ResponseType.Accept)
+ return;
+
/* try to import the project and show a message error is the file
* is not a valid project */
- try{
+ try {
project = Project.Import(fileName);
}
- catch (Exception ex){
+ catch(Exception ex) {
MessagePopup.PopupMessage(window, MessageType.Error,
Catalog.GetString("Error importing project:")+
- "\n"+ex.Message);
+ "\n"+ex.Message);
return;
}
-
+
isFake = (project.Description.File.FilePath == Constants.FAKE_PROJECT);
-
+
/* If it's a fake live project prompt for a video file and
* create a new PreviewMediaFile for this project */
- if (isFake){
+ if(isFake) {
project.Description.File = null;
- npd = new NewProjectDialog();
+ npd = new NewProjectDialog();
npd.TransientFor = window;
npd.Use = ProjectType.EditProject;
npd.Project = project;
int response = npd.Run();
- while (true){
- if (response != (int)ResponseType.Ok){
+ while(true) {
+ if(response != (int)ResponseType.Ok) {
npd.Destroy();
return;
- } else if (npd.Project == null) {
+ } else if(npd.Project == null) {
MessagePopup.PopupMessage(window, MessageType.Info,
Catalog.GetString("Please, select a video file."));
response=npd.Run();
} else {
project = npd.Project;
- npd.Destroy();
+ npd.Destroy();
break;
}
- }
- }
-
+ }
+ }
+
/* If the project exists ask if we want to overwrite it */
- if (MainClass.DB.Exists(project)){
+ if(MainClass.DB.Exists(project)) {
MessageDialog md = new MessageDialog(window,
DialogFlags.Modal,
MessageType.Question,
@@ -146,114 +146,114 @@ namespace LongoMatch.Utils
md.Icon=Stetic.IconLoader.LoadIcon(window, "longomatch", Gtk.IconSize.Dialog);
res = md.Run();
md.Destroy();
- if (res != (int)ResponseType.Yes)
+ if(res != (int)ResponseType.Yes)
return;
exists = true;
} else
exists = false;
-
- if (isFake)
+
+ if(isFake)
CreateThumbnails(window, project);
- if (exists)
+ if(exists)
MainClass.DB.UpdateProject(project);
else
MainClass.DB.AddProject(project);
-
-
- MessagePopup.PopupMessage(window, MessageType.Info,
- Catalog.GetString("Project successfully imported."));
+
+
+ MessagePopup.PopupMessage(window, MessageType.Info,
+ Catalog.GetString("Project successfully imported."));
}
-
- public static void CreateNewProject(Window window,
- out Project project,
- out ProjectType projectType,
- out CapturePropertiesStruct captureProps){
+
+ public static void CreateNewProject(Window window,
+ out Project project,
+ out ProjectType projectType,
+ out CapturePropertiesStruct captureProps) {
ProjectSelectionDialog psd;
- NewProjectDialog npd;
+ NewProjectDialog npd;
List<Device> devices = null;
int response;
-
+
/* The out parameters must be set before leaving the method */
project = null;
projectType = ProjectType.None;
captureProps = new CapturePropertiesStruct();
-
+
/* Show the project selection dialog */
psd = new ProjectSelectionDialog();
psd.TransientFor = window;
response = psd.Run();
psd.Destroy();
- if (response != (int)ResponseType.Ok)
+ if(response != (int)ResponseType.Ok)
return;
projectType = psd.ProjectType;
-
- if (projectType == ProjectType.CaptureProject){
+
+ if(projectType == ProjectType.CaptureProject) {
devices = Device.ListVideoDevices();
- if (devices.Count == 0){
+ if(devices.Count == 0) {
MessagePopup.PopupMessage(window, MessageType.Error,
Catalog.GetString("No capture devices were found."));
return;
}
- }
-
- /* Show the new project dialog and wait to get a valid project
+ }
+
+ /* Show the new project dialog and wait to get a valid project
* or quit if the user cancel it.*/
npd = new NewProjectDialog();
npd.TransientFor = window;
npd.Use = projectType;
- if (projectType == ProjectType.CaptureProject)
+ if(projectType == ProjectType.CaptureProject)
npd.Devices = devices;
response = npd.Run();
- while (true) {
+ while(true) {
/* User cancelled: quit */
- if (response != (int)ResponseType.Ok){
+ if(response != (int)ResponseType.Ok) {
npd.Destroy();
return;
}
/* No file chosen: display the dialog again */
- if (npd.Project == null)
+ if(npd.Project == null)
MessagePopup.PopupMessage(window, MessageType.Info,
Catalog.GetString("Please, select a video file."));
/* If a project with the same file path exists show a warning */
- else if (MainClass.DB.Exists(npd.Project))
+ else if(MainClass.DB.Exists(npd.Project))
MessagePopup.PopupMessage(window, MessageType.Error,
Catalog.GetString("This file is already used in another Project.")+"\n"+
Catalog.GetString("Select a different one to continue."));
-
+
else {
/* We are now ready to create the new project */
project = npd.Project;
- if (projectType == ProjectType.CaptureProject)
+ if(projectType == ProjectType.CaptureProject)
captureProps = npd.CaptureProperties;
npd.Destroy();
break;
}
response = npd.Run();
- }
- if (projectType == ProjectType.FileProject)
- /* We can safelly add the project since we already checked if
+ }
+ if(projectType == ProjectType.FileProject)
+ /* We can safelly add the project since we already checked if
* it can can added */
MainClass.DB.AddProject(project);
}
-
- public static void ExportToCSV(Window window, Project project){
+
+ public static void ExportToCSV(Window window, Project project) {
FileChooserDialog fChooser;
FileFilter filter;
string outputFile;
CSVExport export;
-
+
fChooser = new FileChooserDialog(Catalog.GetString("Select Export File"),
- window,
- FileChooserAction.Save,
- "gtk-cancel",ResponseType.Cancel,
- "gtk-save",ResponseType.Accept);
+ window,
+ FileChooserAction.Save,
+ "gtk-cancel",ResponseType.Cancel,
+ "gtk-save",ResponseType.Accept);
fChooser.SetCurrentFolder(MainClass.HomeDir());
fChooser.DoOverwriteConfirmation = true;
filter = new FileFilter();
filter.Name = "CSV File";
filter.AddPattern("*.csv");
fChooser.AddFilter(filter);
- if (fChooser.Run() == (int)ResponseType.Accept) {
+ if(fChooser.Run() == (int)ResponseType.Accept) {
outputFile=fChooser.Filename;
outputFile = System.IO.Path.ChangeExtension(outputFile,"csv");
export = new CSVExport(project, outputFile);
@@ -261,35 +261,35 @@ namespace LongoMatch.Utils
}
fChooser.Destroy();
}
-
- public static void CreateThumbnails(Window window, Project project){
+
+ public static void CreateThumbnails(Window window, Project project) {
MultimediaFactory factory;
IFramesCapturer capturer;
BusyDialog dialog;
-
+
dialog = new BusyDialog();
dialog.TransientFor = window;
- dialog.Message = Catalog.GetString("Creating video thumbnails. This can take a while.");
+ dialog.Message = Catalog.GetString("Creating video thumbnails. This can take a while.");
dialog.Show();
dialog.Pulse();
-
+
/* Create all the thumbnails */
factory = new MultimediaFactory();
capturer = factory.getFramesCapturer();
- capturer.Open (project.Description.File.FilePath);
- foreach (Play play in project.AllPlays()){
- try{
+ capturer.Open(project.Description.File.FilePath);
+ foreach(Play play in project.AllPlays()) {
+ try {
capturer.SeekTime(play.Start.MSeconds + ((play.Stop - play.Start).MSeconds/2),
true);
play.Miniature = capturer.GetCurrentFrame(Constants.THUMBNAIL_MAX_WIDTH,
- Constants.THUMBNAIL_MAX_HEIGHT);
+ Constants.THUMBNAIL_MAX_HEIGHT);
dialog.Pulse();
-
+
} catch {
- /* FIXME: Add log */
- }
- }
-
+ /* FIXME: Add log */
+ }
+ }
+
capturer.Dispose();
dialog.Destroy();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]