From ae4948bd946af8d3f4c2e184a686aa1d66468e55 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 8 Nov 2019 11:24:57 +0100 Subject: [PATCH] Fixed crash from start if SLA preset is selected. Fixed extruder selection from ObjectList under OSX --- src/slic3r/GUI/GUI_ObjectList.cpp | 32 +------------------------------ src/slic3r/GUI/GUI_Preview.cpp | 2 ++ src/slic3r/GUI/wxExtensions.cpp | 12 +++++++++--- 3 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 1cbfc2bdf..0fef8988e 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -895,12 +895,6 @@ void ObjectList::extruder_editing() if (!item || !(m_objects_model->GetItemType(item) & (itVolume | itObject))) return; - // ! #ys Use ApplyExtruderSelector instead this code - /* - std::vector icons = get_extruder_color_icons(); - if (icons.empty()) - return; - */ const int column_width = GetColumn(colExtruder)->GetWidth() + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X) + 5; wxPoint pos = get_mouse_position_in_control(); @@ -910,32 +904,8 @@ void ObjectList::extruder_editing() apply_extruder_selector(&m_extruder_editor, this, L("default"), pos, size); - // ! #ys Use ApplyExtruderSelector instead this code - /* - if (!m_extruder_editor) - m_extruder_editor = new wxBitmapComboBox(this, wxID_ANY, wxEmptyString, pos, size, - 0, nullptr, wxCB_READONLY); - else - { - m_extruder_editor->SetPosition(pos); - m_extruder_editor->SetMinSize(size); - m_extruder_editor->SetSize(size); - m_extruder_editor->Clear(); - m_extruder_editor->Show(); - } - - int i = 0; - for (wxBitmap* bmp : icons) { - if (i == 0) { - m_extruder_editor->Append(_(L("default")), *bmp); - ++i; - } - - m_extruder_editor->Append(wxString::Format("%d", i), *bmp); - ++i; - } - */ m_extruder_editor->SetSelection(m_objects_model->GetExtruderNumber(item)); + m_extruder_editor->Show(); auto set_extruder = [this]() { diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index a52322e04..847b87fd5 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -619,6 +619,8 @@ void Preview::update_extruder_selector() void Preview::create_double_slider() { m_slider = new DoubleSlider(this, wxID_ANY, 0, 0, 0, 100); + m_slider->EnableTickManipulation(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptFFF); + // #ys_FIXME_COLOR // m_double_slider_sizer->Add(m_slider, 0, wxEXPAND, 0); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index f4c46c0f9..39fc799d7 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -505,8 +505,6 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl, bool use_thin_icon/* = false*/) { std::vector icons = get_extruder_color_icons(use_thin_icon); - if (icons.empty()) - return; if (!*ctrl) *ctrl = new wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, pos, size, @@ -519,6 +517,14 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl, (*ctrl)->Clear(); } + if (icons.empty() && !first_item.empty()) { + (*ctrl)->Append(_(first_item), wxNullBitmap); + return; + } + + // For ObjectList we use short extruder name (just a number) + const bool use_full_item_name = dynamic_cast(parent) == nullptr; + int i = 0; wxString str = _(L("Extruder")); for (wxBitmap* bmp : icons) { @@ -528,7 +534,7 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl, ++i; } - (*ctrl)->Append(wxString::Format("%s %d", str, i), *bmp); + (*ctrl)->Append(use_full_item_name ? wxString::Format("%s %d", str, i) : std::to_string(i), *bmp); ++i; } (*ctrl)->SetSelection(0);