diff --git a/resources/images/ams_refresh_normal.svg b/resources/images/ams_refresh_normal.svg index e12c80ad31..99ea1107a4 100644 --- a/resources/images/ams_refresh_normal.svg +++ b/resources/images/ams_refresh_normal.svg @@ -1,12 +1,14 @@ - - - background - - - + + + + + + Layer 1 - - + + + + \ No newline at end of file diff --git a/resources/images/ams_refresh_selected.svg b/resources/images/ams_refresh_selected.svg index 36dda61d7b..653d0edc1e 100644 --- a/resources/images/ams_refresh_selected.svg +++ b/resources/images/ams_refresh_selected.svg @@ -1,12 +1,14 @@ - - - background - - - - - Layer 1 - - + + + + + + + + Layer 1 + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_0.svg b/resources/images/ams_rfid_0.svg new file mode 100644 index 0000000000..653d0edc1e --- /dev/null +++ b/resources/images/ams_rfid_0.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_1.svg b/resources/images/ams_rfid_1.svg new file mode 100644 index 0000000000..001274d208 --- /dev/null +++ b/resources/images/ams_rfid_1.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_2.svg b/resources/images/ams_rfid_2.svg new file mode 100644 index 0000000000..12076b79bf --- /dev/null +++ b/resources/images/ams_rfid_2.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_3.svg b/resources/images/ams_rfid_3.svg new file mode 100644 index 0000000000..fb7eedd02f --- /dev/null +++ b/resources/images/ams_rfid_3.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_4.svg b/resources/images/ams_rfid_4.svg new file mode 100644 index 0000000000..cf4e1baeb4 --- /dev/null +++ b/resources/images/ams_rfid_4.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_5.svg b/resources/images/ams_rfid_5.svg new file mode 100644 index 0000000000..8cf963c6e2 --- /dev/null +++ b/resources/images/ams_rfid_5.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_6.svg b/resources/images/ams_rfid_6.svg new file mode 100644 index 0000000000..422fc623a5 --- /dev/null +++ b/resources/images/ams_rfid_6.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/resources/images/ams_rfid_7.svg b/resources/images/ams_rfid_7.svg new file mode 100644 index 0000000000..16a872c890 --- /dev/null +++ b/resources/images/ams_rfid_7.svg @@ -0,0 +1,14 @@ + + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/src/slic3r/GUI/Widgets/AMSControl.cpp b/src/slic3r/GUI/Widgets/AMSControl.cpp index e9879aa336..27cee631fa 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.cpp +++ b/src/slic3r/GUI/Widgets/AMSControl.cpp @@ -133,13 +133,26 @@ void AMSrefresh::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, con Bind(wxEVT_LEAVE_WINDOW, &AMSrefresh::OnLeaveWindow, this); Bind(wxEVT_LEFT_DOWN, &AMSrefresh::OnClick, this); - m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 26); - m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 26); + m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 30); + m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 30); - /* m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY, wxNullAnimation, wxDefaultPosition, AMS_REFRESH_SIZE); - auto path = (boost::format("%1%/images/refresh.gif") % resources_dir()).str(); - path = encode_path(path.c_str()); - if (m_animationCtrl->LoadFile(path)) m_animationCtrl->Hide();*/ + m_bitmap_ams_rfid_0 = ScalableBitmap(this, "ams_rfid_0", 30); + m_bitmap_ams_rfid_1 = ScalableBitmap(this, "ams_rfid_1", 30); + m_bitmap_ams_rfid_2 = ScalableBitmap(this, "ams_rfid_2", 30); + m_bitmap_ams_rfid_3 = ScalableBitmap(this, "ams_rfid_3", 30); + m_bitmap_ams_rfid_4 = ScalableBitmap(this, "ams_rfid_4", 30); + m_bitmap_ams_rfid_5 = ScalableBitmap(this, "ams_rfid_5", 30); + m_bitmap_ams_rfid_6 = ScalableBitmap(this, "ams_rfid_6", 30); + m_bitmap_ams_rfid_7 = ScalableBitmap(this, "ams_rfid_7", 30); + + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_0); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_1); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_2); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_3); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_4); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_5); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_6); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_7); m_playing_timer = new wxTimer(); m_playing_timer->SetOwner(this); @@ -147,35 +160,31 @@ void AMSrefresh::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, con SetSize(AMS_REFRESH_SIZE); SetMinSize(AMS_REFRESH_SIZE); + SetMaxSize(AMS_REFRESH_SIZE); } void AMSrefresh::on_timer(wxTimerEvent &event) { - if (m_rotation_angle == 0) { - m_rotation_angle = 360; - } else { - m_rotation_angle--; - } + //if (m_rotation_angle >= m_rfid_bitmap_list.size()) { + // m_rotation_angle = 0; + //} else { + // m_rotation_angle++; + //} Refresh(); } void AMSrefresh::PlayLoading() { if (m_play_loading) return; - //this->m_animationCtrl->Show(); - //this->m_animationCtrl->Play(); m_play_loading = true; - m_rotation_angle = 360; + //m_rotation_angle = 0; m_playing_timer->Start(AMS_REFRESH_PLAY_LOADING_TIMER); Refresh(); } void AMSrefresh::StopLoading() { - if (!m_play_loading) return; - //this->m_animationCtrl->Stop(); - //this->m_animationCtrl->Hide(); m_playing_timer->Stop(); m_play_loading = false; Refresh(); @@ -218,13 +227,19 @@ void AMSrefresh::paintEvent(wxPaintEvent &evt) if (!m_play_loading) { dc.DrawBitmap(m_selected ? m_bitmap_selected.bmp() : m_bitmap_normal.bmp(), pot); } else { - m_bitmap_rotation = ScalableBitmap(this, "ams_refresh_normal", 26); - auto image = m_bitmap_rotation.bmp().ConvertToImage(); - wxPoint offset; - auto loading_img = image.Rotate(m_rotation_angle, wxPoint(image.GetWidth() / 2, image.GetHeight() / 2), true, &offset); - ScalableBitmap loading_bitmap; - loading_bitmap.bmp() = wxBitmap(loading_img); - dc.DrawBitmap(loading_bitmap.bmp(), offset.x , offset.y); + /* m_bitmap_rotation = ScalableBitmap(this, "ams_refresh_normal", 30); + auto image = m_bitmap_rotation.bmp().ConvertToImage(); + wxPoint offset; + auto loading_img = image.Rotate(m_rotation_angle, wxPoint(image.GetWidth() / 2, image.GetHeight() / 2), true, &offset); + ScalableBitmap loading_bitmap; + loading_bitmap.bmp() = wxBitmap(loading_img); + dc.DrawBitmap(loading_bitmap.bmp(), offset.x , offset.y);*/ + m_rotation_angle++; + if (m_rotation_angle >= m_rfid_bitmap_list.size()) { + m_rotation_angle = 0; + } + if (m_rfid_bitmap_list.size() <= 0)return; + dc.DrawBitmap(m_rfid_bitmap_list[m_rotation_angle].bmp(), pot); } dc.SetPen(wxPen(colour)); @@ -242,13 +257,32 @@ void AMSrefresh::Update(Caninfo info) StopLoading(); } -void AMSrefresh::msw_rescale() { } +void AMSrefresh::msw_rescale() { + m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 30); + m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 30); + m_bitmap_ams_rfid_0 = ScalableBitmap(this, "ams_rfid_0", 30); + m_bitmap_ams_rfid_1 = ScalableBitmap(this, "ams_rfid_1", 30); + m_bitmap_ams_rfid_2 = ScalableBitmap(this, "ams_rfid_2", 30); + m_bitmap_ams_rfid_3 = ScalableBitmap(this, "ams_rfid_3", 30); + m_bitmap_ams_rfid_4 = ScalableBitmap(this, "ams_rfid_4", 30); + m_bitmap_ams_rfid_5 = ScalableBitmap(this, "ams_rfid_5", 30); + m_bitmap_ams_rfid_6 = ScalableBitmap(this, "ams_rfid_6", 30); + m_bitmap_ams_rfid_7 = ScalableBitmap(this, "ams_rfid_7", 30); + + m_rfid_bitmap_list.clear(); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_0); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_1); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_2); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_3); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_4); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_5); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_6); + m_rfid_bitmap_list.push_back(m_bitmap_ams_rfid_7); +} void AMSrefresh::DoSetSize(int x, int y, int width, int height, int sizeFlags) { wxWindow::DoSetSize(x, y, width, height, sizeFlags); - m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 26); - m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 26); } /************************************************* diff --git a/src/slic3r/GUI/Widgets/AMSControl.hpp b/src/slic3r/GUI/Widgets/AMSControl.hpp index bc3d638110..506b72eb77 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.hpp +++ b/src/slic3r/GUI/Widgets/AMSControl.hpp @@ -101,7 +101,7 @@ enum FilamentStep { #define AMS_CANS_SIZE wxSize(FromDIP(284), FromDIP(186)) #define AMS_CANS_WINDOW_SIZE wxSize(FromDIP(264), FromDIP(186)) #define AMS_STEP_SIZE wxSize(FromDIP(172), FromDIP(180)) -#define AMS_REFRESH_SIZE wxSize(FromDIP(26), FromDIP(26)) +#define AMS_REFRESH_SIZE wxSize(FromDIP(30), FromDIP(30)) #define AMS_EXTRUDER_SIZE wxSize(FromDIP(66), FromDIP(55)) #define AMS_EXTRUDER_BITMAP_SIZE wxSize(FromDIP(36), FromDIP(55)) @@ -130,7 +130,7 @@ public: /************************************************* Description:AMSrefresh **************************************************/ -#define AMS_REFRESH_PLAY_LOADING_TIMER 200 +#define AMS_REFRESH_PLAY_LOADING_TIMER 100 class AMSrefresh : public wxWindow { public: @@ -153,16 +153,23 @@ public: protected: wxTimer *m_playing_timer= {nullptr}; - int m_rotation_angle = {360}; - - wxAnimationCtrl *m_animationCtrl = {nullptr}; - + int m_rotation_angle = 0; bool m_play_loading = {false}; bool m_selected = {false}; - ScalableBitmap m_bitmap_rotation; + ScalableBitmap m_bitmap_normal; ScalableBitmap m_bitmap_selected; + ScalableBitmap m_bitmap_ams_rfid_0; + ScalableBitmap m_bitmap_ams_rfid_1; + ScalableBitmap m_bitmap_ams_rfid_2; + ScalableBitmap m_bitmap_ams_rfid_3; + ScalableBitmap m_bitmap_ams_rfid_4; + ScalableBitmap m_bitmap_ams_rfid_5; + ScalableBitmap m_bitmap_ams_rfid_6; + ScalableBitmap m_bitmap_ams_rfid_7; + std::vector m_rfid_bitmap_list; + wxString m_text; wxBoxSizer * m_size_body; virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);