Removed cog icon from the horizontal slider.
+ Shortcut "Shift+G" works from the Preview canvas now (not just from the focused slider as before)
This commit is contained in:
parent
ece27dcc42
commit
ea5fdcd7b1
6 changed files with 33 additions and 0 deletions
|
@ -294,6 +294,8 @@ wxSize Control::get_size() const
|
||||||
void Control::get_size(int* w, int* h) const
|
void Control::get_size(int* w, int* h) const
|
||||||
{
|
{
|
||||||
GetSize(w, h);
|
GetSize(w, h);
|
||||||
|
if (m_draw_mode == dmSequentialGCodeView)
|
||||||
|
return; // we have no more icons for drawing
|
||||||
is_horizontal() ? *w -= m_lock_icon_dim : *h -= m_lock_icon_dim;
|
is_horizontal() ? *w -= m_lock_icon_dim : *h -= m_lock_icon_dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,6 +911,10 @@ void Control::draw_revert_icon(wxDC& dc)
|
||||||
|
|
||||||
void Control::draw_cog_icon(wxDC& dc)
|
void Control::draw_cog_icon(wxDC& dc)
|
||||||
{
|
{
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
if (m_draw_mode == dmSequentialGCodeView)
|
||||||
|
return;
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
int width, height;
|
int width, height;
|
||||||
get_size(&width, &height);
|
get_size(&width, &height);
|
||||||
|
|
||||||
|
|
|
@ -1457,6 +1457,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, wxKeyEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
||||||
|
wxDEFINE_EVENT(EVT_GLCANVAS_JUMP_TO, wxKeyEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_COLLAPSE_SIDEBAR, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_COLLAPSE_SIDEBAR, SimpleEvent);
|
||||||
|
@ -2899,6 +2900,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
// see include/wx/defs.h enum wxKeyCode
|
// see include/wx/defs.h enum wxKeyCode
|
||||||
int keyCode = evt.GetKeyCode();
|
int keyCode = evt.GetKeyCode();
|
||||||
int ctrlMask = wxMOD_CONTROL;
|
int ctrlMask = wxMOD_CONTROL;
|
||||||
|
int shiftMask = wxMOD_SHIFT;
|
||||||
|
|
||||||
auto imgui = wxGetApp().imgui();
|
auto imgui = wxGetApp().imgui();
|
||||||
if (imgui->update_key_data(evt)) {
|
if (imgui->update_key_data(evt)) {
|
||||||
|
@ -2996,6 +2998,18 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE_ALL)); break;
|
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE_ALL)); break;
|
||||||
default: evt.Skip();
|
default: evt.Skip();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if ((evt.GetModifiers() & shiftMask) != 0) {
|
||||||
|
switch (keyCode) {
|
||||||
|
case 'g':
|
||||||
|
case 'G': {
|
||||||
|
if (dynamic_cast<Preview*>(m_canvas->GetParent()) != nullptr)
|
||||||
|
post_event(wxKeyEvent(EVT_GLCANVAS_JUMP_TO, evt));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
evt.Skip();
|
||||||
|
}
|
||||||
} else if (evt.HasModifiers()) {
|
} else if (evt.HasModifiers()) {
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -114,6 +114,7 @@ wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, wxKeyEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
||||||
|
wxDECLARE_EVENT(EVT_GLCANVAS_JUMP_TO, wxKeyEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_COLLAPSE_SIDEBAR, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_COLLAPSE_SIDEBAR, SimpleEvent);
|
||||||
|
|
|
@ -557,6 +557,16 @@ void Preview::msw_rescale()
|
||||||
refresh_print();
|
refresh_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preview::jump_layers_slider(wxKeyEvent& evt)
|
||||||
|
{
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
if (m_layers_slider) m_layers_slider->OnChar(evt);
|
||||||
|
#else
|
||||||
|
if (m_slider)
|
||||||
|
m_slider->OnKeyDown(evt);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
void Preview::move_layers_slider(wxKeyEvent& evt)
|
void Preview::move_layers_slider(wxKeyEvent& evt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -179,6 +179,7 @@ Preview(wxWindow* parent, Model* model, DynamicPrintConfig* config,
|
||||||
void refresh_print();
|
void refresh_print();
|
||||||
|
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
|
void jump_layers_slider(wxKeyEvent& evt);
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
void move_layers_slider(wxKeyEvent& evt);
|
void move_layers_slider(wxKeyEvent& evt);
|
||||||
void edit_layers_slider(wxKeyEvent& evt);
|
void edit_layers_slider(wxKeyEvent& evt);
|
||||||
|
|
|
@ -1978,6 +1978,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
|
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
|
||||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
|
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
|
||||||
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_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_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, [this](wxKeyEvent& evt) { preview->move_layers_slider(evt); });
|
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, [this](wxKeyEvent& evt) { preview->move_layers_slider(evt); });
|
||||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_layers_slider(evt); });
|
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_layers_slider(evt); });
|
||||||
|
|
Loading…
Reference in a new issue