FIX: refine Warning dialog
Change-Id: I8169dd8bce0013a1acacd837871af2051f5cc3a5
This commit is contained in:
parent
4abce326bc
commit
e56c266edc
|
@ -243,8 +243,6 @@ set(SLIC3R_GUI_SOURCES
|
||||||
GUI/ConfigManipulation.hpp
|
GUI/ConfigManipulation.hpp
|
||||||
GUI/Field.cpp
|
GUI/Field.cpp
|
||||||
GUI/Field.hpp
|
GUI/Field.hpp
|
||||||
GUI/ConfirmHintDialog.cpp
|
|
||||||
GUI/ConfirmHintDialog.hpp
|
|
||||||
GUI/OptionsGroup.cpp
|
GUI/OptionsGroup.cpp
|
||||||
GUI/OptionsGroup.hpp
|
GUI/OptionsGroup.hpp
|
||||||
GUI/OG_CustomCtrl.cpp
|
GUI/OG_CustomCtrl.cpp
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
#include "ConfirmHintDialog.hpp"
|
|
||||||
#include <slic3r/GUI/I18N.hpp>
|
|
||||||
#include <wx/dcgraph.h>
|
|
||||||
#include <wx/dcmemory.h>
|
|
||||||
#include <slic3r/GUI/Widgets/Label.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
|
||||||
|
|
||||||
wxDEFINE_EVENT(EVT_CONFIRM_HINT, wxCommandEvent);
|
|
||||||
|
|
||||||
ConfirmHintDialog::ConfirmHintDialog(wxWindow* parent, wxWindowID id, const wxString& title, enum ButtonStyle btn_style, const wxPoint& pos, const wxSize& size, long style)
|
|
||||||
: DPIDialog(parent, id, title, pos, size, style)
|
|
||||||
{
|
|
||||||
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
|
|
||||||
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
|
|
||||||
|
|
||||||
auto* main_sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
auto* button_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
|
|
||||||
wxPanel* m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
|
|
||||||
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
|
|
||||||
|
|
||||||
m_button_confirm = new Button(this, _L("Confirm"));
|
|
||||||
m_button_confirm->SetFont(Label::Body_14);
|
|
||||||
m_button_confirm->SetMinSize(wxSize(-1, FromDIP(24)));
|
|
||||||
m_button_confirm->SetCornerRadius(FromDIP(12));
|
|
||||||
StateColor confirm_btn_bg(std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
|
||||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
|
||||||
m_button_confirm->SetBackgroundColor(confirm_btn_bg);
|
|
||||||
m_button_confirm->SetBorderColor(wxColour(0, 174, 66));
|
|
||||||
m_button_confirm->SetTextColor(*wxWHITE);
|
|
||||||
|
|
||||||
m_button_close = new Button(this, _L("Cancel"));
|
|
||||||
m_button_close->SetFont(Label::Body_14);
|
|
||||||
m_button_close->SetMinSize(wxSize(-1, FromDIP(24)));
|
|
||||||
m_button_close->SetCornerRadius(FromDIP(12));
|
|
||||||
StateColor close_btn_bg(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Hovered),
|
|
||||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
|
||||||
m_button_close->SetBackgroundColor(close_btn_bg);
|
|
||||||
m_button_close->SetBorderColor(wxColour(38, 46, 48));
|
|
||||||
m_button_close->SetTextColor(wxColour(38, 46, 48));
|
|
||||||
|
|
||||||
button_sizer->AddStretchSpacer();
|
|
||||||
button_sizer->Add(m_button_confirm);
|
|
||||||
button_sizer->AddSpacer(FromDIP(20));
|
|
||||||
button_sizer->Add(m_button_close);
|
|
||||||
|
|
||||||
if (btn_style == CONFIRM_AND_CANCEL)
|
|
||||||
m_button_close->Show();
|
|
||||||
else
|
|
||||||
m_button_close->Hide();
|
|
||||||
|
|
||||||
main_sizer->Add(m_line_top, 0, wxEXPAND, 0);
|
|
||||||
main_sizer->AddSpacer(wxSize(FromDIP(475), FromDIP(100)).y);
|
|
||||||
main_sizer->Add(button_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, FromDIP(25));
|
|
||||||
|
|
||||||
SetSizer(main_sizer);
|
|
||||||
|
|
||||||
CenterOnParent();
|
|
||||||
|
|
||||||
this->SetSize(wxSize(wxSize(FromDIP(475), FromDIP(100)).x, -1));
|
|
||||||
this->SetMinSize(wxSize(wxSize(FromDIP(475), FromDIP(100)).x, -1));
|
|
||||||
Layout();
|
|
||||||
Fit();
|
|
||||||
this->Bind(wxEVT_PAINT, &ConfirmHintDialog::OnPaint, this);
|
|
||||||
m_button_confirm->Bind(wxEVT_BUTTON, &ConfirmHintDialog::on_button_confirm, this);
|
|
||||||
m_button_close->Bind(wxEVT_BUTTON, &ConfirmHintDialog::on_button_close, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfirmHintDialog::~ConfirmHintDialog() {}
|
|
||||||
|
|
||||||
void ConfirmHintDialog::SetHint(const wxString& hint){
|
|
||||||
firm_up_hint = hint;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmHintDialog::OnPaint(wxPaintEvent& event){
|
|
||||||
wxPaintDC dc(this);
|
|
||||||
render(dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmHintDialog::render(wxDC& dc) {
|
|
||||||
wxSize size = GetSize();
|
|
||||||
|
|
||||||
dc.SetFont(Label::Body_14);
|
|
||||||
dc.SetTextForeground(text_color);
|
|
||||||
wxPoint pos_start = wxPoint(FromDIP(25), FromDIP(25));
|
|
||||||
|
|
||||||
wxSize firm_up_hint_size = dc.GetTextExtent(firm_up_hint);
|
|
||||||
wxPoint pos_firm_up_hint = pos_start;
|
|
||||||
|
|
||||||
if (firm_up_hint_size.x + pos_firm_up_hint.x + FromDIP(25) > wxSize(FromDIP(475), FromDIP(100)).x) {
|
|
||||||
bool is_ch = false;
|
|
||||||
if (firm_up_hint[0] > 0x80 && firm_up_hint[1] > 0x80)
|
|
||||||
is_ch = true;
|
|
||||||
|
|
||||||
wxString fisrt_line;
|
|
||||||
wxString remaining_line;
|
|
||||||
|
|
||||||
wxString count_txt;
|
|
||||||
int new_line_pos = 0;
|
|
||||||
for (int i = 0; i < firm_up_hint.length(); i++) {
|
|
||||||
count_txt += firm_up_hint[i];
|
|
||||||
auto text_size = dc.GetTextExtent(count_txt);
|
|
||||||
if (text_size.x + pos_firm_up_hint.x + FromDIP(25) < wxSize(FromDIP(475), FromDIP(100)).x)
|
|
||||||
{
|
|
||||||
if (firm_up_hint[i] == ' ') {
|
|
||||||
new_line_pos = i;
|
|
||||||
} else if (firm_up_hint[i] == '\n') {
|
|
||||||
fisrt_line = firm_up_hint.SubString(0, i);
|
|
||||||
remaining_line = firm_up_hint.SubString(i + 1, firm_up_hint.length());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!is_ch) {
|
|
||||||
fisrt_line = firm_up_hint.SubString(0, new_line_pos);
|
|
||||||
remaining_line = firm_up_hint.SubString(new_line_pos + 1, firm_up_hint.length());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fisrt_line = firm_up_hint.SubString(0, i - 1);
|
|
||||||
remaining_line = firm_up_hint.SubString(i, firm_up_hint.length());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
count_txt = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dc.DrawText(fisrt_line, pos_firm_up_hint);
|
|
||||||
|
|
||||||
count_txt = "";
|
|
||||||
new_line_pos = 0;
|
|
||||||
for (int i = 0; i < remaining_line.length(); i++) {
|
|
||||||
count_txt += remaining_line[i];
|
|
||||||
auto text_size = dc.GetTextExtent(count_txt);
|
|
||||||
if (text_size.x + FromDIP(25) + FromDIP(25) < wxSize(FromDIP(475), FromDIP(100)).x)
|
|
||||||
{
|
|
||||||
if (remaining_line[i] == ' ' || remaining_line[i] == '\n')
|
|
||||||
new_line_pos = i;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!is_ch){
|
|
||||||
remaining_line[new_line_pos] = '\n';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
remaining_line.insert(i, '\n');
|
|
||||||
}
|
|
||||||
count_txt = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wxPoint pos_txt = pos_firm_up_hint;
|
|
||||||
pos_txt.y += dc.GetCharHeight();
|
|
||||||
dc.DrawText(remaining_line, pos_txt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dc.DrawText(firm_up_hint, pos_firm_up_hint);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmHintDialog::on_button_confirm(wxCommandEvent& event) {
|
|
||||||
wxCommandEvent evt(EVT_CONFIRM_HINT, GetId());
|
|
||||||
event.SetEventObject(this);
|
|
||||||
GetEventHandler()->ProcessEvent(evt);
|
|
||||||
|
|
||||||
if (this->IsModal())
|
|
||||||
this->EndModal(wxID_OK);
|
|
||||||
else
|
|
||||||
this->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmHintDialog::on_button_close(wxCommandEvent& event) {
|
|
||||||
this->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConfirmHintDialog::Show(bool show)
|
|
||||||
{
|
|
||||||
if (show) { CentreOnParent(); }
|
|
||||||
return DPIDialog::Show(show);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmHintDialog::on_dpi_changed(const wxRect& suggested_rect) {
|
|
||||||
m_button_confirm->SetMinSize(wxSize(-1, FromDIP(24)));
|
|
||||||
m_button_confirm->SetCornerRadius(FromDIP(12));
|
|
||||||
if (m_button_close->IsShown()) {
|
|
||||||
m_button_close->SetMinSize(wxSize(-1, FromDIP(24)));
|
|
||||||
m_button_close->SetCornerRadius(FromDIP(12));
|
|
||||||
}
|
|
||||||
Layout();
|
|
||||||
}
|
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
|
|
@ -1,54 +0,0 @@
|
||||||
#ifndef slic3r_GUI_ConfirmHintDialog_hpp_
|
|
||||||
#define slic3r_GUI_ConfirmHintDialog_hpp_
|
|
||||||
|
|
||||||
#include "GUI_Utils.hpp"
|
|
||||||
#include <wx/statbmp.h>
|
|
||||||
#include "Widgets/Button.hpp"
|
|
||||||
#include <wx/stattext.h>
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
|
||||||
|
|
||||||
wxDECLARE_EVENT(EVT_CONFIRM_HINT, wxCommandEvent);
|
|
||||||
|
|
||||||
class ConfirmHintDialog : public DPIDialog
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
wxStaticText* m_staticText_hint;
|
|
||||||
Button* m_button_confirm;
|
|
||||||
Button* m_button_close;
|
|
||||||
wxStaticBitmap* m_bitmap_home;
|
|
||||||
ScalableBitmap m_home_bmp;
|
|
||||||
wxString firm_up_hint = "";
|
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
|
||||||
void render(wxDC& dc);
|
|
||||||
void on_button_confirm(wxCommandEvent& event);
|
|
||||||
void on_button_close(wxCommandEvent& event);
|
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum ButtonStyle {
|
|
||||||
ONLY_CONFIRM = 0,
|
|
||||||
CONFIRM_AND_CANCEL = 1,
|
|
||||||
MAX_STYLE_NUM = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
ConfirmHintDialog(wxWindow* parent,
|
|
||||||
wxWindowID id = wxID_ANY,
|
|
||||||
const wxString& title = wxEmptyString,
|
|
||||||
enum ButtonStyle btn_style = CONFIRM_AND_CANCEL,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxCLOSE_BOX | wxCAPTION);
|
|
||||||
|
|
||||||
const wxColour text_color = wxColour(107, 107, 107);
|
|
||||||
|
|
||||||
void SetHint(const wxString &hint);
|
|
||||||
|
|
||||||
bool Show(bool show) override;
|
|
||||||
|
|
||||||
~ConfirmHintDialog();
|
|
||||||
};
|
|
||||||
}} // namespace Slic3r::GUI
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -180,7 +180,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
||||||
text_ai_monitoring_caption->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
|
text_ai_monitoring_caption->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
|
||||||
text_ai_monitoring_caption->Wrap(-1);
|
text_ai_monitoring_caption->Wrap(-1);
|
||||||
|
|
||||||
ai_monitoring_level_list = new ComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(120),-1), 0, NULL, wxCB_READONLY );
|
ai_monitoring_level_list = new ComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(100),-1), 0, NULL, wxCB_READONLY );
|
||||||
for (auto i = AiMonitorSensitivityLevel::LOW; i < LEVELS_NUM; i = (AiMonitorSensitivityLevel) (i + 1)) {
|
for (auto i = AiMonitorSensitivityLevel::LOW; i < LEVELS_NUM; i = (AiMonitorSensitivityLevel) (i + 1)) {
|
||||||
wxString level_option = sensitivity_level_to_label_string(i);
|
wxString level_option = sensitivity_level_to_label_string(i);
|
||||||
ai_monitoring_level_list->Append(level_option);
|
ai_monitoring_level_list->Append(level_option);
|
||||||
|
@ -210,11 +210,8 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
||||||
wxString caption_text = _L(
|
wxString caption_text = _L(
|
||||||
"The localization tag of build plate is detected, and printing is paused if the tag is not in predefined range."
|
"The localization tag of build plate is detected, and printing is paused if the tag is not in predefined range."
|
||||||
);
|
);
|
||||||
caption_text = format_text(text_plate_mark, caption_text, FromDIP(250));
|
text_plate_mark_caption = new Label(parent, caption_text);
|
||||||
text_plate_mark_caption = new wxStaticText(parent, wxID_ANY, caption_text);
|
text_plate_mark_caption->Wrap(FromDIP(260));
|
||||||
if (is_english_text(caption_text)) {
|
|
||||||
text_plate_mark_caption->Wrap(FromDIP(250));
|
|
||||||
}
|
|
||||||
text_plate_mark_caption->SetFont(Label::Body_14);
|
text_plate_mark_caption->SetFont(Label::Body_14);
|
||||||
text_plate_mark_caption->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
|
text_plate_mark_caption->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
|
||||||
line_sizer->Add(FromDIP(30), 0, 0, 0);
|
line_sizer->Add(FromDIP(30), 0, 0, 0);
|
||||||
|
@ -311,50 +308,4 @@ bool PrintOptionsDialog::Show(bool show)
|
||||||
return DPIDialog::Show(show);
|
return DPIDialog::Show(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintOptionsDialog::is_english_text(wxString str)
|
|
||||||
{
|
|
||||||
std::regex reg("^[0-9a-zA-Z]+$");
|
|
||||||
std::smatch matchResult;
|
|
||||||
|
|
||||||
std::string pattern_Special = "{}[]<>~!@#$%^&*(),.?/ :";
|
|
||||||
for (auto i = 0; i < str.Length(); i++) {
|
|
||||||
std::string regex_str = wxString(str[i]).ToStdString();
|
|
||||||
if(std::regex_match(regex_str, matchResult, reg)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
int result = pattern_Special.find(regex_str.c_str());
|
|
||||||
if (result < 0 || result > pattern_Special.length()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString PrintOptionsDialog::format_text(wxStaticText* st, wxString str, int warp)
|
|
||||||
{
|
|
||||||
if (is_english_text(str)) return str;
|
|
||||||
|
|
||||||
wxString out_txt = str;
|
|
||||||
wxString count_txt = "";
|
|
||||||
int new_line_pos = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < str.length(); i++) {
|
|
||||||
if (str[i] == '\n') {
|
|
||||||
count_txt = "";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto text_size = st->GetTextExtent(count_txt);
|
|
||||||
if (text_size.x < warp) {
|
|
||||||
count_txt += str[i];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
out_txt.insert(i - 1, '\n');
|
|
||||||
count_txt = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out_txt;
|
|
||||||
}
|
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
|
@ -41,9 +41,6 @@ protected:
|
||||||
|
|
||||||
bool print_halt = false;
|
bool print_halt = false;
|
||||||
|
|
||||||
bool is_english_text(wxString str);
|
|
||||||
wxString format_text(wxStaticText* st, wxString str, int warp);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PrintOptionsDialog(wxWindow* parent);
|
PrintOptionsDialog(wxWindow* parent);
|
||||||
~PrintOptionsDialog();
|
~PrintOptionsDialog();
|
||||||
|
|
|
@ -192,7 +192,7 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
m_button_cancel = new Button(this, _L("Cancel"));
|
m_button_cancel = new Button(this, _L("Cancel"));
|
||||||
m_button_cancel->SetBackgroundColor(*wxWHITE);
|
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||||
m_button_cancel->SetFont(Label::Body_12);
|
m_button_cancel->SetFont(Label::Body_12);
|
||||||
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||||
|
@ -347,7 +347,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
||||||
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
|
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
|
||||||
|
|
||||||
SetBackgroundColour(*wxWHITE);
|
SetBackgroundColour(*wxWHITE);
|
||||||
wxBoxSizer* 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(480), 1));
|
||||||
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
|
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
|
||||||
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
|
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
|
||||||
|
@ -360,9 +360,7 @@ 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(wxColour(0xF8, 0xF8, 0xF8));
|
m_vebview_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||||
m_vebview_release_note->SetSize(wxSize(FromDIP(280), FromDIP(280)));
|
|
||||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), FromDIP(280)));
|
m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), FromDIP(280)));
|
||||||
m_vebview_release_note->SetMaxSize(wxSize(FromDIP(280), FromDIP(280)));
|
|
||||||
|
|
||||||
|
|
||||||
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -392,7 +390,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
||||||
});
|
});
|
||||||
|
|
||||||
m_button_cancel = new Button(this, _L("Cancel"));
|
m_button_cancel = new Button(this, _L("Cancel"));
|
||||||
m_button_cancel->SetBackgroundColor(*wxWHITE);
|
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||||
m_button_cancel->SetFont(Label::Body_12);
|
m_button_cancel->SetFont(Label::Body_12);
|
||||||
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||||
|
@ -430,19 +428,30 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
||||||
void SecondaryCheckDialog::update_text(wxString text)
|
void SecondaryCheckDialog::update_text(wxString text)
|
||||||
{
|
{
|
||||||
wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
||||||
auto m_staticText_release_note = new wxStaticText(m_vebview_release_note, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
auto m_staticText_release_note = new Label(m_vebview_release_note, text);
|
||||||
|
m_staticText_release_note->Wrap(FromDIP(260));
|
||||||
m_staticText_release_note->SetSize(wxSize(FromDIP(260), -1));
|
m_staticText_release_note->SetSize(wxSize(FromDIP(260), -1));
|
||||||
m_staticText_release_note->SetMaxSize(wxSize(FromDIP(260), -1));
|
m_staticText_release_note->SetMaxSize(wxSize(FromDIP(260), -1));
|
||||||
m_staticText_release_note->SetMinSize(wxSize(FromDIP(260), -1));
|
m_staticText_release_note->SetMinSize(wxSize(FromDIP(260), -1));
|
||||||
|
|
||||||
text = format_text(m_staticText_release_note, text, FromDIP(240));
|
wxBoxSizer* top_blank_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
wxBoxSizer* bottom_blank_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
top_blank_sizer->Add(FromDIP(5), 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||||
|
bottom_blank_sizer->Add(FromDIP(5), 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||||
|
|
||||||
m_staticText_release_note->SetLabelText(text);
|
sizer_text_release_note->Add(top_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||||
m_staticText_release_note->Wrap(FromDIP(240));
|
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALIGN_CENTER, FromDIP(5));
|
||||||
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALIGN_CENTER, 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();
|
||||||
|
if (text_size.y < FromDIP(280))
|
||||||
|
m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), text_size.y + FromDIP(25)));
|
||||||
|
else
|
||||||
|
m_vebview_release_note->SetMinSize(wxSize(FromDIP(300), FromDIP(280)));
|
||||||
|
|
||||||
m_vebview_release_note->Layout();
|
m_vebview_release_note->Layout();
|
||||||
//Fit();
|
m_sizer_main->Layout();
|
||||||
|
m_sizer_main->Fit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString SecondaryCheckDialog::format_text(wxStaticText* st, wxString str, int warp)
|
wxString SecondaryCheckDialog::format_text(wxStaticText* st, wxString str, int warp)
|
||||||
|
@ -477,7 +486,8 @@ SecondaryCheckDialog::~SecondaryCheckDialog()
|
||||||
|
|
||||||
void SecondaryCheckDialog::on_dpi_changed(const wxRect& suggested_rect)
|
void SecondaryCheckDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||||
{
|
{
|
||||||
|
m_button_ok->Rescale();
|
||||||
|
m_button_cancel->Rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
|
@ -102,6 +102,7 @@ public:
|
||||||
~SecondaryCheckDialog();
|
~SecondaryCheckDialog();
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||||
|
|
||||||
|
wxBoxSizer* m_sizer_main;
|
||||||
wxScrolledWindow *m_vebview_release_note {nullptr};
|
wxScrolledWindow *m_vebview_release_note {nullptr};
|
||||||
Button* m_button_ok;
|
Button* m_button_ok;
|
||||||
Button* m_button_cancel;
|
Button* m_button_cancel;
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "Plater.hpp"
|
#include "Plater.hpp"
|
||||||
#include "BitmapCache.hpp"
|
#include "BitmapCache.hpp"
|
||||||
#include "BindDialog.hpp"
|
#include "BindDialog.hpp"
|
||||||
#include "ConfirmHintDialog.hpp"
|
|
||||||
#include "ReleaseNote.hpp"
|
#include "ReleaseNote.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
|
@ -797,8 +797,8 @@ void UpgradePanel::update(MachineObject *obj)
|
||||||
if (m_obj && m_show_forced_hint) {
|
if (m_obj && m_show_forced_hint) {
|
||||||
if (m_obj->upgrade_force_upgrade) {
|
if (m_obj->upgrade_force_upgrade) {
|
||||||
m_show_forced_hint = false; //lock hint
|
m_show_forced_hint = false; //lock hint
|
||||||
SecondaryCheckDialog* force_dlg = new SecondaryCheckDialog(m_scrolledWindow, wxID_ANY, _L("Update firmware"));
|
SecondaryCheckDialog force_dlg(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize, wxPD_APP_MODAL | wxCLOSE_BOX | wxCAPTION);
|
||||||
force_dlg->update_text(_L(
|
force_dlg.update_text(_L(
|
||||||
"An important update was detected and needs to be run before printing can continue. Do you want to update now? You can also update later from 'Upgrade firmware'."
|
"An important update was detected and needs to be run before printing can continue. Do you want to update now? You can also update later from 'Upgrade firmware'."
|
||||||
));
|
));
|
||||||
force_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, &MachineInfoPanel::on_upgrade_firmware, m_push_upgrade_panel);
|
force_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, &MachineInfoPanel::on_upgrade_firmware, m_push_upgrade_panel);
|
||||||
|
@ -816,8 +816,8 @@ void UpgradePanel::update(MachineObject *obj)
|
||||||
if (m_obj && m_show_consistency_hint) {
|
if (m_obj && m_show_consistency_hint) {
|
||||||
if (m_obj->upgrade_consistency_request) {
|
if (m_obj->upgrade_consistency_request) {
|
||||||
m_show_consistency_hint = false;
|
m_show_consistency_hint = false;
|
||||||
SecondaryCheckDialog* consistency_dlg = new SecondaryCheckDialog(m_scrolledWindow, wxID_ANY, _L("Update firmware"));
|
SecondaryCheckDialog consistency_dlg(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize, wxPD_APP_MODAL | wxCLOSE_BOX | wxCAPTION);
|
||||||
consistency_dlg->update_text(_L(
|
consistency_dlg.update_text(_L(
|
||||||
"The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now? You can also update later on printer or update next time starting the studio."
|
"The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now? You can also update later on printer or update next time starting the studio."
|
||||||
));
|
));
|
||||||
consistency_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, &MachineInfoPanel::on_consisitency_upgrade_firmware, m_push_upgrade_panel);
|
consistency_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, &MachineInfoPanel::on_consisitency_upgrade_firmware, m_push_upgrade_panel);
|
||||||
|
|
Loading…
Reference in New Issue