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

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

Inheritance diagram for Slic3r::GUI::AMSExtImage:
Collaboration diagram for Slic3r::GUI::AMSExtImage:

Public Member Functions

 AMSExtImage (wxWindow *parent, AMSPanelPos ext_pos, int total_ext_num, bool over_ext, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition)
 ~AMSExtImage ()
void msw_rescale ()
void setShowAmsExt (bool show)
void setTotalExtNum (const std::string &series_name, const std::string &printer_type, int num)

Private Member Functions

void paintEvent (wxPaintEvent &evt)
void render (wxDC &dc)
void doRender (wxDC &dc)
const wxBitmap & get_bmp (const std::string &printer_type, bool is_ams_ext, AMSPanelPos pos)

Private Attributes

std::string m_series_name
std::string m_printer_type_name
bool m_show_ams_ext = false
bool m_show_ext = false
AMSPanelPos m_ext_pos
int m_ext_num = 1
ScalableBitmap m_ext_image

Detailed Description

Constructor & Destructor Documentation

◆ AMSExtImage()

Slic3r::GUI::AMSExtImage::AMSExtImage ( wxWindow * parent,
AMSPanelPos ext_pos,
int total_ext_num,
bool over_ext,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition )
664{
665 if (over_ext)
666 {
667 wxWindow::Create(parent, id, pos);
668 SetMinSize(AMS_HUMIDITY_SIZE);
669 SetMaxSize(AMS_HUMIDITY_SIZE);
670 m_show_ams_ext = true;
671 }
672 else
673 {
674 wxWindow::Create(parent, id, pos);
675 SetMinSize(wxSize(FromDIP(98), FromDIP(99)));
676 SetMaxSize(wxSize(FromDIP(98), FromDIP(99)));
677
678 m_show_ext = true;
679 }
680
681 m_ext_num = total_ext_num;
682 m_ext_pos = ext_pos;
684
685 Bind(wxEVT_PAINT, &AMSExtImage::paintEvent, this);
686}
#define AMS_CONTROL_DEF_LIB_BK_COLOUR
Definition AMSItem.hpp:45
#define AMS_HUMIDITY_SIZE
Definition AMSItem.hpp:188
bool m_show_ams_ext
Definition AMSItem.hpp:410
bool m_show_ext
Definition AMSItem.hpp:411
void paintEvent(wxPaintEvent &evt)
Definition AMSItem.cpp:736
AMSPanelPos m_ext_pos
Definition AMSItem.hpp:413
int m_ext_num
Definition AMSItem.hpp:414
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219

References AMS_CONTROL_DEF_LIB_BK_COLOUR, AMS_HUMIDITY_SIZE, StateColor::darkModeColorFor(), m_ext_num, m_ext_pos, m_show_ams_ext, m_show_ext, and paintEvent().

Here is the call graph for this function:

◆ ~AMSExtImage()

Slic3r::GUI::AMSExtImage::~AMSExtImage ( )
688{}

Member Function Documentation

◆ doRender()

void Slic3r::GUI::AMSExtImage::doRender ( wxDC & dc)
private
764{
765 auto size = GetSize();
766 dc.SetPen(*wxTRANSPARENT_PEN);
767
768 if (m_show_ams_ext)
769 {
770 const wxBitmap &bmp = get_bmp(m_printer_type_name, true, m_ext_pos);
771 dc.DrawBitmap(bmp, wxPoint((size.x - ScalableBitmap::GetBmpSize(bmp).x) / 2, 0));
772
773 Layout();
774 return;
775 }
776
777 if (m_show_ext)
778 {
779 const wxBitmap &bmp = get_bmp(m_printer_type_name, false, m_ext_pos);
780 const wxSize& bmp_size = ScalableBitmap::GetBmpSize(bmp);
781 dc.DrawBitmap(bmp, wxPoint((size.x - bmp_size.x) / 2, (size.y - bmp_size.GetHeight())));
782
783 Layout();
784 return;
785 }
786}
wxSize GetBmpSize() const
Definition wxExtensions.cpp:959
std::string m_printer_type_name
Definition AMSItem.hpp:408
const wxBitmap & get_bmp(const std::string &printer_type, bool is_ams_ext, AMSPanelPos pos)
Definition AMSItem.cpp:690

References get_bmp(), ScalableBitmap::GetBmpSize(), m_ext_pos, m_printer_type_name, m_show_ams_ext, and m_show_ext.

Referenced by render().

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

◆ get_bmp()

const wxBitmap & Slic3r::GUI::AMSExtImage::get_bmp ( const std::string & printer_type,
bool is_ams_ext,
AMSPanelPos pos )
private
691{
692 int pos_id = 0;
693 if (pos == AMSPanelPos::LEFT_PANEL) { pos_id = 1;}
694 const std::string &image_name = DevPrinterConfigUtil::get_printer_ext_img(printer_type, pos_id);
695 if (image_name.empty()) { return wxNullBitmap; }
696
697 int image_size = is_ams_ext ? 25 : 98;
698 if ((m_ext_image.name() != image_name) || (m_ext_image.GetBmpWidth() != image_size)) {
699 m_ext_image = ScalableBitmap(this, image_name, image_size);
700 }
701
702 return m_ext_image.bmp();
703}
static std::string get_printer_ext_img(const std::string &type_str, int pos)
Definition DevConfigUtil.cpp:141
ScalableBitmap m_ext_image
Definition AMSItem.hpp:416
@ LEFT_PANEL
Definition AMSItem.hpp:89

References Slic3r::DevPrinterConfigUtil::get_printer_ext_img(), Slic3r::GUI::LEFT_PANEL, and m_ext_image.

Referenced by doRender().

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

◆ msw_rescale()

void Slic3r::GUI::AMSExtImage::msw_rescale ( )
706{
707 if (m_ext_image.bmp().IsOk()) {
708 m_ext_image.msw_rescale();
709 }
710
711 Layout();
712 Fit();
713 Refresh();
714}

References m_ext_image.

◆ paintEvent()

void Slic3r::GUI::AMSExtImage::paintEvent ( wxPaintEvent & evt)
private
737{
738 wxPaintDC dc(this);
739 render(dc);
740}
void render(wxDC &dc)
Definition AMSItem.cpp:742

References render().

Referenced by AMSExtImage().

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

◆ render()

void Slic3r::GUI::AMSExtImage::render ( wxDC & dc)
private
743{
744#ifdef __WXMSW__
745 wxSize size = GetSize();
746 wxMemoryDC memdc;
747 wxBitmap bmp(size.x, size.y);
748 memdc.SelectObject(bmp);
749 memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 });
750
751 {
752 wxGCDC dc2(memdc);
753 doRender(dc2);
754 }
755
756 memdc.SelectObject(wxNullBitmap);
757 dc.DrawBitmap(bmp, 0, 0);
758#else
759 doRender(dc);
760#endif
761}
void doRender(wxDC &dc)
Definition AMSItem.cpp:763

References doRender().

Referenced by paintEvent().

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

◆ setShowAmsExt()

void Slic3r::GUI::AMSExtImage::setShowAmsExt ( bool show)
717{
718 if (m_show_ams_ext != show)
719 {
720 m_show_ams_ext = show;
721 Refresh();
722 }
723}

References m_show_ams_ext.

Referenced by Slic3r::GUI::AMSControl::createAmsPanel().

Here is the caller graph for this function:

◆ setTotalExtNum()

void Slic3r::GUI::AMSExtImage::setTotalExtNum ( const std::string & series_name,
const std::string & printer_type,
int num )
726{
727 if ((m_ext_num != num) || (m_series_name != series_name) || (m_printer_type_name != printer_type))
728 {
729 m_ext_num = num;
730 m_series_name = series_name;
731 m_printer_type_name = printer_type;
732 Refresh();
733 }
734}
std::string m_series_name
Definition AMSItem.hpp:407

References m_ext_num, m_printer_type_name, and m_series_name.

Referenced by Slic3r::GUI::AMSControl::createAmsPanel().

Here is the caller graph for this function:

Member Data Documentation

◆ m_ext_image

ScalableBitmap Slic3r::GUI::AMSExtImage::m_ext_image
private

Referenced by get_bmp(), and msw_rescale().

◆ m_ext_num

int Slic3r::GUI::AMSExtImage::m_ext_num = 1
private

Referenced by AMSExtImage(), and setTotalExtNum().

◆ m_ext_pos

AMSPanelPos Slic3r::GUI::AMSExtImage::m_ext_pos
private

Referenced by AMSExtImage(), and doRender().

◆ m_printer_type_name

std::string Slic3r::GUI::AMSExtImage::m_printer_type_name
private

Referenced by doRender(), and setTotalExtNum().

◆ m_series_name

std::string Slic3r::GUI::AMSExtImage::m_series_name
private

Referenced by setTotalExtNum().

◆ m_show_ams_ext

bool Slic3r::GUI::AMSExtImage::m_show_ams_ext = false
private

◆ m_show_ext

bool Slic3r::GUI::AMSExtImage::m_show_ext = false
private

Referenced by AMSExtImage(), and doRender().


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