2 using System.Drawing;
\r
3 using System.Windows.Forms;
\r
4 using Handbrake.Parsing;
\r
6 namespace Handbrake.Controls
\r
9 * ***** WARNING *****
\r
10 * This file is incomplete.
\r
11 * - Custom Anamorphic mode does not work.
\r
12 * - Several Out of bound exceptions on the numeric up down width/height inputs need fixed.
\r
13 * - Code needs cleaned up and a ton of bugs probably need fixed.
\r
17 * DISPLAY WIDTH STORAGE WIDTH PIXEL WIDTH
\r
18 * HEIGHT KEEP ASPECT PIXEL HEIGHT
\r
20 * --- NOT KEEPING DISPLAY ASPECT ---
\r
21 * Changing STORAGE WIDTH changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT
\r
22 * Changing PIXEL dimensions changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT
\r
23 * Changing DISPLAY WIDTH changes PIXEL WIDTH to DISPLAY WIDTH and PIXEL HEIGHT to STORAGE WIDTH
\r
24 * Changing HEIGHT just....changes the height.
\r
26 * --- KEEPING DISPLAY ASPECT RATIO ---
\r
27 * DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)
\r
28 * Disable editing: PIXEL WIDTH, PIXEL HEIGHT
\r
29 * Changing DISPLAY WIDTH:
\r
30 * Changes HEIGHT to keep DAR
\r
31 * Changes PIXEL WIDTH to new DISPLAY WIDTH
\r
32 * Changes PIXEL HEIGHT to STORAGE WIDTH
\r
34 * Changes DISPLAY WIDTH to keep DAR
\r
35 * Changes PIXEL WIDTH to new DISPLAY WIDTH
\r
36 * Changes PIXEL HEIGHT to STORAGE WIDTH
\r
37 * Changing STORAGE_WIDTH:
\r
38 * Changes PIXEL WIDTH to DISPLAY WIDTH
\r
39 * Changes PIXEL HEIGHT to new STORAGE WIDTH
\r
42 public partial class PictureSettings : UserControl
\r
45 int maxWidth, maxHeight;
\r
46 int widthVal, heightVal;
\r
47 private double darValue;
\r
48 private double storageAspect = 0; // Storage Aspect Cache for current source and title
\r
49 public Title selectedTitle { get; set; }
\r
50 private Boolean heightChangeGuard;
\r
51 private Boolean looseAnamorphicHeightGuard;
\r
54 public PictureSettings()
\r
56 InitializeComponent();
\r
58 drop_modulus.SelectedIndex = 0;
\r
61 public void setComponentsAfterScan(Title st)
\r
65 // Set the Aspect Ratio
\r
66 lbl_Aspect.Text = selectedTitle.AspectRatio.ToString();
\r
67 lbl_src_res.Text = selectedTitle.Resolution.Width + " x " + selectedTitle.Resolution.Height;
\r
69 // Set the Recommended Cropping values
\r
70 crop_top.Text = selectedTitle.AutoCropDimensions[0].ToString();
\r
71 crop_bottom.Text = selectedTitle.AutoCropDimensions[1].ToString();
\r
72 crop_left.Text = selectedTitle.AutoCropDimensions[2].ToString();
\r
73 crop_right.Text = selectedTitle.AutoCropDimensions[3].ToString();
\r
76 // Set the Resolution Boxes
\r
77 text_width.Value = selectedTitle.Resolution.Width;
\r
78 text_height.Value = cacluateHeight(selectedTitle.Resolution.Width);
\r
80 if (drp_anamorphic.SelectedIndex == 3)
\r
82 txt_parWidth.Text = selectedTitle.ParVal.Width.ToString();
\r
83 txt_parHeight.Text = selectedTitle.ParVal.Height.ToString();
\r
84 txt_displayWidth.Text = displayWidth().ToString();
\r
87 public void setMax()
\r
89 if (maxWidth != 0 && maxHeight != 0)
\r
90 lbl_max.Text = "Max Width / Height";
\r
91 else if (maxWidth != 0)
\r
92 lbl_max.Text = "Max Width";
\r
97 // Basic Picture Setting Controls
\r
98 private void text_width_ValueChanged(object sender, EventArgs e)
\r
102 int.TryParse(drop_modulus.SelectedItem.ToString(), out mod);
\r
104 // Increase or decrease value by the correct mod.
\r
105 text_width.Value = widthChangeMod(mod);
\r
108 switch (drp_anamorphic.SelectedIndex)
\r
111 if (calculateUnchangeValue(true) != -1)
\r
112 text_height.Value = calculateUnchangeValue(true);
\r
115 lbl_anamorphic.Text = strictAnamorphic();
\r
118 lbl_anamorphic.Text = looseAnamorphic();
\r
121 customAnamorphic(text_width);
\r
126 private void text_height_ValueChanged(object sender, EventArgs e)
\r
130 int.TryParse(drop_modulus.SelectedItem.ToString(), out mod);
\r
132 // Increase or decrease value by the correct mod.
\r
133 if (drp_anamorphic.SelectedIndex != 2)
\r
135 decimal val = heightChangeMod(mod);
\r
136 heightChangeGuard = true;
\r
137 if (text_height.Value != val)
\r
139 heightChangeGuard = false;
\r
140 text_height.Value = val;
\r
145 switch (drp_anamorphic.SelectedIndex)
\r
148 if (drp_anamorphic.SelectedIndex != 3)
\r
150 if (calculateUnchangeValue(false) != -1)
\r
151 text_width.Value = calculateUnchangeValue(false);
\r
155 lbl_anamorphic.Text = strictAnamorphic();
\r
158 if (!looseAnamorphicHeightGuard)
\r
159 lbl_anamorphic.Text = looseAnamorphic();
\r
162 if (!heightChangeGuard)
\r
163 customAnamorphic(text_height);
\r
166 heightChangeGuard = false;
\r
167 looseAnamorphicHeightGuard = false;
\r
169 private void check_KeepAR_CheckedChanged(object sender, EventArgs e)
\r
171 // Recalculate Height based on width when enabled
\r
172 if (drp_anamorphic.SelectedIndex != 3 && check_KeepAR.Checked && selectedTitle != null)
\r
173 text_height.Value = cacluateHeight(widthVal);
\r
175 // Enable Par Width/Height Check boxes if Keep AR is enabled, otherwise disable them
\r
176 if (check_KeepAR.Checked)
\r
178 txt_parWidth.Enabled = false;
\r
179 txt_parHeight.Enabled = false;
\r
183 txt_parWidth.Enabled = true;
\r
184 txt_parHeight.Enabled = true;
\r
187 private void drp_anamorphic_SelectedIndexChanged(object sender, EventArgs e)
\r
189 switch (drp_anamorphic.SelectedIndex)
\r
192 text_height.BackColor = Color.White;
\r
193 text_width.BackColor = Color.White;
\r
194 text_height.Enabled = true;
\r
195 text_width.Enabled = true;
\r
196 check_KeepAR.CheckState = CheckState.Checked;
\r
197 check_KeepAR.Enabled = true;
\r
198 disableCustomAnaControls();
\r
199 text_width.Text = widthVal.ToString();
\r
200 text_height.Text = heightVal.ToString();
\r
201 check_KeepAR.Enabled = true;
\r
202 lbl_anamorphic.Text = "";
\r
203 lbl_anamprohicLbl.Visible = false;
\r
206 text_height.BackColor = Color.LightGray;
\r
207 text_width.BackColor = Color.LightGray;
\r
208 text_height.Text = "";
\r
209 text_width.Text = "";
\r
210 text_height.Enabled = false;
\r
211 text_width.Enabled = false;
\r
212 check_KeepAR.CheckState = CheckState.Unchecked;
\r
213 check_KeepAR.Enabled = false;
\r
214 disableCustomAnaControls();
\r
215 lbl_anamorphic.Text = strictAnamorphic();
\r
216 lbl_anamprohicLbl.Visible = true;
\r
220 if (selectedTitle != null)
\r
222 text_width.Value = selectedTitle.Resolution.Width - (int) crop_left.Value - (int) crop_right.Value;
\r
223 text_height.Value = selectedTitle.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;
\r
225 text_height.Enabled = false;
\r
226 text_height.BackColor = Color.LightGray;
\r
227 text_width.Enabled = true;
\r
228 text_width.BackColor = Color.White;
\r
229 disableCustomAnaControls();
\r
230 lbl_anamorphic.Text = looseAnamorphic();
\r
231 lbl_anamprohicLbl.Visible = true;
\r
235 // Display Elements
\r
236 enableCustomAnaControls();
\r
237 text_height.BackColor = Color.White;
\r
238 text_width.BackColor = Color.White;
\r
239 text_height.Enabled = true;
\r
240 text_width.Enabled = true;
\r
243 if (selectedTitle != null)
\r
245 widthVal = selectedTitle.Resolution.Width;
\r
246 text_width.Text = widthVal.ToString();
\r
247 text_height.Text = cacluateHeight(widthVal).ToString();
\r
248 txt_parWidth.Text = selectedTitle.ParVal.Width.ToString();
\r
249 txt_parHeight.Text = selectedTitle.ParVal.Height.ToString();
\r
250 txt_displayWidth.Text = displayWidth().ToString();
\r
253 darValue = calculateDar();
\r
255 check_KeepAR.CheckState = CheckState.Checked;
\r
256 check_KeepAR.Enabled = true;
\r
257 lbl_anamprohicLbl.Visible = true;
\r
263 // Custom Anamorphic Controls
\r
264 private void txt_displayWidth_Keyup(object sender, KeyEventArgs e)
\r
266 if (e.KeyCode == Keys.Enter)
\r
267 customAnamorphic(txt_displayWidth);
\r
269 private void txt_parHeight_Keyup(object sender, KeyEventArgs e)
\r
271 if (e.KeyCode == Keys.Enter)
\r
272 customAnamorphic(txt_parHeight);
\r
274 private void txt_parWidth_Keyup(object sender, KeyEventArgs e)
\r
276 if (e.KeyCode == Keys.Enter)
\r
277 customAnamorphic(txt_parWidth);
\r
280 // Cropping Control
\r
281 private void check_autoCrop_CheckedChanged(object sender, EventArgs e)
\r
283 crop_left.Enabled = false;
\r
284 crop_right.Enabled = false;
\r
285 crop_top.Enabled = false;
\r
286 crop_bottom.Enabled = false;
\r
288 private void check_customCrop_CheckedChanged(object sender, EventArgs e)
\r
290 crop_left.Enabled = true;
\r
291 crop_right.Enabled = true;
\r
292 crop_top.Enabled = true;
\r
293 crop_bottom.Enabled = true;
\r
294 if (selectedTitle != null)
\r
296 crop_top.Text = selectedTitle.AutoCropDimensions[0].ToString();
\r
297 crop_bottom.Text = selectedTitle.AutoCropDimensions[1].ToString();
\r
298 crop_left.Text = selectedTitle.AutoCropDimensions[2].ToString();
\r
299 crop_right.Text = selectedTitle.AutoCropDimensions[3].ToString();
\r
303 crop_left.Text = "0";
\r
304 crop_right.Text = "0";
\r
305 crop_top.Text = "0";
\r
306 crop_bottom.Text = "0";
\r
310 // Custom Anamorphic Code
\r
311 private void customAnamorphic(Control control)
\r
313 // Get and parse all the required values
\r
314 int cropLeft = (int)crop_left.Value;
\r
315 int cropRight = (int)crop_right.Value;
\r
317 int width = (int)text_width.Value;
\r
318 int cropped_width = width - cropLeft - cropRight;
\r
321 int.TryParse(drop_modulus.SelectedItem.ToString(), out mod);
\r
324 double displayWidth;
\r
325 int.TryParse(txt_parWidth.Text, out parW);
\r
326 int.TryParse(txt_parHeight.Text, out parH);
\r
327 double.TryParse(txt_displayWidth.Text, out displayWidth);
\r
329 /* NOT KEEPING DISPLAY ASPECT
\r
330 * Changing STORAGE WIDTH changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT
\r
331 * Changing PIXEL dimensions changes DISPLAY WIDTH to STORAGE WIDTH * PIXEL WIDTH / PIXEL HEIGHT
\r
332 * Changing DISPLAY WIDTH changes PIXEL WIDTH to DISPLAY WIDTH and PIXEL HEIGHT to STORAGE WIDTH
\r
333 * Changing HEIGHT just....changes the height.
\r
335 if (!check_KeepAR.Checked)
\r
337 switch (control.Name) // TODO Check if CroppedWidth or just Width
\r
340 double dw = (double)cropped_width * parW / parH;
\r
341 txt_displayWidth.Text = dw.ToString();
\r
343 case "txt_parWidth":
\r
344 double dwpw = (double)cropped_width * parW / parH;
\r
345 txt_displayWidth.Text = dwpw.ToString();
\r
347 case "txt_parHeight":
\r
348 double dwph = (double)cropped_width * parW / parH;
\r
349 txt_displayWidth.Text = dwph.ToString();
\r
351 case "txt_displayWidth":
\r
352 txt_parWidth.Text = txt_displayWidth.Text;
\r
353 txt_parHeight.Text = text_width.Text;
\r
359 * KEEPING DISPLAY ASPECT RATIO
\r
360 * DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)
\r
361 * Disable editing: PIXEL WIDTH, PIXEL HEIGHT
\r
362 * Changing DISPLAY WIDTH:
\r
363 * Changes HEIGHT to keep DAR
\r
364 * Changes PIXEL WIDTH to new DISPLAY WIDTH
\r
365 * Changes PIXEL HEIGHT to STORAGE WIDTH
\r
367 * Changes DISPLAY WIDTH to keep DAR
\r
368 * Changes PIXEL WIDTH to new DISPLAY WIDTH
\r
369 * Changes PIXEL HEIGHT to STORAGE WIDTH
\r
370 * Changing STORAGE_WIDTH:
\r
371 * Changes PIXEL WIDTH to DISPLAY WIDTH
\r
372 * Changes PIXEL HEIGHT to new STORAGE WIDTH
\r
375 if (check_KeepAR.Checked)
\r
377 switch (control.Name)
\r
379 case "txt_displayWidth":
\r
380 heightChangeGuard = true;
\r
381 text_height.Value = (decimal)getHeightKeepDar(); //Changes HEIGHT to keep DAR
\r
382 txt_parWidth.Text = txt_displayWidth.Text;
\r
383 txt_parHeight.Text = cropped_width.ToString();
\r
385 case "text_height":
\r
386 heightChangeGuard = true;
\r
387 txt_displayWidth.Text = getDisplayWidthKeepDar().ToString(); //Changes DISPLAY WIDTH to keep DAR
\r
388 txt_parWidth.Text = txt_displayWidth.Text;
\r
389 txt_parHeight.Text = cropped_width.ToString();
\r
392 txt_parWidth.Text = txt_displayWidth.Text;
\r
393 txt_parHeight.Text = cropped_width.ToString();
\r
398 private double getDisplayWidthKeepDar()
\r
400 double displayWidth;
\r
401 double.TryParse(txt_displayWidth.Text, out displayWidth);
\r
402 double currentDar = calculateDar();
\r
403 double newDwValue = displayWidth;
\r
405 // Correct display width up or down to correct for dar.
\r
406 if (currentDar > darValue)
\r
408 while (currentDar > darValue)
\r
411 newDwValue = displayWidth;
\r
412 currentDar = calculateDarByVal(text_height.Value, displayWidth);
\r
417 while (currentDar < darValue)
\r
420 newDwValue = displayWidth;
\r
421 currentDar = calculateDarByVal(text_height.Value, displayWidth);
\r
425 darValue = calculateDar(); // Cache the dar value
\r
428 private double getHeightKeepDar()
\r
430 double displayWidth;
\r
431 double.TryParse(txt_displayWidth.Text, out displayWidth);
\r
432 double currentDar = calculateDar();
\r
433 double newHeightVal = heightVal;
\r
435 // Correct display width up or down.
\r
436 if (currentDar > darValue)
\r
438 while (currentDar > darValue)
\r
441 newHeightVal = heightVal;
\r
442 currentDar = calculateDarByVal(heightVal, displayWidth);
\r
447 while (currentDar < darValue)
\r
450 newHeightVal = heightVal;
\r
451 currentDar = calculateDarByVal(heightVal, displayWidth);
\r
455 darValue = calculateDar(); // Cache the dar value
\r
456 return newHeightVal;
\r
458 private double calculateDar()
\r
460 // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)
\r
461 int cropTop = (int)crop_top.Value;
\r
462 int cropBottom = (int)crop_bottom.Value;
\r
463 int croppedHeight = (int)text_height.Value - cropTop - cropBottom;
\r
465 double displayWidth;
\r
466 double.TryParse(txt_displayWidth.Text, out displayWidth);
\r
468 double calculatedDar = displayWidth / croppedHeight;
\r
470 return calculatedDar;
\r
472 private double calculateDarByVal(decimal height, double displayWidth)
\r
474 // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)
\r
475 int cropTop = (int)crop_top.Value;
\r
476 int cropBottom = (int)crop_bottom.Value;
\r
477 int croppedHeight = (int)height - cropTop - cropBottom;
\r
479 double calculatedDar = darValue;
\r
480 if (croppedHeight > 0)
\r
481 calculatedDar = displayWidth / croppedHeight;
\r
483 return calculatedDar;
\r
485 private int displayWidth()
\r
487 if (selectedTitle != null)
\r
489 int actualWidth = (int)text_width.Value;
\r
490 int displayWidth = 0;
\r
493 int.TryParse(txt_parWidth.Text, out parW);
\r
494 int.TryParse(txt_parHeight.Text, out parH);
\r
496 if (drp_anamorphic.SelectedIndex != 3)
\r
497 displayWidth = (actualWidth * selectedTitle.ParVal.Width / selectedTitle.ParVal.Height);
\r
498 else if (parW > 0 && parH > 0)
\r
499 displayWidth = (actualWidth * parW / parH);
\r
501 return displayWidth;
\r
506 // Resolution calculation and controls
\r
507 private decimal widthChangeMod(int mod)
\r
509 // Increase or decrease the height based on the users input.
\r
510 decimal returnVal = text_width.Value > widthVal ? getResolutionJump(mod, text_width.Value, true) : getResolutionJump(mod, text_width.Value, false);
\r
512 // Make sure we don't go above source value
\r
513 if (selectedTitle != null)
\r
514 if (selectedTitle.Resolution.Width < returnVal)
\r
515 returnVal = selectedTitle.Resolution.Width;
\r
517 // Set the global tracker
\r
518 widthVal = (int)returnVal;
\r
522 private decimal heightChangeMod(int mod)
\r
524 // Increase or decrease the height based on the users input.
\r
525 decimal returnVal = text_height.Value > heightVal ? getResolutionJump(mod, text_height.Value, true) : getResolutionJump(mod, text_height.Value, false);
\r
527 // Make sure we don't go above source value
\r
528 if (selectedTitle != null)
\r
529 if (selectedTitle.Resolution.Height < returnVal)
\r
530 returnVal = selectedTitle.Resolution.Height;
\r
532 // Set the global tracker
\r
533 heightVal = (int)returnVal; // TODO THIS IS CAUSING PROBLEM
\r
537 private decimal calculateUnchangeValue(Boolean widthChangeFromControl)
\r
539 decimal newValue = -1;
\r
540 if (selectedTitle != null && drp_anamorphic.SelectedIndex != 3 && drp_anamorphic.SelectedIndex != 2)
\r
541 if (widthChangeFromControl)
\r
542 newValue = cacluateHeight(widthVal);
\r
545 if (check_KeepAR.Checked)
\r
546 newValue = cacluateWidth(heightVal);
\r
551 private int getResolutionJump(int mod, decimal value, Boolean up)
\r
554 while ((value % mod) != 0)
\r
557 while ((value % mod) != 0)
\r
562 private double getModulusAuto(int mod, double value)
\r
564 int modDiv2 = mod / 2;
\r
566 if ((value % mod) != 0)
\r
568 double modVal = (int)value % mod;
\r
569 if (modVal >= modDiv2)
\r
571 modVal = 16 - modVal;
\r
572 value = (int)value + (int)modVal;
\r
576 value = (int)value - (int)modVal;
\r
581 private int cacluateHeight(int width)
\r
583 if (selectedTitle != null)
\r
587 if (selectedTitle.AspectRatio.ToString() == "1.78")
\r
592 else if (selectedTitle.AspectRatio.ToString() == "1.33")
\r
600 // Crop_Width = Title->Width - crop_Left - crop_right
\r
601 // Crop_Height = Title->Height - crop_top - crop_bottom
\r
602 double crop_width = selectedTitle.Resolution.Width - (double) crop_left.Value -
\r
603 (double) crop_right.Value;
\r
604 double crop_height = selectedTitle.Resolution.Height - (double) crop_top.Value -
\r
605 (double) crop_bottom.Value;
\r
607 double new_height = (width*selectedTitle.Resolution.Width*ah*crop_height)/
\r
608 (selectedTitle.Resolution.Height*aw*crop_width);
\r
610 if (drp_anamorphic.SelectedIndex == 3)
\r
611 new_height = getModulusAuto(int.Parse(drop_modulus.SelectedItem.ToString()), new_height);
\r
613 new_height = getModulusAuto(16, new_height);
\r
616 //double z = ( 16 * (( y + 8 ) / 16 ) );
\r
617 int x = int.Parse(new_height.ToString());
\r
625 private int cacluateWidth(int height)
\r
629 if (selectedTitle.AspectRatio.ToString() == "1.78")
\r
634 else if (selectedTitle.AspectRatio.ToString() == "1.33")
\r
643 double crop_width = selectedTitle.Resolution.Width - (double)crop_left.Value - (double)crop_right.Value;
\r
644 double crop_height = selectedTitle.Resolution.Height - (double)crop_top.Value - (double)crop_bottom.Value;
\r
646 double new_width = (height * selectedTitle.Resolution.Height * aw * crop_width) /
\r
647 (selectedTitle.Resolution.Width * ah * crop_height);
\r
649 if (drp_anamorphic.SelectedIndex == 3)
\r
650 new_width = getModulusAuto(int.Parse(drop_modulus.SelectedItem.ToString()), new_width);
\r
652 new_width = getModulusAuto(16, new_width);
\r
655 //double z = ( 16 * (( y + 8 ) / 16 ) );
\r
656 int x = int.Parse(new_width.ToString());
\r
662 // Calculate Resolution for Anamorphic functions
\r
663 private string strictAnamorphic()
\r
665 // TODO Make sure cropping is Mod2
\r
666 if (selectedTitle != null)
\r
668 // Calculate the Actual Height
\r
669 int actualWidth = (int)text_width.Value - (int)crop_left.Value - (int)crop_right.Value; ;
\r
670 int actualHeight = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;
\r
671 if (drp_anamorphic.SelectedIndex == 2)
\r
672 actualHeight = (int)getModulusAuto(16, actualHeight);
\r
674 // Calculate Actual Width
\r
675 double displayWidth = ((double)actualWidth * selectedTitle.ParVal.Width / selectedTitle.ParVal.Height);
\r
676 return Math.Round(displayWidth, 0) + "x" + actualHeight;
\r
678 return "Select a Title";
\r
680 private string looseAnamorphic()
\r
682 if (selectedTitle != null)
\r
685 int actualWidth = (int)text_width.Value - (int)crop_left.Value - (int)crop_right.Value;
\r
687 int source_display_width = selectedTitle.Resolution.Width * selectedTitle.ParVal.Width / selectedTitle.ParVal.Height;
\r
688 int source_cropped_height = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;
\r
690 // Calculate storage Aspect and cache it for reuse
\r
691 if (storageAspect == 0)
\r
692 storageAspect = (double)actualWidth / source_cropped_height;
\r
694 // Calculate the new height based on the input cropped width
\r
695 double hcalc = (actualWidth / storageAspect) + 0.5;
\r
696 double newHeight = getModulusAuto(16, hcalc);
\r
697 looseAnamorphicHeightGuard = true;
\r
699 if (newHeight < 64)
\r
701 text_height.Value = (decimal)newHeight; // BUG Out of Range Exception with Width too low here.
\r
703 // Calculate the anamorphic width
\r
704 double parW = newHeight * source_display_width / source_cropped_height;
\r
705 double parH = actualWidth;
\r
706 double displayWidth = (actualWidth * parW / parH);
\r
708 // Now correct DisplayWidth to maintain Aspect ratio. ActualHeight was mod16'd and thus AR is slightly different than the worked out displayWidths
\r
709 return Math.Truncate(displayWidth) + "x" + newHeight;
\r
711 return "Select a Title";
\r
716 private void disableCustomAnaControls()
\r
718 // Disable Custom Anamorphic Stuff
\r
719 lbl_modulus.Visible = false;
\r
720 lbl_displayWidth.Visible = false;
\r
721 lbl_parWidth.Visible = false;
\r
722 lbl_parHeight.Visible = false;
\r
723 drop_modulus.Visible = false;
\r
724 txt_displayWidth.Visible = false;
\r
725 txt_parWidth.Visible = false;
\r
726 txt_parHeight.Visible = false;
\r
727 check_KeepAR.Enabled = false;
\r
729 private void enableCustomAnaControls()
\r
731 // Disable Custom Anamorphic Stuff
\r
732 lbl_modulus.Visible = true;
\r
733 lbl_displayWidth.Visible = true;
\r
734 lbl_parWidth.Visible = true;
\r
735 lbl_parHeight.Visible = true;
\r
736 drop_modulus.Visible = true;
\r
737 txt_displayWidth.Visible = true;
\r
738 txt_parWidth.Visible = true;
\r
739 txt_parHeight.Visible = true;
\r
740 check_KeepAR.Enabled = true;
\r