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

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

Inheritance diagram for Slic3r::GUI::DesignerPanel:
Collaboration diagram for Slic3r::GUI::DesignerPanel:

Public Member Functions

 DesignerPanel (wxWindow *parent, AuxiliaryFolderType type, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 ~DesignerPanel ()
bool Show (bool show) override
void init_license_list ()
void on_input_enter_designer (wxCommandEvent &evt)
void on_input_enter_model (wxCommandEvent &evt)
void on_input_enter_description (wxCommandEvent &evt)
void on_select_license (wxCommandEvent &evt)
void update_info ()
void msw_rescale ()

Public Attributes

::TextInput * m_input_designer {nullptr}
::TextInput * m_input_model_name {nullptr}
wxTextCtrl * m_input_description {nullptr}
ComboBox * m_combo_license {nullptr}

Detailed Description

Constructor & Destructor Documentation

◆ DesignerPanel()

Slic3r::GUI::DesignerPanel::DesignerPanel ( wxWindow * parent,
AuxiliaryFolderType type,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
1119 : wxPanel(parent, id, pos, size, style)
1120{
1121 SetBackgroundColour(AUFILE_GREY300);
1122 wxBoxSizer *m_sizer_body = new wxBoxSizer(wxVERTICAL);
1123
1124 wxBoxSizer *m_sizer_designer = new wxBoxSizer(wxHORIZONTAL);
1125 auto m_text_designer = new wxStaticText(this, wxID_ANY, _L("Author"), wxDefaultPosition, wxSize(180, -1), 0);
1126 m_text_designer->Wrap(-1);
1127 m_text_designer->SetForegroundColour(*wxBLACK);
1128 m_sizer_designer->Add(m_text_designer, 0, wxALIGN_CENTER, 0);
1129 m_input_designer = new ::TextInput(this, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(450), FromDIP(30)), wxTE_PROCESS_ENTER);
1130 m_input_designer->GetTextCtrl()->SetFont(::Label::Body_14);
1131 m_input_designer->GetTextCtrl()->SetSize(wxSize(FromDIP(450), -1));
1132 m_sizer_designer->Add(m_input_designer, 0, wxALIGN_CENTER, 0);
1133
1134 wxBoxSizer *m_sizer_model_name = new wxBoxSizer(wxHORIZONTAL);
1135 auto m_text_model_name = new wxStaticText(this, wxID_ANY, _L("Model Name"), wxDefaultPosition, wxSize(180, -1), 0);
1136 m_text_model_name->SetForegroundColour(*wxBLACK);
1137 m_text_model_name->Wrap(-1);
1138 m_sizer_model_name->Add(m_text_model_name, 0, wxALIGN_CENTER, 0);
1139 m_input_model_name = new ::TextInput(this, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition,wxSize(FromDIP(450),FromDIP(30)), wxTE_PROCESS_ENTER);
1140 m_input_model_name->GetTextCtrl()->SetFont(::Label::Body_14);
1141 m_input_model_name->GetTextCtrl()->SetSize(wxSize(FromDIP(450), -1));
1142 m_sizer_model_name->Add(m_input_model_name, 0, wxALIGN_CENTER, 0);
1143
1144 wxBoxSizer *m_sizer_license = new wxBoxSizer(wxHORIZONTAL);
1145 auto m_text_license = new wxStaticText(this, wxID_ANY, _L("License"), wxDefaultPosition, wxSize(180, -1), 0);
1146 m_text_license->SetForegroundColour(*wxBLACK);
1147 m_text_license->Wrap(-1);
1148 m_sizer_license->Add(m_text_license, 0, wxALIGN_CENTER, 0);
1149 m_combo_license = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(450), -1), 0, NULL, wxCB_READONLY);
1150 m_sizer_license->Add(m_combo_license, 0, wxALIGN_CENTER, 0);
1151
1152 wxBoxSizer *m_sizer_description = new wxBoxSizer(wxHORIZONTAL);
1153 auto m_text_description = new wxStaticText(this, wxID_ANY, _L("Description:"), wxDefaultPosition, wxSize(170, -1), 0); // Using "Description:" with the : because that already exists in the Localizations files
1154 m_text_description->SetForegroundColour(*wxBLACK);
1155 m_text_description->Wrap(-1);
1156 m_sizer_description->Add(m_text_description, 0, wxALIGN_TOP | wxRIGHT, FromDIP(10));
1157 m_input_description = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
1158 wxSize(FromDIP(450), FromDIP(300)), wxTE_MULTILINE | wxTE_PROCESS_ENTER);
1159 m_input_description->SetBackgroundColour(*wxWHITE);
1161 m_sizer_description->Add(m_input_description, 0, wxALIGN_CENTER, 0);
1162
1163 m_sizer_body->Add(0, 0, 0, wxTOP, FromDIP(50));
1164 m_sizer_body->Add(m_sizer_designer, 0, wxLEFT | wxALIGN_LEFT, FromDIP(50));
1165 m_sizer_body->Add(0, 0, 0, wxTOP, FromDIP(20));
1166 m_sizer_body->Add(m_sizer_model_name, 0, wxLEFT | wxALIGN_LEFT, FromDIP(50));
1167 m_sizer_body->Add(0, 0, 0, wxTOP, FromDIP(20));
1168 m_sizer_body->Add(m_sizer_license, 0, wxLEFT | wxALIGN_LEFT, FromDIP(50));
1170 m_sizer_body->Add(0, 0, 0, wxTOP, FromDIP(20));
1171 m_sizer_body->Add(m_sizer_description, 0, wxLEFT | wxALIGN_LEFT, FromDIP(50));
1172
1173 SetSizer(m_sizer_body);
1174 Layout();
1175 Fit();
1176
1180 m_combo_license->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &DesignerPanel::on_select_license, this);
1181}
#define AUFILE_GREY300
Definition Auxiliary.hpp:61
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
#define style
Definition WipeTowerDialog.cpp:101
static wxFont Body_14
Definition Label.hpp:53
void init_license_list()
Definition Auxiliary.cpp:1187
::TextInput * m_input_designer
Definition Auxiliary.hpp:191
void on_select_license(wxCommandEvent &evt)
Definition Auxiliary.cpp:1196
wxTextCtrl * m_input_description
Definition Auxiliary.hpp:193
::TextInput * m_input_model_name
Definition Auxiliary.hpp:192
void on_input_enter_designer(wxCommandEvent &evt)
Definition Auxiliary.cpp:1210
void on_input_enter_description(wxCommandEvent &evt)
Definition Auxiliary.cpp:1222
void on_input_enter_model(wxCommandEvent &evt)
Definition Auxiliary.cpp:1216
ComboBox * m_combo_license
Definition Auxiliary.hpp:194

References _L, AUFILE_GREY300, Label::Body_14, init_license_list(), m_combo_license, m_input_description, m_input_designer, m_input_model_name, on_input_enter_description(), on_input_enter_designer(), on_input_enter_model(), on_select_license(), style, and wxStaticText.

Here is the call graph for this function:

◆ ~DesignerPanel()

Slic3r::GUI::DesignerPanel::~DesignerPanel ( )
1184 {
1185 }

Member Function Documentation

◆ init_license_list()

void Slic3r::GUI::DesignerPanel::init_license_list ( )
1188 {
1189 wxArrayString text_licese;
1190 for (int i = 0; i < license_list.size(); i++) {
1191 text_licese.Add(license_list[i]);
1192 }
1193 m_combo_license->Set(text_licese);
1194 }
const std::vector< std::string > license_list
Definition Auxiliary.cpp:84

References Slic3r::GUI::license_list, and m_combo_license.

Referenced by DesignerPanel().

Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::GUI::DesignerPanel::msw_rescale ( )
1251{
1252 m_input_designer->GetTextCtrl()->SetSize(wxSize(FromDIP(450), -1));
1253 m_input_model_name->GetTextCtrl()->SetSize(wxSize(FromDIP(450), -1));
1254 m_combo_license->SetSize(wxSize(FromDIP(450), -1));
1255 m_input_description->SetSize(wxSize(FromDIP(450), -1));}

References m_combo_license, m_input_description, m_input_designer, and m_input_model_name.

◆ on_input_enter_description()

void Slic3r::GUI::DesignerPanel::on_input_enter_description ( wxCommandEvent & evt)
1223{
1224 auto text = evt.GetString();
1225 ensure_model_info()->description = std::string(text.ToUTF8().data());
1226}
static std::shared_ptr< ModelInfo > ensure_model_info()
Definition Auxiliary.cpp:95

References Slic3r::GUI::ensure_model_info().

Referenced by DesignerPanel().

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

◆ on_input_enter_designer()

void Slic3r::GUI::DesignerPanel::on_input_enter_designer ( wxCommandEvent & evt)
1211{
1212 auto text = evt.GetString();
1213 wxGetApp().plater()->model().SetDesigner(std::string(text.ToUTF8().data()), "");
1214}

Referenced by DesignerPanel().

Here is the caller graph for this function:

◆ on_input_enter_model()

void Slic3r::GUI::DesignerPanel::on_input_enter_model ( wxCommandEvent & evt)
1217{
1218 auto text = evt.GetString();
1219 ensure_model_info()->model_name = std::string(text.ToUTF8().data());
1220}

References Slic3r::GUI::ensure_model_info().

Referenced by DesignerPanel().

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

◆ on_select_license()

void Slic3r::GUI::DesignerPanel::on_select_license ( wxCommandEvent & evt)
1197 {
1198 int selected = evt.GetInt();
1199 if (selected >= 0 && selected < license_list.size()) {
1200 ensure_model_info()->license = license_list[selected];
1201 }
1202 }

References Slic3r::GUI::ensure_model_info(), and Slic3r::GUI::license_list.

Referenced by DesignerPanel().

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

◆ Show()

bool Slic3r::GUI::DesignerPanel::Show ( bool show)
override
1205 {
1206 if (show) update_info();
1207 return wxPanel::Show(show);
1208 }
void update_info()
Definition Auxiliary.cpp:1228

References update_info().

Here is the call graph for this function:

◆ update_info()

void Slic3r::GUI::DesignerPanel::update_info ( )
1229{
1230 if (wxGetApp().plater()->model().design_info != nullptr) {
1231 wxString text = wxString::FromUTF8(wxGetApp().plater()->model().design_info->Designer);
1232 m_input_designer->GetTextCtrl()->SetValue(text);
1233 } else {
1234 m_input_designer->GetTextCtrl()->SetValue(wxEmptyString);
1235 }
1236
1237 if (wxGetApp().plater()->model().model_info != nullptr) {
1238 m_input_model_name->GetTextCtrl()->SetValue(wxString::FromUTF8(wxGetApp().plater()->model().model_info->model_name));
1239 m_input_description->ChangeValue(wxString::FromUTF8(wxGetApp().plater()->model().model_info->description));
1240 if (!m_combo_license->SetStringSelection(wxString::FromUTF8(wxGetApp().plater()->model().model_info->license))) {
1241 m_combo_license->SetSelection(0);
1242 }
1243 } else {
1244 m_input_model_name->GetTextCtrl()->SetValue(wxEmptyString);
1245 m_input_description->ChangeValue(wxEmptyString);
1246 m_combo_license->SetSelection(0);
1247 }
1248}
static Plater * plater()
Definition GUI_Factories.cpp:400

References m_combo_license, m_input_description, m_input_designer, m_input_model_name, and Slic3r::GUI::plater().

Referenced by Show().

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

Member Data Documentation

◆ m_combo_license

ComboBox* Slic3r::GUI::DesignerPanel::m_combo_license {nullptr}
194{nullptr};

Referenced by DesignerPanel(), init_license_list(), msw_rescale(), and update_info().

◆ m_input_description

wxTextCtrl* Slic3r::GUI::DesignerPanel::m_input_description {nullptr}
193{nullptr};

Referenced by DesignerPanel(), msw_rescale(), and update_info().

◆ m_input_designer

::TextInput* Slic3r::GUI::DesignerPanel::m_input_designer {nullptr}
191{nullptr};

Referenced by DesignerPanel(), msw_rescale(), and update_info().

◆ m_input_model_name

::TextInput* Slic3r::GUI::DesignerPanel::m_input_model_name {nullptr}
192{nullptr};

Referenced by DesignerPanel(), msw_rescale(), and update_info().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Auxiliary.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Auxiliary.cpp