Skip to content

Commit

Permalink
Add sorting by color, then by name
Browse files Browse the repository at this point in the history
  • Loading branch information
Shushishtok authored Jun 17, 2024
1 parent 849261b commit 718cba4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/TSMapEditor/UI/Windows/TriggersWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public enum TriggerSortMode
{
ID,
Name,
Color
Color,
ColorThenName,
}

public class TriggersWindow : INItializableWindow
Expand Down Expand Up @@ -304,6 +305,7 @@ public override void Initialize()
triggerListContextMenu.AddItem("Sort by ID", () => TriggerSortMode = TriggerSortMode.ID);
triggerListContextMenu.AddItem("Sort by Name", () => TriggerSortMode = TriggerSortMode.Name);
triggerListContextMenu.AddItem("Sort by Color", () => TriggerSortMode = TriggerSortMode.Color);
triggerListContextMenu.AddItem("Sort by Color, then by Name", () => TriggerSortMode = TriggerSortMode.ColorThenName);
AddChild(triggerListContextMenu);

lbTriggers.AllowRightClickUnselect = false;
Expand Down Expand Up @@ -1454,6 +1456,9 @@ private void ListTriggers()
break;
case TriggerSortMode.Name:
sortedTriggers = sortedTriggers.OrderBy(t => t.Name).ThenBy(t => t.ID).ToList();
break;
case TriggerSortMode.ColorThenName:
sortedTriggers = sortedTriggers.OrderBy(t => t.EditorColor).ThenBy(t => t.Name).ToList();
break;
case TriggerSortMode.ID:
default:
Expand Down

0 comments on commit 718cba4

Please sign in to comment.