Merge expanded widget set: 547 XFrame widgets, combined palette (583), layout, docs

This commit is contained in:
cnmcdee committed 2026-11-29 03:38:35 +00:00
1 parent 800883b024
commit 77a5edfe2c
3996 files changed
+883105 -10

No files matched your search

+21 -3
View File
@@ -2,8 +2,20 @@ CXX ?= g++
CXXFLAGS ?= -O2 -Wall -Wextra -std=c++17
GTKFLAGS := $(shell pkg-config --cflags gtk+-3.0)
GTKLIBS := $(shell pkg-config --libs gtk+-3.0)
NPROC := $(shell nproc 2>/dev/null || echo 4)
lightgui: src/main.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp src/debugger.cpp src/debugger_ui.cpp src/preferences.cpp src/theme.cpp src/codeview.cpp src/model.h src/props.h src/events.h src/generator.h src/cmake_build.h src/project_io.h src/debugger.h src/debugger_ui.h src/preferences.h src/theme.h src/codeview.h src/indicators.h src/indicators_embedded.h src/drawings.h src/drawings_embedded.h ui/designer.ui
# LightGUI -- C++/GTK designer (src/) + XFrame widgets (widgets/).
# make build the lightgui binary and all widget demos
# make lightgui build ./lightgui only
# make widgets build widgets/build (all widget demos + palette + layout)
# make test run the layout -> LightGUI seam test (no display needed)
# make clean remove built artefacts
# ./ide start the combined IDE (designer + palette + layout)
.PHONY: all lightgui widgets test clean
all: lightgui widgets
lightgui: src/main.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp src/debugger.cpp src/debugger_ui.cpp src/preferences.cpp src/theme.cpp src/codeview.cpp src/model.h src/props.h src/events.h src/generator.h src/cmake_build.h src/project_io.h src/debugger.h src/debugger_ui.h src/preferences.h src/theme.h src/codeview.h src/xframe_palette.h src/indicators.h src/indicators_embedded.h src/drawings.h src/drawings_embedded.h ui/designer.ui
$(CXX) $(CXXFLAGS) -o $@ src/main.cpp src/generator.cpp src/cmake_build.cpp src/project_io.cpp src/debugger.cpp src/debugger_ui.cpp src/preferences.cpp src/theme.cpp src/codeview.cpp $(GTKFLAGS) $(GTKLIBS)
src/indicators_embedded.h: src/indicators.h tools/embed_indicators.sh
sh tools/embed_indicators.sh src/indicators.h $@
@@ -11,7 +23,13 @@ src/indicators_embedded.h: src/indicators.h tools/embed_indicators.sh
src/drawings_embedded.h: src/drawings.h tools/embed_drawings.sh
sh tools/embed_drawings.sh src/drawings.h $@
widgets:
cmake -S widgets -B widgets/build
cmake --build widgets/build -j$(NPROC)
test:
python3 widgets/tests/test_layout_to_lightgui.py
clean:
rm -f lightgui
.PHONY: clean
rm -rf widgets/build
+2330
View File
File diff suppressed because it is too large. Load diff
+1015
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+3361
View File
File diff suppressed because it is too large. Load diff
+489
View File
@@ -0,0 +1,489 @@
# The Combined IDE — Designer + XFrame Widgets + GDB Debugger
> **Status: landed.** Written against the LightGUI round-3 tree
> (`lightgui` HEAD `310ff34`, round 3 + palette icons) and the LightGUI tree (HEAD `ab3a2a3`).
> The combined top-level build (`make`) and the single `./ide`
> launcher are in the tree — see [Build](#build) and [Launch](#launch) —
> as is the layout → designer seam
> (`widgets/tools/layout_to_lightgui.py`).
One repository, one IDE, two halves that fit together:
- **`designer/` — LightGUI**, a C++/GTK 3 visual designer. Place
widgets on a canvas, edit properties, generate compilable C++/GTK
code, and step through it with a built-in GDB debugger. The
designer itself is GTK, built with GtkBuilder from a Glade `.ui`
file. No Qt anywhere.
- **`widgets/` — XFrame**, a pure X11/Xlib hand-drawn C++17 widget
library: **481 widgets** (102 `Gtk*`, 90 `T*`, 250 `Ind*`, 37 `Stock*`, plus `XGraph` and
`XSpreadsheet`), drawn with raw Xlib calls. No GTK, no Qt, no
toolkit at all — despite the `Gtk*` names. The `Gtk*` components
recreate the look of GTK widgets as standalone X11 classes; the
`T*` components are the same idea in Lazarus/Delphi style.
The two halves share one repo, one launcher, and one workflow:
design a form, place widgets from a palette, generate code, build it,
debug it. The full widget API reference lives in
[docs/index.md](index.md) (the shared contract) and the ten section
pages; the designer's own design notes live in
[designer/DESIGN.md](../designer/DESIGN.md).
## The windows
Starting the designer opens three top-level windows at once (the
code window opens together with the designer, parked beside the
palette instead of over the canvas). `./ide` adds the XFrame palette
and layout windows, for five in total. Each is a plain top-level window — never
transient or modal — so they coexist; closing one only hides it, and
its View-menu entry brings it back.
| Window | Title | Size | What it is |
|---|---|---|---|
| Designer | `LightGUI — C++/GTK — <name>` | 1150x720 | Canvas, property editor, Events pane, menus |
| Widget palette | `LightGUI — Widgets` | 250x780 | **Combined palette, 517 entries**: the 36 LightGUI buttons in grouped sections (the original Tk set plus 20 Lazarus-style widgets), 2px grid spacing, 20px buttons — Lazarus palette density — then all 481 XFrame widgets in their 10 section groups, each with its 16x16 icon; the window scrolls |
| Code | `LightGUI — Code` | 1000x700 | Generated C++ with gutter, folding, themes, breakpoints, automatic variable inspection |
| Debugger | `LightGUI Debugger` | — | GDB/MI stepping debugger (Debug → Open Debugger…) |
| XFrame palette | `LightGUI Palette - 481 widgets` | 380x880 | All 481 XFrame widgets in 10 collapsible sections, each with its 16x16 icon (`lightgui_palette`) |
| XFrame layout | `LightGUI Layout` | 1024x720 | Live XFrame design surface: place, move, resize real widget instances (`lightgui_layout`) |
The **combined palette** (`LightGUI — Widgets`) holds both sets:
the 36 LightGUI entries place widgets onto the GTK canvas (those
become generated C++/GTK code); the 481 XFrame entries select an
XFrame widget and hand the choice to the **layout window** via the
shared selection file (`/tmp/lightgui-selection.txt`), exactly as the
standalone palette does. The layout window instantiates the *real*
XFrame widget class and lets you place, move, and resize it live.
There is also a **standalone XFrame palette**
(`lightgui_palette`, `LightGUI Palette - 481 widgets`): the same 481
widgets in 10 collapsible sections, writing the same selection file.
Either palette can drive the layout window. The layout window is
the XFrame design surface; it saves a layout text file, it does not
emit LightGUI projects — the seam in section 2 below is how a saved
layout reaches the designer.
## Build
Prerequisites: a C++17 compiler (`g++`), CMake >= 3.20, X11 dev
headers (`libx11-dev` on Debian/Ubuntu), GTK 3 dev files
(`libgtk-3-dev`), and `gdb` for the debugger. Everything needs an X
display — a real X server or Xvfb (see
[Troubleshooting](#troubleshooting)).
**Combined build:** a top-level `Makefile` builds both halves:
```sh
make # designer + widgets (481 demos + palette + layout)
make designer # designer/lightgui only
make widgets # widgets/build only
make test # seam test: layout -> .fdj -> codegen -> CMake build
make clean # remove built artefacts
```
**Building each half today** (verified against the current trees):
```sh
# Designer: plain Makefile, g++ -O2 -Wall -Wextra -std=c++17, GTK 3 via pkg-config
cd designer
make # builds ./lightgui, zero warnings
make clean && make # from scratch
# XFrame library: CMake, one target per component demo + palette + layout
cd widgets
cmake -S . -B build
cmake --build build -j"$(nproc)" # all 481 demos, 0 errors, 0 warnings (-Wall -Wextra)
```
Binaries: `designer/lightgui`, `widgets/build/palette/lightgui_palette`,
`widgets/build/layout/lightgui_layout`,
`widgets/build/components/<Name>/<Name>`.
A single component builds standalone — copy its directory out and
run `cmake -S . -B build` in it; each component ships its own copy of
`core/xframe_core.h`, byte-identical to the canonical
`widgets/core/xframe_core.h`.
## Launch
**Single launcher:** `./ide` at the repo root starts the IDE. It
builds anything missing first (`--build` forces a rebuild), then
starts the designer, the XFrame palette and the XFrame layout window
as separate top-level windows on the same X display; closing the
designer ends the session (the palette/layout windows go with it).
`./ide --no-xframe` starts the designer alone. All three programs
must share one display — run under Xvfb if there is no real X server.
**Launching each half today:**
```sh
./designer/lightgui # designer + palette + code windows together
./widgets/build/palette/lightgui_palette # XFrame palette (same X display)
./widgets/build/layout/lightgui_layout # XFrame layout window
```
All three XFrame programs and the designer must share one X display.
Under Xvfb:
```sh
Xvfb :99 -screen 0 1920x1080x24 &
DISPLAY=:99 ./designer/lightgui
DISPLAY=:99 ./widgets/build/palette/lightgui_palette &
DISPLAY=:99 ./widgets/build/layout/lightgui_layout &
```
## End-to-end workflow
### 1. Design a form (designer)
Click a widget in the `LightGUI — Widgets` palette to add it to the
canvas; click to select, drag to move, Delete to remove it. The
property editor edits the selected widget's properties (per-type
tables in `designer/src/props.h`); bulk operations set or clear a
parameter on all, selected, or filtered widgets. The Events pane
lists the widget type's natural GTK signals — ticking one connects
it: the generator emits a stub handler plus `g_signal_connect` for
it, ready to fill in.
Widget set on the canvas: the original Tk set (Button, Label, Entry,
CheckButton, RadioButton, ComboBox, ListBox, Frame, Scale, Text,
StockChart, Spreadsheet, Toplevel, Canvas, Scrollbar, MenuButton)
plus 20 Lazarus-style widgets (Memo, GroupBox, Panel, Image, Shape,
Notebook, ScrollBox, Splitter, StatusBar, ToolBar, MenuBar,
SpinEdit, TrackBar, ProgressBar, DateTimePicker, ColorBox, ListView,
TreeView, StringGrid, Plot). `StockChart` is the chart widget: candle
charts from CSV (`data-file`, `up-color`, `down-color`,
`max-candles`), with 250 named technical indicators
(`indicators` property, e.g. `"SMA(20), RSI, MACD(12,26,9)"`),
drawings, comparison files, and a percent scale — see
[designer/DESIGN.md](../designer/DESIGN.md).
Save the design as a JSON project file (`.fdj`).
### 2. Place XFrame widgets (palette + layout)
Pick the widget in either palette. In the **combined palette**
(`LightGUI — Widgets`), scroll down past the LightGUI buttons to
the XFrame section groups and click an entry — its 16x16 icon and
name are shown, and the choice is written to
`/tmp/lightgui-selection.txt` for the layout window. In the
standalone XFrame palette, click a section header to collapse/expand
it, scroll with the wheel or keyboard, and click (or Up/Down + Enter)
to select a widget — the title bar shows the selection, and the
choice is written to the same file. In the layout window,
click empty canvas to place the selected widget at its default size,
drag a placed widget to move it, Delete to remove it. Double-click a
placed widget for 8 orange resize handles (corners + edges); drag a
handle to resize live; Escape dismisses the handles, `s` saves the
layout to `/tmp/lightgui-layout.txt`, `q` quits. The layout window
re-reads the selection file every 100 ms, so picking in the palette
updates the "selected to place" readout in its status bar.
**From layout to designer (the seam):** the layout is not a dead end.
Save it (`s`, or `SAVE` in a script) and convert it to an LightGUI
project:
```sh
python3 widgets/tools/layout_to_lightgui.py /tmp/lightgui-layout.txt /tmp/layout.fdj
```
Open `/tmp/layout.fdj` in the designer (**File → Open project**) and
continue with section 3 (generate) and section 5 (debug) below.
136 of the 481 XFrame widgets map to a real GTK counterpart (35 are
nearest-match approximations, listed by the converter); 345 — the 58
original XFrame-only widgets (dialogs, choosers, menus) plus all 287 Stock
Market widgets — have no designer equivalent and are reported, never
forced into a wrong type.
The generated app re-creates the widgets as GTK widgets: it does not
link XFrame classes, and layout edits do not flow back into the
designer — re-run the converter. Proved end to end by
`widgets/tests/test_layout_to_lightgui.py` (`make test`).
The layout tool also has a script mode for automated testing:
`lightgui_layout --script cmds.txt --log out.log` with `PLACE`,
`PLACE_ALL`, `MOVE`, `RESIZE`, `DELETE`, `SELECT`, `DBLCLICK`,
`HANDLE`, `CHECKDRAW`, `SAVE` / `LOAD`, `LIST`, `COUNT`, `QUIT`.
### 3. Generate code (designer)
**File → Generate C++/GTK…** asks for a folder and writes a complete
project. The output is **all code — no `.ui` file** — so a stepping
debugger can walk widget construction line by line, and every widget
is a **standalone class in its own `.h`/`.cpp` pair**: creation plus
configuration in the constructor, the same nine mouse-event stub
handlers per widget (`buttonPress1-3`, `dblbuttonPress1-3`,
`buttonRelease1-3`) routed by two dispatchers, and a
`util_error_print` helper. The window class just instantiates one
widget class per designed widget. Regions in the generated code are
marked `// #region`, which the code view folds.
Every generated project also gets a `CMakeLists.txt` next to its
`Makefile` (`cmake_minimum_required(VERSION 3.10)`,
`project(<ClassName> CXX)`, C++17, `find_package(PkgConfig)` /
`pkg_check_modules(GTK3 REQUIRED gtk+-3.0)`, every generated `.cpp`
listed explicitly in `add_executable(app …)`). The executable is
named `app`, matching the Makefile target, and builds standalone
with:
```sh
g++ -o app *.cpp $(pkg-config --cflags --libs gtk+-3.0)
# or
cmake -S . -B build && cmake --build build
```
From the designer, **File → Generate C++/GTK…** offers **Build with
CMake** right after generating (the default build path for a
generated project); **File → Build with CMake…** rebuilds the last
generated project (or asks for a folder); **File → Open CMake
Project…** points the designer at any directory holding a
`CMakeLists.txt` — generated or hand-written — and builds it
(configure + build), reporting success/failure plus the executable
path in a log dialog. A missing or broken `CMakeLists.txt`, or a
compile error, is reported as a failure, never as success. CMake
settings (command, generator, build type, build directory) live in
`~/.config/lightgui/cmake.conf` and are edited via **File → CMake
Settings…**.
### 4. Read the code (code window)
**View → Code View** shows the generated C++ for the current canvas
in the `LightGUI — Code` window. If nothing has been generated yet
it says so (`Generate a design first: File -> Generate C++/GTK...`).
The view is a `GtkTextView` with a gutter beside it in one
`GtkScrolledWindow`, so the gutter scrolls in lockstep:
- **Line numbers** in the left gutter.
- **Red-dot breakpoints:** click anywhere in the gutter (outside the
fold-marker column) to toggle a breakpoint at that line. This goes
through the real debugger backend and persists with the other
breakpoints (see [Debug](#5-debug-with-the-stepping-debugger)).
- **Folding:** `[-]` / `[+]` toggles in the fold-marker column.
Everything foldable folds: `#region` / `#endregion` (bare and the
`// #region` form the generator emits), every matched-brace span
(functions, if/else, loops, classes, structs, namespaces,
initializers), multi-line `/* */` comments, and `#if` / `#ifdef` /
`#ifndef` … `#endif` blocks — nested in all directions. Folded
lines collapse to zero height, so file line numbers stay exact.
- **Colour themes:** **View → Color Theme…** picks one of four
built-ins — Light, Dark, Monokai, Solarized Dark — colouring
keywords, types, strings, comments, numbers, preprocessor lines,
background/foreground and the current line; per-role colours are
customisable in the picker. The choice persists to
`~/.config/lightgui/theme.conf`.
- **Fonts:** **Edit → Preferences…** sets the interface font and the
code/text-view font (defaults `Sans 10` / `Monospace 11`, sizes
clamped to 6–48 pt), persisted to
`~/.config/lightgui/settings.conf` and applied live.
### 5. Debug with the stepping debugger
**Debug → Open Debugger…** opens the `LightGUI Debugger` window. It
drives a real `gdb` over the MI protocol (`gdb -q -i=mi2`, backend in
`designer/src/debugger.h` / `debugger.cpp`) — no mock, no simulation.
- **Toolbar:** Run, Continue (**F5**), Step Over (**F10**), Step Into
(**F11**), Step Out, Stop (interrupts a running target; press again
to kill it), Restart, Settings.
- **Targets:** any program compiled with `-g` — console programs and
GTK apps alike (a GTK app runs under the same X display as the
designer).
- **Breakpoints:** type `file.cpp:123` or a function name and press
Add BP. The list shows id / location / enabled toggle / hit count.
The Add/Edit dialog sets the full handler set for a breakpoint:
**kind** — Plain, Conditional (stops only when a gdb expression is
true, e.g. `i == 5`), or Logpoint (a gdb `dprintf`: prints a
message and never stops) — plus **ignore count** (skip the first N
hits), **log message** template (literal text plus `{expr}`
placeholders; `{s:expr}` prints a string, `{f:expr}` a float,
`{x:expr}` hex, `{p:expr}` a pointer), and a **group** label.
Breakpoints persist to `~/.config/lightgui/debugger_bps.conf`
(one per line:
`location|enabled|kind|condition|ignore|log_message|group`) and are
restored on the next run.
- **Variables:** Locals (name / type / value) and a watch list (add
any expression, e.g. `sum + 1`) refresh on every stop; the Stack
pane shows the current frames; the status line shows the stopped
file:line and function. Target stdout/stderr appears in the bottom
pane; logpoint output lands in the gdb log (it arrives on gdb's
console stream, not the target's output).
- **Settings:** the Settings toolbar button, **Debug → Debugger
Settings…**, and the **Debug → Debugger** sub-menu (which also has
Break on main / Stop on entry / Pretty-print values toggles).
Settings live in `~/.config/lightgui/debugger.conf`: `gdb_path`
(default `/usr/bin/gdb`), `break_on_main`, `stop_on_entry`,
`pretty_print`, `print_all_locals`, `default_args`. They take
effect on the next Run.
**What happens in the code window when the debugger pauses:** the
code window shares the debugger's `GdbSession` and polls it every
200 ms — one session, no second gdb. On a stop it loads the stopped
file (if it is not already shown), unfolds any region hiding the
paused line, and:
- the paused line's **background goes solid red (`#c00000`) with
white text**, plus a white ▶ arrow in the gutter — the Lazarus
execution-point style (full-line background + gutter arrow,
distinct from the red-dot breakpoint marker). If the paused line
is also a breakpoint line, both marks show (the arrow tip touches
the red dot by ~2px).
- the **automatic variable inspection pane** at the bottom of the
code window shows the scope (`func() — file:line (reason)`) and
the locals of the current frame, refreshed on every stop/step.
While the target is running it shows "running" and clears the
paused line — it never presents stale values as current. With no
target it says so; after exit it shows the exit code.
Step with F10/F11 (or the toolbar) and the red line and the
variables follow the execution point. Click a red dot in the gutter
while paused to add or remove a breakpoint at that line; it stages
into the shared session and persists.
## The XFrame widget library
The library reference is [docs/index.md](index.md) plus one page per
section. Every widget shares the same contract: the identical
constructor
```cpp
<Name>(Display* display, int screen, Window window, GC gc,
SStyle_Manager* styles, int x, int y, int width, int height)
```
`set_bounds` / `width` / `height` / `contains`, visibility and
enabled state, `set_style_name` / `style`, `draw()`, the four event
handlers (`on_button_press`, `on_button_release`, `on_motion`,
`on_key`), and signals as public `std::function` members (most
commonly `on_click`). The exact constructor, widget-specific
methods, signals, and a minimal working example per widget are on
its section page — never guess a signal name: if it is not in the
header, it does not exist.
| Section | Widgets | Page |
|---|---|---|
| Windows & Dialogs | 28 | [windows-dialogs.md](windows-dialogs.md) |
| Containers & Layout | 34 | [containers-layout.md](containers-layout.md) |
| Buttons | 24 | [buttons.md](buttons.md) |
| Display | 33 | [display.md](display.md) |
| Text & Entry | 28 | [text-entry.md](text-entry.md) |
| Choosers | 10 | [choosers.md](choosers.md) |
| Views & Lists | 17 | [views-lists.md](views-lists.md) |
| Menus & Toolbars | 16 | [menus-toolbars.md](menus-toolbars.md) |
| Misc / X | 4 | [misc-x.md](misc-x.md) |
| Stock Market | 287 | [stock-market.md](stock-market.md) |
| **Total** | **481** | |
Section assignment is defined in `widgets/tools/sections.py` — every
widget belongs to exactly one section. Every example in the docs was
built with `g++ -std=c++17 -I widgets/components/<Name> -lX11` and
is byte-identical to the code in the pages. Where a header leaves
something unclear, the docs say so instead of inventing an answer.
Test status (VPS, Debian 12, g++ 12.2, Xvfb): all 481 demos build
with 0 warnings; the original 194: 193 draw (`GtkInvisible` is non-visual
by design); 125 show a visible click response (the rest are display-only
by design); all 194 survive keypresses and exit cleanly; zero crashes,
zero hangs. Stock Market section: OHLC 8/8, comparative/volume 15/15,
drawing 14/14, trend 85/85, momentum 85/85, volatility/other 80/80.
Palette self-test 481/481; layout placement 481/481 and
draw 481/481, all 481 alive at once. Full tables:
`widgets/test-results/results.md` and
`widgets/test-results/palette_layout_results.csv`.
Designer test status (round-3 tree): `make clean && make`, zero
warnings; self-test 29/29 (`LIGHTGUI_SELFTEST=1 ./lightgui`);
debugger console 37/37, GTK 7/7; widget tests 5/5; font tests 20/20;
theme tests 59/59; event handlers 6/6 + runtime 41/41; CMake probe
31/31; code-window suite all pass; palette-window tests 16/16.
## Repo layout
```
. # combined IDE repo (LightGUI)
├── ide # single launcher — starts the IDE
├── Makefile # top-level build: designer + widgets
├── README.md # this repo: IDE headline, library, designer
├── LICENSE # MIT, 2026 cnmcdee
├── designer/ # LightGUI (lightgui round-3 tree)
│ ├── DESIGN.md # designer design notes (all phases)
│ ├── Makefile # builds ./lightgui
│ ├── src/ # designer, code view, debugger, CMake, generator
│ ├── ui/designer.ui # main window + palette window (Glade)
│ ├── tests/ # self-test, matrix, debugger, theme, font, CMake
│ └── screenshots/ # 01–14: designer, code view, debugger, 3-window shots
├── widgets/ # XFrame library (481 widgets)
│ ├── components/<Name>/ # <Name>.h + main_<Name>.cpp + CMakeLists.txt
│ ├── core/xframe_core.h # canonical shared core
│ ├── palette/ # lightgui_palette
│ ├── layout/ # lightgui_layout
│ ├── common/ # registry.h, ipc.h, ico.h
│ ├── icons/ # 481 real 16x16 .ico icons
│ ├── tools/ # docgen, gen_icons.py, gen_registry.py, sections.py
│ │ └── layout_to_lightgui.py # seam: layout file -> .fdj project
│ ├── tests/ # test_palette_layout.py, test_layout_to_lightgui.py
│ ├── test-results/ # results.md/csv, build.log, palette_layout_results.*
│ └── screenshots/ # all_widgets.png + one PNG per demo + palette/layout
└── docs/
├── index.md # XFrame shared contract + tools
├── ide.md # this file — the combined IDE guide
├── windows-dialogs.md # 28 widgets
├── containers-layout.md
├── buttons.md
├── display.md
├── text-entry.md
├── choosers.md
├── views-lists.md
├── menus-toolbars.md
└── misc-x.md
└── screenshots/ # combined-IDE screenshots (ide_*.png)
```
## Troubleshooting
| Symptom | Cause / fix |
|---|---|
| `cannot open display` | No X server. Run under Xvfb (`Xvfb :99 -screen 0 1920x1080x24 &`, `DISPLAY=:99 …`) or a real X session. Give each project its own display number — never take over another project's display. |
| Designer opens but the palette/code window is missing | They open together at startup; closing one only hides it. Reopen with **View → Widget Palette** / **View → Code View**. Under bare Xvfb the palette has no title bar (expected); use the View menu, not the window decoration, to close it. |
| Code view is empty / shows "Generate a design first" | The code view shows the generated code for the current canvas. Design something, then **File → Generate C++/GTK…** (or reopen the view — it refreshes on open). |
| Breakpoint red dot does not appear | Dots come from the persisted breakpoint file (`~/.config/lightgui/debugger_bps.conf`). Gutter clicks toggle through the real session; a dot on a line whose file is not the one shown belongs to that file. Check the file exists and the code view is showing the same file. |
| Paused line is not red / variables are stale | The red line and the inspection pane follow the shared `GdbSession` (200 ms poll). If the target is running, the pane deliberately shows "running" and clears the line — that is the design, not a bug. If it never updates, the debugger window's session is not the one running the target. |
| `gdb` fails to start / target never runs | Check **Debug → Debugger Settings…**: `gdb_path` (default `/usr/bin/gdb`), and that the target was compiled with `-g`. The debugger reports a bad gdb path or a missing executable as a start failure. |
| CMake build reports failure | Read the log dialog: a missing or broken `CMakeLists.txt` or a compile error is reported as failure, never as success. **File → CMake Settings…** edits command, generator, build type, and build directory (`~/.config/lightgui/cmake.conf`). |
| Layout window does not pick up the palette selection | The palette writes `/tmp/lightgui-selection.txt`; the layout window polls it every 100 ms. If the file is stale, click a widget in the palette again. Both programs must run on the same machine/display. |
| Palette exits with "FATAL: not all icons loaded" | It needs all 481 icons from `icons/`. Set `LIGHTGUI_ICONS` to the icons directory, or run from the repo root so the `icons` / `../icons` candidates resolve. A missing icon is also drawn as a red box, never silently skipped. |
| A generated project does not compile | Generated projects are covered by the matrix (`designer/tests/run_matrix.sh`): every type, property, enum, menu, and hostile string compiles with `-Wall -Wextra`, zero warnings. Re-generate from the current canvas; if it still fails, the compiler output names the file — the per-widget classes are one `.h`/`.cpp` pair each, so the fault is local to one widget class. |
| `GtkInvisible` draws nothing | By design — it is a non-visual widget. The test suite expects it blank. |
## Sources
Every claim above was checked against one of these (round-3 designer
tree, LightGUI tree at `ab3a2a3`, combined IDE in this repo):
- `designer/DESIGN.md` — designer phases, debugger, CMake, Lazarus
widgets, fonts, themes/code view.
- `designer/src/main.cpp` — window titles/sizes/parking, View/File/
Debug/Edit menus, 200 ms code-window poll, startup behaviour.
- `designer/src/codeview.h` — gutter, folding, `#c00000` paused line,
inspection states.
- `designer/src/debugger.h` / `debugger_ui.cpp` — GDB/MI backend,
breakpoint kinds, F5/F10/F11, settings and persistence paths.
- `designer/src/preferences.h`, `theme.h`, `generator.h`, `Makefile`,
`ui/designer.ui` — fonts, themes, all-code generation, build.
- `widgets/docs/index.md` — XFrame contract, palette/layout tools,
test status.
- `widgets/palette/main_palette.cpp`, `widgets/layout/main_layout.cpp`,
`widgets/common/ipc.h` — palette/layout behaviour, selection file,
save paths, script commands.
- `widgets/README.md` (pre-combination) — build, test status,
screenshots.
Verified in the integration pass (VPS, Nov 26, 2026): the top-level
build, the `./ide` launcher, the `designer/` + `widgets/` split paths
used above, the combined 517-entry palette
(`designer/src/xframe_palette.h`, generated by
`widgets/tools/gen_xframe_palette_data.py`, covered by
`widgets/tests/test_combined_palette.py`: presence 36+481 exact,
self-test 517/517, real-mouse place of GtkAboutDialog), and the
layout → designer seam (`widgets/tools/layout_to_lightgui.py`,
covered by `widgets/tests/test_layout_to_lightgui.py`).
Combined-IDE test results are in the repo README and in the
integration report; the per-half suites still apply unchanged (see
the test-status paragraphs above).
+263
View File
@@ -0,0 +1,263 @@
# LightGUI Documentation
**XFrame** — a pure X11/Xlib hand-drawn C++17 widget library. Every widget is
drawn by hand with raw Xlib calls. There is no GTK here, no Qt, no toolkit at
all — despite the `Gtk*` names. The `Gtk*` components recreate the look of
GTK widgets as standalone X11 classes; the `T*` components are the same idea
in Lazarus/Delphi style; plus `XGraph` and `XSpreadsheet`.
Start with the [project README](../README.md) for the repo layout, build
instructions, and test status. This index documents the widget API itself:
the contract every widget shares, then one page per section with every
widget in it.
## Contents
| Section | Widgets | Page |
|---|---|---|
| Windows & Dialogs | 28 | [windows-dialogs.md](windows-dialogs.md) |
| Containers & Layout | 34 | [containers-layout.md](containers-layout.md) |
| Buttons | 24 | [buttons.md](buttons.md) |
| Display | 33 | [display.md](display.md) |
| Text & Entry | 28 | [text-entry.md](text-entry.md) |
| Choosers | 10 | [choosers.md](choosers.md) |
| Views & Lists | 17 | [views-lists.md](views-lists.md) |
| Menus & Toolbars | 16 | [menus-toolbars.md](menus-toolbars.md) |
| Misc / X | 4 | [misc-x.md](misc-x.md) |
| Stock Market | 287 | [stock-market.md](stock-market.md) |
| **Total** | **481** | |
Section assignment is defined in `tools/sections.py` and verified by
`tools/sections.py` itself (run it: `python3 tools/sections.py`) — every
widget belongs to exactly one section.
## The shared widget contract
This is the part that is the same for **all 481 widgets** (verified by
inspection across all 481 headers: every member below exists in every
header). Each section page therefore lists only what is *specific* to each
widget — constructor, widget-specific methods, signals — and does not repeat
this contract.
### Construction
Every widget has the identical constructor:
```cpp
<Name>(Display* display, int screen, Window window, GC gc,
SStyle_Manager* styles, int x, int y, int width, int height)
```
- `display`, `screen`, `window`, `gc` — the X connection and the window the
widget draws into, from `XOpenDisplay` / `XCreateSimpleWindow` /
`DefaultGC`.
- `styles` — an `SStyle_Manager` (from `core/xframe_core.h`) holding the
named styles. Register at least a `"default"` style with
`add_style_ex(...)` and activate it with `set_active_style_byName(...)`
before constructing widgets.
- `x, y, width, height` — the widget's initial bounds in window coordinates.
### Geometry
```cpp
void set_bounds(int x, int y, int width, int height);
int width(); // x2_ - x1_
int height(); // y2_ - y1_
bool contains(int x, int y); // false when not visible
```
### Visibility and enabled state
```cpp
void set_visible(bool v);
bool get_visible();
void set_enabled(bool e);
bool get_enabled();
```
A disabled widget still draws, but greyed out (text colour forced to grey)
and its event handlers refuse input. An invisible widget does not draw and
`contains()` returns false for it.
### Style
```cpp
void set_style_name(std::string s); // "" = the manager's active style
SStyle style(); // styles_->resolve(style_name_)
```
### Drawing
```cpp
void draw();
```
Draws the widget into its window with the resolved style. Returns
immediately when the widget is not visible. Call it after construction and
again after any handled event (the standard demo loop clears the window and
redraws on every handled event).
### Events
Every widget implements the same four handlers. Each returns `true` when it
handled the event (the demo loop then clears and redraws) and `false`
otherwise:
```cpp
bool on_button_press(int x, int y, unsigned int button); // button 1 = left
bool on_button_release(int x, int y, unsigned int button);
bool on_motion(int x, int y);
bool on_key(KeySym key, const char* str);
```
Typical behaviour: `on_button_press` sets `pressed_`/`focused_` when the
click lands inside the widget; `on_button_release` fires the widget's
callback if the release is still inside; `on_key` fires the callback on
Return/Space when the widget has focus. `on_motion` is a no-op on most
widgets — only a few headers carry hover state, and the test suite found
only 12 of the original 194 demos show a visible hover response. Do not assume a widget
reacts to hover unless its section page says so.
### Signals
Widgets expose their callbacks as **public `std::function` members**, e.g.:
```cpp
std::function<void()> on_click; // the most common signal (85 widgets)
```
Assign them like any member:
```cpp
widget.on_click = [] { printf("clicked\n"); };
```
Signal names and signatures vary by widget — `on_change`, `on_response`,
`on_toggled`, `on_value_changed`, `on_selection_changed`,
`on_color_changed`, `on_page_selected`, ... — with payloads such as
`void(int)`, `void(std::string)`, `void(bool)`, `void(double)`,
`void(Srgb)`, `void(TTreeNode&)`. The exact name and signature for each
widget are listed on its section page. Never guess a signal name: if it is
not in the header, it does not exist.
## Minimal program skeleton
Every demo in `components/<Name>/main_<Name>.cpp` follows this shape
(shown here for `GtkButton` — the section pages trim it further per widget):
```cpp
#include "GtkButton.h"
#include <cstdio>
int main() {
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen),
100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XStoreName(display, window, "GtkButton - XFrame demo");
XSelectInput(display, window, ExposureMask | KeyPressMask |
StructureNotifyMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask);
Atom wmDelete = XInternAtom(display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(display, window, &wmDelete, 1);
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120},
Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1,
"-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
GtkButton widget(display, screen, window, gc, &styles, 40, 40, 340, 200);
widget.on_click = [] { printf("clicked\n"); };
widget.draw();
bool running = true;
while (running) {
XEvent event;
XNextEvent(display, &event);
bool handled = false;
switch (event.type) {
case Expose: handled = true; break;
case ButtonPress: handled = widget.on_button_press(
event.xbutton.x, event.xbutton.y,
event.xbutton.button); break;
case ButtonRelease: handled = widget.on_button_release(
event.xbutton.x, event.xbutton.y,
event.xbutton.button); break;
case MotionNotify: handled = widget.on_motion(
event.xmotion.x, event.xmotion.y); break;
case KeyPress: {
char buffer[32];
KeySym key = 0;
int n = XLookupString(&event.xkey, buffer, sizeof(buffer) - 1,
&key, nullptr);
buffer[n] = 0;
handled = widget.on_key(key, buffer);
break;
}
case ClientMessage:
if ((Atom)event.xclient.data.l[0] == wmDelete) running = false;
break;
}
if (handled) {
XClearWindow(display, window);
widget.draw();
XFlush(display);
}
}
XCloseDisplay(display);
return 0;
}
```
Build a single example (from the repo root, with the header's component
directory on the include path):
```sh
g++ -std=c++17 -I components/GtkButton example.cpp -lX11 -o example
```
Or build the shipped demo instead — `components/<Name>/CMakeLists.txt`
builds it standalone, and the top-level build builds all 481 (see the
README).
## Tools
- **Selector palette** — `palette/` builds `lightgui_palette` (part of the
top-level build). A pure X11/XFrame window listing all 481 widgets in
their 10 sections, each with its 16x16 icon. Click (or Up/Down + Enter)
to select; the selection is written to the shared selection file
(`/tmp/lightgui-selection.txt`) for the layout tool. Self-test:
481/481 selections OK.
- **Layout window** — `layout/` builds `lightgui_layout`. Instantiates the
real widget classes via the generated factory in `common/registry.h`
(generated by `tools/gen_registry.py` — do not edit by hand). Click to
place the selected widget, drag to move, Delete to remove, `s` to
save/load the layout, `q` to quit. Double-click a placed widget for 8
orange resize handles (corners + edges); drag a handle to resize live;
Escape dismisses the handles, Delete removes the widget.
- **Icons** — `icons/<Name>.ico`, one real 16x16 ICO per widget,
purpose-drawn glyphs generated by `tools/gen_icons.py` (70 glyph kinds,
section accent colours — not downscaled screenshots). Verified by
`tools/verify_icons.py`: 481/481 parse as 16x16, all non-blank.
## Test status
Tested Nov 26, 2026 on the VPS (Debian 12, g++ 12.2, Xvfb) with the
autonomous driver `test-driver/run_tests.py`: all 194 original demos build with
0 warnings (`-Wall -Wextra`); 193 draw (GtkInvisible is non-visual by
design); 125 show a visible click response (the rest are display-only by
design); all 194 survive keypresses and exit cleanly; zero crashes, zero
hangs. Full table: `test-results/results.md`. Stock Market section: OHLC 8/8,
comparative/volume 15/15, drawing 14/14, trend 85/85, momentum 85/85,
volatility/other 80/80 (see [stock-market.md](stock-market.md)). Palette self-test 481/481;
layout placement 481/481, draw 481/481, all 481 alive at once
(`test-results/palette_layout_results.csv`).
## License
MIT — see [LICENSE](../LICENSE). Copyright (c) 2026 cnmcdee.
+203
View File
@@ -0,0 +1,203 @@
# Instrumentation widgets — LED digit displays + analog needles (Group F)
Ten widgets in `widgets/components/`, one per directory. Each directory
contains exactly `<Name>.h`, `main_<Name>.cpp`, `CMakeLists.txt`, and
`core/xframe_core.h` (byte-identical to `widgets/core/xframe_core.h`).
Attribution: XFrame.
Group F extends the Instrumentation section (see `docs/instrumentation.md`
for the 44-widget plan): the old 7-segment LED digit displays in 1–6 digit
variants, plus four analog needle meters. Standard XFrame hand-drawn style,
no photorealism. Demos use `xframe::inst_demo_value(min, max, seed)` from
`widgets/components/InstData.h` (included as `#include "../InstData.h"`).
## Common API (all ten)
Constructor (all widgets):
```cpp
Name(Display* display, int screen, Window window, GC gc,
SStyle_Manager* styles, int x, int y, int width, int height);
```
Key methods, identical on every widget:
- `void set_value(double v)` / `double get_value() const` — settable and
readable; values clamp to the displayable range.
- `void draw()` — redraws the widget.
- `bool on_button_press(int x, int y, unsigned int button)` — click focuses
the widget and fires `on_click`; `bool on_button_release(...)`,
`bool on_motion(int x, int y)` — hover tracking.
- `bool on_key(KeySym key, const char* str)` — only when focused: Up/Right
steps the value up, Down/Left steps it down, Home resets to the minimum.
- `std::function<void()> on_click` — called on click (and Return/Space).
- `void set_bounds(...)`, `width()`, `height()`, `contains(x, y)`,
`set_visible`/`get_visible`, `set_enabled`/`get_enabled`,
`set_style_name`, `set_text`/`get_text`, `style()`.
LED digit displays also have:
- `double max_value() const` — largest displayable value.
- `std::string shown_digits() const` — the digits actually shown,
zero-padded to the digit count (decimal point not included).
- `int digit_at(int i) const`, `static bool segment_on(int digit, char seg)`,
`int decimal_point_after() const` — decimal point sits after that digit
index (-1 when there is none).
- `void set_decimal_places(int dp)` / `int get_decimal_places() const`
(default 1 for 2–6 digits, 0 for 1 digit).
Analog needles also have:
- `void set_range(double lo, double hi)` / `get_min()` / `get_max()`.
- `double needle_angle_deg() const` — needle angle in degrees from
12 o'clock (round dials) or from vertical (edgewise / VU), clockwise positive.
Build one widget (from the repo root, on the server):
```
cmake -S widgets/components/InstLedDigits4 -B /tmp/b-digits4 -DCMAKE_CXX_FLAGS="-Wall -Wextra"
cmake --build /tmp/b-digits4 # 0 warnings
```
Tests: `python3 widgets/tests/test_inst_group_f.py` builds all ten with
`-Wall -Wextra`, runs the headless harness (clamping, segment map, needle
angles, pixel movement), runs each demo under Xvfb `:147` (draw / click /
key / clean exit), and compiles every code example in this document.
Result: 10/10 widgets fully PASS, 0 warnings, driver exit 0.
## InstLedDigits1
1-digit vintage red 7-segment LED display. Shows the value zero-padded to 1 digit(s), in the style of old LED counters and clocks: dark bezel, bright red lit segments, faint unlit segments.
Range 0..9, whole digits only.
Up/Down keys step by 1.
Working example:
```cpp
InstLedDigits1 w(display, screen, window, gc, &styles, 20, 20, 90, 110);
w.set_value(7);
w.draw();
```
## InstLedDigits2
2-digit vintage red 7-segment LED display. Shows the value zero-padded to 2 digit(s) with one decimal place before the last digit, in the style of old LED counters and clocks: dark bezel, bright red lit segments, faint unlit segments.
Range 0..9.9, one decimal place (none for the 1-digit display).
Up/Down keys step by 0.1.
Working example:
```cpp
InstLedDigits2 w(display, screen, window, gc, &styles, 20, 20, 140, 110);
w.set_value(42.5);
w.draw();
```
## InstLedDigits3
3-digit vintage red 7-segment LED display. Shows the value zero-padded to 3 digit(s) with one decimal place before the last digit, in the style of old LED counters and clocks: dark bezel, bright red lit segments, faint unlit segments.
Range 0..99.9, one decimal place (none for the 1-digit display).
Up/Down keys step by 0.1.
Working example:
```cpp
InstLedDigits3 w(display, screen, window, gc, &styles, 20, 20, 190, 110);
w.set_value(123.4);
w.draw();
```
## InstLedDigits4
4-digit vintage red 7-segment LED display. Shows the value zero-padded to 4 digit(s) with one decimal place before the last digit, in the style of old LED counters and clocks: dark bezel, bright red lit segments, faint unlit segments.
Range 0..999.9, one decimal place (none for the 1-digit display).
Up/Down keys step by 0.1.
Working example:
```cpp
InstLedDigits4 w(display, screen, window, gc, &styles, 20, 20, 240, 110);
w.set_value(123.4);
w.draw();
```
## InstLedDigits5
5-digit vintage red 7-segment LED display. Shows the value zero-padded to 5 digit(s) with one decimal place before the last digit, in the style of old LED counters and clocks: dark bezel, bright red lit segments, faint unlit segments.
Range 0..9999.9, one decimal place (none for the 1-digit display).
Up/Down keys step by 0.1.
Working example:
```cpp
InstLedDigits5 w(display, screen, window, gc, &styles, 20, 20, 290, 110);
w.set_value(1234.5);
w.draw();
```
## InstLedDigits6
6-digit vintage red 7-segment LED display. Shows the value zero-padded to 6 digit(s) with one decimal place before the last digit, in the style of old LED counters and clocks: dark bezel, bright red lit segments, faint unlit segments.
Range 0..99999.9, one decimal place (none for the 1-digit display).
Up/Down keys step by 0.1.
Working example:
```cpp
InstLedDigits6 w(display, screen, window, gc, &styles, 20, 20, 340, 110);
w.set_value(12345.6);
w.draw();
```
## InstNeedleTapered
Standard tapered pointer on a round dial: the needle is wide at the hub and narrows to the tip, sweeping -135..+135 degrees over the range (default 0..100). Cream dial, major ticks every 20, red zone over the top 10%.
Range 0.0..100.0 by default; `set_range` changes it.
Working example:
```cpp
InstNeedleTapered w(display, screen, window, gc, &styles, 20, 20, 420, 380);
w.set_value(xframe::inst_demo_value(0.0, 100.0, 42));
w.draw();
```
## InstNeedleKnifeEdge
Knife-edge pointer on a round dial: a hair-thin pointer with a pointed tip and a short tail, sweeping -120..+120 degrees. White dial with a parallax mirror arc strip under the scale, ticks every 5, red zone over the top 10%.
Range 0.0..100.0 by default; `set_range` changes it.
Working example:
```cpp
InstNeedleKnifeEdge w(display, screen, window, gc, &styles, 20, 20, 420, 380);
w.set_value(xframe::inst_demo_value(0.0, 100.0, 42));
w.draw();
```
## InstNeedleEdgewise
Edgewise horizontal meter: a flat horizontal scale with the needle pivoting below it and sweeping left-right (-50..+50 degrees from vertical) across the scale. Ticks every 10, labels every 20, red zone over the rightmost 10%.
Range 0.0..100.0 by default; `set_range` changes it.
Working example:
```cpp
InstNeedleEdgewise w(display, screen, window, gc, &styles, 20, 20, 560, 280);
w.set_value(xframe::inst_demo_value(0.0, 100.0, 42));
w.draw();
```
## InstNeedleVu
VU-style needle on a VU meter scale: -20..+3 VU with the standard nonlinear VU spacing (-20, -10, -7, -5, -3, -1, 0, +1, +2, +3), red arc above 0 VU, cream face, thin black needle sweeping -45..+45 degrees.
Range -20.0..3.0 by default; `set_range` changes it.
Working example:
```cpp
InstNeedleVu w(display, screen, window, gc, &styles, 20, 20, 480, 380);
w.set_value(xframe::inst_demo_value(-20.0, 3.0, 42));
w.draw();
```
+163
View File
@@ -0,0 +1,163 @@
# Instrumentation gauges and panel furniture
Group D (gauges and meters) and Group E (panel furniture) of the XFrame
Instrumentation section. Standard XFrame hand-drawn widget style, no
photorealism. Every widget is header-only, has a settable value where it
applies, and ships with a demo program. Attribution: XFrame.
## InstAnalogGauge
InstAnalogGauge - round dial gauge with a needle over a 0-100 scale.
Range: `0` to `100`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
```cpp
#include "InstAnalogGauge.h"
InstAnalogGauge gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(0, 100, 7));
gauge.set_value(0);
gauge.draw();
```
## InstPressureGauge
InstPressureGauge - pressure dial in psi with a red zone above 240 psi.
Range: `0` to `300`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
```cpp
#include "InstPressureGauge.h"
InstPressureGauge gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(0, 300, 7));
gauge.set_value(0);
gauge.draw();
```
## InstTemperatureGauge
InstTemperatureGauge - temperature dial in degrees C with a red zone above 150 C.
Range: `-20` to `200`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
```cpp
#include "InstTemperatureGauge.h"
InstTemperatureGauge gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(-20, 200, 7));
gauge.set_value(-20);
gauge.draw();
```
## InstVuMeter
InstVuMeter - VU-style meter with a needle, red zone above 0 VU.
Range: `-20` to `3`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
```cpp
#include "InstVuMeter.h"
InstVuMeter gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(-20, 3, 7));
gauge.set_value(-20);
gauge.draw();
```
## InstBarMeter
InstBarMeter - vertical or horizontal bar meter, green/amber/red by level. Click sets the value.
Range: `0` to `100`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
`set_horizontal(bool)` switches vertical / horizontal; clicking the bar sets the value.
```cpp
#include "InstBarMeter.h"
InstBarMeter gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(0, 100, 7));
gauge.set_value(0);
gauge.draw();
```
## InstDigitalReadout
InstDigitalReadout - 7-segment style numeric display, 0 to 999.9.
Range: `0` to `999.9`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
```cpp
#include "InstDigitalReadout.h"
InstDigitalReadout gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(0, 999.9, 7));
gauge.set_value(0);
gauge.draw();
```
## InstManometer
InstManometer - U-tube manometer, liquid levels move apart with differential pressure in mm.
Range: `-50` to `50`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
```cpp
#include "InstManometer.h"
InstManometer gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(-50, 50, 7));
gauge.set_value(-50);
gauge.draw();
```
## InstFlowMeter
InstFlowMeter - rotameter: a float rides in a tapered tube, 0 to 100 L/min. Click sets the flow.
Range: `0` to `100`. API: `set_value(double)` (clamped to range), `get_value()`, `set_range(lo, hi)`, `min_value()`, `max_value()`, `fraction()`. Arrow keys adjust the value, Home resets to mid-range. `on_click` fires on click.
```cpp
#include "InstFlowMeter.h"
InstFlowMeter gauge(display, screen, window, gc, &styles, 20, 20, 320, 240, xframe::inst_demo_value(0, 100, 7));
gauge.set_value(0);
gauge.draw();
```
## InstPanelPlate
InstPanelPlate - mounting plate with corner screws and an amber title strip.
API: `set_text()` / `get_text()` for the title, `set_bounds()`, `contains()`, `set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`, `on_click` fires on click.
```cpp
#include "InstPanelPlate.h"
InstPanelPlate widget(display, screen, window, gc, &styles, 20, 20, 320, 240);
widget.draw();
```
## InstNameplate
InstNameplate - engraved label plate with two screws.
API: `set_text()` / `get_text()` for the title, `set_bounds()`, `contains()`, `set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`, `on_click` fires on click.
```cpp
#include "InstNameplate.h"
InstNameplate widget(display, screen, window, gc, &styles, 20, 20, 320, 240);
widget.draw();
```
## InstBezel
InstBezel - mounting bezel frame with an open window and corner screws.
API: `set_text()` / `get_text()` for the title, `set_bounds()`, `contains()`, `set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`, `on_click` fires on click.
```cpp
#include "InstBezel.h"
InstBezel widget(display, screen, window, gc, &styles, 20, 20, 320, 240);
widget.draw();
```
## InstControlPanel
InstControlPanel - grid container: title strip, screws, and labelled cells other widgets sit on. Click a cell to select it.
API: `set_text()` / `get_text()` for the title, `set_bounds()`, `contains()`, `set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`, `on_click` fires on click.
`set_grid(rows, cols)`, `place_cell(row, col, label)`, `cell_label(row, col)`, `selected_row()` / `selected_col()` / `selected_label()` — click a cell to select it.
```cpp
#include "InstControlPanel.h"
InstControlPanel panel(display, screen, window, gc, &styles, 20, 20, 320, 240);
panel.set_grid(2, 2);
panel.place_cell(0, 0, "PUMP");
panel.place_cell(0, 1, "VALVE");
panel.draw();
```
+273
View File
@@ -0,0 +1,273 @@
# Instrumentation widgets — illuminators & status LEDs
Twelve widgets in `widgets/components/`, one per directory. Each directory
contains exactly `<Name>.h`, `main_<Name>.cpp`, `CMakeLists.txt`, and
`core/xframe_core.h` (byte-identical to `widgets/core/xframe_core.h`).
Attribution: XFrame.
Every lamp and LED is an independent illuminator: its own on/off plus
brightness 0–100, with the state observable (`is_on()`,
`get_brightness()`). They share the types in
`widgets/components/InstData.h` (included as `#include "../InstData.h"`):
`xframe::InstLamp {on, brightness}`, `xframe::InstRgb {red, green, blue}`,
and `inst_clamp_level()`. Style is the standard XFrame hand-drawn widget
style — no photorealism, no photo textures. Click (or Space when focused)
toggles a lamp; moving the mouse over a widget draws a hover outline.
## Common API (all twelve)
Constructor (all widgets):
```
Name(Display* display, int screen, Window window, GC gc,
SStyle_Manager* styles, int x, int y, int width, int height);
```
Key methods, identical on every widget:
- `void draw()` — bezel/lens (or tiers/dome/button) plus label; hover or
focus draws an outline.
- `bool on_button_press(int x, int y, unsigned int button)`,
`bool on_button_release(int x, int y, unsigned int button)`,
`bool on_motion(int x, int y)` — press toggles (or holds, for the
lamp-test button); motion tracks hover.
- `bool on_key(KeySym key, const char* str)` — only when focused: Space
toggles (momentary press/release for the lamp-test button); the RGB LED
also takes `r`/`g`/`b`, the stack light `1`/`2`/`3`, the beacon `f`.
- `void set_bounds(...)`, `width()`, `height()`, `contains(x, y)`,
`set_visible`/`get_visible`, `set_enabled`/`get_enabled`,
`set_style_name`, `set_text`/`get_text`, `style()`.
- `std::function<void()> on_click` — called whenever the widget is
toggled by click or Space.
Build one widget (from the repo root, on the server):
```
cmake -S widgets/components/InstPanelLampRed -B /tmp/b-lampred -DCMAKE_CXX_FLAGS="-Wall -Wextra"
cmake --build /tmp/b-lampred # 0 warnings
```
Tests: `python3 widgets/tests/test_inst_lamps.py` builds all twelve with
`-Wall -Wextra`, runs each demo under Xvfb `:77` and checks build / draw
(non-blank screenshot) / hover / click / key (process survives) / clean
exit via `WM_DELETE_WINDOW`, runs the C++ state harness
(`widgets/tests/test_inst_lamps_state.cpp`, which hashes drawn pixels to
prove on/off and brightness change the picture, and that the RGB LED's 8
channel combinations are all distinct), and verifies every code example in
this document compiles. Result: see the driver run output (12/12 widgets fully PASS, 0 warnings, driver exit 0).
## InstPanelLampRed
Round bezel panel lamp, red. The lens is a dim red tint when off and bright red when on, brighter with brightness; a highlight and glow ring appear at high brightness.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstPanelLampRed.h"
InstPanelLampRed w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstPanelLampGreen
Round bezel panel lamp, green. Same behaviour as the red lamp, green lens.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstPanelLampGreen.h"
InstPanelLampGreen w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstPanelLampAmber
Round bezel panel lamp, amber. Same behaviour as the red lamp, amber lens.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstPanelLampAmber.h"
InstPanelLampAmber w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstPanelLampBlue
Round bezel panel lamp, blue. Same behaviour as the red lamp, blue lens.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstPanelLampBlue.h"
InstPanelLampBlue w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstPanelLampWhite
Round bezel panel lamp, white. Same behaviour as the red lamp, white lens.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstPanelLampWhite.h"
InstPanelLampWhite w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstLedRed
Single status LED, red: dark bezel block, domed lens, two leads. On/off + brightness like the panel lamps.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstLedRed.h"
InstLedRed w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstLedGreen
Single status LED, green: dark bezel block, domed lens, two leads. On/off + brightness like the panel lamps.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstLedGreen.h"
InstLedGreen w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstLedBlue
Single status LED, blue: dark bezel block, domed lens, two leads. On/off + brightness like the panel lamps.
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()` — the lamp state.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; the lens brightens with brightness (off is a dim tint).
- `xframe::InstLamp lamp_state() const` / `void set_lamp(const xframe::InstLamp& s)` — the whole illuminator state at once.
- Click or Space toggles; `on_click` fires on every toggle.
```cpp
#include "InstLedBlue.h"
InstLedBlue w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_brightness(75);
w.draw();
// Click or Space toggles the lamp; w.is_on() / w.get_brightness() read it back.
```
## InstRgbStatusLed
ONE status LED with INDEPENDENT red, green and blue channels — each channel is its own illuminator, so the LED shows any of the 8 colours plus off (red, green, blue, yellow, cyan, magenta, white, off).
- `void set_red(bool v)` / `set_green(bool v)` / `set_blue(bool v)` — each channel independently.
- `bool get_red() const` / `get_green() const` / `get_blue() const`, `xframe::InstRgb rgb_state() const` / `void set_rgb(const xframe::InstRgb& s)`.
- `void colour(int& r, int& g, int& b) const` — the combined 0–255 colour (any of the 8 combinations + off).
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped; scales all channels together.
- `void set_all(bool v)` / `void toggle_all()` / `bool is_on() const` — all channels at once.
- Click or Space toggles all channels; keys `r`/`g`/`b` toggle one channel; the three squares under the dome show the channel states.
```cpp
#include "InstRgbStatusLed.h"
InstRgbStatusLed w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_red(true);
w.set_green(true); // red + green = yellow; each channel independent
w.draw();
int r = 0, g = 0, b = 0;
w.colour(r, g, b);
// Keys r/g/b toggle one channel; w.get_red() / get_green() / get_blue().
```
## InstStackLight
3-tier tower light on a pole and base: red (top), amber, green tiers, each an independent illuminator with its own on/off + brightness.
- `void set_red(bool v)` / `set_amber(bool v)` / `set_green(bool v)` — each tier independently (red top, amber middle, green bottom).
- `bool is_red_on() const` / `is_amber_on() const` / `is_green_on() const`.
- `void set_red_brightness(int b)` / `set_amber_brightness(int b)` / `set_green_brightness(int b)` (0–100, clamped) and matching getters.
- `xframe::InstLamp red_lamp() const` / `amber_lamp() const` / `green_lamp() const`, `void set_all(bool v)`, `bool is_on() const`.
- Click a tier to toggle just that tier; keys `1`/`2`/`3` toggle red/amber/green; Space toggles all.
```cpp
#include "InstStackLight.h"
InstStackLight w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_red(true);
w.set_green(true);
w.draw();
// Click a tier to toggle it; keys 1/2/3 toggle red/amber/green.
```
## InstBeacon
Rotating/flashing beacon on a base: amber dome with a beam when lit, on/off plus a flash rate of 0.5–10 Hz stepped with tick().
- `void set_on(bool on)` / `bool is_on() const` / `void toggle()`.
- `void set_brightness(int b)` / `int get_brightness() const` — 0–100, clamped.
- `void set_flash_rate(double hz)` / `double get_flash_rate() const` — 0.5–10 Hz, clamped.
- `void tick()` / `void set_phase(bool p)` / `bool get_phase() const` — advance one flash step; `bool is_lit() const` is on && in the bright phase.
- Click or Space toggles on/off; key `f` steps the flash.
```cpp
#include "InstBeacon.h"
InstBeacon w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_on(true);
w.set_flash_rate(2.0);
w.draw();
// w.tick() advances one flash step; key f steps it, Space toggles on/off.
```
## InstLampTestButton
Lamp-test push button: while held it lights every lamp wired up with add_lamp(), then restores each lamp's previous state on release. A panel wires its lamps in and gets an on_test callback.
- `void add_lamp(std::function<void(bool)> setter, std::function<bool()> getter)` — wire a lamp in; the button drives it while held.
- `int lamp_count() const` — how many lamps are wired.
- `void set_on_test(std::function<void(bool)> cb)` — callback fired with true on press and false on release, for the panel to wire up.
- `void press()` / `void release()` / `bool is_testing() const` — while held every wired lamp is on; on release each lamp's previous state is restored.
- Click-and-hold (or Space) is the momentary action; `on_click` fires on press.
```cpp
#include "InstLampTestButton.h"
#include "../InstPanelLampRed/InstPanelLampRed.h"
#include "../InstPanelLampGreen/InstPanelLampGreen.h"
InstPanelLampRed lamp_r(display, screen, window, gc, &styles, 20, 20, 200, 200);
InstPanelLampGreen lamp_g(display, screen, window, gc, &styles, 240, 20, 200, 200);
InstLampTestButton w(display, screen, window, gc, &styles, 20, 260, 200, 200);
w.add_lamp([&](bool v) { lamp_r.set_on(v); }, [&]() { return lamp_r.is_on(); });
w.add_lamp([&](bool v) { lamp_g.set_on(v); }, [&]() { return lamp_g.is_on(); });
w.set_on_test([](bool testing) { (void)testing; });
w.draw();
```
+434
View File
@@ -0,0 +1,434 @@
# Instrumentation widgets — higher-segment alphanumeric LED displays (Group G)
Twelve widgets in `widgets/components/`, one per directory. Each directory
contains exactly `<Name>.h`, `main_<Name>.cpp`, `CMakeLists.txt`, and
`core/xframe_core.h` (byte-identical to `widgets/core/xframe_core.h`).
Attribution: XFrame.
Group G extends the Instrumentation section (see `docs/instrumentation.md`
for the plan): the higher-segment displays that can roughly show
alphanumeric text — 14-segment in 1–6 digit variants, and 16-segment in
1–6 digit variants. The honest word is "roughly": a segment display is
not a dot matrix, and the tables below say exactly which characters each
type shows well, which it only approximates, and which it cannot show at
all. Standard XFrame hand-drawn style, no photorealism. Demos use
deterministic strings ("HELLO", "ABC123", "42.5").
## Common API (all twelve)
Constructor (all widgets):
```cpp
Name(Display* display, int screen, Window window, GC gc,
SStyle_Manager* styles, int x, int y, int width, int height);
```
Key methods, identical on every widget:
- `void set_value(const std::string& v)` / `std::string get_value() const` — the displayed string; normalised to uppercase, truncated to the digit count, characters with no approximation dropped, `.`/`:` become a decimal-point dot after the previous digit.
- `std::string shown_text() const` — the string actually shown, padded with spaces to the digit count.
- `int cell_count() const`, `char char_at(int i) const`.
- `static bool segment_on(char ch, const std::string& seg)` — is that segment lit for that character?
- `static bool renders_clean(char ch)` / `renders_approx(char ch)` / `renders_blank(char ch)`; `static std::string clean_repertoire()` / `approx_repertoire()` / `cannot_repertoire()`.
- `static constexpr int kDigits`, `static constexpr int kSegments` (14 or 16), `static const char* default_value()`.
- `void draw()` — redraws the widget.
- `bool on_button_press(int x, int y, unsigned int button)` — click focuses the widget and fires `on_click`; `bool on_button_release(...)`, `bool on_motion(int x, int y)` — hover tracking.
- `bool on_key(KeySym key, const char* str)` — only when focused: Up/Right steps the last displayed character (digit wraps 9→0, letter wraps Z→A), Down/Left steps it down, Home restores the default demo string, Return/Space fires `on_click`.
- `std::function<void()> on_click`, `void set_bounds(...)`, `width()`, `height()`, `contains(x, y)`, `set_visible`/`get_visible`, `set_enabled`/`get_enabled`, `set_style_name`, `set_text`/`get_text`, `style()`.
Build one widget (from the repo root, on the server):
```
cmake -S widgets/components/InstSeg14Display4 -B /tmp/b-seg14-4 -DCMAKE_CXX_FLAGS="-Wall -Wextra"
cmake --build /tmp/b-seg14-4 # 0 warnings
```
Run the whole group (build + harness + demos + doc examples):
```
python3 widgets/tests/test_inst_group_g.py # ALL PASS, 12/12 widgets
```
## InstSeg14Display1
14-segment alphanumeric LED display, 1 digit. The classic
14-segment font: the seven bars plus two half middle bars, two centre
verticals and four diagonals. Shows A–Z, 0–9 and common punctuation
roughly — M and W are poor (no centre peak), and K, Q, R, V, Y and Z
are approximations. Demo string: `A`.
Repertoire (14-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L O P S T U X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K M N Q R V W Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
M and W have no centre peak on 14 segments, so they read as rough approximations; K, Q, R, V, Y and Z need diagonals the font only hints at.
Example:
```cpp
InstSeg14Display1 w(display, screen, window, gc, &styles, 20, 20, 90, 110);
w.set_value("A");
w.draw();
```
## InstSeg14Display2
14-segment alphanumeric LED display, 2 digits. The classic
14-segment font: the seven bars plus two half middle bars, two centre
verticals and four diagonals. Shows A–Z, 0–9 and common punctuation
roughly — M and W are poor (no centre peak), and K, Q, R, V, Y and Z
are approximations. Demo string: `42`.
Repertoire (14-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L O P S T U X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K M N Q R V W Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
M and W have no centre peak on 14 segments, so they read as rough approximations; K, Q, R, V, Y and Z need diagonals the font only hints at.
Example:
```cpp
InstSeg14Display2 w(display, screen, window, gc, &styles, 20, 20, 140, 110);
w.set_value("42");
w.draw();
```
## InstSeg14Display3
14-segment alphanumeric LED display, 3 digits. The classic
14-segment font: the seven bars plus two half middle bars, two centre
verticals and four diagonals. Shows A–Z, 0–9 and common punctuation
roughly — M and W are poor (no centre peak), and K, Q, R, V, Y and Z
are approximations. Demo string: `ABC`.
Repertoire (14-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L O P S T U X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K M N Q R V W Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
M and W have no centre peak on 14 segments, so they read as rough approximations; K, Q, R, V, Y and Z need diagonals the font only hints at.
Example:
```cpp
InstSeg14Display3 w(display, screen, window, gc, &styles, 20, 20, 190, 110);
w.set_value("ABC");
w.draw();
```
## InstSeg14Display4
14-segment alphanumeric LED display, 4 digits. The classic
14-segment font: the seven bars plus two half middle bars, two centre
verticals and four diagonals. Shows A–Z, 0–9 and common punctuation
roughly — M and W are poor (no centre peak), and K, Q, R, V, Y and Z
are approximations. Demo string: `HELL`.
Repertoire (14-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L O P S T U X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K M N Q R V W Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
M and W have no centre peak on 14 segments, so they read as rough approximations; K, Q, R, V, Y and Z need diagonals the font only hints at.
Example:
```cpp
InstSeg14Display4 w(display, screen, window, gc, &styles, 20, 20, 240, 110);
w.set_value("HELL");
w.draw();
```
## InstSeg14Display5
14-segment alphanumeric LED display, 5 digits. The classic
14-segment font: the seven bars plus two half middle bars, two centre
verticals and four diagonals. Shows A–Z, 0–9 and common punctuation
roughly — M and W are poor (no centre peak), and K, Q, R, V, Y and Z
are approximations. Demo string: `HELLO`.
Repertoire (14-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L O P S T U X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K M N Q R V W Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
M and W have no centre peak on 14 segments, so they read as rough approximations; K, Q, R, V, Y and Z need diagonals the font only hints at.
Example:
```cpp
InstSeg14Display5 w(display, screen, window, gc, &styles, 20, 20, 290, 110);
w.set_value("HELLO");
w.draw();
```
## InstSeg14Display6
14-segment alphanumeric LED display, 6 digits. The classic
14-segment font: the seven bars plus two half middle bars, two centre
verticals and four diagonals. Shows A–Z, 0–9 and common punctuation
roughly — M and W are poor (no centre peak), and K, Q, R, V, Y and Z
are approximations. Demo string: `ABC123`.
Repertoire (14-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L O P S T U X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K M N Q R V W Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
M and W have no centre peak on 14 segments, so they read as rough approximations; K, Q, R, V, Y and Z need diagonals the font only hints at.
Example:
```cpp
InstSeg14Display6 w(display, screen, window, gc, &styles, 20, 20, 340, 110);
w.set_value("ABC123");
w.draw();
```
## InstSeg16Display1
16-segment alphanumeric LED display, 1 digit. The 14-segment
font with the top and bottom bars split in two, which — together with
the centre verticals — gives M and W a real middle peak and handles
more punctuation better. K, Q, R, V, Y and Z are still approximations.
Demo string: `M`.
Repertoire (16-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L M O P S T U W X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K N Q R V Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
The split top/bottom bars plus the centre verticals give M and W a real middle peak, so they read cleanly here. K, Q, R, V, Y and Z are still only approximate.
Example:
```cpp
InstSeg16Display1 w(display, screen, window, gc, &styles, 20, 20, 90, 110);
w.set_value("M");
w.draw();
```
## InstSeg16Display2
16-segment alphanumeric LED display, 2 digits. The 14-segment
font with the top and bottom bars split in two, which — together with
the centre verticals — gives M and W a real middle peak and handles
more punctuation better. K, Q, R, V, Y and Z are still approximations.
Demo string: `MW`.
Repertoire (16-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L M O P S T U W X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K N Q R V Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
The split top/bottom bars plus the centre verticals give M and W a real middle peak, so they read cleanly here. K, Q, R, V, Y and Z are still only approximate.
Example:
```cpp
InstSeg16Display2 w(display, screen, window, gc, &styles, 20, 20, 140, 110);
w.set_value("MW");
w.draw();
```
## InstSeg16Display3
16-segment alphanumeric LED display, 3 digits. The 14-segment
font with the top and bottom bars split in two, which — together with
the centre verticals — gives M and W a real middle peak and handles
more punctuation better. K, Q, R, V, Y and Z are still approximations.
Demo string: `MWM`.
Repertoire (16-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L M O P S T U W X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K N Q R V Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
The split top/bottom bars plus the centre verticals give M and W a real middle peak, so they read cleanly here. K, Q, R, V, Y and Z are still only approximate.
Example:
```cpp
InstSeg16Display3 w(display, screen, window, gc, &styles, 20, 20, 190, 110);
w.set_value("MWM");
w.draw();
```
## InstSeg16Display4
16-segment alphanumeric LED display, 4 digits. The 14-segment
font with the top and bottom bars split in two, which — together with
the centre verticals — gives M and W a real middle peak and handles
more punctuation better. K, Q, R, V, Y and Z are still approximations.
Demo string: `MWMW`.
Repertoire (16-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L M O P S T U W X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K N Q R V Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
The split top/bottom bars plus the centre verticals give M and W a real middle peak, so they read cleanly here. K, Q, R, V, Y and Z are still only approximate.
Example:
```cpp
InstSeg16Display4 w(display, screen, window, gc, &styles, 20, 20, 240, 110);
w.set_value("MWMW");
w.draw();
```
## InstSeg16Display5
16-segment alphanumeric LED display, 5 digits. The 14-segment
font with the top and bottom bars split in two, which — together with
the centre verticals — gives M and W a real middle peak and handles
more punctuation better. K, Q, R, V, Y and Z are still approximations.
Demo string: `MWMWM`.
Repertoire (16-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L M O P S T U W X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K N Q R V Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
The split top/bottom bars plus the centre verticals give M and W a real middle peak, so they read cleanly here. K, Q, R, V, Y and Z are still only approximate.
Example:
```cpp
InstSeg16Display5 w(display, screen, window, gc, &styles, 20, 20, 290, 110);
w.set_value("MWMWM");
w.draw();
```
## InstSeg16Display6
16-segment alphanumeric LED display, 6 digits. The 14-segment
font with the top and bottom bars split in two, which — together with
the centre verticals — gives M and W a real middle peak and handles
more punctuation better. K, Q, R, V, Y and Z are still approximations.
Demo string: `MWMWMW`.
Repertoire (16-segment):
| Class | Characters | Notes |
|---|---|---|
| Clean | 0–9, A B C D E F G H I J L M O P S T U W X, - _ = + / | Render distinctly; verified pixel-distinct in the harness, except the look-alikes below. |
| Approximate | K N Q R V Y Z ' " : | Renders something recognisable, but only roughly. |
| Cannot show | ; , ? ! @ # $ % & * ( ) [ ] { } < > \ | ^ ` ~ | Renders blank (no lit segments). |
| Look-alikes | 0/O, 5/S, 6/G, J/U | Each pair renders identically on segment displays. |
The split top/bottom bars plus the centre verticals give M and W a real middle peak, so they read cleanly here. K, Q, R, V, Y and Z are still only approximate.
Example:
```cpp
InstSeg16Display6 w(display, screen, window, gc, &styles, 20, 20, 340, 110);
w.set_value("MWMWMW");
w.draw();
```
+384
View File
@@ -0,0 +1,384 @@
# Instrumentation — Switches (Group B)
12 switch widgets for the XFrame Instrumentation section. Every switch really
toggles: a click flips the state and the widget redraws in the new position.
State is observable via `is_on()` and `get_state()` (returning
`xframe::InstSwitchState`: `Off`, `On`, `Tripped`), and every widget exposes an
`on_click` callback fired on each state change. Style: standard XFrame
hand-drawn widget style, no photorealism. Attribution: XFrame.
Shared types live in `widgets/components/InstData.h`.
## InstRockerSwitch
SPST rocker switch: up is on, down is off. Click flips it and it redraws tilted the other way.
API: is_on(), get_state() -> InstSwitchState, toggle(), set_on(bool), on_click callback.
```cpp
#include "InstRockerSwitch.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstRockerSwitch sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.on_click = []() { std::printf("rocker toggled\n"); };
sw.set_on(true);
std::printf("on=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstRockerSwitchIlluminated
Rocker switch with a lens that lights green when on and dim red when off.
API: is_on(), get_state() -> InstSwitchState, toggle(), set_on(bool), on_click callback. Lens: green lit when on, dim red when off.
```cpp
#include "InstRockerSwitchIlluminated.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstRockerSwitchIlluminated sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.on_click = []() { std::printf("illuminated rocker toggled\n"); };
sw.set_on(true);
std::printf("on=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstRockerSwitchDouble
DPDT centre-off rocker: click the top half for up/on, the bottom half for down, the same half again (or the middle) for centre/off.
API: is_on(), get_state() -> InstSwitchState (On = up, Off = centre, Tripped = down), get_position() (-1/0/+1), set_position(int), on_click callback.
```cpp
#include "InstRockerSwitchDouble.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstRockerSwitchDouble sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.set_position(1);
std::printf("pos=%d on=%d state=%d\n", sw.get_position(), (int)sw.is_on(), (int)sw.get_state());
sw.set_position(-1);
std::printf("pos=%d on=%d state=%d\n", sw.get_position(), (int)sw.is_on(), (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstToggleSwitch
Bat-lever toggle switch: lever points up when on, down when off.
API: is_on(), get_state() -> InstSwitchState, toggle(), set_on(bool), on_click callback.
```cpp
#include "InstToggleSwitch.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstToggleSwitch sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.toggle();
std::printf("on=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstToggleSwitchIlluminated
Bat-lever toggle with an illuminated tip: the tip glows green when on.
API: is_on(), get_state() -> InstSwitchState, toggle(), set_on(bool), on_click callback. Tip glows green when on.
```cpp
#include "InstToggleSwitchIlluminated.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstToggleSwitchIlluminated sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.toggle();
std::printf("on=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstPushButton
Momentary push button: on only while held down, off on release.
API: is_on(), get_state() -> InstSwitchState. On only while the button is held; release turns it off. on_click fires on press.
```cpp
#include "InstPushButton.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstPushButton sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.on_button_press(380, 260, 1);
std::printf("held on=%d\n", (int)sw.is_on());
sw.on_button_release(380, 260, 1);
std::printf("released on=%d\n", (int)sw.is_on());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstPushButtonLatching
Latching push button: click once and it stays in (on), click again and it pops out (off).
API: is_on(), get_state() -> InstSwitchState, toggle(), set_on(bool), on_click callback. Drawn depressed with a green ring while latched in.
```cpp
#include "InstPushButtonLatching.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstPushButtonLatching sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.toggle();
std::printf("latched on=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.toggle();
std::printf("latched on=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstEmergencyStop
Mushroom emergency stop: press once and it latches in (stopped). A second press does nothing; twist (right-click) or the R key resets it.
API: is_on(), get_state() -> InstSwitchState (Tripped = latched/stopped), reset(), on_click callback. Press latches; right-click or R resets.
```cpp
#include "InstEmergencyStop.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstEmergencyStop sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.on_button_press(380, 260, 1);
std::printf("stopped=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.reset();
std::printf("after reset stopped=%d\n", (int)sw.is_on());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstRotarySelector
Rotary selector switch with 2, 3 or 4 positions and a pointer. Click (or Space) advances to the next position.
API: get_position(), get_positions(), set_positions(2..4), set_position(int), is_on() (position > 0), get_state(), on_click callback.
```cpp
#include "InstRotarySelector.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstRotarySelector sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.set_positions(4);
sw.set_position(2);
std::printf("pos=%d of %d on=%d\n", sw.get_position(), sw.get_positions(), (int)sw.is_on());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstKeySwitch
Key-operated selector: click inserts the key, further clicks move through the positions, K removes the key (position resets to 0).
API: get_key_in(), set_key_in(bool), get_position(), get_positions(), set_positions(2..4), is_on() (key in and position > 0), get_state(), on_click callback.
```cpp
#include "InstKeySwitch.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstKeySwitch sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.set_key_in(true);
sw.on_button_press(380, 260, 1);
std::printf("key_in=%d pos=%d on=%d\n", (int)sw.get_key_in(), sw.get_position(), (int)sw.is_on());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstSlideSwitch
Slide switch: knob left is off, right is on. Click toggles; drag the knob across.
API: is_on(), get_state() -> InstSwitchState, toggle(), set_on(bool), on_click callback. Drag the knob or click to flip.
```cpp
#include "InstSlideSwitch.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstSlideSwitch sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.toggle();
std::printf("on=%d state=%d\n", (int)sw.is_on(), (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
## InstCircuitBreaker
Circuit breaker: handle up is on, down is off, mid-position with a red TRIPPED flag is the fault state. Click toggles on/off; trip() simulates a fault.
API: is_on(), get_state() -> InstSwitchState (On/Off/Tripped), trip(), reset(), on_click callback. Click toggles On/Off and resets from Tripped.
```cpp
#include "InstCircuitBreaker.h"
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) return 1;
int screen = DefaultScreen(display);
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100, 800, 600, 1,
BlackPixel(display, screen), WhitePixel(display, screen));
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
InstCircuitBreaker sw(display, screen, window, gc, &styles, 20, 20, 720, 480);
sw.trip();
std::printf("tripped state=%d on=%d\n", (int)sw.get_state(), (int)sw.is_on());
sw.reset();
std::printf("after reset state=%d\n", (int)sw.get_state());
sw.draw();
XCloseDisplay(display);
return 0;
}
```
+161
View File
@@ -0,0 +1,161 @@
# Instrumentation — Tank Level Widgets
Group A of the XFrame Instrumentation section (11th palette section, amber
accent). Eight tank-level widgets, all in the standard XFrame hand-drawn
widget style — no photorealism, no photo textures.
Every widget shows fill 0–100%, a 0–100 scale, and hi/lo alarm markers.
Level is settable with `set_level()` (clamped to 0–100 via
`xframe::inst_clamp_level`) and readable with `get_level()`. Alarm bands
default to hi-hi 95, hi 80, lo 20, lo-lo 5 (`xframe::InstAlarmBands`) and
can be changed with `set_alarm_bands()`. Clicking a widget sets the level
from the click position; Up/Down (or Left/Right) keys nudge it by 5,
Home sets 0, End sets 100, R resets to the deterministic demo level.
Demos use deterministic values from `widgets/components/InstData.h`
(`xframe::inst_demo_level(seed)` in [5, 95]).
Shared header: `widgets/components/InstData.h` — `inst_clamp_level()`,
`InstAlarmBands`, `inst_demo_level()`, `inst_demo_value()`.
## InstVerticalTankLevel
Upright cylindrical tank, fill rises from the bottom, percent readout,
hi-hi / hi / lo / lo-lo alarm markers on the right of the tank.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstVerticalTankLevel tank(display, screen, window, gc, &styles, 20, 20, 360, 240, 62.5);
tank.set_level(75.0);
tank.set_alarm_bands(xframe::InstAlarmBands{95.0, 80.0, 20.0, 5.0});
tank.draw();
```
## InstHorizontalTankLevel
Horizontal bullet tank, fill by cross-section width, percent readout,
hi-hi / hi / lo / lo-lo alarm markers as vertical lines across the tank.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstHorizontalTankLevel tank(display, screen, window, gc, &styles, 20, 20, 360, 240, 40.0);
tank.set_level(55.0);
tank.draw();
```
## InstSphericalTankLevel
Sphere tank on legs, fill by volume height, percent readout, hi-hi / hi /
lo / lo-lo alarm markers.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstSphericalTankLevel tank(display, screen, window, gc, &styles, 20, 20, 360, 240, 68.0);
tank.set_level(68.0);
tank.draw();
```
## InstSightGlassLevel
Glass tube with liquid column, scale marks every 10% (labelled every 25%),
top/bottom pipe connections, percent readout, hi-hi / hi / lo / lo-lo
alarm markers.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstSightGlassLevel gauge(display, screen, window, gc, &styles, 20, 20, 360, 240, 33.0);
gauge.set_level(33.0);
gauge.draw();
```
## InstLevelColumnGauge
Vertical column gauge with scale and a float marker (red bar) at the
level, percent readout, hi-hi / hi / lo / lo-lo alarm markers.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstLevelColumnGauge gauge(display, screen, window, gc, &styles, 20, 20, 360, 240, 47.0);
gauge.set_level(47.0);
gauge.draw();
```
## InstTankLevelAlarms
Tank with hi-hi / hi / lo / lo-lo alarm bands and lamps: the red HI-HI
lamp lights when the level reaches hi-hi, amber HI at hi, amber LO at or
below lo, red LO-LO at or below lo-lo.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstTankLevelAlarms tank(display, screen, window, gc, &styles, 20, 20, 360, 240, 97.0);
tank.set_level(97.0);
tank.draw();
```
## InstOpenChannelLevel
Open reservoir / channel with waterline and depth scale, percent depth
readout, hi-hi / hi / lo / lo-lo alarm markers.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstOpenChannelLevel channel(display, screen, window, gc, &styles, 20, 20, 360, 240, 58.0);
channel.set_level(58.0);
channel.draw();
```
## InstLevelTransmitter
4–20 mA loop indicator: level bar, mA value (4 mA at 0%, 20 mA at 100%),
percent readout, loop terminals, hi-hi / hi / lo / lo-lo alarm markers.
API: `set_level(double)` / `get_level()`, `set_alarm_bands(InstAlarmBands)` /
`alarm_bands()`, `set_text()`, `set_on_click()`, `set_bounds()`, `contains()`,
`set_visible()` / `get_visible()`, `set_enabled()` / `get_enabled()`,
`draw()`, `on_button_press()` / `on_button_release()` / `on_motion()` /
`on_key()`.
```cpp
InstLevelTransmitter tx(display, screen, window, gc, &styles, 20, 20, 360, 240, 62.5);
tx.set_level(62.5);
double pct = tx.get_level();
double ma = 4.0 + 16.0 * pct / 100.0;
bool loop_ok = (ma >= 4.0 && ma <= 20.0);
tx.set_enabled(loop_ok);
tx.draw();
```
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+436
View File
@@ -0,0 +1,436 @@
# Misc / X
Everything that fits nowhere else: a transparent event catcher, the application metadata holder, and the two custom X-prefixed widgets — a chart and a spreadsheet — that are not modelled on any GTK or Lazarus control.
> Every widget here shares the common XFrame widget API — same constructor, set_bounds/draw/event handlers, visible/enabled state. The shared contract is documented in docs/index.md (written by the coordinator). Each subsection below lists only what is specific to that widget.
## GtkEventBox
![GtkEventBox](../screenshots/widgets/GtkEventBox.png)
A transparent event-catching box. By default it draws nothing at all — it exists to receive mouse and keyboard events over an area (for example over a child widget) and report them. With a visible window it draws a pale box with its text; in design-time mode it draws a marker box instead.
**Constructor:** `GtkEventBox(Display* display, int screen, Window window, GC gc, SStyle_Manager* styles, int x, int y, int width, int height)`
**API** (widget-specific methods/properties/signals ONLY — skip the common ones):
- `set_text(std::string t)` / `get_text()` — the text drawn when the window is visible
- `set_above_child(bool a)` / `get_above_child()` — whether the box receives events before its child does
- `set_visible_window(bool v)` / `get_visible_window()` — whether the box draws a visible background (pale fill + outline + centred text)
- `set_design_time(bool d)` — design-time mode: draws a marker box so the box can be seen in a designer
- `get_last_event()` — description of the most recent event the box received
- `get_event_count()` — how many events the box has received
- signal `on_click` (`std::function<void()>`) — fires on a click in the box
**Example:**
```cpp
#include "GtkEventBox.h"
#include <cstdio>
#include <string>
#include <vector>
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) { return 1; }
int screen = DefaultScreen(display);
XID Xid = RootWindow(display, screen);
Window window = XCreateSimpleWindow(display, Xid, 100, 100, 800, 600, 1, BlackPixel(display, screen), WhitePixel(display, screen));
XStoreName(display, window, "GtkEventBox - XFrame demo");
XSelectInput(display, window, ExposureMask | KeyPressMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
Atom deleteWindowMessage = XInternAtom(display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(display, window, &deleteWindowMessage, 1);
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
GtkEventBox widget(display, screen, window, gc, &styles, 40, 40, 340, 200);
widget.set_text("EventBox");
widget.set_visible_window(true);
widget.on_click = []{ std::printf("clicked\n"); };
widget.draw();
bool running = true;
while (running)
{
XEvent event;
XNextEvent(display, &event);
bool handled = false;
switch (event.type)
{
case Expose:
handled = true;
break;
case ButtonPress:
handled = widget.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case ButtonRelease:
handled = widget.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case MotionNotify:
handled = widget.on_motion(event.xmotion.x, event.xmotion.y);
break;
case KeyPress:
{
char buffer[32];
KeySym key = 0;
int n = XLookupString(&event.xkey, buffer, (int)sizeof(buffer) - 1, &key, nullptr);
buffer[n] = 0;
handled = widget.on_key(key, buffer);
break;
}
case ClientMessage:
if ((Atom)event.xclient.data.l[0] == deleteWindowMessage)
{
running = false;
}
break;
}
if (handled)
{
XClearWindow(display, window);
widget.draw();
XFlush(display);
}
}
XCloseDisplay(display);
return 0;
}
```
**Notes:** With both visible_window and design_time off, draw() paints nothing — the widget is invisible but still receives events.
## TApplicationProperties
![TApplicationProperties](../screenshots/widgets/TApplicationProperties.png)
Application metadata with a visual badge — not a non-visual component, despite the name. It draws a round "i" badge plus a `"<title> v<version>"` label, and holds the application's title, version, hint text and help file. handle_exception() records an exception and fires on_exception.
**Constructor:** `TApplicationProperties(Display* display, int screen, Window window, GC gc, SStyle_Manager* styles, int x, int y, int width, int height)`
**API** (widget-specific methods/properties/signals ONLY — skip the common ones):
- `set_text(std::string t)` / `get_text()` — the widget text
- `set_title(std::string t)` / `get_title()` — the application title shown in the badge label
- `set_version(std::string v)` / `get_version()` — the application version (drawn as "v" + version)
- `set_hint(std::string h)` / `get_hint()` — the hint text
- `set_help_file(std::string f)` / `get_help_file()` — the help file path
- `set_show_main_form(bool s)` / `get_show_main_form()` — whether the main form is shown
- `set_show_hint(bool s)` / `get_show_hint()` — whether hints are shown
- `handle_exception(const std::string& message)` — record an exception: it is counted, remembered as the last exception, and on_exception fires with the message
- `get_exception_count()` — how many exceptions have been recorded
- `get_last_exception()` — the most recent exception message
- signal `on_click` (`std::function<void()>`) — fires on a click on the badge
- signal `on_exception` (`std::function<void(const std::string&)>`) — fires with the exception message when handle_exception() is called
- signal `on_minimize` (`std::function<void()>`) — declared on the widget
- signal `on_restore` (`std::function<void()>`) — declared on the widget
**Example:**
```cpp
#include "TApplicationProperties.h"
#include <cstdio>
#include <string>
#include <vector>
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) { return 1; }
int screen = DefaultScreen(display);
XID Xid = RootWindow(display, screen);
Window window = XCreateSimpleWindow(display, Xid, 100, 100, 800, 600, 1, BlackPixel(display, screen), WhitePixel(display, screen));
XStoreName(display, window, "TApplicationProperties - XFrame demo");
XSelectInput(display, window, ExposureMask | KeyPressMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
Atom deleteWindowMessage = XInternAtom(display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(display, window, &deleteWindowMessage, 1);
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
TApplicationProperties widget(display, screen, window, gc, &styles, 40, 40, 340, 200);
widget.set_title("Demo App");
widget.set_version("1.0");
widget.set_hint("A demo application");
widget.on_exception = [](const std::string& m){ std::printf("exception: %s\n", m.c_str()); };
widget.draw();
bool running = true;
while (running)
{
XEvent event;
XNextEvent(display, &event);
bool handled = false;
switch (event.type)
{
case Expose:
handled = true;
break;
case ButtonPress:
handled = widget.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case ButtonRelease:
handled = widget.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case MotionNotify:
handled = widget.on_motion(event.xmotion.x, event.xmotion.y);
break;
case KeyPress:
{
char buffer[32];
KeySym key = 0;
int n = XLookupString(&event.xkey, buffer, (int)sizeof(buffer) - 1, &key, nullptr);
buffer[n] = 0;
handled = widget.on_key(key, buffer);
break;
}
case ClientMessage:
if ((Atom)event.xclient.data.l[0] == deleteWindowMessage)
{
running = false;
}
break;
}
if (handled)
{
XClearWindow(display, window);
widget.draw();
XFlush(display);
}
}
XCloseDisplay(display);
return 0;
}
```
**Notes:** The on_minimize and on_restore signals are declared but no call site for either appears in the header — nothing in the widget fires them, so it is unclear from the header how the host is meant to trigger them.
## XGraph
![XGraph](../screenshots/widgets/XGraph.png)
A chart widget — one of the two custom X-prefixed widgets, not modelled on a GTK or Lazarus control. It draws a white plot area with a grid and axes, and plots line series, OHLC bars or candlesticks. The view pans and zooms: zoom_at() zooms around a point in the view, reset_view() restores the full range, and on_view_change reports the new view.
**Constructor:** `XGraph(Display* display, int screen, Window window, GC gc, SStyle_Manager* styles, int x, int y, int width, int height)`
**API** (widget-specific methods/properties/signals ONLY — skip the common ones):
- `set_text(std::string t)` / `get_text()` — the widget text
- `item_count()` — total number of data points across all series
- `clear_series()` — removes all series
- `add_line_series(const std::string& name, Srgb color, const std::vector<double>& values)` — adds a line series (kind 0)
- `add_ohlc_series(const std::string& name, Srgb color, const std::vector<XGraphBar>& bars, bool candlesticks = false)` — adds an OHLC bar series (kind 1) or a candlestick series (kind 2); each `XGraphBar` is `{ double open, high, low, close; }`
- `set_series_kind(int index, int kind)` — change a series kind: 0 = line, 1 = OHLC bars, 2 = candlesticks
- `set_series_up_down(int index, Srgb up, Srgb down)` — up / down colours for a candlestick series
- `series_count()` — number of series
- `set_x_labels(const std::vector<std::string>& labels)` — labels for the x axis, one per item
- `set_y_range(double lo, double hi)` — fixed y range (turns auto-y off)
- `set_auto_y(bool on)` — automatic y range from the visible data (on by default)
- `reset_view()` — show the whole series again
- `get_view_first()` / `get_view_count()` — first visible item index / number of visible items
- `zoom_at(double factor, double frac_x)` — zoom by a factor around a fractional position in the view
- `effective_count()` — number of items the view covers after zooming
- `y_range(double& lo, double& hi)` — the y range actually being drawn
- `plot_x()` / `plot_y()` / `plot_w()` / `plot_h()` — the plot area rectangle in pixels
- `item_w()` — pixel width of one item
- `x_at(double index)` / `x_center(int i)` — pixel x for an item index
- `y_at(double v, double lo, double hi)` — pixel y for a value
- `value_at_y(int y, double lo, double hi)` — value for a pixel y
- `fire_view_change()` — fire on_view_change() with the current view
- `static double nice_step(double range, int target)` — a "nice" axis step for a range (used by draw() for the grid lines)
- `static std::string fmt(double v)` — formats a value for the axis labels (used by draw())
- signal `on_view_change` (`std::function<void(double, double)>`) — fires with (first visible index, visible count) when the view changes
**Example:**
```cpp
#include "XGraph.h"
#include <cstdio>
#include <string>
#include <vector>
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) { return 1; }
int screen = DefaultScreen(display);
XID Xid = RootWindow(display, screen);
Window window = XCreateSimpleWindow(display, Xid, 100, 100, 800, 600, 1, BlackPixel(display, screen), WhitePixel(display, screen));
XStoreName(display, window, "XGraph - XFrame demo");
XSelectInput(display, window, ExposureMask | KeyPressMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
Atom deleteWindowMessage = XInternAtom(display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(display, window, &deleteWindowMessage, 1);
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
XGraph widget(display, screen, window, gc, &styles, 20, 20, 720, 480);
widget.add_line_series("Price", Srgb{70, 110, 180}, std::vector<double>{1.0, 2.0, 1.5, 3.0, 2.5});
widget.set_x_labels(std::vector<std::string>{"Mon", "Tue", "Wed", "Thu", "Fri"});
widget.set_auto_y(true);
widget.on_view_change = [](double a, double b){ std::printf("view %f %f\n", a, b); };
widget.draw();
bool running = true;
while (running)
{
XEvent event;
XNextEvent(display, &event);
bool handled = false;
switch (event.type)
{
case Expose:
handled = true;
break;
case ButtonPress:
handled = widget.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case ButtonRelease:
handled = widget.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case MotionNotify:
handled = widget.on_motion(event.xmotion.x, event.xmotion.y);
break;
case KeyPress:
{
char buffer[32];
KeySym key = 0;
int n = XLookupString(&event.xkey, buffer, (int)sizeof(buffer) - 1, &key, nullptr);
buffer[n] = 0;
handled = widget.on_key(key, buffer);
break;
}
case ClientMessage:
if ((Atom)event.xclient.data.l[0] == deleteWindowMessage)
{
running = false;
}
break;
}
if (handled)
{
XClearWindow(display, window);
widget.draw();
XFlush(display);
}
}
XCloseDisplay(display);
return 0;
}
```
**Notes:** Series kinds are plain ints (0 / 1 / 2) — there are no named constants in the header. Panning and zooming come from mouse / key input handled by the widget; the host can drive the same view with zoom_at() and reset_view().
## XSpreadsheet
![XSpreadsheet](../screenshots/widgets/XSpreadsheet.png)
A spreadsheet widget — the other custom X-prefixed widget. It draws a grid with a frozen row-number column, a header row, an active cell and a selection, and it evaluates formulas. Cells hold text, numbers or formulas starting with '='; the formula engine supports + - * / ( ), A1 cell references and SUM / AVG / MIN / MAX / COUNT over ranges like A1:B9. The constructor pre-fills a sample sheet with values, a formula column and totals.
**Constructor:** `XSpreadsheet(Display* display, int screen, Window window, GC gc, SStyle_Manager* styles, int x, int y, int width, int height)`
**API** (widget-specific methods/properties/signals ONLY — skip the common ones):
- `set_text(std::string t)` / `get_text()` — the widget text
- `set_size(int cols, int rows)` — resize the sheet (default 12 columns x 40 rows)
- `get_cols()` / `get_rows()` — sheet size
- `set_col_width(int col, int w)` / `get_col_width(int col)` — width of one column
- `set_frozen_rows(int n)` / `set_frozen_cols(int n)` — frozen rows / columns (1 column is frozen by default, for the row numbers; 0 rows frozen by default)
- `set_cell_text(int col, int row, const std::string& text)` / `get_cell_text(int col, int row)` — the raw text of a cell (a formula when it starts with '=')
- `get_cell_value(int col, int row)` — the computed numeric value of a cell
- `get_cell_display(int col, int row)` — the text as drawn (computed value for formulas)
- `get_active_col()` / `get_active_row()` — the active cell
- `set_active_cell(int col, int row)` — make a cell active
- `sort_by_column(int col, bool ascending = true)` — sort the rows by one column
- `copy_selection()` — the selected range as tab-separated text
- `get_clipboard()` — the last copied text
- `recalculate()` — re-evaluate every formula
- `eval_cell(int col, int row, std::set<long>& visiting, std::set<long>& done)` — evaluate one cell (formula-engine entry point; the visiting / done sets are cycle detection)
- `skip_spaces(const std::string& s, size_t& pos)` / `parse_expr(...)` / `parse_term(...)` / `parse_factor(...)` / `apply_function(...)` — the formula parser internals; public, but not part of the normal API
- `col_left(int col)` / `row_top(int row)` — pixel position of a column / row
- `visible_cols(int& first, int& last)` / `visible_rows(int& first, int& last)` — which columns / rows are on screen
- `cell_at(int x, int y, int& col, int& row)` — cell under a point
- `ensure_visible(int col, int row)` — scroll so a cell is visible
- `begin_edit(bool replace)` / `commit_edit()` / `cancel_edit()` — start / finish / abandon editing the active cell
- `static std::string col_name(int col)` — column letters for an index ("A", "B", ...)
- `static std::string format_number(double v)` — formats a numeric cell for display
- `static bool parse_ref(const std::string& s, size_t& pos, int& col, int& row)` — parse an A1-style cell reference out of a formula string
- signal `on_cell_change` (`std::function<void(int, int)>`) — fires with (column, row) when a cell's text changes
- signal `on_select_cell` (`std::function<void(int, int)>`) — fires with (column, row) when the active cell changes
**Example:**
```cpp
#include "XSpreadsheet.h"
#include <cstdio>
#include <string>
#include <vector>
int main()
{
Display* display = XOpenDisplay(nullptr);
if (!display) { return 1; }
int screen = DefaultScreen(display);
XID Xid = RootWindow(display, screen);
Window window = XCreateSimpleWindow(display, Xid, 100, 100, 800, 600, 1, BlackPixel(display, screen), WhitePixel(display, screen));
XStoreName(display, window, "XSpreadsheet - XFrame demo");
XSelectInput(display, window, ExposureMask | KeyPressMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
Atom deleteWindowMessage = XInternAtom(display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(display, window, &deleteWindowMessage, 1);
XMapWindow(display, window);
GC gc = DefaultGC(display, screen);
SStyle_Manager styles(display, window, screen, gc);
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
XSpreadsheet widget(display, screen, window, gc, &styles, 20, 20, 720, 480);
widget.set_size(6, 10);
widget.set_cell_text(0, 0, "Item");
widget.set_cell_text(0, 1, "10");
widget.set_cell_text(0, 2, "20");
widget.set_cell_text(0, 3, "=SUM(A2:A3)");
widget.set_active_cell(0, 3);
widget.on_cell_change = [](int c, int r){ std::printf("cell %d,%d\n", c, r); };
widget.draw();
bool running = true;
while (running)
{
XEvent event;
XNextEvent(display, &event);
bool handled = false;
switch (event.type)
{
case Expose:
handled = true;
break;
case ButtonPress:
handled = widget.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case ButtonRelease:
handled = widget.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button);
break;
case MotionNotify:
handled = widget.on_motion(event.xmotion.x, event.xmotion.y);
break;
case KeyPress:
{
char buffer[32];
KeySym key = 0;
int n = XLookupString(&event.xkey, buffer, (int)sizeof(buffer) - 1, &key, nullptr);
buffer[n] = 0;
handled = widget.on_key(key, buffer);
break;
}
case ClientMessage:
if ((Atom)event.xclient.data.l[0] == deleteWindowMessage)
{
running = false;
}
break;
}
if (handled)
{
XClearWindow(display, window);
widget.draw();
XFlush(display);
}
}
XCloseDisplay(display);
return 0;
}
```
**Notes:** Columns and rows are 0-based in the API; the drawn row numbers start at 1. The constructor's sample sheet has a formula column and totals — call set_size() to start from a rebuilt grid. A failed formula (bad reference, circular reference, parse failure) marks the cell as an error and evaluates to 0.0; the exact text drawn for an error cell is unclear from the header.
+292
View File
@@ -0,0 +1,292 @@
# Stock Market — Comparative Plotting & Volume Widgets
Part of the XFrame Stock Market section (10th palette section). All widgets
are header-only X11 classes in `widgets/components/<Name>/`, following the
`XGraph` pattern (Display\*/screen/window/GC, `draw()`, `on_button_press`,
`on_button_release`, `on_motion`, `on_key`). All demos run on deterministic
seeded synthetic data from `widgets/components/StockData.h`
(`xframe::make_seeded_series(n, seed)`); there is no network, no live market
data, and no API key. Comparative demos use different seeds as different
symbols. Attribution: XFrame.
Common behaviour (all 15): left-drag pans the visible window, mouse wheel
zooms around the cursor, `+`/`-` zoom, arrow keys pan, `r`/`Home` resets the
view, moving the mouse shows a crosshair. `on_view_change(first, count)` fires
on pan/zoom/reset. Build: `cmake -S widgets/components/<Name> -B build`
then `cmake --build build` (C++17, X11 only, `-Wall -Wextra`, 0 warnings).
Test driver: `widgets/tests/test_stock_compare_volume.py` — rebuilds every
demo, runs it under Xvfb, screenshots the default draw, exercises
hover/click/key, and exits cleanly via `WM_DELETE_WINDOW`. Result:
**15/15 widgets, 75/75 cells PASS** (build/draw/click/key/exit each).
---
## Comparative plotting (2+ series each)
### StockOverlayChart
- **Draws/computes:** close-price lines for several symbols overlaid on one
shared price axis, with a colour legend and a 1/2/5 nice-step grid.
- **API:** `StockOverlayChart(Display*, int screen, Window, GC, SStyle_Manager*, int x, int y, int w, int h)`;
`add_series(name, series)` (auto colour) or `add_series(name, series, Srgb)`;
`clear_series()`, `series_count()`, `item_count()`, `close_at(series, i)`.
- **Example:**
```cpp
StockOverlayChart w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
w.add_series("SYM-B", xframe::make_seeded_series(60, 7));
w.draw();
```
- **Unclear from the header:** symbols with very different price levels share
one axis, so a low-priced symbol can look flat next to a high-priced one;
use `StockRelativePerformance` or `StockIndexedComparison` for that case.
### StockMultiSymbolChart
- **Draws/computes:** small-multiple panels — one close-price panel per
symbol, stacked vertically, each with its own auto y-range.
- **API:** same constructor; `add_series(name, series[, colour])`,
`clear_series()`, `series_count()`, `item_count()`,
`panel_close_at(series, i)`.
- **Example:**
```cpp
StockMultiSymbolChart w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
w.add_series("SYM-B", xframe::make_seeded_series(60, 7));
w.draw();
```
- **Unclear from the header:** panels split the plot height evenly (the last
panel takes any remainder); there is no per-panel y-axis label, only grid
lines, so exact values are read from the crosshair position, not the panel.
### StockRelativePerformance
- **Draws/computes:** each symbol rebased to 100 at its first close
(`close / first_close * 100`); lines show percentage performance vs the
start, with a horizontal line at 100.
- **API:** same constructor; `add_series(...)`, `rebased(series)` (vector),
`performance_at(series, i)` (rebased value minus 100).
- **Example:**
```cpp
StockRelativePerformance w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
double pct = w.performance_at(0, 59); // % move of SYM-A over the window
```
- **Unclear from the header:** the base is always the first bar in the
series as supplied, not the first *visible* bar after panning/zooming.
### StockSpreadChart
- **Draws/computes:** the price difference `A.close - B.close` (first two
series, truncated to the shorter length) as a line around a zero line.
- **API:** same constructor; `add_series(...)`, `spread()` (vector),
`spread_at(i)`, `spread_label()` (`"A - B"`).
- **Example:**
```cpp
StockSpreadChart w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
w.add_series("SYM-B", xframe::make_seeded_series(60, 7));
double s = w.spread_at(10);
w.draw();
```
- **Unclear from the header:** only the first two series are used; a third
series is drawn nowhere and ignored by `spread()`. No z-score or
normalisation is applied — the spread is in raw price units.
### StockRatioChart
- **Draws/computes:** the price ratio `A.close / B.close` (first two series,
truncated to the shorter length) as a line.
- **API:** same constructor; `add_series(...)`, `ratio()` (vector),
`ratio_at(i)`, `ratio_label()` (`"A / B"`).
- **Example:**
```cpp
StockRatioChart w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
w.add_series("SYM-B", xframe::make_seeded_series(60, 7));
double r = w.ratio_at(10);
w.draw();
```
- **Unclear from the header:** a zero close in B yields a ratio of 0.0
rather than an error or a skipped bar; only the first two series are used.
### StockCorrelationView
- **Draws/computes:** top panel — rolling Pearson correlation (default
window 20 bars) between the closes of two symbols, on a fixed −1..+1
scale with a zero line; bottom panel — scatter of daily returns
(`(close-prev)/prev`) of A vs B, with cross axes at zero.
- **API:** same constructor; `add_series(...)`, `set_window(w)` /
`get_window()`, `correlation()` (full-period, on closes),
`rolling_correlation()` (vector, 0.0 before the window fills),
`return_scatter()` (vector of `(retA, retB)` pairs).
- **Example:**
```cpp
StockCorrelationView w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
w.add_series("SYM-B", xframe::make_seeded_series(60, 7));
double c = w.correlation();
```
- **Unclear from the header:** the rolling correlation is computed on raw
closes, while the scatter uses returns — the two panels deliberately use
different inputs. The scatter axes are scaled to the largest absolute
return in either symbol, so the aspect is data-dependent.
### StockIndexedComparison
- **Draws/computes:** all symbols indexed to a common base value (default
100) at their first close, as lines, with a horizontal line at the base.
- **API:** same constructor; `add_series(...)`, `set_base_value(v)` /
`base_value()`, `indexed(series)` (vector), `indexed_at(series, i)`.
- **Example:**
```cpp
StockIndexedComparison w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
w.add_series("SYM-B", xframe::make_seeded_series(60, 7));
w.set_base_value(1000.0);
w.draw();
```
- **Unclear from the header:** this differs from `StockRelativePerformance`
only in the configurable base value and the absence of the
`performance_at` helper; the plotted lines are identical when the base
is 100. Changing the base after construction re-indexes on the next draw.
### StockSectorComparison
- **Draws/computes:** series grouped by sector label; one line per sector,
the average of that sector's members each indexed to 100 at its first
close. Legend shows the sector names.
- **API:** same constructor; `add_series(...)`,
`set_labels(vector<string>)` (one label per series, in order),
`labels()`, `sector_names()`, `sector_count()`,
`sector_indexed(sector)` (average indexed vector).
- **Example:**
```cpp
StockSectorComparison w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.add_series("SYM-A", xframe::make_seeded_series(60, 42));
w.add_series("SYM-B", xframe::make_seeded_series(60, 7));
w.add_series("SYM-C", xframe::make_seeded_series(60, 99));
w.set_labels({"Tech", "Tech", "Energy"});
```
- **Unclear from the header:** a series with no label (shorter label list)
is grouped under `"Other"`. The sector line is a simple mean of the
members' indexed values, not volume- or capitalisation-weighted. The
"grouped bars" mentioned in the brief are not drawn — the current widget
draws grouped (per-sector) lines only.
---
## Volume (one OHLCVSeries each)
### StockVolumeBars
- **Draws/computes:** close-price line in the top ~62% of the plot and
volume bars in the bottom strip, coloured green when `close >= open`,
red otherwise.
- **API:** same constructor; `set_series(series)`, `set_symbol(name)` /
`symbol()`, `volume_at(i)`, `max_volume()`.
- **Example:**
```cpp
StockVolumeBars w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_series(xframe::make_seeded_series(60, 42));
```
- **Unclear from the header:** bar height is scaled to the maximum volume
in the *whole* series, not the visible window, so zooming does not
rescale the bars.
### StockVWAP
- **Draws/computes:** close price plus the VWAP line, where VWAP is the
cumulative `sum(typical * volume) / sum(volume)` with typical price
`(high + low + close) / 3`, anchored at the first bar of the series.
- **API:** same constructor; `set_series(series)`, `vwap()` (vector),
`vwap_at(i)`.
- **Example:**
```cpp
StockVWAP w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_series(xframe::make_seeded_series(60, 42));
double v = w.vwap_at(59);
w.draw();
```
- **Unclear from the header:** VWAP is session-anchored at bar 0 of the
supplied series — there is no per-day reset and no way to re-anchor it
other than supplying a shorter series.
### StockVolumeProfile
- **Draws/computes:** horizontal volume-by-price histogram: volume
accumulated into 20 price bins (by typical price) between the series low
and high; the point of control (highest-volume bin) is drawn in red and
labelled with its price.
- **API:** same constructor; `set_series(series)`, `set_bins(n)` /
`get_bins()` (clamped 2..100), `profile()` (vector of bin volumes),
`poc_bin()`, `poc_price()`.
- **Example:**
```cpp
StockVolumeProfile w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_series(xframe::make_seeded_series(60, 42));
double poc = w.poc_price();
```
- **Unclear from the header:** a bar's whole volume goes into the single
bin containing its typical price (no splitting across bins); on a tie,
the lowest bin wins as POC.
### StockOBVChart
- **Draws/computes:** on-balance volume — cumulative volume, adding the
bar's volume when `close > open`, subtracting it when `close < open`,
unchanged on a doji (`close == open`).
- **API:** same constructor; `set_series(series)`, `obv()` (vector),
`obv_at(i)`.
- **Example:**
```cpp
StockOBVChart w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_series(xframe::make_seeded_series(60, 42));
double o = w.obv_at(59);
w.draw();
```
- **Unclear from the header:** OBV starts at 0 at bar 0 (bar 0's own volume
is included with its sign); it is not normalised or rebased.
### StockVolumeCandles
- **Draws/computes:** candlesticks (wick = high–low, body = open–close,
green up / red down) whose body width encodes volume:
`width fraction = 0.3 + 0.7 * volume / max_volume`, so the heaviest bar
is full slot width and the lightest is 30%.
- **API:** same constructor; `set_series(series)`,
`body_width_at(i)` (the 0.3..1.0 fraction), `max_volume()`.
- **Example:**
```cpp
StockVolumeCandles w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_series(xframe::make_seeded_series(60, 42));
double f = w.body_width_at(3);
w.draw();
```
- **Unclear from the header:** the width encodes *relative* volume within
the supplied series; absolute volume is not shown anywhere.
### StockAccumulationDistribution
- **Draws/computes:** the accumulation/distribution line — cumulative
money-flow volume, where each bar contributes
`CLV * volume` and `CLV = ((close-low) - (high-close)) / (high-low)`.
- **API:** same constructor; `set_series(series)`,
`accumulation_distribution()` (vector), `ad_at(i)`,
`clv(bar)` (static helper).
- **Example:**
```cpp
StockAccumulationDistribution w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_series(xframe::make_seeded_series(60, 42));
double a = w.ad_at(59);
w.draw();
```
- **Unclear from the header:** a zero-range bar (`high == low`) contributes
0; the line starts at 0 plus bar 0's contribution, not at bar 0's close.
### StockMoneyFlowChart
- **Draws/computes:** money-flow volume bars — `CLV * typical * volume`
per bar (same CLV as A/D), drawn as signed bars from a zero line, green
for positive flow, red for negative.
- **API:** same constructor; `set_series(series)`,
`money_flow()` (vector, per-bar values, *not* cumulative),
`money_flow_at(i)`, `total_money_flow()` (sum over bars),
`clv(bar)` (static helper).
- **Example:**
```cpp
StockMoneyFlowChart w(display, screen, window, gc, &styles, 20, 20, 720, 480);
w.set_series(xframe::make_seeded_series(60, 42));
double m = w.total_money_flow();
w.draw();
```
- **Unclear from the header:** unlike `StockAccumulationDistribution`,
this widget does *not* cumulate — each bar stands alone. The vertical
scale is money-flow units (price × volume), not volume, so bar heights
are not comparable with `StockVolumeBars`.
+338
View File
@@ -0,0 +1,338 @@
# Stock Market — Drawing / Annotation Widgets
XFrame Stock Market section, drawing group (14 widgets). Every widget in
this group takes an `xframe::OHLCVSeries` (see
`widgets/components/StockData.h`, seeded synthetic data only — no network,
no live market data), draws a light candlestick background from it, then
draws its annotation in a strong colour. All are header-only classes in
`widgets/components/<Name>/<Name>.h`, following the `XGraph` pattern
(`Display*` / `screen_` / `window_` / `GC`, geometry, `draw()`,
`on_button_press` / `on_button_release` / `on_motion` / `on_key`).
Demos: `widgets/components/<Name>/main_<Name>.cpp` (800×600 window,
widget at 20,20,720,480, 60 seeded bars, seed 42), `CMakeLists.txt`
(CMake ≥ 3.20, C++17, X11 only).
Common API (all 14): constructor
`(Display*, int screen, Window, GC, SStyle_Manager*, x, y, width, height)`;
`set_series(const xframe::OHLCVSeries&)` (also resets anchors to seeded
defaults); `set_anchors(int bar1, double price1, int bar2, double price2)`;
`set_anchors3(...)` (3 anchors); `set_anchor(int i, int bar, double price)`;
`anchor(int i)` / `anchor_count()`; `set_color(Srgb)` / `get_color()`;
`add_point(int bar, double price)` / `clear_points()` / `point_count()`
(meaningful only for StockBrush); `set_text(std::string)` /
`get_text()`; `reset_anchors()`; `bar_count()`; `draw()`.
Interaction (all 14): left-click moves the nearest anchor to the clicked
bar/price (StockBrush: click adds a point instead); drag moves the
dragged anchor / extends the brush path; arrow keys shift all anchors
(Left/Right ±1 bar, Up/Down ±2% of the price range); `r` / `Home` resets
anchors. Tests: `widgets/tests/test_stock_drawing.py`
(build/draw/hover/click/key/clean-exit per widget, 14/14 PASS, 0 warnings).
## StockTrendline
Draws a trend line through two anchors, extended across the full plot
width using the slope between them, with filled circles at both anchors
and a `Trend <p0> -> <p1>` label at the second anchor.
API: `set_anchors(b1, p1, b2, p2)` — the two points the line passes through.
Example:
```cpp
StockTrendline w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(5, series[5].close, 25, series[25].close);
w.draw();
```
Unclear from the header: the line is extrapolated to the plot edges, not
clipped to the segment between the anchors; if both anchors share a bar
the slope is treated as 0 (flat line at the first anchor's price).
## StockHorizontalLine
Draws a full-width horizontal line at one price level, with a filled tag
at the right edge showing `H <price>`.
API: `set_anchors(bar, price, bar, price)` — only the first anchor's
price is drawn; the bar indices are stored but ignored.
Example:
```cpp
StockHorizontalLine w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(0, series[30].close, 0, series[30].close);
w.draw();
```
Unclear from the header: clicking/dragging moves the line to the clicked
price (the bar component of the move has no visible effect); arrow-key
Left/Right therefore also has no visible effect on this widget.
## StockVerticalLine
Draws a full-height vertical line at one bar index, labelled
`Bar <n>` at the top.
API: `set_anchors(bar, price, bar, price)` — only the first anchor's bar
is drawn; the prices are stored but ignored.
Example:
```cpp
StockVerticalLine w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(30, series[30].close, 30, series[30].close);
w.draw();
```
Unclear from the header: the line is drawn at the centre of the bar's
slot; Up/Down arrow keys (price shift) have no visible effect here.
## StockRectangle
Draws a rectangle between two anchors (bar/price corners), pale-blue
fill with a strong-colour outline, plus filled circles at both corners.
API: `set_anchors(b1, p1, b2, p2)` — opposite corners; order does not
matter, the min/max of each axis is used.
Example:
```cpp
StockRectangle w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(10, series[10].low, 30, series[30].high);
w.draw();
```
Unclear from the header: the fill is a fixed pale blue, not the
annotation colour set by `set_color()` (only the outline follows it);
a zero-width or zero-height rectangle still draws a 1 px line.
## StockEllipse
Draws an ellipse inscribed in the rectangle between two anchors,
pale-blue fill with a strong-colour outline.
API: `set_anchors(b1, p1, b2, p2)` — opposite corners of the bounding
box; order does not matter.
Example:
```cpp
StockEllipse w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(10, series[10].low, 30, series[30].high);
w.draw();
```
Unclear from the header: same fixed pale-blue fill as StockRectangle;
the ellipse is axis-aligned only (no rotation parameter).
## StockFibRetracement
Draws horizontal Fibonacci retracement levels between a high and a low
anchor: 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%, each labelled at the
right edge. Alternating levels are dashed.
API: `set_anchors(b_high, high, b_low, low)`; `set_high_low(hi, lo)`;
`level_count()` (= 7); `level_ratio(int i)`; `level_price(int i)`.
Example:
```cpp
StockFibRetracement w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
double hi = series[0].high, lo = series[0].low; for (auto& b : series) { hi = std::max(hi, b.high); lo = std::min(lo, b.low); }
w.set_high_low(hi, lo); // hi/lo from the series range
w.draw();
```
Unclear from the header: high/low are normalised (swapped if inverted),
so the anchor order does not matter; the anchors' bar indices do not
affect where the levels are drawn (levels span the full plot width);
labels can run past the right plot edge on narrow windows.
## StockFibExtension
Draws horizontal Fibonacci extension levels beyond the anchor range:
0%, 38.2%, 61.8%, 100%, 127.2%, 161.8%, each labelled at the right edge.
API: `set_anchors(b_high, high, b_low, low)`; `set_high_low(hi, lo)`;
`level_count()` (= 6); `level_ratio(int i)`; `level_price(int i)`.
`level_price(i)` returns `low + (high - low) * ratio`, so 127.2% and
161.8% lie beyond the high.
Example:
```cpp
StockFibExtension w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
double hi = series[0].high, lo = series[0].low; for (auto& b : series) { hi = std::max(hi, b.high); lo = std::min(lo, b.low); }
w.set_high_low(hi, lo);
w.draw();
```
Unclear from the header: same normalisation and full-width behaviour as
StockFibRetracement; the 0%/38.2%/61.8%/100% levels duplicate the
retracement levels by design (they are the shared part of the scale).
## StockTextAnnotation
Draws a text note in a pale-yellow box with a strong-colour border,
anchored at one bar/price, with a small dot at the anchor point.
API: `set_anchors(bar, price, bar, price)`; `set_text(std::string)` /
`set_annotation_text(std::string)` / `annotation_text()`.
Example:
```cpp
StockTextAnnotation w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(20, series[20].close, 20, series[20].close);
w.set_text("Breakout here");
w.draw();
```
Unclear from the header: `set_text()` and `set_annotation_text()` are
aliases (both set the same text); long text is not wrapped and the box
is not clipped to the plot, so it can overflow the right edge; the box
is drawn to the right and slightly above the anchor.
## StockArrow
Draws a thick arrow from the first anchor to the second, with a filled
triangular arrowhead at the tip.
API: `set_anchors(b1, p1, b2, p2)` — tail and tip.
Example:
```cpp
StockArrow w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(10, series[10].low, 25, series[25].high);
w.draw();
```
Unclear from the header: the arrowhead size is fixed (14 px) regardless
of arrow length or zoom; a zero-length arrow (same anchor twice) draws
only the head.
## StockParallelChannel
Draws three parallel lines: a solid line through the first two anchors,
a dashed mid-line halfway between them, and a second solid line offset
from the first by the third anchor's price.
API: `set_anchors(b1, p1, b2, p2)` plus `set_anchor(2, bar, offset_price)`.
Example:
```cpp
StockParallelChannel w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(5, series[5].close, 25, series[25].close);
w.set_anchor(2, 25, series[5].close + 5.0);
w.draw();
```
Unclear from the header: the offset is interpreted as the parallel
line's price at the *first* anchor's bar (the line shares the slope of
the first two anchors); the third anchor's bar index is stored but does
not move the line. All three lines extend across the full plot width.
## StockPitchfork
Draws an Andrews pitchfork from three pivots: a solid median line from
the first pivot through the midpoint of pivots 2 and 3, extended to the
right edge, plus dashed parallel lines through pivots 2 and 3 with the
same slope.
API: `set_anchors3(b1, p1, b2, p2, b3, p3)` or
`set_pivots(b1, p1, b2, p2, b3, p3)` (aliases).
Example:
```cpp
StockPitchfork w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_pivots(5, series[5].low, 15, series[15].high, 25, series[25].low);
w.draw();
```
Unclear from the header: the lines are only drawn from each pivot to
the right edge (no extension to the left); if the midpoint of pivots 2
and 3 shares the first pivot's bar, the slope division is guarded and
the median line is drawn flat.
## StockBrush
Draws a freehand highlight path through stored (bar, price) points: a
thick polyline with a dot at each point, plus a `Brush: <n> points`
label. Clicking adds a point; dragging extends the path.
API: `add_point(int bar, double price)`; `clear_points()`;
`point_count()`.
Example:
```cpp
StockBrush w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.clear_points();
for (int i = 8; i <= 28; i += 2) w.add_point(i, series[i].close);
w.draw();
```
Unclear from the header: there is no erase/undo — points can only be
removed all at once with `clear_points()`; `set_series()` reseeds a
default path (bars 8–20 step 2); the two anchors are unused by the
drawing (arrow keys move them with no visible effect); a single point
draws only its dot, no line.
## StockPriceLabel
Draws a dashed connector from an anchor bar/price to the right edge,
ending in a filled tag showing the price.
API: `set_anchors(bar, price, bar, price)` — only the first anchor is used.
Example:
```cpp
StockPriceLabel w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(59, series[59].close, 59, series[59].close);
w.draw();
```
Unclear from the header: the tag is drawn over the plot's right margin
and can overlap the axis area on narrow windows; the tag text is the
price only (no symbol or bar label).
## StockMeasureTool
Draws a line between two anchors with a right-angle projection, and a
box showing the measurement: `dP <diff> (<pct>%) bars <n>`.
API: `set_anchors(b1, p1, b2, p2)`; `price_diff()`; `bar_diff()`;
`pct_diff()` (percent of the first anchor's price).
Example:
```cpp
StockMeasureTool w(display, screen, window, gc, &styles, 20, 20, 720, 480);
auto series = xframe::make_seeded_series(60, 42);
w.set_series(series);
w.set_anchors(10, series[10].close, 30, series[30].close);
w.draw();
// w.price_diff(), w.bar_diff(), w.pct_diff()
```
Unclear from the header: differences are signed (reversed anchors give
negative values); `pct_diff()` returns 0 if the first anchor's price is
0; the info box is placed above the higher anchor and clamped into the
plot, so it can overlap the line on short measurements.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+249
View File
@@ -0,0 +1,249 @@
# Stock Market widgets — OHLC / price charts
Eight widgets in `widgets/components/`, one per directory. Each directory
contains exactly `<Name>.h`, `main_<Name>.cpp`, `CMakeLists.txt`, and
`core/xframe_core.h` (byte-identical to `widgets/core/xframe_core.h`).
Attribution: XFrame.
All eight render from a shared `xframe::OHLCVSeries`
(`widgets/components/StockData.h`, included as `#include "../StockData.h"`).
Demos use `xframe::make_seeded_series(250)` — deterministic synthetic data,
no network, no live market data. Verified: same `(n, seed)` gives identical
bars, a different seed gives different bars, every bar satisfies
`high >= max(open, close)` and `low <= min(open, close)`.
## Common API (all eight)
Constructor (all widgets):
```cpp
Name(Display* display, int screen, Window window, GC gc,
SStyle_Manager* styles, int x, int y, int width, int height,
const xframe::OHLCVSeries& series = xframe::make_seeded_series(250));
```
Key methods, identical on every widget:
- `void set_series(const xframe::OHLCVSeries& s)` — replace the data; resets
the view to show all items. Derived data (Heikin-Ashi candles, Renko
bricks, BaselineChart's default baseline) is rebuilt here.
- `const xframe::OHLCVSeries& series() const` — the raw series.
- `int item_count()` — number of plotted items (bars for most widgets;
Heikin-Ashi candles for StockHeikinAshi; bricks for StockRenko).
- `void draw()` — axes + 1/2/5 grid, series, index axis, title with last
close, crosshair + readout when the mouse has moved over the plot.
- `bool on_button_press(int x, int y, unsigned int button)` — button 1 starts
a drag-pan and focuses the widget; wheel (4/5) zooms around the cursor;
any press also moves the crosshair to the click point.
- `bool on_button_release(int x, int y, unsigned int button)`,
`bool on_motion(int x, int y)` — crosshair follows the mouse; drag pans.
- `bool on_key(KeySym key, const char* str)` — only when focused:
Left/Right pan 10% of the view, `+`/`-` zoom, `Home`/`r` reset view.
- `void set_y_range(double lo, double hi)` / `void set_auto_y(bool on)` —
manual Y range or auto range (default) with 6% padding.
- `void set_bounds(...)`, `width()`, `height()`, `contains(x, y)`,
`set_visible`/`get_visible`, `set_enabled`/`get_enabled`,
`set_style_name`, `set_text`/`get_text`, `style()`.
- `double get_view_first()`, `double get_view_count()`,
`void reset_view()`, `void zoom_at(double factor, double frac_x)`.
Working example (same shape for every widget; here the candlestick one):
```cpp
#include "StockCandlestickChart.h"
StockCandlestickChart w(display, screen, window, gc, &styles,
20, 20, 720, 480,
xframe::make_seeded_series(250));
w.draw();
// ... event loop forwards ButtonPress/ButtonRelease/MotionNotify/KeyPress
// to w.on_button_press / on_button_release / on_motion / on_key,
// redrawing after any handled event, as in main_StockCandlestickChart.cpp.
```
Build one widget (from the repo root, on the server):
```
cmake -S widgets/components/StockCandlestickChart -B /tmp/b-candle -DCMAKE_CXX_FLAGS="-Wall -Wextra"
cmake --build /tmp/b-candle # 0 warnings
```
Tests: `python3 widgets/tests/test_stock_ohlc.py` builds all eight with
`-Wall -Wextra`, checks StockData.h determinism with a standalone compile,
then runs each demo under Xvfb `:91` and checks build / draw (non-blank
screenshot) / hover (crosshair) / click / key (process survives) /
clean exit via `WM_DELETE_WINDOW`. Result: 8/8 widgets fully PASS,
0 warnings, driver exit 0.
## StockCandlestickChart
Draws one filled candle per bar: vertical wick from low to high, body from
open to close, green when `close >= open`, red otherwise. Body width is 60%
of the per-item slot. Y range from visible lows/highs.
Unclear from the header: a doji (`open == close`) is drawn green (the
`close >= open` branch) with a 1-pixel-tall body; the header does not say
dojis should be special-cased, so they are not.
## StockOHLCBarChart
Classic OHLC bar per bar: vertical high–low line, left tick at the open,
right tick at the close, half-slot-wide ticks (35% of the item slot).
Colour is green when `close >= open`, red otherwise. Y range from visible
lows/highs.
Unclear from the header: tick length is a fixed fraction of the slot width,
so ticks shrink as more bars are shown; there is no minimum tick length
beyond 1 pixel.
## StockLineChart
Closes joined by a single 2-pixel polyline (blue). Y range from visible
closes only, so wicks do not affect the scale. Crosshair readout shows the
close at the hovered index.
Unclear from the header: with a single bar there is no line (needs 2+
points); the widget then shows only axes, grid and title.
## StockAreaChart
Closes as a line (as in StockLineChart) with the area between the line and
the bottom of the plot filled light blue. Y range from visible closes only.
Unclear from the header: the fill goes to the plot bottom, not to zero or to
the Y minimum — on a zoomed view the filled region is bounded by the visible
plot rectangle.
## StockHeikinAshi
Computes Heikin-Ashi candles from the series and draws them as candles
(same rendering as StockCandlestickChart):
- `ha_close = (open + high + low + close) / 4`
- `ha_open = (prev ha_open + prev ha_close) / 2`; for the first bar,
`ha_open = (open + close) / 2`
- `ha_high = max(high, ha_open, ha_close)`,
`ha_low = min(low, ha_open, ha_close)`
Extra API: `const xframe::OHLCVSeries& heikin_ashi_series() const`,
`int heikin_ashi_count()`. The derived candles are rebuilt by the
constructor and by `set_series()`. Y range, item count and crosshair readout
all use the Heikin-Ashi candles, not the raw bars.
Unclear from the header: the first-bar `ha_open` seed `(open + close) / 2`
is a convention choice, not something the header derives — other
implementations seed it with the raw open. The volume and timestamp of each
derived candle are copied from the raw bar.
## StockRenko
Builds Renko bricks from closes. Extra API:
- `void set_brick_size(double s)` — brick height in price units (ignored
when `s <= 0`); rebuilds the bricks and resets the view. Default `1.0`.
- `double brick_size() const`, `int brick_count()`.
Bricks: the anchor is `floor(first close / brick_size) * brick_size`; each
time the close crosses the running brick boundary a brick is added (green
for up, red for down), and the anchor advances one brick. Bricks are drawn
as filled rectangles 80% of the item slot, with a thin outline. Y range,
item count and the x axis all use bricks, so the x axis is brick index, not
time — consecutive bricks need not be consecutive days.
Unclear from the header: the first bar never produces a brick (it only sets
the anchor), and a large single-bar jump produces several bricks at once;
there is no cap on bricks per bar. With the default brick size 1.0 and the
seeded 250-bar series the brick count is in the tens.
## StockHollowCandles
Candles as in StockCandlestickChart, except the body is hollow
(outline only) when `close > open` and filled when `close <= open`.
The wick is always drawn. Colour is green for hollow (up) bodies, red for
filled (down) bodies.
Unclear from the header: a doji (`open == close`) counts as down/filled
(the `close > open` test is strict); the header does not discuss dojis.
## StockBaselineChart
Closes as a line with the area between the line and a baseline value filled
green where the line is above the baseline and red where it is below; the
baseline itself is drawn as a grey horizontal line. Extra API:
`void set_baseline(double b)`, `double baseline() const`. Default baseline
is the first bar's close (or 100.0 for an empty series); `set_series()`
resets it to the new series' first close. Y range includes the baseline, so
the baseline line is always visible.
Unclear from the header: the fill is computed per segment and split at
baseline crossings, so a segment that crosses the baseline is filled with
two triangles; the exact split point is linear interpolation between the
two closes. No smoothing is applied.
## Per-widget examples
One working example per widget (same shape as the shared example
above, with the widget's own class name).
### StockCandlestickChart
- **Example:**
```cpp
StockCandlestickChart w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
### StockOHLCBarChart
- **Example:**
```cpp
StockOHLCBarChart w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
### StockLineChart
- **Example:**
```cpp
StockLineChart w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
### StockAreaChart
- **Example:**
```cpp
StockAreaChart w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
### StockHeikinAshi
- **Example:**
```cpp
StockHeikinAshi w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
### StockRenko
- **Example:**
```cpp
StockRenko w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
### StockHollowCandles
- **Example:**
```cpp
StockHollowCandles w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
### StockBaselineChart
- **Example:**
```cpp
StockBaselineChart w(display, screen, window, gc, &styles, 20, 20, 720, 480, xframe::make_seeded_series(250));
w.draw();
```
+5486
View File
File diff suppressed because it is too large. Load diff
+2720
View File
File diff suppressed because it is too large. Load diff
+1723
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Executable
+77
View File
@@ -0,0 +1,77 @@
#!/bin/sh
# ./ide -- start the combined IDE.
# Starts the designer, the XFrame palette and the XFrame layout window as
# separate top-level windows on one X display:
# LightGUI -- C++/GTK -- <name> designer canvas + property editor
# LightGUI -- Widgets designer palette (36 tight buttons)
# LightGUI -- Code code inspector (code + auto variables)
# LightGUI Palette - 547 widgets XFrame selector palette
# LightGUI Layout XFrame live layout surface
# The debugger opens from the designer (Debug -> Open Debugger...).
#
# Usage: ./ide [--build] [--no-xframe] [--help]
# --build rebuild both halves first
# --no-xframe designer only (skip the XFrame palette + layout windows)
# Requires an X display; under Xvfb: Xvfb :97 -screen 0 1920x1080x24 &
# DISPLAY=:97 ./ide
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
BUILD=0
XFRAME=1
for a in "$@"; do
case "$a" in
--build) BUILD=1 ;;
--no-xframe|--designer-only) XFRAME=0 ;;
--help|-h)
echo "Usage: $0 [--build] [--no-xframe] [--help]"
echo "Starts the combined IDE: LightGUI + XFrame palette + layout,"
echo "each as its own top-level window. Needs an X display."
exit 0 ;;
*) echo "ide: unknown option: $a" >&2; exit 2 ;;
esac
done
if [ -z "$DISPLAY" ]; then
echo "ide: no X display (DISPLAY is unset)." >&2
echo "ide: run under Xvfb, e.g. Xvfb :97 -screen 0 1920x1080x24 &" >&2
echo "ide: DISPLAY=:97 ./ide" >&2
exit 1
fi
if [ "$BUILD" = 1 ] || [ ! -x "$ROOT/lightgui" ]; then
echo "ide: building designer..."
make -C "$ROOT" || exit 1
fi
if [ "$XFRAME" = 1 ]; then
if [ "$BUILD" = 1 ] || [ ! -x "$ROOT/widgets/build/palette/lightgui_palette" ] \
|| [ ! -x "$ROOT/widgets/build/layout/lightgui_layout" ]; then
echo "ide: building widgets..."
cmake -S "$ROOT/widgets" -B "$ROOT/widgets/build" || exit 1
cmake --build "$ROOT/widgets/build" -j"$(nproc 2>/dev/null || echo 4)" || exit 1
fi
fi
export LIGHTGUI_ICONS="$ROOT/widgets/icons"
PAL_PID=""
LAY_PID=""
cleanup() {
[ -n "$PAL_PID" ] && kill "$PAL_PID" 2>/dev/null
[ -n "$LAY_PID" ] && kill "$LAY_PID" 2>/dev/null
}
trap cleanup EXIT INT TERM
if [ "$XFRAME" = 1 ]; then
(cd "$ROOT" && ./widgets/build/palette/lightgui_palette) &
PAL_PID=$!
(cd "$ROOT" && ./widgets/build/layout/lightgui_layout) &
LAY_PID=$!
fi
(cd "$ROOT" && ./lightgui) &
DESIGNER_PID=$!
wait "$DESIGNER_PID"
STATUS=$?
cleanup
trap - EXIT INT TERM
exit "$STATUS"
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Loaded 100 of 3996 files, more files were not shown because too many files have changed in this diff. Show more