ENH: support msw_rescale
jira: [STUDIO-10907] Change-Id: I1e06043fad6345c47e8c5ceb28db204955aa0969
This commit is contained in:
parent
356410959b
commit
193caabdc7
|
@ -721,8 +721,18 @@ void AmsMapingPopup::set_reset_callback(ResetCallback callback) {
|
|||
}
|
||||
|
||||
void AmsMapingPopup::show_reset_button() {
|
||||
m_reset_btn->Show();
|
||||
}
|
||||
m_reset_btn->Show(); }
|
||||
|
||||
void AmsMapingPopup::msw_rescale()
|
||||
{
|
||||
m_left_extra_slot->msw_rescale();
|
||||
m_right_extra_slot->msw_rescale();
|
||||
for (auto item : m_mapping_item_list) { item->msw_rescale(); }
|
||||
for (auto container : m_amsmapping_container_list) { container->msw_rescale(); }
|
||||
|
||||
Fit();
|
||||
Refresh();
|
||||
};
|
||||
|
||||
void AmsMapingPopup::set_sizer_title(wxBoxSizer *sizer, wxString text) {
|
||||
if (!sizer) { return; }
|
||||
|
@ -1331,9 +1341,11 @@ void MappingItem::send_event(int fliament_id)
|
|||
}
|
||||
|
||||
void MappingItem::msw_rescale()
|
||||
{
|
||||
|
||||
}
|
||||
{
|
||||
m_transparent_mapping_item.msw_rescale();
|
||||
mapping_item_checked.msw_rescale();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void MappingItem::paintEvent(wxPaintEvent &evt)
|
||||
{
|
||||
|
@ -1421,11 +1433,10 @@ void MappingItem::render(wxDC &dc)
|
|||
dc.SetTextForeground(txt_colour);
|
||||
|
||||
auto txt_size = dc.GetTextExtent(m_tray_index);
|
||||
top += ((GetSize().y - MAPPING_ITEM_REAL_SIZE.y) / 2);
|
||||
top += FromDIP(2);
|
||||
dc.DrawText(m_tray_index, wxPoint((GetSize().x - txt_size.x) / 2, top));
|
||||
|
||||
|
||||
top += txt_size.y + FromDIP(7);
|
||||
top += txt_size.y + FromDIP(2);
|
||||
m_name.size() > 4 ? dc.SetFont(::Label::Body_9) : dc.SetFont(::Label::Body_12);
|
||||
txt_size = dc.GetTextExtent(m_name);
|
||||
dc.DrawText(m_name, wxPoint((GetSize().x - txt_size.x) / 2, top));
|
||||
|
@ -1953,7 +1964,18 @@ MappingContainer::~MappingContainer()
|
|||
}
|
||||
|
||||
|
||||
void MappingContainer::paintEvent(wxPaintEvent& evt)
|
||||
void MappingContainer::msw_rescale()
|
||||
{
|
||||
if (m_slots_num == 1) {
|
||||
ams_mapping_item_container = create_scaled_bitmap("ams_mapping_container_1", this, 82);
|
||||
} else {
|
||||
ams_mapping_item_container = create_scaled_bitmap("ams_mapping_container_4", this, 82);
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void MappingContainer::paintEvent(wxPaintEvent &evt)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
render(dc);
|
||||
|
|
|
@ -195,6 +195,8 @@ public:
|
|||
public:
|
||||
int get_slots_num() const { return m_slots_num;}
|
||||
|
||||
void msw_rescale();
|
||||
|
||||
protected:
|
||||
void paintEvent(wxPaintEvent& evt);
|
||||
void render(wxDC& dc);
|
||||
|
@ -216,7 +218,7 @@ public:
|
|||
wxWindow* send_win{ nullptr };
|
||||
std::vector<std::string> m_materials_list;
|
||||
std::vector<wxBoxSizer*> m_amsmapping_container_sizer_list;
|
||||
std::vector<wxWindow*> m_amsmapping_container_list;
|
||||
std::vector<MappingContainer*> m_amsmapping_container_list;
|
||||
std::vector<MappingItem*> m_mapping_item_list;
|
||||
|
||||
bool m_has_unmatch_filament {false};
|
||||
|
@ -281,6 +283,9 @@ public:
|
|||
void set_material_index_str(std::string str) { m_material_index = str; }
|
||||
const std::string &get_material_index_str() { return m_material_index; }
|
||||
|
||||
public:
|
||||
void msw_rescale();
|
||||
|
||||
private:
|
||||
ResetCallback m_reset_callback{nullptr};
|
||||
std::string m_material_index;
|
||||
|
|
|
@ -3749,6 +3749,8 @@ void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||
opt.second->msw_rescale();
|
||||
}
|
||||
|
||||
m_mapping_popup.msw_rescale();
|
||||
|
||||
Fit();
|
||||
Refresh();
|
||||
}
|
||||
|
|
|
@ -352,6 +352,8 @@ void SendMultiMachinePage::on_dpi_changed(const wxRect& suggested_rect)
|
|||
it->second->Refresh();
|
||||
}
|
||||
|
||||
if (m_mapping_popup) { m_mapping_popup->msw_rescale();}
|
||||
|
||||
Fit();
|
||||
Layout();
|
||||
Refresh();
|
||||
|
|
|
@ -2751,6 +2751,7 @@ void SyncAmsInfoDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||
m_swipe_right_button->msw_rescale();
|
||||
m_button_ok->Rescale();
|
||||
m_button_cancel->Rescale();
|
||||
m_mapping_popup.msw_rescale();
|
||||
|
||||
Fit();
|
||||
Refresh();
|
||||
|
|
Loading…
Reference in New Issue