mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 13:52:00 +08:00
Fix for SPE-1991 : New ComboBox: InsertItem issue (item was added twice)
This commit is contained in:
parent
7f1db8aa48
commit
0df5faff34
@ -88,7 +88,7 @@ static choice_ctrl* create_word_local_combo(wxWindow *parent)
|
|||||||
temp->SetTextCtrlStyle(wxTE_READONLY);
|
temp->SetTextCtrlStyle(wxTE_READONLY);
|
||||||
temp->Create(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr);
|
temp->Create(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr);
|
||||||
#else
|
#else
|
||||||
temp = new choice_ctrl(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY/* | wxBORDER_SIMPLE*/);
|
temp = new choice_ctrl(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY | DD_NO_CHECK_ICON);
|
||||||
#endif //__WXOSX__
|
#endif //__WXOSX__
|
||||||
|
|
||||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
|
@ -186,14 +186,9 @@ int ComboBox::Insert(const wxString& item,
|
|||||||
int ComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
int ComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||||
unsigned int pos, void* clientData)
|
unsigned int pos, void* clientData)
|
||||||
{
|
{
|
||||||
const int n = wxItemContainer::Insert(item, pos);
|
const int n = wxItemContainer::Insert(item, pos, clientData);
|
||||||
if (n != wxNOT_FOUND) {
|
if (n != wxNOT_FOUND)
|
||||||
texts.insert(texts.begin() + n, item);
|
icons[n] = bitmap;
|
||||||
icons.insert(icons.begin() + n, bitmap);
|
|
||||||
datas.insert(datas.begin() + n, clientData);
|
|
||||||
types.insert(types.begin() + n, wxClientData_None);
|
|
||||||
drop.Invalidate();
|
|
||||||
}
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +208,9 @@ void ComboBox::DoDeleteOneItem(unsigned int pos)
|
|||||||
icons.erase(icons.begin() + pos);
|
icons.erase(icons.begin() + pos);
|
||||||
datas.erase(datas.begin() + pos);
|
datas.erase(datas.begin() + pos);
|
||||||
types.erase(types.begin() + pos);
|
types.erase(types.begin() + pos);
|
||||||
|
const int selection = drop.GetSelection();
|
||||||
drop.Invalidate(true);
|
drop.Invalidate(true);
|
||||||
|
drop.SetSelection(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ComboBox::GetCount() const { return texts.size(); }
|
unsigned int ComboBox::GetCount() const { return texts.size(); }
|
||||||
@ -249,7 +246,9 @@ int ComboBox::DoInsertItems(const wxArrayStringsAdapter &items,
|
|||||||
types.insert(types.begin() + pos, type);
|
types.insert(types.begin() + pos, type);
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
const int selection = drop.GetSelection();
|
||||||
drop.Invalidate(true);
|
drop.Invalidate(true);
|
||||||
|
drop.SetSelection(selection);
|
||||||
return int(pos) - 1;
|
return int(pos) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
|
|
||||||
DropDown & GetDropDown() { return drop; }
|
DropDown & GetDropDown() { return drop; }
|
||||||
|
|
||||||
virtual bool SetFont(wxFont const & font) override;
|
bool SetFont(wxFont const & font) override;
|
||||||
|
|
||||||
bool SetBackgroundColour(const wxColour& colour) override;
|
bool SetBackgroundColour(const wxColour& colour) override;
|
||||||
bool SetForegroundColour(const wxColour& colour) override;
|
bool SetForegroundColour(const wxColour& colour) override;
|
||||||
@ -38,7 +38,6 @@ public:
|
|||||||
void SetBorderColor(StateColor const& color);
|
void SetBorderColor(StateColor const& color);
|
||||||
|
|
||||||
int Append(const wxString &item, const wxBitmapBundle &bitmap = wxNullBitmap);
|
int Append(const wxString &item, const wxBitmapBundle &bitmap = wxNullBitmap);
|
||||||
|
|
||||||
int Append(const wxString &item, const wxBitmapBundle &bitmap, void *clientData);
|
int Append(const wxString &item, const wxBitmapBundle &bitmap, void *clientData);
|
||||||
|
|
||||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
|
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
|
||||||
@ -72,7 +71,7 @@ protected:
|
|||||||
unsigned int pos,
|
unsigned int pos,
|
||||||
void ** clientData,
|
void ** clientData,
|
||||||
wxClientDataType type) override;
|
wxClientDataType type) override;
|
||||||
virtual void DoClear() override;
|
void DoClear() override;
|
||||||
|
|
||||||
void DoDeleteOneItem(unsigned int pos) override;
|
void DoDeleteOneItem(unsigned int pos) override;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user