/// <summary>
        /// Setup this window for a new source
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="preset">
        /// The preset.
        /// </param>
        /// <param name="task">
        /// The task.
        /// </param>
        public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
        {
            this.currentTitle = title;
            this.Task = task;

            this.scannedSource = source;

            if (title != null)
            {
                // Set cached info
                this.sourceParValues = title.ParVal;
                this.sourceResolution = title.Resolution;

                // Update the cropping values, preffering those in the presets.
                if (!preset.Task.HasCropping)
                {
                    this.Task.Cropping.Top = title.AutoCropDimensions.Top;
                    this.Task.Cropping.Bottom = title.AutoCropDimensions.Bottom;
                    this.Task.Cropping.Left = title.AutoCropDimensions.Left;
                    this.Task.Cropping.Right = title.AutoCropDimensions.Right;
                    this.IsCustomCrop = false;
                }
                else
                {
                    this.Task.Cropping.Left = preset.Task.Cropping.Left;
                    this.Task.Cropping.Right = preset.Task.Cropping.Right;
                    this.Task.Cropping.Top = preset.Task.Cropping.Top;
                    this.Task.Cropping.Bottom = preset.Task.Cropping.Bottom;
                    this.IsCustomCrop = true;
                }

                if (preset.PictureSettingsMode == PresetPictureSettingsMode.None)
                {
                    // We have no instructions, so simply set it to the source.
                    this.Task.Width = this.GetModulusValue(this.sourceResolution.Width - this.CropLeft - this.CropRight);
                    this.MaintainAspectRatio = true;
                }
                else
                {
                    // Set the Max Width / Height available to the user controls
                    if (this.sourceResolution.Width < this.MaxWidth)
                    {
                        this.MaxWidth = this.sourceResolution.Width;
                    }
                    else if (this.sourceResolution.Width > this.MaxWidth)
                    {
                        this.MaxWidth = preset.Task.MaxWidth ?? this.sourceResolution.Width;
                    }

                    if (this.sourceResolution.Height < this.MaxHeight)
                    {
                        this.MaxHeight = this.sourceResolution.Height;
                    }
                    else if (this.sourceResolution.Height > this.MaxHeight)
                    {
                        this.MaxHeight = preset.Task.MaxHeight ?? this.sourceResolution.Height;
                    }

                    // Set the Width, and Maintain Aspect ratio. That should calc the Height for us.
                    if (this.SelectedAnamorphicMode == Anamorphic.None)
                    {
                        this.Task.Width = preset.Task.Width ?? (this.MaxWidth - this.CropLeft - this.CropRight);
                        // Note: This will be auto-corrected in the property if it's too large.
                    }
                    else
                    {
                        this.Task.Width = preset.Task.Width ?? this.MaxWidth;

                        int cropHeight = this.Task.Cropping.Top + this.Task.Cropping.Bottom;
                        this.Task.Height = (preset.Task.Height ?? this.MaxHeight) - cropHeight;
                    }

                    // If our height is too large, let it downscale the width for us by setting the height to the lower value.
                    if (!this.MaintainAspectRatio && this.Height > this.MaxHeight)
                    {
                        this.Task.Height = this.MaxHeight;
                    }
                }

                // Set Screen Controls
                this.SourceInfo = string.Format(
                    "{0}x{1}, PAR: {2}/{3}",
                    title.Resolution.Width,
                    title.Resolution.Height,
                    title.ParVal.Width,
                    title.ParVal.Height);

                this.RecaulcatePictureSettingsProperties(ChangedPictureField.Width);
            }

            this.NotifyOfPropertyChange(() => this.Task);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.PictureSettingsViewModel"/> class.
 /// </summary>
 public PictureSettingsViewModel()
 {
     this.sourceResolution = new Size(0, 0);
     this.Task = new EncodeTask();
     this.Init();
 }