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

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

Inheritance diagram for Slic3r::GUI::AuFolderPanel:
Collaboration diagram for Slic3r::GUI::AuFolderPanel:

Public Member Functions

 AuFolderPanel (wxWindow *parent, AuxiliaryFolderType type, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 ~AuFolderPanel ()
void clear ()
void update_cover ()
void update (std::vector< boost::filesystem::path > paths)
void msw_rescale ()
void on_add (wxMouseEvent &event)
void on_delete (wxCommandEvent &event)

Public Attributes

AuxiliaryFolderType m_type
wxScrolledWindow * m_scrolledWindow {nullptr}
wxWrapSizer * m_gsizer_content {nullptr}
Button * m_button_del {nullptr}
AuFile * m_big_button_add { nullptr }
AuFilesHash m_aufiles_list

Detailed Description

Constructor & Destructor Documentation

◆ AuFolderPanel()

Slic3r::GUI::AuFolderPanel::AuFolderPanel ( wxWindow * parent,
AuxiliaryFolderType type,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
645 : wxPanel(parent, id, pos, size, style)
646{
647 m_type = type;
648 SetBackgroundColour(AUFILE_GREY300);
649 wxBoxSizer *sizer_main = new wxBoxSizer(wxVERTICAL);
650
651 m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
652 m_scrolledWindow->SetScrollRate(5, FromDIP(20));
653 wxBoxSizer *sizer_body = new wxBoxSizer(wxVERTICAL);
654 wxBoxSizer *sizer_top = new wxBoxSizer(wxHORIZONTAL);
655
656 StateColor btn_bg_white(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Pressed),
657 std::pair<wxColour, int>(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, StateColor::Hovered),
658 std::pair<wxColour, int>(AMS_CONTROL_WHITE_COLOUR, StateColor::Normal));
659
660 StateColor btn_bd_white(std::pair<wxColour, int>(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
661 //m_button_add = new AuFile(m_scrolledWindow, fs::path(), "", AddFileButton, -1);
662 /*m_button_add->SetBackgroundColor(btn_bg_white);
663 m_button_add->SetBorderColor(btn_bd_white);
664 m_button_add->SetMinSize(wxSize(-1, FromDIP(24)));
665 m_button_add->SetCornerRadius(FromDIP(12));
666 m_button_add->SetFont(Label::Body_14);*/
667
668 m_big_button_add = new AuFile(m_scrolledWindow, fs::path(), "", AddFileButton, -1);
669
670 /*m_button_del = new Button(m_scrolledWindow, _L("Delete"), "auxiliary_delete_file", 12, 12);
671 m_button_del->SetBackgroundColor(btn_bg_white);
672 m_button_del->SetBorderColor(btn_bd_white);
673 m_button_del->SetMinSize(wxSize(FromDIP(80), FromDIP(24)));
674 m_button_del->SetCornerRadius(12);
675 m_button_del->SetFont(Label::Body_14);*/
676 // m_button_del->Bind(wxEVT_LEFT_UP, &AuxiliaryPanel::on_delete, this);
677
678 sizer_top->Add(0, 0, 0, wxLEFT, FromDIP(10));
679 m_gsizer_content = new wxWrapSizer(wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS);
680 //if (m_type == MODEL_PICTURE) {
681 // //sizer_top->Add(m_button_add, 0, wxALL, 0);
682 // //m_big_button_add->Hide();
683 //}
684 //else {
685 m_gsizer_content->Add(m_big_button_add, 0, wxALL, FromDIP(8));
686 //m_button_add->Hide();
687 //}
688 // sizer_top->Add(m_button_del, 0, wxALL, 0);
689 sizer_body->Add(sizer_top, 0, wxEXPAND | wxTOP, FromDIP(35));
690 sizer_body->AddSpacer(FromDIP(14));
691 sizer_body->Add(m_gsizer_content, 0, 0, 0);
692 m_scrolledWindow->SetSizer(sizer_body);
693 m_scrolledWindow->Layout();
694 sizer_main->Add(m_scrolledWindow, 1, wxEXPAND | wxLEFT, FromDIP(40));
695
696 this->SetSizer(sizer_main);
697 this->Layout();
698
699 m_big_button_add->Bind(wxEVT_LEFT_DOWN, [this](auto& e)
700 {
701 auto evt = wxCommandEvent(EVT_AUXILIARY_IMPORT);
702 evt.SetString(s_default_folders[m_type]);
703 evt.SetEventObject(m_parent);
704 wxPostEvent(m_parent, evt);
705 });
706 //m_button_add->Bind(wxEVT_LEFT_UP, &AuFolderPanel::on_add, this);
707}
#define AMS_CONTROL_WHITE_COLOUR
Definition AMSItem.hpp:42
#define AMS_CONTROL_DEF_BLOCK_BK_COLOUR
Definition AMSItem.hpp:44
#define AMS_CONTROL_DISABLE_COLOUR
Definition AMSItem.hpp:40
@ AddFileButton
Definition Auxiliary.hpp:81
#define AUFILE_GREY300
Definition Auxiliary.hpp:61
static const std::array< wxString, 5 > s_default_folders
Definition Auxiliary.hpp:84
#define style
Definition WipeTowerDialog.cpp:101
wxScrolledWindow * m_scrolledWindow
Definition Auxiliary.hpp:169
AuFile * m_big_button_add
Definition Auxiliary.hpp:173
wxWrapSizer * m_gsizer_content
Definition Auxiliary.hpp:170
AuxiliaryFolderType m_type
Definition Auxiliary.hpp:168
@ Hovered
Definition StateColor.hpp:20
@ Normal
Definition StateColor.hpp:16
@ Disabled
Definition StateColor.hpp:22
@ Pressed
Definition StateColor.hpp:21
@ Enabled
Definition StateColor.hpp:17

References AddFileButton, AMS_CONTROL_DEF_BLOCK_BK_COLOUR, AMS_CONTROL_DISABLE_COLOUR, AMS_CONTROL_WHITE_COLOUR, AUFILE_GREY300, StateColor::Disabled, StateColor::Enabled, StateColor::Hovered, m_big_button_add, m_gsizer_content, m_scrolledWindow, m_type, StateColor::Normal, StateColor::Pressed, s_default_folders, and style.

◆ ~AuFolderPanel()

Slic3r::GUI::AuFolderPanel::~AuFolderPanel ( )
759{
760}

Member Function Documentation

◆ clear()

void Slic3r::GUI::AuFolderPanel::clear ( )
710{
711 for (auto i = 0; i < m_aufiles_list.GetCount(); i++) {
712 AuFiles *aufile = m_aufiles_list[i];
713 if (aufile->file) { aufile->file->Destroy(); }
714 }
715 m_aufiles_list.clear();
716 Layout();
717 Refresh();
718}
AuFilesHash m_aufiles_list
Definition Auxiliary.hpp:174

References Slic3r::GUI::AuFiles::file, and m_aufiles_list.

Referenced by on_delete(), and update().

Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::GUI::AuFolderPanel::msw_rescale ( )
740{
741 //m_button_add->SetMinSize(wxSize(-1, FromDIP(24)));
742 for (auto i = 0; i < m_aufiles_list.GetCount(); i++) {
743 AuFiles *aufile = m_aufiles_list[i];
744 aufile->file->msw_rescale();
745 }
746}

References Slic3r::GUI::AuFiles::file, m_aufiles_list, and Slic3r::GUI::AuFile::msw_rescale().

Here is the call graph for this function:

◆ on_add()

void Slic3r::GUI::AuFolderPanel::on_add ( wxMouseEvent & event)
749{
750 auto evt = wxCommandEvent(EVT_AUXILIARY_IMPORT);
751 evt.SetString(s_default_folders[m_type]);
752 evt.SetEventObject(m_parent);
753 wxPostEvent(m_parent, evt);
754}

References m_type, s_default_folders, and Slic3r::GUI::wxMouseEvent.

◆ on_delete()

void Slic3r::GUI::AuFolderPanel::on_delete ( wxCommandEvent & event)
756{ clear(); }
void clear()
Definition Auxiliary.cpp:709

References clear().

Here is the call graph for this function:

◆ update()

void Slic3r::GUI::AuFolderPanel::update ( std::vector< boost::filesystem::path > paths)
721{
722 clear();
723 for (auto i = 0; i < paths.size(); i++) {
724 std::string temp_name = fs::path(paths[i].c_str()).filename().string();
725 auto name = encode_path(temp_name.c_str());
726
727 auto aufile = new AuFile(m_scrolledWindow, paths[i], name, m_type, wxID_ANY);
728 m_gsizer_content->Add(aufile, 0, wxALL, FromDIP(8));
729 auto af = new AuFiles;
730 af->path = paths[i].string();
731 af->file = aufile;
732 m_aufiles_list.push_back(af);
733 }
734 m_gsizer_content->Layout();
735 Layout();
736 Refresh();
737}
std::string encode_path(const char *src)
Definition utils.cpp:1382

References clear(), Slic3r::encode_path(), m_aufiles_list, m_gsizer_content, m_scrolledWindow, m_type, and Slic3r::GUI::AuFiles::path.

Here is the call graph for this function:

◆ update_cover()

void Slic3r::GUI::AuFolderPanel::update_cover ( )
763{
764 if (wxGetApp().plater()->model().model_info != nullptr) {
765 for (auto i = 0; i < m_aufiles_list.GetCount(); i++) {
766 AuFiles *aufile = m_aufiles_list[i];
767
768 if (wxString::FromUTF8(wxGetApp().plater()->model().model_info->cover_file) == aufile->file->m_file_name) {
769 aufile->file->set_cover(true);
770 } else {
771 aufile->file->set_cover(false);
772 }
773 }
774 }
775}
static Plater * plater()
Definition GUI_Factories.cpp:400

References Slic3r::GUI::AuFiles::file, m_aufiles_list, Slic3r::GUI::AuFile::m_file_name, Slic3r::GUI::plater(), and Slic3r::GUI::AuFile::set_cover().

Here is the call graph for this function:

Member Data Documentation

◆ m_aufiles_list

AuFilesHash Slic3r::GUI::AuFolderPanel::m_aufiles_list

◆ m_big_button_add

AuFile* Slic3r::GUI::AuFolderPanel::m_big_button_add { nullptr }
173{ nullptr };

Referenced by AuFolderPanel().

◆ m_button_del

Button* Slic3r::GUI::AuFolderPanel::m_button_del {nullptr}
172{nullptr};

◆ m_gsizer_content

wxWrapSizer* Slic3r::GUI::AuFolderPanel::m_gsizer_content {nullptr}
170{nullptr};

Referenced by AuFolderPanel(), and update().

◆ m_scrolledWindow

wxScrolledWindow* Slic3r::GUI::AuFolderPanel::m_scrolledWindow {nullptr}
169{nullptr};

Referenced by AuFolderPanel(), and update().

◆ m_type

AuxiliaryFolderType Slic3r::GUI::AuFolderPanel::m_type

Referenced by AuFolderPanel(), on_add(), and update().


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