Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_perspective_camera

This commit is contained in:
Enrico Turri 2019-06-20 08:51:08 +02:00
commit 6af69667a3
8 changed files with 45 additions and 13 deletions

View file

@ -74,7 +74,10 @@ if(TBB_FOUND)
target_compile_definitions(libnest2d INTERFACE -DTBB_USE_CAPTURED_EXCEPTION=0)
find_package(Threads REQUIRED)
target_link_libraries(libnest2d INTERFACE ${TBB_LIBRARIES} ${CMAKE_DL_LIBS}
target_link_libraries(libnest2d INTERFACE
tbb # VS debug mode needs linking this way:
# ${TBB_LIBRARIES}
${CMAKE_DL_LIBS}
Threads::Threads
)
else()

View file

@ -17,6 +17,7 @@
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "slic3r/GUI/Tab.hpp"
#include "slic3r/GUI/GUI_Preview.hpp"
#include "GUI_App.hpp"
#include "GUI_ObjectList.hpp"
#include "GUI_ObjectManipulation.hpp"
@ -1183,6 +1184,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_UPDATE_BED_SHAPE, SimpleEvent);
wxDEFINE_EVENT(EVT_GLCANVAS_TAB, SimpleEvent);
wxDEFINE_EVENT(EVT_GLCANVAS_RESETGIZMOS, SimpleEvent);
wxDEFINE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
wxDEFINE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar)
: m_canvas(canvas)
@ -2358,8 +2360,18 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
case '4': { select_view("rear"); break; }
case '5': { select_view("left"); break; }
case '6': { select_view("right"); break; }
case '+': { post_event(Event<int>(EVT_GLCANVAS_INCREASE_INSTANCES, +1)); break; }
case '-': { post_event(Event<int>(EVT_GLCANVAS_INCREASE_INSTANCES, -1)); break; }
case '+': {
if (dynamic_cast<Preview*>(m_canvas->GetParent()) != nullptr)
post_event(wxKeyEvent(EVT_GLCANVAS_EDIT_COLOR_CHANGE, evt));
else
post_event(Event<int>(EVT_GLCANVAS_INCREASE_INSTANCES, +1));
break; }
case '-': {
if (dynamic_cast<Preview*>(m_canvas->GetParent()) != nullptr)
post_event(wxKeyEvent(EVT_GLCANVAS_EDIT_COLOR_CHANGE, evt));
else
post_event(Event<int>(EVT_GLCANVAS_INCREASE_INSTANCES, -1));
break; }
case '?': { post_event(SimpleEvent(EVT_GLCANVAS_QUESTION_MARK)); break; }
case 'A':
case 'a': { post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE)); break; }
@ -2445,15 +2457,10 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
else if (keyCode == WXK_LEFT ||
keyCode == WXK_RIGHT ||
keyCode == WXK_UP ||
keyCode == WXK_DOWN ||
keyCode == '+' ||
keyCode == WXK_NUMPAD_ADD ||
keyCode == '-' ||
keyCode == 390 ||
keyCode == WXK_DELETE ||
keyCode == WXK_BACK )
keyCode == WXK_DOWN )
{
post_event(wxKeyEvent(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, evt));
if (dynamic_cast<Preview*>(m_canvas->GetParent()) != nullptr)
post_event(wxKeyEvent(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, evt));
}
}
}

View file

@ -125,6 +125,7 @@ wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_BED_SHAPE, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_TAB, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_RESETGIZMOS, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
class GLCanvas3D
{

View file

@ -420,6 +420,12 @@ void Preview::move_double_slider(wxKeyEvent& evt)
m_slider->OnKeyDown(evt);
}
void Preview::edit_double_slider(wxKeyEvent& evt)
{
if (m_slider)
m_slider->OnChar(evt);
}
void Preview::bind_event_handlers()
{
this->Bind(wxEVT_SIZE, &Preview::on_size, this);

View file

@ -123,6 +123,7 @@ public:
void msw_rescale();
void move_double_slider(wxKeyEvent& evt);
void edit_double_slider(wxKeyEvent& evt);
private:
bool init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model);

View file

@ -1758,6 +1758,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [this](SimpleEvent&) { set_bed_shape(config->option<ConfigOptionPoints>("bed_shape")->values); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, [this](wxKeyEvent& evt) { preview->move_double_slider(evt); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_double_slider(evt); });
q->Bind(EVT_SLICING_COMPLETED, &priv::on_slicing_completed, this);
q->Bind(EVT_PROCESS_COMPLETED, &priv::on_process_completed, this);

View file

@ -1587,6 +1587,7 @@ DoubleSlider::DoubleSlider( wxWindow *parent,
// slider events
Bind(wxEVT_PAINT, &DoubleSlider::OnPaint, this);
Bind(wxEVT_CHAR, &DoubleSlider::OnChar, this);
Bind(wxEVT_LEFT_DOWN, &DoubleSlider::OnLeftDown, this);
Bind(wxEVT_MOTION, &DoubleSlider::OnMotion, this);
Bind(wxEVT_LEFT_UP, &DoubleSlider::OnLeftUp, this);
@ -2366,9 +2367,9 @@ void DoubleSlider::OnWheel(wxMouseEvent& event)
void DoubleSlider::OnKeyDown(wxKeyEvent &event)
{
const int key = event.GetKeyCode();
if (key == '+' || key == WXK_NUMPAD_ADD)
if (key == WXK_NUMPAD_ADD)
action_tick(taAdd);
else if (key == '-' || key == 390 || key == WXK_DELETE || key == WXK_BACK)
else if (key == 390 || key == WXK_DELETE || key == WXK_BACK)
action_tick(taDel);
else if (is_horizontal())
{
@ -2387,6 +2388,8 @@ void DoubleSlider::OnKeyDown(wxKeyEvent &event)
else if (key == WXK_UP || key == WXK_DOWN)
move_current_thumb(key == WXK_UP);
}
event.Skip(); // !Needed to have EVT_CHAR generated as well
}
void DoubleSlider::OnKeyUp(wxKeyEvent &event)
@ -2398,6 +2401,15 @@ void DoubleSlider::OnKeyUp(wxKeyEvent &event)
event.Skip();
}
void DoubleSlider::OnChar(wxKeyEvent& event)
{
const int key = event.GetKeyCode();
if (key == '+')
action_tick(taAdd);
else if (key == '-')
action_tick(taDel);
}
void DoubleSlider::OnRightDown(wxMouseEvent& event)
{
this->CaptureMouse();

View file

@ -727,6 +727,7 @@ public:
void OnWheel(wxMouseEvent& event);
void OnKeyDown(wxKeyEvent &event);
void OnKeyUp(wxKeyEvent &event);
void OnChar(wxKeyEvent &event);
void OnRightDown(wxMouseEvent& event);
void OnRightUp(wxMouseEvent& event);