From 1c35c63291746d666f8b3c31e817154770163427 Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 23 Jul 2007 22:57:48 +0000 Subject: WinGui: - Fixed one cross-threading bug with a dirty hack. This will need to be sorted out properly later. - Added cancel button place holder on frmReadDVD. (will be used for instances where hbcli stalls or crashes) - Fixed a few Design issues with windows appearing with the wrong dimensions. - Updated some comments about bugs that need fixed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@723 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/frmMain.cs | 38 +++++++++++++++++++++++++++++++------- win/C#/frmQueue.Designer.cs | 5 +++-- win/C#/frmReadDVD.Designer.cs | 28 ++++++++++++++++++++++++---- win/C#/frmReadDVD.cs | 12 +++++++++++- 4 files changed, 69 insertions(+), 14 deletions(-) (limited to 'win') diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index acb35a3c9..794a571c6 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -27,11 +27,18 @@ namespace Handbrake // - Load users default settings. (if required) // - Do an update check (if required) // -------------------------------------------------------------- + private frmDvdInfo dvdInfoWindow = new frmDvdInfo(); + public frmMain() { - + InitializeComponent(); + // This is a quick Hack fix for the cross-thread problem with frmDvdIndo ************************ + dvdInfoWindow.Show(); + dvdInfoWindow.Hide(); + // ********************************************************************************************** + // Set the Version number lable to the corect version. Version.Text = "Version " + Properties.Settings.Default.GuiVersion; @@ -333,15 +340,25 @@ namespace Handbrake showQueue(); } - private frmDvdInfo dvdInfoWindow = new frmDvdInfo(); + private void mnu_viewDVDdata_Click(object sender, EventArgs e) { - dvdInfoWindow.Show(); + try + { + dvdInfoWindow.Show(); + + } + catch (Exception) + { + } // BUG ******************************************************* // Cross-thread operation not valid: Control 'rtf_dvdInfo' accessed from a thread other than the thread it was created on. // This happens when the DVD is scanned and this item is then selected. // If this item is selected so a blank copy of the window appears, then a DVD is scanned, there is no cross-thread issue. + // NOTE: Try/catch added to prevent final build crashing. + // NOTE2: Included a quick fix in frmMain(). Simply show and hide the window when starting the app. + // Note3: Suspect the problem lies with line 30. // *********************************************************** } @@ -593,9 +610,17 @@ namespace Handbrake private void btn_queue_Click(object sender, EventArgs e) { - String query = GenerateTheQuery(); - queueWindow.list_queue.Items.Add(query); - queueWindow.Show(); + if (text_destination.Text != "" && text_source.Text != "") + { + + String query = GenerateTheQuery(); + queueWindow.list_queue.Items.Add(query); + queueWindow.Show(); + } + else + { + MessageBox.Show("No Source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } } private void showQueue() @@ -631,7 +656,6 @@ namespace Handbrake lbl_encode.Text = string.Format("Encode Progress: {0}%, FPS: {1}, Avg FPS: {2}, Time Remaining: {3} ", PercentComplete, CurrentFps, AverageFps, TimeRemaining); } - private void procMonitor(object state) { Functions.CLI process = new Functions.CLI(); diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs index 83233e59e..b078970bd 100644 --- a/win/C#/frmQueue.Designer.cs +++ b/win/C#/frmQueue.Designer.cs @@ -168,7 +168,7 @@ namespace Handbrake // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(651, 423); + this.ClientSize = new System.Drawing.Size(657, 406); this.ControlBox = false; this.Controls.Add(this.lbl_progressValue); this.Controls.Add(this.label2); @@ -182,7 +182,8 @@ namespace Handbrake this.Controls.Add(this.btn_Close); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(659, 431); + this.MaximumSize = new System.Drawing.Size(663, 431); + this.MinimumSize = new System.Drawing.Size(663, 431); this.Name = "frmQueue"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Queue"; diff --git a/win/C#/frmReadDVD.Designer.cs b/win/C#/frmReadDVD.Designer.cs index 971036feb..5ba4af975 100644 --- a/win/C#/frmReadDVD.Designer.cs +++ b/win/C#/frmReadDVD.Designer.cs @@ -35,6 +35,7 @@ namespace Handbrake this.Label2 = new System.Windows.Forms.Label(); this.lbl_status = new System.Windows.Forms.Label(); this.lbl_progress = new System.Windows.Forms.Label(); + this.btn_skip = new System.Windows.Forms.Button(); this.SuspendLayout(); // // lbl_pressOk @@ -54,7 +55,7 @@ namespace Handbrake this.btn_ok.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_ok.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_ok.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_ok.Location = new System.Drawing.Point(416, 45); + this.btn_ok.Location = new System.Drawing.Point(449, 56); this.btn_ok.Name = "btn_ok"; this.btn_ok.Size = new System.Drawing.Size(71, 22); this.btn_ok.TabIndex = 28; @@ -105,13 +106,31 @@ namespace Handbrake this.lbl_progress.Text = "{ % }"; this.lbl_progress.Visible = false; // + // btn_skip + // + this.btn_skip.BackColor = System.Drawing.SystemColors.Control; + this.btn_skip.FlatAppearance.BorderColor = System.Drawing.Color.Black; + this.btn_skip.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btn_skip.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_skip.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + this.btn_skip.Location = new System.Drawing.Point(372, 56); + this.btn_skip.Name = "btn_skip"; + this.btn_skip.Size = new System.Drawing.Size(71, 22); + this.btn_skip.TabIndex = 33; + this.btn_skip.TabStop = false; + this.btn_skip.Text = "Cancel"; + this.btn_skip.UseVisualStyleBackColor = true; + this.btn_skip.Visible = false; + this.btn_skip.Click += new System.EventHandler(this.btn_skip_Click); + // // frmReadDVD // this.AcceptButton = this.btn_ok; this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(499, 79); + this.ClientSize = new System.Drawing.Size(532, 88); this.ControlBox = false; + this.Controls.Add(this.btn_skip); this.Controls.Add(this.lbl_progress); this.Controls.Add(this.lbl_status); this.Controls.Add(this.lbl_pressOk); @@ -122,8 +141,8 @@ namespace Handbrake this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(505, 111); - this.MinimumSize = new System.Drawing.Size(505, 111); + this.MaximumSize = new System.Drawing.Size(538, 113); + this.MinimumSize = new System.Drawing.Size(538, 113); this.Name = "frmReadDVD"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; @@ -141,5 +160,6 @@ namespace Handbrake internal System.Windows.Forms.Label Label2; internal System.Windows.Forms.Label lbl_status; private System.Windows.Forms.Label lbl_progress; + internal System.Windows.Forms.Button btn_skip; } } \ No newline at end of file diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index 231064f66..6c73291e5 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -32,6 +32,7 @@ namespace Handbrake private void btn_ok_Click(object sender, EventArgs e) { btn_ok.Enabled = false; + btn_skip.Visible = true; lbl_pressOk.Visible = false; lbl_progress.Text = "0%"; lbl_progress.Visible = true; @@ -68,7 +69,8 @@ namespace Handbrake readData.OnReadLine += dvdInfo.HandleParsedData; readData.OnReadToEnd += dvdInfo.HandleParsedData; hbProc.Close(); - + hbProc.Dispose(); + // Setup the parser thisDvd = Parsing.DVD.Parse(readData); @@ -90,5 +92,13 @@ namespace Handbrake this.lbl_progress.Text = progress.ToString() + "%"; } + private void btn_skip_Click(object sender, EventArgs e) + { + // TODO ***************************************************************** + // This needs to be implimented so that is destroys the above thread + // closing hbcli with it. + //*********************************************************************** + } + } } \ No newline at end of file -- cgit v1.2.3