/// <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> public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable <VideoWriterInfo> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad, out bool audiosync) { VideoWriterChooserForm dlg = new VideoWriterChooserForm(); dlg.labelDescriptionBody.Text = ""; { int idx = 0; int idx_select = -1; dlg.listBox1.BeginUpdate(); foreach (var vw in list) { dlg.listBox1.Items.Add(vw); if (vw.Attribs.ShortName == Global.Config.VideoWriter) { idx_select = idx; } idx++; } dlg.listBox1.SelectedIndex = idx_select; dlg.listBox1.EndUpdate(); } foreach (Control c in dlg.panelSizeSelect.Controls) { c.Enabled = false; } DialogResult result = dlg.ShowDialog(owner); IVideoWriter ret; if (result == DialogResult.OK && dlg.listBox1.SelectedIndex != -1) { var vwi = (VideoWriterInfo)dlg.listBox1.SelectedItem; ret = vwi.Create(); Global.Config.VideoWriter = vwi.Attribs.ShortName; } else { ret = null; } if (ret != null && dlg.checkBoxResize.Checked) { resizew = dlg.numericTextBoxW.IntValue; resizeh = dlg.numericTextBoxH.IntValue; } else { resizew = -1; resizeh = -1; } pad = dlg.checkBoxPad.Checked; audiosync = dlg.checkBoxASync.Checked; dlg.Dispose(); return(ret); }
/// <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> public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable <IVideoWriter> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad) { VideoWriterChooserForm dlg = new VideoWriterChooserForm(); dlg.labelDescriptionBody.Text = ""; dlg.listBox1.BeginUpdate(); foreach (var vw in list) { dlg.listBox1.Items.Add(vw); } dlg.listBox1.EndUpdate(); int i = dlg.listBox1.FindStringExact(Global.Config.VideoWriter); if (i != ListBox.NoMatches) { dlg.listBox1.SelectedIndex = i; } foreach (Control c in dlg.panelSizeSelect.Controls) { c.Enabled = false; } DialogResult result = dlg.ShowDialog(owner); IVideoWriter ret; if (result == DialogResult.OK && dlg.listBox1.SelectedIndex != -1) { ret = (IVideoWriter)dlg.listBox1.SelectedItem; Global.Config.VideoWriter = ret.ToString(); } else { ret = null; } if (ret != null && dlg.checkBoxResize.Checked) { resizew = dlg.numericTextBoxW.IntValue; resizeh = dlg.numericTextBoxH.IntValue; } else { resizew = -1; resizeh = -1; } pad = dlg.checkBoxPad.Checked; dlg.Dispose(); return(ret); }
/// <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> public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable<IVideoWriter> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad) { VideoWriterChooserForm dlg = new VideoWriterChooserForm(); dlg.labelDescriptionBody.Text = ""; dlg.listBox1.BeginUpdate(); foreach (var vw in list) dlg.listBox1.Items.Add(vw); dlg.listBox1.EndUpdate(); int i = dlg.listBox1.FindStringExact(Global.Config.VideoWriter); if (i != ListBox.NoMatches) dlg.listBox1.SelectedIndex = i; foreach (Control c in dlg.panelSizeSelect.Controls) c.Enabled = false; DialogResult result = dlg.ShowDialog(owner); IVideoWriter ret; if (result == DialogResult.OK && dlg.listBox1.SelectedIndex != -1) { ret = (IVideoWriter)dlg.listBox1.SelectedItem; Global.Config.VideoWriter = ret.ToString(); } else ret = null; if (ret != null && dlg.checkBoxResize.Checked) { resizew = dlg.numericTextBoxW.IntValue; resizeh = dlg.numericTextBoxH.IntValue; } else { resizew = -1; resizeh = -1; } pad = dlg.checkBoxPad.Checked; dlg.Dispose(); return ret; }
/// <summary> /// chose an IVideoWriter /// </summary> /// <param name="list">list of IVideoWriters to choose from</param> /// <param name="owner">parent window</param> /// <param name="emulator">The current emulator</param> /// <returns>user choice, or null on Cancel\Close\invalid</returns> public static IVideoWriter DoVideoWriterChooserDlg <T>( IEnumerable <VideoWriterInfo> list, T owner, IEmulator emulator, Config config, out int resizeW, out int resizeH, out bool pad, ref bool audioSync) where T : IMainFormForTools, IDialogParent { var dlg = new VideoWriterChooserForm(owner, emulator, config) { labelDescriptionBody = { Text = "" } }; int idx = 0; int idxSelect = -1; dlg.listBox1.BeginUpdate(); foreach (var vw in list) { dlg.listBox1.Items.Add(vw); if (vw.Attribs.ShortName == config.VideoWriter) { idxSelect = idx; } idx++; } dlg.listBox1.SelectedIndex = idxSelect; dlg.listBox1.EndUpdate(); foreach (Control c in dlg.panelSizeSelect.Controls) { c.Enabled = false; } dlg.checkBoxASync.Checked = audioSync; var result = owner.ShowDialogAsChild(dlg); IVideoWriter ret; if (result == DialogResult.OK && dlg.listBox1.SelectedIndex != -1) { var vwi = (VideoWriterInfo)dlg.listBox1.SelectedItem; ret = vwi.Create(owner); config.VideoWriter = vwi.Attribs.ShortName; } else { ret = null; } if (ret != null && dlg.checkBoxResize.Checked) { resizeW = dlg.numericTextBoxW.IntValue; resizeH = dlg.numericTextBoxH.IntValue; } else { resizeW = -1; resizeH = -1; } pad = dlg.checkBoxPad.Checked; audioSync = dlg.checkBoxASync.Checked; dlg.Dispose(); return(ret); }
/// <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> public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable<VideoWriterInfo> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad, out bool audiosync) { VideoWriterChooserForm dlg = new VideoWriterChooserForm(); dlg.labelDescriptionBody.Text = ""; { int idx = 0; int idx_select = -1; dlg.listBox1.BeginUpdate(); foreach (var vw in list) { dlg.listBox1.Items.Add(vw); if (vw.Attribs.ShortName == Global.Config.VideoWriter) idx_select = idx; idx++; } dlg.listBox1.SelectedIndex = idx_select; dlg.listBox1.EndUpdate(); } foreach (Control c in dlg.panelSizeSelect.Controls) c.Enabled = false; DialogResult result = dlg.ShowDialog(owner); IVideoWriter ret; if (result == DialogResult.OK && dlg.listBox1.SelectedIndex != -1) { var vwi = (VideoWriterInfo)dlg.listBox1.SelectedItem; ret = vwi.Create(); Global.Config.VideoWriter = vwi.Attribs.ShortName; } else { ret = null; } if (ret != null && dlg.checkBoxResize.Checked) { resizew = dlg.numericTextBoxW.IntValue; resizeh = dlg.numericTextBoxH.IntValue; } else { resizew = -1; resizeh = -1; } pad = dlg.checkBoxPad.Checked; audiosync = dlg.checkBoxASync.Checked; dlg.Dispose(); return ret; }