From d6239a451833361425f47f2f5c23aed5b57faa2a Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 4 Apr 2008 21:13:59 +0000 Subject: WinGui: - Automatically select the longest title after a scan has completed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1380 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/frmMain.Designer.cs | 7 ++++--- win/C#/frmReadDVD.cs | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) (limited to 'win/C#') diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 20d4a9025..4569a3e9a 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -291,6 +291,7 @@ namespace Handbrake this.ToolTip.Active = false; this.ToolTip.AutomaticDelay = 1000; this.ToolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; + this.ToolTip.ToolTipTitle = "Tooltip"; // // drop_chapterFinish // @@ -2207,7 +2208,7 @@ namespace Handbrake // this.label44.AutoSize = true; this.label44.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label44.Location = new System.Drawing.Point(590, 108); + this.label44.Location = new System.Drawing.Point(606, 109); this.label44.Name = "label44"; this.label44.Size = new System.Drawing.Size(55, 12); this.label44.TabIndex = 23; @@ -2217,7 +2218,7 @@ namespace Handbrake // this.check_8x8DCT.AutoSize = true; this.check_8x8DCT.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.check_8x8DCT.Location = new System.Drawing.Point(648, 108); + this.check_8x8DCT.Location = new System.Drawing.Point(664, 109); this.check_8x8DCT.Name = "check_8x8DCT"; this.check_8x8DCT.RightToLeft = System.Windows.Forms.RightToLeft.No; this.check_8x8DCT.Size = new System.Drawing.Size(12, 11); @@ -2243,7 +2244,7 @@ namespace Handbrake this.drop_analysis.FormattingEnabled = true; this.drop_analysis.Location = new System.Drawing.Point(537, 105); this.drop_analysis.Name = "drop_analysis"; - this.drop_analysis.Size = new System.Drawing.Size(47, 20); + this.drop_analysis.Size = new System.Drawing.Size(63, 20); this.drop_analysis.TabIndex = 33; this.drop_analysis.SelectedIndexChanged += new System.EventHandler(this.drop_analysis_SelectedIndexChanged); // diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index edb59873f..98f2110d1 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -14,6 +14,7 @@ using System.Windows.Forms; using System.IO; using System.Threading; using System.Diagnostics; +using System.Collections; namespace Handbrake @@ -67,6 +68,44 @@ namespace Handbrake mainWindow.drop_chapterFinish.Text = "Auto"; mainWindow.drop_chapterStart.Text = "Auto"; + // Now select the longest title + int current_largest = 0; + Handbrake.Parsing.Title title2Select = thisDvd.Titles[0]; + + foreach (Handbrake.Parsing.Title x in thisDvd.Titles) + { + string title = x.ToString(); + if (title != "Automatic") + { + string[] y = title.Split(' '); + string time = y[1].Replace("(", "").Replace(")", ""); + string[] z = time.Split(':'); + + int hours = int.Parse(z[0]) * 60 * 60; + int minutes = int.Parse(z[1]) * 60; + int seconds = int.Parse(z[2]); + int total_sec = hours + minutes + seconds; + + if (current_largest == 0) + { + current_largest = hours + minutes + seconds; + title2Select = x; + } + else + { + if (total_sec > current_largest) + { + current_largest = total_sec; + title2Select = x; + } + } + } + + } + + + mainWindow.drp_dvdtitle.SelectedItem = title2Select; + this.Close(); } catch (Exception exc) @@ -100,7 +139,7 @@ namespace Handbrake if (!File.Exists(dvdInfoPath)) { - throw new Exception("Unable to retrieve the DVD Info. dvdinfo.dat missing."); + throw new Exception("Unable to retrieve the DVD Info. dvdinfo.dat is missing."); } using (StreamReader sr = new StreamReader(dvdInfoPath)) -- cgit v1.2.3