OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 12 Mar 2010 21:24:42 +0000 (21:24 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 12 Mar 2010 21:24:42 +0000 (21:24 +0000)
The Source button dropdown menu can now display multiple ready DVD drives. Previously only the first ready drive would be displayed.

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

win/C#/Functions/Main.cs
win/C#/Model/DriveInformation.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmMain.resx

index c99ce65..3285b5f 100644 (file)
@@ -719,6 +719,7 @@ namespace Handbrake.Functions
         {\r
             List<DriveInformation> drives = new List<DriveInformation>();\r
             DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();\r
+            int id = 0;\r
             foreach (DriveInfo curDrive in theCollectionOfDrives)\r
             {\r
                 if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady &&\r
@@ -726,9 +727,11 @@ namespace Handbrake.Functions
                 {\r
                     drives.Add(new DriveInformation\r
                                    {\r
+                                       Id = id,\r
                                        VolumeLabel = curDrive.VolumeLabel, \r
                                        RootDirectory = curDrive.RootDirectory + "VIDEO_TS"\r
                                    });\r
+                    id++;\r
                 }\r
             }\r
             return drives;\r
index d71d3a8..f22cdf9 100644 (file)
@@ -10,6 +10,12 @@ namespace Handbrake.Model
     /// </summary>\r
     public class DriveInformation\r
     {\r
+\r
+        /// <summary>\r
+        /// Gets or sets A Unique ID That represemts this model.\r
+        /// </summary>\r
+        public int Id { get; set; }\r
+\r
         /// <summary>\r
         /// Gets or sets The Drive Volume Name\r
         /// </summary>\r
@@ -19,5 +25,16 @@ namespace Handbrake.Model
         /// Gets or sets The Root Directory\r
         /// </summary>\r
         public string RootDirectory { get; set; }\r
+\r
+        /// <summary>\r
+        /// Returns  "Drive" + Id  (e.g  Drive2)\r
+        /// </summary>\r
+        /// <returns>\r
+        /// A String that contrains "Drive" and it's ID\r
+        /// </returns>\r
+        public override string ToString()\r
+        {\r
+            return "Drive" + Id;\r
+        }\r
     }\r
 }
\ No newline at end of file
index f29db78..1d55629 100644 (file)
@@ -40,7 +40,7 @@ namespace Handbrake
             this.components = new System.ComponentModel.Container();\r
             System.Windows.Forms.ContextMenuStrip notifyIconMenu;\r
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));\r
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();\r
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
             this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();\r
             this.DVD_Save = new System.Windows.Forms.SaveFileDialog();\r
             this.ToolTip = new System.Windows.Forms.ToolTip(this.components);\r
@@ -145,7 +145,6 @@ namespace Handbrake
             this.btn_file_source = new System.Windows.Forms.ToolStripMenuItem();\r
             this.btn_dvd_source = new System.Windows.Forms.ToolStripMenuItem();\r
             this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();\r
-            this.mnu_dvd_drive = new System.Windows.Forms.ToolStripMenuItem();\r
             this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();\r
             this.btn_start = new System.Windows.Forms.ToolStripButton();\r
             this.btn_add2Queue = new System.Windows.Forms.ToolStripButton();\r
@@ -400,9 +399,9 @@ namespace Handbrake
             // \r
             // number\r
             // \r
-            dataGridViewCellStyle2.Format = "N0";\r
-            dataGridViewCellStyle2.NullValue = null;\r
-            this.number.DefaultCellStyle = dataGridViewCellStyle2;\r
+            dataGridViewCellStyle1.Format = "N0";\r
+            dataGridViewCellStyle1.NullValue = null;\r
+            this.number.DefaultCellStyle = dataGridViewCellStyle1;\r
             this.number.Frozen = true;\r
             this.number.HeaderText = "Chapter Number";\r
             this.number.MaxInputLength = 3;\r
@@ -1077,6 +1076,7 @@ namespace Handbrake
             this.x264Panel.Name = "x264Panel";\r
             this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
             this.x264Panel.TabIndex = 0;\r
+            this.x264Panel.X264Query = "";\r
             // \r
             // tab_query\r
             // \r
@@ -1281,8 +1281,7 @@ namespace Handbrake
             this.btn_source.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
             this.btn_file_source,\r
             this.btn_dvd_source,\r
-            this.toolStripSeparator1,\r
-            this.mnu_dvd_drive});\r
+            this.toolStripSeparator1});\r
             this.btn_source.Image = global::Handbrake.Properties.Resources.Movies;\r
             this.btn_source.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;\r
             this.btn_source.ImageTransparentColor = System.Drawing.Color.Magenta;\r
@@ -1297,7 +1296,7 @@ namespace Handbrake
             this.btn_file_source.Image = global::Handbrake.Properties.Resources.Movies_Small;\r
             this.btn_file_source.Name = "btn_file_source";\r
             this.btn_file_source.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));\r
-            this.btn_file_source.Size = new System.Drawing.Size(189, 22);\r
+            this.btn_file_source.Size = new System.Drawing.Size(182, 22);\r
             this.btn_file_source.Text = "Video File";\r
             this.btn_file_source.Click += new System.EventHandler(this.btn_file_source_Click);\r
             // \r
@@ -1308,23 +1307,14 @@ namespace Handbrake
             this.btn_dvd_source.Name = "btn_dvd_source";\r
             this.btn_dvd_source.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)\r
                         | System.Windows.Forms.Keys.O)));\r
-            this.btn_dvd_source.Size = new System.Drawing.Size(189, 22);\r
+            this.btn_dvd_source.Size = new System.Drawing.Size(182, 22);\r
             this.btn_dvd_source.Text = "Folder";\r
             this.btn_dvd_source.Click += new System.EventHandler(this.btn_dvd_source_Click);\r
             // \r
             // toolStripSeparator1\r
             // \r
             this.toolStripSeparator1.Name = "toolStripSeparator1";\r
-            this.toolStripSeparator1.Size = new System.Drawing.Size(186, 6);\r
-            // \r
-            // mnu_dvd_drive\r
-            // \r
-            this.mnu_dvd_drive.Image = global::Handbrake.Properties.Resources.disc_small;\r
-            this.mnu_dvd_drive.Name = "mnu_dvd_drive";\r
-            this.mnu_dvd_drive.Size = new System.Drawing.Size(189, 22);\r
-            this.mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
-            this.mnu_dvd_drive.Visible = false;\r
-            this.mnu_dvd_drive.Click += new System.EventHandler(this.mnu_dvd_drive_Click);\r
+            this.toolStripSeparator1.Size = new System.Drawing.Size(179, 6);\r
             // \r
             // toolStripSeparator10\r
             // \r
@@ -1794,7 +1784,6 @@ namespace Handbrake
         private System.Windows.Forms.ToolStripStatusLabel lbl_encode;\r
         internal System.Windows.Forms.OpenFileDialog ISO_Open;\r
         internal System.Windows.Forms.FolderBrowserDialog DVD_Open;\r
-        internal System.Windows.Forms.ToolStripMenuItem mnu_dvd_drive;\r
         private System.Windows.Forms.ContextMenuStrip presets_menu;\r
         private System.Windows.Forms.ToolStripMenuItem pmnu_expandAll;\r
         private System.Windows.Forms.ToolStripMenuItem pmnu_collapse;\r
index 07f8f4b..2e9541a 100644 (file)
@@ -19,6 +19,7 @@ namespace Handbrake
     using Model;\r
     using Parsing;\r
     using Presets;\r
+    using Properties;\r
     using Services;\r
 \r
     public partial class frmMain : Form\r
@@ -41,6 +42,7 @@ namespace Handbrake
         private Preset CurrentlySelectedPreset;\r
         private DVD currentSource;\r
         private Scan SourceScan = new Scan();\r
+        private List<DriveInformation> drives;\r
 \r
         // Delegates **********************************************************\r
         private delegate void UpdateWindowHandler();\r
@@ -54,7 +56,7 @@ namespace Handbrake
             // Load and setup the splash screen in this thread\r
             splash = new frmSplashScreen();\r
             splash.Show(this);\r
-            Label lblStatus = new Label {Size = new Size(150, 20), Location = new Point(182, 102)};\r
+            Label lblStatus = new Label { Size = new Size(150, 20), Location = new Point(182, 102) };\r
             splash.Controls.Add(lblStatus);\r
 \r
             InitializeComponent();\r
@@ -118,7 +120,7 @@ namespace Handbrake
                         x264Panel.Reset2Defaults();\r
 \r
                         QueryParser presetQuery = QueryParser.Parse(query);\r
-                        PresetLoader.LoadPreset(this, presetQuery, Properties.Settings.Default.defaultPreset, \r
+                        PresetLoader.LoadPreset(this, presetQuery, Properties.Settings.Default.defaultPreset,\r
                                                 loadPictureSettings);\r
 \r
                         x264Panel.X264_StandardizeOptString();\r
@@ -172,9 +174,9 @@ namespace Handbrake
             }\r
             catch (Exception ex)\r
             {\r
-                if ((bool) result.AsyncState)\r
+                if ((bool)result.AsyncState)\r
                     MessageBox.Show(\r
-                        "Unable to check for updates, Please try again later.\n\nDetailed Error Information:\n" + ex, \r
+                        "Unable to check for updates, Please try again later.\n\nDetailed Error Information:\n" + ex,\r
                         "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             }\r
         }\r
@@ -186,7 +188,7 @@ namespace Handbrake
             {\r
                 DialogResult result =\r
                     MessageBox.Show(\r
-                        "HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?", \r
+                        "HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?",\r
                         "Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
 \r
                 if (result == DialogResult.Yes)\r
@@ -406,7 +408,7 @@ namespace Handbrake
             LoadPresetPanel();\r
             if (treeView_presets.Nodes.Count == 0)\r
                 MessageBox.Show(\r
-                    "Unable to load the presets.xml file. Please select \"Update Built-in Presets\" from the Presets Menu. \nMake sure you are running the program in Admin mode if running on Vista. See Windows FAQ for details!", \r
+                    "Unable to load the presets.xml file. Please select \"Update Built-in Presets\" from the Presets Menu. \nMake sure you are running the program in Admin mode if running on Vista. See Windows FAQ for details!",\r
                     "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             else\r
                 MessageBox.Show("Presets have been updated!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
@@ -432,7 +434,7 @@ namespace Handbrake
 \r
         private void btn_new_preset_Click(object sender, EventArgs e)\r
         {\r
-            Form preset = new frmAddPreset(this, QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), \r
+            Form preset = new frmAddPreset(this, QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null),\r
                                            presetHandler);\r
             preset.ShowDialog();\r
         }\r
@@ -477,16 +479,16 @@ namespace Handbrake
                     updateWindow.ShowDialog();\r
                 }\r
                 else\r
-                    MessageBox.Show("There are no new updates at this time.", "Update Check", MessageBoxButtons.OK, \r
+                    MessageBox.Show("There are no new updates at this time.", "Update Check", MessageBoxButtons.OK,\r
                                     MessageBoxIcon.Information);\r
                 lbl_updateCheck.Visible = false;\r
                 return;\r
             }\r
             catch (Exception ex)\r
             {\r
-                if ((bool) result.AsyncState)\r
+                if ((bool)result.AsyncState)\r
                     MessageBox.Show(\r
-                        "Unable to check for updates, Please try again later.\n\nDetailed Error Information:\n" + ex, \r
+                        "Unable to check for updates, Please try again later.\n\nDetailed Error Information:\n" + ex,\r
                         "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             }\r
         }\r
@@ -524,13 +526,13 @@ namespace Handbrake
             DialogResult result =\r
                 MessageBox.Show(\r
                     "Do you wish to include picture settings when updating the preset: " +\r
-                    treeView_presets.SelectedNode.Text, "Update Preset", MessageBoxButtons.YesNoCancel, \r
+                    treeView_presets.SelectedNode.Text, "Update Preset", MessageBoxButtons.YesNoCancel,\r
                     MessageBoxIcon.Question);\r
             if (result == DialogResult.Yes)\r
-                presetHandler.Update(treeView_presets.SelectedNode.Text, \r
+                presetHandler.Update(treeView_presets.SelectedNode.Text,\r
                                      QueryGenerator.GenerateTabbedComponentsQuery(this), true);\r
             else if (result == DialogResult.No)\r
-                presetHandler.Update(treeView_presets.SelectedNode.Text, \r
+                presetHandler.Update(treeView_presets.SelectedNode.Text,\r
                                      QueryGenerator.GenerateTabbedComponentsQuery(this), false);\r
         }\r
 \r
@@ -566,7 +568,7 @@ namespace Handbrake
 \r
         private void btn_removePreset_Click(object sender, EventArgs e)\r
         {\r
-            DialogResult result = MessageBox.Show("Are you sure you wish to delete the selected preset?", "Preset", \r
+            DialogResult result = MessageBox.Show("Are you sure you wish to delete the selected preset?", "Preset",\r
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
             if (result == DialogResult.Yes)\r
             {\r
@@ -583,7 +585,7 @@ namespace Handbrake
         {\r
             if (treeView_presets.SelectedNode != null)\r
             {\r
-                DialogResult result = MessageBox.Show("Are you sure you wish to set this preset as the default?", \r
+                DialogResult result = MessageBox.Show("Are you sure you wish to set this preset as the default?",\r
                                                       "Preset", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
                 if (result == DialogResult.Yes)\r
                 {\r
@@ -621,7 +623,7 @@ namespace Handbrake
         {\r
             if (e.KeyCode == Keys.Delete)\r
             {\r
-                DialogResult result = MessageBox.Show("Are you sure you wish to delete the selected preset?", "Preset", \r
+                DialogResult result = MessageBox.Show("Are you sure you wish to delete the selected preset?", "Preset",\r
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
                 if (result == DialogResult.Yes)\r
                 {\r
@@ -704,31 +706,31 @@ namespace Handbrake
                 if (presetHandler.CheckIfUserPresetExists(parsed.PresetName + " (Imported)"))\r
                 {\r
                     DialogResult result =\r
-                        MessageBox.Show("This preset appears to already exist. Would you like to overwrite it?", \r
-                                        "Overwrite preset?", \r
+                        MessageBox.Show("This preset appears to already exist. Would you like to overwrite it?",\r
+                                        "Overwrite preset?",\r
                                         MessageBoxButtons.YesNo, MessageBoxIcon.Warning);\r
                     if (result == DialogResult.Yes)\r
                     {\r
                         PresetLoader.LoadPreset(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);\r
-                        presetHandler.Update(parsed.PresetName + " (Imported)", \r
-                                             QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), \r
+                        presetHandler.Update(parsed.PresetName + " (Imported)",\r
+                                             QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null),\r
                                              parsed.UsesPictureSettings);\r
                     }\r
                 }\r
                 else\r
                 {\r
                     PresetLoader.LoadPreset(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);\r
-                    presetHandler.Add(parsed.PresetName, \r
-                                      QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), \r
+                    presetHandler.Add(parsed.PresetName,\r
+                                      QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null),\r
                                       parsed.UsesPictureSettings);\r
 \r
-                    if (presetHandler.Add(parsed.PresetName + " (Imported)", \r
-                                          QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), \r
+                    if (presetHandler.Add(parsed.PresetName + " (Imported)",\r
+                                          QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null),\r
                                           parsed.UsesPictureSettings))\r
                     {\r
                         TreeNode preset_treeview = new TreeNode(parsed.PresetName + " (Imported)")\r
                                                        {\r
-                                                          ForeColor = Color.Black\r
+                                                           ForeColor = Color.Black\r
                                                        };\r
                         treeView_presets.Nodes.Add(preset_treeview);\r
                     }\r
@@ -742,7 +744,23 @@ namespace Handbrake
 \r
         private void btn_source_Click(object sender, EventArgs e)\r
         {\r
-            mnu_dvd_drive.Visible = true;\r
+            // Remove old Drive Menu Items.\r
+            List<ToolStripMenuItem> itemsToRemove = new List<ToolStripMenuItem>();\r
+            foreach (var item in btn_source.DropDownItems)\r
+            {\r
+                if (item.GetType() == typeof(ToolStripMenuItem))\r
+                {\r
+                    ToolStripMenuItem menuItem = (ToolStripMenuItem)item;\r
+                    if (menuItem.Name.StartsWith("Drive"))\r
+                    {\r
+                        itemsToRemove.Add(menuItem);\r
+                    }\r
+                }\r
+            }\r
+\r
+            foreach (ToolStripMenuItem item in itemsToRemove)\r
+                btn_source.DropDownItems.Remove(item);\r
+\r
             Thread driveInfoThread = new Thread(SetDriveSelectionMenuItem);\r
             driveInfoThread.Start();\r
         }\r
@@ -756,12 +774,12 @@ namespace Handbrake
                     !Properties.Settings.Default.showCliForInGuiEncodeStatus)\r
                 {\r
                     result = MessageBox.Show(\r
-                        "Are you sure you wish to cancel the encode?\n\nPlease note, when 'Enable in-GUI encode status' is enabled, stopping this encode will render the file unplayable. ", \r
+                        "Are you sure you wish to cancel the encode?\n\nPlease note, when 'Enable in-GUI encode status' is enabled, stopping this encode will render the file unplayable. ",\r
                         "Cancel Encode?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
                 }\r
                 else\r
                 {\r
-                    result = MessageBox.Show("Are you sure you wish to cancel the encode?", "Cancel Encode?", \r
+                    result = MessageBox.Show("Are you sure you wish to cancel the encode?", "Cancel Encode?",\r
                                              MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
                 }\r
 \r
@@ -806,9 +824,9 @@ namespace Handbrake
                                                               "priority over the GUI, your recently updated settings will not be taken " +\r
                                                               "into account when encoding this job." +\r
                                                               Environment.NewLine + Environment.NewLine +\r
-                                                              "Do you want to replace the manual query with the updated GUI-generated query?", \r
-                                                              "Manual Query does not Match GUI", \r
-                                                              MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk, \r
+                                                              "Do you want to replace the manual query with the updated GUI-generated query?",\r
+                                                              "Manual Query does not Match GUI",\r
+                                                              MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk,\r
                                                               MessageBoxDefaultButton.Button3);\r
 \r
                         switch (result)\r
@@ -837,7 +855,7 @@ namespace Handbrake
                         if (File.Exists(text_destination.Text))\r
                             overwrite =\r
                                 MessageBox.Show(\r
-                                    "The destination file already exists. Are you sure you want to overwrite it?", \r
+                                    "The destination file already exists. Are you sure you want to overwrite it?",\r
                                     "Overwrite File?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
 \r
                     if (overwrite == DialogResult.Yes)\r
@@ -859,7 +877,7 @@ namespace Handbrake
                     this.Focus();\r
                 }\r
                 else if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))\r
-                    MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, \r
+                    MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK,\r
                                     MessageBoxIcon.Warning);\r
             }\r
         }\r
@@ -867,7 +885,7 @@ namespace Handbrake
         private void btn_add2Queue_Click(object sender, EventArgs e)\r
         {\r
             if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))\r
-                MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, \r
+                MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK,\r
                                 MessageBoxIcon.Warning);\r
             else\r
             {\r
@@ -879,7 +897,7 @@ namespace Handbrake
                 {\r
                     DialogResult result =\r
                         MessageBox.Show(\r
-                            "There is already a queue item for this destination path. \n\n If you continue, the encode will be overwritten. Do you wish to continue?", \r
+                            "There is already a queue item for this destination path. \n\n If you continue, the encode will be overwritten. Do you wish to continue?",\r
                             "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);\r
                     if (result == DialogResult.Yes)\r
                         encodeQueue.Add(query, sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
@@ -902,7 +920,7 @@ namespace Handbrake
         private void tb_preview_Click(object sender, EventArgs e)\r
         {\r
             if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))\r
-                MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, \r
+                MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK,\r
                                 MessageBoxIcon.Warning);\r
             else\r
             {\r
@@ -917,7 +935,7 @@ namespace Handbrake
                     qtpreview.Show();\r
                 }\r
                 else\r
-                    MessageBox.Show(qtpreview, "The preview window is already open!", "Warning", MessageBoxButtons.OK, \r
+                    MessageBox.Show(qtpreview, "The preview window is already open!", "Warning", MessageBoxButtons.OK,\r
                                     MessageBoxIcon.Warning);\r
             }\r
         }\r
@@ -1004,9 +1022,22 @@ namespace Handbrake
 \r
         private void mnu_dvd_drive_Click(object sender, EventArgs e)\r
         {\r
-            if (this.dvdDrivePath == null) return;\r
-            this.selectedSourceType = SourceType.DvdDrive;\r
-            SelectSource(this.dvdDrivePath);\r
+            ToolStripMenuItem item = sender as ToolStripMenuItem;\r
+            if (item != null)\r
+            {\r
+                string driveId = item.Name.Replace("Drive", string.Empty);\r
+                int id;\r
+                if (int.TryParse(driveId, out id))\r
+                {\r
+\r
+                    this.dvdDrivePath = drives[id].RootDirectory;\r
+                    this.dvdDriveLabel = drives[id].VolumeLabel;\r
+\r
+                    if (this.dvdDrivePath == null) return;\r
+                    this.selectedSourceType = SourceType.DvdDrive;\r
+                    SelectSource(this.dvdDrivePath);\r
+                }\r
+            }\r
         }\r
 \r
         private void SelectSource(string file)\r
@@ -1029,7 +1060,7 @@ namespace Handbrake
         {\r
             if ((drp_dvdtitle.Items.Count == 1) && (drp_dvdtitle.Items[0].ToString() == "Automatic"))\r
                 MessageBox.Show(\r
-                    "There are no titles to select. Please load a source file by clicking the 'Source' button above before trying to select a title.", \r
+                    "There are no titles to select. Please load a source file by clicking the 'Source' button above before trying to select a title.",\r
                     "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
         }\r
 \r
@@ -1097,7 +1128,7 @@ namespace Handbrake
                     text_destination.Text = autoPath;\r
                 else\r
                     MessageBox.Show(\r
-                        "You currently have \"Automatically name output files\" enabled for the destination file box, but you do not have a default directory set.\n\nYou should set a \"Default Path\" in HandBrakes preferences. (See 'Tools' menu -> 'Options' -> 'General' Tab -> 'Default Path')", \r
+                        "You currently have \"Automatically name output files\" enabled for the destination file box, but you do not have a default directory set.\n\nYou should set a \"Default Path\" in HandBrakes preferences. (See 'Tools' menu -> 'Options' -> 'General' Tab -> 'Default Path')",\r
                         "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
             }\r
 \r
@@ -1126,7 +1157,7 @@ namespace Handbrake
             if (drop_mode.SelectedIndex != 0) // Function is not used if we are not in chapters mode.\r
                 return;\r
 \r
-            Control ctl = (Control) sender;\r
+            Control ctl = (Control)sender;\r
             int chapterStart, chapterEnd;\r
             int.TryParse(drop_chapterStart.Text, out chapterStart);\r
             int.TryParse(drop_chapterFinish.Text, out chapterEnd);\r
@@ -1160,8 +1191,8 @@ namespace Handbrake
                             int n = data_chpt.Rows.Add();\r
                             data_chpt.Rows[n].Cells[0].Value = (i + 1);\r
                             data_chpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);\r
-                            data_chpt.Rows[n].Cells[0].ValueType = typeof (int);\r
-                            data_chpt.Rows[n].Cells[1].ValueType = typeof (string);\r
+                            data_chpt.Rows[n].Cells[0].ValueType = typeof(int);\r
+                            data_chpt.Rows[n].Cells[1].ValueType = typeof(string);\r
                             i++;\r
                         }\r
                     }\r
@@ -1210,7 +1241,7 @@ namespace Handbrake
                 case 2:\r
                     if (selectedTitle != null)\r
                     {\r
-                        duration = duration/selectedTitle.Fps;\r
+                        duration = duration / selectedTitle.Fps;\r
                         lbl_duration.Text = TimeSpan.FromSeconds(duration).ToString();\r
                     }\r
                     else\r
@@ -1259,7 +1290,7 @@ namespace Handbrake
                     if (selectedTitle != null)\r
                     {\r
                         drop_chapterStart.Text = "0";\r
-                        drop_chapterFinish.Text = (selectedTitle.Fps*selectedTitle.Duration.TotalSeconds).ToString();\r
+                        drop_chapterFinish.Text = (selectedTitle.Fps * selectedTitle.Duration.TotalSeconds).ToString();\r
                     }\r
                     return;\r
             }\r
@@ -1288,7 +1319,7 @@ namespace Handbrake
                 {\r
                     case 1:\r
                         if (\r
-                            !Path.GetExtension(DVD_Save.FileName).Equals(".mp4", \r
+                            !Path.GetExtension(DVD_Save.FileName).Equals(".mp4",\r
                                                                          StringComparison.InvariantCultureIgnoreCase))\r
                             if (Properties.Settings.Default.useM4v)\r
                                 DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".m4v").Replace(".mkv", ".m4v");\r
@@ -1297,7 +1328,7 @@ namespace Handbrake
                         break;\r
                     case 2:\r
                         if (\r
-                            !Path.GetExtension(DVD_Save.FileName).Equals(".mkv", \r
+                            !Path.GetExtension(DVD_Save.FileName).Equals(".mkv",\r
                                                                          StringComparison.InvariantCultureIgnoreCase))\r
                             DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".mkv").Replace(".m4v", ".mkv");\r
                         break;\r
@@ -1409,8 +1440,8 @@ namespace Handbrake
 \r
                     CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
                     double cqStep = Properties.Settings.Default.x264cqstep;\r
-                    double multiplier = 1.0/cqStep;\r
-                    double value = slider_videoQuality.Value*multiplier;\r
+                    double multiplier = 1.0 / cqStep;\r
+                    double value = slider_videoQuality.Value * multiplier;\r
 \r
                     switch (Properties.Settings.Default.x264cqstep.ToString(culture))\r
                     {\r
@@ -1431,7 +1462,7 @@ namespace Handbrake
                             break;\r
                     }\r
                     if (value < slider_videoQuality.Maximum)\r
-                        slider_videoQuality.Value = slider_videoQuality.Maximum - (int) value;\r
+                        slider_videoQuality.Value = slider_videoQuality.Maximum - (int)value;\r
 \r
                     break;\r
                 case "VP3 (Theora)":\r
@@ -1474,7 +1505,7 @@ namespace Handbrake
         {\r
             // Work out the current RF value.\r
             double cqStep = _cachedCqStep;\r
-            double rfValue = 51.0 - slider_videoQuality.Value*cqStep;\r
+            double rfValue = 51.0 - slider_videoQuality.Value * cqStep;\r
 \r
             // Change the maximum value for the slider\r
             switch (Properties.Settings.Default.x264cqstep.ToString(new CultureInfo("en-US")))\r
@@ -1501,11 +1532,11 @@ namespace Handbrake
 \r
             // Reset the CQ slider back to the previous value as close as possible\r
             double cqStepNew = Properties.Settings.Default.x264cqstep;\r
-            double rfValueCurrent = 51.0 - slider_videoQuality.Value*cqStepNew;\r
+            double rfValueCurrent = 51.0 - slider_videoQuality.Value * cqStepNew;\r
             while (rfValueCurrent < rfValue)\r
             {\r
                 slider_videoQuality.Value--;\r
-                rfValueCurrent = 51.0 - slider_videoQuality.Value*cqStepNew;\r
+                rfValueCurrent = 51.0 - slider_videoQuality.Value * cqStepNew;\r
             }\r
 \r
             // Cache the CQ step for the next calculation\r
@@ -1521,7 +1552,7 @@ namespace Handbrake
                     lbl_SliderValue.Text = "QP:" + (32 - slider_videoQuality.Value);\r
                     break;\r
                 case "H.264 (x264)":\r
-                    double rfValue = 51.0 - slider_videoQuality.Value*cqStep;\r
+                    double rfValue = 51.0 - slider_videoQuality.Value * cqStep;\r
                     rfValue = Math.Round(rfValue, 2);\r
                     lbl_SliderValue.Text = "RF:" + rfValue.ToString(new CultureInfo("en-US"));\r
                     break;\r
@@ -1723,7 +1754,7 @@ namespace Handbrake
                 if (drp_dvdtitle.Items.Count == 0)\r
                 {\r
                     MessageBox.Show(\r
-                        "No Title(s) found. \n\nYour Source may be copy protected, badly mastered or in a format which HandBrake does not support. \nPlease refer to the Documentation and FAQ (see Help Menu).", \r
+                        "No Title(s) found. \n\nYour Source may be copy protected, badly mastered or in a format which HandBrake does not support. \nPlease refer to the Documentation and FAQ (see Help Menu).",\r
                         "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
                     sourcePath = string.Empty;\r
                 }\r
@@ -1734,7 +1765,7 @@ namespace Handbrake
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show("frmMain.cs - updateUIafterScan " + exc, "Error", MessageBoxButtons.OK, \r
+                MessageBox.Show("frmMain.cs - updateUIafterScan " + exc, "Error", MessageBoxButtons.OK,\r
                                 MessageBoxIcon.Error);\r
                 EnableGUI();\r
             }\r
@@ -1907,21 +1938,25 @@ namespace Handbrake
                     return;\r
                 }\r
 \r
-                List<DriveInformation> drives = Main.GetDrives();\r
+                drives = Main.GetDrives();\r
 \r
-                if (drives.Count == 0)\r
+                List<ToolStripMenuItem> menuItems = new List<ToolStripMenuItem>();\r
+                foreach (DriveInformation drive in drives)\r
                 {\r
-                    mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
-                    return;\r
+                    ToolStripMenuItem menuItem = new ToolStripMenuItem();\r
+                    menuItem.Name = drive.ToString();\r
+                    menuItem.Text = drive.RootDirectory + " (" + drive.VolumeLabel + ")";\r
+                    menuItem.Image = Resources.disc_small;\r
+                    menuItem.Click += new EventHandler(mnu_dvd_drive_Click);\r
+                    menuItems.Add(menuItem);\r
                 }\r
 \r
-                this.dvdDrivePath = drives[0].RootDirectory;\r
-                this.dvdDriveLabel = drives[0].VolumeLabel;\r
-                mnu_dvd_drive.Text = this.dvdDrivePath + " (" + this.dvdDriveLabel + ")";\r
+                foreach (ToolStripMenuItem item in menuItems)\r
+                    btn_source.DropDownItems.Add(item);\r
             }\r
-            catch (Exception)\r
+            catch (Exception exc)\r
             {\r
-                mnu_dvd_drive.Text = "[No DVD Drive Ready / Found]";\r
+                MessageBox.Show("Error in SetDriveSelectionMenuItem" + exc);\r
             }\r
         }\r
 \r
@@ -1932,8 +1967,8 @@ namespace Handbrake
         {\r
             if (presetHandler.CheckIfPresetsAreOutOfDate())\r
                 if (!Properties.Settings.Default.presetNotification)\r
-                    MessageBox.Show(splash, \r
-                                    "HandBrake has determined your built-in presets are out of date... These presets will now be updated.", \r
+                    MessageBox.Show(splash,\r
+                                    "HandBrake has determined your built-in presets are out of date... These presets will now be updated.",\r
                                     "Preset Update", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
 \r
             presetHandler.GetPresetPanel(ref treeView_presets);\r
@@ -1977,7 +2012,7 @@ namespace Handbrake
             {\r
                 DialogResult result =\r
                     MessageBox.Show(\r
-                        "HandBrake has queue items to process. Closing HandBrake will not stop the current encoding, but will stop processing the queue.\n\nDo you want to close HandBrake?", \r
+                        "HandBrake has queue items to process. Closing HandBrake will not stop the current encoding, but will stop processing the queue.\n\nDo you want to close HandBrake?",\r
                         "Close HandBrake?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
                 if (result == DialogResult.No)\r
                     e.Cancel = true;\r
@@ -2017,12 +2052,12 @@ namespace Handbrake
         /// <param name="CurrentFps"></param>\r
         /// <param name="AverageFps"></param>\r
         /// <param name="TimeRemaining"></param>\r
-        private void EncodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, \r
+        private void EncodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete,\r
                                             float CurrentFps, float AverageFps, TimeSpan TimeRemaining)\r
         {\r
             if (this.InvokeRequired)\r
             {\r
-                this.BeginInvoke(new EncodeProgressEventHandler(EncodeOnEncodeProgress), \r
+                this.BeginInvoke(new EncodeProgressEventHandler(EncodeOnEncodeProgress),\r
                                  new[]\r
                                      {\r
                                          Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, \r
@@ -2031,7 +2066,7 @@ namespace Handbrake
                 return;\r
             }\r
             lbl_encode.Text =\r
-                string.Format("Encode Progress: {0}%,       FPS: {1},       Avg FPS: {2},       Time Remaining: {3} ", \r
+                string.Format("Encode Progress: {0}%,       FPS: {1},       Avg FPS: {2},       Time Remaining: {3} ",\r
                               PercentComplete, CurrentFps, AverageFps, TimeRemaining);\r
         }\r
 \r
index 7975f6d..a3662bd 100644 (file)
@@ -583,18 +583,6 @@ Note: Currently, if you wish to use a , in your chapter name, you must escape it
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
     <value>98</value>\r
   </metadata>\r
-  <metadata name="File_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>664, 15</value>\r
-  </metadata>\r
-  <metadata name="openPreset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>680, 54</value>\r
-  </metadata>\r
-  <metadata name="File_ChapterImport.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>787, 54</value>\r
-  </metadata>\r
-  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
-    <value>98</value>\r
-  </metadata>\r
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
     <value>\r
         AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA\r
@@ -974,4 +962,13 @@ Note: Currently, if you wish to use a , in your chapter name, you must escape it
         AAD6AQAA4AEAAMABAACAAQAAgAEAAMBBAADAYQAAjGEAAIRhAADc+wAA3/8AAA==\r
 </value>\r
   </data>\r
+  <metadata name="File_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>664, 15</value>\r
+  </metadata>\r
+  <metadata name="openPreset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>680, 54</value>\r
+  </metadata>\r
+  <metadata name="File_ChapterImport.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>787, 54</value>\r
+  </metadata>\r
 </root>
\ No newline at end of file