From e354a306e68fad5e7e30f15b6c895a461bc06d1a Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 17 May 2019 15:04:06 +0200 Subject: [PATCH 1/4] Fixed delayed update of 3D scene when moving preview layers' slider (as reported in #1250) --- src/slic3r/GUI/GUI_Preview.cpp | 8 +++++--- src/slic3r/GUI/GUI_Preview.hpp | 2 +- src/slic3r/GUI/wxExtensions.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index c9228d085..d28b921d9 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -533,6 +533,7 @@ void Preview::create_double_slider() m_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_sliders_scroll_changed, this); + Bind(wxCUSTOMEVT_TICKSCHANGED, [this](wxEvent&) { auto& config = wxGetApp().preset_bundle->project_config; ((config.option("colorprint_heights"))->values) = (m_slider->GetTicksValues()); @@ -823,7 +824,7 @@ void Preview::load_print_as_sla() } } -void Preview::on_sliders_scroll_changed(wxEvent& event) +void Preview::on_sliders_scroll_changed(wxCommandEvent& event) { if (IsShown()) { @@ -831,7 +832,7 @@ void Preview::on_sliders_scroll_changed(wxEvent& event) if (tech == ptFFF) { m_canvas->set_toolpaths_range(m_slider->GetLowerValueD() - 1e-6, m_slider->GetHigherValueD() + 1e-6); - m_canvas_widget->Refresh(); + m_canvas->render(); m_canvas->set_use_clipping_planes(false); } else if (tech == ptSLA) @@ -839,10 +840,11 @@ void Preview::on_sliders_scroll_changed(wxEvent& event) m_canvas->set_clipping_plane(0, ClippingPlane(Vec3d::UnitZ(), -m_slider->GetLowerValueD())); m_canvas->set_clipping_plane(1, ClippingPlane(-Vec3d::UnitZ(), m_slider->GetHigherValueD())); m_canvas->set_use_clipping_planes(m_slider->GetHigherValue() != 0); - m_canvas_widget->Refresh(); + m_canvas->render(); } } } + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp index b70d01fa4..1838082c3 100644 --- a/src/slic3r/GUI/GUI_Preview.hpp +++ b/src/slic3r/GUI/GUI_Preview.hpp @@ -154,7 +154,7 @@ private: void load_print_as_fff(bool keep_z_range = false); void load_print_as_sla(); - void on_sliders_scroll_changed(wxEvent& event); + void on_sliders_scroll_changed(wxCommandEvent& event); }; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 0e89a72f2..599d3edac 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2235,14 +2235,16 @@ void DoubleSlider::OnMotion(wxMouseEvent& event) } else if (m_is_left_down || m_is_right_down) { if (m_selection == ssLower) { + int current_value = m_lower_value; m_lower_value = get_value_from_position(pos.x, pos.y); correct_lower_value(); - action = true; + action = (current_value != m_lower_value); } else if (m_selection == ssHigher) { + int current_value = m_higher_value; m_higher_value = get_value_from_position(pos.x, pos.y); correct_higher_value(); - action = true; + action = (current_value != m_higher_value); } } Refresh(); @@ -2253,6 +2255,7 @@ void DoubleSlider::OnMotion(wxMouseEvent& event) { wxCommandEvent e(wxEVT_SCROLL_CHANGED); e.SetEventObject(this); + e.SetString("moving"); ProcessWindowEvent(e); } } From 9c288df1b60c0f45eaee8eb16becfdae871fc8f8 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Fri, 17 May 2019 15:04:15 +0200 Subject: [PATCH 2/4] Fix double wizard on incompatible bundle --- src/slic3r/GUI/GUI_App.cpp | 5 ++--- src/slic3r/GUI/GUI_App.hpp | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f1bbd0a0b..ff821d3c9 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -183,9 +183,8 @@ bool GUI_App::on_init_inner() // supplied as argument to --datadir; in that case we should still run the wizard preset_bundle->setup_directories(); - app_conf_exists = app_config->exists(); // load settings - if (app_conf_exists) + if (app_config->exists()) app_config->load(); app_config->set("version", SLIC3R_VERSION); app_config->save(); @@ -258,7 +257,7 @@ bool GUI_App::on_init_inner() } CallAfter([this] { - if (!config_wizard_startup(app_conf_exists)) { + if (!config_wizard_startup(app_config->exists())) { // Only notify if there was no wizard so as not to bother too much ... preset_updater->slic3r_update_notify(); } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 1c9a462c6..68f8d86df 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -72,7 +72,6 @@ static wxString dots("…", wxConvUTF8); class GUI_App : public wxApp { bool m_initialized { false }; - bool app_conf_exists{ false }; wxColour m_color_label_modified; wxColour m_color_label_sys; From 6b379428d4e0b053fd07292d9889f35cb51f3f44 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 17 May 2019 15:49:37 +0200 Subject: [PATCH 3/4] Workaround to fix #2251 --- src/slic3r/GUI/Plater.cpp | 6 ++++-- src/slic3r/GUI/wxExtensions.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c63ae73f2..adbe0c92e 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -671,7 +671,8 @@ Sidebar::Sidebar(Plater *parent) auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL); combo_and_btn_sizer->Add(*combo, 1, wxEXPAND); if ((*combo)->edit_btn) - combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxLEFT|wxRIGHT, int(0.3*wxGetApp().em_unit())); + combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, + int(0.3*wxGetApp().em_unit())); auto *sizer_presets = this->p->sizer_presets; auto *sizer_filaments = this->p->sizer_filaments; @@ -777,7 +778,8 @@ void Sidebar::init_filament_combo(PresetComboBox **combo, const int extr_idx) { auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL); combo_and_btn_sizer->Add(*combo, 1, wxEXPAND); - combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxLEFT | wxRIGHT, int(0.3*wxGetApp().em_unit())); + combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, + int(0.3*wxGetApp().em_unit())); auto /***/sizer_filaments = this->p->sizer_filaments; sizer_filaments->Add(combo_and_btn_sizer, 1, wxEXPAND | wxBOTTOM, 1); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 599d3edac..a5b7eaa5b 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2657,7 +2657,14 @@ ScalableButton::ScalableButton( wxWindow * parent, SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); #endif // __WXMSW__ - SetBitmap(create_scaled_bitmap(parent, icon_name)); + /* #FIXME Edit preset Buttons under OSX. + * Because of _strange_ layout of a Button with a scaled Bitmap on nonactive wxWindow, + * there is just temporary workaround. + * Send to create_scaled_bitmap(nullptr,...) for buttons without text => + * Bitmaps for this Buttons wouldn't be scaled and would be some blurred now, but + * they would be correctly updated on Plater + */ + SetBitmap(create_scaled_bitmap(label.IsEmpty() ? nullptr : parent, icon_name)); } From 74b3351aeba8fe0b3bbe066f7cbc3d3a962090f9 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 17 May 2019 16:05:32 +0200 Subject: [PATCH 4/4] Typo to last commit --- src/slic3r/GUI/Plater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index adbe0c92e..a9edf96f8 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -671,7 +671,7 @@ Sidebar::Sidebar(Plater *parent) auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL); combo_and_btn_sizer->Add(*combo, 1, wxEXPAND); if ((*combo)->edit_btn) - combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, + combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, int(0.3*wxGetApp().em_unit())); auto *sizer_presets = this->p->sizer_presets; @@ -778,7 +778,7 @@ void Sidebar::init_filament_combo(PresetComboBox **combo, const int extr_idx) { auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL); combo_and_btn_sizer->Add(*combo, 1, wxEXPAND); - combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, + combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, int(0.3*wxGetApp().em_unit())); auto /***/sizer_filaments = this->p->sizer_filaments;