2012-06-13 19:50:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2013-10-25 00:57:23 +00:00
|
|
|
|
using BizHawk.Client.Common;
|
|
|
|
|
|
2013-11-03 03:54:37 +00:00
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
2012-06-13 19:50:50 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// implements a simple dialog which chooses an IVideoWriter to record with
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class VideoWriterChooserForm : Form
|
|
|
|
|
{
|
2017-04-18 17:27:44 +00:00
|
|
|
|
private VideoWriterChooserForm()
|
2012-06-13 19:50:50 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2015-02-17 00:13:19 +00:00
|
|
|
|
|
|
|
|
|
CaptureWidth = Global.Emulator.CoreComm.NominalWidth;
|
|
|
|
|
CaptureHeight = Global.Emulator.CoreComm.NominalHeight;
|
|
|
|
|
|
|
|
|
|
if (Global.Config.AVI_CaptureOSD)
|
|
|
|
|
{
|
|
|
|
|
using (var bb = GlobalWin.MainForm.CaptureOSD())
|
|
|
|
|
{
|
|
|
|
|
CaptureWidth = bb.Width;
|
|
|
|
|
CaptureHeight = bb.Height;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-18 17:27:44 +00:00
|
|
|
|
lblSize.Text = $"Size:\r\n{CaptureWidth}x{CaptureHeight}";
|
2015-02-17 00:13:19 +00:00
|
|
|
|
|
|
|
|
|
if (CaptureWidth % 4 != 0 || CaptureHeight % 4 != 0)
|
2017-04-18 17:27:44 +00:00
|
|
|
|
{
|
2015-02-17 00:13:19 +00:00
|
|
|
|
lblResolutionWarning.Visible = true;
|
2017-04-18 17:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lblResolutionWarning.Visible = false;
|
|
|
|
|
}
|
2012-06-13 19:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-18 17:27:44 +00:00
|
|
|
|
private int CaptureWidth, CaptureHeight;
|
2015-02-17 00:13:19 +00:00
|
|
|
|
|
2012-06-13 19:50:50 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// chose an IVideoWriter
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="list">list of IVideoWriters to choose from</param>
|
|
|
|
|
/// <param name="owner">parent window</param>
|
|
|
|
|
/// <returns>user choice, or null on Cancel\Close\invalid</returns>
|
2014-10-11 03:33:09 +00:00
|
|
|
|
public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable<VideoWriterInfo> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad, out bool audiosync)
|
2012-06-13 19:50:50 +00:00
|
|
|
|
{
|
2017-04-18 17:27:44 +00:00
|
|
|
|
VideoWriterChooserForm dlg = new VideoWriterChooserForm
|
|
|
|
|
{
|
2017-05-10 11:45:23 +00:00
|
|
|
|
labelDescriptionBody = { Text = "" }
|
2017-04-18 17:27:44 +00:00
|
|
|
|
};
|
2012-06-13 19:50:50 +00:00
|
|
|
|
|
2017-04-18 17:27:44 +00:00
|
|
|
|
int idx = 0;
|
|
|
|
|
int idx_select = -1;
|
|
|
|
|
dlg.listBox1.BeginUpdate();
|
|
|
|
|
foreach (var vw in list)
|
2014-10-10 18:09:00 +00:00
|
|
|
|
{
|
2017-04-18 17:27:44 +00:00
|
|
|
|
dlg.listBox1.Items.Add(vw);
|
|
|
|
|
if (vw.Attribs.ShortName == Global.Config.VideoWriter)
|
2014-10-10 18:09:00 +00:00
|
|
|
|
{
|
2017-04-18 17:27:44 +00:00
|
|
|
|
idx_select = idx;
|
2014-10-10 18:09:00 +00:00
|
|
|
|
}
|
2017-04-18 17:27:44 +00:00
|
|
|
|
|
|
|
|
|
idx++;
|
2014-10-10 18:09:00 +00:00
|
|
|
|
}
|
2012-06-17 15:09:53 +00:00
|
|
|
|
|
2017-04-18 17:27:44 +00:00
|
|
|
|
dlg.listBox1.SelectedIndex = idx_select;
|
|
|
|
|
dlg.listBox1.EndUpdate();
|
|
|
|
|
|
2012-11-26 02:25:23 +00:00
|
|
|
|
foreach (Control c in dlg.panelSizeSelect.Controls)
|
2017-04-18 17:27:44 +00:00
|
|
|
|
{
|
2012-11-26 02:25:23 +00:00
|
|
|
|
c.Enabled = false;
|
2017-04-18 17:27:44 +00:00
|
|
|
|
}
|
2012-11-26 02:25:23 +00:00
|
|
|
|
|
2012-06-13 19:50:50 +00:00
|
|
|
|
DialogResult result = dlg.ShowDialog(owner);
|
|
|
|
|
|
|
|
|
|
IVideoWriter ret;
|
|
|
|
|
|
|
|
|
|
if (result == DialogResult.OK && dlg.listBox1.SelectedIndex != -1)
|
2012-06-17 15:09:53 +00:00
|
|
|
|
{
|
2014-10-10 18:09:00 +00:00
|
|
|
|
var vwi = (VideoWriterInfo)dlg.listBox1.SelectedItem;
|
|
|
|
|
ret = vwi.Create();
|
|
|
|
|
Global.Config.VideoWriter = vwi.Attribs.ShortName;
|
2012-06-17 15:09:53 +00:00
|
|
|
|
}
|
2012-06-13 19:50:50 +00:00
|
|
|
|
else
|
2014-10-10 18:09:00 +00:00
|
|
|
|
{
|
2012-06-13 19:50:50 +00:00
|
|
|
|
ret = null;
|
2014-10-10 18:09:00 +00:00
|
|
|
|
}
|
2012-06-13 19:50:50 +00:00
|
|
|
|
|
2012-11-26 02:25:23 +00:00
|
|
|
|
if (ret != null && dlg.checkBoxResize.Checked)
|
|
|
|
|
{
|
|
|
|
|
resizew = dlg.numericTextBoxW.IntValue;
|
|
|
|
|
resizeh = dlg.numericTextBoxH.IntValue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
resizew = -1;
|
|
|
|
|
resizeh = -1;
|
|
|
|
|
}
|
2014-02-07 02:28:07 +00:00
|
|
|
|
|
|
|
|
|
pad = dlg.checkBoxPad.Checked;
|
2014-10-11 03:33:09 +00:00
|
|
|
|
audiosync = dlg.checkBoxASync.Checked;
|
2014-02-07 02:28:07 +00:00
|
|
|
|
|
2012-06-13 19:50:50 +00:00
|
|
|
|
dlg.Dispose();
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2017-04-18 17:27:44 +00:00
|
|
|
|
labelDescriptionBody.Text = listBox1.SelectedIndex != -1
|
|
|
|
|
? ((VideoWriterInfo)listBox1.SelectedItem).Attribs.Description
|
2017-05-10 11:45:23 +00:00
|
|
|
|
: "";
|
2012-11-26 02:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkBoxResize_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
foreach (Control c in panelSizeSelect.Controls)
|
2017-04-18 17:27:44 +00:00
|
|
|
|
{
|
2012-11-26 02:25:23 +00:00
|
|
|
|
c.Enabled = checkBoxResize.Checked;
|
2017-04-18 17:27:44 +00:00
|
|
|
|
}
|
2012-11-26 02:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonAuto_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-02-17 00:13:19 +00:00
|
|
|
|
numericTextBoxW.Text = CaptureWidth.ToString();
|
|
|
|
|
numericTextBoxH.Text = CaptureHeight.ToString();
|
2012-11-26 02:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (checkBoxResize.Checked)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (numericTextBoxW.IntValue < 1 || numericTextBoxH.IntValue < 1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(this, "Size must be positive!");
|
|
|
|
|
DialogResult = DialogResult.None;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (FormatException)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(this, "Size must be numeric!");
|
|
|
|
|
DialogResult = DialogResult.None;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-06-13 19:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|