The menus' state key took the pass number of a frame with a click or a
key press, and no number on other frames. The key therefore changed on
the frame after a press and again on the frame after that, and each
change built every row's state again: two rebuilds for one key press.
The key now keeps the pass of the last frame with a pointer button
pressed or released or a key pressed, so each of them changes it once.
A pointer release counts because a click ends there.
Test: menus::tests::a_key_press_rebuilds_the_menus_once counts the
rebuilds over a key press and the four frames after it: 1, and 2
without the change.
script.run's params text now says what app.undo() and app.redo() do. The artboardLayout messages,
their test and their catalog rows go back to main's text; they belong to file.new rather than to
script history.
app.redraw() changes nothing, so docs/mcp.md now describes it on its own. The undo step a run
leaves is stated for documents that were open before the run and are still open after it.
main's own indexer tests already check the receiver's and the key's limits.
The in-window menu bar and the canvas context menu draw each row's own
label rather than its command state's title, so Edit > Undo read
"Undo" where it should read "Undo Rectangle". The menu model now puts
the shown title into the row's label, keeping the English label for
the row's letter, and the context menu applies the same labels before
it draws. Rows named after other state (Last Effect, Reset workspace)
show their names the same way.
The menu model is rebuilt on every edit and selection change. For each
dimmed row, shown_state asked why_off whether the command could run, and
off_reason asked it again for the row's reason. For a row whose check
gives no reason, off_reason also called palette::refusal, which asked
why_off a third time and ran the engine check, then dropped the answer
for every row but window.panel. With 10,000 objects selected, many of
these checks walk the selection and take 1.5 to 7 ms each.
shown_state_with takes the why_off answer, and the tree's rows and the
catalog's rows pass it on to the reason. palette::refusal runs only for
window.panel rows.
The menu model is rebuilt on every edit and selection change, and each
rebuild made the command catalog again: the keymap's 1,544 rows with
their icons and keys, the menu references, AppCatalog::new, the linked
sets' keys and the Type tool's keys.
The model now keeps the catalog's rows and the catalog while what they
are made from is the same: the shortcut editor's entries, the platform,
the actions' function keys, the menu references with their labels, the
user's shortcuts, and the language, plug-ins, scripts, fonts and listed
names. A rebuild after an edit or a selection change sets only the
rows' states. A refused catalog is made again on the next rebuild.