From 2e81191ea0a03976f1e745183290fa7e96fa227a Mon Sep 17 00:00:00 2001 From: ericek111 Date: Fri, 28 Aug 2026 08:28:36 +0000 Subject: [PATCH] Colour the message editor, and let Escape close it The lines are coloured the way N1MM colours them: grey for a comment, blue for the keys while running, green for the keys while searching. Anything past the twenty-four lines that are read is red, so a file with one line too many says so where the operator is looking rather than quietly losing a message. The colours are the ones the rest of the program already uses for a verdict. Avalonia's text box paints one colour, so the colours are painted on a stack of text blocks, one per line, with the box on top holding transparent text. Both use the same font and the same padding, so they line up, and they share one scroll viewer, so they scroll as one. Three things had to be true for that to work, and each of them cost a run to find. The lines are rewritten in place rather than rebuilt, because a control that has been shown once cannot be handed back in a fresh list. The box's own background is forced transparent in every state through its template, not just through the property. And the coloured lines sit above the box: a focused text box paints over what is behind it, which is why the colours were there until the operator clicked into the text. Escape closes the editor and keeps what was there before, which is what Escape does everywhere else in the program. Co-Authored-By: Claude Opus 5 --- README.md | 7 ++- src/Nonemm.App/Dialogs/MessagesDialog.axaml | 26 ++++++-- .../Dialogs/MessagesDialog.axaml.cs | 59 +++++++++++++++++++ 3 files changed, 87 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2d137c8..dbd655c 100644 --- a/README.md +++ b/README.md @@ -102,9 +102,14 @@ to F12 while running, and twelve more give the same keys while searching, with the ones left out keeping their running message. The buttons say what the file says, and they change as you move between running and searching. +The lines are coloured as N1MM colours them: grey for a comment, blue for the +keys while running, green for the keys while searching, and red for anything +past the twenty-four lines that are read, so a file with a line too many says so +on the screen. + This is N1MM's `.mc` format. **Import…** reads a file somebody published for N1MM, **Export…** writes one out, and **Back to the defaults** puts the built-in -messages back. +messages back. Escape closes the editor and keeps what was there before. The macros are N1MM's, spelled the way N1MM's function-key documentation spells them, so a `.mc` file written for either program says the same thing. The text diff --git a/src/Nonemm.App/Dialogs/MessagesDialog.axaml b/src/Nonemm.App/Dialogs/MessagesDialog.axaml index a05702b..8cf0923 100644 --- a/src/Nonemm.App/Dialogs/MessagesDialog.axaml +++ b/src/Nonemm.App/Dialogs/MessagesDialog.axaml @@ -2,7 +2,15 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Nonemm.App.Dialogs.MessagesDialog" Title="Function key messages" Width="620" Height="520" - WindowStartupLocation="CenterOwner"> + WindowStartupLocation="CenterOwner" KeyDown="OnKeyDown"> + + + + @@ -17,8 +25,18 @@