diff --git a/BlueprintExplorer/BlueprintControl.cs b/BlueprintExplorer/BlueprintControl.cs index d0b9437..7ca248a 100644 --- a/BlueprintExplorer/BlueprintControl.cs +++ b/BlueprintExplorer/BlueprintControl.cs @@ -179,6 +179,8 @@ public class RowElement private string _Path; public string Type; internal string Default; + public string Extra = ""; + internal bool LinkStale; internal void AllChildren(Action p) { @@ -232,7 +234,7 @@ private string PathKey public bool HasChildren => Children.Count > 0; public bool HasLink => link != null; - public string SearchableValue => value ?? ValueStyled?.Raw ?? ""; + public string SearchableValue => (value ?? ValueStyled?.Raw ?? "") + Extra; private string CalculatePath() { @@ -395,7 +397,7 @@ private void ValidateBlueprint(bool scroll) Parent = null, String = null, RowCount = 1, - Collapsed = true, + Collapsed = !BubblePrints.Settings.BlueprintNameExpanded, }); Elements.Add(new () { @@ -459,6 +461,20 @@ private void ValidateBlueprint(bool scroll) Collapsed = totalRows != 0 && !BubblePrints.Settings.EagerExpand && currentLevel > 0, }; + if (row.HasLink) + { + if (BlueprintDB.Instance.Blueprints.TryGetValue(Guid.Parse(row.link), out var target)) + { + row.LinkStale = false; + row.Extra = " -> " + target.Name + " :" + target.TypeName; + } + else + { + row.LinkStale = true; + row.Extra = " -> STALE"; + } + } + if (e.isObj && e.HasType) { List spans = new(); @@ -627,7 +643,6 @@ private void DrawElement(int row, DrawParams render) float xOffset = 48 + elem.level * LevelIndent; - var extra = ""; if (elem.HasLink) { if (BackColor.GetBrightness() < 0.5f) @@ -635,15 +650,9 @@ private void DrawElement(int row, DrawParams render) else valueColor = Color.DarkGreen; - if (BlueprintDB.Instance.Blueprints.TryGetValue(Guid.Parse(elem.link), out var target)) - { - extra = " -> " + target.Name + " :" + target.TypeName; - } - else - { + if (elem.LinkStale) valueColor = Color.Gray; - extra = " -> STALE"; - } + valueFont = LinkFont; } else if (elem.value is "null" or "NULL" or "[0]") @@ -690,7 +699,7 @@ private void DrawElement(int row, DrawParams render) var brush = new SolidBrush(valueColor); if (elem.ValueStyled == null) { - var str = elem.value + extra; + var str = elem.value + elem.Extra; if (str.Length > 0) { right += render.Graphics.MeasureString(str, valueFont).Width; @@ -843,6 +852,10 @@ protected override void OnMouseClick(MouseEventArgs e) if (jbpCompatible && elem.key == "Blueprint ID") { value = "!bp_" + value; } + + if (elem.IsObj && elem.Type != null && !jbpCompatible) + value = elem.Type; + if (string.IsNullOrWhiteSpace(value)) return; Clipboard.SetText(value); diff --git a/BlueprintExplorer/BubblePrints.cs b/BlueprintExplorer/BubblePrints.cs index a896a9b..3aed9ac 100644 --- a/BlueprintExplorer/BubblePrints.cs +++ b/BlueprintExplorer/BubblePrints.cs @@ -235,6 +235,11 @@ public SettingsProxy(SettingsProxy settings) [Description("Column widths for search results (only takes effect when BubblePrints loads, automatically updated if you resize the columns)")] [DisplayName("Search column widths")] public int[] SearchColumnSizes { get; set; } = new int[]{-1, -1, -1}; + + [Description("If true, the first item in the blueprint view (name, id, type) will be expanded by default")] + [DisplayName("Expand blueprint name")] + public bool BlueprintNameExpanded { get; set; } = false; + private readonly static int[] SearchColumnSizesDefault = new int[]{800, 600, 450}; }