Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
commit
cb900aa5bc
5 changed files with 15 additions and 12 deletions
|
@ -4085,6 +4085,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_WIPETOWER_MOVED, Vec3dEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
|
wxDEFINE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
|
wxDEFINE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
||||||
|
wxDEFINE_EVENT(EVT_GLCANVAS_TAB, SimpleEvent);
|
||||||
|
|
||||||
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
||||||
: m_canvas(canvas)
|
: m_canvas(canvas)
|
||||||
|
@ -5321,10 +5322,15 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||||
#endif // ENABLE_IMGUI
|
#endif // ENABLE_IMGUI
|
||||||
if (evt.GetEventType() == wxEVT_KEY_UP) {
|
if (evt.GetEventType() == wxEVT_KEY_UP) {
|
||||||
const int keyCode = evt.GetKeyCode();
|
const int keyCode = evt.GetKeyCode();
|
||||||
|
|
||||||
// shift has been just released - SLA gizmo might want to close rectangular selection.
|
if (keyCode == WXK_TAB) {
|
||||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && keyCode == WXK_SHIFT && m_gizmos.mouse_event(SLAGizmoEventType::ShiftUp))
|
// Enable switching between 3D and Preview with Tab
|
||||||
|
// m_canvas->HandleAsNavigationKey(evt); // XXX: Doesn't work in some cases / on Linux
|
||||||
|
post_event(SimpleEvent(EVT_GLCANVAS_TAB));
|
||||||
|
} else if (m_gizmos.get_current_type() == Gizmos::SlaSupports && keyCode == WXK_SHIFT && m_gizmos.mouse_event(SLAGizmoEventType::ShiftUp)) {
|
||||||
|
// shift has been just released - SLA gizmo might want to close rectangular selection.
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
evt.Skip(); // Needed to have EVT_CHAR generated as well
|
evt.Skip(); // Needed to have EVT_CHAR generated as well
|
||||||
|
|
|
@ -131,6 +131,7 @@ wxDECLARE_EVENT(EVT_GLCANVAS_INSTANCE_SCALED, SimpleEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
|
wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
|
wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
||||||
|
wxDECLARE_EVENT(EVT_GLCANVAS_TAB, SimpleEvent);
|
||||||
|
|
||||||
// this describes events being passed from GLCanvas3D to SlaSupport gizmo
|
// this describes events being passed from GLCanvas3D to SlaSupport gizmo
|
||||||
enum class SLAGizmoEventType {
|
enum class SLAGizmoEventType {
|
||||||
|
|
|
@ -229,7 +229,7 @@ bool Preview::init(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlici
|
||||||
if ((config == nullptr) || (process == nullptr) || (gcode_preview_data == nullptr))
|
if ((config == nullptr) || (process == nullptr) || (gcode_preview_data == nullptr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize))
|
if (!Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 /* disable wxTAB_TRAVERSAL */))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_canvas_widget = GLCanvas3DManager::create_wxglcanvas(this);
|
m_canvas_widget = GLCanvas3DManager::create_wxglcanvas(this);
|
||||||
|
|
|
@ -138,11 +138,8 @@ bool ImGuiWrapper::update_key_data(wxKeyEvent &evt)
|
||||||
io.KeyAlt = evt.AltDown();
|
io.KeyAlt = evt.AltDown();
|
||||||
io.KeySuper = evt.MetaDown();
|
io.KeySuper = evt.MetaDown();
|
||||||
|
|
||||||
// XXX: Unfortunatelly this seems broken due to some interference with wxWidgets,
|
new_frame();
|
||||||
// we have to return true always (perform re-render).
|
return want_keyboard() || want_text_input();
|
||||||
// new_frame();
|
|
||||||
// return want_keyboard() || want_text_input();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1191,9 +1191,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
|
|
||||||
view3D = new View3D(q, &model, config, &background_process);
|
view3D = new View3D(q, &model, config, &background_process);
|
||||||
preview = new Preview(q, config, &background_process, &gcode_preview_data, [this](){ schedule_background_process(); });
|
preview = new Preview(q, config, &background_process, &gcode_preview_data, [this](){ schedule_background_process(); });
|
||||||
// Let the Tab key switch between the 3D view and the layer preview.
|
|
||||||
view3D->Bind(wxEVT_NAVIGATION_KEY, [this](wxNavigationKeyEvent &evt) { if (evt.IsFromTab()) this->select_next_view_3D(); });
|
|
||||||
preview->Bind(wxEVT_NAVIGATION_KEY, [this](wxNavigationKeyEvent &evt) { if (evt.IsFromTab()) this->select_next_view_3D(); });
|
|
||||||
|
|
||||||
panels.push_back(view3D);
|
panels.push_back(view3D);
|
||||||
panels.push_back(preview);
|
panels.push_back(preview);
|
||||||
|
@ -1246,6 +1243,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, [this](Event<bool> &evt) { this->sidebar->enable_buttons(evt.data); });
|
view3D_canvas->Bind(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, [this](Event<bool> &evt) { this->sidebar->enable_buttons(evt.data); });
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_GEOMETRY, &priv::on_update_geometry, this);
|
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_GEOMETRY, &priv::on_update_geometry, this);
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, &priv::on_3dcanvas_mouse_dragging_finished, this);
|
view3D_canvas->Bind(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, &priv::on_3dcanvas_mouse_dragging_finished, this);
|
||||||
|
view3D_canvas->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
|
||||||
// 3DScene/Toolbar:
|
// 3DScene/Toolbar:
|
||||||
view3D_canvas->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this);
|
view3D_canvas->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this);
|
||||||
view3D_canvas->Bind(EVT_GLTOOLBAR_DELETE, [q](SimpleEvent&) { q->remove_selected(); });
|
view3D_canvas->Bind(EVT_GLTOOLBAR_DELETE, [q](SimpleEvent&) { q->remove_selected(); });
|
||||||
|
@ -1261,6 +1259,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
// Preview events:
|
// Preview events:
|
||||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this);
|
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this);
|
||||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
|
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
|
||||||
|
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
|
||||||
|
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_INIT, [this](SimpleEvent&) { init_view_toolbar(); });
|
view3D_canvas->Bind(EVT_GLCANVAS_INIT, [this](SimpleEvent&) { init_view_toolbar(); });
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue