Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84526f898e | ||
|
|
a95edac82c | ||
|
|
8f57af7b4f | ||
|
|
8eaa6aa832 | ||
|
|
fd95c48492 | ||
|
|
4edf8f86bd | ||
|
|
2b3d82a726 | ||
|
|
a84a8e4e41 | ||
|
|
560d0aac2f | ||
|
|
d117e77915 |
No files matched your search
@@ -1,25 +0,0 @@
|
||||
# Network Monitor - monitor (C / XFrame)
|
||||
#
|
||||
# Build: make
|
||||
# Run: ./network-monitor (quit: q / Escape / window close)
|
||||
# Clean: make clean
|
||||
|
||||
CXX ?= g++
|
||||
CXXFLAGS ?= -std=c++17 -O2 -Wall
|
||||
|
||||
ROOT := ../../..
|
||||
INCLUDES := -I$(ROOT)/widgets/components/XNetGraph \
|
||||
-I$(ROOT)/widgets/components/XHistoryGraph \
|
||||
-I$(ROOT)/widgets/components/XUsageBar \
|
||||
-I$(ROOT)/widgets/components/XSysBox
|
||||
LIBS := $(shell pkg-config --libs x11)
|
||||
|
||||
all: network-monitor
|
||||
|
||||
network-monitor: main.cpp
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ main.cpp $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f network-monitor
|
||||
|
||||
.PHONY: all clean
|
||||
@@ -1,45 +0,0 @@
|
||||
# Network Monitor — monitor (C)
|
||||
|
||||
A live network monitor in one 1024x768 window, built only from the
|
||||
LightGUI XFrame monitor widgets (Stage 2 of the btop-widget project).
|
||||
|
||||
## What it shows
|
||||
|
||||
Live traffic for the main interface (`enp3s0` on hot_dallas, otherwise
|
||||
the first non-loopback interface with traffic), read from
|
||||
`/proc/net/dev` and differenced every 500 ms:
|
||||
|
||||
- **XNetGraph** (top) — up/down graph in bytes/s, current rates plus
|
||||
session totals in the legend.
|
||||
- **XSysBox** (middle, x2) — Download / Upload big-number boxes in
|
||||
KiB/s, each with its own history sparkline and usage bar. The range
|
||||
tracks the session peak (x1.15, floor 100 KiB/s).
|
||||
- **XHistoryGraph** — down/up rate history in KiB/s, 60 s window,
|
||||
current / min / max / average per series.
|
||||
- **XUsageBar** (bottom) — total throughput as a percentage of the
|
||||
link speed (from `/sys/class/net/<iface>/speed`, 1 Gb/s fallback).
|
||||
|
||||
## Live data, not demo data
|
||||
|
||||
The widgets preload seeded demo series. The app flushes them at
|
||||
startup: the first measured rate (two `/proc/net/dev` reads 500 ms
|
||||
apart) is pushed 120x into XNetGraph (which has no clear API) and its
|
||||
totals reset, the history graph is cleared and re-seeded with down/up
|
||||
series, and each XSysBox gets 60 live `set_value()` calls. Everything
|
||||
on screen after that is measured traffic.
|
||||
|
||||
## Build and run
|
||||
|
||||
```sh
|
||||
make # builds ./network-monitor
|
||||
./network-monitor # quit with q, Escape, or window close
|
||||
```
|
||||
|
||||
## Source
|
||||
|
||||
- C: `examples/monitor/network-monitor/main.cpp` in
|
||||
[lightgui](https://github.com/cnmcdee/lightgui)
|
||||
- Rust: `crates/xframe-demo/examples/monitor_network_monitor/main.rs` in
|
||||
[lightgui_rust](https://github.com/cnmcdee/lightgui_rust)
|
||||
- Python: `examples/monitor_network_monitor/main.py` in
|
||||
[lightgui_python](https://github.com/cnmcdee/lightgui_python)
|
||||
@@ -1,311 +0,0 @@
|
||||
// Network Monitor - monitor (Stage 2, btop-widget project).
|
||||
//
|
||||
// One 1024x768 window showing LIVE traffic for the main interface
|
||||
// (enp3s0 on hot_dallas, else the first non-loopback interface with
|
||||
// traffic), read from /proc/net/dev and differenced every 500 ms:
|
||||
//
|
||||
// XNetGraph up/down graph, current rates + session totals
|
||||
// XSysBox x2 Download / Upload big-number boxes (KiB/s + history)
|
||||
// XHistoryGraph rate history, down/up in KiB/s (60 s window)
|
||||
// XUsageBar total throughput as % of the link speed
|
||||
//
|
||||
// Widgets preload seeded demo data; the app flushes it at startup
|
||||
// (XNetGraph has no clear API, so the first measured rate is pushed
|
||||
// 120x to fill its window, then reset_totals(); XHistoryGraph is
|
||||
// cleared and re-seeded with down/up series; each XSysBox gets 60
|
||||
// live set_value() calls). Everything on screen after that is live.
|
||||
//
|
||||
// Build: make (see Makefile) Run: ./network-monitor
|
||||
// Quit: q / Escape / window close.
|
||||
|
||||
#include "XNetGraph.h"
|
||||
#include "XHistoryGraph.h"
|
||||
#include "XUsageBar.h"
|
||||
#include "XSysBox.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
const char* kTitle = "Network Monitor - monitor";
|
||||
const int kWinW = 1024;
|
||||
const int kWinH = 768;
|
||||
|
||||
// Read rx/tx byte counters for iface from /proc/net/dev.
|
||||
bool read_counters(const std::string& iface, unsigned long long& rx, unsigned long long& tx)
|
||||
{
|
||||
FILE* f = std::fopen("/proc/net/dev", "r");
|
||||
if (!f) return false;
|
||||
char line[512];
|
||||
bool ok = false;
|
||||
while (std::fgets(line, sizeof(line), f))
|
||||
{
|
||||
char* colon = std::strchr(line, ':');
|
||||
if (!colon) continue;
|
||||
std::string name(line, colon);
|
||||
// Trim spaces.
|
||||
size_t b = name.find_first_not_of(" \t");
|
||||
size_t e = name.find_last_not_of(" \t");
|
||||
if (b == std::string::npos) continue;
|
||||
name = name.substr(b, e - b + 1);
|
||||
if (name != iface) continue;
|
||||
unsigned long long v[16] = {0};
|
||||
int n = std::sscanf(colon + 1, "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
|
||||
&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7],
|
||||
&v[8], &v[9], &v[10], &v[11], &v[12], &v[13], &v[14], &v[15]);
|
||||
if (n >= 9)
|
||||
{
|
||||
rx = v[0];
|
||||
tx = v[8];
|
||||
ok = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
std::fclose(f);
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool iface_exists(const std::string& iface)
|
||||
{
|
||||
unsigned long long rx = 0, tx = 0;
|
||||
return read_counters(iface, rx, tx);
|
||||
}
|
||||
|
||||
// Prefer enp3s0; else the first non-loopback interface with traffic.
|
||||
std::string pick_iface()
|
||||
{
|
||||
if (iface_exists("enp3s0")) return "enp3s0";
|
||||
FILE* f = std::fopen("/proc/net/dev", "r");
|
||||
if (!f) return "enp3s0";
|
||||
char line[512];
|
||||
std::string fallback = "enp3s0";
|
||||
while (std::fgets(line, sizeof(line), f))
|
||||
{
|
||||
char* colon = std::strchr(line, ':');
|
||||
if (!colon) continue;
|
||||
std::string name(line, colon);
|
||||
size_t b = name.find_first_not_of(" \t");
|
||||
size_t e = name.find_last_not_of(" \t");
|
||||
if (b == std::string::npos) continue;
|
||||
name = name.substr(b, e - b + 1);
|
||||
if (name == "lo") continue;
|
||||
unsigned long long v[16] = {0};
|
||||
std::sscanf(colon + 1, "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
|
||||
&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7],
|
||||
&v[8], &v[9], &v[10], &v[11], &v[12], &v[13], &v[14], &v[15]);
|
||||
if (fallback == "enp3s0") fallback = name;
|
||||
if (v[0] > 0 || v[8] > 0) { std::fclose(f); return name; }
|
||||
}
|
||||
std::fclose(f);
|
||||
return fallback;
|
||||
}
|
||||
|
||||
// Link speed in bits/s from /sys/class/net/<iface>/speed (Mbit/s);
|
||||
// unknown/unreadable -> assume 1 Gbit/s.
|
||||
double link_speed_bps(const std::string& iface)
|
||||
{
|
||||
std::string path = "/sys/class/net/" + iface + "/speed";
|
||||
FILE* f = std::fopen(path.c_str(), "r");
|
||||
if (!f) return 1e9;
|
||||
long mbps = 0;
|
||||
if (std::fscanf(f, "%ld", &mbps) != 1 || mbps <= 0) mbps = 1000;
|
||||
std::fclose(f);
|
||||
return (double)mbps * 1e6;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string iface = pick_iface();
|
||||
double link_bps = link_speed_bps(iface);
|
||||
|
||||
Display* display = XOpenDisplay(nullptr);
|
||||
if (!display) return 1;
|
||||
int screen = DefaultScreen(display);
|
||||
Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 100, 100,
|
||||
kWinW, kWinH, 1, BlackPixel(display, screen),
|
||||
WhitePixel(display, screen));
|
||||
XStoreName(display, window, kTitle);
|
||||
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.add_style_ex("dark", Srgb{45, 45, 48}, Srgb{20, 20, 22}, Srgb{200, 200, 200},
|
||||
Srgb{240, 240, 240}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
|
||||
styles.set_active_style_byName("default");
|
||||
|
||||
XNetGraph net(display, screen, window, gc, &styles, 12, 12, 1000, 300);
|
||||
net.set_text("Network - " + iface);
|
||||
XSysBox down_box(display, screen, window, gc, &styles, 12, 324, 492, 180);
|
||||
down_box.set_text("Download - " + iface);
|
||||
down_box.set_unit(" KiB/s");
|
||||
XSysBox up_box(display, screen, window, gc, &styles, 520, 324, 492, 180);
|
||||
up_box.set_text("Upload - " + iface);
|
||||
up_box.set_unit(" KiB/s");
|
||||
up_box.set_graph_color(Srgb{220, 80, 40});
|
||||
XHistoryGraph hist(display, screen, window, gc, &styles, 12, 516, 1000, 172);
|
||||
hist.set_text("Rate history (KiB/s)");
|
||||
XUsageBar usage(display, screen, window, gc, &styles, 12, 700, 1000, 44);
|
||||
{
|
||||
char buf[96];
|
||||
std::snprintf(buf, sizeof(buf), "Link use - %s (%.0f Gb/s)", iface.c_str(), link_bps / 1e9);
|
||||
usage.set_text(buf);
|
||||
}
|
||||
usage.set_max(100.0);
|
||||
|
||||
auto redraw = [&]() {
|
||||
XClearWindow(display, window);
|
||||
net.draw();
|
||||
down_box.draw();
|
||||
up_box.draw();
|
||||
hist.draw();
|
||||
usage.draw();
|
||||
XFlush(display);
|
||||
};
|
||||
|
||||
// First live rate (two reads 500 ms apart), then flush the widgets'
|
||||
// seeded demo data with it so the screen is live from the start.
|
||||
unsigned long long rx0 = 0, tx0 = 0, rx1 = 0, tx1 = 0;
|
||||
read_counters(iface, rx0, tx0);
|
||||
usleep(500000);
|
||||
read_counters(iface, rx1, tx1);
|
||||
double down_bps = (rx1 >= rx0) ? (double)(rx1 - rx0) / 0.5 : 0.0;
|
||||
double up_bps = (tx1 >= tx0) ? (double)(tx1 - tx0) / 0.5 : 0.0;
|
||||
double down_kb = down_bps / 1024.0;
|
||||
double up_kb = up_bps / 1024.0;
|
||||
double peak_down = std::max(100.0, down_kb * 1.15);
|
||||
double peak_up = std::max(100.0, up_kb * 1.15);
|
||||
|
||||
for (int i = 0; i < 120; ++i) net.push(down_bps, up_bps);
|
||||
net.reset_totals(); // totals restart at session start, not demo-inflated
|
||||
hist.clear_series();
|
||||
hist.add_series("Down KiB/s", Srgb{0, 170, 70});
|
||||
hist.add_series("Up KiB/s", Srgb{220, 80, 40});
|
||||
hist.push(0, down_kb);
|
||||
hist.push(1, up_kb);
|
||||
down_box.set_max(peak_down);
|
||||
up_box.set_max(peak_up);
|
||||
for (int i = 0; i < 60; ++i) { down_box.set_value(down_kb); up_box.set_value(up_kb); }
|
||||
usage.set_value(std::min(100.0, (down_bps + up_bps) / link_bps * 100.0));
|
||||
|
||||
unsigned long long prev_rx = rx1, prev_tx = tx1;
|
||||
auto prev_time = std::chrono::steady_clock::now();
|
||||
redraw();
|
||||
|
||||
int fd = ConnectionNumber(display);
|
||||
bool running = true;
|
||||
auto last_tick = std::chrono::steady_clock::now();
|
||||
while (running)
|
||||
{
|
||||
while (XPending(display))
|
||||
{
|
||||
XEvent event;
|
||||
XNextEvent(display, &event);
|
||||
bool handled = false;
|
||||
switch (event.type)
|
||||
{
|
||||
case Expose:
|
||||
handled = true;
|
||||
break;
|
||||
case ButtonPress:
|
||||
handled = net.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
down_box.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
up_box.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
hist.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
usage.on_button_press(event.xbutton.x, event.xbutton.y, event.xbutton.button);
|
||||
break;
|
||||
case ButtonRelease:
|
||||
handled = net.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
down_box.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
up_box.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
hist.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button) ||
|
||||
usage.on_button_release(event.xbutton.x, event.xbutton.y, event.xbutton.button);
|
||||
break;
|
||||
case MotionNotify:
|
||||
handled = net.on_motion(event.xmotion.x, event.xmotion.y) ||
|
||||
down_box.on_motion(event.xmotion.x, event.xmotion.y) ||
|
||||
up_box.on_motion(event.xmotion.x, event.xmotion.y) ||
|
||||
hist.on_motion(event.xmotion.x, event.xmotion.y) ||
|
||||
usage.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;
|
||||
if (key == XK_Escape || (n == 1 && (buffer[0] == 'q' || buffer[0] == 'Q')))
|
||||
running = false;
|
||||
handled = net.on_key(key, buffer) || down_box.on_key(key, buffer) ||
|
||||
up_box.on_key(key, buffer) || hist.on_key(key, buffer) ||
|
||||
usage.on_key(key, buffer);
|
||||
break;
|
||||
}
|
||||
case ClientMessage:
|
||||
if ((Atom)event.xclient.data.l[0] == deleteWindowMessage) running = false;
|
||||
break;
|
||||
}
|
||||
if (handled) redraw();
|
||||
if (!running) break;
|
||||
}
|
||||
if (!running) break;
|
||||
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
long elapsed_ms = (long)std::chrono::duration_cast<std::chrono::milliseconds>(now - last_tick).count();
|
||||
if (elapsed_ms < 500)
|
||||
{
|
||||
fd_set fds;
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fd, &fds);
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = (500 - elapsed_ms) * 1000;
|
||||
select(fd + 1, &fds, nullptr, nullptr, &tv);
|
||||
continue;
|
||||
}
|
||||
last_tick = now;
|
||||
|
||||
// Live tick: difference /proc/net/dev over the real elapsed time.
|
||||
unsigned long long rx = 0, tx = 0;
|
||||
if (!read_counters(iface, rx, tx)) continue;
|
||||
double dt = std::chrono::duration<double>(now - prev_time).count();
|
||||
prev_time = now;
|
||||
if (dt <= 0.0) continue;
|
||||
down_bps = (rx >= prev_rx) ? (double)(rx - prev_rx) / dt : 0.0;
|
||||
up_bps = (tx >= prev_tx) ? (double)(tx - prev_tx) / dt : 0.0;
|
||||
prev_rx = rx;
|
||||
prev_tx = tx;
|
||||
down_kb = down_bps / 1024.0;
|
||||
up_kb = up_bps / 1024.0;
|
||||
peak_down = std::max(peak_down, down_kb * 1.15);
|
||||
peak_up = std::max(peak_up, up_kb * 1.15);
|
||||
|
||||
net.push(down_bps, up_bps);
|
||||
hist.push(0, down_kb);
|
||||
hist.push(1, up_kb);
|
||||
down_box.set_max(peak_down);
|
||||
up_box.set_max(peak_up);
|
||||
down_box.set_value(down_kb);
|
||||
up_box.set_value(up_kb);
|
||||
usage.set_value(std::min(100.0, (down_bps + up_bps) / link_bps * 100.0));
|
||||
redraw();
|
||||
}
|
||||
|
||||
XCloseDisplay(display);
|
||||
return 0;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,13 @@
|
||||
CXX ?= g++
|
||||
CXXFLAGS ?= -std=c++17 -O2 -I../../../widgets/components -I../../../widgets
|
||||
LDFLAGS ?= -lX11
|
||||
|
||||
all: task-manager
|
||||
|
||||
task-manager: main.cpp
|
||||
$(CXX) $(CXXFLAGS) main.cpp $(LDFLAGS) -o task-manager
|
||||
|
||||
clean:
|
||||
rm -f task-manager
|
||||
|
||||
.PHONY: all clean
|
||||
@@ -0,0 +1,34 @@
|
||||
# Task Manager — monitor app
|
||||
|
||||
A Windows-style Task Manager clone in one 1024×768 window, built from
|
||||
the LightGUI XFrame monitor widgets (Stage 2 of the btop-widget
|
||||
project).
|
||||
|
||||
## Tabs
|
||||
|
||||
- **Processes** — `XProcessList`: live `/proc` table, columns Pid /
|
||||
Program / User / MemB / Cpu%, click a column header to sort (click
|
||||
again to reverse). Refreshes every 2 s.
|
||||
- **Performance** — `XHistoryGraph` (60 s CPU + memory), `XCoreGrid`
|
||||
(one mini history graph per CPU core), `XUsageBar` (Memory, Disk /,
|
||||
Swap), `XStackBar` (memory Used / Cached / Buffers / Free in GiB),
|
||||
`XNetGraph` (live download / upload bytes/s from `/proc/net/dev`).
|
||||
All graphs refresh every 500 ms from live `/proc` data
|
||||
(`/proc/stat`, `/proc/meminfo`, `/proc/net/dev`, `statvfs`).
|
||||
|
||||
## Build and run
|
||||
|
||||
```sh
|
||||
make
|
||||
DISPLAY=:112 ./task-manager
|
||||
```
|
||||
|
||||
Close the window (or press `q` / Esc) to quit.
|
||||
|
||||
## Widgets used
|
||||
|
||||
`TPageControl`, `XProcessList`, `XHistoryGraph`, `XCoreGrid`,
|
||||
`XUsageBar`, `XStackBar`, `XNetGraph` — all from the LightGUI
|
||||
registry. No raw X11 drawing for UI elements: the only raw X11 here
|
||||
is the window shell and the event loop, as in the per-widget demo
|
||||
mains.
|
||||
@@ -0,0 +1,420 @@
|
||||
// Task Manager - monitor app (Stage 2, btop-widget project).
|
||||
//
|
||||
// A Windows-style Task Manager clone in one 1024x768 window, tabbed
|
||||
// with TPageControl: a Processes tab (XProcessList, live /proc table
|
||||
// with sortable CPU/mem columns) and a Performance tab (XHistoryGraph
|
||||
// 60 s CPU+memory, XCoreGrid per-core grid, XUsageBar memory/disk/swap,
|
||||
// XStackBar memory breakdown, XNetGraph live network rates).
|
||||
//
|
||||
// Every visible UI element is a LightGUI registry widget; the only
|
||||
// raw X11 here is the window shell (create/map/select-input) and the
|
||||
// event loop, exactly like the per-widget demo mains.
|
||||
//
|
||||
// Build: make (g++ -std=c++17, -lX11)
|
||||
// Run: DISPLAY=:112 ./task-manager (or any X server)
|
||||
|
||||
#include "TPageControl/TPageControl.h"
|
||||
#include "XCoreGrid/XCoreGrid.h"
|
||||
#include "XHistoryGraph/XHistoryGraph.h"
|
||||
#include "XNetGraph/XNetGraph.h"
|
||||
#include "XProcessList/XProcessList.h"
|
||||
#include "XStackBar/XStackBar.h"
|
||||
#include "XUsageBar/XUsageBar.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sys/statvfs.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct CpuTimes
|
||||
{
|
||||
unsigned long long idle = 0;
|
||||
unsigned long long total = 0;
|
||||
};
|
||||
|
||||
bool read_cpu(CpuTimes& total, std::vector<CpuTimes>& cores)
|
||||
{
|
||||
std::ifstream in("/proc/stat");
|
||||
if (!in) return false;
|
||||
std::string line;
|
||||
cores.clear();
|
||||
bool got_total = false;
|
||||
while (std::getline(in, line))
|
||||
{
|
||||
if (line.compare(0, 3, "cpu") != 0) break;
|
||||
if (line.size() > 3 && line[3] != ' ' && (line[3] < '0' || line[3] > '9')) break;
|
||||
// Fields start after the first space: for "cpu" that is
|
||||
// offset 3, for "cpuN" offset 4 (the core index digit must
|
||||
// not be parsed as the first counter).
|
||||
size_t fields_at = line.find(' ');
|
||||
if (fields_at == std::string::npos) continue;
|
||||
unsigned long long nums[10] = {0};
|
||||
int n = std::sscanf(line.c_str() + fields_at, "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
|
||||
&nums[0], &nums[1], &nums[2], &nums[3], &nums[4],
|
||||
&nums[5], &nums[6], &nums[7], &nums[8], &nums[9]);
|
||||
if (n < 4) continue;
|
||||
CpuTimes t;
|
||||
t.idle = nums[3] + nums[4];
|
||||
for (int i = 0; i < n; ++i) t.total += nums[i];
|
||||
if (line[3] == ' ')
|
||||
{
|
||||
total = t;
|
||||
got_total = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cores.push_back(t);
|
||||
}
|
||||
}
|
||||
return got_total && !cores.empty();
|
||||
}
|
||||
|
||||
double cpu_pct(const CpuTimes& prev, const CpuTimes& cur)
|
||||
{
|
||||
unsigned long long d_total = cur.total - prev.total;
|
||||
unsigned long long d_idle = cur.idle - prev.idle;
|
||||
if (d_total == 0) return 0.0;
|
||||
double pct = 100.0 * (1.0 - (double)d_idle / (double)d_total);
|
||||
return pct < 0.0 ? 0.0 : (pct > 100.0 ? 100.0 : pct);
|
||||
}
|
||||
|
||||
struct MemInfo
|
||||
{
|
||||
double total_gb = 0.0;
|
||||
double free_gb = 0.0;
|
||||
double buffers_gb = 0.0;
|
||||
double cached_gb = 0.0;
|
||||
double used_gb = 0.0;
|
||||
double used_pct = 0.0;
|
||||
double swap_total_gb = 0.0;
|
||||
double swap_used_pct = 0.0;
|
||||
};
|
||||
|
||||
bool read_mem(MemInfo& m)
|
||||
{
|
||||
std::ifstream in("/proc/meminfo");
|
||||
if (!in) return false;
|
||||
unsigned long long total_kb = 0, free_kb = 0, buf_kb = 0, cache_kb = 0;
|
||||
unsigned long long swap_total_kb = 0, swap_free_kb = 0;
|
||||
std::string key;
|
||||
unsigned long long val = 0;
|
||||
while (in >> key >> val)
|
||||
{
|
||||
if (key == "MemTotal:") total_kb = val;
|
||||
else if (key == "MemFree:") free_kb = val;
|
||||
else if (key == "Buffers:") buf_kb = val;
|
||||
else if (key == "Cached:") cache_kb = val;
|
||||
else if (key == "SwapTotal:") swap_total_kb = val;
|
||||
else if (key == "SwapFree:") swap_free_kb = val;
|
||||
std::string skip;
|
||||
std::getline(in, skip);
|
||||
}
|
||||
if (total_kb == 0) return false;
|
||||
const double gb = 1024.0 * 1024.0;
|
||||
m.total_gb = total_kb / gb;
|
||||
m.free_gb = free_kb / gb;
|
||||
m.buffers_gb = buf_kb / gb;
|
||||
m.cached_gb = cache_kb / gb;
|
||||
m.used_gb = (total_kb - free_kb - buf_kb - cache_kb) / gb;
|
||||
if (m.used_gb < 0.0) m.used_gb = 0.0;
|
||||
m.used_pct = 100.0 * m.used_gb / m.total_gb;
|
||||
m.swap_total_gb = swap_total_kb / gb;
|
||||
m.swap_used_pct = swap_total_kb > 0
|
||||
? 100.0 * (double)(swap_total_kb - swap_free_kb) / (double)swap_total_kb
|
||||
: 0.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
struct NetBytes
|
||||
{
|
||||
unsigned long long rx = 0;
|
||||
unsigned long long tx = 0;
|
||||
};
|
||||
|
||||
bool read_net(NetBytes& n)
|
||||
{
|
||||
std::ifstream in("/proc/net/dev");
|
||||
if (!in) return false;
|
||||
std::string line;
|
||||
std::getline(in, line);
|
||||
std::getline(in, line);
|
||||
n.rx = 0;
|
||||
n.tx = 0;
|
||||
while (std::getline(in, line))
|
||||
{
|
||||
size_t colon = line.find(':');
|
||||
if (colon == std::string::npos) continue;
|
||||
std::string iface = line.substr(0, colon);
|
||||
size_t first = iface.find_first_not_of(" \t");
|
||||
if (first != std::string::npos) iface = iface.substr(first);
|
||||
if (iface == "lo") continue;
|
||||
unsigned long long rx = 0, tx = 0;
|
||||
// rx_bytes is field 1, tx_bytes field 9 after the colon.
|
||||
if (std::sscanf(line.c_str() + colon + 1, "%llu %*u %*u %*u %*u %*u %*u %*u %llu",
|
||||
&rx, &tx) == 2)
|
||||
{
|
||||
n.rx += rx;
|
||||
n.tx += tx;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
double disk_used_pct()
|
||||
{
|
||||
struct statvfs v;
|
||||
if (statvfs("/", &v) != 0 || v.f_blocks == 0) return 0.0;
|
||||
return 100.0 * (double)(v.f_blocks - v.f_bfree) / (double)v.f_blocks;
|
||||
}
|
||||
|
||||
long now_ms()
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return (long)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
{
|
||||
Display* display = XOpenDisplay(nullptr);
|
||||
if (!display) return 1;
|
||||
int screen = DefaultScreen(display);
|
||||
Window window = XCreateSimpleWindow(display, RootWindow(display, screen),
|
||||
100, 100, 1024, 768, 1,
|
||||
BlackPixel(display, screen),
|
||||
WhitePixel(display, screen));
|
||||
XStoreName(display, window, "Task Manager - monitor");
|
||||
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.add_style_ex("dark", Srgb{45, 45, 48}, Srgb{20, 20, 22},
|
||||
Srgb{200, 200, 200}, Srgb{240, 240, 240}, 6, 1,
|
||||
"-misc-fixed-medium-r-normal--13-*");
|
||||
styles.set_active_style_byName("default");
|
||||
|
||||
// Tabs first: the page widgets are drawn after it, over its
|
||||
// centred "Page: ..." placeholder label.
|
||||
TPageControl tabs(display, screen, window, gc, &styles, 8, 8, 1008, 752);
|
||||
// The constructor seeds TabSheet1..3; drop them (remove_page keeps
|
||||
// at least one page, so remove two, add ours, then remove the last).
|
||||
tabs.remove_page(2);
|
||||
tabs.remove_page(1);
|
||||
tabs.add_page("Processes");
|
||||
tabs.add_page("Performance");
|
||||
tabs.remove_page(0);
|
||||
|
||||
// Processes page (page body is 11,35 - 1013,757).
|
||||
XProcessList proclist(display, screen, window, gc, &styles, 14, 38, 996, 712);
|
||||
proclist.set_max_rows(40);
|
||||
|
||||
// Performance page.
|
||||
XHistoryGraph hist(display, screen, window, gc, &styles, 14, 38, 630, 300);
|
||||
hist.set_text("CPU + Memory (60 s)");
|
||||
hist.clear_series();
|
||||
hist.add_series("CPU", Srgb{0, 170, 70});
|
||||
hist.add_series("MEM", Srgb{0, 100, 200});
|
||||
hist.set_y_range(0.0, 100.0);
|
||||
hist.set_window_seconds(60);
|
||||
|
||||
XCoreGrid cores(display, screen, window, gc, &styles, 652, 38, 354, 300);
|
||||
cores.set_text("CPU cores");
|
||||
|
||||
XUsageBar membar(display, screen, window, gc, &styles, 14, 346, 640, 34);
|
||||
membar.set_text("Memory");
|
||||
XStackBar memstack(display, screen, window, gc, &styles, 14, 388, 640, 60);
|
||||
memstack.set_text("Memory");
|
||||
memstack.clear_segments();
|
||||
memstack.add_segment("Used", 0.0, Srgb{0, 150, 60});
|
||||
memstack.add_segment("Cached", 0.0, Srgb{220, 180, 0});
|
||||
memstack.add_segment("Buffers", 0.0, Srgb{0, 120, 200});
|
||||
memstack.add_segment("Free", 0.0, Srgb{200, 200, 200});
|
||||
|
||||
XUsageBar diskbar(display, screen, window, gc, &styles, 662, 346, 344, 34);
|
||||
diskbar.set_text("Disk /");
|
||||
XUsageBar swapbar(display, screen, window, gc, &styles, 662, 388, 344, 34);
|
||||
swapbar.set_text("Swap");
|
||||
|
||||
XNetGraph net(display, screen, window, gc, &styles, 14, 456, 992, 294);
|
||||
net.set_text("Network");
|
||||
|
||||
// clear=true wipes the window first (tick + tab switch, so the old
|
||||
// page leaves no stale pixels in the gaps); Expose and sort clicks
|
||||
// repaint only, because XClearWindow itself generates the Expose
|
||||
// that would otherwise retrigger a clear forever.
|
||||
auto redraw = [&](bool clear) {
|
||||
if (clear) XClearWindow(display, window);
|
||||
tabs.draw();
|
||||
if (tabs.get_active_page() == 0)
|
||||
{
|
||||
proclist.draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
hist.draw();
|
||||
cores.draw();
|
||||
membar.draw();
|
||||
memstack.draw();
|
||||
diskbar.draw();
|
||||
swapbar.draw();
|
||||
net.draw();
|
||||
}
|
||||
XFlush(display);
|
||||
};
|
||||
|
||||
// Prime live data: two /proc/stat samples 100 ms apart give the
|
||||
// first real CPU/net rates; the history widgets are then filled
|
||||
// with that live value so no seeded demo data shows.
|
||||
CpuTimes prev_total, cur_total;
|
||||
std::vector<CpuTimes> prev_cores, cur_cores;
|
||||
read_cpu(prev_total, prev_cores);
|
||||
NetBytes prev_net, cur_net;
|
||||
read_net(prev_net);
|
||||
usleep(100000);
|
||||
read_cpu(cur_total, cur_cores);
|
||||
read_net(cur_net);
|
||||
int ncores = (int)cur_cores.size();
|
||||
cores.set_core_count(ncores);
|
||||
std::vector<double> per_core(ncores, 0.0);
|
||||
for (int i = 0; i < ncores; ++i)
|
||||
per_core[i] = cpu_pct(prev_cores[i], cur_cores[i]);
|
||||
double cpu0 = cpu_pct(prev_total, cur_total);
|
||||
MemInfo mem;
|
||||
read_mem(mem);
|
||||
hist.push_all(std::vector<double>{cpu0, mem.used_pct});
|
||||
for (int i = 0; i < 60; ++i) cores.push_all(per_core);
|
||||
double down0 = (double)(cur_net.rx - prev_net.rx) * 10.0;
|
||||
double up0 = (double)(cur_net.tx - prev_net.tx) * 10.0;
|
||||
for (int i = 0; i < 120; ++i) net.push(down0, up0);
|
||||
membar.set_value(mem.used_pct);
|
||||
memstack.set_segment(0, mem.used_gb);
|
||||
memstack.set_segment(1, mem.cached_gb);
|
||||
memstack.set_segment(2, mem.buffers_gb);
|
||||
memstack.set_segment(3, mem.free_gb);
|
||||
diskbar.set_value(disk_used_pct());
|
||||
swapbar.set_value(mem.swap_used_pct);
|
||||
prev_total = cur_total;
|
||||
prev_cores = cur_cores;
|
||||
prev_net = cur_net;
|
||||
|
||||
redraw(true);
|
||||
bool running = true;
|
||||
long last_poll_ms = now_ms();
|
||||
long last_proc_ms = 0;
|
||||
int tick = 0;
|
||||
int last_page = tabs.get_active_page();
|
||||
while (running)
|
||||
{
|
||||
while (XPending(display) > 0)
|
||||
{
|
||||
XEvent event;
|
||||
XNextEvent(display, &event);
|
||||
bool handled = false;
|
||||
bool clear = false;
|
||||
switch (event.type)
|
||||
{
|
||||
case Expose:
|
||||
handled = true;
|
||||
break;
|
||||
case ButtonPress:
|
||||
handled = tabs.on_button_press(event.xbutton.x, event.xbutton.y,
|
||||
event.xbutton.button);
|
||||
if (handled && tabs.get_active_page() != last_page)
|
||||
{
|
||||
last_page = tabs.get_active_page();
|
||||
clear = true;
|
||||
}
|
||||
if (!handled && tabs.get_active_page() == 0)
|
||||
handled = proclist.on_button_press(event.xbutton.x, event.xbutton.y,
|
||||
event.xbutton.button);
|
||||
break;
|
||||
case ButtonRelease:
|
||||
if (tabs.get_active_page() == 0)
|
||||
handled = proclist.on_button_release(event.xbutton.x, event.xbutton.y,
|
||||
event.xbutton.button);
|
||||
break;
|
||||
case MotionNotify:
|
||||
if (tabs.get_active_page() == 0)
|
||||
handled = proclist.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;
|
||||
if (key == XK_Escape || (n > 0 && (buffer[0] == 'q' || buffer[0] == 'Q')))
|
||||
running = false;
|
||||
handled = tabs.on_key(key, buffer);
|
||||
break;
|
||||
}
|
||||
case ClientMessage:
|
||||
if ((Atom)event.xclient.data.l[0] == deleteWindowMessage)
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
if (handled) redraw(clear);
|
||||
}
|
||||
long now = now_ms();
|
||||
if (now - last_poll_ms >= 500)
|
||||
{
|
||||
long dt_ms = now - last_poll_ms;
|
||||
last_poll_ms = now;
|
||||
++tick;
|
||||
read_cpu(cur_total, cur_cores);
|
||||
read_net(cur_net);
|
||||
read_mem(mem);
|
||||
double cpu = cpu_pct(prev_total, cur_total);
|
||||
for (int i = 0; i < ncores && i < (int)cur_cores.size(); ++i)
|
||||
per_core[i] = cpu_pct(prev_cores[i], cur_cores[i]);
|
||||
hist.push_all(std::vector<double>{cpu, mem.used_pct});
|
||||
cores.push_all(per_core);
|
||||
double dt_s = dt_ms / 1000.0;
|
||||
net.push((double)(cur_net.rx - prev_net.rx) / dt_s,
|
||||
(double)(cur_net.tx - prev_net.tx) / dt_s);
|
||||
membar.set_value(mem.used_pct);
|
||||
memstack.set_segment(0, mem.used_gb);
|
||||
memstack.set_segment(1, mem.cached_gb);
|
||||
memstack.set_segment(2, mem.buffers_gb);
|
||||
memstack.set_segment(3, mem.free_gb);
|
||||
diskbar.set_value(disk_used_pct());
|
||||
swapbar.set_value(mem.swap_used_pct);
|
||||
prev_total = cur_total;
|
||||
prev_cores = cur_cores;
|
||||
prev_net = cur_net;
|
||||
if (now - last_proc_ms >= 2000)
|
||||
{
|
||||
last_proc_ms = now;
|
||||
proclist.refresh();
|
||||
}
|
||||
// Data is sampled every 500 ms, but repainting is every
|
||||
// 2 s (every 4th tick): every widget colour goes through
|
||||
// SStyle_Manager::get_color_Srgb, which is one XAllocColor
|
||||
// round trip per call, and a full repaint issues ~500 of
|
||||
// them (~0.5 s wall on this Xvfb). Repainting every tick
|
||||
// would never catch up and screenshots would catch the
|
||||
// paint mid-draw; at 2 s each repaint completes inside
|
||||
// its interval and the graphs still advance live.
|
||||
if (tick % 4 == 0) redraw(true);
|
||||
}
|
||||
usleep(20000);
|
||||
}
|
||||
|
||||
XCloseDisplay(display);
|
||||
return 0;
|
||||
}
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
@@ -96,6 +96,13 @@ public:
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2;
|
||||
int r = std::min(width(), height()) / 2 - 10;
|
||||
// Audit G1/G3: numerals 7-8% of dial diameter (bold), title inside
|
||||
// the dial below the top numerals, value below the hub.
|
||||
int numCap = std::max(14, r / 7);
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, numCap);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
XSetForeground(display_, gc_, face);
|
||||
XFillArc(display_, window_, gc_, cx - r, cy - r, 2 * r, 2 * r, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
@@ -112,10 +119,10 @@ public:
|
||||
XDrawLine(display_, window_, gc_, tx1, ty1, tx2, ty2);
|
||||
if (i % 2 == 0) {
|
||||
std::string lab = fmt(min_ + f * (max_ - min_));
|
||||
int tw = xf::text_width(st, lab);
|
||||
int lx = cx + (int)((r - 26) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - 26) * std::sin(ang)) + 4;
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx, ly, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
int lx = cx + (int)((r - numCap - 14) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - numCap - 14) * std::sin(ang)) + numAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, lx, ly, lab);
|
||||
}
|
||||
}
|
||||
double nang = (225.0 - 270.0 * fraction()) * pi / 180.0;
|
||||
@@ -128,10 +135,11 @@ public:
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XFillArc(display_, window_, gc_, cx - 5, cy - 5, 10, 10, 0, 360 * 64);
|
||||
std::string val = fmt(value_) + "";
|
||||
int vw = xf::text_width(st, val);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - vw / 2, cy + r - 16, val);
|
||||
int tw2 = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw2 / 2, y1_ + 16, text_);
|
||||
int vw = xf::text_width(stVal, val);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, cx - vw / 2, cy + r - 18, val);
|
||||
// Title inside the dial, below the top numerals (audit G3).
|
||||
int tw2 = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, cx - tw2 / 2, cy - (int)(r * 0.43), text_); // audit G3: below the top numerals, clear of them
|
||||
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -97,6 +97,11 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16-18 px, title 18-20 px bold; top label inset
|
||||
// clear of the border (G7).
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 17);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 19);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long face = styles_->get_color_rgb(face_color_.r, face_color_.g, face_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
@@ -105,7 +110,7 @@ public:
|
||||
unsigned long green = styles_->get_color_rgb(green_color_.r, green_color_.g, green_color_.b);
|
||||
XSetForeground(display_, gc_, white);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int bx = x1_ + 24, by = y1_ + 24, bw = width() - 48, bh = height() - 48;
|
||||
int bx = x1_ + 24, by = y1_ + 40, bw = width() - 48, bh = height() - 64; // audit G7: room for title + top label
|
||||
XSetForeground(display_, gc_, face);
|
||||
XFillRectangle(display_, window_, gc_, bx, by, bw, bh);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
@@ -127,13 +132,13 @@ public:
|
||||
XSetLineAttributes(display_, gc_, 1, LineSolid, CapButt, JoinMiter);
|
||||
for (int i = 0; i <= 10; i += 2) {
|
||||
std::string lab = fmt(min_ + (i / 10.0) * (max_ - min_));
|
||||
int tw = xf::text_width(st, lab);
|
||||
if (horizontal_) xf::draw_text_at(display_, window_, gc_, st, bx + (int)((i / 10.0) * bw) - tw / 2, by + bh + 16, lab);
|
||||
else xf::draw_text_at(display_, window_, gc_, st, bx + bw + 6, by + bh - (int)((i / 10.0) * bh) + 4, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
if (horizontal_) xf::draw_text_at(display_, window_, gc_, stNum, bx + (int)((i / 10.0) * bw) - tw / 2, by + bh + 16, lab);
|
||||
else xf::draw_text_at(display_, window_, gc_, stNum, bx + bw + 10, by + bh - (int)((i / 10.0) * bh) + numAsc / 2, lab);
|
||||
}
|
||||
std::string val = text_ + " " + fmt(value_);
|
||||
int vw = xf::text_width(st, val);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + (width() - vw) / 2, y1_ + 16, val);
|
||||
int vw = xf::text_width(stTitle, val);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, x1_ + (width() - vw) / 2, y1_ + 26, val);
|
||||
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
@@ -143,7 +148,7 @@ public:
|
||||
if (!contains(x, y) || !enabled_) return false;
|
||||
(void)button;
|
||||
focused_ = true; pressed_ = true;
|
||||
int bx = x1_ + 24, by = y1_ + 24, bw = width() - 48, bh = height() - 48;
|
||||
int bx = x1_ + 24, by = y1_ + 40, bw = width() - 48, bh = height() - 64; // audit G7: room for title + top label
|
||||
if (horizontal_) set_value(min_ + std::max(0.0, std::min(1.0, (double)(x - bx) / bw)) * (max_ - min_));
|
||||
else set_value(min_ + std::max(0.0, std::min(1.0, (double)(by + bh - y) / bh)) * (max_ - min_));
|
||||
|
||||
|
||||
@@ -101,11 +101,14 @@ public:
|
||||
XSetForeground(display_, gc_, white);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int base_y = y2_ - 44;
|
||||
// Audit: the dome overlapped the bar's top by 10 px and the
|
||||
// "BEACON" caption sat 4 px from the bottom edge. Bar lowered,
|
||||
// dome sits 6 px above it, captions inset and 16 px bold.
|
||||
int base_y = y2_ - 72;
|
||||
int r = std::max(10, std::min(width(), height()) / 3);
|
||||
int cy = base_y - r + 10;
|
||||
int cy = base_y - r - 6;
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XFillRectangle(display_, window_, gc_, cx - 70, base_y, 140, 22);
|
||||
XFillRectangle(display_, window_, gc_, cx - 70, base_y, 140, 28);
|
||||
XSetForeground(display_, gc_, beacon_colour(beacon_color_.r, beacon_color_.g, beacon_color_.b));
|
||||
XFillArc(display_, window_, gc_, cx - r, cy - r, 2 * r, 2 * r, 0, 360 * 64);
|
||||
if (is_lit()) {
|
||||
@@ -117,13 +120,15 @@ public:
|
||||
XDrawLine(display_, window_, gc_, cx + r / 2, cy - r / 2 + 6, cx + r + 40, cy - r - 24);
|
||||
XDrawLine(display_, window_, gc_, cx + r / 2, cy - r / 2 - 6, cx + r + 40, cy - r - 36);
|
||||
}
|
||||
// Rate on the dark base plate in white: it used to share BEACON baseline (base_y + 38 vs y2_ - 4), so the two labels overstruck each other; the 18 px bold font made it worse.
|
||||
// Rate on the dark base plate in white, 16 px bold.
|
||||
std::string rate = "FLASH " + std::to_string((int)flash_rate_hz_) + " Hz";
|
||||
int twr = xf::text_width(st, rate);
|
||||
SStyle rate_style = st; rate_style.text_color_ = white;
|
||||
xf::draw_text_at(display_, window_, gc_, rate_style, cx - twr / 2, base_y + 17, rate);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 4, text_);
|
||||
rate_style.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
int twr = xf::text_width(rate_style, rate);
|
||||
xf::draw_text_at(display_, window_, gc_, rate_style, cx - twr / 2, base_y + 21, rate);
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 8, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: "GAUGE" 16 px bold, 14 px above the bottom edge.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 15);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
@@ -101,8 +103,8 @@ public:
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XDrawRectangle(display_, window_, gc_, ix, iy, iw, ih);
|
||||
XDrawRectangle(display_, window_, gc_, ix + 3, iy + 3, iw - 6, ih - 6);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + (width() - tw) / 2, y2_ - 12, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, x1_ + (width() - tw) / 2, y2_ - 14, text_);
|
||||
draw_screw(x1_ + 16, y1_ + 16);
|
||||
draw_screw(x2_ - 16, y1_ + 16);
|
||||
draw_screw(x1_ + 16, y2_ - 16);
|
||||
|
||||
@@ -91,6 +91,9 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: banner + state + title 16 px bold; banner text white.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
SStyle stLabWhite = stLab; stLabWhite.text_color_ = styles_->get_color_rgb(255, 255, 255);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
@@ -114,7 +117,7 @@ public:
|
||||
if (tripped) {
|
||||
XSetForeground(display_, gc_, red);
|
||||
XFillRectangle(display_, window_, gc_, bx + 20, by + 16, bw - 40, 34);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx + 20, by + 16, bx + bw - 20, by + 50, "TRIPPED");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLabWhite, bx + 20, by + 16, bx + bw - 20, by + 50, "TRIPPED");
|
||||
}
|
||||
int hx = cx, hy = cy + (on ? -52 : (tripped ? 0 : 52));
|
||||
xf::set_line_width(display_, gc_, lever_line_width_);
|
||||
@@ -128,8 +131,8 @@ public:
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, cx - 30, cy + 10, 60, 60, 0, 360 * 64);
|
||||
std::string lab = on ? "ON" : (tripped ? "TRIPPED" : "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by + bh - 52, bx + bw, by + bh - 28, lab);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by + bh - 56, bx + bw, by + bh - 24, lab);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -119,6 +119,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: grid labels 14 px bold.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
// Audit: header title 18-20 px bold.
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 19);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long face = styles_->get_color_rgb(face_color_.r, face_color_.g, face_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
@@ -128,13 +132,13 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, panel);
|
||||
XFillRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 4, height() - 4);
|
||||
int sx = x1_ + 10, sy = y1_ + 10, sw = width() - 20, sh = 30;
|
||||
int sx = x1_ + 10, sy = y1_ + 10, sw = width() - 20, sh = 38; // audit: header bar taller for the 19 px title
|
||||
XSetForeground(display_, gc_, amber);
|
||||
XFillRectangle(display_, window_, gc_, sx, sy, sw, sh);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XDrawRectangle(display_, window_, gc_, sx, sy, sw, sh);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, sx + (sw - tw) / 2, sy + 20, text_);
|
||||
int tw = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, sx + (sw - tw) / 2, sy + 27, text_);
|
||||
if (labels_.size() != (size_t)(rows_ * cols_)) labels_.assign((size_t)(rows_ * cols_), "");
|
||||
int gx = x1_ + 16, gy = y1_ + 52, gw = width() - 32, gh = height() - 68;
|
||||
int cw = gw / cols_, ch = gh / rows_;
|
||||
@@ -148,8 +152,8 @@ public:
|
||||
XDrawRectangle(display_, window_, gc_, cx0 + 3, cy0 + 3, cw - 6, ch - 6);
|
||||
std::string lab = labels_[(size_t)(r * cols_ + c)];
|
||||
if (!lab.empty()) {
|
||||
int lw = xf::text_width(st, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx0 + (cw - lw) / 2, cy0 + ch / 2 + 4, lab);
|
||||
int lw = xf::text_width(stLab, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx0 + (cw - lw) / 2, cy0 + ch / 2 + 7, lab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -175,4 +176,71 @@ inline int clamp_font_px(double px, int lo, int hi)
|
||||
return v;
|
||||
}
|
||||
|
||||
// Scaled bold fonts — Inst* proportions fix (Dec 2026 audit, G1).
|
||||
// Audit sizes are CAP heights (glyph height); a core font's pixel size
|
||||
// is ~cap / 0.72 (probed on hot_dallas: misc-fixed bold 48 px renders
|
||||
// ~34 px cap-height digits; helvetica bold the same). The X server only
|
||||
// ships bitmap fixed fonts at 13/14/15/18 px, but the scalable XLFD
|
||||
// entries ("-...--<px>-0-75-75-...") render cleanly at any size
|
||||
// (verified 14..48 px, mono + helvetica). Cached per cap height;
|
||||
// falls back to inst_bold_font() when a size cannot load.
|
||||
inline int inst_px_for_cap(int cap) {
|
||||
if (cap <= 0) return 18;
|
||||
return (cap * 100 + 71) / 72;
|
||||
}
|
||||
|
||||
// Bold monospace font with cap height ~cap px (numerals, values).
|
||||
inline XFontStruct* inst_cap_font(Display* display, int cap) {
|
||||
if (!display) return nullptr;
|
||||
static std::map<int, XFontStruct*> cache;
|
||||
auto it = cache.find(cap);
|
||||
if (it != cache.end()) return it->second;
|
||||
int px = inst_px_for_cap(cap);
|
||||
char name[160];
|
||||
XFontStruct* f = nullptr;
|
||||
std::snprintf(name, sizeof name, "-misc-fixed-bold-r-normal--%d-0-75-75-c-0-iso8859-1", px);
|
||||
f = XLoadQueryFont(display, name);
|
||||
if (!f) {
|
||||
std::snprintf(name, sizeof name, "-adobe-helvetica-bold-r-normal--%d-0-75-75-p-0-iso8859-1", px);
|
||||
f = XLoadQueryFont(display, name);
|
||||
}
|
||||
if (!f) f = inst_bold_font(display);
|
||||
cache[cap] = f;
|
||||
return f;
|
||||
}
|
||||
|
||||
// Bold proportional font with cap height ~cap px (titles, word labels).
|
||||
inline XFontStruct* inst_cap_font_prop(Display* display, int cap) {
|
||||
if (!display) return nullptr;
|
||||
static std::map<int, XFontStruct*> cache;
|
||||
auto it = cache.find(cap);
|
||||
if (it != cache.end()) return it->second;
|
||||
int px = inst_px_for_cap(cap);
|
||||
char name[160];
|
||||
XFontStruct* f = nullptr;
|
||||
std::snprintf(name, sizeof name, "-adobe-helvetica-bold-r-normal--%d-0-75-75-p-0-iso8859-1", px);
|
||||
f = XLoadQueryFont(display, name);
|
||||
if (!f) {
|
||||
std::snprintf(name, sizeof name, "-urw-nimbus sans l-bold-r-normal--%d-0-0-0-p-0-iso8859-1", px);
|
||||
f = XLoadQueryFont(display, name);
|
||||
}
|
||||
if (!f) f = inst_bold_font(display);
|
||||
cache[cap] = f;
|
||||
return f;
|
||||
}
|
||||
|
||||
// Largest proportional-bold cap height (<= max_cap) whose rendering of
|
||||
// `text` fits in target_w px; 8 px floor. Used by InstNameplate so the
|
||||
// engraving fills ~40-50% of the plate width.
|
||||
inline XFontStruct* inst_prop_font_fit(Display* display, const std::string& text,
|
||||
int target_w, int max_cap) {
|
||||
if (!display || text.empty() || target_w <= 0) return inst_cap_font_prop(display, 16);
|
||||
for (int cap = max_cap; cap >= 8; --cap) {
|
||||
XFontStruct* f = inst_cap_font_prop(display, cap);
|
||||
if (!f) continue;
|
||||
if (XTextWidth(f, text.c_str(), (int)text.size()) <= target_w) return f;
|
||||
}
|
||||
return inst_cap_font_prop(display, 8);
|
||||
}
|
||||
|
||||
} // namespace xframe
|
||||
@@ -35,7 +35,7 @@ private:
|
||||
// Getter/setter pass (Group D): draw colours/state exposed as properties.
|
||||
// Defaults preserve the original rendering.
|
||||
Srgb segment_on_color_ = {255, 176, 0};
|
||||
Srgb segment_off_color_ = {50, 45, 20};
|
||||
Srgb segment_off_color_ = {56, 48, 20}; // audit: unlit segments slightly more visible, uniform dim
|
||||
Srgb white_color_ = {255, 255, 255};
|
||||
Srgb ink_color_ = {40, 40, 40};
|
||||
Srgb amber_color_ = {255, 176, 0};
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
static const bool seg[10][7] = {{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,0,0},{1,1,1,1,1,1,1},{1,1,1,1,0,1,1}};
|
||||
unsigned long on = styles_->get_color_rgb(segment_on_color_.r, segment_on_color_.g, segment_on_color_.b);
|
||||
unsigned long off = styles_->get_color_rgb(segment_off_color_.r, segment_off_color_.g, segment_off_color_.b);
|
||||
int t = 8; // was 6 (x1.33)
|
||||
int t = std::max(6, h / 10); // segment thickness scales with digit height
|
||||
draw_segment(x + t, y, w - 2 * t, t, seg[d][0], on, off);
|
||||
draw_segment(x + w - t, y + t, t, h / 2 - 2 * t, seg[d][1], on, off);
|
||||
draw_segment(x + w - t, y + h / 2 + t, t, h / 2 - 2 * t, seg[d][2], on, off);
|
||||
@@ -107,31 +107,38 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit G4: title 16 px; digits scale with the display.
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long amber = styles_->get_color_rgb(amber_color_.r, amber_color_.g, amber_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
XSetForeground(display_, gc_, white);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int tw0 = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + (width() - tw0) / 2, y1_ + 18, text_);
|
||||
int dx = x1_ + 12, dy = y1_ + 30, dw = width() - 24, dh = height() - 42;
|
||||
int tw0 = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, x1_ + (width() - tw0) / 2, y1_ + 24, text_);
|
||||
int dx = x1_ + 12, dy = y1_ + 34, dw = width() - 24, dh = height() - 46;
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XFillRectangle(display_, window_, gc_, dx, dy, dw, dh);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XDrawRectangle(display_, window_, gc_, dx, dy, dw, dh);
|
||||
std::string s = fmt(value_, 1);
|
||||
int digw = 45, digh = 85, gap = 11; // glyphs x1.33 (was 34x64, gap 8)
|
||||
// Audit G4: digits were fixed 45x85 in a 696x438 window (19% of
|
||||
// its height); now ~42% of the display height, centred.
|
||||
int digh = (int)(dh * 0.42);
|
||||
int digw = (int)(digh * 0.55);
|
||||
int gap = 20;
|
||||
int dps = std::max(8, digh / 12);
|
||||
int totalw = 0;
|
||||
for (char c : s) totalw += (c == '.') ? 16 : (c == '-' ? 27 : digw + gap);
|
||||
for (char c : s) totalw += (c == '.') ? (dps + 6) : (c == '-' ? 27 : digw + gap);
|
||||
totalw -= gap;
|
||||
int tx = dx + (dw - totalw) / 2;
|
||||
int ty = dy + (dh - digh) / 2;
|
||||
for (char c : s) {
|
||||
if (c == '.') {
|
||||
XSetForeground(display_, gc_, amber);
|
||||
XFillRectangle(display_, window_, gc_, tx, ty + digh - 11, 11, 11);
|
||||
tx += 16;
|
||||
XFillRectangle(display_, window_, gc_, tx, ty + digh - dps, dps, dps);
|
||||
tx += dps + 6;
|
||||
} else if (c == '-') {
|
||||
XSetForeground(display_, gc_, amber);
|
||||
XFillRectangle(display_, window_, gc_, tx, ty + digh / 2 - 4, 21, 8);
|
||||
|
||||
@@ -77,6 +77,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit G6: "E-STOP"/"STOPPED" white on red, 18 px; title 16 px.
|
||||
SStyle stFace = st; stFace.font_ = xframe::inst_cap_font(display_, 18);
|
||||
stFace.text_color_ = styles_->get_color_rgb(255, 255, 255);
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
unsigned long amber = styles_->get_color_rgb(amber_color_.r, amber_color_.g, amber_color_.b);
|
||||
@@ -98,8 +102,8 @@ public:
|
||||
XFillArc(display_, window_, gc_, cx - r + 18, cy - r + 18 + dy, 2 * r - 36, 2 * r - 36, 0, 180 * 64);
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, cx - r, cy - r + dy, 2 * r, 2 * r, 0, 360 * 64);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - r, cy - 12 + dy, cx + r, cy + 12 + dy, latched_ ? "STOPPED" : "E-STOP");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stFace, cx - r, cy - 16 + dy, cx + r, cy + 16 + dy, latched_ ? "STOPPED" : "E-STOP");
|
||||
xf::draw_text_centered(display_, window_, gc_, stTitle, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -84,6 +84,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, title 18 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 18);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long face = styles_->get_color_rgb(face_color_.r, face_color_.g, face_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
@@ -109,7 +113,7 @@ public:
|
||||
XDrawLine(display_, window_, gc_, cx + hw, gy, cx + hw + 8, gy);
|
||||
if (i % 2 == 0) {
|
||||
std::string lab = fmt(f * 100.0);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx + hw + 12, gy + 4, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, cx + hw + 12, gy + numAsc / 2, lab);
|
||||
}
|
||||
}
|
||||
int fy = bot - (int)(fraction() * (bot - top));
|
||||
@@ -118,8 +122,8 @@ public:
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XDrawArc(display_, window_, gc_, cx - 11, fy - 11, 22, 22, 0, 360 * 64);
|
||||
std::string val = text_ + " " + fmt(value_) + " L/min";
|
||||
int vw = xf::text_width(st, val);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + (width() - vw) / 2, y1_ + 18, val);
|
||||
int vw = xf::text_width(stTitle, val);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, x1_ + (width() - vw) / 2, y1_ + 26, val);
|
||||
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(43)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstHorizontalTankLevel"; text_ = "InstHorizontalTankLevel";
|
||||
name_ = "InstHorizontalTankLevel"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstHorizontalTankLevel() {}
|
||||
@@ -105,6 +105,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -114,12 +118,17 @@ public:
|
||||
unsigned long red = styles_->get_color_rgb(red_color_.r, red_color_.g, red_color_.b);
|
||||
XSetForeground(display_, gc_, white);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int tx = x1_ + 40;
|
||||
int ty = y1_ + 90;
|
||||
int tw = width() - 180;
|
||||
// Audit: capsule ends are true half-discs INSIDE the widget;
|
||||
// the old left cap drew an arc centred off-window (tx-th/2 < x1_)
|
||||
// and the pale fill never covered the caps.
|
||||
int th = 150;
|
||||
int tx = x1_ + th / 2 + 12;
|
||||
int ty = y1_ + 90;
|
||||
int tw = width() - th - 24;
|
||||
XSetForeground(display_, gc_, pale);
|
||||
XFillRectangle(display_, window_, gc_, tx, ty, tw, th);
|
||||
XFillArc(display_, window_, gc_, tx - th / 2, ty, th, th, 90 * 64, 180 * 64);
|
||||
XFillArc(display_, window_, gc_, tx + tw - th / 2, ty, th, th, 270 * 64, 180 * 64);
|
||||
int fw = (int)(tw * level_ / 100.0);
|
||||
if (fw > 0) {
|
||||
XSetForeground(display_, gc_, fillc);
|
||||
@@ -135,21 +144,24 @@ public:
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, gx, ty + th + 4, gx, ty + th + 14);
|
||||
std::string lab = std::to_string(v);
|
||||
int lw = xf::text_width(st, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, st, gx - lw / 2, ty + th + 28, lab);
|
||||
int lw = xf::text_width(stNum, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, gx - lw / 2, ty + th + 32, lab);
|
||||
}
|
||||
auto mark = [&](double pct, unsigned long c, const char* lab) {
|
||||
int gx = tx + (int)(tw * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, gx, ty, gx, ty + th);
|
||||
xf::draw_text_at(display_, window_, gc_, st, gx + 4, ty - 8, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, gx + 4, ty - 10, lab);
|
||||
};
|
||||
mark(bands_.hi_hi, red, "HI-HI");
|
||||
mark(bands_.hi, amber, "HI");
|
||||
mark(bands_.lo, amber, "LO");
|
||||
mark(bands_.lo_lo, red, "LO-LO");
|
||||
std::string pct = fmt(level_) + "%";
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 12, ty + th / 2 + 4, pct);
|
||||
// % centred below the scale, clear of the right cap curve (G7).
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
int pvw = xf::text_width(stVal, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, x1_ + (width() - pvw) / 2, ty + th + 58, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -98,6 +98,13 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: position numerals 16 px (was ~10 px), "NO KEY" light
|
||||
// grey on the dark centre (G6), state + title 16 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
SStyle stNoKey = st; stNoKey.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
stNoKey.text_color_ = styles_->get_color_rgb(225, 225, 225);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
@@ -117,7 +124,8 @@ public:
|
||||
double a = -2.094 + i * (4.188 / (positions_ > 1 ? (positions_ - 1) : 1));
|
||||
int tx = cx + (int)((r + 30) * std::cos(a));
|
||||
int ty = cy + (int)((r + 30) * std::sin(a)) + 5;
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx - 4, ty, std::to_string(i));
|
||||
int tw = xf::text_width(stNum, std::to_string(i));
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx - tw / 2, ty + numAsc / 2 - 5, std::to_string(i));
|
||||
}
|
||||
double pa = -2.094 + position_ * (4.188 / (positions_ > 1 ? (positions_ - 1) : 1));
|
||||
int px = cx + (int)((r - 20) * std::cos(pa));
|
||||
@@ -134,11 +142,11 @@ public:
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, px - 12, py - 12, 24, 24, 0, 360 * 64);
|
||||
} else {
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - 60, cy - 10, cx + 60, cy + 10, "NO KEY");
|
||||
xf::draw_text_centered(display_, window_, gc_, stNoKey, cx - 60, cy - 10, cx + 60, cy + 10, "NO KEY");
|
||||
}
|
||||
std::string pos = key_in_ ? ("KEY IN POS " + std::to_string(position_)) : "KEY OUT";
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - 110, cy + r + 40, cx + 110, cy + r + 64, pos);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, cx - 110, cy + r + 44, cx + 110, cy + r + 68, pos);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -98,6 +98,9 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: LAMP/TEST 16 px bold (face is light grey, dark text is
|
||||
// fine), title 16 px.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long face = styles_->get_color_rgb(face_color_.r, face_color_.g, face_color_.b);
|
||||
@@ -112,12 +115,12 @@ public:
|
||||
XFillArc(display_, window_, gc_, cx - R, cy - R, 2 * R, 2 * R, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, pressed_ ? face_down : face);
|
||||
XFillArc(display_, window_, gc_, cx - ir, cy - ir, 2 * ir, 2 * ir, 0, 360 * 64);
|
||||
int tw1 = xf::text_width(st, "LAMP");
|
||||
int tw2 = xf::text_width(st, "TEST");
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw1 / 2, cy - 2, "LAMP");
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw2 / 2, cy + 16, "TEST");
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 6, text_);
|
||||
int tw1 = xf::text_width(stLab, "LAMP");
|
||||
int tw2 = xf::text_width(stLab, "TEST");
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw1 / 2, cy - 2, "LAMP");
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw2 / 2, cy + 16, "TEST");
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 8, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -88,6 +88,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 28 px bold, inset above the leads' end.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 28);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
unsigned long lead = styles_->get_color_rgb(lead_color_.r, lead_color_.g, lead_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XFillRectangle(display_, window_, gc_, cx - r - 8, cy - r - 8, 2 * r + 16, 2 * r + 16);
|
||||
int lead_top = cy + r + 8;
|
||||
int lead_h = std::max(1, y2_ - 16 - lead_top);
|
||||
int lead_h = std::max(1, y2_ - 44 - lead_top); // leads end above the label
|
||||
XSetForeground(display_, gc_, lead);
|
||||
XFillRectangle(display_, window_, gc_, cx - 10, lead_top, 4, lead_h);
|
||||
XFillRectangle(display_, window_, gc_, cx + 6, lead_top, 4, lead_h);
|
||||
@@ -114,8 +116,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - r - 4, cy - r - 4, 2 * (r + 4), 2 * (r + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 6, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 8, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 60, 35};
|
||||
Srgb dim_color_ = {52, 14, 11};
|
||||
Srgb dim_color_ = {24, 15, 13}; // audit G5: unlit segments barely visible, never a ghost "8"
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 1;
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
// Short label: at the 18 px bold font the full name (14 chars,
|
||||
// 126 px) does not fit this 90 px display, and clipping it
|
||||
// mid-word reads badly, so the label shows "LedDigits".
|
||||
text_ = "LedDigits";
|
||||
text_ = "";
|
||||
value_ = xframe::inst_demo_value(0.0, max_value(), 42);
|
||||
}
|
||||
~InstLedDigits1() {}
|
||||
@@ -158,22 +158,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
// Name label clipped to the widget bounds: at the 18 px bold
|
||||
// instrumentation font the full name is wider than the narrowest
|
||||
// displays, and without the clip it would overwrite neighbours.
|
||||
XRectangle label_clip = { (short)x1_, (short)y1_, (unsigned short)width(), (unsigned short)height() };
|
||||
XSetClipRectangles(display_, gc_, 0, 0, &label_clip, 1, Unsorted);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
XSetClipMask(display_, gc_, None);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
int dp_w = (decimal_places_ > 0) ? 8 : 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 60, 35};
|
||||
Srgb dim_color_ = {52, 14, 11};
|
||||
Srgb dim_color_ = {24, 15, 13}; // audit G5: unlit segments barely visible, never a ghost "8"
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 2;
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstLedDigits2"; text_ = "InstLedDigits2";
|
||||
name_ = "InstLedDigits2"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(0.0, max_value(), 42);
|
||||
}
|
||||
~InstLedDigits2() {}
|
||||
@@ -154,16 +154,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
int dp_w = (decimal_places_ > 0) ? 8 : 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 60, 35};
|
||||
Srgb dim_color_ = {52, 14, 11};
|
||||
Srgb dim_color_ = {24, 15, 13}; // audit G5: unlit segments barely visible, never a ghost "8"
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 3;
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstLedDigits3"; text_ = "InstLedDigits3";
|
||||
name_ = "InstLedDigits3"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(0.0, max_value(), 42);
|
||||
}
|
||||
~InstLedDigits3() {}
|
||||
@@ -154,16 +154,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
int dp_w = (decimal_places_ > 0) ? 8 : 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 60, 35};
|
||||
Srgb dim_color_ = {52, 14, 11};
|
||||
Srgb dim_color_ = {24, 15, 13}; // audit G5: unlit segments barely visible, never a ghost "8"
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 4;
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstLedDigits4"; text_ = "InstLedDigits4";
|
||||
name_ = "InstLedDigits4"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(0.0, max_value(), 42);
|
||||
}
|
||||
~InstLedDigits4() {}
|
||||
@@ -154,16 +154,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
int dp_w = (decimal_places_ > 0) ? 8 : 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 60, 35};
|
||||
Srgb dim_color_ = {52, 14, 11};
|
||||
Srgb dim_color_ = {24, 15, 13}; // audit G5: unlit segments barely visible, never a ghost "8"
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 5;
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstLedDigits5"; text_ = "InstLedDigits5";
|
||||
name_ = "InstLedDigits5"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(0.0, max_value(), 42);
|
||||
}
|
||||
~InstLedDigits5() {}
|
||||
@@ -154,16 +154,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
int dp_w = (decimal_places_ > 0) ? 8 : 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 60, 35};
|
||||
Srgb dim_color_ = {52, 14, 11};
|
||||
Srgb dim_color_ = {24, 15, 13}; // audit G5: unlit segments barely visible, never a ghost "8"
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 6;
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstLedDigits6"; text_ = "InstLedDigits6";
|
||||
name_ = "InstLedDigits6"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(0.0, max_value(), 42);
|
||||
}
|
||||
~InstLedDigits6() {}
|
||||
@@ -154,16 +154,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
int dp_w = (decimal_places_ > 0) ? 8 : 0;
|
||||
|
||||
@@ -88,6 +88,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 28 px bold, inset above the leads' end.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 28);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
unsigned long lead = styles_->get_color_rgb(lead_color_.r, lead_color_.g, lead_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XFillRectangle(display_, window_, gc_, cx - r - 8, cy - r - 8, 2 * r + 16, 2 * r + 16);
|
||||
int lead_top = cy + r + 8;
|
||||
int lead_h = std::max(1, y2_ - 16 - lead_top);
|
||||
int lead_h = std::max(1, y2_ - 44 - lead_top); // leads end above the label
|
||||
XSetForeground(display_, gc_, lead);
|
||||
XFillRectangle(display_, window_, gc_, cx - 10, lead_top, 4, lead_h);
|
||||
XFillRectangle(display_, window_, gc_, cx + 6, lead_top, 4, lead_h);
|
||||
@@ -114,8 +116,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - r - 4, cy - r - 4, 2 * (r + 4), 2 * (r + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 6, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 8, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -88,6 +88,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 28 px bold, inset above the leads' end.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 28);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
unsigned long lead = styles_->get_color_rgb(lead_color_.r, lead_color_.g, lead_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XFillRectangle(display_, window_, gc_, cx - r - 8, cy - r - 8, 2 * r + 16, 2 * r + 16);
|
||||
int lead_top = cy + r + 8;
|
||||
int lead_h = std::max(1, y2_ - 16 - lead_top);
|
||||
int lead_h = std::max(1, y2_ - 44 - lead_top); // leads end above the label
|
||||
XSetForeground(display_, gc_, lead);
|
||||
XFillRectangle(display_, window_, gc_, cx - 10, lead_top, 4, lead_h);
|
||||
XFillRectangle(display_, window_, gc_, cx + 6, lead_top, 4, lead_h);
|
||||
@@ -114,8 +116,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - r - 4, cy - r - 4, 2 * (r + 4), 2 * (r + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 6, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 8, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(46)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstLevelColumnGauge"; text_ = "InstLevelColumnGauge";
|
||||
name_ = "InstLevelColumnGauge"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstLevelColumnGauge() {}
|
||||
@@ -105,6 +105,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -133,14 +137,17 @@ public:
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, tx + tw + 4, gy, tx + tw + 4 + len, gy);
|
||||
if (v % 25 == 0) {
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 24, gy + 4, std::to_string(v));
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx + tw + 24, gy + numAsc / 2, std::to_string(v));
|
||||
}
|
||||
}
|
||||
auto mark = [&](double pct, unsigned long c, const char* lab) {
|
||||
int gy = ty + th - (int)(th * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, tx - 6, gy, tx, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx - 52, gy + 4, lab);
|
||||
// Right-aligned ending tx-10: clear of the tick mark at
|
||||
// tx-6..tx and of the column (audit G7).
|
||||
int aw = xf::text_width(stLab, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, tx - 10 - aw, gy + 9, lab);
|
||||
};
|
||||
mark(bands_.hi_hi, red, "HI-HI");
|
||||
mark(bands_.hi, amber, "HI");
|
||||
@@ -151,8 +158,9 @@ public:
|
||||
XDrawLine(display_, window_, gc_, tx - 2, fy, tx + tw + 2, fy);
|
||||
XFillRectangle(display_, window_, gc_, tx + tw + 2, fy - 5, 10, 10);
|
||||
std::string pct = fmt(level_) + "%";
|
||||
int pw2 = xf::text_width(st, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + (tw - pw2) / 2, ty + th + 18, pct);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
int pw2 = xf::text_width(stVal, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, tx + (tw - pw2) / 2, ty + th + 26, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(49)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstLevelTransmitter"; text_ = "InstLevelTransmitter";
|
||||
name_ = "InstLevelTransmitter"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstLevelTransmitter() {}
|
||||
@@ -105,6 +105,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -131,13 +135,13 @@ public:
|
||||
int gy = ty + th - (int)(th * v / 100.0);
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, tx + tw + 4, gy, tx + tw + 14, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 18, gy + 4, std::to_string(v));
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx + tw + 18, gy + numAsc / 2, std::to_string(v));
|
||||
}
|
||||
auto mark = [&](double pct, unsigned long c, const char* lab) {
|
||||
int gy = ty + th - (int)(th * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, tx, gy, tx + tw, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 52, gy + 4, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, tx + tw + 52, gy + 9, lab);
|
||||
};
|
||||
mark(bands_.hi_hi, red, "HI-HI");
|
||||
mark(bands_.hi, amber, "HI");
|
||||
@@ -147,14 +151,16 @@ public:
|
||||
std::string pct = fmt(level_) + "%";
|
||||
std::string mas = fmt(ma) + " mA";
|
||||
int rx = tx + tw + 120;
|
||||
xf::draw_text_at(display_, window_, gc_, st, rx, ty + 40, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, rx, ty + 60, mas);
|
||||
xf::draw_text_at(display_, window_, gc_, st, rx, ty + 80, "4-20 mA loop");
|
||||
// Data block at 16 px (audit).
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, rx, ty + 44, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, rx, ty + 68, mas);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, rx, ty + 92, "4-20 mA loop");
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XDrawArc(display_, window_, gc_, rx, ty + 100, 16, 16, 0, 360 * 64);
|
||||
XDrawArc(display_, window_, gc_, rx + 26, ty + 100, 16, 16, 0, 360 * 64);
|
||||
xf::draw_text_at(display_, window_, gc_, st, rx + 5, ty + 112, "+");
|
||||
xf::draw_text_at(display_, window_, gc_, st, rx + 31, ty + 112, "-");
|
||||
// Buttons 24 px so the 16 px +/- glyphs fit (audit).
|
||||
XDrawArc(display_, window_, gc_, rx, ty + 104, 24, 24, 0, 360 * 64);
|
||||
XDrawArc(display_, window_, gc_, rx + 32, ty + 104, 24, 24, 0, 360 * 64);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, rx, ty + 104, rx + 24, ty + 128, "+");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, rx + 32, ty + 104, rx + 56, ty + 128, "-");
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -84,6 +84,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, title 18 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 18);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long face = styles_->get_color_rgb(face_color_.r, face_color_.g, face_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
@@ -114,13 +118,13 @@ public:
|
||||
XDrawLine(display_, window_, gc_, lx - 8, gy, lx, gy);
|
||||
if (i % 2 == 0) {
|
||||
std::string lab = fmt(50.0 - (i / 10.0) * 100.0);
|
||||
int tw = xf::text_width(st, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx - 12 - tw, gy + 4, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, lx - 12 - tw, gy + numAsc / 2, lab);
|
||||
}
|
||||
}
|
||||
std::string val = text_ + " " + fmt(value_) + " mm";
|
||||
int vw = xf::text_width(st, val);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + (width() - vw) / 2, y1_ + 18, val);
|
||||
int vw = xf::text_width(stTitle, val);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, x1_ + (width() - vw) / 2, y1_ + 26, val);
|
||||
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -104,11 +104,19 @@ public:
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 14, y1_ + 14, width() - 28, height() - 28);
|
||||
XSetForeground(display_, gc_, grey);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 18, y1_ + 18, width() - 36, height() - 36);
|
||||
int tw = xf::text_width(st, text_);
|
||||
// Audit: the engraving must fill 40-50% of the plate width
|
||||
// (it was ~2% at the default 18 px font), so fit the font to the
|
||||
// plate width (width ratio wins over the audit's "~30-40 px tall"
|
||||
// parenthetical — ~68 px cap for "PUMP 1").
|
||||
XFontStruct* plate_font = xframe::inst_prop_font_fit(display_, text_, (int)((width() - 20) * 0.45), 72);
|
||||
int plateAsc = plate_font ? plate_font->ascent : 13;
|
||||
SStyle stPlate = st; stPlate.font_ = plate_font;
|
||||
int tw = xf::text_width(stPlate, text_);
|
||||
int tx = x1_ + (width() - tw) / 2;
|
||||
int ty = y1_ + height() / 2 + 5;
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + 1, ty + 1, text_);
|
||||
int ty = y1_ + height() / 2 + plateAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stPlate, tx + 1, ty + 1, text_);
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(engraved_color_.r, engraved_color_.g, engraved_color_.b));
|
||||
if (plate_font) XSetFont(display_, gc_, plate_font->fid);
|
||||
XDrawString(display_, window_, gc_, tx, ty, text_.c_str(), (int)text_.size());
|
||||
draw_screw(x1_ + 24, y1_ + height() / 2);
|
||||
draw_screw(x2_ - 24, y1_ + height() / 2);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstNeedleEdgewise"; text_ = "InstNeedleEdgewise";
|
||||
name_ = "InstNeedleEdgewise"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(min_, max_, 42);
|
||||
}
|
||||
~InstNeedleEdgewise() {}
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
// Needle angle in degrees from vertical, negative = left: -50 .. +50.
|
||||
double needle_angle_deg() const { return -50.0 + 100.0 * fraction(); }
|
||||
int pivot_x() const { return x1_ + width() / 2; }
|
||||
int pivot_y() const { return y2_ - 16; }
|
||||
int pivot_y() const { return scale_y() + 36; } // audit: pivot attached to the scale
|
||||
int scale_y() const { return y1_ + (int)(height() * 0.45); }
|
||||
int scale_half() const { return std::max(10, width() / 2 - 24); }
|
||||
int needle_len() const { return pivot_y() - scale_y() + 6; }
|
||||
@@ -146,6 +146,10 @@ public:
|
||||
XSetForeground(display_, gc_, panel);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int px = pivot_x(), py = pivot_y(), sy = scale_y(), half = scale_half();
|
||||
// Audit: numerals 18-20 px bold (3% of scale length).
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 18);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stCap = st; stCap.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
XSetForeground(display_, gc_, face);
|
||||
XFillRectangle(display_, window_, gc_, x1_ + 8, y1_ + 8, width() - 16, sy - y1_ + 22);
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
@@ -164,8 +168,8 @@ public:
|
||||
XDrawLine(display_, window_, gc_, tx, sy, tx, sy - th);
|
||||
if (major) {
|
||||
std::string lab = std::to_string((int)std::llround(min_ + f * (max_ - min_)));
|
||||
int tw = xf::text_width(st, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx - tw / 2, sy - th - 12, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx - tw / 2, sy - th - 6, lab);
|
||||
}
|
||||
}
|
||||
// Needle sweeps left-right from the pivot below the scale.
|
||||
@@ -175,8 +179,8 @@ public:
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XFillArc(display_, window_, gc_, px - 7, py - 7, 14, 14, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, tick_col);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, px - tw / 2, py + 24, text_);
|
||||
int tw = xf::text_width(stCap, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stCap, px - tw / 2, py + 24, text_);
|
||||
if (focused_) {
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 3, height() - 3);
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstNeedleKnifeEdge"; text_ = "InstNeedleKnifeEdge";
|
||||
name_ = "InstNeedleKnifeEdge"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(min_, max_, 42);
|
||||
}
|
||||
~InstNeedleKnifeEdge() {}
|
||||
@@ -140,6 +140,11 @@ public:
|
||||
XSetForeground(display_, gc_, panel);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = centre_x(), cy = centre_y(), R = dial_radius();
|
||||
// Audit G1: numerals 7-8% of dial diameter, bold.
|
||||
int numCap = std::max(14, R / 7);
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, numCap);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stCap = st; stCap.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XFillArc(display_, window_, gc_, cx - R - 3, cy - R - 3, 2 * R + 6, 2 * R + 6, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, face);
|
||||
@@ -182,10 +187,10 @@ public:
|
||||
cx + (int)(R * sx), cy + (int)(R * sy));
|
||||
if (major) {
|
||||
std::string lab = std::to_string((int)std::llround(min_ + f * (max_ - min_)));
|
||||
int tw = xf::text_width(st, lab);
|
||||
int lx = cx + (int)((R - 26) * sx) - tw / 2;
|
||||
int ly = cy + (int)((R - 26) * sy) + 4;
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx, ly, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
int lx = cx + (int)((R - numCap - 12) * sx) - tw / 2;
|
||||
int ly = cy + (int)((R - numCap - 12) * sy) + numAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, lx, ly, lab);
|
||||
}
|
||||
}
|
||||
// Knife-edge needle: hair-thin pointer with a pointed tip and a tail.
|
||||
@@ -204,8 +209,12 @@ public:
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XFillArc(display_, window_, gc_, cx - 6, cy - 6, 12, 12, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, tick_col);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, cy + R - 26, text_);
|
||||
// Units caption inside the dial bottom; the class-name default is
|
||||
// now empty (audit G2), so nothing is drawn unless text is set.
|
||||
if (!text_.empty()) {
|
||||
int tw = xf::text_width(stCap, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stCap, cx - tw / 2, cy + R - 30, text_);
|
||||
}
|
||||
if (focused_) {
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 3, height() - 3);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstNeedleTapered"; text_ = "InstNeedleTapered";
|
||||
name_ = "InstNeedleTapered"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(min_, max_, 42);
|
||||
}
|
||||
~InstNeedleTapered() {}
|
||||
@@ -136,6 +136,11 @@ public:
|
||||
XSetForeground(display_, gc_, panel);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = centre_x(), cy = centre_y(), R = dial_radius();
|
||||
// Audit G1: numerals 7-8% of dial diameter, bold.
|
||||
int numCap = std::max(14, R / 7);
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, numCap);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stCap = st; stCap.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XFillArc(display_, window_, gc_, cx - R - 4, cy - R - 4, 2 * R + 8, 2 * R + 8, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, face);
|
||||
@@ -163,10 +168,10 @@ public:
|
||||
cx + (int)(R * sx), cy + (int)(R * sy));
|
||||
if (major) {
|
||||
std::string lab = std::to_string((int)std::llround(min_ + f * (max_ - min_)));
|
||||
int tw = xf::text_width(st, lab);
|
||||
int lx = cx + (int)((R - 26) * sx) - tw / 2;
|
||||
int ly = cy + (int)((R - 26) * sy) + 4;
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx, ly, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
int lx = cx + (int)((R - numCap - 12) * sx) - tw / 2;
|
||||
int ly = cy + (int)((R - numCap - 12) * sy) + numAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, lx, ly, lab);
|
||||
}
|
||||
}
|
||||
// Tapered needle: wide at the hub, narrow at the tip.
|
||||
@@ -183,8 +188,12 @@ public:
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XFillArc(display_, window_, gc_, cx - 8, cy - 8, 16, 16, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, tick_col);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, cy + R - 26, text_);
|
||||
// Units caption inside the dial bottom; the class-name default is
|
||||
// now empty (audit G2), so nothing is drawn unless text is set.
|
||||
if (!text_.empty()) {
|
||||
int tw = xf::text_width(stCap, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stCap, cx - tw / 2, cy + R - 30, text_);
|
||||
}
|
||||
if (focused_) {
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 3, height() - 3);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstNeedleVu"; text_ = "InstNeedleVu";
|
||||
name_ = "InstNeedleVu"; text_ = "";
|
||||
value_ = xframe::inst_demo_value(min_, max_, 42);
|
||||
}
|
||||
~InstNeedleVu() {}
|
||||
@@ -150,6 +150,12 @@ public:
|
||||
XSetForeground(display_, gc_, panel);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int px = pivot_x(), py = pivot_y(), R = arc_radius();
|
||||
// Audit: numerals 16-18 px bold (4% of width), red in the red zone;
|
||||
// "VU" below the arc centre, clear of the numerals.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 17);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stNumRed = stNum; stNumRed.text_color_ = red;
|
||||
SStyle stVu = st; stVu.font_ = xframe::inst_cap_font_prop(display_, 20);
|
||||
XSetForeground(display_, gc_, face);
|
||||
XFillRectangle(display_, window_, gc_, x1_ + 6, y1_ + 6, width() - 12, height() - 12);
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
@@ -185,10 +191,11 @@ public:
|
||||
XSetForeground(display_, gc_, (kDb[i] >= 0) ? red : tick_col);
|
||||
XDrawLine(display_, window_, gc_, tx0, ty0, tx1, ty1);
|
||||
std::string lab = (kDb[i] > 0) ? ("+" + std::to_string((int)kDb[i])) : std::to_string((int)kDb[i]);
|
||||
int tw = xf::text_width(st, lab);
|
||||
int lx = px + (int)((R - 26) * sx) - tw / 2;
|
||||
int ly = py + (int)((R - 26) * sy) + 4;
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx, ly, lab);
|
||||
SStyle& stLab = (kDb[i] >= 0) ? stNumRed : stNum;
|
||||
int tw = xf::text_width(stLab, lab);
|
||||
int lx = px + (int)((R - 38) * sx) - tw / 2;
|
||||
int ly = py + (int)((R - 38) * sy) + numAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, lx, ly, lab);
|
||||
}
|
||||
// VU needle: thin black pointer with a short tail.
|
||||
double a = needle_angle_deg() * kPi / 180.0;
|
||||
@@ -206,10 +213,10 @@ public:
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XFillArc(display_, window_, gc_, px - 7, py - 7, 14, 14, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, tick_col);
|
||||
int tw = xf::text_width(st, "VU");
|
||||
xf::draw_text_at(display_, window_, gc_, st, px - tw / 2, py - R + 34, "VU");
|
||||
int tw2 = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, px - tw2 / 2, py - R + 50, text_);
|
||||
// "VU" below the arc centre, clear of the scale numerals (audit
|
||||
// G3); the class-name caption is gone (audit G2).
|
||||
int tw = xf::text_width(stVu, "VU");
|
||||
xf::draw_text_at(display_, window_, gc_, stVu, px - tw / 2, py - R + 96, "VU");
|
||||
if (focused_) {
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 3, height() - 3);
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(48)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstOpenChannelLevel"; text_ = "InstOpenChannelLevel";
|
||||
name_ = "InstOpenChannelLevel"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstOpenChannelLevel() {}
|
||||
@@ -108,6 +108,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -150,21 +154,25 @@ public:
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, tx - 14, gy, tx - 4, gy);
|
||||
std::string lab = std::to_string(v);
|
||||
int lw = xf::text_width(st, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx - 18 - lw, gy + 4, lab);
|
||||
int lw = xf::text_width(stNum, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx - 8 - lw, gy + numAsc / 2, lab);
|
||||
}
|
||||
auto mark = [&](double pct, unsigned long c, const char* lab) {
|
||||
int gy = ty + th - (int)(th * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, tx + tw + 4, gy, tx + tw + 14, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 18, gy + 4, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, tx + tw + 18, gy + 9, lab);
|
||||
};
|
||||
mark(bands_.hi_hi, red, "HI-HI");
|
||||
mark(bands_.hi, amber, "HI");
|
||||
mark(bands_.lo, amber, "LO");
|
||||
mark(bands_.lo_lo, red, "LO-LO");
|
||||
std::string pct = fmt(level_) + "% depth";
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 18, ty + 4, pct);
|
||||
// "% depth" centred below the basin (audit G7: it sat at the top
|
||||
// edge and overran the right margin at 18 px).
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
int pw2 = xf::text_width(stVal, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, tx + (tw - pw2) / 2, ty + th + 30, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -91,6 +91,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 16-18 px bold, 10 px below the disc.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long ring = styles_->get_color_rgb(ring_color_.r, ring_color_.g, ring_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2 - 8;
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 10);
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 30); // audit: disc shrunk, label clear below it
|
||||
int lr = std::max(4, R - 8);
|
||||
XSetForeground(display_, gc_, pressed_ ? dark : bezel);
|
||||
XFillArc(display_, window_, gc_, cx - R, cy - R, 2 * R, 2 * R, 0, 360 * 64);
|
||||
@@ -116,8 +118,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - lr - 4, cy - lr - 4, 2 * (lr + 4), 2 * (lr + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 8, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 10, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -91,6 +91,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 16-18 px bold, 10 px below the disc.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long ring = styles_->get_color_rgb(ring_color_.r, ring_color_.g, ring_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2 - 8;
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 10);
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 30); // audit: disc shrunk, label clear below it
|
||||
int lr = std::max(4, R - 8);
|
||||
XSetForeground(display_, gc_, pressed_ ? dark : bezel);
|
||||
XFillArc(display_, window_, gc_, cx - R, cy - R, 2 * R, 2 * R, 0, 360 * 64);
|
||||
@@ -116,8 +118,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - lr - 4, cy - lr - 4, 2 * (lr + 4), 2 * (lr + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 8, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 10, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -91,6 +91,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 16-18 px bold, 10 px below the disc.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long ring = styles_->get_color_rgb(ring_color_.r, ring_color_.g, ring_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2 - 8;
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 10);
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 30); // audit: disc shrunk, label clear below it
|
||||
int lr = std::max(4, R - 8);
|
||||
XSetForeground(display_, gc_, pressed_ ? dark : bezel);
|
||||
XFillArc(display_, window_, gc_, cx - R, cy - R, 2 * R, 2 * R, 0, 360 * 64);
|
||||
@@ -116,8 +118,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - lr - 4, cy - lr - 4, 2 * (lr + 4), 2 * (lr + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 8, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 10, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -91,6 +91,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 16-18 px bold, 10 px below the disc.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long ring = styles_->get_color_rgb(ring_color_.r, ring_color_.g, ring_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2 - 8;
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 10);
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 30); // audit: disc shrunk, label clear below it
|
||||
int lr = std::max(4, R - 8);
|
||||
XSetForeground(display_, gc_, pressed_ ? dark : bezel);
|
||||
XFillArc(display_, window_, gc_, cx - R, cy - R, 2 * R, 2 * R, 0, 360 * 64);
|
||||
@@ -116,8 +118,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - lr - 4, cy - lr - 4, 2 * (lr + 4), 2 * (lr + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 8, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 10, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -91,6 +91,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: label 16-18 px bold, 10 px below the disc.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long ring = styles_->get_color_rgb(ring_color_.r, ring_color_.g, ring_color_.b);
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2 - 8;
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 10);
|
||||
int R = std::max(6, std::min(width(), height()) / 2 - 30); // audit: disc shrunk, label clear below it
|
||||
int lr = std::max(4, R - 8);
|
||||
XSetForeground(display_, gc_, pressed_ ? dark : bezel);
|
||||
XFillArc(display_, window_, gc_, cx - R, cy - R, 2 * R, 2 * R, 0, 360 * 64);
|
||||
@@ -116,8 +118,8 @@ public:
|
||||
XSetForeground(display_, gc_, lamp_colour(lens_color_.r, lens_color_.g, lens_color_.b));
|
||||
XDrawArc(display_, window_, gc_, cx - lr - 4, cy - lr - 4, 2 * (lr + 4), 2 * (lr + 4), 0, 360 * 64);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 8, text_);
|
||||
int tw = xf::text_width(stLab, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - tw / 2, y2_ - 10, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -89,6 +89,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: header title 18-20 px bold.
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 19);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long amber = styles_->get_color_rgb(amber_color_.r, amber_color_.g, amber_color_.b);
|
||||
@@ -99,13 +101,13 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 4, height() - 4);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 8, y1_ + 8, width() - 16, height() - 16);
|
||||
int sx = x1_ + 10, sy = y1_ + 10, sw = width() - 20, sh = 30;
|
||||
int sx = x1_ + 10, sy = y1_ + 10, sw = width() - 20, sh = 38; // audit: header bar taller for the 19 px title
|
||||
XSetForeground(display_, gc_, amber);
|
||||
XFillRectangle(display_, window_, gc_, sx, sy, sw, sh);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XDrawRectangle(display_, window_, gc_, sx, sy, sw, sh);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, sx + (sw - tw) / 2, sy + 20, text_);
|
||||
int tw = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, sx + (sw - tw) / 2, sy + 27, text_);
|
||||
draw_screw(x1_ + 20, y1_ + 20);
|
||||
draw_screw(x2_ - 20, y1_ + 20);
|
||||
draw_screw(x1_ + 20, y2_ - 20);
|
||||
|
||||
@@ -96,6 +96,13 @@ public:
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2;
|
||||
int r = std::min(width(), height()) / 2 - 10;
|
||||
// Audit G1/G3: numerals 7-8% of dial diameter (bold), title inside
|
||||
// the dial below the top numerals, value below the hub.
|
||||
int numCap = std::max(14, r / 7);
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, numCap);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
XSetForeground(display_, gc_, face);
|
||||
XFillArc(display_, window_, gc_, cx - r, cy - r, 2 * r, 2 * r, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
@@ -112,10 +119,10 @@ public:
|
||||
XDrawLine(display_, window_, gc_, tx1, ty1, tx2, ty2);
|
||||
if (i % 2 == 0) {
|
||||
std::string lab = fmt(min_ + f * (max_ - min_));
|
||||
int tw = xf::text_width(st, lab);
|
||||
int lx = cx + (int)((r - 26) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - 26) * std::sin(ang)) + 4;
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx, ly, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
int lx = cx + (int)((r - numCap - 14) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - numCap - 14) * std::sin(ang)) + numAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, lx, ly, lab);
|
||||
}
|
||||
}
|
||||
double nang = (225.0 - 270.0 * fraction()) * pi / 180.0;
|
||||
@@ -128,10 +135,11 @@ public:
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XFillArc(display_, window_, gc_, cx - 5, cy - 5, 10, 10, 0, 360 * 64);
|
||||
std::string val = fmt(value_) + " psi";
|
||||
int vw = xf::text_width(st, val);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - vw / 2, cy + r - 16, val);
|
||||
int tw2 = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw2 / 2, y1_ + 16, text_);
|
||||
int vw = xf::text_width(stVal, val);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, cx - vw / 2, cy + r - 18, val);
|
||||
// Title inside the dial, below the top numerals (audit G3).
|
||||
int tw2 = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, cx - tw2 / 2, cy - (int)(r * 0.43), text_); // audit G3: below the top numerals, clear of them
|
||||
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -82,6 +82,11 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit G6: face label white on the red/green/amber face, 18 px;
|
||||
// title 16 px at the foot.
|
||||
SStyle stFace = st; stFace.font_ = xframe::inst_cap_font(display_, 18);
|
||||
stFace.text_color_ = styles_->get_color_rgb(255, 255, 255);
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
@@ -104,8 +109,8 @@ public:
|
||||
XFillArc(display_, window_, gc_, cx - r + 16, cy - r + 16 + dy, 2 * r - 32, 2 * r - 32, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, cx - r, cy - r + dy, 2 * r, 2 * r, 0, 360 * 64);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - r, cy - 12 + dy, cx + r, cy + 12 + dy, on_ ? "ON" : "PUSH");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stFace, cx - r, cy - 16 + dy, cx + r, cy + 16 + dy, on_ ? "ON" : "PUSH");
|
||||
xf::draw_text_centered(display_, window_, gc_, stTitle, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -80,6 +80,11 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit G6: face label white on the red/green/amber face, 18 px;
|
||||
// title 16 px at the foot.
|
||||
SStyle stFace = st; stFace.font_ = xframe::inst_cap_font(display_, 18);
|
||||
stFace.text_color_ = styles_->get_color_rgb(255, 255, 255);
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
@@ -101,8 +106,8 @@ public:
|
||||
XFillArc(display_, window_, gc_, cx - r + 16, cy - r + 16 + dy, 2 * r - 32, 2 * r - 32, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, cx - r, cy - r + dy, 2 * r, 2 * r, 0, 360 * 64);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - r, cy - 12 + dy, cx + r, cy + 12 + dy, on_ ? "IN" : "OUT");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stFace, cx - r, cy - 16 + dy, cx + r, cy + 16 + dy, on_ ? "IN" : "OUT");
|
||||
xf::draw_text_centered(display_, window_, gc_, stTitle, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -102,6 +102,11 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: swatches 24 px, R/G/B letters white 14 px inside them,
|
||||
// "RGB" 16 px at the foot.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
SStyle stLabWhite = stLab; stLabWhite.text_color_ = styles_->get_color_rgb(255, 255, 255);
|
||||
SStyle stRgb = st; stRgb.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long dark = styles_->get_color_rgb(dark_color_.r, dark_color_.g, dark_color_.b);
|
||||
XSetForeground(display_, gc_, white);
|
||||
@@ -125,19 +130,20 @@ public:
|
||||
unsigned long cols[3] = {styles_->get_color_rgb(red_channel_color_.r, red_channel_color_.g, red_channel_color_.b),
|
||||
styles_->get_color_rgb(green_channel_color_.r, green_channel_color_.g, green_channel_color_.b),
|
||||
styles_->get_color_rgb(blue_channel_color_.r, blue_channel_color_.g, blue_channel_color_.b)};
|
||||
int sq = 20;
|
||||
int sy = y2_ - 40;
|
||||
int sq = 24;
|
||||
int sy = y2_ - 52;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
int sx = cx - 33 + i * 24;
|
||||
int sx = cx - 39 + i * 28;
|
||||
XSetForeground(display_, gc_, ch[i] ? cols[i] : dark);
|
||||
XFillRectangle(display_, window_, gc_, sx, sy, sq, sq);
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(swatch_outline_color_.r, swatch_outline_color_.g, swatch_outline_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, sx, sy, sq, sq);
|
||||
int twl = xf::text_width(st, labs[i]);
|
||||
xf::draw_text_at(display_, window_, gc_, st, sx + (sq - twl) / 2, sy + 15, labs[i]);
|
||||
// White letter centred on its swatch (audit G6: the old dark
|
||||
// letters were invisible on the dark swatches).
|
||||
xf::draw_text_centered(display_, window_, gc_, stLabWhite, sx, sy, sx + sq, sy + sq, labs[i]);
|
||||
}
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 6, text_);
|
||||
int tw = xf::text_width(stRgb, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stRgb, cx - tw / 2, y2_ - 8, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -83,6 +83,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: state labels 16 px bold, boxes widened to fit.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
@@ -110,9 +112,9 @@ public:
|
||||
XDrawRectangle(display_, window_, gc_, bx, by + shift, bw, bh);
|
||||
XSetForeground(display_, gc_, amber);
|
||||
XDrawLine(display_, window_, gc_, bx + 8, by + bh / 2 + shift, bx + bw - 8, by + bh / 2 + shift);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by - 34, bx + bw, by - 10, "I ON");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by + bh + 12, bx + bw, by + bh + 36, "O OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by - 36, bx + bw, by - 8, "I ON");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by + bh + 10, bx + bw, by + bh + 38, "O OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -96,6 +96,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: state labels 16 px bold, boxes widened to fit.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long rocker = styles_->get_color_rgb(rocker_color_.r, rocker_color_.g, rocker_color_.b);
|
||||
@@ -119,10 +121,10 @@ public:
|
||||
XSetForeground(display_, gc_, amber);
|
||||
XDrawLine(display_, window_, gc_, bx + 8, by + bh / 2 + shift, bx + bw - 8, by + bh / 2 + shift);
|
||||
std::string pos = (pos_ > 0) ? "UP ON" : (pos_ < 0) ? "DOWN ON" : "CENTRE OFF";
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by + shift + 100, bx + bw, by + shift + 126, pos);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by - 34, bx + bw, by - 10, "UP");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by + bh + 12, bx + bw, by + bh + 36, "DOWN");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by + shift + 100, bx + bw, by + shift + 126, pos);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by - 36, bx + bw, by - 8, "UP");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by + bh + 10, bx + bw, by + bh + 38, "DOWN");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: state labels 16 px bold, boxes widened to fit.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long rocker = styles_->get_color_rgb(rocker_color_.r, rocker_color_.g, rocker_color_.b);
|
||||
@@ -117,10 +119,10 @@ public:
|
||||
XSetForeground(display_, gc_, green);
|
||||
XDrawRectangle(display_, window_, gc_, lx - 4, ly - 4, lw + 8, lh + 8);
|
||||
}
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by + shift + 90, bx + bw, by + shift + 116, on_ ? "ON" : "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by - 34, bx + bw, by - 10, "I ON");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, bx, by + bh + 12, bx + bw, by + bh + 36, "O OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by + shift + 90, bx + bw, by + shift + 116, on_ ? "ON" : "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by - 36, bx + bw, by - 8, "I ON");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, bx, by + bh + 10, bx + bw, by + bh + 38, "O OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -90,6 +90,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: position numerals 16 px (was ~10 px), POS + title 16 px.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
@@ -110,7 +114,8 @@ public:
|
||||
int tx = cx + (int)((r + 34) * std::cos(a));
|
||||
int ty = cy + (int)((r + 34) * std::sin(a)) + 5;
|
||||
std::string lab = std::to_string(i);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx - 4, ty, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx - tw / 2, ty + numAsc / 2 - 5, lab);
|
||||
int mx = cx + (int)((r - 6) * std::cos(a));
|
||||
int my = cy + (int)((r - 6) * std::sin(a));
|
||||
XSetForeground(display_, gc_, dark);
|
||||
@@ -128,8 +133,8 @@ public:
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, cx - 26, cy - 26, 52, 52, 0, 360 * 64);
|
||||
std::string pos = "POS " + std::to_string(position_) + " / " + std::to_string(positions_);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - 110, cy + r + 44, cx + 110, cy + r + 68, pos);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, cx - 110, cy + r + 44, cx + 110, cy + r + 68, pos);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 1;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg14Display1"; text_ = "InstSeg14Display1";
|
||||
name_ = "InstSeg14Display1"; text_ = "";
|
||||
}
|
||||
~InstSeg14Display1() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,22 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
// Name label clipped to the widget bounds: at the 18 px bold
|
||||
// instrumentation font the full name is wider than the narrowest
|
||||
// displays, and without the clip it would overwrite neighbours.
|
||||
XRectangle label_clip = { (short)x1_, (short)y1_, (unsigned short)width(), (unsigned short)height() };
|
||||
XSetClipRectangles(display_, gc_, 0, 0, &label_clip, 1, Unsorted);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
XSetClipMask(display_, gc_, None);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 2;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg14Display2"; text_ = "InstSeg14Display2";
|
||||
name_ = "InstSeg14Display2"; text_ = "";
|
||||
}
|
||||
~InstSeg14Display2() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,22 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
// Name label clipped to the widget bounds: at the 18 px bold
|
||||
// instrumentation font the full name is wider than the narrowest
|
||||
// displays, and without the clip it would overwrite neighbours.
|
||||
XRectangle label_clip = { (short)x1_, (short)y1_, (unsigned short)width(), (unsigned short)height() };
|
||||
XSetClipRectangles(display_, gc_, 0, 0, &label_clip, 1, Unsorted);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
XSetClipMask(display_, gc_, None);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 3;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg14Display3"; text_ = "InstSeg14Display3";
|
||||
name_ = "InstSeg14Display3"; text_ = "";
|
||||
}
|
||||
~InstSeg14Display3() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 4;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg14Display4"; text_ = "InstSeg14Display4";
|
||||
name_ = "InstSeg14Display4"; text_ = "";
|
||||
}
|
||||
~InstSeg14Display4() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 5;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg14Display5"; text_ = "InstSeg14Display5";
|
||||
name_ = "InstSeg14Display5"; text_ = "";
|
||||
}
|
||||
~InstSeg14Display5() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 6;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg14Display6"; text_ = "InstSeg14Display6";
|
||||
name_ = "InstSeg14Display6"; text_ = "";
|
||||
}
|
||||
~InstSeg14Display6() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 1;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg16Display1"; text_ = "InstSeg16Display1";
|
||||
name_ = "InstSeg16Display1"; text_ = "";
|
||||
}
|
||||
~InstSeg16Display1() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,22 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
// Name label clipped to the widget bounds: at the 18 px bold
|
||||
// instrumentation font the full name is wider than the narrowest
|
||||
// displays, and without the clip it would overwrite neighbours.
|
||||
XRectangle label_clip = { (short)x1_, (short)y1_, (unsigned short)width(), (unsigned short)height() };
|
||||
XSetClipRectangles(display_, gc_, 0, 0, &label_clip, 1, Unsorted);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
XSetClipMask(display_, gc_, None);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 2;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg16Display2"; text_ = "InstSeg16Display2";
|
||||
name_ = "InstSeg16Display2"; text_ = "";
|
||||
}
|
||||
~InstSeg16Display2() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,22 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
// Name label clipped to the widget bounds: at the 18 px bold
|
||||
// instrumentation font the full name is wider than the narrowest
|
||||
// displays, and without the clip it would overwrite neighbours.
|
||||
XRectangle label_clip = { (short)x1_, (short)y1_, (unsigned short)width(), (unsigned short)height() };
|
||||
XSetClipRectangles(display_, gc_, 0, 0, &label_clip, 1, Unsorted);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
XSetClipMask(display_, gc_, None);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 3;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg16Display3"; text_ = "InstSeg16Display3";
|
||||
name_ = "InstSeg16Display3"; text_ = "";
|
||||
}
|
||||
~InstSeg16Display3() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 4;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg16Display4"; text_ = "InstSeg16Display4";
|
||||
name_ = "InstSeg16Display4"; text_ = "";
|
||||
}
|
||||
~InstSeg16Display4() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 5;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg16Display5"; text_ = "InstSeg16Display5";
|
||||
name_ = "InstSeg16Display5"; text_ = "";
|
||||
}
|
||||
~InstSeg16Display5() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
else if (seg == "g2") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx, midy - t / 2, hw, t); }
|
||||
else if (seg == "i") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, y + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "l") { XSetForeground(display_, gc_, col); XFillRectangle(display_, window_, gc_, midx - t / 2, midy + t, t, std::max(1, h / 2 - 2 * t)); }
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, t, col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, t, col);
|
||||
else if (seg == "h") draw_diag(x + t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "j") draw_diag(x + w - t, y + t, midx, midy - t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "k") draw_diag(x + t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
else if (seg == "m") draw_diag(x + w - t, y + h - t, midx, midy + t, std::max(2, t * 2 / 3), col);
|
||||
}
|
||||
void draw_digit(int x, int y, int w, int h, int t, char ch,
|
||||
unsigned long lit, unsigned long dim) {
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
Srgb bg_color_ = {12, 12, 14};
|
||||
Srgb bezel_color_ = {58, 58, 62};
|
||||
Srgb lit_color_ = {255, 176, 0};
|
||||
Srgb dim_color_ = {60, 42, 8};
|
||||
Srgb dim_color_ = {26, 20, 10}; // audit G5: unlit segments very dim, never brown blocks
|
||||
Srgb label_color_ = {170, 170, 170};
|
||||
public:
|
||||
static constexpr int kDigits = 6;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
int x, int y, int width, int height) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSeg16Display6"; text_ = "InstSeg16Display6";
|
||||
name_ = "InstSeg16Display6"; text_ = "";
|
||||
}
|
||||
~InstSeg16Display6() {}
|
||||
void set_bounds(int x, int y, int width, int height) { x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height; }
|
||||
@@ -276,16 +276,16 @@ public:
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
unsigned long lit = styles_->get_color_rgb(lit_color_.r, lit_color_.g, lit_color_.b);
|
||||
unsigned long dim = styles_->get_color_rgb(dim_color_.r, dim_color_.g, dim_color_.b);
|
||||
unsigned long label_col = styles_->get_color_rgb(label_color_.r, label_color_.g, label_color_.b);
|
||||
XSetForeground(display_, gc_, bg);
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
XSetForeground(display_, gc_, bezel);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width() - 1, height() - 1);
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 2, y1_ + 2, width() - 5, height() - 5);
|
||||
XSetForeground(display_, gc_, label_col);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 6, y1_ + 12, text_);
|
||||
int label_h = 16;
|
||||
int ax = x1_ + 6, ay = y1_ + label_h + 4, aw = width() - 12, ah = height() - label_h - 10;
|
||||
// No name label (audit G2: the class-name default is gone); the
|
||||
// digits fill the widget, centred (audit G4: 70-80% of height).
|
||||
int ax = x1_ + 6, aw = width() - 12;
|
||||
int ah = (int)(height() * 0.78);
|
||||
int ay = y1_ + (height() - ah) / 2;
|
||||
if (aw >= 10 && ah >= 10) {
|
||||
int gap = 4;
|
||||
bool has_dp = value_.find('.') != std::string::npos;
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(45)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSightGlassLevel"; text_ = "InstSightGlassLevel";
|
||||
name_ = "InstSightGlassLevel"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstSightGlassLevel() {}
|
||||
@@ -108,6 +108,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -119,7 +123,7 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
int tx = x1_ + 120;
|
||||
int ty = y1_ + 40;
|
||||
int tw = 40;
|
||||
int tw = 64; // audit: tube widened 40->64 px
|
||||
int th = height() - 120;
|
||||
unsigned long steel = styles_->get_color_rgb(steel_color_.r, steel_color_.g, steel_color_.b);
|
||||
XSetForeground(display_, gc_, steel);
|
||||
@@ -142,21 +146,24 @@ public:
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, tx - 4 - len, gy, tx - 4, gy);
|
||||
if (v % 25 == 0) {
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx - 52, gy + 4, std::to_string(v));
|
||||
std::string lab = std::to_string(v);
|
||||
int lw = xf::text_width(stNum, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx - 8 - lw, gy + numAsc / 2, lab);
|
||||
}
|
||||
}
|
||||
auto mark = [&](double pct, unsigned long c, const char* lab) {
|
||||
int gy = ty + th - (int)(th * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, tx, gy, tx + tw, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 10, gy + 4, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, tx + tw + 10, gy + 9, lab);
|
||||
};
|
||||
mark(bands_.hi_hi, red, "HI-HI");
|
||||
mark(bands_.hi, amber, "HI");
|
||||
mark(bands_.lo, amber, "LO");
|
||||
mark(bands_.lo_lo, red, "LO-LO");
|
||||
std::string pct = fmt(level_) + "%";
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 10, ty + th + 34, pct);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, tx + tw + 10, ty + th + 40, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -81,6 +81,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: OFF/ON 16 px bold, boxes widened; title 16 px.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
@@ -98,17 +100,17 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, tx - 12, ty - 12, tw + 24, th + 24);
|
||||
XSetForeground(display_, gc_, panel);
|
||||
XFillRectangle(display_, window_, gc_, tx, ty, tw, th);
|
||||
int kw = 90;
|
||||
int kw = 110; // audit: wider knob to match 16 px OFF/ON labels
|
||||
int kx = on_ ? tx + tw - kw - 6 : tx + 6;
|
||||
XSetForeground(display_, gc_, on_ ? green : rocker);
|
||||
XFillRectangle(display_, window_, gc_, kx, ty + 6, kw, th - 12);
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawRectangle(display_, window_, gc_, kx, ty + 6, kw, th - 12);
|
||||
XSetForeground(display_, gc_, amber);
|
||||
XDrawLine(display_, window_, gc_, kx + kw / 2 - 14, ty + th / 2, kx + kw / 2 + 14, ty + th / 2);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, tx, ty - 34, tx + 90, ty - 10, "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, tx + tw - 90, ty - 34, tx + tw, ty - 10, "ON");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XDrawLine(display_, window_, gc_, kx + kw / 2 - 20, ty + th / 2, kx + kw / 2 + 20, ty + th / 2); // audit: grip line widened with the 110 px knob
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, tx, ty - 36, tx + 110, ty - 8, "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, tx + tw - 110, ty - 36, tx + tw, ty - 8, "ON");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(44)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstSphericalTankLevel"; text_ = "InstSphericalTankLevel";
|
||||
name_ = "InstSphericalTankLevel"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstSphericalTankLevel() {}
|
||||
@@ -105,6 +105,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -135,21 +139,25 @@ public:
|
||||
int gy = cy + r - (int)(2.0 * r * v / 100.0);
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, cx + r + 4, gy, cx + r + 14, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx + r + 18, gy + 4, std::to_string(v));
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, cx + r + 18, gy + numAsc / 2, std::to_string(v));
|
||||
}
|
||||
auto mark = [&](double pct, unsigned long c, const char* lab) {
|
||||
int gy = cy + r - (int)(2.0 * r * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, cx - r, gy, cx + r, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - r - 52, gy + 4, lab);
|
||||
// Right-aligned ending cx-r-8 so 14 px names stay clear
|
||||
// of the sphere (audit G7).
|
||||
int aw = xf::text_width(stLab, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, cx - r - 8 - aw, gy + 9, lab);
|
||||
};
|
||||
mark(bands_.hi_hi, red, "HI-HI");
|
||||
mark(bands_.hi, amber, "HI");
|
||||
mark(bands_.lo, amber, "LO");
|
||||
mark(bands_.lo_lo, red, "LO-LO");
|
||||
std::string pct = fmt(level_) + "%";
|
||||
int pw2 = xf::text_width(st, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - pw2 / 2, cy - r - 16, pct);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
int pw2 = xf::text_width(stVal, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, cx - pw2 / 2, cy - r - 18, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -92,9 +92,14 @@ public:
|
||||
XFillRectangle(display_, window_, gc_, x, y, w, h);
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(tier_outline_color_.r, tier_outline_color_.g, tier_outline_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x, y, w, h);
|
||||
// Audit G6: tier letter white (lit) / light grey (unlit), 24 px
|
||||
// bold, centred on the tier.
|
||||
SStyle st = style();
|
||||
int tw = xf::text_width(st, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x + (w - tw) / 2, y + h / 2 + 5, lab);
|
||||
SStyle stLetter = st;
|
||||
stLetter.font_ = xframe::inst_cap_font(display_, 24);
|
||||
stLetter.text_color_ = t.on ? styles_->get_color_rgb(255, 255, 255) : styles_->get_color_rgb(200, 200, 200);
|
||||
int tw = xf::text_width(stLetter, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLetter, x + (w - tw) / 2, y + h / 2 + 8, lab);
|
||||
}
|
||||
|
||||
// Exposed draw colours/state (Group D getter/setter pass).
|
||||
@@ -126,12 +131,13 @@ public:
|
||||
draw_tier(cx - tw2 / 2, tier_y(1), tw2, th, amber_, amber_color_.r, amber_color_.g, amber_color_.b, "A");
|
||||
draw_tier(cx - tw2 / 2, tier_y(2), tw2, th, green_, green_color_.r, green_color_.g, green_color_.b, "G");
|
||||
int pole_top = tier_y(2) + th + 4;
|
||||
int pole_bot = std::max(pole_top + 1, y2_ - 30);
|
||||
int pole_bot = std::max(pole_top + 1, y2_ - 48); // audit G7: base raised so the 16 px STACK title clears it
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XFillRectangle(display_, window_, gc_, cx - 4, pole_top, 8, pole_bot - pole_top);
|
||||
XFillRectangle(display_, window_, gc_, cx - 50, y2_ - 30, 100, 12);
|
||||
int tw = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, y2_ - 6, text_);
|
||||
XFillRectangle(display_, window_, gc_, cx - 50, y2_ - 48, 100, 12);
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
int tw = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, cx - tw / 2, y2_ - 8, text_);
|
||||
if (hovered_ || focused_) {
|
||||
XSetForeground(display_, gc_, styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b));
|
||||
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, height() - 2);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(47)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstTankLevelAlarms"; text_ = "InstTankLevelAlarms";
|
||||
name_ = "InstTankLevelAlarms"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstTankLevelAlarms() {}
|
||||
@@ -105,6 +105,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -131,24 +135,25 @@ public:
|
||||
int gy = ty + th - (int)(th * v / 100.0);
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, tx + tw + 4, gy, tx + tw + 14, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 18, gy + 4, std::to_string(v));
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx + tw + 18, gy + numAsc / 2, std::to_string(v));
|
||||
}
|
||||
auto lamp = [&](double pct, unsigned long c, const char* lab, bool active) {
|
||||
int gy = ty + th - (int)(th * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, tx, gy, tx + tw, gy);
|
||||
int lx = tx + tw + 64;
|
||||
if (active) XFillArc(display_, window_, gc_, lx, gy - 7, 14, 14, 0, 360 * 64);
|
||||
else XDrawArc(display_, window_, gc_, lx, gy - 7, 14, 14, 0, 360 * 64);
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx + 20, gy + 4, lab);
|
||||
if (active) XFillArc(display_, window_, gc_, lx, gy - 7, 16, 16, 0, 360 * 64);
|
||||
else XDrawArc(display_, window_, gc_, lx, gy - 7, 16, 16, 0, 360 * 64);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, lx + 24, gy + 9, lab);
|
||||
};
|
||||
lamp(bands_.hi_hi, red, "HI-HI", level_ >= bands_.hi_hi);
|
||||
lamp(bands_.hi, amber, "HI", level_ >= bands_.hi);
|
||||
lamp(bands_.lo, amber, "LO", level_ <= bands_.lo);
|
||||
lamp(bands_.lo_lo, red, "LO-LO", level_ <= bands_.lo_lo);
|
||||
std::string pct = fmt(level_) + "%";
|
||||
int pw2 = xf::text_width(st, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + (tw - pw2) / 2, ty + th + 18, pct);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
int pw2 = xf::text_width(stVal, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, tx + (tw - pw2) / 2, ty + th + 26, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -96,6 +96,13 @@ public:
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2;
|
||||
int r = std::min(width(), height()) / 2 - 10;
|
||||
// Audit G1/G3: numerals 7-8% of dial diameter (bold), title inside
|
||||
// the dial below the top numerals, value below the hub.
|
||||
int numCap = std::max(14, r / 7);
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, numCap);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
XSetForeground(display_, gc_, face);
|
||||
XFillArc(display_, window_, gc_, cx - r, cy - r, 2 * r, 2 * r, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
@@ -112,10 +119,10 @@ public:
|
||||
XDrawLine(display_, window_, gc_, tx1, ty1, tx2, ty2);
|
||||
if (i % 2 == 0) {
|
||||
std::string lab = fmt(min_ + f * (max_ - min_));
|
||||
int tw = xf::text_width(st, lab);
|
||||
int lx = cx + (int)((r - 26) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - 26) * std::sin(ang)) + 4;
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx, ly, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
int lx = cx + (int)((r - numCap - 14) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - numCap - 14) * std::sin(ang)) + numAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, lx, ly, lab);
|
||||
}
|
||||
}
|
||||
double nang = (225.0 - 270.0 * fraction()) * pi / 180.0;
|
||||
@@ -128,10 +135,11 @@ public:
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XFillArc(display_, window_, gc_, cx - 5, cy - 5, 10, 10, 0, 360 * 64);
|
||||
std::string val = fmt(value_) + " C";
|
||||
int vw = xf::text_width(st, val);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - vw / 2, cy + r - 16, val);
|
||||
int tw2 = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw2 / 2, y1_ + 16, text_);
|
||||
int vw = xf::text_width(stVal, val);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, cx - vw / 2, cy + r - 18, val);
|
||||
// Title inside the dial, below the top numerals (audit G3).
|
||||
int tw2 = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, cx - tw2 / 2, cy - (int)(r * 0.43), text_); // audit G3: below the top numerals, clear of them
|
||||
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: state 16 px, title 16 px bold.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
@@ -120,8 +122,8 @@ public:
|
||||
XFillArc(display_, window_, gc_, cx - 18, cy - 18, 36, 36, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, cx - 26, cy - 26, 52, 52, 0, 360 * 64);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - 110, cy - 130, cx + 110, cy - 106, on_ ? "ON" : "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, cx - 110, cy - 132, cx + 110, cy - 104, on_ ? "ON" : "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: state 16 px, title 16 px bold.
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 16);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long panel = styles_->get_color_rgb(panel_color_.r, panel_color_.g, panel_color_.b);
|
||||
unsigned long bezel = styles_->get_color_rgb(bezel_color_.r, bezel_color_.g, bezel_color_.b);
|
||||
@@ -120,8 +122,8 @@ public:
|
||||
XFillArc(display_, window_, gc_, cx - 18, cy - 18, 36, 36, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, dark);
|
||||
XDrawArc(display_, window_, gc_, cx - 26, cy - 26, 52, 52, 0, 360 * 64);
|
||||
xf::draw_text_centered(display_, window_, gc_, st, cx - 110, cy - 130, cx + 110, cy - 106, on_ ? "ON" : "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, st, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, cx - 110, cy - 132, cx + 110, cy - 104, on_ ? "ON" : "OFF");
|
||||
xf::draw_text_centered(display_, window_, gc_, stLab, x1_, y2_ - 28, x2_, y2_ - 6, text_);
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
if (focused_) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
int x, int y, int width, int height, double level = xframe::inst_demo_level(42)) {
|
||||
display_ = display; screen_ = screen; window_ = window; gc_ = gc; styles_ = styles;
|
||||
x1_ = x; y1_ = y; x2_ = x + width; y2_ = y + height;
|
||||
name_ = "InstVerticalTankLevel"; text_ = "InstVerticalTankLevel";
|
||||
name_ = "InstVerticalTankLevel"; text_ = "";
|
||||
level_ = xframe::inst_clamp_level(level);
|
||||
}
|
||||
~InstVerticalTankLevel() {}
|
||||
@@ -105,6 +105,10 @@ public:
|
||||
void draw() {
|
||||
if (!visible_) return;
|
||||
SStyle st = style();
|
||||
// Audit: scale 16 px, word labels 14 px bold.
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, 16);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stLab = st; stLab.font_ = xframe::inst_cap_font_prop(display_, 14);
|
||||
unsigned long white = styles_->get_color_rgb(white_color_.r, white_color_.g, white_color_.b);
|
||||
unsigned long ink = styles_->get_color_rgb(ink_color_.r, ink_color_.g, ink_color_.b);
|
||||
unsigned long pale = styles_->get_color_rgb(pale_color_.r, pale_color_.g, pale_color_.b);
|
||||
@@ -132,21 +136,22 @@ public:
|
||||
int gy = ty + th - (int)(th * v / 100.0);
|
||||
XSetForeground(display_, gc_, grid);
|
||||
XDrawLine(display_, window_, gc_, tx + tw + 4, gy, tx + tw + 14, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 18, gy + 4, std::to_string(v));
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, tx + tw + 18, gy + numAsc / 2, std::to_string(v));
|
||||
}
|
||||
auto mark = [&](double pct, unsigned long c, const char* lab) {
|
||||
int gy = ty + th - (int)(th * pct / 100.0);
|
||||
XSetForeground(display_, gc_, c);
|
||||
XDrawLine(display_, window_, gc_, tx, gy, tx + tw, gy);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + tw + 52, gy + 4, lab);
|
||||
xf::draw_text_at(display_, window_, gc_, stLab, tx + tw + 52, gy + 9, lab);
|
||||
};
|
||||
mark(bands_.hi_hi, red, "HI-HI");
|
||||
mark(bands_.hi, amber, "HI");
|
||||
mark(bands_.lo, amber, "LO");
|
||||
mark(bands_.lo_lo, red, "LO-LO");
|
||||
std::string pct = fmt(level_) + "%";
|
||||
int pw2 = xf::text_width(st, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, tx + (tw - pw2) / 2, ty + th + 18, pct);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
int pw2 = xf::text_width(stVal, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, tx + (tw - pw2) / 2, ty + th + 26, pct);
|
||||
xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 16, text_);
|
||||
XSetForeground(display_, gc_, hovered_ ? styles_->get_color_rgb(hover_color_.r, hover_color_.g, hover_color_.b) : st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
@@ -96,6 +96,13 @@ public:
|
||||
int cx = (x1_ + x2_) / 2;
|
||||
int cy = (y1_ + y2_) / 2;
|
||||
int r = std::min(width(), height()) / 2 - 10;
|
||||
// Audit G1/G3: numerals 7-8% of dial diameter (bold), title inside
|
||||
// the dial below the top numerals, value below the hub.
|
||||
int numCap = std::max(14, r / 7);
|
||||
SStyle stNum = st; stNum.font_ = xframe::inst_cap_font(display_, numCap);
|
||||
int numAsc = stNum.font_ ? stNum.font_->ascent : 13;
|
||||
SStyle stTitle = st; stTitle.font_ = xframe::inst_cap_font_prop(display_, 17);
|
||||
SStyle stVal = st; stVal.font_ = xframe::inst_cap_font(display_, 18);
|
||||
XSetForeground(display_, gc_, face);
|
||||
XFillArc(display_, window_, gc_, cx - r, cy - r, 2 * r, 2 * r, 0, 360 * 64);
|
||||
XSetForeground(display_, gc_, ink);
|
||||
@@ -112,10 +119,10 @@ public:
|
||||
XDrawLine(display_, window_, gc_, tx1, ty1, tx2, ty2);
|
||||
if (i % 2 == 0) {
|
||||
std::string lab = fmt(min_ + f * (max_ - min_));
|
||||
int tw = xf::text_width(st, lab);
|
||||
int lx = cx + (int)((r - 26) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - 26) * std::sin(ang)) + 4;
|
||||
xf::draw_text_at(display_, window_, gc_, st, lx, ly, lab);
|
||||
int tw = xf::text_width(stNum, lab);
|
||||
int lx = cx + (int)((r - numCap - 14) * std::cos(ang)) - tw / 2;
|
||||
int ly = cy - (int)((r - numCap - 14) * std::sin(ang)) + numAsc / 2;
|
||||
xf::draw_text_at(display_, window_, gc_, stNum, lx, ly, lab);
|
||||
}
|
||||
}
|
||||
double nang = (225.0 - 270.0 * fraction()) * pi / 180.0;
|
||||
@@ -128,10 +135,11 @@ public:
|
||||
XSetForeground(display_, gc_, ink);
|
||||
XFillArc(display_, window_, gc_, cx - 5, cy - 5, 10, 10, 0, 360 * 64);
|
||||
std::string val = fmt(value_) + " VU";
|
||||
int vw = xf::text_width(st, val);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - vw / 2, cy + r - 16, val);
|
||||
int tw2 = xf::text_width(st, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, st, cx - tw2 / 2, y1_ + 16, text_);
|
||||
int vw = xf::text_width(stVal, val);
|
||||
xf::draw_text_at(display_, window_, gc_, stVal, cx - vw / 2, cy + r - 18, val);
|
||||
// Title inside the dial, below the top numerals (audit G3).
|
||||
int tw2 = xf::text_width(stTitle, text_);
|
||||
xf::draw_text_at(display_, window_, gc_, stTitle, cx - tw2 / 2, cy - (int)(r * 0.43), text_); // audit G3: below the top numerals, clear of them
|
||||
|
||||
XSetForeground(display_, gc_, st.lineColor_);
|
||||
XDrawRectangle(display_, window_, gc_, x1_, y1_, width(), height());
|
||||
|
||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 611 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 645 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 678 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 683 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 699 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 1.7 KiB |