OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::AMSrefresh Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/AMSItem.hpp>

Inheritance diagram for Slic3r::GUI::AMSrefresh:
Collaboration diagram for Slic3r::GUI::AMSrefresh:

Public Member Functions

 AMSrefresh ()
 AMSrefresh (wxWindow *parent, std::string ams_id, wxString can_id, Caninfo info, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 AMSrefresh (wxWindow *parent, std::string ams_id, int can_id, Caninfo info, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 ~AMSrefresh ()
void UpdateInfo (std::string ams_id, Caninfo info)
std::string GetCanId () const
void PlayLoading ()
void StopLoading ()
void msw_rescale ()

Protected Member Functions

void create (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
void on_timer (wxTimerEvent &event)
void OnEnterWindow (wxMouseEvent &evt)
void OnLeaveWindow (wxMouseEvent &evt)
void OnClick (wxMouseEvent &evt)
void post_event (wxCommandEvent &&event)
void paintEvent (wxPaintEvent &evt)
virtual void DoSetSize (int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO)

Protected Attributes

wxTimer * m_playing_timer = {nullptr}
int m_rotation_angle = 0
bool m_play_loading = {false}
bool m_selected = {false}
std::string m_ams_id
std::string m_can_id
Caninfo m_info
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< ScalableBitmap > m_rfid_bitmap_list
wxString m_refresh_id
wxBoxSizer * m_size_body
bool m_disable_mode { false }

Detailed Description

Constructor & Destructor Documentation

◆ AMSrefresh() [1/3]

Slic3r::GUI::AMSrefresh::AMSrefresh ( )
350{ SetFont(Label::Body_10);}
static wxFont Body_10
Definition Label.hpp:56

References Label::Body_10.

Referenced by AMSrefresh(), and AMSrefresh().

Here is the caller graph for this function:

◆ AMSrefresh() [2/3]

Slic3r::GUI::AMSrefresh::AMSrefresh ( wxWindow * parent,
std::string ams_id,
wxString can_id,
Caninfo info,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize )
352 : AMSrefresh()
353{
354 m_can_id = can_id.ToStdString();
355 create(parent, wxID_ANY, pos, size);
356
357 UpdateInfo(ams_id, info);
358}
void UpdateInfo(std::string ams_id, Caninfo info)
Definition AMSItem.cpp:514
void create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
Definition AMSItem.cpp:377
AMSrefresh()
Definition AMSItem.cpp:350
std::string m_can_id
Definition AMSItem.hpp:358

References AMSrefresh(), create(), m_can_id, and UpdateInfo().

Here is the call graph for this function:

◆ AMSrefresh() [3/3]

Slic3r::GUI::AMSrefresh::AMSrefresh ( wxWindow * parent,
std::string ams_id,
int can_id,
Caninfo info,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize )
360 : AMSrefresh()
361{
362 m_can_id = wxString::Format("%d", can_id).ToStdString();
363 create(parent, wxID_ANY, pos, size);
364
365 UpdateInfo(ams_id, info);
366}

References AMSrefresh(), create(), m_can_id, and UpdateInfo().

Here is the call graph for this function:

◆ ~AMSrefresh()

Slic3r::GUI::AMSrefresh::~AMSrefresh ( )
369 {
370 if (m_playing_timer) {
371 m_playing_timer->Stop();
372 delete m_playing_timer;
373 m_playing_timer = nullptr;
374 }
375 }
wxTimer * m_playing_timer
Definition AMSItem.hpp:352

References m_playing_timer.

Member Function Documentation

◆ create()

void Slic3r::GUI::AMSrefresh::create ( wxWindow * parent,
wxWindowID id,
const wxPoint & pos,
const wxSize & size )
protected
378{
379 wxWindow::Create(parent, id, pos, size, wxBORDER_NONE);
381
382 Bind(wxEVT_TIMER, &AMSrefresh::on_timer, this);
383 Bind(wxEVT_PAINT, &AMSrefresh::paintEvent, this);
384 Bind(wxEVT_ENTER_WINDOW, &AMSrefresh::OnEnterWindow, this);
385 Bind(wxEVT_LEAVE_WINDOW, &AMSrefresh::OnLeaveWindow, this);
386 Bind(wxEVT_LEFT_DOWN, &AMSrefresh::OnClick, this);
387
388 m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 32);
389 m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 32);
390
391 m_bitmap_ams_rfid_0 = ScalableBitmap(this, "ams_rfid_0", 32);
392 m_bitmap_ams_rfid_1 = ScalableBitmap(this, "ams_rfid_1", 32);
393 m_bitmap_ams_rfid_2 = ScalableBitmap(this, "ams_rfid_2", 32);
394 m_bitmap_ams_rfid_3 = ScalableBitmap(this, "ams_rfid_3", 32);
395 m_bitmap_ams_rfid_4 = ScalableBitmap(this, "ams_rfid_4", 32);
396 m_bitmap_ams_rfid_5 = ScalableBitmap(this, "ams_rfid_5", 32);
397 m_bitmap_ams_rfid_6 = ScalableBitmap(this, "ams_rfid_6", 32);
398 m_bitmap_ams_rfid_7 = ScalableBitmap(this, "ams_rfid_7", 32);
399
408
409 m_playing_timer = new wxTimer();
410 m_playing_timer->SetOwner(this);
411
412 SetSize(AMS_REFRESH_SIZE);
413 SetMinSize(AMS_REFRESH_SIZE);
414 SetMaxSize(AMS_REFRESH_SIZE);
415 Refresh();
416}
#define AMS_CONTROL_DEF_LIB_BK_COLOUR
Definition AMSItem.hpp:45
#define AMS_REFRESH_SIZE
Definition AMSItem.hpp:180
void OnEnterWindow(wxMouseEvent &evt)
Definition AMSItem.cpp:446
void paintEvent(wxPaintEvent &evt)
Definition AMSItem.cpp:475
ScalableBitmap m_bitmap_ams_rfid_5
Definition AMSItem.hpp:368
ScalableBitmap m_bitmap_ams_rfid_7
Definition AMSItem.hpp:370
ScalableBitmap m_bitmap_ams_rfid_4
Definition AMSItem.hpp:367
void OnClick(wxMouseEvent &evt)
Definition AMSItem.cpp:458
std::vector< ScalableBitmap > m_rfid_bitmap_list
Definition AMSItem.hpp:371
void on_timer(wxTimerEvent &event)
Definition AMSItem.cpp:418
ScalableBitmap m_bitmap_selected
Definition AMSItem.hpp:362
void OnLeaveWindow(wxMouseEvent &evt)
Definition AMSItem.cpp:452
ScalableBitmap m_bitmap_ams_rfid_6
Definition AMSItem.hpp:369
ScalableBitmap m_bitmap_normal
Definition AMSItem.hpp:361
ScalableBitmap m_bitmap_ams_rfid_2
Definition AMSItem.hpp:365
ScalableBitmap m_bitmap_ams_rfid_0
Definition AMSItem.hpp:363
ScalableBitmap m_bitmap_ams_rfid_1
Definition AMSItem.hpp:364
ScalableBitmap m_bitmap_ams_rfid_3
Definition AMSItem.hpp:366
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219

References AMS_CONTROL_DEF_LIB_BK_COLOUR, AMS_REFRESH_SIZE, StateColor::darkModeColorFor(), m_bitmap_ams_rfid_0, m_bitmap_ams_rfid_1, m_bitmap_ams_rfid_2, m_bitmap_ams_rfid_3, m_bitmap_ams_rfid_4, m_bitmap_ams_rfid_5, m_bitmap_ams_rfid_6, m_bitmap_ams_rfid_7, m_bitmap_normal, m_bitmap_selected, m_playing_timer, m_rfid_bitmap_list, on_timer(), OnClick(), OnEnterWindow(), OnLeaveWindow(), and paintEvent().

Referenced by AMSrefresh(), and AMSrefresh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoSetSize()

void Slic3r::GUI::AMSrefresh::DoSetSize ( int x,
int y,
int width,
int height,
int sizeFlags = wxSIZE_AUTO )
protectedvirtual
561{
562 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
563}

◆ GetCanId()

std::string Slic3r::GUI::AMSrefresh::GetCanId ( ) const
inline
334{ return m_info.can_id; };
Caninfo m_info
Definition AMSItem.hpp:359

References m_info.

◆ msw_rescale()

void Slic3r::GUI::AMSrefresh::msw_rescale ( )
534 {
535 m_bitmap_normal = ScalableBitmap(this, "ams_refresh_normal", 32);
536 m_bitmap_selected = ScalableBitmap(this, "ams_refresh_selected", 32);
537 m_bitmap_ams_rfid_0 = ScalableBitmap(this, "ams_rfid_0", 32);
538 m_bitmap_ams_rfid_1 = ScalableBitmap(this, "ams_rfid_1", 32);
539 m_bitmap_ams_rfid_2 = ScalableBitmap(this, "ams_rfid_2", 32);
540 m_bitmap_ams_rfid_3 = ScalableBitmap(this, "ams_rfid_3", 32);
541 m_bitmap_ams_rfid_4 = ScalableBitmap(this, "ams_rfid_4", 32);
542 m_bitmap_ams_rfid_5 = ScalableBitmap(this, "ams_rfid_5", 32);
543 m_bitmap_ams_rfid_6 = ScalableBitmap(this, "ams_rfid_6", 32);
544 m_bitmap_ams_rfid_7 = ScalableBitmap(this, "ams_rfid_7", 32);
545
546 m_rfid_bitmap_list.clear();
555
556 Layout();
557 Refresh();
558}

References m_bitmap_ams_rfid_0, m_bitmap_ams_rfid_1, m_bitmap_ams_rfid_2, m_bitmap_ams_rfid_3, m_bitmap_ams_rfid_4, m_bitmap_ams_rfid_5, m_bitmap_ams_rfid_6, m_bitmap_ams_rfid_7, m_bitmap_normal, m_bitmap_selected, and m_rfid_bitmap_list.

◆ on_timer()

void Slic3r::GUI::AMSrefresh::on_timer ( wxTimerEvent & event)
protected
419{
420 //if (m_rotation_angle >= m_rfid_bitmap_list.size()) {
421 // m_rotation_angle = 0;
422 //} else {
423 // m_rotation_angle++;
424 //}
425 Refresh();
426}

Referenced by create().

Here is the caller graph for this function:

◆ OnClick()

void Slic3r::GUI::AMSrefresh::OnClick ( wxMouseEvent & evt)
protected
458 {
459 post_event(wxCommandEvent(EVT_AMS_REFRESH_RFID));
460}
void post_event(wxCommandEvent &&event)
Definition AMSItem.cpp:462

References post_event(), and Slic3r::GUI::wxMouseEvent.

Referenced by create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnEnterWindow()

void Slic3r::GUI::AMSrefresh::OnEnterWindow ( wxMouseEvent & evt)
protected
447{
448 m_selected = true;
449 Refresh();
450}
bool m_selected
Definition AMSItem.hpp:355

References m_selected, and Slic3r::GUI::wxMouseEvent.

Referenced by create().

Here is the caller graph for this function:

◆ OnLeaveWindow()

void Slic3r::GUI::AMSrefresh::OnLeaveWindow ( wxMouseEvent & evt)
protected
453{
454 m_selected = false;
455 Refresh();
456}

References m_selected, and Slic3r::GUI::wxMouseEvent.

Referenced by create().

Here is the caller graph for this function:

◆ paintEvent()

void Slic3r::GUI::AMSrefresh::paintEvent ( wxPaintEvent & evt)
protected
476{
477 wxSize size = GetSize();
478 wxPaintDC dc(this);
479
481 if (!wxWindow::IsEnabled()) { colour = StateColor::darkModeColorFor(AMS_CONTROL_GRAY500); }
482
483 auto pot = wxPoint((size.x - m_bitmap_selected.GetBmpSize().x) / 2, (size.y - m_bitmap_selected.GetBmpSize().y) / 2);
484
485 if (!m_disable_mode) {
486 if (!m_play_loading) {
487 dc.DrawBitmap(m_selected ? m_bitmap_selected.bmp() : m_bitmap_normal.bmp(), pot);
488 }
489 else {
490 /* m_bitmap_rotation = ScalableBitmap(this, "ams_refresh_normal", 30);
491 auto image = m_bitmap_rotation.bmp().ConvertToImage();
492 wxPoint offset;
493 auto loading_img = image.Rotate(m_rotation_angle, wxPoint(image.GetWidth() / 2, image.GetHeight() / 2), true, &offset);
494 ScalableBitmap loading_bitmap;
495 loading_bitmap.bmp() = wxBitmap(loading_img);
496 dc.DrawBitmap(loading_bitmap.bmp(), offset.x , offset.y);*/
498 if (m_rotation_angle >= m_rfid_bitmap_list.size()) {
500 }
501 if (m_rfid_bitmap_list.size() <= 0)return;
502 dc.DrawBitmap(m_rfid_bitmap_list[m_rotation_angle].bmp(), pot);
503 }
504 }
505
506 dc.SetFont(Label::Body_10);
507 //dc.SetTextForeground(StateColor::darkModeColorFor(AMS_CONTROL_BLACK_COLOUR));
508 dc.SetTextForeground(colour);
509 auto tsize = dc.GetTextExtent(m_refresh_id);
510 pot = wxPoint((size.x - tsize.x) / 2, (size.y - tsize.y) / 2);
511 dc.DrawText(m_refresh_id, pot);
512}
#define AMS_CONTROL_GRAY500
Definition AMSItem.hpp:39
#define AMS_CONTROL_GRAY700
Definition AMSItem.hpp:37
bool m_play_loading
Definition AMSItem.hpp:354
wxString m_refresh_id
Definition AMSItem.hpp:373
int m_rotation_angle
Definition AMSItem.hpp:353
bool m_disable_mode
Definition AMSItem.hpp:377

References AMS_CONTROL_GRAY500, AMS_CONTROL_GRAY700, Label::Body_10, StateColor::darkModeColorFor(), m_bitmap_normal, m_bitmap_selected, m_disable_mode, m_play_loading, m_refresh_id, m_rfid_bitmap_list, m_rotation_angle, and m_selected.

Referenced by create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PlayLoading()

void Slic3r::GUI::AMSrefresh::PlayLoading ( )
429{
430 if (m_play_loading || m_disable_mode) return;
431
432 m_play_loading = true;
434 Refresh();
435}
#define AMS_REFRESH_PLAY_LOADING_TIMER
Definition AMSItem.hpp:322

References AMS_REFRESH_PLAY_LOADING_TIMER, m_disable_mode, m_play_loading, and m_playing_timer.

◆ post_event()

void Slic3r::GUI::AMSrefresh::post_event ( wxCommandEvent && event)
protected
463{
464 if (m_play_loading) { return;}
465
466 if (m_disable_mode)
467 return;
468 event.SetString(m_info.can_id);
469 event.SetInt(atoi(m_ams_id.c_str()));
470 event.SetEventObject(m_parent);
471 wxPostEvent(m_parent, event);
472 event.Skip();
473}
std::string m_ams_id
Definition AMSItem.hpp:357

References m_ams_id, m_disable_mode, m_info, and m_play_loading.

Referenced by OnClick().

Here is the caller graph for this function:

◆ StopLoading()

void Slic3r::GUI::AMSrefresh::StopLoading ( )
438{
439 if (!m_play_loading || m_disable_mode) return;
440
441 m_playing_timer->Stop();
442 m_play_loading = false;
443 Refresh();
444}

References m_disable_mode, m_play_loading, and m_playing_timer.

◆ UpdateInfo()

void Slic3r::GUI::AMSrefresh::UpdateInfo ( std::string ams_id,
Caninfo info )
515{
516 if (m_ams_id == ams_id && m_info == info)
517 {
518 return;
519 }
520
521 m_ams_id = ams_id;
522 m_info = info;
523
524 if (!m_ams_id.empty() && !m_can_id.empty()) {
525 auto aid = atoi(m_ams_id.c_str());
526 auto tid = atoi(m_can_id.c_str());
527 auto tray_id = aid * 4 + tid;
528 m_refresh_id = wxGetApp().transition_tridid(tray_id);
529 }
530
531 Refresh();
532}

References m_ams_id, m_can_id, m_info, and m_refresh_id.

Referenced by AMSrefresh(), and AMSrefresh().

Here is the caller graph for this function:

Member Data Documentation

◆ m_ams_id

std::string Slic3r::GUI::AMSrefresh::m_ams_id
protected

Referenced by post_event(), and UpdateInfo().

◆ m_bitmap_ams_rfid_0

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_0
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_ams_rfid_1

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_1
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_ams_rfid_2

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_2
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_ams_rfid_3

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_3
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_ams_rfid_4

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_4
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_ams_rfid_5

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_5
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_ams_rfid_6

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_6
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_ams_rfid_7

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_ams_rfid_7
protected

Referenced by create(), and msw_rescale().

◆ m_bitmap_normal

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_normal
protected

Referenced by create(), msw_rescale(), and paintEvent().

◆ m_bitmap_selected

ScalableBitmap Slic3r::GUI::AMSrefresh::m_bitmap_selected
protected

Referenced by create(), msw_rescale(), and paintEvent().

◆ m_can_id

std::string Slic3r::GUI::AMSrefresh::m_can_id
protected

Referenced by AMSrefresh(), AMSrefresh(), and UpdateInfo().

◆ m_disable_mode

bool Slic3r::GUI::AMSrefresh::m_disable_mode { false }
protected
377{ false };

Referenced by paintEvent(), PlayLoading(), post_event(), and StopLoading().

◆ m_info

Caninfo Slic3r::GUI::AMSrefresh::m_info
protected

Referenced by GetCanId(), post_event(), and UpdateInfo().

◆ m_play_loading

bool Slic3r::GUI::AMSrefresh::m_play_loading = {false}
protected
354{false};

Referenced by paintEvent(), PlayLoading(), post_event(), and StopLoading().

◆ m_playing_timer

wxTimer* Slic3r::GUI::AMSrefresh::m_playing_timer = {nullptr}
protected
352{nullptr};

Referenced by ~AMSrefresh(), create(), PlayLoading(), and StopLoading().

◆ m_refresh_id

wxString Slic3r::GUI::AMSrefresh::m_refresh_id
protected

Referenced by paintEvent(), and UpdateInfo().

◆ m_rfid_bitmap_list

std::vector<ScalableBitmap> Slic3r::GUI::AMSrefresh::m_rfid_bitmap_list
protected

Referenced by create(), msw_rescale(), and paintEvent().

◆ m_rotation_angle

int Slic3r::GUI::AMSrefresh::m_rotation_angle = 0
protected

Referenced by paintEvent().

◆ m_selected

bool Slic3r::GUI::AMSrefresh::m_selected = {false}
protected
355{false};

Referenced by OnEnterWindow(), OnLeaveWindow(), and paintEvent().

◆ m_size_body

wxBoxSizer* Slic3r::GUI::AMSrefresh::m_size_body
protected

The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/AMSItem.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/AMSItem.cpp