summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-01-09 22:49:50 +0000
committersr55 <[email protected]>2010-01-09 22:49:50 +0000
commit52413428ae29b701202853b602ae073928e5b5ab (patch)
tree51e392bae42764d4a6558c71b1659f77d6afdba9 /win
parent33b1c3f11e430dc483a8d3f2af5efb2b3f93d989 (diff)
WinGui:
- If crop values are stored in the preset and the user has decided to enable them in the preset, the gui will not longer reset the crop panel on title change. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3062 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/C#/Controls/PictureSettings.cs34
-rw-r--r--win/C#/Presets/PresetsHandler.cs6
-rw-r--r--win/C#/frmMain.cs9
3 files changed, 38 insertions, 11 deletions
diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs
index d46efb8f2..a0c269f5e 100644
--- a/win/C#/Controls/PictureSettings.cs
+++ b/win/C#/Controls/PictureSettings.cs
@@ -4,6 +4,7 @@ using System.Drawing;
using System.Globalization;
using System.Windows.Forms;
using Handbrake.Parsing;
+using Handbrake.Presets;
namespace Handbrake.Controls
{
@@ -42,11 +43,21 @@ namespace Handbrake.Controls
lbl_Aspect.Text = _sourceTitle.AspectRatio.ToString(Culture);
lbl_src_res.Text = _sourceTitle.Resolution.Width + " x " + _sourceTitle.Resolution.Height;
- // Set the Recommended Cropping values
- crop_top.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[0]);
- crop_bottom.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[1]);
- crop_left.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[2]);
- crop_right.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[3]);
+ // Set the Recommended Cropping values, but only if a preset doesn't have hard set picture settings.
+ if (CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false)
+ {
+ crop_top.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[0]);
+ crop_bottom.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[1]);
+ crop_left.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[2]);
+ crop_right.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[3]);
+ }
+ else if (CurrentlySelectedPreset == null )
+ {
+ crop_top.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[0]);
+ crop_bottom.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[1]);
+ crop_left.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[2]);
+ crop_right.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[3]);
+ }
// Set the Resolution Boxes
if (drp_anamorphic.SelectedIndex == 0)
@@ -74,12 +85,17 @@ namespace Handbrake.Controls
Size croppedDar = CalculateAnamorphicSizes();
- _cachedDar = (double) croppedDar.Width/croppedDar.Height;
+ _cachedDar = (double)croppedDar.Width / croppedDar.Height;
updownDisplayWidth.Value = croppedDar.Width;
}
}
/// <summary>
+ /// Which preset is currently selected by the user.
+ /// </summary>
+ public Preset CurrentlySelectedPreset { get; set; }
+
+ /// <summary>
/// Gets or sets the maximum allowable size for the encoded resolution. Set a value to
/// "0" if the maximum does not matter.
/// </summary>
@@ -269,7 +285,7 @@ namespace Handbrake.Controls
// Calculate new Height Value
int modulus;
- if(!int.TryParse(drp_modulus.SelectedItem.ToString(), out modulus))
+ if (!int.TryParse(drp_modulus.SelectedItem.ToString(), out modulus))
modulus = 16;
int rawCalculatedHeight = (int)((int)updownDisplayWidth.Value / _cachedDar);
@@ -451,7 +467,7 @@ namespace Handbrake.Controls
- Uses mod16-compliant dimensions,
- Allows users to set the width
*/
- width = (int) text_width.Value;
+ width = (int)text_width.Value;
width = GetModulusValue(width); /* Time to get picture width that divide cleanly.*/
height = (width / storage_aspect) + 0.5;
@@ -506,7 +522,7 @@ namespace Handbrake.Controls
// Hidden UI feature to drop the MaxWidth / Height with the MaxWidth/Height label is double clicked
private void lbl_max_DoubleClick(object sender, EventArgs e)
{
- PresetMaximumResolution = new Size(0,0);
+ PresetMaximumResolution = new Size(0, 0);
if (PictureSettingsChanged != null)
PictureSettingsChanged(this, new EventArgs());
}
diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs
index 05c0243ab..a26538b73 100644
--- a/win/C#/Presets/PresetsHandler.cs
+++ b/win/C#/Presets/PresetsHandler.cs
@@ -167,13 +167,17 @@ namespace Handbrake.Presets
Regex r = new Regex("(: )"); // Split on hyphens.
string[] presetName = r.Split(line);
+ bool pic = false;
+ if (presetName[2].Contains("crop"))
+ pic = true;
+
Preset newPreset = new Preset
{
Category = category,
Name = presetName[0].Replace("+", "").Trim(),
Query = presetName[2],
Version = Properties.Settings.Default.hb_version,
- PictureSettings = true
+ PictureSettings = pic
};
_presets.Add(newPreset);
}
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index b6fda2d32..546ef4efb 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -37,6 +37,7 @@ namespace Handbrake
private SourceType selectedSourceType;
private string dvdDrivePath;
private string dvdDriveLabel;
+ private Preset CurrentlySelectedPreset;
// Delegates **********************************************************
private delegate void UpdateWindowHandler();
@@ -283,6 +284,7 @@ namespace Handbrake
private void changePresetLabel(object sender, EventArgs e)
{
labelPreset.Text = "Output Settings (Preset: Custom)";
+ CurrentlySelectedPreset = null;
}
private static void frmMain_DragEnter(object sender, DragEventArgs e)
@@ -578,7 +580,8 @@ namespace Handbrake
{
// Ok, so, we've selected a preset. Now we want to load it.
string presetName = treeView_presets.SelectedNode.Text;
- if (presetHandler.GetPreset(presetName) != null)
+ Preset preset = presetHandler.GetPreset(presetName);
+ if (preset != null)
{
string query = presetHandler.GetPreset(presetName).Query;
Boolean loadPictureSettings = presetHandler.GetPreset(presetName).PictureSettings;
@@ -597,6 +600,9 @@ namespace Handbrake
// The x264 widgets will need updated, so do this now:
x264Panel.X264_StandardizeOptString();
x264Panel.X264_SetCurrentSettingsInPanel();
+
+ // Finally, let this window have a copy of the preset settings.
+ CurrentlySelectedPreset = preset;
}
}
}
@@ -903,6 +909,7 @@ namespace Handbrake
{
selectedTitle = drp_dvdtitle.SelectedItem as Title;
lbl_duration.Text = selectedTitle.Duration.ToString();
+ PictureSettings.CurrentlySelectedPreset = CurrentlySelectedPreset;
PictureSettings.Source = selectedTitle; // Setup Picture Settings Tab Control
// Populate the Angles dropdown