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() {
|
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) {
|
void AmsMapingPopup::set_sizer_title(wxBoxSizer *sizer, wxString text) {
|
||||||
if (!sizer) { return; }
|
if (!sizer) { return; }
|
||||||
|
@ -1332,7 +1342,9 @@ void MappingItem::send_event(int fliament_id)
|
||||||
|
|
||||||
void MappingItem::msw_rescale()
|
void MappingItem::msw_rescale()
|
||||||
{
|
{
|
||||||
|
m_transparent_mapping_item.msw_rescale();
|
||||||
|
mapping_item_checked.msw_rescale();
|
||||||
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingItem::paintEvent(wxPaintEvent &evt)
|
void MappingItem::paintEvent(wxPaintEvent &evt)
|
||||||
|
@ -1421,11 +1433,10 @@ void MappingItem::render(wxDC &dc)
|
||||||
dc.SetTextForeground(txt_colour);
|
dc.SetTextForeground(txt_colour);
|
||||||
|
|
||||||
auto txt_size = dc.GetTextExtent(m_tray_index);
|
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));
|
dc.DrawText(m_tray_index, wxPoint((GetSize().x - txt_size.x) / 2, top));
|
||||||
|
|
||||||
|
top += txt_size.y + FromDIP(2);
|
||||||
top += txt_size.y + FromDIP(7);
|
|
||||||
m_name.size() > 4 ? dc.SetFont(::Label::Body_9) : dc.SetFont(::Label::Body_12);
|
m_name.size() > 4 ? dc.SetFont(::Label::Body_9) : dc.SetFont(::Label::Body_12);
|
||||||
txt_size = dc.GetTextExtent(m_name);
|
txt_size = dc.GetTextExtent(m_name);
|
||||||
dc.DrawText(m_name, wxPoint((GetSize().x - txt_size.x) / 2, top));
|
dc.DrawText(m_name, wxPoint((GetSize().x - txt_size.x) / 2, top));
|
||||||
|
@ -1953,6 +1964,17 @@ MappingContainer::~MappingContainer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
void MappingContainer::paintEvent(wxPaintEvent &evt)
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
|
@ -195,6 +195,8 @@ public:
|
||||||
public:
|
public:
|
||||||
int get_slots_num() const { return m_slots_num;}
|
int get_slots_num() const { return m_slots_num;}
|
||||||
|
|
||||||
|
void msw_rescale();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(wxPaintEvent& evt);
|
void paintEvent(wxPaintEvent& evt);
|
||||||
void render(wxDC& dc);
|
void render(wxDC& dc);
|
||||||
|
@ -216,7 +218,7 @@ public:
|
||||||
wxWindow* send_win{ nullptr };
|
wxWindow* send_win{ nullptr };
|
||||||
std::vector<std::string> m_materials_list;
|
std::vector<std::string> m_materials_list;
|
||||||
std::vector<wxBoxSizer*> m_amsmapping_container_sizer_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;
|
std::vector<MappingItem*> m_mapping_item_list;
|
||||||
|
|
||||||
bool m_has_unmatch_filament {false};
|
bool m_has_unmatch_filament {false};
|
||||||
|
@ -281,6 +283,9 @@ public:
|
||||||
void set_material_index_str(std::string str) { m_material_index = str; }
|
void set_material_index_str(std::string str) { m_material_index = str; }
|
||||||
const std::string &get_material_index_str() { return m_material_index; }
|
const std::string &get_material_index_str() { return m_material_index; }
|
||||||
|
|
||||||
|
public:
|
||||||
|
void msw_rescale();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResetCallback m_reset_callback{nullptr};
|
ResetCallback m_reset_callback{nullptr};
|
||||||
std::string m_material_index;
|
std::string m_material_index;
|
||||||
|
|
|
@ -3749,6 +3749,8 @@ void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||||
opt.second->msw_rescale();
|
opt.second->msw_rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_mapping_popup.msw_rescale();
|
||||||
|
|
||||||
Fit();
|
Fit();
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,6 +352,8 @@ void SendMultiMachinePage::on_dpi_changed(const wxRect& suggested_rect)
|
||||||
it->second->Refresh();
|
it->second->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_mapping_popup) { m_mapping_popup->msw_rescale();}
|
||||||
|
|
||||||
Fit();
|
Fit();
|
||||||
Layout();
|
Layout();
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
|
@ -2751,6 +2751,7 @@ void SyncAmsInfoDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||||
m_swipe_right_button->msw_rescale();
|
m_swipe_right_button->msw_rescale();
|
||||||
m_button_ok->Rescale();
|
m_button_ok->Rescale();
|
||||||
m_button_cancel->Rescale();
|
m_button_cancel->Rescale();
|
||||||
|
m_mapping_popup.msw_rescale();
|
||||||
|
|
||||||
Fit();
|
Fit();
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
Loading…
Reference in New Issue