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

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

Inheritance diagram for Slic3r::GUI::HotEndTable:
Collaboration diagram for Slic3r::GUI::HotEndTable:

Classes

struct  HotEndAttr

Public Member Functions

 HotEndTable (wxWindow *parent)
void UpdateRackInfo (std::weak_ptr< DevNozzleRack > rack)
void MarkRelatedItems (const NozzleOption &option)
void UnMarkRelatedItems (const NozzleOption &option)

Private Member Functions

StaticBox * CreateNozzleBox (const std::vector< int > &nozzle_indices)
void UpdateNozzleItems (const std::unordered_map< int, wgtDeviceNozzleRackNozzleItem * > &nozzle_items, std::shared_ptr< DevNozzleRack > nozzle_rack)
std::vector< int > FilterHotEnds (const NozzleOption &option)
void OnPaint (wxPaintEvent &event)

Private Attributes

StaticBox * m_arow_nozzle_box { nullptr }
StaticBox * m_brow_nozzle_box { nullptr }
std::unordered_map< int, wgtDeviceNozzleRackNozzleItem * > m_nozzle_items
std::weak_ptr< DevNozzleRack > m_nozzle_rack

Detailed Description


Class Documentation

◆ Slic3r::GUI::HotEndTable::HotEndAttr

struct Slic3r::GUI::HotEndTable::HotEndAttr
Collaboration diagram for Slic3r::GUI::HotEndTable::HotEndAttr:
Class Members
string diameter
int extruder_id
NozzleVolumeType volume_type

Constructor & Destructor Documentation

◆ HotEndTable()

Slic3r::GUI::HotEndTable::HotEndTable ( wxWindow * parent)
513 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,wxBORDER_NONE)
514{
515 Bind(wxEVT_PAINT, &HotEndTable::OnPaint, this);
516 auto main_sizer = new wxBoxSizer(wxVERTICAL);
517 auto label = new Label(this, _L("Induction Hotend Rack"));
518 label->SetBackgroundColour("#F8F8F8");
519
522 main_sizer->Add(label, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, FromDIP(5));
523 main_sizer->Add(m_arow_nozzle_box, 0, wxLEFT | wxRIGHT, FromDIP(5));
524 main_sizer->Add(m_brow_nozzle_box, 0, wxLEFT | wxRIGHT, FromDIP(5));
525 SetBackgroundColour("#F8F8F8");
526
527 SetSizer(main_sizer);
528 Layout();
529 Fit();
530 wxGetApp().UpdateDarkUIWin(this);
531}
#define _L(s)
Definition OBJ.cpp:34
StaticBox * m_brow_nozzle_box
Definition MultiNozzleSync.hpp:132
StaticBox * m_arow_nozzle_box
Definition MultiNozzleSync.hpp:131
StaticBox * CreateNozzleBox(const std::vector< int > &nozzle_indices)
Definition MultiNozzleSync.cpp:631
void OnPaint(wxPaintEvent &event)
Definition MultiNozzleSync.cpp:659

References _L, CreateNozzleBox(), m_arow_nozzle_box, m_brow_nozzle_box, and OnPaint().

Here is the call graph for this function:

Member Function Documentation

◆ CreateNozzleBox()

StaticBox * Slic3r::GUI::HotEndTable::CreateNozzleBox ( const std::vector< int > & nozzle_indices)
private
632{
633 StaticBox* nozzle_box = new StaticBox(this);
634 nozzle_box->SetBackgroundColour("#F8F8F8");
635 nozzle_box->SetBorderColorNormal("#F8F8F8");
636 nozzle_box->SetCornerRadius(0);
637
638 wxSizer* h_sizer = new wxBoxSizer(wxHORIZONTAL);
639 for (auto idx : nozzle_indices) {
640 wgtDeviceNozzleRackNozzleItem* nozzle_item = new wgtDeviceNozzleRackNozzleItem(nozzle_box, idx);
641 nozzle_item->SetBackgroundColorNormal("#EEEEEE");
642 for (auto& child : nozzle_item->GetChildren())
643 child->SetBackgroundColour("#EEEEEE");
644 m_nozzle_items[idx] = nozzle_item;
645 h_sizer->Add(nozzle_item, 0, wxALL, FromDIP(8));
646 }
647
648 nozzle_box->SetSizer(h_sizer);
649
650 return nozzle_box;
651}
std::unordered_map< int, wgtDeviceNozzleRackNozzleItem * > m_nozzle_items
Definition MultiNozzleSync.hpp:133
void SetBorderColorNormal(wxColor const &color)
Definition StaticBox.cpp:96
void SetCornerRadius(double radius)
Definition StaticBox.cpp:62

References m_nozzle_items, StaticBox::SetBackgroundColorNormal(), StaticBox::SetBorderColorNormal(), and StaticBox::SetCornerRadius().

Referenced by HotEndTable().

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

◆ FilterHotEnds()

std::vector< int > Slic3r::GUI::HotEndTable::FilterHotEnds ( const NozzleOption & option)
private
543{
544 auto rack = m_nozzle_rack.lock();
545 if (!rack)
546 return {};
547
548 std::vector<HotEndAttr> nozzles_to_search;
549
550 for (auto& item : option.extruder_nozzle_stats) {
551 for (auto& nozzle : item.second) {
552 HotEndAttr info;
553 info.diameter = option.diameter;
554 info.extruder_id = item.first;
555 info.volume_type = nozzle.first;
556 nozzles_to_search.emplace_back(info);
557 }
558 }
559
560 std::vector<int> filtered_nozzles;
561
562 for (auto& info : nozzles_to_search) {
563
564 float diameter = atof(info.diameter.c_str());
565 NozzleFlowType flow = DevNozzle::ToNozzleFlowType(info.volume_type);
566 int extruder_id = 1 - info.extruder_id; //physical
567
568 auto nozzles = rack->GetNozzleSystem()->CollectNozzles(extruder_id, flow, diameter);
569
570 for (auto& nozzle : nozzles) {
571 if (nozzle.IsOnRack())
572 filtered_nozzles.emplace_back(nozzle.GetNozzleId());
573 }
574 }
575
576 return filtered_nozzles;
577}
std::weak_ptr< DevNozzleRack > m_nozzle_rack
Definition MultiNozzleSync.hpp:134
std::string diameter
Definition MultiNozzleSync.hpp:123
Definition MultiNozzleSync.hpp:122
NozzleFlowType
Definition DevDefs.h:116
static NozzleFlowType ToNozzleFlowType(const NozzleVolumeType &type)
Definition DevNozzleSystem.cpp:41

References Slic3r::GUI::HotEndTable::HotEndAttr::diameter, Slic3r::GUI::NozzleOption::diameter, Slic3r::GUI::HotEndTable::HotEndAttr::extruder_id, Slic3r::GUI::NozzleOption::extruder_nozzle_stats, m_nozzle_rack, Slic3r::DevNozzle::ToNozzleFlowType(), and Slic3r::GUI::HotEndTable::HotEndAttr::volume_type.

Referenced by MarkRelatedItems(), and UnMarkRelatedItems().

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

◆ MarkRelatedItems()

void Slic3r::GUI::HotEndTable::MarkRelatedItems ( const NozzleOption & option)
580{
581 const static StateColor bg_green(
582 std::pair<wxColour, int>(wxColour("#E5F0EE"), StateColor::Normal)
583 );
584
585 const static StateColor bd_green(
586 std::pair<wxColour, int>(wxColour("#009688"), StateColor::Normal)
587 );
588 auto filtered_nozzles = FilterHotEnds(option);
589 for (auto nozzle_id : filtered_nozzles) {
590 auto iter = m_nozzle_items.find(nozzle_id);
591 if (iter == m_nozzle_items.end())
592 continue;
593 auto& item = iter->second;
594 item->SetBackgroundColor(bg_green);
595 item->SetBorderColor(bd_green);
596 for (auto child : item->GetChildren()) {
597 child->SetBackgroundColour("#E5F0EE");
598 }
599 }
600 wxGetApp().UpdateDarkUIWin(this);
601}
std::vector< int > FilterHotEnds(const NozzleOption &option)
Definition MultiNozzleSync.cpp:542
@ Normal
Definition StateColor.hpp:16

References FilterHotEnds(), m_nozzle_items, and StateColor::Normal.

Here is the call graph for this function:

◆ OnPaint()

void Slic3r::GUI::HotEndTable::OnPaint ( wxPaintEvent & event)
private
660{
661 wxPaintDC dc(this);
662 wxSize size = GetClientSize();
663
664 dc.SetPen(wxPen(wxColour("#EEEEEE"), 2));
665 dc.SetBrush(*wxTRANSPARENT_BRUSH);
666 dc.DrawRoundedRectangle(0, 0, size.GetWidth()-2, size.GetHeight()-2, 5);
667}

Referenced by HotEndTable().

Here is the caller graph for this function:

◆ UnMarkRelatedItems()

void Slic3r::GUI::HotEndTable::UnMarkRelatedItems ( const NozzleOption & option)
604{
605 static const wxColour bg_color("#EEEEEE");
606 static const wxColour bd_color("#CECECE");
607 const static StateColor bg_green(
608 std::pair<wxColour, int>(bg_color, StateColor::Normal)
609 );
610
611 const static StateColor bd_green(
612 std::pair<wxColour, int>(bd_color, StateColor::Normal)
613 );
614 auto filtered_nozzles = FilterHotEnds(option);
615 for (auto nozzle_id : filtered_nozzles) {
616 auto iter = m_nozzle_items.find(nozzle_id);
617 if (iter == m_nozzle_items.end())
618 continue;
619 auto& item = iter->second;
620 item->SetBackgroundColor(bg_green);
621 item->SetBorderColor(bd_green);
622 for (auto child : item->GetChildren()) {
623 child->SetBackgroundColour(bg_color);
624 }
625 }
626 wxGetApp().UpdateDarkUIWin(this);
627}
wxColour bg_color()
Definition SpeedDialDialog.cpp:69

References FilterHotEnds(), m_nozzle_items, and StateColor::Normal.

Here is the call graph for this function:

◆ UpdateNozzleItems()

void Slic3r::GUI::HotEndTable::UpdateNozzleItems ( const std::unordered_map< int, wgtDeviceNozzleRackNozzleItem * > & nozzle_items,
std::shared_ptr< DevNozzleRack > nozzle_rack )
private
654{
655 for (auto& item : nozzle_items)
656 item.second->UpdateInfo(nozzle_rack);
657}

Referenced by UpdateRackInfo().

Here is the caller graph for this function:

◆ UpdateRackInfo()

void Slic3r::GUI::HotEndTable::UpdateRackInfo ( std::weak_ptr< DevNozzleRack > rack)
534{
535 m_nozzle_rack = rack;
536 const auto& nozzle_rack = rack.lock();
537 if (nozzle_rack) {
538 UpdateNozzleItems(m_nozzle_items, nozzle_rack);
539 }
540}
void UpdateNozzleItems(const std::unordered_map< int, wgtDeviceNozzleRackNozzleItem * > &nozzle_items, std::shared_ptr< DevNozzleRack > nozzle_rack)
Definition MultiNozzleSync.cpp:653

References m_nozzle_items, m_nozzle_rack, and UpdateNozzleItems().

Here is the call graph for this function:

Member Data Documentation

◆ m_arow_nozzle_box

StaticBox* Slic3r::GUI::HotEndTable::m_arow_nozzle_box { nullptr }
private
131{ nullptr };

Referenced by HotEndTable().

◆ m_brow_nozzle_box

StaticBox* Slic3r::GUI::HotEndTable::m_brow_nozzle_box { nullptr }
private
132{ nullptr };

Referenced by HotEndTable().

◆ m_nozzle_items

std::unordered_map<int, wgtDeviceNozzleRackNozzleItem*> Slic3r::GUI::HotEndTable::m_nozzle_items
private

◆ m_nozzle_rack

std::weak_ptr<DevNozzleRack> Slic3r::GUI::HotEndTable::m_nozzle_rack
private

Referenced by FilterHotEnds(), and UpdateRackInfo().


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