From 8424a17467c5c05dcea127ff68a354b8c07dcd76 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Tue, 7 Aug 2018 22:50:54 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31230 --- client/DxPlay/Configuration/dxplay.en | 27 + client/DxPlay/Configuration/dxplay.json | 17 + .../Controls/BindableToolStripMenuItem .cs | 35 + client/DxPlay/Controls/Player.Designer.cs | 32 + client/DxPlay/Controls/Player.cs | 17 + .../Controls/PlayerControls.Designer.cs | 274 ++++++++ client/DxPlay/Controls/PlayerControls.cs | 22 + client/DxPlay/Controls/PlayerControls.resx | 120 ++++ client/DxPlay/DxPlay.csproj | 52 +- client/DxPlay/DxPlaySettings.cs | 13 + client/DxPlay/DxPlayer.cs | 97 +-- .../{DxPlayer - Copy.cs => DxPlayerx.cs} | 0 client/DxPlay/Integration/Traffic.cs | 62 ++ client/DxPlay/Model/DxPlayModel.cs | 79 +++ client/DxPlay/PlayerForm.Designer.cs | 627 ++++++++++-------- client/DxPlay/PlayerForm.cs | 384 ++++++----- client/DxPlay/PlayerForm.resx | 97 ++- client/DxPlay/PlayerGraph.cs | 9 +- client/DxPlay/Program.cs | 48 +- client/DxPlay/Properties/AssemblyInfo.cs | 4 +- client/DxPlay/StringResource.Designer.cs | 29 +- client/DxPlay/StringResource.resx | 9 + client/DxPlay/app.config | 29 +- client/DxPlay/nlog.config | 2 +- client/DxPlay/packages.config | 2 + client/IntegrationTests/App.config | 16 + ....json => -UJ-configuration-tqc-check.json} | 6 +- ...ration-nle.json => configuration-nle.json} | 4 +- client/Maestro/MaestroForm.Source.cs | 19 +- client/Maestro/Program.cs | 19 +- client/Maestro/app.config | 17 +- .../Configuration/ConfigurationInfo.cs | 35 + .../MaestroShared/Controls/FlatTabControl.cs | 519 +++++++++++++++ .../Controls/FlatTabControl.resx | 157 +++++ client/MaestroShared/Controls/Win32.cs | 182 +++++ client/MaestroShared/MaestroShared.csproj | 30 + .../Properties/Resources.Designer.cs | 60 ++ .../MaestroShared/Properties/Resources.resx | 18 + .../baseline_arrow_downward_black_18dp.png | Bin 0 -> 140 bytes .../baseline_chevron_left_black_18dp.png | Bin 0 -> 115 bytes .../baseline_chevron_right_black_18dp.png | Bin 0 -> 119 bytes .../Resources/baseline_close_black_18dp.png | Bin 0 -> 143 bytes .../baseline_ondemand_video_black_18dp.png | Bin 0 -> 189 bytes ...baseline_playlist_add_check_black_18dp.png | Bin 0 -> 146 bytes ...baseline_playlist_add_check_black_36dp.png | Bin 0 -> 180 bytes .../Resources/round_publish_black_24dp.png | Bin 0 -> 152 bytes 46 files changed, 2598 insertions(+), 571 deletions(-) create mode 100644 client/DxPlay/Configuration/dxplay.en create mode 100644 client/DxPlay/Configuration/dxplay.json create mode 100644 client/DxPlay/Controls/BindableToolStripMenuItem .cs create mode 100644 client/DxPlay/Controls/Player.Designer.cs create mode 100644 client/DxPlay/Controls/Player.cs create mode 100644 client/DxPlay/Controls/PlayerControls.Designer.cs create mode 100644 client/DxPlay/Controls/PlayerControls.cs create mode 100644 client/DxPlay/Controls/PlayerControls.resx create mode 100644 client/DxPlay/DxPlaySettings.cs rename client/DxPlay/{DxPlayer - Copy.cs => DxPlayerx.cs} (100%) create mode 100644 client/DxPlay/Integration/Traffic.cs create mode 100644 client/DxPlay/Model/DxPlayModel.cs rename client/Maestro/Configuration/{UJ-configuration-tqc-check.json => -UJ-configuration-tqc-check.json} (92%) rename client/Maestro/Configuration/{-configuration-nle.json => configuration-nle.json} (94%) create mode 100644 client/MaestroShared/Controls/FlatTabControl.cs create mode 100644 client/MaestroShared/Controls/FlatTabControl.resx create mode 100644 client/MaestroShared/Controls/Win32.cs create mode 100644 client/MaestroShared/Resources/baseline_arrow_downward_black_18dp.png create mode 100644 client/MaestroShared/Resources/baseline_chevron_left_black_18dp.png create mode 100644 client/MaestroShared/Resources/baseline_chevron_right_black_18dp.png create mode 100644 client/MaestroShared/Resources/baseline_close_black_18dp.png create mode 100644 client/MaestroShared/Resources/baseline_ondemand_video_black_18dp.png create mode 100644 client/MaestroShared/Resources/baseline_playlist_add_check_black_18dp.png create mode 100644 client/MaestroShared/Resources/baseline_playlist_add_check_black_36dp.png create mode 100644 client/MaestroShared/Resources/round_publish_black_24dp.png diff --git a/client/DxPlay/Configuration/dxplay.en b/client/DxPlay/Configuration/dxplay.en new file mode 100644 index 00000000..3f488e8c --- /dev/null +++ b/client/DxPlay/Configuration/dxplay.en @@ -0,0 +1,27 @@ +{ + "define-segment": "Define segment", + "break-segment": "Break segment", + "position-as-tcin": "Current position as TC in", + "position-as-tcout": "Current position as TC out", + "delete-segment": "Delete segment", + "segments": "Segments", + "no-input": "NO INPUT", + "start": "START", + "length": "LENGTH", + "tc-in": "TC in", + "tc-out": "TC out", + "optional": "Optional", + "comment": "Comment", + "starting": "STARTING", + "exiting": "EXITING", + "paused": "PAUSED", + "playing": "PLAYING", + "stopped": "STOPPED", + "completed": "COMPLETED", + "pause": "Pause", + "play": "Play", + "stop": "Stop", + "missing-traffic-configuration": "Missing PlanAir connection configuration.", + "error-traffic-connect": "Could not connect to PlanAir system, using: {0}", + "missing-traffic-variant": "Missing metadata for {0} in PlanAir system." +} diff --git a/client/DxPlay/Configuration/dxplay.json b/client/DxPlay/Configuration/dxplay.json new file mode 100644 index 00000000..eb24fa45 --- /dev/null +++ b/client/DxPlay/Configuration/dxplay.json @@ -0,0 +1,17 @@ +{ + "uiFileName": "dxplay.en", + "isMaximized": true, + "player": { + "autoStart": false, + "segmentEditor": true, + }, + "metadata": { + "$type": "TrafficMetadata", + "server": { + "address": "Data Source=10.10.1.45;Initial Catalog=PA_Echo;Persist Security Info=True;", + "userName": "MAM", + "password": "7RKZYBzumKjL40SJwuwiFCvX57xuCN8zay6OttUm2wbrgImyYZBHyZTUUYrXX31Ge2Uwew07HYsqh2uzdJeDBDwcVntxaHg3nIpv9Dyq/odVoiC4tUF/K+lgvKWANcrZ", + "timeout": 1000 + } + } +} diff --git a/client/DxPlay/Controls/BindableToolStripMenuItem .cs b/client/DxPlay/Controls/BindableToolStripMenuItem .cs new file mode 100644 index 00000000..34e42533 --- /dev/null +++ b/client/DxPlay/Controls/BindableToolStripMenuItem .cs @@ -0,0 +1,35 @@ +using System.ComponentModel; +using System.Windows.Forms; + +namespace DxPlay.Controls { + class BindableToolStripMenuItem : ToolStripMenuItem, IBindableComponent { + private BindingContext bindingContext; + private ControlBindingsCollection dataBindings; + + [Browsable(false)] + public BindingContext BindingContext { + get { + if (bindingContext == null) { + bindingContext = new BindingContext(); + } + return bindingContext; + } + + set { + bindingContext = value; + } + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + public ControlBindingsCollection DataBindings { + get { + if (dataBindings == null) { + dataBindings = new ControlBindingsCollection(this); + } + return dataBindings; + + } + + } + } +} diff --git a/client/DxPlay/Controls/Player.Designer.cs b/client/DxPlay/Controls/Player.Designer.cs new file mode 100644 index 00000000..290f08be --- /dev/null +++ b/client/DxPlay/Controls/Player.Designer.cs @@ -0,0 +1,32 @@ +namespace DxPlay.Controls { + partial class Player { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/client/DxPlay/Controls/Player.cs b/client/DxPlay/Controls/Player.cs new file mode 100644 index 00000000..20f30a01 --- /dev/null +++ b/client/DxPlay/Controls/Player.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace DxPlay.Controls { + public partial class Player : UserControl { + public Player() { + InitializeComponent(); + } + } +} diff --git a/client/DxPlay/Controls/PlayerControls.Designer.cs b/client/DxPlay/Controls/PlayerControls.Designer.cs new file mode 100644 index 00000000..9ca08ea1 --- /dev/null +++ b/client/DxPlay/Controls/PlayerControls.Designer.cs @@ -0,0 +1,274 @@ +namespace DxPlay.Controls { + partial class PlayerControls { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.mainPanel = new System.Windows.Forms.TableLayoutPanel(); + this.trackBar = new MaestroShared.Controls.ColorSlider(); + this.timecodePanel = new System.Windows.Forms.TableLayoutPanel(); + this.lbCurrentTC = new System.Windows.Forms.Label(); + this.lbStartTC = new System.Windows.Forms.Label(); + this.lbStart = new System.Windows.Forms.Label(); + this.lbStatus = new System.Windows.Forms.Label(); + this.lbDuration = new System.Windows.Forms.Label(); + this.lbEndTC = new System.Windows.Forms.Label(); + this.buttonsPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.btnPlay = new MaestroShared.Controls.NoFocusCueButton(); + this.btnStop = new MaestroShared.Controls.NoFocusCueButton(); + this.btnPause = new MaestroShared.Controls.NoFocusCueButton(); + this.mainPanel.SuspendLayout(); + this.timecodePanel.SuspendLayout(); + this.buttonsPanel.SuspendLayout(); + this.SuspendLayout(); + // + // mainPanel + // + this.mainPanel.AutoSize = true; + this.mainPanel.ColumnCount = 1; + this.mainPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.mainPanel.Controls.Add(this.trackBar, 0, 1); + this.mainPanel.Controls.Add(this.timecodePanel, 0, 0); + this.mainPanel.Controls.Add(this.buttonsPanel, 0, 2); + this.mainPanel.Dock = System.Windows.Forms.DockStyle.Top; + this.mainPanel.Location = new System.Drawing.Point(0, 0); + this.mainPanel.Margin = new System.Windows.Forms.Padding(0); + this.mainPanel.Name = "mainPanel"; + this.mainPanel.RowCount = 3; + this.mainPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.mainPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.mainPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.mainPanel.Size = new System.Drawing.Size(835, 116); + this.mainPanel.TabIndex = 0; + // + // trackBar + // + this.trackBar.BackColor = System.Drawing.Color.Transparent; + this.trackBar.BarInnerColor = System.Drawing.Color.Transparent; + this.trackBar.BarOuterColor = System.Drawing.Color.Black; + this.trackBar.BarPenColor = System.Drawing.Color.Black; + this.trackBar.BorderRoundRectSize = new System.Drawing.Size(8, 8); + this.trackBar.Cursor = System.Windows.Forms.Cursors.Hand; + this.trackBar.Dock = System.Windows.Forms.DockStyle.Top; + this.trackBar.ElapsedInnerColor = System.Drawing.Color.Black; + this.trackBar.ElapsedOuterColor = System.Drawing.Color.DarkGray; + this.trackBar.LargeChange = ((uint)(0u)); + this.trackBar.Location = new System.Drawing.Point(3, 43); + this.trackBar.Maximum = 1; + this.trackBar.Name = "trackBar"; + this.trackBar.Size = new System.Drawing.Size(829, 10); + this.trackBar.SmallChange = ((uint)(1u)); + this.trackBar.TabIndex = 19; + this.trackBar.Text = "colorSlider1"; + this.trackBar.ThumbInnerColor = System.Drawing.Color.Black; + this.trackBar.ThumbOuterColor = System.Drawing.Color.Silver; + this.trackBar.ThumbPenColor = System.Drawing.Color.Black; + this.trackBar.ThumbRoundRectSize = new System.Drawing.Size(8, 8); + this.trackBar.ThumbSize = 10; + this.trackBar.Value = 0; + // + // timecodePanel + // + this.timecodePanel.AutoSize = true; + this.timecodePanel.ColumnCount = 3; + this.timecodePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.timecodePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60F)); + this.timecodePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.timecodePanel.Controls.Add(this.lbCurrentTC, 0, 1); + this.timecodePanel.Controls.Add(this.lbStartTC, 0, 1); + this.timecodePanel.Controls.Add(this.lbStart, 0, 0); + this.timecodePanel.Controls.Add(this.lbStatus, 1, 0); + this.timecodePanel.Controls.Add(this.lbDuration, 2, 0); + this.timecodePanel.Controls.Add(this.lbEndTC, 2, 1); + this.timecodePanel.Dock = System.Windows.Forms.DockStyle.Top; + this.timecodePanel.Location = new System.Drawing.Point(0, 0); + this.timecodePanel.Margin = new System.Windows.Forms.Padding(0); + this.timecodePanel.Name = "timecodePanel"; + this.timecodePanel.RowCount = 2; + this.timecodePanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.timecodePanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.timecodePanel.Size = new System.Drawing.Size(835, 40); + this.timecodePanel.TabIndex = 0; + // + // lbCurrentTC + // + this.lbCurrentTC.BackColor = System.Drawing.SystemColors.Control; + this.lbCurrentTC.Dock = System.Windows.Forms.DockStyle.Top; + this.lbCurrentTC.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lbCurrentTC.Location = new System.Drawing.Point(170, 13); + this.lbCurrentTC.Name = "lbCurrentTC"; + this.lbCurrentTC.Size = new System.Drawing.Size(495, 27); + this.lbCurrentTC.TabIndex = 25; + this.lbCurrentTC.Text = "00:00:00.00"; + this.lbCurrentTC.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lbStartTC + // + this.lbStartTC.BackColor = System.Drawing.SystemColors.Control; + this.lbStartTC.Dock = System.Windows.Forms.DockStyle.Top; + this.lbStartTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lbStartTC.ForeColor = System.Drawing.SystemColors.WindowText; + this.lbStartTC.Location = new System.Drawing.Point(3, 13); + this.lbStartTC.Name = "lbStartTC"; + this.lbStartTC.Size = new System.Drawing.Size(161, 17); + this.lbStartTC.TabIndex = 23; + this.lbStartTC.Text = "00:00:00.00"; + // + // lbStart + // + this.lbStart.Dock = System.Windows.Forms.DockStyle.Top; + this.lbStart.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lbStart.Location = new System.Drawing.Point(3, 0); + this.lbStart.Name = "lbStart"; + this.lbStart.Size = new System.Drawing.Size(161, 13); + this.lbStart.TabIndex = 19; + this.lbStart.Text = "START"; + this.lbStart.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lbStatus + // + this.lbStatus.Dock = System.Windows.Forms.DockStyle.Top; + this.lbStatus.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lbStatus.Location = new System.Drawing.Point(170, 0); + this.lbStatus.Name = "lbStatus"; + this.lbStatus.Size = new System.Drawing.Size(495, 13); + this.lbStatus.TabIndex = 21; + this.lbStatus.Text = "NO INPUT"; + this.lbStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lbDuration + // + this.lbDuration.Dock = System.Windows.Forms.DockStyle.Top; + this.lbDuration.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lbDuration.Location = new System.Drawing.Point(671, 0); + this.lbDuration.Name = "lbDuration"; + this.lbDuration.Size = new System.Drawing.Size(161, 13); + this.lbDuration.TabIndex = 22; + this.lbDuration.Text = "DURATION"; + this.lbDuration.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lbEndTC + // + this.lbEndTC.BackColor = System.Drawing.SystemColors.Control; + this.lbEndTC.Dock = System.Windows.Forms.DockStyle.Top; + this.lbEndTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lbEndTC.ForeColor = System.Drawing.SystemColors.WindowText; + this.lbEndTC.Location = new System.Drawing.Point(671, 13); + this.lbEndTC.Name = "lbEndTC"; + this.lbEndTC.Size = new System.Drawing.Size(161, 17); + this.lbEndTC.TabIndex = 24; + this.lbEndTC.Text = "00:00:00.00"; + this.lbEndTC.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // buttonsPanel + // + this.buttonsPanel.AutoSize = true; + this.buttonsPanel.Controls.Add(this.btnPlay); + this.buttonsPanel.Controls.Add(this.btnStop); + this.buttonsPanel.Controls.Add(this.btnPause); + this.buttonsPanel.Location = new System.Drawing.Point(0, 56); + this.buttonsPanel.Margin = new System.Windows.Forms.Padding(0); + this.buttonsPanel.Name = "buttonsPanel"; + this.buttonsPanel.Size = new System.Drawing.Size(180, 60); + this.buttonsPanel.TabIndex = 20; + // + // btnPlay + // + this.btnPlay.AutoSize = true; + this.btnPlay.BackColor = System.Drawing.Color.Transparent; + this.btnPlay.FlatAppearance.BorderSize = 0; + this.btnPlay.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnPlay.Image = global::DxPlay.Properties.Resources.ic_play_arrow_black_24dp_2x; + this.btnPlay.Location = new System.Drawing.Point(3, 3); + this.btnPlay.Name = "btnPlay"; + this.btnPlay.Size = new System.Drawing.Size(54, 54); + this.btnPlay.TabIndex = 17; + this.btnPlay.TabStop = false; + this.btnPlay.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.btnPlay.UseVisualStyleBackColor = false; + // + // btnStop + // + this.btnStop.AutoSize = true; + this.btnStop.BackColor = System.Drawing.Color.Transparent; + this.btnStop.FlatAppearance.BorderSize = 0; + this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnStop.Image = global::DxPlay.Properties.Resources.ic_stop_black_24dp_2x; + this.btnStop.Location = new System.Drawing.Point(63, 3); + this.btnStop.Name = "btnStop"; + this.btnStop.Size = new System.Drawing.Size(54, 54); + this.btnStop.TabIndex = 19; + this.btnStop.TabStop = false; + this.btnStop.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.btnStop.UseVisualStyleBackColor = false; + // + // btnPause + // + this.btnPause.AutoSize = true; + this.btnPause.BackColor = System.Drawing.Color.Transparent; + this.btnPause.FlatAppearance.BorderSize = 0; + this.btnPause.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnPause.Image = global::DxPlay.Properties.Resources.ic_pause_black_24dp_2x; + this.btnPause.Location = new System.Drawing.Point(123, 3); + this.btnPause.Name = "btnPause"; + this.btnPause.Size = new System.Drawing.Size(54, 54); + this.btnPause.TabIndex = 18; + this.btnPause.TabStop = false; + this.btnPause.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.btnPause.UseVisualStyleBackColor = false; + // + // PlayerControls + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.Controls.Add(this.mainPanel); + this.Margin = new System.Windows.Forms.Padding(0); + this.Name = "PlayerControls"; + this.Size = new System.Drawing.Size(835, 116); + this.mainPanel.ResumeLayout(false); + this.mainPanel.PerformLayout(); + this.timecodePanel.ResumeLayout(false); + this.buttonsPanel.ResumeLayout(false); + this.buttonsPanel.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel mainPanel; + private System.Windows.Forms.TableLayoutPanel timecodePanel; + private System.Windows.Forms.Label lbStart; + private System.Windows.Forms.Label lbStatus; + private System.Windows.Forms.Label lbDuration; + private System.Windows.Forms.Label lbStartTC; + private System.Windows.Forms.Label lbEndTC; + private System.Windows.Forms.Label lbCurrentTC; + private MaestroShared.Controls.ColorSlider trackBar; + private System.Windows.Forms.FlowLayoutPanel buttonsPanel; + private MaestroShared.Controls.NoFocusCueButton btnPlay; + private MaestroShared.Controls.NoFocusCueButton btnStop; + private MaestroShared.Controls.NoFocusCueButton btnPause; + } +} diff --git a/client/DxPlay/Controls/PlayerControls.cs b/client/DxPlay/Controls/PlayerControls.cs new file mode 100644 index 00000000..6fa42265 --- /dev/null +++ b/client/DxPlay/Controls/PlayerControls.cs @@ -0,0 +1,22 @@ +using MaestroShared.Controls; +using System.Windows.Forms; + +namespace DxPlay.Controls { + public partial class PlayerControls : UserControl { + public PlayerControls() { + InitializeComponent(); + } + + public Label Start { get => lbStart; } + public Label Status { get => lbStatus; } + public Label Duration { get => lbDuration; } + public Label StartTC { get => lbStartTC; } + public Label EndTC { get => lbEndTC; } + public Label CurrentTC { get => lbCurrentTC; } + public ColorSlider TrackBar { get => trackBar; } + public NoFocusCueButton Play { get => btnPlay; } + public NoFocusCueButton Stop { get => btnStop; } + public NoFocusCueButton Pause { get => btnPause; } + + } +} diff --git a/client/DxPlay/Controls/PlayerControls.resx b/client/DxPlay/Controls/PlayerControls.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/client/DxPlay/Controls/PlayerControls.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/client/DxPlay/DxPlay.csproj b/client/DxPlay/DxPlay.csproj index 00defee4..730e8fa9 100644 --- a/client/DxPlay/DxPlay.csproj +++ b/client/DxPlay/DxPlay.csproj @@ -29,6 +29,10 @@ v4.6.1 false + SAK + SAK + SAK + SAK publish\ true Disk @@ -43,10 +47,6 @@ 1.0.0.%2a false true - SAK - SAK - SAK - SAK bin\Debug\ @@ -152,30 +152,57 @@ False lib\DirectShowLib.dll + + ..\packages\LinkDotNet.MessageBus.0.1.1\lib\LinkDotNet.MessageHandling.dll + + + ..\packages\LinkDotNet.MessageBus.Contracts.0.1.1\lib\LinkDotNet.MessageHandling.Contracts.dll + ..\packages\NLog.4.4.12\lib\net45\NLog.dll System + System.Data System.Drawing + + System.Windows.Forms System.XML + - + + Component + + + UserControl + + + Player.cs + + + UserControl + + + PlayerControls.cs + + + + @@ -186,6 +213,7 @@ Component + @@ -218,12 +246,21 @@ + + Always + + + Always + + + PlayerControls.cs + ResXFileCodeGenerator StringResource.Designer.cs @@ -248,6 +285,7 @@ PlayerForm.cs + Designer @@ -267,6 +305,10 @@ {bf494ee9-1e70-44e8-8942-dd726510a766} MXFFileParser + + {a7a21311-cb0e-465f-8ad6-829faf093f00} + TrafficClient + diff --git a/client/DxPlay/DxPlaySettings.cs b/client/DxPlay/DxPlaySettings.cs new file mode 100644 index 00000000..c18c4077 --- /dev/null +++ b/client/DxPlay/DxPlaySettings.cs @@ -0,0 +1,13 @@ +using MaestroShared.Configuration; +using MaestroShared.Metadata; +using System.ComponentModel; + +namespace DxPlay { + public class DxPlaySettings : UISettings { + public Player Player { get; set; } + public MetadataProvider Metadata { get; set; } + public BindingList Segments { get; set; } + public bool IsStandalone { get; set; } + public bool IsMaximized { get; set; } + } +} diff --git a/client/DxPlay/DxPlayer.cs b/client/DxPlay/DxPlayer.cs index 061994fc..f13bb1a8 100644 --- a/client/DxPlay/DxPlayer.cs +++ b/client/DxPlay/DxPlayer.cs @@ -14,8 +14,18 @@ using System.Collections.Generic; using Myriadbits.MXF; using MaestroShared.Metadata; using NLog; +using MaestroShared.Configuration; namespace DxPlay { + public delegate void DxPlayEvent(); + + public enum GraphState { + Stopped, + Completed, + Paused, + Playing, + Exiting + } internal class DxPlayer : ISampleGrabberCB, IDisposable { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); @@ -24,45 +34,34 @@ namespace DxPlay { private static extern void CopyMemory(IntPtr Destination, IntPtr Source, [MarshalAs(UnmanagedType.U4)] uint Length); private const int MEDIATIME_REFERENCE = 10000000; + private bool isDisposed; - public enum GraphState { - Stopped, - Completed, - Paused, - Playing, - Exiting - } - public Dictionary stateHunStringValues = new Dictionary(); + public Dictionary stringValues = new Dictionary(); public MediaDescription MediaDescription { get; internal set; } public Timecode CurrentTC { get; internal set; } public GraphState State { get; internal set; } private ManualResetEvent m_mre; private BackgroundWorker tcWorker; public event DxPlayEvent PlayEvent; - public delegate void DxPlayEvent(); private Thread m_eventThread = null; private object tcLock = new object(); Bitmap m_Bitmap = null; public bool IsError { get; set; } private int m_stride; - public void Dispose() { - CloseInterfaces(); - } - - ~DxPlayer() { - CloseInterfaces(); - } Control playerWindow; - private object ppUnk; private PlayerGraph graph; // Play an avi file into a window. Allow for snapshots. // (Control to show video in, Avi file to play - public DxPlayer(Control hWin, ref MediaDescription mediaDesc) { - FillTheHunStringvalues(); + public DxPlayer(Control hWin, ref MediaDescription mediaDesc, UISettings properties) { + stringValues.Add(GraphState.Exiting, properties.Resource("exiting", StringResource.KILEPES)); + stringValues.Add(GraphState.Paused, properties.Resource("paused", StringResource.SZUNETELTETETT)); + stringValues.Add(GraphState.Playing, properties.Resource("playing", StringResource.LEJATSZAS)); + stringValues.Add(GraphState.Stopped, properties.Resource("stopped", StringResource.MEGALLITVA)); + stringValues.Add(GraphState.Completed, properties.Resource("completed", StringResource.VEGE)); State = GraphState.Stopped; try { int hr; @@ -70,7 +69,7 @@ namespace DxPlay { MediaDescription = mediaDesc; // Set up the graph playerWindow = hWin; - + playerWindow.Invalidate(); SetupGraph(); hWin.Hide(); @@ -78,7 +77,7 @@ namespace DxPlay { // Get the event handle the graph will use to signal // when events occur - Debug.WriteLine("GetEventHandle"); + logger.Debug("GetEventHandle"); hr = graph.MediaEvent.GetEventHandle(out hEvent); DsError.ThrowExceptionForHR(hr); @@ -87,7 +86,6 @@ namespace DxPlay { m_mre.SafeWaitHandle = new SafeWaitHandle(hEvent, true); // Create a new thread to wait for events - Debug.WriteLine("m_eventThread.Start()"); m_eventThread = new Thread(new ThreadStart(EventWait)); m_eventThread.Name = "Media Event Thread"; m_eventThread.Start(); @@ -121,14 +119,13 @@ namespace DxPlay { SetTimeCodes(); logger.Debug("ConfigureVideoWindow"); ConfigureVideoWindow(); + RenderFirstFrame(); } - private void FillTheHunStringvalues() { - stateHunStringValues.Add(GraphState.Exiting, StringResource.KILEPES); - stateHunStringValues.Add(GraphState.Paused, StringResource.SZUNETELTETETT); - stateHunStringValues.Add(GraphState.Playing, StringResource.LEJATSZAS); - stateHunStringValues.Add(GraphState.Stopped, StringResource.MEGALLITVA); - stateHunStringValues.Add(GraphState.Completed, StringResource.VEGE); + private void RenderFirstFrame() { + graph.MediaControl.Run(); + graph.MediaSeeking.SetPositions(1, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning); + graph.MediaControl.Pause(); } private void TcWorker_DoWork(object sender, DoWorkEventArgs e) { @@ -166,14 +163,17 @@ namespace DxPlay { // Pause the capture graph. public void Stop() { - // Can only Stop when playing or paused - if (State == GraphState.Playing || State == GraphState.Paused || State == GraphState.Completed) { - int hr = graph.MediaControl.Stop(); - DsError.ThrowExceptionForHR(hr); - State = GraphState.Stopped; - } + //// Can only Stop when playing or paused + //if (State == GraphState.Playing || State == GraphState.Paused || State == GraphState.Completed) { + // int hr = graph.MediaControl.Stop(); + // DsError.ThrowExceptionForHR(hr); + // State = GraphState.Stopped; + //} + //Rewind(); + //PlayEvent?.Invoke(); + + Pause(); Rewind(); - PlayEvent?.Invoke(); } // Reset the clip back to the beginning @@ -204,7 +204,7 @@ namespace DxPlay { corrected = true; } - Debug.WriteLine("Seeking requested frame {0} got frame {1}, media position {2}, frame length {3}, corrected {4}", value, reachedFrames, requestedPosition, avgTimePerFrame, corrected); + logger.Debug("Seeking requested frame {0} got frame {1}, media position {2}, frame length {3}, corrected {4}", value, reachedFrames, requestedPosition, avgTimePerFrame, corrected); } private void UpdateTC() { @@ -216,7 +216,7 @@ namespace DxPlay { int frames = ReferenceTimeToFrames(currentPosition); if (CurrentTC.ZeroBasedFrames != frames) { CurrentTC.Set(frames); - //Debug.WriteLine("Current frame is {0} ({1}), media position is {2}, AVG frame time is {3}", frames, CurrentTC.ToString(), currentPosition, AvgTimePerFrame); + //logger.Debug("Current frame is {0} ({1}), media position is {2}, AVG frame time is {3}", frames, CurrentTC.ToString(), currentPosition, AvgTimePerFrame); } PlayEvent?.Invoke(); @@ -346,12 +346,14 @@ namespace DxPlay { } // Shut down capture - private void CloseInterfaces() { - Debug.WriteLine("CloseInterfaces"); - GC.SuppressFinalize(this); - if (tcWorker != null) - tcWorker.CancelAsync(); + public void Dispose() { lock (this) { + if (isDisposed) + return; + logger.Debug("Dispose"); + GC.SuppressFinalize(this); + if (tcWorker != null) + tcWorker.CancelAsync(); if (State != GraphState.Exiting) { State = GraphState.Exiting; @@ -361,10 +363,13 @@ namespace DxPlay { } } - if (graph != null) + if (graph != null) { graph.Dispose(); + graph = null; + } } GC.Collect(); + isDisposed = true; //if (m_eventThread != null) // m_eventThread.Join(); } @@ -377,7 +382,7 @@ namespace DxPlay { public int BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen) { return 0; int frames = (int)Math.Abs(SampleTime * MediaDescription.FrameRate); - //Debug.WriteLine("BufferCB frames {0}, sample time {1}", frames, SampleTime); + //logger.Debug("BufferCB frames {0}, sample time {1}", frames, SampleTime); Font font = new Font("Tahoma", 30); string display = frames.ToString(); SizeF size = new SizeF(100, 100); @@ -443,7 +448,7 @@ namespace DxPlay { hr = graph.MediaEvent.GetEvent(out ec, out p1, out p2, 0) ) { // Write the event name to the debug window - Debug.WriteLine(ec.ToString()); + logger.Debug("EVENT:" + ec.ToString()); // If the clip is finished playing if (ec == EventCode.Complete) { @@ -466,7 +471,7 @@ namespace DxPlay { } } else { // We are shutting down - Debug.WriteLine("Shutdown"); + logger.Debug("Shutdown"); break; } } diff --git a/client/DxPlay/DxPlayer - Copy.cs b/client/DxPlay/DxPlayerx.cs similarity index 100% rename from client/DxPlay/DxPlayer - Copy.cs rename to client/DxPlay/DxPlayerx.cs diff --git a/client/DxPlay/Integration/Traffic.cs b/client/DxPlay/Integration/Traffic.cs new file mode 100644 index 00000000..f3e65ec2 --- /dev/null +++ b/client/DxPlay/Integration/Traffic.cs @@ -0,0 +1,62 @@ + +using LinkDotNet.MessageHandling.Contracts; +using TrafficClient; +using LinkDotNet.MessageHandling; +using MaestroShared.Configuration; +using System; +using System.Linq; +using MaestroShared.Metadata; +using System.Collections.Generic; +using NLog; + +namespace DxPlay.Integration { + public class Traffic { + private static readonly Logger logger = LogManager.GetCurrentClassLogger(); + private IMessageBus messageBus = new MessageBus(); + private readonly DxPlaySettings settings; + private readonly string id; + private readonly Connection connection; + public TrafficAPI Api { get; private set; } + + public Traffic(DxPlaySettings settings, string id) { + messageBus.Subscribe(OnMessage); + connection = settings?.Metadata?.Server; + if (connection == null) + throw new Exception(settings.Resource("missing-traffic-configuration", StringResource.MISSING_TRAFFIC_CONFIGURATION)); + Api = new TrafficAPI(connection.Address.OriginalString, connection.UserName, connection.Password, connection.Timeout, messageBus); + this.settings = settings; + this.id = id; + } + + private void OnMessage(IMessage message) { + string msg = string.Format(settings.Resource("error-traffic-connect", StringResource.ERROR_TRAFFIC_CONNECT), connection.Address.OriginalString); + throw new Exception(msg); + //MessageBox.Show(msg, "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + public List LoadSegments() { + var metadataType = MetadataTypeUtil.Guess(id); + List result = null; + + switch (metadataType) { + case MetadataType.TrafficMaterial: { + var trafficItem = Api.GetMaterials(id, false).FirstOrDefault(); + if (trafficItem == null) + throw new Exception(string.Format(settings.Resource("missing-traffic-variant", StringResource.MISSING_TRAFFIC_VARIANT), id)); + result = Api.GetMaterialSegments(trafficItem.VariantID); + break; + } + case MetadataType.TrafficPromo: { + result = Api.GetPromoSegments(id); + break; + } + case MetadataType.TrafficAD: { + result = Api.GetADSegments(id); + break; + } + } + return result; + } + + } +} diff --git a/client/DxPlay/Model/DxPlayModel.cs b/client/DxPlay/Model/DxPlayModel.cs new file mode 100644 index 00000000..57fa05d0 --- /dev/null +++ b/client/DxPlay/Model/DxPlayModel.cs @@ -0,0 +1,79 @@ +using DxPlay.Integration; +using MaestroShared.Metadata; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace DxPlay.Model { + public class DxPlayModel { + public event PropertyChangedEventHandler PropertyChanged; + private readonly DxPlaySettings settings; + private Traffic traffic; + + public DxPlayModel(DxPlaySettings settings) { + this.settings = settings; + IsSegmentEditorEnabled = true.Equals(settings?.Player?.SegmentEditor); + IsMenuVisible = true.Equals(settings?.IsStandalone); + Segments = settings.Segments ?? new BindingList(); + } + + private void Notify([CallerMemberName] String propertyName = "") { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + private bool isSegmentEditorEnabled; + public bool IsSegmentEditorEnabled { + get { + return isSegmentEditorEnabled; + } + set { + if (value != isSegmentEditorEnabled) { + isSegmentEditorEnabled = value; + Notify(); + } + } + } + + private bool isMenuVisible; + public bool IsMenuVisible { + get { + return isMenuVisible; + } + set { + if (value != isMenuVisible) { + isMenuVisible = value; + Notify(); + } + } + } + + private bool isApproveEnabled; + public bool IsApproveEnabled { + get { + return isApproveEnabled; + } + set { + if (value != isApproveEnabled) { + isApproveEnabled = value; + Notify(); + } + } + } + + public BindingList Segments { get; private set; } + + internal void InitializeSegments(string id) { + Segments.Clear(); + try { + traffic = new Traffic(settings, id); + List segments = traffic.LoadSegments(); + if (segments != null) + segments.ForEach(s => Segments.Add(s)); + } catch (Exception) { + IsSegmentEditorEnabled = false; + throw; + } + } + } +} diff --git a/client/DxPlay/PlayerForm.Designer.cs b/client/DxPlay/PlayerForm.Designer.cs index 355089a5..9e1cefff 100644 --- a/client/DxPlay/PlayerForm.Designer.cs +++ b/client/DxPlay/PlayerForm.Designer.cs @@ -5,15 +5,6 @@ using System.Windows.Forms; namespace DxPlay { partial class PlayerForm : Form { private Panel pVideo; - private NoFocusCueButton btnPlay; - private NoFocusCueButton btnPause; - private TextBox lbCurrentTC; - private NoFocusCueButton btnStop; - private TextBox lbStartTC; - private TextBox lbEndTC; - private Panel panel3; - private Label lbDuration; - private Label lbStart; /// /// Clean up any resources being used. @@ -41,22 +32,6 @@ namespace DxPlay { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlayerForm)); this.pVideo = new System.Windows.Forms.Panel(); - this.lbCurrentTC = new System.Windows.Forms.TextBox(); - this.lbStartTC = new System.Windows.Forms.TextBox(); - this.lbEndTC = new System.Windows.Forms.TextBox(); - this.panel3 = new System.Windows.Forms.Panel(); - this.lbStatus = new System.Windows.Forms.Label(); - this.trackBar1 = new MaestroShared.Controls.ColorSlider(); - this.lbDuration = new System.Windows.Forms.Label(); - this.lbStart = new System.Windows.Forms.Label(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.panelPlayer = new System.Windows.Forms.Panel(); - this.pControls = new System.Windows.Forms.FlowLayoutPanel(); - this.btnPlay = new MaestroShared.Controls.NoFocusCueButton(); - this.btnStop = new MaestroShared.Controls.NoFocusCueButton(); - this.btnPause = new MaestroShared.Controls.NoFocusCueButton(); - this.dgSegments = new System.Windows.Forms.DataGridView(); - this.bsSegments = new System.Windows.Forms.BindingSource(this.components); this.menuButtonSegmentActions = new DxPlay.MenuButton(); this.ctxmSegmentActions = new System.Windows.Forms.ContextMenuStrip(this.components); this.defineOneSegmentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -64,282 +39,70 @@ namespace DxPlay { this.deleteSegmentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.actualPositionToIntroToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.actualPositionToOutroToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.panel3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); + this.mainSplit = new System.Windows.Forms.SplitContainer(); + this.panelPlayer = new System.Windows.Forms.Panel(); + this.marginPanel = new System.Windows.Forms.Panel(); + this.tabEditor = new System.Windows.Forms.TabControl(); + this.tpMetadata = new System.Windows.Forms.TabPage(); + this.trafficBrowser = new TrafficClient.TrafficIDSelector(); + this.tpSegments = new System.Windows.Forms.TabPage(); + this.dgSegments = new System.Windows.Forms.DataGridView(); + this.bsSegments = new System.Windows.Forms.BindingSource(this.components); + this.segmentActions = new System.Windows.Forms.ToolStrip(); + this.toolStripButton5 = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton4 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.imagesTabEdit = new System.Windows.Forms.ImageList(this.components); + this.mainMenu = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuOpenFile = new DxPlay.Controls.BindableToolStripMenuItem(); + this.menuApprove = new DxPlay.Controls.BindableToolStripMenuItem(); + this.playerControls = new DxPlay.Controls.PlayerControls(); + this.pVideo.SuspendLayout(); + this.ctxmSegmentActions.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.mainSplit)).BeginInit(); + this.mainSplit.Panel1.SuspendLayout(); + this.mainSplit.Panel2.SuspendLayout(); + this.mainSplit.SuspendLayout(); this.panelPlayer.SuspendLayout(); - this.pControls.SuspendLayout(); + this.marginPanel.SuspendLayout(); + this.tabEditor.SuspendLayout(); + this.tpMetadata.SuspendLayout(); + this.tpSegments.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgSegments)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsSegments)).BeginInit(); - this.ctxmSegmentActions.SuspendLayout(); + this.segmentActions.SuspendLayout(); + this.mainMenu.SuspendLayout(); this.SuspendLayout(); // // pVideo // this.pVideo.BackColor = System.Drawing.Color.Black; + this.pVideo.Controls.Add(this.menuButtonSegmentActions); this.pVideo.Dock = System.Windows.Forms.DockStyle.Fill; this.pVideo.Location = new System.Drawing.Point(0, 0); this.pVideo.Name = "pVideo"; - this.pVideo.Size = new System.Drawing.Size(675, 433); + this.pVideo.Size = new System.Drawing.Size(689, 489); this.pVideo.TabIndex = 10; this.pVideo.TabStop = true; this.pVideo.SizeChanged += new System.EventHandler(this.panel1_SizeChanged); this.pVideo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // - // lbCurrentTC - // - this.lbCurrentTC.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.lbCurrentTC.BackColor = System.Drawing.Color.White; - this.lbCurrentTC.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.lbCurrentTC.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.lbCurrentTC.Location = new System.Drawing.Point(284, 12); - this.lbCurrentTC.Name = "lbCurrentTC"; - this.lbCurrentTC.ReadOnly = true; - this.lbCurrentTC.Size = new System.Drawing.Size(108, 27); - this.lbCurrentTC.TabIndex = 15; - this.lbCurrentTC.TabStop = false; - this.lbCurrentTC.Text = "00:00:00.00"; - // - // lbStartTC - // - this.lbStartTC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lbStartTC.BackColor = System.Drawing.Color.White; - this.lbStartTC.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.lbStartTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.lbStartTC.ForeColor = System.Drawing.SystemColors.WindowText; - this.lbStartTC.Location = new System.Drawing.Point(6, 21); - this.lbStartTC.Name = "lbStartTC"; - this.lbStartTC.ReadOnly = true; - this.lbStartTC.Size = new System.Drawing.Size(66, 17); - this.lbStartTC.TabIndex = 16; - this.lbStartTC.TabStop = false; - this.lbStartTC.Text = "00:00:00.00"; - // - // lbEndTC - // - this.lbEndTC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.lbEndTC.BackColor = System.Drawing.Color.White; - this.lbEndTC.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.lbEndTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.lbEndTC.ForeColor = System.Drawing.SystemColors.WindowText; - this.lbEndTC.Location = new System.Drawing.Point(605, 24); - this.lbEndTC.Name = "lbEndTC"; - this.lbEndTC.ReadOnly = true; - this.lbEndTC.Size = new System.Drawing.Size(65, 17); - this.lbEndTC.TabIndex = 17; - this.lbEndTC.TabStop = false; - this.lbEndTC.Text = "00:00:00.00"; - this.lbEndTC.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // panel3 - // - this.panel3.Controls.Add(this.lbStatus); - this.panel3.Controls.Add(this.trackBar1); - this.panel3.Controls.Add(this.lbDuration); - this.panel3.Controls.Add(this.lbStart); - this.panel3.Controls.Add(this.lbStartTC); - this.panel3.Controls.Add(this.lbEndTC); - this.panel3.Controls.Add(this.lbCurrentTC); - this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel3.Location = new System.Drawing.Point(0, 433); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(675, 51); - this.panel3.TabIndex = 19; - // - // lbStatus - // - this.lbStatus.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.lbStatus.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.lbStatus.Location = new System.Drawing.Point(281, 4); - this.lbStatus.Name = "lbStatus"; - this.lbStatus.Size = new System.Drawing.Size(111, 13); - this.lbStatus.TabIndex = 20; - this.lbStatus.Text = "NO INPUT"; - this.lbStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // trackBar1 - // - this.trackBar1.BackColor = System.Drawing.Color.Transparent; - this.trackBar1.BarInnerColor = System.Drawing.Color.Transparent; - this.trackBar1.BarOuterColor = System.Drawing.Color.Black; - this.trackBar1.BarPenColor = System.Drawing.Color.Black; - this.trackBar1.BorderRoundRectSize = new System.Drawing.Size(8, 8); - this.trackBar1.Cursor = System.Windows.Forms.Cursors.Hand; - this.trackBar1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.trackBar1.ElapsedInnerColor = System.Drawing.Color.Black; - this.trackBar1.ElapsedOuterColor = System.Drawing.Color.DarkGray; - this.trackBar1.LargeChange = ((uint)(0u)); - this.trackBar1.Location = new System.Drawing.Point(0, 41); - this.trackBar1.Maximum = 1; - this.trackBar1.Name = "trackBar1"; - this.trackBar1.Size = new System.Drawing.Size(675, 10); - this.trackBar1.SmallChange = ((uint)(1u)); - this.trackBar1.TabIndex = 18; - this.trackBar1.Text = "colorSlider1"; - this.trackBar1.ThumbInnerColor = System.Drawing.Color.Black; - this.trackBar1.ThumbOuterColor = System.Drawing.Color.Silver; - this.trackBar1.ThumbPenColor = System.Drawing.Color.Black; - this.trackBar1.ThumbRoundRectSize = new System.Drawing.Size(8, 8); - this.trackBar1.ThumbSize = 10; - this.trackBar1.Value = 0; - this.trackBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar1_MouseDown); - this.trackBar1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.trackBar1_MouseUp); - // - // lbDuration - // - this.lbDuration.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.lbDuration.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.lbDuration.Location = new System.Drawing.Point(605, 5); - this.lbDuration.Name = "lbDuration"; - this.lbDuration.Size = new System.Drawing.Size(68, 13); - this.lbDuration.TabIndex = 19; - this.lbDuration.Text = "DURATION"; - this.lbDuration.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbStart - // - this.lbStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lbStart.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.lbStart.Location = new System.Drawing.Point(3, 5); - this.lbStart.Name = "lbStart"; - this.lbStart.Size = new System.Drawing.Size(69, 13); - this.lbStart.TabIndex = 18; - this.lbStart.Text = "START"; - this.lbStart.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.panelPlayer); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.dgSegments); - this.splitContainer1.Panel2.Controls.Add(this.menuButtonSegmentActions); - this.splitContainer1.Size = new System.Drawing.Size(936, 544); - this.splitContainer1.SplitterDistance = 675; - this.splitContainer1.TabIndex = 20; - // - // panelPlayer - // - this.panelPlayer.Controls.Add(this.pVideo); - this.panelPlayer.Controls.Add(this.panel3); - this.panelPlayer.Controls.Add(this.pControls); - this.panelPlayer.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelPlayer.Location = new System.Drawing.Point(0, 0); - this.panelPlayer.Name = "panelPlayer"; - this.panelPlayer.Size = new System.Drawing.Size(675, 544); - this.panelPlayer.TabIndex = 0; - // - // pControls - // - this.pControls.AutoSize = true; - this.pControls.Controls.Add(this.btnPlay); - this.pControls.Controls.Add(this.btnStop); - this.pControls.Controls.Add(this.btnPause); - this.pControls.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pControls.Location = new System.Drawing.Point(0, 484); - this.pControls.Name = "pControls"; - this.pControls.Size = new System.Drawing.Size(675, 60); - this.pControls.TabIndex = 20; - // - // btnPlay - // - this.btnPlay.AutoSize = true; - this.btnPlay.BackColor = System.Drawing.Color.Transparent; - this.btnPlay.FlatAppearance.BorderSize = 0; - this.btnPlay.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnPlay.Image = global::DxPlay.Properties.Resources.ic_play_arrow_black_24dp_2x; - this.btnPlay.Location = new System.Drawing.Point(3, 3); - this.btnPlay.Name = "btnPlay"; - this.btnPlay.Size = new System.Drawing.Size(54, 54); - this.btnPlay.TabIndex = 1; - this.btnPlay.TabStop = false; - this.btnPlay.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.btnPlay.UseVisualStyleBackColor = false; - this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click); - // - // btnStop - // - this.btnStop.AutoSize = true; - this.btnStop.BackColor = System.Drawing.Color.Transparent; - this.btnStop.FlatAppearance.BorderSize = 0; - this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnStop.Image = global::DxPlay.Properties.Resources.ic_stop_black_24dp_2x; - this.btnStop.Location = new System.Drawing.Point(63, 3); - this.btnStop.Name = "btnStop"; - this.btnStop.Size = new System.Drawing.Size(54, 54); - this.btnStop.TabIndex = 16; - this.btnStop.TabStop = false; - this.btnStop.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.btnStop.UseVisualStyleBackColor = false; - this.btnStop.Click += new System.EventHandler(this.btnStop_Click); - // - // btnPause - // - this.btnPause.AutoSize = true; - this.btnPause.BackColor = System.Drawing.Color.Transparent; - this.btnPause.FlatAppearance.BorderSize = 0; - this.btnPause.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnPause.Image = global::DxPlay.Properties.Resources.ic_pause_black_24dp_2x; - this.btnPause.Location = new System.Drawing.Point(123, 3); - this.btnPause.Name = "btnPause"; - this.btnPause.Size = new System.Drawing.Size(54, 54); - this.btnPause.TabIndex = 11; - this.btnPause.TabStop = false; - this.btnPause.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.btnPause.UseVisualStyleBackColor = false; - this.btnPause.Click += new System.EventHandler(this.btnPause_Click); - // - // dgSegments - // - this.dgSegments.AllowUserToAddRows = false; - this.dgSegments.AllowUserToOrderColumns = true; - this.dgSegments.AllowUserToResizeRows = false; - this.dgSegments.AutoGenerateColumns = false; - this.dgSegments.BackgroundColor = System.Drawing.Color.White; - this.dgSegments.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.dgSegments.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgSegments.DataSource = this.bsSegments; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgSegments.DefaultCellStyle = dataGridViewCellStyle1; - this.dgSegments.Dock = System.Windows.Forms.DockStyle.Fill; - this.dgSegments.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnF2; - this.dgSegments.Location = new System.Drawing.Point(0, 23); - this.dgSegments.MultiSelect = false; - this.dgSegments.Name = "dgSegments"; - this.dgSegments.RowHeadersVisible = false; - this.dgSegments.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgSegments.Size = new System.Drawing.Size(257, 521); - this.dgSegments.TabIndex = 1; - this.dgSegments.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgSegments_CellContentClick); - this.dgSegments.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgSegments_CellMouseDoubleClick); - this.dgSegments.ColumnAdded += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dgSegments_ColumnAdded); - // // menuButtonSegmentActions // this.menuButtonSegmentActions.BackColor = System.Drawing.Color.White; - this.menuButtonSegmentActions.Dock = System.Windows.Forms.DockStyle.Top; - this.menuButtonSegmentActions.Location = new System.Drawing.Point(0, 0); + this.menuButtonSegmentActions.Location = new System.Drawing.Point(389, 462); this.menuButtonSegmentActions.Menu = this.ctxmSegmentActions; this.menuButtonSegmentActions.Name = "menuButtonSegmentActions"; - this.menuButtonSegmentActions.Size = new System.Drawing.Size(257, 23); + this.menuButtonSegmentActions.Size = new System.Drawing.Size(297, 23); this.menuButtonSegmentActions.TabIndex = 0; this.menuButtonSegmentActions.Text = "Segment actions"; this.menuButtonSegmentActions.UseVisualStyleBackColor = false; + this.menuButtonSegmentActions.Visible = false; // // ctxmSegmentActions // @@ -387,13 +150,269 @@ namespace DxPlay { this.actualPositionToOutroToolStripMenuItem.Text = "Actual position to TCOut"; this.actualPositionToOutroToolStripMenuItem.Click += new System.EventHandler(this.OnActualPositionToTCOutToolStripMenuItem1Click); // + // mainSplit + // + this.mainSplit.BackColor = System.Drawing.Color.DimGray; + this.mainSplit.Dock = System.Windows.Forms.DockStyle.Fill; + this.mainSplit.Location = new System.Drawing.Point(0, 24); + this.mainSplit.Name = "mainSplit"; + // + // mainSplit.Panel1 + // + this.mainSplit.Panel1.Controls.Add(this.panelPlayer); + // + // mainSplit.Panel2 + // + this.mainSplit.Panel2.Controls.Add(this.marginPanel); + this.mainSplit.Size = new System.Drawing.Size(990, 489); + this.mainSplit.SplitterDistance = 689; + this.mainSplit.TabIndex = 20; + // + // panelPlayer + // + this.panelPlayer.Controls.Add(this.pVideo); + this.panelPlayer.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelPlayer.Location = new System.Drawing.Point(0, 0); + this.panelPlayer.Name = "panelPlayer"; + this.panelPlayer.Size = new System.Drawing.Size(689, 489); + this.panelPlayer.TabIndex = 0; + // + // marginPanel + // + this.marginPanel.BackColor = System.Drawing.SystemColors.ControlDark; + this.marginPanel.Controls.Add(this.tabEditor); + this.marginPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.marginPanel.Location = new System.Drawing.Point(0, 0); + this.marginPanel.Name = "marginPanel"; + this.marginPanel.Padding = new System.Windows.Forms.Padding(4); + this.marginPanel.Size = new System.Drawing.Size(297, 489); + this.marginPanel.TabIndex = 3; + // + // tabEditor + // + this.tabEditor.Alignment = System.Windows.Forms.TabAlignment.Bottom; + this.tabEditor.Controls.Add(this.tpMetadata); + this.tabEditor.Controls.Add(this.tpSegments); + this.tabEditor.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabEditor.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.tabEditor.ImageList = this.imagesTabEdit; + this.tabEditor.Location = new System.Drawing.Point(4, 4); + this.tabEditor.Multiline = true; + this.tabEditor.Name = "tabEditor"; + this.tabEditor.Padding = new System.Drawing.Point(10, 5); + this.tabEditor.SelectedIndex = 0; + this.tabEditor.Size = new System.Drawing.Size(289, 481); + this.tabEditor.TabIndex = 2; + // + // tpMetadata + // + this.tpMetadata.BackColor = System.Drawing.Color.Transparent; + this.tpMetadata.Controls.Add(this.trafficBrowser); + this.tpMetadata.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.tpMetadata.ImageIndex = 0; + this.tpMetadata.Location = new System.Drawing.Point(4, 4); + this.tpMetadata.Name = "tpMetadata"; + this.tpMetadata.Padding = new System.Windows.Forms.Padding(3); + this.tpMetadata.Size = new System.Drawing.Size(281, 442); + this.tpMetadata.TabIndex = 0; + this.tpMetadata.Text = "Metadata"; + // + // trafficBrowser + // + this.trafficBrowser.BackColor = System.Drawing.Color.White; + this.trafficBrowser.Dock = System.Windows.Forms.DockStyle.Fill; + this.trafficBrowser.IDChangedEvent = null; + this.trafficBrowser.Location = new System.Drawing.Point(3, 3); + this.trafficBrowser.Margin = new System.Windows.Forms.Padding(0); + this.trafficBrowser.Name = "trafficBrowser"; + this.trafficBrowser.Size = new System.Drawing.Size(275, 436); + this.trafficBrowser.TabIndex = 0; + // + // tpSegments + // + this.tpSegments.Controls.Add(this.dgSegments); + this.tpSegments.Controls.Add(this.segmentActions); + this.tpSegments.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.tpSegments.ImageIndex = 1; + this.tpSegments.Location = new System.Drawing.Point(4, 4); + this.tpSegments.Name = "tpSegments"; + this.tpSegments.Padding = new System.Windows.Forms.Padding(3); + this.tpSegments.Size = new System.Drawing.Size(281, 442); + this.tpSegments.TabIndex = 1; + this.tpSegments.Text = "Segments"; + this.tpSegments.UseVisualStyleBackColor = true; + // + // dgSegments + // + this.dgSegments.AllowUserToAddRows = false; + this.dgSegments.AllowUserToOrderColumns = true; + this.dgSegments.AllowUserToResizeRows = false; + this.dgSegments.AutoGenerateColumns = false; + this.dgSegments.BackgroundColor = System.Drawing.Color.White; + this.dgSegments.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dgSegments.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgSegments.DataSource = this.bsSegments; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgSegments.DefaultCellStyle = dataGridViewCellStyle1; + this.dgSegments.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgSegments.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnF2; + this.dgSegments.Location = new System.Drawing.Point(3, 28); + this.dgSegments.MultiSelect = false; + this.dgSegments.Name = "dgSegments"; + this.dgSegments.RowHeadersVisible = false; + this.dgSegments.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dgSegments.Size = new System.Drawing.Size(275, 411); + this.dgSegments.TabIndex = 1; + this.dgSegments.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgSegments_CellContentClick); + this.dgSegments.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgSegments_CellMouseDoubleClick); + this.dgSegments.ColumnAdded += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dgSegments_ColumnAdded); + // + // segmentActions + // + this.segmentActions.AutoSize = false; + this.segmentActions.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.segmentActions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton5, + this.toolStripSeparator2, + this.toolStripButton1, + this.toolStripButton4, + this.toolStripButton2, + this.toolStripSeparator1, + this.toolStripButton3}); + this.segmentActions.Location = new System.Drawing.Point(3, 3); + this.segmentActions.Name = "segmentActions"; + this.segmentActions.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.segmentActions.Size = new System.Drawing.Size(275, 25); + this.segmentActions.TabIndex = 0; + this.segmentActions.Text = "toolStrip1"; + // + // toolStripButton5 + // + this.toolStripButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton5.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton5.Image"))); + this.toolStripButton5.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButton5.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton5.Name = "toolStripButton5"; + this.toolStripButton5.Size = new System.Drawing.Size(23, 22); + this.toolStripButton5.Text = "toolStripButton5"; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); + this.toolStripButton1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "toolStripButton1"; + // + // toolStripButton4 + // + this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image"))); + this.toolStripButton4.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton4.Name = "toolStripButton4"; + this.toolStripButton4.Size = new System.Drawing.Size(23, 22); + this.toolStripButton4.Text = "toolStripButton4"; + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); + this.toolStripButton2.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = "toolStripButton2"; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); + this.toolStripButton3.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(23, 22); + this.toolStripButton3.Text = "toolStripButton3"; + // + // imagesTabEdit + // + this.imagesTabEdit.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imagesTabEdit.ImageStream"))); + this.imagesTabEdit.TransparentColor = System.Drawing.Color.Transparent; + this.imagesTabEdit.Images.SetKeyName(0, "round_publish_black_24dp.png"); + this.imagesTabEdit.Images.SetKeyName(1, "ic_playlist_add_check_black_24dp_1x.png"); + // + // mainMenu + // + this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem}); + this.mainMenu.Location = new System.Drawing.Point(0, 0); + this.mainMenu.Name = "mainMenu"; + this.mainMenu.Size = new System.Drawing.Size(990, 24); + this.mainMenu.TabIndex = 21; + this.mainMenu.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuOpenFile, + this.menuApprove}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // menuOpenFile + // + this.menuOpenFile.Name = "menuOpenFile"; + this.menuOpenFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.menuOpenFile.Size = new System.Drawing.Size(165, 22); + this.menuOpenFile.Text = "Open file"; + this.menuOpenFile.Click += new System.EventHandler(this.menuOpenFile_Click); + // + // menuApprove + // + this.menuApprove.Name = "menuApprove"; + this.menuApprove.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.menuApprove.Size = new System.Drawing.Size(165, 22); + this.menuApprove.Text = "Approve"; + this.menuApprove.Click += new System.EventHandler(this.OnClick_menuApprove); + // + // playerControls + // + this.playerControls.AutoSize = true; + this.playerControls.Dock = System.Windows.Forms.DockStyle.Bottom; + this.playerControls.Location = new System.Drawing.Point(0, 513); + this.playerControls.Margin = new System.Windows.Forms.Padding(0); + this.playerControls.Name = "playerControls"; + this.playerControls.Size = new System.Drawing.Size(990, 116); + this.playerControls.TabIndex = 22; + // // PlayerForm // this.AllowDrop = true; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(936, 544); - this.Controls.Add(this.splitContainer1); + this.ClientSize = new System.Drawing.Size(990, 629); + this.Controls.Add(this.mainSplit); + this.Controls.Add(this.mainMenu); + this.Controls.Add(this.playerControls); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.MinimumSize = new System.Drawing.Size(640, 480); @@ -408,27 +427,29 @@ namespace DxPlay { this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Form1_DragEnter); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PlayerForm_KeyDown); this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.PlayerForm_PreviewKeyDown); - this.panel3.ResumeLayout(false); - this.panel3.PerformLayout(); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); + this.pVideo.ResumeLayout(false); + this.ctxmSegmentActions.ResumeLayout(false); + this.mainSplit.Panel1.ResumeLayout(false); + this.mainSplit.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.mainSplit)).EndInit(); + this.mainSplit.ResumeLayout(false); this.panelPlayer.ResumeLayout(false); - this.panelPlayer.PerformLayout(); - this.pControls.ResumeLayout(false); - this.pControls.PerformLayout(); + this.marginPanel.ResumeLayout(false); + this.tabEditor.ResumeLayout(false); + this.tpMetadata.ResumeLayout(false); + this.tpSegments.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dgSegments)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsSegments)).EndInit(); - this.ctxmSegmentActions.ResumeLayout(false); + this.segmentActions.ResumeLayout(false); + this.segmentActions.PerformLayout(); + this.mainMenu.ResumeLayout(false); + this.mainMenu.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion - - private ColorSlider trackBar1; - private Label lbStatus; - private SplitContainer splitContainer1; + private SplitContainer mainSplit; private Panel panelPlayer; private MenuButton menuButtonSegmentActions; private ContextMenuStrip ctxmSegmentActions; @@ -440,7 +461,25 @@ namespace DxPlay { private ToolStripMenuItem deleteSegmentToolStripMenuItem; private ToolStripMenuItem actualPositionToIntroToolStripMenuItem; private ToolStripMenuItem actualPositionToOutroToolStripMenuItem; - private FlowLayoutPanel pControls; + private MenuStrip mainMenu; + private ToolStripMenuItem fileToolStripMenuItem; + private DxPlay.Controls.BindableToolStripMenuItem menuOpenFile; + private DxPlay.Controls.BindableToolStripMenuItem menuApprove; + private Controls.PlayerControls playerControls; + private TabControl tabEditor; + private TabPage tpMetadata; + private TabPage tpSegments; + private ToolStrip segmentActions; + private ToolStripButton toolStripButton1; + private ToolStripButton toolStripButton2; + private ToolStripButton toolStripButton3; + private ToolStripButton toolStripButton4; + private ToolStripButton toolStripButton5; + private ImageList imagesTabEdit; + private Panel marginPanel; + private TrafficClient.TrafficIDSelector trafficBrowser; + private ToolStripSeparator toolStripSeparator2; + private ToolStripSeparator toolStripSeparator1; } } diff --git a/client/DxPlay/PlayerForm.cs b/client/DxPlay/PlayerForm.cs index 9bcc9c79..884a4f72 100644 --- a/client/DxPlay/PlayerForm.cs +++ b/client/DxPlay/PlayerForm.cs @@ -1,104 +1,136 @@ using System; using System.Windows.Forms; -using System.Diagnostics; -using static DxPlay.DxPlayer; -using JR.Utils.GUI.Forms; using System.IO; using System.Linq; -using System.ComponentModel; using MaestroShared.Metadata; +using NLog; +using DxPlay.Model; namespace DxPlay { public partial class PlayerForm : Form { + private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - private BindingList segments; private DateTime lastClick = DateTime.Now; private string selectedFile; private volatile bool trackBarAtUser; private DxPlayer m_play = null; private MediaDescription m_mediaDescription = null; - public bool AutoStart; + private OpenFileDialog openFileDialog = new OpenFileDialog() { Filter = "All files (*.*)|*.*" }; - public bool SegmentEditor { get; set; } + private DxPlaySettings settings; + public DxPlaySettings Settings { + get { + return settings; + } + set { + settings = value ?? throw new NullReferenceException("DxPlaySettings"); + Model = new DxPlayModel(value); + } + } - public PlayerForm() { - InitializeComponent(); - InitializeTexts(); + private DxPlayModel model; + public DxPlayModel Model { + get { return model; } + set { + model = value ?? throw new NullReferenceException("DxPlayModel"); + ApplyModel(); + } + } + + /// + /// User control cimkejenek rendszeres frissitese villogast eredmenyez e nelkul + /// + protected override CreateParams CreateParams { + get { + CreateParams cp = base.CreateParams; + cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED + return cp; + } + } + private void ApplyModel() { + bsSegments.DataSource = model.Segments; + dgSegments.AutoGenerateColumns = true; + mainMenu.DataBindings.Add(new Binding("Visible", model, "IsMenuVisible")); + menuOpenFile.DataBindings.Add(new Binding("Enabled", model, "IsMenuVisible")); + menuApprove.DataBindings.Add(new Binding("Enabled", model, "IsApproveEnabled")); + Binding segmentEditorPanelBinding = new Binding("Panel2Collapsed", model, "IsSegmentEditorEnabled"); + segmentEditorPanelBinding.Format += (s, e) => { + bool enabled = (bool)e.Value; + e.Value = !enabled; + if (enabled) + mainSplit.Panel2.Show(); + else + mainSplit.Panel2.Hide(); + }; + mainSplit.DataBindings.Add(segmentEditorPanelBinding); } - public PlayerForm(ref BindingList segments) { - this.segments = segments; + public PlayerForm() { InitializeComponent(); - InitializeTexts(); + + playerControls.Play.Click += btnPlay_Click; + playerControls.Stop.Click += btnStop_Click; + playerControls.Pause.Click += btnPause_Click; + + playerControls.TrackBar.MouseDown += trackBar1_MouseDown; + playerControls.TrackBar.MouseUp += trackBar1_MouseUp; } private void InitializeTexts() { - defineOneSegmentToolStripMenuItem.Text = StringResource.SZEGMENS_DEFINIALASA; - splitSegmentAtCurrentPositionToolStripMenuItem.Text = StringResource.SZEGMENS_SZETVAGASA; - actualPositionToIntroToolStripMenuItem.Text = StringResource.AKTUALIS_POZICIO_BELEPO; - actualPositionToOutroToolStripMenuItem.Text = StringResource.AKTUALIS_POZICIO_KILEPO; - deleteSegmentToolStripMenuItem.Text = StringResource.SZEGMENS_TORLESE; - menuButtonSegmentActions.Text = StringResource.SZEGMENSEK; + defineOneSegmentToolStripMenuItem.Text = Settings.Resource("define-segment", StringResource.SZEGMENS_DEFINIALASA); + splitSegmentAtCurrentPositionToolStripMenuItem.Text = Settings.Resource("break-segment", StringResource.SZEGMENS_SZETVAGASA); + actualPositionToIntroToolStripMenuItem.Text = Settings.Resource("position-as-tcin", StringResource.AKTUALIS_POZICIO_BELEPO); + actualPositionToOutroToolStripMenuItem.Text = Settings.Resource("position-as-tcout", StringResource.AKTUALIS_POZICIO_KILEPO); + deleteSegmentToolStripMenuItem.Text = Settings.Resource("delete-segment", StringResource.SZEGMENS_TORLESE); + menuButtonSegmentActions.Text = Settings.Resource("segments", StringResource.SZEGMENSEK); - //btnPause.Text = StringResource.SZUNET; - //btnPlay.Text = StringResource.LEJATSZAS; - //btnStop.Text = StringResource.LEALLITAS; - lbStatus.Text = StringResource.NINCS_BEMENET; - lbStart.Text = StringResource.INDULASI_PONT; - lbDuration.Text = StringResource.HOSSZ; + ToolTip tt = new ToolTip(); + tt.SetToolTip(playerControls.Pause, Settings.Resource("pause", StringResource.SZUNET)); + tt.SetToolTip(playerControls.Play, Settings.Resource("play", StringResource.LEJATSZAS)); + tt.SetToolTip(playerControls.Stop, Settings.Resource("stop", StringResource.LEALLITAS)); + playerControls.Status.Text = Settings.Resource("no-input", StringResource.NINCS_BEMENET); + playerControls.Start.Text = Settings.Resource("start", StringResource.INDULASI_PONT); + playerControls.Duration.Text = Settings.Resource("length", StringResource.HOSSZ); } - private void cueue() { + private void Cueue() { m_play = null; try { //m_mediaDescription = MediaDetector.GetDescription(selectedFile); m_mediaDescription = new MediaDescription() { fileName = selectedFile }; - trackBar1.Value = 0; - trackBar1.Minimum = 0; - m_play = new DxPlayer(pVideo, ref m_mediaDescription); + playerControls.TrackBar.Value = 0; + playerControls.TrackBar.Minimum = 0; + m_play = new DxPlayer(pVideo, ref m_mediaDescription, Settings); if (m_play.IsError) - throw new Exception(selectedFile); + throw new Exception(selectedFile); - m_play.PlayEvent += new DxPlayEvent(playEvent); + m_play.PlayEvent += new DxPlayEvent(OnPlayEvent); if (m_mediaDescription != null) { - trackBar1.Maximum = m_mediaDescription.Duration.Frames; - lbStartTC.Text = m_mediaDescription.FirstFrame.ToString(); - lbEndTC.Text = m_mediaDescription.Duration.ToString(); + playerControls.TrackBar.Maximum = m_mediaDescription.Duration.Frames; + playerControls.StartTC.Text = m_mediaDescription.FirstFrame.ToString(); + playerControls.EndTC.Text = m_mediaDescription.Duration.ToString(); } - } - catch (Exception ce) { + } catch (Exception ce) { MessageBox.Show("Az állomány nem tölthetõ be: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } } - private void playEvent() { + private void OnPlayEvent() { if (!IsHandleCreated || Disposing || IsDisposed || m_play == null) return; - //Debug.WriteLine("Event " + m_play.State); - //switch (m_play.State) { - // case GraphState.Paused: { - // break; - // } - // case GraphState.Stopped: { - // break; - // } - // case GraphState.Playing: { - // break; - // } - //} BeginInvoke((Action)(() => { if (Disposing || IsDisposed || m_play == null) return; if (!trackBarAtUser) - trackBar1.Value = m_play.CurrentTC.ZeroBasedFrames; - lbCurrentTC.Text = m_play.CurrentTC.ToString(); - string labelStatusText = lbStatus.Text; - m_play.stateHunStringValues.TryGetValue(m_play.State, out labelStatusText);//m_play.State.ToString().ToUpper(); - lbStatus.Text = labelStatusText; + playerControls.TrackBar.Value = m_play.CurrentTC.ZeroBasedFrames; + playerControls.CurrentTC.Text = m_play.CurrentTC.ToString(); + string labelStatusText = playerControls.Status.Text; + m_play.stringValues.TryGetValue(m_play.State, out labelStatusText); + playerControls.Status.Text = labelStatusText; })); } @@ -112,38 +144,42 @@ namespace DxPlay { } public void Open(FileInfo fileInfo) { + logger.Debug("Open"); + if (m_play != null) + m_play.Dispose(); this.Text = fileInfo.Name; selectedFile = fileInfo.FullName; - if (m_play != null && selectedFile != m_mediaDescription.FileName) { - m_play.Stop(); - m_play.Dispose(); - m_play = null; + + Cueue(); + + if (model.IsMenuVisible) { + openFileDialog.InitialDirectory = fileInfo.Directory.FullName; + string id = fileInfo.Name.Replace(fileInfo.Extension, ""); + try { + model.InitializeSegments(id); + } catch (Exception e) { + MessageBox.Show(e.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); + logger.Error(e); + } } - cueue(); - //BringToFront(); - //Activate(); } + private void Form1_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); FileInfo fileInfo = new FileInfo(files[0]); Open(fileInfo); - ShowFirstFrame(); } private void panel1_MouseDown(object sender, MouseEventArgs e) { - if (e.Button == MouseButtons.Left) { + if (m_play != null && e.Button == MouseButtons.Left) { DateTime currentClick = DateTime.Now; if ((currentClick - lastClick).TotalMilliseconds < 300) { m_play.ToggleFullscreen(); - Debug.WriteLine("Fullscreen"); + logger.Debug("Fullscreen"); } else lastClick = currentClick; } - - //if (e.Button == MouseButtons.Right) { - // FlexibleMessageBox.Show(m_play.MediaDescription.Description); - //} } private void panel1_SizeChanged(object sender, EventArgs e) { @@ -159,23 +195,10 @@ namespace DxPlay { private void trackBar1_MouseUp(object sender, MouseEventArgs e) { if (trackBarAtUser) { trackBarAtUser = false; - /* - DateTime currentClick = DateTime.Now; - if ((currentClick - lastClick).TotalMilliseconds < 300) { - double absoluteMouse = (double)e.X / trackBar1.Width; - int seek = (int)Math.Round(trackBar1.Maximum * absoluteMouse); - m_play.Seek(seek); - } else { - if (m_play != null) - m_play.Seek(trackBar1.Value); - else - trackBar1.Value = 0; - } - */ if (m_play != null) - m_play.Seek(trackBar1.Value); + m_play.Seek(playerControls.TrackBar.Value); else - trackBar1.Value = 0; + playerControls.TrackBar.Value = 0; } } @@ -195,22 +218,21 @@ namespace DxPlay { m_play.Pause(); } - private void PlayerForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Space || e.KeyCode == Keys.Escape) { e.IsInputKey = false; } } - private void DisableHotKeysDefaults(Control.ControlCollection controls) { - foreach (Control control in controls) { - if (control.Equals(dgSegments)) - continue; - control.PreviewKeyDown += new PreviewKeyDownEventHandler(PlayerForm_PreviewKeyDown); - if (control.HasChildren) - DisableHotKeysDefaults(control.Controls); - } - } + //private void DisableHotKeysDefaults(Control.ControlCollection controls) { + // foreach (Control control in controls) { + // if (control.Equals(dgSegments)) + // continue; + // control.PreviewKeyDown += new PreviewKeyDownEventHandler(PlayerForm_PreviewKeyDown); + // if (control.HasChildren) + // DisableHotKeysDefaults(control.Controls); + // } + //} private void PlayerForm_Load(object sender, EventArgs e) { //DisableHotKeysDefaults(this.Controls); @@ -218,25 +240,15 @@ namespace DxPlay { InterceptKeys.Start(); InterceptKeys.GlobalKeyEvent += HandleHotKey; - bsSegments.DataSource = segments; - dgSegments.AutoGenerateColumns = true; - - if (SegmentEditor) { - splitContainer1.Panel2Collapsed = false; - splitContainer1.Panel2.Show(); - } else { - splitContainer1.Panel2Collapsed = true; - splitContainer1.Panel2.Hide(); - } - - lbStartTC.BackColor = BackColor; - lbDuration.BackColor = BackColor; - lbEndTC.BackColor = BackColor; - lbCurrentTC.BackColor = BackColor; - lbStart.BackColor = BackColor; - lbStatus.BackColor = BackColor; + playerControls.BackColor = BackColor; + playerControls.StartTC.BackColor = BackColor; + playerControls.Duration.BackColor = BackColor; + playerControls.EndTC.BackColor = BackColor; + playerControls.CurrentTC.BackColor = BackColor; + playerControls.Start.BackColor = BackColor; + playerControls.Status.BackColor = BackColor; dgSegments.BackgroundColor = BackColor; - + trafficBrowser.BackColor = BackColor; } private void PlayerForm_KeyDown(object sender, KeyEventArgs e) { @@ -249,67 +261,73 @@ namespace DxPlay { } private bool HandleHotKey(Keys keyCode) { - Debug.WriteLine("Key pressed " + keyCode); - if (m_play == null || dgSegments.IsCurrentCellInEditMode || (!m_play.IsFullscreen() && !this.ContainsFocus)) - return true; - Debug.WriteLine("Handling " + keyCode); + logger.Debug("Key pressed " + keyCode); + if (dgSegments.IsCurrentCellInEditMode || (m_play != null && !m_play.IsFullscreen() && !ContainsFocus)) + return true; + logger.Debug("Handling " + keyCode); bool result = false; switch (keyCode) { case Keys.Return: - if (ModifierKeys.HasFlag(Keys.Shift)) { + if (m_play != null && ModifierKeys.HasFlag(Keys.Shift)) { m_play.ToggleFullscreen(); result = true; } break; case Keys.Escape: - if (m_play.IsFullscreen()) + if (m_play != null && m_play.IsFullscreen()) m_play.ToggleFullscreen(); else Close(); result = true; break; case Keys.Left: - Debug.WriteLine("Seeking..."); - if (ModifierKeys.HasFlag(Keys.Control)) { - if (m_play.CurrentTC.ZeroBasedFrames > 4) { - m_play.Pause(); - m_play.Seek(m_play.CurrentTC.ZeroBasedFrames - 5); - } - } else { - if (m_play.CurrentTC.ZeroBasedFrames > 0) { - m_play.Pause(); - m_play.Seek(m_play.CurrentTC.ZeroBasedFrames - 1); + logger.Debug("Seeking..."); + if (m_play != null) { + if (ModifierKeys.HasFlag(Keys.Control)) { + if (m_play.CurrentTC.ZeroBasedFrames > 4) { + m_play.Pause(); + m_play.Seek(m_play.CurrentTC.ZeroBasedFrames - 5); + } + } else { + if (m_play.CurrentTC.ZeroBasedFrames > 0) { + m_play.Pause(); + m_play.Seek(m_play.CurrentTC.ZeroBasedFrames - 1); + } } } result = true; break; case Keys.Right: - if (ModifierKeys.HasFlag(Keys.Control)) { - if (m_play.CurrentTC.ZeroBasedFrames + 5 <= m_mediaDescription.Duration.Frames) { - m_play.Pause(); - m_play.Seek(m_play.CurrentTC.ZeroBasedFrames + 5); - } - } else { - if (m_play.CurrentTC.ZeroBasedFrames + 1 <= m_mediaDescription.Duration.Frames) { - m_play.Pause(); - m_play.Seek(m_play.CurrentTC.ZeroBasedFrames + 1); + if (m_play != null) { + if (ModifierKeys.HasFlag(Keys.Control)) { + if (m_play.CurrentTC.ZeroBasedFrames + 5 <= m_mediaDescription.Duration.Frames) { + m_play.Pause(); + m_play.Seek(m_play.CurrentTC.ZeroBasedFrames + 5); + } + } else { + if (m_play.CurrentTC.ZeroBasedFrames + 1 <= m_mediaDescription.Duration.Frames) { + m_play.Pause(); + m_play.Seek(m_play.CurrentTC.ZeroBasedFrames + 1); + } } } result = true; break; case Keys.Space: - if (m_play.State == GraphState.Playing) - m_play.Pause(); - else - m_play.Play(); + if (m_play != null) { + if (m_play.State == GraphState.Playing) + m_play.Pause(); + else + m_play.Play(); + } result = true; break; case Keys.I: - if (SegmentEditor) + if (m_play != null && true.Equals(Settings?.Player?.SegmentEditor)) SetActualPositionAsIn(); break; case Keys.O: - if (SegmentEditor) + if (m_play != null && true.Equals(Settings?.Player?.SegmentEditor)) SetActualPositionAsOut(); break; } @@ -317,42 +335,35 @@ namespace DxPlay { } private void PlayerForm_FormClosing(object sender, FormClosingEventArgs e) { - if (m_play != null) { - m_play.Stop(); - m_play.Dispose(); - m_play = null; - } + //if (m_play != null) + // m_play.Dispose(); } private void PlayerForm_Shown(object sender, EventArgs e) { - if (m_play != null) { - if (AutoStart) - m_play.Play(); - else { - ShowFirstFrame(); - } + logger.Debug("PlayerForm_Shown"); + InitializeTexts(); + if (true.Equals(Settings?.Player?.SegmentEditor) && true.Equals(Settings?.IsStandalone)) { + mainMenu.Visible = true; } - } - - private void ShowFirstFrame() { - m_play.Play(); - m_play.Pause(); - m_play.Seek(0); + if (m_play != null && true.Equals(Settings?.Player?.AutoStart)) + m_play.Play(); } private void PlayerForm_FormClosed(object sender, FormClosedEventArgs e) { InterceptKeys.Stop(); + if (m_play != null) + m_play.Dispose(); } private void OnDefineOneSegmentClick(object sender, EventArgs e) { MovieSegment segment = null; - if (segments.Count == 0) { + if (model.Segments.Count == 0) { segment = new MovieSegment() { TCIn = new Timecode(m_mediaDescription.FirstFrame.Frames), TCOut = new Timecode(m_mediaDescription.FirstFrame, m_mediaDescription.Duration) }; } else { - MovieSegment lastSegment = segments[segments.Count - 1]; + MovieSegment lastSegment = model.Segments[model.Segments.Count - 1]; Timecode tcEnd = new Timecode(m_mediaDescription.FirstFrame, m_mediaDescription.Duration); if (lastSegment.TCOut.Frames == tcEnd.Frames) { MessageBox.Show("Az utolsó szegmens az anyag végéig tart, így nem hozható létre új szegmens."); @@ -363,12 +374,12 @@ namespace DxPlay { TCOut = tcEnd }; } - segments.Add(segment); + model.Segments.Add(segment); } private void OnDeleteSegmentClick(object sender, EventArgs e) { if (bsSegments.Current != null) - segments.Remove(bsSegments.Current as MovieSegment); + model.Segments.Remove(bsSegments.Current as MovieSegment); } private void SetActualPositionAsIn() { @@ -395,7 +406,7 @@ namespace DxPlay { } //if (MessageBox.Show("Biztos felül akarja írni az belépõt?", "Belépõ felülírása", MessageBoxButtons.YesNo) == DialogResult.No) // return; - MovieSegment collisionSegment = segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault(); + MovieSegment collisionSegment = model.Segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault(); if (collisionSegment != null && !currentSegment.Equals(collisionSegment)) { MessageBox.Show("A szegmensek között nem lehet átfedés."); @@ -419,7 +430,7 @@ namespace DxPlay { if (currentSegment.TCIn.Frames >= m_play.CurrentTC.Frames) MessageBox.Show("A kilépõ nem lehet a belépõ elõtt."); - MovieSegment collisionSegment = segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault(); + MovieSegment collisionSegment = model.Segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault(); if (collisionSegment != null && !currentSegment.Equals(collisionSegment)) { MessageBox.Show("A szegmensek között nem lehet átfedés."); @@ -441,40 +452,42 @@ namespace DxPlay { } private void OnSplitSegmentAtCurrentPositionClick(object sender, EventArgs e) { - MovieSegment currentSegment = segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && s.TCOut.Frames > m_play.CurrentTC.Frames).SingleOrDefault(); + MovieSegment currentSegment = model.Segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && s.TCOut.Frames > m_play.CurrentTC.Frames).SingleOrDefault(); if (currentSegment == null) return; - int position = segments.IndexOf(currentSegment); + int position = model.Segments.IndexOf(currentSegment); MovieSegment newSegment = new MovieSegment() { TCIn = new Timecode(currentSegment.TCIn.Frames), TCOut = new Timecode(m_play.CurrentTC.Frames) }; currentSegment.TCIn = new Timecode(m_play.CurrentTC.Frames); - segments.Insert(position, newSegment); + model.Segments.Insert(position, newSegment); } private void dgSegments_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { int index = e.Column.Index; switch (index) { case 0: - e.Column.HeaderText = StringResource.BELEPO; + e.Column.HeaderText = Settings.Resource("tc-in", StringResource.BELEPO); e.Column.ReadOnly = true; break; case 1: - e.Column.HeaderText = StringResource.KILEPO; + e.Column.HeaderText = Settings.Resource("tc-out", StringResource.KILEPO); e.Column.ReadOnly = true; break; case 2: - e.Column.HeaderText = StringResource.ELHAGYHATO; + e.Column.HeaderText = Settings.Resource("optional", StringResource.ELHAGYHATO); + break; + case 3: + e.Column.HeaderText = Settings.Resource("comment", StringResource.MEGJEGYZES); break; - case 3: e.Column.HeaderText = StringResource.MEGJEGYZES; break; } } private void dgSegments_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { MovieSegment actualSegment = bsSegments.Current as MovieSegment; - if (actualSegment == null) + if (actualSegment == null || m_play == null) return; if (e.ColumnIndex == 0) { m_play.Pause(); @@ -484,12 +497,16 @@ namespace DxPlay { m_play.Pause(); int pos = actualSegment.TCOut.Frames - m_play.MediaDescription.FirstFrame.Frames; //Az utolsó kocka nem jelenik meg egyébként - if (pos == m_play.MediaDescription.Duration.Frames) { - pos--; - m_play.Seek(pos); - m_play.Play(); - } else - m_play.Seek(pos); + try { + if (pos == m_play.MediaDescription.Duration.Frames) { + pos--; + m_play.Seek(pos); + m_play.Play(); + } else + m_play.Seek(pos); + } catch (Exception ex) { + MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } } @@ -499,5 +516,14 @@ namespace DxPlay { if (e.ColumnIndex == 2) dgSegments.EndEdit(); } + + private void menuOpenFile_Click(object sender, EventArgs e) { + if (openFileDialog.ShowDialog() == DialogResult.OK) + Open(new FileInfo(openFileDialog.FileName)); + } + + private void OnClick_menuApprove(object sender, EventArgs e) { + MessageBox.Show("approve"); + } } } diff --git a/client/DxPlay/PlayerForm.resx b/client/DxPlay/PlayerForm.resx index 925137f6..ebe652a9 100644 --- a/client/DxPlay/PlayerForm.resx +++ b/client/DxPlay/PlayerForm.resx @@ -117,13 +117,106 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + 184, 17 - - 17, 17 + + 412, 17 + + + iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAC8SURBVDhP1ZO9DcIwFISfqKGjpaENG4S/GZiEOiWMkR2Y + gREo2IEVaBDcOXnS48m24lRw0qf4nHeXxFLkZ3UC15GcQVAF3uAGYoM5mGF2BWTfG15LpdmdNb6Ib3ro + lkkNKtJ9fgJLY9KZrTWpIvICLZgDq+Ii8gQNsNKZjTW5ogtYAq/BRXcQDjIhza6t8UVTMOmWSX0V8aBo + joA3SmCG2RrIDDz6jTEwy46gBfBPi4WIn2M2K/9fKX8hkQ9xw2LrlhXH8QAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABOSURBVDhPYxgFVAWOUJoiUALE/4HYB8wjE8AMmQbmkQmo + asg8MI8C0ADEMIMYQQKUgG4gpoqrQABmGEXhBAMww3zBPAqBG5QeBWQBBgYAaigQp+qpuEkAAAAASUVO + RK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABlSURBVDhPYxjZ4AAUUwxGDUIFFUDcD2HCATaDQGoKIEzs + oIGRkfE/kEY2DN2gfqiaBggXN+hGMwzZIJgh3RAuYQAzrB2IYQa1k2oIDMAM+wHC5BoCA2DDKDUEBkAG + UGzIkAUMDABv+SVD4UMwTwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABOSURBVDhPYxgFFAMnKE0R8APi/0BcAuZRCKYBMdUMmwfE + VDGMEYiXADHFhoEMgrmqASRADkA2pBskQC6giiH+QEyxITDgBqVHAcWAgQEAtZ4QxOLkcD0AAAAASUVO + RK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABvSURBVDhPYxhZwBVK4wOOUBoncAPi/0DcDuZhByA5kBon + MA8P6AdiXIbBDAGpIQpgM4xkQ2AAZlg9EDdA2SQbAgPTgBhkAEWGgADMVRQZBDME5C2yvQYzhKLAxmYI + DBBtGFUTJDFZhBg1wwMwMAAAvx8nVwi8b+UAAAAASUVORK5CYII= + + + + 517, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABo + CAAAAk1TRnQBSQFMAgEBAgEAAVgBAAFYAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABYAMAARgDAAEBAQABCAYAAQkYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8AiwABEwQAARMYAALv + XQAB7wIAAe9bAAHvBAAB71kAAe8CAALvAgAB71cAAfICAAHvAgAB7wIAAe9XAALvBAAB7wIAAe84AAHx + AQ4IAAEOAfAZAAHvAgAB7zcAAbwKAAG8GgAB7wEAAe84AAHvCAAB7xwAAfI6AAHvBgAB71kAAQcEAAEH + WwABBwIAAQddAAHyAfG4AAETDAABE1IAARMMAAEU/wDOAAFCAU0BPgcAAT4DAAEoAwABYAMAARgDAAEB + AQABAQUAASABARYAA/8BAAb/BgAG/wYABv8GAAb/BgAB/wGBAv8B/gF/BgAB/wGBAv8B/AE/BgAB/wGB + Av8B+AEfBgAB/wGBAv8B8AEPBgAB/wGBAf8BwAEhAYcGAAH/AYEB/wHAATMBwwYAAfwBAAE/Av8B4QYA + AfwBAAE/Av8B8QYAAf4BAAF/AcABAwH7BgAB/wEAAf8BwAEDAf8GAAH/AYEE/wYAAf8BwwT/BgAB/wHn + Af8BwAEDAf8GAAP/AcABAwH/BgAB+AEAAR8D/wYAAfgBAAEfA/8GAAb/BgAG/wYABv8GAAb/BgAL + + + + 302, 17 + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAAAAAAAAAAAAAAAAAAAA diff --git a/client/DxPlay/PlayerGraph.cs b/client/DxPlay/PlayerGraph.cs index 65276411..ab23c592 100644 --- a/client/DxPlay/PlayerGraph.cs +++ b/client/DxPlay/PlayerGraph.cs @@ -15,6 +15,7 @@ namespace DxPlay { public IMediaSeeking MediaSeeking { get; private set; } public IMediaControl MediaControl { get; private set; } public IMediaEvent MediaEvent { get; private set; } + private bool isDisposed; public PlayerGraph(string fileName) { try { @@ -43,8 +44,7 @@ namespace DxPlay { SearchAudioTracks(splitter); EnableDeinterlace(videoDecoder); - } - catch (Exception e) { + } catch (Exception e) { logger.Error(e.Message); } } @@ -167,8 +167,10 @@ namespace DxPlay { // Shut down capture public void Dispose() { - logger.Debug("CloseInterfaces"); lock (this) { + if (isDisposed) + return; + logger.Debug("Dispose"); #if DEBUG if (m_DsRot != null) m_DsRot.Dispose(); @@ -182,6 +184,7 @@ namespace DxPlay { } Marshal.ReleaseComObject(this); + isDisposed = true; } } diff --git a/client/DxPlay/Program.cs b/client/DxPlay/Program.cs index 15a345d3..b53f777b 100644 --- a/client/DxPlay/Program.cs +++ b/client/DxPlay/Program.cs @@ -1,36 +1,58 @@ using DxPlay; +using MaestroShared.Configuration; +using NLog; using System; -using System.Diagnostics; using System.IO; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace Maestro { static class Program { - /// - /// The main entry point for the application. - /// + private const string DXPLAY_FILE = "dxplay.json"; + private static readonly Logger logger = LogManager.GetCurrentClassLogger(); + [STAThread] static void Main() { - AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PlayerForm playerForm = new PlayerForm(); + LoadSettings(playerForm); + if (playerForm.Settings == null) + playerForm.Settings = new DxPlaySettings(); + if (ProcessCommandLine(playerForm)) + return; + Application.Run(playerForm); + } + private static bool ProcessCommandLine(PlayerForm playerForm) { String[] arguments = Environment.GetCommandLineArgs(); if (arguments.Length > 1) { FileInfo fi = new FileInfo(arguments[1]); - if (fi.Exists) { - playerForm.AutoStart = true; + if (fi.Exists) playerForm.Open(fi); - if (playerForm.IsDisposed) - return; - } } - Application.Run(playerForm); + return playerForm.IsDisposed; } - private static void MyHandler(object sender, UnhandledExceptionEventArgs e) { - Debug.WriteLine("Unhandled exception: " + e.ExceptionObject); + private static void LoadSettings(PlayerForm playerForm) { + FileInfo dxPlayConfig = new FileInfo(ConfigurationSerializer.Combine(DXPLAY_FILE)); + if (dxPlayConfig.Exists) { + Type[] knownTypes = { typeof(TrafficMetadata) }; + var settings = ConfigurationSerializer.Load(dxPlayConfig.FullName, knownTypes); + settings.IsStandalone = true; + playerForm.Settings = settings; + if (settings.IsMaximized) + playerForm.WindowState = FormWindowState.Maximized; + } + } + + private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) { + logger.Error("Unhandled exception: " + e.ExceptionObject); + if (e.ExceptionObject is SEHException) { + SEHException sex = e.ExceptionObject as SEHException; + logger.Error(sex.StackTrace); + } } } diff --git a/client/DxPlay/Properties/AssemblyInfo.cs b/client/DxPlay/Properties/AssemblyInfo.cs index 97fa846a..c5ea5cb9 100644 --- a/client/DxPlay/Properties/AssemblyInfo.cs +++ b/client/DxPlay/Properties/AssemblyInfo.cs @@ -26,7 +26,7 @@ using System.Runtime.CompilerServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.0.7.0")] +[assembly: AssemblyVersion("2.0.8.1")] // // In order to sign your assembly you must specify a key to use. Refer to the @@ -56,5 +56,5 @@ using System.Runtime.CompilerServices; [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] -[assembly: AssemblyFileVersion("2.0.7.0")] +[assembly: AssemblyFileVersion("2.0.8.1")] diff --git a/client/DxPlay/StringResource.Designer.cs b/client/DxPlay/StringResource.Designer.cs index 34b4f6b7..306c8420 100644 --- a/client/DxPlay/StringResource.Designer.cs +++ b/client/DxPlay/StringResource.Designer.cs @@ -19,7 +19,7 @@ namespace DxPlay { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class StringResource { @@ -96,6 +96,15 @@ namespace DxPlay { } } + /// + /// Looks up a localized string similar to Nem tudok kapcsolódni a PlanAir rendszerhez ezen az útvonalon: {0}. + /// + internal static string ERROR_TRAFFIC_CONNECT { + get { + return ResourceManager.GetString("ERROR_TRAFFIC_CONNECT", resourceCulture); + } + } + /// /// Looks up a localized string similar to Hossz. /// @@ -177,6 +186,24 @@ namespace DxPlay { } } + /// + /// Looks up a localized string similar to Nem található a PlanAir rendszer kapcsolódási információja a dxplay.json állományban.. + /// + internal static string MISSING_TRAFFIC_CONFIGURATION { + get { + return ResourceManager.GetString("MISSING_TRAFFIC_CONFIGURATION", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Nem található az {0} azonosító a PlanAir rendszerben.. + /// + internal static string MISSING_TRAFFIC_VARIANT { + get { + return ResourceManager.GetString("MISSING_TRAFFIC_VARIANT", resourceCulture); + } + } + /// /// Looks up a localized string similar to NINCS BEMENET. /// diff --git a/client/DxPlay/StringResource.resx b/client/DxPlay/StringResource.resx index efd48cd3..18c76f4a 100644 --- a/client/DxPlay/StringResource.resx +++ b/client/DxPlay/StringResource.resx @@ -129,6 +129,9 @@ Elhagyható + + Nem tudok kapcsolódni a PlanAir rendszerhez ezen az útvonalon: {0} + Hossz @@ -156,6 +159,12 @@ Megjegyzés + + Nem található a PlanAir rendszer kapcsolódási információja a dxplay.json állományban. + + + Nem található az {0} azonosító a PlanAir rendszerben. + NINCS BEMENET diff --git a/client/DxPlay/app.config b/client/DxPlay/app.config index d4050983..f826f52f 100644 --- a/client/DxPlay/app.config +++ b/client/DxPlay/app.config @@ -1,3 +1,28 @@ - + - + + + + + + + + + + + + + + + diff --git a/client/DxPlay/nlog.config b/client/DxPlay/nlog.config index 65416377..e02c3e30 100644 --- a/client/DxPlay/nlog.config +++ b/client/DxPlay/nlog.config @@ -3,7 +3,7 @@ - + diff --git a/client/DxPlay/packages.config b/client/DxPlay/packages.config index 7d41141a..577b2433 100644 --- a/client/DxPlay/packages.config +++ b/client/DxPlay/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/client/IntegrationTests/App.config b/client/IntegrationTests/App.config index c7ada3f3..acd65b49 100644 --- a/client/IntegrationTests/App.config +++ b/client/IntegrationTests/App.config @@ -38,6 +38,22 @@ + + + + + + + + + + + + + + + + diff --git a/client/Maestro/Configuration/UJ-configuration-tqc-check.json b/client/Maestro/Configuration/-UJ-configuration-tqc-check.json similarity index 92% rename from client/Maestro/Configuration/UJ-configuration-tqc-check.json rename to client/Maestro/Configuration/-UJ-configuration-tqc-check.json index d655bfec..e8a3d085 100644 --- a/client/Maestro/Configuration/UJ-configuration-tqc-check.json +++ b/client/Maestro/Configuration/-UJ-configuration-tqc-check.json @@ -12,13 +12,13 @@ "$type": "UNCSource", "filter": "avi,wav,mxf", "local": { - "address": "file://10.10.1.100/BRAAVOS/ARCHIVE/ONE", + "address": "file://10.10.1.100/BRAAVOS/ARCHIVE", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 }, "remote": { - "address": "ftp://10.10.1.100/ARCHIVE/ONE", + "address": "ftp://10.10.1.100/ARCHIVE", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 @@ -82,7 +82,7 @@ }, { "label": "Archiválás", - "processor": "FTPTargetProcessor", + "processor": "FXPTargetProcessor", "outputFormat": "%ID%", "tag": "Archiválás", "saveArchiveMetadata": true, diff --git a/client/Maestro/Configuration/-configuration-nle.json b/client/Maestro/Configuration/configuration-nle.json similarity index 94% rename from client/Maestro/Configuration/-configuration-nle.json rename to client/Maestro/Configuration/configuration-nle.json index 393c10c0..4231532d 100644 --- a/client/Maestro/Configuration/-configuration-nle.json +++ b/client/Maestro/Configuration/configuration-nle.json @@ -16,7 +16,7 @@ "filter": "avi,wav,mxf", "foldersAutoExpand": true, "local": { - "address": "file://10.10.1.100/BRAAVOS/OCTOPUS" + "address": "file://c:/_video" } }, "metadatas": [ @@ -55,7 +55,7 @@ { "$type": "TrafficMetadata", "server": { - "address": "Data Source=10.10.1.45\\sql16;Initial Catalog=PA_Echo;Persist Security Info=True;", + "address": "Data Source=10.10.1.45;Initial Catalog=PA_Echo;Persist Security Info=True;", "userName": "MAM", "password": "7RKZYBzumKjL40SJwuwiFCvX57xuCN8zay6OttUm2wbrgImyYZBHyZTUUYrXX31Ge2Uwew07HYsqh2uzdJeDBDwcVntxaHg3nIpv9Dyq/odVoiC4tUF/K+lgvKWANcrZ", "timeout": 1000 diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index fafb41b9..4cc4969d 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -129,10 +129,15 @@ namespace Maestro { openInternal = extensions.Any(e => e != null && fileInfo.Extension.Length > 0 && fileInfo.Extension.Substring(1).ToLower().Equals(e.ToLower())); if (openInternal) { - PlayerForm player = new PlayerForm(ref movieSegments); + PlayerForm player = new PlayerForm(); player.BackColor = partialColor; - player.AutoStart = Configuration.Player.AutoStart; - player.SegmentEditor = Configuration.Player.SegmentEditor && segmentEditor; + player.Settings = new DxPlaySettings { + Player = new Player { + AutoStart = Configuration.Player.AutoStart, + SegmentEditor = Configuration.Player.SegmentEditor && segmentEditor + }, + Segments = movieSegments + }; player.Open(fileInfo); if (!player.IsDisposed) player.ShowDialog(); @@ -145,11 +150,9 @@ namespace Maestro { Process.Start(psf); } - } - catch (Exception ex) { + } catch (Exception ex) { MessageBox.Show(ex.Message); - } - finally { + } finally { Cursor = Cursors.Default; } } @@ -332,7 +335,7 @@ namespace Maestro { else { treeFolders.Nodes.Clear(); ShowFolders(); - } + } } else { if (txtSourceFilter.Text.Trim().Length > 0) { bindingSource.Filter = txtSourceFilter.Text; diff --git a/client/Maestro/Program.cs b/client/Maestro/Program.cs index 05efed34..5471bfe4 100644 --- a/client/Maestro/Program.cs +++ b/client/Maestro/Program.cs @@ -93,11 +93,11 @@ namespace Maestro { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private const string GLOBAL_JSON = "global.json"; private const string AUDIORECORDER_JSON = "audiorecorder.json"; + private const string DXPLAY_JSON = "dxplay.json"; private const string JSON_WILDCARD = "*.json"; private const string CONFIG_ERROR = "Nem található aktív konfiguráció."; private const string SYSCONFIG_ERROR = "Nem található a 'global.json' rendszer konfiguráció."; private const string SYSCONFIG_DOMAIN_ERROR = "Nem található a 'global.json' rendszer konfigurációban a tartományhitelesítő beállítása."; - private const string CONFIGURATION_FOLDER = "./Configuration"; private const string DOMAIN_QUERY_ERROR = "A bejelentkezett felhasználó domain információja nem elérhető."; private const string NOSPLASH = "nosplash"; private const string NOLOGIN = "nologin"; @@ -129,7 +129,7 @@ namespace Maestro { Application.Run(splash); }); } - string[] configFiles = Directory.GetFiles(CONFIGURATION_FOLDER, JSON_WILDCARD); + string[] configFiles = Directory.GetFiles(ConfigurationSerializer.CONFIGURATION_FOLDER, JSON_WILDCARD); if (configFiles.Length == 0) throw new Exception(CONFIG_ERROR); @@ -142,11 +142,14 @@ namespace Maestro { private void CreateForms(string[] configFiles) { foreach (String file in configFiles) { - string audioRecorderFile = Path.Combine(CONFIGURATION_FOLDER, AUDIORECORDER_JSON); - if (file.Equals(audioRecorderFile)) + string audioRecorderFile = ConfigurationSerializer.Combine(AUDIORECORDER_JSON); + if (file.ToLower().Equals(audioRecorderFile.ToLower())) continue; - string globalFile = Path.Combine(CONFIGURATION_FOLDER, GLOBAL_JSON); - if (file.Equals(globalFile)) + string dxPlayFile = ConfigurationSerializer.Combine(DXPLAY_JSON); + if (file.ToLower().Equals(dxPlayFile.ToLower())) + continue; + string globalFile = ConfigurationSerializer.Combine(GLOBAL_JSON); + if (file.ToLower().Equals(globalFile.ToLower())) continue; if (Path.GetFileName(file).StartsWith(HYPHEN)) continue; @@ -157,7 +160,7 @@ namespace Maestro { } private GlobalInfo LoadGlobalConfig(string[] files) { - string globalFile = Path.Combine(CONFIGURATION_FOLDER, GLOBAL_JSON); + string globalFile = ConfigurationSerializer.Combine(GLOBAL_JSON); if (!files.Contains(globalFile)) throw new Exception(SYSCONFIG_ERROR); return ConfigurationSerializer.Load(globalFile); @@ -179,7 +182,7 @@ namespace Maestro { } private void CheckUser() { - string globalFile = Path.Combine(CONFIGURATION_FOLDER, GLOBAL_JSON); + string globalFile = ConfigurationSerializer.Combine(GLOBAL_JSON); string domainName = GlobalConfig?.UserDomain?.Address?.ToString(); if (String.IsNullOrEmpty(domainName)) throw new Exception(SYSCONFIG_DOMAIN_ERROR); diff --git a/client/Maestro/app.config b/client/Maestro/app.config index d4050983..55470653 100644 --- a/client/Maestro/app.config +++ b/client/Maestro/app.config @@ -1,3 +1,16 @@ - + - + + + + + + + + + + + + + + diff --git a/client/MaestroShared/Configuration/ConfigurationInfo.cs b/client/MaestroShared/Configuration/ConfigurationInfo.cs index f273ac68..43496074 100644 --- a/client/MaestroShared/Configuration/ConfigurationInfo.cs +++ b/client/MaestroShared/Configuration/ConfigurationInfo.cs @@ -6,12 +6,25 @@ using System.Drawing; using System.ComponentModel; using Newtonsoft.Json.Serialization; using MaestroShared.Commons; +using Newtonsoft.Json.Linq; +using System.Runtime.Serialization; namespace MaestroShared.Configuration { public class ConfigurationSerializer { + public const string CONFIGURATION_FOLDER = "./Configuration"; + + public static string Combine(string fileName) { + return Path.Combine(CONFIGURATION_FOLDER, fileName); + } + private static Type[] MinimalKnownTypes = { typeof(UNCSource), typeof(NEXIOSource), typeof(OctopusMetadata), typeof(TrafficMetadata), typeof(MediaCubeMetadata) }; + public static JObject Load(string fileName) { + string configuration = File.ReadAllText(fileName); + return JObject.Parse(configuration); + } + public static T Load(string fileName, Type[] currentKnownTypes = null) { KnownTypesBinder knownTypesBinder = new KnownTypesBinder { KnownTypes = currentKnownTypes ?? MinimalKnownTypes @@ -174,4 +187,26 @@ namespace MaestroShared.Configuration { public string MetadataTitleFormat { get; set; } public string MetadataIDFormat { get; set; } } + + public class UISettings { + public string UIFileName { get; set; } + public JObject UIStrings { get; set; } + + + public string Resource(string name, string defaultValue) { + string result = UIStrings?[name]?.Value(); + return result ?? defaultValue; + } + + [OnDeserialized] + private void OnDeserialized(StreamingContext context) { + if (UIFileName != null) { + string fileName = ConfigurationSerializer.Combine(UIFileName); + FileInfo fi = new FileInfo(fileName); + if (fi.Exists) { + UIStrings = ConfigurationSerializer.Load(fileName); + } + } + } + } } diff --git a/client/MaestroShared/Controls/FlatTabControl.cs b/client/MaestroShared/Controls/FlatTabControl.cs new file mode 100644 index 00000000..1a49703c --- /dev/null +++ b/client/MaestroShared/Controls/FlatTabControl.cs @@ -0,0 +1,519 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using System.Drawing.Design; +using System.ComponentModel.Design; + +namespace MaestroShared.Controls +{ + /// + /// Summary description for FlatTabControl. + /// + [ToolboxBitmap(typeof(System.Windows.Forms.TabControl))] //, + //Designer(typeof(Designers.FlatTabControlDesigner))] + + public class FlatTabControl : System.Windows.Forms.TabControl + { + + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + private SubClass scUpDown = null; + private bool bUpDown; // true when the button UpDown is required + private ImageList leftRightImages = null; + private const int nMargin = 5; + private Color mBackColor = SystemColors.Control; + + public FlatTabControl() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + + // double buffering + this.SetStyle(ControlStyles.UserPaint, true); + this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); + this.SetStyle(ControlStyles.DoubleBuffer, true); + this.SetStyle(ControlStyles.ResizeRedraw, true); + this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); + + bUpDown = false; + + this.ControlAdded += new ControlEventHandler(FlatTabControl_ControlAdded); + this.ControlRemoved += new ControlEventHandler(FlatTabControl_ControlRemoved); + this.SelectedIndexChanged += new EventHandler(FlatTabControl_SelectedIndexChanged); + + leftRightImages = new ImageList(); + //leftRightImages.ImageSize = new Size(16, 16); // default + + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FlatTabControl)); + Bitmap updownImage = ((System.Drawing.Bitmap)(resources.GetObject("TabIcons.bmp"))); + + if (updownImage != null) + { + updownImage.MakeTransparent(Color.White); + leftRightImages.Images.AddStrip(updownImage); + } + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + + leftRightImages.Dispose(); + } + base.Dispose( disposing ); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + DrawControl(e.Graphics); + } + + internal void DrawControl(Graphics g) + { + if (!Visible) + return; + + Rectangle TabControlArea = this.ClientRectangle; + Rectangle TabArea = this.DisplayRectangle; + + //---------------------------- + // fill client area + Brush br = new SolidBrush(mBackColor); //(SystemColors.Control); UPDATED + g.FillRectangle(br, TabControlArea); + br.Dispose(); + //---------------------------- + + //---------------------------- + // draw border + int nDelta = SystemInformation.Border3DSize.Width; + + Pen border = new Pen(SystemColors.ControlDark); + TabArea.Inflate(nDelta, nDelta); + g.DrawRectangle(border, TabArea); + border.Dispose(); + //---------------------------- + + + //---------------------------- + // clip region for drawing tabs + Region rsaved = g.Clip; + Rectangle rreg; + + int nWidth = TabArea.Width + nMargin; + if (bUpDown) + { + // exclude updown control for painting + if (Win32.IsWindowVisible(scUpDown.Handle)) + { + Rectangle rupdown = new Rectangle(); + Win32.GetWindowRect(scUpDown.Handle, ref rupdown); + Rectangle rupdown2 = this.RectangleToClient(rupdown); + + nWidth = rupdown2.X; + } + } + + rreg = new Rectangle(TabArea.Left, TabControlArea.Top, nWidth - nMargin, TabControlArea.Height); + + g.SetClip(rreg); + + // draw tabs + for (int i = 0; i < this.TabCount; i++) + DrawTab(g, this.TabPages[i], i); + + g.Clip = rsaved; + //---------------------------- + + + //---------------------------- + // draw background to cover flat border areas + if (this.SelectedTab != null) + { + TabPage tabPage = this.SelectedTab; + Color color = tabPage.BackColor; + border = new Pen(color); + + TabArea.Offset(1, 1); + TabArea.Width -= 2; + TabArea.Height -= 2; + + g.DrawRectangle(border, TabArea); + TabArea.Width -= 1; + TabArea.Height -= 1; + g.DrawRectangle(border, TabArea); + + border.Dispose(); + } + //---------------------------- + } + + internal void DrawTab(Graphics g, TabPage tabPage, int nIndex) + { + Rectangle recBounds = this.GetTabRect(nIndex); + RectangleF tabTextArea = (RectangleF)this.GetTabRect(nIndex); + + bool bSelected = (this.SelectedIndex == nIndex); + + Point[] pt = new Point[7]; + if (this.Alignment == TabAlignment.Top) + { + pt[0] = new Point(recBounds.Left, recBounds.Bottom); + pt[1] = new Point(recBounds.Left, recBounds.Top + 3); + pt[2] = new Point(recBounds.Left + 3, recBounds.Top); + pt[3] = new Point(recBounds.Right - 3, recBounds.Top); + pt[4] = new Point(recBounds.Right, recBounds.Top + 3); + pt[5] = new Point(recBounds.Right, recBounds.Bottom); + pt[6] = new Point(recBounds.Left, recBounds.Bottom); + } + else + { + pt[0] = new Point(recBounds.Left, recBounds.Top); + pt[1] = new Point(recBounds.Right, recBounds.Top); + pt[2] = new Point(recBounds.Right, recBounds.Bottom - 3); + pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom); + pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom); + pt[5] = new Point(recBounds.Left, recBounds.Bottom - 3); + pt[6] = new Point(recBounds.Left, recBounds.Top); + } + + //---------------------------- + // fill this tab with background color + Brush br = new SolidBrush(tabPage.BackColor); + g.FillPolygon(br, pt); + br.Dispose(); + //---------------------------- + + //---------------------------- + // draw border + //g.DrawRectangle(SystemPens.ControlDark, recBounds); + g.DrawPolygon(SystemPens.ControlDark, pt); + + if (bSelected) + { + //---------------------------- + // clear bottom lines + Pen pen = new Pen(tabPage.BackColor); + + switch (this.Alignment) + { + case TabAlignment.Top: + g.DrawLine(pen, recBounds.Left + 1, recBounds.Bottom, recBounds.Right - 1, recBounds.Bottom); + g.DrawLine(pen, recBounds.Left + 1, recBounds.Bottom+1, recBounds.Right - 1, recBounds.Bottom+1); + break; + + case TabAlignment.Bottom: + g.DrawLine(pen, recBounds.Left + 1, recBounds.Top, recBounds.Right - 1, recBounds.Top); + g.DrawLine(pen, recBounds.Left + 1, recBounds.Top-1, recBounds.Right - 1, recBounds.Top-1); + g.DrawLine(pen, recBounds.Left + 1, recBounds.Top-2, recBounds.Right - 1, recBounds.Top-2); + break; + } + + pen.Dispose(); + //---------------------------- + } + //---------------------------- + + //---------------------------- + // draw tab's icon + if ((tabPage.ImageIndex >= 0) && (ImageList != null) && (ImageList.Images[tabPage.ImageIndex] != null)) + { + int nLeftMargin = 8; + int nRightMargin = 2; + + Image img = ImageList.Images[tabPage.ImageIndex]; + + Rectangle rimage = new Rectangle(recBounds.X + nLeftMargin, recBounds.Y + 1, img.Width, img.Height); + + // adjust rectangles + float nAdj = (float)(nLeftMargin + img.Width + nRightMargin); + + rimage.Y += (recBounds.Height - img.Height) / 2; + tabTextArea.X += nAdj; + tabTextArea.Width -= nAdj; + + // draw icon + g.DrawImage(img, rimage); + } + //---------------------------- + + //---------------------------- + // draw string + StringFormat stringFormat = new StringFormat(); + stringFormat.Alignment = StringAlignment.Center; + stringFormat.LineAlignment = StringAlignment.Center; + + br = new SolidBrush(tabPage.ForeColor); + + g.DrawString(tabPage.Text, Font, br, tabTextArea, stringFormat); + //---------------------------- + } + + internal void DrawIcons(Graphics g) + { + if ((leftRightImages == null) || (leftRightImages.Images.Count != 4)) + return; + + //---------------------------- + // calc positions + Rectangle TabControlArea = this.ClientRectangle; + + Rectangle r0 = new Rectangle(); + Win32.GetClientRect(scUpDown.Handle, ref r0); + + Brush br = new SolidBrush(SystemColors.Control); + g.FillRectangle(br, r0); + br.Dispose(); + + Pen border = new Pen(SystemColors.ControlDark); + Rectangle rborder = r0; + rborder.Inflate(-1, -1); + g.DrawRectangle(border, rborder); + border.Dispose(); + + int nMiddle = (r0.Width / 2); + int nTop = (r0.Height - 16) / 2; + int nLeft = (nMiddle - 16) / 2; + + Rectangle r1 = new Rectangle(nLeft, nTop, 16, 16); + Rectangle r2 = new Rectangle(nMiddle+nLeft, nTop, 16, 16); + //---------------------------- + + //---------------------------- + // draw buttons + Image img = leftRightImages.Images[1]; + if (img != null) + { + if (this.TabCount > 0) + { + Rectangle r3 = this.GetTabRect(0); + if (r3.Left < TabControlArea.Left) + g.DrawImage(img, r1); + else + { + img = leftRightImages.Images[3]; + if (img != null) + g.DrawImage(img, r1); + } + } + } + + img = leftRightImages.Images[0]; + if (img != null) + { + if (this.TabCount > 0) + { + Rectangle r3 = this.GetTabRect(this.TabCount - 1); + if (r3.Right > (TabControlArea.Width - r0.Width)) + g.DrawImage(img, r2); + else + { + img = leftRightImages.Images[2]; + if (img != null) + g.DrawImage(img, r2); + } + } + } + //---------------------------- + } + + protected override void OnCreateControl() + { + base.OnCreateControl(); + + FindUpDown(); + } + + private void FlatTabControl_ControlAdded(object sender, ControlEventArgs e) + { + FindUpDown(); + UpdateUpDown(); + } + + private void FlatTabControl_ControlRemoved(object sender, ControlEventArgs e) + { + FindUpDown(); + UpdateUpDown(); + } + + private void FlatTabControl_SelectedIndexChanged(object sender, EventArgs e) + { + UpdateUpDown(); + Invalidate(); // we need to update border and background colors + } + + private void FindUpDown() + { + bool bFound = false; + + // find the UpDown control + IntPtr pWnd = Win32.GetWindow(this.Handle, Win32.GW_CHILD); + + while (pWnd != IntPtr.Zero) + { + //---------------------------- + // Get the window class name + char[] className = new char[33]; + + int length = Win32.GetClassName(pWnd, className, 32); + + string s = new string(className, 0, length); + //---------------------------- + + if (s == "msctls_updown32") + { + bFound = true; + + if (!bUpDown) + { + //---------------------------- + // Subclass it + this.scUpDown = new SubClass(pWnd, true); + this.scUpDown.SubClassedWndProc += new SubClass.SubClassWndProcEventHandler(scUpDown_SubClassedWndProc); + //---------------------------- + + bUpDown = true; + } + break; + } + + pWnd = Win32.GetWindow(pWnd, Win32.GW_HWNDNEXT); + } + + if ((!bFound) && (bUpDown)) + bUpDown = false; + } + + private void UpdateUpDown() + { + if (bUpDown) + { + if (Win32.IsWindowVisible(scUpDown.Handle)) + { + Rectangle rect = new Rectangle(); + + Win32.GetClientRect(scUpDown.Handle, ref rect); + Win32.InvalidateRect(scUpDown.Handle, ref rect, true); + } + } + } + + #region scUpDown_SubClassedWndProc Event Handler + + private int scUpDown_SubClassedWndProc(ref Message m) + { + switch (m.Msg) + { + case Win32.WM_PAINT: + { + //------------------------ + // redraw + IntPtr hDC = Win32.GetWindowDC(scUpDown.Handle); + Graphics g = Graphics.FromHdc(hDC); + + DrawIcons(g); + + g.Dispose(); + Win32.ReleaseDC(scUpDown.Handle, hDC); + //------------------------ + + // return 0 (processed) + m.Result = IntPtr.Zero; + + //------------------------ + // validate current rect + Rectangle rect = new Rectangle(); + + Win32.GetClientRect(scUpDown.Handle, ref rect); + Win32.ValidateRect(scUpDown.Handle, ref rect); + //------------------------ + } + return 1; + } + + return 0; + } + #endregion + + #region Component Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + + #endregion + + #region Properties + + [Editor(typeof(TabpageExCollectionEditor), typeof(UITypeEditor))] + public new TabPageCollection TabPages + { + get + { + return base.TabPages; + } + } + + new public TabAlignment Alignment + { + get {return base.Alignment;} + set { + TabAlignment ta = value; + if ((ta != TabAlignment.Top) && (ta != TabAlignment.Bottom)) + ta = TabAlignment.Top; + + base.Alignment = ta;} + } + + [Browsable(false)] + new public bool Multiline + { + get {return base.Multiline;} + set {base.Multiline = false;} + } + + [Browsable(true)] + new public Color myBackColor + { + get {return mBackColor;} + set {mBackColor = value; this.Invalidate();} + } + + #endregion + + #region TabpageExCollectionEditor + + internal class TabpageExCollectionEditor : CollectionEditor + { + public TabpageExCollectionEditor(System.Type type): base(type) + { + } + + protected override Type CreateCollectionItemType() + { + return typeof(TabPage); + } + } + + #endregion + } + + //#endregion +} diff --git a/client/MaestroShared/Controls/FlatTabControl.resx b/client/MaestroShared/Controls/FlatTabControl.resx new file mode 100644 index 00000000..07f39629 --- /dev/null +++ b/client/MaestroShared/Controls/FlatTabControl.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Qk02DAAAAAAAADYAAAAoAAAAQAAAABAAAAABABgAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA//////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////kEgg//////// + ////////////////////////////////////////////////////////////4IhQ//////////////// + ////////////////////////////////////////S0tL//////////////////////////////////// + ////////////////////////////////hYWF//////////////////////////////////////////// + ////kFAw0Ggw////////////////////////////////////////////////////////////4Ihg0IBQ + ////////////////////////////////////////////////////////UVFRampq//////////////// + ////////////////////////////////////////////h4eHfn5+//////////////////////////// + ////////////////////oFAw8Ggg0GAw//////////////////////////////////////////////// + ////4Ihg/8Cg0HhQ////////////////////////////////////////////////////////U1NTbW1t + ZGRk////////////////////////////////////////////////////h4eHvb29eHh4//////////// + ////////////////////////////oFgwoFgwoFgw8Ggg8HAw0Ggw//////////////////////////// + ////////////////4Ihg/8Cg/5hw0HhQ0HhQ0HhQ//////////////////////////////////////// + WVlZWVlZWFhYbW1tdHR0ampq////////////////////////////////////////////h4eHvb29mJiY + eHh4eHh4eHh4////////////////////////////////sGBA8HAw8HAw8HAw8IhQ/6Bg4HBA//////// + ////////////////////////////4IhQ/8Cg/7CA/4hQ/4BA8HAwwHBA//////////////////////// + ////////////////YmJic3NzdHR0c3Nzh4eHnJycc3Nz//////////////////////////////////// + hYWFvb29rKysiYmJgoKCdHR0bm5u////////////////////////////////sGhA8HAw8HAw/4BA/6Bw + /7CQ/8Cg4IhQ////////////////////////////4IhQ/8Cg/7CQ/6Bw/4BA8HAw8HAwsGhA//////// + ////////////////////////////////Z2dnc3NzdHR0goKCnp6erq6uvLy8hYWF//////////////// + ////////////hoaGvb29rq6unp6egoKCdHR0c3NzaGho////////////////////////////////wHBA + 8HAw/4BA/4hQ/7CA/8Cg4IhQ////////////////////////////////////4HBA/6Bg8IhQ8HAw8HAw + 8HAwsGBA////////////////////////////////////////b29vdHR0goKCiYmJrKysvb29hYWF//// + ////////////////////////////////c3NznJych4eHc3Nzc3Nzc3NzYmJi//////////////////// + ////////////0HhQ0HhQ0HhQ/5hw/8Cg4Ihg//////////////////////////////////////////// + 0Ggw8HAw8GggoFgwoFgwoFgw////////////////////////////////////////eXl5eHh4eHh4mZmZ + vb29h4eH////////////////////////////////////////////ampqdHR0bm5uWVlZWFhYWVlZ//// + ////////////////////////////////////0HhQ/8Cg4Ihg//////////////////////////////// + ////////////////////0GAw8GggoFAw//////////////////////////////////////////////// + ////////eHh4vb29iIiI////////////////////////////////////////////////////ZGRkbW1t + VFRU////////////////////////////////////////////////0IBQ4Ihg//////////////////// + ////////////////////////////////////////0GgwkFAw//////////////////////////////// + ////////////////////////fn5+h4eH//////////////////////////////////////////////// + ////////////aWlpUVFR////////////////////////////////////////////////4IhQ//////// + ////////////////////////////////////////////////////////////kEgg//////////////// + ////////////////////////////////////////hYWF//////////////////////////////////// + ////////////////////////////////SkpK//////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////// + + + \ No newline at end of file diff --git a/client/MaestroShared/Controls/Win32.cs b/client/MaestroShared/Controls/Win32.cs new file mode 100644 index 00000000..cff63677 --- /dev/null +++ b/client/MaestroShared/Controls/Win32.cs @@ -0,0 +1,182 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using System.Runtime.InteropServices; + +namespace MaestroShared.Controls +{ + internal class Win32 + { + /* + * GetWindow() Constants + */ + public const int GW_HWNDFIRST = 0; + public const int GW_HWNDLAST = 1; + public const int GW_HWNDNEXT = 2; + public const int GW_HWNDPREV = 3; + public const int GW_OWNER = 4; + public const int GW_CHILD = 5; + + public const int WM_NCCALCSIZE = 0x83; + public const int WM_WINDOWPOSCHANGING = 0x46; + public const int WM_PAINT = 0xF; + public const int WM_CREATE = 0x1; + public const int WM_NCCREATE = 0x81; + public const int WM_NCPAINT = 0x85; + public const int WM_PRINT = 0x317; + public const int WM_DESTROY = 0x2; + public const int WM_SHOWWINDOW = 0x18; + public const int WM_SHARED_MENU = 0x1E2; + public const int HC_ACTION = 0; + public const int WH_CALLWNDPROC = 4; + public const int GWL_WNDPROC = -4; + + public Win32() + { + // + // TODO: Add constructor logic here + // + } + + [DllImport("User32.dll",CharSet = CharSet.Auto)] + public static extern IntPtr GetWindowDC(IntPtr handle); + + [DllImport("User32.dll",CharSet = CharSet.Auto)] + public static extern IntPtr ReleaseDC(IntPtr handle, IntPtr hDC); + + [DllImport("Gdi32.dll",CharSet = CharSet.Auto)] + public static extern IntPtr CreateCompatibleDC(IntPtr hdc); + + [DllImport("User32.dll",CharSet = CharSet.Auto)] + public static extern int GetClassName(IntPtr hwnd, char[] className, int maxCount); + + [DllImport("User32.dll",CharSet = CharSet.Auto)] + public static extern IntPtr GetWindow(IntPtr hwnd, int uCmd); + + [DllImport("User32.dll",CharSet = CharSet.Auto)] + public static extern bool IsWindowVisible(IntPtr hwnd); + + [DllImport("user32",CharSet = CharSet.Auto)] + public static extern int GetClientRect(IntPtr hwnd, ref RECT lpRect); + + [DllImport("user32",CharSet = CharSet.Auto)] + public static extern int GetClientRect(IntPtr hwnd, [In, Out] ref Rectangle rect); + + [DllImport("user32",CharSet = CharSet.Auto)] + public static extern bool MoveWindow(IntPtr hwnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); + + [DllImport("user32",CharSet = CharSet.Auto)] + public static extern bool UpdateWindow(IntPtr hwnd); + + [DllImport("user32",CharSet = CharSet.Auto)] + public static extern bool InvalidateRect(IntPtr hwnd, ref Rectangle rect, bool bErase); + + [DllImport("user32",CharSet = CharSet.Auto)] + public static extern bool ValidateRect(IntPtr hwnd, ref Rectangle rect); + + [DllImport("user32.dll",CharSet = CharSet.Auto)] + internal static extern bool GetWindowRect(IntPtr hWnd, [In, Out] ref Rectangle rect); + + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int Left; + public int Top; + public int Right; + public int Bottom; + } + + [StructLayout(LayoutKind.Sequential)] + public struct WINDOWPOS + { + public IntPtr hwnd; + public IntPtr hwndAfter; + public int x; + public int y; + public int cx; + public int cy; + public uint flags; + } + + [StructLayout(LayoutKind.Sequential)] + public struct NCCALCSIZE_PARAMS + { + public RECT rgc; + public WINDOWPOS wndpos; + } + } + + #region SubClass Classing Handler Class + internal class SubClass : System.Windows.Forms.NativeWindow + { + public delegate int SubClassWndProcEventHandler(ref System.Windows.Forms.Message m); + public event SubClassWndProcEventHandler SubClassedWndProc; + private bool IsSubClassed = false; + + public SubClass(IntPtr Handle, bool _SubClass) + { + base.AssignHandle(Handle); + this.IsSubClassed = _SubClass; + } + + public bool SubClassed + { + get{ return this.IsSubClassed; } + set{ this.IsSubClassed = value; } + } + + protected override void WndProc(ref Message m) + { + if (this.IsSubClassed) + { + if (OnSubClassedWndProc(ref m) != 0) + return; + } + base.WndProc(ref m); + } + + public void CallDefaultWndProc(ref Message m) + { + base.WndProc(ref m); + } + + #region HiWord Message Cracker + public int HiWord(int Number) + { + return ((Number >> 16) & 0xffff); + } + #endregion + + #region LoWord Message Cracker + public int LoWord(int Number) + { + return (Number & 0xffff); + } + #endregion + + #region MakeLong Message Cracker + public int MakeLong(int LoWord, int HiWord) + { + return (HiWord << 16) | (LoWord & 0xffff); + } + #endregion + + #region MakeLParam Message Cracker + public IntPtr MakeLParam(int LoWord, int HiWord) + { + return (IntPtr) ((HiWord << 16) | (LoWord & 0xffff)); + } + #endregion + + private int OnSubClassedWndProc(ref Message m) + { + if (SubClassedWndProc != null) + { + return this.SubClassedWndProc(ref m); + } + + return 0; + } + } + #endregion +} diff --git a/client/MaestroShared/MaestroShared.csproj b/client/MaestroShared/MaestroShared.csproj index e3f83c2b..4169050f 100644 --- a/client/MaestroShared/MaestroShared.csproj +++ b/client/MaestroShared/MaestroShared.csproj @@ -66,6 +66,7 @@ + @@ -103,9 +104,13 @@ ColorSlider.cs + + Component + Component + @@ -143,6 +148,7 @@ ColorSlider.cs + PublicResXFileCodeGenerator Resources.Designer.cs @@ -187,5 +193,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/MaestroShared/Properties/Resources.Designer.cs b/client/MaestroShared/Properties/Resources.Designer.cs index e2bf6c44..15edbb2a 100644 --- a/client/MaestroShared/Properties/Resources.Designer.cs +++ b/client/MaestroShared/Properties/Resources.Designer.cs @@ -60,6 +60,56 @@ namespace MaestroShared.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap baseline_arrow_downward_black_18dp { + get { + object obj = ResourceManager.GetObject("baseline_arrow_downward_black_18dp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap baseline_chevron_left_black_18dp { + get { + object obj = ResourceManager.GetObject("baseline_chevron_left_black_18dp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap baseline_chevron_right_black_18dp { + get { + object obj = ResourceManager.GetObject("baseline_chevron_right_black_18dp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap baseline_close_black_18dp { + get { + object obj = ResourceManager.GetObject("baseline_close_black_18dp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap baseline_ondemand_video_black_18dp { + get { + object obj = ResourceManager.GetObject("baseline_ondemand_video_black_18dp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -189,5 +239,15 @@ namespace MaestroShared.Properties { return ((System.Drawing.Bitmap)(obj)); } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap round_publish_black_24dp { + get { + object obj = ResourceManager.GetObject("round_publish_black_24dp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/client/MaestroShared/Properties/Resources.resx b/client/MaestroShared/Properties/Resources.resx index d084ffe4..c11d6ca0 100644 --- a/client/MaestroShared/Properties/Resources.resx +++ b/client/MaestroShared/Properties/Resources.resx @@ -157,4 +157,22 @@ ..\Resources\ic_stop_black_24dp_2x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\baseline_arrow_downward_black_18dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\baseline_chevron_left_black_18dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\baseline_chevron_right_black_18dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\baseline_close_black_18dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\baseline_ondemand_video_black_18dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\round_publish_black_24dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/client/MaestroShared/Resources/baseline_arrow_downward_black_18dp.png b/client/MaestroShared/Resources/baseline_arrow_downward_black_18dp.png new file mode 100644 index 0000000000000000000000000000000000000000..d5bb07e5eb7fad082278c3ca26c83600841be06e GIT binary patch literal 140 zcmeAS@N?(olHy`uVBq!ia0y~yU=RXf4mJh`hOl#e;S3B6!JaOTAr*{o&oHtvC sHbq1%a1iL4DyZZxp>%x4w^vg6KUJL@6t|ycU|?YIboFyt=akR{0A+qF{{R30 literal 0 HcmV?d00001 diff --git a/client/MaestroShared/Resources/baseline_chevron_left_black_18dp.png b/client/MaestroShared/Resources/baseline_chevron_left_black_18dp.png new file mode 100644 index 0000000000000000000000000000000000000000..99ec8129fb1ea221e62683c4a03dea9a24e160f8 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0y~yU=RXf4mJh`hOl#e;S3B6R-P`7Ar*|t3$!Fy`>q%) zVd?nKypi9OXQo*O&rJ8s9VQBrM?6+0-kq^-(VY#MS4_@KmulM?xU5!$fgwvnVEJBa SW(Nia1_n=8KbLh*2~7Z)ZX!Sc literal 0 HcmV?d00001 diff --git a/client/MaestroShared/Resources/baseline_chevron_right_black_18dp.png b/client/MaestroShared/Resources/baseline_chevron_right_black_18dp.png new file mode 100644 index 0000000000000000000000000000000000000000..c22e1de52146c371ba822d4fe2cbbd07561820f8 GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0y~yU=RXf4mJh`hOl#e;S3B6cAhSdAr*|t3nY4&)UzZW zu^;*0xT8g?&3Ey##Lp{IC6op97q%t#c&y7>(584d#kw`B?T0eYLYW#WAFUF|we_u0#4k+XT*KjXVoZ2(+vgU<=Ih tU`|{gD0gFuyM3(i679g78BZ7(_RFh>U)r8z%D}+D;OXk;vd$@?2>_HQE@c1! literal 0 HcmV?d00001 diff --git a/client/MaestroShared/Resources/baseline_ondemand_video_black_18dp.png b/client/MaestroShared/Resources/baseline_ondemand_video_black_18dp.png new file mode 100644 index 0000000000000000000000000000000000000000..7d635989c6db96bc81995481f9fae902b3355f08 GIT binary patch literal 189 zcmV;u07CzXP)b}t! z3e1WNTs)ZE$%L_*HxxyO@Ah>NgM$Jy<7_1gz<{8UXNkfvc=m$=F!iYEdjL#53c!?R iJebUQFqy?@Qc8Vq&(ktX7WRn%0000uqz&3n3bf#rGBSP`M`zk30IoDowt2Skzi$DY|SaJ*=ux}fq{X+)78&qol`;+ E017oR>Hq)$ literal 0 HcmV?d00001 -- 2.54.0