OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::ExtruderGroup Struct Reference
Inheritance diagram for Slic3r::GUI::ExtruderGroup:
Collaboration diagram for Slic3r::GUI::ExtruderGroup:

Classes

struct  NozzleRow

Public Member Functions

 ExtruderGroup (wxWindow *parent, int index, wxString const &title)
void SetNozzleRowCount (size_t count)
size_t NozzleRowCount () const
void SetRowDiameters (const std::vector< double > &diameters)
NozzleRow create_nozzle_row ()
void update_row_widths ()
void set_ams_count (int n4, int n1)
void update_ams ()
void SetTitle (const wxString &title)
void SetCount (int count)
void SetEditEnabled (bool enable)
void SetOnHoverClick (std::function< void()> on_click)
void sync_ams (MachineObject const *obj, std::vector< DevAms * > const &ams4, std::vector< DevAms * > const &ams1)
void Rescale ()
void sys_color_changed ()
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)

Public Attributes

wxBoxSizer * sizer = nullptr
HoverLabel * hover_label = nullptr
wxStaticText * ams_label {nullptr}
ScalableButton * btn_edit = nullptr
ComboBox * combo_diameter = nullptr
AMSPreview * ams [4] = {nullptr}
wxStaticText * ams_not_installed_msg {nullptr}
ScalableButton * btn_up {nullptr}
ScalableButton * btn_down {nullptr}
wxBoxSizer * hsizer_ams { nullptr }
size_t page_cur {0}
size_t page_num {3}
size_t ams_n4 = 0
size_t ams_n1 = 0
std::vector< AMSinfo > ams_4
std::vector< AMSinfo > ams_1
wxString diameter
std::vector< NozzleRow > rows
size_t nozzle_row_count = 0
wxBoxSizer * row_columns [2] = {}
int group_index = -1

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

Detailed Description

Constructor & Destructor Documentation

◆ ExtruderGroup()

Slic3r::GUI::ExtruderGroup::ExtruderGroup ( wxWindow * parent,
int index,
wxString const & title )
1531 : StaticBox(parent), group_index(index)
1532{
1533 SetFont(Label::Body_10);
1534 SetForegroundColour(wxColour("#CECECE"));
1535 SetBorderColor(wxColour("#EEEEEE"));
1536 SetCornerRadius(FromDIP(PRINTER_PANEL_RADIUS)); // ORCA match radius with other boxes
1537 ShowBadge(true);
1538 SetTopMargin(FromDIP(7)); // ORCA
1539
1540 // The title lives in an interactive row inside the card (with the nozzle-count badge and its edit button)
1541 hover_label = new HoverLabel(this, title);
1542 hover_label->SetPosition(wxPoint(FromDIP(PRINTER_PANEL_RADIUS), 0)); // position it without putting in a sizer so it will look like title
1543
1544 // Nozzle. Only the dual left/right cards show this combo: it is how they ask which nozzle the
1545 // project should print with. Every other card reads the diameter out as text.
1546 auto combo_diameter = new ComboBox(this, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
1548 combo_diameter->SetToolTip(_L("Diameter"));
1549 combo_diameter->Show(index >= 0);
1551
1552 // AMS
1553 auto ams_panel = new wxPanel(this, wxID_ANY);
1554 ams_panel->SetBackgroundColour(*wxWHITE);
1555
1556 ams_label = new wxStaticText(ams_panel, wxID_ANY, _L("AMS"));
1557 ams_label->SetFont(Label::Body_13);
1558 ams_label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
1559
1560 // AMS not installed message
1561 ams_not_installed_msg = new wxStaticText(ams_panel, wxID_ANY, _L("Not installed"));
1563 ams_not_installed_msg->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#6B6B6B")));
1564
1565 if (index >= 0) {
1566 btn_edit = new ScalableButton(ams_panel, wxID_ANY, "edit");
1567 btn_edit->SetMinSize(ams_label->GetSize());
1568 btn_edit->SetBackgroundColour(extruder_group_chip_bg());
1569 btn_edit->Hide();
1570 btn_edit->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index, combo_diameter](auto &evt) {
1571 PopupWindow *window = new AMSCountPopupWindow(this, index);
1572 auto size = GetSize();
1573 auto pos = ClientToScreen({0, size.y - FromDIP(8) - combo_diameter->GetSize().y});
1574 size.SetWidth(size.GetWidth() + FromDIP(10));
1575 window->Position(pos, {0, 0});
1576 window->Popup();
1577 });
1578
1579 auto hovered = std::make_shared<wxWindow *>();
1580 for (wxWindow *w : std::initializer_list<wxWindow *>{this, btn_edit, ams_not_installed_msg, ams_label, ams_panel}) {
1581 // ORCA using CallAfter fixes crash on linux while clicking edit button
1582 w->Bind(wxEVT_ENTER_WINDOW, [w, hovered, this](wxMouseEvent &evt) {
1583 *hovered = w;
1584 this->CallAfter([this]() {
1585 btn_edit->Show();
1586 ams_label->Hide();
1587 hsizer_ams->Layout();
1588 });
1589 });
1590 w->Bind(wxEVT_LEAVE_WINDOW, [w, hovered, this](wxMouseEvent &evt) {
1591 if (*hovered == w) {
1592 *hovered = nullptr;
1593 this->CallAfter([this]() {
1594 btn_edit->Hide();
1595 ams_label->Show();
1596 hsizer_ams->Layout();
1597 });
1598 }
1599 });
1600 }
1601 }
1602
1603 // AMS group
1604 for (size_t i = 0; i < 4; ++i) {
1605 ams[i] = new AMSPreview(ams_panel, wxID_ANY, AMSinfo(), AMSModel::GENERIC_AMS);
1606 ams[i]->Close();
1607 }
1608
1609 hsizer_ams = new wxBoxSizer(wxHORIZONTAL);
1610 hsizer_ams->SetMinSize(0, ams[0]->GetMinHeight());
1611 hsizer_ams->Add(ams_label, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(5));
1612 if (btn_edit)
1613 hsizer_ams->Add(btn_edit, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(5));
1614 hsizer_ams->Add(ams_not_installed_msg, 1, wxALIGN_CENTER);
1615
1616 ams_panel->SetSizer(hsizer_ams);
1617
1618 btn_up = new ScalableButton(ams_panel, wxID_ANY, "page_up", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14);
1619 btn_up->SetBackgroundColour(*wxWHITE);
1620 btn_up->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &evt) {
1621 if (page_cur > 0)
1622 --page_cur;
1623 update_ams();
1624 });
1625 btn_up->Hide();
1626 btn_down = new ScalableButton(ams_panel, wxID_ANY, "page_down", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14);
1627 btn_down->SetBackgroundColour(*wxWHITE);
1628 btn_down->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &evt) {
1629 if (page_cur + 1 < page_num)
1630 ++page_cur;
1631 update_ams();
1632 });
1633 btn_down->Hide();
1634
1635 wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL);
1636
1637 vsizer->AddSpacer(FromDIP(16)); // spacing for title and control
1638 if (index < 0) {
1639 ams_panel->Hide();
1640 } else {
1641 vsizer->Add(ams_panel, 0, wxEXPAND | wxLEFT | wxRIGHT , FromDIP(5));
1642 vsizer->AddSpacer(FromDIP(2));
1643 }
1644
1645 // Nozzle rows. The first one is the only one for a printer whose nozzles are not listed
1646 // individually; a multi-extruder printer grows one row per tool (see SetNozzleRowCount).
1647 // The rows are dealt into two columns, which halves the height of a long tool list; the second
1648 // column empties itself when there is a single row, so a one-row card still spans the width.
1649 auto rows_sizer = new wxBoxSizer(wxHORIZONTAL);
1650 for (wxBoxSizer *&column : row_columns) {
1651 column = new wxBoxSizer(wxVERTICAL);
1652 rows_sizer->Add(column, 1, wxEXPAND | wxLEFT , FromDIP(5));
1653 }
1654 vsizer->Add(rows_sizer, 0, wxEXPAND | wxRIGHT, FromDIP(5));
1655 sizer = vsizer; // the floating filament-switch icon positions itself against this card
1656 SetSizer(vsizer);
1658
1659 Layout();
1660
1661 AMSCountPopupWindow::UpdateAMSCount(index < 0 ? 0 : index, this);
1662}
#define _L(s)
Definition OBJ.cpp:34
#define PRINTER_PANEL_RADIUS
Definition Plater.cpp:363
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static wxFont Body_13
Definition Label.hpp:54
static wxFont Body_10
Definition Label.hpp:56
static void UpdateAMSCount(int index, ExtruderGroup *extruder)
Definition Plater.cpp:1514
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
void SetCornerRadius(double radius)
Definition StaticBox.cpp:62
void ShowBadge(bool show)
Definition StaticBox.cpp:141
StaticBox()
Definition StaticBox.cpp:33
void SetBorderColor(StateColor const &color)
Definition StaticBox.cpp:87
void SetTopMargin(int margin)
Definition StaticBox.cpp:69
wxMouseEvent
Definition CameraPopup.cpp:47
static void use_nozzle_row_font(ComboBox *combo)
Definition Plater.cpp:739
@ GENERIC_AMS
Definition AMSItem.hpp:59
static wxColour extruder_group_chip_bg()
Definition Plater.cpp:609
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
@ hovered
Definition GLGizmoEmboss.cpp:223
int group_index
Definition Plater.cpp:800
size_t page_cur
Definition Plater.cpp:789
size_t page_num
Definition Plater.cpp:790
void update_ams()
Definition Plater.cpp:1775
void SetNozzleRowCount(size_t count)
Definition Plater.cpp:1741
wxBoxSizer * sizer
Definition Plater.cpp:779
wxStaticText * ams_label
Definition Plater.cpp:781
ComboBox * combo_diameter
Definition Plater.cpp:783
AMSPreview * ams[4]
Definition Plater.cpp:784
HoverLabel * hover_label
Definition Plater.cpp:780
ScalableButton * btn_edit
Definition Plater.cpp:782
wxBoxSizer * hsizer_ams
Definition Plater.cpp:788
wxBoxSizer * row_columns[2]
Definition Plater.cpp:799
ScalableButton * btn_down
Definition Plater.cpp:787
wxStaticText * ams_not_installed_msg
Definition Plater.cpp:785
ScalableButton * btn_up
Definition Plater.cpp:786

References StaticBox::StaticBox(), _L, ams, ams_label, ams_not_installed_msg, Label::Body_10, Label::Body_13, btn_down, btn_edit, btn_up, combo_diameter, StateColor::darkModeColorFor(), Slic3r::GUI::extruder_group_chip_bg(), Slic3r::GUI::GENERIC_AMS, group_index, hover_label, hsizer_ams, page_cur, page_num, PRINTER_PANEL_RADIUS, row_columns, StaticBox::SetBorderColor(), StaticBox::SetCornerRadius(), SetNozzleRowCount(), StaticBox::SetTopMargin(), StaticBox::ShowBadge(), sizer, update_ams(), Slic3r::GUI::AMSCountPopupWindow::UpdateAMSCount(), Slic3r::GUI::use_nozzle_row_font(), Slic3r::GUI::wxMouseEvent, and wxStaticText.

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:

◆ create_nozzle_row()

ExtruderGroup::NozzleRow Slic3r::GUI::ExtruderGroup::create_nozzle_row ( )
1665{
1666 const size_t row_index = rows.size();
1667 NozzleRow row;
1668
1669 row.prefix = new Label(this, NozzleRow::prefix_font());
1670 row.prefix->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
1671 row.prefix->SetLabelText(wxString::Format("T%d", int(row_index) + 1));
1672 row.prefix->Hide();
1673
1674 row.diameter_label = new Label(this, NozzleRow::diameter_font());
1675 row.diameter_label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
1676 row.diameter_label->Hide();
1677
1678 auto combo_flow = new ComboBox(this, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
1679 combo_flow->GetDropDown().SetUseContentWidth(true);
1680 combo_flow->Bind(wxEVT_COMBOBOX, [this, row_index, combo_flow](wxCommandEvent &evt) {
1681 // A one-row card edits the extruder it was created for, a multi-row card one extruder per row.
1682 const int index = nozzle_row_count > 1 ? int(row_index) : group_index;
1683 auto printer_tab = dynamic_cast<TabPrinter *>(wxGetApp().get_tab(Preset::TYPE_PRINTER));
1684 NozzleVolumeType volume_type = NozzleVolumeType(intptr_t(combo_flow->GetClientData(evt.GetInt())));
1685 printer_tab->set_extruder_volume_type(index, volume_type);
1686 auto plater = GUI::wxGetApp().plater();
1687 if (plater) {
1688 // A new Flow type invalidates the per-filament volume choices stored on the
1689 // plates for this extruder; rewrite them so the next apply/grouping sees the
1690 // selected volume instead of a stale one.
1691 plater->update_filament_volume_map(index, static_cast<int>(volume_type));
1693 }
1694 });
1695 combo_flow->SetToolTip(_L_CONTEXT("Flow", "Nozzle Flow"));
1696 row.flow = combo_flow;
1697 use_nozzle_row_font(combo_flow);
1698
1699 auto row_sizer = new wxBoxSizer(wxHORIZONTAL);
1700 row_sizer->Add(row.prefix, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(3));
1701 if (row_index == 0)
1702 row_sizer->Add(combo_diameter, 1, wxRIGHT, FromDIP(5));
1703 row_sizer->Add(row.diameter_label, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(5));
1704 row_sizer->Add(row.flow, 1);
1705 // Row-major: T1 T2 on the first line, T3 T4 on the second, and so on.
1706 row_columns[row_index % 2]->Add(row_sizer, 0, wxEXPAND | wxBOTTOM, FromDIP(5));
1707
1708 return row;
1709}
void update_filament_volume_map(int extruder_id, int volume_type)
Definition Plater.cpp:23766
void update_machine_sync_status()
Definition Plater.cpp:23750
@ TYPE_PRINTER
Definition Preset.hpp:250
static Plater * plater()
Definition GUI_Factories.cpp:400
NozzleVolumeType
Definition PrintConfig.hpp:618
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15
Definition Plater.cpp:768
static wxFont prefix_font()
Definition Plater.cpp:770
Label * prefix
Definition Plater.cpp:773
static wxFont diameter_font()
Definition Plater.cpp:771
std::vector< NozzleRow > rows
Definition Plater.cpp:797
size_t nozzle_row_count
Definition Plater.cpp:798

References _L_CONTEXT, combo_diameter, StateColor::darkModeColorFor(), Slic3r::GUI::ExtruderGroup::NozzleRow::diameter_font(), Slic3r::GUI::ExtruderGroup::NozzleRow::diameter_label, Slic3r::GUI::ExtruderGroup::NozzleRow::flow, group_index, nozzle_row_count, Slic3r::GUI::plater(), Slic3r::GUI::ExtruderGroup::NozzleRow::prefix, Slic3r::GUI::ExtruderGroup::NozzleRow::prefix_font(), row_columns, rows, Slic3r::Preset::TYPE_PRINTER, and Slic3r::GUI::use_nozzle_row_font().

Referenced by SetNozzleRowCount().

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:

◆ 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}

◆ 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:

◆ NozzleRowCount()

size_t Slic3r::GUI::ExtruderGroup::NozzleRowCount ( ) const
inline
804{ return nozzle_row_count; }

References nozzle_row_count.

◆ 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::ExtruderGroup::Rescale ( )
inline
834 {
835 if (hover_label)
836 hover_label->Rescale();
837 if (btn_edit){
838 btn_edit->msw_rescale();
839 btn_edit->SetMinSize(ams_label->GetSize());
840 }
841 btn_up->msw_rescale();
842 btn_down->msw_rescale();
843 combo_diameter->Rescale();
844 for (const NozzleRow &row : rows) {
845 row.prefix->SetFont(NozzleRow::prefix_font());
846 row.diameter_label->SetFont(NozzleRow::diameter_font());
847 row.flow->Rescale();
848 }
850 for (int i = 0; i < 4; ++i)
851 ams[i]->msw_rescale();
852 }
void update_row_widths()
Definition Plater.cpp:1711

References ams, ams_label, btn_down, btn_edit, btn_up, combo_diameter, Slic3r::GUI::ExtruderGroup::NozzleRow::diameter_font(), hover_label, Slic3r::GUI::ExtruderGroup::NozzleRow::prefix_font(), rows, and update_row_widths().

Here is the call graph for this function:

◆ set_ams_count()

void Slic3r::GUI::ExtruderGroup::set_ams_count ( int n4,
int n1 )
inline
815 {
816 if (n4 == ams_n4 && n1 == ams_n1)
817 return;
818 ams_n4 = n4;
819 ams_n1 = n1;
820 if (btn_edit) {
821 update_ams();
822 }
823 }
size_t ams_n4
Definition Plater.cpp:791
size_t ams_n1
Definition Plater.cpp:792

References ams_n1, ams_n4, btn_edit, and update_ams().

Referenced by Slic3r::GUI::AMSCountPopupWindow::UpdateAMSCount().

Here is the call graph for this function:
Here is the caller 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()

◆ SetCount()

void Slic3r::GUI::ExtruderGroup::SetCount ( int count)
inline
827{ if (hover_label) hover_label->SetCount(count); }
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246

References count, and hover_label.

◆ SetEditEnabled()

void Slic3r::GUI::ExtruderGroup::SetEditEnabled ( bool enable)
inline
828{ if (hover_label) hover_label->EnableEdit(enable); }

References hover_label.

◆ SetNozzleRowCount()

void Slic3r::GUI::ExtruderGroup::SetNozzleRowCount ( size_t count)
1742{
1743 const size_t row_count = std::min(count, size_t(MAXIMUM_EXTRUDER_NUMBER));
1744 if (row_count == nozzle_row_count)
1745 return;
1746 nozzle_row_count = row_count;
1747
1748 // Every row names its tool as soon as there is more than one, so a single-nozzle card keeps the
1749 // plain "Nozzle" look. A row is shown by showing its widgets: a sizer item holding a sub-sizer
1750 // reports itself as shown while any of its windows is, so hiding the sub-sizer alone would
1751 // leave the row in the layout.
1752 for (size_t i = 0; i < row_count; ++i) {
1753 if (i >= rows.size())
1754 rows.push_back(create_nozzle_row());
1755 rows[i].prefix->Show(row_count > 1);
1756 rows[i].diameter_label->Show(group_index < 0); // the dual left/right cards show combo_diameter
1757 // The flow combo's own visibility is decided with its choices, see update_extruder_variant.
1758 }
1759 for (size_t i = row_count; i < rows.size(); ++i) {
1760 rows[i].prefix->Hide();
1761 rows[i].diameter_label->Hide();
1762 rows[i].flow->Hide();
1763 }
1764
1765 // The rows just changed: re-measure them, then let the card and its containers give it the new room.
1767 Layout();
1768 if (wxWindow *parent = GetParent()) {
1769 parent->Layout();
1770 if (wxWindow *grand_parent = parent->GetParent())
1771 grand_parent->Layout();
1772 }
1773}
static constexpr size_t MAXIMUM_EXTRUDER_NUMBER
Definition libslic3r.h:70
NozzleRow create_nozzle_row()
Definition Plater.cpp:1664

References count, create_nozzle_row(), group_index, MAXIMUM_EXTRUDER_NUMBER, nozzle_row_count, rows, and update_row_widths().

Referenced by ExtruderGroup().

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

◆ SetOnHoverClick()

void Slic3r::GUI::ExtruderGroup::SetOnHoverClick ( std::function< void()> on_click)
inline
829{ if (hover_label) hover_label->SetOnHoverClick(std::move(on_click)); }

References hover_label.

◆ SetRowDiameters()

void Slic3r::GUI::ExtruderGroup::SetRowDiameters ( const std::vector< double > & diameters)
1730{
1731 for (size_t i = 0; i < std::min(nozzle_row_count, diameters.size()); ++i) {
1732 // Spelled like the calibration dialogs spell a nozzle diameter, "0.4 mm".
1733 const wxString text = from_u8(get_diameter_string(diameters[i]));
1734 rows[i].diameter_label->SetLabelText(text);
1735 rows[i].diameter_label->SetToolTip(text + " mm");
1736 }
1738 Layout();
1739}
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
static std::string get_diameter_string(float diameter)
Definition Plater.cpp:366

References Slic3r::GUI::from_u8(), Slic3r::GUI::get_diameter_string(), nozzle_row_count, rows, and update_row_widths().

Here is the call graph for this function:

◆ SetTitle()

void Slic3r::GUI::ExtruderGroup::SetTitle ( const wxString & title)
1867{
1868 if (hover_label)
1869 hover_label->SetTitle(title);
1870}

References hover_label.

◆ 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}

◆ sync_ams()

void Slic3r::GUI::ExtruderGroup::sync_ams ( MachineObject const * obj,
std::vector< DevAms * > const & ams4,
std::vector< DevAms * > const & ams1 )
1846{
1847 if (ams_4.empty() && ams4.empty()
1848 && ams_1.empty() && ams1.empty())
1849 return;
1850 auto sync = [obj](std::vector<AMSinfo> &infos, std::vector<DevAms *> const &ams) -> bool {
1851 std::vector<AMSinfo> infos2;
1852 for (auto a : ams) {
1853 AMSinfo ams_info;
1854 ams_info.parse_ams_info(const_cast<MachineObject*>(obj), a, obj->GetFilaSystem()->IsDetectRemainEnabled(), obj->is_support_ams_humidity);
1855 infos2.push_back(ams_info);
1856 }
1857 if (infos == infos2)
1858 return false;
1859 infos.swap(infos2);
1860 return true;
1861 };
1862 if (sync(ams_4, ams4) || sync(ams_1, ams1))
1863 update_ams();
1864}
std::vector< AMSinfo > ams_4
Definition Plater.cpp:793
std::vector< AMSinfo > ams_1
Definition Plater.cpp:794

References ams, ams_1, ams_4, Slic3r::MachineObject::GetFilaSystem(), Slic3r::MachineObject::is_support_ams_humidity, Slic3r::GUI::AMSinfo::parse_ams_info(), and update_ams().

Here is the call graph for this function:

◆ sys_color_changed()

void Slic3r::GUI::ExtruderGroup::sys_color_changed ( )
inline
855 {
856 if (hover_label)
857 hover_label->sys_color_changed();
858 if (btn_edit)
859 btn_edit->SetBackgroundColour(extruder_group_chip_bg());
860 for (const NozzleRow &row : rows) {
861 row.prefix->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
862 row.diameter_label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
863 }
864 Refresh();
865 }

References btn_edit, StateColor::darkModeColorFor(), Slic3r::GUI::extruder_group_chip_bg(), hover_label, and rows.

Here is the call graph for this function:

◆ update_ams()

void Slic3r::GUI::ExtruderGroup::update_ams ( )
1776{
1777 static AMSinfo info4;
1778 static AMSinfo info1;
1779 if (info4.cans.empty()) {
1780 for (size_t i = 0; i < 4; ++i) info4.cans.push_back({});
1781 info1.ams_type = AMSModel::N3S_AMS;
1782 info1.cans.push_back({});
1783 }
1784
1785 if (btn_edit == nullptr)
1786 return;
1787
1788 page_num = (ams_n4 * 2 + ams_n1 + 3) / 4;
1789 size_t i4 = page_cur * 2;
1790 size_t i1 = 0;
1791 if (i4 > ams_n4) {
1792 i1 = (i4 - ams_n4) * 2;
1793 i4 = ams_n4;
1794 }
1795
1796 size_t left = 4;
1797 size_t index = 0;
1798 for (size_t i = i4; i < ams_n4 && left > 0; ++i, ++index, left -= 2) {
1799 ams[index]->UpdateInfo(i < ams_4.size() ? ams_4[i] : info4);
1800 ams[index]->Refresh();
1801 ams[index]->Open();
1802 }
1803 for (size_t i = i1; i < ams_n1 && left > 0; ++i, ++index, --left) {
1804 ams[index]->UpdateInfo(i < ams_1.size() ? ams_1[i] : info1);
1805 ams[index]->Refresh();
1806 ams[index]->Open();
1807 }
1808 for (; index < 4; ++index)
1809 ams[index]->Close();
1810
1811 ams_not_installed_msg->Show(ams_n4 == 0 && ams_n1 == 0);
1812 btn_up->Show(page_cur > 0);
1813 btn_down->Show(page_cur + 1 < page_num);
1814
1815 while (hsizer_ams->GetItemCount() > 2)
1816 hsizer_ams->Remove(2);
1817 if (ams_not_installed_msg->IsShown()) {
1818 hsizer_ams->AddStretchSpacer(1);
1819 hsizer_ams->Add(ams_not_installed_msg, 0, wxALIGN_CENTER);
1820 hsizer_ams->AddStretchSpacer(1);
1821 }
1822 for (size_t i = 0; i < 4; ++i) {
1823 if (ams[i]->IsShown())
1824 hsizer_ams->Add(this->ams[i], 0, wxLEFT, FromDIP(1));
1825 }
1826 if (btn_up->IsShown() || btn_down->IsShown()) {
1827 if (btn_edit)
1828 hsizer_ams->AddStretchSpacer(1);
1829 if (btn_up->IsShown() && btn_down->IsShown()) {
1830 auto vsizer_btn = new wxBoxSizer(wxVERTICAL);
1831 auto size = btn_up->GetSize();
1832 vsizer_btn->Add(btn_up, 0);
1833 vsizer_btn->Add(btn_down, 0);
1834 hsizer_ams->Add(vsizer_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
1835 } else if (btn_up->IsShown()) {
1836 hsizer_ams->Add(btn_up, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
1837 } else {
1838 hsizer_ams->Add(btn_down, 0, wxALIGN_CENTER | wxLEFT, FromDIP(2));
1839 }
1840 }
1841
1842 Layout();
1843}
@ N3S_AMS
Definition AMSItem.hpp:62
@ left
Definition MarchingSquares.hpp:188

References ams, ams_1, ams_4, ams_n1, ams_n4, ams_not_installed_msg, Slic3r::GUI::AMSinfo::ams_type, btn_down, btn_edit, btn_up, Slic3r::GUI::AMSinfo::cans, hsizer_ams, Slic3r::GUI::N3S_AMS, page_cur, and page_num.

Referenced by ExtruderGroup(), set_ams_count(), and sync_ams().

Here is the caller graph for this function:

◆ update_row_widths()

void Slic3r::GUI::ExtruderGroup::update_row_widths ( )
1712{
1713 // Measured from the rows on screen rather than fixed, so no gap is reserved for a "T10" or a
1714 // "0.25 mm" that no row carries while the flow combos of a column still line up.
1715 wxSize prefix_width(0, -1);
1716 wxSize diameter_width(0, -1);
1717 for (const NozzleRow &row : rows) {
1718 if (row.prefix->IsShown())
1719 prefix_width.x = std::max(prefix_width.x, row.prefix->GetTextExtent(row.prefix->GetLabelText()).x);
1720 if (row.diameter_label->IsShown())
1721 diameter_width.x = std::max(diameter_width.x, row.diameter_label->GetTextExtent(row.diameter_label->GetLabelText()).x);
1722 }
1723 for (const NozzleRow &row : rows) {
1724 row.prefix->SetMinSize(prefix_width);
1725 row.diameter_label->SetMinSize(diameter_width);
1726 }
1727}

References rows.

Referenced by Rescale(), SetNozzleRowCount(), and SetRowDiameters().

Here is the caller graph for this function:

Member Data Documentation

◆ ams

AMSPreview* Slic3r::GUI::ExtruderGroup::ams[4] = {nullptr}
784{nullptr};

Referenced by ExtruderGroup(), Rescale(), sync_ams(), and update_ams().

◆ ams_1

std::vector<AMSinfo> Slic3r::GUI::ExtruderGroup::ams_1

Referenced by sync_ams(), and update_ams().

◆ ams_4

std::vector<AMSinfo> Slic3r::GUI::ExtruderGroup::ams_4

Referenced by sync_ams(), and update_ams().

◆ ams_label

wxStaticText* Slic3r::GUI::ExtruderGroup::ams_label {nullptr}
781{nullptr};

Referenced by ExtruderGroup(), and Rescale().

◆ ams_n1

size_t Slic3r::GUI::ExtruderGroup::ams_n1 = 0

Referenced by set_ams_count(), and update_ams().

◆ ams_n4

size_t Slic3r::GUI::ExtruderGroup::ams_n4 = 0

Referenced by set_ams_count(), and update_ams().

◆ ams_not_installed_msg

wxStaticText* Slic3r::GUI::ExtruderGroup::ams_not_installed_msg {nullptr}
785{nullptr};

Referenced by ExtruderGroup(), and update_ams().

◆ 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

◆ btn_down

ScalableButton* Slic3r::GUI::ExtruderGroup::btn_down {nullptr}
787{nullptr};

Referenced by ExtruderGroup(), Rescale(), and update_ams().

◆ btn_edit

ScalableButton* Slic3r::GUI::ExtruderGroup::btn_edit = nullptr

◆ btn_up

ScalableButton* Slic3r::GUI::ExtruderGroup::btn_up {nullptr}
786{nullptr};

Referenced by ExtruderGroup(), Rescale(), and update_ams().

◆ combo_diameter

ComboBox* Slic3r::GUI::ExtruderGroup::combo_diameter = nullptr

◆ diameter

wxString Slic3r::GUI::ExtruderGroup::diameter

◆ group_index

int Slic3r::GUI::ExtruderGroup::group_index = -1

◆ hover_label

HoverLabel* Slic3r::GUI::ExtruderGroup::hover_label = nullptr

◆ hsizer_ams

wxBoxSizer* Slic3r::GUI::ExtruderGroup::hsizer_ams { nullptr }
788{ nullptr };

Referenced by ExtruderGroup(), and update_ams().

◆ nozzle_row_count

size_t Slic3r::GUI::ExtruderGroup::nozzle_row_count = 0

◆ page_cur

size_t Slic3r::GUI::ExtruderGroup::page_cur {0}
789{0};

Referenced by ExtruderGroup(), and update_ams().

◆ page_num

size_t Slic3r::GUI::ExtruderGroup::page_num {3}
790{3};

Referenced by ExtruderGroup(), and update_ams().

◆ radius

◆ row_columns

wxBoxSizer* Slic3r::GUI::ExtruderGroup::row_columns[2] = {}
799{}; // row i is dealt into column i % 2

Referenced by ExtruderGroup(), and create_nozzle_row().

◆ rows

std::vector<NozzleRow> Slic3r::GUI::ExtruderGroup::rows

◆ sizer

wxBoxSizer* Slic3r::GUI::ExtruderGroup::sizer = nullptr

Referenced by ExtruderGroup().

◆ state_handler

◆ top_margin

int StaticBox::top_margin = 0
protectedinherited

Referenced by doRender(), and SetTopMargin().


The documentation for this struct was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Plater.cpp