OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 7 May 2010 18:58:46 +0000 (18:58 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 7 May 2010 18:58:46 +0000 (18:58 +0000)
- Added Export support to the Chapters Tab.

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

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

index 80d806b..552c6a9 100644 (file)
@@ -136,6 +136,38 @@ namespace Handbrake.Functions
         }\r
 \r
         /// <summary>\r
+        /// Create a CSV file with the data from the Main Window Chapters tab\r
+        /// </summary>\r
+        /// <param name="mainWindow">Main Window</param>\r
+        /// <param name="filePathName">Path to save the csv file</param>\r
+        /// <returns>True if successful </returns>\r
+        public static bool SaveChapterMarkersToCsv(frmMain mainWindow, string filePathName)\r
+        {\r
+            try\r
+            {\r
+                string csv = string.Empty;\r
+\r
+                foreach (DataGridViewRow row in mainWindow.data_chpt.Rows)\r
+                {\r
+                    csv += row.Cells[0].Value.ToString();\r
+                    csv += ",";\r
+                    csv += row.Cells[1].Value.ToString().Replace(",", "\\,");\r
+                    csv += Environment.NewLine;\r
+                }\r
+                StreamWriter file = new StreamWriter(filePathName);\r
+                file.Write(csv);\r
+                file.Close();\r
+                file.Dispose();\r
+                return true;\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                MessageBox.Show("Unable to save Chapter Makrers file! \nChapter marker names will NOT be saved in your encode \n\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+                return false;\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
         /// Function which generates the filename and path automatically based on \r
         /// the Source Name, DVD title and DVD Chapters\r
         /// </summary>\r
index f9e2d11..99ae3eb 100644 (file)
@@ -98,7 +98,6 @@ namespace Handbrake
             this.Label47 = new System.Windows.Forms.Label();\r
             this.Label3 = new System.Windows.Forms.Label();\r
             this.tab_audio = new System.Windows.Forms.TabPage();\r
-            this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
             this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);\r
             this.tab_video = new System.Windows.Forms.TabPage();\r
             this.radio_cq = new System.Windows.Forms.RadioButton();\r
@@ -110,17 +109,13 @@ namespace Handbrake
             this.lbl_SliderValue = new System.Windows.Forms.Label();\r
             this.Label46 = new System.Windows.Forms.Label();\r
             this.tab_picture = new System.Windows.Forms.TabPage();\r
-            this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
             this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox();\r
             this.tabs_panel = new System.Windows.Forms.TabControl();\r
             this.tab_filters = new System.Windows.Forms.TabPage();\r
-            this.Filters = new Handbrake.Controls.Filters();\r
             this.tab_subtitles = new System.Windows.Forms.TabPage();\r
-            this.Subtitles = new Handbrake.Controls.Subtitles();\r
             this.tab_chapters = new System.Windows.Forms.TabPage();\r
             this.label31 = new System.Windows.Forms.Label();\r
             this.tab_advanced = new System.Windows.Forms.TabPage();\r
-            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             this.tab_query = new System.Windows.Forms.TabPage();\r
             this.btn_clear = new System.Windows.Forms.Button();\r
             this.label34 = new System.Windows.Forms.Label();\r
@@ -172,6 +167,12 @@ namespace Handbrake
             this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();\r
             this.openPreset = new System.Windows.Forms.OpenFileDialog();\r
             this.File_ChapterImport = new System.Windows.Forms.OpenFileDialog();\r
+            this.btn_export = new System.Windows.Forms.Button();\r
+            this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
+            this.Filters = new Handbrake.Controls.Filters();\r
+            this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
+            this.Subtitles = new Handbrake.Controls.Subtitles();\r
+            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
             notifyIconMenu.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();\r
@@ -274,7 +275,7 @@ namespace Handbrake
             this.check_turbo.Enabled = false;\r
             this.check_turbo.Location = new System.Drawing.Point(146, 123);\r
             this.check_turbo.Name = "check_turbo";\r
-            this.check_turbo.Size = new System.Drawing.Size(99, 17);\r
+            this.check_turbo.Size = new System.Drawing.Size(101, 17);\r
             this.check_turbo.TabIndex = 7;\r
             this.check_turbo.Text = "Turbo first Pass";\r
             this.ToolTip.SetToolTip(this.check_turbo, "Makes the first pass of a 2 pass encode faster.");\r
@@ -523,7 +524,7 @@ namespace Handbrake
             this.btn_importChapters.AutoSize = true;\r
             this.btn_importChapters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_importChapters.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_importChapters.Location = new System.Drawing.Point(625, 26);\r
+            this.btn_importChapters.Location = new System.Drawing.Point(544, 28);\r
             this.btn_importChapters.Name = "btn_importChapters";\r
             this.btn_importChapters.Size = new System.Drawing.Size(75, 23);\r
             this.btn_importChapters.TabIndex = 14;\r
@@ -793,15 +794,6 @@ namespace Handbrake
             this.tab_audio.Text = "Audio";\r
             this.tab_audio.UseVisualStyleBackColor = true;\r
             // \r
-            // AudioSettings\r
-            // \r
-            this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
-            this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
-            this.AudioSettings.Name = "AudioSettings";\r
-            this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
-            this.AudioSettings.TabIndex = 0;\r
-            // \r
             // AudioMenuRowHeightHack\r
             // \r
             this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;\r
@@ -840,7 +832,7 @@ namespace Handbrake
             this.radio_cq.BackColor = System.Drawing.Color.Transparent;\r
             this.radio_cq.Location = new System.Drawing.Point(336, 97);\r
             this.radio_cq.Name = "radio_cq";\r
-            this.radio_cq.Size = new System.Drawing.Size(105, 17);\r
+            this.radio_cq.Size = new System.Drawing.Size(110, 17);\r
             this.radio_cq.TabIndex = 18;\r
             this.radio_cq.Text = "Constant Quality:";\r
             this.radio_cq.UseVisualStyleBackColor = false;\r
@@ -853,7 +845,7 @@ namespace Handbrake
             this.radio_avgBitrate.Checked = true;\r
             this.radio_avgBitrate.Location = new System.Drawing.Point(336, 64);\r
             this.radio_avgBitrate.Name = "radio_avgBitrate";\r
-            this.radio_avgBitrate.Size = new System.Drawing.Size(112, 17);\r
+            this.radio_avgBitrate.Size = new System.Drawing.Size(116, 17);\r
             this.radio_avgBitrate.TabIndex = 17;\r
             this.radio_avgBitrate.TabStop = true;\r
             this.radio_avgBitrate.Text = "Avg Bitrate (kbps):";\r
@@ -866,7 +858,7 @@ namespace Handbrake
             this.radio_targetFilesize.BackColor = System.Drawing.Color.Transparent;\r
             this.radio_targetFilesize.Location = new System.Drawing.Point(336, 37);\r
             this.radio_targetFilesize.Name = "radio_targetFilesize";\r
-            this.radio_targetFilesize.Size = new System.Drawing.Size(107, 17);\r
+            this.radio_targetFilesize.Size = new System.Drawing.Size(108, 17);\r
             this.radio_targetFilesize.TabIndex = 16;\r
             this.radio_targetFilesize.Text = "Target Size (MB):";\r
             this.radio_targetFilesize.UseVisualStyleBackColor = false;\r
@@ -889,7 +881,7 @@ namespace Handbrake
             this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent;\r
             this.check_2PassEncode.Location = new System.Drawing.Point(125, 100);\r
             this.check_2PassEncode.Name = "check_2PassEncode";\r
-            this.check_2PassEncode.Size = new System.Drawing.Size(106, 17);\r
+            this.check_2PassEncode.Size = new System.Drawing.Size(104, 17);\r
             this.check_2PassEncode.TabIndex = 6;\r
             this.check_2PassEncode.Text = "2-Pass Encoding";\r
             this.check_2PassEncode.UseVisualStyleBackColor = false;\r
@@ -939,25 +931,13 @@ namespace Handbrake
             this.tab_picture.Text = "Picture";\r
             this.tab_picture.UseVisualStyleBackColor = true;\r
             // \r
-            // PictureSettings\r
-            // \r
-            this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
-            this.PictureSettings.CurrentlySelectedPreset = null;\r
-            this.PictureSettings.Enabled = false;\r
-            this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
-            this.PictureSettings.Name = "PictureSettings";\r
-            this.PictureSettings.PresetMaximumResolution = new System.Drawing.Size(0, 0);\r
-            this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
-            this.PictureSettings.TabIndex = 0;\r
-            // \r
             // Check_ChapterMarkers\r
             // \r
             this.Check_ChapterMarkers.AutoSize = true;\r
             this.Check_ChapterMarkers.BackColor = System.Drawing.Color.Transparent;\r
             this.Check_ChapterMarkers.Location = new System.Drawing.Point(16, 32);\r
             this.Check_ChapterMarkers.Name = "Check_ChapterMarkers";\r
-            this.Check_ChapterMarkers.Size = new System.Drawing.Size(136, 17);\r
+            this.Check_ChapterMarkers.Size = new System.Drawing.Size(140, 17);\r
             this.Check_ChapterMarkers.TabIndex = 1;\r
             this.Check_ChapterMarkers.Text = "Create chapter markers";\r
             this.Check_ChapterMarkers.UseVisualStyleBackColor = false;\r
@@ -990,15 +970,6 @@ namespace Handbrake
             this.tab_filters.Text = "Video Filters";\r
             this.tab_filters.UseVisualStyleBackColor = true;\r
             // \r
-            // Filters\r
-            // \r
-            this.Filters.BackColor = System.Drawing.Color.Transparent;\r
-            this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.Filters.Location = new System.Drawing.Point(0, 0);\r
-            this.Filters.Name = "Filters";\r
-            this.Filters.Size = new System.Drawing.Size(713, 310);\r
-            this.Filters.TabIndex = 0;\r
-            // \r
             // tab_subtitles\r
             // \r
             this.tab_subtitles.Controls.Add(this.Subtitles);\r
@@ -1010,18 +981,10 @@ namespace Handbrake
             this.tab_subtitles.Text = "Subtitles";\r
             this.tab_subtitles.UseVisualStyleBackColor = true;\r
             // \r
-            // Subtitles\r
-            // \r
-            this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
-            this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
-            this.Subtitles.Name = "Subtitles";\r
-            this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
-            this.Subtitles.TabIndex = 0;\r
-            // \r
             // tab_chapters\r
             // \r
             this.tab_chapters.BackColor = System.Drawing.Color.Transparent;\r
+            this.tab_chapters.Controls.Add(this.btn_export);\r
             this.tab_chapters.Controls.Add(this.btn_importChapters);\r
             this.tab_chapters.Controls.Add(this.label31);\r
             this.tab_chapters.Controls.Add(this.data_chpt);\r
@@ -1056,16 +1019,6 @@ namespace Handbrake
             this.tab_advanced.Text = "Advanced";\r
             this.tab_advanced.UseVisualStyleBackColor = true;\r
             // \r
-            // x264Panel\r
-            // \r
-            this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
-            this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
-            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
             this.tab_query.Controls.Add(this.btn_clear);\r
@@ -1623,6 +1576,69 @@ namespace Handbrake
             // \r
             this.File_ChapterImport.Filter = "CSV Files|*.csv";\r
             // \r
+            // btn_export\r
+            // \r
+            this.btn_export.AutoSize = true;\r
+            this.btn_export.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.btn_export.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
+            this.btn_export.Location = new System.Drawing.Point(625, 28);\r
+            this.btn_export.Name = "btn_export";\r
+            this.btn_export.Size = new System.Drawing.Size(75, 23);\r
+            this.btn_export.TabIndex = 15;\r
+            this.btn_export.Text = "Export";\r
+            this.ToolTip.SetToolTip(this.btn_export, resources.GetString("btn_export.ToolTip"));\r
+            this.btn_export.UseVisualStyleBackColor = true;\r
+            this.btn_export.Click += new System.EventHandler(this.btn_export_Click);\r
+            // \r
+            // PictureSettings\r
+            // \r
+            this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
+            this.PictureSettings.CurrentlySelectedPreset = null;\r
+            this.PictureSettings.Enabled = false;\r
+            this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
+            this.PictureSettings.Name = "PictureSettings";\r
+            this.PictureSettings.PresetMaximumResolution = new System.Drawing.Size(0, 0);\r
+            this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
+            this.PictureSettings.TabIndex = 0;\r
+            // \r
+            // Filters\r
+            // \r
+            this.Filters.BackColor = System.Drawing.Color.Transparent;\r
+            this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.Filters.Location = new System.Drawing.Point(0, 0);\r
+            this.Filters.Name = "Filters";\r
+            this.Filters.Size = new System.Drawing.Size(713, 310);\r
+            this.Filters.TabIndex = 0;\r
+            // \r
+            // AudioSettings\r
+            // \r
+            this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
+            this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
+            this.AudioSettings.Name = "AudioSettings";\r
+            this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
+            this.AudioSettings.TabIndex = 0;\r
+            // \r
+            // Subtitles\r
+            // \r
+            this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
+            this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
+            this.Subtitles.Name = "Subtitles";\r
+            this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
+            this.Subtitles.TabIndex = 0;\r
+            // \r
+            // x264Panel\r
+            // \r
+            this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
+            this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
+            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
             // frmMain\r
             // \r
             this.AllowDrop = true;\r
@@ -1823,5 +1839,6 @@ namespace Handbrake
         private ToolStripMenuItem pmnu_import;\r
         private ToolStripSeparator toolStripSeparator2;\r
         internal ComboBox drop_mode;\r
+        private Button btn_export;\r
     }\r
 }
\ No newline at end of file
index 0b89a57..bfa4054 100644 (file)
@@ -1605,6 +1605,19 @@ namespace Handbrake
             }\r
         }\r
 \r
+        private void btn_export_Click(object sender, EventArgs e)\r
+        {\r
+            SaveFileDialog saveFileDialog = new SaveFileDialog();\r
+            saveFileDialog.Filter = "Csv File|*.csv";\r
+            saveFileDialog.DefaultExt = "csv";\r
+            if (saveFileDialog.ShowDialog() == DialogResult.OK)\r
+            {\r
+                string filename = saveFileDialog.FileName;\r
+\r
+                Main.SaveChapterMarkersToCsv(this, filename);\r
+            }\r
+        }\r
+\r
         private void mnu_resetChapters_Click(object sender, EventArgs e)\r
         {\r
             data_chpt.Rows.Clear();\r
@@ -2075,6 +2088,7 @@ namespace Handbrake
 \r
         #endregion\r
 \r
+\r
         // This is the END of the road ****************************************\r
     }\r
 }
\ No newline at end of file
index a3662bd..5664038 100644 (file)
@@ -169,6 +169,16 @@ Note: Currently, if you wish to use a , in your chapter name, you must escape it
   <metadata name="AudioMenuRowHeightHack.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>392, 54</value>\r
   </metadata>\r
+  <data name="btn_export.ToolTip" xml:space="preserve">\r
+    <value>Import a comma separated file containing the chapter information.\r
+The CSV should be formatted as follows:\r
+\r
+1,Chapter 1 Name\r
+2,Chapter 2 Name\r
+3,Chapter 3 Name\r
+\r
+Note: Currently, if you wish to use a , in your chapter name, you must escape it with a \</value>\r
+  </data>\r
   <metadata name="presets_menu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>265, 54</value>\r
   </metadata>\r