Edit the function key messages as their file
The messages were twelve boxes in a dialog, which meant no labels, no search-and-pounce set, and no way to read a file somebody published. They are now the file itself: right-click any function key button under the entry window, or the two buttons in Config ▸ Keyer and messages, and the text of an N1MM .mc file opens in a plain editor with Import, Export and Back to the defaults. MessageFile reads that format by N1MM's rules. A line starting with # is a comment; every other line is a label, a comma and the message, with && standing for one & in a label. Which key a line belongs to is decided by where it is and nothing else: the first twelve lines are F1 to F12 while running, the next twelve the same keys while searching, and a file that stops part way through the second twelve leaves the rest sending what they send while running. A blank line in the middle is a key with nothing in it, which is what the manual says; the newline that ends the last line is not, which it does not say, but no .mc file in the world means its final newline as a message. Two things fall out of this. The buttons now say what the file says, and they change when the operator moves between running and searching, so the labels are the documentation N1MM's manual suggests writing them as. And the search set is real: ESM's F2 while searching can be a different message from the one it sends while running, which is how the file was always meant to be used. Settings keep the file text and carry the twelve stored messages into it on first read, with the labels this program used then, so nobody loses what they had typed. The editor is deliberately a text box rather than a grid of fields: importing, exporting and editing are then the same thing, and the comments an operator writes in the file survive being edited here. The telnet window's buttons can use the same editor later. Running it caught two: Save as the default button ate the Enter key that a multi-line editor needs, and the button labels did not follow the move between run and search until they were redrawn rather than only rebuilt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,58 +1,59 @@
|
||||
using Nonemm.Core;
|
||||
using Nonemm.Session;
|
||||
|
||||
namespace Nonemm.App;
|
||||
|
||||
/// The function key messages. The text uses N1MM's macro names so a message
|
||||
/// written for either program says the same thing.
|
||||
/// The function key messages, held as the text of an N1MM `.mc` file so the
|
||||
/// same file works in either program. The macro names are N1MM's too.
|
||||
public static class Messages
|
||||
{
|
||||
public static readonly IReadOnlyList<(string Key, string Label)> Keys =
|
||||
[
|
||||
("F1", "CQ"), ("F2", "Exch"), ("F3", "TU"), ("F4", "MyCall"),
|
||||
("F5", "HisCall"), ("F6", "QSO B4"), ("F7", "?"), ("F8", "Agn"),
|
||||
("F9", "Nr?"), ("F10", "Call?"), ("F11", "Spot"), ("F12", "Wipe"),
|
||||
];
|
||||
|
||||
public static readonly IReadOnlyList<string> DefaultCw =
|
||||
[
|
||||
"CQ TEST {MYCALL} {MYCALL}",
|
||||
"{SENTRST} {EXCH}",
|
||||
"TU {MYCALL}",
|
||||
"{MYCALL}",
|
||||
"!",
|
||||
"QSO B4",
|
||||
"?",
|
||||
"AGN",
|
||||
"NR?",
|
||||
"CALL?",
|
||||
"",
|
||||
"",
|
||||
];
|
||||
/// What an operator gets before touching anything. Twelve lines, so the
|
||||
/// same messages are sent running and searching until the operator writes
|
||||
/// the second twelve.
|
||||
public const string DefaultCw =
|
||||
"""
|
||||
# CW function keys. The first twelve lines are F1 to F12 while running;
|
||||
# add twelve more for the keys while searching.
|
||||
F1 CQ,CQ TEST {MYCALL} {MYCALL}
|
||||
F2 Exch,{SENTRST} {EXCH}
|
||||
F3 TU,TU {MYCALL}
|
||||
F4 MyCall,{MYCALL}
|
||||
F5 HisCall,!
|
||||
F6 QSO B4,QSO B4
|
||||
F7 ?,?
|
||||
F8 Agn,AGN
|
||||
F9 Nr?,NR?
|
||||
F10 Call?,CALL?
|
||||
F11 Spot,
|
||||
F12 Wipe,
|
||||
""";
|
||||
|
||||
/// Phone messages name a recording to play; the text is what would be said.
|
||||
public static readonly IReadOnlyList<string> DefaultPhone =
|
||||
[
|
||||
"CQ CONTEST {MYCALL}",
|
||||
"{EXCH}",
|
||||
"THANK YOU {MYCALL}",
|
||||
"{MYCALL}",
|
||||
"!",
|
||||
"QSO BEFORE",
|
||||
"PLEASE REPEAT",
|
||||
"AGAIN",
|
||||
"NUMBER PLEASE",
|
||||
"YOUR CALL PLEASE",
|
||||
"",
|
||||
"",
|
||||
];
|
||||
public const string DefaultPhone =
|
||||
"""
|
||||
# Phone function keys.
|
||||
F1 CQ,CQ CONTEST {MYCALL}
|
||||
F2 Exch,{EXCH}
|
||||
F3 TU,THANK YOU {MYCALL}
|
||||
F4 MyCall,{MYCALL}
|
||||
F5 HisCall,!
|
||||
F6 QSO B4,QSO BEFORE
|
||||
F7 ?,PLEASE REPEAT
|
||||
F8 Agn,AGAIN
|
||||
F9 Nr?,NUMBER PLEASE
|
||||
F10 Call?,YOUR CALL PLEASE
|
||||
F11 Spot,
|
||||
F12 Wipe,
|
||||
""";
|
||||
|
||||
public static IReadOnlyList<string> For(
|
||||
ModeCategory mode,
|
||||
IReadOnlyList<string> cw,
|
||||
IReadOnlyList<string> phone)
|
||||
public static string DefaultFor(ModeCategory mode) =>
|
||||
mode == ModeCategory.Phone ? DefaultPhone : DefaultCw;
|
||||
|
||||
/// The stored file for that mode, or the built-in one while the operator
|
||||
/// has not written their own.
|
||||
public static MessageFile For(ModeCategory mode, string cw, string phone)
|
||||
{
|
||||
IReadOnlyList<string> stored = mode == ModeCategory.Phone ? phone : cw;
|
||||
IReadOnlyList<string> fallback = mode == ModeCategory.Phone ? DefaultPhone : DefaultCw;
|
||||
return stored.Count == Keys.Count ? stored : fallback;
|
||||
string stored = mode == ModeCategory.Phone ? phone : cw;
|
||||
return MessageFile.Parse(stored.Trim().Length > 0 ? stored : DefaultFor(mode));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user