misc cleanups

This commit is contained in:
adelikat 2019-10-29 08:23:40 -05:00
parent 1b548ed92d
commit 0b965dffc5
5 changed files with 27 additions and 47 deletions

View File

@ -101,15 +101,9 @@ namespace BizHawk.Client.EmuHawk
public bool UpdateBefore => true;
private IEnumerable<LuaFile> SelectedItems
{
get { return LuaListView.SelectedRows.Select(index => LuaImp.ScriptList[index]); }
}
private IEnumerable<LuaFile> SelectedItems => LuaListView.SelectedRows.Select(index => LuaImp.ScriptList[index]);
private IEnumerable<LuaFile> SelectedFiles
{
get { return SelectedItems.Where(x => !x.IsSeparator); }
}
private IEnumerable<LuaFile> SelectedFiles => SelectedItems.Where(x => !x.IsSeparator);
public void NewUpdate(ToolFormUpdateType type) { }

View File

@ -119,31 +119,24 @@ namespace BizHawk.Client.EmuHawk
private class Sorting
{
private bool _desc;
private int _column = 1;
public int Column
{
get
{
return _column;
}
get => _column;
set
{
if (_column == value)
{
_desc ^= true;
Descending ^= true;
}
_column = value;
}
}
public bool Descending
{
get { return _desc; }
}
public bool Descending { get; private set; }
}
private void FunctionView_KeyDown(object sender, KeyEventArgs e)
@ -189,7 +182,9 @@ namespace BizHawk.Client.EmuHawk
}
if (sb.Length > 0)
{
Clipboard.SetText(sb.ToString());
}
}
private void UpdateList()

View File

@ -332,8 +332,8 @@ namespace BizHawk.Client.EmuHawk
var f = new StringFormat(StringFormat.GenericDefault);
var font = new Font(family, fontsize ?? 12, fstyle, GraphicsUnit.Pixel);
var boxBackground = Graphics.FromImage(Image);
Size sizeOfText = boxBackground.MeasureString(message, font, 0, f).ToSize();
Size sizeOfText = boxBackground.MeasureString(message, font, 0, f).ToSize();
if (horizalign != null)
{

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml.Linq;
@ -18,7 +16,7 @@ namespace BizHawk.Client.EmuHawk
{
public partial class MultiDiskBundler : Form, IToolFormAutoConfig
{
private XElement _currentXml = null;
private XElement _currentXml;
[RequiredService]
public IEmulator Emulator { get; set; }
@ -35,7 +33,6 @@ namespace BizHawk.Client.EmuHawk
if (!Global.Game.IsNullInstance && !GlobalWin.MainForm.CurrentlyOpenRom.EndsWith(".xml"))
{
string currentRom = GlobalWin.MainForm.CurrentlyOpenRom;
if (GlobalWin.MainForm.CurrentlyOpenRom.Contains("|"))
{
var pieces = GlobalWin.MainForm.CurrentlyOpenRom.Split('|');
@ -50,12 +47,12 @@ namespace BizHawk.Client.EmuHawk
NameBox.Text = Path.ChangeExtension(GlobalWin.MainForm.CurrentlyOpenRom, ".xml");
}
if (SystemDropDown.Items.Contains(Emulator.SystemId))
{
SystemDropDown.SelectedItem = Emulator.SystemId;
}
if (SystemDropDown.Items.Contains(Emulator.SystemId))
{
SystemDropDown.SelectedItem = Emulator.SystemId;
}
FileSelectors.First().SetName(GlobalWin.MainForm.CurrentlyOpenRom);
FileSelectors.First().SetName(GlobalWin.MainForm.CurrentlyOpenRom);
}
}
@ -83,10 +80,7 @@ namespace BizHawk.Client.EmuHawk
return true;
}
public bool UpdateBefore
{
get { return true; }
}
public bool UpdateBefore => true;
#endregion
@ -115,8 +109,8 @@ namespace BizHawk.Client.EmuHawk
DialogResult = DialogResult.OK;
Close();
var lra = new MainForm.LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom { Path = fileInfo.FullName } };
GlobalWin.MainForm.LoadRom(fileInfo.FullName, lra);
var lra = new MainForm.LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom { Path = fileInfo.FullName } };
GlobalWin.MainForm.LoadRom(fileInfo.FullName, lra);
}
}
@ -132,18 +126,18 @@ namespace BizHawk.Client.EmuHawk
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
};
var mdf = new MultiDiskFileSelector
{
Location = UIHelper.Scale(new Point(7, 12)),
Width = groupBox.ClientSize.Width - UIHelper.ScaleX(13),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
var mdf = new MultiDiskFileSelector
{
Location = UIHelper.Scale(new Point(7, 12)),
Width = groupBox.ClientSize.Width - UIHelper.ScaleX(13),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
};
mdf.NameChanged += FileSelector_NameChanged;
mdf.SystemString = SystemDropDown.SelectedText;
mdf.SystemString = SystemDropDown.SelectedText;
groupBox.Controls.Add(mdf);
groupBox.Controls.Add(mdf);
FileSelectorPanel.Controls.Add(groupBox);
}
@ -236,11 +230,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private static string ConvertToTag(string name)
{
return new Regex("[^A-Za-z0-9]").Replace(name, "");
}
private void NameBox_TextChanged(object sender, EventArgs e)
{
Recalculate();

View File

@ -186,6 +186,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=autorestore/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autosave/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=backcolor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bezier/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=botting/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsnes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bundler/@EntryIndexedValue">True</s:Boolean>
@ -261,6 +262,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vectrex/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Virtua/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vsync/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Winform/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=winforms/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=WSWAN/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xjin/@EntryIndexedValue">True</s:Boolean>