Index: win/C#/frmMain.cs =================================================================== --- win/C#/frmMain.cs (revision 1295) +++ win/C#/frmMain.cs (working copy) @@ -1213,8 +1213,72 @@ #endregion + private void btn_Preview_Click(object sender, EventArgs e) + { + string mplayerPath = Path.Combine(Application.StartupPath, "mplayer.exe"); + string dvdPath = text_source.Text; + int selDvdTitle, selDvdChapter = 1, selSubtitle; + decimal cropHorizontal, cropVertical, cropX, cropTop; + string cl_subtitle = "", cl_crop = ""; + + + if (drp_dvdtitle.Items.Count > 0 && drp_dvdtitle.Text != "Automatic") + { + Parsing.Title selectedTitle = drp_dvdtitle.SelectedItem as Parsing.Title; + + // Title and Chapter + + selDvdTitle = selectedTitle.TitleNumber; + selDvdChapter = int.Parse(drop_chapterStart.Text); + + // Subtitle + + if (drp_subtitle.SelectedIndex >=2) + { + selSubtitle = drp_subtitle.SelectedIndex - 2; + cl_subtitle = String.Format("-sid {0}", selSubtitle); + } + + // Cropping + + if (drp_crop.SelectedIndex != 2) + { + + if (drp_crop.SelectedIndex == 1) + { + + cropHorizontal = selectedTitle.Resolution.Width - (text_right.Value + text_left.Value); + cropVertical = selectedTitle.Resolution.Height - (text_top.Value + text_bottom.Value); + cropX = text_left.Value; + cropTop = text_top.Value; + + } + else + { + + cropHorizontal = selectedTitle.Resolution.Width - (selectedTitle.AutoCropDimensions[2] + selectedTitle.AutoCropDimensions[3]); + cropVertical = selectedTitle.Resolution.Height - (selectedTitle.AutoCropDimensions[0] + selectedTitle.AutoCropDimensions[1]); + cropX = selectedTitle.AutoCropDimensions[2]; + cropTop = selectedTitle.AutoCropDimensions[0]; + + } + + string cropping = cropHorizontal + ":" + cropVertical + ":" + cropX + ":" + cropTop; + + cl_crop = String.Format("-vf crop={0}", cropping); + } + + string strCmdLine = String.Format(@"cmd /c """"{0}"" dvd://{1} -chapter {2} {3} {4} -dvd-device ""{5}""", mplayerPath, selDvdTitle, selDvdChapter, cl_crop, cl_subtitle, dvdPath); + + ProcessStartInfo hbPreviewTitle = new ProcessStartInfo("CMD.exe", strCmdLine); + hbPreviewTitle.WindowStyle = ProcessWindowStyle.Hidden; + Process.Start(hbPreviewTitle); + + } + + } // This is the END of the road ------------------------------------------------------------------------------ } } \ No newline at end of file Index: win/C#/frmMain.Designer.cs =================================================================== --- win/C#/frmMain.Designer.cs (revision 1295) +++ win/C#/frmMain.Designer.cs (working copy) @@ -202,6 +202,7 @@ this.btn_ActivityWindow = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.btn_Preview = new System.Windows.Forms.ToolStripButton(); Label38 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.slider_drc)).BeginInit(); @@ -663,7 +664,7 @@ this.mnu_open.ImageTransparentColor = System.Drawing.Color.Magenta; this.mnu_open.Name = "mnu_open"; this.mnu_open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.mnu_open.Size = new System.Drawing.Size(201, 22); + this.mnu_open.Size = new System.Drawing.Size(193, 22); this.mnu_open.Text = "&Open Preset"; this.mnu_open.Click += new System.EventHandler(this.mnu_open_Click); // @@ -673,19 +674,19 @@ this.mnu_save.ImageTransparentColor = System.Drawing.Color.Magenta; this.mnu_save.Name = "mnu_save"; this.mnu_save.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.mnu_save.Size = new System.Drawing.Size(201, 22); + this.mnu_save.Size = new System.Drawing.Size(193, 22); this.mnu_save.Text = "&Save Preset"; this.mnu_save.Click += new System.EventHandler(this.mnu_save_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(198, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(190, 6); // // mnu_exit // this.mnu_exit.Name = "mnu_exit"; - this.mnu_exit.Size = new System.Drawing.Size(201, 22); + this.mnu_exit.Size = new System.Drawing.Size(193, 22); this.mnu_exit.Text = "E&xit"; this.mnu_exit.Click += new System.EventHandler(this.mnu_exit_Click); // @@ -710,7 +711,7 @@ this.mnu_encode.Image = global::Handbrake.Properties.Resources.Queue_Small; this.mnu_encode.Name = "mnu_encode"; this.mnu_encode.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); - this.mnu_encode.Size = new System.Drawing.Size(217, 22); + this.mnu_encode.Size = new System.Drawing.Size(209, 22); this.mnu_encode.Text = "Show Queue"; this.mnu_encode.Click += new System.EventHandler(this.mnu_encode_Click); // @@ -719,20 +720,20 @@ this.mnu_viewDVDdata.Image = global::Handbrake.Properties.Resources.Movies_Small; this.mnu_viewDVDdata.Name = "mnu_viewDVDdata"; this.mnu_viewDVDdata.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - this.mnu_viewDVDdata.Size = new System.Drawing.Size(217, 22); + this.mnu_viewDVDdata.Size = new System.Drawing.Size(209, 22); this.mnu_viewDVDdata.Text = "View DVD data"; this.mnu_viewDVDdata.Click += new System.EventHandler(this.mnu_viewDVDdata_Click); // // ToolStripSeparator5 // this.ToolStripSeparator5.Name = "ToolStripSeparator5"; - this.ToolStripSeparator5.Size = new System.Drawing.Size(214, 6); + this.ToolStripSeparator5.Size = new System.Drawing.Size(206, 6); // // mnu_options // this.mnu_options.Image = global::Handbrake.Properties.Resources.Pref_Small; this.mnu_options.Name = "mnu_options"; - this.mnu_options.Size = new System.Drawing.Size(217, 22); + this.mnu_options.Size = new System.Drawing.Size(209, 22); this.mnu_options.Text = "Options"; this.mnu_options.Click += new System.EventHandler(this.mnu_options_Click); // @@ -750,7 +751,7 @@ // mnu_SelectDefault // this.mnu_SelectDefault.Name = "mnu_SelectDefault"; - this.mnu_SelectDefault.Size = new System.Drawing.Size(215, 22); + this.mnu_SelectDefault.Size = new System.Drawing.Size(204, 22); this.mnu_SelectDefault.Text = "Select Default Preset"; this.mnu_SelectDefault.ToolTipText = "Select HandBrake\'s default preset"; this.mnu_SelectDefault.Click += new System.EventHandler(this.mnu_SelectDefault_Click); @@ -758,12 +759,12 @@ // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(212, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(201, 6); // // mnu_presetReset // this.mnu_presetReset.Name = "mnu_presetReset"; - this.mnu_presetReset.Size = new System.Drawing.Size(215, 22); + this.mnu_presetReset.Size = new System.Drawing.Size(204, 22); this.mnu_presetReset.Text = "Update Built-in Presets"; this.mnu_presetReset.ToolTipText = "Resets all presets."; this.mnu_presetReset.Click += new System.EventHandler(this.mnu_presetReset_Click); @@ -788,27 +789,27 @@ this.mnu_faq, this.mnu_onlineDocs}); this.OnlineDocumentationToolStripMenuItem.Name = "OnlineDocumentationToolStripMenuItem"; - this.OnlineDocumentationToolStripMenuItem.Size = new System.Drawing.Size(211, 22); + this.OnlineDocumentationToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.OnlineDocumentationToolStripMenuItem.Text = "Online Documentation"; // // mnu_wiki // this.mnu_wiki.Name = "mnu_wiki"; - this.mnu_wiki.Size = new System.Drawing.Size(217, 22); + this.mnu_wiki.Size = new System.Drawing.Size(206, 22); this.mnu_wiki.Text = "Wiki / User Guides"; this.mnu_wiki.Click += new System.EventHandler(this.mnu_wiki_Click); // // mnu_faq // this.mnu_faq.Name = "mnu_faq"; - this.mnu_faq.Size = new System.Drawing.Size(217, 22); + this.mnu_faq.Size = new System.Drawing.Size(206, 22); this.mnu_faq.Text = "FAQ"; this.mnu_faq.Click += new System.EventHandler(this.mnu_faq_Click); // // mnu_onlineDocs // this.mnu_onlineDocs.Name = "mnu_onlineDocs"; - this.mnu_onlineDocs.Size = new System.Drawing.Size(217, 22); + this.mnu_onlineDocs.Size = new System.Drawing.Size(206, 22); this.mnu_onlineDocs.Text = "Full Documentation List"; this.mnu_onlineDocs.Click += new System.EventHandler(this.mnu_onlineDocs_Click); // @@ -818,44 +819,44 @@ this.mnu_homepage, this.mnu_forum}); this.WebsiteToolStripMenuItem.Name = "WebsiteToolStripMenuItem"; - this.WebsiteToolStripMenuItem.Size = new System.Drawing.Size(211, 22); + this.WebsiteToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.WebsiteToolStripMenuItem.Text = "Website"; // // mnu_homepage // this.mnu_homepage.Name = "mnu_homepage"; - this.mnu_homepage.Size = new System.Drawing.Size(146, 22); + this.mnu_homepage.Size = new System.Drawing.Size(135, 22); this.mnu_homepage.Text = "Homepage"; this.mnu_homepage.Click += new System.EventHandler(this.mnu_homepage_Click); // // mnu_forum // this.mnu_forum.Name = "mnu_forum"; - this.mnu_forum.Size = new System.Drawing.Size(146, 22); + this.mnu_forum.Size = new System.Drawing.Size(135, 22); this.mnu_forum.Text = "Forum"; this.mnu_forum.Click += new System.EventHandler(this.mnu_forum_Click); // // ToolStripSeparator3 // this.ToolStripSeparator3.Name = "ToolStripSeparator3"; - this.ToolStripSeparator3.Size = new System.Drawing.Size(208, 6); + this.ToolStripSeparator3.Size = new System.Drawing.Size(197, 6); // // mnu_UpdateCheck // this.mnu_UpdateCheck.Name = "mnu_UpdateCheck"; - this.mnu_UpdateCheck.Size = new System.Drawing.Size(211, 22); + this.mnu_UpdateCheck.Size = new System.Drawing.Size(200, 22); this.mnu_UpdateCheck.Text = "Check for Updates"; this.mnu_UpdateCheck.Click += new System.EventHandler(this.mnu_UpdateCheck_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(208, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(197, 6); // // mnu_about // this.mnu_about.Name = "mnu_about"; - this.mnu_about.Size = new System.Drawing.Size(211, 22); + this.mnu_about.Size = new System.Drawing.Size(200, 22); this.mnu_about.Text = "About..."; this.mnu_about.Click += new System.EventHandler(this.mnu_about_Click); // @@ -1008,7 +1009,7 @@ // this.lbl_encode.AutoSize = true; this.lbl_encode.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_encode.Location = new System.Drawing.Point(429, 35); + this.lbl_encode.Location = new System.Drawing.Point(509, 35); this.lbl_encode.Name = "lbl_encode"; this.lbl_encode.Size = new System.Drawing.Size(129, 13); this.lbl_encode.TabIndex = 5; @@ -2090,6 +2091,7 @@ this.toolStrip1.BackColor = System.Drawing.SystemColors.ControlLight; this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.btn_Preview, this.btn_start, this.toolStripSeparator1, this.btn_add2Queue, @@ -2159,6 +2161,16 @@ this.toolStripSeparator8.Name = "toolStripSeparator8"; this.toolStripSeparator8.Size = new System.Drawing.Size(6, 39); // + // btn_Preview + // + this.btn_Preview.Image = global::Handbrake.Properties.Resources.Emoticon; + this.btn_Preview.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.btn_Preview.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btn_Preview.Name = "btn_Preview"; + this.btn_Preview.Size = new System.Drawing.Size(81, 36); + this.btn_Preview.Text = "Preview"; + this.btn_Preview.Click += new System.EventHandler(this.btn_Preview_Click); + // // frmMain // this.AllowDrop = true; @@ -2383,6 +2395,7 @@ private System.Windows.Forms.ToolStripButton btn_ActivityWindow; private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.ToolStripButton btn_Preview; } } \ No newline at end of file