Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GUI::Sidebar Class Reference

#include <src/slic3r/GUI/Plater.hpp>

+ Inheritance diagram for Slic3r::GUI::Sidebar:
+ Collaboration diagram for Slic3r::GUI::Sidebar:

Classes

struct  priv
 

Public Member Functions

 Sidebar (Plater *parent)
 
 Sidebar (Sidebar &&)=delete
 
 Sidebar (const Sidebar &)=delete
 
Sidebaroperator= (Sidebar &&)=delete
 
Sidebaroperator= (const Sidebar &)=delete
 
 ~Sidebar ()
 
void init_filament_combo (PlaterPresetComboBox **combo, const int extr_idx)
 
void remove_unused_filament_combos (const size_t current_extruder_count)
 
void update_all_preset_comboboxes ()
 
void update_presets (Slic3r::Preset::Type preset_type)
 
void update_mode_sizer () const
 
void change_top_border_for_mode_sizer (bool increase_border)
 
void update_reslice_btn_tooltip () const
 
void msw_rescale ()
 
void sys_color_changed ()
 
void update_mode_markers ()
 
void search ()
 
void jump_to_option (size_t selected)
 
void jump_to_option (const std::string &opt_key, Preset::Type type, const std::wstring &category)
 
ObjectManipulationobj_manipul ()
 
ObjectListobj_list ()
 
ObjectSettingsobj_settings ()
 
ObjectLayersobj_layers ()
 
wxScrolledWindow * scrolled_panel ()
 
wxPanel * presets_panel ()
 
ConfigOptionsGroupog_freq_chng_params (const bool is_fff)
 
wxButton * get_wiping_dialog_button ()
 
void update_objects_list_extruder_column (size_t extruders_count)
 
void show_info_sizer ()
 
void show_sliced_info_sizer (const bool show)
 
void update_sliced_info_sizer ()
 
void enable_buttons (bool enable)
 
void set_btn_label (const ActionButtonType btn_type, const wxString &label) const
 
bool show_reslice (bool show) const
 
bool show_export (bool show) const
 
bool show_send (bool show) const
 
bool show_eject (bool show) const
 
bool show_export_removable (bool show) const
 
bool get_eject_shown () const
 
bool is_multifilament ()
 
void update_mode ()
 
bool is_collapsed ()
 
void collapse (bool collapse)
 
void check_and_update_searcher (bool respect_mode=false)
 
void update_ui_from_settings ()
 
std::vector< PlaterPresetComboBox * > & combos_filament ()
 
Search::OptionsSearcherget_searcher ()
 
std::string & get_search_line ()
 

Private Attributes

ConfigOptionMode m_mode {ConfigOptionMode::comSimple}
 
std::unique_ptr< privp
 

Detailed Description

Constructor & Destructor Documentation

◆ Sidebar() [1/3]

Slic3r::GUI::Sidebar::Sidebar ( Plater parent)
765 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(42 * wxGetApp().em_unit(), -1)), p(new priv(parent))
766{
767 p->scrolled = new wxScrolledWindow(this);
768// p->scrolled->SetScrollbars(0, 100, 1, 2); // ys_DELETE_after_testing. pixelsPerUnitY = 100 from https://github.com/prusa3d/PrusaSlicer/commit/8f019e5fa992eac2c9a1e84311c990a943f80b01,
769 // but this cause the bad layout of the sidebar, when all infoboxes appear.
770 // As a result we can see the empty block at the bottom of the sidebar
771 // But if we set this value to 5, layout will be better
772 p->scrolled->SetScrollRate(0, 5);
773
774 SetFont(wxGetApp().normal_font());
775#ifndef __APPLE__
776#ifdef _WIN32
777 wxGetApp().UpdateDarkUI(this);
778 wxGetApp().UpdateDarkUI(p->scrolled);
779#else
780 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
781#endif
782#endif
783
784 // Sizer in the scrolled area
785 auto *scrolled_sizer = new wxBoxSizer(wxVERTICAL);
786 p->scrolled->SetSizer(scrolled_sizer);
787
788 // Sizer with buttons for mode changing
789 p->mode_sizer = new ModeSizer(p->scrolled, int(0.5 * wxGetApp().em_unit()));
790
791 // The preset chooser
792 p->sizer_presets = new wxFlexGridSizer(10, 1, 1, 2);
793 p->sizer_presets->AddGrowableCol(0, 1);
794 p->sizer_presets->SetFlexibleDirection(wxBOTH);
795
796 bool is_msw = false;
797#ifdef __WINDOWS__
798 p->scrolled->SetDoubleBuffered(true);
799
800 p->presets_panel = new wxPanel(p->scrolled, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
801 wxGetApp().UpdateDarkUI(p->presets_panel);
802 p->presets_panel->SetSizer(p->sizer_presets);
803
804 is_msw = true;
805#else
806 p->presets_panel = p->scrolled;
807#endif //__WINDOWS__
808
809 p->sizer_filaments = new wxBoxSizer(wxVERTICAL);
810
811 const int margin_5 = int(0.5 * wxGetApp().em_unit());// 5;
812
813 auto init_combo = [this, margin_5](PlaterPresetComboBox **combo, wxString label, Preset::Type preset_type, bool filament) {
814 auto *text = new wxStaticText(p->presets_panel, wxID_ANY, label + ":");
815 text->SetFont(wxGetApp().small_font());
816 *combo = new PlaterPresetComboBox(p->presets_panel, preset_type);
817
818 auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
819 combo_and_btn_sizer->Add(*combo, 1, wxEXPAND);
820 if ((*combo)->edit_btn)
821 combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT,
822 int(0.3*wxGetApp().em_unit()));
823
824 auto *sizer_presets = this->p->sizer_presets;
825 auto *sizer_filaments = this->p->sizer_filaments;
826 // Hide controls, which will be shown/hidden in respect to the printer technology
827 text->Show(preset_type == Preset::TYPE_PRINTER);
828 sizer_presets->Add(text, 0, wxALIGN_LEFT | wxEXPAND | wxRIGHT, 4);
829 if (! filament) {
830 combo_and_btn_sizer->ShowItems(preset_type == Preset::TYPE_PRINTER);
831 sizer_presets->Add(combo_and_btn_sizer, 0, wxEXPAND |
832#ifdef __WXGTK3__
833 wxRIGHT, margin_5);
834#else
835 wxBOTTOM, 1);
836 (void)margin_5; // supress unused capture warning
837#endif // __WXGTK3__
838 } else {
839 sizer_filaments->Add(combo_and_btn_sizer, 0, wxEXPAND |
840#ifdef __WXGTK3__
841 wxRIGHT, margin_5);
842#else
843 wxBOTTOM, 1);
844#endif // __WXGTK3__
845 (*combo)->set_extruder_idx(0);
846 sizer_filaments->ShowItems(false);
847 sizer_presets->Add(sizer_filaments, 1, wxEXPAND);
848 }
849 };
850
851 p->combos_filament.push_back(nullptr);
852 init_combo(&p->combo_print, _L("Print settings"), Preset::TYPE_PRINT, false);
853 init_combo(&p->combos_filament[0], _L("Filament"), Preset::TYPE_FILAMENT, true);
854 init_combo(&p->combo_sla_print, _L("SLA print settings"), Preset::TYPE_SLA_PRINT, false);
855 init_combo(&p->combo_sla_material, _L("SLA material"), Preset::TYPE_SLA_MATERIAL, false);
856 init_combo(&p->combo_printer, _L("Printer"), Preset::TYPE_PRINTER, false);
857
858 p->sizer_params = new wxBoxSizer(wxVERTICAL);
859
860 // Frequently changed parameters
861 p->frequently_changed_parameters = new FreqChangedParams(p->scrolled);
862 p->sizer_params->Add(p->frequently_changed_parameters->get_sizer(), 0, wxEXPAND | wxTOP | wxBOTTOM
863#ifdef __WXGTK3__
864 | wxRIGHT
865#endif // __WXGTK3__
866 , wxOSX ? 1 : margin_5);
867
868 // Object List
869 p->object_list = new ObjectList(p->scrolled);
870 p->sizer_params->Add(p->object_list->get_sizer(), 1, wxEXPAND);
871
872 // Object Manipulations
873 p->object_manipulation = new ObjectManipulation(p->scrolled);
874 p->object_manipulation->Hide();
875 p->sizer_params->Add(p->object_manipulation->get_sizer(), 0, wxEXPAND | wxTOP, margin_5);
876
877 // Frequently Object Settings
878 p->object_settings = new ObjectSettings(p->scrolled);
879 p->object_settings->Hide();
880 p->sizer_params->Add(p->object_settings->get_sizer(), 0, wxEXPAND | wxTOP, margin_5);
881
882 // Object Layers
883 p->object_layers = new ObjectLayers(p->scrolled);
884 p->object_layers->Hide();
885 p->sizer_params->Add(p->object_layers->get_sizer(), 0, wxEXPAND | wxTOP, margin_5);
886
887 // Info boxes
888 p->object_info = new ObjectInfo(p->scrolled);
889 p->sliced_info = new SlicedInfo(p->scrolled);
890
891 // Sizer in the scrolled area
892 if (p->mode_sizer)
893 scrolled_sizer->Add(p->mode_sizer, 0, wxALIGN_CENTER_HORIZONTAL);
894
895 int size_margin = wxGTK3 ? wxLEFT | wxRIGHT : wxLEFT;
896
897 is_msw ?
898 scrolled_sizer->Add(p->presets_panel, 0, wxEXPAND | size_margin, margin_5) :
899 scrolled_sizer->Add(p->sizer_presets, 0, wxEXPAND | size_margin, margin_5);
900 scrolled_sizer->Add(p->sizer_params, 1, wxEXPAND | size_margin, margin_5);
901 scrolled_sizer->Add(p->object_info, 0, wxEXPAND | wxTOP | size_margin, margin_5);
902 scrolled_sizer->Add(p->sliced_info, 0, wxEXPAND | wxTOP | size_margin, margin_5);
903
904 // Buttons underneath the scrolled area
905
906 // rescalable bitmap buttons "Send to printer" and "Remove device"
907
908 auto init_scalable_btn = [this](ScalableButton** btn, const std::string& icon_name, wxString tooltip = wxEmptyString)
909 {
910#ifdef __APPLE__
911 int bmp_px_cnt = 16;
912#else
913 int bmp_px_cnt = 32;
914#endif //__APPLE__
915 ScalableBitmap bmp = ScalableBitmap(this, icon_name, bmp_px_cnt);
916 *btn = new ScalableButton(this, wxID_ANY, bmp, "", wxBU_EXACTFIT);
917
918#ifdef _WIN32
919 (*btn)->Bind(wxEVT_ENTER_WINDOW, [tooltip, btn, this](wxMouseEvent& event) {
920 p->show_rich_tip(tooltip, *btn);
921 event.Skip();
922 });
923 (*btn)->Bind(wxEVT_LEAVE_WINDOW, [btn, this](wxMouseEvent& event) {
924 p->hide_rich_tip(*btn);
925 event.Skip();
926 });
927#else
928 (*btn)->SetToolTip(tooltip);
929#endif // _WIN32
930 (*btn)->Hide();
931 };
932
933 init_scalable_btn(&p->btn_send_gcode , "export_gcode", _L("Send to printer") + " " +GUI::shortkey_ctrl_prefix() + "Shift+G");
934// init_scalable_btn(&p->btn_eject_device, "eject_sd" , _L("Remove device ") + GUI::shortkey_ctrl_prefix() + "T");
935 init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _L("Export to SD card / Flash drive") + " " + GUI::shortkey_ctrl_prefix() + "U");
936
937 // regular buttons "Slice now" and "Export G-code"
938
939// const int scaled_height = p->btn_eject_device->GetBitmapHeight() + 4;
940#ifdef _WIN32
941 const int scaled_height = p->btn_export_gcode_removable->GetBitmapHeight();
942#else
943 const int scaled_height = p->btn_export_gcode_removable->GetBitmapHeight() + 4;
944#endif
945 auto init_btn = [this](wxButton **btn, wxString label, const int button_height) {
946 *btn = new wxButton(this, wxID_ANY, label, wxDefaultPosition,
947 wxSize(-1, button_height), wxBU_EXACTFIT);
948 (*btn)->SetFont(wxGetApp().bold_font());
949 wxGetApp().UpdateDarkUI((*btn), true);
950 };
951
952 init_btn(&p->btn_export_gcode, _L("Export G-code") + dots , scaled_height);
953 init_btn(&p->btn_reslice , _L("Slice now") , scaled_height);
954
955 enable_buttons(false);
956
957 auto *btns_sizer = new wxBoxSizer(wxVERTICAL);
958
959 auto* complect_btns_sizer = new wxBoxSizer(wxHORIZONTAL);
960 complect_btns_sizer->Add(p->btn_export_gcode, 1, wxEXPAND);
961 complect_btns_sizer->Add(p->btn_send_gcode, 0, wxLEFT, margin_5);
962 complect_btns_sizer->Add(p->btn_export_gcode_removable, 0, wxLEFT, margin_5);
963// complect_btns_sizer->Add(p->btn_eject_device);
964
965
966 btns_sizer->Add(p->btn_reslice, 0, wxEXPAND | wxTOP, margin_5);
967 btns_sizer->Add(complect_btns_sizer, 0, wxEXPAND | wxTOP, margin_5);
968
969 auto *sizer = new wxBoxSizer(wxVERTICAL);
970 sizer->Add(p->scrolled, 1, wxEXPAND);
971 sizer->Add(btns_sizer, 0, wxEXPAND | wxLEFT, margin_5);
972 SetSizer(sizer);
973
974 // Events
975 p->btn_export_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->export_gcode(false); });
976 p->btn_reslice->Bind(wxEVT_BUTTON, [this](wxCommandEvent&)
977 {
978 if (p->plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
979 return;
980
981 const bool export_gcode_after_slicing = wxGetKeyState(WXK_SHIFT);
982 if (export_gcode_after_slicing)
983 p->plater->export_gcode(true);
984 else
985 p->plater->reslice();
986 p->plater->select_view_3D("Preview");
987 });
988
989#ifdef _WIN32
990 p->btn_reslice->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& event) {
991 p->show_rich_tip(p->btn_reslice_tip, p->btn_reslice);
992 event.Skip();
993 });
994 p->btn_reslice->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& event) {
995 p->hide_rich_tip(p->btn_reslice);
996 event.Skip();
997 });
998#endif // _WIN32
999
1000 p->btn_send_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->send_gcode(); });
1001// p->btn_eject_device->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->eject_drive(); });
1002 p->btn_export_gcode_removable->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->export_gcode(true); });
1003}
#define wxOSX
Definition Field.cpp:26
#define wxGTK3
Definition OptionsGroup.hpp:25
Definition wxExtensions.hpp:319
Definition wxExtensions.hpp:136
Definition wxExtensions.hpp:217
void enable_buttons(bool enable)
Definition Plater.cpp:1498
std::unique_ptr< priv > p
Definition Plater.hpp:130
Type
Definition Preset.hpp:110
@ TYPE_SLA_PRINT
Definition Preset.hpp:113
@ TYPE_PRINTER
Definition Preset.hpp:116
@ TYPE_PRINT
Definition Preset.hpp:112
@ TYPE_SLA_MATERIAL
Definition Preset.hpp:115
@ TYPE_FILAMENT
Definition Preset.hpp:114
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
const std::string & shortkey_ctrl_prefix()
Definition GUI.cpp:78
static wxString dots("…", wxConvUTF8)
Definition CutSurface.cpp:39
#define _L(s)
Definition I18N.hpp:3
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:388
#define wxEVT_BUTTON
Definition wxinit.h:18

References _L, Slic3r::GUI::dots(), em_unit(), enable_buttons(), p, Slic3r::GUI::shortkey_ctrl_prefix(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, Slic3r::Preset::TYPE_SLA_PRINT, void(), wxEVT_BUTTON, wxGTK3, and wxOSX.

+ Here is the call graph for this function:

◆ Sidebar() [2/3]

Slic3r::GUI::Sidebar::Sidebar ( Sidebar &&  )
delete

◆ Sidebar() [3/3]

Slic3r::GUI::Sidebar::Sidebar ( const Sidebar )
delete

◆ ~Sidebar()

Slic3r::GUI::Sidebar::~Sidebar ( )
1005{}

Member Function Documentation

◆ change_top_border_for_mode_sizer()

void Slic3r::GUI::Sidebar::change_top_border_for_mode_sizer ( bool  increase_border)
1114{
1115 if (p->mode_sizer) {
1116 p->mode_sizer->set_items_flag(increase_border ? wxTOP : 0);
1117 p->mode_sizer->set_items_border(increase_border ? int(0.5 * wxGetApp().em_unit()) : 0);
1118 }
1119}

References em_unit(), and p.

Referenced by Slic3r::GUI::MainFrame::update_layout().

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

◆ check_and_update_searcher()

void Slic3r::GUI::Sidebar::check_and_update_searcher ( bool  respect_mode = false)
1520{
1521 std::vector<Search::InputInfo> search_inputs{};
1522
1523 auto& tabs_list = wxGetApp().tabs_list;
1524 auto print_tech = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology();
1525 for (auto tab : tabs_list)
1526 if (tab->supports_printer_technology(print_tech))
1527 search_inputs.emplace_back(Search::InputInfo{ tab->get_config(), tab->type() });
1528
1529 p->searcher.check_and_update(wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology(),
1530 respect_mode ? m_mode : comExpert, search_inputs);
1531}
ConfigOptionMode m_mode
Definition Plater.hpp:69
if(!(yy_init))
Definition lexer.c:1190
@ comExpert
Definition Config.hpp:200

References Slic3r::Search::InputInfo::type.

◆ collapse()

void Slic3r::GUI::Sidebar::collapse ( bool  collapse)
1556{
1557 p->is_collapsed = collapse;
1558
1559 this->Show(!collapse);
1560 p->plater->Layout();
1561
1562 // save collapsing state to the AppConfig
1563 if (wxGetApp().is_editor())
1564 wxGetApp().app_config->set("collapsed_sidebar", collapse ? "1" : "0");
1565}
void collapse(bool collapse)
Definition Plater.cpp:1555

Referenced by Slic3r::GUI::Plater::priv::collapse_sidebar().

+ Here is the caller graph for this function:

◆ combos_filament()

std::vector< PlaterPresetComboBox * > & Slic3r::GUI::Sidebar::combos_filament ( )
1587{
1588 return p->combos_filament;
1589}

Referenced by Slic3r::GUI::Plater::on_extruders_change().

+ Here is the caller graph for this function:

◆ enable_buttons()

void Slic3r::GUI::Sidebar::enable_buttons ( bool  enable)
1499{
1500 p->btn_reslice->Enable(enable);
1501 p->btn_export_gcode->Enable(enable);
1502 p->btn_send_gcode->Enable(enable);
1503// p->btn_eject_device->Enable(enable);
1504 p->btn_export_gcode_removable->Enable(enable);
1505}

References p.

Referenced by Sidebar(), and Slic3r::GUI::Plater::priv::object_list_changed().

+ Here is the caller graph for this function:

◆ get_eject_shown()

bool Slic3r::GUI::Sidebar::get_eject_shown ( ) const

◆ get_search_line()

std::string & Slic3r::GUI::Sidebar::get_search_line ( )
1597{
1598 // update searcher before show imGui search dialog on the plater, if printer technology or mode was changed
1600 return p->searcher.search_string();
1601}
void check_and_update_searcher(bool respect_mode=false)
Definition Plater.cpp:1519

Referenced by Slic3r::GUI::GLCanvas3D::_render_search_list().

+ Here is the caller graph for this function:

◆ get_searcher()

Search::OptionsSearcher & Slic3r::GUI::Sidebar::get_searcher ( )
1592{
1593 return p->searcher;
1594}

Referenced by Slic3r::GUI::GLCanvas3D::_render_search_list().

+ Here is the caller graph for this function:

◆ get_wiping_dialog_button()

wxButton * Slic3r::GUI::Sidebar::get_wiping_dialog_button ( )
1266{
1267 return p->frequently_changed_parameters->get_wiping_dialog_button();
1268}

References p.

◆ init_filament_combo()

void Slic3r::GUI::Sidebar::init_filament_combo ( PlaterPresetComboBox **  combo,
const int  extr_idx 
)
1008{
1009 *combo = new PlaterPresetComboBox(p->presets_panel, Slic3r::Preset::TYPE_FILAMENT);
1010 (*combo)->set_extruder_idx(extr_idx);
1011
1012 auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
1013 combo_and_btn_sizer->Add(*combo, 1, wxEXPAND);
1014 combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
1015 int(0.3*wxGetApp().em_unit()));
1016
1017 this->p->sizer_filaments->Add(combo_and_btn_sizer, 1, wxEXPAND |
1018#ifdef __WXGTK3__
1019 wxRIGHT, int(0.5 * wxGetApp().em_unit()));
1020#else
1021 wxBOTTOM, 1);
1022#endif // __WXGTK3__
1023}

References em_unit(), p, and Slic3r::Preset::TYPE_FILAMENT.

Referenced by Slic3r::GUI::Plater::on_extruders_change().

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

◆ is_collapsed()

bool Slic3r::GUI::Sidebar::is_collapsed ( )
1553{ return p->is_collapsed; }

Referenced by Slic3r::GUI::Plater::priv::is_sidebar_collapsed().

+ Here is the caller graph for this function:

◆ is_multifilament()

bool Slic3r::GUI::Sidebar::is_multifilament ( )
1515{
1516 return p->combos_filament.size() > 1;
1517}

References p.

◆ jump_to_option() [1/2]

void Slic3r::GUI::Sidebar::jump_to_option ( const std::string &  opt_key,
Preset::Type  type,
const std::wstring &  category 
)
1216{
1217 //const Search::Option& opt = p->searcher.get_option(opt_key, type);
1218 wxGetApp().get_tab(type)->activate_option(opt_key, category);
1219}

◆ jump_to_option() [2/2]

void Slic3r::GUI::Sidebar::jump_to_option ( size_t  selected)
1222{
1223 const Search::Option& opt = p->searcher.get_option(selected);
1224 if (opt.type == Preset::TYPE_PREFERENCES)
1225 wxGetApp().open_preferences(opt.opt_key(), boost::nowide::narrow(opt.group));
1226 else
1227 wxGetApp().get_tab(opt.type)->activate_option(opt.opt_key(), boost::nowide::narrow(opt.category));
1228}
@ TYPE_PREFERENCES
Definition Preset.hpp:122
char * narrow(char *output, size_t output_size, wchar_t const *source)
Convert NULL terminated UTF source string to NULL terminated output string of size at most output_siz...
Definition convert.hpp:73

References Slic3r::Search::Option::category, Slic3r::Search::Option::group, boost::nowide::narrow(), Slic3r::Search::Option::opt_key(), p, Slic3r::Search::Option::type, and Slic3r::Preset::TYPE_PREFERENCES.

Referenced by Slic3r::GUI::GLCanvas3D::_render_search_list().

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

◆ msw_rescale()

void Slic3r::GUI::Sidebar::msw_rescale ( )
1134{
1135 SetMinSize(wxSize(40 * wxGetApp().em_unit(), -1));
1136
1137 for (PlaterPresetComboBox* combo : std::vector<PlaterPresetComboBox*> { p->combo_print,
1138 p->combo_sla_print,
1139 p->combo_sla_material,
1140 p->combo_printer } )
1141 combo->msw_rescale();
1142 for (PlaterPresetComboBox* combo : p->combos_filament)
1143 combo->msw_rescale();
1144
1145 p->frequently_changed_parameters->msw_rescale();
1146 p->object_list->msw_rescale();
1147 p->object_manipulation->msw_rescale();
1148 p->object_layers->msw_rescale();
1149
1150#ifdef _WIN32
1151 const int scaled_height = p->btn_export_gcode_removable->GetBitmapHeight();
1152#else
1153 const int scaled_height = p->btn_export_gcode_removable->GetBitmapHeight() + 4;
1154#endif
1155 p->btn_export_gcode->SetMinSize(wxSize(-1, scaled_height));
1156 p->btn_reslice ->SetMinSize(wxSize(-1, scaled_height));
1157
1158 p->scrolled->Layout();
1159
1160 p->searcher.dlg_msw_rescale();
1161}
std::vector< PlaterPresetComboBox * > & combos_filament()
Definition Plater.cpp:1586
void msw_rescale()
Definition Plater.cpp:1133
STL namespace.

References em_unit(), and p.

+ Here is the call graph for this function:

◆ obj_layers()

ObjectLayers * Slic3r::GUI::Sidebar::obj_layers ( )
1246{
1247 return p->object_layers;
1248}

References p.

Referenced by Slic3r::GUI::GUI_App::obj_layers().

+ Here is the caller graph for this function:

◆ obj_list()

◆ obj_manipul()

ObjectManipulation * Slic3r::GUI::Sidebar::obj_manipul ( )
1231{
1232 return p->object_manipulation;
1233}

References p.

Referenced by Slic3r::GUI::GUI_App::obj_manipul(), and Slic3r::GUI::Plater::priv::update().

+ Here is the caller graph for this function:

◆ obj_settings()

ObjectSettings * Slic3r::GUI::Sidebar::obj_settings ( )
1241{
1242 return p->object_settings;
1243}

References p.

Referenced by Slic3r::GUI::GUI_App::obj_settings(), and Slic3r::GUI::ObjectList::update_settings_item_and_selection().

+ Here is the caller graph for this function:

◆ og_freq_chng_params()

ConfigOptionsGroup * Slic3r::GUI::Sidebar::og_freq_chng_params ( const bool  is_fff)
1261{
1262 return p->frequently_changed_parameters->get_og(is_fff);
1263}

References p.

◆ operator=() [1/2]

Sidebar & Slic3r::GUI::Sidebar::operator= ( const Sidebar )
delete

◆ operator=() [2/2]

Sidebar & Slic3r::GUI::Sidebar::operator= ( Sidebar &&  )
delete

◆ presets_panel()

wxPanel * Slic3r::GUI::Sidebar::presets_panel ( )
1256{
1257 return p->presets_panel;
1258}

References p.

Referenced by Slic3r::GUI::Plater::priv::on_select_preset().

+ Here is the caller graph for this function:

◆ remove_unused_filament_combos()

void Slic3r::GUI::Sidebar::remove_unused_filament_combos ( const size_t  current_extruder_count)
1026{
1027 if (current_extruder_count >= p->combos_filament.size())
1028 return;
1029 auto sizer_filaments = this->p->sizer_filaments;
1030 while (p->combos_filament.size() > current_extruder_count) {
1031 const int last = p->combos_filament.size() - 1;
1032 sizer_filaments->Remove(last);
1033 (*p->combos_filament[last]).Destroy();
1034 p->combos_filament.pop_back();
1035 }
1036}

References p.

Referenced by Slic3r::GUI::Plater::on_extruders_change().

+ Here is the caller graph for this function:

◆ scrolled_panel()

wxScrolledWindow * Slic3r::GUI::Sidebar::scrolled_panel ( )
1251{
1252 return p->scrolled;
1253}

References p.

Referenced by Slic3r::GUI::Plater::on_extruders_change().

+ Here is the caller graph for this function:

◆ search()

void Slic3r::GUI::Sidebar::search ( )
1211{
1212 p->searcher.search();
1213}

References p.

Referenced by Slic3r::GUI::GLCanvas3D::_render_search_list().

+ Here is the caller graph for this function:

◆ set_btn_label()

void Slic3r::GUI::Sidebar::set_btn_label ( const ActionButtonType  btn_type,
const wxString &  label 
) const
5193{
5194 switch (btn_type)
5195 {
5196 case ActionButtonType::abReslice: p->btn_reslice->SetLabelText(label); break;
5197 case ActionButtonType::abExport: p->btn_export_gcode->SetLabelText(label); break;
5198 case ActionButtonType::abSendGCode: /*p->btn_send_gcode->SetLabelText(label);*/ break;
5199 }
5200}

References Slic3r::GUI::abExport, Slic3r::GUI::abReslice, Slic3r::GUI::abSendGCode, and Slic3r::GUI::Plater::p.

Referenced by Slic3r::GUI::Plater::priv::on_process_completed(), and Slic3r::GUI::Plater::priv::update_background_process().

+ Here is the caller graph for this function:

◆ show_eject()

bool Slic3r::GUI::Sidebar::show_eject ( bool  show) const

◆ show_export()

bool Slic3r::GUI::Sidebar::show_export ( bool  show) const
1508{ return p->btn_export_gcode->Show(show); }

References p.

Referenced by Slic3r::GUI::Plater::priv::show_action_buttons().

+ Here is the caller graph for this function:

◆ show_export_removable()

bool Slic3r::GUI::Sidebar::show_export_removable ( bool  show) const
1510{ return p->btn_export_gcode_removable->Show(show); }

References p.

Referenced by Slic3r::GUI::Plater::priv::show_action_buttons().

+ Here is the caller graph for this function:

◆ show_info_sizer()

void Slic3r::GUI::Sidebar::show_info_sizer ( )
1276{
1277 Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
1278 ModelObjectPtrs objects = p->plater->model().objects;
1279 int obj_idx = selection.get_object_idx();
1280
1281 if (m_mode < comExpert || objects.empty() || obj_idx < 0 || int(objects.size()) <= obj_idx ||
1282 objects[obj_idx]->volumes.empty() || // hack to avoid crash when deleting the last object on the bed
1283 (selection.is_single_full_object() && objects[obj_idx]->instances.size()> 1) ||
1284 !(selection.is_single_full_instance() || selection.is_single_volume())) {
1285 p->object_info->Show(false);
1286 return;
1287 }
1288
1289 const ModelObject* model_object = objects[obj_idx];
1290
1291 int inst_idx = selection.get_instance_idx();
1292 assert(inst_idx >= 0);
1293
1294 bool imperial_units = wxGetApp().app_config->get_bool("use_inches");
1295 double koef = imperial_units ? ObjectManipulation::mm_to_in : 1.0f;
1296
1297 ModelVolume* vol = nullptr;
1298 Transform3d t;
1299 if (selection.is_single_volume()) {
1300 std::vector<int> obj_idxs, vol_idxs;
1301 wxGetApp().obj_list()->get_selection_indexes(obj_idxs, vol_idxs);
1302 if (vol_idxs.size() != 1)
1303 // Case when this fuction is called between update selection in ObjectList and on Canvas
1304 // Like after try to delete last solid part in object, the object is selected in ObjectLIst when just a part is still selected on Canvas
1305 // see https://github.com/prusa3d/PrusaSlicer/issues/7408
1306 return;
1307 vol = model_object->volumes[vol_idxs[0]];
1308 t = model_object->instances[inst_idx]->get_matrix() * vol->get_matrix();
1309 }
1310
1311 Vec3d size = vol ? vol->mesh().transformed_bounding_box(t).size() : model_object->instance_bounding_box(inst_idx).size();
1312 p->object_info->info_size->SetLabel(wxString::Format("%.2f x %.2f x %.2f", size(0)*koef, size(1)*koef, size(2)*koef));
1313// p->object_info->info_materials->SetLabel(wxString::Format("%d", static_cast<int>(model_object->materials_count())));
1314
1315 const TriangleMeshStats& stats = vol ? vol->mesh().stats() : model_object->get_object_stl_stats();
1316
1317 double volume_val = stats.volume;
1318 if (vol)
1319 volume_val *= std::fabs(t.matrix().block(0, 0, 3, 3).determinant());
1320
1321 p->object_info->info_volume->SetLabel(wxString::Format("%.2f", volume_val * pow(koef,3)));
1322 p->object_info->info_facets->SetLabel(format_wxstr(_L_PLURAL("%1% (%2$d shell)", "%1% (%2$d shells)", stats.number_of_parts),
1323 static_cast<int>(model_object->facets_count()), stats.number_of_parts));
1324
1325 wxString info_manifold_label;
1326 auto mesh_errors = obj_list()->get_mesh_errors_info(&info_manifold_label);
1327 wxString tooltip = mesh_errors.tooltip;
1328 p->object_info->update_warning_icon(mesh_errors.warning_icon_name);
1329 p->object_info->info_manifold->SetLabel(info_manifold_label);
1330 p->object_info->info_manifold->SetToolTip(tooltip);
1331 p->object_info->manifold_warning_icon->SetToolTip(tooltip);
1332
1333 p->object_info->show_sizer(true);
1334 if (vol || model_object->volumes.size() == 1)
1335 p->object_info->info_icon->Hide();
1336
1337 if (p->plater->printer_technology() == ptSLA) {
1338 for (auto item: p->object_info->sla_hidden_items)
1339 item->Show(false);
1340 }
1341}
MeshErrorsInfo get_mesh_errors_info(const int obj_idx, const int vol_idx=-1, wxString *sidebar_info=nullptr) const
Definition GUI_ObjectList.cpp:426
static const double mm_to_in
Definition GUI_ObjectManipulation.hpp:74
ObjectList * obj_list()
Definition Plater.cpp:1235
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half pow(const half &a, const half &b)
Definition Half.h:477
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:42
wxString tooltip
Definition GUI_ObjectList.hpp:73
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:81
@ ptSLA
Definition Config.hpp:209
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:52
std::vector< ModelObject * > ModelObjectPtrs
Definition Model.hpp:105
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:93

References _L_PLURAL, Slic3r::comExpert, Slic3r::ModelObject::facets_count(), Slic3r::GUI::format_wxstr(), Slic3r::GUI::Selection::get_instance_idx(), Slic3r::ModelVolume::get_matrix(), Slic3r::GUI::ObjectList::get_mesh_errors_info(), Slic3r::GUI::Selection::get_object_idx(), Slic3r::ModelObject::get_object_stl_stats(), Slic3r::ModelObject::instance_bounding_box(), Slic3r::ModelObject::instances, Slic3r::GUI::Selection::is_single_full_instance(), Slic3r::GUI::Selection::is_single_full_object(), Slic3r::GUI::Selection::is_single_volume(), m_mode, Eigen::Transform< _Scalar, _Dim, _Mode, _Options >::matrix(), Slic3r::ModelVolume::mesh(), Slic3r::GUI::ObjectManipulation::mm_to_in, Slic3r::TriangleMeshStats::number_of_parts, obj_list(), p, Slic3r::ptSLA, Slic3r::BoundingBox3Base< PointType >::size(), Slic3r::TriangleMesh::stats(), Slic3r::GUI::MeshErrorsInfo::tooltip, Slic3r::TriangleMesh::transformed_bounding_box(), Slic3r::TriangleMeshStats::volume, and Slic3r::ModelObject::volumes.

+ Here is the call graph for this function:

◆ show_reslice()

bool Slic3r::GUI::Sidebar::show_reslice ( bool  show) const
1507{ return p->btn_reslice->Show(show); }

References p.

Referenced by Slic3r::GUI::Plater::priv::show_action_buttons().

+ Here is the caller graph for this function:

◆ show_send()

bool Slic3r::GUI::Sidebar::show_send ( bool  show) const
1509{ return p->btn_send_gcode->Show(show); }

References p.

Referenced by Slic3r::GUI::Plater::priv::show_action_buttons().

+ Here is the caller graph for this function:

◆ show_sliced_info_sizer()

void Slic3r::GUI::Sidebar::show_sliced_info_sizer ( const bool  show)
1487{
1488 wxWindowUpdateLocker freeze_guard(this);
1489
1490 p->sliced_info->Show(show);
1491 if (show)
1493
1494 Layout();
1495 p->scrolled->Refresh();
1496}
void update_sliced_info_sizer()
Definition Plater.cpp:1343

References p, and update_sliced_info_sizer().

Referenced by Slic3r::GUI::Plater::priv::delete_all_objects_from_model(), Slic3r::GUI::Plater::priv::on_process_completed(), Slic3r::GUI::Plater::priv::reset(), and Slic3r::GUI::Plater::priv::update_background_process().

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

◆ sys_color_changed()

void Slic3r::GUI::Sidebar::sys_color_changed ( )
1164{
1165#ifdef _WIN32
1166 wxWindowUpdateLocker noUpdates(this);
1167
1168 for (wxWindow* win : std::vector<wxWindow*>{ this, p->sliced_info->GetStaticBox(), p->object_info->GetStaticBox(), p->btn_reslice, p->btn_export_gcode })
1169 wxGetApp().UpdateDarkUI(win);
1170 for (wxWindow* win : std::vector<wxWindow*>{ p->scrolled, p->presets_panel })
1171 wxGetApp().UpdateAllStaticTextDarkUI(win);
1172 for (wxWindow* btn : std::vector<wxWindow*>{ p->btn_reslice, p->btn_export_gcode })
1173 wxGetApp().UpdateDarkUI(btn, true);
1174
1175 if (p->mode_sizer)
1176 p->mode_sizer->sys_color_changed();
1177 p->frequently_changed_parameters->sys_color_changed();
1178 p->object_settings->sys_color_changed();
1179#endif
1180
1181 for (PlaterPresetComboBox* combo : std::vector<PlaterPresetComboBox*>{ p->combo_print,
1182 p->combo_sla_print,
1183 p->combo_sla_material,
1184 p->combo_printer })
1185 combo->sys_color_changed();
1186 for (PlaterPresetComboBox* combo : p->combos_filament)
1187 combo->sys_color_changed();
1188
1189 p->object_list->sys_color_changed();
1190 p->object_manipulation->sys_color_changed();
1191 p->object_layers->sys_color_changed();
1192
1193 // btn...->msw_rescale() updates icon on button, so use it
1194 p->btn_send_gcode->sys_color_changed();
1195// p->btn_eject_device->msw_rescale();
1196 p->btn_export_gcode_removable->sys_color_changed();
1197
1198 p->scrolled->Layout();
1199 p->scrolled->Refresh();
1200
1201 p->searcher.dlg_sys_color_changed();
1202}
void sys_color_changed()
Definition Plater.cpp:1163

References p.

◆ update_all_preset_comboboxes()

void Slic3r::GUI::Sidebar::update_all_preset_comboboxes ( )
1039{
1040 PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
1041 const auto print_tech = preset_bundle.printers.get_edited_preset().printer_technology();
1042
1043 // Update the print choosers to only contain the compatible presets, update the dirty flags.
1044 if (print_tech == ptFFF)
1045 p->combo_print->update();
1046 else {
1047 p->combo_sla_print->update();
1048 p->combo_sla_material->update();
1049 }
1050 // Update the printer choosers, update the dirty flags.
1051 p->combo_printer->update();
1052 // Update the filament choosers to only contain the compatible presets, update the color preview,
1053 // update the dirty flags.
1054 if (print_tech == ptFFF) {
1055 for (PlaterPresetComboBox* cb : p->combos_filament)
1056 cb->update();
1057 }
1058}
@ ptFFF
Definition Config.hpp:207

References Slic3r::PresetCollection::get_edited_preset(), p, Slic3r::Preset::printer_technology(), Slic3r::PresetBundle::printers, and Slic3r::ptFFF.

Referenced by update_presets().

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

◆ update_mode()

void Slic3r::GUI::Sidebar::update_mode ( )
1534{
1535 m_mode = wxGetApp().get_mode();
1536
1539
1540 wxWindowUpdateLocker noUpdates(this);
1541
1542 if (m_mode == comSimple)
1543 p->object_manipulation->set_coordinates_type(ECoordinatesType::World);
1544
1545 p->object_list->get_sizer()->Show(m_mode > comSimple);
1546
1547 p->object_list->unselect_objects();
1548 p->object_list->update_selections();
1549
1550 Layout();
1551}
void update_reslice_btn_tooltip() const
Definition Plater.cpp:1121
void update_mode_sizer() const
Definition Plater.cpp:1107
@ comSimple
Definition Config.hpp:198

References Slic3r::comSimple.

Referenced by Slic3r::GUI::GUI_App::update_mode().

+ Here is the caller graph for this function:

◆ update_mode_markers()

void Slic3r::GUI::Sidebar::update_mode_markers ( )
1205{
1206 if (p->mode_sizer)
1207 p->mode_sizer->update_mode_markers();
1208}

References p.

◆ update_mode_sizer()

void Slic3r::GUI::Sidebar::update_mode_sizer ( ) const
1108{
1109 if (p->mode_sizer)
1110 p->mode_sizer->SetMode(m_mode);
1111}

References m_mode, and p.

◆ update_objects_list_extruder_column()

void Slic3r::GUI::Sidebar::update_objects_list_extruder_column ( size_t  extruders_count)
1271{
1272 p->object_list->update_objects_list_extruder_column(extruders_count);
1273}
static int extruders_count()
Definition GUI_Factories.cpp:35

References Slic3r::GUI::extruders_count(), and p.

+ Here is the call graph for this function:

◆ update_presets()

void Slic3r::GUI::Sidebar::update_presets ( Slic3r::Preset::Type  preset_type)
1061{
1062 PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
1063 const auto print_tech = preset_bundle.printers.get_edited_preset().printer_technology();
1064
1065 switch (preset_type) {
1067 {
1068 const size_t extruder_cnt = print_tech != ptFFF ? 1 :
1069 dynamic_cast<ConfigOptionFloats*>(preset_bundle.printers.get_edited_preset().config.option("nozzle_diameter"))->values.size();
1070 const size_t filament_cnt = p->combos_filament.size() > extruder_cnt ? extruder_cnt : p->combos_filament.size();
1071
1072 for (size_t i = 0; i < filament_cnt; i++)
1073 p->combos_filament[i]->update();
1074
1075 break;
1076 }
1077
1078 case Preset::TYPE_PRINT:
1079 p->combo_print->update();
1080 break;
1081
1083 p->combo_sla_print->update();
1084 break;
1085
1087 p->combo_sla_material->update();
1088 break;
1089
1091 {
1093 // CallAfter is really needed here to correct layout of the preset comboboxes,
1094 // when printer technology is changed during a project loading AND/OR switching the application mode.
1095 // Otherwise, some of comboboxes are invisible
1096 CallAfter([this]() { p->show_preset_comboboxes(); });
1097 break;
1098 }
1099
1100 default: break;
1101 }
1102
1103 // Synchronize config.ini with the current selections.
1104 wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
1105}
void update_all_preset_comboboxes()
Definition Plater.cpp:1038
ConfigOptionFloatsTempl< false > ConfigOptionFloats
Definition Config.hpp:716

References Slic3r::Preset::config, Slic3r::PresetCollection::get_edited_preset(), Slic3r::ConfigBase::option(), p, Slic3r::Preset::printer_technology(), Slic3r::PresetBundle::printers, Slic3r::ptFFF, Slic3r::ConfigOptionVector< T >::size(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, Slic3r::Preset::TYPE_SLA_PRINT, and update_all_preset_comboboxes().

Referenced by Slic3r::GUI::MainFrame::bind_diff_dialog(), Slic3r::GUI::TabPrinter::build_fff(), and Slic3r::GUI::MainFrame::on_presets_changed().

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

◆ update_reslice_btn_tooltip()

void Slic3r::GUI::Sidebar::update_reslice_btn_tooltip ( ) const
1122{
1123 wxString tooltip = wxString("Slice") + " [" + GUI::shortkey_ctrl_prefix() + "R]";
1124 if (m_mode != comSimple)
1125 tooltip += wxString("\n") + _L("Hold Shift to Slice & Export G-code");
1126#ifdef _WIN32
1127 p->btn_reslice_tip = tooltip;
1128#else
1129 p->btn_reslice->SetToolTip(tooltip);
1130#endif
1131}

References _L, Slic3r::comSimple, m_mode, p, and Slic3r::GUI::shortkey_ctrl_prefix().

+ Here is the call graph for this function:

◆ update_sliced_info_sizer()

void Slic3r::GUI::Sidebar::update_sliced_info_sizer ( )
1344{
1345 if (p->sliced_info->IsShown(size_t(0)))
1346 {
1347 if (p->plater->printer_technology() == ptSLA)
1348 {
1349 const SLAPrintStatistics& ps = p->plater->sla_print().print_statistics();
1350 wxString new_label = _L("Used Material (ml)") + ":";
1351 const bool is_supports = ps.support_used_material > 0.0;
1352 if (is_supports)
1353 new_label += format_wxstr("\n - %s\n - %s", _L_PLURAL("object", "objects", p->plater->model().objects.size()), _L("supports and pad"));
1354
1355 wxString info_text = is_supports ?
1356 wxString::Format("%.2f \n%.2f \n%.2f", (ps.objects_used_material + ps.support_used_material) / 1000,
1357 ps.objects_used_material / 1000,
1358 ps.support_used_material / 1000) :
1359 wxString::Format("%.2f", (ps.objects_used_material + ps.support_used_material) / 1000);
1360 p->sliced_info->SetTextAndShow(siMateril_unit, info_text, new_label);
1361
1362 wxString str_total_cost = "N/A";
1363
1364 DynamicPrintConfig* cfg = wxGetApp().get_tab(Preset::TYPE_SLA_MATERIAL)->get_config();
1365 if (cfg->option("bottle_cost")->getFloat() > 0.0 &&
1366 cfg->option("bottle_volume")->getFloat() > 0.0)
1367 {
1368 double material_cost = cfg->option("bottle_cost")->getFloat() /
1369 cfg->option("bottle_volume")->getFloat();
1370 str_total_cost = wxString::Format("%.3f", material_cost*(ps.objects_used_material + ps.support_used_material) / 1000);
1371 }
1372 p->sliced_info->SetTextAndShow(siCost, str_total_cost, "Cost");
1373
1374 wxString t_est = std::isnan(ps.estimated_print_time) ? "N/A" : from_u8(short_time_ui(get_time_dhms(float(ps.estimated_print_time))));
1375 p->sliced_info->SetTextAndShow(siEstimatedTime, t_est, _L("Estimated printing time") + ":");
1376
1377 p->plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + boost::nowide::narrow(t_est), p->plater->is_sidebar_collapsed());
1378
1379 // Hide non-SLA sliced info parameters
1380 p->sliced_info->SetTextAndShow(siFilament_m, "N/A");
1381 p->sliced_info->SetTextAndShow(siFilament_mm3, "N/A");
1382 p->sliced_info->SetTextAndShow(siFilament_g, "N/A");
1383 p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, "N/A");
1384 }
1385 else
1386 {
1387 const PrintStatistics& ps = p->plater->fff_print().print_statistics();
1388 const bool is_wipe_tower = ps.total_wipe_tower_filament > 0;
1389
1390 bool imperial_units = wxGetApp().app_config->get_bool("use_inches");
1391 double koef = imperial_units ? ObjectManipulation::in_to_mm : 1000.0;
1392
1393 wxString new_label = imperial_units ? _L("Used Filament (in)") : _L("Used Filament (m)");
1394 if (is_wipe_tower)
1395 new_label += format_wxstr(":\n - %1%\n - %2%", _L("objects"), _L("wipe tower"));
1396
1397 wxString info_text = is_wipe_tower ?
1398 wxString::Format("%.2f \n%.2f \n%.2f", ps.total_used_filament / koef,
1399 (ps.total_used_filament - ps.total_wipe_tower_filament) / koef,
1400 ps.total_wipe_tower_filament / koef) :
1401 wxString::Format("%.2f", ps.total_used_filament / koef);
1402 p->sliced_info->SetTextAndShow(siFilament_m, info_text, new_label);
1403
1404 koef = imperial_units ? pow(ObjectManipulation::mm_to_in, 3) : 1.0f;
1405 new_label = imperial_units ? _L("Used Filament (in³)") : _L("Used Filament (mm³)");
1406 info_text = wxString::Format("%.2f", imperial_units ? ps.total_extruded_volume * koef : ps.total_extruded_volume);
1407 p->sliced_info->SetTextAndShow(siFilament_mm3, info_text, new_label);
1408
1409 if (ps.total_weight == 0.0)
1410 p->sliced_info->SetTextAndShow(siFilament_g, "N/A");
1411 else {
1412 new_label = _L("Used Filament (g)");
1413 info_text = wxString::Format("%.2f", ps.total_weight);
1414
1415 if (ps.filament_stats.size() > 1)
1416 new_label += ":";
1417
1418 const auto& extruders_filaments = wxGetApp().preset_bundle->extruders_filaments;
1419 for (const auto& [filament_id, filament_vol] : ps.filament_stats) {
1420 assert(filament_id < extruders_filaments.size());
1421 if (const Preset* preset = extruders_filaments[filament_id].get_selected_preset()) {
1422 double filament_weight;
1423 if (ps.filament_stats.size() == 1)
1424 filament_weight = ps.total_weight;
1425 else {
1426 double filament_density = preset->config.opt_float("filament_density", 0);
1427 filament_weight = filament_vol * filament_density/* *2.4052f*/ * 0.001; // assumes 1.75mm filament diameter;
1428
1429 new_label += "\n - " + format_wxstr(_L("Filament at extruder %1%"), filament_id + 1);
1430 info_text += wxString::Format("\n%.2f", filament_weight);
1431 }
1432
1433 double spool_weight = preset->config.opt_float("filament_spool_weight", 0);
1434 if (spool_weight != 0.0) {
1435 new_label += "\n " + _L("(including spool)");
1436 info_text += wxString::Format(" (%.2f)\n", filament_weight + spool_weight);
1437 }
1438 }
1439 }
1440
1441 p->sliced_info->SetTextAndShow(siFilament_g, info_text, new_label);
1442 }
1443
1444 new_label = _L("Cost");
1445 if (is_wipe_tower)
1446 new_label += format_wxstr(":\n - %1%\n - %2%", _L("objects"), _L("wipe tower"));
1447
1448 info_text = ps.total_cost == 0.0 ? "N/A" :
1449 is_wipe_tower ?
1450 wxString::Format("%.2f \n%.2f \n%.2f", ps.total_cost,
1451 (ps.total_cost - ps.total_wipe_tower_cost),
1452 ps.total_wipe_tower_cost) :
1453 wxString::Format("%.2f", ps.total_cost);
1454 p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
1455
1456 if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
1457 p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
1458 else {
1459 info_text = "";
1460 new_label = _L("Estimated printing time") + ":";
1461 if (ps.estimated_normal_print_time != "N/A") {
1462 new_label += format_wxstr("\n - %1%", _L("normal mode"));
1463 info_text += format_wxstr("\n%1%", short_time_ui(ps.estimated_normal_print_time));
1464
1465 p->plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + ps.estimated_normal_print_time, p->plater->is_sidebar_collapsed());
1466
1467 }
1468 if (ps.estimated_silent_print_time != "N/A") {
1469 new_label += format_wxstr("\n - %1%", _L("stealth mode"));
1470 info_text += format_wxstr("\n%1%", short_time_ui(ps.estimated_silent_print_time));
1471 }
1472 p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
1473 }
1474
1475 // if there is a wipe tower, insert number of toolchanges info into the array:
1476 p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", ps.total_toolchanges) : "N/A");
1477
1478 // Hide non-FFF sliced info parameters
1479 p->sliced_info->SetTextAndShow(siMateril_unit, "N/A");
1480 }
1481 }
1482
1483 Layout();
1484}
#define _u8L(s)
macro used to mark string used at localization, return same string
Definition SLAPrint.cpp:29
static const double in_to_mm
Definition GUI_ObjectManipulation.hpp:73
Definition Preset.hpp:107
@ siFilament_g
Definition Plater.cpp:267
@ siFilament_mm3
Definition Plater.cpp:269
@ siMateril_unit
Definition Plater.cpp:270
@ siCost
Definition Plater.cpp:271
@ siFilament_m
Definition Plater.cpp:268
@ siWTNumbetOfToolchanges
Definition Plater.cpp:273
@ siEstimatedTime
Definition Plater.cpp:272
wxString from_u8(const std::string &str)
Definition GUI.cpp:437
std::string short_time_ui(const std::string &time)
Definition Utils.hpp:312
std::string get_time_dhms(float time_in_secs)
Definition Utils.hpp:315

References _L, _L_PLURAL, _u8L, Slic3r::PrintStatistics::estimated_normal_print_time, Slic3r::SLAPrintStatistics::estimated_print_time, Slic3r::PrintStatistics::estimated_silent_print_time, Slic3r::PrintStatistics::filament_stats, Slic3r::GUI::format_wxstr(), Slic3r::GUI::from_u8(), Slic3r::get_time_dhms(), Slic3r::ConfigOption::getFloat(), Slic3r::GUI::ObjectManipulation::in_to_mm, Slic3r::GUI::ObjectManipulation::mm_to_in, boost::nowide::narrow(), Slic3r::SLAPrintStatistics::objects_used_material, Slic3r::ConfigBase::option(), p, Slic3r::ptSLA, Slic3r::short_time_ui(), Slic3r::GUI::siCost, Slic3r::GUI::siEstimatedTime, Slic3r::GUI::siFilament_g, Slic3r::GUI::siFilament_m, Slic3r::GUI::siFilament_mm3, Slic3r::GUI::siMateril_unit, Slic3r::GUI::siWTNumbetOfToolchanges, Slic3r::SLAPrintStatistics::support_used_material, Slic3r::PrintStatistics::total_cost, Slic3r::PrintStatistics::total_extruded_volume, Slic3r::PrintStatistics::total_toolchanges, Slic3r::PrintStatistics::total_used_filament, Slic3r::PrintStatistics::total_weight, Slic3r::PrintStatistics::total_wipe_tower_cost, Slic3r::PrintStatistics::total_wipe_tower_filament, and Slic3r::Preset::TYPE_SLA_MATERIAL.

Referenced by show_sliced_info_sizer().

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

◆ update_ui_from_settings()

void Slic3r::GUI::Sidebar::update_ui_from_settings ( )
1575{
1576 p->object_manipulation->update_ui_from_settings();
1579 // update Cut gizmo, if it's open
1580 p->plater->canvas3D()->update_gizmos_on_off_state();
1581 p->plater->set_current_canvas_as_dirty();
1582 p->plater->get_current_canvas3D()->request_extra_frame();
1583 p->object_list->apply_volumes_order();
1584}
void show_info_sizer()
Definition Plater.cpp:1275

Referenced by Slic3r::GUI::Plater::priv::update_ui_from_settings().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_mode

◆ p


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