Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions RuntimeUnityEditor.Bepin5/LogViewer/LogViewerEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public bool DrawEntry()
{
GUI.color = GetColor();
var clicked = GUILayout.Button(_timeString, GUI.skin.label, GUILayout.MinWidth(35));
GUILayout.Label("[", GUILayout.ExpandWidth(false));
GUILayout.Label("[", IMGUIUtils.LayoutOptionsExpandWidthFalse);
clicked |= GUILayout.Button(_logLevelString, GUI.skin.label, GUILayout.MinWidth(45));
GUILayout.Label(":", GUILayout.ExpandWidth(false));
GUILayout.Label(":", IMGUIUtils.LayoutOptionsExpandWidthFalse);
clicked |= GUILayout.Button(_sourceNameString, GUI.skin.label, GUILayout.MinWidth(100));
GUILayout.Label("]", GUILayout.ExpandWidth(false));
GUILayout.Label("]", IMGUIUtils.LayoutOptionsExpandWidthFalse);
GUI.color = Color.white;
clicked |= GUILayout.Button(_dataString, GUI.skin.label, GUILayout.ExpandWidth(true));
clicked |= GUILayout.Button(_dataString, GUI.skin.label, IMGUIUtils.LayoutOptionsExpandWidthTrue);
return clicked;
}

Expand Down
8 changes: 4 additions & 4 deletions RuntimeUnityEditor.Bepin5/LogViewer/LogViewerWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ protected override void DrawContents()
{
GUILayout.BeginHorizontal();
{
GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(true));
GUILayout.BeginHorizontal(GUI.skin.box, IMGUIUtils.LayoutOptionsExpandWidthTrue);
{
GUI.changed = false;
var searchString = SearchString;
var isEmpty = string.IsNullOrEmpty(searchString) && GUI.GetNameOfFocusedControl() != "sbox";
if (isEmpty) GUI.color = Color.gray;
GUI.SetNextControlName("sbox");
var newString = GUILayout.TextField(isEmpty ? "Search log text and stack traces..." : searchString, GUILayout.ExpandWidth(true));
var newString = GUILayout.TextField(isEmpty ? "Search log text and stack traces..." : searchString, IMGUIUtils.LayoutOptionsExpandWidthTrue);
if (GUI.changed) SearchString = newString;
GUI.color = Color.white;
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(false));
GUILayout.BeginHorizontal(GUI.skin.box, IMGUIUtils.LayoutOptionsExpandWidthFalse);
{
if (!Capture) GUI.color = Color.red;
Capture = GUILayout.Toggle(Capture, new GUIContent("Enable log capture", "Note: This can hurt performance, especially if there is log spam."));
Expand Down Expand Up @@ -240,7 +240,7 @@ protected override void DrawContents()
}
}

if (entry.Sender != null && GUILayout.Button("Inspect", GUILayout.ExpandWidth(false)))
if (entry.Sender != null && GUILayout.Button("Inspect", IMGUIUtils.LayoutOptionsExpandWidthFalse))
Inspector.Instance.Push(new InstanceStackEntry(entry, entry.LogEventArgs.Source.SourceName + " -> Log entry"), true);

DnSpyHelper.DrawDnSpyButtonIfAvailable(entry.Method, new GUIContent("^", $"In dnSpy, attempt to navigate to the method that produced this log message:\n\n{entry.Method.GetFancyDescription()}"));
Expand Down
7 changes: 4 additions & 3 deletions RuntimeUnityEditor.UMM/RuntimeUnityEditorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using RuntimeUnityEditor.Core.Utils;
using UnityEngine;
using UnityModManagerNet;
#pragma warning disable CS0618
Expand Down Expand Up @@ -120,7 +121,7 @@ public void Draw(UnityModManager.ModEntry entry)
}
else if (setting is Setting<UnityEngine.KeyCode> keycodeSetting)
{
GUILayout.Label(settingName, GUILayout.ExpandWidth(false));
GUILayout.Label(settingName, IMGUIUtils.LayoutOptionsExpandWidthFalse);

var value = new KeyBinding() { keyCode = keycodeSetting.Value };
if (UnityModManager.UI.DrawKeybinding(ref value, settingName)) keycodeSetting.Value = value.keyCode;
Expand All @@ -129,9 +130,9 @@ public void Draw(UnityModManager.ModEntry entry)
else if (setting is Setting<string> stringSetting)
{
GUILayout.BeginVertical();
GUILayout.Label(settingName, GUILayout.ExpandWidth(false));
GUILayout.Label(settingName, IMGUIUtils.LayoutOptionsExpandWidthFalse);

var value = GUILayout.TextField(stringSetting.Value, GUILayout.ExpandWidth(true));
var value = GUILayout.TextField(stringSetting.Value, IMGUIUtils.LayoutOptionsExpandWidthTrue);
if (value != stringSetting.Value) stringSetting.Value = value;
GUILayout.EndVertical();
}
Expand Down
2 changes: 1 addition & 1 deletion RuntimeUnityEditor/Features/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void Show(object obj, MemberInfo objMemberInfo, Vector2 clickPoint)
/// </summary>
public void DrawContextButton(object obj, MemberInfo objMemberInfo)
{
if (obj != null && GUILayout.Button("...", GUILayout.ExpandWidth(false)))
if (obj != null && GUILayout.Button("...", IMGUIUtils.LayoutOptionsExpandWidthFalse))
Show(obj, objMemberInfo);
}

Expand Down
2 changes: 1 addition & 1 deletion RuntimeUnityEditor/Utils/Abstractions/DnSpyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void IFeature.OnEditorShownChanged(bool visible) { }
private static readonly GUIContent _guiContent = new GUIContent("^", "Navigate to this member in dnSpy");
internal static void DrawDnSpyButtonIfAvailable(MemberInfo mi, GUIContent customButtonContent = null)
{
if (IsAvailable && GUILayout.Button(customButtonContent ?? _guiContent, GUILayout.ExpandWidth(false)))
if (IsAvailable && GUILayout.Button(customButtonContent ?? _guiContent, IMGUIUtils.LayoutOptionsExpandWidthFalse))
OpenInDnSpy(mi);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ protected override void DrawContents()
GUI.color = Color.white;
}

GUILayout.TextField(change.GetDisplayString(), GUI.skin.label, GUILayout.ExpandWidth(true));
GUILayout.TextField(change.GetDisplayString(), GUI.skin.label, IMGUIUtils.LayoutOptionsExpandWidthTrue);

if (change.CanUndo && GUILayout.Button(_undoContent, GUILayout.ExpandWidth(false)))
if (change.CanUndo && GUILayout.Button(_undoContent, IMGUIUtils.LayoutOptionsExpandWidthFalse))
{
try
{
Expand All @@ -101,7 +101,7 @@ protected override void DrawContents()
}
}

if (!change.Target.IsNullOrDestroyed() && GUILayout.Button(_inspectContent, GUILayout.ExpandWidth(false)))
if (!change.Target.IsNullOrDestroyed() && GUILayout.Button(_inspectContent, IMGUIUtils.LayoutOptionsExpandWidthFalse))
Inspector.Inspector.Instance.Push(new InstanceStackEntry(change.Target, change.GetDisplayString()), true);
}
GUILayout.EndHorizontal();
Expand Down
8 changes: 4 additions & 4 deletions RuntimeUnityEditor/Windows/Clipboard/ClipboardWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override void DrawContents()
GUILayout.FlexibleSpace();
GUILayout.Label("You can copy objects to clipboard by clicking the 'C' button in inspector, or by running the 'copy(object)' command in REPL. Structs are copied by value, classes by reference.\n\n" +
"Clipboard contents can be used in REPL by running the 'paste(index)' command, or in inspector when invoking a method.\n\n" +
"Press 'X' to remove item from clipboard, right click on it to open a menu with more options.", GUILayout.ExpandWidth(true));
"Press 'X' to remove item from clipboard, right click on it to open a menu with more options.", IMGUIUtils.LayoutOptionsExpandWidthTrue);
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
Expand All @@ -57,7 +57,7 @@ protected override void DrawContents()
{
GUILayout.Label("Index", GUILayout.Width(widthIndex), GUILayout.ExpandWidth(false));
GUILayout.Label("Type", GUILayout.Width(widthName), GUILayout.ExpandWidth(false));
GUILayout.Label("Value", GUILayout.ExpandWidth(true));
GUILayout.Label("Value", IMGUIUtils.LayoutOptionsExpandWidthTrue);
}
GUILayout.EndHorizontal();

Expand All @@ -78,7 +78,7 @@ protected override void DrawContents()
var prevEnabled = GUI.enabled;
GUI.enabled = type != null && typeof(IConvertible).IsAssignableFrom(type);
GUI.changed = false;
var newVal = GUILayout.TextField(ToStringConverter.ObjectToString(content), GUILayout.ExpandWidth(true));
var newVal = GUILayout.TextField(ToStringConverter.ObjectToString(content), IMGUIUtils.LayoutOptionsExpandWidthTrue);
if (GUI.changed && type != null)
{
try
Expand All @@ -93,7 +93,7 @@ protected override void DrawContents()

GUI.enabled = prevEnabled;

if (GUILayout.Button("X", GUILayout.ExpandWidth(false)))
if (GUILayout.Button("X", IMGUIUtils.LayoutOptionsExpandWidthFalse))
Contents.RemoveAt(index);
}
GUILayout.EndHorizontal();
Expand Down
20 changes: 10 additions & 10 deletions RuntimeUnityEditor/Windows/Inspector/Inspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ protected override void DrawContents()
{
GUILayout.BeginHorizontal();
{
GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(true));
GUILayout.BeginHorizontal(GUI.skin.box, IMGUIUtils.LayoutOptionsExpandWidthTrue);
{
GUILayout.Label("Filter:", GUILayout.ExpandWidth(false));
GUILayout.Label("Filter:", IMGUIUtils.LayoutOptionsExpandWidthFalse);

GUI.SetNextControlName(SearchBoxName);
SearchString = GUILayout.TextField(SearchString, GUILayout.ExpandWidth(true));
SearchString = GUILayout.TextField(SearchString, IMGUIUtils.LayoutOptionsExpandWidthTrue);

if (_focusSearchBox)
{
Expand All @@ -206,7 +206,7 @@ protected override void DrawContents()
_showDeclaredOnly = GUILayout.Toggle(_showDeclaredOnly, "Only declared");

/* todo
GUILayout.Label("Find:", GUILayout.ExpandWidth(false));
GUILayout.Label("Find:", IMGUIUtils.LayoutOptionsExpandWidthFalse);
foreach (var obj in new[]
{
new KeyValuePair<object, string>(EditorUtilities.GetInstanceClassScanner().OrderBy(x => x.Name()), "Instances"),
Expand All @@ -217,7 +217,7 @@ protected override void DrawContents()
})
{
if (obj.Key == null) continue;
if (GUILayout.Button(obj.Value, GUILayout.ExpandWidth(false)))
if (GUILayout.Button(obj.Value, IMGUIUtils.LayoutOptionsExpandWidthFalse))
Push(new InstanceStackEntry(obj.Key, obj.Value), true);
}*/
}
Expand Down Expand Up @@ -257,7 +257,7 @@ protected override void DrawContents()
if (currentTab == tab)
GUI.backgroundColor = Color.cyan;

if (GUILayout.Button($"Tab {index + 1}: {LimitStringLengthForPreview(tab?.CurrentStackItem?.Name, 18)}", GUILayout.ExpandWidth(false)))
if (GUILayout.Button($"Tab {index + 1}: {LimitStringLengthForPreview(tab?.CurrentStackItem?.Name, 18)}", IMGUIUtils.LayoutOptionsExpandWidthFalse))
{
// todo custom context menu for the tab bar? IMGUIUtils.IsMouseRightClick()
if (IMGUIUtils.IsMouseWheelClick())
Expand Down Expand Up @@ -293,7 +293,7 @@ protected override void DrawContents()
if (stackEntry == currentTab.CurrentStackItem)
GUI.backgroundColor = Color.cyan;

if (GUILayout.Button(LimitStringLengthForPreview(stackEntry.Name, 90), GUILayout.ExpandWidth(false)))
if (GUILayout.Button(LimitStringLengthForPreview(stackEntry.Name, 90), IMGUIUtils.LayoutOptionsExpandWidthFalse))
{
if (IMGUIUtils.IsMouseRightClick())
stackEntry.ShowContextMenu();
Expand All @@ -305,7 +305,7 @@ protected override void DrawContents()
}

if (i + 1 < stackEntries.Length)
GUILayout.Label(">", GUILayout.ExpandWidth(false));
GUILayout.Label(">", IMGUIUtils.LayoutOptionsExpandWidthFalse);

GUI.backgroundColor = defaultGuiColor;
}
Expand All @@ -322,7 +322,7 @@ protected override void DrawContents()
GUILayout.Space(2);
GUILayout.Label("Member name", GUI.skin.box, _inspectorNameWidth);
GUILayout.Space(1);
GUILayout.Label("Value", GUI.skin.box, GUILayout.ExpandWidth(true));
GUILayout.Label("Value", GUI.skin.box, IMGUIUtils.LayoutOptionsExpandWidthTrue);
}
GUILayout.EndHorizontal();

Expand Down Expand Up @@ -451,7 +451,7 @@ private void DrawSingleContentEntry(ICacheEntry entry)
catch (Exception ex)
{
RuntimeUnityEditorCore.Logger.Log(LogLevel.Error, $"[{Title}] Failed to draw setting {entry?.Name()} - {ex.Message}");
GUILayout.TextArea(ex.Message, GUI.skin.label, GUILayout.ExpandWidth(true));
GUILayout.TextArea(ex.Message, GUI.skin.label, IMGUIUtils.LayoutOptionsExpandWidthTrue);
}
}
GUILayout.EndHorizontal();
Expand Down
Loading