From b28b9c49b208b4269563f59b42ac671fca8035be Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Sat, 22 Mar 2025 15:28:33 +0800 Subject: [PATCH] ENH:When software is full screen in mac, the sub frame uses the wxSTAYBON_TOP style jira: STUDIO-11046 Change-Id: Ie1b85e4ac5a5698ec42870349f688924cdf30e21 --- src/slic3r/GUI/BaseTransparentDPIFrame.cpp | 6 ++++++ src/slic3r/GUI/BaseTransparentDPIFrame.hpp | 2 +- src/slic3r/GUI/ImageDPIFrame.cpp | 4 ++++ src/slic3r/GUI/MainFrame.cpp | 2 ++ src/slic3r/GUI/Plater.cpp | 8 +++++++- src/slic3r/GUI/Plater.hpp | 2 ++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/BaseTransparentDPIFrame.cpp b/src/slic3r/GUI/BaseTransparentDPIFrame.cpp index e425a5516..aba3ea4d9 100644 --- a/src/slic3r/GUI/BaseTransparentDPIFrame.cpp +++ b/src/slic3r/GUI/BaseTransparentDPIFrame.cpp @@ -137,6 +137,12 @@ bool BaseTransparentDPIFrame::Show(bool show) return DPIFrame::Show(show); } +void BaseTransparentDPIFrame::on_full_screen(IntEvent &e) { +#ifdef __APPLE__ + SetWindowStyleFlag(GetWindowStyleFlag() | wxSTAY_ON_TOP); +#endif +} + void BaseTransparentDPIFrame::on_dpi_changed(const wxRect &suggested_rect) { m_button_ok->Rescale(); diff --git a/src/slic3r/GUI/BaseTransparentDPIFrame.hpp b/src/slic3r/GUI/BaseTransparentDPIFrame.hpp index 29613f0c1..35ed51ddf 100644 --- a/src/slic3r/GUI/BaseTransparentDPIFrame.hpp +++ b/src/slic3r/GUI/BaseTransparentDPIFrame.hpp @@ -33,7 +33,7 @@ public: void on_hide(); void clear_timer_count(); bool Show(bool show = true) override; - + void on_full_screen(IntEvent &); virtual void deal_ok(); virtual void deal_cancel(); virtual void on_timer(wxTimerEvent &event); diff --git a/src/slic3r/GUI/ImageDPIFrame.cpp b/src/slic3r/GUI/ImageDPIFrame.cpp index c2ee92f98..409ada8d7 100644 --- a/src/slic3r/GUI/ImageDPIFrame.cpp +++ b/src/slic3r/GUI/ImageDPIFrame.cpp @@ -26,6 +26,10 @@ ImageDPIFrame::ImageDPIFrame() SetMinSize(wxSize(FromDIP(width), -1)); SetMaxSize(wxSize(FromDIP(width), -1)); SetBackgroundColour(wxColour(242, 242, 242, 255)); +#ifdef __APPLE__ + SetWindowStyleFlag(GetWindowStyleFlag() | wxSTAY_ON_TOP); +#endif + m_sizer_main = new wxBoxSizer(wxVERTICAL); auto image_sizer = new wxBoxSizer(wxVERTICAL); auto imgsize = FromDIP(width); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 54d315d0e..cfa424746 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -242,6 +242,8 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ m_reset_title_text_colour_timer->Start(500); } } + auto int_event = new IntEvent(EVT_NOTICE_FULL_SCREEN_CHANGED, e.IsFullScreen() ? 1 : 0); + wxQueueEvent(wxGetApp().plater(), int_event); e.Skip(); }); #endif diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index d541d9398..f675a363f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -195,7 +195,7 @@ wxDEFINE_EVENT(EVT_ADD_FILAMENT, SimpleEvent); wxDEFINE_EVENT(EVT_DEL_FILAMENT, SimpleEvent); wxDEFINE_EVENT(EVT_ADD_CUSTOM_FILAMENT, ColorEvent); wxDEFINE_EVENT(EVT_NOTICE_CHILDE_SIZE_CHANGED, SimpleEvent); - +wxDEFINE_EVENT(EVT_NOTICE_FULL_SCREEN_CHANGED, IntEvent); #define PRINTER_THUMBNAIL_SIZE (wxSize(FromDIP(48), FromDIP(48))) #define PRINTER_THUMBNAIL_SIZE_SMALL (wxSize(FromDIP(32), FromDIP(32))) #define PRINTER_PANEL_SIZE_SMALL (wxSize(FromDIP(98), FromDIP(68))) @@ -2955,6 +2955,11 @@ void Sidebar::on_size(SimpleEvent &e) { } } +void Sidebar::on_full_screen(IntEvent &e) { + if (m_sna_dialog) { m_sna_dialog->on_full_screen(e); } + if (m_fna_dialog) { m_fna_dialog->on_full_screen(e); } +} + void Sidebar::get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size) { size =btn_sync->GetSize(); @@ -4329,6 +4334,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) this->q->Bind(EVT_CREATE_FILAMENT, &priv::on_create_filament, this); this->q->Bind(EVT_MODIFY_FILAMENT, &priv::on_modify_filament, this); this->q->Bind(EVT_NOTICE_CHILDE_SIZE_CHANGED, &Sidebar::on_size, sidebar); + this->q->Bind(EVT_NOTICE_FULL_SCREEN_CHANGED, &Sidebar::on_full_screen, sidebar); this->q->Bind(EVT_ADD_FILAMENT, &priv::on_add_filament, this); this->q->Bind(EVT_DEL_FILAMENT, &priv::on_delete_filament, this); this->q->Bind(EVT_ADD_CUSTOM_FILAMENT, &priv::on_add_custom_filament, this); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index b142f94d2..127d0246b 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -111,6 +111,7 @@ wxDECLARE_EVENT(EVT_MODIFY_FILAMENT, SimpleEvent); wxDECLARE_EVENT(EVT_ADD_FILAMENT, SimpleEvent); wxDECLARE_EVENT(EVT_DEL_FILAMENT, SimpleEvent); wxDECLARE_EVENT(EVT_NOTICE_CHILDE_SIZE_CHANGED, SimpleEvent); +wxDECLARE_EVENT(EVT_NOTICE_FULL_SCREEN_CHANGED, IntEvent); using ColorEvent = Event; wxDECLARE_EVENT(EVT_ADD_CUSTOM_FILAMENT, ColorEvent); const wxString DEFAULT_PROJECT_NAME = "Untitled"; @@ -182,6 +183,7 @@ public: void update_sync_status(const MachineObject* obj); int get_sidebar_pos_right_x(); void on_size(SimpleEvent &e); + void on_full_screen(IntEvent &); void get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size); void get_small_btn_sync_pos_size(wxPoint &pt, wxSize &size);