mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	FIX:macos13 system display printer rename button
Change-Id: I56a492043690ee6ef320fee626f4a09c070119d9
This commit is contained in:
		
							parent
							
								
									1ca7c4e554
								
							
						
					
					
						commit
						447e7306bd
					
				
					 2 changed files with 26 additions and 8 deletions
				
			
		|  | @ -13,6 +13,7 @@ | |||
| #include "Widgets/StaticBox.hpp" | ||||
| #include "ConnectPrinter.hpp" | ||||
| 
 | ||||
| 
 | ||||
| #include <wx/progdlg.h> | ||||
| #include <wx/clipbrd.h> | ||||
| #include <wx/dcgraph.h> | ||||
|  | @ -175,8 +176,22 @@ MachineObjectPanel::MachineObjectPanel(wxWindow *parent, wxWindowID id, const wx | |||
|     this->Bind(wxEVT_ENTER_WINDOW, &MachineObjectPanel::on_mouse_enter, this); | ||||
|     this->Bind(wxEVT_LEAVE_WINDOW, &MachineObjectPanel::on_mouse_leave, this); | ||||
|     this->Bind(wxEVT_LEFT_UP, &MachineObjectPanel::on_mouse_left_up, this); | ||||
| 
 | ||||
| #ifdef __APPLE__ | ||||
|     wxPlatformInfo platformInfo; | ||||
|     auto major = platformInfo.GetOSMajorVersion(); | ||||
|     auto minor = platformInfo.GetOSMinorVersion(); | ||||
|     auto micro = platformInfo.GetOSMicroVersion(); | ||||
| 
 | ||||
|     //macos 13.1.0
 | ||||
|     if (major >= 13 && minor >= 1 && micro >= 0) { | ||||
|         m_is_macos_special_version = true; | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| MachineObjectPanel::~MachineObjectPanel() {} | ||||
| 
 | ||||
| void MachineObjectPanel::show_bind_dialog() | ||||
|  | @ -286,10 +301,14 @@ void MachineObjectPanel::doRender(wxDC &dc) | |||
| 
 | ||||
|     dc.DrawText(finally_name, wxPoint(left, (size.y - sizet.y) / 2)); | ||||
| 
 | ||||
|     if (m_hover) { | ||||
|         dc.SetPen(SELECT_MACHINE_BRAND); | ||||
|         dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|         dc.DrawRectangle(0, 0, size.x, size.y); | ||||
| 
 | ||||
|     if (m_hover || m_is_macos_special_version) { | ||||
| 
 | ||||
|         if (m_hover && !m_is_macos_special_version) { | ||||
|             dc.SetPen(SELECT_MACHINE_BRAND); | ||||
|             dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|             dc.DrawRectangle(0, 0, size.x, size.y); | ||||
|         } | ||||
| 
 | ||||
|         if (m_show_bind) { | ||||
|             if (m_bind_state == ALLOW_UNBIND) { | ||||
|  | @ -303,6 +322,7 @@ void MachineObjectPanel::doRender(wxDC &dc) | |||
|             dc.DrawBitmap(m_edit_name_img.bmp(), left, (size.y - m_edit_name_img.GetBmpSize().y) / 2); | ||||
|         } | ||||
|     } | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MachineObjectPanel::update_machine_info(MachineObject *info, bool is_my_devices) | ||||
|  |  | |||
|  | @ -117,6 +117,7 @@ private: | |||
|     bool        m_show_edit{false}; | ||||
|     bool        m_show_bind{false}; | ||||
|     bool        m_hover {false}; | ||||
|     bool        m_is_macos_special_version{false}; | ||||
| 
 | ||||
| 
 | ||||
|     PrinterBindState   m_bind_state; | ||||
|  | @ -145,17 +146,14 @@ public: | |||
|                        const wxSize &  size  = wxDefaultSize, | ||||
|                        long            style = wxTAB_TRAVERSAL, | ||||
|                        const wxString &name  = wxEmptyString); | ||||
|      | ||||
|     ~MachineObjectPanel(); | ||||
| 
 | ||||
|     void show_bind_dialog(); | ||||
|   | ||||
|     void set_printer_state(PrinterState state); | ||||
| 
 | ||||
|     void show_printer_bind(bool show, PrinterBindState state); | ||||
|     void show_edit_printer_name(bool show); | ||||
| 
 | ||||
|     void update_machine_info(MachineObject *info, bool is_my_devices = false); | ||||
| 
 | ||||
| protected: | ||||
|     void OnPaint(wxPaintEvent &event); | ||||
|     void render(wxDC &dc); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang