Tech ENABLE_ARROW_KEYS_WITH_SLIDERS set as default
This commit is contained in:
parent
77be228b75
commit
7c3e3272aa
8 changed files with 2 additions and 66 deletions
|
@ -85,7 +85,6 @@
|
|||
//===================
|
||||
#define ENABLE_2_3_0_BETA2 1
|
||||
|
||||
#define ENABLE_ARROW_KEYS_WITH_SLIDERS (1 && ENABLE_2_3_0_BETA2)
|
||||
#define ENABLE_NEW_NOTIFICATIONS_FADE_OUT (1 && ENABLE_2_3_0_BETA2)
|
||||
#define ENABLE_PREVIEW_TYPE_CHANGE (1 && ENABLE_2_3_0_BETA2)
|
||||
|
||||
|
|
|
@ -1558,9 +1558,8 @@ void Control::move_current_thumb(const bool condition)
|
|||
if (accelerator > 0)
|
||||
delta *= accelerator;
|
||||
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
if (m_selection == ssUndef) m_selection = ssHigher;
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
if (m_selection == ssUndef)
|
||||
m_selection = ssHigher;
|
||||
|
||||
if (m_selection == ssLower) {
|
||||
m_lower_value -= delta;
|
||||
|
@ -1622,26 +1621,17 @@ void Control::OnKeyDown(wxKeyEvent &event)
|
|||
if (key == WXK_LEFT || key == WXK_RIGHT)
|
||||
move_current_thumb(key == WXK_LEFT);
|
||||
else if (key == WXK_UP || key == WXK_DOWN) {
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
if (key == WXK_DOWN)
|
||||
m_selection = ssHigher;
|
||||
else if (key == WXK_UP && is_lower_thumb_editable())
|
||||
m_selection = ssLower;
|
||||
#else
|
||||
if (key == WXK_UP)
|
||||
m_selection = ssHigher;
|
||||
else if (key == WXK_DOWN && is_lower_thumb_editable())
|
||||
m_selection = ssLower;
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
else {
|
||||
if (key == WXK_LEFT || key == WXK_RIGHT)
|
||||
move_current_thumb(key == WXK_LEFT);
|
||||
}
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
}
|
||||
else {
|
||||
if (m_is_focused) {
|
||||
|
@ -1655,12 +1645,10 @@ void Control::OnKeyDown(wxKeyEvent &event)
|
|||
else if (key == WXK_UP || key == WXK_DOWN)
|
||||
move_current_thumb(key == WXK_UP);
|
||||
}
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
else {
|
||||
if (key == WXK_UP || key == WXK_DOWN)
|
||||
move_current_thumb(key == WXK_UP);
|
||||
}
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
}
|
||||
|
||||
event.Skip(); // !Needed to have EVT_CHAR generated as well
|
||||
|
|
|
@ -1087,11 +1087,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
|||
wxDEFINE_EVENT(EVT_GLCANVAS_UPDATE_BED_SHAPE, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_TAB, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_RESETGIZMOS, SimpleEvent);
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_MOVE_SLIDERS, wxKeyEvent);
|
||||
#else
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, wxKeyEvent);
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_JUMP_TO, wxKeyEvent);
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
||||
|
@ -2928,11 +2924,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
|||
keyCode == WXK_UP ||
|
||||
keyCode == WXK_DOWN) {
|
||||
if (dynamic_cast<Preview*>(m_canvas->GetParent()) != nullptr)
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
post_event(wxKeyEvent(EVT_GLCANVAS_MOVE_SLIDERS, evt));
|
||||
#else
|
||||
post_event(wxKeyEvent(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, evt));
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,11 +124,7 @@ wxDECLARE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
|||
wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_BED_SHAPE, SimpleEvent);
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_TAB, SimpleEvent);
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_RESETGIZMOS, SimpleEvent);
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_SLIDERS, wxKeyEvent);
|
||||
#else
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, wxKeyEvent);
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_JUMP_TO, wxKeyEvent);
|
||||
wxDECLARE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
||||
|
|
|
@ -449,12 +449,10 @@ void Preview::unbind_event_handlers()
|
|||
m_moves_slider->Unbind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
|
||||
}
|
||||
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
void Preview::move_moves_slider(wxKeyEvent& evt)
|
||||
{
|
||||
if (m_moves_slider != nullptr) m_moves_slider->OnKeyDown(evt);
|
||||
}
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
|
||||
void Preview::hide_layers_slider()
|
||||
{
|
||||
|
@ -782,26 +780,17 @@ void Preview::update_layers_slider_from_canvas(wxKeyEvent& event)
|
|||
|
||||
const auto key = event.GetKeyCode();
|
||||
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
if (key == 'S' || key == 'W') {
|
||||
const int new_pos = key == 'W' ? m_layers_slider->GetHigherValue() + 1 : m_layers_slider->GetHigherValue() - 1;
|
||||
#else
|
||||
if (key == 'U' || key == 'D') {
|
||||
const int new_pos = key == 'U' ? m_layers_slider->GetHigherValue() + 1 : m_layers_slider->GetHigherValue() - 1;
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
m_layers_slider->SetHigherValue(new_pos);
|
||||
if (event.ShiftDown() || m_layers_slider->is_one_layer()) m_layers_slider->SetLowerValue(m_layers_slider->GetHigherValue());
|
||||
}
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
else if (key == 'A' || key == 'D') {
|
||||
const int new_pos = key == 'D' ? m_moves_slider->GetHigherValue() + 1 : m_moves_slider->GetHigherValue() - 1;
|
||||
m_moves_slider->SetHigherValue(new_pos);
|
||||
if (event.ShiftDown() || m_moves_slider->is_one_layer()) m_moves_slider->SetLowerValue(m_moves_slider->GetHigherValue());
|
||||
}
|
||||
else if (key == 'X')
|
||||
#else
|
||||
else if (key == 'S')
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
m_layers_slider->ChangeOneLayerLock();
|
||||
else if (key == WXK_SHIFT)
|
||||
m_layers_slider->UseDefaultColors(false);
|
||||
|
|
|
@ -164,9 +164,7 @@ public:
|
|||
void update_bottom_toolbar();
|
||||
void update_moves_slider();
|
||||
void enable_moves_slider(bool enable);
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
void move_moves_slider(wxKeyEvent& evt);
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
void hide_layers_slider();
|
||||
|
||||
private:
|
||||
|
|
|
@ -192,7 +192,6 @@ void KBShortcutsDialog::fill_shortcuts()
|
|||
}
|
||||
|
||||
Shortcuts preview_shortcuts = {
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
{ L("Arrow Up"), L("Vertical slider - Move active thumb Up") },
|
||||
{ L("Arrow Down"), L("Vertical slider - Move active thumb Down") },
|
||||
{ L("Arrow Left"), L("Horizontal slider - Move active thumb Left") },
|
||||
|
@ -203,33 +202,17 @@ void KBShortcutsDialog::fill_shortcuts()
|
|||
{ "D", L("Horizontal slider - Move active thumb Right") },
|
||||
{ "X", L("On/Off one layer mode of the vertical slider") },
|
||||
{ "L", L("Show/Hide Legend and Estimated printing time") },
|
||||
#else
|
||||
{ L("Arrow Up"), L("Upper layer") },
|
||||
{ L("Arrow Down"), L("Lower layer") },
|
||||
{ "U", L("Upper Layer") },
|
||||
{ "D", L("Lower Layer") },
|
||||
{ "L", L("Show/Hide Legend & Estimated printing time") },
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
};
|
||||
|
||||
m_full_shortcuts.push_back({ { _L("Preview"), "" }, preview_shortcuts });
|
||||
|
||||
Shortcuts layers_slider_shortcuts = {
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
{ L("Arrow Up"), L("Move active thumb Up") },
|
||||
{ L("Arrow Down"), L("Move active thumb Down") },
|
||||
{ L("Arrow Left"), L("Set upper thumb as active") },
|
||||
{ L("Arrow Right"), L("Set lower thumb as active") },
|
||||
{ "+", L("Add color change marker for current layer") },
|
||||
{ "-", L("Delete color change marker for current layer") },
|
||||
#else
|
||||
{ L("Arrow Up"), L("Move current slider thumb Up") },
|
||||
{ L("Arrow Down"), L("Move current slider thumb Down") },
|
||||
{ L("Arrow Left"), L("Set upper thumb to current slider thumb") },
|
||||
{ L("Arrow Right"), L("Set lower thumb to current slider thumb") },
|
||||
{ "+", L("Add color change marker for current layer") },
|
||||
{ "-", L("Delete color change marker for current layer") },
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
{ "Shift+", L("Press to speed up 5 times while moving thumb\nwith arrow keys or mouse wheel") },
|
||||
{ ctrl, L("Press to speed up 5 times while moving thumb\nwith arrow keys or mouse wheel") },
|
||||
};
|
||||
|
@ -237,15 +220,10 @@ void KBShortcutsDialog::fill_shortcuts()
|
|||
m_full_shortcuts.push_back({ { _L("Vertical Slider"), _L("The following shortcuts are applicable in G-code preview when the vertical slider is active") }, layers_slider_shortcuts });
|
||||
|
||||
Shortcuts sequential_slider_shortcuts = {
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
{ L("Arrow Left"), L("Move active thumb Left") },
|
||||
{ L("Arrow Right"), L("Move active thumb Right") },
|
||||
{ L("Arrow Up"), L("Set left thumb as active") },
|
||||
{ L("Arrow Down"), L("Set right thumb as active") },
|
||||
#else
|
||||
{ L("Arrow Left"), L("Move active slider thumb Left") },
|
||||
{ L("Arrow Right"), L("Move active slider thumb Right") },
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
{ "Shift+", L("Press to speed up 5 times while moving thumb\nwith arrow keys or mouse wheel") },
|
||||
{ ctrl, L("Press to speed up 5 times while moving thumb\nwith arrow keys or mouse wheel") },
|
||||
};
|
||||
|
|
|
@ -1888,14 +1888,10 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [this](SimpleEvent&) { this->q->collapse_sidebar(!this->q->is_sidebar_collapsed()); });
|
||||
}
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_JUMP_TO, [this](wxKeyEvent& evt) { preview->jump_layers_slider(evt); });
|
||||
#if ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_SLIDERS, [this](wxKeyEvent& evt) {
|
||||
preview->move_layers_slider(evt);
|
||||
preview->move_moves_slider(evt);
|
||||
});
|
||||
#else
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, [this](wxKeyEvent& evt) { preview->move_layers_slider(evt); });
|
||||
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_layers_slider(evt); });
|
||||
if (wxGetApp().is_gcode_viewer())
|
||||
preview->Bind(EVT_GLCANVAS_RELOAD_FROM_DISK, [this](SimpleEvent&) { this->q->reload_gcode_from_disk(); });
|
||||
|
|
Loading…
Add table
Reference in a new issue