Give Commit to Plate and the bed toggle a keyboard, on a Ctrl+Shift layer

Both were mouse-only: Commit to Plate is a toolbar button bound to wxEVT_BUTTON,
the bed is a CheckBox, and neither had an accelerator. That put them out of
reach of anything driving the keyboard, and out of reach of a hand that had not
already left the model to find them.

Ctrl+Shift, because the Shift+letter space is full to the last letter and
because the char hook deliberately ignores every Ctrl-combo -- which is exactly
what leaves this layer free to claim. P is Plate and B is Bed; neither collides
with OrcaSlicer own Ctrl+Shift+S (Save as) or Ctrl+Shift+G (Print plate), and
nothing else in the tree binds either.

The lookup goes ahead of the guard that drops Ctrl-combos, and nothing already
bound changes meaning: a plain Shift+letter still resolves as before, because
the new layer only answers when Ctrl is held as well.

The bed toggle drives the checkbox rather than the viewport alone, so the
control and the view cannot disagree about what is shown, and it says which it
did in the status line.

Both verified on the running build: Ctrl+Shift+B toggles the grid and the
checkbox together, Ctrl+Shift+P commits to Prepare.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tommaso Bianchi
2026-08-21 16:25:29 +02:00
co-authored by Claude Opus 5
parent eb66e45b7b
commit 3ad6d2fd50
2 changed files with 24 additions and 0 deletions
+20
View File
@@ -473,6 +473,19 @@ DesignPanel::DesignPanel(wxWindow* parent)
set_status(_L("Isometric view, fitted"));
};
// Commit to Plate and the bed toggle were mouse-only: a toolbar button and a checkbox with
// no accelerator between them, so neither could be reached from the keyboard at all, nor by
// anything driving the keyboard. Ctrl+Shift+P is Plate, Ctrl+Shift+B is Bed; neither
// collides with Orca's own Ctrl+Shift+S (Save as) or Ctrl+Shift+G (Print plate).
m_keys_feature['P' | SC_SHIFT | SC_CTRL] = [this] { on_commit(); };
m_keys_feature['B' | SC_SHIFT | SC_CTRL] = [this] {
if (!m_show_bed) return;
const bool show = !m_show_bed->GetValue();
m_show_bed->SetValue(show);
if (m_viewport) m_viewport->set_show_bed(show);
set_status(show ? _L("Bed shown") : _L("Bed hidden"));
};
// Shared flyout glyph tint (used by BOTH the feature and sketch toolbars). Re-tint each
// design_* glyph to the DropDown's resolved TEXT colour so it reads on the popup in either
// theme: text_color is 0x363636, which darkModeColorFor() maps to a light tone in dark mode
@@ -3953,6 +3966,13 @@ DesignPanel::DesignPanel(wxWindow* parent)
auto it2 = m_keys_sketch.find(up2);
if (it2 != m_keys_sketch.end()) { it2->second(); return; }
}
// Ctrl+Shift first: the block below deliberately ignores every Ctrl-combo, which is
// exactly what makes this layer free to use.
if (!in_text && ctrl && e.ShiftDown()) {
const int up = (key >= 'a' && key <= 'z') ? key - 'a' + 'A' : key;
auto it = m_keys_feature.find(up | SC_SHIFT | SC_CTRL);
if (it != m_keys_feature.end()) { it->second(); return; }
}
if (!in_text && !ctrl) {
const int up = (key >= 'a' && key <= 'z') ? key - 'a' + 'A' : key; // normalise case
if (sketch_mode) {
+4
View File
@@ -305,6 +305,10 @@ private:
// while a sketch is open (single letters = sketch tools); m_keys_feature fires only when
// no sketch is open (Shift+letter = feature tools; single letters = view toggles/section).
static constexpr int SC_SHIFT = 0x10000;
// ...and with 0x20000 when Ctrl is required too. The Shift+letter space is full, so an
// action that arrives late lives on Ctrl+Shift; plain Ctrl-combos are still passed
// straight through, which is what leaves this layer free.
static constexpr int SC_CTRL = 0x20000;
std::map<int, std::function<void()>> m_keys_sketch;
std::map<int, std::function<void()>> m_keys_feature;