Walk the QTC window the way N1MM walks it
Four changes to the QTC window, three of them N1MM's behaviour and one an addition. Tab, enter and space all move to the next box the operator types in, and shift and tab move back. The walk covers those boxes and nothing else. N1MM handles the three keys in every box itself — `QTCLinesA_KeyDown` and its two siblings, with `PreviewKeyDown` claiming Tab — rather than leaving them to the tab order, so the cursor never lands on a switched-off line or on a button beside one. Tab was going to Avalonia's default walk, which covered every control in the window. The header now says how many lines take traffic. `QTCHeader_LostFocus` reads the count after the last `/` and hands it to `ColorizeCWRXFields`, which enables that many lines and switches off the rest, capped by how many of the station's ten are still free. All ten were live whatever the header said. Nothing already typed is cleared, which N1MM does under `DontErase`. A time typed short is filled in from the line above as the cursor leaves the box: `52` under `1148` reads as `1152`. `QTCLinesA_LostFocus` takes as many characters off the front of the line above as the typed part is missing, and drops a colon whatever the length. `QtcTraffic.FillTime` is that rule. The addition: while the cursor is in a QTC callsign box the check window answers for that call rather than the entry window's, so a call taken down in traffic is checked the same way one being worked is. `CheckWindowSources` takes the call from `Elsewhere` when the QTC window has set it. Checked by driving the window: header `4/5` left five lines live and read "1 of 5", tab walked header to time to call to serial to the next line's time, shift and tab walked back, `52` on the second line became `1152`, and the check window listed W1AW while `W1A` was typed in a QTC line. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
@@ -177,6 +177,22 @@ public sealed class QtcTraffic
|
||||
: null;
|
||||
}
|
||||
|
||||
/// A time typed short is filled in from the line above, which is what N1MM
|
||||
/// does when the cursor leaves the box: `52` under `1148` reads as `1152`.
|
||||
/// As many characters are taken off the front of the line above as the
|
||||
/// typed part is missing. A colon is dropped whatever the length.
|
||||
public static string FillTime(string typed, string above)
|
||||
{
|
||||
string text = typed.Trim().Replace(":", "");
|
||||
string previous = above.Trim().Replace(":", "");
|
||||
if (text.Length is 0 or >= 4)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
int missing = 4 - text.Length;
|
||||
return (previous.Length >= missing ? previous[..missing] : previous) + text;
|
||||
}
|
||||
|
||||
private static bool IsClockTime(string text) =>
|
||||
int.Parse(text[..2]) < 24 && int.Parse(text[2..]) < 60;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user