OSX specific : Set top border for the mode buttons, when settings pages has new layouts

(when tabs bar is hidden)

+ Code cleaning for OG_CustomCtrl (delete unused input parameter from the draw_blinking_bmp())
This commit is contained in:
YuSanka 2020-11-06 16:24:03 +01:00
parent 1492bc9cd5
commit 8448d1a1dc
7 changed files with 28 additions and 3 deletions

View file

@ -429,6 +429,10 @@ void MainFrame::update_layout()
// m_tabpanel->SetMinSize(size); // m_tabpanel->SetMinSize(size);
// } // }
//#endif //#endif
#ifdef __APPLE__
m_plater->sidebar().change_top_border_for_mode_sizer(m_layout != ESettingsLayout::Old);
#endif
Layout(); Layout();
Thaw(); Thaw();

View file

@ -627,7 +627,7 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC& dc, wxPoint pos, const wxStr
return pos.x + width + ctrl->m_h_gap; return pos.x + width + ctrl->m_h_gap;
} }
wxPoint OG_CustomCtrl::CtrlLine::draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking, size_t rect_id) wxPoint OG_CustomCtrl::CtrlLine::draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking)
{ {
wxBitmap bmp_blinking = create_scaled_bitmap(is_blinking ? "search_blink" : "empty", ctrl); wxBitmap bmp_blinking = create_scaled_bitmap(is_blinking ? "search_blink" : "empty", ctrl);
wxCoord h_pos = pos.x; wxCoord h_pos = pos.x;
@ -643,7 +643,7 @@ wxPoint OG_CustomCtrl::CtrlLine::draw_blinking_bmp(wxDC& dc, wxPoint pos, bool i
wxCoord OG_CustomCtrl::CtrlLine::draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id) wxCoord OG_CustomCtrl::CtrlLine::draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id)
{ {
pos = draw_blinking_bmp(dc, pos, is_blinking, rect_id); pos = draw_blinking_bmp(dc, pos, is_blinking);
wxCoord h_pos = pos.x; wxCoord h_pos = pos.x;
wxCoord v_pos = pos.y; wxCoord v_pos = pos.y;

View file

@ -55,7 +55,7 @@ class OG_CustomCtrl :public wxPanel
void render(wxDC& dc, wxCoord v_pos); void render(wxDC& dc, wxCoord v_pos);
wxCoord draw_mode_bmp(wxDC& dc, wxCoord v_pos); wxCoord draw_mode_bmp(wxDC& dc, wxCoord v_pos);
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false); wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false);
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking, size_t rect_id = 0); wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking);
wxCoord draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id = 0); wxCoord draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id = 0);
bool launch_browser() const; bool launch_browser() const;

View file

@ -910,6 +910,12 @@ void Sidebar::update_mode_sizer() const
p->mode_sizer->SetMode(m_mode); p->mode_sizer->SetMode(m_mode);
} }
void Sidebar::change_top_border_for_mode_sizer(bool increase_border)
{
p->mode_sizer->set_items_flag(increase_border ? wxTOP : 0);
p->mode_sizer->set_items_border(increase_border ? int(0.5 * wxGetApp().em_unit()) : 0);
}
void Sidebar::update_reslice_btn_tooltip() const void Sidebar::update_reslice_btn_tooltip() const
{ {
wxString tooltip = wxString("Slice") + " [" + GUI::shortkey_ctrl_prefix() + "R]"; wxString tooltip = wxString("Slice") + " [" + GUI::shortkey_ctrl_prefix() + "R]";

View file

@ -72,6 +72,7 @@ public:
void update_all_preset_comboboxes(); void update_all_preset_comboboxes();
void update_presets(Slic3r::Preset::Type preset_type); void update_presets(Slic3r::Preset::Type preset_type);
void update_mode_sizer() const; void update_mode_sizer() const;
void change_top_border_for_mode_sizer(bool increase_border);
void update_reslice_btn_tooltip() const; void update_reslice_btn_tooltip() const;
void msw_rescale(); void msw_rescale();
void sys_color_changed(); void sys_color_changed();

View file

@ -696,6 +696,17 @@ void ModeSizer::SetMode(const int mode)
m_mode_btns[m]->SetState(int(m) == mode); m_mode_btns[m]->SetState(int(m) == mode);
} }
void ModeSizer::set_items_flag(int flag)
{
for (wxSizerItem* item : this->GetChildren())
item->SetFlag(flag);
}
void ModeSizer::set_items_border(int border)
{
for (wxSizerItem* item : this->GetChildren())
item->SetBorder(border);
}
void ModeSizer::msw_rescale() void ModeSizer::msw_rescale()
{ {

View file

@ -298,6 +298,9 @@ public:
void SetMode(const /*ConfigOptionMode*/int mode); void SetMode(const /*ConfigOptionMode*/int mode);
void set_items_flag(int flag);
void set_items_border(int border);
void msw_rescale(); void msw_rescale();
private: private: