{\r
/*\r
* TODO:\r
- * Handle Presets when a new title is set\r
- * Handle changes in cropping affecting the resolution calcuation.\r
+ * - We are not handling cropping correctly within the UI.\r
+ * - The Height is not correctly set when using no Anamorphic\r
+ * - Maintain Aspect ratio needs corrected.\r
* \r
*/\r
#region Constants and Fields\r
/// </summary>\r
private bool showDisplaySize;\r
\r
+ /// <summary>\r
+ /// Backing field for max height\r
+ /// </summary>\r
+ private int maxHeight;\r
+\r
+ /// <summary>\r
+ /// Backing field for max width\r
+ /// </summary>\r
+ private int maxWidth;\r
+\r
#endregion\r
\r
#region Constructors and Destructors\r
this.Task = new EncodeTask();\r
this.SelectedModulus = 16;\r
this.MaintainAspectRatio = true;\r
+\r
+ // Default the Max Width / Height to 1080p format\r
+ this.MaxHeight = 1080;\r
+ this.MaxWidth = 1920;\r
}\r
\r
#endregion\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Gets or sets MaxHeight.\r
+ /// </summary>\r
+ public int MaxHeight\r
+ {\r
+ get\r
+ {\r
+ return this.maxHeight;\r
+ }\r
+ set\r
+ {\r
+ this.maxHeight = value;\r
+ this.NotifyOfPropertyChange(() => this.MaxHeight);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets or sets MinHeight.\r
+ /// </summary>\r
+ public int MaxWidth\r
+ {\r
+ get\r
+ {\r
+ return this.maxWidth;\r
+ }\r
+ set\r
+ {\r
+ this.maxWidth = value;\r
+ this.NotifyOfPropertyChange(() => this.MaxWidth);\r
+ }\r
+ }\r
+\r
/// <summary>\r
/// Gets SourceAspect.\r
/// </summary>\r
// TODO: These all need to be handled correctly.\r
this.SelectedAnamorphicMode = preset.Task.Anamorphic;\r
\r
- if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum)\r
+ // Set the limits on the UI Controls.\r
+ this.MaxWidth = preset.Task.MaxWidth ?? sourceResolution.Width;\r
+ this.MaxHeight = preset.Task.MaxHeight ?? sourceResolution.Height;\r
+ this.Task.MaxWidth = preset.Task.MaxWidth;\r
+ this.Task.MaxHeight = preset.Task.MaxHeight;\r
+\r
+ if (preset.Task.MaxWidth.HasValue)\r
+ {\r
+ if (this.Width > this.MaxWidth)\r
+ {\r
+ this.Width = this.MaxWidth;\r
+ } \r
+ else\r
+ {\r
+ this.Width = preset.Task.Width ?? this.getRes((sourceResolution.Width - this.CropLeft - this.CropRight), this.MaxWidth);\r
+ }\r
+ } \r
+ else\r
{\r
- this.Task.MaxWidth = preset.Task.MaxWidth;\r
- this.Task.MaxHeight = preset.Task.MaxHeight;\r
this.Width = preset.Task.Width ?? (sourceResolution.Width - this.CropLeft - this.CropRight);\r
- this.Height = preset.Task.Height ?? (sourceResolution.Height - this.CropTop - this.CropBottom);\r
}\r
+\r
+ if (preset.Task.MaxHeight.HasValue)\r
+ {\r
+ if (this.Height > this.MaxHeight)\r
+ {\r
+ this.Height = this.MaxHeight;\r
+ }\r
+ else\r
+ {\r
+ this.Height = preset.Task.Height ?? this.getRes((sourceResolution.Height - this.CropTop - this.CropBottom), this.MaxHeight);\r
+ }\r
+ } \r
else\r
{\r
- this.Width = preset.Task.Width ?? (sourceResolution.Width - this.CropLeft - this.CropRight);\r
this.Height = preset.Task.Height ?? (sourceResolution.Height - this.CropTop - this.CropBottom);\r
}\r
\r
+ // Anamorphic\r
if (preset.Task.Anamorphic == Anamorphic.Custom)\r
{\r
this.DisplayWidth = preset.Task.DisplayWidth != null ? int.Parse(preset.Task.DisplayWidth.ToString()) : 0;\r
this.sourceParValues = title.ParVal;\r
this.sourceResolution = title.Resolution;\r
\r
+ // Set the Max Width / Height available to the user controls\r
+ if (sourceResolution.Width < this.MaxWidth)\r
+ {\r
+ this.MaxWidth = sourceResolution.Width;\r
+ } \r
+ else if (sourceResolution.Width > this.MaxWidth)\r
+ {\r
+ this.MaxWidth = preset.Task.MaxWidth ?? sourceResolution.Width;\r
+ }\r
+\r
+ if (sourceResolution.Height < this.MaxHeight)\r
+ {\r
+ this.MaxHeight = sourceResolution.Height;\r
+ }\r
+ else if (sourceResolution.Height > this.MaxHeight)\r
+ {\r
+ this.MaxHeight = preset.Task.MaxHeight ?? sourceResolution.Height;\r
+ }\r
+\r
// Set Screen Controls\r
this.SourceInfo = string.Format(\r
"{0}x{1}, Aspect Ratio: {2:0.00}", \r
}\r
}\r
\r
+ /// <summary>\r
+ /// Quick function to get the max resolution value\r
+ /// </summary>\r
+ /// <param name="value">\r
+ /// The value.\r
+ /// </param>\r
+ /// <param name="max">\r
+ /// The max.\r
+ /// </param>\r
+ /// <returns>\r
+ /// An Int\r
+ /// </returns>\r
+ private int getRes(int value, int max)\r
+ {\r
+ if (value > max)\r
+ {\r
+ return max;\r
+ }\r
+ else\r
+ {\r
+ return value;\r
+ }\r
+\r
+ return 0;\r
+ }\r
+\r
#endregion\r
}\r
}
\ No newline at end of file