ENH: calibration pages adapt to the screen dpi

Jira: STUDIO-3420

Change-Id: Ib816476aec68398714d7ea74c0fc13e6616cc698
This commit is contained in:
liz.li 2023-10-09 17:18:49 +08:00 committed by Lane.Wei
parent 276025a27f
commit 64146d8386
12 changed files with 235 additions and 57 deletions

View File

@ -101,27 +101,27 @@ void CalibrationCaliPage::set_cali_img()
{
if (m_cali_mode == CalibMode::Calib_PA_Line) {
if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_manual", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual", 400));
}
else if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) {
m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_auto", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_auto", 400));
}
}
else if (m_cali_mode == CalibMode::Calib_Flow_Rate) {
if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
if (m_page_type == CaliPageType::CALI_PAGE_CALI)
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_coarse", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_coarse", 400));
if (m_page_type == CaliPageType::CALI_PAGE_FINE_CALI)
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_fine", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_fine", 400));
else
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_coarse", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_coarse", 400));
}
else if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) {
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_auto", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_auto", 400));
}
}
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower) {
m_picture_panel->set_img(create_scaled_bitmap("max_volumetric_speed_calibration", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "max_volumetric_speed_calibration", 400));
}
}
@ -129,9 +129,9 @@ void CalibrationCaliPage::set_pa_cali_image(int stage)
{
if (m_cali_mode == CalibMode::Calib_PA_Line && m_cali_method == CALI_METHOD_MANUAL) {
if (stage == 0) {
m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_manual", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual", 400));
} else if (stage == 1) {
m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual", nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_pattern_manual", 400));
}
}
}
@ -481,6 +481,12 @@ bool CalibrationCaliPage::Show(bool show /*= true*/)
return wxPanel::Show(show);
}
void CalibrationCaliPage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
m_picture_panel->msw_rescale();
}
float CalibrationCaliPage::get_selected_calibration_nozzle_dia(MachineObject* obj)
{
// return selected if this is set

View File

@ -33,6 +33,7 @@ public:
void set_cali_method(CalibrationMethod method) override;
virtual bool Show(bool show = true) override;
void msw_rescale() override;
protected:
float get_selected_calibration_nozzle_dia(MachineObject* obj);

View File

@ -249,6 +249,13 @@ CaliPageButton::CaliPageButton(wxWindow* parent, CaliPageActionType type, wxStri
SetCornerRadius(FromDIP(12));
}
void CaliPageButton::msw_rescale()
{
SetMinSize(wxSize(-1, FromDIP(24)));
SetCornerRadius(FromDIP(12));
Rescale();
}
FilamentComboBox::FilamentComboBox(wxWindow* parent, const wxPoint& pos, const wxSize& size)
: wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL)
@ -343,6 +350,14 @@ void FilamentComboBox::SetValue(bool value, bool send_event) {
m_checkBox->SetValue(value);
}
void FilamentComboBox::msw_rescale()
{
//m_checkBox->Rescale();
m_comboBox->SetSize(CALIBRATION_FILAMENT_COMBOX_SIZE);
m_comboBox->SetMinSize(CALIBRATION_FILAMENT_COMBOX_SIZE);
m_comboBox->msw_rescale();
}
CaliPageCaption::CaliPageCaption(wxWindow* parent, CalibMode cali_mode,
@ -460,6 +475,11 @@ void CaliPageCaption::on_sys_color_changed()
m_prev_btn->msw_rescale();
}
void CaliPageCaption::msw_rescale()
{
m_prev_btn->msw_rescale();
}
CaliPageStepGuide::CaliPageStepGuide(wxWindow* parent, wxArrayString steps,
wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxPanel(parent, id, pos, size, style),
@ -541,9 +561,16 @@ CaliPagePicture::CaliPagePicture(wxWindow* parent, wxWindowID id, const wxPoint&
top_sizer->Fit(this);
}
void CaliPagePicture::set_img(const wxBitmap& bmp)
void CaliPagePicture::set_bmp(const ScalableBitmap& bmp)
{
m_img->SetBitmap(bmp);
m_bmp = bmp;
m_img->SetBitmap(m_bmp.bmp());
}
void CaliPagePicture::msw_rescale()
{
m_bmp.msw_rescale();
m_img->SetBitmap(m_bmp.bmp());
}
@ -582,6 +609,13 @@ PAPageHelpPanel::PAPageHelpPanel(wxWindow* parent, bool ground_panel, wxWindowID
top_sizer->Fit(this);
}
void PAPageHelpPanel::msw_rescale()
{
m_help_btn->msw_rescale();
m_bmp.msw_rescale();
m_img->SetBitmap(m_bmp.bmp());
}
void PAPageHelpPanel::create_pop_window()
{
m_pop_win = new PopupWindow(this);
@ -589,13 +623,10 @@ void PAPageHelpPanel::create_pop_window()
wxBoxSizer* pop_sizer = new wxBoxSizer(wxVERTICAL);
m_pop_win->SetSizer(pop_sizer);
wxStaticBitmap* img = new wxStaticBitmap(m_pop_win, wxID_ANY, wxNullBitmap);
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
img->SetBitmap(ScalableBitmap(this, "cali_fdc_editing_diagram_CN", 206).bmp());
} else {
img->SetBitmap(ScalableBitmap(this, "cali_fdc_editing_diagram", 206).bmp());
}
pop_sizer->Add(img, 1, wxEXPAND | wxALL, FromDIP(20));
m_img = new wxStaticBitmap(m_pop_win, wxID_ANY, wxNullBitmap);
m_bmp = ScalableBitmap(this, "cali_fdc_editing_diagram", 206);
m_img->SetBitmap(m_bmp.bmp());
pop_sizer->Add(m_img, 1, wxEXPAND | wxALL, FromDIP(20));
m_pop_win->Layout();
m_pop_win->Fit();
@ -754,6 +785,13 @@ void CaliPageActionPanel::enable_button(CaliPageActionType action_type, bool ena
}
}
void CaliPageActionPanel::msw_rescale()
{
for (int i = 0; i < m_action_btns.size(); i++) {
m_action_btns[i]->msw_rescale();
}
}
CaliPageSendingPanel::CaliPageSendingPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxPanel(parent, id, pos, size, style)
{
@ -914,6 +952,8 @@ CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, co
void CalibrationWizardPage::msw_rescale()
{
m_page_caption->msw_rescale();
m_action_panel->msw_rescale();
}
void CalibrationWizardPage::on_sys_color_changed()

View File

@ -96,6 +96,7 @@ public:
virtual bool Show(bool show = true);
virtual bool Enable(bool enable);
virtual void SetValue(bool value, bool send_event = true);
void msw_rescale();
protected:
int m_tray_id { -1 };
@ -123,6 +124,7 @@ public:
void show_prev_btn(bool show = true);
void show_help_icon(bool show = true);
void on_sys_color_changed();
void msw_rescale();
protected:
ScalableButton* m_prev_btn;
@ -167,9 +169,12 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL);
void set_img(const wxBitmap& bmp);
void set_bmp(const ScalableBitmap& bmp);
void paint_on_img();
void msw_rescale();
protected:
ScalableBitmap m_bmp;
wxStaticBitmap* m_img;
};
@ -182,12 +187,14 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL);
void msw_rescale();
protected:
void create_pop_window();
ScalableButton* m_help_btn;
PopupWindow* m_pop_win;
ScalableBitmap m_bmp;
wxStaticBitmap* m_img;
};
@ -218,6 +225,9 @@ public:
CaliPageButton(wxWindow* parent, CaliPageActionType type, wxString text = wxEmptyString);
CaliPageActionType get_action_type() { return m_action_type; }
void msw_rescale();
private:
CaliPageActionType m_action_type;
};
@ -261,6 +271,7 @@ public:
void bind_button(CaliPageActionType action_type, bool is_block);
void show_button(CaliPageActionType action_type, bool show = true);
void enable_button(CaliPageActionType action_type, bool enable = true);
void msw_rescale();
protected:
std::vector<CaliPageButton*> m_action_btns;
@ -302,7 +313,7 @@ public:
}
}
void msw_rescale();
virtual void msw_rescale();
void on_sys_color_changed();
protected:

View File

@ -445,6 +445,16 @@ CalibrationPresetPage::CalibrationPresetPage(
m_top_sizer->Fit(this);
}
void CalibrationPresetPage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
m_ams_sync_button->msw_rescale();
m_virtual_tray_comboBox->msw_rescale();
for (auto& comboBox : m_filament_comboBox_list) {
comboBox->msw_rescale();
}
}
void CalibrationPresetPage::create_selection_panel(wxWindow* parent)
{
auto panel_sizer = new wxBoxSizer(wxVERTICAL);

View File

@ -206,6 +206,9 @@ public:
CalibMode get_pa_cali_method();
CaliPresetPageStatus get_page_status() { return m_page_status; }
void msw_rescale() override;
protected:
void create_selection_panel(wxWindow* parent);
void create_filament_list_panel(wxWindow* parent);

View File

@ -519,9 +519,9 @@ void CaliPASaveManualPanel::create_panel(wxWindow* parent)
void CaliPASaveManualPanel::set_save_img() {
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_manual_result_CN", nullptr, 330));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual_result_CN", 330));
} else {
m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_manual_result", nullptr, 330));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual_result", 330));
}
}
@ -533,9 +533,9 @@ void CaliPASaveManualPanel::set_pa_cali_method(ManualPaCaliMethod method)
} else if (method == ManualPaCaliMethod::PA_PATTERN) {
m_complete_text->SetLabel(_L("Please find the cornor with perfect degree of extrusion"));
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result_CN", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_pattern_manual_result_CN", 350));
} else {
m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_pattern_manual_result", 350));
}
}
}
@ -606,6 +606,11 @@ bool CaliPASaveManualPanel::Show(bool show) {
return wxPanel::Show(show);
}
void CaliPASaveManualPanel::msw_rescale()
{
m_picture_panel->msw_rescale();
}
CaliPASaveP1PPanel::CaliPASaveP1PPanel(
wxWindow* parent,
wxWindowID id,
@ -675,9 +680,9 @@ void CaliPASaveP1PPanel::create_panel(wxWindow* parent)
void CaliPASaveP1PPanel::set_save_img() {
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_manual_result_CN", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual_result_CN", 350));
} else {
m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_manual_result", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual_result", 350));
}
}
@ -690,9 +695,9 @@ void CaliPASaveP1PPanel::set_pa_cali_method(ManualPaCaliMethod method)
else if (method == ManualPaCaliMethod::PA_PATTERN) {
m_complete_text->SetLabel(_L("Please find the cornor with perfect degree of extrusion"));
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result_CN", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_pattern_manual_result_CN", 350));
} else {
m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "fd_pattern_manual_result", 350));
}
}
}
@ -715,6 +720,11 @@ bool CaliPASaveP1PPanel::Show(bool show) {
return wxPanel::Show(show);
}
void CaliPASaveP1PPanel::msw_rescale()
{
m_picture_panel->msw_rescale();
}
CaliSavePresetValuePanel::CaliSavePresetValuePanel(
wxWindow *parent,
wxWindowID id,
@ -763,7 +773,7 @@ void CaliSavePresetValuePanel::create_panel(wxWindow *parent)
void CaliSavePresetValuePanel::set_img(const std::string& bmp_name_in)
{
m_picture_panel->set_img(create_scaled_bitmap(bmp_name_in, nullptr, 400));
m_picture_panel->set_bmp(ScalableBitmap(this, bmp_name_in, 400));
}
void CaliSavePresetValuePanel::set_value_title(const wxString& title) {
@ -789,6 +799,11 @@ void CaliSavePresetValuePanel::set_save_name(const std::string& name)
m_input_name->GetTextCtrl()->SetValue(name);
}
void CaliSavePresetValuePanel::msw_rescale()
{
m_picture_panel->msw_rescale();
}
CalibrationPASavePage::CalibrationPASavePage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: CalibrationCommonSavePage(parent, id, pos, size, style)
{
@ -913,6 +928,14 @@ bool CalibrationPASavePage::Show(bool show) {
return wxPanel::Show(show);
}
void CalibrationPASavePage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
m_manual_panel->msw_rescale();
m_p1p_panel->msw_rescale();
m_help_panel->msw_rescale();
}
CalibrationFlowX1SavePage::CalibrationFlowX1SavePage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: CalibrationCommonSavePage(parent, id, pos, size, style)
{
@ -1152,6 +1175,11 @@ bool CalibrationFlowX1SavePage::Show(bool show) {
return wxPanel::Show(show);
}
void CalibrationFlowX1SavePage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
}
CalibrationFlowCoarseSavePage::CalibrationFlowCoarseSavePage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: CalibrationCommonSavePage(parent, id, pos, size, style)
{
@ -1286,9 +1314,9 @@ void CalibrationFlowCoarseSavePage::create_page(wxWindow* parent)
void CalibrationFlowCoarseSavePage::set_save_img() {
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_coarse_result_CN", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_coarse_result_CN", 350));
} else {
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_coarse_result", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_coarse_result", 350));
}
}
@ -1384,6 +1412,12 @@ void CalibrationFlowCoarseSavePage::on_cali_cancel_job()
Fit();
}
void CalibrationFlowCoarseSavePage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
m_picture_panel->msw_rescale();
}
CalibrationFlowFineSavePage::CalibrationFlowFineSavePage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: CalibrationCommonSavePage(parent, id, pos, size, style)
{
@ -1466,9 +1500,9 @@ void CalibrationFlowFineSavePage::create_page(wxWindow* parent)
void CalibrationFlowFineSavePage::set_save_img() {
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_fine_result_CN", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_fine_result_CN", 350));
} else {
m_picture_panel->set_img(create_scaled_bitmap("flow_rate_calibration_fine_result", nullptr, 350));
m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_fine_result", 350));
}
}
@ -1516,6 +1550,12 @@ bool CalibrationFlowFineSavePage::Show(bool show) {
return wxPanel::Show(show);
}
void CalibrationFlowFineSavePage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
m_picture_panel->msw_rescale();
}
CalibrationMaxVolumetricSpeedSavePage::CalibrationMaxVolumetricSpeedSavePage(
wxWindow *parent,
wxWindowID id,

View File

@ -74,6 +74,7 @@ public:
void get_value(double& value);
void get_save_name(std::string& name);
void set_save_name(const std::string& name);
void msw_rescale();
};
@ -129,6 +130,8 @@ public:
virtual bool Show(bool show = true) override;
void msw_rescale();
protected:
wxBoxSizer* m_top_sizer;
Label * m_complete_text;
@ -157,6 +160,8 @@ public:
virtual bool Show(bool show = true) override;
void msw_rescale();
protected:
wxBoxSizer* m_top_sizer;
Label * m_complete_text;
@ -187,12 +192,14 @@ public:
virtual bool Show(bool show = true) override;
void msw_rescale() override;
protected:
CaliPageStepGuide* m_step_panel { nullptr };
CaliPASaveAutoPanel* m_auto_panel { nullptr };
CaliPASaveManualPanel* m_manual_panel { nullptr };
CaliPASaveP1PPanel* m_p1p_panel{ nullptr };
PAPageHelpPanel* m_help_panel;
PAPageHelpPanel* m_help_panel{ nullptr };
CaliSaveStyle m_save_style;
};
@ -211,6 +218,8 @@ public:
bool is_all_failed() { return m_is_all_failed; }
virtual bool Show(bool show = true) override;
void msw_rescale() override;
protected:
CaliPageStepGuide* m_step_panel{ nullptr };
@ -251,6 +260,8 @@ public:
return m_sending_panel->get_sending_progress_bar();
}
void msw_rescale() override;
protected:
CaliPageStepGuide* m_step_panel{ nullptr };
CaliPagePicture* m_picture_panel;
@ -283,6 +294,8 @@ public:
virtual bool Show(bool show = true) override;
void msw_rescale() override;
protected:
CaliPageStepGuide* m_step_panel{ nullptr };
CaliPagePicture* m_picture_panel;

View File

@ -35,30 +35,37 @@ void CalibrationStartPage::create_about(wxWindow* parent, wxString title, wxStri
void CalibrationStartPage::create_bitmap(wxWindow* parent, const wxBitmap& before_img, const wxBitmap& after_img)
{
m_images_sizer = new wxBoxSizer(wxHORIZONTAL);
m_before_bmp = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
if (!m_before_bmp)
m_before_bmp = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
m_before_bmp->SetBitmap(before_img);
m_images_sizer->Add(m_before_bmp, 0, wxALL, 0);
m_images_sizer->AddSpacer(FromDIP(20));
m_after_bmp = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
if (!m_after_bmp)
m_after_bmp = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
m_after_bmp->SetBitmap(after_img);
m_images_sizer->Add(m_after_bmp, 0, wxALL, 0);
if (!m_images_sizer) {
m_images_sizer = new wxBoxSizer(wxHORIZONTAL);
m_images_sizer->Add(m_before_bmp, 0, wxALL, 0);
m_images_sizer->AddSpacer(FromDIP(20));
m_images_sizer->Add(m_after_bmp, 0, wxALL, 0);
}
}
void CalibrationStartPage::create_bitmap(wxWindow* parent, std::string before_img, std::string after_img)
{
wxBitmap before_bmp = create_scaled_bitmap(before_img, nullptr, 350);
wxBitmap after_bmp = create_scaled_bitmap(after_img, nullptr, 350);
wxBitmap before_bmp = create_scaled_bitmap(before_img, this, 350);
wxBitmap after_bmp = create_scaled_bitmap(after_img, this, 350);
create_bitmap(parent, before_bmp, after_bmp);
}
void CalibrationStartPage::create_bitmap(wxWindow* parent, std::string img) {
wxBitmap before_bmp = create_scaled_bitmap(img, nullptr, 350);
m_images_sizer = new wxBoxSizer(wxHORIZONTAL);
m_bmp_intro = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
wxBitmap before_bmp = create_scaled_bitmap(img, this, 350);
if (!m_bmp_intro)
m_bmp_intro = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
m_bmp_intro->SetBitmap(before_bmp);
m_images_sizer->Add(m_bmp_intro, 0, wxALL, 0);
if (!m_images_sizer) {
m_images_sizer = new wxBoxSizer(wxHORIZONTAL);
m_images_sizer->Add(m_bmp_intro, 0, wxALL, 0);
}
}
CalibrationPAStartPage::CalibrationPAStartPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
@ -97,7 +104,7 @@ void CalibrationPAStartPage::create_page(wxWindow* parent)
m_top_sizer->Add(m_images_sizer, 0, wxALL, 0);
m_top_sizer->AddSpacer(PRESET_GAP);
PAPageHelpPanel* m_help_panel = new PAPageHelpPanel(parent, false);
m_help_panel = new PAPageHelpPanel(parent, false);
m_top_sizer->Add(m_help_panel, 0, wxALL, 0);
m_top_sizer->AddSpacer(PRESET_GAP);
@ -169,6 +176,17 @@ void CalibrationPAStartPage::on_device_connected(MachineObject* obj)
}
}
void CalibrationPAStartPage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
m_help_panel->msw_rescale();
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
create_bitmap(this, "cali_page_before_pa_CN", "cali_page_after_pa_CN");
} else {
create_bitmap(this, "cali_page_before_pa", "cali_page_after_pa");
}
}
CalibrationFlowRateStartPage::CalibrationFlowRateStartPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: CalibrationStartPage(parent, id, pos, size, style)
{
@ -291,6 +309,16 @@ void CalibrationFlowRateStartPage::on_device_connected(MachineObject* obj)
}
}
void CalibrationFlowRateStartPage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
create_bitmap(this, "cali_page_flow_introduction_CN");
} else {
create_bitmap(this, "cali_page_flow_introduction");
}
}
CalibrationMaxVolumetricSpeedStartPage::CalibrationMaxVolumetricSpeedStartPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: CalibrationStartPage(parent, id, pos, size, style)
{
@ -343,4 +371,14 @@ void CalibrationMaxVolumetricSpeedStartPage::create_page(wxWindow* parent)
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
}
void CalibrationMaxVolumetricSpeedStartPage::msw_rescale()
{
CalibrationWizardPage::msw_rescale();
if (wxGetApp().app_config->get_language_code() == "zh-cn") {
create_bitmap(this, "cali_page_before_pa_CN", "cali_page_after_pa_CN");
} else {
create_bitmap(this, "cali_page_before_pa", "cali_page_after_pa");
}
}
}}

View File

@ -19,15 +19,16 @@ public:
protected:
CalibMode m_cali_mode;
wxBoxSizer* m_top_sizer;
wxBoxSizer* m_images_sizer;
Label* m_when_title;
Label* m_when_content;
Label* m_about_title;
Label* m_about_content;
wxBoxSizer* m_top_sizer{ nullptr };
wxBoxSizer* m_images_sizer{ nullptr };
Label* m_when_title{ nullptr };
Label* m_when_content{ nullptr };
Label* m_about_title{ nullptr };
Label* m_about_content{ nullptr };
wxStaticBitmap* m_before_bmp{ nullptr };
wxStaticBitmap* m_after_bmp{ nullptr };
wxStaticBitmap* m_bmp_intro{ nullptr };
PAPageHelpPanel* m_help_panel{ nullptr };
void create_when(wxWindow* parent, wxString title, wxString content);
void create_about(wxWindow* parent, wxString title, wxString content);
@ -49,6 +50,7 @@ public:
void on_reset_page();
void on_device_connected(MachineObject* obj);
void msw_rescale() override;
};
class CalibrationFlowRateStartPage : public CalibrationStartPage
@ -63,6 +65,7 @@ public:
void create_page(wxWindow* parent);
void on_reset_page();
void on_device_connected(MachineObject* obj);
void msw_rescale() override;
};
class CalibrationMaxVolumetricSpeedStartPage : public CalibrationStartPage
@ -75,6 +78,7 @@ public:
long style = wxTAB_TRAVERSAL);
void create_page(wxWindow* parent);
void msw_rescale() override;
};
}} // namespace Slic3r::GUI

View File

@ -1393,7 +1393,7 @@ GUI::CalibrateFilamentComboBox::CalibrateFilamentComboBox(wxWindow *parent)
: PlaterPresetComboBox(parent, Preset::TYPE_FILAMENT)
{
clr_picker->SetBackgroundColour(*wxWHITE);
clr_picker->SetBitmap(*get_extruder_color_icon("#FFFFFFFF", "", 20, 20));
clr_picker->SetBitmap(*get_extruder_color_icon("#FFFFFFFF", "", FromDIP(20), FromDIP(20)));
clr_picker->SetToolTip("");
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {});
}
@ -1411,7 +1411,7 @@ void GUI::CalibrateFilamentComboBox::load_tray(DynamicPrintConfig &config)
m_filament_color = config.opt_string("filament_colour", 0u);
m_filament_exist = config.opt_bool("filament_exist", 0u);
wxColor clr(m_filament_color);
clr_picker->SetBitmap(*get_extruder_color_icon(m_filament_color, m_tray_name, 20, 20));
clr_picker->SetBitmap(*get_extruder_color_icon(m_filament_color, m_tray_name, FromDIP(20), FromDIP(20)));
#ifdef __WXOSX__
clr_picker->SetLabel(clr_picker->GetLabel()); // Let setBezelStyle: be called
clr_picker->Refresh();
@ -1420,7 +1420,7 @@ void GUI::CalibrateFilamentComboBox::load_tray(DynamicPrintConfig &config)
SetValue(_L("Empty"));
m_selected_preset = nullptr;
m_is_compatible = false;
clr_picker->SetBitmap(*get_extruder_color_icon("#F0F0F0FF", m_tray_name, 20, 20));
clr_picker->SetBitmap(*get_extruder_color_icon("#F0F0F0FF", m_tray_name, FromDIP(20), FromDIP(20)));
} else {
auto &filaments = m_collection->get_presets();
auto iter = std::find_if(filaments.begin(), filaments.end(), [this](auto &f) {
@ -1521,6 +1521,17 @@ void GUI::CalibrateFilamentComboBox::update()
SetToolTip(NULL);
}
void GUI::CalibrateFilamentComboBox::msw_rescale()
{
if (clr_picker) {
clr_picker->SetSize(FromDIP(20), FromDIP(20));
clr_picker->SetBitmap(*get_extruder_color_icon(m_filament_color, m_tray_name, FromDIP(20), FromDIP(20)));
}
// BBS
if (edit_btn != nullptr)
edit_btn->msw_rescale();
}
void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt)
{
auto marker = reinterpret_cast<Marker>(this->GetClientData(evt.GetSelection()));

View File

@ -228,6 +228,7 @@ public:
void load_tray(DynamicPrintConfig & config);
void update() override;
void msw_rescale() override;
void OnSelect(wxCommandEvent &evt) override;
const Preset* get_selected_preset() { return m_selected_preset; }
std::string get_tray_name() { return m_tray_name; }