using System.Drawing;\r
using System.Globalization;\r
using System.IO;\r
- using System.Reflection;\r
using System.Threading;\r
using System.Windows.Forms;\r
using Functions;\r
\r
+ using HandBrake.ApplicationServices.Functions;\r
using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Parsing;\r
using HandBrake.ApplicationServices.Services;\r
using Presets;\r
using Properties;\r
\r
+ using Main = Handbrake.Functions.Main;\r
+\r
/// <summary>\r
/// The Main Window\r
/// </summary>\r
\r
// Update the users config file with the CLI version data.\r
Main.SetCliVersionData();\r
- Main.CheckForValidCliVersion();\r
\r
if (Settings.Default.hb_version.Contains("svn"))\r
{\r
- Version v = Assembly.GetExecutingAssembly().GetName().Version;\r
- this.Text += " " + v.ToString(4);\r
+ this.Text += " " + Settings.Default.hb_version;\r
}\r
\r
// Check for new versions, if update checking is enabled\r
MessageBox.Show("This feature has not been implimented yet.", "Not Implimented", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
return;\r
\r
- SaveFileDialog savefiledialog = new SaveFileDialog();\r
+ /*SaveFileDialog savefiledialog = new SaveFileDialog();\r
savefiledialog.Filter = "plist|*.plist";\r
\r
if (treeView_presets.SelectedNode != null)\r
{\r
+\r
if (savefiledialog.ShowDialog() == DialogResult.OK)\r
{\r
Preset preset = presetHandler.GetPreset(treeView_presets.SelectedNode.Text);\r
PlistPresetHandler.Export(savefiledialog.FileName, preset);\r
}\r
- }\r
+ }*/\r
}\r
\r
#endregion\r
#region Main Window and Tab Control\r
\r
// Source\r
- private void btn_dvd_source_Click(object sender, EventArgs e)\r
+ private void BtnFolderScanClicked(object sender, EventArgs e)\r
{\r
+ this.btn_source.HideDropDown();\r
if (DVD_Open.ShowDialog() == DialogResult.OK)\r
{\r
this.selectedSourceType = SourceType.Folder;\r
- SelectSource(DVD_Open.SelectedPath);\r
+ SelectSource(DVD_Open.SelectedPath, 0);\r
}\r
else\r
UpdateSourceLabel();\r
}\r
\r
- private void btn_file_source_Click(object sender, EventArgs e)\r
+ private void BtnFileScanClicked(object sender, EventArgs e)\r
{\r
+ this.btn_source.HideDropDown();\r
if (ISO_Open.ShowDialog() == DialogResult.OK)\r
{\r
this.selectedSourceType = SourceType.VideoFile;\r
- SelectSource(ISO_Open.FileName);\r
+ SelectSource(ISO_Open.FileName, 0);\r
}\r
else\r
UpdateSourceLabel();\r
}\r
\r
- private void mnu_dvd_drive_Click(object sender, EventArgs e)\r
+ private void MnuDvdDriveClick(object sender, EventArgs e)\r
{\r
ToolStripMenuItem item = sender as ToolStripMenuItem;\r
if (item != null)\r
\r
if (this.dvdDrivePath == null) return;\r
this.selectedSourceType = SourceType.DvdDrive;\r
- SelectSource(this.dvdDrivePath);\r
+ SelectSource(this.dvdDrivePath, 0);\r
+ }\r
+ }\r
+ }\r
+\r
+ private void VideoTitleSpecificScanClick(object sender, EventArgs e)\r
+ {\r
+ this.btn_source.HideDropDown();\r
+ if (ISO_Open.ShowDialog() == DialogResult.OK)\r
+ {\r
+ this.selectedSourceType = SourceType.VideoFile;\r
+\r
+ int sourceTitle = 0;\r
+ TitleSpecificScan title = new TitleSpecificScan();\r
+ if (title.ShowDialog() == DialogResult.OK)\r
+ {\r
+ sourceTitle = title.Title;\r
+ }\r
+\r
+ SelectSource(ISO_Open.FileName, sourceTitle);\r
+ }\r
+ else\r
+ UpdateSourceLabel();\r
+ }\r
+\r
+ private void FolderTitleSpecificScanClick(object sender, EventArgs e)\r
+ {\r
+ this.btn_source.HideDropDown();\r
+ if (DVD_Open.ShowDialog() == DialogResult.OK)\r
+ {\r
+ this.selectedSourceType = SourceType.Folder;\r
+\r
+ int sourceTitle = 0;\r
+ TitleSpecificScan title = new TitleSpecificScan();\r
+ if (title.ShowDialog() == DialogResult.OK)\r
+ {\r
+ sourceTitle = title.Title;\r
}\r
+\r
+ SelectSource(DVD_Open.SelectedPath, sourceTitle);\r
}\r
+ else\r
+ UpdateSourceLabel();\r
}\r
\r
- private void SelectSource(string file)\r
+ private void SelectSource(string file, int titleSpecific)\r
{\r
Check_ChapterMarkers.Enabled = true;\r
sourcePath = string.Empty;\r
}\r
\r
sourcePath = Path.GetFileName(file);\r
- StartScan(file, 0);\r
+ StartScan(file, titleSpecific);\r
}\r
\r
private void drp_dvdtitle_Click(object sender, EventArgs e)\r
\r
// Populate the Angles dropdown\r
drop_angle.Items.Clear();\r
- if (!Settings.Default.noDvdNav)\r
+ if (!Properties.Settings.Default.noDvdNav)\r
{\r
drop_angle.Visible = true;\r
lbl_angle.Visible = true;\r
labelSource.Text = labelSource.Text = Path.GetFileName(selectedTitle.SourceName);\r
\r
// Run the AutoName & ChapterNaming functions\r
- if (Settings.Default.autoNaming)\r
+ if (Properties.Settings.Default.autoNaming)\r
{\r
string autoPath = Main.AutoName(this);\r
if (autoPath != null)\r
text_destination.Text = autoPath;\r
else\r
MessageBox.Show(\r
- "You currently have \"Automatically name output files\" enabled for the destination file box, but you do not have a default directory set.\n\nYou should set a \"Default Path\" in HandBrakes preferences. (See 'Tools' menu -> 'Options' -> 'General' Tab -> 'Default Path')",\r
+ "You currently have \"Automatically name output files\" enabled for the destination file box, but you do not have a valid default directory set.\n\nYou should set a \"Default Path\" in HandBrakes preferences. (See 'Tools' menu -> 'Options' -> 'General' Tab -> 'Default Path')",\r
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
}\r
\r
// Add more rows to the Chapter menu if needed.\r
if (Check_ChapterMarkers.Checked)\r
{\r
- int i = data_chpt.Rows.Count, finish;\r
+ int i = data_chpt.Rows.Count, finish = 0;\r
int.TryParse(drop_chapterFinish.Text, out finish);\r
\r
while (i < finish)\r
.ToString();\r
\r
// Run the Autonaming function\r
- if (Settings.Default.autoNaming)\r
+ if (Properties.Settings.Default.autoNaming)\r
text_destination.Text = Main.AutoName(this);\r
\r
// Disable chapter markers if only 1 chapter is selected.\r
private void drop_mode_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
// Reset\r
- this.drop_chapterFinish.TextChanged -= this.SecondsOrFramesChanged;\r
- this.drop_chapterStart.TextChanged -= this.SecondsOrFramesChanged;\r
+ this.drop_chapterFinish.TextChanged -= new EventHandler(this.SecondsOrFramesChanged);\r
+ this.drop_chapterStart.TextChanged -= new EventHandler(this.SecondsOrFramesChanged);\r
\r
// Do Work\r
switch (drop_mode.SelectedIndex)\r
lbl_duration.Text = "--:--:--";\r
return;\r
case 1:\r
- this.drop_chapterStart.TextChanged += this.SecondsOrFramesChanged;\r
- this.drop_chapterFinish.TextChanged += this.SecondsOrFramesChanged;\r
+ this.drop_chapterStart.TextChanged += new EventHandler(this.SecondsOrFramesChanged);\r
+ this.drop_chapterFinish.TextChanged += new EventHandler(this.SecondsOrFramesChanged);\r
drop_chapterStart.DropDownStyle = ComboBoxStyle.Simple;\r
drop_chapterFinish.DropDownStyle = ComboBoxStyle.Simple;\r
if (selectedTitle != null)\r
}\r
return;\r
case 2:\r
- this.drop_chapterStart.TextChanged += this.SecondsOrFramesChanged;\r
- this.drop_chapterFinish.TextChanged += this.SecondsOrFramesChanged;\r
+ this.drop_chapterStart.TextChanged += new EventHandler(this.SecondsOrFramesChanged);\r
+ this.drop_chapterFinish.TextChanged += new EventHandler(this.SecondsOrFramesChanged);\r
drop_chapterStart.DropDownStyle = ComboBoxStyle.Simple;\r
drop_chapterFinish.DropDownStyle = ComboBoxStyle.Simple;\r
if (selectedTitle != null)\r
else if (drop_format.SelectedIndex.Equals(1))\r
DVD_Save.FilterIndex = 2;\r
\r
- if (DVD_Save.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(DVD_Save.FileName))\r
+ if (DVD_Save.ShowDialog() == DialogResult.OK)\r
{\r
// Add a file extension manually, as FileDialog.AddExtension has issues with dots in filenames\r
switch (DVD_Save.FilterIndex)\r
{\r
case 1:\r
- if (!Path.GetExtension(DVD_Save.FileName).Equals(".mp4", StringComparison.InvariantCultureIgnoreCase))\r
- DVD_Save.FileName = Settings.Default.useM4v ? DVD_Save.FileName.Replace(".mp4", ".m4v").Replace(".mkv", ".m4v") : DVD_Save.FileName.Replace(".m4v", ".mp4").Replace(".mkv", ".mp4");\r
+ if (\r
+ !Path.GetExtension(DVD_Save.FileName).Equals(".mp4",\r
+ StringComparison.InvariantCultureIgnoreCase))\r
+ if (Properties.Settings.Default.useM4v)\r
+ DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".m4v").Replace(".mkv", ".m4v");\r
+ else\r
+ DVD_Save.FileName = DVD_Save.FileName.Replace(".m4v", ".mp4").Replace(".mkv", ".mp4");\r
break;\r
case 2:\r
- if (!Path.GetExtension(DVD_Save.FileName).Equals(".mkv", StringComparison.InvariantCultureIgnoreCase))\r
+ if (\r
+ !Path.GetExtension(DVD_Save.FileName).Equals(".mkv", StringComparison.InvariantCultureIgnoreCase))\r
DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".mkv").Replace(".m4v", ".mkv");\r
break;\r
default:\r
switch (drop_format.SelectedIndex)\r
{\r
case 0:\r
- if (Settings.Default.useM4v || Check_ChapterMarkers.Checked ||\r
+ if (Properties.Settings.Default.useM4v || Check_ChapterMarkers.Checked ||\r
AudioSettings.RequiresM4V() || Subtitles.RequiresM4V())\r
SetExtension(".m4v");\r
else\r
public void SetExtension(string newExtension)\r
{\r
if (newExtension == ".mp4" || newExtension == ".m4v")\r
- if (Settings.Default.useM4v || Check_ChapterMarkers.Checked || AudioSettings.RequiresM4V() ||\r
+ if (Properties.Settings.Default.useM4v || Check_ChapterMarkers.Checked || AudioSettings.RequiresM4V() ||\r
Subtitles.RequiresM4V())\r
newExtension = ".m4v";\r
else\r
slider_videoQuality.Minimum = 0;\r
slider_videoQuality.TickFrequency = 1;\r
\r
- double cqStep = Settings.Default.x264cqstep;\r
+ CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
+ double cqStep = Properties.Settings.Default.x264cqstep;\r
double multiplier = 1.0 / cqStep;\r
double value = slider_videoQuality.Value * multiplier;\r
\r
- slider_videoQuality.Maximum = (int)(51 / Settings.Default.x264cqstep);\r
+ slider_videoQuality.Maximum = (int)(51 / Properties.Settings.Default.x264cqstep);\r
\r
if (value < slider_videoQuality.Maximum)\r
slider_videoQuality.Value = slider_videoQuality.Maximum - (int)value;\r
}\r
}\r
\r
- private double cachedCqStep = Settings.Default.x264cqstep;\r
+ private double cachedCqStep = Properties.Settings.Default.x264cqstep;\r
\r
/// <summary>\r
/// Update the CQ slider for x264 for a new CQ step. This is set from option\r
public void setQualityFromSlider()\r
{\r
// Work out the current RF value.\r
- double cqStep = cachedCqStep;\r
+ double cqStep = this.cachedCqStep;\r
double rfValue = 51.0 - slider_videoQuality.Value * cqStep;\r
\r
// Change the maximum value for the slider\r
- slider_videoQuality.Maximum = (int)(51 / Settings.Default.x264cqstep);\r
+ slider_videoQuality.Maximum = (int)(51 / Properties.Settings.Default.x264cqstep);\r
\r
// Reset the CQ slider to RF0\r
slider_videoQuality.Value = slider_videoQuality.Maximum;\r
\r
// Reset the CQ slider back to the previous value as close as possible\r
- double cqStepNew = Settings.Default.x264cqstep;\r
+ double cqStepNew = Properties.Settings.Default.x264cqstep;\r
double rfValueCurrent = 51.0 - slider_videoQuality.Value * cqStepNew;\r
while (rfValueCurrent < rfValue)\r
{\r
}\r
\r
// Cache the CQ step for the next calculation\r
- cachedCqStep = Settings.Default.x264cqstep;\r
+ this.cachedCqStep = Properties.Settings.Default.x264cqstep;\r
}\r
\r
private void slider_videoQuality_Scroll(object sender, EventArgs e)\r
{\r
- double cqStep = Settings.Default.x264cqstep;\r
+ double cqStep = Properties.Settings.Default.x264cqstep;\r
switch (drp_videoEncoder.Text)\r
{\r
case "MPEG-4 (FFmpeg)":\r
}\r
else\r
{\r
- if (drop_format.SelectedIndex != 1 && !Settings.Default.useM4v)\r
+ if (drop_format.SelectedIndex != 1 && !Properties.Settings.Default.useM4v)\r
SetExtension(".mp4");\r
data_chpt.Enabled = false;\r
btn_importChapters.Enabled = false;\r
\r
private void btn_export_Click(object sender, EventArgs e)\r
{\r
- SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = "Csv File|*.csv", DefaultExt = "csv" };\r
+ SaveFileDialog saveFileDialog = new SaveFileDialog();\r
+ saveFileDialog.Filter = "Csv File|*.csv";\r
+ saveFileDialog.DefaultExt = "csv";\r
if (saveFileDialog.ShowDialog() == DialogResult.OK)\r
{\r
string filename = saveFileDialog.FileName;\r
try\r
{\r
SourceScan.Scan(sourcePath, title);\r
- SourceScan.ScanStatusChanged += SourceScan_ScanStatusChanged;\r
- SourceScan.ScanCompleted += SourceScan_ScanCompleted;\r
+ SourceScan.ScanStatusChanged += new EventHandler(SourceScan_ScanStatusChanged);\r
+ SourceScan.ScanCompleted += new EventHandler(SourceScan_ScanCompleted);\r
}\r
catch (Exception exc)\r
{\r
/// <param name="e">\r
/// The e.\r
/// </param>\r
- private void SourceScan_ScanStatusChanged(object sender, HandBrake.ApplicationServices.ScanProgressEventArgs e)\r
+ private void SourceScan_ScanStatusChanged(object sender, EventArgs e)\r
{\r
- UpdateScanStatusLabel(sender, e);\r
+ UpdateScanStatusLabel();\r
}\r
\r
/// <summary>\r
/// <summary>\r
/// Update the Scan Status Label\r
/// </summary>\r
- /// <param name="sender"> The Sender </param>\r
- /// <param name="e">Scan Progress Event Args</param>\r
- private void UpdateScanStatusLabel(object sender, HandBrake.ApplicationServices.ScanProgressEventArgs e)\r
+ private void UpdateScanStatusLabel()\r
{\r
if (InvokeRequired)\r
{\r
- BeginInvoke(new ScanService.ScanProgessStatus(UpdateScanStatusLabel), new[] { e });\r
+ BeginInvoke(new UpdateWindowHandler(UpdateScanStatusLabel));\r
return;\r
}\r
-\r
- lbl_encode.Text = "Scanning Title" + e.CurrentTitle + " of " + e.TotalTitles;\r
+ lbl_encode.Text = SourceScan.ScanStatus;\r
}\r
\r
/// <summary>\r
/// </summary>\r
private void KillScan()\r
{\r
- SourceScan.ScanCompleted -= SourceScan_ScanCompleted;\r
+ SourceScan.ScanCompleted -= new EventHandler(SourceScan_ScanCompleted);\r
EnableGUI();\r
ResetGUI();\r
\r
ProgressBarStatus.Visible = false;\r
btn_start.Text = "Start";\r
btn_start.ToolTipText = "Start the encoding process";\r
- btn_start.Image = Resources.Play;\r
+ btn_start.Image = Properties.Resources.Play;\r
\r
// If the window is minimized, display the notification in a popup.\r
- if (Settings.Default.trayIconAlerts)\r
+ if (Properties.Settings.Default.trayIconAlerts)\r
if (FormWindowState.Minimized == this.WindowState)\r
{\r
notifyIcon.BalloonTipText = lbl_encode.Text;\r
lbl_encode.Text = "Encoding with " + encodeQueue.Count + " encode(s) pending";\r
btn_start.Text = "Stop";\r
btn_start.ToolTipText = "Stop the encoding process.";\r
- btn_start.Image = Resources.stop;\r
+ btn_start.Image = Properties.Resources.stop;\r
}\r
catch (Exception exc)\r
{\r
Text = drive.RootDirectory + " (" + drive.VolumeLabel + ")",\r
Image = Resources.disc_small\r
};\r
- menuItem.Click += mnu_dvd_drive_Click;\r
+ menuItem.Click += new EventHandler(MnuDvdDriveClick);\r
menuItems.Add(menuItem);\r
}\r
\r
\r
if (SourceScan.IsScanning)\r
{\r
- SourceScan.ScanCompleted -= SourceScan_ScanCompleted;\r
+ SourceScan.ScanCompleted -= new EventHandler(SourceScan_ScanCompleted);\r
SourceScan.Stop();\r
}\r
}\r