FIX: the extruder image do not show in mac
jira: [STUDIO-9504] Change-Id: I8457b6beaccc30492e1275926a7213c8ce328d15
This commit is contained in:
parent
d994fa4b90
commit
e86b061473
|
@ -632,8 +632,7 @@ void AMSExtImage::doRender(wxDC& dc)
|
||||||
//Ams Extruder
|
//Ams Extruder
|
||||||
AMSextruder::AMSextruder(wxWindow *parent, wxWindowID id, int nozzle_num, const wxPoint &pos, const wxSize &size)
|
AMSextruder::AMSextruder(wxWindow *parent, wxWindowID id, int nozzle_num, const wxPoint &pos, const wxSize &size)
|
||||||
{
|
{
|
||||||
create(parent, id, pos, size);
|
create(parent, id, pos, size, nozzle_num);
|
||||||
m_nozzle_num = nozzle_num;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AMSextruder::~AMSextruder() {}
|
AMSextruder::~AMSextruder() {}
|
||||||
|
@ -648,30 +647,12 @@ void AMSextruder::TurnOff()
|
||||||
m_left_extruder->TurnOff();
|
m_left_extruder->TurnOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSextruder::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
|
void AMSextruder::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int nozzle_num)
|
||||||
{
|
{
|
||||||
wxWindow::Create(parent, id, pos, wxSize(-1, FromDIP(36)), wxBORDER_NONE);
|
wxWindow::Create(parent, id, pos, wxSize(-1, FromDIP(36)), wxBORDER_NONE);
|
||||||
SetBackgroundColour(*wxWHITE);
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
wxBoxSizer *m_sizer_body = new wxBoxSizer(wxVERTICAL);
|
updateNozzleNum(nozzle_num);
|
||||||
|
|
||||||
m_bitmap_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
|
|
||||||
m_right_extruder = new AMSextruderImage(this, wxID_ANY, "right_nozzle", AMS_EXTRUDER_DOUBLE_NOZZLE_BITMAP_SIZE);
|
|
||||||
m_right_extruder->setShowState(false);
|
|
||||||
|
|
||||||
if (m_nozzle_num >= 2){
|
|
||||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "left_nozzle", AMS_EXTRUDER_DOUBLE_NOZZLE_BITMAP_SIZE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
|
|
||||||
}
|
|
||||||
m_left_extruder->setShowState(true);
|
|
||||||
m_bitmap_sizer->Add(m_left_extruder, 0, wxLEFT | wxALIGN_TOP, 0);
|
|
||||||
m_bitmap_sizer->Add(m_right_extruder, 0, wxLEFT | wxALIGN_TOP, FromDIP(2));
|
|
||||||
SetSizer(m_bitmap_sizer);
|
|
||||||
|
|
||||||
Bind(wxEVT_PAINT, &AMSextruder::paintEvent, this);
|
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,68 +694,29 @@ void AMSextruder::updateNozzleNum(int nozzle_num)
|
||||||
this->DestroyChildren();
|
this->DestroyChildren();
|
||||||
|
|
||||||
m_right_extruder = new AMSextruderImage(this, wxID_ANY, "right_nozzle", AMS_EXTRUDER_DOUBLE_NOZZLE_BITMAP_SIZE);
|
m_right_extruder = new AMSextruderImage(this, wxID_ANY, "right_nozzle", AMS_EXTRUDER_DOUBLE_NOZZLE_BITMAP_SIZE);
|
||||||
m_right_extruder->setShowState(false);
|
|
||||||
if (m_nozzle_num >= 2) {
|
|
||||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "left_nozzle", AMS_EXTRUDER_DOUBLE_NOZZLE_BITMAP_SIZE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
|
|
||||||
}
|
|
||||||
wxBoxSizer *m_bitmap_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
|
|
||||||
|
wxBoxSizer* m_bitmap_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
if (m_nozzle_num >= 2)
|
||||||
|
{
|
||||||
|
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "left_nozzle", AMS_EXTRUDER_DOUBLE_NOZZLE_BITMAP_SIZE);
|
||||||
|
m_left_extruder->setShowState(true);
|
||||||
|
m_right_extruder->setShowState(true);
|
||||||
m_bitmap_sizer->Add(m_left_extruder, 0, wxALIGN_LEFT | wxALIGN_TOP, 0);
|
m_bitmap_sizer->Add(m_left_extruder, 0, wxALIGN_LEFT | wxALIGN_TOP, 0);
|
||||||
if (m_nozzle_num >= 2){
|
|
||||||
m_bitmap_sizer->Add(m_right_extruder, 0, wxLEFT | wxALIGN_TOP, FromDIP(2));
|
m_bitmap_sizer->Add(m_right_extruder, 0, wxLEFT | wxALIGN_TOP, FromDIP(2));
|
||||||
m_bitmap_sizer->AddSpacer(2);
|
m_bitmap_sizer->AddSpacer(2);
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
|
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
|
||||||
|
m_left_extruder->setShowState(true);
|
||||||
|
m_right_extruder->setShowState(false);
|
||||||
|
m_bitmap_sizer->Add(m_left_extruder, 0, wxALIGN_LEFT | wxALIGN_TOP, 0);
|
||||||
m_bitmap_sizer->Add(m_right_extruder, 0, wxLEFT | wxALIGN_TOP, FromDIP(3));
|
m_bitmap_sizer->Add(m_right_extruder, 0, wxLEFT | wxALIGN_TOP, FromDIP(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSizer(m_bitmap_sizer);
|
SetSizer(m_bitmap_sizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSextruder::paintEvent(wxPaintEvent& evt)
|
|
||||||
{
|
|
||||||
wxPaintDC dc(this);
|
|
||||||
render(dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AMSextruder::render(wxDC& dc)
|
|
||||||
{
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
wxSize size = GetSize();
|
|
||||||
wxMemoryDC memdc;
|
|
||||||
wxBitmap bmp(size.x, size.y);
|
|
||||||
memdc.SelectObject(bmp);
|
|
||||||
memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 });
|
|
||||||
|
|
||||||
{
|
|
||||||
wxGCDC dc2(memdc);
|
|
||||||
//doRender(dc2);
|
|
||||||
}
|
|
||||||
m_left_extruder->setShowState(true);
|
|
||||||
if (m_nozzle_num >= 2) {
|
|
||||||
m_right_extruder->setShowState(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_right_extruder->setShowState(false);
|
|
||||||
}
|
|
||||||
memdc.SelectObject(wxNullBitmap);
|
|
||||||
dc.DrawBitmap(bmp, 0, 0);
|
|
||||||
#else
|
|
||||||
doRender(dc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void AMSextruder::doRender(wxDC& dc)
|
|
||||||
{
|
|
||||||
//m_current_colur =
|
|
||||||
wxSize size = GetSize();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void AMSextruder::msw_rescale()
|
void AMSextruder::msw_rescale()
|
||||||
{
|
{
|
||||||
//m_amsSextruder->msw_rescale();
|
//m_amsSextruder->msw_rescale();
|
||||||
|
|
|
@ -319,16 +319,12 @@ public:
|
||||||
class AMSextruder : public wxWindow
|
class AMSextruder : public wxWindow
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int m_nozzle_num{ 1 };
|
int m_nozzle_num = -1;
|
||||||
public:
|
public:
|
||||||
void TurnOn(wxColour col);
|
void TurnOn(wxColour col);
|
||||||
void TurnOff();
|
void TurnOff();
|
||||||
void create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size);
|
|
||||||
void OnVamsLoading(bool load, wxColour col = AMS_CONTROL_GRAY500);
|
void OnVamsLoading(bool load, wxColour col = AMS_CONTROL_GRAY500);
|
||||||
void OnAmsLoading(bool load, int nozzle_id = 0, wxColour col = AMS_CONTROL_GRAY500);
|
void OnAmsLoading(bool load, int nozzle_id = 0, wxColour col = AMS_CONTROL_GRAY500);
|
||||||
void paintEvent(wxPaintEvent& evt);
|
|
||||||
void render(wxDC& dc);
|
|
||||||
void doRender(wxDC& dc);
|
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
void has_ams(bool hams) {m_has_vams = hams; Refresh();};
|
void has_ams(bool hams) {m_has_vams = hams; Refresh();};
|
||||||
void no_ams_mode(bool mode) {m_none_ams_mode = mode; Refresh();};
|
void no_ams_mode(bool mode) {m_none_ams_mode = mode; Refresh();};
|
||||||
|
@ -348,6 +344,9 @@ public:
|
||||||
AMSextruderImage* m_right_extruder = nullptr;
|
AMSextruderImage* m_right_extruder = nullptr;
|
||||||
AMSextruder(wxWindow *parent, wxWindowID id, int nozzle_num, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
AMSextruder(wxWindow *parent, wxWindowID id, int nozzle_num, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
||||||
~AMSextruder();
|
~AMSextruder();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int nozzle_num);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
|
|
Loading…
Reference in New Issue