diff options
author | sr55 <[email protected]> | 2009-06-08 16:18:38 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-06-08 16:18:38 +0000 |
commit | ba55f4a2f3c85a600231223d2912d9afcada00f8 (patch) | |
tree | f2f71219b0d7b8155ea29afb59c9976e97a7c041 /win/C#/Controls | |
parent | 8c2ee7ae989974d9cd64d853e3c82acb55d4a4ab (diff) |
WinGui:
- Fixes some crashes in the new picture settings panel and hooks up the presetLoader and query parser so they work with the new options.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2502 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Controls')
-rw-r--r-- | win/C#/Controls/PictureSettings.Designer.cs | 22 | ||||
-rw-r--r-- | win/C#/Controls/PictureSettings.cs | 105 |
2 files changed, 71 insertions, 56 deletions
diff --git a/win/C#/Controls/PictureSettings.Designer.cs b/win/C#/Controls/PictureSettings.Designer.cs index a5a79d85a..c033f7445 100644 --- a/win/C#/Controls/PictureSettings.Designer.cs +++ b/win/C#/Controls/PictureSettings.Designer.cs @@ -63,7 +63,7 @@ namespace Handbrake.Controls this.Label51 = new System.Windows.Forms.Label();
this.Label15 = new System.Windows.Forms.Label();
this.lbl_anamorphic = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
+ this.lbl_anamprohicLbl = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.text_height)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.text_width)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.crop_bottom)).BeginInit();
@@ -468,21 +468,21 @@ namespace Handbrake.Controls this.lbl_anamorphic.TabIndex = 74;
this.lbl_anamorphic.Text = "Select a Title";
//
- // label3
+ // lbl_anamprohicLbl
//
- this.label3.AutoSize = true;
- this.label3.BackColor = System.Drawing.Color.Transparent;
- this.label3.Location = new System.Drawing.Point(13, 221);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(66, 13);
- this.label3.TabIndex = 73;
- this.label3.Text = "Anamorphic:";
+ this.lbl_anamprohicLbl.AutoSize = true;
+ this.lbl_anamprohicLbl.BackColor = System.Drawing.Color.Transparent;
+ this.lbl_anamprohicLbl.Location = new System.Drawing.Point(13, 221);
+ this.lbl_anamprohicLbl.Name = "lbl_anamprohicLbl";
+ this.lbl_anamprohicLbl.Size = new System.Drawing.Size(66, 13);
+ this.lbl_anamprohicLbl.TabIndex = 73;
+ this.lbl_anamprohicLbl.Text = "Anamorphic:";
//
// PictureSettings
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.lbl_anamorphic);
- this.Controls.Add(this.label3);
+ this.Controls.Add(this.lbl_anamprohicLbl);
this.Controls.Add(this.check_customCrop);
this.Controls.Add(this.check_autoCrop);
this.Controls.Add(this.crop_bottom);
@@ -563,7 +563,7 @@ namespace Handbrake.Controls internal System.Windows.Forms.TextBox txt_parHeight;
internal System.Windows.Forms.CheckBox check_KeepAR;
internal System.Windows.Forms.Label lbl_anamorphic;
- internal System.Windows.Forms.Label label3;
+ internal System.Windows.Forms.Label lbl_anamprohicLbl;
}
}
diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs index 1563e8685..b9626f1d6 100644 --- a/win/C#/Controls/PictureSettings.cs +++ b/win/C#/Controls/PictureSettings.cs @@ -13,8 +13,6 @@ namespace Handbrake.Controls * - Code needs cleaned up and a ton of bugs probably need fixed.
*/
-
-
/*
* DISPLAY WIDTH STORAGE WIDTH PIXEL WIDTH
* HEIGHT KEEP ASPECT PIXEL HEIGHT
@@ -202,6 +200,7 @@ namespace Handbrake.Controls text_height.Text = heightVal.ToString();
check_KeepAR.Enabled = true;
lbl_anamorphic.Text = "";
+ lbl_anamprohicLbl.Visible = false;
break;
case 1: // Strict
text_height.BackColor = Color.LightGray;
@@ -214,17 +213,22 @@ namespace Handbrake.Controls check_KeepAR.Enabled = false;
disableCustomAnaControls();
lbl_anamorphic.Text = strictAnamorphic();
+ lbl_anamprohicLbl.Visible = true;
break;
case 2: // Loose
storageAspect = 0;
- text_width.Text = widthVal.ToString();
- text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;
+ if (selectedTitle != null)
+ {
+ text_width.Value = selectedTitle.Resolution.Width - (int) crop_left.Value - (int) crop_right.Value;
+ text_height.Value = selectedTitle.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;
+ }
text_height.Enabled = false;
text_height.BackColor = Color.LightGray;
text_width.Enabled = true;
text_width.BackColor = Color.White;
disableCustomAnaControls();
lbl_anamorphic.Text = looseAnamorphic();
+ lbl_anamprohicLbl.Visible = true;
break;
case 3: // Custom
@@ -235,19 +239,22 @@ namespace Handbrake.Controls text_height.Enabled = true;
text_width.Enabled = true;
- // Actual Work
- text_width.Text = widthVal.ToString();
- text_height.Text = cacluateHeight(widthVal).ToString(); // Bug here
-
- txt_parWidth.Text = selectedTitle.ParVal.Width.ToString();
- txt_parHeight.Text = selectedTitle.ParVal.Height.ToString();
- txt_displayWidth.Text = displayWidth().ToString();
-
+ // Actual Work
+ if (selectedTitle != null)
+ {
+ widthVal = selectedTitle.Resolution.Width;
+ text_width.Text = widthVal.ToString();
+ text_height.Text = cacluateHeight(widthVal).ToString();
+ txt_parWidth.Text = selectedTitle.ParVal.Width.ToString();
+ txt_parHeight.Text = selectedTitle.ParVal.Height.ToString();
+ txt_displayWidth.Text = displayWidth().ToString();
+ }
+
darValue = calculateDar();
check_KeepAR.CheckState = CheckState.Checked;
check_KeepAR.Enabled = true;
-
+ lbl_anamprohicLbl.Visible = true;
break;
}
@@ -573,40 +580,45 @@ namespace Handbrake.Controls }
private int cacluateHeight(int width)
{
- int aw = 0;
- int ah = 0;
- if (selectedTitle.AspectRatio.ToString() == "1.78")
- {
- aw = 16;
- ah = 9;
- }
- else if (selectedTitle.AspectRatio.ToString() == "1.33")
- {
- aw = 4;
- ah = 3;
- }
-
- if (aw != 0)
+ if (selectedTitle != null)
{
- // Crop_Width = Title->Width - crop_Left - crop_right
- // Crop_Height = Title->Height - crop_top - crop_bottom
- double crop_width = selectedTitle.Resolution.Width - (double)crop_left.Value - (double)crop_right.Value;
- double crop_height = selectedTitle.Resolution.Height - (double)crop_top.Value - (double)crop_bottom.Value;
-
- double new_height = (width * selectedTitle.Resolution.Width * ah * crop_height) /
- (selectedTitle.Resolution.Height * aw * crop_width);
-
- if (drp_anamorphic.SelectedIndex == 3)
- new_height = getModulusAuto(int.Parse(drop_modulus.SelectedItem.ToString()), new_height);
- else
- new_height = getModulusAuto(16, new_height);
+ int aw = 0;
+ int ah = 0;
+ if (selectedTitle.AspectRatio.ToString() == "1.78")
+ {
+ aw = 16;
+ ah = 9;
+ }
+ else if (selectedTitle.AspectRatio.ToString() == "1.33")
+ {
+ aw = 4;
+ ah = 3;
+ }
- //16 * (421 / 16)
- //double z = ( 16 * (( y + 8 ) / 16 ) );
- int x = int.Parse(new_height.ToString());
- if (x < 64)
- x = 64;
- return x;
+ if (aw != 0)
+ {
+ // Crop_Width = Title->Width - crop_Left - crop_right
+ // Crop_Height = Title->Height - crop_top - crop_bottom
+ double crop_width = selectedTitle.Resolution.Width - (double) crop_left.Value -
+ (double) crop_right.Value;
+ double crop_height = selectedTitle.Resolution.Height - (double) crop_top.Value -
+ (double) crop_bottom.Value;
+
+ double new_height = (width*selectedTitle.Resolution.Width*ah*crop_height)/
+ (selectedTitle.Resolution.Height*aw*crop_width);
+
+ if (drp_anamorphic.SelectedIndex == 3)
+ new_height = getModulusAuto(int.Parse(drop_modulus.SelectedItem.ToString()), new_height);
+ else
+ new_height = getModulusAuto(16, new_height);
+
+ //16 * (421 / 16)
+ //double z = ( 16 * (( y + 8 ) / 16 ) );
+ int x = int.Parse(new_height.ToString());
+ if (x < 64)
+ x = 64;
+ return x;
+ }
}
return 0;
}
@@ -683,6 +695,9 @@ namespace Handbrake.Controls double hcalc = (actualWidth / storageAspect) + 0.5;
double newHeight = getModulusAuto(16, hcalc);
looseAnamorphicHeightGuard = true;
+
+ if (newHeight < 64)
+ newHeight = 64;
text_height.Value = (decimal)newHeight; // BUG Out of Range Exception with Width too low here.
// Calculate the anamorphic width
|