From c74fe8acb88e958e1e3418054ccae6b6ded8d9b7 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 8 Mar 2019 17:00:56 +0100 Subject: [PATCH 1/4] Moved the "Delete" button in the 3D Canvas pop up menu from the very top below the add / remove instance, so that it could not be selected by mistake. --- src/slic3r/GUI/Plater.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 112dc8b6e..fa2510394 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2509,15 +2509,20 @@ bool Plater::priv::init_object_menu() bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/) { - wxMenuItem* item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")), - [this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png"); - if (!is_part){ + wxMenuItem* item_delete = nullptr; + if (is_part) { + item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")), + [this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png"); + } else { wxMenuItem* item_increase = append_menu_item(menu, wxID_ANY, _(L("Increase copies")) + "\t+", _(L("Place one more copy of the selected object")), [this](wxCommandEvent&) { q->increase_instances(); }, "add.png"); wxMenuItem* item_decrease = append_menu_item(menu, wxID_ANY, _(L("Decrease copies")) + "\t-", _(L("Remove one copy of the selected object")), [this](wxCommandEvent&) { q->decrease_instances(); }, "delete.png"); wxMenuItem* item_set_number_of_copies = append_menu_item(menu, wxID_ANY, _(L("Set number of copies")) + dots, _(L("Change the number of copies of the selected object")), [this](wxCommandEvent&) { q->set_number_of_copies(); }, "textfield.png"); + // Delete menu was moved to be after +/- instace to make it more difficult to be selected by mistake. + item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")), + [this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png"); menu->AppendSeparator(); wxMenuItem* item_instance_to_object = sidebar->obj_list()->append_menu_item_instance_to_object(menu); @@ -2554,7 +2559,7 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/ wxMenuItem* item_mirror = append_submenu(menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object"))); - // ui updates needs to be binded to the parent panel + // ui updates needs to be bound to the parent panel if (q != nullptr) { q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId()); From e4dca04a4b3c8c1d4cfed21f82e245ecc0ec1922 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 8 Mar 2019 20:34:22 +0100 Subject: [PATCH 2/4] Added wxBusyCursor on AABB tree calculation for SLA gizmo --- src/slic3r/GUI/GLGizmo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp index 22023825f..5627c77f4 100644 --- a/src/slic3r/GUI/GLGizmo.cpp +++ b/src/slic3r/GUI/GLGizmo.cpp @@ -1932,6 +1932,7 @@ bool GLGizmoSlaSupports::is_mesh_update_necessary() const void GLGizmoSlaSupports::update_mesh() { + wxBusyCursor wait; Eigen::MatrixXf& V = m_V; Eigen::MatrixXi& F = m_F; // Composite mesh of all instances in the world coordinate system. From 6811c68f60979b0e07ecb469da613ade88963141 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 11 Mar 2019 11:03:13 +0100 Subject: [PATCH 3/4] Fixed crashes if OnIdle handler was called before Plater was initialized. --- src/slic3r/GUI/GUI_App.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 7a3d6f13a..194399316 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -161,12 +161,15 @@ bool GUI_App::OnInit() Bind(wxEVT_IDLE, [this](wxIdleEvent& event) { + if (! plater_) + return; + if (app_config->dirty() && app_config->get("autosave") == "1") app_config->save(); // ! Temporary workaround for the correct behavior of the Scrolled sidebar panel // Do this "manipulations" only once ( after (re)create of the application ) - if (plater_ && sidebar().obj_list()->GetMinHeight() > 15 * wxGetApp().em_unit()) + if (sidebar().obj_list()->GetMinHeight() > 15 * wxGetApp().em_unit()) { wxWindowUpdateLocker noUpdates_sidebar(&sidebar()); sidebar().obj_list()->SetMinSize(wxSize(-1, 15 * wxGetApp().em_unit())); @@ -175,8 +178,7 @@ bool GUI_App::OnInit() update_mode(); // update view mode after fix of the object_list size } - if (this->plater() != nullptr) - this->obj_manipul()->update_if_dirty(); + this->obj_manipul()->update_if_dirty(); // Preset updating & Configwizard are done after the above initializations, // and after MainFrame is created & shown. From c77d15c98bf45db05d9dee84ed210a5694fb0f9e Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 11 Mar 2019 12:58:46 +0100 Subject: [PATCH 4/4] Fixed OnWhile() function for the PrusaDoubleSlider (#1913) Current behavior: Move selected thumb only. If no one thumb is selected, set selection to the thumb nearest to the current mouse position --- src/slic3r/GUI/wxExtensions.cpp | 35 ++++++++++++++------------------- src/slic3r/GUI/wxExtensions.hpp | 2 +- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index e83101d22..dee18ad43 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -1958,21 +1958,8 @@ int PrusaDoubleSlider::get_value_from_position(const wxCoord x, const wxCoord y) return int(m_min_value + double(height - SLIDER_MARGIN - y) / step + 0.5); } -void PrusaDoubleSlider::detect_selected_slider(const wxPoint& pt, const bool is_mouse_wheel /*= false*/) +void PrusaDoubleSlider::detect_selected_slider(const wxPoint& pt) { - if (is_mouse_wheel) - { - if (is_horizontal()) { - m_selection = pt.x <= m_rect_lower_thumb.GetRight() ? ssLower : - pt.x >= m_rect_higher_thumb.GetLeft() ? ssHigher : ssUndef; - } - else { - m_selection = pt.y >= m_rect_lower_thumb.GetTop() ? ssLower : - pt.y <= m_rect_higher_thumb.GetBottom() ? ssHigher : ssUndef; - } - return; - } - m_selection = is_point_in_rect(pt, m_rect_lower_thumb) ? ssLower : is_point_in_rect(pt, m_rect_higher_thumb) ? ssHigher : ssUndef; } @@ -2192,12 +2179,20 @@ void PrusaDoubleSlider::action_tick(const TicksAction action) void PrusaDoubleSlider::OnWheel(wxMouseEvent& event) { - wxClientDC dc(this); - wxPoint pos = event.GetLogicalPosition(dc); - detect_selected_slider(pos, true); - - if (m_selection == ssUndef) - return; + // Set nearest to the mouse thumb as a selected, if there is not selected thumb + if (m_selection == ssUndef) + { + const wxPoint& pt = event.GetLogicalPosition(wxClientDC(this)); + + if (is_horizontal()) + m_selection = abs(pt.x - m_rect_lower_thumb.GetRight()) <= + abs(pt.x - m_rect_higher_thumb.GetLeft()) ? + ssLower : ssHigher; + else + m_selection = abs(pt.y - m_rect_lower_thumb.GetTop()) <= + abs(pt.y - m_rect_higher_thumb.GetBottom()) ? + ssLower : ssHigher; + } move_current_thumb(event.GetWheelRotation() > 0); } diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index e0bd5d091..a15bee256 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -771,7 +771,7 @@ protected: void draw_thumb_text(wxDC& dc, const wxPoint& pos, const SelectedSlider& selection) const; void update_thumb_rect(const wxCoord& begin_x, const wxCoord& begin_y, const SelectedSlider& selection); - void detect_selected_slider(const wxPoint& pt, const bool is_mouse_wheel = false); + void detect_selected_slider(const wxPoint& pt); void correct_lower_value(); void correct_higher_value(); void move_current_thumb(const bool condition);