diff options
author | sr55 <[email protected]> | 2009-04-12 20:10:47 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-04-12 20:10:47 +0000 |
commit | 5680b256e398c3c4c28c36e479e8983284b0a340 (patch) | |
tree | fc270d846f87a8d20ce9b7ee264a637e1b99fb7a | |
parent | 7c54b2bdfdcfa132eed627f8d1a4d02bd888c3e7 (diff) |
WinGui:
- Improvements to the preview window design.
- Code tweaks to make it less crash / error prone (QT Control)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2320 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/C#/HandBrakeCS.csproj | 1 | ||||
-rw-r--r-- | win/C#/Properties/Resources.Designer.cs | 7 | ||||
-rw-r--r-- | win/C#/Properties/Resources.resx | 3 | ||||
-rw-r--r-- | win/C#/Resources/Play_small.png | bin | 0 -> 1166 bytes | |||
-rw-r--r-- | win/C#/frmPreview.Designer.cs | 81 | ||||
-rw-r--r-- | win/C#/frmPreview.cs | 49 | ||||
-rw-r--r-- | win/C#/frmPreview.resx | 3 |
7 files changed, 90 insertions, 54 deletions
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 7542e6097..f892112b2 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -318,6 +318,7 @@ <None Include="Resources\Pause.png" />
<None Include="Resources\Play.png" />
<None Include="Resources\picture.png" />
+ <None Include="Resources\Play_small.png" />
<Content Include="Resources\Pref_Small.png" />
<Content Include="Resources\Queue.png" />
<Content Include="Resources\Queue_Small.png" />
diff --git a/win/C#/Properties/Resources.Designer.cs b/win/C#/Properties/Resources.Designer.cs index 70b73b78e..36b338870 100644 --- a/win/C#/Properties/Resources.Designer.cs +++ b/win/C#/Properties/Resources.Designer.cs @@ -200,6 +200,13 @@ namespace Handbrake.Properties { }
}
+ internal static System.Drawing.Bitmap Play_small {
+ get {
+ object obj = ResourceManager.GetObject("Play_small", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
internal static System.Drawing.Bitmap Pref_Small {
get {
object obj = ResourceManager.GetObject("Pref_Small", resourceCulture);
diff --git a/win/C#/Properties/Resources.resx b/win/C#/Properties/Resources.resx index 7807b0e53..d5524c82b 100644 --- a/win/C#/Properties/Resources.resx +++ b/win/C#/Properties/Resources.resx @@ -199,4 +199,7 @@ <data name="AddToQueue_small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AddToQueue_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="Play_small" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\Play_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/C#/Resources/Play_small.png b/win/C#/Resources/Play_small.png Binary files differnew file mode 100644 index 000000000..3e4647a15 --- /dev/null +++ b/win/C#/Resources/Play_small.png diff --git a/win/C#/frmPreview.Designer.cs b/win/C#/frmPreview.Designer.cs index 0beebf6e0..464ac255b 100644 --- a/win/C#/frmPreview.Designer.cs +++ b/win/C#/frmPreview.Designer.cs @@ -39,12 +39,12 @@ this.cb_duration = new System.Windows.Forms.ToolStripComboBox();
this.btn_playQT = new System.Windows.Forms.ToolStripButton();
this.btn_playVLC = new System.Windows.Forms.ToolStripButton();
- this.statusStrip = new System.Windows.Forms.StatusStrip();
- this.lbl_status = new System.Windows.Forms.ToolStripStatusLabel();
this.QTControl = new AxQTOControlLib.AxQTControl();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.lbl_status = new System.Windows.Forms.Label();
this.toolBar.SuspendLayout();
- this.statusStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.QTControl)).BeginInit();
+ this.panel1.SuspendLayout();
this.SuspendLayout();
//
// toolBar
@@ -60,7 +60,7 @@ this.toolBar.Location = new System.Drawing.Point(0, 0);
this.toolBar.Name = "toolBar";
this.toolBar.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
- this.toolBar.Size = new System.Drawing.Size(774, 39);
+ this.toolBar.Size = new System.Drawing.Size(774, 25);
this.toolBar.TabIndex = 37;
this.toolBar.Text = "toolStrip1";
//
@@ -68,7 +68,7 @@ //
this.lbl_preview.BackColor = System.Drawing.Color.Transparent;
this.lbl_preview.Name = "lbl_preview";
- this.lbl_preview.Size = new System.Drawing.Size(100, 36);
+ this.lbl_preview.Size = new System.Drawing.Size(100, 22);
this.lbl_preview.Text = "Start at Preview:";
//
// cb_preview
@@ -88,13 +88,13 @@ "9",
"10"});
this.cb_preview.Name = "cb_preview";
- this.cb_preview.Size = new System.Drawing.Size(75, 39);
+ this.cb_preview.Size = new System.Drawing.Size(75, 25);
//
// toolStripLabel2
//
this.toolStripLabel2.BackColor = System.Drawing.Color.Transparent;
this.toolStripLabel2.Name = "toolStripLabel2";
- this.toolStripLabel2.Size = new System.Drawing.Size(111, 36);
+ this.toolStripLabel2.Size = new System.Drawing.Size(111, 22);
this.toolStripLabel2.Text = "Duration (seconds)";
//
// cb_duration
@@ -117,64 +117,69 @@ "60"});
this.cb_duration.Margin = new System.Windows.Forms.Padding(0);
this.cb_duration.Name = "cb_duration";
- this.cb_duration.Size = new System.Drawing.Size(75, 39);
+ this.cb_duration.Size = new System.Drawing.Size(75, 25);
//
// btn_playQT
//
- this.btn_playQT.Image = global::Handbrake.Properties.Resources.Play;
+ this.btn_playQT.Image = global::Handbrake.Properties.Resources.Play_small;
this.btn_playQT.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.btn_playQT.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btn_playQT.Name = "btn_playQT";
- this.btn_playQT.Size = new System.Drawing.Size(113, 36);
+ this.btn_playQT.Size = new System.Drawing.Size(99, 22);
this.btn_playQT.Text = "Play with QT";
this.btn_playQT.Click += new System.EventHandler(this.btn_playQT_Click);
//
// btn_playVLC
//
- this.btn_playVLC.Image = global::Handbrake.Properties.Resources.Play;
+ this.btn_playVLC.Image = global::Handbrake.Properties.Resources.Play_small;
this.btn_playVLC.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.btn_playVLC.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btn_playVLC.Name = "btn_playVLC";
- this.btn_playVLC.Size = new System.Drawing.Size(117, 36);
+ this.btn_playVLC.Size = new System.Drawing.Size(103, 22);
this.btn_playVLC.Text = "Play with VLC";
this.btn_playVLC.Click += new System.EventHandler(this.btn_playVLC_Click);
//
- // statusStrip
- //
- this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.lbl_status});
- this.statusStrip.Location = new System.Drawing.Point(0, 486);
- this.statusStrip.Name = "statusStrip";
- this.statusStrip.Size = new System.Drawing.Size(774, 22);
- this.statusStrip.TabIndex = 38;
- this.statusStrip.Text = "statusStrip1";
- //
- // lbl_status
- //
- this.lbl_status.BackColor = System.Drawing.Color.Transparent;
- this.lbl_status.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbl_status.Name = "lbl_status";
- this.lbl_status.Size = new System.Drawing.Size(31, 17);
- this.lbl_status.Text = "{0}";
- //
// QTControl
//
this.QTControl.Enabled = true;
- this.QTControl.Location = new System.Drawing.Point(0, 42);
+ this.QTControl.Location = new System.Drawing.Point(0, 0);
this.QTControl.Name = "QTControl";
this.QTControl.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("QTControl.OcxState")));
- this.QTControl.Size = new System.Drawing.Size(64, 64);
+ this.QTControl.Size = new System.Drawing.Size(64, 72);
this.QTControl.TabIndex = 39;
this.QTControl.Visible = false;
//
+ // panel1
+ //
+ this.panel1.Controls.Add(this.lbl_status);
+ this.panel1.Controls.Add(this.QTControl);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel1.Location = new System.Drawing.Point(0, 25);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(774, 483);
+ this.panel1.TabIndex = 40;
+ //
+ // lbl_status
+ //
+ this.lbl_status.AutoSize = true;
+ this.lbl_status.BackColor = System.Drawing.Color.Transparent;
+ this.lbl_status.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lbl_status.Font = new System.Drawing.Font("Tahoma", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lbl_status.ForeColor = System.Drawing.Color.White;
+ this.lbl_status.Location = new System.Drawing.Point(0, 0);
+ this.lbl_status.Name = "lbl_status";
+ this.lbl_status.Size = new System.Drawing.Size(51, 25);
+ this.lbl_status.TabIndex = 40;
+ this.lbl_status.Text = "{0}";
+ this.lbl_status.Visible = false;
+ //
// frmPreview
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(774, 508);
- this.Controls.Add(this.QTControl);
- this.Controls.Add(this.statusStrip);
+ this.Controls.Add(this.panel1);
this.Controls.Add(this.toolBar);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmPreview";
@@ -183,9 +188,9 @@ this.TopMost = true;
this.toolBar.ResumeLayout(false);
this.toolBar.PerformLayout();
- this.statusStrip.ResumeLayout(false);
- this.statusStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.QTControl)).EndInit();
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -195,13 +200,13 @@ private System.Windows.Forms.ToolStrip toolBar;
private System.Windows.Forms.ToolStripButton btn_playQT;
- private System.Windows.Forms.StatusStrip statusStrip;
private AxQTOControlLib.AxQTControl QTControl;
private System.Windows.Forms.ToolStripComboBox cb_preview;
private System.Windows.Forms.ToolStripLabel lbl_preview;
private System.Windows.Forms.ToolStripLabel toolStripLabel2;
private System.Windows.Forms.ToolStripComboBox cb_duration;
- private System.Windows.Forms.ToolStripStatusLabel lbl_status;
private System.Windows.Forms.ToolStripButton btn_playVLC;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Label lbl_status;
}
}
\ No newline at end of file diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs index e5ebd21f6..4591b3d6d 100644 --- a/win/C#/frmPreview.cs +++ b/win/C#/frmPreview.cs @@ -4,6 +4,8 @@ using System.Threading; using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;
+using AxQTOControlLib;
+using QTOControlLib;
using QTOLibrary;
namespace Handbrake
@@ -36,18 +38,42 @@ namespace Handbrake cb_preview.SelectedIndex = 0;
cb_duration.SelectedIndex = 1;
}
-
+
#region Encode Sample
private void btn_playVLC_Click(object sender, EventArgs e)
{
+ lbl_status.Visible = true;
+ try
+ {
+ QTControl.URL = "";
+ if (File.Exists(currently_playing))
+ File.Delete(currently_playing);
+ }
+ catch (Exception)
+ {
+ MessageBox.Show(this, "Unable to delete previous preview file. You may need to restart the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (VLC) ...";
String query = hb_common_func.GeneratePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
- ThreadPool.QueueUserWorkItem(procMonitor, query);
+ ThreadPool.QueueUserWorkItem(procMonitor, query);
}
private void btn_playQT_Click(object sender, EventArgs e)
{
+ lbl_status.Visible = true;
+ try
+ {
+ QTControl.URL = "";
+ if (File.Exists(currently_playing))
+ File.Delete(currently_playing);
+ }
+ catch (Exception)
+ {
+ MessageBox.Show(this, "Unable to delete previous preview file. You may need to restart the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (QT) ...";
@@ -92,9 +118,9 @@ namespace Handbrake // Play back in QT or VLC
if (playerSelection == "QT")
play();
- else
+ else
playVLC();
-
+
lbl_status.Text = "";
}
catch (Exception exc)
@@ -113,6 +139,7 @@ namespace Handbrake {
player = new Thread(OpenMovie) { IsBackground = true };
player.Start();
+ lbl_status.Visible = false;
}
/// <summary>
@@ -138,6 +165,7 @@ namespace Handbrake else
MessageBox.Show(this, "Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.", "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
+ lbl_status.Visible = false;
}
/// <summary>
@@ -153,18 +181,13 @@ namespace Handbrake BeginInvoke(new UpdateUIHandler(OpenMovie));
return;
}
+ QTControl.Sizing = QTSizingModeEnum.qtControlFitsMovie;
QTControl.URL = currently_playing;
- QTControl.Width = QTControl.Movie.Width;
- QTControl.Height = QTControl.Movie.Height;
- // The initial control size is 64,64. If we do not reload the clip here
- // it'll scale the video from 64,64.
- // Unsure why as it correctly resizes the control to the movies actual size.
- QTControl.URL = currently_playing;
- QTControl.SetScale(0);
+ QTControl.Sizing = QTSizingModeEnum.qtMovieFitsControl;
QTControl.Show();
- this.Width = QTControl.Width + 5;
- this.Height = QTControl.Height + 90;
+ this.ClientSize = QTControl.Size;
+ this.Height += 25;
}
catch (COMException ex)
{
diff --git a/win/C#/frmPreview.resx b/win/C#/frmPreview.resx index 0db6e0108..ef2d4bca6 100644 --- a/win/C#/frmPreview.resx +++ b/win/C#/frmPreview.resx @@ -120,9 +120,6 @@ <metadata name="toolBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
- <metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>116, 17</value>
- </metadata>
<data name="QTControl.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|