Skip to content

Commit

Permalink
Add a Close button and reorder some existing buttons
Browse files Browse the repository at this point in the history
Closes #59
  • Loading branch information
ManlyMarco committed Mar 7, 2023
1 parent 9fff578 commit 0bcd570
Showing 1 changed file with 74 additions and 55 deletions.
129 changes: 74 additions & 55 deletions ConfigurationManager/ConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,85 +380,104 @@ private void DrawTips()
GUILayout.BeginHorizontal();
{
GUILayout.Label("Tip: Click plugin names to expand. Click setting and group names to see their descriptions.");

GUILayout.FlexibleSpace();

if (GUILayout.Button(_pluginConfigCollapsedDefault.Value ? "Expand" : "Collapse", GUILayout.ExpandWidth(false)))
{
var newValue = !_pluginConfigCollapsedDefault.Value;
_pluginConfigCollapsedDefault.Value = newValue;
foreach (var plugin in _filteredSetings)
plugin.Collapsed = newValue;
}
}
GUILayout.EndHorizontal();
}

private void DrawWindowHeader()
{
GUILayout.BeginHorizontal(GUI.skin.box);
GUILayout.BeginHorizontal();
{
GUILayout.Label("Show: ", GUILayout.ExpandWidth(false));

GUI.enabled = SearchString == string.Empty;

var newVal = GUILayout.Toggle(_showSettings.Value, "Normal settings");
if (_showSettings.Value != newVal)
GUILayout.BeginHorizontal(GUI.skin.box);
{
_showSettings.Value = newVal;
BuildFilteredSettingList();
}
GUILayout.Label("Show: ");

newVal = GUILayout.Toggle(_showKeybinds.Value, "Keyboard shortcuts");
if (_showKeybinds.Value != newVal)
{
_showKeybinds.Value = newVal;
BuildFilteredSettingList();
}
GUI.enabled = SearchString == string.Empty;

var origColor = GUI.color;
GUI.color = _advancedSettingColor;
newVal = GUILayout.Toggle(_showAdvanced.Value, "Advanced settings");
if (_showAdvanced.Value != newVal)
{
_showAdvanced.Value = newVal;
BuildFilteredSettingList();
}
GUI.color = origColor;
var newVal = GUILayout.Toggle(_showSettings.Value, "Normal settings");
if (_showSettings.Value != newVal)
{
_showSettings.Value = newVal;
BuildFilteredSettingList();
}

GUI.enabled = true;
newVal = GUILayout.Toggle(_showKeybinds.Value, "Keyboard shortcuts");
if (_showKeybinds.Value != newVal)
{
_showKeybinds.Value = newVal;
BuildFilteredSettingList();
}

newVal = GUILayout.Toggle(_showDebug, "Debug mode");
if (_showDebug != newVal)
{
_showDebug = newVal;
BuildSettingList();
var origColor = GUI.color;
GUI.color = _advancedSettingColor;
newVal = GUILayout.Toggle(_showAdvanced.Value, "Advanced settings");
if (_showAdvanced.Value != newVal)
{
_showAdvanced.Value = newVal;
BuildFilteredSettingList();
}
GUI.color = origColor;

GUI.enabled = true;
}
GUILayout.EndHorizontal();

if (GUILayout.Button("Log", GUILayout.ExpandWidth(false)))
GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(false));
{
try { Utils.OpenLog(); }
catch (SystemException ex) { Logger.Log(LogLevel.Message | LogLevel.Error, ex.Message); }
if (GUILayout.Button("Close"))
{
DisplayingWindow = false;
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal(GUI.skin.box);
GUILayout.BeginHorizontal();
{
GUILayout.Label("Search settings: ", GUILayout.ExpandWidth(false));
GUILayout.BeginHorizontal(GUI.skin.box);
{
GUILayout.Label("Search: ", GUILayout.ExpandWidth(false));

GUI.SetNextControlName(SearchBoxName);
SearchString = GUILayout.TextField(SearchString, GUILayout.ExpandWidth(true));
GUI.SetNextControlName(SearchBoxName);
SearchString = GUILayout.TextField(SearchString, GUILayout.ExpandWidth(true), GUILayout.MinWidth(250));

if (_focusSearchBox)
{
GUI.FocusWindow(WindowId);
GUI.FocusControl(SearchBoxName);
_focusSearchBox = false;
if (_focusSearchBox)
{
GUI.FocusWindow(WindowId);
GUI.FocusControl(SearchBoxName);
_focusSearchBox = false;
}

if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false)))
SearchString = string.Empty;
}
GUILayout.EndHorizontal();

if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false)))
SearchString = string.Empty;
GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(false));
{
if (GUILayout.Button(_pluginConfigCollapsedDefault.Value ? "Expand All" : "Collapse All"))
{
var newValue = !_pluginConfigCollapsedDefault.Value;
_pluginConfigCollapsedDefault.Value = newValue;
foreach (var plugin in _filteredSetings)
plugin.Collapsed = newValue;
}

var newVal = GUILayout.Toggle(_showDebug, "Debug mode");
if (_showDebug != newVal)
{
_showDebug = newVal;
BuildSettingList();
}

if (GUILayout.Button("Open Log"))
{
try { Utils.OpenLog(); }
catch (SystemException ex) { Logger.Log(LogLevel.Message | LogLevel.Error, ex.Message); }
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndHorizontal();
}
Expand Down

0 comments on commit 0bcd570

Please sign in to comment.
  翻译: