summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-07-04 17:50:37 +0000
committersr55 <[email protected]>2010-07-04 17:50:37 +0000
commit7139bd97551c5f8a521295599f0bf294a00cd3dd (patch)
tree075518b4ab1565c438fcd41b398263e60be96e99
parentdaec13f6144419aa5efdada8598500f2d48cefac (diff)
WinGui:
- Next step in the new Add Presets Window. Now added Picture Size modes "None" and "Source Maximum". Note cropping values are stored with "Source Maximum" if custom crop is selected. Also included option to include filter settings. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3425 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/C#/Controls/PictureSettings.Designer.cs2
-rw-r--r--win/C#/Controls/PictureSettings.cs15
-rw-r--r--win/C#/Functions/PresetLoader.cs29
-rw-r--r--win/C#/Functions/QueryGenerator.cs2
-rw-r--r--win/C#/Presets/Preset.cs4
-rw-r--r--win/C#/Presets/PresetsHandler.cs12
-rw-r--r--win/C#/frmAddPreset.Designer.cs135
-rw-r--r--win/C#/frmAddPreset.cs59
-rw-r--r--win/C#/frmMain.Designer.cs2
-rw-r--r--win/C#/frmMain.cs32
10 files changed, 157 insertions, 135 deletions
diff --git a/win/C#/Controls/PictureSettings.Designer.cs b/win/C#/Controls/PictureSettings.Designer.cs
index 83dfc9baf..21c796daf 100644
--- a/win/C#/Controls/PictureSettings.Designer.cs
+++ b/win/C#/Controls/PictureSettings.Designer.cs
@@ -610,7 +610,7 @@ namespace Handbrake.Controls
this.lbl_presetCropWarning.TabIndex = 118;
this.lbl_presetCropWarning.Text = "( Preset values are in use! )";
//
- // PictureSettings
+ // CropSettings
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.BackColor = System.Drawing.Color.Transparent;
diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs
index 1528d07b7..e0319a690 100644
--- a/win/C#/Controls/PictureSettings.cs
+++ b/win/C#/Controls/PictureSettings.cs
@@ -81,11 +81,16 @@ namespace Handbrake.Controls
/// </param>
public void SetPresetCropWarningLabel(Preset selectedPreset)
{
- lbl_presetCropWarning.Visible = true;
- if (selectedPreset != null && selectedPreset.PictureSettings == false)
- lbl_presetCropWarning.Visible = false;
- else if (selectedPreset == null)
+ if (this.check_customCrop.Checked)
+ {
+ lbl_presetCropWarning.Visible = true;
+ if (selectedPreset != null && selectedPreset.CropSettings == false) lbl_presetCropWarning.Visible = false;
+ else if (selectedPreset == null) lbl_presetCropWarning.Visible = false;
+ }
+ else
+ {
lbl_presetCropWarning.Visible = false;
+ }
}
/// <summary>
@@ -97,7 +102,7 @@ namespace Handbrake.Controls
lbl_src_res.Text = sourceTitle.Resolution.Width + " x " + sourceTitle.Resolution.Height;
// Set the Recommended Cropping values, but only if a preset doesn't have hard set picture settings.
- if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) || CurrentlySelectedPreset == null)
+ if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.CropSettings == false) || CurrentlySelectedPreset == null)
{
crop_top.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Top);
crop_bottom.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Bottom);
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs
index 9b6d154ad..649804914 100644
--- a/win/C#/Functions/PresetLoader.cs
+++ b/win/C#/Functions/PresetLoader.cs
@@ -29,7 +29,7 @@ namespace Handbrake.Functions
/// <param name="pictureSettings">
/// Save picture settings in the preset
/// </param>
- public static void LoadPreset(frmMain mainWindow, QueryParser presetQuery, string name, bool pictureSettings)
+ public static void LoadPreset(frmMain mainWindow, QueryParser presetQuery, string name)
{
#region Source
@@ -83,22 +83,19 @@ namespace Handbrake.Functions
#region Picture
mainWindow.PictureSettings.check_autoCrop.Checked = true;
- if (pictureSettings) // only Load picture settings if the perset requires it
+ if (presetQuery.CropValues != null)
{
- if (presetQuery.CropValues != null)
- {
- int top, bottom, left, right;
- int.TryParse(presetQuery.CropTop, out top);
- int.TryParse(presetQuery.CropBottom, out bottom);
- int.TryParse(presetQuery.CropLeft, out left);
- int.TryParse(presetQuery.CropRight, out right);
-
- mainWindow.PictureSettings.check_customCrop.Checked = true;
- mainWindow.PictureSettings.crop_top.Value = top;
- mainWindow.PictureSettings.crop_bottom.Value = bottom;
- mainWindow.PictureSettings.crop_left.Value = left;
- mainWindow.PictureSettings.crop_right.Value = right;
- }
+ int top, bottom, left, right;
+ int.TryParse(presetQuery.CropTop, out top);
+ int.TryParse(presetQuery.CropBottom, out bottom);
+ int.TryParse(presetQuery.CropLeft, out left);
+ int.TryParse(presetQuery.CropRight, out right);
+
+ mainWindow.PictureSettings.check_customCrop.Checked = true;
+ mainWindow.PictureSettings.crop_top.Value = top;
+ mainWindow.PictureSettings.crop_bottom.Value = bottom;
+ mainWindow.PictureSettings.crop_left.Value = left;
+ mainWindow.PictureSettings.crop_right.Value = right;
}
// Set the anamorphic mode 0,1,2,3
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index f29bdd4fe..2c4706f71 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -219,7 +219,7 @@ namespace Handbrake.Functions
string cropLeft = mainWindow.PictureSettings.crop_left.Text;
string cropRight = mainWindow.PictureSettings.crop_right.Text;
- if (mainWindow.PictureSettings.check_customCrop.Checked)
+ if (mainWindow.PictureSettings.check_customCrop.Checked && mode != QueryPictureSettingsMode.None)
{
if (mainWindow.PictureSettings.crop_top.Text == string.Empty)
cropTop = "0";
diff --git a/win/C#/Presets/Preset.cs b/win/C#/Presets/Preset.cs
index bf41e4719..024d31667 100644
--- a/win/C#/Presets/Preset.cs
+++ b/win/C#/Presets/Preset.cs
@@ -5,8 +5,6 @@
namespace Handbrake.Presets
{
- using System.Windows.Controls;
-
/// <summary>
/// A Preset
/// </summary>
@@ -30,7 +28,7 @@ namespace Handbrake.Presets
/// <summary>
/// Gets or sets a value indicating whether to use picture Settings in presets.
/// </summary>
- public bool PictureSettings { get; set; }
+ public bool CropSettings { get; set; }
/// <summary>
/// Gets or sets The version number which associates this preset with a HB build
diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs
index 1a47a4dd8..971a47859 100644
--- a/win/C#/Presets/PresetsHandler.cs
+++ b/win/C#/Presets/PresetsHandler.cs
@@ -46,6 +46,11 @@ namespace Handbrake.Presets
private List<Preset> userPresets = new List<Preset>();
/// <summary>
+ /// Last preset added
+ /// </summary>
+ public Preset LastPresetAdded { get; set; }
+
+ /// <summary>
/// Add a new preset to the system
/// </summary>
/// <param name="presetName">
@@ -68,11 +73,12 @@ namespace Handbrake.Presets
{
Name = presetName,
Query = query,
- PictureSettings = pictureSettings,
+ CropSettings = pictureSettings,
Version = Properties.Settings.Default.hb_version
};
this.userPresets.Add(newPreset);
this.UpdatePresetFiles();
+ this.LastPresetAdded = newPreset;
return true;
}
return false;
@@ -135,7 +141,7 @@ namespace Handbrake.Presets
if (item.Name == presetName)
{
item.Query = query;
- item.PictureSettings = pictureSettings;
+ item.CropSettings = pictureSettings;
MessageBox.Show(
"Changes to \"" + presetName + "\" Saved",
"Success",
@@ -216,7 +222,7 @@ namespace Handbrake.Presets
Name = presetName[0].Replace("+", string.Empty).Trim(),
Query = presetName[2],
Version = Properties.Settings.Default.hb_version,
- PictureSettings = pic
+ CropSettings = pic
};
this.presets.Add(newPreset);
}
diff --git a/win/C#/frmAddPreset.Designer.cs b/win/C#/frmAddPreset.Designer.cs
index 348c430b9..530122101 100644
--- a/win/C#/frmAddPreset.Designer.cs
+++ b/win/C#/frmAddPreset.Designer.cs
@@ -40,18 +40,17 @@ namespace Handbrake
this.txt_preset_name = new System.Windows.Forms.TextBox();
this.btn_add = new System.Windows.Forms.Button();
this.btn_cancel = new System.Windows.Forms.Button();
- this.check_pictureSettings = new System.Windows.Forms.CheckBox();
+ this.check_useFilters = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
- this.label1 = new System.Windows.Forms.Label();
- this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
- this.tableLayoutPanel1.SuspendLayout();
+ this.cb_usePictureSettings = new System.Windows.Forms.ComboBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lbl_name
//
- this.lbl_name.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lbl_name.AutoSize = true;
- this.lbl_name.Location = new System.Drawing.Point(3, 7);
+ this.lbl_name.Location = new System.Drawing.Point(12, 18);
this.lbl_name.Name = "lbl_name";
this.lbl_name.Size = new System.Drawing.Size(75, 13);
this.lbl_name.TabIndex = 1;
@@ -59,21 +58,18 @@ namespace Handbrake
//
// txt_preset_name
//
- this.txt_preset_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
- this.tableLayoutPanel1.SetColumnSpan(this.txt_preset_name, 2);
- this.txt_preset_name.Location = new System.Drawing.Point(84, 3);
+ this.txt_preset_name.Location = new System.Drawing.Point(130, 15);
this.txt_preset_name.Name = "txt_preset_name";
- this.txt_preset_name.Size = new System.Drawing.Size(208, 21);
+ this.txt_preset_name.Size = new System.Drawing.Size(172, 21);
this.txt_preset_name.TabIndex = 0;
//
// btn_add
//
- this.btn_add.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_add.BackColor = System.Drawing.Color.Transparent;
this.btn_add.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_add.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_add.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_add.Location = new System.Drawing.Point(172, 72);
+ this.btn_add.Location = new System.Drawing.Point(185, 133);
this.btn_add.Name = "btn_add";
this.btn_add.Size = new System.Drawing.Size(57, 22);
this.btn_add.TabIndex = 2;
@@ -87,7 +83,7 @@ namespace Handbrake
this.btn_cancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_cancel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_cancel.Location = new System.Drawing.Point(235, 72);
+ this.btn_cancel.Location = new System.Drawing.Point(248, 133);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(57, 22);
this.btn_cancel.TabIndex = 3;
@@ -95,55 +91,48 @@ namespace Handbrake
this.btn_cancel.UseVisualStyleBackColor = false;
this.btn_cancel.Click += new System.EventHandler(this.BtnCancelClick);
//
- // check_pictureSettings
- //
- this.check_pictureSettings.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.check_pictureSettings.AutoSize = true;
- this.tableLayoutPanel1.SetColumnSpan(this.check_pictureSettings, 2);
- this.check_pictureSettings.Location = new System.Drawing.Point(84, 30);
- this.check_pictureSettings.Name = "check_pictureSettings";
- this.check_pictureSettings.Size = new System.Drawing.Size(132, 17);
- this.check_pictureSettings.TabIndex = 1;
- this.check_pictureSettings.Text = "Store Cropping Values";
- this.toolTip.SetToolTip(this.check_pictureSettings, "Save Picture Width/Height and Crop Values");
- this.check_pictureSettings.UseVisualStyleBackColor = true;
- //
- // label1
- //
- this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.label1.AutoSize = true;
- this.tableLayoutPanel1.SetColumnSpan(this.label1, 2);
- this.label1.Location = new System.Drawing.Point(84, 53);
- this.label1.Margin = new System.Windows.Forms.Padding(3);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(200, 13);
- this.label1.TabIndex = 4;
- this.label1.Text = "Note: Subtitles are not stored in presets";
- //
- // tableLayoutPanel1
- //
- this.tableLayoutPanel1.AutoSize = true;
- this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.tableLayoutPanel1.ColumnCount = 3;
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
- this.tableLayoutPanel1.Controls.Add(this.lbl_name, 0, 0);
- this.tableLayoutPanel1.Controls.Add(this.btn_cancel, 2, 3);
- this.tableLayoutPanel1.Controls.Add(this.label1, 1, 2);
- this.tableLayoutPanel1.Controls.Add(this.btn_add, 1, 3);
- this.tableLayoutPanel1.Controls.Add(this.txt_preset_name, 1, 0);
- this.tableLayoutPanel1.Controls.Add(this.check_pictureSettings, 1, 1);
- this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel1.Location = new System.Drawing.Point(9, 9);
- this.tableLayoutPanel1.Name = "tableLayoutPanel1";
- this.tableLayoutPanel1.RowCount = 4;
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tableLayoutPanel1.Size = new System.Drawing.Size(295, 125);
- this.tableLayoutPanel1.TabIndex = 5;
+ // check_useFilters
+ //
+ this.check_useFilters.AutoSize = true;
+ this.check_useFilters.Location = new System.Drawing.Point(130, 106);
+ this.check_useFilters.Name = "check_useFilters";
+ this.check_useFilters.Size = new System.Drawing.Size(112, 17);
+ this.check_useFilters.TabIndex = 1;
+ this.check_useFilters.Text = "Use Picture Filters";
+ this.toolTip.SetToolTip(this.check_useFilters, "Save Picture Width/Height and Crop Values");
+ this.check_useFilters.UseVisualStyleBackColor = true;
+ //
+ // cb_usePictureSettings
+ //
+ this.cb_usePictureSettings.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cb_usePictureSettings.FormattingEnabled = true;
+ this.cb_usePictureSettings.Items.AddRange(new object[] {
+ "None",
+ "Source Maximum"});
+ this.cb_usePictureSettings.Location = new System.Drawing.Point(130, 79);
+ this.cb_usePictureSettings.Name = "cb_usePictureSettings";
+ this.cb_usePictureSettings.Size = new System.Drawing.Size(172, 21);
+ this.cb_usePictureSettings.TabIndex = 6;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label2.Location = new System.Drawing.Point(12, 57);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(100, 13);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "Picture Settings:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(12, 82);
+ this.label3.Margin = new System.Windows.Forms.Padding(3);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(87, 13);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "Use Picture Size:";
//
// frmAddPreset
//
@@ -151,8 +140,15 @@ namespace Handbrake
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.ClientSize = new System.Drawing.Size(313, 143);
- this.Controls.Add(this.tableLayoutPanel1);
+ this.ClientSize = new System.Drawing.Size(319, 166);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.cb_usePictureSettings);
+ this.Controls.Add(this.lbl_name);
+ this.Controls.Add(this.txt_preset_name);
+ this.Controls.Add(this.check_useFilters);
+ this.Controls.Add(this.btn_cancel);
+ this.Controls.Add(this.btn_add);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -164,10 +160,8 @@ namespace Handbrake
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Add Preset";
+ this.Text = "Add New Preset";
this.TopMost = true;
- this.tableLayoutPanel1.ResumeLayout(false);
- this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -179,9 +173,10 @@ namespace Handbrake
private System.Windows.Forms.TextBox txt_preset_name;
internal System.Windows.Forms.Button btn_add;
internal System.Windows.Forms.Button btn_cancel;
- private System.Windows.Forms.CheckBox check_pictureSettings;
+ private System.Windows.Forms.CheckBox check_useFilters;
private System.Windows.Forms.ToolTip toolTip;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.ComboBox cb_usePictureSettings;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label3;
}
} \ No newline at end of file
diff --git a/win/C#/frmAddPreset.cs b/win/C#/frmAddPreset.cs
index a04b07428..22ba835d7 100644
--- a/win/C#/frmAddPreset.cs
+++ b/win/C#/frmAddPreset.cs
@@ -6,8 +6,11 @@
namespace Handbrake
{
using System;
- using System.Drawing;
using System.Windows.Forms;
+
+ using Handbrake.Functions;
+ using Handbrake.Model;
+
using Presets;
/// <summary>
@@ -15,9 +18,6 @@ namespace Handbrake
/// </summary>
public partial class frmAddPreset : Form
{
- /// <summary>
- /// The Main Window
- /// </summary>
private readonly frmMain mainWindow;
/// <summary>
@@ -26,28 +26,19 @@ namespace Handbrake
private readonly PresetsHandler presetCode;
/// <summary>
- /// The CLI Query
- /// </summary>
- private readonly string query = string.Empty;
-
- /// <summary>
/// Initializes a new instance of the <see cref="frmAddPreset"/> class.
/// </summary>
- /// <param name="fmw">
- /// The fmw.
- /// </param>
- /// <param name="queryString">
- /// The query string.
- /// </param>
+ /// <param name="mainWindow"></param>
/// <param name="presetHandler">
/// The preset handler.
/// </param>
- public frmAddPreset(frmMain fmw, string queryString, PresetsHandler presetHandler)
+ public frmAddPreset(frmMain mainWindow, PresetsHandler presetHandler)
{
InitializeComponent();
- mainWindow = fmw;
+ this.mainWindow = mainWindow;
presetCode = presetHandler;
- this.query = queryString;
+
+ cb_usePictureSettings.SelectedIndex = 0;
}
/// <summary>
@@ -61,11 +52,34 @@ namespace Handbrake
/// </param>
private void BtnAddClick(object sender, EventArgs e)
{
- if (presetCode.Add(txt_preset_name.Text.Trim(), query, check_pictureSettings.Checked))
+ if (string.IsNullOrEmpty(txt_preset_name.Text.Trim()))
+ {
+ MessageBox.Show("You must enter a preset name!", "Warning",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+
+ QueryPictureSettingsMode pictureSettingsMode;
+
+ switch (cb_usePictureSettings.SelectedIndex)
+ {
+ case 0:
+ pictureSettingsMode = QueryPictureSettingsMode.None;
+ break;
+ case 1:
+ pictureSettingsMode = QueryPictureSettingsMode.SourceMaximum;
+ break;
+ default:
+ pictureSettingsMode = QueryPictureSettingsMode.None;
+ break;
+ }
+
+ string query = QueryGenerator.GenerateQueryForPreset(mainWindow, pictureSettingsMode, check_useFilters.Checked, 0, 0);
+
+ if (presetCode.Add(txt_preset_name.Text.Trim(), query, pictureSettingsMode != QueryPictureSettingsMode.None))
{
- TreeNode presetTreeview = new TreeNode(txt_preset_name.Text.Trim()) {ForeColor = Color.Black};
- mainWindow.treeView_presets.Nodes.Add(presetTreeview);
- this.Close();
+ this.DialogResult = DialogResult.OK;
+ this.Close();
}
else
MessageBox.Show("Sorry, that preset name already exists. Please choose another!", "Warning",
@@ -83,6 +97,7 @@ namespace Handbrake
/// </param>
private void BtnCancelClick(object sender, EventArgs e)
{
+ this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs
index 589d674ad..4f6839e4c 100644
--- a/win/C#/frmMain.Designer.cs
+++ b/win/C#/frmMain.Designer.cs
@@ -983,7 +983,7 @@ namespace Handbrake
this.tab_picture.Text = "Picture";
this.tab_picture.UseVisualStyleBackColor = true;
//
- // PictureSettings
+ // CropSettings
//
this.PictureSettings.BackColor = System.Drawing.Color.Transparent;
this.PictureSettings.CurrentlySelectedPreset = null;
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index b0fb65ce2..6937c5923 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -152,8 +152,7 @@ namespace Handbrake
x264Panel.Reset2Defaults();
QueryParser presetQuery = QueryParser.Parse(query);
- PresetLoader.LoadPreset(this, presetQuery, Properties.Settings.Default.defaultPreset,
- presetHandler.GetPreset(Properties.Settings.Default.defaultPreset).PictureSettings);
+ PresetLoader.LoadPreset(this, presetQuery, Properties.Settings.Default.defaultPreset);
x264Panel.StandardizeOptString();
x264Panel.SetCurrentSettingsInPanel();
@@ -538,9 +537,13 @@ namespace Handbrake
/// </param>
private void btn_new_preset_Click(object sender, EventArgs e)
{
- Form preset = new frmAddPreset(this, QueryGenerator.GenerateQueryForPreset(this, QueryPictureSettingsMode.SourceMaximum, true, 0, 0),
- presetHandler);
- preset.ShowDialog();
+ Form preset = new frmAddPreset(this, presetHandler);
+ if (preset.ShowDialog() == DialogResult.OK)
+ {
+ TreeNode presetTreeview = new TreeNode(presetHandler.LastPresetAdded.Name) { ForeColor = Color.Black };
+ treeView_presets.Nodes.Add(presetTreeview);
+ presetHandler.LastPresetAdded = null;
+ }
}
#endregion
@@ -718,9 +721,13 @@ namespace Handbrake
/// </param>
private void btn_addPreset_Click(object sender, EventArgs e)
{
- // TODO this requires a re-think due to the Query Editor Changing.
- Form preset = new frmAddPreset(this, QueryGenerator.GenerateQueryForPreset(this, QueryPictureSettingsMode.SourceMaximum, true, 0, 0), presetHandler);
- preset.ShowDialog();
+ Form preset = new frmAddPreset(this, presetHandler);
+ if (preset.ShowDialog() == DialogResult.OK)
+ {
+ TreeNode presetTreeview = new TreeNode(presetHandler.LastPresetAdded.Name) { ForeColor = Color.Black };
+ treeView_presets.Nodes.Add(presetTreeview);
+ presetHandler.LastPresetAdded = null;
+ }
}
/// <summary>
@@ -866,7 +873,6 @@ namespace Handbrake
if (preset != null)
{
string query = presetHandler.GetPreset(presetName).Query;
- bool loadPictureSettings = presetHandler.GetPreset(presetName).PictureSettings;
if (query != null)
{
@@ -877,7 +883,7 @@ namespace Handbrake
QueryParser presetQuery = QueryParser.Parse(query);
// Now load the preset
- PresetLoader.LoadPreset(this, presetQuery, presetName, loadPictureSettings);
+ PresetLoader.LoadPreset(this, presetQuery, presetName);
// The x264 widgets will need updated, so do this now:
x264Panel.StandardizeOptString();
@@ -922,7 +928,7 @@ namespace Handbrake
MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
- PresetLoader.LoadPreset(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);
+ PresetLoader.LoadPreset(this, parsed, parsed.PresetName);
presetHandler.Update(parsed.PresetName + " (Imported)",
QueryGenerator.GenerateFullQuery(this),
parsed.UsesPictureSettings);
@@ -930,7 +936,7 @@ namespace Handbrake
}
else
{
- PresetLoader.LoadPreset(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);
+ PresetLoader.LoadPreset(this, parsed, parsed.PresetName);
if (presetHandler.Add(parsed.PresetName + " (Imported)",
QueryGenerator.GenerateFullQuery(this),
parsed.UsesPictureSettings))
@@ -2216,7 +2222,7 @@ namespace Handbrake
QueryParser presetQuery = QueryParser.Parse(query);
// Now load the preset
- PresetLoader.LoadPreset(this, presetQuery, "Load Back From Queue", true);
+ PresetLoader.LoadPreset(this, presetQuery, "Load Back From Queue");
// The x264 widgets will need updated, so do this now:
x264Panel.StandardizeOptString();