OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 4 Apr 2008 21:13:59 +0000 (21:13 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 4 Apr 2008 21:13:59 +0000 (21:13 +0000)
- Automatically select the longest title after a scan has completed.

git-svn-id: svn://localhost/HandBrake/trunk@1380 b64f7644-9d1e-0410-96f1-a4d463321fa5

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

index 20d4a90..4569a3e 100644 (file)
@@ -291,6 +291,7 @@ namespace Handbrake
             this.ToolTip.Active = false;\r
             this.ToolTip.AutomaticDelay = 1000;\r
             this.ToolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info;\r
+            this.ToolTip.ToolTipTitle = "Tooltip";\r
             // \r
             // drop_chapterFinish\r
             // \r
@@ -2207,7 +2208,7 @@ namespace Handbrake
             // \r
             this.label44.AutoSize = true;\r
             this.label44.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label44.Location = new System.Drawing.Point(590, 108);\r
+            this.label44.Location = new System.Drawing.Point(606, 109);\r
             this.label44.Name = "label44";\r
             this.label44.Size = new System.Drawing.Size(55, 12);\r
             this.label44.TabIndex = 23;\r
@@ -2217,7 +2218,7 @@ namespace Handbrake
             // \r
             this.check_8x8DCT.AutoSize = true;\r
             this.check_8x8DCT.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
-            this.check_8x8DCT.Location = new System.Drawing.Point(648, 108);\r
+            this.check_8x8DCT.Location = new System.Drawing.Point(664, 109);\r
             this.check_8x8DCT.Name = "check_8x8DCT";\r
             this.check_8x8DCT.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
             this.check_8x8DCT.Size = new System.Drawing.Size(12, 11);\r
@@ -2243,7 +2244,7 @@ namespace Handbrake
             this.drop_analysis.FormattingEnabled = true;\r
             this.drop_analysis.Location = new System.Drawing.Point(537, 105);\r
             this.drop_analysis.Name = "drop_analysis";\r
-            this.drop_analysis.Size = new System.Drawing.Size(47, 20);\r
+            this.drop_analysis.Size = new System.Drawing.Size(63, 20);\r
             this.drop_analysis.TabIndex = 33;\r
             this.drop_analysis.SelectedIndexChanged += new System.EventHandler(this.drop_analysis_SelectedIndexChanged);\r
             // \r
index edb5987..98f2110 100644 (file)
@@ -14,6 +14,7 @@ using System.Windows.Forms;
 using System.IO;\r
 using System.Threading;\r
 using System.Diagnostics;\r
+using System.Collections;\r
 \r
 \r
 namespace Handbrake\r
@@ -67,6 +68,44 @@ namespace Handbrake
                 mainWindow.drop_chapterFinish.Text = "Auto";\r
                 mainWindow.drop_chapterStart.Text = "Auto";\r
 \r
+                // Now select the longest title\r
+                int current_largest = 0;\r
+                Handbrake.Parsing.Title title2Select = thisDvd.Titles[0];\r
+\r
+                foreach (Handbrake.Parsing.Title x in thisDvd.Titles)\r
+                {\r
+                    string title = x.ToString();\r
+                    if (title != "Automatic")\r
+                    {\r
+                        string[] y = title.Split(' ');\r
+                        string time = y[1].Replace("(", "").Replace(")", "");\r
+                        string[] z = time.Split(':');\r
+\r
+                        int hours = int.Parse(z[0]) * 60 * 60;\r
+                        int minutes = int.Parse(z[1]) * 60;\r
+                        int seconds = int.Parse(z[2]);\r
+                        int total_sec = hours + minutes + seconds;\r
+\r
+                        if (current_largest == 0)\r
+                        {\r
+                            current_largest = hours + minutes + seconds;\r
+                            title2Select = x;\r
+                        }\r
+                        else\r
+                        {\r
+                            if (total_sec > current_largest)\r
+                            {\r
+                                current_largest = total_sec;\r
+                                title2Select = x;\r
+                            }\r
+                        }\r
+                    }\r
+            \r
+                }\r
+\r
+\r
+                    mainWindow.drp_dvdtitle.SelectedItem = title2Select;\r
+\r
                 this.Close();\r
             }\r
             catch (Exception exc)\r
@@ -100,7 +139,7 @@ namespace Handbrake
 \r
                 if (!File.Exists(dvdInfoPath))\r
                 {\r
-                    throw new Exception("Unable to retrieve the DVD Info. dvdinfo.dat missing.");\r
+                    throw new Exception("Unable to retrieve the DVD Info. dvdinfo.dat is missing.");\r
                 }\r
 \r
                 using (StreamReader sr = new StreamReader(dvdInfoPath))\r