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

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

Inheritance diagram for Slic3r::GUI::FeedDirectionDialog:
Collaboration diagram for Slic3r::GUI::FeedDirectionDialog:

Public Member Functions

 FeedDirectionDialog (wxWindow *parent, const int extruderNum, const std::string &printer_type="")
std::optional< int > GetExtruderID ()
void SetExtruderMapping (MachineObject *obj, const std::string &currAmsId, const std::string &currSlotId, const std::vector< std::pair< std::string, std::string > > &extruderSlots)

Private Member Functions

void OnConfirm (wxCommandEvent &event)
void OnRadioClicked (wxCommandEvent &evt)

Static Private Member Functions

static wxString calcTrayName (MachineObject *obj, const std::string &amsID, const std::string &slotID)

Private Attributes

int m_extruder_num {}
std::string m_printer_type
wxString m_filament_id {}
wxRadioButton * m_radioHelper {nullptr}
wxRadioButton * m_leftRadio {nullptr}
wxRadioButton * m_rightRadio {nullptr}
wxRadioButton * m_lastChecked {nullptr}
DevExtruderImage * m_extruderImage {nullptr}
Button * m_confirmBtn {nullptr}
std::optional< int > m_load_extruder_id = std::nullopt

Detailed Description

Constructor & Destructor Documentation

◆ FeedDirectionDialog()

Slic3r::GUI::FeedDirectionDialog::FeedDirectionDialog ( wxWindow * parent,
const int extruderNum,
const std::string & printer_type = "" )
4002 : wxDialog(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize),
4003 m_extruder_num(extruderNum),
4004 m_printer_type(printer_type)
4005{
4006 SetBackgroundColour(wxColour("#FFFFFF"));
4007 SetMaxSize(wxSize(FromDIP(360), FromDIP(207)));
4008 SetMinSize(wxSize(FromDIP(360), FromDIP(207)));
4009 SetSize(wxSize(FromDIP(360), FromDIP(207)));
4010
4011 wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
4012
4013 wxGridSizer* topSizer = new wxGridSizer (1, 3, FromDIP(5), 0);
4014
4015 m_radioHelper = new wxRadioButton(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
4016 m_leftRadio = new wxRadioButton(this, wxID_ANY,
4018 m_rightRadio = new wxRadioButton(this, wxID_ANY,
4020 m_radioHelper->Show(false);
4021 m_radioHelper->SetCanFocus(false);
4022
4023 m_leftRadio->SetForegroundColour(*wxBLACK);
4024 m_rightRadio->SetForegroundColour(*wxBLACK);
4025
4026 topSizer->Add(m_leftRadio, 0, wxALIGN_CENTER | wxALL, FromDIP(20));
4027 m_extruderImage = new DevExtruderImage(this, wxID_ANY, m_extruder_num);
4028 topSizer->Add(m_extruderImage, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
4029 topSizer->Add(m_rightRadio, 0, wxALIGN_CENTER | wxALL, FromDIP(20));
4030
4031 mainSizer->AddStretchSpacer(1);
4032 mainSizer->Add(topSizer, 1, wxEXPAND);
4033 mainSizer->AddStretchSpacer(1);
4034
4035 wxBoxSizer* bottomSizer = new wxBoxSizer(wxHORIZONTAL);
4036 m_confirmBtn = new Button(this, _L("Confirm"));
4037 m_confirmBtn->SetSize(wxSize(FromDIP(80), FromDIP(32)));
4038 m_confirmBtn->Enable(false);
4040 bottomSizer->Add(m_confirmBtn, 0, wxALIGN_RIGHT);
4041
4042 mainSizer->Add(bottomSizer, 0, wxALIGN_RIGHT | wxBOTTOM | wxRIGHT, FromDIP(10));
4043
4044 SetSizer(mainSizer);
4045 Layout();
4046 Centre(wxBOTH);
4047
4049 m_confirmBtn->Bind(wxEVT_BUTTON, &FeedDirectionDialog::OnConfirm, this);
4050 m_leftRadio->Bind(wxEVT_RADIOBUTTON, &FeedDirectionDialog::OnRadioClicked, this);
4051 m_rightRadio->Bind(wxEVT_RADIOBUTTON, &FeedDirectionDialog::OnRadioClicked, this);
4052}
#define DEPUTY_EXTRUDER_ID
Definition DevDefs.h:102
#define MAIN_EXTRUDER_ID
Definition DevDefs.h:101
#define _L(s)
Definition OBJ.cpp:34
static wxFont Body_14
Definition Label.hpp:53
static std::string get_toolhead_display_name(const std::string &type_str, int ext_id, ToolHeadComponent component, ToolHeadNameCase name_case=ToolHeadNameCase::TitleCase, bool short_name=false)
Definition DevConfigUtil.cpp:379
DevExtruderImage * m_extruderImage
Definition AMSItem.hpp:993
void OnConfirm(wxCommandEvent &event)
Definition AMSItem.cpp:4054
std::string m_printer_type
Definition AMSItem.hpp:987
wxRadioButton * m_radioHelper
Definition AMSItem.hpp:989
void OnRadioClicked(wxCommandEvent &evt)
Definition AMSItem.cpp:4059
wxRadioButton * m_leftRadio
Definition AMSItem.hpp:990
wxRadioButton * m_lastChecked
Definition AMSItem.hpp:992
int m_extruder_num
Definition AMSItem.hpp:986
Button * m_confirmBtn
Definition AMSItem.hpp:994
wxRadioButton * m_rightRadio
Definition AMSItem.hpp:991
@ Extruder
Definition DevConfigUtil.h:34
@ TitleCase
Definition DevConfigUtil.h:41

References _L, Label::Body_14, DEPUTY_EXTRUDER_ID, Slic3r::Extruder, Slic3r::DevPrinterConfigUtil::get_toolhead_display_name(), m_confirmBtn, m_extruder_num, m_extruderImage, m_lastChecked, m_leftRadio, m_printer_type, m_radioHelper, m_rightRadio, MAIN_EXTRUDER_ID, OnConfirm(), OnRadioClicked(), and Slic3r::TitleCase.

Here is the call graph for this function:

Member Function Documentation

◆ calcTrayName()

wxString Slic3r::GUI::FeedDirectionDialog::calcTrayName ( MachineObject * obj,
const std::string & amsID,
const std::string & slotID )
staticprivate
4113{
4114 if (amsID.empty() || slotID.empty() || !obj)
4115 return wxString();
4116
4117 auto filaSys = obj->GetFilaSystem();
4118 if (!filaSys)
4119 return wxString();
4120
4121 DevAms* ams = filaSys->GetAmsById(amsID);
4122 if (!ams)
4123 return wxString();
4124
4125 int ams_id_int = std::stoi(amsID);
4126 int slot_id_int = std::stoi(slotID);
4127 int tray_id = 0;
4128
4129 // Orca: DevAms::AmsType is the local enum (AMS / AMS_LITE / N3F / N3S); it has no EXT_SPOOL
4130 // member, and external/virtual spools are not real DevAms objects (GetAmsById returns nullptr
4131 // above), so the EXT_SPOOL branch from upstream is unnecessary here.
4132 if (ams->GetAmsType() == DevAms::AMS || ams->GetAmsType() == DevAms::AMS_LITE || ams->GetAmsType() == DevAms::N3F) {
4133 tray_id = ams_id_int * 4 + slot_id_int;
4134 } else if (ams->GetAmsType() == DevAms::N3S) {
4135 tray_id = ams_id_int + slot_id_int;
4136 } else {
4137 return wxString();
4138 }
4139
4140 return wxGetApp().transition_tridid(tray_id);
4141}
static constexpr AmsType AMS
Definition DevFilaSystem.h:144
static constexpr AmsType N3F
Definition DevFilaSystem.h:146
static constexpr AmsType AMS_LITE
Definition DevFilaSystem.h:145
static constexpr AmsType N3S
Definition DevFilaSystem.h:147

References Slic3r::DevAms::AMS, Slic3r::DevAms::AMS_LITE, Slic3r::DevAms::GetAmsType(), Slic3r::MachineObject::GetFilaSystem(), Slic3r::DevAms::N3F, and Slic3r::DevAms::N3S.

Referenced by SetExtruderMapping().

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

◆ GetExtruderID()

std::optional< int > Slic3r::GUI::FeedDirectionDialog::GetExtruderID ( )
4104{
4105 if (m_extruderImage)
4106 {
4107 return m_load_extruder_id;
4108 }
4109 return std::nullopt;
4110}
std::optional< int > m_load_extruder_id
Definition AMSItem.hpp:995

References m_extruderImage, and m_load_extruder_id.

Referenced by Slic3r::GUI::StatusPanel::on_ams_load_curr().

Here is the caller graph for this function:

◆ OnConfirm()

void Slic3r::GUI::FeedDirectionDialog::OnConfirm ( wxCommandEvent & event)
private
4055{
4056 EndModal(wxID_OK);
4057}

Referenced by FeedDirectionDialog().

Here is the caller graph for this function:

◆ OnRadioClicked()

void Slic3r::GUI::FeedDirectionDialog::OnRadioClicked ( wxCommandEvent & evt)
private
4060{
4061 auto clicked = static_cast<wxRadioButton*>(evt.GetEventObject());
4062 m_load_extruder_id = std::nullopt;
4063 if (clicked == m_lastChecked)
4064 {
4065 m_radioHelper->SetValue(true);
4067 m_confirmBtn->Enable(false);
4069 m_extruderImage->setExtruderUsed("");
4070
4071 }
4072 else
4073 {
4074 clicked->SetValue(true);
4075 m_lastChecked = clicked;
4076 m_confirmBtn->Enable(true);
4077
4078 if (clicked == m_leftRadio)
4079 {
4081 m_extruderImage->setExtruderUsed("left");
4083 {
4085 }
4086 }
4087 else if (clicked == m_rightRadio)
4088 {
4090 m_extruderImage->setExtruderUsed("right");
4092 {
4094 }
4095 }
4096 }
4097 m_leftRadio->Refresh();
4098 m_rightRadio->Refresh();
4099 Fit();
4100 Update();
4101}
wxString m_filament_id
Definition AMSItem.hpp:988
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:22
@ FILLED_LOAD
Definition AMSItem.hpp:898
@ EMPTY_LOAD
Definition AMSItem.hpp:900
@ LowerCase
Definition DevConfigUtil.h:43

References _L, DEPUTY_EXTRUDER_ID, Slic3r::GUI::EMPTY_LOAD, Slic3r::Extruder, Slic3r::GUI::FILLED_LOAD, Slic3r::GUI::format_wxstr(), Slic3r::DevPrinterConfigUtil::get_toolhead_display_name(), Slic3r::LowerCase, m_confirmBtn, m_extruderImage, m_filament_id, m_lastChecked, m_leftRadio, m_load_extruder_id, m_printer_type, m_radioHelper, m_rightRadio, and MAIN_EXTRUDER_ID.

Referenced by FeedDirectionDialog().

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

◆ SetExtruderMapping()

void Slic3r::GUI::FeedDirectionDialog::SetExtruderMapping ( MachineObject * obj,
const std::string & currAmsId,
const std::string & currSlotId,
const std::vector< std::pair< std::string, std::string > > & extruderSlots )
4147{
4148 wxString filamentID = calcTrayName(obj, currAmsId, currSlotId);
4149 if (filamentID.empty())
4150 return;
4151
4152 m_filament_id = filamentID;
4153 SetTitle(wxString::Format(_L("Load %s"), filamentID));
4154
4155 std::vector<wxString> extruderMapping(extruderSlots.size());
4156 for (size_t i = 0; i < extruderSlots.size(); ++i) {
4157 if (!extruderSlots[i].first.empty())
4158 extruderMapping[i] = calcTrayName(obj, extruderSlots[i].first, extruderSlots[i].second);
4159 }
4160
4161 if (extruderMapping.size() > 1 && extruderMapping[1] == filamentID) //left extruder
4162 {
4163 m_leftRadio->Enable(false);
4164 m_confirmBtn->Enable(false);
4166 m_extruderImage->setExtruderUsed("right");
4167 }
4168 else if (!extruderMapping.empty() && extruderMapping[0] == filamentID) //right extruder
4169 {
4170 m_rightRadio->Enable(false);
4171 m_confirmBtn->Enable(false);
4173 m_extruderImage->setExtruderUsed("left");
4174 }
4175 else
4176 {
4177 m_radioHelper->SetValue(true);
4179 m_confirmBtn->Enable(false);
4181 m_extruderImage->setExtruderUsed("");
4182 }
4183}
static wxString calcTrayName(MachineObject *obj, const std::string &amsID, const std::string &slotID)
Definition AMSItem.cpp:4112

References _L, calcTrayName(), Slic3r::GUI::EMPTY_LOAD, m_confirmBtn, m_extruderImage, m_filament_id, m_lastChecked, m_leftRadio, m_radioHelper, and m_rightRadio.

Referenced by Slic3r::GUI::StatusPanel::on_ams_load_curr().

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

Member Data Documentation

◆ m_confirmBtn

Button* Slic3r::GUI::FeedDirectionDialog::m_confirmBtn {nullptr}
private
994{nullptr};

Referenced by FeedDirectionDialog(), OnRadioClicked(), and SetExtruderMapping().

◆ m_extruder_num

int Slic3r::GUI::FeedDirectionDialog::m_extruder_num {}
private
986{};

Referenced by FeedDirectionDialog().

◆ m_extruderImage

DevExtruderImage* Slic3r::GUI::FeedDirectionDialog::m_extruderImage {nullptr}
private

◆ m_filament_id

wxString Slic3r::GUI::FeedDirectionDialog::m_filament_id {}
private
988{};

Referenced by OnRadioClicked(), and SetExtruderMapping().

◆ m_lastChecked

wxRadioButton* Slic3r::GUI::FeedDirectionDialog::m_lastChecked {nullptr}
private
992{nullptr};

Referenced by FeedDirectionDialog(), OnRadioClicked(), and SetExtruderMapping().

◆ m_leftRadio

wxRadioButton* Slic3r::GUI::FeedDirectionDialog::m_leftRadio {nullptr}
private
990{nullptr};

Referenced by FeedDirectionDialog(), OnRadioClicked(), and SetExtruderMapping().

◆ m_load_extruder_id

std::optional<int> Slic3r::GUI::FeedDirectionDialog::m_load_extruder_id = std::nullopt
private

Referenced by GetExtruderID(), and OnRadioClicked().

◆ m_printer_type

std::string Slic3r::GUI::FeedDirectionDialog::m_printer_type
private

◆ m_radioHelper

wxRadioButton* Slic3r::GUI::FeedDirectionDialog::m_radioHelper {nullptr}
private
989{nullptr};

Referenced by FeedDirectionDialog(), OnRadioClicked(), and SetExtruderMapping().

◆ m_rightRadio

wxRadioButton* Slic3r::GUI::FeedDirectionDialog::m_rightRadio {nullptr}
private
991{nullptr};

Referenced by FeedDirectionDialog(), OnRadioClicked(), and SetExtruderMapping().


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