New Archetype::Monitor (MonitorWidget, kind-dispatched draw) for XHistoryGraph, XCoreGrid, XNetGraph, XTempHistory, XUsageBar, XStackBar, XVerticalBar, XTachometer, XArcGauge, XDonutGauge, XProcessList, XLoadBadge, XMonitorButton, XMonitorGrid, XSysBox. - data/registry.json + data/palette.json: 15 entries, registry kept in sorted order (the C extractor requires it); palette Misc/X group re-sorted, other sections untouched, registry_index refreshed (XGraph 545->548, XSpreadsheet 546->555). - crates/xframe-widgets/src/monitor.rs: stdlib-only live checks (/proc scan, systemctl is-active, TcpStream::connect_timeout), poll()/update() with a 2s staleness guard, deterministic demo seeding; unit tests incl. headless Canvas draw for all kinds. - Placeholder 16x16 icons (assets/PROVENANCE.md notes they are placeholders pending the C port) + 15 demo examples + README monitor-family section (547 -> 562). - xframe-common ico test tolerates the 15 monitor icons as pending until the C icons land (matched by name, not index). cargo build --workspace: clean, warning-free. xframe-common lib 8/8, xframe-widgets lib 28/28, widget_tests 24/24, demo smoke 3/3, designer palette/seam 4/4 + 4/4 pass.
4.8 KiB
4.8 KiB
lightgui-designer
The LightGUI visual designer on gtk-rs 0.18 (GTK 3.24) — a port of
src/main.cpp (4,751 lines) + ui/designer.ui from lightgui
(HEAD eb0b5fc), with the unified XFrame-native canvas treatment.
What it is
- Main window (
LightGUI — C++/XFrame, 1150x720): menu bar, XFrame canvas in a scrolled window, statusbar. The canvas is aGtkDrawingArea(double-buffered FALSE) drawn on with x11rb by the XFrame-native core insrc/canvas.rs; the placed widgets are the real XFrame widget classes: click to select, drag to move (8px drag threshold), double-click for 16px resize handles, Delete removes. Palette clicks arm a widget for placement in-process — no selection file, no separate layout window. - Widget palette (
LightGUI — Widgets, 250x780): the XFrame-only 562-entry palette — all 562 XFrame widgets in their 11 section groups, built in code fromdata/palette.jsonwith 16x16.icoicons. - Object Inspector (
LightGUI — Object Inspector, 340x700): its own top-level window. Property editor (per-type tables + common props fromlightgui-core, resolved through the XFrame class name), geometry spins, events pane (signal → handler()checkbuttons), plus the Bulk parameter and Colour palette sections. The 340px width is not in the.ui(which says 300): like the C build, the bulk combo-with-entry and colour grid widen the inspector's box to 340 at startup — verified against the C binary on the same display. - Code window (
LightGUI — Code, 1000x700): its own top-level window showing the generated C++/XFrame code for the current canvas, regenerated fromlightgui-genon every open and Generate. - The four windows open together and park in a cascade (palette left of main, inspector right, code below/right) instead of stacking over the canvas; closing one only hides it and its View-menu entry brings it back.
ui/designer.ui is embedded verbatim via include_str! and loaded
through GtkBuilder. There is no separate layout process any more:
the standalone xframe-layout crate is deleted and the canvas lives
inside this designer.
Wiring
lightgui-core: palette types, property/event tables,.fdjload/save (File → Open/Save), canonicalisation..fdjis XFrame-only: GTK widgets in an old file are dropped on load, never migrated.lightgui-gen:File → Generatewrites a C++/XFrame project; the code window shows it.data/palette.json(562 XFrame entries) anddata/registry.json(562 widgets) are embedded at compile time (src/palette.rs). The palette extract still carries the old 36 LightGUI entries, but the designer reads the XFrame part only.
Build & run
cargo build -p lightgui-designer
./target/debug/lightgui-designer # needs an X display
Tests
cargo test -p lightgui-designer # palette + seam tests, no display
tests/palette.rs— XFrame-only counts, 11 sections, families, registry cross-checks.tests/seam.rs— Rust port ofwidgets/tests/test_layout_to_lightgui.py: all 562 registry names through the layout →.fdjconverter (identity mapping now), reallightgui-coreload, reallightgui-gengenerate. WithLIGHTGUI_SEAM_CMAKE_BUILD=1it also CMake-builds the generated project (step 4 of the Python test).
Live (Xvfb) hooks, same names as the C++ designer:
LIGHTGUI_SELFTEST=1 xvfb-run -a ./target/debug/lightgui-designer
# -> SELFTEST PASS items=1, exit 0
LIGHTGUI_PALETTE_SELFTEST=/tmp/pal.log xvfb-run -a ./target/debug/lightgui-designer
# -> SUMMARY pass=562 fail=0, exit 0
LIGHTGUI_PALETTE_DUMP=/tmp/pal.txt xvfb-run -a ./target/debug/lightgui-designer
# -> 562 XFRAME position lines
LIGHTGUI_ICONS overrides the XFrame .ico directory.
Deliberately not here (sibling crates own them)
- GDB debugger window/settings/toggles →
lightgui-debug. The Debug menu entries report that on the statusbar instead of pretending. - Codeview widget (syntax highlight, folding, breakpoints), themes,
preferences, CMake build →
lightgui-support. Same treatment for their menu entries. - The standalone XFrame palette process →
xframe-palette(kept as dead code, mirroring the C repo).
Known gaps vs src/main.cpp
- StockChart draws candles from its CSV data file (fake seeded candles until one loads); compare series and indicator panes are model-only, not drawn.
- Spreadsheet rows/columns are model-only at design time (the generator still emits them); the design-time grid stays 5x4.
- The code window shows generated code as plain monospace text — the
full codeview widget (highlight/folding/breakpoints) is the
lightgui-supportcrate's job. Shape/Plotdraw simple design-time placeholders (outline / sine wave), not the full C draw routines.