Skip to main content

Module app

Module app 

Source
Expand description

The application: an AppBuilder takes plugins and a theme, sorts and connects the plugins, and gives an App that draws the shell (menu bar, zones, panels, the command palette) and dispatches keys. It runs in eframe (feature eframe) or headless, driven by tests.

Re-exports§

pub use crate::palette::CMD_PALETTE;

Structs§

App
A built application.
AppBuilder
Builds an application.
AppHandle
The application at run time, cheap to clone: blocks, panels, stories and command handlers reach services, the store and the command runner through it.
Call
What a command handler receives.
DeclaredIcon
Diagnostic codes recomputed by each rebuild. An icon name a declaration gives, as the icons collector and the unknown-icon diagnostic read it.
DormantKey
A key binding kept dormant (ADR 0028): its command went with a plugin now disconnected. It stays in its layer, saved, takes no key, and is live again when the plugin reconnects.
OverlayRect
An overlay on screen: what it is, a name for it (dialog:3, the overlay’s label, toasts), where it was drawn last, in points.
ThemeService
The theme, as a service: read it, ask for another (installed between frames), and choose between its light and dark variants when it has a counterpart (the SETTING_THEME_PREFERENCE setting).

Enums§

OverlayKind
What an overlay is, as AppHandle::overlay_rects reports it.
Request
What a block or a handler asks of the application, done before the next frame.

Constants§

BRIDGE
The bridge’s own collector: bridge.describe, bridge.wait.
CMD_QUIT
CMD_REDO
CMD_SAVE
CMD_THEME_TOGGLE
The command switching between the theme’s light and dark variants.
CMD_UNDO
Undo and redo: the keys, menu items and when checks are egui-pop’s, what an undo does is the history owner’s (Host::history, ADR 0014), each run going through the STEP_UNDO and STEP_REDO steps.
CONTEXT_FOCUSED_PANEL_KIND
The context key holding the kind of the focused panel (PanelId::kind): the panel’s own id, or app.gallery while its instance app.gallery#2 has the focus, so one clause reaches every instance: when: "focusedPanelKind == 'app.gallery'".
CONTEXT_REDO_NEEDS_VIEW
CONTEXT_UNDO_NEEDS_VIEW’s twin for Ctrl+Shift+Z.
CONTEXT_UNDO_NEEDS_VIEW
The context key true when, under focus routing (Routing::Focus), Ctrl+Z goes nowhere only because no view was focused yet while a step waits somewhere (needs_view): Edit › Undo stays live to say why.
CONTEXT_WINDOW
The main menu bar. The context key holding the detached panel whose window is drawn (empty in the main window): when: "window == 'app.log'".
FOCUS_MODE
The focus mode (click or hover, the system’s way and the user’s choice), as a service.
MENU_BAR_END
The end of the main menu bar: its command items show there as icon buttons (menus::bar_end), the last at the bar’s end, each pressed while its checked clause holds and left out where its command does not apply. Commands go there as into any menu (CommandSpec::menu(MENU_BAR_END, group, order)): the devtools’ inspect mode does.
MENU_EDIT
MENU_FILE
MENU_HELP
MENU_MAIN
MENU_VIEW
SETTING_ACCENT_COLOR
The setting generating the accent from a colour (#rrggbb), for the theme and its counterpart; empty for the theme’s own accent.
SETTING_FOCUS
The setting choosing the focus mode: system, click, hover.
SETTING_THEME_PREFERENCE
The setting choosing between a theme’s light and dark variants: system, light, dark.
STEP_DEBUG_CALL
A debug collector’s action is called ({ "collector", "action", "args", "origin" }, the origin as the journal’s sources write it: agent:debug-bridge, user): by an agent through the bridge (AppHandle::debug_call) or by the user (AppHandle::debug_call_as, the devtools panel). A before-hook may veto it, for every caller (a kiosk build); the caller is not redirected. A call that only reads (a read-only command’s commands.run included) is published and traced only when vetoed or failed. A call the bridge’s mode or the action’s agent flag refuses never reaches the step: it is refused first (debug.call.refused).
STEP_EXIT
The application closes: its default writes what is still waiting (the settings, the keymap, the layout and the documents plugins offered, when a directory was given). A plugin replaces it to save elsewhere, or follows it; a veto writes nothing more. Saving does not wait for the exit: what changes is written about a second later (AppHandle::save_later).
STEP_LAYOUT_LOAD
The workbench’s layout is loaded ({ "document" }, from Host::layout_document): at the start, and on App::load_layout. A before-hook may redirect the document or veto; a run-hook loads it from elsewhere (and calls AppHandle::set_layout).
STEP_LAYOUT_SAVE
The workbench’s layout is saved ({ "document" }): by App::save (so at exit) and App::save_layout. A before-hook may redirect or veto; a run-hook saves it elsewhere (AppHandle::layout).
STEP_LOAD_KEYMAP
A keymap document is loaded into a layer ({ "layer", "bindings" }).
STEP_REBIND
The user gives a command new keys, or none ({ "command", "keys", "layer" }; keys a shortcut, null, or an array of several: a pointer gesture’s triggers).
STEP_REDO
STEP_UNDO
The steps of an undo and a redo (ADR 0011): a before-hook may veto one (a gesture in progress) or redirect it (another scope), a run-hook does it instead of the owner, an after-hook follows. Their arguments: label (what it takes back, as the menu said), origin and scope (the history focus picked). Their result: {"undone": label, "scope", "steps", "rev", "head"} ("redone"), the label null when there was nothing. Besides the step’s own signal, the journal says edit.undone / edit.redone with the label, or edit.undo_failed / edit.redo_failed with the error or the veto; and history.changed or history.refused.
THEME
The theme service’s token.

Functions§

declared_icons
Every icon name the commands, panels, frames (places and modes) and status items declare.
parse_preference
A preference from its name in the setting.
preference_name
A preference’s name in the setting: system, light, dark.

Type Aliases§

CommandFn
A command handler.
ExitFn
Runs when the application closes (AppBuilder::on_exit), before the app.exit step.
MakeError
Why make (of AppBuilder::run_native_with) gave no application.
WrapUi
Draws around the whole application (AppBuilder::wrap): gets the Ui, the handle, and the application’s drawing to call where it likes.