From 24203717648fcdeff506ac6aea100d746f7b487c Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 17 May 2014 21:27:20 +0000 Subject: WinGui: Give the preview window a presence on the picture settings tab. Added some initial code to manage the window size. (Note, this is not complete or DPI aware yet) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6197 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../ViewModels/StaticPreviewViewModel.cs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs') diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index fd683fc2a..279cc6fc8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels { using System; + using System.Windows; using System.Windows.Media.Imaging; using HandBrake.ApplicationServices.Model; @@ -22,6 +23,12 @@ namespace HandBrakeWPF.ViewModels /// public class StaticPreviewViewModel : ViewModelBase, IStaticPreviewViewModel { + /* + * TODO + * - Screen needs to be made DPI Aware + * - Integrate Video Preview panel. + */ + #region Fields /// @@ -63,6 +70,7 @@ namespace HandBrakeWPF.ViewModels { this.scanService = scanService; this.selectedPreviewImage = 1; + this.Title = Properties.Resources.Preview; } #endregion @@ -172,11 +180,18 @@ namespace HandBrakeWPF.ViewModels #region Public Methods and Operators + /// + /// The update preview frame. + /// + /// + /// The task. + /// public void UpdatePreviewFrame(EncodeTask task) { this.Task = task; this.UpdatePreviewFrame(); this.DisplayName = "Picture Preview"; + this.Title = Properties.Resources.Preview; } /// @@ -193,6 +208,28 @@ namespace HandBrakeWPF.ViewModels this.PreviewImage = image; } } + + /// + /// The preview size changed. + /// + /// + /// The ea. + /// + public void PreviewSizeChanged(SizeChangedEventArgs ea) + { + Rect workArea = SystemParameters.WorkArea; + if (ea.NewSize.Width > workArea.Width) + { + this.Width = (int)Math.Round(workArea.Width, 0) - 20; + this.Title = Properties.Resources.Preview_Scaled; + } + + if (ea.NewSize.Height > workArea.Height) + { + this.Height = (int)Math.Round(workArea.Height, 0) - 20; + this.Title = Properties.Resources.Preview_Scaled; + } + } #endregion } } \ No newline at end of file -- cgit v1.2.3