JFLib

ui/inspect.rs#

Source: lib/ui/inspect.rs

inspect -- the live inspector: an overlay in the app's windows and the tool window
"Inspektor" (ROADMAP §12)

App-facing:
  inspect_enable(on)         arm the inspector: its hot keys open and close it (off: closed,
                             the keys reach the app again)
  inspect_show(on)           open / close it (opening arms it)
  inspect_open() -> bool     it is open
  inspect_keys(&[chord])     its hot keys, VK | MOD_* << 16 (default Ctrl+Shift+I and F12)
Command line: --inspect arms and opens it; jfgui_INSPECT=1 arms it, jfgui_INSPECT=open opens
it too.

Closed (the default) it costs nothing: the runtime's hooks test one flag and nothing is
recorded or drawn.  Open:
  * the overlay in every window of the app: the widget under the pointer outlined, with a tag
    (kind, id in hex and its hashed name when known, label, size in DIP, state); the selected
    widget; optionally the layout boxes, the Tab order and the repainted rectangles of the
    last frames (flashing).  The overlay is drawn into the framebuffer after the app's
    commands, outside their lists: the app's dirty regions stay its own (ins_render_begin
    adds the overlay's old and new rectangles, which are redrawn from the app's commands)
  * the tool window "Inspektor" (WF_TOOL: it never takes the keyboard by itself; Esc, its
    close button and drops on it never reach the app): the widget tree of the current pass
    (the semantic records of the app's windows inside their layout boxes; collapsible,
    selectable; selecting highlights in the app), the properties of the selected widget, a
    script selector to copy (Ctrl+C or "Kopieren"), frame statistics, the theme's colour
    tokens; "Auswählen" picks a widget with a click into the app (the click does not reach
    it; Esc ends the pick)
The inspector's own window is left out of the tree, the overlay and the pick.
Development builds edit in it (inspect_edit.rs): the tab "Farben" is editable, the tab
"Darstellung" and the widget operations below the properties are added; and they show where
the app called the selected widget, with "Im Editor öffnen" (inspect_src.rs).

Script commands (auto.rs `inspect ...`, sc_inspect):
  inspect on|off|toggle      open / close (on arms it)     inspect arm|disarm   hot keys
  inspect pick               the pick mode ("Auswählen")   inspect select S|none
  inspect option outlines|order|dirty on|off               inspect tab widgets|frame|colors|look
  inspect copy               copy the selector ("Kopieren")
  inspect snap               remember the main window's frame (for `inspect expect same`)
  inspect expect open|closed|idle|same|excluded            inspect expect pick|flash on|off
  inspect expect selected S|none   inspect expect hover S|none
  inspect expect selector "s"      inspect expect copied "s"
idle: the inspector did no work since it closed (or since the last idle check); same: the main
window renders byte for byte as at `inspect snap`; excluded: the tree holds no record of the
inspector's own window.  Editing (development builds): inspect set|reset|undo|redo|save|list|
do ..., inspect expect changes|list|value|undo|redo|message (inspect_edit.rs); the sources:
inspect editor "C"|none, inspect open [dry], inspect expect source|sources|opened|note
(inspect_src.rs).

impl Ui

  • fn inspect_enable(&mut self, on: bool) arm the inspector (--inspect, jfgui_INSPECT=1): its hot keys (Ctrl+Shift+I and F12, inspect_keys) open and close it; false closes it, the keys reach the app again
  • fn inspect_show(&mut self, on: bool) open / close the inspector: its overlay in the app's windows and its tool window "Inspektor" (opening arms it); closed it costs nothing
  • fn inspect_open(&self) -> bool the inspector is open
  • fn inspect_keys(&mut self, keys: &[u32]) the inspector's hot keys: VK | MOD_* << 16 each (MOD_SHIFT / MOD_CTRL / MOD_ALT); default Ctrl+Shift+I and F12, none: only the API and --inspect open it

Source: docs/API.md in the JFLib repository.