From 894020986595ff74617300eabcde6404a747f2f0 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 24 Oct 2018 10:46:18 +0200 Subject: [PATCH 1/3] Fixed menu view accelerator keys --- src/slic3r/GUI/MainFrame.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 5960e8886..8dd8ac3e2 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -328,14 +328,17 @@ void MainFrame::init_menubar() // View menu if (m_plater) { m_viewMenu = new wxMenu(); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Iso\t0")), _(L("Iso View")), [this](wxCommandEvent&){ select_view("iso"); }); + // \xA0 is a non-breaing space. It is entered here to spoil the automatic accelerators, + // as the simple numeric accelerators spoil all numeric data entry. + // The camera control accelerators are captured by GLCanvas3D::on_char(). + append_menu_item(m_viewMenu, wxID_ANY, _(L("Iso")) + "\t\xA0" + "0", _(L("Iso View")), [this](wxCommandEvent&){ select_view("iso"); }); m_viewMenu->AppendSeparator(); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Top\t1")), _(L("Top View")), [this](wxCommandEvent&){ select_view("top"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Bottom\t2")), _(L("Bottom View")), [this](wxCommandEvent&){ select_view("bottom"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Front\t3")), _(L("Front View")), [this](wxCommandEvent&){ select_view("front"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Rear\t4")), _(L("Rear View")), [this](wxCommandEvent&){ select_view("rear"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Left\t5")), _(L("Left View")), [this](wxCommandEvent&){ select_view("left"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Right\t6")), _(L("Right View")), [this](wxCommandEvent&){ select_view("right"); }); + append_menu_item(m_viewMenu, wxID_ANY, _(L("Top")) + "\t\xA0" + "1", _(L("Top View")), [this](wxCommandEvent&){ select_view("top"); }); + append_menu_item(m_viewMenu, wxID_ANY, _(L("Bottom")) + "\t\xA0" + "2", _(L("Bottom View")), [this](wxCommandEvent&){ select_view("bottom"); }); + append_menu_item(m_viewMenu, wxID_ANY, _(L("Front")) + "\t\xA0" + "3", _(L("Front View")), [this](wxCommandEvent&){ select_view("front"); }); + append_menu_item(m_viewMenu, wxID_ANY, _(L("Rear")) + "\t\xA0" + "4", _(L("Rear View")), [this](wxCommandEvent&){ select_view("rear"); }); + append_menu_item(m_viewMenu, wxID_ANY, _(L("Left")) + "\t\xA0" + "5", _(L("Left View")), [this](wxCommandEvent&){ select_view("left"); }); + append_menu_item(m_viewMenu, wxID_ANY, _(L("Right")) + "\t\xA0" + "6", _(L("Right View")), [this](wxCommandEvent&){ select_view("right"); }); } // Help menu From 37e4f69e3b2a1b1a58edb5930b53fe4dd0ef8df1 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 24 Oct 2018 10:55:35 +0200 Subject: [PATCH 2/3] Fixed memory leak in GLToolbar --- src/slic3r/GUI/GLToolbar.cpp | 8 ++++++++ src/slic3r/GUI/GLToolbar.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index ec203541e..e094e1105 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -149,6 +149,14 @@ GLToolbar::GLToolbar(GLCanvas3D& parent) { } +GLToolbar::~GLToolbar() +{ + for (GLToolbarItem* item : m_items) + { + delete item; + } +} + bool GLToolbar::init(const std::string& icons_texture_filename, unsigned int items_icon_size, unsigned int items_icon_border_size, unsigned int items_icon_gap_size) { std::string path = resources_dir() + "/icons/"; diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 7c0f5bf84..216171753 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -141,6 +141,7 @@ private: public: explicit GLToolbar(GLCanvas3D& parent); + ~GLToolbar(); bool init(const std::string& icons_texture_filename, unsigned int items_icon_size, unsigned int items_icon_border_size, unsigned int items_icon_gap_size); From 481229da974627f1c361bce3c256ae440cb4d701 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 24 Oct 2018 11:05:19 +0200 Subject: [PATCH 3/3] CancellationCallback is now passed by value, instead of non-const reference (which would require initializing the reference from temporaries) --- src/libslic3r/Print.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index bd04cd371..a00ef5c9e 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -86,7 +86,7 @@ public: // In case the step has already been entered or finished, cancel the background // processing by calling the cancel callback. template - bool invalidate(StepType step, tbb::mutex &mtx, CancelationCallback &cancel) { + bool invalidate(StepType step, tbb::mutex &mtx, CancelationCallback cancel) { bool invalidated = m_state[step].load(std::memory_order_relaxed) != INVALID; if (invalidated) { #if 0 @@ -109,7 +109,7 @@ public: // In case any step has already been entered or finished, cancel the background // processing by calling the cancel callback. template - bool invalidate_all(tbb::mutex &mtx, CancelationCallback &cancel) { + bool invalidate_all(tbb::mutex &mtx, CancelationCallback cancel) { bool invalidated = false; for (size_t i = 0; i < COUNT; ++ i) if (m_state[i].load(std::memory_order_relaxed) != INVALID) {