diff --git a/widgets/components/InstAnalogGauge/InstAnalogGauge.h b/widgets/components/InstAnalogGauge/InstAnalogGauge.h index 5f561d0..dd47ac0 100644 --- a/widgets/components/InstAnalogGauge/InstAnalogGauge.h +++ b/widgets/components/InstAnalogGauge/InstAnalogGauge.h @@ -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()); diff --git a/widgets/components/InstBarMeter/InstBarMeter.h b/widgets/components/InstBarMeter/InstBarMeter.h index dfc0c8d..63c8993 100644 --- a/widgets/components/InstBarMeter/InstBarMeter.h +++ b/widgets/components/InstBarMeter/InstBarMeter.h @@ -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_)); diff --git a/widgets/components/InstBeacon/InstBeacon.h b/widgets/components/InstBeacon/InstBeacon.h index ec4f637..b791f6a 100644 --- a/widgets/components/InstBeacon/InstBeacon.h +++ b/widgets/components/InstBeacon/InstBeacon.h @@ -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); diff --git a/widgets/components/InstBezel/InstBezel.h b/widgets/components/InstBezel/InstBezel.h index c33abc6..0923211 100644 --- a/widgets/components/InstBezel/InstBezel.h +++ b/widgets/components/InstBezel/InstBezel.h @@ -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); diff --git a/widgets/components/InstCircuitBreaker/InstCircuitBreaker.h b/widgets/components/InstCircuitBreaker/InstCircuitBreaker.h index ca6a8a3..cef3eb1 100644 --- a/widgets/components/InstCircuitBreaker/InstCircuitBreaker.h +++ b/widgets/components/InstCircuitBreaker/InstCircuitBreaker.h @@ -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_) { diff --git a/widgets/components/InstControlPanel/InstControlPanel.h b/widgets/components/InstControlPanel/InstControlPanel.h index ad2e631..ef8ff83 100644 --- a/widgets/components/InstControlPanel/InstControlPanel.h +++ b/widgets/components/InstControlPanel/InstControlPanel.h @@ -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); } } } diff --git a/widgets/components/InstData.h b/widgets/components/InstData.h index 3ab5a68..7e104f0 100644 --- a/widgets/components/InstData.h +++ b/widgets/components/InstData.h @@ -7,7 +7,12 @@ // Attribution: XFrame. #pragma once +#include #include +#include +#include +#include +#include #include @@ -75,8 +80,7 @@ inline double inst_demo_value(double min_v, double max_v, unsigned seed = 42) { // runs (same rationale as the SStyle_Manager comment in // core/xframe_core.h). Returns nullptr if no size loads, in which case // callers keep the style's own font. -inline XFontStruct* inst_bold_font(Display* display) { - if (!display) return nullptr; +inline XFontStruct* inst_bold_font(Display* display) { if (!display) return nullptr; static XFontStruct* cached = nullptr; static bool tried = false; if (tried) return cached; @@ -94,4 +98,149 @@ inline XFontStruct* inst_bold_font(Display* display) { return cached; } +// Scaled monitor fonts (Dec 5, 2026, monitor proportions audit): the C +// monitor widgets derive every font size from the widget's current +// dimensions, so they need core fonts at arbitrary pixel sizes, bold and +// medium. Probed Dec 5, 2026 on the dallas Xvfb: bitmap bold exists only +// at 13/14/15/18 px and bitmap medium only at 13/18/20 px, but the +// misc-fixed family is scalable — an XLFD with an explicit pixel size and +// wildcards for the remaining fields loads at that size (20/24/28 px +// verified for bold; the same pattern works for medium). So try the +// scalable XLFD at the requested size first, then bitmap fallbacks. +// Loaded fonts are cached per (size, weight) in a process-lifetime table +// and never XFreeFont'd (same rationale as inst_bold_font above). +// Returns nullptr when nothing loads; callers then keep the style font. +inline XFontStruct* scaled_font(Display* display, int px, bool bold) +{ + if (!display) return nullptr; + if (px < 8) px = 8; + if (px > 64) px = 64; + struct Entry + { + int px; + bool bold; + XFontStruct* font; + }; + static std::vector cache; + for (auto& e : cache) + if (e.px == px && e.bold == bold) return e.font; + XFontStruct* font = nullptr; + char name[96]; + // Scalable XLFD: explicit pixel size, wildcards elsewhere. + std::snprintf(name, sizeof(name), "-misc-fixed-%s-r-normal--%d-*-75-75-c-*-iso8859-1", + bold ? "bold" : "medium", px); + font = XLoadQueryFont(display, name); + if (!font) + { + // Bitmap fallbacks, nearest size first. + static const int kBoldFallbacks[] = {18, 20, 15, 14, 13}; + static const int kMediumFallbacks[] = {20, 18, 13}; + const int* fallbacks = bold ? kBoldFallbacks : kMediumFallbacks; + int n = bold ? 5 : 3; + for (int i = 0; i < n && !font; ++i) + { + std::snprintf(name, sizeof(name), "-misc-fixed-%s-r-normal--%d-*", + bold ? "bold" : "medium", fallbacks[i]); + font = XLoadQueryFont(display, name); + } + } + if (!font) font = XLoadQueryFont(display, "fixed"); + if ((int)cache.size() < 24) cache.push_back(Entry{px, bold, font}); + return font; +} + +// Width of `s` in `font` (XTextWidth), or 8 px/char when no font. +inline int font_text_width(XFontStruct* font, const std::string& s) +{ + if (!font) return (int)s.size() * 8; + return XTextWidth(font, s.c_str(), (int)s.size()); +} + +// Draw `s` at baseline (x, baseline_y) in `font` and foreground `fg`. +// No-op when the font failed to load. +inline void draw_text_font(Display* display, Window window, GC gc, XFontStruct* font, + int x, int baseline_y, const std::string& s, unsigned long fg) +{ + if (!font || s.empty()) return; + XSetFont(display, gc, font->fid); + XSetForeground(display, gc, fg); + XDrawString(display, window, gc, x, baseline_y, s.c_str(), (int)s.size()); +} + +// Clamp a derived font size: at least `lo` px, at most `hi` px. +inline int clamp_font_px(double px, int lo, int hi) +{ + int v = (int)std::lround(px); + if (v < lo) v = lo; + if (v > hi) v = 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 ("-...---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 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 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 diff --git a/widgets/components/InstDigitalReadout/InstDigitalReadout.h b/widgets/components/InstDigitalReadout/InstDigitalReadout.h index 0a44b91..69bbe1c 100644 --- a/widgets/components/InstDigitalReadout/InstDigitalReadout.h +++ b/widgets/components/InstDigitalReadout/InstDigitalReadout.h @@ -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); diff --git a/widgets/components/InstEmergencyStop/InstEmergencyStop.h b/widgets/components/InstEmergencyStop/InstEmergencyStop.h index de543cb..abb850a 100644 --- a/widgets/components/InstEmergencyStop/InstEmergencyStop.h +++ b/widgets/components/InstEmergencyStop/InstEmergencyStop.h @@ -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_) { diff --git a/widgets/components/InstFlowMeter/InstFlowMeter.h b/widgets/components/InstFlowMeter/InstFlowMeter.h index 1175b31..df2a87f 100644 --- a/widgets/components/InstFlowMeter/InstFlowMeter.h +++ b/widgets/components/InstFlowMeter/InstFlowMeter.h @@ -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()); diff --git a/widgets/components/InstHorizontalTankLevel/InstHorizontalTankLevel.h b/widgets/components/InstHorizontalTankLevel/InstHorizontalTankLevel.h index d876133..e3b1336 100644 --- a/widgets/components/InstHorizontalTankLevel/InstHorizontalTankLevel.h +++ b/widgets/components/InstHorizontalTankLevel/InstHorizontalTankLevel.h @@ -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()); diff --git a/widgets/components/InstKeySwitch/InstKeySwitch.h b/widgets/components/InstKeySwitch/InstKeySwitch.h index ffc3143..a051101 100644 --- a/widgets/components/InstKeySwitch/InstKeySwitch.h +++ b/widgets/components/InstKeySwitch/InstKeySwitch.h @@ -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_) { diff --git a/widgets/components/InstLampTestButton/InstLampTestButton.h b/widgets/components/InstLampTestButton/InstLampTestButton.h index 006e264..868a09d 100644 --- a/widgets/components/InstLampTestButton/InstLampTestButton.h +++ b/widgets/components/InstLampTestButton/InstLampTestButton.h @@ -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); diff --git a/widgets/components/InstLedBlue/InstLedBlue.h b/widgets/components/InstLedBlue/InstLedBlue.h index 0630ac6..a4081d0 100644 --- a/widgets/components/InstLedBlue/InstLedBlue.h +++ b/widgets/components/InstLedBlue/InstLedBlue.h @@ -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); diff --git a/widgets/components/InstLedDigits1/InstLedDigits1.h b/widgets/components/InstLedDigits1/InstLedDigits1.h index f3030b9..4f23c3d 100644 --- a/widgets/components/InstLedDigits1/InstLedDigits1.h +++ b/widgets/components/InstLedDigits1/InstLedDigits1.h @@ -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; diff --git a/widgets/components/InstLedDigits2/InstLedDigits2.h b/widgets/components/InstLedDigits2/InstLedDigits2.h index 8d8f8df..3882911 100644 --- a/widgets/components/InstLedDigits2/InstLedDigits2.h +++ b/widgets/components/InstLedDigits2/InstLedDigits2.h @@ -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; diff --git a/widgets/components/InstLedDigits3/InstLedDigits3.h b/widgets/components/InstLedDigits3/InstLedDigits3.h index 8d9ea24..944c145 100644 --- a/widgets/components/InstLedDigits3/InstLedDigits3.h +++ b/widgets/components/InstLedDigits3/InstLedDigits3.h @@ -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; diff --git a/widgets/components/InstLedDigits4/InstLedDigits4.h b/widgets/components/InstLedDigits4/InstLedDigits4.h index a083c6d..7f24597 100644 --- a/widgets/components/InstLedDigits4/InstLedDigits4.h +++ b/widgets/components/InstLedDigits4/InstLedDigits4.h @@ -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; diff --git a/widgets/components/InstLedDigits5/InstLedDigits5.h b/widgets/components/InstLedDigits5/InstLedDigits5.h index cc0f458..ef116b8 100644 --- a/widgets/components/InstLedDigits5/InstLedDigits5.h +++ b/widgets/components/InstLedDigits5/InstLedDigits5.h @@ -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; diff --git a/widgets/components/InstLedDigits6/InstLedDigits6.h b/widgets/components/InstLedDigits6/InstLedDigits6.h index fbfea63..c37d810 100644 --- a/widgets/components/InstLedDigits6/InstLedDigits6.h +++ b/widgets/components/InstLedDigits6/InstLedDigits6.h @@ -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; diff --git a/widgets/components/InstLedGreen/InstLedGreen.h b/widgets/components/InstLedGreen/InstLedGreen.h index 07a94cf..17ef8d2 100644 --- a/widgets/components/InstLedGreen/InstLedGreen.h +++ b/widgets/components/InstLedGreen/InstLedGreen.h @@ -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); diff --git a/widgets/components/InstLedRed/InstLedRed.h b/widgets/components/InstLedRed/InstLedRed.h index 4e10eec..5c60db7 100644 --- a/widgets/components/InstLedRed/InstLedRed.h +++ b/widgets/components/InstLedRed/InstLedRed.h @@ -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); diff --git a/widgets/components/InstLevelColumnGauge/InstLevelColumnGauge.h b/widgets/components/InstLevelColumnGauge/InstLevelColumnGauge.h index d929b95..8f98875 100644 --- a/widgets/components/InstLevelColumnGauge/InstLevelColumnGauge.h +++ b/widgets/components/InstLevelColumnGauge/InstLevelColumnGauge.h @@ -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()); diff --git a/widgets/components/InstLevelTransmitter/InstLevelTransmitter.h b/widgets/components/InstLevelTransmitter/InstLevelTransmitter.h index 7522795..c444354 100644 --- a/widgets/components/InstLevelTransmitter/InstLevelTransmitter.h +++ b/widgets/components/InstLevelTransmitter/InstLevelTransmitter.h @@ -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()); diff --git a/widgets/components/InstManometer/InstManometer.h b/widgets/components/InstManometer/InstManometer.h index 29fa90e..18a765e 100644 --- a/widgets/components/InstManometer/InstManometer.h +++ b/widgets/components/InstManometer/InstManometer.h @@ -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()); diff --git a/widgets/components/InstNameplate/InstNameplate.h b/widgets/components/InstNameplate/InstNameplate.h index 939e9cf..dfb8b94 100644 --- a/widgets/components/InstNameplate/InstNameplate.h +++ b/widgets/components/InstNameplate/InstNameplate.h @@ -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); diff --git a/widgets/components/InstNeedleEdgewise/InstNeedleEdgewise.h b/widgets/components/InstNeedleEdgewise/InstNeedleEdgewise.h index 6db0487..ee97b05 100644 --- a/widgets/components/InstNeedleEdgewise/InstNeedleEdgewise.h +++ b/widgets/components/InstNeedleEdgewise/InstNeedleEdgewise.h @@ -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); diff --git a/widgets/components/InstNeedleKnifeEdge/InstNeedleKnifeEdge.h b/widgets/components/InstNeedleKnifeEdge/InstNeedleKnifeEdge.h index c9b446b..bd5d56e 100644 --- a/widgets/components/InstNeedleKnifeEdge/InstNeedleKnifeEdge.h +++ b/widgets/components/InstNeedleKnifeEdge/InstNeedleKnifeEdge.h @@ -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); diff --git a/widgets/components/InstNeedleTapered/InstNeedleTapered.h b/widgets/components/InstNeedleTapered/InstNeedleTapered.h index f2a65b1..ef7ddda 100644 --- a/widgets/components/InstNeedleTapered/InstNeedleTapered.h +++ b/widgets/components/InstNeedleTapered/InstNeedleTapered.h @@ -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); diff --git a/widgets/components/InstNeedleVu/InstNeedleVu.h b/widgets/components/InstNeedleVu/InstNeedleVu.h index 12399df..f5b6047 100644 --- a/widgets/components/InstNeedleVu/InstNeedleVu.h +++ b/widgets/components/InstNeedleVu/InstNeedleVu.h @@ -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); diff --git a/widgets/components/InstOpenChannelLevel/InstOpenChannelLevel.h b/widgets/components/InstOpenChannelLevel/InstOpenChannelLevel.h index 1e7c191..6c5a1fc 100644 --- a/widgets/components/InstOpenChannelLevel/InstOpenChannelLevel.h +++ b/widgets/components/InstOpenChannelLevel/InstOpenChannelLevel.h @@ -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()); diff --git a/widgets/components/InstPanelLampAmber/InstPanelLampAmber.h b/widgets/components/InstPanelLampAmber/InstPanelLampAmber.h index 064d382..6c94b38 100644 --- a/widgets/components/InstPanelLampAmber/InstPanelLampAmber.h +++ b/widgets/components/InstPanelLampAmber/InstPanelLampAmber.h @@ -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); diff --git a/widgets/components/InstPanelLampBlue/InstPanelLampBlue.h b/widgets/components/InstPanelLampBlue/InstPanelLampBlue.h index 6c88860..70c9657 100644 --- a/widgets/components/InstPanelLampBlue/InstPanelLampBlue.h +++ b/widgets/components/InstPanelLampBlue/InstPanelLampBlue.h @@ -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); diff --git a/widgets/components/InstPanelLampGreen/InstPanelLampGreen.h b/widgets/components/InstPanelLampGreen/InstPanelLampGreen.h index 5e8c8fe..1ae200d 100644 --- a/widgets/components/InstPanelLampGreen/InstPanelLampGreen.h +++ b/widgets/components/InstPanelLampGreen/InstPanelLampGreen.h @@ -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); diff --git a/widgets/components/InstPanelLampRed/InstPanelLampRed.h b/widgets/components/InstPanelLampRed/InstPanelLampRed.h index 4d57cf5..c997bee 100644 --- a/widgets/components/InstPanelLampRed/InstPanelLampRed.h +++ b/widgets/components/InstPanelLampRed/InstPanelLampRed.h @@ -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); diff --git a/widgets/components/InstPanelLampWhite/InstPanelLampWhite.h b/widgets/components/InstPanelLampWhite/InstPanelLampWhite.h index 9590dbf..25f8fd1 100644 --- a/widgets/components/InstPanelLampWhite/InstPanelLampWhite.h +++ b/widgets/components/InstPanelLampWhite/InstPanelLampWhite.h @@ -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); diff --git a/widgets/components/InstPanelPlate/InstPanelPlate.h b/widgets/components/InstPanelPlate/InstPanelPlate.h index 3945089..f71a257 100644 --- a/widgets/components/InstPanelPlate/InstPanelPlate.h +++ b/widgets/components/InstPanelPlate/InstPanelPlate.h @@ -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); diff --git a/widgets/components/InstPressureGauge/InstPressureGauge.h b/widgets/components/InstPressureGauge/InstPressureGauge.h index 6ca7d64..e2f5681 100644 --- a/widgets/components/InstPressureGauge/InstPressureGauge.h +++ b/widgets/components/InstPressureGauge/InstPressureGauge.h @@ -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()); diff --git a/widgets/components/InstPushButton/InstPushButton.h b/widgets/components/InstPushButton/InstPushButton.h index e4efc4d..643885b 100644 --- a/widgets/components/InstPushButton/InstPushButton.h +++ b/widgets/components/InstPushButton/InstPushButton.h @@ -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_) { diff --git a/widgets/components/InstPushButtonLatching/InstPushButtonLatching.h b/widgets/components/InstPushButtonLatching/InstPushButtonLatching.h index 07f8c40..f5f5073 100644 --- a/widgets/components/InstPushButtonLatching/InstPushButtonLatching.h +++ b/widgets/components/InstPushButtonLatching/InstPushButtonLatching.h @@ -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_) { diff --git a/widgets/components/InstRgbStatusLed/InstRgbStatusLed.h b/widgets/components/InstRgbStatusLed/InstRgbStatusLed.h index e32eedd..f0b5eed 100644 --- a/widgets/components/InstRgbStatusLed/InstRgbStatusLed.h +++ b/widgets/components/InstRgbStatusLed/InstRgbStatusLed.h @@ -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); diff --git a/widgets/components/InstRockerSwitch/InstRockerSwitch.h b/widgets/components/InstRockerSwitch/InstRockerSwitch.h index 6955073..7c9b771 100644 --- a/widgets/components/InstRockerSwitch/InstRockerSwitch.h +++ b/widgets/components/InstRockerSwitch/InstRockerSwitch.h @@ -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_) { diff --git a/widgets/components/InstRockerSwitchDouble/InstRockerSwitchDouble.h b/widgets/components/InstRockerSwitchDouble/InstRockerSwitchDouble.h index 8487d49..8dd5e45 100644 --- a/widgets/components/InstRockerSwitchDouble/InstRockerSwitchDouble.h +++ b/widgets/components/InstRockerSwitchDouble/InstRockerSwitchDouble.h @@ -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_) { diff --git a/widgets/components/InstRockerSwitchIlluminated/InstRockerSwitchIlluminated.h b/widgets/components/InstRockerSwitchIlluminated/InstRockerSwitchIlluminated.h index fdb4090..d3c51ed 100644 --- a/widgets/components/InstRockerSwitchIlluminated/InstRockerSwitchIlluminated.h +++ b/widgets/components/InstRockerSwitchIlluminated/InstRockerSwitchIlluminated.h @@ -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_) { diff --git a/widgets/components/InstRotarySelector/InstRotarySelector.h b/widgets/components/InstRotarySelector/InstRotarySelector.h index 83c5770..e23e8c4 100644 --- a/widgets/components/InstRotarySelector/InstRotarySelector.h +++ b/widgets/components/InstRotarySelector/InstRotarySelector.h @@ -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_) { diff --git a/widgets/components/InstSeg14Display1/InstSeg14Display1.h b/widgets/components/InstSeg14Display1/InstSeg14Display1.h index cad9081..311990a 100644 --- a/widgets/components/InstSeg14Display1/InstSeg14Display1.h +++ b/widgets/components/InstSeg14Display1/InstSeg14Display1.h @@ -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; diff --git a/widgets/components/InstSeg14Display2/InstSeg14Display2.h b/widgets/components/InstSeg14Display2/InstSeg14Display2.h index eb43248..9cf2f4a 100644 --- a/widgets/components/InstSeg14Display2/InstSeg14Display2.h +++ b/widgets/components/InstSeg14Display2/InstSeg14Display2.h @@ -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; diff --git a/widgets/components/InstSeg14Display3/InstSeg14Display3.h b/widgets/components/InstSeg14Display3/InstSeg14Display3.h index 572075d..d7728ff 100644 --- a/widgets/components/InstSeg14Display3/InstSeg14Display3.h +++ b/widgets/components/InstSeg14Display3/InstSeg14Display3.h @@ -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; diff --git a/widgets/components/InstSeg14Display4/InstSeg14Display4.h b/widgets/components/InstSeg14Display4/InstSeg14Display4.h index 3ad833c..d8c7d5a 100644 --- a/widgets/components/InstSeg14Display4/InstSeg14Display4.h +++ b/widgets/components/InstSeg14Display4/InstSeg14Display4.h @@ -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; diff --git a/widgets/components/InstSeg14Display5/InstSeg14Display5.h b/widgets/components/InstSeg14Display5/InstSeg14Display5.h index 5d8b35a..35a44d4 100644 --- a/widgets/components/InstSeg14Display5/InstSeg14Display5.h +++ b/widgets/components/InstSeg14Display5/InstSeg14Display5.h @@ -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; diff --git a/widgets/components/InstSeg14Display6/InstSeg14Display6.h b/widgets/components/InstSeg14Display6/InstSeg14Display6.h index 9a3b288..b945065 100644 --- a/widgets/components/InstSeg14Display6/InstSeg14Display6.h +++ b/widgets/components/InstSeg14Display6/InstSeg14Display6.h @@ -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; diff --git a/widgets/components/InstSeg16Display1/InstSeg16Display1.h b/widgets/components/InstSeg16Display1/InstSeg16Display1.h index bf3f01b..6e1cea4 100644 --- a/widgets/components/InstSeg16Display1/InstSeg16Display1.h +++ b/widgets/components/InstSeg16Display1/InstSeg16Display1.h @@ -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; diff --git a/widgets/components/InstSeg16Display2/InstSeg16Display2.h b/widgets/components/InstSeg16Display2/InstSeg16Display2.h index c20f24b..97b7889 100644 --- a/widgets/components/InstSeg16Display2/InstSeg16Display2.h +++ b/widgets/components/InstSeg16Display2/InstSeg16Display2.h @@ -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; diff --git a/widgets/components/InstSeg16Display3/InstSeg16Display3.h b/widgets/components/InstSeg16Display3/InstSeg16Display3.h index 3096ae6..ed5c10f 100644 --- a/widgets/components/InstSeg16Display3/InstSeg16Display3.h +++ b/widgets/components/InstSeg16Display3/InstSeg16Display3.h @@ -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; diff --git a/widgets/components/InstSeg16Display4/InstSeg16Display4.h b/widgets/components/InstSeg16Display4/InstSeg16Display4.h index 526dd4b..e675bdd 100644 --- a/widgets/components/InstSeg16Display4/InstSeg16Display4.h +++ b/widgets/components/InstSeg16Display4/InstSeg16Display4.h @@ -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; diff --git a/widgets/components/InstSeg16Display5/InstSeg16Display5.h b/widgets/components/InstSeg16Display5/InstSeg16Display5.h index eb4c197..85d59c6 100644 --- a/widgets/components/InstSeg16Display5/InstSeg16Display5.h +++ b/widgets/components/InstSeg16Display5/InstSeg16Display5.h @@ -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; diff --git a/widgets/components/InstSeg16Display6/InstSeg16Display6.h b/widgets/components/InstSeg16Display6/InstSeg16Display6.h index 12e88f7..24ac8dc 100644 --- a/widgets/components/InstSeg16Display6/InstSeg16Display6.h +++ b/widgets/components/InstSeg16Display6/InstSeg16Display6.h @@ -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; diff --git a/widgets/components/InstSightGlassLevel/InstSightGlassLevel.h b/widgets/components/InstSightGlassLevel/InstSightGlassLevel.h index fc6ea46..c1dd2cb 100644 --- a/widgets/components/InstSightGlassLevel/InstSightGlassLevel.h +++ b/widgets/components/InstSightGlassLevel/InstSightGlassLevel.h @@ -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()); diff --git a/widgets/components/InstSlideSwitch/InstSlideSwitch.h b/widgets/components/InstSlideSwitch/InstSlideSwitch.h index 09a2660..4e4f6e3 100644 --- a/widgets/components/InstSlideSwitch/InstSlideSwitch.h +++ b/widgets/components/InstSlideSwitch/InstSlideSwitch.h @@ -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_) { diff --git a/widgets/components/InstSphericalTankLevel/InstSphericalTankLevel.h b/widgets/components/InstSphericalTankLevel/InstSphericalTankLevel.h index 67076dd..69b24b5 100644 --- a/widgets/components/InstSphericalTankLevel/InstSphericalTankLevel.h +++ b/widgets/components/InstSphericalTankLevel/InstSphericalTankLevel.h @@ -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()); diff --git a/widgets/components/InstStackLight/InstStackLight.h b/widgets/components/InstStackLight/InstStackLight.h index f6ce45f..656defc 100644 --- a/widgets/components/InstStackLight/InstStackLight.h +++ b/widgets/components/InstStackLight/InstStackLight.h @@ -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); diff --git a/widgets/components/InstTankLevelAlarms/InstTankLevelAlarms.h b/widgets/components/InstTankLevelAlarms/InstTankLevelAlarms.h index 5fd425a..1f012d1 100644 --- a/widgets/components/InstTankLevelAlarms/InstTankLevelAlarms.h +++ b/widgets/components/InstTankLevelAlarms/InstTankLevelAlarms.h @@ -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()); diff --git a/widgets/components/InstTemperatureGauge/InstTemperatureGauge.h b/widgets/components/InstTemperatureGauge/InstTemperatureGauge.h index b2887ea..6499e45 100644 --- a/widgets/components/InstTemperatureGauge/InstTemperatureGauge.h +++ b/widgets/components/InstTemperatureGauge/InstTemperatureGauge.h @@ -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()); diff --git a/widgets/components/InstToggleSwitch/InstToggleSwitch.h b/widgets/components/InstToggleSwitch/InstToggleSwitch.h index 905e3c4..b1df36a 100644 --- a/widgets/components/InstToggleSwitch/InstToggleSwitch.h +++ b/widgets/components/InstToggleSwitch/InstToggleSwitch.h @@ -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_) { diff --git a/widgets/components/InstToggleSwitchIlluminated/InstToggleSwitchIlluminated.h b/widgets/components/InstToggleSwitchIlluminated/InstToggleSwitchIlluminated.h index 359d6a8..76837ea 100644 --- a/widgets/components/InstToggleSwitchIlluminated/InstToggleSwitchIlluminated.h +++ b/widgets/components/InstToggleSwitchIlluminated/InstToggleSwitchIlluminated.h @@ -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_) { diff --git a/widgets/components/InstVerticalTankLevel/InstVerticalTankLevel.h b/widgets/components/InstVerticalTankLevel/InstVerticalTankLevel.h index 4daaf59..1bc0288 100644 --- a/widgets/components/InstVerticalTankLevel/InstVerticalTankLevel.h +++ b/widgets/components/InstVerticalTankLevel/InstVerticalTankLevel.h @@ -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()); diff --git a/widgets/components/InstVuMeter/InstVuMeter.h b/widgets/components/InstVuMeter/InstVuMeter.h index 847e9f2..e1aa879 100644 --- a/widgets/components/InstVuMeter/InstVuMeter.h +++ b/widgets/components/InstVuMeter/InstVuMeter.h @@ -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()); diff --git a/widgets/components/XArcGauge/XArcGauge.h b/widgets/components/XArcGauge/XArcGauge.h index ac4c8ab..1cfb749 100644 --- a/widgets/components/XArcGauge/XArcGauge.h +++ b/widgets/components/XArcGauge/XArcGauge.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -31,6 +32,7 @@ private: double value_ = 0.0; // 0..100 double warn_ = 70.0; // yellow starts here double crit_ = 90.0; // red starts here + std::string unit_ = "load"; // sub-label under the centre value Srgb white_color_{255, 255, 255}; Srgb axis_color_{150, 150, 150}; @@ -109,6 +111,8 @@ public: // region Gauge API void set_value(double v) { value_ = std::max(0.0, std::min(100.0, v)); } double get_value() { return value_; } + void set_unit(const std::string& u) { unit_ = u; } + std::string get_unit() { return unit_; } void set_zones(double warn, double crit) { warn_ = std::max(0.0, std::min(100.0, warn)); @@ -133,7 +137,26 @@ public: double wfrac = warn_ / 100.0; double cfrac = crit_ / 100.0; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + // Scaled fonts (Dec 5, 2026 proportions audit): centre value + // 40-48 px bold (9-11% of arc diameter), endpoints 16-18 px, + // title 16 px bold, "load" sub-label under the value. + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int value_px = xframe::clamp_font_px(0.10 * 2 * r, 16, 48); + int end_px = xframe::clamp_font_px(0.04 * 2 * r, 11, 18); + int sub_px = xframe::clamp_font_px(0.04 * 2 * r, 11, 18); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* value_font = xframe::scaled_font(display_, value_px, true); + if (!value_font) value_font = st.font_; + XFontStruct* end_font = xframe::scaled_font(display_, end_px, false); + if (!end_font) end_font = st.font_; + XFontStruct* sub_font = xframe::scaled_font(display_, sub_px, false); + if (!sub_font) sub_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int sub_asc = sub_font ? sub_font->ascent : 11; + + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); // Track + coloured zones. arc_slice(cx, cy, r, 0.0, 1.0, track_color_, 14); @@ -142,17 +165,30 @@ public: if (frac > cfrac) arc_slice(cx, cy, r, cfrac, frac, crit_color_, 14); // End labels 0 / 100. - draw_text_color(cx - r - 4, cy + 16, "0", Srgb{100, 100, 100}); - draw_text_color(cx + r - 12, cy + 16, "100", Srgb{100, 100, 100}); + xframe::draw_text_font(display_, window_, gc_, end_font, cx - r - 4, cy + 16, + "0", col(Srgb{100, 100, 100})); + { + std::string end100 = "100"; + int ew = xframe::font_text_width(end_font, end100); + xframe::draw_text_font(display_, window_, gc_, end_font, cx + r + 4 - ew, + cy + 16, end100, col(Srgb{100, 100, 100})); + } - // Big % in the middle. + // Big % in the middle + sub-label under it. char pct[16]; std::snprintf(pct, sizeof(pct), "%.0f%%", value_); Srgb pct_color = value_ >= crit_ ? crit_color_ : (value_ >= warn_ ? warn_color_ : ok_color_); - int pw = xf::text_width(st, pct); - // Fake a larger readout by drawing the text twice offset by 1 px. - draw_text_color(cx - pw / 2, cy - 8, pct, pct_color); - draw_text_color(cx - pw / 2 + 1, cy - 8, pct, pct_color); + int pw = xframe::font_text_width(value_font, pct); + int value_base = cy - (int)(r * 0.35); + xframe::draw_text_font(display_, window_, gc_, value_font, cx - pw / 2, + value_base, pct, col(pct_color)); + if (!unit_.empty()) + { + int uw = xframe::font_text_width(sub_font, unit_); + xframe::draw_text_font(display_, window_, gc_, sub_font, cx - uw / 2, + value_base + sub_asc + 10, unit_, + col(Srgb{100, 100, 100})); + } XSetForeground(display_, gc_, st.lineColor_); XDrawRectangle(display_, window_, gc_, x1_, y1_, w, h); diff --git a/widgets/components/XCoreGrid/XCoreGrid.h b/widgets/components/XCoreGrid/XCoreGrid.h index 99220cc..7c59452 100644 --- a/widgets/components/XCoreGrid/XCoreGrid.h +++ b/widgets/components/XCoreGrid/XCoreGrid.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -162,13 +163,42 @@ public: XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); ensure_cores(); - const int title_h = 20; + // Scaled fonts (Dec 5, 2026 proportions audit): title 16 px bold, + // cell labels 14-16 px bold (9-11% of cell height). + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + + const int title_h = title_px + 8; + // Grid geometry: pick cols/rows with no empty cell when possible + // (8 cores -> 4x2, not 3x3 with a hole). Minimise waste among + // near-square layouts, keeping rows >= 2 and cols <= 2*rows. int cols = (int)std::ceil(std::sqrt((double)cores_)); int rows = (cores_ + cols - 1) / cols; + int best_waste = cols * rows - cores_; + for (int cc = cols + 1; cc <= cores_; ++cc) + { + int rr = (cores_ + cc - 1) / cc; + if (rr < 2 || cc > 2 * rr) continue; + int waste = cc * rr - cores_; + if (waste < best_waste) + { + cols = cc; + rows = rr; + best_waste = waste; + if (waste == 0) break; + } + } int cell_w = (w - 8) / cols; int cell_h = (h - title_h - 8) / rows; + int label_px = xframe::clamp_font_px(0.10 * cell_h, 11, 16); + XFontStruct* label_font = xframe::scaled_font(display_, label_px, true); + if (!label_font) label_font = st.font_; + int label_asc = label_font ? label_font->ascent : 11; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); for (int c = 0; c < cores_; ++c) { @@ -182,12 +212,13 @@ public: // Label + current %. char label[32]; std::snprintf(label, sizeof(label), "C%d %.0f%%", c, current_[c]); - draw_text_color(cx + 5, cy + 14, label, color_for(current_[c])); + xframe::draw_text_font(display_, window_, gc_, label_font, cx + 5, + cy + 4 + label_asc, label, col(color_for(current_[c]))); // Mini history graph. int gx = cx + 4; - int gy = cy + 18; + int gy = cy + label_px + 10; int gw = std::max(10, cw - 8); - int gh = std::max(6, ch - 22); + int gh = std::max(6, ch - label_px - 14); XSetForeground(display_, gc_, col(grid_color_)); XDrawLine(display_, window_, gc_, gx, gy + gh / 2, gx + gw, gy + gh / 2); auto& hist = history_[c]; diff --git a/widgets/components/XDonutGauge/XDonutGauge.h b/widgets/components/XDonutGauge/XDonutGauge.h index 164f3e2..9126285 100644 --- a/widgets/components/XDonutGauge/XDonutGauge.h +++ b/widgets/components/XDonutGauge/XDonutGauge.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -103,13 +104,24 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; + // Scaled fonts (Dec 5, 2026 proportions audit): centre value + // 36-44 px bold (9-11% of diameter), centre label 16-18 px, + // ring thickness 8-10% of diameter. The top-left title is + // dropped: it duplicated the centre label ("Disk" twice). int cx = x1_ + w / 2; - int cy = y1_ + title_h + (h - title_h) / 2; - int r = std::max(16, std::min(w, h - title_h - 8) / 2 - 10); - const int thick = 16; - - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + int cy = y1_ + h / 2; + int r = std::max(16, std::min(w, h) / 2 - 10); + int thick = xframe::clamp_font_px(0.09 * 2 * r, 8, 40); + // The ring stroke extends thick/2 past r: shrink r so the outer + // edge stays inside the frame. + r = std::max(16, r - thick / 2); + int value_px = xframe::clamp_font_px(0.10 * 2 * r, 16, 44); + int label_px = xframe::clamp_font_px(0.045 * 2 * r, 11, 18); + XFontStruct* value_font = xframe::scaled_font(display_, value_px, true); + if (!value_font) value_font = st.font_; + XFontStruct* label_font = xframe::scaled_font(display_, label_px, false); + if (!label_font) label_font = st.font_; + int label_asc = label_font ? label_font->ascent : 11; // Track ring (full circle) + value arc from the top, clockwise. XSetForeground(display_, gc_, col(track_color_)); @@ -121,14 +133,15 @@ public: XDrawArc(display_, window_, gc_, cx - r, cy - r, 2 * r, 2 * r, 90 * 64, -sweep); xf::set_line_width(display_, gc_, 1); - // % centred, label under it. + // % centred, value name under it (the only "Disk" label now). char pct[16]; std::snprintf(pct, sizeof(pct), "%.0f%%", value_); - int pw = xf::text_width(st, pct); - draw_text_color(cx - pw / 2, cy + 4, pct, ring_color_); - draw_text_color(cx - pw / 2 + 1, cy + 4, pct, ring_color_); - int tw = xf::text_width(st, text_); - xf::draw_text_at(display_, window_, gc_, st, cx - tw / 2, cy + 22, text_); + int pw = xframe::font_text_width(value_font, pct); + xframe::draw_text_font(display_, window_, gc_, value_font, cx - pw / 2, cy - 2, + pct, col(ring_color_)); + int tw = xframe::font_text_width(label_font, text_); + xframe::draw_text_font(display_, window_, gc_, label_font, cx - tw / 2, + cy + label_asc + 10, text_, col(Srgb{20, 20, 20})); XSetForeground(display_, gc_, st.lineColor_); XDrawRectangle(display_, window_, gc_, x1_, y1_, w, h); diff --git a/widgets/components/XHistoryGraph/XHistoryGraph.h b/widgets/components/XHistoryGraph/XHistoryGraph.h index d4f7305..0ae13d7 100644 --- a/widgets/components/XHistoryGraph/XHistoryGraph.h +++ b/widgets/components/XHistoryGraph/XHistoryGraph.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -176,19 +177,26 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; - const int legend_h = 18 * (int)series_.size(); - const int axis_w = 44; + // Scaled fonts (Dec 5, 2026 proportions audit): title 16 px bold, + // Y labels + legend 14-16 px, time labels 13-14 px, all derived + // from widget height (min 11 px). Fall back to the style font + // when a scaled font fails to load. + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int body_px = xframe::clamp_font_px(0.032 * h, 11, 16); + int time_px = xframe::clamp_font_px(0.028 * h, 11, 14); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* body_font = xframe::scaled_font(display_, body_px, false); + if (!body_font) body_font = st.font_; + XFontStruct* time_font = xframe::scaled_font(display_, time_px, false); + if (!time_font) time_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int body_asc = body_font ? body_font->ascent : 11; + + const int title_h = title_px + 8; const int axis_h = 16; - int px = x1_ + axis_w; - int py = y1_ + title_h + legend_h + 4; - int pw = std::max(10, x2_ - 8 - px); - int ph = std::max(10, y2_ - axis_h - py); - // Title. - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); - - // Y range. + // Y range first: the widest Y label sets the left margin. double lo = y_min_; double hi = y_max_; if (auto_y_) @@ -201,11 +209,75 @@ public: } if (hi <= lo) hi = lo + 1.0; + // Dynamic left margin: measure the widest of the 5 Y labels and + // put the plot's left edge after it (labels right-aligned, + // ending 4 px left of the plot). The old fixed 44 px margin let + // labels wider than 40 px run over the axis line. + std::string ylabels[5]; + int axis_w = 8; + for (int g = 0; g <= 4; ++g) + { + double v = lo + (hi - lo) * (4 - g) / 4.0; + ylabels[g] = fmt1(v); + axis_w = std::max(axis_w, xframe::font_text_width(body_font, ylabels[g]) + 8); + } + + // Legend lines first: a series whose full line would run past + // the right edge wraps to two lines ("name cur X" / + // "min Y max Z avg W"), so the plot height accounts for it. + struct LegLine + { + std::string text; + bool swatch; + Srgb color{0, 0, 0}; + }; + std::vector leg_lines; + int leg_avail = std::max(20, x2_ - 8 - (x1_ + 32)); + for (auto& s : series_) + { + double cur = 0.0, mn = 0.0, mx = 0.0, sum = 0.0; + if (!s.data.empty()) + { + cur = s.data.back(); + mn = mx = s.data[0]; + for (double v : s.data) + { + mn = std::min(mn, v); + mx = std::max(mx, v); + sum += v; + } + sum /= (double)s.data.size(); + } + std::string full = s.name + " cur " + fmt1(cur) + " min " + fmt1(mn) + + " max " + fmt1(mx) + " avg " + fmt1(sum); + if (xframe::font_text_width(body_font, full) <= leg_avail) + { + leg_lines.push_back(LegLine{full, true, s.color}); + } + else + { + std::string l1 = s.name + " cur " + fmt1(cur); + std::string l2 = "min " + fmt1(mn) + " max " + fmt1(mx) + " avg " + fmt1(sum); + leg_lines.push_back(LegLine{l1, true, s.color}); + leg_lines.push_back(LegLine{l2, false, s.color}); + } + } + int line_h = body_px + 8; + int legend_h = line_h * (int)leg_lines.size(); + int px = x1_ + axis_w; + int py = y1_ + title_h + legend_h + 4; + int pw = std::max(10, x2_ - 8 - px); + int ph = std::max(10, y2_ - axis_h - py); + + // Title. + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); + auto y_at = [&](double v) { return py + ph - (int)((v - lo) / (hi - lo) * ph); }; - // Grid + y labels. + // Grid + y labels (right-aligned, clear of the plot). XSetForeground(display_, gc_, col(grid_color_)); for (int g = 0; g <= 4; ++g) { @@ -214,13 +286,21 @@ public: } for (int g = 0; g <= 4; ++g) { - double v = lo + (hi - lo) * (4 - g) / 4.0; - draw_text_color(px - 40, py + ph * g / 4 + 4, fmt1(v), Srgb{100, 100, 100}); + int gy = py + ph * g / 4; + int lw = xframe::font_text_width(body_font, ylabels[g]); + int ybase = (g == 0) ? gy + body_asc + : (g == 4) ? gy - 2 : gy + body_asc / 2; + xframe::draw_text_font(display_, window_, gc_, body_font, px - 4 - lw, + ybase, ylabels[g], col(Srgb{100, 100, 100})); } // Time labels. - draw_text_color(px, y2_ - 3, "-" + std::to_string(window_seconds_) + "s", Srgb{100, 100, 100}); + std::string ago = "-" + std::to_string(window_seconds_) + "s"; + xframe::draw_text_font(display_, window_, gc_, time_font, px, y2_ - 3, ago, + col(Srgb{100, 100, 100})); std::string now_s = "now"; - draw_text_color(px + pw - xf::text_width(st, now_s), y2_ - 3, now_s, Srgb{100, 100, 100}); + xframe::draw_text_font(display_, window_, gc_, time_font, + px + pw - xframe::font_text_width(time_font, now_s), y2_ - 3, + now_s, col(Srgb{100, 100, 100})); // Series lines. for (auto& s : series_) @@ -239,29 +319,20 @@ public: xf::set_line_width(display_, gc_, 1); } - // Legend: swatch + name + current / min / max / avg. + // Legend: swatch + name + current / min / max / avg (wrapped + // lines computed above so nothing runs past the right edge). int ly = y1_ + title_h + 4; - for (auto& s : series_) + for (auto& ln : leg_lines) { - double cur = 0.0, mn = 0.0, mx = 0.0, sum = 0.0; - if (!s.data.empty()) + int base = ly + body_asc; + if (ln.swatch) { - cur = s.data.back(); - mn = mx = s.data[0]; - for (double v : s.data) - { - mn = std::min(mn, v); - mx = std::max(mx, v); - sum += v; - } - sum /= (double)s.data.size(); + XSetForeground(display_, gc_, col(ln.color)); + XFillRectangle(display_, window_, gc_, x1_ + 8, base - body_asc + 2, 18, 4); } - XSetForeground(display_, gc_, col(s.color)); - XFillRectangle(display_, window_, gc_, x1_ + 8, ly - 2, 18, 4); - std::string leg = s.name + " cur " + fmt1(cur) + " min " + fmt1(mn) + - " max " + fmt1(mx) + " avg " + fmt1(sum); - xf::draw_text_at(display_, window_, gc_, st, x1_ + 32, ly + 8, leg); - ly += 18; + xframe::draw_text_font(display_, window_, gc_, body_font, x1_ + 32, base, + ln.text, col(Srgb{20, 20, 20})); + ly += line_h; } // Plot frame + outer frame. diff --git a/widgets/components/XLoadBadge/XLoadBadge.h b/widgets/components/XLoadBadge/XLoadBadge.h index 3180fb2..a0fd848 100644 --- a/widgets/components/XLoadBadge/XLoadBadge.h +++ b/widgets/components/XLoadBadge/XLoadBadge.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -159,29 +160,71 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); + // Scaled fonts (Dec 5, 2026 proportions audit): values 24-28 px + // bold (5-6% of height), sub-labels 14 px, title + "N cores" + // 14-16 px, uptime 14 px. The value block is vertically centred + // (no ~350 px empty middle); sub-labels sit under their value. + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int values_px = xframe::clamp_font_px(0.055 * h, 13, 28); + int sub_px = xframe::clamp_font_px(0.03 * h, 11, 14); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* values_font = xframe::scaled_font(display_, values_px, true); + if (!values_font) values_font = st.font_; + XFontStruct* sub_font = xframe::scaled_font(display_, sub_px, false); + if (!sub_font) sub_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int values_asc = values_font ? values_font->ascent : 11; + int sub_asc = sub_font ? sub_font->ascent : 11; + Srgb state = state_color(); // Left status stripe. XSetForeground(display_, gc_, col(state)); XFillRectangle(display_, window_, gc_, x1_, y1_, 8, h); - xf::draw_text_at(display_, window_, gc_, st, x1_ + 16, y1_ + 15, text_); + const int title_h = title_px + 8; + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 16, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); std::string cpus = std::to_string(ncpu_) + " cores"; - xf::draw_text_at(display_, window_, gc_, st, x2_ - 8 - xf::text_width(st, cpus), y1_ + 15, cpus); + xframe::draw_text_font(display_, window_, gc_, sub_font, + x2_ - 8 - xframe::font_text_width(sub_font, cpus), + y1_ + 4 + title_asc, cpus, col(Srgb{20, 20, 20})); - // Big load numbers: 1 / 5 / 15 min. - std::string loads = fmt1(load1_) + " " + fmt1(load5_) + " " + fmt1(load15_); - int lw = xf::text_width(st, loads); - draw_text_color(x1_ + (w - lw) / 2, y1_ + 42, loads, state); - draw_text_color(x1_ + (w - lw) / 2 + 1, y1_ + 42, loads, state); - - std::string labels = "1 min 5 min 15 min"; - int tw = xf::text_width(st, labels); - xf::draw_text_at(display_, window_, gc_, st, x1_ + (w - tw) / 2, y1_ + 58, labels); + // Big load numbers: 1 / 5 / 15 min, centred as a block. + std::string vstr[3] = {fmt1(load1_), fmt1(load5_), fmt1(load15_)}; + std::string gap = " "; + int gap_w = xframe::font_text_width(values_font, gap); + int widths[3]; + int total_w = -gap_w; + for (int i = 0; i < 3; ++i) + { + widths[i] = xframe::font_text_width(values_font, vstr[i]); + total_w += widths[i] + gap_w; + } + int region_top = y1_ + title_h + 4; + int region_bottom = y2_ - sub_px - 12; + int block_h = values_px + 6 + sub_px; + int block_top = region_top + std::max(0, (region_bottom - region_top - block_h) / 2); + int values_base = block_top + values_asc; + int sub_base = values_base + 6 + sub_asc; + int vx = x1_ + (w - total_w) / 2; + const char* sub_labels[3] = {"1 min", "5 min", "15 min"}; + for (int i = 0; i < 3; ++i) + { + xframe::draw_text_font(display_, window_, gc_, values_font, vx, values_base, + vstr[i], col(state)); + int sw = xframe::font_text_width(sub_font, sub_labels[i]); + xframe::draw_text_font(display_, window_, gc_, sub_font, + vx + (widths[i] - sw) / 2, sub_base, sub_labels[i], + col(Srgb{100, 100, 100})); + vx += widths[i] + gap_w; + } // Uptime line. std::string up = uptime_string(); - int uw = xf::text_width(st, up); - xf::draw_text_at(display_, window_, gc_, st, x1_ + (w - uw) / 2, y2_ - 8, up); + int uw = xframe::font_text_width(sub_font, up); + xframe::draw_text_font(display_, window_, gc_, sub_font, x1_ + (w - uw) / 2, + y2_ - 10, up, col(Srgb{20, 20, 20})); XSetForeground(display_, gc_, st.lineColor_); XDrawRectangle(display_, window_, gc_, x1_, y1_, w, h); diff --git a/widgets/components/XMonitorButton/XMonitorButton.h b/widgets/components/XMonitorButton/XMonitorButton.h index 4d58106..ab0f318 100644 --- a/widgets/components/XMonitorButton/XMonitorButton.h +++ b/widgets/components/XMonitorButton/XMonitorButton.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -248,6 +249,25 @@ public: int h = height(); Srgb state = status_ == MonUp ? up_color_ : (status_ == MonDown ? down_color_ : unknown_color_); + // Scaled content (Dec 5, 2026 proportions audit): label 20-24 px + // bold, dot 24-32 px, status 20 px bold, sub-label (details_: + // "open" / "pid N" / ...) under the label. The content block is + // vertically centred. Sizes derive from the button's own height + // (one rule serves the standalone button and the grid cells, + // whose demo heights are 480 px and ~180 px). + int label_px = xframe::clamp_font_px(0.10 * h, 13, 24); + int dot_d = xframe::clamp_font_px(0.10 * h, 12, 30); + int status_px = xframe::clamp_font_px(0.09 * h, 12, 20); + int detail_px = xframe::clamp_font_px(0.06 * h, 11, 14); + XFontStruct* label_font = xframe::scaled_font(display_, label_px, true); + if (!label_font) label_font = st.font_; + XFontStruct* status_font = xframe::scaled_font(display_, status_px, true); + if (!status_font) status_font = st.font_; + XFontStruct* detail_font = xframe::scaled_font(display_, detail_px, false); + if (!detail_font) detail_font = st.font_; + int label_asc = label_font ? label_font->ascent : 11; + int detail_asc = detail_font ? detail_font->ascent : 11; + // Body: white, thick status-coloured border = the glow. XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); @@ -256,27 +276,48 @@ public: XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, w - 2, h - 2); xf::set_line_width(display_, gc_, 1); - // Status dot. - int dot_r = 7; - int dot_cx = x1_ + 16; - int dot_cy = y1_ + h / 2 - (show_details_ ? 8 : 0); + int block_h = label_px + 6 + detail_px; + int block_top = y1_ + std::max(4, (h - block_h) / 2); + int label_base = block_top + label_asc; + int detail_base = block_top + label_px + 6 + detail_asc; + + // Status dot, centred on the content block. + int dot_r = dot_d / 2; + int dot_cx = x1_ + 8 + dot_r; + int dot_cy = block_top + block_h / 2; XSetForeground(display_, gc_, col(state)); XFillArc(display_, window_, gc_, dot_cx - dot_r, dot_cy - dot_r, 2 * dot_r, 2 * dot_r, 0, 360 * 64); - // Label + status text. - xf::draw_text_at(display_, window_, gc_, st, x1_ + 30, dot_cy + 4, text_); + // Label + status text on the first line. std::string stxt = status_text(); - int sw = xf::text_width(st, stxt); - draw_text_color(x2_ - 10 - sw, dot_cy + 4, stxt, state); - draw_text_color(x2_ - 10 - sw + 1, dot_cy + 4, stxt, state); - - if (show_details_) + int sw = xframe::font_text_width(status_font, stxt); + int label_x = dot_cx + dot_r + 10; + int label_avail = std::max(10, x2_ - 10 - sw - 8 - label_x); + std::string label = text_; + int label_w = xframe::font_text_width(label_font, label); + if (label_w > label_avail) { - std::string d = kind_ == Process ? ("process " + target_ + ": " + details_) - : kind_ == Unit ? ("unit " + target_ + ": " + details_) - : ("port " + target_ + ": " + details_); - xf::draw_text_at(display_, window_, gc_, st, x1_ + 30, y1_ + h - 8, d.substr(0, 48)); + int cw = label_font ? label_font->max_bounds.width : 8; + int keep = std::max(0, label_avail / std::max(1, cw) - 3); + label = label.substr(0, (size_t)keep) + "..."; } + xframe::draw_text_font(display_, window_, gc_, label_font, label_x, label_base, + label, col(Srgb{20, 20, 20})); + xframe::draw_text_font(display_, window_, gc_, status_font, x2_ - 10 - sw, + label_base, stxt, col(state)); + + // Sub-label under the label (always shown now, not click-gated). + std::string detail = details_; + int detail_avail = std::max(10, x2_ - 10 - label_x); + int detail_w = xframe::font_text_width(detail_font, detail); + if (detail_w > detail_avail) + { + int cw = detail_font ? detail_font->max_bounds.width : 8; + int keep = std::max(0, detail_avail / std::max(1, cw) - 3); + detail = detail.substr(0, (size_t)keep) + "..."; + } + xframe::draw_text_font(display_, window_, gc_, detail_font, label_x, detail_base, + detail, col(Srgb{100, 100, 100})); XFlush(display_); } @@ -285,7 +326,8 @@ public: { if (button == 1 && contains(x, y)) { - show_details_ = !show_details_; + // The detail sub-label is always shown now (Dec 5, 2026 + // proportions audit); a click just re-polls. poll(); return true; } diff --git a/widgets/components/XMonitorGrid/XMonitorGrid.h b/widgets/components/XMonitorGrid/XMonitorGrid.h index 9475880..b9a0753 100644 --- a/widgets/components/XMonitorGrid/XMonitorGrid.h +++ b/widgets/components/XMonitorGrid/XMonitorGrid.h @@ -1,9 +1,11 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include "../XMonitorButton/XMonitorButton.h" #include +#include #include #include @@ -31,7 +33,7 @@ private: bool focused_ = false; std::vector monitors_; - int columns_ = 2; + int columns_ = 0; // 0 = auto: cols = ceil(sqrt(n)) (2x2 for 4) Srgb white_color_{255, 255, 255}; @@ -40,9 +42,11 @@ private: void layout() { if (monitors_.empty()) return; - const int title_h = 20; + const int title_h = xframe::clamp_font_px(0.033 * height(), 11, 16) + 8; const int gap = 6; - int cols = std::max(1, columns_); + int cols = columns_ > 0 ? columns_ + : (int)std::ceil(std::sqrt((double)monitors_.size())); + cols = std::max(1, cols); int rows = ((int)monitors_.size() + cols - 1) / cols; int cw = (width() - 8 - gap * (cols - 1)) / cols; int ch = (height() - title_h - 8 - gap * (rows - 1)) / rows; @@ -147,9 +151,17 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + // Title + summary 14-16 px bold (Dec 5, 2026 proportions audit). + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); std::string summary = std::to_string(up_count()) + "/" + std::to_string(monitors_.size()) + " up"; - xf::draw_text_at(display_, window_, gc_, st, x2_ - 8 - xf::text_width(st, summary), y1_ + 15, summary); + xframe::draw_text_font(display_, window_, gc_, title_font, + x2_ - 8 - xframe::font_text_width(title_font, summary), + y1_ + 4 + title_asc, summary, col(Srgb{20, 20, 20})); layout(); for (auto& m : monitors_) m.draw(); diff --git a/widgets/components/XNetGraph/XNetGraph.h b/widgets/components/XNetGraph/XNetGraph.h index 5e1cae4..b45264f 100644 --- a/widgets/components/XNetGraph/XNetGraph.h +++ b/widgets/components/XNetGraph/XNetGraph.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -176,16 +177,18 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; - const int legend_h = 44; - const int axis_w = 52; + // Scaled fonts (Dec 5, 2026 proportions audit): title 16 px bold, + // Y labels + legend 14-16 px, derived from widget height. + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int body_px = xframe::clamp_font_px(0.032 * h, 11, 16); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* body_font = xframe::scaled_font(display_, body_px, false); + if (!body_font) body_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int body_asc = body_font ? body_font->ascent : 11; + const int title_h = title_px + 8; const int axis_h = 16; - int px = x1_ + axis_w; - int py = y1_ + title_h + legend_h + 4; - int pw = std::max(10, x2_ - 8 - px); - int ph = std::max(10, y2_ - axis_h - py); - - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); double hi = y_max_; if (hi <= 0.0) @@ -196,7 +199,52 @@ public: hi *= 1.05; } - // Grid + y labels. + // Dynamic left margin: the widest humanised Y label + // ("276.7 KiB/s") sets the plot's left edge; labels are + // right-aligned so none runs over the axis line. + std::string ylabels[5]; + int axis_w = 8; + for (int g = 0; g <= 4; ++g) + { + ylabels[g] = fmt_rate(hi * (4 - g) / 4.0); + axis_w = std::max(axis_w, xframe::font_text_width(body_font, ylabels[g]) + 8); + } + + // Legend lines first: a "down R total T" line that would run + // past the right edge splits into rate / total lines. + struct LegLine + { + std::string text; + bool swatch; + Srgb color{0, 0, 0}; + }; + std::vector leg_lines; + int leg_avail = std::max(20, x2_ - 8 - (x1_ + 32)); + auto add_series_leg = [&](const std::string& tag, double rate, double tot, Srgb color) { + std::string full = tag + fmt_rate(rate) + " total " + fmt_total(tot); + if (xframe::font_text_width(body_font, full) <= leg_avail) + { + leg_lines.push_back(LegLine{full, true, color}); + } + else + { + leg_lines.push_back(LegLine{tag + fmt_rate(rate), true, color}); + leg_lines.push_back(LegLine{"total " + fmt_total(tot), false, color}); + } + }; + add_series_leg("down ", down_rate(), down_total_, down_color_); + add_series_leg("up ", up_rate(), up_total_, up_color_); + int line_h = body_px + 8; + int legend_h = line_h * (int)leg_lines.size(); + int px = x1_ + axis_w; + int py = y1_ + title_h + legend_h + 4; + int pw = std::max(10, x2_ - 8 - px); + int ph = std::max(10, y2_ - axis_h - py); + + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); + + // Grid + y labels (right-aligned, clear of the plot). XSetForeground(display_, gc_, col(grid_color_)); for (int g = 0; g <= 4; ++g) { @@ -205,22 +253,31 @@ public: } for (int g = 0; g <= 4; ++g) { - double v = hi * (4 - g) / 4.0; - draw_text_color(px - 48, py + ph * g / 4 + 4, fmt_rate(v), Srgb{100, 100, 100}); + int gy = py + ph * g / 4; + int lw = xframe::font_text_width(body_font, ylabels[g]); + int ybase = (g == 0) ? gy + body_asc + : (g == 4) ? gy - 2 : gy + body_asc / 2; + xframe::draw_text_font(display_, window_, gc_, body_font, px - 4 - lw, + ybase, ylabels[g], col(Srgb{100, 100, 100})); } draw_series(down_, px, py, pw, ph, hi, down_color_); draw_series(up_, px, py, pw, ph, hi, up_color_); - // Legend: current rates + totals. - XSetForeground(display_, gc_, col(down_color_)); - XFillRectangle(display_, window_, gc_, x1_ + 8, y1_ + title_h + 6, 18, 4); - xf::draw_text_at(display_, window_, gc_, st, x1_ + 32, y1_ + title_h + 16, - "down " + fmt_rate(down_rate()) + " total " + fmt_total(down_total_)); - XSetForeground(display_, gc_, col(up_color_)); - XFillRectangle(display_, window_, gc_, x1_ + 8, y1_ + title_h + 24, 18, 4); - xf::draw_text_at(display_, window_, gc_, st, x1_ + 32, y1_ + title_h + 34, - "up " + fmt_rate(up_rate()) + " total " + fmt_total(up_total_)); + // Legend: current rates + totals (wrapped lines computed above). + int ly = y1_ + title_h + 4; + for (auto& ln : leg_lines) + { + int base = ly + body_asc; + if (ln.swatch) + { + XSetForeground(display_, gc_, col(ln.color)); + XFillRectangle(display_, window_, gc_, x1_ + 8, base - body_asc + 2, 18, 4); + } + xframe::draw_text_font(display_, window_, gc_, body_font, x1_ + 32, base, + ln.text, col(Srgb{20, 20, 20})); + ly += line_h; + } XSetForeground(display_, gc_, col(axis_color_)); XDrawRectangle(display_, window_, gc_, px, py, pw, ph); diff --git a/widgets/components/XProcessList/XProcessList.h b/widgets/components/XProcessList/XProcessList.h index 412693b..a8471cc 100644 --- a/widgets/components/XProcessList/XProcessList.h +++ b/widgets/components/XProcessList/XProcessList.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -258,28 +259,54 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; - const int header_h = 18; - const int row_h = 16; + // Scaled fonts (Dec 5, 2026 proportions audit): title 16 px bold, + // "N procs" 13-14 px, header bold 13-14 px, rows 13 px at + // 22-24 px pitch. CPU bars colour-coded by value (Python scheme: + // green < 50, amber < 80, red >= 80). + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int head_px = xframe::clamp_font_px(0.03 * h, 11, 14); + const int row_px = 13; + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* head_font = xframe::scaled_font(display_, head_px, true); + if (!head_font) head_font = st.font_; + XFontStruct* row_font = xframe::scaled_font(display_, row_px, false); + if (!row_font) row_font = st.font_; + XFontStruct* count_font = xframe::scaled_font(display_, head_px, false); + if (!count_font) count_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int head_asc = head_font ? head_font->ascent : 11; + int head_desc = head_font ? head_font->descent : 2; + int row_asc = row_font ? row_font->ascent : 11; + int row_desc = row_font ? row_font->descent : 2; + + const int title_h = title_px + 8; + const int header_h = head_px + 10; + const int row_h = 23; int ix = x1_ + 6; int iw = w - 12; int xs[6]; col_xs(ix, iw, xs); const char* heads[5] = {"Pid", "Program", "User", "MemB", "Cpu%"}; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); std::string count = std::to_string(rows_.size()) + " procs"; - xf::draw_text_at(display_, window_, gc_, st, x2_ - 8 - xf::text_width(st, count), y1_ + 15, count); + xframe::draw_text_font(display_, window_, gc_, count_font, + x2_ - 8 - xframe::font_text_width(count_font, count), + y1_ + 4 + title_asc, count, col(Srgb{20, 20, 20})); // Header row. int hy = y1_ + title_h; XSetForeground(display_, gc_, col(header_color_)); XFillRectangle(display_, window_, gc_, ix, hy, iw, header_h); + int head_base = hy + (header_h + head_asc - head_desc) / 2; for (int c = 0; c < 5; ++c) { std::string head = heads[c]; if (c == sort_col_) head += sort_desc_ ? " v" : " ^"; - xf::draw_text_at(display_, window_, gc_, st, xs[c] + 2, hy + 13, head); + xframe::draw_text_font(display_, window_, gc_, head_font, xs[c] + 2, + head_base, head, col(Srgb{20, 20, 20})); } XSetForeground(display_, gc_, col(axis_color_)); XDrawLine(display_, window_, gc_, ix, hy + header_h, ix + iw, hy + header_h); @@ -288,6 +315,7 @@ public: int y = hy + header_h; int shown = 0; int max_fit = (y2_ - 6 - y) / row_h; + int row_base_off = (row_h + row_asc - row_desc) / 2; for (auto& r : rows_) { if (shown >= max_fit) break; @@ -302,21 +330,35 @@ public: XSetForeground(display_, gc_, col(Srgb{248, 248, 248})); XFillRectangle(display_, window_, gc_, ix, ry, iw, row_h); } - xf::draw_text_at(display_, window_, gc_, st, xs[0] + 2, ry + 12, std::to_string(r.pid)); + xframe::draw_text_font(display_, window_, gc_, row_font, xs[0] + 2, + ry + row_base_off, std::to_string(r.pid), + col(Srgb{20, 20, 20})); std::string prog = r.name.substr(0, 28); - xf::draw_text_at(display_, window_, gc_, st, xs[1] + 2, ry + 12, prog); - xf::draw_text_at(display_, window_, gc_, st, xs[2] + 2, ry + 12, r.user.substr(0, 10)); - xf::draw_text_at(display_, window_, gc_, st, xs[3] + 2, ry + 12, fmt_mem(r.mem_mb)); - // In-cell CPU% bar behind the number. + xframe::draw_text_font(display_, window_, gc_, row_font, xs[1] + 2, + ry + row_base_off, prog, col(Srgb{20, 20, 20})); + xframe::draw_text_font(display_, window_, gc_, row_font, xs[2] + 2, + ry + row_base_off, r.user.substr(0, 10), + col(Srgb{20, 20, 20})); + xframe::draw_text_font(display_, window_, gc_, row_font, xs[3] + 2, + ry + row_base_off, fmt_mem(r.mem_mb), col(Srgb{20, 20, 20})); + // In-cell CPU% bar AFTER the number: drawing the bar first put + // it under the first digit (dark-on-green, e.g. "10.2" lost + // its "1" behind the bar). int bar_x = xs[4] + 2; - int bar_w = xs[5] - bar_x - 4; - int fill = (int)(bar_w * std::min(100.0, r.cpu) / 100.0); + std::string cpu_txt = fmt1(r.cpu); + int cpu_tw = xframe::font_text_width(row_font, cpu_txt); + xframe::draw_text_font(display_, window_, gc_, row_font, bar_x + 2, + ry + row_base_off, cpu_txt, col(Srgb{20, 20, 20})); + int bar_x2 = bar_x + 4 + cpu_tw; + int bar_w2 = xs[5] - bar_x2 - 4; + int fill = (int)(bar_w2 * std::min(100.0, r.cpu) / 100.0); if (fill > 0) { - XSetForeground(display_, gc_, col(r.cpu >= 50.0 ? Srgb{210, 40, 30} : bar_color_)); - XFillRectangle(display_, window_, gc_, bar_x, ry + 3, fill, row_h - 6); + Srgb bar_col = r.cpu >= 80.0 ? Srgb{210, 40, 30} + : r.cpu >= 50.0 ? Srgb{220, 180, 0} : bar_color_; + XSetForeground(display_, gc_, col(bar_col)); + XFillRectangle(display_, window_, gc_, bar_x2, ry + (row_h - 12) / 2, fill, 12); } - draw_text_color(bar_x + 2, ry + 12, fmt1(r.cpu), Srgb{20, 20, 20}); ++shown; } @@ -328,8 +370,8 @@ public: bool on_button_press(int x, int y, unsigned int button) { if (button != 1 || !contains(x, y)) return false; - const int title_h = 20; - const int header_h = 18; + const int title_h = xframe::clamp_font_px(0.033 * height(), 11, 16) + 8; + const int header_h = xframe::clamp_font_px(0.03 * height(), 11, 14) + 10; int hy = y1_ + title_h; if (y >= hy && y < hy + header_h) { diff --git a/widgets/components/XStackBar/XStackBar.h b/widgets/components/XStackBar/XStackBar.h index 883dcd8..20e3323 100644 --- a/widgets/components/XStackBar/XStackBar.h +++ b/widgets/components/XStackBar/XStackBar.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -131,20 +132,44 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; - const int bar_h = 26; - double tot = total(); + // Scaled fonts (Dec 5, 2026 proportions audit): title + total + // 14-16 px (title bold), legend 14-16 px, bar height ~1.5x + // legend text height. The bar+legend block scales with widget + // height and is vertically centred (no 80% empty area). + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int legend_px = xframe::clamp_font_px(0.032 * h, 11, 16); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* legend_font = xframe::scaled_font(display_, legend_px, false); + if (!legend_font) legend_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int legend_asc = legend_font ? legend_font->ascent : 11; + int legend_desc = legend_font ? legend_font->descent : 2; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + double tot = total(); + const int title_h = title_px + 8; + int row_h = (int)std::lround(1.6 * legend_px); + int legend_total = row_h * (int)segments_.size(); + int bar_min = (int)std::lround(1.5 * legend_px); + int bar_max = (int)std::lround(0.30 * h); + int bar_h = std::max(bar_min, std::min(bar_max, h - title_h - legend_total - 24)); + bar_h = std::max(8, bar_h); + int block_h = title_h + 6 + bar_h + 8 + legend_total; + int start_y = y1_ + std::max(4, (h - block_h) / 2); + + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + start_y + 4 + title_asc, text_, col(Srgb{20, 20, 20})); if (tot > 0.0) { std::string tot_s = "total " + fmt1(tot) + " GiB"; - xf::draw_text_at(display_, window_, gc_, st, x2_ - 8 - xf::text_width(st, tot_s), y1_ + 15, tot_s); + xframe::draw_text_font(display_, window_, gc_, legend_font, + x2_ - 8 - xframe::font_text_width(legend_font, tot_s), + start_y + 4 + title_asc, tot_s, col(Srgb{20, 20, 20})); } // Stacked bar. int bx = x1_ + 8; - int by = y1_ + title_h + 4; + int by = start_y + title_h + 6; int bw = std::max(10, w - 16); int x = bx; for (auto& s : segments_) @@ -159,11 +184,13 @@ public: XDrawRectangle(display_, window_, gc_, bx, by, bw, bar_h); // Legend: one row per segment — swatch, name, value, share. - int ly = by + bar_h + 18; + int ly = by + bar_h + 8; for (auto& s : segments_) { + int base = ly + (row_h + legend_asc - legend_desc) / 2; XSetForeground(display_, gc_, col(s.color)); - XFillRectangle(display_, window_, gc_, x1_ + 8, ly - 10, 12, 12); + XFillRectangle(display_, window_, gc_, x1_ + 8, ly + (row_h - legend_px) / 2, + legend_px, legend_px); std::string line = s.name + " " + fmt1(s.value) + " GiB"; if (tot > 0.0) { @@ -171,8 +198,10 @@ public: std::snprintf(share, sizeof(share), " %.0f%%", s.value / tot * 100.0); line += share; } - xf::draw_text_at(display_, window_, gc_, st, x1_ + 28, ly, line); - ly += 18; + xframe::draw_text_font(display_, window_, gc_, legend_font, + x1_ + 8 + legend_px + 8, base, line, + col(Srgb{20, 20, 20})); + ly += row_h; } XSetForeground(display_, gc_, st.lineColor_); diff --git a/widgets/components/XSysBox/XSysBox.h b/widgets/components/XSysBox/XSysBox.h index 6948ae6..7d2d414 100644 --- a/widgets/components/XSysBox/XSysBox.h +++ b/widgets/components/XSysBox/XSysBox.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -149,22 +150,49 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; - const int big_h = 30; - const int bar_h = 18; + // Scaled fonts (Dec 5, 2026 proportions audit): hero value + // 28-32 px bold, title 14-16 px bold, "max" 13-14 px, bottom bar + // 24-28 px tall with a 14 px label. NOTE on the hero rule: the + // spec's 6-7% of height and the Python port's audited-correct + // 10.3% conflict, so the hero uses 10% of height clamped to + // 20-32 px — 28-32 px at the 480 px demo scale, ~23 px at the + // Python port's natural size. + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int hero_px = xframe::clamp_font_px(0.10 * h, 20, 32); + int max_px = xframe::clamp_font_px(0.03 * h, 11, 14); + int bar_label_px = xframe::clamp_font_px(0.03 * h, 11, 14); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* hero_font = xframe::scaled_font(display_, hero_px, true); + if (!hero_font) hero_font = st.font_; + XFontStruct* max_font = xframe::scaled_font(display_, max_px, false); + if (!max_font) max_font = st.font_; + XFontStruct* bar_font = xframe::scaled_font(display_, bar_label_px, true); + if (!bar_font) bar_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int hero_asc = hero_font ? hero_font->ascent : 11; + int bar_asc = bar_font ? bar_font->ascent : 11; + int bar_desc = bar_font ? bar_font->descent : 2; + + const int title_h = title_px + 8; + const int hero_h = hero_px + 10; + const int bar_h = xframe::clamp_font_px(0.055 * h, 20, 28); int gx = x1_ + 8; - int gy = y1_ + title_h + big_h + 4; + int gy = y1_ + title_h + hero_h + 4; int gw = std::max(10, w - 16); int gh = std::max(10, y2_ - bar_h - 12 - gy); // Title + big number. - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); std::string big = fmt1(value_) + unit_; - draw_text_color(x1_ + 8, y1_ + title_h + 22, big, graph_color_); - draw_text_color(x1_ + 9, y1_ + title_h + 22, big, graph_color_); + xframe::draw_text_font(display_, window_, gc_, hero_font, x1_ + 8, + y1_ + title_h + hero_asc + 2, big, col(graph_color_)); // Max at the right of the big number row. std::string mx = "max " + fmt1(max_) + unit_; - xf::draw_text_at(display_, window_, gc_, st, x2_ - 8 - xf::text_width(st, mx), y1_ + title_h + 22, mx); + xframe::draw_text_font(display_, window_, gc_, max_font, + x2_ - 8 - xframe::font_text_width(max_font, mx), + y1_ + title_h + hero_asc + 2, mx, col(Srgb{100, 100, 100})); // History graph. XSetForeground(display_, gc_, col(grid_color_)); @@ -200,8 +228,10 @@ public: XDrawRectangle(display_, window_, gc_, bx, by, bw, bar_h); char pct[16]; std::snprintf(pct, sizeof(pct), "%.0f%%", max_ > 0.0 ? value_ / max_ * 100.0 : 0.0); - int pw = xf::text_width(st, pct); - xf::draw_text_at(display_, window_, gc_, st, bx + bw - pw - 4, by + 13, pct); + int pw = xframe::font_text_width(bar_font, pct); + xframe::draw_text_font(display_, window_, gc_, bar_font, bx + bw - pw - 4, + by + (bar_h + bar_asc - bar_desc) / 2, pct, + col(Srgb{20, 20, 20})); XSetForeground(display_, gc_, st.lineColor_); XDrawRectangle(display_, window_, gc_, x1_, y1_, w, h); diff --git a/widgets/components/XTachometer/XTachometer.h b/widgets/components/XTachometer/XTachometer.h index de65cc5..7f14c0d 100644 --- a/widgets/components/XTachometer/XTachometer.h +++ b/widgets/components/XTachometer/XTachometer.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -138,7 +139,18 @@ public: double red_frac = max_ > 0.0 ? redline_ / max_ : 1.0; double peak_frac = max_ > 0.0 ? peak_ / max_ : 0.0; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + // Scaled fonts (Dec 5, 2026 tach fix): dial numerals ~7-8% of + // the dial diameter, bold, just inside the major tick ring; + // "RPM" title slightly smaller, bold; readout legible, bold. + int numeral_px = xframe::clamp_font_px(0.075 * 2 * r, 13, 28); + int title_px = xframe::clamp_font_px(numeral_px - 4, 13, 24); + int readout_px = xframe::clamp_font_px(0.05 * 2 * r, 13, 20); + XFontStruct* numeral_font = xframe::scaled_font(display_, numeral_px, true); + if (!numeral_font) numeral_font = st.font_; + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* readout_font = xframe::scaled_font(display_, readout_px, true); + if (!readout_font) readout_font = st.font_; // Dial face. XSetForeground(display_, gc_, col(dial_color_)); @@ -172,12 +184,49 @@ public: if (i % 2 == 0) { std::string lab = fmt0(max_ * f / 1000.0); - int lx = cx + (int)((r - 26) * std::cos(a)); - int ly = cy - (int)((r - 26) * std::sin(a)); - xf::draw_text_at(display_, window_, gc_, st, lx - xf::text_width(st, lab) / 2, ly + 4, lab); + int lw = xframe::font_text_width(numeral_font, lab); + // Numeral centre radius: the glyph box's farthest + // corner in the radial direction must stay inside the + // tick ring (inner end r-10) with 4 px clearance, so a + // wide label never crosses the dial rim. + double extent = (lw / 2.0) * std::fabs(std::cos(a)) + + (numeral_px / 2.0) * std::fabs(std::sin(a)); + double lr = std::max(8.0, r - 10.0 - extent - 4.0); + int lx = cx + (int)(lr * std::cos(a)); + int ly = cy - (int)(lr * std::sin(a)); + // Numerals at/after the redline render in red. + Srgb lab_color = (f >= red_frac) ? redline_color_ : Srgb{20, 20, 20}; + xframe::draw_text_font(display_, window_, gc_, numeral_font, + lx - lw / 2, + ly + (numeral_font ? numeral_font->ascent : 11) / 2, + lab, col(lab_color)); } } + // "RPM" title: bold, centred inside the dial below the top + // numerals (not a tiny top-left corner label). Its baseline + // hangs below the top numeral's bottom edge, so it cannot + // collide with the neighbouring numerals on small dials. + if (!text_.empty()) + { + int tw = xframe::font_text_width(title_font, text_); + int title_base = cy - (r - 22) + (int)(numeral_px * 0.75) + + title_font->ascent + 4; + xframe::draw_text_font(display_, window_, gc_, title_font, + cx - tw / 2, title_base, text_, + col(Srgb{20, 20, 20})); + } + + // Current value + peak readout: enlarged, inside the dial below + // the hub (not cramped at the bottom edge). + { + std::string readout = fmt0(value_) + " (peak " + fmt0(peak_) + ")"; + int rw = xframe::font_text_width(readout_font, readout); + xframe::draw_text_font(display_, window_, gc_, readout_font, + cx - rw / 2, cy + (int)(r * 0.45), readout, + col(Srgb{20, 20, 20})); + } + // Peak-hold tick. { double a = angle_deg(peak_frac) * M_PI / 180.0; @@ -203,11 +252,6 @@ public: XFillArc(display_, window_, gc_, cx - 6, cy - 6, 12, 12, 0, 360 * 64); } - // Digital readout under the dial. - std::string readout = fmt0(value_) + " (peak " + fmt0(peak_) + ")"; - int rw = xf::text_width(st, readout); - xf::draw_text_at(display_, window_, gc_, st, cx - rw / 2, y2_ - 10, readout); - XSetForeground(display_, gc_, st.lineColor_); XDrawRectangle(display_, window_, gc_, x1_, y1_, w, h); XFlush(display_); diff --git a/widgets/components/XTempHistory/XTempHistory.h b/widgets/components/XTempHistory/XTempHistory.h index 7316620..94565df 100644 --- a/widgets/components/XTempHistory/XTempHistory.h +++ b/widgets/components/XTempHistory/XTempHistory.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -138,23 +139,54 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; - const int legend_h = 18; - const int axis_w = 44; - const int axis_h = 16; - int px = x1_ + axis_w; - int py = y1_ + title_h + legend_h + 4; - int pw = std::max(10, x2_ - 8 - px); - int ph = std::max(10, y2_ - axis_h - py); + // Scaled fonts (Dec 5, 2026 proportions audit): title 16 px bold, + // "now" 14-16 px bold, Y labels + subtitle 14-16 px, threshold + // label 14 px — all derived from widget height. Layout + // standardised on the Python port: big current value top-right, + // min/max/avg on a bottom line. + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int body_px = xframe::clamp_font_px(0.032 * h, 11, 16); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* body_font = xframe::scaled_font(display_, body_px, false); + if (!body_font) body_font = st.font_; + XFontStruct* bold_font = xframe::scaled_font(display_, body_px, true); + if (!bold_font) bold_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int body_asc = body_font ? body_font->ascent : 11; + + const int title_h = title_px + 8; + const int bottom_h = body_px + 8; double hi = y_max_ > 0.0 ? y_max_ : 100.0; + // Dynamic left margin: the widest "100.0C" label sets the plot's + // left edge; labels are right-aligned, clear of the axis line. + std::string ylabels[5]; + int axis_w = 8; + for (int g = 0; g <= 4; ++g) + { + ylabels[g] = fmt1(hi * (4 - g) / 4.0) + "C"; + axis_w = std::max(axis_w, xframe::font_text_width(body_font, ylabels[g]) + 8); + } + int px = x1_ + axis_w; + int py = y1_ + title_h + 4; + int pw = std::max(10, x2_ - 8 - px); + int ph = std::max(10, y2_ - bottom_h - 6 - py); + auto y_at = [&](double v) { return py + ph - (int)(std::max(0.0, std::min(hi, v)) / hi * ph); }; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + // Title left, big current value right (bold, red when over). + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); + std::string cur = "now " + fmt1(current()) + "C"; + xframe::draw_text_font(display_, window_, gc_, bold_font, + x2_ - 8 - xframe::font_text_width(bold_font, cur), + y1_ + 4 + title_asc, cur, + col(over_temp() ? hot_color_ : Srgb{20, 20, 20})); - // Grid + y labels. + // Grid + y labels (right-aligned, clear of the plot). XSetForeground(display_, gc_, col(grid_color_)); for (int g = 0; g <= 4; ++g) { @@ -163,11 +195,16 @@ public: } for (int g = 0; g <= 4; ++g) { - double v = hi * (4 - g) / 4.0; - draw_text_color(px - 40, py + ph * g / 4 + 4, fmt1(v) + "C", Srgb{100, 100, 100}); + int gy = py + ph * g / 4; + int lw = xframe::font_text_width(body_font, ylabels[g]); + int ybase = (g == 0) ? gy + body_asc + : (g == 4) ? gy - 2 : gy + body_asc / 2; + xframe::draw_text_font(display_, window_, gc_, body_font, px - 4 - lw, + ybase, ylabels[g], col(Srgb{100, 100, 100})); } - // Threshold: dashed red line + label. + // Threshold: dashed red line + label ABOVE the line with + // clearance (never on the line). { XGCValues gv; gv.line_style = LineOnOffDash; @@ -178,7 +215,9 @@ public: gv.line_style = LineSolid; XChangeGC(display_, gc_, GCLineStyle, &gv); std::string lim = fmt1(threshold_) + "C limit"; - draw_text_color(px + pw - xf::text_width(st, lim) - 4, ty - 4, lim, hot_color_); + xframe::draw_text_font(display_, window_, gc_, body_font, + px + pw - xframe::font_text_width(body_font, lim) - 4, + ty - 4, lim, col(hot_color_)); } // Temperature line: green below the threshold, red above it. @@ -197,8 +236,8 @@ public: xf::set_line_width(display_, gc_, 1); } - // Legend: current (big, coloured by state) + min / max. - double mn = 0.0, mx = 0.0; + // Bottom line: min / max / avg. + double mn = 0.0, mx = 0.0, sum = 0.0; if (!temps_.empty()) { mn = mx = temps_[0]; @@ -206,12 +245,13 @@ public: { mn = std::min(mn, v); mx = std::max(mx, v); + sum += v; } + sum /= (double)temps_.size(); } - std::string cur = "now " + fmt1(current()) + "C"; - draw_text_color(x2_ - 8 - xf::text_width(st, cur), y1_ + title_h + 14, cur, over_temp() ? hot_color_ : ok_color_); - std::string mm = "min " + fmt1(mn) + "C max " + fmt1(mx) + "C threshold " + fmt1(threshold_) + "C"; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + title_h + 14, mm); + std::string mm = "min " + fmt1(mn) + "C max " + fmt1(mx) + "C avg " + fmt1(sum) + "C"; + xframe::draw_text_font(display_, window_, gc_, body_font, x1_ + 8, + py + ph + 4 + body_asc, mm, col(Srgb{100, 100, 100})); XSetForeground(display_, gc_, col(axis_color_)); XDrawRectangle(display_, window_, gc_, px, py, pw, ph); diff --git a/widgets/components/XUsageBar/XUsageBar.h b/widgets/components/XUsageBar/XUsageBar.h index 2466c65..fdf0fbb 100644 --- a/widgets/components/XUsageBar/XUsageBar.h +++ b/widgets/components/XUsageBar/XUsageBar.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -110,19 +111,33 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - // Label left, % right. - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + (h + 12) / 2 - 4, text_); - char pct[16]; - std::snprintf(pct, sizeof(pct), "%.0f%%", fraction() * 100.0); - int pct_w = xf::text_width(st, pct); - xf::draw_text_at(display_, window_, gc_, st, x2_ - 8 - pct_w, y1_ + (h + 12) / 2 - 4, pct); - - // Bar track between label and %. - int label_w = xf::text_width(st, text_) + 16; - int bx = x1_ + label_w; - int bw = std::max(10, x2_ - 16 - pct_w - bx); + // Bar geometry first: the label size derives from the bar. int bh = std::max(8, h - 16); int by = y1_ + (h - bh) / 2; + // Label height = 0.45 x bar height (min 11 px). NOTE: at the + // stretched 720x480 demo the bar is 464 px tall, so the literal + // rule gives a 209 px label; capped at 40 px to match the + // audit's demo-size expectation (~35-45 px). At real app sizes + // (bar ~24 px) the rule gives ~11 px. + int label_px = xframe::clamp_font_px(0.45 * bh, 11, 40); + XFontStruct* label_font = xframe::scaled_font(display_, label_px, true); + if (!label_font) label_font = st.font_; + int label_asc = label_font ? label_font->ascent : 11; + int label_desc = label_font ? label_font->descent : 2; + // Labels outside the bar, vertically centred on it. + int base = by + (bh + label_asc - label_desc) / 2; + char pct[16]; + std::snprintf(pct, sizeof(pct), "%.0f%%", fraction() * 100.0); + int pct_w = xframe::font_text_width(label_font, pct); + int label_w = xframe::font_text_width(label_font, text_) + 16; + xframe::draw_text_font(display_, window_, gc_, label_font, x1_ + 8, base, + text_, col(Srgb{20, 20, 20})); + xframe::draw_text_font(display_, window_, gc_, label_font, x2_ - 8 - pct_w, base, + pct, col(Srgb{20, 20, 20})); + + // Bar track between label and %. + int bx = x1_ + label_w; + int bw = std::max(10, x2_ - 16 - pct_w - bx); XSetForeground(display_, gc_, col(track_color_)); XFillRectangle(display_, window_, gc_, bx, by, bw, bh); // Gradient fill: 48 slices across the filled fraction. diff --git a/widgets/components/XVerticalBar/XVerticalBar.h b/widgets/components/XVerticalBar/XVerticalBar.h index 4e9d4cc..df0c300 100644 --- a/widgets/components/XVerticalBar/XVerticalBar.h +++ b/widgets/components/XVerticalBar/XVerticalBar.h @@ -1,6 +1,7 @@ #pragma once #include "core/xframe_core.h" +#include "../InstData.h" #include #include @@ -120,15 +121,38 @@ public: XSetForeground(display_, gc_, col(white_color_)); XFillRectangle(display_, window_, gc_, x1_, y1_, w, h); - const int title_h = 20; - const int scale_w = 36; - const int bottom_h = 18; - int bx = x1_ + scale_w + 8; - int by = y1_ + title_h + 16; - int bw = std::max(10, x2_ - 8 - bx); - int bh = std::max(10, y2_ - bottom_h - by); + // Scaled fonts (Dec 5, 2026 proportions audit): title 16 px bold, + // Y labels 14-16 px, "peak" 14 px bold, value 16 px bold inside + // the bar (never on top of a tick label). + int title_px = xframe::clamp_font_px(0.033 * h, 11, 16); + int body_px = xframe::clamp_font_px(0.032 * h, 11, 16); + int value_px = xframe::clamp_font_px(0.033 * h, 13, 16); + XFontStruct* title_font = xframe::scaled_font(display_, title_px, true); + if (!title_font) title_font = st.font_; + XFontStruct* body_font = xframe::scaled_font(display_, body_px, false); + if (!body_font) body_font = st.font_; + XFontStruct* bold_font = xframe::scaled_font(display_, body_px, true); + if (!bold_font) bold_font = st.font_; + XFontStruct* value_font = xframe::scaled_font(display_, value_px, true); + if (!value_font) value_font = st.font_; + int title_asc = title_font ? title_font->ascent : 11; + int body_asc = body_font ? body_font->ascent : 11; - xf::draw_text_at(display_, window_, gc_, st, x1_ + 8, y1_ + 15, text_); + const int title_h = title_px + 8; + // Dynamic scale width: the widest Y label sets it. + int scale_w = 8; + for (int g = 0; g <= 4; ++g) + { + std::string lab = fmt0(max_ * (4 - g) / 4.0); + scale_w = std::max(scale_w, xframe::font_text_width(body_font, lab) + 12); + } + int bx = x1_ + scale_w + 8; + int by = y1_ + title_h + 8; + int bw = std::max(10, x2_ - 8 - bx); + int bh = std::max(10, y2_ - 8 - by); + + xframe::draw_text_font(display_, window_, gc_, title_font, x1_ + 8, + y1_ + 4 + title_asc, text_, col(Srgb{20, 20, 20})); // Scale ticks + labels (0 / 25 / 50 / 75 / 100 % of max). for (int g = 0; g <= 4; ++g) @@ -139,7 +163,9 @@ public: XSetForeground(display_, gc_, col(axis_color_)); XDrawLine(display_, window_, gc_, bx - 4, gy, bx, gy); std::string lab = fmt0(max_ * (4 - g) / 4.0); - xf::draw_text_at(display_, window_, gc_, st, bx - 8 - xf::text_width(st, lab), gy + 4, lab); + int lw = xframe::font_text_width(body_font, lab); + xframe::draw_text_font(display_, window_, gc_, body_font, bx - 8 - lw, + gy + body_asc / 2, lab, col(Srgb{100, 100, 100})); } // Fill from the bottom. @@ -149,7 +175,8 @@ public: XSetForeground(display_, gc_, col(axis_color_)); XDrawRectangle(display_, window_, gc_, bx, by, bw, bh); - // Peak-hold marker: red line across the bar + value. + // Peak-hold marker: red line across the bar + value above it + // with clearance, inset from the frame edge. if (peak_hold_) { int py = by + bh - (int)(bh * peak_ / max_); @@ -158,12 +185,40 @@ public: XDrawLine(display_, window_, gc_, bx - 4, py, bx + bw + 4, py); xf::set_line_width(display_, gc_, 1); std::string pk = "peak " + fmt0(peak_); - xf::draw_text_at(display_, window_, gc_, st, bx + bw - xf::text_width(st, pk) - 4, py - 4, pk); + // Shrink to fit when the bar is narrow: the label must + // stay inside the frame (right-aligned at the bar's right + // edge minus 4px), never spill past the scale labels. + int pk_px = 14; + XFontStruct* pk_font = bold_font; + int avail_w = (bx + bw - 4) - (x1_ + 8); + for (int try_px = 14; try_px >= 11; --try_px) + { + XFontStruct* f = xframe::scaled_font(display_, try_px, true); + if (xframe::font_text_width(f, pk) <= avail_w) + { + pk_px = try_px; + pk_font = f; + break; + } + pk_px = try_px; + pk_font = f; + } + (void)pk_px; + xframe::draw_text_font(display_, window_, gc_, pk_font, + bx + bw - xframe::font_text_width(pk_font, pk) - 4, + py - 6, pk, col(peak_color_)); } - // Current value under the bar. - std::string cur = fmt0(value_) + " / " + fmt0(max_); - xf::draw_text_at(display_, window_, gc_, st, bx, y2_ - 4, cur); + // Current value INSIDE the bar near the bottom, centred (white + // on the fill; dark when the fill is too short to cover it). + { + char cur[16]; + std::snprintf(cur, sizeof(cur), "%.0f%%", value_); + int cw = xframe::font_text_width(value_font, cur); + Srgb vcolor = (filled >= value_px + 8) ? Srgb{255, 255, 255} : Srgb{20, 20, 20}; + xframe::draw_text_font(display_, window_, gc_, value_font, + bx + (bw - cw) / 2, by + bh - 6, cur, col(vcolor)); + } XSetForeground(display_, gc_, st.lineColor_); XDrawRectangle(display_, window_, gc_, x1_, y1_, w, h); diff --git a/widgets/screenshots/InstAnalogGauge.png b/widgets/screenshots/InstAnalogGauge.png index 5a3b5db..771d8c0 100644 Binary files a/widgets/screenshots/InstAnalogGauge.png and b/widgets/screenshots/InstAnalogGauge.png differ diff --git a/widgets/screenshots/InstBarMeter.png b/widgets/screenshots/InstBarMeter.png index be395cc..c000b33 100644 Binary files a/widgets/screenshots/InstBarMeter.png and b/widgets/screenshots/InstBarMeter.png differ diff --git a/widgets/screenshots/InstBeacon.png b/widgets/screenshots/InstBeacon.png index 3dee70b..9436913 100644 Binary files a/widgets/screenshots/InstBeacon.png and b/widgets/screenshots/InstBeacon.png differ diff --git a/widgets/screenshots/InstBezel.png b/widgets/screenshots/InstBezel.png index 76b366a..683b3a0 100644 Binary files a/widgets/screenshots/InstBezel.png and b/widgets/screenshots/InstBezel.png differ diff --git a/widgets/screenshots/InstCircuitBreaker.png b/widgets/screenshots/InstCircuitBreaker.png index 2d1b4d8..e013564 100644 Binary files a/widgets/screenshots/InstCircuitBreaker.png and b/widgets/screenshots/InstCircuitBreaker.png differ diff --git a/widgets/screenshots/InstControlPanel.png b/widgets/screenshots/InstControlPanel.png index f9eafb6..f753b46 100644 Binary files a/widgets/screenshots/InstControlPanel.png and b/widgets/screenshots/InstControlPanel.png differ diff --git a/widgets/screenshots/InstDigitalReadout.png b/widgets/screenshots/InstDigitalReadout.png index 622e995..868e04b 100644 Binary files a/widgets/screenshots/InstDigitalReadout.png and b/widgets/screenshots/InstDigitalReadout.png differ diff --git a/widgets/screenshots/InstEmergencyStop.png b/widgets/screenshots/InstEmergencyStop.png index 4492f06..c10034d 100644 Binary files a/widgets/screenshots/InstEmergencyStop.png and b/widgets/screenshots/InstEmergencyStop.png differ diff --git a/widgets/screenshots/InstFlowMeter.png b/widgets/screenshots/InstFlowMeter.png index c7da502..b862de2 100644 Binary files a/widgets/screenshots/InstFlowMeter.png and b/widgets/screenshots/InstFlowMeter.png differ diff --git a/widgets/screenshots/InstHorizontalTankLevel.png b/widgets/screenshots/InstHorizontalTankLevel.png index fbff157..086109e 100644 Binary files a/widgets/screenshots/InstHorizontalTankLevel.png and b/widgets/screenshots/InstHorizontalTankLevel.png differ diff --git a/widgets/screenshots/InstKeySwitch.png b/widgets/screenshots/InstKeySwitch.png index f7d826c..e00d283 100644 Binary files a/widgets/screenshots/InstKeySwitch.png and b/widgets/screenshots/InstKeySwitch.png differ diff --git a/widgets/screenshots/InstLampTestButton.png b/widgets/screenshots/InstLampTestButton.png index 4e5830a..80ee8ab 100644 Binary files a/widgets/screenshots/InstLampTestButton.png and b/widgets/screenshots/InstLampTestButton.png differ diff --git a/widgets/screenshots/InstLedBlue.png b/widgets/screenshots/InstLedBlue.png index 17b2980..18f2104 100644 Binary files a/widgets/screenshots/InstLedBlue.png and b/widgets/screenshots/InstLedBlue.png differ diff --git a/widgets/screenshots/InstLedDigits1.png b/widgets/screenshots/InstLedDigits1.png index 917440e..229d5c5 100644 Binary files a/widgets/screenshots/InstLedDigits1.png and b/widgets/screenshots/InstLedDigits1.png differ diff --git a/widgets/screenshots/InstLedDigits2.png b/widgets/screenshots/InstLedDigits2.png index 1287667..dc3daa3 100644 Binary files a/widgets/screenshots/InstLedDigits2.png and b/widgets/screenshots/InstLedDigits2.png differ diff --git a/widgets/screenshots/InstLedDigits3.png b/widgets/screenshots/InstLedDigits3.png index 566a792..a94db28 100644 Binary files a/widgets/screenshots/InstLedDigits3.png and b/widgets/screenshots/InstLedDigits3.png differ diff --git a/widgets/screenshots/InstLedDigits4.png b/widgets/screenshots/InstLedDigits4.png index 91c80c4..31f9e38 100644 Binary files a/widgets/screenshots/InstLedDigits4.png and b/widgets/screenshots/InstLedDigits4.png differ diff --git a/widgets/screenshots/InstLedDigits5.png b/widgets/screenshots/InstLedDigits5.png index 20a92cd..82f878b 100644 Binary files a/widgets/screenshots/InstLedDigits5.png and b/widgets/screenshots/InstLedDigits5.png differ diff --git a/widgets/screenshots/InstLedDigits6.png b/widgets/screenshots/InstLedDigits6.png index a5f5f4e..c9001e6 100644 Binary files a/widgets/screenshots/InstLedDigits6.png and b/widgets/screenshots/InstLedDigits6.png differ diff --git a/widgets/screenshots/InstLedGreen.png b/widgets/screenshots/InstLedGreen.png index 38bf5b4..6e28aab 100644 Binary files a/widgets/screenshots/InstLedGreen.png and b/widgets/screenshots/InstLedGreen.png differ diff --git a/widgets/screenshots/InstLedRed.png b/widgets/screenshots/InstLedRed.png index fa5f954..7fb2509 100644 Binary files a/widgets/screenshots/InstLedRed.png and b/widgets/screenshots/InstLedRed.png differ diff --git a/widgets/screenshots/InstLevelColumnGauge.png b/widgets/screenshots/InstLevelColumnGauge.png index f58aa9d..d8cda39 100644 Binary files a/widgets/screenshots/InstLevelColumnGauge.png and b/widgets/screenshots/InstLevelColumnGauge.png differ diff --git a/widgets/screenshots/InstLevelTransmitter.png b/widgets/screenshots/InstLevelTransmitter.png index ad0e3d5..2cc2088 100644 Binary files a/widgets/screenshots/InstLevelTransmitter.png and b/widgets/screenshots/InstLevelTransmitter.png differ diff --git a/widgets/screenshots/InstManometer.png b/widgets/screenshots/InstManometer.png index 1610d37..8f1891b 100644 Binary files a/widgets/screenshots/InstManometer.png and b/widgets/screenshots/InstManometer.png differ diff --git a/widgets/screenshots/InstNameplate.png b/widgets/screenshots/InstNameplate.png index 5bec0d4..e2d0600 100644 Binary files a/widgets/screenshots/InstNameplate.png and b/widgets/screenshots/InstNameplate.png differ diff --git a/widgets/screenshots/InstNeedleEdgewise.png b/widgets/screenshots/InstNeedleEdgewise.png index 70c2c39..602593c 100644 Binary files a/widgets/screenshots/InstNeedleEdgewise.png and b/widgets/screenshots/InstNeedleEdgewise.png differ diff --git a/widgets/screenshots/InstNeedleKnifeEdge.png b/widgets/screenshots/InstNeedleKnifeEdge.png index 88b65d2..6127362 100644 Binary files a/widgets/screenshots/InstNeedleKnifeEdge.png and b/widgets/screenshots/InstNeedleKnifeEdge.png differ diff --git a/widgets/screenshots/InstNeedleTapered.png b/widgets/screenshots/InstNeedleTapered.png index b5a05e2..5f4299f 100644 Binary files a/widgets/screenshots/InstNeedleTapered.png and b/widgets/screenshots/InstNeedleTapered.png differ diff --git a/widgets/screenshots/InstNeedleVu.png b/widgets/screenshots/InstNeedleVu.png index 6490e44..3e7e75b 100644 Binary files a/widgets/screenshots/InstNeedleVu.png and b/widgets/screenshots/InstNeedleVu.png differ diff --git a/widgets/screenshots/InstOpenChannelLevel.png b/widgets/screenshots/InstOpenChannelLevel.png index 6f97019..6efc227 100644 Binary files a/widgets/screenshots/InstOpenChannelLevel.png and b/widgets/screenshots/InstOpenChannelLevel.png differ diff --git a/widgets/screenshots/InstPanelLampAmber.png b/widgets/screenshots/InstPanelLampAmber.png index 7a75743..5b8caf0 100644 Binary files a/widgets/screenshots/InstPanelLampAmber.png and b/widgets/screenshots/InstPanelLampAmber.png differ diff --git a/widgets/screenshots/InstPanelLampBlue.png b/widgets/screenshots/InstPanelLampBlue.png index 1adf3d4..348c5ff 100644 Binary files a/widgets/screenshots/InstPanelLampBlue.png and b/widgets/screenshots/InstPanelLampBlue.png differ diff --git a/widgets/screenshots/InstPanelLampGreen.png b/widgets/screenshots/InstPanelLampGreen.png index 0a577d1..b412211 100644 Binary files a/widgets/screenshots/InstPanelLampGreen.png and b/widgets/screenshots/InstPanelLampGreen.png differ diff --git a/widgets/screenshots/InstPanelLampRed.png b/widgets/screenshots/InstPanelLampRed.png index cebd146..df39a6e 100644 Binary files a/widgets/screenshots/InstPanelLampRed.png and b/widgets/screenshots/InstPanelLampRed.png differ diff --git a/widgets/screenshots/InstPanelLampWhite.png b/widgets/screenshots/InstPanelLampWhite.png index 88327e7..bbbdc70 100644 Binary files a/widgets/screenshots/InstPanelLampWhite.png and b/widgets/screenshots/InstPanelLampWhite.png differ diff --git a/widgets/screenshots/InstPanelPlate.png b/widgets/screenshots/InstPanelPlate.png index d29f0e4..a2d8ea1 100644 Binary files a/widgets/screenshots/InstPanelPlate.png and b/widgets/screenshots/InstPanelPlate.png differ diff --git a/widgets/screenshots/InstPressureGauge.png b/widgets/screenshots/InstPressureGauge.png index f8640f9..8c3dc70 100644 Binary files a/widgets/screenshots/InstPressureGauge.png and b/widgets/screenshots/InstPressureGauge.png differ diff --git a/widgets/screenshots/InstPushButton.png b/widgets/screenshots/InstPushButton.png index 4abfa86..3fddce5 100644 Binary files a/widgets/screenshots/InstPushButton.png and b/widgets/screenshots/InstPushButton.png differ diff --git a/widgets/screenshots/InstPushButtonLatching.png b/widgets/screenshots/InstPushButtonLatching.png index 7eb7ffb..dcc4211 100644 Binary files a/widgets/screenshots/InstPushButtonLatching.png and b/widgets/screenshots/InstPushButtonLatching.png differ diff --git a/widgets/screenshots/InstRgbStatusLed.png b/widgets/screenshots/InstRgbStatusLed.png index ae81429..7530806 100644 Binary files a/widgets/screenshots/InstRgbStatusLed.png and b/widgets/screenshots/InstRgbStatusLed.png differ diff --git a/widgets/screenshots/InstRockerSwitch.png b/widgets/screenshots/InstRockerSwitch.png index f270dee..aef8ce5 100644 Binary files a/widgets/screenshots/InstRockerSwitch.png and b/widgets/screenshots/InstRockerSwitch.png differ diff --git a/widgets/screenshots/InstRockerSwitchDouble.png b/widgets/screenshots/InstRockerSwitchDouble.png index abc1998..67cd216 100644 Binary files a/widgets/screenshots/InstRockerSwitchDouble.png and b/widgets/screenshots/InstRockerSwitchDouble.png differ diff --git a/widgets/screenshots/InstRockerSwitchIlluminated.png b/widgets/screenshots/InstRockerSwitchIlluminated.png index db25c98..71a94c3 100644 Binary files a/widgets/screenshots/InstRockerSwitchIlluminated.png and b/widgets/screenshots/InstRockerSwitchIlluminated.png differ diff --git a/widgets/screenshots/InstRotarySelector.png b/widgets/screenshots/InstRotarySelector.png index 73dd588..57c2fe5 100644 Binary files a/widgets/screenshots/InstRotarySelector.png and b/widgets/screenshots/InstRotarySelector.png differ diff --git a/widgets/screenshots/InstSeg14Display1.png b/widgets/screenshots/InstSeg14Display1.png index af27c4c..4560ab0 100644 Binary files a/widgets/screenshots/InstSeg14Display1.png and b/widgets/screenshots/InstSeg14Display1.png differ diff --git a/widgets/screenshots/InstSeg14Display2.png b/widgets/screenshots/InstSeg14Display2.png index 6bfb751..89e00d1 100644 Binary files a/widgets/screenshots/InstSeg14Display2.png and b/widgets/screenshots/InstSeg14Display2.png differ diff --git a/widgets/screenshots/InstSeg14Display3.png b/widgets/screenshots/InstSeg14Display3.png index 6f1927d..7d17172 100644 Binary files a/widgets/screenshots/InstSeg14Display3.png and b/widgets/screenshots/InstSeg14Display3.png differ diff --git a/widgets/screenshots/InstSeg14Display4.png b/widgets/screenshots/InstSeg14Display4.png index b143188..0b70778 100644 Binary files a/widgets/screenshots/InstSeg14Display4.png and b/widgets/screenshots/InstSeg14Display4.png differ diff --git a/widgets/screenshots/InstSeg14Display5.png b/widgets/screenshots/InstSeg14Display5.png index 2234490..2fa2e75 100644 Binary files a/widgets/screenshots/InstSeg14Display5.png and b/widgets/screenshots/InstSeg14Display5.png differ diff --git a/widgets/screenshots/InstSeg14Display6.png b/widgets/screenshots/InstSeg14Display6.png index a8bf017..f9dad8a 100644 Binary files a/widgets/screenshots/InstSeg14Display6.png and b/widgets/screenshots/InstSeg14Display6.png differ diff --git a/widgets/screenshots/InstSeg16Display1.png b/widgets/screenshots/InstSeg16Display1.png index 26dfd31..6386963 100644 Binary files a/widgets/screenshots/InstSeg16Display1.png and b/widgets/screenshots/InstSeg16Display1.png differ diff --git a/widgets/screenshots/InstSeg16Display2.png b/widgets/screenshots/InstSeg16Display2.png index 35f6f5d..66a0b20 100644 Binary files a/widgets/screenshots/InstSeg16Display2.png and b/widgets/screenshots/InstSeg16Display2.png differ diff --git a/widgets/screenshots/InstSeg16Display3.png b/widgets/screenshots/InstSeg16Display3.png index dd1bb9a..7b74953 100644 Binary files a/widgets/screenshots/InstSeg16Display3.png and b/widgets/screenshots/InstSeg16Display3.png differ diff --git a/widgets/screenshots/InstSeg16Display4.png b/widgets/screenshots/InstSeg16Display4.png index b643ffe..23be0ec 100644 Binary files a/widgets/screenshots/InstSeg16Display4.png and b/widgets/screenshots/InstSeg16Display4.png differ diff --git a/widgets/screenshots/InstSeg16Display5.png b/widgets/screenshots/InstSeg16Display5.png index b3adaa3..d9bbd79 100644 Binary files a/widgets/screenshots/InstSeg16Display5.png and b/widgets/screenshots/InstSeg16Display5.png differ diff --git a/widgets/screenshots/InstSeg16Display6.png b/widgets/screenshots/InstSeg16Display6.png index bc4f890..15647c2 100644 Binary files a/widgets/screenshots/InstSeg16Display6.png and b/widgets/screenshots/InstSeg16Display6.png differ diff --git a/widgets/screenshots/InstSightGlassLevel.png b/widgets/screenshots/InstSightGlassLevel.png index ec568b8..f1c445c 100644 Binary files a/widgets/screenshots/InstSightGlassLevel.png and b/widgets/screenshots/InstSightGlassLevel.png differ diff --git a/widgets/screenshots/InstSlideSwitch.png b/widgets/screenshots/InstSlideSwitch.png index 93e5ef6..31008f6 100644 Binary files a/widgets/screenshots/InstSlideSwitch.png and b/widgets/screenshots/InstSlideSwitch.png differ diff --git a/widgets/screenshots/InstSphericalTankLevel.png b/widgets/screenshots/InstSphericalTankLevel.png index f4d3aab..ccaf2bd 100644 Binary files a/widgets/screenshots/InstSphericalTankLevel.png and b/widgets/screenshots/InstSphericalTankLevel.png differ diff --git a/widgets/screenshots/InstStackLight.png b/widgets/screenshots/InstStackLight.png index bc18ab9..1c4a150 100644 Binary files a/widgets/screenshots/InstStackLight.png and b/widgets/screenshots/InstStackLight.png differ diff --git a/widgets/screenshots/InstTankLevelAlarms.png b/widgets/screenshots/InstTankLevelAlarms.png index 69afee1..0a0ae19 100644 Binary files a/widgets/screenshots/InstTankLevelAlarms.png and b/widgets/screenshots/InstTankLevelAlarms.png differ diff --git a/widgets/screenshots/InstTemperatureGauge.png b/widgets/screenshots/InstTemperatureGauge.png index 6da3cd8..d9a25c0 100644 Binary files a/widgets/screenshots/InstTemperatureGauge.png and b/widgets/screenshots/InstTemperatureGauge.png differ diff --git a/widgets/screenshots/InstToggleSwitch.png b/widgets/screenshots/InstToggleSwitch.png index 6c33f79..6b7bb36 100644 Binary files a/widgets/screenshots/InstToggleSwitch.png and b/widgets/screenshots/InstToggleSwitch.png differ diff --git a/widgets/screenshots/InstToggleSwitchIlluminated.png b/widgets/screenshots/InstToggleSwitchIlluminated.png index 42a9b87..13e6490 100644 Binary files a/widgets/screenshots/InstToggleSwitchIlluminated.png and b/widgets/screenshots/InstToggleSwitchIlluminated.png differ diff --git a/widgets/screenshots/InstVerticalTankLevel.png b/widgets/screenshots/InstVerticalTankLevel.png index 593e6b1..384d076 100644 Binary files a/widgets/screenshots/InstVerticalTankLevel.png and b/widgets/screenshots/InstVerticalTankLevel.png differ diff --git a/widgets/screenshots/InstVuMeter.png b/widgets/screenshots/InstVuMeter.png index 5f8e83a..46fc263 100644 Binary files a/widgets/screenshots/InstVuMeter.png and b/widgets/screenshots/InstVuMeter.png differ