diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index 764456da..18b4b499 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -694,6 +694,10 @@ impl App { _ => continue, }; t.dvlc_set_cell(disp, ci, &encoded); + // The Errors cell gets the full message list as a hover tooltip. + if matches!(c, Column::Error) { + t.dvlc_set_cell_tooltip(disp, ci, &r.errors.join("\n")); + } } } if let Some(row) = top { diff --git a/thirdparty/wx-rs/patches/0002-widget-bridge-rs.patch b/thirdparty/wx-rs/patches/0002-widget-bridge-rs.patch index 95c0e655..75aa4e01 100644 --- a/thirdparty/wx-rs/patches/0002-widget-bridge-rs.patch +++ b/thirdparty/wx-rs/patches/0002-widget-bridge-rs.patch @@ -10,7 +10,7 @@ +pub use widgets::*; --- a/src/widgets.rs +++ b/src/widgets.rs -@@ -0,0 +1,720 @@ +@@ -0,0 +1,728 @@ +// widgets.rs — alkane-toolkit extension: Rust bindings for the widget bridge +// in cpp_src/widgets_bridge.cpp. Handles are opaque pointers owned by the +// wxWidgets object tree (parents own children; nothing to free in Rust). @@ -71,6 +71,7 @@ + pub fn wxbr_dvlc_clear(win: *mut c_void); + pub fn wxbr_dvlc_row_count(win: *mut c_void) -> c_int; + pub fn wxbr_dvlc_set_cell(win: *mut c_void, row: usize, col: usize, value: *const c_char); ++ pub fn wxbr_dvlc_set_cell_tooltip(win: *mut c_void, row: usize, col: usize, text: *const c_char); + pub fn wxbr_dvlc_get_cell(win: *mut c_void, row: usize, col: usize, buf: *mut c_char, cap: c_int) -> c_int; + pub fn wxbr_dvlc_col_count(win: *mut c_void) -> c_int; + pub fn wxbr_dvlc_autosize_col(win: *mut c_void, pos: c_int); @@ -495,6 +496,13 @@ + unsafe { notsafe::wxbr_dvlc_set_cell(self.0, row, col, c.as_ptr()) } + } + ++ /// Set the hover tooltip for one cell (empty clears it). GTK only; a no-op ++ /// on other platforms until they gain per-cell tooltip support. ++ pub fn dvlc_set_cell_tooltip(&self, row: usize, col: usize, text: &str) { ++ let c = CString::new(text).unwrap_or_default(); ++ unsafe { notsafe::wxbr_dvlc_set_cell_tooltip(self.0, row, col, c.as_ptr()) } ++ } ++ + pub fn dvlc_get_cell(&self, row: usize, col: usize) -> Option { + let mut buf = vec![0i8; 4096]; + let n = unsafe { diff --git a/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch b/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch index a97e0856..d62ea92e 100644 --- a/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch +++ b/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch @@ -1,6 +1,6 @@ --- a/cpp_src/widgets_bridge.cpp +++ b/cpp_src/widgets_bridge.cpp -@@ -0,0 +1,1009 @@ +@@ -0,0 +1,1059 @@ +// widgets_bridge.cpp — alkane-toolkit extension to wx-rs +// Adds the widget/event surface the toolkit UI needs on top of the upstream +// render-callback bridge (which is kept untouched). @@ -80,6 +80,9 @@ + public: + std::vector row_fg; + wxColour zebra; // odd-row background; unset (=off) unless the app sets it ++ // Per-cell hover tooltip text, keyed by (row, model column). Used for the ++ // Errors column's full-message tooltip (see the GTK query-tooltip handler). ++ std::map, wxString> cell_tip; + bool GetAttrByRow(unsigned int row, unsigned int col, + wxDataViewItemAttr& attr) const override { + (void)col; @@ -462,6 +465,36 @@ + return static_cast(((wxDataViewCtrl*)win)->GetModel()); +} + ++#ifdef __WXGTK__ ++// GtkTreeView "query-tooltip" handler: show the per-cell tooltip stored for the ++// (row, model column) under the pointer (used by the Errors column). wx does ++// not surface per-cell tooltips on wxDataViewCtrl, and mouse-motion events are ++// not delivered to wx handlers on the native GTK control, so this hooks the ++// native signal directly. ++static gboolean dvlc_query_tooltip(GtkWidget* tv, gint x, gint y, gboolean keyboard, ++ GtkTooltip* tooltip, gpointer user_data) { ++ (void)keyboard; ++ wxDataViewCtrl* dv = static_cast(user_data); ++ gint bx = 0, by = 0; ++ gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(tv), x, y, &bx, &by); ++ GtkTreePath* path = nullptr; ++ GtkTreeViewColumn* gcol = nullptr; ++ if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), bx, by, &path, &gcol, nullptr, nullptr)) ++ return FALSE; ++ gint* idx = gtk_tree_path_get_indices(path); ++ int row = idx ? idx[0] : -1; ++ gtk_tree_path_free(path); ++ if (row < 0 || !gcol) return FALSE; ++ wxDataViewColumn* wxcol = dv->GTKColumnToWX(gcol); ++ if (!wxcol) return FALSE; ++ AttrListStore* store = static_cast(dv->GetModel()); ++ auto it = store->cell_tip.find({(unsigned)row, wxcol->GetModelColumn()}); ++ if (it == store->cell_tip.end() || it->second.IsEmpty()) return FALSE; ++ gtk_tooltip_set_text(tooltip, it->second.utf8_str()); ++ return TRUE; ++} ++#endif ++ +void* wxbr_dvlc(void* parent) { + // Multi-select (ctrl/shift-click) + row lines. Selection replaces the old + // checkbox column. A custom AttrListStore backs it so rows can be coloured by @@ -507,7 +540,12 @@ + // inapplicable on GTK.) + { + GtkWidget* tv = dv->GtkGetTreeView(); -+ if (tv) gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE); ++ if (tv) { ++ gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE); ++ // Per-cell hover tooltips (Errors column) via the native signal. ++ gtk_widget_set_has_tooltip(tv, TRUE); ++ g_signal_connect(tv, "query-tooltip", G_CALLBACK(dvlc_query_tooltip), dv); ++ } + } +#else + // Non-GTK fallback: track a drag anchor and extend the selection to the row @@ -625,6 +663,18 @@ + AttrListStore* store = dvlc_store(win); + store->DeleteAllItems(); + store->row_fg.clear(); ++ store->cell_tip.clear(); ++} ++ ++// Set (or clear, with an empty string) the hover tooltip for one cell, ++// addressed by (row, model column). Used for the Errors column's full text. ++void wxbr_dvlc_set_cell_tooltip(void* win, unsigned row, unsigned col, const char* text) { ++ AttrListStore* store = dvlc_store(win); ++ if (text && text[0]) { ++ store->cell_tip[{row, col}] = wxString::FromUTF8(text); ++ } else { ++ store->cell_tip.erase({row, col}); ++ } +} + +// Set (or clear, when r<0) a row's text colour; used to paint rows by status. diff --git a/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp b/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp index 7cc6daa0..4f11c301 100644 --- a/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp +++ b/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp @@ -77,6 +77,9 @@ class AttrListStore : public wxDataViewListStore { public: std::vector row_fg; wxColour zebra; // odd-row background; unset (=off) unless the app sets it + // Per-cell hover tooltip text, keyed by (row, model column). Used for the + // Errors column's full-message tooltip (see the GTK query-tooltip handler). + std::map, wxString> cell_tip; bool GetAttrByRow(unsigned int row, unsigned int col, wxDataViewItemAttr& attr) const override { (void)col; @@ -459,6 +462,36 @@ static AttrListStore* dvlc_store(void* win) { return static_cast(((wxDataViewCtrl*)win)->GetModel()); } +#ifdef __WXGTK__ +// GtkTreeView "query-tooltip" handler: show the per-cell tooltip stored for the +// (row, model column) under the pointer (used by the Errors column). wx does +// not surface per-cell tooltips on wxDataViewCtrl, and mouse-motion events are +// not delivered to wx handlers on the native GTK control, so this hooks the +// native signal directly. +static gboolean dvlc_query_tooltip(GtkWidget* tv, gint x, gint y, gboolean keyboard, + GtkTooltip* tooltip, gpointer user_data) { + (void)keyboard; + wxDataViewCtrl* dv = static_cast(user_data); + gint bx = 0, by = 0; + gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(tv), x, y, &bx, &by); + GtkTreePath* path = nullptr; + GtkTreeViewColumn* gcol = nullptr; + if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), bx, by, &path, &gcol, nullptr, nullptr)) + return FALSE; + gint* idx = gtk_tree_path_get_indices(path); + int row = idx ? idx[0] : -1; + gtk_tree_path_free(path); + if (row < 0 || !gcol) return FALSE; + wxDataViewColumn* wxcol = dv->GTKColumnToWX(gcol); + if (!wxcol) return FALSE; + AttrListStore* store = static_cast(dv->GetModel()); + auto it = store->cell_tip.find({(unsigned)row, wxcol->GetModelColumn()}); + if (it == store->cell_tip.end() || it->second.IsEmpty()) return FALSE; + gtk_tooltip_set_text(tooltip, it->second.utf8_str()); + return TRUE; +} +#endif + void* wxbr_dvlc(void* parent) { // Multi-select (ctrl/shift-click) + row lines. Selection replaces the old // checkbox column. A custom AttrListStore backs it so rows can be coloured by @@ -504,7 +537,12 @@ void* wxbr_dvlc(void* parent) { // inapplicable on GTK.) { GtkWidget* tv = dv->GtkGetTreeView(); - if (tv) gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE); + if (tv) { + gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tv), TRUE); + // Per-cell hover tooltips (Errors column) via the native signal. + gtk_widget_set_has_tooltip(tv, TRUE); + g_signal_connect(tv, "query-tooltip", G_CALLBACK(dvlc_query_tooltip), dv); + } } #else // Non-GTK fallback: track a drag anchor and extend the selection to the row @@ -622,6 +660,18 @@ void wxbr_dvlc_clear(void* win) { AttrListStore* store = dvlc_store(win); store->DeleteAllItems(); store->row_fg.clear(); + store->cell_tip.clear(); +} + +// Set (or clear, with an empty string) the hover tooltip for one cell, +// addressed by (row, model column). Used for the Errors column's full text. +void wxbr_dvlc_set_cell_tooltip(void* win, unsigned row, unsigned col, const char* text) { + AttrListStore* store = dvlc_store(win); + if (text && text[0]) { + store->cell_tip[{row, col}] = wxString::FromUTF8(text); + } else { + store->cell_tip.erase({row, col}); + } } // Set (or clear, when r<0) a row's text colour; used to paint rows by status. diff --git a/thirdparty/wx-rs/wx-rs-0.2.0-patched/src/widgets.rs b/thirdparty/wx-rs/wx-rs-0.2.0-patched/src/widgets.rs index 81cb9953..31cc6b6d 100644 --- a/thirdparty/wx-rs/wx-rs-0.2.0-patched/src/widgets.rs +++ b/thirdparty/wx-rs/wx-rs-0.2.0-patched/src/widgets.rs @@ -58,6 +58,7 @@ mod notsafe { pub fn wxbr_dvlc_clear(win: *mut c_void); pub fn wxbr_dvlc_row_count(win: *mut c_void) -> c_int; pub fn wxbr_dvlc_set_cell(win: *mut c_void, row: usize, col: usize, value: *const c_char); + pub fn wxbr_dvlc_set_cell_tooltip(win: *mut c_void, row: usize, col: usize, text: *const c_char); pub fn wxbr_dvlc_get_cell(win: *mut c_void, row: usize, col: usize, buf: *mut c_char, cap: c_int) -> c_int; pub fn wxbr_dvlc_col_count(win: *mut c_void) -> c_int; pub fn wxbr_dvlc_autosize_col(win: *mut c_void, pos: c_int); @@ -482,6 +483,13 @@ impl Widget { unsafe { notsafe::wxbr_dvlc_set_cell(self.0, row, col, c.as_ptr()) } } + /// Set the hover tooltip for one cell (empty clears it). GTK only; a no-op + /// on other platforms until they gain per-cell tooltip support. + pub fn dvlc_set_cell_tooltip(&self, row: usize, col: usize, text: &str) { + let c = CString::new(text).unwrap_or_default(); + unsafe { notsafe::wxbr_dvlc_set_cell_tooltip(self.0, row, col, c.as_ptr()) } + } + pub fn dvlc_get_cell(&self, row: usize, col: usize) -> Option { let mut buf = vec![0i8; 4096]; let n = unsafe {