]> granicus.if.org Git - handbrake/commitdiff
WinGui: Adding support for Custom Anamorphic back. Implements #504
authorsr55 <sr55.hb@outlook.com>
Wed, 28 Jun 2017 18:53:53 +0000 (19:53 +0100)
committersr55 <sr55.hb@outlook.com>
Wed, 28 Jun 2017 18:53:53 +0000 (19:53 +0100)
win/CS/HandBrakeWPF/Helpers/PictureSize.cs
win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs
win/CS/HandBrakeWPF/Properties/ResourcesUI.resx
win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml

index 93b85e6e4d2c308e3fcd4d1b4512e3a58277962e..896add53e8ba9eaf269d7707c4799d955c3baf4f 100644 (file)
@@ -9,8 +9,6 @@
 \r
 namespace HandBrakeWPF.Helpers\r
 {\r
-    using System.Diagnostics;\r
-\r
     using HandBrake.ApplicationServices.Interop.HbLib;\r
     using HandBrake.ApplicationServices.Interop.Model;\r
     using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
index 6ca2f276e4f42091948c77d869c4c8036efb2678..75fc8ba41d2829a30ce401dd9e40ef00bc514bd1 100644 (file)
@@ -1645,20 +1645,11 @@ namespace HandBrakeWPF.Properties {
         }\r
         \r
         /// <summary>\r
-        ///   Looks up a localized string similar to PAR Height:.\r
+        ///   Looks up a localized string similar to PAR:.\r
         /// </summary>\r
-        public static string PictureSettingsView_ParH {\r
+        public static string PictureSettingsView_PAR {\r
             get {\r
-                return ResourceManager.GetString("PictureSettingsView_ParH", resourceCulture);\r
-            }\r
-        }\r
-        \r
-        /// <summary>\r
-        ///   Looks up a localized string similar to PAR Width:.\r
-        /// </summary>\r
-        public static string PictureSettingsView_ParW {\r
-            get {\r
-                return ResourceManager.GetString("PictureSettingsView_ParW", resourceCulture);\r
+                return ResourceManager.GetString("PictureSettingsView_PAR", resourceCulture);\r
             }\r
         }\r
         \r
index 6349d49784fed99b6e4869e1a1717ad5eea24066..2e12b14ef588146aa51586130c578faaa5d78445 100644 (file)
   <data name="PictureSettingsView_Output" xml:space="preserve">\r
     <value>Output</value>\r
   </data>\r
-  <data name="PictureSettingsView_ParH" xml:space="preserve">\r
-    <value>PAR Height:</value>\r
-  </data>\r
-  <data name="PictureSettingsView_ParW" xml:space="preserve">\r
-    <value>PAR Width:</value>\r
+  <data name="PictureSettingsView_PAR" xml:space="preserve">\r
+    <value>PAR:</value>\r
   </data>\r
   <data name="PictureSettingsView_Right" xml:space="preserve">\r
     <value>Right</value>\r
index 97de36a3ccfb18a6cc7e7db3527218265e5fea9e..42cbf094329bd26e0e678daa08b187f08106318f 100644 (file)
@@ -147,7 +147,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             get\r
             {\r
-                return new List<Anamorphic> { Anamorphic.None, Anamorphic.Automatic, Anamorphic.Loose }; // , Anamorphic.Custom   TODO Re-enable one the UI is re-worked.\r
+                return new List<Anamorphic> { Anamorphic.None, Anamorphic.Automatic, Anamorphic.Loose, Anamorphic.Custom };\r
             }\r
         }\r
 \r
@@ -855,7 +855,6 @@ namespace HandBrakeWPF.ViewModels
                 Height = this.sourceResolution.Height,\r
                 ParW = this.sourceParValues.Width,\r
                 ParH = this.sourceParValues.Height,\r
-                Aspect = 0 // TODO\r
             };\r
 \r
             return title;\r
@@ -881,8 +880,6 @@ namespace HandBrakeWPF.ViewModels
                 MaxHeight = this.MaxHeight,\r
                 KeepDisplayAspect = this.MaintainAspectRatio,\r
                 AnamorphicMode = this.SelectedAnamorphicMode,\r
-                DarWidth = 0,\r
-                DarHeight = 0,\r
                 Crop = new Cropping(this.CropTop, this.CropBottom, this.CropLeft, this.CropRight),\r
             };\r
 \r
@@ -892,6 +889,12 @@ namespace HandBrakeWPF.ViewModels
                 job.ParH = sourceParValues.Height;\r
             }\r
 \r
+            if (SelectedAnamorphicMode == Anamorphic.Custom)\r
+            {\r
+                job.ParW = this.DisplayWidth;  // num\r
+                job.ParH = this.Width; // den\r
+            }\r
+\r
             return job;\r
         }\r
 \r
@@ -948,9 +951,15 @@ namespace HandBrakeWPF.ViewModels
                            ? string.Empty\r
                            : string.Format(Resources.PictureSettingsViewModel_StorageDisplayLabel, dispWidth, result.OutputHeight, this.ParWidth, this.ParHeight);\r
 \r
+            if (changedField != ChangedPictureField.DisplayWidth)\r
+            {\r
+                this.Task.DisplayWidth = (int)dispWidth;\r
+            }\r
+\r
             // Step 4, Force an update on all the UI elements.\r
             this.NotifyOfPropertyChange(() => this.Width);\r
             this.NotifyOfPropertyChange(() => this.Height);\r
+            this.NotifyOfPropertyChange(() => this.DisplayWidth);\r
             this.NotifyOfPropertyChange(() => this.ParWidth);\r
             this.NotifyOfPropertyChange(() => this.ParHeight);\r
             this.NotifyOfPropertyChange(() => this.CropTop);\r
@@ -1006,8 +1015,8 @@ namespace HandBrakeWPF.ViewModels
                     this.HeightControlEnabled = true;\r
                     this.ShowCustomAnamorphicControls = true;\r
                     this.ShowModulus = true;\r
-                    this.ShowDisplaySize = false;\r
-                    this.ShowKeepAR = false;\r
+                    this.ShowDisplaySize = true;\r
+                    this.ShowKeepAR = true;\r
                     break;\r
             }\r
         }\r
index b0ed03da98ec621579ea21d6369a24ca8e9305bc..c6e19a89b5a61a1bf5ea7d5ac5df5b712d2b7b85 100644 (file)
                     </Grid.ColumnDefinitions>\r
 \r
                     <Label Content="{x:Static Properties:ResourcesUI.PictureSettingsView_DisplayWitdh}" Grid.Row="0" Grid.Column="0" />\r
-                    <Label Content="{x:Static Properties:ResourcesUI.PictureSettingsView_ParW}" Grid.Row="1" Grid.Column="0" />\r
-                    <Label Content="{x:Static Properties:ResourcesUI.PictureSettingsView_ParH}" Grid.Row="2" Grid.Column="0" />\r
+                    <Label Content="{x:Static Properties:ResourcesUI.PictureSettingsView_PAR}" Grid.Row="1" Grid.Column="0" />\r
 \r
                     <controls:NumberBox Width="60" Number="{Binding DisplayWidth, Mode=TwoWay}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" \r
                                     AllowEmpty="False" />\r
-                    <controls:NumberBox Width="60" Number="{Binding ParWidth, Mode=TwoWay}" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" AllowEmpty="False"\r
-                                             IsEnabled="{Binding MaintainAspectRatio, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,0,5"\r
-                                             ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_PAR}"/>\r
-                    <controls:NumberBox Width="60" Number="{Binding ParHeight, Mode=TwoWay}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" AllowEmpty="False"\r
-                                             IsEnabled="{Binding MaintainAspectRatio, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,0,5"\r
-                                             ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_PAR}"/>\r
+                    <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">\r
+                        <controls:NumberBox Width="60" Number="{Binding ParWidth, Mode=TwoWay}" HorizontalAlignment="Left" AllowEmpty="False"\r
+                                                 IsEnabled="{Binding MaintainAspectRatio, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,0,5"\r
+                                                 ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_PAR}"/>\r
+                        <TextBlock Text="X" Margin="10,0,10,0" />\r
+                        <controls:NumberBox Width="60" Number="{Binding ParHeight, Mode=TwoWay}"  HorizontalAlignment="Left" AllowEmpty="False"\r
+                                                 IsEnabled="{Binding MaintainAspectRatio, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,0,5"\r
+                                                 ToolTip="{x:Static Properties:ResourcesTooltips.PictureSettingsView_PAR}"/>\r
+                    </StackPanel>\r
                 </Grid>\r
 \r
             </StackPanel>\r