Show the boxes N1MM shows for each contest

The entry window had a fixed set of boxes with a Name and Comment box beside
the exchange. N1MM lays out one row of boxes per contest and nothing else, so
this does the same: general logging keeps Name and Comment, and a contest gets
the boxes it exchanges.

Two new members on `Contest` carry the cases where the boxes and the log
columns are not the same list:

- `FromExchange1` spreads what was typed in one box across the log columns.
  Where the other station sends a serial or a district code depending on where
  it is, N1MM gives it one box and sorts the value into the number, section or
  zone column from there, so the score and the Cabrillo file read it from the
  same column N1MM does.
- `LogFieldsFor` gives the log window its own column list. Sweepstakes takes
  the whole exchange in one box and logs it in four columns; `SweepstakesExchange`
  parses `72 A 74 SCV` in any order, reading from the last word back as N1MM
  does.

The sent serial is now marked as not required and space steps over it along
with the two report boxes, because nobody types the number going out.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
2026-09-09 20:12:37 +00:00
co-authored by Claude Opus 5
parent 6e24e00ec8
commit bae40bb04e
47 changed files with 702 additions and 277 deletions
+31 -3
View File
@@ -16,6 +16,11 @@ public sealed class OperatingPosition
Session = session;
RadioNumber = radioNumber;
Entry = new EntryFields(session.Contest.ExchangeFieldsFor(session.Me));
FillSentExchange();
// N1MM fills the sent serial in again on every entry window when a
// contact is logged, so the other radio is not left showing the number
// that has just gone
Session.Logged += (_, _) => FillSentExchange();
}
public ContestSession Session { get; }
@@ -38,8 +43,9 @@ public sealed class OperatingPosition
public bool IsRunning { get; set; }
/// The other operator's name and a note about the contact. Neither is part
/// of any exchange — N1MM keeps both beside the exchange boxes and writes
/// them into the log — so neither counts towards a complete exchange.
/// of any exchange: the name is what a contact being quick edited already
/// held, and the note is what Ctrl+N asks for. Neither counts towards a
/// complete exchange.
public string OtherName { get; set; } = "";
public string Comment { get; set; } = "";
@@ -62,8 +68,13 @@ public sealed class OperatingPosition
public void Tune(Frequency frequency, Mode? mode = null, Frequency? transmitFrequency = null)
{
bool modeChanged = mode is not null && mode.Category != Mode.Category;
Frequency = frequency;
Mode = mode ?? Mode;
if (modeChanged)
{
FillSentExchange();
}
TransmitFrequency = transmitFrequency ?? TransmitFrequency;
Session.NotifyChanged();
}
@@ -209,6 +220,7 @@ public sealed class OperatingPosition
StampSentTime();
Qso stored = Session.Add(Noted(BuildQso(Entry.Call.Trim())));
Entry.Clear();
FillSentExchange();
OtherName = "";
Comment = "";
SentTime = "";
@@ -228,6 +240,19 @@ public sealed class OperatingPosition
}
}
/// Puts what this station sends into the boxes that show it: the report
/// and the serial number. N1MM keeps both filled in and steps over them,
/// so the number going out is on the screen without being typed.
public void FillSentExchange()
{
foreach (ExchangeField field in Entry.Exchange.Where(f => f.IsSent))
{
Entry.Set(
field.Slot,
field.Slot == ExchangeSlot.SentReport ? DefaultReport() : SentNumber.ToString());
}
}
/// Puts the report the operator would send anyway into the report boxes
/// that are empty: 599 on CW and digital modes, 59 on phone. N1MM does the
/// same when the callsign box is left, which is why neither program stops
@@ -406,6 +431,7 @@ public sealed class OperatingPosition
Editing = null;
held = null;
Entry.Clear();
FillSentExchange();
OtherName = "";
Comment = "";
SentTime = "";
@@ -458,6 +484,8 @@ public sealed class OperatingPosition
{
qso = ExchangeSlots.Apply(qso, field.Slot, Entry.ValueOf(field.Slot).Trim());
}
return qso;
return Entry.Exchange.Any(f => f.Slot == ExchangeSlot.Exchange1)
? Contest.FromExchange1(qso, Entry.ValueOf(ExchangeSlot.Exchange1).Trim())
: qso;
}
}