Using of wxWidgets 3.1.6 WIP: Linux/OSX specific fixes

OSX specific: Fixed get_mouse_position_in_control().
+ Use GetItemRect() to calculation of the position and size for Extruder selector

Linux specific:
* Use just 1.0 scale for wxBitmapComboboxes under GTK3 and gtk3
* GTK2 specific: use GTK2 doesn't suppost get_scale, so scale bitmap size form em_unit()
This commit is contained in:
YuSanka 2022-06-03 12:49:21 +02:00 committed by Lukas Matena
parent 066b567714
commit f8477d1be6
9 changed files with 85 additions and 150 deletions
src/slic3r/GUI

View file

@ -971,12 +971,11 @@ void ObjectList::extruder_editing()
if (!item || !(m_objects_model->GetItemType(item) & (itVolume | itObject)))
return;
const int column_width = GetColumn(colExtruder)->GetWidth() + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X) + 5;
wxPoint pos = this->get_mouse_position_in_control();
wxSize size = wxSize(column_width, -1);
pos.x = GetColumn(colName)->GetWidth() + GetColumn(colPrint)->GetWidth() + 5;
pos.y -= GetTextExtent("m").y;
wxRect rect = this->GetItemRect(item, GetColumn(colExtruder));
wxPoint pos = rect.GetPosition();
pos.y -= 4;
wxSize size = rect.GetSize();
size.SetWidth(size.GetWidth() + 8);
apply_extruder_selector(&m_extruder_editor, this, L("default"), pos, size);
@ -2433,6 +2432,21 @@ bool ObjectList::can_merge_to_single_object() const
return (*m_objects)[obj_idx]->volumes.size() > 1;
}
wxPoint ObjectList::get_mouse_position_in_control() const
{
wxPoint pt = wxGetMousePosition() - this->GetScreenPosition();
#ifdef __APPLE__
// Workaround for OSX. From wxWidgets 3.1.6 Hittest doesn't respect to the header of wxDataViewCtrl
if (wxDataViewItem top_item = this->GetTopItem(); top_item.IsOk()) {
auto rect = this->GetItemRect(top_item, this->GetColumn(0));
pt.y -= rect.y;
}
#endif // __APPLE__
return pt;
}
// NO_PARAMETERS function call means that changed object index will be determine from Selection()
void ObjectList::changed_object(const int obj_idx/* = -1*/) const
{