switch (drp_anamorphic.SelectedIndex)\r
{\r
case 0: // None\r
- text_height.Enabled = true;\r
- text_width.Enabled = true;\r
check_KeepAR.CheckState = CheckState.Checked;\r
- check_KeepAR.Enabled = true;\r
- disableCustomAnaControls();\r
- check_KeepAR.Enabled = true;\r
+ anamorphicWidgetContoller(0);\r
if (selectedTitle != null)\r
{\r
text_width.Value = maxWidth != 0 ? maxWidth : selectedTitle.Resolution.Width;\r
setMax();\r
}\r
lbl_anamorphic.Text = "";\r
- lbl_anamprohicLbl.Visible = false;\r
break;\r
case 1: // Strict\r
if (selectedTitle != null)\r
text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value -\r
(int)crop_bottom.Value;\r
}\r
- text_height.Enabled = false;\r
- text_width.Enabled = false;\r
+ anamorphicWidgetContoller(1);\r
check_KeepAR.CheckState = CheckState.Unchecked;\r
- check_KeepAR.Enabled = false;\r
- disableCustomAnaControls();\r
lbl_anamorphic.Text = strictAnamorphic();\r
- lbl_anamprohicLbl.Visible = true;\r
break;\r
case 2: // Loose\r
- disableCustomAnaControls();\r
+ anamorphicWidgetContoller(2);\r
storageAspect = 0;\r
- text_height.Enabled = false;\r
- text_width.Enabled = true;\r
if (selectedTitle != null)\r
{\r
heightModJumpGaurd = true;\r
(int)crop_bottom.Value;\r
}\r
lbl_anamorphic.Text = looseAnamorphic();\r
- lbl_anamprohicLbl.Visible = true;\r
break;\r
case 3: // Custom\r
-\r
- // Display Elements\r
- enableCustomAnaControls();\r
- text_height.Enabled = true;\r
- text_width.Enabled = true;\r
+ anamorphicWidgetContoller(3); // Display Elements\r
\r
// Actual Work \r
if (selectedTitle != null)\r
}\r
\r
darValue = calculateDar();\r
-\r
check_KeepAR.CheckState = CheckState.Checked;\r
- check_KeepAR.Enabled = true;\r
- lbl_anamprohicLbl.Visible = true;\r
-\r
break;\r
}\r
\r
// A Picture Setting has changed so raise a PictureSettingsChanged event.\r
if (this.PictureSettingsChanged != null)\r
this.PictureSettingsChanged(this, new EventArgs());\r
-\r
}\r
\r
// Custom Anamorphic Controls\r
\r
return newValue;\r
}\r
- private int getResolutionJump(int mod, decimal value, Boolean up)\r
+ private static int getResolutionJump(int mod, decimal value, Boolean up)\r
{\r
if (up)\r
while ((value % mod) != 0)\r
\r
return (int)value;\r
}\r
- private double getModulusAuto(int mod, double value)\r
+ private static double getModulusAuto(int mod, double value)\r
{\r
int modDiv2 = mod / 2;\r
\r
// Calculate Resolution for Anamorphic functions\r
private string strictAnamorphic()\r
{\r
- // TODO Make sure cropping is Mod2\r
if (selectedTitle != null)\r
{\r
// Calculate the Actual Height\r
\r
if (newHeight < 64)\r
newHeight = 64;\r
- text_height.Value = (decimal)newHeight; // BUG Out of Range Exception with Width too low here.\r
+ text_height.Value = (decimal)newHeight; \r
\r
// Calculate the anamorphic width\r
double parW = newHeight * source_display_width / source_cropped_height;\r
return Math.Truncate(displayWidth) + "x" + newHeight;\r
}\r
return "Select a Title";\r
-\r
}\r
\r
- // GUI\r
- private void disableCustomAnaControls()\r
- {\r
- // Disable Custom Anamorphic Stuff\r
- lbl_modulus.Visible = false;\r
- lbl_displayWidth.Visible = false;\r
- lbl_parWidth.Visible = false;\r
- lbl_parHeight.Visible = false;\r
- drop_modulus.Visible = false;\r
- txt_displayWidth.Visible = false;\r
- txt_parWidth.Visible = false;\r
- txt_parHeight.Visible = false;\r
- check_KeepAR.Enabled = false;\r
- }\r
- private void enableCustomAnaControls()\r
- {\r
- // Disable Custom Anamorphic Stuff\r
- lbl_modulus.Visible = true;\r
- lbl_displayWidth.Visible = true;\r
- lbl_parWidth.Visible = true;\r
- lbl_parHeight.Visible = true;\r
- drop_modulus.Visible = true;\r
- txt_displayWidth.Visible = true;\r
- txt_parWidth.Visible = true;\r
- txt_parHeight.Visible = true;\r
- check_KeepAR.Enabled = true;\r
+ // Function to control the enable / disable property of the display controls.\r
+ private void anamorphicWidgetContoller(int mode)\r
+ {\r
+\r
+ switch (mode)\r
+ {\r
+ case 0: // None\r
+ text_height.Enabled = true;\r
+ text_width.Enabled = true;\r
+ check_KeepAR.Enabled = true;\r
+ lbl_anamprohicLbl.Visible = false;\r
+ break;\r
+ case 1: // Strict\r
+ text_height.Enabled = false;\r
+ text_width.Enabled = false;\r
+ check_KeepAR.Enabled = false;\r
+ lbl_anamprohicLbl.Visible = true;\r
+ break;\r
+ case 2: // Loose\r
+ text_height.Enabled = false;\r
+ text_width.Enabled = true;\r
+ check_KeepAR.Enabled = false;\r
+ lbl_anamprohicLbl.Visible = true;\r
+ break;\r
+ case 3: // Custom\r
+ text_height.Enabled = true;\r
+ text_width.Enabled = true;\r
+ check_KeepAR.Enabled = true;\r
+ // Labels\r
+ lbl_anamprohicLbl.Visible = true;\r
+ lbl_modulus.Visible = true;\r
+ lbl_displayWidth.Visible = true;\r
+ lbl_parWidth.Visible = true;\r
+ lbl_parHeight.Visible = true;\r
+ // Controls\r
+ drop_modulus.Visible = true;\r
+ txt_displayWidth.Visible = true;\r
+ txt_parWidth.Visible = true;\r
+ txt_parHeight.Visible = true;\r
+ break;\r
+ }\r
+\r
+ // Disable All the custom anamorphic controls if not required.\r
+ if (mode != 3)\r
+ {\r
+ // Labels\r
+ lbl_modulus.Visible = false;\r
+ lbl_displayWidth.Visible = false;\r
+ lbl_parWidth.Visible = false;\r
+ lbl_parHeight.Visible = false;\r
+\r
+ // Controls\r
+ drop_modulus.Visible = false;\r
+ txt_displayWidth.Visible = false;\r
+ txt_parWidth.Visible = false;\r
+ txt_parHeight.Visible = false;\r
+\r
+ }\r
}\r
\r
}\r