summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-11-06 21:26:55 +0000
committersr55 <[email protected]>2008-11-06 21:26:55 +0000
commitc0a30f0be5aa54e8b19e04fb560e907319339a2f (patch)
tree27f237f1fb768184a0ff2d3ce68d258737bde61b /win
parent4187cbcfdad5d71657431f9b5d662942c5d9c8f5 (diff)
WinGui:
- Set's DRC to 1 by default. - Chapter Markers tab only enabled if it's a DVD source or ISO image. - -X and -Y options now parsed by the query parser. - Added a small hack to allow built-in presets to use -X and -Y and have the query generator correctly generate the query. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1898 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/C#/Functions/QueryParser.cs42
-rw-r--r--win/C#/frmMain.cs21
-rw-r--r--win/C#/frmMain/PresetLoader.cs15
-rw-r--r--win/C#/frmMain/QueryGenerator.cs27
4 files changed, 97 insertions, 8 deletions
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs
index f120f5671..3e8b18ebe 100644
--- a/win/C#/Functions/QueryParser.cs
+++ b/win/C#/Functions/QueryParser.cs
@@ -142,6 +142,32 @@ namespace Handbrake.Functions
}
}
+ private int q_maxWidth;
+ /// <summary>
+ /// Returns an Int
+ /// The selected Width for the encoding.
+ /// </summary>
+ public int MaxWidth
+ {
+ get
+ {
+ return this.q_maxWidth;
+ }
+ }
+
+ private int q_maxHeight;
+ /// <summary>
+ /// Returns an Int
+ /// The selected Height for the encoding.
+ /// </summary>
+ public int MaxHeight
+ {
+ get
+ {
+ return this.q_maxHeight;
+ }
+ }
+
private string q_cropValues;
/// <summary>
/// Returns an String
@@ -800,6 +826,8 @@ namespace Handbrake.Functions
//Picture Settings Tab
Match width = Regex.Match(input, @"-w ([0-9]*)");
Match height = Regex.Match(input, @"-l ([0-9]*)");
+ Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");
+ Match maxHeight = Regex.Match(input, @"-Y ([0-9]*)");
Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z]*)\""");
Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z]*)\""");
Match deblock = Regex.Match(input, @"--deblock=([0-9]*)");
@@ -930,6 +958,12 @@ namespace Handbrake.Functions
if (height.Success != false)
thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));
+ if (maxWidth.Success != false)
+ thisQuery.q_maxWidth = int.Parse(maxWidth.ToString().Replace("-X ", ""));
+
+ if (maxHeight.Success != false)
+ thisQuery.q_maxHeight = int.Parse(maxHeight.ToString().Replace("-Y ", ""));
+
if (crop.Success != false)
{
thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");
@@ -1194,7 +1228,7 @@ namespace Handbrake.Functions
thisQuery.q_drc1 = drcValue;
}
else
- thisQuery.q_drc1 = 0;
+ thisQuery.q_drc1 = 10;
if (drc2.Success != false)
{
@@ -1205,7 +1239,7 @@ namespace Handbrake.Functions
thisQuery.q_drc2 = drcValue;
}
else
- thisQuery.q_drc2 = 0;
+ thisQuery.q_drc2 = 10;
if (drc3.Success != false)
{
@@ -1216,7 +1250,7 @@ namespace Handbrake.Functions
thisQuery.q_drc3 = drcValue;
}
else
- thisQuery.q_drc3 = 0;
+ thisQuery.q_drc3 = 10;
if (drc4.Success != false)
{
@@ -1227,7 +1261,7 @@ namespace Handbrake.Functions
thisQuery.q_drc4 = drcValue;
}
else
- thisQuery.q_drc4 = 0;
+ thisQuery.q_drc4 = 10;
// Subtitle Stuff
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index f7733a153..2888dad41 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -39,6 +39,8 @@ namespace Handbrake
private frmQueue queueWindow;
private delegate void updateStatusChanger();
private string lastAction = null;
+ public int maxWidth = 0;
+ public int maxHeight = 0;
// Applicaiton Startup ************************************************
@@ -422,6 +424,9 @@ namespace Handbrake
//Source
private void btn_dvd_source_Click(object sender, EventArgs e)
{
+ // Enable the creation of chapter markers.
+ Check_ChapterMarkers.Enabled = true;
+
// Set the last action to scan.
// This is used for tracking which file to load in the activity window
lastAction = "scan";
@@ -484,10 +489,22 @@ namespace Handbrake
MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source.\nYour Source may be copy protected, badly mastered or a format which HandBrake does not support. \nPlease refer to the Documentation and FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
lbl_encode.Text = "";
+
+ // Enable the creation of chapter markers if the file is an image of a dvd.
+ if (filename.ToLower().Contains(".iso"))
+ Check_ChapterMarkers.Enabled = true;
+ else
+ {
+ Check_ChapterMarkers.Enabled = false;
+ data_chpt.Rows.Clear();
+ }
}
}
private void mnu_dvd_drive_Click(object sender, EventArgs e)
{
+ // Enable the creation of chapter markers.
+ Check_ChapterMarkers.Enabled = true;
+
// Set the last action to scan.
// This is used for tracking which file to load in the activity window
lastAction = "scan";
@@ -779,6 +796,8 @@ namespace Handbrake
//Picture Tab
private void text_width_TextChanged(object sender, EventArgs e)
{
+ maxWidth = 0; // Reset max width so that it's not using the MaxWidth -X. Quick hack to allow -X for preset usage.
+
int width;
Boolean parsed = int.TryParse(text_width.Text, out width);
if (parsed != false)
@@ -801,6 +820,8 @@ namespace Handbrake
}
private void text_height_TextChanged(object sender, EventArgs e)
{
+ maxHeight = 0; // Reset max height so that it's not using the MaxHeight -Y. Quick hack to allow -Y for preset usage.
+
int height;
Boolean parsed = int.TryParse(text_height.Text, out height);
if (parsed != false)
diff --git a/win/C#/frmMain/PresetLoader.cs b/win/C#/frmMain/PresetLoader.cs
index c42f8202e..e56ee4cbf 100644
--- a/win/C#/frmMain/PresetLoader.cs
+++ b/win/C#/frmMain/PresetLoader.cs
@@ -129,6 +129,21 @@ namespace Handbrake
mainWindow.text_height.Text = "";
}
+ // Set the public max width and max height varibles in frmMain
+ // These are used by the query generator to determine if it should use -X or -w / -Y or -h
+ if (presetQuery.MaxWidth != 0)
+ {
+ mainWindow.text_width.Text = presetQuery.MaxWidth.ToString();
+ mainWindow.maxWidth = presetQuery.MaxWidth;
+ }
+
+ if (presetQuery.MaxHeight != 0)
+ {
+ mainWindow.text_height.Text = presetQuery.MaxHeight.ToString();
+ mainWindow.maxHeight = presetQuery.MaxHeight;
+ }
+
+
#endregion
// Video Settings Tab
diff --git a/win/C#/frmMain/QueryGenerator.cs b/win/C#/frmMain/QueryGenerator.cs
index b66e3f041..a2cb50ed0 100644
--- a/win/C#/frmMain/QueryGenerator.cs
+++ b/win/C#/frmMain/QueryGenerator.cs
@@ -101,11 +101,30 @@ namespace Handbrake
// Picture Settings Tab
#region Picture Settings Tab
- if (mainWindow.text_width.Text != "")
- query += " -w " + mainWindow.text_width.Text;
+ // Use MaxWidth for built-in presets and width for user settings.
+ if (mainWindow.maxWidth == 0)
+ {
+
+ if (mainWindow.text_width.Text != "")
+ query += " -w " + mainWindow.text_width.Text;
+ }
+ else
+ {
+ if (mainWindow.text_width.Text != "")
+ query += " -X " + mainWindow.text_width.Text;
+ }
- if (mainWindow.text_height.Text != "")
- query += " -l " + mainWindow.text_height.Text;
+ // Use MaxHeight for built-in presets and height for user settings.
+ if (mainWindow.maxHeight == 0)
+ {
+ if (mainWindow.text_height.Text != "")
+ query += " -l " + mainWindow.text_height.Text;
+ }
+ else
+ {
+ if (mainWindow.text_height.Text != "")
+ query += " -Y " + mainWindow.text_height.Text;
+ }
string cropTop = mainWindow.text_top.Text;
string cropBottom = mainWindow.text_bottom.Text;