From 0d89fd84db41e582381a310904765b4f37aacfdb Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 22 Oct 2019 10:26:51 +0200 Subject: Fixed a case when (under OSX) after some manipulation with an object or a part and then add some setting from 3dScene, "Revert button(s)" are still appear(s) in right panel --- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 0b3f2b098..4ecab8a0f 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -632,7 +632,11 @@ void ObjectManipulation::update_reset_buttons_visibility() show_drop_to_bed = (std::abs(min_z) > EPSILON); } - wxGetApp().CallAfter([this, show_rotation, show_scale, show_drop_to_bed]{ + wxGetApp().CallAfter([this, show_rotation, show_scale, show_drop_to_bed] { + // There is a case (under OSX), when this function is called after the Manipulation panel is hidden + // So, let check if Manipulation panel is still shown for this moment + if (!this->IsShown()) + return; m_reset_rotation_button->Show(show_rotation); m_reset_scale_button->Show(show_scale); m_drop_to_bed_button->Show(show_drop_to_bed); -- cgit v1.2.3 From 62c90abbc03887c7cf03297d3ec2c7c68ee15755 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 25 Oct 2019 13:09:10 +0200 Subject: Fix of SPE-1041: set_state function for gizmos is called even if they are turned on/off by the undo/redo action --- src/slic3r/GUI/Gizmos/GLGizmosManager.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp index f649c98b2..0defb1348 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp @@ -114,8 +114,17 @@ public: m_serializing = true; + // Following is needed to know which to be turn on, but not actually modify + // m_current prematurely, so activate_gizmo is not confused. + EType old_current = m_current; ar(m_current); + EType new_current = m_current; + m_current = old_current; + // activate_gizmo call sets m_current and calls set_state for the gizmo + // it does nothing in case the gizmo is already activated + // it can safely be called for Undefined gizmo + activate_gizmo(new_current); if (m_current != Undefined) m_gizmos[m_current]->load(ar); } -- cgit v1.2.3 From 8b5561aec7e6e2411396b3bf6b67cb333319687f Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 29 Oct 2019 10:40:34 +0100 Subject: Fixed several warnings --- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 1 + src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/GUI_App.hpp | 9 ++++----- src/slic3r/GUI/GUI_ObjectList.cpp | 4 ++-- src/slic3r/GUI/OptionsGroup.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/wxExtensions.cpp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index a1db6884e..6c138d4d0 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -55,6 +55,7 @@ bool BackgroundSlicingProcess::select_technology(PrinterTechnology tech) switch (tech) { case ptFFF: m_print = m_fff_print; break; case ptSLA: m_print = m_sla_print; break; + default: assert(false); break; } changed = true; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c55d64b47..268b4dc30 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1926,7 +1926,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re if (it->new_geometry()) { // New volume. unsigned int old_id = find_old_volume_id(it->composite_id); - if (old_id != -1) + if (old_id != (unsigned int)-1) map_glvolume_old_to_new[old_id] = m_volumes.volumes.size(); m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_color_by, m_initialized); m_volumes.volumes.back()->geometry_id = key.geometry_id; diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index c5ddc0152..9bfc34543 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -87,7 +87,7 @@ class GUI_App : public wxApp wxFont m_bold_font; wxFont m_normal_font; - size_t m_em_unit; // width of a "m"-symbol in pixels for current system font + int m_em_unit; // width of a "m"-symbol in pixels for current system font // Note: for 100% Scale m_em_unit = 10 -> it's a good enough coefficient for a size setting of controls std::unique_ptr m_wxLocale; @@ -105,7 +105,7 @@ public: bool initialized() const { return m_initialized; } GUI_App(); - ~GUI_App(); + ~GUI_App() override; static unsigned get_colour_approx_luma(const wxColour &colour); static bool dark_mode(); @@ -124,8 +124,7 @@ public: const wxFont& small_font() { return m_small_font; } const wxFont& bold_font() { return m_bold_font; } const wxFont& normal_font() { return m_normal_font; } - size_t em_unit() const { return m_em_unit; } - void set_em_unit(const size_t em_unit) { m_em_unit = em_unit; } + int em_unit() const { return m_em_unit; } float toolbar_icon_scale(const bool is_limited = false) const; void recreate_GUI(); @@ -155,7 +154,7 @@ public: // Translate the language code to a code, for which Prusa Research maintains translations. Defaults to "en_US". wxString current_language_code_safe() const; - virtual bool OnExceptionInMainLoop(); + virtual bool OnExceptionInMainLoop() override; #ifdef __APPLE__ // wxWidgets override to get an event on open files. diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index dc48a218c..a88980a8d 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -445,7 +445,7 @@ void ObjectList::update_extruder_values_for_items(const size_t max_extruder) auto object = (*m_objects)[i]; wxString extruder; if (!object->config.has("extruder") || - object->config.option("extruder")->value > max_extruder) + size_t(object->config.option("extruder")->value) > max_extruder) extruder = _(L("default")); else extruder = wxString::Format("%d", object->config.option("extruder")->value); @@ -457,7 +457,7 @@ void ObjectList::update_extruder_values_for_items(const size_t max_extruder) item = m_objects_model->GetItemByVolumeId(i, id); if (!item) continue; if (!object->volumes[id]->config.has("extruder") || - object->volumes[id]->config.option("extruder")->value > max_extruder) + size_t(object->volumes[id]->config.option("extruder")->value) > max_extruder) extruder = _(L("default")); else extruder = wxString::Format("%d", object->volumes[id]->config.option("extruder")->value); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 698c1e034..8b6f5bc30 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -233,7 +233,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n add_undo_buttuns_to_sizer(sizer, field); if (is_window_field(field)) - sizer->Add(field->getWindow(), option.opt.full_width ? 1 : 0, //(option.opt.full_width ? wxEXPAND : 0) | + sizer->Add(field->getWindow(), option.opt.full_width ? 1 : 0, //(option.opt.full_width ? wxEXPAND : 0) | wxBOTTOM | wxTOP | (option.opt.full_width ? wxEXPAND : wxALIGN_CENTER_VERTICAL), (wxOSX || !staticbox) ? 0 : 2); if (is_sizer_field(field)) sizer->Add(field->getSizer(), 1, /*(*/option.opt.full_width ? wxEXPAND : /*0) |*/ wxALIGN_CENTER_VERTICAL, 0); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index cca164ca3..90529f88c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4791,7 +4791,7 @@ bool Plater::undo_redo_string_getter(const bool is_undo, int idx, const char** o const std::vector& ss_stack = p->undo_redo_stack().snapshots(); const int idx_in_ss_stack = p->get_active_snapshot_index() + (is_undo ? -(++idx) : idx); - if (0 < idx_in_ss_stack && idx_in_ss_stack < ss_stack.size() - 1) { + if (0 < idx_in_ss_stack && (size_t)idx_in_ss_stack < ss_stack.size() - 1) { *out_text = ss_stack[idx_in_ss_stack].name.c_str(); return true; } @@ -4804,7 +4804,7 @@ void Plater::undo_redo_topmost_string_getter(const bool is_undo, std::string& ou const std::vector& ss_stack = p->undo_redo_stack().snapshots(); const int idx_in_ss_stack = p->get_active_snapshot_index() + (is_undo ? -1 : 0); - if (0 < idx_in_ss_stack && idx_in_ss_stack < ss_stack.size() - 1) { + if (0 < idx_in_ss_stack && (size_t)idx_in_ss_stack < ss_stack.size() - 1) { out_text = ss_stack[idx_in_ss_stack].name; return; } diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 06e37fb4f..eb47fd208 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -1020,7 +1020,7 @@ wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item) node_parent->GetChildren().Remove(node); if (id > 0) { - if(id == node_parent->GetChildCount()) id--; + if (size_t(id) == node_parent->GetChildCount()) id--; ret_item = wxDataViewItem(node_parent->GetChildren().Item(id)); } -- cgit v1.2.3 From ffcf25e5cb0fab7b527c9bbffe34fc65d9a6d38b Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 29 Oct 2019 13:07:57 +0100 Subject: Fix for #3108 --- src/slic3r/GUI/Field.cpp | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 07d75c947..42e3448fc 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -150,7 +150,13 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true case coFloat:{ if (m_opt.type == coPercent && !str.IsEmpty() && str.Last() == '%') str.RemoveLast(); - else if (check_value && !str.IsEmpty() && str.Last() == '%') { + else if (!str.IsEmpty() && str.Last() == '%') + { + if (!check_value) { + m_value.clear(); + break; + } + wxString label = m_Label->GetLabel(); if (label.Last() == '\n') label.RemoveLast(); while (label.Last() == ' ') label.RemoveLast(); @@ -169,13 +175,21 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true { if (m_opt.nullable && str == na_value()) val = ConfigOptionFloatsNullable::nil_value(); - else if (check_value && !str.ToCDouble(&val)) + else if (!str.ToCDouble(&val)) { + if (!check_value) { + m_value.clear(); + break; + } show_error(m_parent, _(L("Invalid numeric input."))); set_value(double_to_string(val), true); } - if (check_value && (m_opt.min > val || val > m_opt.max)) + if (m_opt.min > val || val > m_opt.max) { + if (!check_value) { + m_value.clear(); + break; + } show_error(m_parent, _(L("Input value is out of range"))); if (m_opt.min > val) val = m_opt.min; if (val > m_opt.max) val = m_opt.max; @@ -192,15 +206,24 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true double val = 0.; // Replace the first occurence of comma in decimal number. str.Replace(",", ".", false); - if (check_value && !str.ToCDouble(&val)) + if (!str.ToCDouble(&val)) { + if (!check_value) { + m_value.clear(); + break; + } show_error(m_parent, _(L("Invalid numeric input."))); set_value(double_to_string(val), true); } - else if (check_value && ((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max) || + else if (((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max) || (m_opt.sidetext.rfind("mm ") != std::string::npos && val > 1)) && (m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast(m_value))) { + if (!check_value) { + m_value.clear(); + break; + } + const std::string sidetext = m_opt.sidetext.rfind("mm/s") != std::string::npos ? "mm/s" : "mm"; const wxString stVal = double_to_string(val, 2); const wxString msg_text = wxString::Format(_(L("Do you mean %s%% instead of %s %s?\n" @@ -351,6 +374,7 @@ bool TextCtrl::value_was_changed() boost::any val = m_value; wxString ret_str = static_cast(window)->GetValue(); // update m_value! + // ret_str might be changed inside get_value_by_opt_type get_value_by_opt_type(ret_str); switch (m_opt.type) { @@ -396,8 +420,10 @@ void TextCtrl::set_value(const boost::any& value, bool change_event/* = false*/) if (!change_event) { wxString ret_str = static_cast(window)->GetValue(); - // update m_value to correct work of next value_was_changed(), - // but don't check/change inputed value and don't show a warning message + /* Update m_value to correct work of next value_was_changed(). + * But after checking of entered value, don't fix the "incorrect" value and don't show a warning message, + * just clear m_value in this case. + */ get_value_by_opt_type(ret_str, false); } } -- cgit v1.2.3 From b3f53c96c7a5cad8ccaf60b0047d1b195826a32b Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 30 Oct 2019 08:28:40 +0100 Subject: Fixed update of 3D preview layout after changing printer after slicing --- src/slic3r/GUI/GUI_Preview.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index b6350bcab..d89ac1bcb 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -375,6 +375,8 @@ void Preview::load_print(bool keep_z_range) load_print_as_fff(keep_z_range); else if (tech == ptSLA) load_print_as_sla(); + + Layout(); } void Preview::reload_print(bool keep_volumes) -- cgit v1.2.3