summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-02-25 20:45:44 +0000
committersr55 <[email protected]>2010-02-25 20:45:44 +0000
commit8c3709d289a996567d459a92d64378ddebb7d2f9 (patch)
tree13936b652aee6a05466e1c2d14b9b4a62bf263e9 /win/C#
parent4de954484ea3b2bac3d48e502acb616e2b6779c1 (diff)
WinGui:
- Make the picture settings panel work more like the macgui. No longer uses -X Max Width but instead does all the logic in-gui so it's less confusing to the user. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3139 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/Controls/PictureSettings.Designer.cs50
-rw-r--r--win/C#/Controls/PictureSettings.cs170
-rw-r--r--win/C#/Functions/QueryGenerator.cs47
-rw-r--r--win/C#/Functions/QueryParser.cs25
-rw-r--r--win/C#/Functions/Scan.cs7
-rw-r--r--win/C#/HandBrakeCS.5.0.ReSharper2
-rw-r--r--win/C#/frmMain.cs2
7 files changed, 116 insertions, 187 deletions
diff --git a/win/C#/Controls/PictureSettings.Designer.cs b/win/C#/Controls/PictureSettings.Designer.cs
index 96953ac53..83dfc9baf 100644
--- a/win/C#/Controls/PictureSettings.Designer.cs
+++ b/win/C#/Controls/PictureSettings.Designer.cs
@@ -42,11 +42,8 @@ namespace Handbrake.Controls
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.label7 = new System.Windows.Forms.Label();
this.lbl_src_res = new System.Windows.Forms.Label();
- this.Label91 = new System.Windows.Forms.Label();
- this.lbl_Aspect = new System.Windows.Forms.Label();
this.Label55 = new System.Windows.Forms.Label();
this.text_width = new System.Windows.Forms.NumericUpDown();
- this.lbl_max = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.text_height = new System.Windows.Forms.NumericUpDown();
this.check_KeepAR = new System.Windows.Forms.CheckBox();
@@ -280,11 +277,8 @@ namespace Handbrake.Controls
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.Controls.Add(this.label7, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.lbl_src_res, 1, 0);
- this.tableLayoutPanel2.Controls.Add(this.Label91, 2, 0);
- this.tableLayoutPanel2.Controls.Add(this.lbl_Aspect, 3, 0);
this.tableLayoutPanel2.Controls.Add(this.Label55, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.text_width, 1, 1);
- this.tableLayoutPanel2.Controls.Add(this.lbl_max, 4, 1);
this.tableLayoutPanel2.Controls.Add(this.label4, 2, 1);
this.tableLayoutPanel2.Controls.Add(this.text_height, 3, 1);
this.tableLayoutPanel2.Controls.Add(this.check_KeepAR, 1, 2);
@@ -323,32 +317,6 @@ namespace Handbrake.Controls
this.lbl_src_res.TabIndex = 77;
this.lbl_src_res.Text = "--";
//
- // Label91
- //
- this.Label91.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.Label91.AutoSize = true;
- this.Label91.BackColor = System.Drawing.Color.Transparent;
- this.Label91.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.Label91.Location = new System.Drawing.Point(120, 3);
- this.Label91.Margin = new System.Windows.Forms.Padding(3);
- this.Label91.Name = "Label91";
- this.Label91.Size = new System.Drawing.Size(72, 13);
- this.Label91.TabIndex = 78;
- this.Label91.Text = "Aspect Ratio:";
- //
- // lbl_Aspect
- //
- this.lbl_Aspect.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.lbl_Aspect.AutoSize = true;
- this.lbl_Aspect.BackColor = System.Drawing.Color.Transparent;
- this.lbl_Aspect.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.lbl_Aspect.Location = new System.Drawing.Point(198, 3);
- this.lbl_Aspect.Margin = new System.Windows.Forms.Padding(3);
- this.lbl_Aspect.Name = "lbl_Aspect";
- this.lbl_Aspect.Size = new System.Drawing.Size(15, 13);
- this.lbl_Aspect.TabIndex = 79;
- this.lbl_Aspect.Text = "--";
- //
// Label55
//
this.Label55.Anchor = System.Windows.Forms.AnchorStyles.Left;
@@ -376,19 +344,6 @@ namespace Handbrake.Controls
this.text_width.TabIndex = 85;
this.text_width.ValueChanged += new System.EventHandler(this.TextWidthValueChanged);
//
- // lbl_max
- //
- this.lbl_max.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.lbl_max.AutoSize = true;
- this.lbl_max.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.lbl_max.Location = new System.Drawing.Point(268, 26);
- this.lbl_max.Margin = new System.Windows.Forms.Padding(3);
- this.lbl_max.Name = "lbl_max";
- this.lbl_max.Size = new System.Drawing.Size(15, 13);
- this.lbl_max.TabIndex = 83;
- this.lbl_max.Text = "--";
- this.lbl_max.DoubleClick += new System.EventHandler(this.LblMaxDoubleClick);
- //
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left;
@@ -405,7 +360,7 @@ namespace Handbrake.Controls
//
// text_height
//
- this.text_height.Location = new System.Drawing.Point(198, 22);
+ this.text_height.Location = new System.Drawing.Point(168, 22);
this.text_height.Maximum = new decimal(new int[] {
2560,
0,
@@ -705,10 +660,7 @@ namespace Handbrake.Controls
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
internal System.Windows.Forms.Label label7;
internal System.Windows.Forms.Label lbl_src_res;
- internal System.Windows.Forms.Label Label91;
- internal System.Windows.Forms.Label lbl_Aspect;
internal System.Windows.Forms.Label Label55;
- private System.Windows.Forms.Label lbl_max;
internal System.Windows.Forms.Label label4;
internal System.Windows.Forms.CheckBox check_KeepAR;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs
index 44de20038..b9a0bf040 100644
--- a/win/C#/Controls/PictureSettings.cs
+++ b/win/C#/Controls/PictureSettings.cs
@@ -1,8 +1,7 @@
/* PictureSetting.cs $
-
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
namespace Handbrake.Controls
{
@@ -13,17 +12,16 @@ namespace Handbrake.Controls
using Parsing;
using Presets;
+ /// <summary>
+ /// The Picture Settings Panel
+ /// </summary>
public partial class PictureSettings : UserControl
{
private readonly CultureInfo culture = new CultureInfo("en-US", false);
- public event EventHandler PictureSettingsChanged;
-
private bool preventChangingWidth;
private bool preventChangingHeight;
private bool preventChangingCustom;
private bool preventChangingDisplayWidth;
- private int presetMaximumWidth;
- private int presetMaximumHeight;
private double cachedDar;
private Title sourceTitle;
@@ -40,11 +38,20 @@ namespace Handbrake.Controls
}
/// <summary>
+ /// Picture Settings Changed Event Handler
+ /// </summary>
+ public event EventHandler PictureSettingsChanged;
+
+ /// <summary>
/// Gets or sets the source media used by this control.
/// </summary>
public Title Source
{
- private get { return sourceTitle; }
+ private get
+ {
+ return sourceTitle;
+ }
+
set
{
sourceTitle = value;
@@ -54,7 +61,7 @@ namespace Handbrake.Controls
}
/// <summary>
- /// Which preset is currently selected by the user.
+ /// Gets or sets the currently selected preset.
/// </summary>
public Preset CurrentlySelectedPreset { get; set; }
@@ -62,29 +69,14 @@ namespace Handbrake.Controls
/// Gets or sets the maximum allowable size for the encoded resolution. Set a value to
/// "0" if the maximum does not matter.
/// </summary>
- public Size PresetMaximumResolution
- {
- get { return new Size(presetMaximumWidth, presetMaximumHeight); }
- set
- {
- presetMaximumWidth = value.Width;
- presetMaximumHeight = value.Height;
-
- if (value.Width != 0 && value.Height != 0)
- lbl_max.Text = "Max Width / Height";
- else if (value.Width != 0)
- lbl_max.Text = "Max Width";
- else if (value.Height != 0)
- lbl_max.Text = "Max Height";
- else
- lbl_max.Text = string.Empty;
- }
- }
+ public Size PresetMaximumResolution { get; set; }
/// <summary>
/// Set the Preset Crop Warning Label
/// </summary>
- /// <param name="selectedPreset"></param>
+ /// <param name="selectedPreset">
+ /// The Selected preset
+ /// </param>
public void SetPresetCropWarningLabel(Preset selectedPreset)
{
lbl_presetCropWarning.Visible = true;
@@ -100,12 +92,10 @@ namespace Handbrake.Controls
private void NewSourceSet()
{
// Set the Aspect Ratio
- lbl_Aspect.Text = sourceTitle.AspectRatio.ToString(culture);
lbl_src_res.Text = sourceTitle.Resolution.Width + " x " + sourceTitle.Resolution.Height;
// Set the Recommended Cropping values, but only if a preset doesn't have hard set picture settings.
- if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) ||
- CurrentlySelectedPreset == null)
+ if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) || CurrentlySelectedPreset == null)
{
crop_top.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[0]);
crop_bottom.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[1]);
@@ -118,19 +108,28 @@ namespace Handbrake.Controls
// Set the Resolution Boxes
if (drp_anamorphic.SelectedIndex == 0)
{
- if (text_width.Value == 0) // Only update the values if the fields don't already have values.
- text_width.Value = sourceTitle.Resolution.Width;
+ int width = sourceTitle.Resolution.Width;
+
+ if (width > PresetMaximumResolution.Width && PresetMaximumResolution.Width != 0) // If the preset has a Max width set, don't use a width larger than it.
+ width = PresetMaximumResolution.Width;
+
+ if (text_width.Value == 0 || (text_width.Value > PresetMaximumResolution.Width && PresetMaximumResolution.Width != 0)) // Only update the values if the fields don't already have values.
+ text_width.Value = width;
check_KeepAR.Checked = true; // Forces Resolution to be correct.
}
else
{
- if (text_width.Value == 0 && text_height.Value == 0)
- // Only update the values if the fields don't already have values.
- {
- text_width.Value = sourceTitle.Resolution.Width;
- text_height.Value = sourceTitle.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;
- }
+ int width = sourceTitle.Resolution.Width;
+ if (width > PresetMaximumResolution.Width && PresetMaximumResolution.Width != 0) // If the preset has a Max width set, don't use a width larger than it.
+ width = PresetMaximumResolution.Width;
+
+ int height = sourceTitle.Resolution.Height;
+ if (height > PresetMaximumResolution.Height && PresetMaximumResolution.Height != 0) // If the preset has a Max height set, don't use a width larger than it.
+ height = PresetMaximumResolution.Height;
+
+ text_width.Value = width;
+ text_height.Value = height - (int)crop_top.Value - (int)crop_bottom.Value;
labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height;
}
@@ -139,7 +138,7 @@ namespace Handbrake.Controls
updownParHeight.Value = sourceTitle.ParVal.Height;
Size croppedDar = CalculateAnamorphicSizes();
- cachedDar = (double) croppedDar.Width/croppedDar.Height;
+ cachedDar = (double)croppedDar.Width / croppedDar.Height;
updownDisplayWidth.Value = croppedDar.Width;
}
@@ -164,17 +163,17 @@ namespace Handbrake.Controls
{
preventChangingHeight = true;
- int width = (int) text_width.Value;
+ int width = (int)text_width.Value;
- double crop_width = Source.Resolution.Width - (int) crop_left.Value - (int) crop_right.Value;
- double crop_height = Source.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;
+ double crop_width = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value;
+ double crop_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;
if (SourceAspect.Width == 0 && SourceAspect.Height == 0)
break;
- double newHeight = ((double) width*Source.Resolution.Width*SourceAspect.Height*crop_height)/
- (Source.Resolution.Height*SourceAspect.Width*crop_width);
- text_height.Value = (decimal) GetModulusValue(newHeight);
+ double newHeight = ((double)width * Source.Resolution.Width * SourceAspect.Height * crop_height) /
+ (Source.Resolution.Height * SourceAspect.Width * crop_width);
+ text_height.Value = (decimal)GetModulusValue(newHeight);
preventChangingHeight = false;
}
@@ -186,7 +185,7 @@ namespace Handbrake.Controls
break;
preventChangingDisplayWidth = true;
- updownDisplayWidth.Value = text_width.Value*updownParWidth.Value/updownParHeight.Value;
+ updownDisplayWidth.Value = text_width.Value * updownParWidth.Value / updownParHeight.Value;
preventChangingDisplayWidth = false;
labelDisplaySize.Text = Math.Truncate(updownDisplayWidth.Value) + "x" + text_height.Value;
@@ -225,14 +224,14 @@ namespace Handbrake.Controls
{
preventChangingWidth = true;
- double crop_width = Source.Resolution.Width - (int) crop_left.Value - (int) crop_right.Value;
- double crop_height = Source.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;
+ double crop_width = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value;
+ double crop_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;
- double new_width = ((double) text_height.Value*Source.Resolution.Height*SourceAspect.Width*
- crop_width)/
- (Source.Resolution.Width*SourceAspect.Height*crop_height);
+ double new_width = ((double)text_height.Value * Source.Resolution.Height * SourceAspect.Width *
+ crop_width) /
+ (Source.Resolution.Width * SourceAspect.Height * crop_height);
- text_width.Value = (decimal) GetModulusValue(new_width);
+ text_width.Value = (decimal)GetModulusValue(new_width);
preventChangingWidth = false;
}
@@ -247,12 +246,12 @@ namespace Handbrake.Controls
// - Changes PIXEL HEIGHT to STORAGE WIDTH
// DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)
- double rawCalculatedDisplayWidth = (double) text_height.Value*cachedDar;
+ double rawCalculatedDisplayWidth = (double)text_height.Value * cachedDar;
preventChangingDisplayWidth = true; // Start Guards
preventChangingWidth = true;
- updownDisplayWidth.Value = (decimal) rawCalculatedDisplayWidth;
+ updownDisplayWidth.Value = (decimal)rawCalculatedDisplayWidth;
updownParWidth.Value = updownDisplayWidth.Value;
updownParHeight.Value = text_width.Value;
@@ -315,12 +314,12 @@ namespace Handbrake.Controls
if (!int.TryParse(drp_modulus.SelectedItem.ToString(), out modulus))
modulus = 16;
- int rawCalculatedHeight = (int) ((int) updownDisplayWidth.Value/cachedDar);
- int modulusHeight = rawCalculatedHeight - (rawCalculatedHeight%modulus);
+ int rawCalculatedHeight = (int)((int)updownDisplayWidth.Value / cachedDar);
+ int modulusHeight = rawCalculatedHeight - (rawCalculatedHeight % modulus);
// Update value
preventChangingHeight = true;
- text_height.Value = (decimal) modulusHeight;
+ text_height.Value = (decimal)modulusHeight;
updownParWidth.Value = updownDisplayWidth.Value;
updownParHeight.Value = text_width.Value;
preventChangingHeight = false;
@@ -339,8 +338,9 @@ namespace Handbrake.Controls
SetCustomAnamorphicOptionsVisible(false);
labelStaticDisplaySize.Visible = false;
- labelDisplaySize.Visible = true;
+ labelDisplaySize.Visible = false;
drp_modulus.Visible = true;
+ lbl_modulus.Visible = true;
// check_KeepAR.Checked = true;
@@ -401,8 +401,8 @@ namespace Handbrake.Controls
preventChangingWidth = true;
preventChangingHeight = true;
- text_width.Value = (decimal) GetModulusValue((double) text_width.Value);
- text_height.Value = (decimal) GetModulusValue((double) text_height.Value);
+ text_width.Value = (decimal)GetModulusValue((double)text_width.Value);
+ text_height.Value = (decimal)GetModulusValue((double)text_height.Value);
preventChangingWidth = false;
preventChangingHeight = false;
@@ -456,8 +456,8 @@ namespace Handbrake.Controls
get
{
if (Source != null) // display aspect = (width * par_width) / (height * par_height)
- return new Size((Source.ParVal.Width*Source.Resolution.Width),
- (Source.ParVal.Height*Source.Resolution.Height));
+ return new Size((Source.ParVal.Width * Source.Resolution.Width),
+ (Source.ParVal.Height * Source.Resolution.Height));
return new Size(0, 0); // Fall over to 16:9 and hope for the best
}
@@ -468,12 +468,12 @@ namespace Handbrake.Controls
if (Source != null)
{
/* Set up some variables to make the math easier to follow. */
- int croppedWidth = Source.Resolution.Width - (int) crop_left.Value - (int) crop_right.Value;
- int croppedHeight = Source.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;
- double storageAspect = (double) croppedWidth/croppedHeight;
+ int croppedWidth = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value;
+ int croppedHeight = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;
+ double storageAspect = (double)croppedWidth / croppedHeight;
/* Figure out what width the source would display at. */
- double sourceDisplayWidth = (double) croppedWidth*Source.ParVal.Width/Source.ParVal.Height;
+ double sourceDisplayWidth = (double)croppedWidth * Source.ParVal.Width / Source.ParVal.Height;
/*
3 different ways of deciding output dimensions:
@@ -487,31 +487,31 @@ namespace Handbrake.Controls
default:
case 1:
/* Strict anamorphic */
- double displayWidth = ((double) croppedWidth*Source.ParVal.Width/Source.ParVal.Height);
+ double displayWidth = ((double)croppedWidth * Source.ParVal.Width / Source.ParVal.Height);
displayWidth = Math.Round(displayWidth, 0);
- Size output = new Size((int) displayWidth, croppedHeight);
+ Size output = new Size((int)displayWidth, croppedHeight);
return output;
case 2:
/* "Loose" anamorphic.
- Uses mod16-compliant dimensions,
- Allows users to set the width
*/
- width = (int) text_width.Value;
+ width = (int)text_width.Value;
width = GetModulusValue(width); /* Time to get picture width that divide cleanly.*/
- height = (width/storageAspect) + 0.5;
+ height = (width / storageAspect) + 0.5;
height = GetModulusValue(height); /* Time to get picture height that divide cleanly.*/
/* The film AR is the source's display width / cropped source height.
The output display width is the output height * film AR.
The output PAR is the output display width / output storage width. */
- double pixelAspectWidth = height*sourceDisplayWidth/croppedHeight;
+ double pixelAspectWidth = height * sourceDisplayWidth / croppedHeight;
double pixelAspectHeight = width;
- double disWidthLoose = (width*pixelAspectWidth/pixelAspectHeight);
+ double disWidthLoose = (width * pixelAspectWidth / pixelAspectHeight);
if (double.IsNaN(disWidthLoose))
disWidthLoose = 0;
- return new Size((int) disWidthLoose, (int) height);
+ return new Size((int)disWidthLoose, (int)height);
case 3:
// Get the User Interface Values
@@ -519,12 +519,12 @@ namespace Handbrake.Controls
double.TryParse(updownDisplayWidth.Text, out UIdisplayWidth);
/* Anamorphic 3: Power User Jamboree - Set everything based on specified values */
- height = GetModulusValue((double) text_height.Value);
+ height = GetModulusValue((double)text_height.Value);
if (check_KeepAR.Checked)
- return new Size((int) Math.Truncate(UIdisplayWidth), (int) height);
+ return new Size((int)Math.Truncate(UIdisplayWidth), (int)height);
- return new Size((int) Math.Truncate(UIdisplayWidth), (int) height);
+ return new Size((int)Math.Truncate(UIdisplayWidth), (int)height);
}
}
@@ -535,27 +535,19 @@ namespace Handbrake.Controls
private double GetModulusValue(double value)
{
int mod = int.Parse(drp_modulus.SelectedItem.ToString());
- double remainder = value%mod;
+ double remainder = value % mod;
if (remainder == 0)
return value;
- return remainder >= ((double) mod/2) ? value + (mod - remainder) : value - remainder;
+ return remainder >= ((double)mod / 2) ? value + (mod - remainder) : value - remainder;
}
private static int GetCropMod2Clean(int value)
{
- int remainder = value%2;
+ int remainder = value % 2;
if (remainder == 0) return value;
return (value + remainder);
}
-
- // Hidden UI feature to drop the MaxWidth / Height with the MaxWidth/Height label is double clicked
- private void LblMaxDoubleClick(object sender, EventArgs e)
- {
- PresetMaximumResolution = new Size(0, 0);
- if (PictureSettingsChanged != null)
- PictureSettingsChanged(this, new EventArgs());
- }
}
} \ No newline at end of file
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index c1cadfd71..7775b8cdf 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -60,7 +60,7 @@ namespace Handbrake.Functions
query += string.Format(" -c {0}", mainWindow.drop_chapterStart.Text);
else if (mainWindow.drop_chapterStart.Text != string.Empty &&
mainWindow.drop_chapterFinish.Text != string.Empty)
- query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text,
+ query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text,
mainWindow.drop_chapterFinish.Text);
break;
case 1: // Seconds
@@ -69,7 +69,7 @@ namespace Handbrake.Functions
int.TryParse(mainWindow.drop_chapterFinish.Text, out end);
int calculatedDuration = end - start;
- query += string.Format(" --start-at duration:{0} --stop-at duration:{1}",
+ query += string.Format(" --start-at duration:{0} --stop-at duration:{1}",
mainWindow.drop_chapterStart.Text, calculatedDuration);
break;
case 2: // Frames
@@ -77,7 +77,7 @@ namespace Handbrake.Functions
int.TryParse(mainWindow.drop_chapterFinish.Text, out end);
calculatedDuration = end - start;
- query += string.Format(" --start-at frame:{0} --stop-at frame:{1}",
+ query += string.Format(" --start-at frame:{0} --stop-at frame:{1}",
mainWindow.drop_chapterStart.Text, calculatedDuration);
break;
case 3: // Preview
@@ -86,7 +86,7 @@ namespace Handbrake.Functions
query += " --stop-at duration:" + duration + " ";
if (mainWindow.text_destination.Text != string.Empty)
- query += string.Format(" -o \"{0}\" ",
+ query += string.Format(" -o \"{0}\" ",
mainWindow.text_destination.Text.Replace(".m", "_sample.m"));
break;
default:
@@ -127,38 +127,13 @@ namespace Handbrake.Functions
#region Picture Settings Tab
- // Use MaxWidth for built-in presets and width for user settings.
- if (mainWindow.PictureSettings.PresetMaximumResolution.Width == 0)
- {
- if (mainWindow.PictureSettings.text_width.Value != 0)
- if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1)
- // Prevent usage for strict anamorphic
- query += " -w " + mainWindow.PictureSettings.text_width.Text;
- }
- else
- {
- if (mainWindow.PictureSettings.text_width.Value != 0)
- if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1)
- query += " -X " + mainWindow.PictureSettings.text_width.Text;
- }
+ if (mainWindow.PictureSettings.text_width.Value != 0)
+ if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1) // Prevent usage for strict anamorphic
+ query += " -w " + mainWindow.PictureSettings.text_width.Text;
- // Use MaxHeight for built-in presets and height for user settings.
- if (mainWindow.PictureSettings.PresetMaximumResolution.Height == 0)
- {
- if (mainWindow.PictureSettings.text_height.Value != 0)
- if (mainWindow.PictureSettings.text_height.Text != string.Empty)
- if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||
- mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)
- // Prevent usage for strict anamorphic
- query += " -l " + mainWindow.PictureSettings.text_height.Text;
- }
- else
- {
- if (mainWindow.PictureSettings.text_height.Value != 0)
- if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||
- mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)
- query += " -Y " + mainWindow.PictureSettings.text_height.Text;
- }
+ if (mainWindow.PictureSettings.text_height.Value != 0 && mainWindow.PictureSettings.text_height.Text != string.Empty)
+ if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic
+ query += " -l " + mainWindow.PictureSettings.text_height.Text;
string cropTop = mainWindow.PictureSettings.crop_top.Text;
string cropBottom = mainWindow.PictureSettings.crop_bottom.Text;
@@ -256,7 +231,7 @@ namespace Handbrake.Functions
break;
case "H.264 (x264)":
CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
- value = 51 - mainWindow.slider_videoQuality.Value*cqStep;
+ value = 51 - mainWindow.slider_videoQuality.Value * cqStep;
value = Math.Round(value, 2);
query += " -q " + value.ToString(culture);
break;
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs
index 9d5b9a9e5..95b153aa3 100644
--- a/win/C#/Functions/QueryParser.cs
+++ b/win/C#/Functions/QueryParser.cs
@@ -1,8 +1,7 @@
/* QueryParser.cs $
-
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
namespace Handbrake.Functions
{
@@ -13,8 +12,14 @@ namespace Handbrake.Functions
using System.Windows.Forms;
using Model;
+ /// <summary>
+ /// Parse a CLI Query
+ /// </summary>
public class QueryParser
{
+ /// <summary>
+ /// The Culture
+ /// </summary>
private static readonly CultureInfo Culture = new CultureInfo("en-US", false);
#region Varibles
@@ -433,9 +438,7 @@ namespace Handbrake.Functions
}
catch (Exception exc)
{
- MessageBox.Show(
- "An error has occured in the Query Parser.\n\n" +
- exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show("An error has occured in the Query Parser.\n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
#endregion
@@ -446,8 +449,8 @@ namespace Handbrake.Functions
/// <summary>
/// Get the GUI equiv to a CLI mixdown
/// </summary>
- /// <param name="mixdown"></param>
- /// <returns></returns>
+ /// <param name="mixdown">The Audio Mixdown</param>
+ /// <returns>The GUI representation of the mixdown</returns>
private static string GetMixDown(string mixdown)
{
switch (mixdown.Trim())
@@ -470,8 +473,8 @@ namespace Handbrake.Functions
/// <summary>
/// Get the GUI equiv to a CLI audio encoder
/// </summary>
- /// <param name="audioEnc"></param>
- /// <returns></returns>
+ /// <param name="audioEnc">The Audio Encoder</param>
+ /// <returns>The GUI representation of that audio encoder</returns>
private static string GetAudioEncoder(string audioEnc)
{
switch (audioEnc)
diff --git a/win/C#/Functions/Scan.cs b/win/C#/Functions/Scan.cs
index 78d158564..8532b353c 100644
--- a/win/C#/Functions/Scan.cs
+++ b/win/C#/Functions/Scan.cs
@@ -53,6 +53,11 @@ namespace Handbrake.Functions
public event EventHandler ScanStatusChanged;
/// <summary>
+ /// Gets or sets a value indicating whether IsScanning.
+ /// </summary>
+ public bool IsScanning { get; set; }
+
+ /// <summary>
/// Scan a Source Path.
/// Title 0: scan all
/// </summary>
@@ -109,6 +114,7 @@ namespace Handbrake.Functions
{
try
{
+ IsScanning = true;
if (this.ScanStared != null)
this.ScanStared(this, new EventArgs());
@@ -152,6 +158,7 @@ namespace Handbrake.Functions
if (this.ScanCompleted != null)
this.ScanCompleted(this, new EventArgs());
+ IsScanning = false;
}
catch (Exception exc)
{
diff --git a/win/C#/HandBrakeCS.5.0.ReSharper b/win/C#/HandBrakeCS.5.0.ReSharper
index 780744878..ede9d3f57 100644
--- a/win/C#/HandBrakeCS.5.0.ReSharper
+++ b/win/C#/HandBrakeCS.5.0.ReSharper
@@ -106,6 +106,8 @@
<Abbreviation Text="CLI" />
<Abbreviation Text="DRC" />
<Abbreviation Text="ID" />
+ <Abbreviation Text="MP" />
+ <Abbreviation Text="DVD" />
</Naming2>
</CodeStyleSettings>
</Configuration> \ No newline at end of file
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 8dd436c9b..8e7e31db2 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -1037,7 +1037,6 @@ namespace Handbrake
UnRegisterPresetEventHandler();
drop_mode.SelectedIndex = 0;
- PictureSettings.lbl_Aspect.Text = "Select a Title"; // Reset some values on the form
drop_chapterStart.Items.Clear();
drop_chapterFinish.Items.Clear();
@@ -1791,7 +1790,6 @@ namespace Handbrake
drop_chapterFinish.Items.Clear();
lbl_duration.Text = "Select a Title";
PictureSettings.lbl_src_res.Text = "Select a Title";
- PictureSettings.lbl_Aspect.Text = "Select a Title";
sourcePath = String.Empty;
text_destination.Text = String.Empty;
selectedTitle = null;