Skip to main content

Module arrangements

Module arrangements 

Source
Expand description

Arrangements, as a plugin (ArrangementsPlugin, in DefaultPlugins): named layouts of the workbench, saved, switched and reset. They are kept in the host’s store (settings/workbench.arrangements, one versioned layout document per name, and settings/workbench.arrangement, the current name), so they are saved with the settings, or wherever a host keeps its store.

Experimental: may change in any release (docs/stability.md).

With the context stack (ADR 0012), the current arrangement is the arranged frame’s: the last active mode that declares an arrangement (FrameSpec::arrangement), else the top place, else the root. The root’s name stays in settings/workbench.arrangement, as it always was; each place’s and mode’s in settings/workbench.arrangement.frames (a JSON object, frame id to name), written when the user switches or saves there. A frame the user never arranged starts from the arrangement it declares. Settings files written before keep their meaning: their name is the root’s.

Applications offer templates, named layouts of their own (Ctx::arrangement, owned by the plugin): switching to one starts from it, and resetting the current arrangement goes back to its template (or to every panel in its default area). A saved layout is repaired against today’s panels when switched to (ADR 0003: what changed is said).

Saving without a name (workbench.arrangement.save with name empty, as the View menu and the layout menu run it) asks for one in a dialog, a new name suggested, when the dialogs plugin is there.

Steps (ADR 0011), each with its default:

StepArguments
arrangement.save{ "name" }
arrangement.switch{ "name" }
arrangement.reset{ "name" } (the current one)
arrangement.delete{ "name" }

Structs§

ArrangementStrings
The texts that name an arrangement, which an application may word its own way (AppBuilder::arrangement_strings): “Save the current arrangement as…” in the layout menu, the save dialog’s title and button, and the name it suggests ({ $n }: one more than the saved ones). Whole strings, not a word put into egui-pop’s sentences, so each language keeps its grammar. By default egui-pop’s own.
ArrangementsPlugin
The plugin.

Constants§

ARRANGEMENTS
Where the saved arrangements are: a JSON object, name to layout document.
CMD_RESET
CMD_SAVE
CMD_SWITCH
CURRENT
The current arrangement’s name at the root of the context stack (the whole application without it).
CURRENT_BY_FRAME
The current arrangement of each place and arranged mode of the context stack: a JSON object, frame id to name.
DEFAULT
The name of the arrangement every application starts with.
STEP_DELETE
STEP_RESET
STEP_SAVE
STEP_SWITCH

Functions§

arranged_frame
The frame of the context stack whose arrangement is shown: the last active mode declaring an arrangement, else the top place; None at the root (or without the stack). With the arrangement it declares.
ask_name
Asks for the name to save the current arrangement under, in a form that runs workbench.arrangement.save with it; false without the dialogs plugin.
by_frame
The current arrangement of each frame the user arranged.
current
The current arrangement’s name: the arranged frame’s (see arranged_frame), else the root’s.
delete
Forgets a saved arrangement (arrangement.delete).
layout_of
The layout an arrangement names: a saved one, else a template, else every panel in its default area for DEFAULT.
names
Every name to switch to: the saved ones and the templates.
reset
Puts the current arrangement back as its template has it (or every panel in its default area), forgetting what was saved under its name (arrangement.reset).
save
Saves the workbench’s layout as name (arrangement.save).
saved
The saved arrangements, by name.
switch
Switches to an arrangement (arrangement.switch): a saved one, else a template.