Editor: add per-profile trigger-executables field
Add a "Triggers:" field under the profile name that edits the profile's MatchExecutables (comma-separated, .exe optional). On save, the listed foreground executables auto-activate the profile in Auto mode — no more hand-editing config.json. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -30,26 +30,27 @@ public sealed class ProfileEditorForm : Form
|
||||
private readonly PanelCanvas _canvas = new();
|
||||
|
||||
private readonly TextBox _nameBox = new() { Location = new Point(66, 12), Width = 234 };
|
||||
private readonly Label _info = new() { AutoSize = true, Location = new Point(12, 40), MaximumSize = new Size(310, 0) };
|
||||
private readonly TextBox _labelBox = new() { Location = new Point(70, 72), Width = 230 };
|
||||
private readonly ComboBox _kindBox = new() { Location = new Point(70, 106), Width = 150, DropDownStyle = ComboBoxStyle.DropDownList };
|
||||
private readonly Label _valueLabel = new() { Text = "Key:", Location = new Point(12, 143), AutoSize = true };
|
||||
private readonly ComboBox _valueCombo = new() { Location = new Point(70, 140), Width = 230, DropDownStyle = ComboBoxStyle.DropDownList };
|
||||
private readonly CheckBox _shift = new() { Text = "Shift", Location = new Point(70, 172), AutoSize = true };
|
||||
private readonly CheckBox _ctrl = new() { Text = "Ctrl", Location = new Point(140, 172), AutoSize = true };
|
||||
private readonly CheckBox _alt = new() { Text = "Alt", Location = new Point(200, 172), AutoSize = true };
|
||||
private readonly CheckBox _ext = new() { Text = "Ext", Location = new Point(250, 172), AutoSize = true };
|
||||
private readonly CheckBox _lit = new() { Text = "Lit", Location = new Point(70, 200), AutoSize = true };
|
||||
private readonly Button _apply = new() { Text = "Apply to cell", Location = new Point(70, 234), Width = 110 };
|
||||
private readonly Button _unassign = new() { Text = "Unassign", Location = new Point(190, 234), Width = 110 };
|
||||
private readonly Button _save = new() { Text = "Save profile", Location = new Point(70, 268), Width = 110 };
|
||||
private readonly Button _close = new() { Text = "Close", Location = new Point(190, 268), Width = 80 };
|
||||
private readonly CheckBox _outputToggle = new() { Text = "Send button output to the PC", Location = new Point(12, 300), AutoSize = true };
|
||||
private readonly TextBox _matchBox = new() { Location = new Point(66, 40), Width = 234, PlaceholderText = "game.exe, other.exe — auto-switch" };
|
||||
private readonly Label _info = new() { AutoSize = true, Location = new Point(12, 68), MaximumSize = new Size(310, 0) };
|
||||
private readonly TextBox _labelBox = new() { Location = new Point(70, 100), Width = 230 };
|
||||
private readonly ComboBox _kindBox = new() { Location = new Point(70, 134), Width = 150, DropDownStyle = ComboBoxStyle.DropDownList };
|
||||
private readonly Label _valueLabel = new() { Text = "Key:", Location = new Point(12, 171), AutoSize = true };
|
||||
private readonly ComboBox _valueCombo = new() { Location = new Point(70, 168), Width = 230, DropDownStyle = ComboBoxStyle.DropDownList };
|
||||
private readonly CheckBox _shift = new() { Text = "Shift", Location = new Point(70, 200), AutoSize = true };
|
||||
private readonly CheckBox _ctrl = new() { Text = "Ctrl", Location = new Point(140, 200), AutoSize = true };
|
||||
private readonly CheckBox _alt = new() { Text = "Alt", Location = new Point(200, 200), AutoSize = true };
|
||||
private readonly CheckBox _ext = new() { Text = "Ext", Location = new Point(250, 200), AutoSize = true };
|
||||
private readonly CheckBox _lit = new() { Text = "Lit", Location = new Point(70, 228), AutoSize = true };
|
||||
private readonly Button _apply = new() { Text = "Apply to cell", Location = new Point(70, 262), Width = 110 };
|
||||
private readonly Button _unassign = new() { Text = "Unassign", Location = new Point(190, 262), Width = 110 };
|
||||
private readonly Button _save = new() { Text = "Save profile", Location = new Point(70, 296), Width = 110 };
|
||||
private readonly Button _close = new() { Text = "Close", Location = new Point(190, 296), Width = 80 };
|
||||
private readonly CheckBox _outputToggle = new() { Text = "Send button output to the PC", Location = new Point(12, 328), AutoSize = true };
|
||||
|
||||
private readonly TextBox _statusBox = new()
|
||||
{
|
||||
Location = new Point(12, 618),
|
||||
Size = new Size(306, 172),
|
||||
Location = new Point(12, 646),
|
||||
Size = new Size(306, 145),
|
||||
Multiline = true,
|
||||
ReadOnly = true,
|
||||
ScrollBars = ScrollBars.Vertical,
|
||||
@@ -110,6 +111,7 @@ public sealed class ProfileEditorForm : Form
|
||||
|
||||
Text = $"RIOJoy — Edit profile: {profile.Name}";
|
||||
_nameBox.Text = profile.Name;
|
||||
_matchBox.Text = string.Join(", ", profile.MatchExecutables);
|
||||
ClientSize = new Size(1320, 820);
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
MinimumSize = new Size(900, 500);
|
||||
@@ -159,16 +161,18 @@ public sealed class ProfileEditorForm : Form
|
||||
|
||||
panel.Controls.Add(new Label { Text = "Profile:", Location = new Point(12, 15), AutoSize = true });
|
||||
panel.Controls.Add(_nameBox);
|
||||
panel.Controls.Add(new Label { Text = "Triggers:", Location = new Point(12, 43), AutoSize = true });
|
||||
panel.Controls.Add(_matchBox);
|
||||
panel.Controls.Add(_info);
|
||||
panel.Controls.Add(new Label { Text = "Label:", Location = new Point(12, 75), AutoSize = true });
|
||||
panel.Controls.Add(new Label { Text = "Label:", Location = new Point(12, 103), AutoSize = true });
|
||||
panel.Controls.Add(_labelBox);
|
||||
panel.Controls.Add(new Label { Text = "Action:", Location = new Point(12, 109), AutoSize = true });
|
||||
panel.Controls.Add(new Label { Text = "Action:", Location = new Point(12, 137), AutoSize = true });
|
||||
panel.Controls.Add(_kindBox);
|
||||
panel.Controls.Add(_valueLabel);
|
||||
panel.Controls.Add(_valueCombo);
|
||||
panel.Controls.AddRange(new Control[] { _shift, _ctrl, _alt, _ext, _lit, _apply, _unassign, _save, _close, _outputToggle });
|
||||
panel.Controls.Add(BuildCommandGroup());
|
||||
panel.Controls.Add(new Label { Text = "RIO reply:", Location = new Point(12, 600), AutoSize = true });
|
||||
panel.Controls.Add(new Label { Text = "RIO reply:", Location = new Point(12, 628), AutoSize = true });
|
||||
panel.Controls.Add(_statusBox);
|
||||
|
||||
return panel;
|
||||
@@ -177,7 +181,7 @@ public sealed class ProfileEditorForm : Form
|
||||
// A button per RIO device command, fired against the live RIO via CommandRequested.
|
||||
private GroupBox BuildCommandGroup()
|
||||
{
|
||||
var group = new GroupBox { Text = "RIO commands (live)", Location = new Point(12, 330), Size = new Size(306, 262) };
|
||||
var group = new GroupBox { Text = "RIO commands (live)", Location = new Point(12, 358), Size = new Size(306, 262) };
|
||||
|
||||
int y = 24;
|
||||
foreach ((string label, RioCommandCode code) in RioCommands)
|
||||
@@ -342,6 +346,11 @@ public sealed class ProfileEditorForm : Form
|
||||
if (!ApplyName())
|
||||
return;
|
||||
|
||||
// The foreground executables that auto-activate this profile (comma-separated).
|
||||
_profile.MatchExecutables = _matchBox.Text
|
||||
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
|
||||
.ToList();
|
||||
|
||||
ApplyToCell();
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user