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

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.h>

Inheritance diagram for Slic3r::GUI::wgtDeviceNozzleRackNozzleItem:
Collaboration diagram for Slic3r::GUI::wgtDeviceNozzleRackNozzleItem:

Public Types

enum  NOZZLE_STATUS { NOZZLE_EMPTY , NOZZLE_NORMAL , NOZZLE_UNKNOWN , NOZZLE_ERROR }

Public Member Functions

 wgtDeviceNozzleRackNozzleItem (wxWindow *parent, int nozzle_id)
void UpdateInfo (const std::shared_ptr< DevNozzleRack > rack, bool on_rack=true)
int GetNozzleId () const
void SetDisplayIdText (const wxString &text)
void EnableSelect ()
void SetSelected (bool selected)
bool IsSelected () const
bool IsDisabled () const
void SetDisable (bool disabled)
void Rescale ()
bool Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
void SetCornerRadius (double radius)
void SetBorderWidth (int width)
void SetTopMargin (int margin)
void SetBorderColor (StateColor const &color)
void SetBorderColorNormal (wxColor const &color)
void SetBorderStyle (wxPenStyle style)
void SetBackgroundColor (StateColor const &color)
void SetBackgroundColorNormal (wxColor const &color)
void SetBackgroundColor2 (StateColor const &color)
void ShowBadge (bool show)

Static Public Member Functions

static wxColor GetParentBackgroundColor (wxWindow *parent)

Protected Member Functions

void eraseEvent (wxEraseEvent &evt)
void sizeEvent (wxSizeEvent &evt)
void paintEvent (wxPaintEvent &evt)
void render (wxDC &dc)
virtual void doRender (wxDC &dc)

Protected Attributes

double radius
int border_width = 1
int top_margin = 0
wxPenStyle border_style = wxPENSTYLE_SOLID
StateHandler state_handler
StateColor border_color
StateColor background_color
StateColor background_color2
ScalableBitmap badge

Private Member Functions

void CreateGui ()
void SetNozzleStatus (NOZZLE_STATUS status, const wxString &str1, const wxString &str2, const std::string &color)
void OnBtnNozzleStatus (wxMouseEvent &evt)
void OnItemSelected (wxMouseEvent &evt)

Private Attributes

std::weak_ptr< DevNozzleRack > m_rack
int m_nozzle_id
std::string m_filament_color
NOZZLE_STATUS m_status = NOZZLE_STATUS::NOZZLE_EMPTY
bool m_is_selected = false
bool m_enable_select = false
ScalableBitmap * m_nozzle_selected_image { nullptr }
wxStaticBitmap * m_nozzle_selected_bitmap { nullptr }
bool m_is_disabled = false
ScalableBitmap * m_nozzle_normal_image { nullptr }
ScalableBitmap * m_nozzle_empty_image { nullptr }
ScalableBitmap * m_nozzle_unknown_image { nullptr }
ScalableBitmap * m_nozzle_error_image { nullptr }
wxStaticBitmap * m_nozzle_icon { nullptr }
Label * m_nozzle_label_id { nullptr }
Label * m_nozzle_label_1 { nullptr }
wxStaticBitmap * m_nozzle_status_icon = nullptr
Label * m_nozzle_label_2 { nullptr }

Detailed Description

Member Enumeration Documentation

◆ NOZZLE_STATUS

Enumerator
NOZZLE_EMPTY 
NOZZLE_NORMAL 
NOZZLE_UNKNOWN 
NOZZLE_ERROR 
199 {
204 };
@ NOZZLE_EMPTY
Definition wgtDeviceNozzleRack.h:200
@ NOZZLE_UNKNOWN
Definition wgtDeviceNozzleRack.h:202
@ NOZZLE_ERROR
Definition wgtDeviceNozzleRack.h:203
@ NOZZLE_NORMAL
Definition wgtDeviceNozzleRack.h:201

Constructor & Destructor Documentation

◆ wgtDeviceNozzleRackNozzleItem()

Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::wgtDeviceNozzleRackNozzleItem ( wxWindow * parent,
int nozzle_id )
763 : StaticBox(parent, wxID_ANY), m_nozzle_id(nozzle_id)
764{
765 CreateGui();
766}
void CreateGui()
Definition wgtDeviceNozzleRack.cpp:768
int m_nozzle_id
Definition wgtDeviceNozzleRack.h:235
StaticBox()
Definition StaticBox.cpp:33

References StaticBox::StaticBox(), CreateGui(), and m_nozzle_id.

Here is the call graph for this function:

Member Function Documentation

◆ Create()

bool StaticBox::Create ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0 )
inherited
52{
53 if (style & wxBORDER_NONE)
54 border_width = 0;
55 wxWindow::Create(parent, id, pos, size, style);
57 state_handler.update_binds();
58 SetBackgroundColour(GetParentBackgroundColor(parent));
59 return true;
60}
#define style
Definition WipeTowerDialog.cpp:101
StateColor border_color
Definition StaticBox.hpp:72
int border_width
Definition StaticBox.hpp:68
static wxColor GetParentBackgroundColor(wxWindow *parent)
Definition StaticBox.cpp:122
StateHandler state_handler
Definition StaticBox.hpp:71
StateColor background_color
Definition StaticBox.hpp:73
StateColor background_color2
Definition StaticBox.hpp:74

References background_color, background_color2, border_color, border_width, GetParentBackgroundColor(), state_handler, and style.

Referenced by FanSwitchButton::FanSwitchButton(), ImageSwitchButton::ImageSwitchButton(), ModeSwitchButton::ModeSwitchButton(), StaticBox(), Button::Create(), SpinInput::Create(), TabButton::Create(), TempInput::Create(), and TextInput::Create().

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

◆ CreateGui()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::CreateGui ( )
private
769{
770 // Background
771 SetCornerRadius(FromDIP(5));
772 SetBackgroundColor(*wxWHITE);
773
774 // Top H
775 wxSizer *top_h_sizer = new wxBoxSizer(wxHORIZONTAL);
776
777 m_nozzle_label_id = new Label(this);
779 m_nozzle_label_id->SetBackgroundColour(*wxWHITE);
780 m_nozzle_label_id->SetLabel(wxString::Format("%d", m_nozzle_id + 1));
781
783 m_nozzle_empty_image = new ScalableBitmap(this, "dev_rack_nozzle_empty", 46);
784 m_nozzle_icon = new wxStaticBitmap(this, wxID_ANY, m_nozzle_empty_image->bmp(), wxDefaultPosition, WX_DIP_SIZE_46);
785 m_nozzle_icon->SetBackgroundColour(*wxWHITE);
786
787 m_nozzle_selected_bitmap = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, WX_DIP_SIZE(20, 20));
788 m_nozzle_selected_bitmap->SetBackgroundColour(*wxWHITE);
789
790 top_h_sizer->Add(m_nozzle_label_id, 0, wxTOP | wxLEFT, FromDIP(6));
791 top_h_sizer->AddStretchSpacer(1);
792 top_h_sizer->Add(m_nozzle_icon, 0, wxTOP, FromDIP(10));
793 top_h_sizer->AddStretchSpacer(1);
794 top_h_sizer->Add(m_nozzle_selected_bitmap, 0, wxTOP | wxRIGHT, FromDIP(2));
795
796 // Bottom V
797 wxBoxSizer* bottom_v = new wxBoxSizer(wxVERTICAL);
798
799 wxSizer* label_h_sizer = new wxBoxSizer(wxHORIZONTAL);
800 m_nozzle_label_1 = new Label(this);
802 m_nozzle_label_1->SetBackgroundColour(*wxWHITE);
803 m_nozzle_label_1->SetLabel(_L("Empty"));
804
805 label_h_sizer->Add(m_nozzle_label_1, 0, wxALIGN_LEFT);
806
807 auto status_icon = create_scaled_bitmap("dev_rack_nozzle_error_icon", this, 14);
808 m_nozzle_status_icon = new wxStaticBitmap(this, wxID_ANY, status_icon, wxDefaultPosition, WX_DIP_SIZE(14, 14));
810 m_nozzle_status_icon->Bind(wxEVT_ENTER_WINDOW, [this](auto&) { SetCursor(wxCURSOR_HAND); });
811 m_nozzle_status_icon->Bind(wxEVT_LEAVE_WINDOW, [this](auto&) { SetCursor(wxCURSOR_ARROW); });
812 m_nozzle_status_icon->SetBackgroundColour(*wxWHITE);
813 m_nozzle_status_icon->Show(false);
814
815 label_h_sizer->Add(m_nozzle_status_icon, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
816 bottom_v->Add(label_h_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, FromDIP(2));
817
818 m_nozzle_label_2 = new Label(this);
820 m_nozzle_label_2->SetBackgroundColour(*wxWHITE);
821 bottom_v->Add(m_nozzle_label_2, 0, wxALIGN_CENTER_HORIZONTAL);
822
823 // Main sizer
824 wxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
825 main_sizer->Add(top_h_sizer, 0, wxEXPAND);
826 main_sizer->Add(bottom_v, 0, wxALIGN_CENTER_HORIZONTAL);
827 SetSizer(main_sizer);
828
829 SetMinSize(WGT_RACK_NOZZLE_SIZE);
830 SetMaxSize(WGT_RACK_NOZZLE_SIZE);
831 SetSize(WGT_RACK_NOZZLE_SIZE);
832 Layout();
833};
#define _L(s)
Definition OBJ.cpp:34
static wxFont Body_12
Definition Label.hpp:55
Label * m_nozzle_label_1
Definition wgtDeviceNozzleRack.h:257
Label * m_nozzle_label_id
Definition wgtDeviceNozzleRack.h:256
Label * m_nozzle_label_2
Definition wgtDeviceNozzleRack.h:259
NOZZLE_STATUS m_status
Definition wgtDeviceNozzleRack.h:237
wxStaticBitmap * m_nozzle_icon
Definition wgtDeviceNozzleRack.h:255
ScalableBitmap * m_nozzle_empty_image
Definition wgtDeviceNozzleRack.h:250
wxStaticBitmap * m_nozzle_status_icon
Definition wgtDeviceNozzleRack.h:258
void OnBtnNozzleStatus(wxMouseEvent &evt)
Definition wgtDeviceNozzleRack.cpp:942
wxStaticBitmap * m_nozzle_selected_bitmap
Definition wgtDeviceNozzleRack.h:243
void SetCornerRadius(double radius)
Definition StaticBox.cpp:62
void SetBackgroundColor(StateColor const &color)
Definition StaticBox.cpp:102
#define WX_DIP_SIZE_46
Definition wgtDeviceNozzleRack.cpp:48
#define WX_DIP_SIZE(x, y)
Definition wgtDeviceNozzleRack.cpp:49
#define WGT_RACK_NOZZLE_SIZE
Definition wgtDeviceNozzleRack.cpp:51
wxBitmap create_scaled_bitmap(const std::string &bmp_name_in, wxWindow *win, const int px_cnt, const bool grayscale, const std::string &new_color, const bool menu_bitmap, const bool resize, const bool bitmap2, const std::vector< std::string > &array_new_color)
Definition wxExtensions.cpp:448

References _L, Label::Body_12, create_scaled_bitmap(), m_nozzle_empty_image, m_nozzle_icon, m_nozzle_id, m_nozzle_label_1, m_nozzle_label_2, m_nozzle_label_id, m_nozzle_selected_bitmap, m_nozzle_status_icon, m_status, NOZZLE_EMPTY, OnBtnNozzleStatus(), StaticBox::SetBackgroundColor(), StaticBox::SetCornerRadius(), WGT_RACK_NOZZLE_SIZE, WX_DIP_SIZE, and WX_DIP_SIZE_46.

Referenced by wgtDeviceNozzleRackNozzleItem().

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

◆ doRender()

void StaticBox::doRender ( wxDC & dc)
protectedvirtualinherited

Reimplemented in FilamentStepIndicator, ModeSwitchButton, StepCtrl, StepIndicator, and TabCtrl.

215{
216 wxSize size = GetSize();
217 int states = state_handler.states();
218 if (background_color2.count() == 0) {
219 if ((border_width && border_color.count() > 0) || background_color.count() > 0) {
220 int topM = top_margin > 0 ? top_margin : 0;
221 wxRect rc(0, topM, size.x, size.y - topM);
222 if (border_width && border_color.count() > 0) {
223 const double scale = dc.GetContentScaleFactor();
224
225 // Snap rect edges to physical pixel boundaries so the 1px pen doesn't straddle a pixel boundary
226 auto snap = [&](int logical) -> int {
227 return (int)(ceil(logical * scale) / scale);
228 };
229
230 int deflate = snap(border_width / 2.0); // at 175%: snap(0.5) = snap→1/1.75 ≈ 1
231 rc.x += deflate;
232 rc.y += deflate;
233 rc.width -= deflate * 2;
234 rc.height -= deflate * 2;
235 dc.SetPen(wxPen(border_color.colorForStates(states), border_width, border_style));
236 } else {
237 dc.SetPen(wxPen(background_color.colorForStates(states)));
238 }
239 if (background_color.count() > 0)
240 dc.SetBrush(wxBrush(background_color.colorForStates(states)));
241 else
242 dc.SetBrush(wxBrush(GetBackgroundColour()));
243 if (radius == 0) {
244 dc.DrawRectangle(rc);
245 }
246 else {
247 dc.DrawRoundedRectangle(rc, radius - border_width);
248 }
249 }
250 }
251 else {
252 wxColor start = background_color.colorForStates(states);
253 wxColor stop = background_color2.colorForStates(states);
254 int r = start.Red(), g = start.Green(), b = start.Blue();
255 int dr = (int) stop.Red() - r, dg = (int) stop.Green() - g, db = (int) stop.Blue() - b;
256 int lr = 0, lg = 0, lb = 0;
257 for (int y = 0; y < size.y; ++y) {
258 dc.SetPen(wxPen(wxColor(r, g, b)));
259 dc.DrawLine(0, y, size.x, y);
260 lr += dr; while (lr >= size.y) { ++r, lr -= size.y; } while (lr <= -size.y) { --r, lr += size.y; }
261 lg += dg; while (lg >= size.y) { ++g, lg -= size.y; } while (lg <= -size.y) { --g, lg += size.y; }
262 lb += db; while (lb >= size.y) { ++b, lb -= size.y; } while (lb <= -size.y) { --b, lb += size.y; }
263 }
264 }
265
266 if (badge.bmp().IsOk()) {
267 auto s = badge.bmp().GetScaledSize();
268 dc.DrawBitmap(badge.bmp(), size.x - s.x, top_margin > 0 ? top_margin : 0);
269 }
270}
int scale(const int val)
Definition WipeTowerDialog.cpp:58
ScalableBitmap badge
Definition StaticBox.hpp:75
int top_margin
Definition StaticBox.hpp:69
double radius
Definition StaticBox.hpp:67
wxPenStyle border_style
Definition StaticBox.hpp:70

References background_color, background_color2, badge, border_color, border_style, border_width, radius, scale(), state_handler, and top_margin.

Referenced by FilamentStepIndicator::doRender(), StepCtrl::doRender(), StepIndicator::doRender(), and render().

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

◆ EnableSelect()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::EnableSelect ( )
1011{
1012 if (m_enable_select == true) {
1013 return;
1014 };
1015
1016 m_enable_select = true;
1017 m_nozzle_icon->Bind(wxEVT_LEFT_DOWN, [this](auto& evt) { OnItemSelected(evt); });
1018 m_nozzle_label_id->Bind(wxEVT_LEFT_DOWN, [this](auto& evt) { OnItemSelected(evt); });
1019 m_nozzle_label_1->Bind(wxEVT_LEFT_DOWN, [this](auto& evt) { OnItemSelected(evt); });
1020 m_nozzle_label_2->Bind(wxEVT_LEFT_DOWN, [this](auto& evt) { OnItemSelected(evt); });
1021 Bind(wxEVT_LEFT_DOWN, [this](auto& evt) { OnItemSelected(evt); });
1022}
void OnItemSelected(wxMouseEvent &evt)
Definition wgtDeviceNozzleRack.cpp:1024
bool m_enable_select
Definition wgtDeviceNozzleRack.h:241

References m_enable_select, m_nozzle_icon, m_nozzle_label_1, m_nozzle_label_2, m_nozzle_label_id, and OnItemSelected().

Referenced by Slic3r::GUI::wgtDeviceNozzleRackSelect::CreateGui().

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

◆ eraseEvent()

void StaticBox::eraseEvent ( wxEraseEvent & evt)
protectedinherited
153{
154 // for transparent background, but not work
155#ifdef __WXMSW__
156 wxDC *dc = evt.GetDC();
157 wxSize size = GetSize();
158 wxClientDC dc2(GetParent());
159 dc->Blit({0, 0}, size, &dc2, GetPosition());
160#endif
161}

◆ GetNozzleId()

int Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::GetNozzleId ( ) const
inline
212{ return m_nozzle_id; }

References m_nozzle_id.

Referenced by Slic3r::GUI::sGetNozzlePosId().

Here is the caller graph for this function:

◆ GetParentBackgroundColor()

wxColor StaticBox::GetParentBackgroundColor ( wxWindow * parent)
staticinherited
123{
124 if (auto box = dynamic_cast<StaticBox*>(parent)) {
125 if (box->background_color.count() > 0) {
126 if (box->background_color2.count() == 0)
127 return box->background_color.defaultColor();
128 auto s = box->background_color.defaultColor();
129 auto e = box->background_color2.defaultColor();
130 int r = (s.Red() + e.Red()) / 2;
131 int g = (s.Green() + e.Green()) / 2;
132 int b = (s.Blue() + e.Blue()) / 2;
133 return wxColor(r, g, b);
134 }
135 }
136 if (parent)
137 return parent->GetBackgroundColour();
138 return *wxWHITE;
139}

References StaticBox().

Referenced by Label::Label(), ModeSwitchButton::ModeSwitchButton(), ScalableButton::ScalableButton(), SwitchButton::SwitchButton(), Create(), and SwitchButton::Rescale().

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

◆ IsDisabled()

bool Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::IsDisabled ( ) const
inline
219{ return m_is_disabled; }
bool m_is_disabled
Definition wgtDeviceNozzleRack.h:246

References m_is_disabled.

◆ IsSelected()

bool Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::IsSelected ( ) const
inline
217{ return m_is_selected; }
bool m_is_selected
Definition wgtDeviceNozzleRack.h:240

References m_is_selected.

◆ OnBtnNozzleStatus()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::OnBtnNozzleStatus ( wxMouseEvent & evt)
private
943{
944 if (m_is_disabled) {
945 return;
946 }
947
948 auto rack = m_rack.lock();
950 {
951 MessageDialog dlg(nullptr, _L("The hotend is in an abnormal state and currently unavailable. "
952 "Please go to 'Device -> Upgrade' to upgrade firmware."), _L("Abnormal Hotend"), wxICON_WARNING);
953 dlg.AddButton(wxID_CANCEL, _L("Cancel"), false);
954 dlg.AddButton(wxID_OK,_L("Jump to the upgrade page"), true);
955
956 if (dlg.ShowModal() == wxID_OK) {
957 if (MonitorPanel* monitor = MonitorPanel::if_built())
958 monitor->jump_to_Upgrade();
959 };
960 }
961}
static MonitorPanel * if_built()
Definition Lazy.hpp:183
std::weak_ptr< DevNozzleRack > m_rack
Definition wgtDeviceNozzleRack.h:233

References _L, Slic3r::GUI::MsgDialog::AddButton(), Slic3r::GUI::LazyInstance< MonitorPanel >::if_built(), m_is_disabled, m_rack, m_status, NOZZLE_ERROR, Slic3r::GUI::DPIAware< P >::ShowModal(), and Slic3r::GUI::wxMouseEvent.

Referenced by CreateGui().

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

◆ OnItemSelected()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::OnItemSelected ( wxMouseEvent & evt)
private
1025{
1027 SetSelected(true);
1028 wxCommandEvent command_evt(EVT_NOZZLE_RACK_NOZZLE_ITEM_SELECTED, GetId());
1029 command_evt.SetEventObject(this);
1030 ProcessEvent(command_evt);
1031 }
1032
1033 evt.Skip();
1034}
void SetSelected(bool selected)
Definition wgtDeviceNozzleRack.cpp:835

References m_enable_select, m_is_disabled, SetSelected(), and Slic3r::GUI::wxMouseEvent.

Referenced by EnableSelect().

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

◆ paintEvent()

void StaticBox::paintEvent ( wxPaintEvent & evt)
protectedinherited
170{
171 // depending on your system you may need to look at double-buffered dcs
172 wxPaintDC dc(this);
173 render(dc);
174}
void render(wxDC &dc)
Definition StaticBox.cpp:181

References render().

Here is the call graph for this function:

◆ render()

void StaticBox::render ( wxDC & dc)
protectedinherited
182{
183#ifdef __WXMSW__
184 if (radius == 0) {
185 doRender(dc);
186 return;
187 }
188
189 wxSize size = GetSize();
190 if (size.x <= 0 || size.y <= 0)
191 return;
192 wxMemoryDC memdc(&dc);
193 if (!memdc.IsOk()) {
194 doRender(dc);
195 return;
196 }
197 wxBitmap bmp(size.x, size.y);
198 memdc.SelectObject(bmp);
199 //memdc.Blit({0, 0}, size, &dc, {0, 0});
200 memdc.SetBackground(wxBrush(GetBackgroundColour()));
201 memdc.Clear();
202 {
203 wxGCDC dc2(memdc);
204 doRender(dc2);
205 }
206
207 memdc.SelectObject(wxNullBitmap);
208 dc.DrawBitmap(bmp, 0, 0);
209#else
210 doRender(dc);
211#endif
212}
virtual void doRender(wxDC &dc)
Definition StaticBox.cpp:214

References doRender(), and radius.

Referenced by paintEvent(), Button::render(), FanSwitchButton::render(), ImageSwitchButton::render(), SpinInput::render(), TabButton::render(), TempInput::render(), and TextInput::render().

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

◆ Rescale()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::Rescale ( )
964{
965 if (m_nozzle_normal_image) { m_nozzle_normal_image->msw_rescale(); }
966 if (m_nozzle_empty_image) { m_nozzle_empty_image->msw_rescale(); }
967 if (m_nozzle_unknown_image) { m_nozzle_unknown_image->msw_rescale(); }
968 if (m_nozzle_error_image) { m_nozzle_error_image->msw_rescale(); }
969
970 auto status_icon = create_scaled_bitmap("dev_rack_nozzle_error_icon", this, 14);
971 m_nozzle_status_icon->SetBitmap(status_icon);
972 m_nozzle_status_icon->Refresh();
973
975 m_nozzle_selected_image->msw_rescale();
976 if (m_is_selected) {
978 }
979 };
980
981 switch (m_status)
982 {
984 {
985 m_nozzle_icon->SetBitmap(m_nozzle_empty_image->bmp());
986 break;
987 }
989 {
991 break;
992 }
994 {
995 m_nozzle_icon->SetBitmap(m_nozzle_unknown_image->bmp());
996 break;
997 }
999 {
1000 m_nozzle_icon->SetBitmap(m_nozzle_error_image->bmp());
1001 break;
1002 }
1003 default:
1004 {
1005 break;
1006 }
1007 };
1008};
ScalableBitmap * m_nozzle_unknown_image
Definition wgtDeviceNozzleRack.h:251
ScalableBitmap * m_nozzle_normal_image
Definition wgtDeviceNozzleRack.h:249
ScalableBitmap * m_nozzle_selected_image
Definition wgtDeviceNozzleRack.h:242
ScalableBitmap * m_nozzle_error_image
Definition wgtDeviceNozzleRack.h:252
std::string m_filament_color
Definition wgtDeviceNozzleRack.h:236
static wxBitmap SetNozzleBmpColor(const wxBitmap &bmp, const std::string &color_str)
Definition wgtDeviceNozzleRack.cpp:72

References create_scaled_bitmap(), m_filament_color, m_is_selected, m_nozzle_empty_image, m_nozzle_error_image, m_nozzle_icon, m_nozzle_normal_image, m_nozzle_selected_bitmap, m_nozzle_selected_image, m_nozzle_status_icon, m_nozzle_unknown_image, m_status, NOZZLE_EMPTY, NOZZLE_ERROR, NOZZLE_NORMAL, NOZZLE_UNKNOWN, and Slic3r::GUI::SetNozzleBmpColor().

Here is the call graph for this function:

◆ SetBackgroundColor()

◆ SetBackgroundColor2()

void StaticBox::SetBackgroundColor2 ( StateColor const & color)
inherited
116{
117 background_color2 = color;
118 state_handler.update_binds();
119 Refresh();
120}

References background_color2, and state_handler.

◆ SetBackgroundColorNormal()

void StaticBox::SetBackgroundColorNormal ( wxColor const & color)
inherited
110{
111 background_color.setColorForStates(color, 0);
112 Refresh();
113}

References background_color.

Referenced by Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), and Slic3r::GUI::HotEndTable::CreateNozzleBox().

Here is the caller graph for this function:

◆ SetBorderColor()

◆ SetBorderColorNormal()

void StaticBox::SetBorderColorNormal ( wxColor const & color)
inherited
97{
98 border_color.setColorForStates(color, 0);
99 Refresh();
100}

References border_color.

Referenced by Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), and Slic3r::GUI::HotEndTable::CreateNozzleBox().

Here is the caller graph for this function:

◆ SetBorderStyle()

void StaticBox::SetBorderStyle ( wxPenStyle style)
inherited
76{
78 Refresh();
79}

References border_style, and style.

◆ SetBorderWidth()

void StaticBox::SetBorderWidth ( int width)
inherited
82{
84 Refresh();
85}
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184

References border_width.

Referenced by MultiSwitchButton::MultiSwitchButton(), Slic3r::GUI::KBShortcutsDialog::create_page(), and Button::SetStyle().

Here is the caller graph for this function:

◆ SetCornerRadius()

◆ SetDisable()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::SetDisable ( bool disabled)
1038{
1039 if (m_is_disabled == disabled) {
1040 return;
1041 }
1042
1044
1045 auto bg_clr = disabled ? StateColor::darkModeColorFor("#E5E7EB") : StateColor::darkModeColorFor(*wxWHITE);
1046 m_nozzle_icon->SetBackgroundColour(bg_clr);
1047 m_nozzle_label_id->SetBackgroundColour(bg_clr);
1048 m_nozzle_label_1->SetBackgroundColour(bg_clr);
1049 m_nozzle_status_icon->SetBackgroundColour(bg_clr);
1050 m_nozzle_label_2->SetBackgroundColour(bg_clr);
1051 m_nozzle_selected_bitmap->SetBackgroundColour(bg_clr);
1052
1053 SetBackgroundColor(bg_clr);
1054 Refresh();
1055};
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
@ disabled
Definition GLGizmoEmboss.cpp:223

References StateColor::darkModeColorFor(), m_is_disabled, m_nozzle_icon, m_nozzle_label_1, m_nozzle_label_2, m_nozzle_label_id, m_nozzle_selected_bitmap, m_nozzle_status_icon, and StaticBox::SetBackgroundColor().

Referenced by Slic3r::GUI::s_enable_item_if_match().

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

◆ SetDisplayIdText()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::SetDisplayIdText ( const wxString & text)
inline
213{ m_nozzle_label_id->SetLabel(text);};

References m_nozzle_label_id.

◆ SetNozzleStatus()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::SetNozzleStatus ( NOZZLE_STATUS status,
const wxString & str1,
const wxString & str2,
const std::string & color )
private
884{
885 if (m_status != status || m_filament_color != color)
886 {
887 m_status = status;
888 m_filament_color = color;
889 switch (status)
890 {
892 {
893 if (!m_nozzle_empty_image) { m_nozzle_empty_image = new ScalableBitmap(this, "dev_rack_nozzle_empty", 46);}
894 m_nozzle_icon->SetBitmap(m_nozzle_empty_image->bmp());
895 break;
896 }
898 {
899 if (!m_nozzle_normal_image) { m_nozzle_normal_image = new ScalableBitmap(this, "dev_rack_nozzle_normal", 46);}
901 break;
902 }
904 {
905 if (!m_nozzle_unknown_image) { m_nozzle_unknown_image = new ScalableBitmap(this, "dev_rack_nozzle_unknown", 46);}
906 m_nozzle_icon->SetBitmap(m_nozzle_unknown_image->bmp());
907 break;
908 }
910 {
911 if (!m_nozzle_error_image) { m_nozzle_error_image = new ScalableBitmap(this, "dev_rack_nozzle_error", 46);}
912 m_nozzle_icon->SetBitmap(m_nozzle_error_image->bmp());
913 break;
914 }
915 default:
916 {
917 break;
918 }
919 }
920
922 {
924 m_nozzle_status_icon->Show(true);
925 }
926 else
927 {
928 m_nozzle_label_1->SetForegroundColour(StateColor::darkModeColorFor(*wxBLACK));
929 m_nozzle_status_icon->Show(false);
930 }
931 }
932
933 bool update_layout = (m_nozzle_label_1->GetLabel() != str1 || m_nozzle_label_2->GetLabel() != str2);
934 m_nozzle_label_1->SetLabel(str1);
935 m_nozzle_label_2->SetLabel(str2);
936
937 if (update_layout) {
938 Layout();
939 }
940}
static wxColour s_red_clr("#D01B1B")

References StateColor::darkModeColorFor(), m_filament_color, m_nozzle_empty_image, m_nozzle_error_image, m_nozzle_icon, m_nozzle_label_1, m_nozzle_label_2, m_nozzle_normal_image, m_nozzle_status_icon, m_nozzle_unknown_image, m_status, NOZZLE_EMPTY, NOZZLE_ERROR, NOZZLE_NORMAL, NOZZLE_UNKNOWN, s_red_clr(), and Slic3r::GUI::SetNozzleBmpColor().

Referenced by UpdateInfo().

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

◆ SetSelected()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::SetSelected ( bool selected)
836{
837 if (!m_enable_select){
838 assert(false && "not support select");
839 return;
840 }
841
842 if (m_is_selected != selected) {
843 m_is_selected = selected;
844 if (selected) {
846 m_nozzle_selected_image = new ScalableBitmap(this, "dev_rack_nozzle_selected", 20);
847 }
848
851 } else {
852 m_nozzle_selected_bitmap->SetBitmap(wxNullBitmap);
854 }
855
856 Refresh();
857 }
858}
void SetBorderColor(StateColor const &color)
Definition StaticBox.cpp:87
static wxColour s_hgreen_clr("#009688")
static wxColour s_gray_clr("#B0B0B0")

References StateColor::darkModeColorFor(), m_enable_select, m_is_selected, m_nozzle_selected_bitmap, m_nozzle_selected_image, s_gray_clr(), s_hgreen_clr(), and StaticBox::SetBorderColor().

Referenced by OnItemSelected().

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

◆ SetTopMargin()

void StaticBox::SetTopMargin ( int margin)
inherited
70{
71 this->top_margin = margin;
72 Refresh();
73}

References top_margin.

Referenced by Slic3r::GUI::ExtruderGroup::ExtruderGroup().

Here is the caller graph for this function:

◆ ShowBadge()

void StaticBox::ShowBadge ( bool show)
inherited
142{
143 if (show && badge.name() != "badge") {
144 badge = ScalableBitmap(this, "badge", 18);
145 Refresh();
146 } else if (!show && !badge.name().empty()) {
147 badge = ScalableBitmap {};
148 Refresh();
149 }
150}

References badge.

Referenced by Slic3r::GUI::ExtruderGroup::ExtruderGroup().

Here is the caller graph for this function:

◆ sizeEvent()

void StaticBox::sizeEvent ( wxSizeEvent & evt)
protectedinherited
164{
165 Refresh();
166 evt.Skip();
167}

◆ UpdateInfo()

void Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::UpdateInfo ( const std::shared_ptr< DevNozzleRack > rack,
bool on_rack = true )
861{
862 m_rack = rack;
863
864 if (rack) {
865 const auto &nozzle_info = on_rack ? rack->GetNozzle(m_nozzle_id) : rack->GetNozzleSystem()->GetExtNozzle(m_nozzle_id);
866 const wxString &diameter_str = nozzle_info.GetNozzleDiameterStr();
867 const wxString &flowtype_str = nozzle_info.GetNozzleFlowTypeStr();
868 const std::string &color = nozzle_info.GetFilamentColor();
869
870 /*check empty first*/
871 if (nozzle_info.IsEmpty()) {
872 SetNozzleStatus(NOZZLE_STATUS::NOZZLE_EMPTY, _L("Empty"), wxEmptyString, color);
873 } else if (nozzle_info.IsNormal()) {
874 SetNozzleStatus(NOZZLE_STATUS::NOZZLE_NORMAL, diameter_str, flowtype_str, color);
875 } else if (nozzle_info.IsAbnormal()) {
876 SetNozzleStatus(NOZZLE_STATUS::NOZZLE_ERROR, _L("Error"), wxEmptyString, color);
877 } else if (nozzle_info.IsUnknown()) {
878 SetNozzleStatus(NOZZLE_STATUS::NOZZLE_UNKNOWN, _L("Unknown"), wxEmptyString, color);
879 }
880 }
881}
void SetNozzleStatus(NOZZLE_STATUS status, const wxString &str1, const wxString &str2, const std::string &color)
Definition wgtDeviceNozzleRack.cpp:883

References _L, m_nozzle_id, m_rack, NOZZLE_EMPTY, NOZZLE_ERROR, NOZZLE_NORMAL, NOZZLE_UNKNOWN, and SetNozzleStatus().

Referenced by Slic3r::GUI::s_update_nozzle_info().

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

Member Data Documentation

◆ background_color

◆ background_color2

StateColor StaticBox::background_color2
protectedinherited

◆ badge

ScalableBitmap StaticBox::badge
protectedinherited

Referenced by doRender(), and ShowBadge().

◆ border_color

◆ border_style

wxPenStyle StaticBox::border_style = wxPENSTYLE_SOLID
protectedinherited

Referenced by doRender(), and SetBorderStyle().

◆ border_width

◆ m_enable_select

bool Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_enable_select = false
private

◆ m_filament_color

std::string Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_filament_color
private

Referenced by Rescale(), and SetNozzleStatus().

◆ m_is_disabled

bool Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_is_disabled = false
private

◆ m_is_selected

bool Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_is_selected = false
private

Referenced by IsSelected(), Rescale(), and SetSelected().

◆ m_nozzle_empty_image

ScalableBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_empty_image { nullptr }
private
250{ nullptr };

Referenced by CreateGui(), Rescale(), and SetNozzleStatus().

◆ m_nozzle_error_image

ScalableBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_error_image { nullptr }
private
252{ nullptr };

Referenced by Rescale(), and SetNozzleStatus().

◆ m_nozzle_icon

wxStaticBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_icon { nullptr }
private
255{ nullptr };

Referenced by CreateGui(), EnableSelect(), Rescale(), SetDisable(), and SetNozzleStatus().

◆ m_nozzle_id

int Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_id
private

◆ m_nozzle_label_1

Label* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_label_1 { nullptr }
private
257{ nullptr };

Referenced by CreateGui(), EnableSelect(), SetDisable(), and SetNozzleStatus().

◆ m_nozzle_label_2

Label* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_label_2 { nullptr }
private
259{ nullptr };

Referenced by CreateGui(), EnableSelect(), SetDisable(), and SetNozzleStatus().

◆ m_nozzle_label_id

Label* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_label_id { nullptr }
private
256{ nullptr };

Referenced by CreateGui(), EnableSelect(), SetDisable(), and SetDisplayIdText().

◆ m_nozzle_normal_image

ScalableBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_normal_image { nullptr }
private
249{ nullptr };

Referenced by Rescale(), and SetNozzleStatus().

◆ m_nozzle_selected_bitmap

wxStaticBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_selected_bitmap { nullptr }
private
243{ nullptr };

Referenced by CreateGui(), Rescale(), SetDisable(), and SetSelected().

◆ m_nozzle_selected_image

ScalableBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_selected_image { nullptr }
private
242{ nullptr };

Referenced by Rescale(), and SetSelected().

◆ m_nozzle_status_icon

wxStaticBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_status_icon = nullptr
private

◆ m_nozzle_unknown_image

ScalableBitmap* Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_nozzle_unknown_image { nullptr }
private
251{ nullptr };

Referenced by Rescale(), and SetNozzleStatus().

◆ m_rack

std::weak_ptr<DevNozzleRack> Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_rack
private

Referenced by OnBtnNozzleStatus(), and UpdateInfo().

◆ m_status

NOZZLE_STATUS Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::m_status = NOZZLE_STATUS::NOZZLE_EMPTY
private

◆ radius

◆ state_handler

◆ top_margin

int StaticBox::top_margin = 0
protectedinherited

Referenced by doRender(), and SetTopMargin().


The documentation for this class was generated from the following files: