diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 25654af8e90..bd3ac7efab3 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -124,7 +124,6 @@ class GUI_App : public wxApp wxColour m_color_label_default; wxColour m_color_label_phony; wxColour m_color_window_default; -#ifdef _WIN32 wxColour m_color_highlight_label_default; wxColour m_color_hovered_btn_label; wxColour m_color_hovered_btn; @@ -132,7 +131,6 @@ class GUI_App : public wxApp wxColour m_color_highlight_default; wxColour m_color_selected_btn_bg; bool m_force_colors_update { false }; -#endif wxFont m_small_font; wxFont m_bold_font; @@ -216,8 +214,6 @@ class GUI_App : public wxApp const wxColour& get_label_clr_phony() { return m_color_label_phony; } const wxColour& get_window_default_clr(){ return m_color_window_default; } - -#ifdef _WIN32 const wxColour& get_label_highlight_clr() { return m_color_highlight_label_default; } const wxColour& get_highlight_default_clr() { return m_color_highlight_default; } const wxColour& get_color_hovered_btn_label() { return m_color_hovered_btn_label; } @@ -227,7 +223,6 @@ class GUI_App : public wxApp #ifdef _MSW_DARK_MODE void force_menu_update(); #endif //_MSW_DARK_MODE -#endif const wxFont& small_font() { return m_small_font; } const wxFont& bold_font() { return m_bold_font; } diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 5a96894850b..84436d956a3 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -318,17 +318,21 @@ void MainFrame::update_icon() { } case ESettingsLayout::Tabs: { +#ifdef __APPLE__ + // no icons for macos + break; +#else if (icon_size >= 8) { m_tabpanel->SetPageImage(0, 0); m_tabpanel->SetPageImage(1, 1); m_tabpanel->SetPageImage(2, 2); - m_tabpanel->SetPageImage(3, 3); - m_tabpanel->SetPageImage(4, m_plater->printer_technology() == PrinterTechnology::ptSLA ? 6 : 4); - m_tabpanel->SetPageImage(5, m_plater->printer_technology() == PrinterTechnology::ptSLA ? 7 : 5); + m_tabpanel->SetPageImage(3, m_plater->printer_technology() == PrinterTechnology::ptSLA ? 6 : 3); + m_tabpanel->SetPageImage(4, m_plater->printer_technology() == PrinterTechnology::ptSLA ? 7 : 4); + m_tabpanel->SetPageImage(5, m_plater->printer_technology() == PrinterTechnology::ptSLA ? 8 : 5); } break; - } +#endif case ESettingsLayout::Dlg: { if (m_tabpanel->GetPageCount() == 4 && icon_size >= 8) { diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index c2c297786ea..54e23da0d09 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -184,9 +184,9 @@ class MainFrame : public DPIFrame void update_menubar(); // Open item in menu by menu and item name (in actual language) void open_menubar_item(const wxString& menu_name,const wxString& item_name); -#ifdef _WIN32 + void show_tabs_menu(bool show); -#endif + void update_ui_from_settings(); bool is_loaded() const { return m_loaded; } bool is_last_input_file() const { return !m_qs_last_input_file.IsEmpty(); } diff --git a/src/slic3r/GUI/Notebook.cpp b/src/slic3r/GUI/Notebook.cpp index c833872c172..408aeeaed11 100644 --- a/src/slic3r/GUI/Notebook.cpp +++ b/src/slic3r/GUI/Notebook.cpp @@ -1,7 +1,5 @@ #include "Notebook.hpp" -#ifdef _WIN32 - #include "libslic3r/AppConfig.hpp" #include "GUI_App.hpp" @@ -22,18 +20,27 @@ ButtonsListCtrl::ButtonsListCtrl(wxWindow *parent, bool add_mode_buttons/* = fal #endif //__WINDOWS__ int em = em_unit(this);// Slic3r::GUI::wxGetApp().em_unit(); - m_btn_margin = std::lround(0.3 * em); +#ifdef __WINDOWS__ + m_btn_margin = std::lround(0.3 * em); +#else + m_btn_margin = std::lround(0.4 * em); +#endif m_line_margin = std::lround(0.1 * em); m_sizer = new wxBoxSizer(wxHORIZONTAL); this->SetSizer(m_sizer); + // Create the buttons sizer with adjustable gaps m_buttons_sizer = new wxFlexGridSizer(1, m_btn_margin, m_btn_margin); +#ifdef __APPLE__ + m_buttons_sizer->SetHGap(m_btn_margin); // Horizontal gap between buttons + m_buttons_sizer->SetVGap(m_btn_margin); // Vertical gap between buttons +#endif m_sizer->Add(m_buttons_sizer, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxBOTTOM, m_btn_margin); if (add_mode_buttons) { m_mode_sizer = new Slic3r::GUI::ModeSizer(this, m_btn_margin, 0); - m_sizer->AddStretchSpacer(20); + m_sizer->AddStretchSpacer(20); // Adjust the stretch spacer to ensure buttons align correctly m_sizer->Add(m_mode_sizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, m_btn_margin); } @@ -48,45 +55,42 @@ void ButtonsListCtrl::OnPaint(wxPaintEvent&) if (m_selection < 0 || m_selection >= (int)m_pageButtons.size()) return; - + const wxColour& selected_btn_bg = Slic3r::GUI::wxGetApp().get_color_selected_btn_bg(); const wxColour& default_btn_bg = Slic3r::GUI::wxGetApp().get_highlight_default_clr(); - const wxColour& btn_marker_color = Slic3r::GUI::wxGetApp().get_color_hovered_btn(); //Slic3r::GUI::wxGetApp().get_color_hovered_btn_label(); + const wxColour& btn_marker_color = Slic3r::GUI::wxGetApp().get_color_hovered_btn(); // highlight selected notebook button - for (int idx = 0; idx < int(m_pageButtons.size()); idx++) { wxButton* btn = m_pageButtons[idx]; - btn->SetBackgroundColour(idx == m_selection ? selected_btn_bg : default_btn_bg); - +#ifdef __APPLE__ + // Adding border to make it look more like buttons + btn->SetWindowStyle(wxBORDER_SUNKEN | wxBORDER_SIMPLE); +#else wxPoint pos = btn->GetPosition(); wxSize size = btn->GetSize(); const wxColour& clr = idx == m_selection ? btn_marker_color : default_btn_bg; dc.SetPen(clr); dc.SetBrush(clr); dc.DrawRectangle(pos.x, pos.y + size.y, size.x, sz.y - size.y); +#endif } // highlight selected mode button - if (m_mode_sizer) { const std::vector& mode_btns = m_mode_sizer->get_btns(); for (int idx = 0; idx < int(mode_btns.size()); idx++) { Slic3r::GUI::ModeButton* btn = mode_btns[idx]; btn->SetBackgroundColour(btn->is_selected() ? selected_btn_bg : default_btn_bg); - - //wxPoint pos = btn->GetPosition(); - //wxSize size = btn->GetSize(); - //const wxColour& clr = btn->is_selected() ? btn_marker_color : default_btn_bg; - //dc.SetPen(clr); - //dc.SetBrush(clr); - //dc.DrawRectangle(pos.x, pos.y + size.y, size.x, sz.y - size.y); +#ifdef __APPLE_ + // Adding border to make it look more like buttons + btn->SetWindowStyle(wxBORDER_SUNKEN | wxBORDER_SIMPLE); +#endif } } // Draw orange bottom line - dc.SetPen(btn_marker_color); dc.SetBrush(btn_marker_color); dc.DrawRectangle(1, sz.y - m_line_margin, sz.x, m_line_margin); @@ -104,10 +108,18 @@ void ButtonsListCtrl::Rescale() btn->msw_rescale(); int em = em_unit(this); + +#ifdef __APPLE__ + // Adjust margins and sizes specifically for macOS + m_btn_margin = std::lround(0.4 * em); + m_line_margin = std::lround(0.1 * em); +#else m_btn_margin = std::lround(0.3 * em); m_line_margin = std::lround(0.1 * em); - m_buttons_sizer->SetVGap(m_btn_margin); - m_buttons_sizer->SetHGap(m_btn_margin); +#endif //__APPLE__ + + m_buttons_sizer->SetVGap(m_btn_margin); // Adjust vertical gap here + m_buttons_sizer->SetHGap(m_btn_margin); // Adjust horizontal gap here m_sizer->Layout(); } @@ -122,7 +134,18 @@ void ButtonsListCtrl::SetSelection(int sel) bool ButtonsListCtrl::InsertPage(size_t n, const wxString& text, bool bSelect/* = false*/, const std::string& bmp_name/* = ""*/, const int bmp_size) { - ScalableButton* btn = new ScalableButton(this, wxID_ANY, bmp_name, text, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER | (bmp_name.empty() ? 0 : wxBU_LEFT), false, bmp_size); + + ScalableButton* btn = new ScalableButton(this, wxID_ANY, bmp_name, text, wxDefaultSize, wxDefaultPosition, +#ifdef __APPLE__ + wxBU_EXACTFIT | wxBORDER_SIMPLE | (bmp_name.empty() ? 0 : wxBU_LEFT), +#else + wxBU_EXACTFIT | wxNO_BORDER | (bmp_name.empty() ? 0 : wxBU_LEFT), +#endif //__APPLE__ + false, bmp_size); + + // Set custom background color for the button + btn->SetBackgroundColour(Slic3r::GUI::wxGetApp().get_color_hovered_btn()); + btn->Bind(wxEVT_BUTTON, [this, btn](wxCommandEvent& event) { if (auto it = std::find(m_pageButtons.begin(), m_pageButtons.end(), btn); it != m_pageButtons.end()) { m_selection = (it - m_pageButtons.begin()); @@ -131,7 +154,7 @@ bool ButtonsListCtrl::InsertPage(size_t n, const wxString& text, bool bSelect/* wxPostEvent(this->GetParent(), evt); Refresh(); } - }); + }); Slic3r::GUI::wxGetApp().UpdateDarkUI(btn); m_pageButtons.insert(m_pageButtons.begin() + n, btn); m_spacers.insert(m_spacers.begin() + n, false); @@ -247,6 +270,4 @@ void Notebook::EmitEventSelChanged(int16_t new_sel) { } } } -#endif // _WIN32 - - + diff --git a/src/slic3r/GUI/Notebook.hpp b/src/slic3r/GUI/Notebook.hpp index 50c209aec1e..4b4cd75111b 100644 --- a/src/slic3r/GUI/Notebook.hpp +++ b/src/slic3r/GUI/Notebook.hpp @@ -1,8 +1,6 @@ #ifndef slic3r_Notebook_hpp_ #define slic3r_Notebook_hpp_ -#ifdef _WIN32 - #include namespace Slic3r { @@ -98,7 +96,7 @@ class Notebook: public wxBookCtrlBase SetSizer(mainSizer); this->Bind(wxCUSTOMEVT_NOTEBOOK_SEL_CHANGED, [this](wxCommandEvent& evt) - { + { if (int page_idx = evt.GetId(); page_idx >= 0) SetBtSelection(page_idx); }); @@ -246,7 +244,7 @@ class Notebook: public wxBookCtrlBase } //// get number of pages in the dialog - //virtual size_t GetPageCount() const override { + //virtual size_t GetPageCount() const override { // return btidx_to_tabpage.size(); //} @@ -545,7 +543,7 @@ class Notebook: public wxBookCtrlBase // the base class version. } - virtual wxBookCtrlEvent * CreatePageChangingEvent() const override + virtual wxBookCtrlEvent* CreatePageChangingEvent() const override { return new wxBookCtrlEvent(wxEVT_BOOKCTRL_PAGE_CHANGING, GetId()); @@ -622,5 +620,4 @@ class Notebook: public wxBookCtrlBase ButtonsListCtrl* m_ctrl{ nullptr }; }; -#endif // _WIN32 #endif // slic3r_Notebook_hpp_ diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 64c4f736c07..fe396dee233 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -23,7 +23,10 @@ inline void msw_rescale_menu(wxMenu* /* menu */) {} #endif /* __WXMSW__ */ #ifdef _MSW_DARK_MODE -#define _USE_CUSTOM_NOTEBOOK 1 +#define _USE_CUSTOM_NOTEBOOK 1 +#endif +#ifdef __APPLE__ +#define _USE_CUSTOM_NOTEBOOK 1 #endif wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,