diff --git a/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs b/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs index af4c2813b4..d8ad72b03f 100644 --- a/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs +++ b/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs @@ -304,5 +304,20 @@ namespace BizHawk.Client.EmuHawk bitmap.Save(file.FullName, i); } + + public static void SetDistanceOrDefault(this SplitContainer splitter, int distance, int defaultDistance) + { + if (distance > 0) + { + try + { + splitter.SplitterDistance = distance; + } + catch (Exception) + { + splitter.SplitterDistance = defaultDistance; + } + } + } } } diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index 52c5624ab4..ac22549501 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -194,17 +194,7 @@ namespace BizHawk.Client.EmuHawk LuaListView.AllColumns.Clear(); SetColumns(); - if (Settings.SplitDistance > 0) - { - try - { - splitContainer1.SplitterDistance = Settings.SplitDistance; - } - catch (Exception) - { - splitContainer1.SplitterDistance = _defaultSplitDistance; - } - } + splitContainer1.SetDistanceOrDefault(Settings.SplitDistance, _defaultSplitDistance); } private void BranchesMarkersSplit_SplitterMoved(object sender, SplitterEventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index a2aa3f869a..8e7a7494b9 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -176,31 +176,13 @@ namespace BizHawk.Client.EmuHawk _autosaveTimer.Start(); } - // Remembering Split container logic - if (Settings.MainVerticalSplitDistance > 0) - { - try - { - MainVertialSplit.SplitterDistance = Settings.MainVerticalSplitDistance; - } - catch (Exception) - { - MainVertialSplit.SplitterDistance = _defaultMainSplitDistance; - } - - } + MainVertialSplit.SetDistanceOrDefault( + Settings.MainVerticalSplitDistance, + _defaultMainSplitDistance); - if (Settings.BranchMarkerSplitDistance > 0) - { - try - { - BranchesMarkersSplit.SplitterDistance = Settings.BranchMarkerSplitDistance; - } - catch (Exception) - { - BranchesMarkersSplit.SplitterDistance = _defaultBranchMarkerSplitDistance; - } - } + BranchesMarkersSplit.SetDistanceOrDefault( + Settings.BranchMarkerSplitDistance, + _defaultBranchMarkerSplitDistance); TasView.Font = TasViewFont; CurrentTasMovie.BindMarkersToInput = Settings.BindMarkersToInput;