Fixed crash from start if SLA preset is selected.

Fixed extruder selection from ObjectList under OSX
This commit is contained in:
YuSanka 2019-11-08 11:24:57 +01:00
parent f2120c1122
commit ae4948bd94
3 changed files with 12 additions and 34 deletions

View File

@ -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<wxBitmap*> 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]()
{

View File

@ -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);

View File

@ -505,8 +505,6 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl,
bool use_thin_icon/* = false*/)
{
std::vector<wxBitmap*> 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<Slic3r::GUI::ObjectList*>(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);