scope windows: their own layout editor, and the same shortcuts
A detached window is a view with an arrangement of its own -- and there was no way to change it:
the layout editor was the main window's, and a second window's rows could not be added or removed.
Every scope window now carries its own editor: `L` (or the grid toggle in its corner, revealed by
the same proximity rule as the attach button) shows the main editor's `+` / `×` / Done controls,
and they act on **that window's** row set (`set_scope_layout_editing()`, every button tagged with
its window), so a window holds as many figures as the user gives it and the two editors cannot
move each other's rows. Nothing a scope window arranges is written to the main window's session:
the windows themselves are not persisted.
The keyboard: each scope window gets a `GtkEventControllerKey` running the application's one
accelerator table -- `L` acts on the window the key arrived in, every other action reaches the
application through `run_app_action()`. The plot's own keys ('f', the arrows, Escape) already
worked there, through its plot controller.
The window struct now always builds its overlay (the corner controls' host); the attach button
stays detached-only, and both corner toggles step aside while the editor is up (Done is the way
out).
Probe: `[scope-probe] layout buttons=3 rows=1->2` -- the toggle builds 2*rows+1 buttons and a
boundary `+` adds a row. `L` in a real scope window verified by OCR ("Done" appears, the row's
`×` at its left). Docs: README, the Mallard layout page, the probe readings, and the layout
invariant (a view's arrangement is the view's).
This commit is contained in:
1 parent
ecdbf4f0e1
commit
0c9333858c
6 files changed
+327
-37
No files matched your search
+19
-4
@@ -225,10 +225,18 @@ struct App {
|
||||
/// carries the attach control and can be put back. A copied or empty window is a plain second
|
||||
/// view, and has no attach control.
|
||||
bool detached = false;
|
||||
/// The attach control: an overlay wrapping the GL widget, its button in the top-right corner
|
||||
/// (revealed by pointer proximity, the same rule the main window's toggles follow), and the
|
||||
/// pointer state the overlay's own motion controller keeps.
|
||||
GtkWidget* attach_overlay = nullptr;
|
||||
/// The overlay wrapping the GL widget: the corner controls (attach, the layout toggle, the
|
||||
/// layout editor's own buttons) all live on it. Its motion controller keeps the pointer state
|
||||
/// they are revealed by.
|
||||
GtkWidget* overlay = nullptr;
|
||||
/// Layout editing in this window: its own editor and toggle. A scope is a view with its own
|
||||
/// arrangement, so it holds as many figure rows as it is given and edits them with the same
|
||||
/// `+` / `×` / Done controls the main window's editor has -- its own, never the main window's.
|
||||
bool layout_editing = false;
|
||||
GtkWidget* layout_toggle = nullptr;
|
||||
std::vector<GtkWidget*> layout_buttons;
|
||||
GtkWidget* layout_done = nullptr;
|
||||
int layout_buttons_rows = -1;
|
||||
std::vector<GtkWidget*> attach_buttons;
|
||||
double pointer_x = 0.0;
|
||||
double pointer_y = 0.0;
|
||||
@@ -2077,6 +2085,13 @@ gboolean on_scope_drop_channel(GtkDropTarget*, const GValue* value, double x, do
|
||||
/// drop target both end here). False, with a notice, when the signal cannot be acquired or the plot
|
||||
/// holds four signals already.
|
||||
bool assign_signal_to_scope(App& app, App::ScopeWindow& scope, std::size_t signal, int row);
|
||||
/// Runs one keyboard accelerator. Scope windows carry the same shortcuts as the main window: the
|
||||
/// view-level ones (`L` -- the layout editor) act on the window the key arrived in; the rest reach
|
||||
/// the application through `run_app_action()`.
|
||||
gboolean on_scope_key(GtkEventControllerKey* controller, guint keyval, guint keycode,
|
||||
GdkModifierType state, gpointer user);
|
||||
/// Turns a scope window's own layout editor on or off, building or taking down its buttons.
|
||||
void set_scope_layout_editing(App& app, App::ScopeWindow& scope, bool on);
|
||||
/// The scope window's own right-click menu: the same row menu's actions, aimed at **that
|
||||
/// window's** row set.
|
||||
void on_scope_right_click(GtkGestureClick* gesture, int n_press, double x, double y,
|
||||
|
||||
Reference in new issue
Block a user