mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Fix for #6218 - Button tooltip in the way
Use wxRichTooltip instead of wxTooltip for buttons on the bottom of a sidebar
This commit is contained in:
		
							parent
							
								
									e185bf58b7
								
							
						
					
					
						commit
						e2f2ed4172
					
				
					 1 changed files with 25 additions and 2 deletions
				
			
		|  | @ -27,6 +27,7 @@ | ||||||
| #include <wx/numdlg.h> | #include <wx/numdlg.h> | ||||||
| #include <wx/debug.h> | #include <wx/debug.h> | ||||||
| #include <wx/busyinfo.h> | #include <wx/busyinfo.h> | ||||||
|  | #include <wx/richtooltip.h> | ||||||
| 
 | 
 | ||||||
| #include "libslic3r/libslic3r.h" | #include "libslic3r/libslic3r.h" | ||||||
| #include "libslic3r/Format/STL.hpp" | #include "libslic3r/Format/STL.hpp" | ||||||
|  | @ -611,6 +612,7 @@ struct Sidebar::priv | ||||||
| 
 | 
 | ||||||
|     wxButton *btn_export_gcode; |     wxButton *btn_export_gcode; | ||||||
|     wxButton *btn_reslice; |     wxButton *btn_reslice; | ||||||
|  |     wxString btn_reslice_tip; | ||||||
|     ScalableButton *btn_send_gcode; |     ScalableButton *btn_send_gcode; | ||||||
|     //ScalableButton *btn_eject_device;
 |     //ScalableButton *btn_eject_device;
 | ||||||
| 	ScalableButton* btn_export_gcode_removable; //exports to removable drives (appears only if removable drive is connected)
 | 	ScalableButton* btn_export_gcode_removable; //exports to removable drives (appears only if removable drive is connected)
 | ||||||
|  | @ -622,6 +624,7 @@ struct Sidebar::priv | ||||||
|     ~priv(); |     ~priv(); | ||||||
| 
 | 
 | ||||||
|     void show_preset_comboboxes(); |     void show_preset_comboboxes(); | ||||||
|  |     void show_rich_tip(const wxString& tooltip, wxButton* btn); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| Sidebar::priv::~priv() | Sidebar::priv::~priv() | ||||||
|  | @ -650,6 +653,17 @@ void Sidebar::priv::show_preset_comboboxes() | ||||||
|     scrolled->Refresh(); |     scrolled->Refresh(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void Sidebar::priv::show_rich_tip(const wxString& tooltip, wxButton* btn) | ||||||
|  | {    | ||||||
|  |     if (tooltip.IsEmpty()) | ||||||
|  |         return; | ||||||
|  |     wxRichToolTip tip(tooltip, ""); | ||||||
|  |     tip.SetIcon(wxICON_NONE); | ||||||
|  |     tip.SetTitleFont(wxGetApp().normal_font()); | ||||||
|  |     tip.SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); | ||||||
|  |     tip.SetTimeout(1200); | ||||||
|  |     tip.ShowFor(btn); | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| // Sidebar / public
 | // Sidebar / public
 | ||||||
| 
 | 
 | ||||||
|  | @ -784,7 +798,11 @@ Sidebar::Sidebar(Plater *parent) | ||||||
| #endif //__APPLE__
 | #endif //__APPLE__
 | ||||||
|         ScalableBitmap bmp = ScalableBitmap(this, icon_name, bmp_px_cnt); |         ScalableBitmap bmp = ScalableBitmap(this, icon_name, bmp_px_cnt); | ||||||
|         *btn = new ScalableButton(this, wxID_ANY, bmp, "", wxBU_EXACTFIT); |         *btn = new ScalableButton(this, wxID_ANY, bmp, "", wxBU_EXACTFIT); | ||||||
|         (*btn)->SetToolTip(tooltip); | 
 | ||||||
|  |         (*btn)->Bind(wxEVT_ENTER_WINDOW, [tooltip, btn, this](wxMouseEvent& event) { | ||||||
|  |             p->show_rich_tip(tooltip, *btn); | ||||||
|  |             event.Skip(); | ||||||
|  |         }); | ||||||
|         (*btn)->Hide(); |         (*btn)->Hide(); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | @ -843,6 +861,11 @@ Sidebar::Sidebar(Plater *parent) | ||||||
|             p->plater->reslice(); |             p->plater->reslice(); | ||||||
|         p->plater->select_view_3D("Preview"); |         p->plater->select_view_3D("Preview"); | ||||||
|     }); |     }); | ||||||
|  | 
 | ||||||
|  |     p->btn_reslice->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& event) { | ||||||
|  |         p->show_rich_tip(p->btn_reslice_tip, p->btn_reslice); | ||||||
|  |         event.Skip(); | ||||||
|  |     }); | ||||||
|     p->btn_send_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->send_gcode(); }); |     p->btn_send_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->send_gcode(); }); | ||||||
| //    p->btn_eject_device->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->eject_drive(); });
 | //    p->btn_eject_device->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->eject_drive(); });
 | ||||||
| 	p->btn_export_gcode_removable->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->export_gcode(true); }); | 	p->btn_export_gcode_removable->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->export_gcode(true); }); | ||||||
|  | @ -970,7 +993,7 @@ 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]"; | ||||||
|     if (m_mode != comSimple) |     if (m_mode != comSimple) | ||||||
|         tooltip += wxString("\n") + _L("Hold Shift to Slice & Export G-code"); |         tooltip += wxString("\n") + _L("Hold Shift to Slice & Export G-code"); | ||||||
|     p->btn_reslice->SetToolTip(tooltip); |     p->btn_reslice_tip = tooltip; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Sidebar::msw_rescale() | void Sidebar::msw_rescale() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 YuSanka
						YuSanka