Belt printer: bring back the raw G-code view in the canvas view menu

The "Show raw G-code (belt only)" toggle, retired in #16236, returns as
an item of the Preview canvas view menu (with its B shortcut), and only
there: no legend checkbox.  Unlit, the preview shows the designed,
upright view; lit, the raw machine-frame G-code, which is what to look
at when checking the machine frame transforms.  The toggle is view
only; exported G-code is the same either way.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
harrierpigeon
2026-10-07 01:43:56 -05:00
co-authored by Claude Fable 5.1
parent ef3c47135f
commit e34f4aa0e5
9 changed files with 74 additions and 8 deletions
+19
View File
@@ -369,6 +369,25 @@ void Preview::reload_print(bool only_gcode)
m_only_gcode = only_gcode;
}
void Preview::refresh_belt_view()
{
// Re-run the G-code preview conversion so the belt "designed view" toggle takes effect
// (the back-transform is baked into the toolpath geometry in GCodeViewer::load_as_gcode,
// whose same-result cache also keys on the view state, so the re-convert runs).
// Reset m_loaded_print to bypass the "already loaded" guard the way reload_print does, but
// keep the current layer range and only-gcode mode so the view doesn't jump on toggle.
// The layer Z values differ between the designed and the raw view (the raw view's are
// machine-frame heights), so keep_z_range alone cannot find the old span: carry the
// slider over by layer index instead.
IMSlider *layers_slider = m_canvas->get_gcode_viewer().get_layers_slider();
const int lower = layers_slider->GetLowerValue();
const int higher = layers_slider->GetHigherValue();
m_loaded_print = nullptr;
load_print(true /*keep_z_range*/, m_only_gcode);
if (higher <= layers_slider->GetMaxValue())
layers_slider->SetSelectionSpan(lower, higher);
}
//BBS: always load shell at preview
void Preview::load_shells(const Print& print, bool force_previewing)
{