mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-10 18:56:13 +00:00
FIX: use different ext image for different machine
jira: [STUDIO-11133] Change-Id: Ice69b4f33317e23a2c2d7b8fbdfc94402b4bba28 (cherry picked from commit a67acd8f0ced49052cfe0c4b01a5bf159b046e85)
This commit is contained in:
@@ -581,14 +581,7 @@ AMSExtImage::AMSExtImage(wxWindow* parent, AMSPanelPos ext_pos, ExtderData *data
|
||||
}
|
||||
|
||||
m_ext_pos = ext_pos;
|
||||
m_ext_left = ScalableBitmap(this, "ext_image_left", 98);
|
||||
m_ext_right = ScalableBitmap(this, "ext_image_right", 98);
|
||||
m_ext_single_nozzle = ScalableBitmap(this, "ext_image_single_nozzle", 98);
|
||||
|
||||
m_ams_single_ext = ScalableBitmap(this, "ams_ext_image", 25);
|
||||
m_ams_ext_left = ScalableBitmap(this, "ext_image_left", 25);
|
||||
m_ams_ext_right = ScalableBitmap(this, "ext_image_right", 25);
|
||||
|
||||
createImages();
|
||||
SetBackgroundColour(StateColor::darkModeColorFor(AMS_CONTROL_DEF_LIB_BK_COLOUR));
|
||||
|
||||
Bind(wxEVT_PAINT, &AMSExtImage::paintEvent, this);
|
||||
@@ -596,17 +589,63 @@ AMSExtImage::AMSExtImage(wxWindow* parent, AMSPanelPos ext_pos, ExtderData *data
|
||||
|
||||
AMSExtImage::~AMSExtImage() {}
|
||||
|
||||
void AMSExtImage::createImages()
|
||||
{
|
||||
m_ams_ext_o_left = ScalableBitmap(this, "ams_ext_image_o_left", 25);
|
||||
m_ams_ext_o_right = ScalableBitmap(this, "ams_ext_image_o_right", 25);
|
||||
m_ams_ext_xp = ScalableBitmap(this, "ams_ext_image_xp", 25);
|
||||
m_ams_ext_n1 = ScalableBitmap(this, "ams_ext_image_n1", 25);
|
||||
m_ams_ext_n2s = ScalableBitmap(this, "ams_ext_image_n2s", 25);
|
||||
m_ams_ext_default = ScalableBitmap(this, "ams_ext_image_default", 25);
|
||||
|
||||
m_ext_o_left = ScalableBitmap(this, "ext_image_o_left", 98);
|
||||
m_ext_o_right = ScalableBitmap(this, "ext_image_o_right", 98);
|
||||
m_ext_xp = ScalableBitmap(this, "ext_image_xp", 98);
|
||||
m_ext_n1 = ScalableBitmap(this, "ext_image_n1", 98);
|
||||
m_ext_n2s = ScalableBitmap(this, "ext_image_n2s", 98);
|
||||
m_ext_default = ScalableBitmap(this, "ext_image_default", 98);
|
||||
}
|
||||
|
||||
const wxBitmap &AMSExtImage::get_bmp(const std::string &series_name, const std::string &printer_type, bool is_ams_ext, AMSPanelPos pos) const
|
||||
{
|
||||
if (MachineObject::is_series_o(series_name)) {
|
||||
if (pos == AMSPanelPos::LEFT_PANEL) {
|
||||
return is_ams_ext ? m_ams_ext_o_left.bmp() : m_ext_o_left.bmp();
|
||||
} else if (pos == AMSPanelPos::RIGHT_PANEL) {
|
||||
return is_ams_ext ? m_ams_ext_o_right.bmp() : m_ext_o_right.bmp();
|
||||
}
|
||||
} else if (MachineObject::is_series_x(series_name) || MachineObject::is_series_p(series_name)) {
|
||||
return is_ams_ext ? m_ams_ext_xp.bmp() : m_ext_xp.bmp();
|
||||
} else if (MachineObject::is_series_n(series_name)) {
|
||||
if (printer_type == "N1") {
|
||||
return is_ams_ext ? m_ams_ext_n1.bmp() : m_ext_n1.bmp();
|
||||
} else if (printer_type == "N2S") {
|
||||
return is_ams_ext ? m_ams_ext_n2s.bmp() : m_ext_n2s.bmp();
|
||||
}
|
||||
}
|
||||
|
||||
return is_ams_ext ? m_ams_ext_default.bmp() : m_ext_default.bmp();
|
||||
}
|
||||
|
||||
void AMSExtImage::msw_rescale()
|
||||
{
|
||||
//m_ams_extruder.SetSize(AMS_EXTRUDER_BITMAP_SIZE);
|
||||
//auto image = m_ams_extruder.ConvertToImage();
|
||||
m_ext_left.msw_rescale();
|
||||
m_ext_right.msw_rescale();
|
||||
m_ext_single_nozzle.msw_rescale();
|
||||
m_ams_ext_o_left.msw_rescale();
|
||||
m_ams_ext_o_right.msw_rescale();
|
||||
m_ams_ext_xp.msw_rescale();
|
||||
m_ams_ext_n1.msw_rescale();
|
||||
m_ams_ext_n2s.msw_rescale();
|
||||
m_ams_ext_default.msw_rescale();
|
||||
|
||||
m_ams_single_ext.msw_rescale();
|
||||
m_ams_ext_left.msw_rescale();
|
||||
m_ams_ext_right.msw_rescale();
|
||||
m_ext_o_left.msw_rescale();
|
||||
m_ext_o_right.msw_rescale();
|
||||
m_ext_xp.msw_rescale();
|
||||
m_ext_n1.msw_rescale();
|
||||
m_ext_n2s.msw_rescale();
|
||||
m_ext_default.msw_rescale();
|
||||
|
||||
m_ext_default.bmp();
|
||||
|
||||
Layout();
|
||||
Fit();
|
||||
@@ -622,11 +661,13 @@ void AMSExtImage::setShowAmsExt(bool show)
|
||||
}
|
||||
}
|
||||
|
||||
void AMSExtImage::setTotalExtNum(int num)
|
||||
void AMSExtImage::setTotalExtNum(const std::string &series_name, const std::string &printer_type, int num)
|
||||
{
|
||||
if (total_ext_num != num)
|
||||
if ((total_ext_num != num) || (m_series_name != series_name) || (m_printer_type_name != printer_type))
|
||||
{
|
||||
total_ext_num = num;
|
||||
m_series_name = series_name;
|
||||
m_printer_type_name = printer_type;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
@@ -665,21 +706,8 @@ void AMSExtImage::doRender(wxDC& dc)
|
||||
|
||||
if (m_show_ams_ext)
|
||||
{
|
||||
if (total_ext_num < 2)
|
||||
{
|
||||
dc.DrawBitmap(m_ams_single_ext.bmp(), wxPoint((size.x - m_ams_single_ext.GetBmpSize().x) / 2, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ext_pos == AMSPanelPos::LEFT_PANEL)
|
||||
{
|
||||
dc.DrawBitmap(m_ams_ext_left.bmp(), wxPoint((size.x - m_ams_ext_left.GetBmpSize().x) / 2, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.DrawBitmap(m_ams_ext_right.bmp(), wxPoint((size.x - m_ams_ext_right.GetBmpSize().x) / 2, 0));
|
||||
}
|
||||
}
|
||||
const wxBitmap &bmp = get_bmp(m_series_name, m_printer_type_name, true, m_ext_pos);
|
||||
dc.DrawBitmap(bmp, wxPoint((size.x - ScalableBitmap::GetBmpSize(bmp).x) / 2, 0));
|
||||
|
||||
Layout();
|
||||
return;
|
||||
@@ -687,21 +715,9 @@ void AMSExtImage::doRender(wxDC& dc)
|
||||
|
||||
if (m_show_ext)
|
||||
{
|
||||
if (total_ext_num < 2)
|
||||
{
|
||||
dc.DrawBitmap(m_ext_single_nozzle.bmp(), wxPoint((size.x - m_ext_right.GetBmpSize().x) / 2, (size.y - m_ext_right.GetBmpSize().GetHeight())));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ext_pos == AMSPanelPos::LEFT_PANEL)
|
||||
{
|
||||
dc.DrawBitmap(m_ext_left.bmp(), wxPoint((size.x - m_ext_left.GetBmpSize().x) / 2, (size.y - m_ext_right.GetBmpSize().GetHeight())));
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.DrawBitmap(m_ext_right.bmp(), wxPoint((size.x - m_ext_right.GetBmpSize().x) / 2, (size.y - m_ext_right.GetBmpSize().GetHeight())));
|
||||
}
|
||||
}
|
||||
const wxBitmap &bmp = get_bmp(m_series_name, m_printer_type_name, false, m_ext_pos);
|
||||
const wxSize& bmp_size = ScalableBitmap::GetBmpSize(bmp);
|
||||
dc.DrawBitmap(bmp, wxPoint((size.x - bmp_size.x) / 2, (size.y - bmp_size.GetHeight())));
|
||||
|
||||
Layout();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user