Fixed scroll the Object List to selected item on OSX & GTK

+ fixed #1395 (maximum PresetComboBox's width limit on Ubuntu)
This commit is contained in:
YuSanka 2018-12-14 09:52:54 +01:00
parent 2d29b7d6cd
commit 48a94ebae1
3 changed files with 4 additions and 8 deletions

View File

@ -1459,13 +1459,11 @@ void ObjectList::update_selections()
select_items(sels); select_items(sels);
#ifdef __WXMSW__
if (GetSelection()) { if (GetSelection()) {
const int sel_item_row = GetRowByItem(GetSelection()); const wxRect& top_rc = GetItemRect(GetTopItem());
ScrollLines(sel_item_row - m_selected_row); const wxRect& sel_rc = GetItemRect(GetSelection());
m_selected_row = sel_item_row; ScrollLines(int((sel_rc.y - top_rc.y) / top_rc.GetHeight()) - 0.5*GetCountPerPage());
} }
#endif //__WXMSW__
} }
void ObjectList::update_selections_on_canvas() void ObjectList::update_selections_on_canvas()

View File

@ -108,8 +108,6 @@ class ObjectList : public wxDataViewCtrl
bool m_parts_changed = false; bool m_parts_changed = false;
bool m_part_settings_changed = false; bool m_part_settings_changed = false;
int m_selected_row = 0;
public: public:
ObjectList(wxWindow* parent); ObjectList(wxWindow* parent);
~ObjectList(); ~ObjectList();

View File

@ -213,7 +213,7 @@ void SlicedInfo::SetTextAndShow(SlisedInfoIdx idx, const wxString& text, const w
} }
PresetComboBox::PresetComboBox(wxWindow *parent, Preset::Type preset_type) : PresetComboBox::PresetComboBox(wxWindow *parent, Preset::Type preset_type) :
wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY), wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,-1), 0, nullptr, wxCB_READONLY),
preset_type(preset_type), preset_type(preset_type),
last_selected(wxNOT_FOUND) last_selected(wxNOT_FOUND)
{ {