FIX: [STUDIO-3547] use Label instead of ErrorMsgStaticText
Change-Id: Ibf813bea7ced38a6a303d6d4bac3cac542663ba0
This commit is contained in:
parent
a4b3a5c000
commit
0162fceb98
6 changed files with 98 additions and 94 deletions
|
@ -59,10 +59,9 @@ ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/)
|
|||
|
||||
wxBoxSizer *m_sizer_right = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_text_up_info = new Label(this,wxEmptyString);
|
||||
m_text_up_info = new Label(this, wxEmptyString, LB_AUTO_WRAP);
|
||||
m_text_up_info->SetFont(::Label::Head_14);
|
||||
m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30));
|
||||
m_text_up_info->Wrap(-1);
|
||||
m_sizer_right->Add(m_text_up_info, 0, 0, 0);
|
||||
|
||||
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
||||
|
@ -95,10 +94,9 @@ void ReleaseNoteDialog::update_release_note(wxString release_note, std::string v
|
|||
{
|
||||
m_text_up_info->SetLabel(wxString::Format(_L("version %s update information :"), version));
|
||||
wxBoxSizer * sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
||||
auto m_staticText_release_note = new ::Label(m_vebview_release_note, release_note);
|
||||
auto m_staticText_release_note = new ::Label(m_vebview_release_note, release_note, LB_AUTO_WRAP);
|
||||
m_staticText_release_note->SetMinSize(wxSize(FromDIP(530), -1));
|
||||
m_staticText_release_note->SetMaxSize(wxSize(FromDIP(530), -1));
|
||||
m_staticText_release_note->Wrap(FromDIP(530));
|
||||
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALL, 5);
|
||||
m_vebview_release_note->SetSizer(sizer_text_release_note);
|
||||
m_vebview_release_note->Layout();
|
||||
|
@ -128,18 +126,16 @@ UpdatePluginDialog::UpdatePluginDialog(wxWindow* parent /*= nullptr*/)
|
|||
|
||||
wxBoxSizer* m_sizer_right = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_text_up_info = new Label(this,wxEmptyString);
|
||||
m_text_up_info = new Label(this,wxEmptyString, LB_AUTO_WRAP);
|
||||
m_text_up_info->SetFont(::Label::Head_13);
|
||||
m_text_up_info->SetMaxSize(wxSize(FromDIP(260), -1));
|
||||
m_text_up_info->Wrap(FromDIP(260));
|
||||
m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30));
|
||||
|
||||
|
||||
operation_tips = new ::Label(this, _L("Click OK to update the Network plug-in when Bambu Studio launches next time."));
|
||||
operation_tips = new ::Label(this, _L("Click OK to update the Network plug-in when Bambu Studio launches next time."), LB_AUTO_WRAP);
|
||||
operation_tips->SetFont(::Label::Body_12);
|
||||
operation_tips->SetMinSize(wxSize(FromDIP(260), -1));
|
||||
operation_tips->SetMaxSize(wxSize(FromDIP(260), -1));
|
||||
operation_tips->Wrap(FromDIP(260));
|
||||
|
||||
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||
m_vebview_release_note->SetScrollRate(5, 5);
|
||||
|
@ -238,13 +234,11 @@ void UpdatePluginDialog::update_info(std::string json_path)
|
|||
m_text_up_info->SetLabel(wxString::Format(_L("A new Network plug-in(%s) available, Do you want to install it?"), version));
|
||||
m_text_up_info->SetMinSize(wxSize(FromDIP(260), -1));
|
||||
m_text_up_info->SetMaxSize(wxSize(FromDIP(260), -1));
|
||||
m_text_up_info->Wrap(FromDIP(260));
|
||||
wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
||||
auto m_text_label = new ::Label(m_vebview_release_note, description);
|
||||
auto m_text_label = new ::Label(m_vebview_release_note, description, LB_AUTO_WRAP);
|
||||
m_text_label->SetFont(::Label::Body_13);
|
||||
m_text_label->SetMinSize(wxSize(FromDIP(235), -1));
|
||||
m_text_label->SetMaxSize(wxSize(FromDIP(235), -1));
|
||||
m_text_label->Wrap(FromDIP(235));
|
||||
|
||||
sizer_text_release_note->Add(m_text_label, 0, wxALL, 5);
|
||||
m_vebview_release_note->SetSizer(sizer_text_release_note);
|
||||
|
@ -279,10 +273,9 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
|||
|
||||
wxBoxSizer *m_sizer_right = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_text_up_info = new Label(this,wxEmptyString);
|
||||
m_text_up_info = new Label(this,wxEmptyString, LB_AUTO_WRAP);
|
||||
m_text_up_info->SetFont(::Label::Head_14);
|
||||
m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30));
|
||||
m_text_up_info->Wrap(-1);
|
||||
|
||||
|
||||
|
||||
|
@ -502,10 +495,9 @@ void UpdateVersionDialog::update_version_info(wxString release_note, wxString ve
|
|||
m_simplebook_release_note->SetSelection(0);
|
||||
m_text_up_info->SetLabel(wxString::Format(_L("Click to download new version in default browser: %s"), version));
|
||||
wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
||||
auto m_staticText_release_note = new ::Label(m_scrollwindows_release_note, release_note);
|
||||
auto m_staticText_release_note = new ::Label(m_scrollwindows_release_note, release_note, LB_AUTO_WRAP);
|
||||
m_staticText_release_note->SetMinSize(wxSize(FromDIP(560), -1));
|
||||
m_staticText_release_note->SetMaxSize(wxSize(FromDIP(560), -1));
|
||||
m_staticText_release_note->Wrap(FromDIP(530));
|
||||
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALL, 5);
|
||||
m_scrollwindows_release_note->SetSizer(sizer_text_release_note);
|
||||
m_scrollwindows_release_note->Layout();
|
||||
|
@ -680,34 +672,29 @@ void SecondaryCheckDialog::update_text(wxString text)
|
|||
wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
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, LB_AUTO_WRAP);
|
||||
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));
|
||||
|
||||
sizer_text_release_note->Add(top_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALIGN_CENTER, 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_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();
|
||||
|
||||
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));
|
||||
|
||||
sizer_text_release_note->Add(top_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALIGN_CENTER, 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);
|
||||
auto text_size = m_staticText_release_note->GetSize();
|
||||
auto text_size = m_staticText_release_note->GetBestSize();
|
||||
if (text_size.y < FromDIP(360))
|
||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), text_size.y + FromDIP(25)));
|
||||
else {
|
||||
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();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
|
@ -909,34 +896,29 @@ void ConfirmBeforeSendDialog::update_text(wxString text)
|
|||
{
|
||||
wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
||||
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, LB_AUTO_WRAP);
|
||||
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));
|
||||
|
||||
sizer_text_release_note->Add(top_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALIGN_CENTER, 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_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();
|
||||
|
||||
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));
|
||||
|
||||
sizer_text_release_note->Add(top_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALIGN_CENTER, 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);
|
||||
auto text_size = m_staticText_release_note->GetSize();
|
||||
auto text_size = m_staticText_release_note->GetBestSize();
|
||||
if (text_size.y < FromDIP(360))
|
||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), text_size.y + FromDIP(25)));
|
||||
else {
|
||||
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();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
|
@ -1019,8 +1001,7 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow* parent)
|
|||
comfirm_after_enter_text = _L("Step 2, if the IP and Access Code below are different from the actual values on your printer, please correct them.");
|
||||
|
||||
|
||||
m_tip1 = new Label(this, comfirm_before_enter_text);
|
||||
m_tip1->SetFont(::Label::Body_13);
|
||||
m_tip1 = new Label(this, ::Label::Body_13, comfirm_before_enter_text, LB_AUTO_WRAP);
|
||||
m_tip1->SetMinSize(wxSize(FromDIP(352), -1));
|
||||
m_tip1->SetMaxSize(wxSize(FromDIP(352), -1));
|
||||
m_tip1->Wrap(FromDIP(352));
|
||||
|
@ -1028,11 +1009,9 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow* parent)
|
|||
auto m_line_tips = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1));
|
||||
m_line_tips->SetBackgroundColour(wxColour(0xEEEEEE));
|
||||
|
||||
m_tip2 = new Label(this, comfirm_after_enter_text);
|
||||
m_tip2->SetFont(::Label::Body_13);
|
||||
m_tip2 = new Label(this, ::Label::Body_13, comfirm_after_enter_text, LB_AUTO_WRAP);
|
||||
m_tip2->SetMinSize(wxSize(FromDIP(352), -1));
|
||||
m_tip2->SetMaxSize(wxSize(FromDIP(352), -1));
|
||||
m_tip2->Wrap(FromDIP(352));
|
||||
|
||||
auto m_input_tip_area = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto m_input_area = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -1063,16 +1042,15 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow* parent)
|
|||
m_input_area->Add(0, 0, 0, wxLEFT, FromDIP(16));
|
||||
m_input_area->Add(m_input_access_code, 0, wxALIGN_CENTER, 0);
|
||||
|
||||
m_error_msg = new Label(this, wxEmptyString);
|
||||
m_error_msg = new Label(this, wxEmptyString, LB_AUTO_WRAP);
|
||||
m_error_msg->SetFont(::Label::Body_13);
|
||||
m_error_msg->SetForegroundColour(wxColour(208,27,27));
|
||||
m_error_msg->Hide();
|
||||
|
||||
m_tip3 = new Label(this, _L("Where to find your printer's IP and Access Code?"));
|
||||
m_tip3 = new Label(this, _L("Where to find your printer's IP and Access Code?"), LB_AUTO_WRAP);
|
||||
m_tip3->SetFont(::Label::Body_12);
|
||||
m_tip3->SetMinSize(wxSize(FromDIP(352), -1));
|
||||
m_tip3->SetMaxSize(wxSize(FromDIP(352), -1));
|
||||
m_tip3->Wrap(FromDIP(352));
|
||||
|
||||
m_img_help1 = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("input_accesscode_help1", this, 198), wxDefaultPosition, wxSize(FromDIP(352), FromDIP(198)), 0);
|
||||
|
||||
|
@ -1152,8 +1130,8 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow* parent)
|
|||
|
||||
m_sizer_step_icon_panel2->Add(m_img_step2, 0, wxALIGN_CENTER|wxALL, FromDIP(5));
|
||||
|
||||
m_step_icon_panel1->SetMinSize(wxSize(-1, m_tip1->GetSize().y));
|
||||
m_step_icon_panel1->SetMaxSize(wxSize(-1, m_tip1->GetSize().y));
|
||||
m_step_icon_panel1->SetMinSize(wxSize(-1, m_tip1->GetBestSize().y));
|
||||
m_step_icon_panel1->SetMaxSize(wxSize(-1, m_tip1->GetBestSize().y));
|
||||
|
||||
m_sizer_main_left->Add(m_step_icon_panel1, 0, wxEXPAND, 0);
|
||||
m_sizer_main_left->Add(0, 0, 0, wxTOP, FromDIP(20));
|
||||
|
@ -1271,7 +1249,6 @@ void InputIpAddressDialog::update_error_msg(wxString msg)
|
|||
m_error_msg->SetLabelText(msg);
|
||||
m_error_msg->SetMinSize(wxSize(FromDIP(352), -1));
|
||||
m_error_msg->SetMaxSize(wxSize(FromDIP(352), -1));
|
||||
m_error_msg->Wrap(FromDIP(352));
|
||||
}
|
||||
|
||||
Layout();
|
||||
|
|
|
@ -383,11 +383,10 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
m_panel_error_txt->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
wxBoxSizer *static_text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_error_text = new ErrorMsgStaticText(m_panel_error_txt);
|
||||
m_error_text = new Label(m_panel_error_txt, "", LB_AUTO_WRAP);
|
||||
m_error_text->SetForegroundColour(wxColour(255, 0, 0));
|
||||
text_sizer->Add(m_error_text, 1, wxEXPAND|wxLEFT, FromDIP(17));
|
||||
static_text_sizer->Add(m_error_text, 1, wxEXPAND | wxLEFT, FromDIP(17));
|
||||
|
||||
m_button_clean = new Button(m_panel_error_txt, _L("Clear"));
|
||||
StateColor clean_bg(std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Disabled), std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed),
|
||||
|
@ -403,7 +402,6 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
m_button_clean->SetFont(Label::Body_10);
|
||||
m_button_clean->SetMinSize(TASK_BUTTON_SIZE2);
|
||||
|
||||
static_text_sizer->Add(text_sizer, 1, wxEXPAND, 0);
|
||||
static_text_sizer->Add( FromDIP(10), 0, 0, 0, 0 );
|
||||
static_text_sizer->Add(m_button_clean, 0, wxALIGN_CENTRE_VERTICAL|wxRIGHT, FromDIP(5));
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "Widgets/AMSControl.hpp"
|
||||
#include "Widgets/FanControl.hpp"
|
||||
#include "HMS.hpp"
|
||||
#include "Widgets/ErrorMsgStaticText.hpp"
|
||||
|
||||
class StepIndicator;
|
||||
|
||||
#define COMMAND_TIMEOUT_U0 15
|
||||
|
@ -98,7 +98,7 @@ private:
|
|||
Button* m_button_clean;
|
||||
|
||||
ProgressBar* m_gauge_progress;
|
||||
ErrorMsgStaticText* m_error_text;
|
||||
Label* m_error_text;
|
||||
PrintingTaskType m_type;
|
||||
|
||||
public:
|
||||
|
@ -263,7 +263,7 @@ protected:
|
|||
wxBoxSizer * m_tasklist_caption_sizer;
|
||||
wxPanel* m_panel_error_txt;
|
||||
wxPanel* m_staticline;
|
||||
ErrorMsgStaticText * m_error_text;
|
||||
Label * m_error_text;
|
||||
wxStaticText* m_staticText_calibration_caption;
|
||||
wxStaticText* m_staticText_calibration_caption_top;
|
||||
wxStaticText* m_calibration_text;
|
||||
|
|
|
@ -108,6 +108,11 @@ public:
|
|||
for (bool newLine = false; !line.empty(); newLine = true) {
|
||||
if (newLine) OnNewLine();
|
||||
|
||||
if (1 == line.length()) {
|
||||
DoOutputLine(line);
|
||||
break;
|
||||
}
|
||||
|
||||
wxArrayInt widths;
|
||||
dc.GetPartialTextExtents(line, widths);
|
||||
|
||||
|
@ -136,6 +141,10 @@ public:
|
|||
// No spaces, so can't wrap.
|
||||
lastSpace = posEnd;
|
||||
}
|
||||
if (lastSpace == 0) {
|
||||
// Break at least one char
|
||||
lastSpace = 1;
|
||||
}
|
||||
|
||||
// Output the part that fits.
|
||||
DoOutputLine(line.substr(0, lastSpace));
|
||||
|
@ -184,13 +193,14 @@ private:
|
|||
class wxLabelWrapper2 : public wxTextWrapper2
|
||||
{
|
||||
public:
|
||||
void WrapLabel(wxWindow *text, int widthMax)
|
||||
void WrapLabel(wxWindow *text, wxString const & label, int widthMax)
|
||||
{
|
||||
m_text.clear();
|
||||
Wrap(text, text->GetLabel(), widthMax);
|
||||
text->SetLabel(m_text);
|
||||
Wrap(text, label, widthMax);
|
||||
}
|
||||
|
||||
wxString GetText() const { return m_text; }
|
||||
|
||||
protected:
|
||||
virtual void OnOutputLine(const wxString &line) wxOVERRIDE { m_text += line; }
|
||||
|
||||
|
@ -232,23 +242,32 @@ Label::Label(wxWindow *parent, wxString const &text, long style) : Label(parent,
|
|||
Label::Label(wxWindow *parent, wxFont const &font, wxString const &text, long style)
|
||||
: wxStaticText(parent, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, style)
|
||||
{
|
||||
this->font = font;
|
||||
this->m_font = font;
|
||||
this->m_text = text;
|
||||
SetFont(font);
|
||||
SetForegroundColour(*wxBLACK);
|
||||
SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent));
|
||||
SetForegroundColour("#262E30");
|
||||
if (style & LB_PROPAGATE_MOUSE_EVENT) {
|
||||
for (auto evt : {
|
||||
wxEVT_LEFT_UP, wxEVT_LEFT_DOWN})
|
||||
for (auto evt : { wxEVT_LEFT_UP, wxEVT_LEFT_DOWN })
|
||||
Bind(evt, [this] (auto & e) { GetParent()->GetEventHandler()->ProcessEventLocally(e); });
|
||||
};
|
||||
};
|
||||
if (style & LB_AUTO_WRAP) {
|
||||
Bind(wxEVT_SIZE, &Label::OnSize, this);
|
||||
Wrap(GetSize().x);
|
||||
}
|
||||
}
|
||||
|
||||
void Label::SetLabel(const wxString& label)
|
||||
{
|
||||
if (GetLabel() == label)
|
||||
if (m_text == label)
|
||||
return;
|
||||
wxStaticText::SetLabel(label);
|
||||
m_text = label;
|
||||
if ((GetWindowStyle() & LB_AUTO_WRAP)) {
|
||||
Wrap(GetSize().x);
|
||||
} else {
|
||||
wxStaticText::SetLabel(label);
|
||||
}
|
||||
#ifdef __WXOSX__
|
||||
if ((GetWindowStyle() & LB_HYPERLINK)) {
|
||||
SetLabelMarkup(label);
|
||||
|
@ -263,22 +282,21 @@ void Label::SetWindowStyleFlag(long style)
|
|||
return;
|
||||
wxStaticText::SetWindowStyleFlag(style);
|
||||
if (style & LB_HYPERLINK) {
|
||||
this->color = GetForegroundColour();
|
||||
this->m_color = GetForegroundColour();
|
||||
static wxColor clr_url("#00AE42");
|
||||
SetFont(this->font.Underlined());
|
||||
SetFont(this->m_font.Underlined());
|
||||
SetForegroundColour(clr_url);
|
||||
SetCursor(wxCURSOR_HAND);
|
||||
#ifdef __WXOSX__
|
||||
SetLabelMarkup(GetLabel());
|
||||
SetLabelMarkup(m_text);
|
||||
#endif
|
||||
} else {
|
||||
SetForegroundColour(this->color);
|
||||
SetFont(this->font);
|
||||
SetForegroundColour(this->m_color);
|
||||
SetFont(this->m_font);
|
||||
SetCursor(wxCURSOR_ARROW);
|
||||
#ifdef __WXOSX__
|
||||
auto label = GetLabel();
|
||||
wxStaticText::SetLabel({});
|
||||
wxStaticText::SetLabel(label);
|
||||
SetLabel(m_text);
|
||||
#endif
|
||||
}
|
||||
Refresh();
|
||||
|
@ -287,5 +305,15 @@ void Label::SetWindowStyleFlag(long style)
|
|||
void Label::Wrap(int width)
|
||||
{
|
||||
wxLabelWrapper2 wrapper;
|
||||
wrapper.WrapLabel(this, width);
|
||||
wrapper.Wrap(this, m_text, width);
|
||||
m_skip_size_evt = true;
|
||||
wxStaticText::SetLabel(wrapper.GetText());
|
||||
m_skip_size_evt = false;
|
||||
}
|
||||
|
||||
void Label::OnSize(wxSizeEvent &evt)
|
||||
{
|
||||
evt.Skip();
|
||||
if (m_skip_size_evt) return;
|
||||
Wrap(evt.GetSize().x);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#define LB_HYPERLINK 0x0020
|
||||
#define LB_PROPAGATE_MOUSE_EVENT 0x0040
|
||||
#define LB_AUTO_WRAP 0x0080
|
||||
|
||||
|
||||
class Label : public wxStaticText
|
||||
|
@ -21,8 +22,13 @@ public:
|
|||
void Wrap(int width);
|
||||
|
||||
private:
|
||||
wxFont font;
|
||||
wxColour color;
|
||||
void OnSize(wxSizeEvent & evt);
|
||||
|
||||
private:
|
||||
wxFont m_font;
|
||||
wxColour m_color;
|
||||
wxString m_text;
|
||||
bool m_skip_size_evt = false;
|
||||
|
||||
public:
|
||||
static wxFont Head_48;
|
||||
|
|
|
@ -323,7 +323,7 @@ SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const
|
|||
|
||||
auto st_title_error_code = new wxStaticText(m_side_error_panel, wxID_ANY, _L("code"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
||||
auto st_title_error_code_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
||||
m_st_txt_error_code = new Label(m_side_error_panel, wxEmptyString);
|
||||
m_st_txt_error_code = new Label(m_side_error_panel, wxEmptyString, LB_AUTO_WRAP);
|
||||
st_title_error_code->SetForegroundColour(0x909090);
|
||||
st_title_error_code_doc->SetForegroundColour(0x909090);
|
||||
m_st_txt_error_code->SetForegroundColour(0x909090);
|
||||
|
@ -341,7 +341,7 @@ SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const
|
|||
|
||||
auto st_title_error_desc = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("desc"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
||||
auto st_title_error_desc_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
||||
m_st_txt_error_desc = new Label(m_side_error_panel, wxEmptyString);
|
||||
m_st_txt_error_desc = new Label(m_side_error_panel, wxEmptyString, LB_AUTO_WRAP);
|
||||
st_title_error_desc->SetForegroundColour(0x909090);
|
||||
st_title_error_desc_doc->SetForegroundColour(0x909090);
|
||||
m_st_txt_error_desc->SetForegroundColour(0x909090);
|
||||
|
@ -358,7 +358,7 @@ SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const
|
|||
|
||||
auto st_title_extra_info = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("info"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
||||
auto st_title_extra_info_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
||||
m_st_txt_extra_info = new Label(m_side_error_panel, wxEmptyString);
|
||||
m_st_txt_extra_info = new Label(m_side_error_panel, wxEmptyString, LB_AUTO_WRAP);
|
||||
st_title_extra_info->SetForegroundColour(0x909090);
|
||||
st_title_extra_info_doc->SetForegroundColour(0x909090);
|
||||
m_st_txt_extra_info->SetForegroundColour(0x909090);
|
||||
|
@ -381,7 +381,6 @@ SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const
|
|||
sizer_print_failed_info->Add(sizer_extra_info, 0, wxLEFT, 5);
|
||||
|
||||
m_st_txt_error_desc->SetLabel("");
|
||||
m_st_txt_error_desc->Wrap(FromDIP(170));
|
||||
|
||||
wxBoxSizer* m_main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_main_sizer->Add(m_connection_info, 0, wxEXPAND, 0);
|
||||
|
@ -432,10 +431,6 @@ void SideTools::update_connect_err_info(int code, wxString desc, wxString info)
|
|||
m_st_txt_error_desc->SetLabelText(desc);
|
||||
m_st_txt_extra_info->SetLabelText(info);
|
||||
|
||||
m_st_txt_error_code->Wrap(FromDIP(175));
|
||||
m_st_txt_error_desc->Wrap(FromDIP(175));
|
||||
m_st_txt_extra_info->Wrap(FromDIP(175));
|
||||
|
||||
if (code == BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED) {
|
||||
m_link_network_state->Hide();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue