From 1bd547ad1105e88e30c65bf625b88b3d14794b1c Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 7 May 2008 20:43:49 +0000 Subject: [PATCH] WinGui: - Got rid of the DVD info window. DVD information can now be read from the activity window. - Removed some unused code calls to frmDvdInfo. - Changed frmActivityWindow design, removed all buttons, text window now expands as the window size grows. Basically, the window is identical to the MacGUI window now. git-svn-id: svn://localhost/HandBrake/trunk@1454 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/HandBrakeCS.csproj | 10 ----- win/C#/Properties/Settings.Designer.cs | 2 +- win/C#/Properties/Settings.settings | 2 +- win/C#/app.config | 2 +- win/C#/frmActivityWindow.Designer.cs | 71 ++++++++-------------------------- win/C#/frmActivityWindow.cs | 26 ++----------- win/C#/frmMain.cs | 7 ++-- win/C#/frmReadDVD.cs | 12 +++--- 8 files changed, 31 insertions(+), 101 deletions(-) diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index da343ea9..49f2ae67 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -128,12 +128,6 @@ frmDownload.cs - - Form - - - frmDvdInfo.cs - Form @@ -187,10 +181,6 @@ Designer frmDownload.cs - - Designer - frmDvdInfo.cs - Designer frmMain.cs diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index e5f9dd94..41899aaf 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -121,7 +121,7 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("2008041701")] + [global::System.Configuration.DefaultSettingValueAttribute("2008043001")] public int hb_build { get { return ((int)(this["hb_build"])); diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index ab759a13..e36176bf 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -27,7 +27,7 @@ Checked - 2008041701 + 2008043001 0 diff --git a/win/C#/app.config b/win/C#/app.config index 61a016d1..1b918120 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -32,7 +32,7 @@ Checked - 2008041701 + 2008043001 0 diff --git a/win/C#/frmActivityWindow.Designer.cs b/win/C#/frmActivityWindow.Designer.cs index ac1e6f1a..1ef113d3 100644 --- a/win/C#/frmActivityWindow.Designer.cs +++ b/win/C#/frmActivityWindow.Designer.cs @@ -37,81 +37,43 @@ namespace Handbrake this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmActivityWindow)); this.rtf_actLog = new System.Windows.Forms.RichTextBox(); - this.btn_close = new System.Windows.Forms.Button(); this.ToolTip = new System.Windows.Forms.ToolTip(this.components); - this.btn_copy = new System.Windows.Forms.Button(); - this.btn_refresh = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // // rtf_actLog // this.rtf_actLog.Cursor = System.Windows.Forms.Cursors.IBeam; this.rtf_actLog.DetectUrls = false; - this.rtf_actLog.Location = new System.Drawing.Point(12, 12); + this.rtf_actLog.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtf_actLog.Location = new System.Drawing.Point(0, 0); this.rtf_actLog.Name = "rtf_actLog"; this.rtf_actLog.ReadOnly = true; - this.rtf_actLog.Size = new System.Drawing.Size(515, 433); + this.rtf_actLog.Size = new System.Drawing.Size(390, 390); this.rtf_actLog.TabIndex = 29; this.rtf_actLog.Text = ""; // - // btn_close - // - this.btn_close.BackColor = System.Drawing.SystemColors.ControlLight; - this.btn_close.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.btn_close.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btn_close.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_close.Location = new System.Drawing.Point(399, 451); - this.btn_close.Name = "btn_close"; - this.btn_close.Size = new System.Drawing.Size(128, 22); - this.btn_close.TabIndex = 28; - this.btn_close.TabStop = false; - this.btn_close.Text = "Close Window"; - this.btn_close.UseVisualStyleBackColor = true; - this.btn_close.Click += new System.EventHandler(this.btn_close_Click); - // // ToolTip // this.ToolTip.Active = false; // - // btn_copy - // - this.btn_copy.BackColor = System.Drawing.SystemColors.ControlLight; - this.btn_copy.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.btn_copy.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btn_copy.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_copy.Location = new System.Drawing.Point(12, 451); - this.btn_copy.Name = "btn_copy"; - this.btn_copy.Size = new System.Drawing.Size(134, 23); - this.btn_copy.TabIndex = 93; - this.btn_copy.Text = "Copy to Clipboard"; - this.btn_copy.UseVisualStyleBackColor = true; - this.btn_copy.Click += new System.EventHandler(this.btn_copy_Click); - // - // btn_refresh + // panel1 // - this.btn_refresh.BackColor = System.Drawing.SystemColors.ControlLight; - this.btn_refresh.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.btn_refresh.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btn_refresh.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_refresh.Location = new System.Drawing.Point(152, 451); - this.btn_refresh.Name = "btn_refresh"; - this.btn_refresh.Size = new System.Drawing.Size(69, 23); - this.btn_refresh.TabIndex = 94; - this.btn_refresh.Text = "Refresh"; - this.btn_refresh.UseVisualStyleBackColor = true; - this.btn_refresh.Click += new System.EventHandler(this.btn_refresh_Click); + this.panel1.Controls.Add(this.rtf_actLog); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(390, 390); + this.panel1.TabIndex = 95; // // frmActivityWindow // - this.AcceptButton = this.btn_close; this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlLight; - this.ClientSize = new System.Drawing.Size(539, 486); - this.Controls.Add(this.btn_refresh); - this.Controls.Add(this.btn_copy); - this.Controls.Add(this.rtf_actLog); - this.Controls.Add(this.btn_close); + this.ClientSize = new System.Drawing.Size(390, 390); + this.Controls.Add(this.panel1); this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; @@ -120,6 +82,7 @@ namespace Handbrake this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Activity Window"; this.Load += new System.EventHandler(this.frmActivityWindow_Load); + this.panel1.ResumeLayout(false); this.ResumeLayout(false); } @@ -127,9 +90,7 @@ namespace Handbrake #endregion internal System.Windows.Forms.RichTextBox rtf_actLog; - internal System.Windows.Forms.Button btn_close; internal System.Windows.Forms.ToolTip ToolTip; - internal System.Windows.Forms.Button btn_copy; - internal System.Windows.Forms.Button btn_refresh; + private System.Windows.Forms.Panel panel1; } } \ No newline at end of file diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index 4864df68..ebee0ea4 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -24,19 +24,15 @@ namespace Handbrake /// /// Thread monitorFile; - public frmActivityWindow() + String read_file; + public frmActivityWindow(string file) { InitializeComponent(); this.rtf_actLog.Text = string.Empty; monitorFile = new Thread(autoUpdate); + read_file = file; } - - private void btn_close_Click(object sender, EventArgs e) - { - monitorFile.Abort(); - this.Hide(); - } private void frmActivityWindow_Load(object sender, EventArgs e) { @@ -78,7 +74,7 @@ namespace Handbrake { // hb_encode_log.dat is the primary log file. Since .NET can't read this file whilst the CLI is outputing to it, // we'll need to make a copy of it. - string logFile = Path.Combine(Path.GetTempPath(), "hb_encode_log.dat"); + string logFile = Path.Combine(Path.GetTempPath(), read_file); string logFile2 = Path.Combine(Path.GetTempPath(), "hb_encode_log_AppReadable.dat"); // Make sure the application readable log file does not already exist. FileCopy fill fail if it does. @@ -105,19 +101,5 @@ namespace Handbrake return log; } - - private void btn_copy_Click(object sender, EventArgs e) - { - if (rtf_actLog.Text != "") - Clipboard.SetText(rtf_actLog.Text, TextDataFormat.Rtf); - } - - private void btn_refresh_Click(object sender, EventArgs e) - { - rtf_actLog.Clear(); - rtf_actLog.Text = readFile(); - } - - } } \ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 052f1b71..b9aad1ef 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -343,7 +343,7 @@ namespace Handbrake } private void mnu_viewDVDdata_Click(object sender, EventArgs e) { - frmDvdInfo dvdInfoWindow = new frmDvdInfo(); + frmActivityWindow dvdInfoWindow = new frmActivityWindow("dvdinfo.dat"); dvdInfoWindow.Show(); } private void mnu_options_Click(object sender, EventArgs e) @@ -456,7 +456,7 @@ namespace Handbrake } private void btn_ActivityWindow_Click(object sender, EventArgs e) { - Form ActivityWindow = new frmActivityWindow(); + frmActivityWindow ActivityWindow = new frmActivityWindow("hb_encode_log.dat"); ActivityWindow.ShowDialog(); } @@ -465,7 +465,6 @@ namespace Handbrake { String filename = ""; text_source.Text = ""; - frmDvdInfo dvdInfoWindow = new frmDvdInfo(); if (check_fileMode.Checked) { @@ -484,7 +483,7 @@ namespace Handbrake { if (filename != "") { - Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); + Form frmRD = new frmReadDVD(filename, this); text_source.Text = filename; frmRD.ShowDialog(); } diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index 4c62658f..d825d1c5 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -23,16 +23,14 @@ namespace Handbrake { private string inputFile; private frmMain mainWindow; - private frmDvdInfo dvdInfo; private Parsing.DVD thisDvd; private delegate void UpdateUIHandler(); - public frmReadDVD(string inputFile, frmMain parent, frmDvdInfo dvdInfoWindow) + public frmReadDVD(string inputFile, frmMain parent) { InitializeComponent(); this.inputFile = inputFile; this.mainWindow = parent; - this.dvdInfo = dvdInfoWindow; startScan(); } @@ -100,11 +98,9 @@ namespace Handbrake } } } - } - - mainWindow.drp_dvdtitle.SelectedItem = title2Select; + mainWindow.drp_dvdtitle.SelectedItem = title2Select; this.Close(); } @@ -136,7 +132,7 @@ namespace Handbrake { hbproc.WaitForExit(); // TODO: Verify exit code if the CLI supports it properly - } + } if (!File.Exists(dvdInfoPath)) { @@ -146,6 +142,8 @@ namespace Handbrake using (StreamReader sr = new StreamReader(dvdInfoPath)) { thisDvd = Parsing.DVD.Parse(sr); + sr.Close(); + sr.Dispose(); } updateUIElements(); -- 2.11.0