// SPDX-License-Identifier: MIT #pragma once namespace udpscope { /// Everything a key can ask the application to do. The plot's own actions (zoom, pan, fit) /// are not here: they belong to the plotter's input controller, which handles its own keys. enum class AppAction { PauseToggle, TriggerArm, TriggerPanel, CursorsPane, MeasuresPane, MathPane, LayoutEditor, SidePanel, Export, Help, Shortcuts, Quit, }; /// One application accelerator: what to press, what it does, and where the overview lists it. struct Accel { unsigned keyval; ///< GDK keyval unsigned mods; ///< GdkModifierType mask, 0 for a bare key AppAction action; const char* accel; ///< GTK accelerator syntax, as `gtk_accelerator_parse()` reads it const char* description; const char* section; }; /// One documented plot interaction. These have no AppAction: the plotter's own controller /// implements them, and this table exists so the overview can list them. struct Gesture { const char* accel; ///< GTK accelerator syntax, or "" for a pointer gesture const char* subtitle; ///< prose for what no accelerator can express ("Wheel"), else "" const char* description; const char* section; }; /// The application accelerator table. Writes the row count to `count`. const Accel* app_accels(int* count); /// The plot keyboard and mouse table. Writes the row count to `count`. const Gesture* plot_gestures(int* count); /// The accelerator for `keyval` with `mods`, or nullptr. `mods` is masked to /// Ctrl/Shift/Alt before comparing, because Lock, Num-Lock and the pointer buttons /// arrive in the same mask and would otherwise never match a table row. const Accel* find_accel(unsigned keyval, unsigned mods); } // namespace udpscope