16:9 and 16:10 crop helper

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
bivy
Posts: 1
Joined: Sun Oct 13, 2013 8:58 pm

16:9 and 16:10 crop helper

Post by bivy »

I added couple buttons to make cropping easier to 16:10 and 16:9.
Sorry, only for windows, don't know how to do it for other platforms.
I think it is worth making a setting that can be set for all sources automatically on opening input file.
Please let me know what you think about this.

Code: Select all

Index: win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
===================================================================
--- win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs	(revision 5835)
+++ win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs	(working copy)
@@ -807,6 +807,18 @@
 
         #region Methods
 
+        public void SetCropWidescreen()
+        {
+            CropLeft = (sourceResolution.Width - sourceResolution.Height * 16 / 10) / 2;
+            CropRight = (sourceResolution.Width - sourceResolution.Height * 16 / 10) / 2;
+        }
+
+        public void SetCropUWidescreen()
+        {
+            CropLeft = (sourceResolution.Width - sourceResolution.Height * 16 / 9) / 2;
+            CropRight = (sourceResolution.Width - sourceResolution.Height * 16 / 9) / 2;
+        }
+
         /// <summary>
         /// The crop adjust.
         /// </summary>
Index: win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml
===================================================================
--- win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml	(revision 5835)
+++ win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml	(working copy)
@@ -2,6 +2,7 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
+             xmlns:cal="http://www.caliburnproject.org"
              xmlns:controls="clr-namespace:HandBrakeWPF.Controls">
 
     <UserControl.Resources>
@@ -106,6 +107,10 @@
             <Label Content="Cropping" FontWeight="Bold" />
             <RadioButton Content="Automatic" IsChecked="{Binding IsCustomCrop, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="10,0,0,0"/>
             <RadioButton Content="Custom" IsChecked="{Binding IsCustomCrop}" Margin="10,5,0,0" />
+            <StackPanel Height="30" Width="100" Orientation="Horizontal" IsEnabled="{Binding IsCustomCrop}">
+                <Button Content="16:10" Width="50" Margin="0,0,0,0" cal:Message.Attach="[Event Click] = [Action SetCropWidescreen]"  />
+                <Button Content="16:9" Width="50" Margin="0,0,0,0"  cal:Message.Attach="[Event Click] = [Action SetCropUWidescreen]"/>
+            </StackPanel>
 
             <Grid Margin="0,10,0,0">
                 <Grid.RowDefinitions>
BlueCrypt

Re: 16:9 and 16:10 crop helper

Post by BlueCrypt »

Sorry, only for windows, don't know how to do it for other platforms.
Don't worry! This is quite common.

That's why I am working to do exactly the opposed. For many reasons ($).
Post Reply