mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
FIX:fixed some issue with send print and ams ui
Change-Id: I1a37bad6ec1f193f9fd98c74506b3bb0358ece6d
This commit is contained in:
parent
67c2f5a285
commit
0db1b52b23
18 changed files with 292 additions and 32 deletions
|
@ -388,7 +388,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
|||
m_button_ok = new Button(this, _L("Confirm"));
|
||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_button_ok->SetBorderColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_button_ok->SetFont(Label::Body_12);
|
||||
m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
|
@ -399,7 +399,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
|||
e.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(evt);
|
||||
this->on_hide();
|
||||
});
|
||||
});
|
||||
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||
|
@ -512,6 +512,172 @@ void SecondaryCheckDialog::on_dpi_changed(const wxRect& suggested_rect)
|
|||
}
|
||||
|
||||
void SecondaryCheckDialog::rescale()
|
||||
{
|
||||
m_button_ok->Rescale();
|
||||
m_button_cancel->Rescale();
|
||||
}
|
||||
|
||||
ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id, const wxString& title, enum ButtonStyle btn_style, const wxPoint& pos, const wxSize& size, long style, bool not_show_again_check)
|
||||
: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));
|
||||
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
m_sizer_main = new wxBoxSizer(wxVERTICAL);
|
||||
auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(480), 1));
|
||||
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
|
||||
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
|
||||
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(5));
|
||||
|
||||
wxBoxSizer* m_sizer_right = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
||||
|
||||
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||
m_vebview_release_note->SetScrollRate(0, 5);
|
||||
m_vebview_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(280), FromDIP(280)));
|
||||
m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35));
|
||||
|
||||
|
||||
auto bottom_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||
|
||||
|
||||
if (not_show_again_check) {
|
||||
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) {
|
||||
not_show_again = !not_show_again;
|
||||
m_show_again_checkbox->SetValue(not_show_again);
|
||||
});
|
||||
bottom_sizer->Add(m_show_again_checkbox, 0, wxALL, FromDIP(5));
|
||||
}
|
||||
m_button_ok = new Button(this, _L("Confirm"));
|
||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_button_ok->SetBorderColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_button_ok->SetFont(Label::Body_12);
|
||||
m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_ok->SetCornerRadius(FromDIP(12));
|
||||
|
||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||
wxCommandEvent evt(EVT_SECONDARY_CHECK_CONFIRM, GetId());
|
||||
e.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(evt);
|
||||
this->on_hide();
|
||||
});
|
||||
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||
m_button_cancel->SetFont(Label::Body_12);
|
||||
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_cancel->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||
wxCommandEvent evt(EVT_SECONDARY_CHECK_CANCEL);
|
||||
e.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(evt);
|
||||
this->on_hide();
|
||||
});
|
||||
|
||||
if (btn_style != CONFIRM_AND_CANCEL)
|
||||
m_button_cancel->Hide();
|
||||
else
|
||||
m_button_cancel->Show();
|
||||
|
||||
sizer_button->AddStretchSpacer();
|
||||
sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5));
|
||||
sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5));
|
||||
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(0, 0, 0, wxTOP, FromDIP(18));
|
||||
|
||||
Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->on_hide(); });
|
||||
|
||||
SetSizer(m_sizer_right);
|
||||
Layout();
|
||||
m_sizer_main->Fit(this);
|
||||
|
||||
CenterOnParent();
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
void ConfirmBeforeSendDialog::update_text(wxString text)
|
||||
{
|
||||
wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
|
||||
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->SetMaxSize(wxSize(FromDIP(260), -1));
|
||||
m_staticText_release_note->SetMinSize(wxSize(FromDIP(260), -1));
|
||||
|
||||
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();
|
||||
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_sizer_main->Layout();
|
||||
m_sizer_main->Fit(this);
|
||||
}
|
||||
|
||||
void ConfirmBeforeSendDialog::on_show()
|
||||
{
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
// recover button color
|
||||
wxMouseEvent evt_ok(wxEVT_LEFT_UP);
|
||||
m_button_ok->GetEventHandler()->ProcessEvent(evt_ok);
|
||||
wxMouseEvent evt_cancel(wxEVT_LEFT_UP);
|
||||
m_button_cancel->GetEventHandler()->ProcessEvent(evt_cancel);
|
||||
this->ShowModal();
|
||||
}
|
||||
|
||||
void ConfirmBeforeSendDialog::on_hide()
|
||||
{
|
||||
if (m_show_again_checkbox != nullptr && not_show_again && show_again_config_text != "")
|
||||
wxGetApp().app_config->set(show_again_config_text, "1");
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
void ConfirmBeforeSendDialog::update_btn_label(wxString ok_btn_text, wxString cancel_btn_text)
|
||||
{
|
||||
m_button_ok->SetLabel(ok_btn_text);
|
||||
m_button_cancel->SetLabel(cancel_btn_text);
|
||||
rescale();
|
||||
}
|
||||
|
||||
ConfirmBeforeSendDialog::~ConfirmBeforeSendDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ConfirmBeforeSendDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
{
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConfirmBeforeSendDialog::rescale()
|
||||
{
|
||||
m_button_ok->Rescale();
|
||||
m_button_cancel->Rescale();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue