Lua Console - convert spaces to tabs and remove a todo
This commit is contained in:
parent
a177a111b9
commit
9df0821fcd
|
@ -16,16 +16,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// TODO:
|
||||
// remember column widths and restore column width on restore default settings
|
||||
// column click
|
||||
// ^ done the sorting - MightyMar
|
||||
// column reorder
|
||||
public EmuLuaLibrary LuaImp { get; set; }
|
||||
|
||||
private readonly LuaFileList _luaList;
|
||||
private int _defaultWidth;
|
||||
private int _defaultHeight;
|
||||
private bool _sortReverse;
|
||||
private string _lastColumnSorted;
|
||||
private bool _sortReverse;
|
||||
private string _lastColumnSorted;
|
||||
|
||||
public bool UpdateBefore { get { return true; } }
|
||||
public void UpdateValues() { }
|
||||
|
@ -41,8 +39,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public LuaConsole()
|
||||
{
|
||||
_sortReverse = false;
|
||||
_lastColumnSorted = String.Empty;
|
||||
_sortReverse = false;
|
||||
_lastColumnSorted = String.Empty;
|
||||
_luaList = new LuaFileList
|
||||
{
|
||||
ChangedCallback = SessionChangedCallback,
|
||||
|
@ -179,7 +177,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void SessionChangedCallback()
|
||||
{
|
||||
OutputMessages.Text =
|
||||
(_luaList.Changes ? "* " : String.Empty) +
|
||||
(_luaList.Changes ? "* " : String.Empty) +
|
||||
Path.GetFileName(_luaList.Filename);
|
||||
}
|
||||
|
||||
|
@ -233,7 +231,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_defaultHeight = Size.Height;
|
||||
|
||||
if (Global.Config.LuaConsoleSaveWindowPosition && Global.Config.LuaConsoleWndx >= 0
|
||||
&& Global.Config.LuaConsoleWndy >= 0)
|
||||
&& Global.Config.LuaConsoleWndy >= 0)
|
||||
{
|
||||
Location = new Point(Global.Config.LuaConsoleWndx, Global.Config.LuaConsoleWndy);
|
||||
}
|
||||
|
@ -248,8 +246,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var ofd = new OpenFileDialog
|
||||
{
|
||||
InitialDirectory = PathManager.GetLuaPath(),
|
||||
Filter = filter, RestoreDirectory = true
|
||||
InitialDirectory = PathManager.GetLuaPath(),
|
||||
Filter = filter,
|
||||
RestoreDirectory = true
|
||||
};
|
||||
|
||||
if (!Directory.Exists(ofd.InitialDirectory))
|
||||
|
@ -1009,66 +1008,66 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> -MightyMar
|
||||
/// Sorts the column Ascending on the first click and Descending on the second click.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LuaListView_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
String columnToSort = LuaListView.Columns[e.Column].Text;
|
||||
List<LuaFile> luaListTemp = new List<LuaFile>();
|
||||
if (columnToSort != _lastColumnSorted)
|
||||
{
|
||||
_sortReverse = false;
|
||||
}
|
||||
/// <summary> -MightyMar
|
||||
/// Sorts the column Ascending on the first click and Descending on the second click.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LuaListView_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
String columnToSort = LuaListView.Columns[e.Column].Text;
|
||||
List<LuaFile> luaListTemp = new List<LuaFile>();
|
||||
if (columnToSort != _lastColumnSorted)
|
||||
{
|
||||
_sortReverse = false;
|
||||
}
|
||||
|
||||
//For getting the name of the .lua file, for some reason this field is kept blank in LuaFile.cs?
|
||||
//The Name variable gets emptied again near the end just in case it would break something.
|
||||
for (int i = 0; i < _luaList.Count; i++)
|
||||
{
|
||||
String[] words = Regex.Split(_luaList[i].Path, ".lua");
|
||||
String[] split = words[0].Split('\\');
|
||||
//For getting the name of the .lua file, for some reason this field is kept blank in LuaFile.cs?
|
||||
//The Name variable gets emptied again near the end just in case it would break something.
|
||||
for (int i = 0; i < _luaList.Count; i++)
|
||||
{
|
||||
String[] words = Regex.Split(_luaList[i].Path, ".lua");
|
||||
String[] split = words[0].Split('\\');
|
||||
|
||||
luaListTemp.Add(_luaList[i]);
|
||||
luaListTemp[i].Name = split[split.Count() - 1];
|
||||
}
|
||||
luaListTemp.Add(_luaList[i]);
|
||||
luaListTemp[i].Name = split[split.Count() - 1];
|
||||
}
|
||||
|
||||
//Script, Path
|
||||
switch (columnToSort)
|
||||
{
|
||||
case "Script":
|
||||
if (_sortReverse)
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderByDescending(x => x.Name).ThenBy(x => x.Path).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderBy(x => x.Name).ThenBy(x => x.Path).ToList();
|
||||
//Script, Path
|
||||
switch (columnToSort)
|
||||
{
|
||||
case "Script":
|
||||
if (_sortReverse)
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderByDescending(x => x.Name).ThenBy(x => x.Path).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderBy(x => x.Name).ThenBy(x => x.Path).ToList();
|
||||
|
||||
}
|
||||
break;
|
||||
case "Path":
|
||||
if (_sortReverse)
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderByDescending(x => x.Path).ThenBy(x => x.Name).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderBy(x => x.Path).ThenBy(x => x.Name).ToList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Path":
|
||||
if (_sortReverse)
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderByDescending(x => x.Path).ThenBy(x => x.Name).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
luaListTemp = luaListTemp.OrderBy(x => x.Path).ThenBy(x => x.Name).ToList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _luaList.Count; i++)
|
||||
{
|
||||
_luaList[i] = luaListTemp[i];
|
||||
_luaList[i].Name = String.Empty;
|
||||
}
|
||||
UpdateDialog();
|
||||
_lastColumnSorted = columnToSort;
|
||||
_sortReverse = !_sortReverse;
|
||||
}
|
||||
for (int i = 0; i < _luaList.Count; i++)
|
||||
{
|
||||
_luaList[i] = luaListTemp[i];
|
||||
_luaList[i].Name = String.Empty;
|
||||
}
|
||||
UpdateDialog();
|
||||
_lastColumnSorted = columnToSort;
|
||||
_sortReverse = !_sortReverse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue