From 9df0821fcd3096d824705d14d1a95230681bb906 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 21 Jan 2014 16:25:51 +0000 Subject: [PATCH] Lua Console - convert spaces to tabs and remove a todo --- .../tools/Lua/LuaConsole.cs | 129 +++++++++--------- 1 file changed, 64 insertions(+), 65 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index 28a0be220b..8863437404 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -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 } } - /// -MightyMar - /// Sorts the column Ascending on the first click and Descending on the second click. - /// - /// - /// - private void LuaListView_ColumnClick(object sender, ColumnClickEventArgs e) - { - String columnToSort = LuaListView.Columns[e.Column].Text; - List luaListTemp = new List(); - if (columnToSort != _lastColumnSorted) - { - _sortReverse = false; - } + /// -MightyMar + /// Sorts the column Ascending on the first click and Descending on the second click. + /// + /// + /// + private void LuaListView_ColumnClick(object sender, ColumnClickEventArgs e) + { + String columnToSort = LuaListView.Columns[e.Column].Text; + List luaListTemp = new List(); + 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; + }