mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-06-01 13:15:26 +08:00
Added overriding of the DoGetBestSize() to correct control sizing on OSX and Linux/GTK
This commit is contained in:
parent
5cd4597d38
commit
a5119a41a5
@ -765,15 +765,12 @@ PrusaDoubleSlider::PrusaDoubleSlider( wxWindow *parent,
|
|||||||
wxControl(parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE),
|
wxControl(parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE),
|
||||||
m_lower_value(lowerValue), m_higher_value (higherValue),
|
m_lower_value(lowerValue), m_higher_value (higherValue),
|
||||||
m_min_value(minValue), m_max_value(maxValue),
|
m_min_value(minValue), m_max_value(maxValue),
|
||||||
m_style(style)
|
m_style(style == wxSL_HORIZONTAL || style == wxSL_VERTICAL ? style: wxSL_HORIZONTAL)
|
||||||
{
|
{
|
||||||
#ifndef __WXOSX__ // SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
|
#ifndef __WXOSX__ // SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
|
||||||
SetDoubleBuffered(true);
|
SetDoubleBuffered(true);
|
||||||
#endif //__WXOSX__
|
#endif //__WXOSX__
|
||||||
|
|
||||||
if (m_style != wxSL_HORIZONTAL && m_style != wxSL_VERTICAL)
|
|
||||||
m_style = wxSL_HORIZONTAL;
|
|
||||||
|
|
||||||
m_thumb_higher = wxBitmap(style == wxSL_HORIZONTAL ? Slic3r::GUI::from_u8(Slic3r::var("right_half_circle.png")) :
|
m_thumb_higher = wxBitmap(style == wxSL_HORIZONTAL ? Slic3r::GUI::from_u8(Slic3r::var("right_half_circle.png")) :
|
||||||
Slic3r::GUI::from_u8(Slic3r::var("up_half_circle.png")), wxBITMAP_TYPE_PNG);
|
Slic3r::GUI::from_u8(Slic3r::var("up_half_circle.png")), wxBITMAP_TYPE_PNG);
|
||||||
m_thumb_lower = wxBitmap(style == wxSL_HORIZONTAL ? Slic3r::GUI::from_u8(Slic3r::var("left_half_circle.png")) :
|
m_thumb_lower = wxBitmap(style == wxSL_HORIZONTAL ? Slic3r::GUI::from_u8(Slic3r::var("left_half_circle.png")) :
|
||||||
@ -807,6 +804,15 @@ PrusaDoubleSlider::PrusaDoubleSlider( wxWindow *parent,
|
|||||||
segm_pens = { &DARK_ORANGE_PEN, &ORANGE_PEN, &LIGHT_ORANGE_PEN };
|
segm_pens = { &DARK_ORANGE_PEN, &ORANGE_PEN, &LIGHT_ORANGE_PEN };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize PrusaDoubleSlider::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
wxSize size = wxControl::DoGetBestSize();
|
||||||
|
if (size.x > 1 && size.y > 1)
|
||||||
|
return size;
|
||||||
|
const int new_size = is_horizontal() ? 80 : 120;
|
||||||
|
return wxSize(new_size, new_size);
|
||||||
|
}
|
||||||
|
|
||||||
void PrusaDoubleSlider::SetLowerValue(const int lower_val)
|
void PrusaDoubleSlider::SetLowerValue(const int lower_val)
|
||||||
{
|
{
|
||||||
m_lower_value = lower_val;
|
m_lower_value = lower_val;
|
||||||
|
@ -527,7 +527,7 @@ public:
|
|||||||
void SetHigherValue(int higher_val);
|
void SetHigherValue(int higher_val);
|
||||||
void SetKoefForLabels(float koef){ m_label_koef = koef;}
|
void SetKoefForLabels(float koef){ m_label_koef = koef;}
|
||||||
|
|
||||||
wxSize DoGetBestSize(){ return wxDefaultSize; }
|
wxSize DoGetBestSize() const override;
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& ){ render();}
|
void OnPaint(wxPaintEvent& ){ render();}
|
||||||
void OnLeftDown(wxMouseEvent& event);
|
void OnLeftDown(wxMouseEvent& event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user