More improvements

This commit is contained in:
YuSanka 2019-10-02 15:02:13 +02:00
parent 4171a6a80d
commit 9e01740db6

View file

@ -896,20 +896,22 @@ void ObjectList::extruder_editing()
const int column_width = GetColumn(colExtruder)->GetWidth(); const int column_width = GetColumn(colExtruder)->GetWidth();
wxPoint pos = get_mouse_position_in_control(); wxPoint pos = get_mouse_position_in_control();
wxSize size = wxSize(column_width, -1);
pos.x = GetColumn(colName)->GetWidth() + GetColumn(colPrint)->GetWidth(); pos.x = GetColumn(colName)->GetWidth() + GetColumn(colPrint)->GetWidth();
// pos.y -= 2*GetTextExtent("m").y; pos.y -= GetTextExtent("m").y;
if (!m_extruder_editor) if (!m_extruder_editor)
m_extruder_editor = new wxBitmapComboBox(this, wxID_ANY, wxEmptyString, pos, wxSize(column_width, -1), m_extruder_editor = new wxBitmapComboBox(this, wxID_ANY, wxEmptyString, pos, size,
0, nullptr, wxCB_READONLY); 0, nullptr, wxCB_READONLY);
else else
{ {
m_extruder_editor->SetPosition(pos); m_extruder_editor->SetPosition(pos);
m_extruder_editor->SetMinSize(size);
m_extruder_editor->SetSize(size);
m_extruder_editor->Clear(); m_extruder_editor->Clear();
m_extruder_editor->Show(); m_extruder_editor->Show();
} }
int i = 0; int i = 0;
for (wxBitmap* bmp : icons) { for (wxBitmap* bmp : icons) {
if (i == 0) { if (i == 0) {
@ -922,8 +924,11 @@ void ObjectList::extruder_editing()
} }
m_extruder_editor->SetSelection(m_objects_model->GetExtruderNumber(item)); m_extruder_editor->SetSelection(m_objects_model->GetExtruderNumber(item));
auto set_extruder = [this, item]() auto set_extruder = [this]()
{ {
wxDataViewItem item = GetSelection();
if (!item) return;
const int selection = m_extruder_editor->GetSelection(); const int selection = m_extruder_editor->GetSelection();
if (selection >= 0) if (selection >= 0)
m_objects_model->SetExtruder(m_extruder_editor->GetString(selection), item); m_objects_model->SetExtruder(m_extruder_editor->GetString(selection), item);
@ -937,12 +942,12 @@ void ObjectList::extruder_editing()
set_extruder(); set_extruder();
evt.StopPropagation(); evt.StopPropagation();
}); });
/*
m_extruder_editor->Bind(wxEVT_KILL_FOCUS, [set_extruder](wxFocusEvent& evt) m_extruder_editor->Bind(wxEVT_KILL_FOCUS, [set_extruder](wxFocusEvent& evt)
{ {
set_extruder(); set_extruder();
evt.Skip(); evt.Skip();
}); });*/
} }