diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 3935e38c3d..1a98afad83 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -49,6 +49,10 @@ find_package(Git REQUIRED) get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +# C and CXX flags handed over to unix autotools projects. +set(DEP_CFLAGS "") +set(DEP_CXXFLAGS "") + function(prusaslicer_add_cmake_project projectname) cmake_parse_arguments(P_ARGS "" "INSTALL_DIR;BUILD_COMMAND;INSTALL_COMMAND" "CMAKE_ARGS" ${ARGN}) diff --git a/deps/GMP/GMP.cmake b/deps/GMP/GMP.cmake index 4e8228cbac..aa23a24e99 100644 --- a/deps/GMP/GMP.cmake +++ b/deps/GMP/GMP.cmake @@ -21,8 +21,8 @@ else () # URL https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2 URL https://gmplib.org/download/gmp/gmp-6.2.0.tar.lz BUILD_IN_SOURCE ON - CONFIGURE_COMMAND ./configure --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}/usr/local" --with-pic + CONFIGURE_COMMAND env "CFLAGS=${DEP_CFLAGS}" "CXXFLAGS=${DEP_CXXFLAGS}" ./configure --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}/usr/local" --with-pic BUILD_COMMAND make -j INSTALL_COMMAND make install - ) + ) endif () \ No newline at end of file diff --git a/deps/MPFR/MPFR.cmake b/deps/MPFR/MPFR.cmake index cda7eeea93..89073fb73b 100644 --- a/deps/MPFR/MPFR.cmake +++ b/deps/MPFR/MPFR.cmake @@ -21,7 +21,7 @@ else () ExternalProject_Add(dep_MPFR URL http://ftp.vim.org/ftp/gnu/mpfr/mpfr-3.1.6.tar.bz2 https://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.bz2 # mirrors are allowed BUILD_IN_SOURCE ON - CONFIGURE_COMMAND ./configure --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local --with-pic + CONFIGURE_COMMAND env "CFLAGS=${DEP_CFLAGS}" "CXXFLAGS=${DEP_CXXFLAGS}" ./configure --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local --with-pic BUILD_COMMAND make -j INSTALL_COMMAND make install DEPENDS dep_GMP diff --git a/deps/deps-macos.cmake b/deps/deps-macos.cmake index 17300b247e..fbf2d6c480 100644 --- a/deps/deps-macos.cmake +++ b/deps/deps-macos.cmake @@ -11,6 +11,9 @@ set(DEP_CMAKE_OPTS "-DCMAKE_C_FLAGS=${DEP_WERRORS_SDK}" ) +list(APPEND DEP_CFLAGS "-mmacosx-version-min=${DEP_OSX_TARGET} ${DEP_WERRORS_SDK}") +list(APPEND DEP_CXXFLAGS "-mmacosx-version-min=${DEP_OSX_TARGET} ${DEP_WERRORS_SDK}") + include("deps-unix-common.cmake") diff --git a/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp b/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp index 8e65bafe98..e963782961 100644 --- a/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp +++ b/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp @@ -43,7 +43,10 @@ protected: Placer p{bin}; p.configure(pcfg); - if (itm.area() <= 0 || !p.pack(cpy)) it = c.erase(it); + if (itm.area() <= 0 || !p.pack(cpy)) { + static_cast(*it).binId(BIN_ID_UNSET); + it = c.erase(it); + } else it++; } } diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 3fa7e1841a..b8ef0bcdca 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -577,7 +577,7 @@ void _arrange( std::function stopfn) { // Integer ceiling the min distance from the bed perimeters - coord_t md = minobjd - 2 * scaled(0.1 + EPSILON); + coord_t md = minobjd; md = (md % 2) ? md / 2 + 1 : md / 2; auto corrected_bin = bin; diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index e8db02a756..1dcfae3bc1 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -124,7 +124,14 @@ ObjectList::ObjectList(wxWindow* parent) : // On Windows and Linux, forces a kill focus emulation on the object manipulator fields because this event handler is called // before the kill focus event handler on the object manipulator when changing selection in the list, invalidating the object // manipulator cache with the following call to selection_changed() - wxGetApp().obj_manipul()->emulate_kill_focus(); +// wxGetApp().obj_manipul()->emulate_kill_focus(); // It's not necessury anymore #ys_FIXME delete after testing + + // On Windows and Linux: + // It's not invoked KillFocus event for "temporary" panels (like "Manipulation panel", "Settings", "Layer ranges"), + // if we change selection in object list. + // see https://github.com/prusa3d/PrusaSlicer/issues/3303 + // But, if we call SetFocus() for ObjectList it will cause an invoking of a KillFocus event for "temporary" panels + this->SetFocus(); #else // To avoid selection update from SetSelection() and UnselectAll() under osx if (m_prevent_list_events) @@ -3041,7 +3048,10 @@ void ObjectList::add_layer_item(const t_layer_height_range& range, bool ObjectList::edit_layer_range(const t_layer_height_range& range, coordf_t layer_height) { - const int obj_idx = get_selected_obj_idx(); + // Use m_selected_object_id instead of get_selected_obj_idx() + // because of get_selected_obj_idx() return obj_idx for currently selected item. + // But edit_layer_range(...) function can be called, when Selection in ObjectList could be changed + const int obj_idx = m_selected_object_id ; if (obj_idx < 0) return false; @@ -3064,7 +3074,10 @@ bool ObjectList::edit_layer_range(const t_layer_height_range& range, coordf_t la bool ObjectList::edit_layer_range(const t_layer_height_range& range, const t_layer_height_range& new_range, bool dont_update_ui) { - const int obj_idx = get_selected_obj_idx(); + // Use m_selected_object_id instead of get_selected_obj_idx() + // because of get_selected_obj_idx() return obj_idx for currently selected item. + // But edit_layer_range(...) function can be called, when Selection in ObjectList could be changed + const int obj_idx = m_selected_object_id; if (obj_idx < 0) return false; take_snapshot(_(L("Edit Height Range"))); @@ -3091,10 +3104,13 @@ bool ObjectList::edit_layer_range(const t_layer_height_range& range, const t_lay add_layer_item(r.first, root_item); } - if (!dont_update_ui) + // if this function was invoked from wxEVT_CHANGE_SELECTION selected item could be other than itLayer or itLayerRoot + if (!dont_update_ui && (sel_type & (itLayer | itLayerRoot))) select_item(sel_type&itLayer ? m_objects_model->GetItemByLayerRange(obj_idx, new_range) : root_item); Expand(root_item); + + m_prevent_list_events = false; return true; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 2a30ccf68f..1408a137b1 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2124,6 +2124,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLCANVAS_REMOVE_OBJECT, [q](SimpleEvent&) { q->remove_selected(); }); view3D_canvas->Bind(EVT_GLCANVAS_ARRANGE, [this](SimpleEvent&) { arrange(); }); view3D_canvas->Bind(EVT_GLCANVAS_SELECT_ALL, [this](SimpleEvent&) { this->q->select_all(); }); + view3D_canvas->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); view3D_canvas->Bind(EVT_GLCANVAS_INCREASE_INSTANCES, [this](Event &evt) { if (evt.data == 1) this->q->increase_instances(); else if (this->can_decrease_instances()) this->q->decrease_instances(); }); view3D_canvas->Bind(EVT_GLCANVAS_INSTANCE_MOVED, [this](SimpleEvent&) { update(); }); @@ -2135,6 +2136,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, [this](Event &evt) { this->sidebar->enable_buttons(evt.data); }); view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_GEOMETRY, &priv::on_update_geometry, this); view3D_canvas->Bind(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, &priv::on_3dcanvas_mouse_dragging_finished, this); + view3D_canvas->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); }); view3D_canvas->Bind(EVT_GLCANVAS_RESETGIZMOS, [this](SimpleEvent&) { reset_all_gizmos(); }); view3D_canvas->Bind(EVT_GLCANVAS_UNDO, [this](SimpleEvent&) { this->undo(); }); view3D_canvas->Bind(EVT_GLCANVAS_REDO, [this](SimpleEvent&) { this->redo(); }); @@ -2145,6 +2147,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) // 3DScene/Toolbar: view3D_canvas->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this); + view3D_canvas->Bind(EVT_GLTOOLBAR_DELETE, [q](SimpleEvent&) { q->remove_selected(); }); + view3D_canvas->Bind(EVT_GLTOOLBAR_DELETE_ALL, [q](SimpleEvent&) { q->reset_with_confirm(); }); view3D_canvas->Bind(EVT_GLTOOLBAR_ARRANGE, [this](SimpleEvent&) { arrange(); }); view3D_canvas->Bind(EVT_GLTOOLBAR_COPY, [q](SimpleEvent&) { q->copy_selection_to_clipboard(); }); view3D_canvas->Bind(EVT_GLTOOLBAR_PASTE, [q](SimpleEvent&) { q->paste_from_clipboard(); }); @@ -2153,33 +2157,24 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_OBJECTS, &priv::on_action_split_objects, this); view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this); view3D_canvas->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this); - - wxGLCanvas* preview_canvas = preview->get_wxglcanvas(); - // Preview events: - preview_canvas->Bind(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, [this](wxKeyEvent& evt) { preview->move_double_slider(evt); }); - preview_canvas->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_double_slider(evt); }); - - // 3DScene/Preview shred events: view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [this](SimpleEvent&) { set_bed_shape(config->option("bed_shape")->values, config->option("bed_custom_texture")->value, config->option("bed_custom_model")->value); }); - preview_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [this](SimpleEvent&) + + // Preview events: + preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); + preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [this](SimpleEvent&) { set_bed_shape(config->option("bed_shape")->values, config->option("bed_custom_texture")->value, config->option("bed_custom_model")->value); }); - view3D_canvas->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); - preview_canvas->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); - view3D_canvas->Bind(EVT_GLTOOLBAR_DELETE, [q](SimpleEvent&) { q->remove_selected(); }); - preview_canvas->Bind(EVT_GLTOOLBAR_DELETE, [q](SimpleEvent&) { q->remove_selected(); }); - view3D_canvas->Bind(EVT_GLTOOLBAR_DELETE_ALL, [q](SimpleEvent&) { q->reset_with_confirm(); }); - preview_canvas->Bind(EVT_GLTOOLBAR_DELETE_ALL, [q](SimpleEvent&) { q->reset_with_confirm(); }); - view3D_canvas->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); }); - preview_canvas->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); }); + 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);