jotpluggler: fix custom series loading (#39188)

* tools: evaluate custom series when layouts load or reset

reload_layout/reset_layout never refreshed custom curves, so custom series stayed empty until the next route load (curves without local samples are dropped by plot.cc).

* tools: restore subplots after closing the custom series editor

The editor replaces the subplots while it is open; on close the subplots stayed collapsed into a single pane until a window resize. Reselect the workspace tab and rebuild its view.

* tools: allow reloading the current layout

Selecting the already-current layout did nothing. Reload it like any other layout selection.
This commit is contained in:
dzid26
2026-11-08 23:19:24 +00:00
committed by GitHub
parent ac17dbac0f
commit f5dfddb72a
2 changed files with 10 additions and 2 deletions
+8 -2
View File
@@ -829,7 +829,7 @@ void draw_sidebar(AppSession *session, const UiMetrics &ui, UiState *state, bool
const std::string current_layout = session->layout_path.empty() ? std::string("untitled") : session->layout_path.stem().string();
for (const std::string &layout_name : layouts) {
const bool selected = layout_name == current_layout;
if (ImGui::Selectable(layout_name.c_str(), selected) && !selected) {
if (ImGui::Selectable(layout_name.c_str(), selected)) {
reload_layout(session, state, layout_name);
}
if (selected) {
@@ -1644,7 +1644,8 @@ void draw_workspace(AppSession *session, const UiMetrics &ui, UiState *state) {
};
TabActionKind pending_action = TabActionKind::None;
int pending_tab_index = -1;
bool custom_series_tab_open = state->custom_series.open;
const bool custom_open_at_start = state->custom_series.open;
bool custom_series_tab_open = custom_open_at_start;
bool suppress_aux_tabs_this_frame = state->request_close_tab && session->layout.tabs.size() == 1;
for (size_t i = 0; i < session->layout.tabs.size(); ++i) {
const WorkspaceTab &tab = session->layout.tabs[i];
@@ -1768,6 +1769,11 @@ void draw_workspace(AppSession *session, const UiMetrics &ui, UiState *state) {
state->custom_series.open = false;
state->custom_series.request_select = false;
}
if (custom_open_at_start && !state->custom_series.open) {
// Editor hid the DockSpace while open (render.cc); rebuild dock tree on close.
request_tab_selection(state, state->active_tab_index);
mark_tab_dock_dirty(state, state->active_tab_index);
}
if (rename_tab_rect.has_value()) {
draw_inline_tab_editor(session, state, *rename_tab_rect);
+2
View File
@@ -477,6 +477,7 @@ bool reset_layout(AppSession *session, UiState *state) {
session->autosave_path = autosave_path_for_layout(session->layout_path);
state->undo.reset(session->layout);
refresh_replaced_layout_ui(session, state, false);
refresh_all_custom_curves(session, state);
reset_shared_range(state, *session);
state->status_text = "Reset layout";
return true;
@@ -501,6 +502,7 @@ bool reload_layout(AppSession *session, UiState *state, const std::string &layou
state->layout_dirty = load_draft;
state->undo.reset(session->layout);
refresh_replaced_layout_ui(session, state, true);
refresh_all_custom_curves(session, state);
if (preserve_shared_range) {
state->has_shared_range = true;
state->x_view_min = preserved_x_min;