Skip to content

Commit 0bcd570

Browse files
committed
Add a Close button and reorder some existing buttons
Closes #59
1 parent 9fff578 commit 0bcd570

File tree

1 file changed

+74
-55
lines changed

1 file changed

+74
-55
lines changed

ConfigurationManager/ConfigurationManager.cs

Lines changed: 74 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -380,85 +380,104 @@ private void DrawTips()
380380
GUILayout.BeginHorizontal();
381381
{
382382
GUILayout.Label("Tip: Click plugin names to expand. Click setting and group names to see their descriptions.");
383-
384-
GUILayout.FlexibleSpace();
385-
386-
if (GUILayout.Button(_pluginConfigCollapsedDefault.Value ? "Expand" : "Collapse", GUILayout.ExpandWidth(false)))
387-
{
388-
var newValue = !_pluginConfigCollapsedDefault.Value;
389-
_pluginConfigCollapsedDefault.Value = newValue;
390-
foreach (var plugin in _filteredSetings)
391-
plugin.Collapsed = newValue;
392-
}
393383
}
394384
GUILayout.EndHorizontal();
395385
}
396386

397387
private void DrawWindowHeader()
398388
{
399-
GUILayout.BeginHorizontal(GUI.skin.box);
389+
GUILayout.BeginHorizontal();
400390
{
401-
GUILayout.Label("Show: ", GUILayout.ExpandWidth(false));
402-
403-
GUI.enabled = SearchString == string.Empty;
404-
405-
var newVal = GUILayout.Toggle(_showSettings.Value, "Normal settings");
406-
if (_showSettings.Value != newVal)
391+
GUILayout.BeginHorizontal(GUI.skin.box);
407392
{
408-
_showSettings.Value = newVal;
409-
BuildFilteredSettingList();
410-
}
393+
GUILayout.Label("Show: ");
411394

412-
newVal = GUILayout.Toggle(_showKeybinds.Value, "Keyboard shortcuts");
413-
if (_showKeybinds.Value != newVal)
414-
{
415-
_showKeybinds.Value = newVal;
416-
BuildFilteredSettingList();
417-
}
395+
GUI.enabled = SearchString == string.Empty;
418396

419-
var origColor = GUI.color;
420-
GUI.color = _advancedSettingColor;
421-
newVal = GUILayout.Toggle(_showAdvanced.Value, "Advanced settings");
422-
if (_showAdvanced.Value != newVal)
423-
{
424-
_showAdvanced.Value = newVal;
425-
BuildFilteredSettingList();
426-
}
427-
GUI.color = origColor;
397+
var newVal = GUILayout.Toggle(_showSettings.Value, "Normal settings");
398+
if (_showSettings.Value != newVal)
399+
{
400+
_showSettings.Value = newVal;
401+
BuildFilteredSettingList();
402+
}
428403

429-
GUI.enabled = true;
404+
newVal = GUILayout.Toggle(_showKeybinds.Value, "Keyboard shortcuts");
405+
if (_showKeybinds.Value != newVal)
406+
{
407+
_showKeybinds.Value = newVal;
408+
BuildFilteredSettingList();
409+
}
430410

431-
newVal = GUILayout.Toggle(_showDebug, "Debug mode");
432-
if (_showDebug != newVal)
433-
{
434-
_showDebug = newVal;
435-
BuildSettingList();
411+
var origColor = GUI.color;
412+
GUI.color = _advancedSettingColor;
413+
newVal = GUILayout.Toggle(_showAdvanced.Value, "Advanced settings");
414+
if (_showAdvanced.Value != newVal)
415+
{
416+
_showAdvanced.Value = newVal;
417+
BuildFilteredSettingList();
418+
}
419+
GUI.color = origColor;
420+
421+
GUI.enabled = true;
436422
}
423+
GUILayout.EndHorizontal();
437424

438-
if (GUILayout.Button("Log", GUILayout.ExpandWidth(false)))
425+
GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(false));
439426
{
440-
try { Utils.OpenLog(); }
441-
catch (SystemException ex) { Logger.Log(LogLevel.Message | LogLevel.Error, ex.Message); }
427+
if (GUILayout.Button("Close"))
428+
{
429+
DisplayingWindow = false;
430+
}
442431
}
432+
GUILayout.EndHorizontal();
443433
}
444434
GUILayout.EndHorizontal();
445435

446-
GUILayout.BeginHorizontal(GUI.skin.box);
436+
GUILayout.BeginHorizontal();
447437
{
448-
GUILayout.Label("Search settings: ", GUILayout.ExpandWidth(false));
438+
GUILayout.BeginHorizontal(GUI.skin.box);
439+
{
440+
GUILayout.Label("Search: ", GUILayout.ExpandWidth(false));
449441

450-
GUI.SetNextControlName(SearchBoxName);
451-
SearchString = GUILayout.TextField(SearchString, GUILayout.ExpandWidth(true));
442+
GUI.SetNextControlName(SearchBoxName);
443+
SearchString = GUILayout.TextField(SearchString, GUILayout.ExpandWidth(true), GUILayout.MinWidth(250));
452444

453-
if (_focusSearchBox)
454-
{
455-
GUI.FocusWindow(WindowId);
456-
GUI.FocusControl(SearchBoxName);
457-
_focusSearchBox = false;
445+
if (_focusSearchBox)
446+
{
447+
GUI.FocusWindow(WindowId);
448+
GUI.FocusControl(SearchBoxName);
449+
_focusSearchBox = false;
450+
}
451+
452+
if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false)))
453+
SearchString = string.Empty;
458454
}
455+
GUILayout.EndHorizontal();
459456

460-
if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false)))
461-
SearchString = string.Empty;
457+
GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(false));
458+
{
459+
if (GUILayout.Button(_pluginConfigCollapsedDefault.Value ? "Expand All" : "Collapse All"))
460+
{
461+
var newValue = !_pluginConfigCollapsedDefault.Value;
462+
_pluginConfigCollapsedDefault.Value = newValue;
463+
foreach (var plugin in _filteredSetings)
464+
plugin.Collapsed = newValue;
465+
}
466+
467+
var newVal = GUILayout.Toggle(_showDebug, "Debug mode");
468+
if (_showDebug != newVal)
469+
{
470+
_showDebug = newVal;
471+
BuildSettingList();
472+
}
473+
474+
if (GUILayout.Button("Open Log"))
475+
{
476+
try { Utils.OpenLog(); }
477+
catch (SystemException ex) { Logger.Log(LogLevel.Message | LogLevel.Error, ex.Message); }
478+
}
479+
}
480+
GUILayout.EndHorizontal();
462481
}
463482
GUILayout.EndHorizontal();
464483
}

0 commit comments

Comments
 (0)