OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 23 Jul 2007 22:57:48 +0000 (22:57 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 23 Jul 2007 22:57:48 +0000 (22:57 +0000)
- 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://localhost/HandBrake/trunk@723 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/frmMain.cs
win/C#/frmQueue.Designer.cs
win/C#/frmReadDVD.Designer.cs
win/C#/frmReadDVD.cs

index acb35a3..794a571 100644 (file)
@@ -27,11 +27,18 @@ namespace Handbrake
         // - Load users default settings. (if required)\r
         // - Do an update check (if required)\r
         // --------------------------------------------------------------\r
+        private frmDvdInfo dvdInfoWindow = new frmDvdInfo();\r
+        \r
         public frmMain()\r
         {\r
-            \r
+\r
             InitializeComponent();\r
 \r
+            // This is a quick Hack fix for the cross-thread problem with frmDvdIndo ************************\r
+            dvdInfoWindow.Show();\r
+            dvdInfoWindow.Hide();\r
+            // **********************************************************************************************\r
+\r
             // Set the Version number lable to the corect version.\r
             Version.Text = "Version " + Properties.Settings.Default.GuiVersion;\r
 \r
@@ -333,15 +340,25 @@ namespace Handbrake
             showQueue();\r
         }\r
 \r
-        private frmDvdInfo dvdInfoWindow = new frmDvdInfo();\r
+       \r
         private void mnu_viewDVDdata_Click(object sender, EventArgs e)\r
         {\r
-            dvdInfoWindow.Show();\r
+            try\r
+            {\r
+                dvdInfoWindow.Show();\r
+                \r
+            }\r
+            catch (Exception)\r
+            {\r
+            }\r
 \r
             // BUG *******************************************************\r
             // Cross-thread operation not valid: Control 'rtf_dvdInfo' accessed from a thread other than the thread it was created on.\r
             // This happens when the DVD is scanned and this item is then selected.\r
             // If this item is selected so a blank copy of the window appears, then a DVD is scanned, there is no cross-thread issue.\r
+            // NOTE: Try/catch added to prevent final build crashing.\r
+            // NOTE2: Included a quick fix in frmMain(). Simply show and hide the window when starting the app.\r
+            // Note3: Suspect the problem lies with line 30.\r
             // ***********************************************************\r
 \r
         }\r
@@ -593,9 +610,17 @@ namespace Handbrake
 \r
         private void btn_queue_Click(object sender, EventArgs e)\r
         {\r
-            String query = GenerateTheQuery();\r
-            queueWindow.list_queue.Items.Add(query);\r
-            queueWindow.Show();\r
+            if (text_destination.Text != "" && text_source.Text != "")\r
+            {\r
+\r
+                String query = GenerateTheQuery();\r
+                queueWindow.list_queue.Items.Add(query);\r
+                queueWindow.Show();\r
+            } \r
+            else \r
+            {\r
+                MessageBox.Show("No Source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+            }\r
         }\r
 \r
         private void showQueue()\r
@@ -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);\r
         }\r
 \r
-\r
         private void procMonitor(object state)\r
         {\r
             Functions.CLI process = new Functions.CLI();\r
index 83233e5..b078970 100644 (file)
@@ -168,7 +168,7 @@ namespace Handbrake
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
-            this.ClientSize = new System.Drawing.Size(651, 423);\r
+            this.ClientSize = new System.Drawing.Size(657, 406);\r
             this.ControlBox = false;\r
             this.Controls.Add(this.lbl_progressValue);\r
             this.Controls.Add(this.label2);\r
@@ -182,7 +182,8 @@ namespace Handbrake
             this.Controls.Add(this.btn_Close);\r
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;\r
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));\r
-            this.MinimumSize = new System.Drawing.Size(659, 431);\r
+            this.MaximumSize = new System.Drawing.Size(663, 431);\r
+            this.MinimumSize = new System.Drawing.Size(663, 431);\r
             this.Name = "frmQueue";\r
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
             this.Text = "Queue";\r
index 971036f..5ba4af9 100644 (file)
@@ -35,6 +35,7 @@ namespace Handbrake
             this.Label2 = new System.Windows.Forms.Label();\r
             this.lbl_status = new System.Windows.Forms.Label();\r
             this.lbl_progress = new System.Windows.Forms.Label();\r
+            this.btn_skip = new System.Windows.Forms.Button();\r
             this.SuspendLayout();\r
             // \r
             // lbl_pressOk\r
@@ -54,7 +55,7 @@ namespace Handbrake
             this.btn_ok.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
             this.btn_ok.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_ok.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_ok.Location = new System.Drawing.Point(416, 45);\r
+            this.btn_ok.Location = new System.Drawing.Point(449, 56);\r
             this.btn_ok.Name = "btn_ok";\r
             this.btn_ok.Size = new System.Drawing.Size(71, 22);\r
             this.btn_ok.TabIndex = 28;\r
@@ -105,13 +106,31 @@ namespace Handbrake
             this.lbl_progress.Text = "{ % }";\r
             this.lbl_progress.Visible = false;\r
             // \r
+            // btn_skip\r
+            // \r
+            this.btn_skip.BackColor = System.Drawing.SystemColors.Control;\r
+            this.btn_skip.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
+            this.btn_skip.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.btn_skip.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.btn_skip.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
+            this.btn_skip.Location = new System.Drawing.Point(372, 56);\r
+            this.btn_skip.Name = "btn_skip";\r
+            this.btn_skip.Size = new System.Drawing.Size(71, 22);\r
+            this.btn_skip.TabIndex = 33;\r
+            this.btn_skip.TabStop = false;\r
+            this.btn_skip.Text = "Cancel";\r
+            this.btn_skip.UseVisualStyleBackColor = true;\r
+            this.btn_skip.Visible = false;\r
+            this.btn_skip.Click += new System.EventHandler(this.btn_skip_Click);\r
+            // \r
             // frmReadDVD\r
             // \r
             this.AcceptButton = this.btn_ok;\r
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F);\r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
-            this.ClientSize = new System.Drawing.Size(499, 79);\r
+            this.ClientSize = new System.Drawing.Size(532, 88);\r
             this.ControlBox = false;\r
+            this.Controls.Add(this.btn_skip);\r
             this.Controls.Add(this.lbl_progress);\r
             this.Controls.Add(this.lbl_status);\r
             this.Controls.Add(this.lbl_pressOk);\r
@@ -122,8 +141,8 @@ namespace Handbrake
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;\r
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));\r
             this.MaximizeBox = false;\r
-            this.MaximumSize = new System.Drawing.Size(505, 111);\r
-            this.MinimumSize = new System.Drawing.Size(505, 111);\r
+            this.MaximumSize = new System.Drawing.Size(538, 113);\r
+            this.MinimumSize = new System.Drawing.Size(538, 113);\r
             this.Name = "frmReadDVD";\r
             this.ShowInTaskbar = false;\r
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
@@ -141,5 +160,6 @@ namespace Handbrake
         internal System.Windows.Forms.Label Label2;\r
         internal System.Windows.Forms.Label lbl_status;\r
         private System.Windows.Forms.Label lbl_progress;\r
+        internal System.Windows.Forms.Button btn_skip;\r
     }\r
 }
\ No newline at end of file
index 231064f..6c73291 100644 (file)
@@ -32,6 +32,7 @@ namespace Handbrake
         private void btn_ok_Click(object sender, EventArgs e)\r
         {\r
             btn_ok.Enabled = false;\r
+            btn_skip.Visible = true;\r
             lbl_pressOk.Visible = false;\r
             lbl_progress.Text = "0%";\r
             lbl_progress.Visible = true;\r
@@ -68,7 +69,8 @@ namespace Handbrake
             readData.OnReadLine += dvdInfo.HandleParsedData;\r
             readData.OnReadToEnd += dvdInfo.HandleParsedData;\r
             hbProc.Close();\r
-\r
+            hbProc.Dispose();\r
+   \r
             // Setup the parser\r
             thisDvd = Parsing.DVD.Parse(readData);\r
 \r
@@ -90,5 +92,13 @@ namespace Handbrake
             this.lbl_progress.Text = progress.ToString() + "%";\r
         }\r
 \r
+        private void btn_skip_Click(object sender, EventArgs e)\r
+        {\r
+            // TODO *****************************************************************\r
+            // This needs to be implimented so that is destroys the above thread\r
+            // closing hbcli with it.\r
+            //***********************************************************************\r
+        }\r
+\r
     }\r
 }
\ No newline at end of file