refactor: modal-gate helper + data-driven colormap table

Two extensibility easy-wins, both behavior-preserving:

- UiModalOpen() centralizes the "an overlay owns input" check that was
  copy-pasted as `!showFileBrowser && !showAbout` across 6 input gates.
  New overlays now update one place.
- Colormaps become a COLORMAPS[] table (name + function) indexed by enum.
  GetColormapColor and the sidebar both read it, so adding a colormap is
  one enum value + one Cmap* fn + one row — and the sidebar name can no
  longer drift from the enum (deleted the parallel colormapNames[] array).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 01:53:55 -07:00
parent c4d1d096ad
commit 7240cf8ecf
5 changed files with 86 additions and 48 deletions
+7
View File
@@ -226,6 +226,13 @@ extern Font mainFont;
// (defined in spectrogram.c; used by every load path).
void ResetForNewSignal(void);
// True when a modal overlay owns input; normal spectrogram/keyboard interaction
// is gated off while this is the case. Add new overlays here in one place.
static inline bool UiModalOpen(void)
{
return app.showFileBrowser || app.showAbout;
}
// ============================================================================
// Small math helpers (header-inline so every module can use them)
// ============================================================================