diff --git a/src/slic3r/GUI/InstanceCheck.cpp b/src/slic3r/GUI/InstanceCheck.cpp index 9535e0126..38ea95f2c 100644 --- a/src/slic3r/GUI/InstanceCheck.cpp +++ b/src/slic3r/GUI/InstanceCheck.cpp @@ -352,10 +352,16 @@ bool instance_check(int argc, char** argv, bool app_config_single_instance) if (instance_check_internal::get_lock(lock_name + ".lock", data_dir() + "/cache/") && *cla.should_send) { #endif instance_check_internal::send_message(cla.cl_string, lock_name); - BOOST_LOG_TRIVIAL(info) << "instance check: Another instance found. This instance will terminate."; + BOOST_LOG_TRIVIAL(error) << "Instance check: Another instance found. This instance will terminate. Lock file of current running instance is located at " << data_dir() << +#ifdef _WIN32 + "\\cache\\" +#else // mac & linx + "/cache/" +#endif + << lock_name << ".lock"; return true; } - BOOST_LOG_TRIVIAL(info) << "instance check: Another instance not found or single-instance not set."; + BOOST_LOG_TRIVIAL(info) << "Instance check: Another instance not found or single-instance not set."; return false; } diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 027e9ce97..b42a9c7bf 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -435,8 +435,9 @@ void MainFrame::update_layout() { m_plater->Reparent(m_tabpanel); #ifdef _MSW_DARK_MODE + m_plater->Layout(); if (!wxGetApp().tabs_as_menu()) - dynamic_cast(m_tabpanel)->InsertPage(0, m_plater, _L("Plater"), std::string("plater")); + dynamic_cast(m_tabpanel)->InsertPage(0, m_plater, _L("Plater"), std::string("plater"), true); else #endif m_tabpanel->InsertPage(0, m_plater, _L("Plater")); @@ -461,7 +462,7 @@ void MainFrame::update_layout() m_plater_page = new wxPanel(m_tabpanel); #ifdef _MSW_DARK_MODE if (!wxGetApp().tabs_as_menu()) - dynamic_cast(m_tabpanel)->InsertPage(0, m_plater_page, _L("Plater"), std::string("plater")); + dynamic_cast(m_tabpanel)->InsertPage(0, m_plater_page, _L("Plater"), std::string("plater"), true); else #endif m_tabpanel->InsertPage(0, m_plater_page, _L("Plater")); // empty panel just for Plater tab */ diff --git a/src/slic3r/GUI/MeshUtils.cpp b/src/slic3r/GUI/MeshUtils.cpp index 576728b24..0f72d0f78 100644 --- a/src/slic3r/GUI/MeshUtils.cpp +++ b/src/slic3r/GUI/MeshUtils.cpp @@ -253,11 +253,10 @@ std::vector MeshRaycaster::get_unobscured_idxs(const Geometry::Transfo std::vector out; const Transform3d& instance_matrix_no_translation_no_scaling = trafo.get_matrix(true,false,true); - Vec3f direction_to_camera = -camera.get_dir_forward().cast(); - Vec3f direction_to_camera_mesh = (instance_matrix_no_translation_no_scaling.inverse().cast() * direction_to_camera).normalized().eval(); - Vec3f scaling = trafo.get_scaling_factor().cast(); - direction_to_camera_mesh = Vec3f(direction_to_camera_mesh(0)*scaling(0), direction_to_camera_mesh(1)*scaling(1), direction_to_camera_mesh(2)*scaling(2)); - const Transform3f inverse_trafo = trafo.get_matrix().inverse().cast(); + Vec3d direction_to_camera = -camera.get_dir_forward(); + Vec3d direction_to_camera_mesh = (instance_matrix_no_translation_no_scaling.inverse() * direction_to_camera).normalized().eval(); + direction_to_camera_mesh = direction_to_camera_mesh.cwiseProduct(trafo.get_scaling_factor()); + const Transform3d inverse_trafo = trafo.get_matrix().inverse(); for (size_t i=0; i MeshRaycaster::get_unobscured_idxs(const Geometry::Transfo // Cast a ray in the direction of the camera and look for intersection with the mesh: std::vector hits; // Offset the start of the ray by EPSILON to account for numerical inaccuracies. - hits = m_emesh.query_ray_hits((inverse_trafo * pt + direction_to_camera_mesh * EPSILON).cast(), - direction_to_camera.cast()); - + hits = m_emesh.query_ray_hits((inverse_trafo * pt.cast() + direction_to_camera_mesh * EPSILON), + direction_to_camera_mesh); if (! hits.empty()) { // If the closest hit facet normal points in the same direction as the ray, diff --git a/src/slic3r/GUI/Notebook.hpp b/src/slic3r/GUI/Notebook.hpp index 56e6ddf6c..56ae5b285 100644 --- a/src/slic3r/GUI/Notebook.hpp +++ b/src/slic3r/GUI/Notebook.hpp @@ -165,8 +165,8 @@ public: GetBtnsListCtrl()->InsertPage(n, text, bSelect, bmp_name); - if (!DoSetSelectionAfterInsertion(n, bSelect)) - page->Hide(); + if (bSelect) + SetSelection(n); return true; } @@ -174,7 +174,14 @@ public: virtual int SetSelection(size_t n) override { GetBtnsListCtrl()->SetSelection(n); - return DoSetSelection(n, SetSelection_SendEvent); + int ret = DoSetSelection(n, SetSelection_SendEvent); + + // check that only the selected page is visible and others are hidden: + for (size_t page = 0; page < m_pages.size(); page++) + if (page != n) + m_pages[page]->Hide(); + + return ret; } virtual int ChangeSelection(size_t n) override diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f4b7e758a..9e7409c11 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6536,12 +6536,7 @@ void Plater::search(bool plater_is_active) canvas3D()->on_char(evt); } else - { - wxPoint pos = this->ClientToScreen(wxPoint(0, 0)); - pos.x += em_unit(this) * 40; - pos.y += em_unit(this) * 4; - p->sidebar->get_searcher().search_dialog->Popup(pos); - } + p->sidebar->get_searcher().show_dialog(); } void Plater::msw_rescale() diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 83d60ac6e..000ebf402 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -289,7 +289,6 @@ bool OptionsSearcher::search(const std::string& search, bool force/* = false*/) OptionsSearcher::OptionsSearcher() { - search_dialog = new SearchDialog(this); } OptionsSearcher::~OptionsSearcher() @@ -386,6 +385,22 @@ Option OptionsSearcher::get_option(const std::string& opt_key, const wxString& l return create_option(opt_key, label, type, gc); } +void OptionsSearcher::show_dialog() +{ + if (!search_dialog) { + search_dialog = new SearchDialog(this); + + auto parent = search_dialog->GetParent(); + wxPoint pos = parent->ClientToScreen(wxPoint(0, 0)); + pos.x += em_unit(parent) * 40; + pos.y += em_unit(parent) * 4; + + search_dialog->SetPosition(pos); + } + + search_dialog->Popup(); +} + void OptionsSearcher::add_key(const std::string& opt_key, Preset::Type type, const wxString& group, const wxString& category) { groups_and_categories[get_key(opt_key, type)] = GroupAndCategory{group, category}; @@ -405,7 +420,7 @@ static const std::map icon_idxs = { }; SearchDialog::SearchDialog(OptionsSearcher* searcher) - : GUI::DPIDialog(NULL, wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), + : GUI::DPIDialog(GUI::wxGetApp().tab_panel(), wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), searcher(searcher) { SetFont(GUI::wxGetApp().normal_font()); @@ -506,7 +521,8 @@ void SearchDialog::Popup(wxPoint position /*= wxDefaultPosition*/) if (check_english) check_english->SetValue(params.english); - this->SetPosition(position); + if (position != wxDefaultPosition) + this->SetPosition(position); this->ShowModal(); } diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index a942a89f8..99575e1fa 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -134,6 +134,8 @@ public: return o1.key < o2.key; }); } void sort_options_by_label() { sort_options(); } + + void show_dialog(); };