From db21c67f1869eed13483c56ce0a42bfd9d982056 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 22 Mar 2019 13:03:34 +0100 Subject: [PATCH 01/10] Changed logic for releasing mouse capture into GLToolbar::on_mouse() --- src/slic3r/GUI/GLToolbar.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index ac79784adf..1b6570eabd 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -411,24 +411,19 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) // mouse anywhere if (evt.Moving()) + { m_tooltip = update_hover_state(mouse_pos, parent); + if ((m_mouse_capture.parent != nullptr) && (m_mouse_capture.parent != &parent)) + m_mouse_capture.reset(); + } else if (evt.LeftUp()) m_mouse_capture.left = false; else if (evt.MiddleUp()) m_mouse_capture.middle = false; else if (evt.RightUp()) m_mouse_capture.right = false; - else if (m_mouse_capture.any()) - { - if (evt.Dragging()) - processed = true; - else if (evt.Entering() && (m_mouse_capture.parent == &parent)) - // Resets the mouse capture state to avoid setting the dragging event as processed when, for example, - // the item action opens a modal dialog - // Keeps the mouse capture state if the entering event happens on different parent from the one - // who received the button down event, to prevent, for example, dragging when switching between scene views - m_mouse_capture.reset(); - } + else if (evt.Dragging() && m_mouse_capture.any()) + processed = true; int item_id = contains_mouse(mouse_pos, parent); if (item_id == -1) From 6bf0cf946669cba253c9b19db449727d0c003670 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 22 Mar 2019 14:35:26 +0100 Subject: [PATCH 02/10] Another tweak to the logic for releasing mouse capture into GLToolbar::on_mouse() --- src/slic3r/GUI/GLToolbar.cpp | 30 +++++++++++++++++++++++++++--- src/slic3r/GUI/GLToolbar.hpp | 4 ++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 1b6570eabd..1a8539aefc 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -157,7 +157,9 @@ GLToolbar::GLToolbar(GLToolbar::EType type) #if ENABLE_SVG_ICONS , m_icons_texture_dirty(true) #endif // ENABLE_SVG_ICONS - , m_mouse_capture({ false, false, false, nullptr }) +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +// , m_mouse_capture({ false, false, false, nullptr }) +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ , m_tooltip("") { } @@ -410,12 +412,27 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) bool processed = false; // mouse anywhere - if (evt.Moving()) +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + if (evt.Moving() || evt.LeftDown() || evt.MiddleDown() || evt.RightDown() || evt.LeftDClick() || evt.RightDClick()) { - m_tooltip = update_hover_state(mouse_pos, parent); if ((m_mouse_capture.parent != nullptr) && (m_mouse_capture.parent != &parent)) + { m_mouse_capture.reset(); + std::cout << "Dragging restored by toolbar" << std::endl; + } } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + if (evt.Moving()) +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +// { +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + m_tooltip = update_hover_state(mouse_pos, parent); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +// if ((m_mouse_capture.parent != nullptr) && (m_mouse_capture.parent != &parent)) +// m_mouse_capture.reset(); +// } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ else if (evt.LeftUp()) m_mouse_capture.left = false; else if (evt.MiddleUp()) @@ -423,7 +440,14 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) else if (evt.RightUp()) m_mouse_capture.right = false; else if (evt.Dragging() && m_mouse_capture.any()) +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + { + std::cout << "Dragging prevented by toolbar" << std::endl; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ processed = true; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int item_id = contains_mouse(mouse_pos, parent); if (item_id == -1) diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 95953795f0..3d72266c9f 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -238,6 +238,10 @@ private: bool right; GLCanvas3D* parent; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + MouseCapture() { reset(); } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + bool any() const { return left || middle || right; } void reset() { left = middle = right = false; parent = nullptr; } }; From 3f7f8f978eb6b08e27454c2c090f28dcb4c00a96 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Sun, 24 Mar 2019 13:35:09 +0100 Subject: [PATCH 03/10] Fix of sla gizmo (it sometimes showed supports for hidden objects) --- src/slic3r/GUI/GLCanvas3D.cpp | 10 ++++++---- src/slic3r/GUI/GLCanvas3D.hpp | 5 ++++- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 8be187dece..3192e7861e 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2293,11 +2293,13 @@ int GLCanvas3D::check_volumes_outside_state() const return (int)state; } -void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible) +void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx) { for (GLVolume* vol : m_volumes.volumes) { - if (vol->composite_id.volume_id < 0) - vol->is_active = visible; + if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo) + && (instance_idx == -1 || vol->composite_id.instance_id == instance_idx) + && vol->composite_id.volume_id < 0) + vol->is_active = visible; } m_render_sla_auxiliaries = visible; @@ -2313,7 +2315,7 @@ void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject } } if (visible && !mo) - toggle_sla_auxiliaries_visibility(true); + toggle_sla_auxiliaries_visibility(true, mo, instance_idx); if (!mo && !visible && !m_model->objects.empty() && (m_model->objects.size() > 1 || m_model->objects.front()->instances.size() > 1)) _set_warning_texture(WarningTexture::SomethingNotShown, true); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index d9e38c4e0e..29e0fbb088 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -584,6 +584,9 @@ private: bool m_regenerate_volumes; bool m_moving; bool m_tab_down; + + // Following variable is obsolete and it should be safe to remove it. + // I just don't want to do it now before a release (Lukas Matena 24.3.2019) bool m_render_sla_auxiliaries; std::string m_color_by; @@ -610,7 +613,7 @@ public: void reset_volumes(); int check_volumes_outside_state() const; - void toggle_sla_auxiliaries_visibility(bool visible); + void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1); void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1); void set_config(const DynamicPrintConfig* config); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index c629f21729..31f6b0278a 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -666,7 +666,7 @@ RENDER_AGAIN: m_imgui->end(); if (m_editing_mode != m_old_editing_state) { // user toggled between editing/non-editing mode - m_parent.toggle_sla_auxiliaries_visibility(!m_editing_mode); + m_parent.toggle_sla_auxiliaries_visibility(!m_editing_mode, m_model_object, m_active_instance); force_refresh = true; } m_old_editing_state = m_editing_mode; From dd3ac4017a3001da6ab01d2b9ce54f42d0891b99 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 25 Mar 2019 08:48:41 +0100 Subject: [PATCH 04/10] Yet another tweak to the logic for releasing mouse capture into GLToolbar::on_mouse() --- src/slic3r/GUI/GLToolbar.cpp | 59 ++++++++++++++++++++++++++++++++---- src/slic3r/GUI/GLToolbar.hpp | 2 +- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 1a8539aefc..00596a9cce 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -413,14 +413,60 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) // mouse anywhere //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - if (evt.Moving() || evt.LeftDown() || evt.MiddleDown() || evt.RightDown() || evt.LeftDClick() || evt.RightDClick()) + if (!evt.Dragging() && !evt.Leaving() && !evt.Entering() && (m_mouse_capture.parent != nullptr)) { - if ((m_mouse_capture.parent != nullptr) && (m_mouse_capture.parent != &parent)) - { - m_mouse_capture.reset(); - std::cout << "Dragging restored by toolbar" << std::endl; - } + if (m_mouse_capture.any() && (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())) + // prevents loosing selection into the scene if mouse down was done inside the toolbar and mouse up was down outside it, + // as when switching between views + processed = true; + + m_mouse_capture.reset(); + + + std::cout << "Dragging restored by toolbar ["; + if (evt.Entering()) + std::cout << "Entering"; + else if (evt.Leaving()) + std::cout << "Leaving"; + else if (evt.Dragging()) + std::cout << "Dragging"; + else if (evt.Moving()) + std::cout << "Moving"; + else if (evt.Magnify()) + std::cout << "Magnify"; + else if (evt.LeftDown()) + std::cout << "LeftDown"; + else if (evt.LeftUp()) + std::cout << "LeftUp"; + else if (evt.LeftDClick()) + std::cout << "LeftDClick"; + else if (evt.MiddleDown()) + std::cout << "MiddleDown"; + else if (evt.MiddleUp()) + std::cout << "MiddleUp"; + else if (evt.MiddleDClick()) + std::cout << "MiddleDClick"; + else if (evt.RightDown()) + std::cout << "RightDown"; + else if (evt.RightUp()) + std::cout << "RightUp"; + else if (evt.RightDClick()) + std::cout << "RightDClick"; + else + std::cout << "UNKNOWN "; + std::cout << "]" << std::endl; } + + +// if (evt.Moving() || evt.LeftDown() || evt.MiddleDown() || evt.RightDown() || evt.LeftDClick() || evt.RightDClick()) +// { +// std::cout << m_name << " - " << (void*)m_mouse_capture.parent << std::endl; +// if ((m_mouse_capture.parent != nullptr) && (m_mouse_capture.parent != &parent)) +// { +// m_mouse_capture.reset(); +// std::cout << "Dragging restored by toolbar" << std::endl; +// } +// } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if (evt.Moving()) @@ -444,6 +490,7 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) { std::cout << "Dragging prevented by toolbar" << std::endl; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + // if the button down was done on this toolbar, prevent from dragging into the scene processed = true; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ } diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 3d72266c9f..a0c0d9ca7a 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -239,7 +239,7 @@ private: GLCanvas3D* parent; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - MouseCapture() { reset(); } + MouseCapture() { reset(); } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ bool any() const { return left || middle || right; } From 149551946ca2f6f932d7e9f1f0ba461b956615cb Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 25 Mar 2019 12:07:43 +0100 Subject: [PATCH 05/10] Fix of #1998 --- src/libslic3r/Format/AMF.cpp | 11 ++++++----- src/slic3r/GUI/Plater.cpp | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/Format/AMF.cpp b/src/libslic3r/Format/AMF.cpp index f5219263d6..ff1da37cc1 100644 --- a/src/libslic3r/Format/AMF.cpp +++ b/src/libslic3r/Format/AMF.cpp @@ -175,6 +175,11 @@ struct AMFParserContext bool mirrory_set; float mirrorz; bool mirrorz_set; + + bool anything_set() const { return deltax_set || deltay_set || deltaz_set || + rx_set || ry_set || rz_set || + scalex_set || scaley_set || scalez_set || + mirrorx_set || mirrory_set || mirrorz_set; } }; struct Object { @@ -644,11 +649,7 @@ void AMFParserContext::endDocument() continue; } for (const Instance &instance : object.second.instances) -#if ENABLE_VOLUMES_CENTERING_FIXES - { -#else - if (instance.deltax_set && instance.deltay_set) { -#endif // ENABLE_VOLUMES_CENTERING_FIXES + if (instance.anything_set()) { ModelInstance *mi = m_model.objects[object.second.idx]->add_instance(); mi->set_offset(Vec3d(instance.deltax_set ? (double)instance.deltax : 0.0, instance.deltay_set ? (double)instance.deltay : 0.0, instance.deltaz_set ? (double)instance.deltaz : 0.0)); mi->set_rotation(Vec3d(instance.rx_set ? (double)instance.rx : 0.0, instance.ry_set ? (double)instance.ry : 0.0, instance.rz_set ? (double)instance.rz : 0.0)); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f9c598ce39..e158821257 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1713,8 +1713,8 @@ std::vector Plater::priv::load_model_objects(const ModelObjectPtrs &mode object->center_around_origin(); new_instances.emplace_back(object->add_instance()); #else /* AUTOPLACEMENT_ON_LOAD */ - // if object has no defined position(s) we need to rearrange everything after loading object->center_around_origin(); - need_arrange = true; + // if object has no defined position(s) we need to rearrange everything after loading + need_arrange = true; // add a default instance and center object around origin object->center_around_origin(); // also aligns object to Z = 0 ModelInstance* instance = object->add_instance(); From 3e0ec8098bce46673c4b0325b85825008ead9d03 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 25 Mar 2019 14:13:20 +0100 Subject: [PATCH 06/10] Code cleanup --- src/slic3r/GUI/GLToolbar.cpp | 65 ------------------------------------ src/slic3r/GUI/GLToolbar.hpp | 2 -- 2 files changed, 67 deletions(-) diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 00596a9cce..2f7f13f6fc 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -157,9 +157,6 @@ GLToolbar::GLToolbar(GLToolbar::EType type) #if ENABLE_SVG_ICONS , m_icons_texture_dirty(true) #endif // ENABLE_SVG_ICONS -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -// , m_mouse_capture({ false, false, false, nullptr }) -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ , m_tooltip("") { } @@ -412,7 +409,6 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) bool processed = false; // mouse anywhere -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if (!evt.Dragging() && !evt.Leaving() && !evt.Entering() && (m_mouse_capture.parent != nullptr)) { if (m_mouse_capture.any() && (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())) @@ -421,64 +417,10 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) processed = true; m_mouse_capture.reset(); - - - std::cout << "Dragging restored by toolbar ["; - if (evt.Entering()) - std::cout << "Entering"; - else if (evt.Leaving()) - std::cout << "Leaving"; - else if (evt.Dragging()) - std::cout << "Dragging"; - else if (evt.Moving()) - std::cout << "Moving"; - else if (evt.Magnify()) - std::cout << "Magnify"; - else if (evt.LeftDown()) - std::cout << "LeftDown"; - else if (evt.LeftUp()) - std::cout << "LeftUp"; - else if (evt.LeftDClick()) - std::cout << "LeftDClick"; - else if (evt.MiddleDown()) - std::cout << "MiddleDown"; - else if (evt.MiddleUp()) - std::cout << "MiddleUp"; - else if (evt.MiddleDClick()) - std::cout << "MiddleDClick"; - else if (evt.RightDown()) - std::cout << "RightDown"; - else if (evt.RightUp()) - std::cout << "RightUp"; - else if (evt.RightDClick()) - std::cout << "RightDClick"; - else - std::cout << "UNKNOWN "; - std::cout << "]" << std::endl; } - -// if (evt.Moving() || evt.LeftDown() || evt.MiddleDown() || evt.RightDown() || evt.LeftDClick() || evt.RightDClick()) -// { -// std::cout << m_name << " - " << (void*)m_mouse_capture.parent << std::endl; -// if ((m_mouse_capture.parent != nullptr) && (m_mouse_capture.parent != &parent)) -// { -// m_mouse_capture.reset(); -// std::cout << "Dragging restored by toolbar" << std::endl; -// } -// } -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - if (evt.Moving()) -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -// { -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ m_tooltip = update_hover_state(mouse_pos, parent); -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -// if ((m_mouse_capture.parent != nullptr) && (m_mouse_capture.parent != &parent)) -// m_mouse_capture.reset(); -// } -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ else if (evt.LeftUp()) m_mouse_capture.left = false; else if (evt.MiddleUp()) @@ -486,15 +428,8 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) else if (evt.RightUp()) m_mouse_capture.right = false; else if (evt.Dragging() && m_mouse_capture.any()) -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - { - std::cout << "Dragging prevented by toolbar" << std::endl; -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // if the button down was done on this toolbar, prevent from dragging into the scene processed = true; -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - } -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int item_id = contains_mouse(mouse_pos, parent); if (item_id == -1) diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index a0c0d9ca7a..5fac1f5b2e 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -238,9 +238,7 @@ private: bool right; GLCanvas3D* parent; -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MouseCapture() { reset(); } -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ bool any() const { return left || middle || right; } void reset() { left = middle = right = false; parent = nullptr; } From aca2ffcdfbefecf00437d89a965d1ccdade567e6 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Mon, 25 Mar 2019 15:06:29 +0100 Subject: [PATCH 07/10] doc: Warn about build dir being too nested on Windows --- doc/How to build - Windows.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/How to build - Windows.md b/doc/How to build - Windows.md index 627f1c99bb..020b28958a 100644 --- a/doc/How to build - Windows.md +++ b/doc/How to build - Windows.md @@ -91,6 +91,10 @@ You can also use the Visual Studio GUI or other generators as mentioned above. The `DESTDIR` option is the location where the bundle will be installed. This may be customized. If you leave it empty, the `DESTDIR` will be places inside the same `build` directory. +Warning: If the `build` directory is nested too deep inside other folders, various file paths during the build +become too long and the build might fail due to file writing errors. For this reason, it is recommended to +place the `build` directory relatively close to the drive root. + Note that the build variant that you may choose using Visual Studio (i.e. _Release_ or _Debug_ etc.) when building the dependency package is **not relevant**. The dependency build will by default build _both_ the _Release_ and _Debug_ variants regardless of what you choose in Visual Studio. You can disable building of the debug variant by passing the `-DDEP_DEBUG=OFF` option to CMake, this will only produce a _Release_ build. From ba66f34c4572beae3600a8557f89435ceaac2f5f Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Mon, 25 Mar 2019 15:50:07 +0100 Subject: [PATCH 08/10] Build: Add an option to choose GTK version on Linux, fix #1937 --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90ebd1e5b0..1e6cf45bd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,8 @@ option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0) option(SLIC3R_SYNTAXONLY "Only perform source code correctness checking, no binary output (UNIX only)" 0) +set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux") + # Proposal for C++ unit tests and sandboxes option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF) option(SLIC3R_BUILD_TESTS "Build unit tests" OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aae3436ae0..a6ae943914 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,6 +60,7 @@ if (SLIC3R_GUI) endif() if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set (wxWidgets_CONFIG_OPTIONS "--toolkit=gtk${SLIC3R_GTK}") if (SLIC3R_WX_STABLE) find_package(wxWidgets 3.0 REQUIRED COMPONENTS base core adv html gl) else () From d0171b568711e42b74a665f497ad5242dc693e40 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 26 Mar 2019 09:54:05 +0100 Subject: [PATCH 09/10] doc: typo --- doc/How to build - Windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/How to build - Windows.md b/doc/How to build - Windows.md index 020b28958a..dec85ae483 100644 --- a/doc/How to build - Windows.md +++ b/doc/How to build - Windows.md @@ -89,7 +89,7 @@ Then `cd` into the `deps` directory and use these commands to build: You can also use the Visual Studio GUI or other generators as mentioned above. The `DESTDIR` option is the location where the bundle will be installed. -This may be customized. If you leave it empty, the `DESTDIR` will be places inside the same `build` directory. +This may be customized. If you leave it empty, the `DESTDIR` will be placed inside the same `build` directory. Warning: If the `build` directory is nested too deep inside other folders, various file paths during the build become too long and the build might fail due to file writing errors. For this reason, it is recommended to From 910979cf73524a25d405fa7ae04a6545831abea1 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 26 Mar 2019 10:08:57 +0100 Subject: [PATCH 10/10] Fixed crash after change of a language + Updating of a mode after recreation --- src/slic3r/GUI/GUI_App.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index d68257a0a6..d66e6f5ad7 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -279,31 +280,50 @@ void GUI_App::set_label_clr_sys(const wxColour& clr) { void GUI_App::recreate_GUI() { + // Weird things happen as the Paint messages are floating around the windows being destructed. + // Avoid the Paint messages by hiding the main window. + // Also the application closes much faster without these unnecessary screen refreshes. + // In addition, there were some crashes due to the Paint events sent to already destructed windows. + mainframe->Show(false); + + const auto msg_name = _(L("Changing of an application language")) + dots; + wxProgressDialog dlg(msg_name, msg_name); + dlg.Pulse(); + // to make sure nobody accesses data from the soon-to-be-destroyed widgets: tabs_list.clear(); plater_ = nullptr; + dlg.Update(10, _(L("Recreating")) + dots); + MainFrame* topwindow = mainframe; mainframe = new MainFrame(); sidebar().obj_list()->init_objects(); // propagate model objects to object list if (topwindow) { SetTopWindow(mainframe); + + dlg.Update(30, _(L("Recreating")) + dots); topwindow->Destroy(); } + dlg.Update(80, _(L("Loading of a current presets")) + dots); + m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg())); load_current_presets(); mainframe->Show(true); - // On OSX the UI was not initialized correctly if the wizard was called - // before the UI was up and running. - CallAfter([]() { - // Run the config wizard, don't offer the "reset user profile" checkbox. - config_wizard_startup(true); - }); + dlg.Update(90, _(L("Loading of a mode view")) + dots); + + update_mode(); + + // #ys_FIXME_delete_after_testing Do we still need this ? +// CallAfter([]() { +// // Run the config wizard, don't offer the "reset user profile" checkbox. +// config_wizard_startup(true); +// }); } void GUI_App::system_info()