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
+65
-3
No files matched your search
+10
@@ -1826,7 +1826,13 @@ void rebuild_cursors_pane(App& app) {
|
|||||||
for (int r = 0; r < app.rows->row_count(); ++r) {
|
for (int r = 0; r < app.rows->row_count(); ++r) {
|
||||||
if (!rulers) break;
|
if (!rulers) break;
|
||||||
char who[64];
|
char who[64];
|
||||||
|
// A row split into cells names its plots the way the rest of the UI does ("plot 2a"); an
|
||||||
|
// unsplit row keeps the wording it always had.
|
||||||
|
if (app.rows->cells_in_row(app.rows->figure_row_of(r)) > 1) {
|
||||||
|
std::snprintf(who, sizeof(who), "plot %s", app.rows->plot_label(r).c_str());
|
||||||
|
} else {
|
||||||
std::snprintf(who, sizeof(who), "row %d", r);
|
std::snprintf(who, sizeof(who), "row %d", r);
|
||||||
|
}
|
||||||
app.cursors_lines.push_back(cursors_line(app, who, plot::Color::hex(0), false));
|
app.cursors_lines.push_back(cursors_line(app, who, plot::Color::hex(0), false));
|
||||||
app.cursors_lines.back().row = r;
|
app.cursors_lines.back().row = r;
|
||||||
app.cursors_lines.back().slot = -1;
|
app.cursors_lines.back().slot = -1;
|
||||||
@@ -7011,6 +7017,10 @@ int run_ui(int argc, char** argv, const Config& cfg, ScopeModel& model, Acquisit
|
|||||||
}
|
}
|
||||||
std::printf("]");
|
std::printf("]");
|
||||||
}
|
}
|
||||||
|
// The split, appended so every field before it keeps its place: cells per figure row, and the
|
||||||
|
// cell weights per figure row (`|` between rows, empty for an unsplit one). RowSet only.
|
||||||
|
std::printf(" cells=[%s] colweights=[%s]", layout_cells_text(rows).c_str(),
|
||||||
|
layout_colweights_text(rows).c_str());
|
||||||
std::printf("\n");
|
std::printf("\n");
|
||||||
for (int r = 0; r < rows.row_count() && r < RowSet::kMaxRows; ++r) {
|
for (int r = 0; r < rows.row_count() && r < RowSet::kMaxRows; ++r) {
|
||||||
for (int s = 0; s < RowSet::kSlotsPerRow; ++s) {
|
for (int s = 0; s < RowSet::kSlotsPerRow; ++s) {
|
||||||
|
|||||||
@@ -2112,6 +2112,11 @@ GtkWidget* layout_cell_button(App& a, int fr, int pos);
|
|||||||
GtkWidget* layout_col_handle(App& a, int plot);
|
GtkWidget* layout_col_handle(App& a, int plot);
|
||||||
void layout_col_apply(App& app, int plot, double offset_px);
|
void layout_col_apply(App& app, int plot, double offset_px);
|
||||||
void layout_probe_report(App& a, const char* what);
|
void layout_probe_report(App& a, const char* what);
|
||||||
|
/// The split in the report lines, from the `RowSet` alone (no widget is asked, so the exit dump can
|
||||||
|
/// use them): cells per figure row (`1,2,1`) and each figure row's cell weights, rows divided by `|`
|
||||||
|
/// and empty for an unsplit row (`|0.3,0.7|`).
|
||||||
|
std::string layout_cells_text(const RowSet& rs);
|
||||||
|
std::string layout_colweights_text(const RowSet& rs);
|
||||||
void layout_click(GtkWidget* b);
|
void layout_click(GtkWidget* b);
|
||||||
void layout_probe_next(App& a, int step, guint delay_ms);
|
void layout_probe_next(App& a, int step, guint delay_ms);
|
||||||
gboolean layout_probe_step(gpointer user);
|
gboolean layout_probe_step(gpointer user);
|
||||||
|
|||||||
+50
-3
@@ -3384,6 +3384,28 @@ gboolean window_probe(gpointer user) {
|
|||||||
return G_SOURCE_REMOVE;
|
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) {
|
void layout_probe_report(App& a, const char* what) {
|
||||||
const int rows = a.rows->row_count();
|
const int rows = a.rows->row_count();
|
||||||
const double scale = (a.area != nullptr && a.area->device_scale() > 0.0f)
|
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] "
|
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,
|
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(),
|
done_box.c_str(), geom.c_str(), close_tops.c_str(), add_tops.c_str(),
|
||||||
resize_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`
|
// 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
|
// 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.
|
// 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);
|
std::fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4323,9 +4347,32 @@ gboolean split_probe_step(gpointer user) {
|
|||||||
split_probe_next(*a);
|
split_probe_next(*a);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 18:
|
case 18: {
|
||||||
split_probe_report(*a, "after-assign");
|
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;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user