The toolbar and the status bar
The two fixed bars of the editor window, around the docked panels: the toolbar under the menu bar
(conjure/editor/ui/panels/toolbar_panel.h) and the status bar along the bottom (conjure/editor/ui/status_bar.h).
Both are drawn with the widget kit alone. The status bar counts the agents connected to the AI
protocol through protocol_server::agent_count() (conjure/editor/protocol/protocol_server.h).
| Name | The toolbar and the status bar |
| Module | Editor |
#include |
conjure/editor/protocol/protocol_server.h, conjure/editor/ui/panels/toolbar_panel.h, conjure/editor/ui/status_bar.h |
| Engineering Handbook | User Interface |
Syntax
What the status bar says about the AI protocol, read without drawing the bar. Adapted from the AI state tests of
tests/editor/ui/test_status_bar.cpp, which refresh a bar and read its segments.
#include "conjure/editor/ui/status_bar.h"
#include <string>
using namespace conjure::editor;
using namespace conjure::editor::ui;
std::string describe_ai_state(editor_context &context) {
status_bar bar = {};
bar.refresh(context); // rebuilds every segment's text; paints nothing
if (!bar.online()) {
return "No agent can reach the editor"; // the bar shows no AI segment at all
}
std::string text(bar.segment(status_segment::AI_STATE)); // "Ready" or "Connected"
text += ": ";
text += bar.segment(status_segment::AI_PORT); // "AI port 47820, 1 client"
return text;
}
At a glance
| If you want to... | Then use... |
|---|---|
| draw the bars | toolbar_panel::draw(context, gizmo) and status_bar::draw(context) inside a kit frame; the workspace does it every frame |
| do what a control does from a protocol client | send the command it sends: play.start, play.pause, play.step, editor.layout.reset... |
| step a paused game by more than one fixed update | play.step {"fixedSteps": n} from a client; Step advances one |
| read what the status bar shows | status_bar::segment(status_segment::AI_STATE), listening(), agents(), online() |
| find a control in a test | the kit's frame record, by the key constants (toolbar_panel::PAUSE_KEY) |
| know how much of the window the bars take | toolbar_panel::height(), status_bar::height(); 0 without a kit context |
Variables and Properties
| Name | Access | Purpose |
|---|---|---|
const char *toolbar_panel::WINDOW_NAME |
constant | the toolbar's ImGui window name, "##conjure_toolbar" |
std::string_view toolbar_panel::STRIP_KEY |
constant | the toolbar strip's key in the frame record, "toolbar" |
std::array<std::string_view, 4> toolbar_panel::TOOL_KEYS |
constant | the keys of Move, Rotate, Scale, and All in the frame record |
std::string_view toolbar_panel::PIVOT_KEY, SNAP_KEY, SNAP_STEP_KEY, PLAY_KEY, PAUSE_KEY, STEP_KEY, STOP_KEY, PERSIST_KEY, LAYOUT_KEY |
constant | the keys of the toolbar's other controls in the frame record |
std::string_view toolbar_panel::LAYOUT_MENU_KEY, LAYOUT_RESET_ITEM, PINNED_LIST_KEY |
constant | the layouts menu, its Reset layout row, and the Persist pill's pinned list |
const char *status_bar::WINDOW_NAME |
constant | the status bar's ImGui window name, "##conjure_status" |
std::string_view status_bar::STRIP_KEY |
constant | the status strip's key in the frame record, "status" |
usize status_bar::FPS_FRAMES |
constant | how many of the latest frames the frame rate averages: 60 |
How the bars are drawn
Each bar is a kit::viewport_bar: a fixed window across the main viewport, not a dock node, so it cannot be
closed, undocked, or lost. It reserves its strip of the window, so the docked panels keep clear of it. The toolbar is
a TOP bar under the menu bar holding a MAIN kit::toolbar_strip, 41 px at 100 % with its line. The status bar
is a BOTTOM bar, 24 px at 100 %, holding a kit::status_strip, and keyboard navigation does not enter it. Both
draw inside a kit::stock_canary_scope, so a stock ImGui widget in them would show at once.
The workspace draws both bars every frame, after the menu bar. The start screen, shown while no project is open, has the menu bar and the status bar but no toolbar. Both bars need a current kit context, which the editor's UI layer provides: without one the toolbar draws nothing and the status bar only refreshes its texts. Once their texts have their capacity, drawing the bars allocates nothing while the Persist pill's pinned list is closed.
Every control has a tooltip, an accessible name, and a key in the kit's frame record, where tests find it. No protocol command reads the frame record: a client does what a control does by sending the same command.
Warning
The toolbar centres its play group with two equal spacers, which use the last frame's widths. The group lands one frame after a width change and is hidden in the strip's first frame (Containers).
The toolbar
toolbar_panel lays out its controls left to right, with the play group and the Persist pill centred between Snap
and Layout:
| Control (key) | What it does |
|---|---|
Move, Rotate, Scale, All (TOOL_KEYS) |
the Scene panel's gizmo operation, a segmented group; W, E, and R choose Move, Rotate, and Scale in the Scene panel. All is the universal gizmo and shows its label |
Pivot World or Local (PIVOT_KEY) |
switches the gizmo between the world axes and the entity's own |
Snap (SNAP_KEY) and its step (SNAP_STEP_KEY) |
turns snapping on (in the accent) and off. The field joined to it edits the step of the gizmo's current tool: 0.01 to 100 for Move and All, 1 to 180 degrees for Rotate, 0.01 to 10 for Scale. It is disabled while snapping is off |
Play (PLAY_KEY) |
starts the scene (play.start), or resumes a paused game (play.resume), as F5 and Play > Play do |
Pause (PAUSE_KEY) |
a toggle, on while paused: pauses a running game (play.pause) and resumes a paused one |
Step (STEP_KEY) |
advances a paused game by one fixed update (play.step {}), as Play > Step does |
Stop (STOP_KEY) |
ends play (play.stop) and returns to the edited scene, as Shift+F5 does; pinned values are kept |
Persist n (PERSIST_KEY) |
how many values this play session has pinned; pressed, it opens the pinned list |
Layout Default (LAYOUT_KEY) |
opens the layouts menu, whose Reset layout row sends editor.layout.reset, so a reset always takes two clicks |
The lit controls show the play state, so no text beside them repeats it:
| Play state | Live controls |
|---|---|
| editing a scene | Play, in the play colour |
| editing, no scene | none of the four |
| playing | Pause and Stop |
| paused | Pause (on), Play, Step, and Stop |
- The gizmo controls. The tools, Pivot, and Snap drive the gizmo of the Scene panel, which the workspace passes
to
draw(). While that panel does not exist they show their defaults, disabled. - Commands. Every button and menu row sends a command from the UI client, so it is validated and announced like a protocol request. The keyboard shortcuts (Ctrl+Z, Ctrl+Y, Ctrl+S, F5, Shift+F5) belong to the workspace, so they work whatever the toolbar shows. Undo and Redo live in the Edit menu, not on the toolbar.
- The Persist pill is enabled while playing or paused, whatever is selected, since pins exist only during play.
Its pinned list has one row per pin, in pin order: "Entity > Component > Field" in the names the inspector shows,
with the value as it is now in short (
(-1.25, -0.5, 0),#ffe2b8). An entity without a name, or one destroyed in play, shows its guid shortened; a destroyed one shows that Stop skips it. A row's click, or Enter, selects its entity (selection.set), and the workspace brings the Inspector forward and scrolls it to the pinned value (take_panel_request(),take_reveal_request()). The list closes when play stops.
The status bar
status_bar is a 24 px strip on the theme's status fill, its segments 16 px apart without separators. From the
left:
Segment (status_segment) |
Shows |
|---|---|
AI_STATE |
Connected while an agent is connected, Ready while the AI port listens without one; no segment while there is neither |
SCENE |
the open scene in statusDim: its path under assets://, or its name before it has a file (Untitled when it has none), then , unsaved changes while it has some; No scene without one |
PERSIST |
while playing or paused with something pinned, a pin and 3 changes persist on Stop (1 change persists on Stop); no segment otherwise |
From the right:
Segment (status_segment) |
Shows |
|---|---|
AI_PORT |
led by the green dot, AI port 47820, then , 1 client or , 3 clients with agents; AI stdio, 1 client for a stdio agent while the TCP port is off; no segment while no agent can reach the editor |
BUILD |
the build configuration, the graphics backend when one is known, and the GPU: Debug · D3D12 · <adapter>, or Debug · no GPU without an adapter |
FPS |
the frame rate and time over the last 60 frames (60 fps · 16.7 ms) in the code font; -- fps before the first frame was measured |
The play state is not repeated here: the toolbar's lit controls show it. refresh(context) rebuilds every text
into the same strings, and draw(context) refreshes and paints.
Agents
An agent is a client of the AI protocol (see the glossary). The status bar counts them with
protocol_server::agent_count(), by these rules:
- TCP clients always present a token in their
session.hello: the full-control token (the one the editor generated, or the one--ai-tokenset) or the inspect-only one (Access tokens and the audit log). A TCP client counts only once itssession.hellocarried a valid token. - A stdio client needs a token only when one was set (
--ai-tokenor--ai-inspect-token). Then it counts only after a validsession.hellotoo; otherwise it counts from the poll that accepts it. - In-process clients, such as the editor's own AI session panel, never count.
- A client the server is disconnecting no longer counts.
So a connection that never says hello, such as a port scanner or a health probe, leaves the bar at Ready. A stdio
agent while the TCP port is off (--ai-stdio --ai-port 0) shows as Connected and AI stdio, 1 client, with the
dot. With neither a listening port nor an agent, the bar shows no AI segment at all: nothing can reach the editor,
so there is nothing to report. The same count is the agents member of editor.state
(The AI control protocol).
Functions
| Signature | Purpose |
|---|---|
void toolbar_panel::draw(editor_context &, gizmo_controller *) |
draw the toolbar; gizmo is the Scene panel's, or nullptr |
std::string_view toolbar_panel::take_panel_request() |
the panel a pinned list row asked for, once |
std::optional<persist_entry> toolbar_panel::take_reveal_request() |
the pin a pinned list row asked the Inspector to show, once |
std::span<const kit::list_row> toolbar_panel::pinned_rows() const |
the pinned list's rows as the last open frame built them |
static f32 toolbar_panel::height() |
the toolbar's height at the kit's scale, its line included |
void status_bar::draw(editor_context &context) |
refreshes the texts and paints the bar |
void status_bar::refresh(editor_context &context) |
rebuilds the texts only |
std::string_view status_bar::segment(status_segment which) const |
what a segment shows: AI_STATE, SCENE, PERSIST, AI_PORT, BUILD, or FPS |
bool status_bar::listening() const |
the TCP port listens |
usize status_bar::agents() const |
the agents connected |
bool status_bar::online() const |
the AI port segment and its dot show |
static f32 status_bar::height() |
the status bar's height at the kit's scale |
usize protocol_server::agent_count() const |
the connected agents, by the rules above |
See also:
- 📘 API: The widget kit, Themes, The workspace UI
- 📘 API: The AI control protocol, Access tokens and the audit log, Glossary
- 🛠 Handbook: User Interface, Editor Architecture