probes: print cells and column weights; split-row ruler label
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f3e3597af
commit
7730b35fe3
3 files changed
+66
-4
No files matched your search
+50
-3
@@ -3384,6 +3384,28 @@ gboolean window_probe(gpointer user) {
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
std::string layout_cells_text(const RowSet& rs) {
|
||||
std::string out;
|
||||
for (int fr = 0; fr < rs.figure_row_count(); ++fr) {
|
||||
out += (fr == 0 ? "" : ",") + std::to_string(rs.cells_in_row(fr));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string layout_colweights_text(const RowSet& rs) {
|
||||
std::string out;
|
||||
for (int fr = 0; fr < rs.figure_row_count(); ++fr) {
|
||||
if (fr != 0) out += "|";
|
||||
const std::vector<float>& w = rs.cell_weights(fr);
|
||||
for (std::size_t k = 0; k < w.size(); ++k) {
|
||||
char buf[32];
|
||||
std::snprintf(buf, sizeof(buf), "%s%g", k == 0 ? "" : ",", static_cast<double>(w[k]));
|
||||
out += buf;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
void layout_probe_report(App& a, const char* what) {
|
||||
const int rows = a.rows->row_count();
|
||||
const double scale = (a.area != nullptr && a.area->device_scale() > 0.0f)
|
||||
@@ -3459,7 +3481,8 @@ void layout_probe_report(App& a, const char* what) {
|
||||
}
|
||||
}
|
||||
std::fprintf(stderr, "[layout-probe] %-12s rows=%d buttons=%zu done=%d done_box=[%s] "
|
||||
"rows_y=[%s] close=[%s] add=[%s] resize=[%s] traces=[%s] side_w=%d\n",
|
||||
"rows_y=[%s] close=[%s] add=[%s] resize=[%s] traces=[%s] side_w=%d cells=[%s] "
|
||||
"colweights=[%s]\n",
|
||||
what, rows, a.layout_buttons.size(), a.layout_done_button != nullptr ? 1 : 0,
|
||||
done_box.c_str(), geom.c_str(), close_tops.c_str(), add_tops.c_str(),
|
||||
resize_tops.c_str(),
|
||||
@@ -3467,7 +3490,8 @@ void layout_probe_report(App& a, const char* what) {
|
||||
// The sidebar, which is the pane a divider position can silently take away: `side_w`
|
||||
// must be its own request (320) rather than 0, and `divider` the position the window's
|
||||
// width less the sidebar's column left it at.
|
||||
a.side_box != nullptr ? gtk_widget_get_width(a.side_box) : -1);
|
||||
a.side_box != nullptr ? gtk_widget_get_width(a.side_box) : -1,
|
||||
layout_cells_text(*a.rows).c_str(), layout_colweights_text(*a.rows).c_str());
|
||||
std::fflush(stderr);
|
||||
}
|
||||
|
||||
@@ -4323,9 +4347,32 @@ gboolean split_probe_step(gpointer user) {
|
||||
split_probe_next(*a);
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
case 18: {
|
||||
split_probe_report(*a, "after-assign");
|
||||
// The cursors pane's ruler labels (`rebuild_cursors_pane()`, ruler modes): a plot of a split row is
|
||||
// "plot <label>", a plot of an unsplit row keeps "row <index>". Both arrangements are read off the
|
||||
// pane's own label widgets, the all-split one first and a mixed one second.
|
||||
const RowSet::CursorMode was_mode = rs.cursor_mode();
|
||||
rs.set_cursor_mode(RowSet::CursorMode::Both);
|
||||
const auto ruler_labels = [&]() {
|
||||
rebuild_cursors_pane(*a);
|
||||
std::string out;
|
||||
for (const App::CursorLine& line : a->cursors_lines) {
|
||||
if (line.slot != -1 || line.label == nullptr) continue;
|
||||
out += (out.empty() ? "" : ",") + std::string(gtk_label_get_text(GTK_LABEL(line.label)));
|
||||
}
|
||||
return out;
|
||||
};
|
||||
const std::string split_labels = ruler_labels();
|
||||
rs.set_cells_per_row({1, 2});
|
||||
split_probe_restructured(*a);
|
||||
const std::string mixed_labels = ruler_labels();
|
||||
std::fprintf(stderr, "[split-probe] ruler-labels split=[%s] mixed=[%s]\n", split_labels.c_str(),
|
||||
mixed_labels.c_str());
|
||||
rs.set_cursor_mode(was_mode);
|
||||
rebuild_cursors_pane(*a);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user