mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	 3c37aed2f8
			
		
	
	
		3c37aed2f8
		
	
	
	
	
		
			
			Description of issue: When for some parameter set a value which is out of rage or inaccurate and than click to another parameter, receive a warning message dialog with description of a problem. After closing of this Dialog any button on settings tab doesn't work for first click. Looks like after dialog is closed Notebook page loses a focus. Workaround: Use self-created WarningDialog (inherited from the wxDialog) instead of wxMessageDialog
		
			
				
	
	
		
			93 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			93 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef slic3r_MsgDialog_hpp_
 | |
| #define slic3r_MsgDialog_hpp_
 | |
| 
 | |
| #include <string>
 | |
| #include <unordered_map>
 | |
| 
 | |
| #include <wx/dialog.h>
 | |
| #include <wx/font.h>
 | |
| #include <wx/bitmap.h>
 | |
| 
 | |
| class wxBoxSizer;
 | |
| class wxCheckBox;
 | |
| class wxStaticBitmap;
 | |
| 
 | |
| namespace Slic3r {
 | |
| 
 | |
| namespace GUI {
 | |
| 
 | |
| 
 | |
| // A message / query dialog with a bitmap on the left and any content on the right
 | |
| // with buttons underneath.
 | |
| struct MsgDialog : wxDialog
 | |
| {
 | |
| 	MsgDialog(MsgDialog &&) = delete;
 | |
| 	MsgDialog(const MsgDialog &) = delete;
 | |
| 	MsgDialog &operator=(MsgDialog &&) = delete;
 | |
| 	MsgDialog &operator=(const MsgDialog &) = delete;
 | |
| 	virtual ~MsgDialog() = default;
 | |
| 
 | |
| 	// TODO: refactor with CreateStdDialogButtonSizer usage
 | |
| 
 | |
| protected:
 | |
| 	enum {
 | |
| 		CONTENT_WIDTH = 50,
 | |
| 		CONTENT_MAX_HEIGHT = 60,
 | |
| 		BORDER = 30,
 | |
| 		VERT_SPACING = 15,
 | |
| 		HORIZ_SPACING = 5,
 | |
| 	};
 | |
| 
 | |
| 	// button_id is an id of a button that can be added by default, use wxID_NONE to disable
 | |
| 	MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, wxWindowID button_id = wxID_OK, wxBitmap bitmap = wxNullBitmap);
 | |
| 
 | |
| 	wxFont boldfont;
 | |
| 	wxBoxSizer *content_sizer;
 | |
| 	wxBoxSizer *btn_sizer;
 | |
| 	wxStaticBitmap *logo;
 | |
| };
 | |
| 
 | |
| 
 | |
| // Generic error dialog, used for displaying exceptions
 | |
| class ErrorDialog : public MsgDialog
 | |
| {
 | |
| public:
 | |
| 	// If monospaced_font is true, the error message is displayed using html <code><pre></pre></code> tags,
 | |
| 	// so that the code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
 | |
| 	ErrorDialog(wxWindow *parent, const wxString &msg, bool courier_font);
 | |
| 	ErrorDialog(ErrorDialog &&) = delete;
 | |
| 	ErrorDialog(const ErrorDialog &) = delete;
 | |
| 	ErrorDialog &operator=(ErrorDialog &&) = delete;
 | |
| 	ErrorDialog &operator=(const ErrorDialog &) = delete;
 | |
| 	virtual ~ErrorDialog() = default;
 | |
| 
 | |
| private:
 | |
| 	wxString msg;
 | |
| };
 | |
| 
 | |
| 
 | |
| // Generic error dialog, used for displaying exceptions
 | |
| class WarningDialog : public MsgDialog
 | |
| {
 | |
| public:
 | |
| 	// If monospaced_font is true, the error message is displayed using html <code><pre></pre></code> tags,
 | |
| 	// so that the code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
 | |
| 	WarningDialog(	wxWindow *parent,
 | |
| 		            const wxString& message,
 | |
| 		            const wxString& caption = wxEmptyString,
 | |
| 		            long style = wxOK);
 | |
| 	WarningDialog(WarningDialog&&) = delete;
 | |
| 	WarningDialog(const WarningDialog&) = delete;
 | |
| 	WarningDialog &operator=(WarningDialog&&) = delete;
 | |
| 	WarningDialog &operator=(const WarningDialog&) = delete;
 | |
| 	virtual ~WarningDialog() = default;
 | |
| 
 | |
| private:
 | |
| 	wxString	msg;
 | |
| };
 | |
| 
 | |
| 
 | |
| }
 | |
| }
 | |
| 
 | |
| #endif
 |