OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::FilamentSelectPopup Class Reference
Inheritance diagram for Slic3r::GUI::FilamentSelectPopup:
Collaboration diagram for Slic3r::GUI::FilamentSelectPopup:

Public Member Functions

 FilamentSelectPopup (wxWindow *parent, const std::vector< TextureFilamentEntry > &entries, const std::vector< std::array< float, 4 > > &colors_rgba, const std::vector< std::string > &names, size_t existing_count, int popup_width, wxWindow *dialog_anchor, std::function< void(int)> on_select, std::function< void(wxColour)> on_add_filament, std::function< void()> on_decompose_color, std::function< bool()> can_add_filament, std::function< void(bool)> on_close, std::vector< int > display_numbers)
bool Create (wxWindow *parent, int flags=wxBORDER_NONE)

Protected Member Functions

virtual bool ShouldDismissOnTopWindowDeactivate ()

Private Member Functions

void OnDismiss () override
void restore_cursor_state ()
void schedule_destroy ()
wxPanel * create_item_row (size_t idx, int row_h)
wxPanel * create_mixed_item_row (const TextureFilamentEntry &entry, int row_h)
int display_number (int idx) const

Private Attributes

wxScrolledWindow * m_content = nullptr
std::vector< TextureFilamentEntry > m_entries
std::vector< std::array< float, 4 > > m_colors_rgba
std::vector< std::string > m_names
wxWindow * m_dialog_anchor = nullptr
std::function< void(int)> m_on_select
std::function< void(wxColour)> m_on_add_filament
std::function< void()> m_on_decompose_color
std::function< bool()> m_can_add_filament
std::function< void(bool)> m_on_close
std::vector< int > m_display_numbers
int m_hover_idx = -1
bool m_closing_from_action = false
bool m_destroy_scheduled = false

Detailed Description

Constructor & Destructor Documentation

◆ FilamentSelectPopup()

Slic3r::GUI::FilamentSelectPopup::FilamentSelectPopup ( wxWindow * parent,
const std::vector< TextureFilamentEntry > & entries,
const std::vector< std::array< float, 4 > > & colors_rgba,
const std::vector< std::string > & names,
size_t existing_count,
int popup_width,
wxWindow * dialog_anchor,
std::function< void(int)> on_select,
std::function< void(wxColour)> on_add_filament,
std::function< void()> on_decompose_color,
std::function< bool()> can_add_filament,
std::function< void(bool)> on_close,
std::vector< int > display_numbers )
inline
509 : PopupWindow(parent, wxBORDER_NONE | wxPU_CONTAINS_CONTROLS)
510 , m_entries(entries)
511 , m_colors_rgba(colors_rgba)
512 , m_names(names)
513 , m_dialog_anchor(dialog_anchor)
514 , m_on_select(std::move(on_select))
515 , m_on_add_filament(std::move(on_add_filament))
516 , m_on_decompose_color(std::move(on_decompose_color))
517 , m_can_add_filament(std::move(can_add_filament))
518 , m_on_close(std::move(on_close))
519 , m_display_numbers(std::move(display_numbers))
520 {
521 wxColour pop_bg = StateColor::darkModeColorFor(*wxWHITE);
522 SetBackgroundColour(pop_bg);
523
524 // ORCA add border for popups. it required to add this controls because it covers all background
525 Bind(wxEVT_PAINT, [this](wxPaintEvent& evt) {
526 wxPaintDC dc(this);
527 dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#DBDBDB")), FromDIP(1)));
528 dc.SetBrush(*wxTRANSPARENT_BRUSH);
529 dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0);
530 });
531
532 m_content = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
533 m_content->SetBackgroundColour(pop_bg);
534 m_content->SetScrollRate(0, FromDIP(20));
535 auto* outer = new wxBoxSizer(wxVERTICAL);
536
537 const int pop_w = std::max(FromDIP(213), popup_width);
538 const int row_h = FromDIP(32);
539 const int pad = FromDIP(8);
540 const int max_visible_rows = 10;
541 const wxColour header_clr = StateColor::darkModeColorFor(wxColour("#363636"));
542
543 auto add_section_header = [&](const wxString& label) {
544 auto* hdr = new wxStaticText(m_content, wxID_ANY, label);
545 wxFont hf = hdr->GetFont();
546 hf.SetPointSize(9);
547 hdr->SetFont(hf);
548 hdr->SetForegroundColour(header_clr);
549 outer->Add(hdr, 0, wxLEFT | wxRIGHT | wxTOP, pad);
550 auto* line = new StaticLine(m_content);
551 line->SetLineColour(wxColour(SEPARATOR_COLOUR_KEY));
552 outer->Add(line, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, pad);
553 };
554
555 auto add_section = [&](const wxString& label, TextureFilamentKind kind) {
556 bool has_any = false;
557 for (const auto& entry : m_entries) {
558 if (entry.kind == kind) {
559 has_any = true;
560 break;
561 }
562 }
563 if (!has_any)
564 return;
565 add_section_header(label);
566 for (const auto& entry : m_entries) {
567 if (entry.kind != kind)
568 continue;
569 wxPanel* row = texture_entry_is_mixed(entry.kind) ? create_mixed_item_row(entry, row_h)
570 : create_item_row((size_t)entry.dialog_index, row_h);
571 outer->Add(row, 0, wxEXPAND | wxLEFT | wxRIGHT, pad);
572 }
573 };
574
575 // Section order matches compute_display_numbers() so the visible IDs
576 // ascend monotonically (ExistingPhysical -> NewPhysical -> ExistingMixed
577 // -> NewMixed) instead of jumping (e.g. 1,2 -> 7 -> 3,4,5,6 -> 8,9,10).
578 add_section(_L("Project Physical Filaments"), TextureFilamentKind::ExistingPhysical);
579 add_section(_L("New Physical Filaments"), TextureFilamentKind::NewPhysical);
580 add_section(_L("Project Mixed Filaments"), TextureFilamentKind::ExistingMixed);
581 add_section(_L("New Mixed Filaments"), TextureFilamentKind::NewMixed);
582
583 auto* decompose_label = new wxStaticText(this, wxID_ANY, _L("Decompose Color"));
584 auto* add_label = new wxStaticText(this, wxID_ANY, _L("+ Add Material"));
585 wxFont af = add_label->GetFont();
586 af.SetPointSize(10);
587 add_label->SetFont(af);
588 decompose_label->SetFont(af);
589 const bool add_enabled = !m_can_add_filament || m_can_add_filament();
590 const wxColour action_clr = wxColour("#009688");
591 add_label->SetForegroundColour(add_enabled ? action_clr : header_clr);
592 decompose_label->SetForegroundColour(add_enabled ? action_clr : header_clr);
593 add_label->SetCursor(wxCursor(add_enabled ? wxCURSOR_HAND : wxCURSOR_ARROW));
594 decompose_label->SetCursor(wxCursor(add_enabled ? wxCURSOR_HAND : wxCURSOR_ARROW));
595 if (!add_enabled)
596 add_label->SetToolTip(wxString::Format(
597 _L_PLURAL("The project supports up to %d filament. Extra filaments will be discarded.",
598 "The project supports up to %d filaments. Extra filaments will be discarded.",
601 decompose_label->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent&) {
603 return;
604 auto on_decompose_color = m_on_decompose_color;
606 Dismiss();
607 if (on_decompose_color)
608 on_decompose_color();
609 });
610 add_label->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent&) {
612 return;
613 }
614 auto on_add_filament = m_on_add_filament;
615 wxWindow* popup_parent = GetParent();
616 wxWindow* color_anchor = m_dialog_anchor ? m_dialog_anchor : popup_parent;
617 wxWeakRef<FilamentSelectPopup> popup(this);
619 std::optional<wxColour> selected;
620 {
621 // Capture the stable mapping row before the transient popup is dismissed.
622 ColorPickerDialog dlg(popup_parent, ColorRGBA(0.f, 0.f, 0.f, 1.f), {}, false, color_anchor);
623 if (popup) popup->Dismiss();
624 // Dismissal can delete the popup. Only copied locals are used below.
625 if (dlg.ShowModal() == wxID_OK && dlg.selection()) {
626 const auto& color = std::get<ColorRGBA>(*dlg.selection());
627 selected = wxColour(static_cast<unsigned char>(std::lround(color.r() * 255.f)),
628 static_cast<unsigned char>(std::lround(color.g() * 255.f)),
629 static_cast<unsigned char>(std::lround(color.b() * 255.f)));
630 }
631 }
632 if (selected && on_add_filament) on_add_filament(*selected);
633 });
634
635 m_content->SetSizer(outer);
636 m_content->FitInside();
637
638 auto* top_sizer = new wxBoxSizer(wxVERTICAL);
639 int list_h = outer->GetMinSize().y;
640 if (m_colors_rgba.size() > max_visible_rows)
641 list_h -= ((int)m_colors_rgba.size() - max_visible_rows) * row_h;
642 m_content->SetMinSize(wxSize(pop_w, list_h));
643 m_content->SetMaxSize(wxSize(pop_w, list_h));
644 top_sizer->Add(m_content, 0, wxEXPAND | wxALL, FromDIP(1));
645
646 top_sizer->AddSpacer(FromDIP(4));
647 auto* sep_line = new StaticLine(this);
648 sep_line->SetLineColour(wxColour(SEPARATOR_COLOUR_KEY));
649 top_sizer->Add(sep_line, 0, wxEXPAND | wxLEFT | wxRIGHT, pad);
650 top_sizer->Add(decompose_label, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM, pad);
651 auto* sep_line2 = new StaticLine(this);
652 sep_line2->SetLineColour(wxColour(SEPARATOR_COLOUR_KEY));
653 top_sizer->Add(sep_line2, 0, wxEXPAND | wxLEFT | wxRIGHT, pad);
654 top_sizer->Add(add_label, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM, pad);
655 SetSizerAndFit(top_sizer);
656
657 SetSize(pop_w, top_sizer->GetMinSize().y);
658 }
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static constexpr const char * SEPARATOR_COLOUR_KEY
Definition TextureImportDialog.cpp:99
PopupWindow()
Definition PopupWindow.hpp:10
std::vector< TextureFilamentEntry > m_entries
Definition TextureImportDialog.cpp:875
bool m_closing_from_action
Definition TextureImportDialog.cpp:888
std::vector< std::array< float, 4 > > m_colors_rgba
Definition TextureImportDialog.cpp:876
std::function< void(bool)> m_on_close
Definition TextureImportDialog.cpp:883
wxPanel * create_mixed_item_row(const TextureFilamentEntry &entry, int row_h)
Definition TextureImportDialog.cpp:783
wxWindow * m_dialog_anchor
Definition TextureImportDialog.cpp:878
wxPanel * create_item_row(size_t idx, int row_h)
Definition TextureImportDialog.cpp:688
std::vector< std::string > m_names
Definition TextureImportDialog.cpp:877
wxScrolledWindow * m_content
Definition TextureImportDialog.cpp:874
std::function< void()> m_on_decompose_color
Definition TextureImportDialog.cpp:881
std::vector< int > m_display_numbers
Definition TextureImportDialog.cpp:886
std::function< void(int)> m_on_select
Definition TextureImportDialog.cpp:879
std::function< void(wxColour)> m_on_add_filament
Definition TextureImportDialog.cpp:880
std::function< bool()> m_can_add_filament
Definition TextureImportDialog.cpp:882
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
wxMouseEvent
Definition CameraPopup.cpp:47
static bool texture_entry_is_mixed(TextureFilamentKind kind)
Definition TextureImportDialog.cpp:407
TextureFilamentKind
Definition TextureImportDialog.hpp:54
@ NewMixed
Definition TextureImportDialog.hpp:58
@ ExistingMixed
Definition TextureImportDialog.hpp:56
@ NewPhysical
Definition TextureImportDialog.hpp:57
@ ExistingPhysical
Definition TextureImportDialog.hpp:55
@ ExtruderMax
Definition TriangleSelector.hpp:66
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96

References PopupWindow::PopupWindow(), _L, _L_PLURAL, create_item_row(), create_mixed_item_row(), StateColor::darkModeColorFor(), Slic3r::GUI::ExistingMixed, Slic3r::GUI::ExistingPhysical, Slic3r::ExtruderMax, m_can_add_filament, m_closing_from_action, m_colors_rgba, m_content, m_dialog_anchor, m_display_numbers, m_entries, m_names, m_on_add_filament, m_on_close, m_on_decompose_color, m_on_select, Slic3r::GUI::NewMixed, Slic3r::GUI::NewPhysical, SEPARATOR_COLOUR_KEY, Slic3r::GUI::texture_entry_is_mixed(), Slic3r::GUI::wxMouseEvent, and wxStaticText.

Here is the call graph for this function:

Member Function Documentation

◆ Create()

bool PopupWindow::Create ( wxWindow * parent,
int flags = wxBORDER_NONE )
inherited
22{
23 if (!wxPopupTransientWindow::Create(parent, style))
24 return false;
25#ifdef __WXGTK__
26 GetTopParent(parent)->Bind(wxEVT_ACTIVATE, &PopupWindow::topWindowActiavate, this);
27#endif
28#ifdef __WXOSX__
29 if (style & wxPU_CONTAINS_CONTROLS)
30 for (auto evt : {wxEVT_LEFT_DOWN, wxEVT_LEFT_UP, wxEVT_LEFT_DCLICK, wxEVT_MOTION, wxEVT_MOUSEWHEEL})
31 Bind(evt, &PopupWindow::OnMouseEvent2, this);
32#endif
33 return true;
34}
static wxWindow * GetTopParent(wxWindow *pWindow)
Definition PopupWindow.cpp:10
#define style
Definition WipeTowerDialog.cpp:101

References GetTopParent(), and style.

Referenced by PopupWindow(), and DropDown::Create().

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

◆ create_item_row()

wxPanel * Slic3r::GUI::FilamentSelectPopup::create_item_row ( size_t idx,
int row_h )
inlineprivate
689 {
690 wxColour row_bg = StateColor::darkModeColorFor(*wxWHITE);
691 wxColour hover_bg = StateColor::darkModeColorFor(wxColour("#F4F4F4"));
692 wxColour name_fg = texture_import_text_colour();
693
694 wxPanel* row = new wxPanel(m_content, wxID_ANY, wxDefaultPosition, wxSize(-1, row_h));
695 row->SetBackgroundColour(row_bg);
696 row->SetBackgroundStyle(wxBG_STYLE_PAINT);
697 row->SetCursor(wxCursor(wxCURSOR_HAND));
698
699 const int sq = row->FromDIP(20); // ORCA match color swatch sizes
700 const int sq_r = row->FromDIP(0);
701 const int sq_x = row->FromDIP(4);
702 const int gap1 = row->FromDIP(8);
703
704 wxColour fil_clr = idx < m_colors_rgba.size()
705 ? wxColour((unsigned char)(m_colors_rgba[idx][0] * 255.f),
706 (unsigned char)(m_colors_rgba[idx][1] * 255.f),
707 (unsigned char)(m_colors_rgba[idx][2] * 255.f))
708 : wxColour(128, 128, 128);
709
710 wxString name_str = (idx < m_names.size()) ? filament_name_to_wx_string(m_names[idx])
711 : wxString::Format(_L("Filament %d"), display_number((int)idx));
712 row->SetToolTip(name_str);
713
714 row->Bind(wxEVT_PAINT, [this, idx, sq, sq_r, sq_x, gap1, fil_clr, name_str, row_bg, hover_bg, name_fg](wxPaintEvent& e) {
715 auto* p = static_cast<wxPanel*>(e.GetEventObject());
716 wxAutoBufferedPaintDC dc(p);
717 wxSize sz = p->GetClientSize();
718
719 bool hovered = (m_hover_idx == (int)idx);
720 dc.SetBrush(wxBrush(hovered ? hover_bg : row_bg));
721 dc.SetPen(*wxTRANSPARENT_PEN);
722 dc.DrawRectangle(0, 0, sz.x, sz.y);
723
724 int sq_y = (sz.y - sq) / 2;
725 wxColour paint_clr = fil_clr;
726 if (idx < m_colors_rgba.size()) {
727 paint_clr = wxColour((unsigned char)(m_colors_rgba[idx][0] * 255.f),
728 (unsigned char)(m_colors_rgba[idx][1] * 255.f),
729 (unsigned char)(m_colors_rgba[idx][2] * 255.f));
730 }
731 dc.SetBrush(wxBrush(paint_clr));
732 dc.DrawRoundedRectangle(sq_x, sq_y, sq, sq, sq_r);
733 draw_filament_swatch_border(dc, paint_clr, sq_x, sq_y, sq, sq, sq_r);
734
735 {
736 wxFont nf = p->GetFont();
737 nf.SetPointSize(9);
738 dc.SetFont(nf);
739 dc.SetTextForeground(paint_clr.GetLuminance() < 0.51 ? *wxWHITE : *wxBLACK); // ORCA match used foreground color with other swatches
740 wxString ns = wxString::Format("%d", display_number((int)idx));
741 wxSize tsz = dc.GetTextExtent(ns);
742 dc.DrawText(ns, sq_x + (sq - tsz.x) / 2, sq_y + (sq - tsz.y) / 2);
743 }
744
745 // Material name
746 {
747 wxFont mf = p->GetFont();
748 mf.SetPointSize(10);
749 dc.SetFont(mf);
750 dc.SetTextForeground(name_fg);
751 int tx = sq_x + sq + gap1;
752 wxString display = ellipsize_text(dc, name_str, sz.x - tx - p->FromDIP(4));
753 wxSize tsz = dc.GetTextExtent(display);
754 if (!display.empty())
755 dc.DrawText(display, tx, (sz.y - tsz.y) / 2);
756 }
757 });
758
759 row->Bind(wxEVT_MOTION, [this, idx](wxMouseEvent& evt) {
760 if (m_hover_idx != (int)idx) {
761 m_hover_idx = (int)idx;
762 m_content->Refresh();
763 }
764 evt.Skip();
765 });
766 row->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& evt) {
767 if (m_hover_idx != -1) {
768 m_hover_idx = -1;
769 m_content->Refresh();
770 }
771 evt.Skip();
772 });
773
774 row->Bind(wxEVT_LEFT_DOWN, [this, idx](wxMouseEvent&) {
775 if (m_on_select) m_on_select((int)idx);
777 Dismiss();
778 });
779
780 return row;
781 }
static void draw_filament_swatch_border(wxDC &dc, const wxColour &colour, int x, int y, int w, int h, int radius=0)
Definition TextureImportDialog.cpp:167
static wxString ellipsize_text(wxDC &dc, wxString text, int max_width)
Definition TextureImportDialog.cpp:192
static wxColour texture_import_text_colour()
Definition TextureImportDialog.cpp:92
int display_number(int idx) const
Definition TextureImportDialog.cpp:893
int m_hover_idx
Definition TextureImportDialog.cpp:887
static wxString filament_name_to_wx_string(const std::string &name)
Definition TextureImportDialog.cpp:377
@ hovered
Definition GLGizmoEmboss.cpp:223

References _L, StateColor::darkModeColorFor(), display_number(), draw_filament_swatch_border(), ellipsize_text(), Slic3r::GUI::filament_name_to_wx_string(), m_closing_from_action, m_colors_rgba, m_content, m_hover_idx, m_names, m_on_select, texture_import_text_colour(), and Slic3r::GUI::wxMouseEvent.

Referenced by FilamentSelectPopup().

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

◆ create_mixed_item_row()

wxPanel * Slic3r::GUI::FilamentSelectPopup::create_mixed_item_row ( const TextureFilamentEntry & entry,
int row_h )
inlineprivate
784 {
785 wxColour row_bg = StateColor::darkModeColorFor(*wxWHITE);
786 wxColour hover_bg = StateColor::darkModeColorFor(wxColour("#F4F4F4"));
787 wxColour name_fg = texture_import_text_colour();
788 const int idx = entry.dialog_index;
789
790 wxPanel* row = new wxPanel(m_content, wxID_ANY, wxDefaultPosition, wxSize(-1, row_h));
791 row->SetBackgroundColour(row_bg);
792 row->SetBackgroundStyle(wxBG_STYLE_PAINT);
793 row->SetCursor(wxCursor(wxCURSOR_HAND));
794 row->SetToolTip(entry.name.empty() ? wxString::Format(_L("Filament %d"), display_number(idx)) : filament_name_to_wx_string(entry.name));
795
796 row->Bind(wxEVT_PAINT, [this, entry, idx, row_bg, hover_bg, name_fg](wxPaintEvent& e) {
797 auto* p = static_cast<wxPanel*>(e.GetEventObject());
798 wxAutoBufferedPaintDC dc(p);
799 wxSize sz = p->GetClientSize();
800 const bool hovered = (m_hover_idx == idx);
801 dc.SetBrush(wxBrush(hovered ? hover_bg : row_bg));
802 dc.SetPen(*wxTRANSPARENT_PEN);
803 dc.DrawRectangle(0, 0, sz.x, sz.y);
804
805 wxFont font = p->GetFont();
806 font.SetPointSize(9);
807 dc.SetFont(font);
808 int x = p->FromDIP(6); // ORCA Match left margins
809 const int sw = p->FromDIP(20); // ORCA Match color swatch sizes
810 const int sw_r = 0; //p->FromDIP(2);
811 const int y = (sz.y - sw) / 2;
812
813 for (size_t ci = 0; ci < entry.mixed_components.size() && ci < entry.mixed_ratios.size(); ++ci) {
814 if (ci > 0) {
815 dc.SetTextForeground(name_fg);
816 wxString plus = "+";
817 wxSize psz = dc.GetTextExtent(plus);
818 dc.DrawText(plus, x, (sz.y - psz.y) / 2);
819 x += psz.x + p->FromDIP(4);
820 }
821
822 const unsigned int comp_id = entry.mixed_components[ci];
823 const int comp_dialog_idx = comp_id >= 1 ? (int)comp_id - 1 : -1;
824 wxColour comp_clr("#D9D9D9");
825 if (comp_dialog_idx >= 0 && comp_dialog_idx < (int)m_colors_rgba.size()) {
826 const auto& c = m_colors_rgba[comp_dialog_idx];
827 comp_clr = wxColour((unsigned char)(c[0] * 255.f),
828 (unsigned char)(c[1] * 255.f),
829 (unsigned char)(c[2] * 255.f));
830 }
831
832 dc.SetBrush(wxBrush(comp_clr));
833 dc.SetPen(*wxTRANSPARENT_PEN);
834 dc.DrawRoundedRectangle(x, y, sw, sw, sw_r);
835 draw_filament_swatch_border(dc, comp_clr, x, y, sw, sw, sw_r);
836
837 wxString num = wxString::Format("%d", display_number(comp_dialog_idx));
838 wxSize nsz = dc.GetTextExtent(num);
839 dc.SetTextForeground(comp_clr.GetLuminance() < 0.6 ? *wxWHITE : texture_import_gray9000());
840 dc.DrawText(num, x + (sw - nsz.x) / 2, y + (sw - nsz.y) / 2);
841 x += sw + p->FromDIP(4);
842
843 dc.SetTextForeground(name_fg);
844 wxString pct = wxString::Format("%d%%", entry.mixed_ratios[ci]);
845 wxSize psz = dc.GetTextExtent(pct);
846 dc.DrawText(pct, x, (sz.y - psz.y) / 2);
847 x += psz.x + p->FromDIP(4);
848 }
849 });
850
851 row->Bind(wxEVT_MOTION, [this, idx](wxMouseEvent& evt) {
852 if (m_hover_idx != idx) {
853 m_hover_idx = idx;
854 m_content->Refresh();
855 }
856 evt.Skip();
857 });
858 row->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& evt) {
859 if (m_hover_idx != -1) {
860 m_hover_idx = -1;
861 m_content->Refresh();
862 }
863 evt.Skip();
864 });
865 row->Bind(wxEVT_LEFT_DOWN, [this, idx](wxMouseEvent&) {
866 if (m_on_select) m_on_select(idx);
868 Dismiss();
869 });
870
871 return row;
872 }
static wxColour texture_import_gray9000()
Definition TextureImportDialog.cpp:87
void plus(CGALMesh &A, CGALMesh &B)
Definition MeshBoolean.cpp:476

References _L, StateColor::darkModeColorFor(), Slic3r::GUI::TextureFilamentEntry::dialog_index, display_number(), draw_filament_swatch_border(), Slic3r::GUI::filament_name_to_wx_string(), m_closing_from_action, m_colors_rgba, m_content, m_hover_idx, m_on_select, Slic3r::GUI::TextureFilamentEntry::mixed_components, Slic3r::GUI::TextureFilamentEntry::mixed_ratios, Slic3r::GUI::TextureFilamentEntry::name, texture_import_gray9000(), texture_import_text_colour(), and Slic3r::GUI::wxMouseEvent.

Referenced by FilamentSelectPopup().

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

◆ display_number()

int Slic3r::GUI::FilamentSelectPopup::display_number ( int idx) const
inlineprivate
893 {
894 return (idx >= 0 && idx < (int)m_display_numbers.size() && m_display_numbers[idx] > 0)
895 ? m_display_numbers[idx] : idx + 1;
896 }

References m_display_numbers.

Referenced by create_item_row(), and create_mixed_item_row().

Here is the caller graph for this function:

◆ OnDismiss()

void Slic3r::GUI::FilamentSelectPopup::OnDismiss ( )
inlineoverrideprivate
662 {
665 m_closing_from_action = false;
666 wxPopupTransientWindow::OnDismiss();
668 }
void restore_cursor_state()
Definition TextureImportDialog.cpp:670
void schedule_destroy()
Definition TextureImportDialog.cpp:680

References m_closing_from_action, m_on_close, restore_cursor_state(), and schedule_destroy().

Here is the call graph for this function:

◆ restore_cursor_state()

void Slic3r::GUI::FilamentSelectPopup::restore_cursor_state ( )
inlineprivate
671 {
672 SetCursor(wxNullCursor);
673 if (m_content)
674 m_content->SetCursor(wxNullCursor);
675 if (m_dialog_anchor)
676 m_dialog_anchor->SetCursor(wxCursor(wxCURSOR_HAND));
677 wxSetCursor(wxNullCursor);
678 }

References m_content, and m_dialog_anchor.

Referenced by OnDismiss().

Here is the caller graph for this function:

◆ schedule_destroy()

void Slic3r::GUI::FilamentSelectPopup::schedule_destroy ( )
inlineprivate
681 {
683 return;
684 m_destroy_scheduled = true;
685 CallAfter([this]() { Destroy(); });
686 }
bool m_destroy_scheduled
Definition TextureImportDialog.cpp:889

References m_destroy_scheduled.

Referenced by OnDismiss().

Here is the caller graph for this function:

◆ ShouldDismissOnTopWindowDeactivate()

virtual bool PopupWindow::ShouldDismissOnTopWindowDeactivate ( )
inlineprotectedvirtualinherited

Reimplemented in DropDown.

28{ return true; }

Member Data Documentation

◆ m_can_add_filament

std::function<bool()> Slic3r::GUI::FilamentSelectPopup::m_can_add_filament
private

Referenced by FilamentSelectPopup().

◆ m_closing_from_action

bool Slic3r::GUI::FilamentSelectPopup::m_closing_from_action = false
private

◆ m_colors_rgba

std::vector<std::array<float, 4> > Slic3r::GUI::FilamentSelectPopup::m_colors_rgba
private

◆ m_content

wxScrolledWindow* Slic3r::GUI::FilamentSelectPopup::m_content = nullptr
private

◆ m_destroy_scheduled

bool Slic3r::GUI::FilamentSelectPopup::m_destroy_scheduled = false
private

Referenced by schedule_destroy().

◆ m_dialog_anchor

wxWindow* Slic3r::GUI::FilamentSelectPopup::m_dialog_anchor = nullptr
private

◆ m_display_numbers

std::vector<int> Slic3r::GUI::FilamentSelectPopup::m_display_numbers
private

◆ m_entries

std::vector<TextureFilamentEntry> Slic3r::GUI::FilamentSelectPopup::m_entries
private

Referenced by FilamentSelectPopup().

◆ m_hover_idx

int Slic3r::GUI::FilamentSelectPopup::m_hover_idx = -1
private

◆ m_names

std::vector<std::string> Slic3r::GUI::FilamentSelectPopup::m_names
private

◆ m_on_add_filament

std::function<void(wxColour)> Slic3r::GUI::FilamentSelectPopup::m_on_add_filament
private

Referenced by FilamentSelectPopup().

◆ m_on_close

std::function<void(bool)> Slic3r::GUI::FilamentSelectPopup::m_on_close
private

Referenced by FilamentSelectPopup(), and OnDismiss().

◆ m_on_decompose_color

std::function<void()> Slic3r::GUI::FilamentSelectPopup::m_on_decompose_color
private

Referenced by FilamentSelectPopup().

◆ m_on_select

std::function<void(int)> Slic3r::GUI::FilamentSelectPopup::m_on_select
private

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