\r
namespace Handbrake.Controls\r
{\r
-\r
- // TODO Custom Anamorphic\r
- /* NOT KEEPING DISPLAY ASPECT == [Complete]\r
- \r
- KEEPING DISPLAY ASPECT RATIO == [TODO]\r
- DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)\r
- Disable editing: PIXEL WIDTH, PIXEL HEIGHT\r
- Changing DISPLAY WIDTH:\r
- Changes HEIGHT to keep DAR\r
- Changes PIXEL WIDTH to new DISPLAY WIDTH\r
- Changes PIXEL HEIGHT to STORAGE WIDTH\r
- Changing HEIGHT\r
- Changes DISPLAY WIDTH to keep DAR\r
- Changes PIXEL WIDTH to new DISPLAY WIDTH\r
- Changes PIXEL HEIGHT to STORAGE WIDTH\r
- Changing STORAGE_WIDTH:\r
- Changes PIXEL WIDTH to DISPLAY WIDTH\r
- Changes PIXEL HEIGHT to new STORAGE WIDTH\r
- * */\r
-\r
-\r
public partial class PictureSettings : UserControl\r
{\r
private readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
\r
private Boolean preventChangingWidth, preventChangingHeight, preventChangingCustom, preventChangingDisplayWidth;\r
private int _PresetMaximumWidth, _PresetMaximumHeight;\r
+ private double cachedDar;\r
private Title _SourceTitle;\r
\r
public PictureSettings()\r
updownDisplayWidth.Value = calculateAnamorphicSizes().Width;\r
updownParWidth.Value = _SourceTitle.ParVal.Width;\r
updownParHeight.Value = _SourceTitle.ParVal.Height;\r
+ cachedDar = (double)updownDisplayWidth.Value / (double)text_height.Value;\r
}\r
}\r
\r
\r
labelDisplaySize.Text = Math.Truncate(updownDisplayWidth.Value) + "x" + text_height.Value;\r
}\r
+\r
+ if (check_KeepAR.CheckState == CheckState.Checked && Source != null)\r
+ {\r
+ updownParWidth.Value = updownDisplayWidth.Value;\r
+ updownParHeight.Value = text_width.Value;\r
+ }\r
break;\r
default:\r
labelDisplaySize.Text = calculateAnamorphicSizes().Width + "x" + calculateAnamorphicSizes().Height;\r
break;\r
case 3:\r
labelDisplaySize.Text = Math.Truncate(updownDisplayWidth.Value) + "x" + text_height.Value;\r
+\r
+ if (check_KeepAR.CheckState == CheckState.Checked && Source != null)\r
+ {\r
+ // - Changes DISPLAY WIDTH to keep DAR\r
+ // - Changes PIXEL WIDTH to new DISPLAY WIDTH\r
+ // - Changes PIXEL HEIGHT to STORAGE WIDTH\r
+ // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)\r
+\r
+ double rawCalculatedDisplayWidth = (double)text_height.Value * cachedDar;\r
+\r
+ preventChangingDisplayWidth = true; // Start Guards\r
+ preventChangingWidth = true;\r
+\r
+ updownDisplayWidth.Value = (decimal)rawCalculatedDisplayWidth;\r
+ updownParWidth.Value = updownDisplayWidth.Value;\r
+ updownParHeight.Value = text_width.Value;\r
+\r
+ preventChangingWidth = false; // Reset Guards\r
+ preventChangingDisplayWidth = false;\r
+ }\r
+\r
break;\r
default:\r
labelDisplaySize.Text = calculateAnamorphicSizes().Width + "x" + calculateAnamorphicSizes().Height;\r
updownParHeight.Value = text_width.Value;\r
preventChangingCustom = false;\r
}\r
+\r
+ if (preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Checked)\r
+ {\r
+ // - Changes HEIGHT to keep DAR\r
+ // - Changes PIXEL WIDTH to new DISPLAY WIDTH\r
+ // - Changes PIXEL HEIGHT to STORAGE WIDTH\r
+ // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)\r
+\r
+ // Calculate new Height Value\r
+ int modulus = 16;\r
+ int.TryParse(drp_modulus.SelectedItem.ToString(), out modulus);\r
+\r
+ int rawCalculatedHeight = (int) ((int)updownDisplayWidth.Value/cachedDar);\r
+ int modulusHeight = rawCalculatedHeight - (rawCalculatedHeight % modulus);\r
+\r
+ // Update value\r
+ preventChangingHeight = true;\r
+ text_height.Value = (decimal)modulusHeight;\r
+ updownParWidth.Value = updownDisplayWidth.Value;\r
+ updownParHeight.Value = text_width.Value;\r
+ preventChangingHeight = false; \r
+ }\r
+ \r
}\r
\r
// Anamorphic Controls\r
#endregion\r
\r
#region In-GUI Encode Status (Experimental)\r
-\r
private void encodeMonitorThread()\r
{\r
try\r
Parser encode = new Parser(encodeQueue.hbProcess.StandardOutput.BaseStream);\r
encode.OnEncodeProgress += encodeOnEncodeProgress;\r
while (!encode.EndOfStream)\r
- {\r
encode.readEncodeStatus();\r
- }\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show(exc.ToString());\r
+ MessageBox.Show(exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
private void encodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)\r