mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	FIX: display of Label and warning dialog
Change-Id: Ib147f28096336b07b033c2e8104a56f5c28b7d93
This commit is contained in:
		
							parent
							
								
									7c728452a2
								
							
						
					
					
						commit
						c2eeb2522b
					
				
					 4 changed files with 78 additions and 56 deletions
				
			
		|  | @ -980,10 +980,8 @@ bool MainFrame::preview_only_hint() | ||||||
|         }); |         }); | ||||||
|         confirm_dlg.update_btn_label(_L("Yes"), _L("No")); |         confirm_dlg.update_btn_label(_L("Yes"), _L("No")); | ||||||
|         auto filename = wxString((m_plater->get_preview_only_filename()).c_str(), wxConvUTF8); |         auto filename = wxString((m_plater->get_preview_only_filename()).c_str(), wxConvUTF8); | ||||||
|         //if size of filename is beyond limit
 |  | ||||||
|         auto format_filename = confirm_dlg.format_text(filename, FromDIP(240)); |  | ||||||
| 
 | 
 | ||||||
|         confirm_dlg.update_text(format_filename + _L(" will be closed before creating a new model. Do you want to continue?")); |         confirm_dlg.update_text(filename + _L(" will be closed before creating a new model. Do you want to continue?")); | ||||||
|         confirm_dlg.on_show(); |         confirm_dlg.on_show(); | ||||||
|         if (preview_only_to_editor) { |         if (preview_only_to_editor) { | ||||||
|             m_plater->new_project(); |             m_plater->new_project(); | ||||||
|  |  | ||||||
|  | @ -57,7 +57,7 @@ ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/) | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer *m_sizer_right = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer *m_sizer_right = new wxBoxSizer(wxVERTICAL); | ||||||
| 
 | 
 | ||||||
|     m_text_up_info = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); |     m_text_up_info = new Label(this,wxEmptyString); | ||||||
|     m_text_up_info->SetFont(::Label::Head_14); |     m_text_up_info->SetFont(::Label::Head_14); | ||||||
|     m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30)); |     m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30)); | ||||||
|     m_text_up_info->Wrap(-1); |     m_text_up_info->Wrap(-1); | ||||||
|  | @ -126,7 +126,7 @@ UpdatePluginDialog::UpdatePluginDialog(wxWindow* parent /*= nullptr*/) | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer* m_sizer_right = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer* m_sizer_right = new wxBoxSizer(wxVERTICAL); | ||||||
| 
 | 
 | ||||||
|     m_text_up_info = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); |     m_text_up_info = new Label(this,wxEmptyString); | ||||||
|     m_text_up_info->SetFont(::Label::Head_13); |     m_text_up_info->SetFont(::Label::Head_13); | ||||||
|     m_text_up_info->SetMaxSize(wxSize(FromDIP(260), -1)); |     m_text_up_info->SetMaxSize(wxSize(FromDIP(260), -1)); | ||||||
|     m_text_up_info->Wrap(FromDIP(260)); |     m_text_up_info->Wrap(FromDIP(260)); | ||||||
|  | @ -277,7 +277,7 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent) | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer *m_sizer_right = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer *m_sizer_right = new wxBoxSizer(wxVERTICAL); | ||||||
| 
 | 
 | ||||||
|     m_text_up_info = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); |     m_text_up_info = new Label(this,wxEmptyString); | ||||||
|     m_text_up_info->SetFont(::Label::Head_14); |     m_text_up_info->SetFont(::Label::Head_14); | ||||||
|     m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30)); |     m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30)); | ||||||
|     m_text_up_info->Wrap(-1); |     m_text_up_info->Wrap(-1); | ||||||
|  | @ -525,8 +525,8 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons | ||||||
| 
 | 
 | ||||||
|     SetBackgroundColour(*wxWHITE); |     SetBackgroundColour(*wxWHITE); | ||||||
|     m_sizer_main = new wxBoxSizer(wxVERTICAL); |     m_sizer_main = new wxBoxSizer(wxVERTICAL); | ||||||
|     auto        m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(480), 1)); |     auto        m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(400), 1)); | ||||||
|     m_line_top->SetBackgroundColour(wxColour(166, 169, 170)); |     m_line_top->SetBackgroundColour(*wxWHITE); | ||||||
|     m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); |     m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); | ||||||
|     m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(5)); |     m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(5)); | ||||||
| 
 | 
 | ||||||
|  | @ -537,8 +537,8 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons | ||||||
|     m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); |     m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); | ||||||
|     m_vebview_release_note->SetScrollRate(0, 5); |     m_vebview_release_note->SetScrollRate(0, 5); | ||||||
|     m_vebview_release_note->SetBackgroundColour(*wxWHITE); |     m_vebview_release_note->SetBackgroundColour(*wxWHITE); | ||||||
|     m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), FromDIP(280))); |     m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380))); | ||||||
|     m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35)); |     m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15)); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     auto bottom_sizer = new wxBoxSizer(wxVERTICAL); |     auto bottom_sizer = new wxBoxSizer(wxVERTICAL); | ||||||
|  | @ -551,12 +551,15 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     if (not_show_again_check) { |     if (not_show_again_check) { | ||||||
|  |         auto checkbox_sizer = new wxBoxSizer(wxHORIZONTAL); | ||||||
|         m_show_again_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0); |         m_show_again_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0); | ||||||
|         m_show_again_checkbox->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, [this](wxCommandEvent& e) { |         m_show_again_checkbox->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, [this](wxCommandEvent& e) { | ||||||
|             not_show_again = !not_show_again; |             not_show_again = !not_show_again; | ||||||
|             m_show_again_checkbox->SetValue(not_show_again); |             m_show_again_checkbox->SetValue(not_show_again); | ||||||
|         }); |         }); | ||||||
|         bottom_sizer->Add(m_show_again_checkbox, 0, wxALL, FromDIP(5)); |         checkbox_sizer->Add(FromDIP(15), 0, 0, 0); | ||||||
|  |         checkbox_sizer->Add(m_show_again_checkbox, 0, wxALL, FromDIP(5)); | ||||||
|  |         bottom_sizer->Add(checkbox_sizer, 0, wxBOTTOM | wxEXPAND, 0); | ||||||
|     } |     } | ||||||
|     m_button_ok = new Button(this, _L("Confirm")); |     m_button_ok = new Button(this, _L("Confirm")); | ||||||
|     m_button_ok->SetBackgroundColor(btn_bg_green); |     m_button_ok->SetBackgroundColor(btn_bg_green); | ||||||
|  | @ -597,15 +600,18 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons | ||||||
|     sizer_button->AddStretchSpacer(); |     sizer_button->AddStretchSpacer(); | ||||||
|     sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5)); |     sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5)); | ||||||
|     sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5)); |     sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5)); | ||||||
|  |     sizer_button->Add(FromDIP(5),0, 0, 0); | ||||||
|     bottom_sizer->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, 0); |     bottom_sizer->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, 0); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     m_sizer_right->Add(bottom_sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35)); |     m_sizer_right->Add(bottom_sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15)); | ||||||
|     m_sizer_right->Add(0, 0, 0, wxTOP,FromDIP(18)); |     m_sizer_right->Add(0, 0, 0, wxTOP,FromDIP(10)); | ||||||
|  | 
 | ||||||
|  |     m_sizer_main->Add(m_sizer_right, 0, wxBOTTOM | wxEXPAND, FromDIP(5)); | ||||||
| 
 | 
 | ||||||
|     Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->on_hide();}); |     Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->on_hide();}); | ||||||
| 
 | 
 | ||||||
|     SetSizer(m_sizer_right); |     SetSizer(m_sizer_main); | ||||||
|     Layout(); |     Layout(); | ||||||
|     m_sizer_main->Fit(this); |     m_sizer_main->Fit(this); | ||||||
| 
 | 
 | ||||||
|  | @ -620,11 +626,10 @@ void SecondaryCheckDialog::update_text(wxString text) | ||||||
|     if (!m_staticText_release_note) { |     if (!m_staticText_release_note) { | ||||||
|         m_staticText_release_note = new Label(m_vebview_release_note, text); |         m_staticText_release_note = new Label(m_vebview_release_note, text); | ||||||
|     } |     } | ||||||
|  |     m_staticText_release_note->SetMaxSize(wxSize(FromDIP(330), -1)); | ||||||
|  |     m_staticText_release_note->SetMinSize(wxSize(FromDIP(330), -1)); | ||||||
|     m_staticText_release_note->SetLabelText(text); |     m_staticText_release_note->SetLabelText(text); | ||||||
|     m_staticText_release_note->SetSize(wxSize(FromDIP(260), -1)); |     m_staticText_release_note->Wrap(FromDIP(330)); | ||||||
|     m_staticText_release_note->SetMaxSize(wxSize(FromDIP(260), -1)); |  | ||||||
|     m_staticText_release_note->SetMinSize(wxSize(FromDIP(260), -1)); |  | ||||||
|     m_staticText_release_note->Wrap(FromDIP(260)); |  | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer* top_blank_sizer = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer* top_blank_sizer = new wxBoxSizer(wxVERTICAL); | ||||||
|     wxBoxSizer* bottom_blank_sizer = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer* bottom_blank_sizer = new wxBoxSizer(wxVERTICAL); | ||||||
|  | @ -636,14 +641,19 @@ void SecondaryCheckDialog::update_text(wxString text) | ||||||
|     sizer_text_release_note->Add(bottom_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); |     sizer_text_release_note->Add(bottom_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); | ||||||
|     m_vebview_release_note->SetSizer(sizer_text_release_note); |     m_vebview_release_note->SetSizer(sizer_text_release_note); | ||||||
|     auto text_size = m_staticText_release_note->GetSize(); |     auto text_size = m_staticText_release_note->GetSize(); | ||||||
|     if (text_size.y < FromDIP(280)) |     if (text_size.y < FromDIP(360)) | ||||||
|         m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), text_size.y + FromDIP(25))); |         m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), text_size.y + FromDIP(25))); | ||||||
|     else |     else { | ||||||
|         m_vebview_release_note->SetMinSize(wxSize(FromDIP(300), FromDIP(280))); |         m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), FromDIP(360))); | ||||||
|  |         m_staticText_release_note->SetMaxSize(wxSize(FromDIP(330), -1)); | ||||||
|  |         m_staticText_release_note->SetMinSize(wxSize(FromDIP(330), -1)); | ||||||
|  |         m_staticText_release_note->SetLabelText(text); | ||||||
|  |         m_staticText_release_note->Wrap(FromDIP(330)); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     m_vebview_release_note->Layout(); |     m_vebview_release_note->Layout(); | ||||||
|     m_sizer_main->Layout(); |     Layout(); | ||||||
|     m_sizer_main->Fit(this); |     Fit(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void SecondaryCheckDialog::on_show() | void SecondaryCheckDialog::on_show() | ||||||
|  | @ -702,8 +712,8 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id | ||||||
| 
 | 
 | ||||||
|     SetBackgroundColour(*wxWHITE); |     SetBackgroundColour(*wxWHITE); | ||||||
|     m_sizer_main = new wxBoxSizer(wxVERTICAL); |     m_sizer_main = new wxBoxSizer(wxVERTICAL); | ||||||
|     auto        m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(480), 1)); |     auto        m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(400), 1)); | ||||||
|     m_line_top->SetBackgroundColour(wxColour(166, 169, 170)); |     m_line_top->SetBackgroundColour(*wxWHITE); | ||||||
|     m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); |     m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); | ||||||
|     m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(5)); |     m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(5)); | ||||||
| 
 | 
 | ||||||
|  | @ -714,8 +724,8 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id | ||||||
|     m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); |     m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); | ||||||
|     m_vebview_release_note->SetScrollRate(0, 5); |     m_vebview_release_note->SetScrollRate(0, 5); | ||||||
|     m_vebview_release_note->SetBackgroundColour(*wxWHITE); |     m_vebview_release_note->SetBackgroundColour(*wxWHITE); | ||||||
|     m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), FromDIP(280))); |     m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380))); | ||||||
|     m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35)); |     m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15)); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     auto bottom_sizer = new wxBoxSizer(wxVERTICAL); |     auto bottom_sizer = new wxBoxSizer(wxVERTICAL); | ||||||
|  | @ -728,12 +738,15 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     if (not_show_again_check) { |     if (not_show_again_check) { | ||||||
|  |         auto checkbox_sizer = new wxBoxSizer(wxHORIZONTAL); | ||||||
|         m_show_again_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0); |         m_show_again_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0); | ||||||
|         m_show_again_checkbox->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, [this](wxCommandEvent& e) { |         m_show_again_checkbox->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, [this](wxCommandEvent& e) { | ||||||
|             not_show_again = !not_show_again; |             not_show_again = !not_show_again; | ||||||
|             m_show_again_checkbox->SetValue(not_show_again); |             m_show_again_checkbox->SetValue(not_show_again); | ||||||
|             }); |         }); | ||||||
|         bottom_sizer->Add(m_show_again_checkbox, 0, wxALL, FromDIP(5)); |         checkbox_sizer->Add(FromDIP(15), 0, 0, 0); | ||||||
|  |         checkbox_sizer->Add(m_show_again_checkbox, 0, wxALL, FromDIP(5)); | ||||||
|  |         bottom_sizer->Add(checkbox_sizer, 0, wxBOTTOM | wxEXPAND, 0); | ||||||
|     } |     } | ||||||
|     m_button_ok = new Button(this, _L("Confirm")); |     m_button_ok = new Button(this, _L("Confirm")); | ||||||
|     m_button_ok->SetBackgroundColor(btn_bg_green); |     m_button_ok->SetBackgroundColor(btn_bg_green); | ||||||
|  | @ -774,15 +787,18 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id | ||||||
|     sizer_button->AddStretchSpacer(); |     sizer_button->AddStretchSpacer(); | ||||||
|     sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5)); |     sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5)); | ||||||
|     sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5)); |     sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5)); | ||||||
|  |     sizer_button->Add(FromDIP(5),0, 0, 0); | ||||||
|     bottom_sizer->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, 0); |     bottom_sizer->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, 0); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     m_sizer_right->Add(bottom_sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35)); |     m_sizer_right->Add(bottom_sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(20)); | ||||||
|     m_sizer_right->Add(0, 0, 0, wxTOP, FromDIP(18)); |     m_sizer_right->Add(0, 0, 0, wxTOP, FromDIP(10)); | ||||||
|  | 
 | ||||||
|  |     m_sizer_main->Add(m_sizer_right, 0, wxBOTTOM | wxEXPAND, FromDIP(5)); | ||||||
| 
 | 
 | ||||||
|     Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->on_hide(); }); |     Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->on_hide(); }); | ||||||
| 
 | 
 | ||||||
|     SetSizer(m_sizer_right); |     SetSizer(m_sizer_main); | ||||||
|     Layout(); |     Layout(); | ||||||
|     m_sizer_main->Fit(this); |     m_sizer_main->Fit(this); | ||||||
| 
 | 
 | ||||||
|  | @ -793,14 +809,13 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id | ||||||
| void ConfirmBeforeSendDialog::update_text(wxString text) | void ConfirmBeforeSendDialog::update_text(wxString text) | ||||||
| { | { | ||||||
|     wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL); | ||||||
|     if (!m_staticText_release_note) |     if (!m_staticText_release_note){ | ||||||
|         m_staticText_release_note = new Label(m_vebview_release_note, text); |         m_staticText_release_note = new Label(m_vebview_release_note, text); | ||||||
|     else |     } | ||||||
|         m_staticText_release_note->SetLabelText(text); |     m_staticText_release_note->SetMaxSize(wxSize(FromDIP(330), -1)); | ||||||
|     m_staticText_release_note->Wrap(FromDIP(260)); |     m_staticText_release_note->SetMinSize(wxSize(FromDIP(330), -1)); | ||||||
|     m_staticText_release_note->SetSize(wxSize(FromDIP(260), -1)); |     m_staticText_release_note->SetLabelText(text); | ||||||
|     m_staticText_release_note->SetMaxSize(wxSize(FromDIP(260), -1)); |     m_staticText_release_note->Wrap(FromDIP(330)); | ||||||
|     m_staticText_release_note->SetMinSize(wxSize(FromDIP(260), -1)); |  | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer* top_blank_sizer = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer* top_blank_sizer = new wxBoxSizer(wxVERTICAL); | ||||||
|     wxBoxSizer* bottom_blank_sizer = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer* bottom_blank_sizer = new wxBoxSizer(wxVERTICAL); | ||||||
|  | @ -812,14 +827,19 @@ void ConfirmBeforeSendDialog::update_text(wxString text) | ||||||
|     sizer_text_release_note->Add(bottom_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); |     sizer_text_release_note->Add(bottom_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); | ||||||
|     m_vebview_release_note->SetSizer(sizer_text_release_note); |     m_vebview_release_note->SetSizer(sizer_text_release_note); | ||||||
|     auto text_size = m_staticText_release_note->GetSize(); |     auto text_size = m_staticText_release_note->GetSize(); | ||||||
|     if (text_size.y < FromDIP(280)) |     if (text_size.y < FromDIP(360)) | ||||||
|         m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), text_size.y + FromDIP(25))); |         m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), text_size.y + FromDIP(25))); | ||||||
|     else |     else { | ||||||
|         m_vebview_release_note->SetMinSize(wxSize(FromDIP(300), FromDIP(280))); |         m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), FromDIP(360))); | ||||||
|  |         m_staticText_release_note->SetMaxSize(wxSize(FromDIP(330), -1)); | ||||||
|  |         m_staticText_release_note->SetMinSize(wxSize(FromDIP(330), -1)); | ||||||
|  |         m_staticText_release_note->SetLabelText(text); | ||||||
|  |         m_staticText_release_note->Wrap(FromDIP(330)); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     m_vebview_release_note->Layout(); |     m_vebview_release_note->Layout(); | ||||||
|     m_sizer_main->Layout(); |     Layout(); | ||||||
|     m_sizer_main->Fit(this); |     Fit(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ConfirmBeforeSendDialog::on_show() | void ConfirmBeforeSendDialog::on_show() | ||||||
|  |  | ||||||
|  | @ -49,7 +49,7 @@ public: | ||||||
|     void on_dpi_changed(const wxRect &suggested_rect) override; |     void on_dpi_changed(const wxRect &suggested_rect) override; | ||||||
|     void update_release_note(wxString release_note, std::string version); |     void update_release_note(wxString release_note, std::string version); | ||||||
| 
 | 
 | ||||||
|     wxStaticText *    m_text_up_info{nullptr}; |     Label *    m_text_up_info{nullptr}; | ||||||
|     wxScrolledWindow *m_vebview_release_note {nullptr}; |     wxScrolledWindow *m_vebview_release_note {nullptr}; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | @ -62,7 +62,7 @@ public: | ||||||
|     void on_dpi_changed(const wxRect& suggested_rect) override; |     void on_dpi_changed(const wxRect& suggested_rect) override; | ||||||
|     void update_info(std::string json_path); |     void update_info(std::string json_path); | ||||||
| 
 | 
 | ||||||
|     wxStaticText* m_text_up_info{ nullptr }; |     Label* m_text_up_info{ nullptr }; | ||||||
|     Label* operation_tips{ nullptr }; |     Label* operation_tips{ nullptr }; | ||||||
|     wxScrolledWindow* m_vebview_release_note{ nullptr }; |     wxScrolledWindow* m_vebview_release_note{ nullptr }; | ||||||
| }; | }; | ||||||
|  | @ -85,12 +85,12 @@ public: | ||||||
|     std::vector<std::string> splitWithStl(std::string str, std::string pattern); |     std::vector<std::string> splitWithStl(std::string str, std::string pattern); | ||||||
| 
 | 
 | ||||||
|     wxStaticBitmap*   m_brand{nullptr}; |     wxStaticBitmap*   m_brand{nullptr}; | ||||||
|     wxStaticText *    m_text_up_info{nullptr}; |     Label *           m_text_up_info{nullptr}; | ||||||
|     wxWebView*        m_vebview_release_note{nullptr}; |     wxWebView*        m_vebview_release_note{nullptr}; | ||||||
|     wxSimplebook*     m_simplebook_release_note{nullptr}; |     wxSimplebook*     m_simplebook_release_note{nullptr}; | ||||||
|     wxScrolledWindow* m_scrollwindows_release_note{nullptr}; |     wxScrolledWindow* m_scrollwindows_release_note{nullptr}; | ||||||
|     wxBoxSizer *      sizer_text_release_note{nullptr}; |     wxBoxSizer *      sizer_text_release_note{nullptr}; | ||||||
|     wxStaticText *    m_staticText_release_note{nullptr}; |     Label *           m_staticText_release_note{nullptr}; | ||||||
|     wxCheckBox*       m_remind_choice; |     wxCheckBox*       m_remind_choice; | ||||||
|     Button*           m_button_ok; |     Button*           m_button_ok; | ||||||
|     Button*           m_button_cancel; |     Button*           m_button_cancel; | ||||||
|  | @ -161,7 +161,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer* m_sizer_main; |     wxBoxSizer* m_sizer_main; | ||||||
|     wxScrolledWindow* m_vebview_release_note{ nullptr }; |     wxScrolledWindow* m_vebview_release_note{ nullptr }; | ||||||
|     wxStaticText* m_staticText_release_note{ nullptr }; |     Label* m_staticText_release_note{ nullptr }; | ||||||
|     Button* m_button_ok; |     Button* m_button_ok; | ||||||
|     Button* m_button_cancel; |     Button* m_button_cancel; | ||||||
|     wxCheckBox* m_show_again_checkbox; |     wxCheckBox* m_show_again_checkbox; | ||||||
|  |  | ||||||
|  | @ -116,16 +116,20 @@ public: | ||||||
| 
 | 
 | ||||||
|                 // Find the last word to chop off.
 |                 // Find the last word to chop off.
 | ||||||
|                 size_t lastSpace = posEnd; |                 size_t lastSpace = posEnd; | ||||||
|                 while (lastSpace != size_t(-1)) { |                 while (lastSpace > 0) { | ||||||
|                     auto c = line[lastSpace]; |                     auto c = line[lastSpace]; | ||||||
|                     if (c == ' ' || c > 0x4E00) |                     if (c == ' ') | ||||||
|                         break; |                         break; | ||||||
|  |                     if (c > 0x4E00) { | ||||||
|  |                         if (lastSpace != posEnd) | ||||||
|  |                             ++lastSpace; | ||||||
|  |                         break; | ||||||
|  |                     } | ||||||
|                     --lastSpace; |                     --lastSpace; | ||||||
|                 } |                 } | ||||||
|                 if (lastSpace == size_t(-1)) { |                 if (lastSpace == 0) { | ||||||
|                     // No spaces, so can't wrap.
 |                     // No spaces, so can't wrap.
 | ||||||
|                     DoOutputLine(line); |                     lastSpace = posEnd; | ||||||
|                     break; |  | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 // Output the part that fits.
 |                 // Output the part that fits.
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao.jin
						tao.jin