mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 00:56:19 +02:00
Refactor YesNtWindowStatements to use constructor for ownerProcess
This commit is contained in:
@@ -22,7 +22,7 @@ public class YesNtInterpreterProcess() : Process("YesNtInterpreter")
|
|||||||
];
|
];
|
||||||
interpreter = new();
|
interpreter = new();
|
||||||
|
|
||||||
YesNtWindowStatements.Register(interpreter, this);
|
new YesNtWindowStatements(this).Register(interpreter);
|
||||||
|
|
||||||
interpreter.Prepare([.. args]);
|
interpreter.Prepare([.. args]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace RemSox.Utils;
|
|||||||
/// %win_last_id expands to the id of the last created window
|
/// %win_last_id expands to the id of the last created window
|
||||||
/// %ui_last_id expands to the id of the last created UI element
|
/// %ui_last_id expands to the id of the last created UI element
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class YesNtWindowStatements
|
public class YesNtWindowStatements(Process ownerProcess)
|
||||||
{
|
{
|
||||||
// Maps script-visible integer ids to actual Window objects.
|
// Maps script-visible integer ids to actual Window objects.
|
||||||
private readonly Dictionary<int, Window> windows = [];
|
private readonly Dictionary<int, Window> windows = [];
|
||||||
@@ -42,8 +42,6 @@ public class YesNtWindowStatements
|
|||||||
private int lastWindowId = 0;
|
private int lastWindowId = 0;
|
||||||
private int lastUiId = 0;
|
private int lastUiId = 0;
|
||||||
|
|
||||||
private Process ownerProcess = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call this from <see cref="YesNtInterpreterProcess.Start"/> to register
|
/// Call this from <see cref="YesNtInterpreterProcess.Start"/> to register
|
||||||
/// every window-related statement with the given interpreter.
|
/// every window-related statement with the given interpreter.
|
||||||
@@ -53,10 +51,8 @@ public class YesNtWindowStatements
|
|||||||
/// The <see cref="Process"/> that will own created windows
|
/// The <see cref="Process"/> that will own created windows
|
||||||
/// (usually the <see cref="YesNtInterpreterProcess"/> itself).
|
/// (usually the <see cref="YesNtInterpreterProcess"/> itself).
|
||||||
/// </param>
|
/// </param>
|
||||||
public void Register(YesNtInterpreter interpreter, Process ownerProcess)
|
public void Register(YesNtInterpreter interpreter)
|
||||||
{
|
{
|
||||||
this.ownerProcess = ownerProcess;
|
|
||||||
|
|
||||||
RegisterWindowStatements(interpreter);
|
RegisterWindowStatements(interpreter);
|
||||||
RegisterButtonStatement(interpreter);
|
RegisterButtonStatement(interpreter);
|
||||||
RegisterCheckBoxStatement(interpreter);
|
RegisterCheckBoxStatement(interpreter);
|
||||||
|
|||||||
Reference in New Issue
Block a user