Reworks the fleet-view toolbar into icon buttons and adds a direct Installation-Media entry point: - New wx-rs bridge fn `wxbr_svg_button` (patch 0010): render a recoloured SVG into a clickable wxBitmapButton. Rust wrapper `Widget::svg_button`. - Settings -> gear icon; its dropdown already carries Logs (ID_LOGS_OPEN), so the standalone Log toolbar button is removed (the inline log view + toggle are kept but no longer surfaced as a button). - Bug report -> bug icon. - New unified "Data" icon (database) with a dropdown: Presets, Filter, Columns, Export (the four former standalone buttons; items dispatched via on_menu_item). - New "SD card" icon opens the Installation Media dialog without right-clicking a miner (ID_MEDIA_TOOLBAR -> build_install_media_dialog; defaults to the zynq-7010 board when nothing is selected). - Four new Font-Awesome-style icons (gear/bug/database/sd-card), recoloured to the theme foreground via svg_recolored; tooltips name each button. Native + Windows clippy clean, fmt clean, GUI self-test passes; icons verified to rasterise correctly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
57 lines
2.6 KiB
Diff
57 lines
2.6 KiB
Diff
Subject: [PATCH 0010] svg_button: clickable SVG icon button for the toolbar
|
|
|
|
--- a/cpp_src/widgets_bridge.cpp
|
|
+++ b/cpp_src/widgets_bridge.cpp
|
|
@@ -2140,6 +2140,18 @@
|
|
return (void*)new wxStaticBitmap((wxWindow*)parent, wxID_ANY, bundle);
|
|
}
|
|
|
|
+// Like wxbr_svg_icon, but a clickable button: render the (already-recoloured)
|
|
+// SVG into a w x h DIP bitmap bundle and wrap it in a wxBitmapButton that emits
|
|
+// WxEV_BUTTON_CLICKED with `id`. Used for the toolbar's icon buttons.
|
|
+void* wxbr_svg_button(void* parent, const char* svg, int id, int w, int h) {
|
|
+ wxBitmapBundle bundle = wxBitmapBundle::FromSVG(svg, wxSize(w, h));
|
|
+ wxBitmapButton* btn = new wxBitmapButton((wxWindow*)parent, id, bundle);
|
|
+ btn->Bind(wxEVT_BUTTON, [id](wxCommandEvent&) {
|
|
+ if (g_widget_event) g_widget_event(WxEV_BUTTON_CLICKED, id, 0);
|
|
+ });
|
|
+ return (void*)btn;
|
|
+}
|
|
+
|
|
// Register a raw SVG (with its viewBox width/height for aspect) for a table-cell
|
|
// shape sentinel, so the SegmentRenderer can draw it recoloured to the cell's
|
|
// segment colour (round 12 #9 access padlocks, #11 status KPI icons). Replaces
|
|
--- a/src/widgets.rs
|
|
+++ b/src/widgets.rs
|
|
@@ -121,6 +121,13 @@
|
|
pub fn wxbr_choice_set_selection(win: *mut c_void, i: c_int);
|
|
pub fn wxbr_media_button(parent: *mut c_void, id: c_int, kind: c_int, r: c_int, g: c_int, b: c_int) -> *mut c_void;
|
|
pub fn wxbr_svg_icon(parent: *mut c_void, svg: *const c_char, w: c_int, h: c_int) -> *mut c_void;
|
|
+ pub fn wxbr_svg_button(
|
|
+ parent: *mut c_void,
|
|
+ svg: *const c_char,
|
|
+ id: c_int,
|
|
+ w: c_int,
|
|
+ h: c_int,
|
|
+ ) -> *mut c_void;
|
|
pub fn wxbr_register_shape_svg(sentinel: c_int, svg: *const c_char, vbw: c_int, vbh: c_int);
|
|
pub fn wxbr_set_light_pulse(on: c_int);
|
|
pub fn wxbr_bind_sys_colour(win: *mut c_void);
|
|
@@ -949,6 +956,16 @@
|
|
Widget(unsafe { notsafe::wxbr_svg_icon(parent.0, c.as_ptr(), w as c_int, h as c_int) })
|
|
}
|
|
|
|
+ /// A clickable icon button: render the (already-recoloured) SVG into a
|
|
+ /// `w`x`h` DIP bitmap button that emits a button click with `id`. Recolour
|
|
+ /// the SVG first (explicit fill, not `currentColor`).
|
|
+ pub fn svg_button(parent: Widget, svg: &str, id: i32, w: i32, h: i32) -> Widget {
|
|
+ let c = CString::new(svg).unwrap_or_default();
|
|
+ Widget(unsafe {
|
|
+ notsafe::wxbr_svg_button(parent.0, c.as_ptr(), id as c_int, w as c_int, h as c_int)
|
|
+ })
|
|
+ }
|
|
+
|
|
/// Listen for OS light/dark theme changes on this window (emits `SysColour`).
|
|
pub fn bind_sys_colour(&self) {
|
|
unsafe { notsafe::wxbr_bind_sys_colour(self.0) }
|