OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::Tab Class Referenceabstract

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

Inheritance diagram for Slic3r::GUI::Tab:
Collaboration diagram for Slic3r::GUI::Tab:

Classes

struct  PresetDependencies
struct  Highlighter
struct  SettingRowState

Public Member Functions

 Tab (ParamsPanel *parent, const wxString &title, Preset::Type type)
 ~Tab ()
wxWindow * parent () const
wxString title () const
std::string name () const
Preset::Type type () const
bool completed () const
virtual bool supports_printer_technology (const PrinterTechnology tech) const =0
void create_preset_tab ()
void add_scaled_button (wxWindow *parent, ScalableButton **btn, const std::string &icon_name, const wxString &label=wxEmptyString, long style=wxBU_EXACTFIT|wxNO_BORDER)
void add_scaled_bitmap (wxWindow *parent, ScalableBitmap &btn, const std::string &icon_name)
void update_ui_items_related_on_parent_preset (const Preset *selected_preset_parent)
void load_current_preset ()
void reactive_preset_combo_box ()
void rebuild_page_tree ()
void update_btns_enabling ()
void update_preset_choice ()
bool select_preset (std::string preset_name="", bool delete_current=false, const std::string &last_selected_ph_printer_name="", bool force_select=false, bool force_no_transfer=false)
bool may_discard_current_dirty_preset (PresetCollection *presets=nullptr, const std::string &new_printer_name="", bool no_transfer=false, bool no_transfer_variant=false)
virtual void clear_pages ()
virtual void update_description_lines ()
virtual void activate_selected_page (std::function< void()> throw_if_canceled)
void OnTreeSelChange (wxCommandEvent &event)
void OnKeyDown (wxKeyEvent &event)
void compare_preset ()
void transfer_options (const std::string &name_from, const std::string &name_to, std::vector< std::string > options)
void save_preset (std::string name=std::string(), bool detach=false, bool save_to_project=false, bool from_input=false, std::string input_name="")
void delete_preset ()
void toggle_show_hide_incompatible ()
void update_show_hide_incompatible_button ()
void update_ui_from_settings ()
void update_label_colours ()
void decorate ()
void update_changed_ui ()
void get_sys_and_mod_flags (const std::string &opt_key, bool &sys_page, bool &modified_page)
void update_changed_tree_ui ()
void update_undo_buttons ()
void update_extruder_switch_colors ()
bool variant_switch_active () const
bool is_printer_extruder_page (const Page *page) const
void update_variant_sizer_visibility ()
void update_all_extruder_options_status ()
void check_extruder_options_status (int index, bool &sys_extruder, bool &modified_extruder, const std::vector< PageShp > &pages_to_check)
void on_roll_back_value (const bool to_sys=false)
PageShp add_options_page (const wxString &title, const std::string &icon, bool is_extruder_pages=false)
virtual void OnActivate ()
virtual void on_preset_loaded ()
virtual void build ()=0
virtual void update ()=0
virtual void toggle_options ()=0
virtual void init_options_list ()
std::string options_list_storage_key (const std::string &opt_key) const
virtual void update_custom_dirty (std::vector< std::string > &dirty_options, std::vector< std::string > &nonsys_options)
void load_initial_data ()
void update_dirty ()
void update_tab_ui (bool update_plater_presets=false)
void load_config (const DynamicPrintConfig &config)
void apply_preset_config_value (const std::string &opt_key, const std::string &value)
void apply_preset_config_values (const std::vector< std::pair< std::string, std::string > > &values)
virtual void reload_config ()
void update_mode ()
void update_visibility ()
virtual void msw_rescale ()
virtual void sys_color_changed ()
Field * get_field (const t_config_option_key &opt_key, int opt_index=-1) const
Line * get_line (const t_config_option_key &opt_key)
std::pair< OG_CustomCtrl *, bool * > get_custom_ctrl_with_blinking_ptr (const t_config_option_key &opt_key, int opt_index=-1)
Field * get_field (const t_config_option_key &opt_key, Page **selected_page, int opt_index=-1)
void toggle_option (const std::string &opt_key, bool toggle, int opt_index=-1)
void toggle_line (const std::string &opt_key, bool toggle, int opt_index=-1)
void set_option_label (const std::string &opt_key, const wxString &label, int opt_index=-1)
SettingRowState setting_row_state (const std::string &opt_id) const
wxSizer * description_line_widget (wxWindow *parent, ogStaticText **StaticText, wxString text=wxEmptyString)
bool current_preset_is_dirty () const
bool saved_preset_is_dirty () const
void update_saved_preset_from_current_preset ()
void update_pages_with_multi_variant ()
DynamicPrintConfig * get_config ()
PresetCollection * get_presets ()
TabPresetComboBox * get_combo_box ()
virtual void on_value_change (const std::string &opt_key, const boost::any &value)
void update_wiping_button_visibility ()
virtual void activate_option (const std::string &opt_key, const wxString &category)
void apply_searcher ()
void cache_config_diff (const std::vector< std::string > &selected_options, const DynamicPrintConfig *config=nullptr)
void apply_config_from_cache ()
void show_timelapse_warning_dialog ()
const std::map< wxString, std::string > & get_category_icon_map ()
bool update_current_page_in_background (int &item)
void unselect_tree_item ()
void set_expanded (bool value)
void restore_last_select_item ()
bool page_build_pending () const
bool page_build_step ()
bool validate_custom_gcodes ()
bool validate_filament_temperature_pairs ()
void set_just_edit (bool just_edit)
void edit_custom_gcode (const t_config_option_key &opt_key)
virtual const std::string & get_custom_gcode (const t_config_option_key &opt_key)
virtual void set_custom_gcode (const t_config_option_key &opt_key, const std::string &value)
void update_extruder_variants (int extruder_id=-1, bool reload=true)
 Call from: 1: on_value_change "nozzle_volume_type" 2: on_preset_loaded (extruder_id = -1).
void switch_excluder (int extruder_id=-1, bool reload=true)
void sync_excluder ()
void parse_extruder_selection (int selection, int &extruder_id, NozzleVolumeType &nozzle_type)
int calculate_selection_index_for_extruder (int extruder_id, NozzleVolumeType nozzle_type)
bool get_extruder_sync_enable_state (int extruder_id)
int get_current_active_extruder ()
std::vector< wxString > generate_extruder_options ()
NozzleVolumeType get_actual_nozzle_volume_type (int extruder_id)

Static Public Member Functions

static wxString translate_category (const wxString &title, Preset::Type preset_type, bool translate=true)
static bool validate_custom_gcode (const wxString &title, const std::string &gcode)

Public Attributes

PresetBundle * m_preset_bundle
bool m_show_btn_incompatible_presets = false
PresetCollection * m_presets = nullptr
DynamicPrintConfig * m_config
ogStaticText * m_parent_preset_description_line = nullptr
ScalableButton * m_detach_preset_btn = nullptr
std::map< std::string, wxColour > m_colored_Label_colors
int m_update_cnt = 0
ModeSwitchButton * m_mode_view = nullptr
ScalableButton * m_mode_icon = nullptr
wxSizer * m_variant_sizer = nullptr
MultiSwitchButton * m_extruder_switch = nullptr
MultiSwitchButton * m_variant_combo = nullptr
ScalableButton * m_extruder_sync = nullptr
wxPanel * m_extruder_sync_box = nullptr
bool m_extruder_switch_variants = false
std::vector< NozzleVolumeType > m_actual_nozzle_volumes
bool validate_custom_gcodes_was_shown { false }

Protected Types

enum  OptStatus { osSystemValue = 1 , osInitValue = 2 }

Protected Member Functions

void set_type ()
void create_line_with_widget (ConfigOptionsGroup *optgroup, const std::string &opt_key, const std::string &path, widget_t widget)
wxSizer * compatible_widget_create (wxWindow *parent, PresetDependencies &deps)
void compatible_widget_reload (PresetDependencies &deps)
void load_key_value (const std::string &opt_key, const boost::any &value, bool saved_value=false)
bool commit_preset_config_value (const std::string &opt_key)
bool tree_sel_change_delayed (wxCommandEvent &event)
void on_presets_changed ()
void update_printer_agent_if_needed ()
void build_preset_description_line (ConfigOptionsGroup *optgroup)
void update_preset_description_line ()
void update_frequently_changed_parameters ()
void set_tooltips_text ()
void filter_diff_option (std::vector< std::string > &options)
ConfigManipulation get_config_manipulation ()

Protected Attributes

ParamsPanel * m_parent
Preset::Type m_type
std::string m_name
const wxString m_title
TabPresetComboBox * m_presets_choice { nullptr }
wxPanel * m_top_panel
wxBoxSizer * m_main_sizer
wxBoxSizer * m_top_sizer
wxBoxSizer * m_top_left_sizer
wxGridSizer * m_top_right_sizer
wxBoxSizer * m_select_sizer
wxBoxSizer * m_tree_sizer
ScalableButton * m_btn_compare_preset
ScalableButton * m_btn_save_preset
ScalableButton * m_btn_delete_preset
TabCtrl * m_tabctrl
wxImageList * m_icons
wxScrolledWindow * m_page_view {nullptr}
PresetDependencies m_compatible_printers
PresetDependencies m_compatible_prints
bool m_is_default_preset {false}
bool m_just_edit {false}
ScalableButton * m_undo_btn
ScalableButton * m_undo_to_sys_btn
ScalableButton * m_btn_search
StaticBox * m_search_item
TextInput * m_search_input
ScalableBitmap m_bmp_show_incompatible_presets
ScalableBitmap m_bmp_hide_incompatible_presets
ScalableBitmap m_bmp_value_lock
ScalableBitmap m_bmp_value_unlock
ScalableBitmap m_bmp_white_bullet
ScalableBitmap * m_bmp_non_system
ScalableBitmap m_bmp_value_revert
ScalableBitmap m_bmp_edit_value
std::vector< ScalableButton * > m_scaled_buttons = {}
std::vector< ScalableBitmap * > m_scaled_bitmaps = {}
std::vector< ScalableBitmap > m_scaled_icons_list = {}
wxColour m_sys_label_clr
wxColour m_modified_label_clr
wxColour m_default_text_clr
wxString m_ttg_value_lock
wxString m_ttg_value_unlock
wxString m_ttg_white_bullet_ns
wxString * m_ttg_non_system
wxString m_ttg_white_bullet
wxString m_ttg_value_revert
wxString m_tt_value_lock
wxString m_tt_value_unlock
wxString * m_tt_non_system
wxString m_tt_white_bullet
wxString m_tt_value_revert
int m_icon_count
std::map< std::string, size_t > m_icon_index
std::map< wxString, std::string > m_category_icon
std::vector< PageShp > m_pages
Page * m_active_page {nullptr}
bool m_disable_tree_sel_changed_event {false}
bool m_show_incompatible_presets
int m_last_select_item = -1
std::vector< Preset::Type > m_dependent_tabs
std::map< std::string, int > m_options_list
std::map< std::string, int > m_all_extruder_options_status
int m_opt_status_value = 0
bool m_is_modified_values { false }
bool m_is_nonsys_values { true }
bool m_postpone_update_ui {false}
int m_em_unit
bool m_completed { false }
ConfigOptionMode m_mode = comAdvanced
struct Slic3r::GUI::Tab::Highlighter m_highlighter
DynamicPrintConfig m_cache_config
std::vector< std::string > m_cache_options
bool m_page_switch_running = false
bool m_page_switch_planned = false
bool m_is_timelapse_wipe_tower_already_prompted = false
ConfigManipulation m_config_manipulation
std::string m_last_sparse_infill_rotate_template_value

Friends

class EditGCodeDialog
class PublishSettingsDialog

Detailed Description


Class Documentation

◆ Slic3r::GUI::Tab::PresetDependencies

struct Slic3r::GUI::Tab::PresetDependencies
Collaboration diagram for Slic3r::GUI::Tab::PresetDependencies:
Class Members
Button * btn = nullptr
::CheckBox * checkbox = nullptr
wxStaticText * checkbox_title = nullptr
wxString dialog_label
wxString dialog_title
string key_condition
string key_list
Type type = Preset::TYPE_INVALID

◆ Slic3r::GUI::Tab::SettingRowState

struct Slic3r::GUI::Tab::SettingRowState
Class Members
wxString label
wxString label_en
bool multi {false}
bool visible {true}

Member Enumeration Documentation

◆ OptStatus

Enumerator
osSystemValue 
osInitValue 
270{ osSystemValue = 1, osInitValue = 2 };
@ osInitValue
Definition Tab.hpp:270
@ osSystemValue
Definition Tab.hpp:270

Constructor & Destructor Documentation

◆ Tab()

Slic3r::GUI::Tab::Tab ( ParamsPanel * parent,
const wxString & title,
Preset::Type type )
207 :
209{
210 Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL/*, name*/);
211 this->SetFont(Slic3r::GUI::wxGetApp().normal_font());
212
213 wxGetApp().UpdateDarkUI(this);
214 SetBackgroundColour(*wxWHITE);
215
217 m_compatible_printers.key_list = "compatible_printers";
218 m_compatible_printers.key_condition = "compatible_printers_condition";
219 //m_compatible_printers.dialog_title = _L("Compatible printers");
220 //m_compatible_printers.dialog_label = _L("Select the printers this profile is compatible with.");
221
223 m_compatible_prints.key_list = "compatible_prints";
224 m_compatible_prints.key_condition = "compatible_prints_condition";
225 //m_compatible_prints.dialog_title = _L("Compatible print profiles");
226 //m_compatible_prints.dialog_label = _L("Select the print profiles this profile is compatible with.");
227
228 wxGetApp().tabs_list.push_back(this);
229
230 m_em_unit = em_unit(m_parent); //wxGetApp().em_unit();
231
233
234 Bind(wxEVT_SIZE, ([](wxSizeEvent &evt) {
235 //for (auto page : m_pages)
236 // if (! page.get()->IsShown())
237 // page->layout_valid = false;
238 evt.Skip();
239 }));
240
241 m_highlighter.set_timer_owner(this, 0);
242 this->Bind(wxEVT_TIMER, [this](wxTimerEvent&)
243 {
244 m_highlighter.blink();
245 });
246}
wxWindow * parent() const
Definition Tab.hpp:347
ConfigManipulation get_config_manipulation()
Definition Tab.cpp:9948
ParamsPanel * m_parent
Definition Tab.hpp:155
const wxString m_title
Definition Tab.hpp:163
PresetDependencies m_compatible_printers
Definition Tab.hpp:198
PresetDependencies m_compatible_prints
Definition Tab.hpp:199
Preset::Type type() const
Definition Tab.hpp:350
struct Slic3r::GUI::Tab::Highlighter m_highlighter
Preset::Type m_type
Definition Tab.hpp:161
wxString title() const
Definition Tab.hpp:348
int m_em_unit
Definition Tab.hpp:281
ConfigManipulation m_config_manipulation
Definition Tab.hpp:562
@ TYPE_PRINTER
Definition Preset.hpp:250
@ TYPE_PRINT
Definition Preset.hpp:246
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:424

References em_unit(), get_config_manipulation(), m_compatible_printers, m_compatible_prints, m_config_manipulation, m_em_unit, m_highlighter, m_parent, m_title, m_type, parent(), title(), type(), Slic3r::Preset::TYPE_PRINT, and Slic3r::Preset::TYPE_PRINTER.

Referenced by Slic3r::GUI::TabFilament::TabFilament(), Slic3r::GUI::TabPrint::TabPrint(), Slic3r::GUI::TabPrinter::TabPrinter(), Slic3r::GUI::TabSLAMaterial::TabSLAMaterial(), Slic3r::GUI::TabSLAPrint::TabSLAPrint(), on_presets_changed(), and tree_sel_change_delayed().

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

◆ ~Tab()

Slic3r::GUI::Tab::~Tab ( )
inline
345{}

Member Function Documentation

◆ activate_option()

void Slic3r::GUI::Tab::activate_option ( const std::string & opt_key,
const wxString & category )
virtual

Reimplemented in Slic3r::GUI::TabPrinter.

2661{
2662 wxString page_title = translate_category(category, m_type);
2663
2664 auto cur_item = m_tabctrl->GetFirstVisibleItem();
2665 if (cur_item < 0)
2666 return;
2667
2668 // We should to activate a tab with searched option, if it doesn't.
2669 // And do it before finding of the cur_item to avoid a case when Tab isn't activated jet and all treeItems are invisible
2670 //BBS: GUI refactor
2671 //wxGetApp().mainframe->select_tab(this);
2672 wxGetApp().mainframe->select_tab((wxPanel*)m_parent);
2673
2674 while (cur_item >= 0) {
2675 if (page_title.empty()) {
2676 bool has = false;
2677 for (auto &g : m_pages[cur_item]->m_optgroups) {
2678 for (auto &l : g->get_lines()) {
2679 for (auto &o : l.get_options()) { if (o.opt.opt_key == opt_key) { has = true; break; } }
2680 if (has) break;
2681 }
2682 if (has) break;
2683 }
2684 if (!has) {
2685 cur_item = m_tabctrl->GetNextVisible(cur_item);
2686 continue;
2687 }
2688 } else {
2689 auto title = m_tabctrl->GetItemText(cur_item);
2690 if (page_title != title) {
2691 cur_item = m_tabctrl->GetNextVisible(cur_item);
2692 continue;
2693 }
2694 }
2695
2696 m_tabctrl->SelectItem(cur_item);
2697 break;
2698 }
2699
2700 auto set_focus = [](wxWindow* win) {
2701 win->SetFocus();
2702#ifdef WIN32
2703 if (wxTextCtrl* text = dynamic_cast<wxTextCtrl*>(win))
2704 text->SetSelection(-1, -1);
2705 else if (wxSpinCtrl* spin = dynamic_cast<wxSpinCtrl*>(win))
2706 spin->SetSelection(-1, -1);
2707#endif // WIN32
2708 };
2709
2710 Field* field = get_field(opt_key);
2711
2712 // focused selected field
2713 if (field) {
2714 set_focus(field->getWindow());
2715 if (!field->getWindow()->HasFocus()) {
2716 wxScrollEvent evt(wxEVT_SCROLL_CHANGED);
2717 evt.SetEventObject(field->getWindow());
2718 wxPostEvent(m_page_view, evt);
2719 }
2720 }
2721 else if (category == "Single extruder MM setup") {
2722 // When we show and hide "Single extruder MM setup" page,
2723 // related options are still in the search list
2724 // So, let's hightlighte a "single_extruder_multi_material" option,
2725 // as a "way" to show hidden page again
2726 field = get_field("single_extruder_multi_material");
2727 if (field)
2728 set_focus(field->getWindow());
2729 }
2730
2732}
wxScrolledWindow * m_page_view
Definition Tab.hpp:185
std::pair< OG_CustomCtrl *, bool * > get_custom_ctrl_with_blinking_ptr(const t_config_option_key &opt_key, int opt_index=-1)
Definition Tab.cpp:1933
std::vector< PageShp > m_pages
Definition Tab.hpp:263
TabCtrl * m_tabctrl
Definition Tab.hpp:182
Field * get_field(const t_config_option_key &opt_key, int opt_index=-1) const
Definition Tab.cpp:1923
static wxString translate_category(const wxString &title, Preset::Type preset_type, bool translate=true)
Definition Tab.cpp:823

References activate_option(), get_custom_ctrl_with_blinking_ptr(), get_field(), Slic3r::GUI::Field::getWindow(), m_highlighter, m_page_view, m_pages, m_parent, m_tabctrl, m_type, title(), and translate_category().

Referenced by activate_option(), and Slic3r::GUI::TabPrinter::activate_option().

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

◆ activate_selected_page()

void Slic3r::GUI::Tab::activate_selected_page ( std::function< void()> throw_if_canceled)
virtual

Reimplemented in Slic3r::GUI::TabPrinter, and Slic3r::GUI::TabPrintModel.

7879{
7880 if (!m_active_page)
7881 return;
7882
7883#ifdef __WXGTK__
7884 // Builds the page off screen, since GTK crashes when it desensitizes a multiline text view
7885 // that was built on screen and hidden before its first size allocation.
7886 const bool hide_view = m_active_page->build_pending() && m_page_view->IsShown();
7887 if (hide_view)
7888 m_page_view->Hide();
7889 ScopeGuard show_view([this, hide_view] { if (hide_view) m_page_view->Show(); });
7890#endif
7891 m_active_page->activate(m_mode, throw_if_canceled);
7894 if (m_active_page && !(m_active_page->title() == "Dependencies"))
7896 m_active_page->update_visibility(m_mode, true); // for taggle line
7897}
ConfigOptionMode m_mode
Definition Tab.hpp:284
virtual void toggle_options()=0
Page * m_active_page
Definition Tab.hpp:264
virtual void update_description_lines()
Definition Tab.cpp:7872
void update_changed_ui()
Definition Tab.cpp:1106

References activate_selected_page(), m_active_page, m_mode, m_page_view, toggle_options(), update_changed_ui(), and update_description_lines().

Referenced by activate_selected_page(), Slic3r::GUI::TabPrinter::activate_selected_page(), Slic3r::GUI::TabPrintModel::activate_selected_page(), OnActivate(), and tree_sel_change_delayed().

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

◆ add_options_page()

Slic3r::GUI::PageShp Slic3r::GUI::Tab::add_options_page ( const wxString & title,
const std::string & icon,
bool is_extruder_pages = false )
782{
783 // Index of icon in an icon list $self->{icons}.
784 auto icon_idx = 0;
785 if (!icon.empty()) {
786 icon_idx = (m_icon_index.find(icon) == m_icon_index.end()) ? -1 : m_icon_index.at(icon);
787 if (icon_idx == -1) {
788 // Add a new icon to the icon list.
789 m_scaled_icons_list.push_back(ScalableBitmap(this, icon, 32, false, true));
790 //m_icons->Add(m_scaled_icons_list.back().bmp());
791 icon_idx = ++m_icon_count;
792 m_icon_index[icon] = icon_idx;
793 }
794
795 if (m_category_icon.find(title) == m_category_icon.end()) {
796 // Add new category to the category_to_icon list.
797 m_category_icon[title] = icon;
798 }
799 }
800 // Initialize the page.
801 //BBS: GUI refactor
802 PageShp page = std::make_shared<Page>(m_page_view, title, icon_idx, this);
803// page->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
804#ifdef __WINDOWS__
805// page->SetDoubleBuffered(true);
806#endif //__WINDOWS__
807
808 if (dynamic_cast<TabPrint*>(this)) {
809 page->m_split_multi_line = true;
810 page->m_option_label_at_right = true;
811 }
812
813 if (!is_extruder_pages)
814 m_pages.push_back(page);
815
816 page->set_config(m_config);
817 return page;
818}
DynamicPrintConfig * m_config
Definition Tab.hpp:314
int m_icon_count
Definition Tab.hpp:260
std::map< wxString, std::string > m_category_icon
Definition Tab.hpp:262
std::vector< ScalableBitmap > m_scaled_icons_list
Definition Tab.hpp:234
std::map< std::string, size_t > m_icon_index
Definition Tab.hpp:261
std::shared_ptr< Page > PageShp
Definition Tab.hpp:150

References m_category_icon, m_config, m_icon_count, m_icon_index, m_page_view, m_pages, m_scaled_icons_list, and title().

Referenced by Slic3r::GUI::TabFilament::add_filament_overrides_page(), Slic3r::GUI::TabFilament::build(), Slic3r::GUI::TabPrint::build(), Slic3r::GUI::TabPrintModel::build(), Slic3r::GUI::TabPrintPlate::build(), Slic3r::GUI::TabPrinter::build_fff(), Slic3r::GUI::TabPrinter::build_kinematics_page(), and Slic3r::GUI::TabPrinter::build_unregular_pages().

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

◆ add_scaled_bitmap()

void Slic3r::GUI::Tab::add_scaled_bitmap ( wxWindow * parent,
ScalableBitmap & btn,
const std::string & icon_name )
767{
768 bmp = ScalableBitmap(parent, icon_name);
769 m_scaled_bitmaps.push_back(&bmp);
770}
std::vector< ScalableBitmap * > m_scaled_bitmaps
Definition Tab.hpp:233

References m_scaled_bitmaps, and parent().

Referenced by create_preset_tab().

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

◆ add_scaled_button()

void Slic3r::GUI::Tab::add_scaled_button ( wxWindow * parent,
ScalableButton ** btn,
const std::string & icon_name,
const wxString & label = wxEmptyString,
long style = wxBU_EXACTFIT | wxNO_BORDER )
758{
759 *btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, style, true);
760 (*btn)->SetBackgroundColour(parent->GetBackgroundColour());
761 m_scaled_buttons.push_back(*btn);
762}
#define style
Definition WipeTowerDialog.cpp:101
std::vector< ScalableButton * > m_scaled_buttons
Definition Tab.hpp:232

References m_scaled_buttons, parent(), and style.

Referenced by create_preset_tab().

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

◆ apply_config_from_cache()

void Slic3r::GUI::Tab::apply_config_from_cache ( )
2746{
2747 bool was_applied = false;
2748 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<<boost::format(": enter");
2749 // check and apply extruders count for printer preset
2751 was_applied = static_cast<TabPrinter*>(this)->apply_extruder_cnt_from_cache();
2752
2753 if (!m_cache_config.empty()) {
2754 m_presets->get_edited_preset().config.apply_only(m_cache_config, m_cache_options);
2755 m_cache_config.clear();
2756 m_cache_options.clear();
2757
2758 was_applied = true;
2759 }
2760
2761 if (was_applied)
2762 update_dirty();
2763 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<<boost::format(": exit, was_applied=%1%")%was_applied;
2764}
PresetCollection * m_presets
Definition Tab.hpp:313
DynamicPrintConfig m_cache_config
Definition Tab.hpp:301
std::vector< std::string > m_cache_options
Definition Tab.hpp:302
void update_dirty()
Definition Tab.cpp:1610

References apply_config_from_cache(), m_cache_config, m_cache_options, m_presets, m_type, Slic3r::Preset::TYPE_PRINTER, and update_dirty().

Referenced by apply_config_from_cache(), on_presets_changed(), select_preset(), and transfer_options().

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

◆ apply_preset_config_value()

void Slic3r::GUI::Tab::apply_preset_config_value ( const std::string & opt_key,
const std::string & value )
1701{
1702 apply_preset_config_values({{opt_key, value}});
1703}
void apply_preset_config_values(const std::vector< std::pair< std::string, std::string > > &values)
Definition Tab.cpp:1709

References apply_preset_config_value(), and apply_preset_config_values().

Referenced by apply_preset_config_value().

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

◆ apply_preset_config_values()

void Slic3r::GUI::Tab::apply_preset_config_values ( const std::vector< std::pair< std::string, std::string > > & values)
1710{
1711 if (m_config == nullptr)
1712 throw std::runtime_error("The preset configuration is not available");
1713 if (wxGetApp().plater() == nullptr)
1714 throw std::runtime_error("OrcaSlicer main window is not available");
1715
1716 if (values.empty())
1717 return;
1718
1719 const std::vector<std::string>& options = preset_type_options(m_type);
1720
1721 // Preparation: reject every batch that cannot be applied before touching the edited preset, so a
1722 // bad key or value fails without a partial write. The key must belong to this preset type, it must
1723 // not repeat, and each value is strict-parsed into a scratch copy (the strict deserializer can
1724 // already have mutated an option when it rejects a bad value, so the check has to run somewhere
1725 // the edited preset is not affected). Callback failures cannot be prepared this way: a setting's
1726 // on_change callback is a GUI method, not a pure function of the config, so whether it throws is
1727 // only known by running it. That residual case is handled by the rollback below.
1728 std::set<std::string> seen;
1729 DynamicPrintConfig scratch(*m_config);
1730 for (const auto& kv : values) {
1731 const std::string& opt_key = kv.first;
1732 if (std::find(options.begin(), options.end(), opt_key) == options.end())
1733 throw std::invalid_argument(format("Unknown %1% preset setting \"%2%\"", preset_type_name(m_type), opt_key));
1734 if (!seen.insert(opt_key).second)
1735 throw std::invalid_argument(format("%1% preset setting \"%2%\" is set more than once in the same update",
1736 preset_type_name(m_type), opt_key));
1737 try {
1738 scratch.set_deserialize_strict(opt_key, kv.second);
1739 } catch (const ConfigurationError& err) {
1740 throw std::invalid_argument(err.what());
1741 }
1742 }
1743
1744 // Rollback boundary: snapshot the whole edited config, not just the keys the batch names, because a
1745 // key-specific callback can adjust related settings of the edited preset (mutually exclusive
1746 // options, compatibility, and so on). A failure restores this config and then recomputes the state
1747 // derived from it.
1748 DynamicPrintConfig before(*m_config);
1749 try {
1750 for (const auto& kv : values) {
1751 m_config->set_deserialize_strict(kv.first, kv.second);
1752 if (!commit_preset_config_value(kv.first))
1753 // The GUI edits this setting through a custom widget rather than a group (e.g.
1754 // compatible_printers), so take the same shared no-field commit path the widget uses.
1755 // The value was written above, so saved mode skips the write and keeps the path's
1756 // compatibility recompute, dirty flag, preset-combo and plater updates.
1757 load_key_value(kv.first, boost::any(), /*saved_value=*/true);
1758 }
1759 } catch (...) {
1760 *m_config = before;
1761 // A callback can rewrite state derived from the config (compatibility marks, the preset
1762 // selector, dependent tabs, the Plater and, on the printer tab, the printer agent) before it
1763 // throws. Recompute that derived state from the restored config so none of it is left
1764 // reflecting the failed batch. Effects that are not a function of the config (a dialog the
1765 // user already accepted, an undo snapshot, a command already sent to a device, the target
1766 // selection) cannot be reversed here; see the header.
1768 reload_config();
1769 update_dirty();
1770 update();
1771 throw;
1772 }
1773
1774 // Apply the batch's final state once. The commit paths above already maintained the dirty flag,
1775 // preset combo and, on the printer tab, the printer-agent switch; this reloads the visible page
1776 // and pushes the config to the Plater.
1777 reload_config();
1778 update_dirty();
1779 update();
1780}
bool commit_preset_config_value(const std::string &opt_key)
Definition Tab.cpp:1683
virtual void reload_config()
Definition Tab.cpp:1783
void load_key_value(const std::string &opt_key, const boost::any &value, bool saved_value=false)
Definition Tab.cpp:2018
PresetBundle * m_preset_bundle
Definition Tab.hpp:311
virtual void update()=0
static const std::vector< std::string > & preset_type_options(Preset::Type type)
Definition Tab.cpp:1654
static Plater * plater()
Definition GUI_Factories.cpp:400
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36
static const char * preset_type_name(Preset::Type type)
Definition Tab.cpp:1665
@ Never
Definition Preset.hpp:523

References apply_preset_config_values(), commit_preset_config_value(), Slic3r::format(), load_key_value(), m_config, m_preset_bundle, m_type, Slic3r::Never, Slic3r::GUI::plater(), Slic3r::GUI::preset_type_name(), Slic3r::GUI::preset_type_options(), reload_config(), Slic3r::ConfigBase::set_deserialize_strict(), update(), and update_dirty().

Referenced by apply_preset_config_value(), apply_preset_config_values(), and Slic3r::anonymous_namespace{PluginHostPresets.cpp}::PresetTransaction::commit().

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

◆ apply_searcher()

void Slic3r::GUI::Tab::apply_searcher ( )
2735{
2736 wxGetApp().sidebar().get_searcher().apply(m_config, m_type, m_mode);
2737}

References apply_searcher(), m_config, m_mode, and m_type.

Referenced by apply_searcher(), and Slic3r::GUI::TabPrinter::build_unregular_pages().

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

◆ build()

virtual void Slic3r::GUI::Tab::build ( )
pure virtual

Implemented in Slic3r::GUI::TabFilament, Slic3r::GUI::TabPrint, Slic3r::GUI::TabPrinter, Slic3r::GUI::TabPrintModel, Slic3r::GUI::TabPrintPlate, Slic3r::GUI::TabSLAMaterial, and Slic3r::GUI::TabSLAPrint.

Referenced by create_preset_tab().

Here is the caller graph for this function:

◆ build_preset_description_line()

void Slic3r::GUI::Tab::build_preset_description_line ( ConfigOptionsGroup * optgroup)
protected
2826{
2827 auto description_line = [this](wxWindow* parent) {
2829 };
2830
2831 auto detach_preset_btn = [this](wxWindow* parent) {
2832 m_detach_preset_btn = new ScalableButton(parent, wxID_ANY, "lock_normal", "",
2833 wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
2834 ScalableButton* btn = m_detach_preset_btn;
2835 btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
2836
2837 auto sizer = new wxBoxSizer(wxHORIZONTAL);
2838 sizer->Add(btn);
2839
2840 btn->Bind(wxEVT_BUTTON, [this, parent](wxCommandEvent&)
2841 {
2842 bool system = m_presets->get_edited_preset().is_system;
2843 bool dirty = m_presets->get_edited_preset().is_dirty;
2844 wxString msg_text = system ?
2845 _(L("A copy of the current system preset will be created, which will be detached from the system preset.")) :
2846 _(L("The current custom preset will be detached from the parent system preset."));
2847 if (dirty) {
2848 msg_text += "\n\n";
2849 msg_text += _(L("Modifications to the current profile will be saved."));
2850 }
2851 msg_text += "\n\n";
2852 msg_text += _(L("This action is not revertible.\nDo you want to proceed?"));
2853
2854 //wxMessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL);
2855 MessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL);
2856 if (dialog.ShowModal() == wxID_YES)
2857 save_preset(m_presets->get_edited_preset().is_system ? std::string() : m_presets->get_edited_preset().name, true);
2858 });
2859
2860 btn->Hide();
2861
2862 return sizer;
2863 };
2864
2865 Line line = Line{ "", "" };
2866 line.full_width = 1;
2867
2868 line.append_widget(description_line);
2869 line.append_widget(detach_preset_btn);
2870 optgroup->append_line(line);
2871}
#define _(s)
Definition 3mf.cpp:306
#define L(s)
Definition ExtrusionEntity.cpp:25
wxSizer * description_line_widget(wxWindow *parent, ogStaticText **StaticText, wxString text=wxEmptyString)
Definition Tab.cpp:5341
ogStaticText * m_parent_preset_description_line
Definition Tab.hpp:315
void save_preset(std::string name=std::string(), bool detach=false, bool save_to_project=false, bool from_input=false, std::string input_name="")
Definition Tab.cpp:8121
ScalableButton * m_detach_preset_btn
Definition Tab.hpp:316

References _, Slic3r::GUI::OptionsGroup::append_line(), Slic3r::GUI::Line::append_widget(), build_preset_description_line(), description_line_widget(), Slic3r::GUI::Line::full_width, L, m_detach_preset_btn, m_parent_preset_description_line, m_presets, parent(), save_preset(), and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by build_preset_description_line().

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

◆ cache_config_diff()

void Slic3r::GUI::Tab::cache_config_diff ( const std::vector< std::string > & selected_options,
const DynamicPrintConfig * config = nullptr )
2740{
2741 m_cache_options = selected_options;
2742 m_cache_config.apply_only(config ? *config : m_presets->get_edited_preset().config, selected_options);
2743}

References cache_config_diff(), m_cache_config, m_cache_options, and m_presets.

Referenced by cache_config_diff(), Slic3r::GUI::GUI_App::check_and_keep_current_preset_changes(), may_discard_current_dirty_preset(), and transfer_options().

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

◆ calculate_selection_index_for_extruder()

int Slic3r::GUI::Tab::calculate_selection_index_for_extruder ( int extruder_id,
NozzleVolumeType nozzle_type )
718{
719 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
720 int extruder_nums = m_preset_bundle->get_printer_extruder_count();
721
722 int index = 0;
723
724 for (int i = 0; i < extruder_nums; ++i) {
725 if (i == extruder_id) {
726 NozzleVolumeType volume_type = NozzleVolumeType(nozzle_volumes->values[i]);
727 if (volume_type == NozzleVolumeType::nvtHybrid) {
728 return nozzle_type == NozzleVolumeType::nvtHighFlow ? index + 1 : index;
729 } else {
730 return index;
731 }
732 }
733
734 NozzleVolumeType volume_type = NozzleVolumeType(nozzle_volumes->values[i]);
735 index += (volume_type == NozzleVolumeType::nvtHybrid) ? 2 : 1;
736 }
737
738 return 0;
739}
NozzleVolumeType
Definition PrintConfig.hpp:618
@ nvtHybrid
Definition PrintConfig.hpp:621
@ nvtHighFlow
Definition PrintConfig.hpp:620
ConfigOptionEnumsGenericTempl< false > ConfigOptionEnumsGeneric
Definition Config.hpp:2311
zaa_minimize_perimeter_height nozzle_type((ConfigOptionInt, nozzle_hrc))((ConfigOptionBool

References m_preset_bundle, Slic3r::nozzle_type(), Slic3r::nvtHighFlow, and Slic3r::nvtHybrid.

Referenced by Slic3r::GUI::TabPrinter::activate_option(), and update_extruder_variants().

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

◆ check_extruder_options_status()

void Slic3r::GUI::Tab::check_extruder_options_status ( int index,
bool & sys_extruder,
bool & modified_extruder,
const std::vector< PageShp > & pages_to_check )
1310{
1311 int config_index = index;
1312 int extruder_id = index;
1315 parse_extruder_selection(index, extruder_id, nozzle_type);
1316
1317 auto extruders = m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnumsGeneric>("extruder_type");
1319 config_index = m_config->get_index_for_extruder(
1320 extruder_id + 1,
1321 variant_keys.first,
1322 ExtruderType(extruders->values[extruder_id]),
1324 variant_keys.second
1325 );
1326 }
1327
1328 for (auto page : pages_to_check) {
1329 /*if (page->title() != "Speed" && page->title() != "Motion ability" && page->title() != "Filament" && page->title() != "Setting Overrides" && page->title() != "Multimaterial") {
1330 continue;
1331 }*/
1332 for (auto group : page->m_optgroups) {
1333 for (const auto &kvp : group->opt_map()) {
1334 std::string base_opt_key = kvp.second.first;
1335 // For filament tab, common options will not change color when edited
1336 if (m_type == Preset::TYPE_FILAMENT && kvp.second.second == -1) {
1337 continue;
1338 }
1339
1340 unsigned int stride = 1;
1341 if (printer_options_with_variant_2.count(base_opt_key) > 0) {
1342 stride = 2;
1343 }
1344
1345 std::string target_opt_key = base_opt_key + "#" + std::to_string(config_index * stride);
1346 // Orca: on the printer's Extruder page only per-variant options use the variant column,
1347 // the others (nozzle_diameter, extruder_offset, ...) are indexed by the extruder.
1348 if (is_printer_extruder_page(page.get()) && printer_options_with_variant_1.count(base_opt_key) == 0)
1349 target_opt_key = base_opt_key + "#" + std::to_string(extruder_id);
1350
1351 auto status_iter = m_all_extruder_options_status.find(target_opt_key);
1352 if (status_iter != m_all_extruder_options_status.end()) {
1353 bool found_modified_for_this_config = false;
1356 auto original_dirty_options = m_presets->current_dirty_options(deep_compare);
1357 for (const std::string &orig_opt : original_dirty_options) {
1358 if (orig_opt == target_opt_key) {
1359 found_modified_for_this_config = true;
1360 break;
1361 }
1362 }
1363
1364 if (found_modified_for_this_config) {
1365 sys_extruder = (status_iter->second & osSystemValue) != 0;
1366 modified_extruder |= (status_iter->second & osInitValue) == 0;
1367
1368 if (!sys_extruder && modified_extruder) { return; }
1369 }
1370 }
1371 }
1372 }
1373 }
1374}
bool is_printer_extruder_page(const Page *page) const
Definition Tab.hpp:399
void parse_extruder_selection(int selection, int &extruder_id, NozzleVolumeType &nozzle_type)
Definition Tab.cpp:682
std::map< std::string, int > m_all_extruder_options_status
Definition Tab.hpp:272
@ TYPE_MODEL
Definition Preset.hpp:258
@ TYPE_SLA_MATERIAL
Definition Preset.hpp:249
@ TYPE_COUNT
Definition Preset.hpp:251
@ TYPE_FILAMENT
Definition Preset.hpp:248
static std::pair< std::string, std::string > extruder_variant_keys[]
Definition Tab.cpp:149
static std::vector< std::string > variant_keys(DynamicPrintConfig const &config)
Definition Tab.cpp:3765
std::set< std::string > printer_options_with_variant_1
Definition PrintConfig.cpp:10236
ExtruderType
Definition PrintConfig.hpp:612
std::set< std::string > printer_options_with_variant_2
Definition PrintConfig.cpp:10270

References check_extruder_options_status(), Slic3r::GUI::extruder_variant_keys, is_printer_extruder_page(), m_all_extruder_options_status, m_config, m_preset_bundle, m_presets, m_type, Slic3r::nozzle_type(), osInitValue, osSystemValue, parse_extruder_selection(), Slic3r::printer_options_with_variant_1, Slic3r::printer_options_with_variant_2, Slic3r::Preset::TYPE_COUNT, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_MODEL, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, and Slic3r::GUI::variant_keys().

Referenced by check_extruder_options_status(), update_changed_tree_ui(), and update_extruder_switch_colors().

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

◆ clear_pages()

void Slic3r::GUI::Tab::clear_pages ( )
virtual

Reimplemented in Slic3r::GUI::TabFilament, Slic3r::GUI::TabPrint, Slic3r::GUI::TabPrinter, and Slic3r::GUI::TabSLAPrint.

7799{
7800 // invalidated highlighter, if any exists
7801 m_highlighter.invalidate();
7802 // clear pages from the controlls
7803 for (auto p : m_pages)
7804 p->clear();
7805 //BBS: clear page in Parent
7806 //m_page_sizer->Clear(true);
7807 m_parent->clear_page();
7808
7809 // nulling pointers
7811 m_detach_preset_btn = nullptr;
7812
7813 m_compatible_printers.checkbox = nullptr;
7814 m_compatible_printers.btn = nullptr;
7815
7816 m_compatible_prints.checkbox = nullptr;
7817 m_compatible_prints.btn = nullptr;
7818}

References clear_pages(), m_compatible_printers, m_compatible_prints, m_detach_preset_btn, m_highlighter, m_pages, m_parent, and m_parent_preset_description_line.

Referenced by Slic3r::GUI::ParamsPanel::~ParamsPanel(), clear_pages(), Slic3r::GUI::TabFilament::clear_pages(), Slic3r::GUI::TabPrint::clear_pages(), Slic3r::GUI::TabPrinter::clear_pages(), Slic3r::GUI::TabSLAPrint::clear_pages(), and tree_sel_change_delayed().

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

◆ commit_preset_config_value()

bool Slic3r::GUI::Tab::commit_preset_config_value ( const std::string & opt_key)
protected
1684{
1685 if (Page* field_page = nullptr; Field* field = get_field(opt_key, &field_page)) {
1686 field_page->reload_config();
1687 field->field_changed();
1688 return true;
1689 }
1690 for (const PageShp& page : m_pages)
1691 for (const ConfigOptionsGroupShp& group : page->m_optgroups)
1692 if (group->commit_config_value(opt_key))
1693 return true;
1694 return false;
1695}
std::shared_ptr< ConfigOptionsGroup > ConfigOptionsGroupShp
Definition BedShapeDialog.hpp:31

References commit_preset_config_value(), Slic3r::GUI::Field::field_changed(), get_field(), and m_pages.

Referenced by apply_preset_config_values(), and commit_preset_config_value().

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

◆ compare_preset()

void Slic3r::GUI::Tab::compare_preset ( )
8085{
8087}
void show(Preset::Type type=Preset::TYPE_INVALID)
Definition UnsavedChangesDialog.cpp:2054
static DiffPresetDialog * ensure()
Definition Lazy.hpp:186

References compare_preset(), Slic3r::GUI::LazyInstance< DiffPresetDialog >::ensure(), and m_type.

Referenced by compare_preset().

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

◆ compatible_widget_create()

wxSizer * Slic3r::GUI::Tab::compatible_widget_create ( wxWindow * parent,
PresetDependencies & deps )
protected
8446{
8447 deps.checkbox = new ::CheckBox(parent, wxID_ANY);
8448 wxGetApp().UpdateDarkUI(deps.checkbox, false, true);
8449
8450 deps.checkbox_title = new wxStaticText(parent, wxID_ANY, _L("All"));
8451 deps.checkbox_title->SetFont(Label::Body_14);
8452 deps.checkbox_title->SetForegroundColour(wxColour("#363636"));
8453 wxGetApp().UpdateDarkUI(deps.checkbox_title, false, true);
8454
8455 // ORCA modernize button style
8456 Button* btn = new Button(parent, _(L("Set")) + " " + dots);
8458 deps.btn = btn;
8459
8460 auto sizer = new wxBoxSizer(wxHORIZONTAL);
8461 sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL);
8462 sizer->Add((deps.checkbox_title), 0, wxALIGN_CENTER_VERTICAL);
8463 sizer->Add(new wxStaticText(parent, wxID_ANY, " ")); // weirdly didnt apply AddSpacer or wxRIGHT border
8464 sizer->Add((deps.btn), 0, wxALIGN_CENTER_VERTICAL);
8465
8466 auto on_toggle = [this, &deps](const bool &state){
8467 deps.checkbox->SetValue(state);
8468 deps.btn->Enable(!state);
8469 // All printers have been made compatible with this preset.
8470 if (state)
8471 this->load_key_value(deps.key_list, std::vector<std::string> {});
8472 this->get_field(deps.key_condition)->toggle(state);
8473 this->update_changed_ui();
8474 };
8475
8476 deps.checkbox_title->Bind(wxEVT_LEFT_DOWN,([&deps, on_toggle](wxMouseEvent& e) {
8477 if (e.GetEventType() == wxEVT_LEFT_DCLICK) return;
8478 on_toggle(!deps.checkbox->GetValue());
8479 e.Skip();
8480 }));
8481
8482 deps.checkbox_title->Bind(wxEVT_LEFT_DCLICK,([&deps, on_toggle](wxMouseEvent& e) {
8483 on_toggle(!deps.checkbox->GetValue());
8484 e.Skip();
8485 }));
8486
8487 deps.checkbox->Bind(wxEVT_TOGGLEBUTTON, ([on_toggle](wxCommandEvent& e) {
8488 on_toggle(e.IsChecked());
8489 e.Skip();
8490 }), deps.checkbox->GetId());
8491
8492 if (deps.checkbox){
8493 bool is_empty = m_config->option<ConfigOptionStrings>(deps.key_list)->values.empty();
8494 deps.checkbox->SetValue(is_empty);
8495 deps.btn->Enable(!is_empty);
8496 }
8497
8498 /*
8499 if (m_compatible_printers.checkbox) {
8500 bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
8501 m_compatible_printers.checkbox->SetValue(is_empty);
8502 is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable();
8503 }
8504
8505 if (m_compatible_prints.checkbox) {
8506 bool is_empty = m_config->option<ConfigOptionStrings>("compatible_prints")->values.empty();
8507 m_compatible_prints.checkbox->SetValue(is_empty);
8508 is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
8509 }
8510 */
8511
8512 deps.btn->Bind(wxEVT_BUTTON, ([this, parent, &deps](wxCommandEvent& e)
8513 {
8514 // Collect names of non-default non-external profiles.
8515 PrinterTechnology printer_technology = m_preset_bundle->printers.get_edited_preset().printer_technology();
8516 PresetCollection &depending_presets = (deps.type == Preset::TYPE_PRINTER) ? m_preset_bundle->printers :
8517 (printer_technology == ptFFF) ? m_preset_bundle->prints : m_preset_bundle->sla_prints;
8518 wxArrayString presets;
8519 for (size_t idx = 0; idx < depending_presets.size(); ++ idx)
8520 {
8521 Preset& preset = depending_presets.preset(idx);
8522 //BBS: add project embedded preset logic and refine is_external
8523 bool add = ! preset.is_default;
8524 //bool add = ! preset.is_default && ! preset.is_external;
8525 if (add && deps.type == Preset::TYPE_PRINTER)
8526 // Only add printers with the same technology as the active printer.
8527 add &= preset.printer_technology() == printer_technology;
8528 if (add)
8529 presets.Add(from_u8(preset.name));
8530 }
8531
8532 if(deps.type == Preset::TYPE_PRINTER){
8533 deps.dialog_title = _L("Compatible printers");
8534 deps.dialog_label = _L("Select printers");
8535 }else{
8536 deps.dialog_title = _L("Compatible process profiles");
8537 deps.dialog_label = _L("Select profiles");
8538 }
8539
8540 MultiChoiceDialog dlg(parent, deps.dialog_label, deps.dialog_title, presets);
8541 wxGetApp().UpdateDlgDarkUI(&dlg);
8542 // Collect and set indices of depending_presets marked as compatible.
8543 wxArrayInt selections;
8544 auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(m_config->option(deps.key_list));
8545 if (compatible_printers != nullptr && !compatible_printers->values.empty())
8546 for (auto preset_name : compatible_printers->values)
8547 for (size_t idx = 0; idx < presets.GetCount(); ++idx)
8548 if (presets[idx] == from_u8(preset_name)) {
8549 selections.Add(idx);
8550 break;
8551 }
8552 dlg.SetSelections(selections);
8553 dlg.SetSize(FromDIP(wxSize(360, 480)));
8554 std::vector<std::string> value;
8555 // Show the dialog.
8556 if (dlg.ShowModal() == wxID_OK) {
8557 selections.Clear();
8558 selections = dlg.GetSelections();
8559 // leave list empty if all items checked. this will check "All" checkbox automatically. also fixes unnecessary config change
8560 if(selections.GetCount() != presets.GetCount())
8561 for (auto idx : selections)
8562 value.push_back(presets[idx].ToUTF8().data());
8563 if (value.empty()) {
8564 deps.checkbox->SetValue(1);
8565 deps.btn->Disable();
8566 }
8567 // All depending_presets have been made compatible with this preset.
8568 this->load_key_value(deps.key_list, value);
8569 this->update_changed_ui();
8570 }
8571 }));
8572
8573 return sizer;
8574}
@ Regular
Definition Button.hpp:24
@ Parameter
Definition Button.hpp:34
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
void SetStyle(const ButtonStyle style, const ButtonType type)
Definition Button.cpp:200
static wxFont Body_14
Definition Label.hpp:53
void toggle(bool en)
Fires the enable or disable function, based on the input.
Definition Field.cpp:439
wxMouseEvent
Definition CameraPopup.cpp:47
static PrinterTechnology printer_technology()
Definition GUI_Factories.cpp:60
static wxString dots("...", wxConvUTF8)
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
SpiralVase::SpiralPoint add(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:26
PrinterTechnology
Definition Config.hpp:229
@ ptFFF
Definition Config.hpp:231
@ Preset
Definition calib.hpp:39

References _, _L, Label::Body_14, Slic3r::GUI::Tab::PresetDependencies::btn, Slic3r::GUI::Tab::PresetDependencies::checkbox, Slic3r::GUI::Tab::PresetDependencies::checkbox_title, compatible_widget_create(), Slic3r::GUI::Tab::PresetDependencies::dialog_label, Slic3r::GUI::Tab::PresetDependencies::dialog_title, Slic3r::GUI::dots(), Slic3r::ConfigOptionVector< T >::empty(), Button::Enable(), Slic3r::from_u8(), get_field(), Slic3r::GUI::MultiChoiceDialog::GetSelections(), Slic3r::Preset::is_default, Slic3r::GUI::Tab::PresetDependencies::key_condition, Slic3r::GUI::Tab::PresetDependencies::key_list, L, load_key_value(), m_config, m_preset_bundle, Slic3r::Preset::name, Parameter, parent(), Slic3r::PresetCollection::preset(), Slic3r::GUI::printer_technology(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, Regular, Slic3r::GUI::MultiChoiceDialog::SetSelections(), Button::SetStyle(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::PresetCollection::size(), Slic3r::GUI::Tab::PresetDependencies::type, Slic3r::Preset::TYPE_PRINTER, update_changed_ui(), Slic3r::GUI::wxMouseEvent, and wxStaticText.

Referenced by compatible_widget_create().

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

◆ compatible_widget_reload()

void Slic3r::GUI::Tab::compatible_widget_reload ( PresetDependencies & deps)
protected
9351{
9352 Field* field = this->get_field(deps.key_condition);
9353 if (!field)
9354 return;
9355
9356 bool has_any = ! m_config->option<ConfigOptionStrings>(deps.key_list)->values.empty();
9357 has_any ? deps.btn->Enable() : deps.btn->Disable();
9358 deps.checkbox->SetValue(! has_any);
9359
9360 field->toggle(! has_any);
9361}

References Slic3r::GUI::Tab::PresetDependencies::btn, Slic3r::GUI::Tab::PresetDependencies::checkbox, compatible_widget_reload(), Slic3r::ConfigOptionVector< T >::empty(), Button::Enable(), get_field(), Slic3r::GUI::Tab::PresetDependencies::key_condition, Slic3r::GUI::Tab::PresetDependencies::key_list, m_config, and Slic3r::GUI::Field::toggle().

Referenced by compatible_widget_reload(), on_value_change(), Slic3r::GUI::TabFilament::reload_config(), Slic3r::GUI::TabPrint::reload_config(), Slic3r::GUI::TabSLAMaterial::reload_config(), and Slic3r::GUI::TabSLAPrint::reload_config().

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

◆ completed()

bool Slic3r::GUI::Tab::completed ( ) const
inline
352{ return m_completed; }
bool m_completed
Definition Tab.hpp:283

References m_completed.

◆ create_line_with_widget()

void Slic3r::GUI::Tab::create_line_with_widget ( ConfigOptionsGroup * optgroup,
const std::string & opt_key,
const std::string & path,
widget_t widget )
protected
8429{
8430 Line line = optgroup->create_single_option_line(opt_key);
8431 line.widget = widget;
8432 line.label_path = path;
8433
8434 // set default undo ui
8435 line.set_undo_bitmap(&m_bmp_white_bullet);
8436 line.set_undo_to_sys_bitmap(&m_bmp_white_bullet);
8437 line.set_undo_tooltip(&m_tt_white_bullet);
8438 line.set_undo_to_sys_tooltip(&m_tt_white_bullet);
8439 line.set_label_colour(&m_default_text_clr);
8440
8441 optgroup->append_line(line);
8442}
wxString m_tt_white_bullet
Definition Tab.hpp:257
wxColour m_default_text_clr
Definition Tab.hpp:239
ScalableBitmap m_bmp_white_bullet
Definition Tab.hpp:224

References Slic3r::GUI::OptionsGroup::append_line(), create_line_with_widget(), Slic3r::GUI::ConfigOptionsGroup::create_single_option_line(), Slic3r::GUI::Line::label_path, m_bmp_white_bullet, m_default_text_clr, m_tt_white_bullet, Slic3r::GUI::UndoValueUIManager::set_label_colour(), Slic3r::GUI::UndoValueUIManager::set_undo_bitmap(), Slic3r::GUI::UndoValueUIManager::set_undo_to_sys_bitmap(), Slic3r::GUI::UndoValueUIManager::set_undo_to_sys_tooltip(), Slic3r::GUI::UndoValueUIManager::set_undo_tooltip(), and Slic3r::GUI::Line::widget.

Referenced by Slic3r::GUI::TabFilament::build(), Slic3r::GUI::TabPrinter::build_fff(), and create_line_with_widget().

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

◆ create_preset_tab()

void Slic3r::GUI::Tab::create_preset_tab ( )
261{
262//move to ParamsPanel
263/*#ifdef __WINDOWS__
264 SetDoubleBuffered(true);
265#endif //__WINDOWS__*/
266 auto panel = this;
267
268 m_preset_bundle = wxGetApp().preset_bundle;
269
270 // Vertical sizer to hold the choice menu and the rest of the page.
271/*#ifdef __WXOSX__
272 auto *main_sizer = new wxBoxSizer(wxVERTICAL);
273 main_sizer->SetSizeHints(this);
274 this->SetSizer(main_sizer);
275
276 // Create additional panel to Fit() it from OnActivate()
277 // It's needed for tooltip showing on OSX
278 m_tmp_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
279 auto panel = m_tmp_panel;
280 auto sizer = new wxBoxSizer(wxVERTICAL);
281 m_tmp_panel->SetSizer(sizer);
282 m_tmp_panel->Layout();
283
284 main_sizer->Add(m_tmp_panel, 1, wxEXPAND | wxALL, 0);
285#else
286 Tab *panel = this;
287 auto *sizer = new wxBoxSizer(wxVERTICAL);
288 sizer->SetSizeHints(panel);
289 panel->SetSizer(sizer);
290#endif //__WXOSX__*/
291
292 // BBS: model config
294 // preset chooser
295 m_presets_choice = new TabPresetComboBox(panel, m_type);
296 // m_presets_choice->SetFont(Label::Body_10); // BBS
297 m_presets_choice->set_selection_changed_function([this](int selection) {
298 if (!m_presets_choice->selection_is_changed_according_to_physical_printers())
299 {
300 if (m_type == Preset::TYPE_PRINTER && !m_presets_choice->is_selected_physical_printer())
301 m_preset_bundle->physical_printers.unselect_printer();
302
303 // select preset — prefer stored internal name to avoid alias collisions
304 wxString stored_name = m_presets_choice->GetItemAlias(selection);
305 std::string preset_name;
306 if (!stored_name.empty()) {
307 preset_name = Preset::remove_suffix_modified(stored_name.ToUTF8().data());
308 } else {
309 std::string selected_label = Preset::remove_suffix_modified(
310 m_presets_choice->GetString(selection).ToUTF8().data());
311 preset_name = m_preset_bundle->get_preset_name_by_alias(m_type, selected_label);
312 }
313 select_preset(preset_name);
314 }
315 });
316 }
317
318 auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
319
320 //buttons
321 m_scaled_buttons.reserve(6);
322 m_scaled_bitmaps.reserve(4);
323
324 m_top_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
325 // BBS: open this tab by select first
326 m_top_panel->SetBackgroundColour(*wxWHITE);
327 m_top_panel->Bind(wxEVT_LEFT_UP, [this](auto & e) {
329 });
330
331 //add_scaled_button(panel, &m_btn_compare_preset, "compare");
334 //if (m_type == Preset::Type::TYPE_PRINTER)
335 // add_scaled_button(panel, &m_btn_edit_ph_printer, "cog");
336
340
341 //add_scaled_button(panel, &m_btn_hide_incompatible_presets, m_bmp_hide_incompatible_presets.name());
342
343 //m_btn_compare_preset->SetToolTip(_L("Compare presets"));
344 // TRN "Save current Settings"
345 m_btn_save_preset->SetToolTip(wxString::Format(_L("Save current %s"), m_title));
346 m_btn_delete_preset->SetToolTip(_(L("Delete this preset")));
347 m_btn_delete_preset->Hide();
348
349 /*add_scaled_button(panel, &m_question_btn, "question");
350 m_question_btn->SetToolTip(_(L("Hover the cursor over buttons to find more information\n"
351 "or click this button.")));
352
353 add_scaled_button(panel, &m_search_btn, "search");
354 m_search_btn->SetToolTip(format_wxstr(_L("Search in settings [%1%]"), _L("Ctrl+") + "F"));*/
355
356 // Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
357 add_scaled_bitmap(this, m_bmp_value_lock , "unlock_normal");
358 add_scaled_bitmap(this, m_bmp_value_unlock, "lock_normal");
360 // Bitmaps to be shown on the "Undo user changes" button next to each input field.
363 // Bitmap to be shown on the "edit" button before to each editable input field.
364 add_scaled_bitmap(this, m_bmp_edit_value, "edit");
365
367
369 //add_scaled_button(m_top_panel, &m_undo_to_sys_btn, m_bmp_white_bullet.name());
371 m_btn_search->SetToolTip(_L("Search in preset"));
372
373 //search input
374 m_search_item = new StaticBox(m_top_panel);
375 StateColor box_colour(std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
376 StateColor box_border_colour(std::pair<wxColour, int>(wxColour("#009688"), StateColor::Normal)); // ORCA match border color with other input/combo boxes
377
378 m_search_item->SetBackgroundColor(box_colour);
379 m_search_item->SetBorderColor(box_border_colour);
380 m_search_item->SetCornerRadius(5);
381
382
383 //StateColor::darkModeColorFor(wxColour(238, 238, 238)), wxDefaultPosition, wxSize(m_top_panel->GetSize().GetWidth(), 3 * wxGetApp().em_unit()), 8);
384 auto search_sizer = new wxBoxSizer(wxHORIZONTAL);
385 m_search_input = new TextInput(m_search_item, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 | wxBORDER_NONE);
386 m_search_input->SetBackgroundColour(wxColour(238, 238, 238));
387 m_search_input->SetForegroundColour(wxColour(43, 52, 54));
388 m_search_input->SetFont(wxGetApp().bold_font());
389 m_search_input->SetIcon(*BitmapCache().load_svg("search", FromDIP(16), FromDIP(16)));
390 m_search_input->GetTextCtrl()->SetHint(_L("Search in preset") + dots);
391 search_sizer->Add(new wxWindow(m_search_item, wxID_ANY, wxDefaultPosition, wxSize(0, 0)), 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(2));
392 search_sizer->Add(m_search_input, 1, wxEXPAND | wxALL, FromDIP(2));
393 //bbl for linux
394 //search_sizer->Add(new wxWindow(m_search_input, wxID_ANY, wxDefaultPosition, wxSize(0, 0)), 0, wxEXPAND | wxLEFT, 16);
395
396
397 m_search_item->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
398 m_search_input->SetFocus();
399 });
400
401 m_search_input->Bind(wxCUSTOMEVT_EXIT_SEARCH, [this](wxCommandEvent &) {
402 Freeze();
404
405 m_btn_save_preset->Show();
406 m_btn_delete_preset->Show(); // ORCA: fixes delete preset button visible while search box focused
407 m_undo_btn->Show(); // ORCA: fixes revert preset button visible while search box focused
408 m_btn_search->Show();
409 m_search_item->Hide();
410
411 m_search_item->Refresh();
412 m_search_item->Update();
413 m_search_item->Layout();
414
415 this->GetParent()->Refresh();
416 this->GetParent()->Update();
417 this->GetParent()->Layout();
418 Thaw();
419 });
420
421 m_search_item->SetSizer(search_sizer);
422 m_search_item->Layout();
423 search_sizer->Fit(m_search_item);
424
425 m_search_item->Hide();
426 //m_btn_search->SetId(wxID_FIND_PROCESS);
427
428 m_btn_search->Bind(
429 wxEVT_BUTTON,
430 [this](wxCommandEvent &) {
431 Freeze();
433 m_presets_choice->Hide();
434
435 m_btn_save_preset->Hide();
436 m_btn_delete_preset->Hide(); // ORCA: fixes delete preset button visible while search box focused
437 m_undo_btn->Hide(); // ORCA: fixes revert preset button visible while search box focused
438 m_btn_search->Hide();
439 m_search_item->Show();
440
441 this->GetParent()->Refresh();
442 this->GetParent()->Update();
443 this->GetParent()->Layout();
444
445 wxGetApp().plater()->search(false, m_type, m_top_panel->GetParent(), m_search_input, m_btn_search);
446 Thaw();
447
448 });
449
450 m_undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent&) { on_roll_back_value(); }));
451 //m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent&) { on_roll_back_value(true); }));
452 /* m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent&) { wxGetApp().plater()->search(false); });*/
453
454 // Colors for ui "decoration"
455 m_sys_label_clr = wxGetApp().get_label_clr_sys();
456 m_modified_label_clr = wxGetApp().get_label_clr_modified();
457 m_default_text_clr = wxGetApp().get_label_clr_default();
458
459 m_main_sizer = new wxBoxSizer( wxVERTICAL );
460 m_top_sizer = new wxBoxSizer( wxHORIZONTAL );
461
462 m_top_sizer->Add(m_undo_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::ContentMargin()));
463 // BBS: model config
464 if (m_presets_choice) {
465 m_presets_choice->Reparent(m_top_panel);
466 m_top_sizer->Add(m_presets_choice, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::ElementSpacing()));
467 } else {
468 m_top_sizer->AddSpacer(FromDIP(SidebarProps::ElementSpacing()));
469 m_top_sizer->AddStretchSpacer(1);
470 }
471
472 const float scale_factor = /*wxGetApp().*/em_unit(this)*0.1;// GetContentScaleFactor();
473#ifndef DISABLE_UNDO_SYS
474 m_top_sizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
475 m_top_sizer->AddSpacer(FromDIP(SidebarProps::IconSpacing()));
476#endif
477 m_top_sizer->Add(m_btn_save_preset , 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::IconSpacing()));
478 m_top_sizer->Add(m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::IconSpacing()));
479 m_top_sizer->Add(m_btn_search , 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::WideSpacing()));
480 m_top_sizer->Add(m_search_item , 1, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::ContentMargin()));
481
482 if (dynamic_cast<TabPrint*>(this) == nullptr) {
483 m_mode_icon = new ScalableButton(m_top_panel, wxID_ANY, "advanced"); // ORCA
484 m_mode_icon->SetToolTip(_L("Cycle settings visibility"));
485 m_mode_icon->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) {
486 if (wxGetApp().get_mode() == comDevelop || m_mode_view == nullptr)
487 return; // prevent change on dev mode
488
489 const int selection = m_mode_view->GetSelection();
490 m_mode_view->SelectAndNotify((selection + 1) % 3);
491 });
492 m_top_sizer->Add(m_mode_icon, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::WideSpacing()));
493 m_mode_view = new ModeSwitchButton(m_top_panel);
494 if (wxGetApp().get_mode() == comDevelop) {
496 m_mode_view->Enable(false);
497 } else {
498 m_mode_view->SetSelection(mode_to_selection(wxGetApp().get_saved_mode()));
499 }
500 m_top_sizer->AddSpacer(FromDIP(SidebarProps::ElementSpacing()));
501 m_top_sizer->Add( m_mode_view, 0, wxALIGN_CENTER_VERTICAL);
502 }
503
504 m_top_sizer->AddSpacer(FromDIP(SidebarProps::ContentMargin()));
505
506 m_top_sizer->SetMinSize(-1, 3 * m_em_unit);
507 m_top_panel->SetSizer(m_top_sizer);
509 m_main_sizer->Add(m_top_panel, 0, wxEXPAND | wxUP | wxDOWN, FromDIP(SidebarProps::ContentMarginV()));
510 else
511 m_top_panel->Hide();
512
513 // tree
514 m_tabctrl = new TabCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(20 * m_em_unit, -1),
515 wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_NONE | wxWANTS_CHARS | wxTR_FULL_ROW_HIGHLIGHT);
516 m_tabctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable right select
517 m_tabctrl->SetFont(Label::Body_14);
518 //m_left_sizer->Add(m_tabctrl, 1, wxEXPAND);
519 const int img_sz = int(32 * scale_factor + 0.5f);
520 m_icons = new wxImageList(img_sz, img_sz, false, 1);
521 // Index of the last icon inserted into $self->{icons}.
522 m_icon_count = -1;
523 m_tabctrl->AssignImageList(m_icons);
524 wxGetApp().UpdateDarkUI(m_tabctrl);
525
526 // Delay processing of the following handler until the message queue is flushed.
527 // This helps to process all the cursor key events on Windows in the tree control,
528 // so that the cursor jumps to the last item.
529 // BBS: bold selection
530 m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGING, [this](wxCommandEvent& event) {
531 const auto sel_item = m_tabctrl->GetSelection();
532 m_tabctrl->SetItemBold(sel_item, false);
533 });
534 m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGED, [this](wxCommandEvent& event) {
535#ifdef __linux__
536 // Events queue is opposite On Linux. wxEVT_SET_FOCUS invokes after wxEVT_TAB_SEL_CHANGED,
537 // and a result wxEVT_KILL_FOCUS doesn't invoke for the TextCtrls.
538 // So, call SetFocus explicitly for this control before changing of the selection
539 m_tabctrl->SetFocus();
540#endif
541 if (!m_disable_tree_sel_changed_event && !m_pages.empty()) {
544 else {
546 do {
547 m_page_switch_planned = false;
548 m_tabctrl->Update();
549 } while (this->tree_sel_change_delayed(event));
550 m_page_switch_running = false;
551 }
552 }
553 });
554
555 m_tabctrl->Bind(wxEVT_KEY_DOWN, &Tab::OnKeyDown, this);
556
557 m_main_sizer->Add(m_tabctrl, 0, wxEXPAND | wxALL, 0 );
558
559 if (dynamic_cast<TabPrinter *>(this) || dynamic_cast<TabPrint *>(this)) {
560 m_extruder_switch = new MultiSwitchButton(panel);
562 m_extruder_switch->SetFitToOptions();
563 m_extruder_switch->Bind(wxCUSTOMEVT_MULTISWITCH_SELECTION, [this](auto &evt) {
564 evt.Skip();
565 int selection = evt.GetInt();
566
567 int extruder_id;
569 parse_extruder_selection(selection, extruder_id, nozzle_type);
570 int extruder_count = m_preset_bundle->get_printer_extruder_count();
572 if (extruder_id >= 0 && extruder_id < m_preset_bundle->get_printer_extruder_count())
574
575 switch_excluder(extruder_id);
576 });
577 m_extruder_sync_box = new wxPanel(panel, wxID_ANY);
578 m_extruder_sync_box->SetBackgroundColour(panel->GetBackgroundColour());
579 m_extruder_sync_box->SetToolTip(_L("Synchronization of different extruder drives or nozzle volume types is not supported."));
580 m_extruder_sync = nullptr;
582 m_extruder_sync->SetToolTip(_L("Synchronize the modification of parameters to the corresponding parameters of another extruder."));
583 m_extruder_sync->Bind(wxEVT_BUTTON, [this](auto &evt) {
584 evt.Skip();
586 });
587
588 ScalableButton* icon = nullptr;
589 add_scaled_button(panel, &icon, "multi_extruder");
590 icon->SetToolTip(_L("Parameters with this icon can be configured per nozzle."));
591
592 auto sync_box_sizer = new wxBoxSizer(wxHORIZONTAL);
593 sync_box_sizer->Add(m_extruder_sync, 1, wxEXPAND);
594 m_extruder_sync_box->SetSizer(sync_box_sizer);
595
596 m_variant_sizer = new wxBoxSizer(wxHORIZONTAL);
597 auto right_sizer = new wxBoxSizer(wxHORIZONTAL);
598 auto left_sizer = new wxBoxSizer(wxHORIZONTAL);
599
600 m_variant_sizer->Add(left_sizer, 0, wxALIGN_CENTER);
601 m_variant_sizer->AddStretchSpacer(1);
602 // Orca: proportion 1 lets a narrow row squeeze the switch, which then scrolls its buttons.
603 m_variant_sizer->Add(m_extruder_switch, 1, wxALIGN_CENTER, 0);
604 m_variant_sizer->AddStretchSpacer(1);
605 m_variant_sizer->Add(right_sizer, 0, wxALIGN_CENTER);
606 left_sizer->Add(icon , 0, wxALIGN_CENTER | wxLEFT , m_em_unit);
607 right_sizer->Add(m_extruder_sync_box, 0, wxALIGN_CENTER | wxRIGHT, m_em_unit);
608
609 m_main_sizer->Add(m_variant_sizer, 0, wxEXPAND | wxTOP, m_em_unit);
610 } else if (dynamic_cast<TabFilament *>(this)) {
611 m_variant_combo = new MultiSwitchButton(panel);
613 m_variant_combo->Bind(wxCUSTOMEVT_MULTISWITCH_SELECTION, [this](auto &evt) {
614 evt.Skip();
615 switch_excluder(evt.GetInt());
619 if (m_active_page)
620 m_active_page->update_visibility(m_mode, true);
621 m_page_view->GetParent()->Layout();
622 });
623
624 ScalableButton* icon = nullptr;
625 add_scaled_button(panel, &icon, "multi_extruder");
626 icon->SetToolTip(_L("Parameters with this icon can be configured per nozzle."));
627
628 wxBoxSizer *top_sizer = new wxBoxSizer(wxHORIZONTAL);
629 top_sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL);
630 top_sizer->Add(m_variant_combo, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(2));
631
632 m_variant_sizer = new wxBoxSizer(wxVERTICAL);
633 m_variant_sizer->Add(top_sizer, 0, wxEXPAND | wxLEFT, m_em_unit);
634
635 m_main_sizer->Add(m_variant_sizer, 0, wxEXPAND | wxTOP, m_em_unit);
636 }
637
638 this->SetSizer(m_main_sizer);
639 //this->Layout();
640 m_page_view = m_parent->get_paged_view();
641
642 // Initialize the page.
643/*#ifdef __WXOSX__
644 auto page_parent = m_tmp_panel;
645#else
646 auto page_parent = this;
647#endif
648
649 m_page_view = new wxScrolledWindow(page_parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
650 m_page_sizer = new wxBoxSizer(wxVERTICAL);
651 m_page_view->SetSizer(m_page_sizer);
652 m_page_view->SetScrollbars(1, 20, 1, 2);
653 m_hsizer->Add(m_page_view, 1, wxEXPAND | wxLEFT, 5);*/
654
655 //m_btn_compare_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { compare_preset(); }));
656 m_btn_save_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent& e) { save_preset(); }));
657 m_btn_delete_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent& e) { delete_preset(); }));
658 /*m_btn_hide_incompatible_presets->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) {
659 toggle_show_hide_incompatible();
660 }));
661
662 if (m_btn_edit_ph_printer)
663 m_btn_edit_ph_printer->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
664 if (m_preset_bundle->physical_printers.has_selection())
665 m_presets_choice->edit_physical_printer();
666 else
667 m_presets_choice->add_physical_printer();
668 });*/
669
670 // Initialize the DynamicPrintConfig by default keys/values.
671 build();
672
673 // ys_FIXME: Following should not be needed, the function will be called later
674 // (update_mode->update_visibility->rebuild_page_tree). This does not work, during the
675 // second call of rebuild_page_tree m_tabctrl->GetFirstVisibleItem(); returns zero
676 // for some unknown reason (and the page is not refreshed until user does a selection).
678
679 m_completed = true;
680}
static wxFont Body_11
Definition Label.hpp:57
static int ElementSpacing()
Definition Plater.hpp:153
static int WideSpacing()
Definition Plater.hpp:152
static int IconSpacing()
Definition Plater.hpp:151
static int ContentMargin()
Definition Plater.hpp:149
static int ContentMarginV()
Definition Plater.hpp:150
wxPanel * m_top_panel
Definition Tab.hpp:167
TabPresetComboBox * m_presets_choice
Definition Tab.hpp:164
ScalableButton * m_undo_to_sys_btn
Definition Tab.hpp:211
ScalableBitmap m_bmp_show_incompatible_presets
Definition Tab.hpp:219
ScalableButton * m_btn_delete_preset
Definition Tab.hpp:177
ScalableButton * m_extruder_sync
Definition Tab.hpp:333
ScalableButton * m_undo_btn
Definition Tab.hpp:210
wxPanel * m_extruder_sync_box
Definition Tab.hpp:334
wxColour m_modified_label_clr
Definition Tab.hpp:238
wxSizer * m_variant_sizer
Definition Tab.hpp:330
ScalableBitmap m_bmp_hide_incompatible_presets
Definition Tab.hpp:220
bool m_show_incompatible_presets
Definition Tab.hpp:266
void add_scaled_bitmap(wxWindow *parent, ScalableBitmap &btn, const std::string &icon_name)
Definition Tab.cpp:764
void switch_excluder(int extruder_id=-1, bool reload=true)
Definition Tab.cpp:9177
ScalableButton * m_mode_icon
Definition Tab.hpp:329
void rebuild_page_tree()
Definition Tab.cpp:7301
void restore_last_select_item()
Definition Tab.cpp:7848
ScalableButton * m_btn_save_preset
Definition Tab.hpp:176
MultiSwitchButton * m_extruder_switch
Definition Tab.hpp:331
ScalableButton * m_btn_search
Definition Tab.hpp:213
void OnKeyDown(wxKeyEvent &event)
Definition Tab.cpp:8076
wxImageList * m_icons
Definition Tab.hpp:183
ScalableBitmap m_bmp_value_lock
Definition Tab.hpp:222
wxBoxSizer * m_top_sizer
Definition Tab.hpp:169
bool select_preset(std::string preset_name="", bool delete_current=false, const std::string &last_selected_ph_printer_name="", bool force_select=false, bool force_no_transfer=false)
Definition Tab.cpp:7387
ScalableBitmap * m_bmp_non_system
Definition Tab.hpp:226
std::vector< NozzleVolumeType > m_actual_nozzle_volumes
Definition Tab.hpp:339
bool m_page_switch_running
Definition Tab.hpp:305
void add_scaled_button(wxWindow *parent, ScalableButton **btn, const std::string &icon_name, const wxString &label=wxEmptyString, long style=wxBU_EXACTFIT|wxNO_BORDER)
Definition Tab.cpp:753
TextInput * m_search_input
Definition Tab.hpp:215
ModeSwitchButton * m_mode_view
Definition Tab.hpp:328
wxBoxSizer * m_main_sizer
Definition Tab.hpp:168
void sync_excluder()
Definition Tab.cpp:9263
wxColour m_sys_label_clr
Definition Tab.hpp:237
ScalableBitmap m_bmp_value_unlock
Definition Tab.hpp:223
StaticBox * m_search_item
Definition Tab.hpp:214
bool m_page_switch_planned
Definition Tab.hpp:306
ScalableBitmap m_bmp_edit_value
Definition Tab.hpp:230
ScalableBitmap m_bmp_value_revert
Definition Tab.hpp:228
bool m_disable_tree_sel_changed_event
Definition Tab.hpp:265
virtual void build()=0
void delete_preset()
Definition Tab.cpp:8261
bool tree_sel_change_delayed(wxCommandEvent &event)
Definition Tab.cpp:7950
void set_tooltips_text()
Definition Tab.cpp:9363
void on_roll_back_value(const bool to_sys=false)
Definition Tab.cpp:1528
MultiSwitchButton * m_variant_combo
Definition Tab.hpp:332
static std::string remove_suffix_modified(const std::string &name)
Definition Preset.cpp:516
@ Normal
Definition StateColor.hpp:16
int mode_to_selection(ConfigOptionMode mode)
Definition ParamsPanel.cpp:47
@ comDevelop
Definition Config.hpp:225
@ comExpert
Definition Config.hpp:224
@ nvtStandard
Definition PrintConfig.hpp:619
bool load_svg(const char *path, Model *model, std::string &message)
Definition svg.cpp:309

References _, _L, add_scaled_bitmap(), add_scaled_button(), Label::Body_11, Label::Body_14, build(), Slic3r::comDevelop, Slic3r::comExpert, Slic3r::GUI::SidebarProps::ContentMargin(), Slic3r::GUI::SidebarProps::ContentMarginV(), delete_preset(), Slic3r::GUI::dots(), Slic3r::GUI::SidebarProps::ElementSpacing(), em_unit(), Slic3r::GUI::SidebarProps::IconSpacing(), L, Slic3r::load_svg(), m_active_page, m_actual_nozzle_volumes, m_bmp_edit_value, m_bmp_hide_incompatible_presets, m_bmp_non_system, m_bmp_show_incompatible_presets, m_bmp_value_lock, m_bmp_value_revert, m_bmp_value_unlock, m_bmp_white_bullet, m_btn_delete_preset, m_btn_save_preset, m_btn_search, m_completed, m_default_text_clr, m_disable_tree_sel_changed_event, m_em_unit, m_extruder_switch, m_extruder_sync, m_extruder_sync_box, m_icon_count, m_icons, m_main_sizer, m_mode, m_mode_icon, m_mode_view, m_modified_label_clr, m_page_switch_planned, m_page_switch_running, m_page_view, m_pages, m_parent, m_preset_bundle, m_presets_choice, m_scaled_bitmaps, m_scaled_buttons, m_search_input, m_search_item, m_show_incompatible_presets, m_sys_label_clr, m_tabctrl, m_title, m_top_panel, m_top_sizer, m_type, m_undo_btn, m_undo_to_sys_btn, m_variant_combo, m_variant_sizer, StateColor::Normal, Slic3r::nozzle_type(), Slic3r::nvtStandard, on_roll_back_value(), OnKeyDown(), parse_extruder_selection(), rebuild_page_tree(), reload_config(), Slic3r::Preset::remove_suffix_modified(), restore_last_select_item(), save_preset(), select_preset(), set_tooltips_text(), switch_excluder(), sync_excluder(), toggle_options(), tree_sel_change_delayed(), Slic3r::Preset::TYPE_COUNT, Slic3r::Preset::TYPE_PRINTER, update_changed_ui(), Slic3r::GUI::SidebarProps::WideSpacing(), and Slic3r::GUI::wxMouseEvent.

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

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

◆ current_preset_is_dirty()

bool Slic3r::GUI::Tab::current_preset_is_dirty ( ) const
5389{ return m_presets->current_is_dirty(); }

References current_preset_is_dirty(), and m_presets.

Referenced by current_preset_is_dirty(), and Slic3r::GUI::PresetComboBox::get_tooltip().

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

◆ decorate()

void Slic3r::GUI::Tab::decorate ( )
977{
978 for (const auto& opt : m_options_list)
979 {
980 Field* field = nullptr;
981 bool option_without_field = false;
982
983 if (opt.first == "printable_area" ||
984 opt.first == "compatible_prints" || opt.first == "compatible_printers")
985 option_without_field = true;
986
987 if (!option_without_field) {
988 field = get_field(opt.first);
989 if (!field)
990 continue;
991 }
992
993 bool is_nonsys_value = false;
994 bool is_modified_value = true;
995 const ScalableBitmap* sys_icon = &m_bmp_value_lock;
996 const ScalableBitmap* icon = &m_bmp_value_revert;
997
998 const wxColour* color = m_is_default_preset ? &m_default_text_clr : &m_sys_label_clr;
999
1000 const wxString* sys_tt = &m_tt_value_lock;
1001 const wxString* tt = &m_tt_value_revert;
1002
1003 // value isn't equal to system value
1004 if ((opt.second & osSystemValue) == 0) {
1005 is_nonsys_value = true;
1006 sys_icon = m_bmp_non_system;
1007 sys_tt = m_tt_non_system;
1008 // value is equal to last saved
1009 if ((opt.second & osInitValue) != 0)
1010 color = &m_default_text_clr;
1011 // value is modified
1012 else
1013 color = &m_modified_label_clr;
1014 }
1015 if ((opt.second & osInitValue) != 0)
1016 {
1017 is_modified_value = false;
1018 icon = &m_bmp_white_bullet;
1019 tt = &m_tt_white_bullet;
1020 }
1021
1022 if (opt.first == "compatible_prints" || opt.first == "compatible_printers") {
1023 bool sys_page = true;
1024 bool modified_page = false;
1026 sys_page = m_presets->get_selected_preset_parent() != nullptr;
1027 modified_page = false;
1028 } else {
1029 if (opt.first == "compatible_prints") {
1030 get_sys_and_mod_flags("compatible_prints", sys_page, modified_page);
1031 // Don't call for "compatible_printers"
1032 } else if (opt.first == "compatible_printers") {
1033 get_sys_and_mod_flags("compatible_printers", sys_page, modified_page);
1035 get_sys_and_mod_flags("compatible_prints", sys_page, modified_page);
1036 }
1037 }
1038 }
1039 if (!sys_page) {
1040 is_nonsys_value = true;
1041 sys_icon = m_bmp_non_system;
1042 sys_tt = m_tt_non_system;
1043
1044 if (!modified_page)
1045 color = &m_default_text_clr;
1046 else
1047 color = &m_modified_label_clr;
1048 }
1049
1050 if (!modified_page) {
1051 is_modified_value = false;
1052 icon = &m_bmp_white_bullet;
1053 tt = &m_tt_white_bullet;
1054 }
1055
1056 }
1057
1058 if (option_without_field) {
1059 if (Line* line = get_line(opt.first)) {
1060 line->set_undo_bitmap(icon);
1061 line->set_undo_to_sys_bitmap(sys_icon);
1062 line->set_undo_tooltip(tt);
1063 line->set_undo_to_sys_tooltip(sys_tt);
1064 line->set_label_colour(color);
1065 }
1066 continue;
1067 }
1068
1069 field->m_is_nonsys_value = is_nonsys_value;
1070 field->m_is_modified_value = is_modified_value;
1071 field->set_undo_bitmap(icon);
1072 //BBS: GUI refactor
1073 field->set_undo_to_sys_bitmap(sys_icon);
1074 field->set_undo_tooltip(tt);
1075 field->set_undo_to_sys_tooltip(sys_tt);
1076 field->set_label_colour(color);
1077
1078 if (field->has_edit_ui())
1079 field->set_edit_bitmap(&m_bmp_edit_value);
1080
1081 }
1082
1083 if (m_active_page)
1084 m_active_page->refresh();
1085}
void get_sys_and_mod_flags(const std::string &opt_key, bool &sys_page, bool &modified_page)
Definition Tab.cpp:1417
std::map< std::string, int > m_options_list
Definition Tab.hpp:271
wxString * m_tt_non_system
Definition Tab.hpp:255
bool m_is_default_preset
Definition Tab.hpp:205
Line * get_line(const t_config_option_key &opt_key)
Definition Tab.cpp:1928
wxString m_tt_value_revert
Definition Tab.hpp:258
wxString m_tt_value_lock
Definition Tab.hpp:252

References get_field(), get_line(), get_sys_and_mod_flags(), Slic3r::GUI::UndoValueUIManager::has_edit_ui(), m_active_page, m_bmp_edit_value, m_bmp_non_system, m_bmp_value_lock, m_bmp_value_revert, m_bmp_white_bullet, m_default_text_clr, m_is_default_preset, Slic3r::GUI::Field::m_is_modified_value, Slic3r::GUI::Field::m_is_nonsys_value, m_modified_label_clr, m_options_list, m_presets, m_sys_label_clr, m_tt_non_system, m_tt_value_lock, m_tt_value_revert, m_tt_white_bullet, m_type, osInitValue, osSystemValue, Slic3r::GUI::UndoValueUIManager::set_edit_bitmap(), Slic3r::GUI::UndoValueUIManager::set_label_colour(), Slic3r::GUI::UndoValueUIManager::set_undo_bitmap(), Slic3r::GUI::UndoValueUIManager::set_undo_to_sys_bitmap(), Slic3r::GUI::UndoValueUIManager::set_undo_to_sys_tooltip(), Slic3r::GUI::UndoValueUIManager::set_undo_tooltip(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINTER, and Slic3r::Preset::TYPE_SLA_MATERIAL.

Referenced by update_changed_ui(), and update_label_colours().

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

◆ delete_preset()

void Slic3r::GUI::Tab::delete_preset ( )
8262{
8263 auto current_preset = m_presets->get_selected_preset();
8264 // Don't let the user delete the ' - default - ' configuration.
8265 //BBS: add project embedded preset logic and refine is_external
8266 wxString msg;
8267 bool confirm_delete_third_party_printer = false;
8268 bool is_base_preset = false;
8269 if (m_presets->get_preset_base(current_preset) == &current_preset) { //root preset
8270 is_base_preset = true;
8271 if (current_preset.type == Preset::Type::TYPE_PRINTER && !current_preset.is_system) { //Customize third-party printers
8272 Preset &current_preset = m_presets->get_selected_preset();
8273 int filament_preset_num = 0;
8274 int process_preset_num = 0;
8275 for (const Preset &preset : m_preset_bundle->filaments.get_presets()) {
8276 if (preset.is_compatible && !preset.is_default) { filament_preset_num++; }
8277 }
8278 for (const Preset &preset : m_preset_bundle->prints.get_presets()) {
8279 if (preset.is_compatible && !preset.is_default) { process_preset_num++; }
8280 }
8281
8282 DeleteConfirmDialog
8283 dlg(parent(), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Delete"),
8284 // TRN %1% is "N filament preset(s)", %2% is "N process preset(s)".
8285 format_wxstr(_L("%1% and %2% are attached to this printer. Those presets would be deleted if the printer is deleted."),
8286 wxString::Format(_L_PLURAL("%d filament preset", "%d filament presets", filament_preset_num), filament_preset_num),
8287 wxString::Format(_L_PLURAL("%d process preset", "%d process presets", process_preset_num), process_preset_num)));
8288 int res = dlg.ShowModal();
8289 if (res != wxID_OK) return;
8290 confirm_delete_third_party_printer = true;
8291 }
8292 int count = 0;
8293 wxString presets;
8294 for (auto &preset2 : *m_presets)
8295 if (preset2.inherits() == current_preset.name) {
8296 ++count;
8297 presets += "\n - " + from_u8(preset2.name);
8298 }
8299 if (count > 0) {
8300 msg = _L("Presets inherited by other presets cannot be deleted!");
8301 msg += "\n";
8302 msg += _L_PLURAL("The following preset inherits this preset.",
8303 "The following presets inherit this preset.", count);
8304 wxString title = _L("Delete Preset");
8305 MessageDialog(parent(), msg + presets, title, wxOK | wxICON_ERROR).ShowModal();
8306 return;
8307 }
8308 }
8309
8310 BOOST_LOG_TRIVIAL(info) << boost::format("delete preset %1%, setting_id %2%, user_id %3%, base_id %4%, sync_info %5%, type %6%")
8311 %current_preset.name%current_preset.setting_id%current_preset.user_id%current_preset.base_id%current_preset.sync_info
8313 PhysicalPrinterCollection& physical_printers = m_preset_bundle->physical_printers;
8314
8315 if (m_type == Preset::TYPE_PRINTER && !physical_printers.empty())
8316 {
8317 // Check preset for delete in physical printers
8318 // Ask a customer about next action, if there is a printer with just one preset and this preset is equal to delete
8319 std::vector<std::string> ph_printers = physical_printers.get_printers_with_preset(current_preset.name);
8320 std::vector<std::string> ph_printers_only = physical_printers.get_printers_with_only_preset(current_preset.name);
8321
8322 //if (!ph_printers.empty()) {
8323 // msg += _L_PLURAL("The physical printer below is based on the preset, you are going to delete.",
8324 // "The physical printers below are based on the preset, you are going to delete.", ph_printers.size());
8325 // for (const std::string& printer : ph_printers)
8326 // msg += "\n \"" + from_u8(printer) + "\",";
8327 // msg.RemoveLast();
8328 // msg += "\n" + _L_PLURAL("Note, that the selected preset will be deleted from this printer too.",
8329 // "Note, that the selected preset will be deleted from these printers too.", ph_printers.size()) + "\n\n";
8330 //}
8331
8332 //if (!ph_printers_only.empty()) {
8333 // msg += _L_PLURAL("The physical printer below is based only on the preset, you are going to delete.",
8334 // "The physical printers below are based only on the preset, you are going to delete.", ph_printers_only.size());
8335 // for (const std::string& printer : ph_printers_only)
8336 // msg += "\n \"" + from_u8(printer) + "\",";
8337 // msg.RemoveLast();
8338 // msg += "\n" + _L_PLURAL("Note, that this printer will be deleted after deleting the selected preset.",
8339 // "Note, that these printers will be deleted after deleting the selected preset.", ph_printers_only.size()) + "\n\n";
8340 //}
8341 if (!ph_printers.empty() || !ph_printers_only.empty()) {
8342 msg += _L_PLURAL("The following preset will be deleted too:", "The following presets will be deleted too:", ph_printers.size() + ph_printers_only.size());
8343 for (const std::string &printer : ph_printers) msg += "\n \"" + from_u8(printer) + "\",";
8344 for (const std::string &printer : ph_printers_only) msg += "\n \"" + from_u8(printer) + "\",";
8345 msg.RemoveLast();
8346 // msg += "\n" + _L_PLURAL("Note, that the selected preset will be deleted from this printer too.",
8347 // "Note, that the selected preset will be deleted from these printers too.", ph_printers.size()) + "\n\n";
8348 }
8349 }
8350
8351 if (is_base_preset && (current_preset.type == Preset::Type::TYPE_FILAMENT)) {
8352 msg += from_u8(_u8L("Are you sure to delete the selected preset?\nIf the preset corresponds to a filament currently in use on your printer, please reset the filament information for that slot."));
8353 } else {
8354 msg += _L("Are you sure you want to delete the selected preset?");
8355 }
8356
8357 wxString title = _L("Delete Preset");
8358 if (current_preset.is_default || !(confirm_delete_third_party_printer ||
8359 //wxID_YES != wxMessageDialog(parent(), msg, title, wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal())
8360 wxID_YES == MessageDialog(parent(), msg, title, wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal()))
8361 return;
8362
8363 // if we just delete preset from the physical printer
8364 if (m_presets_choice->is_selected_physical_printer()) {
8365 PhysicalPrinter& printer = physical_printers.get_selected_printer();
8366
8367 // just delete this preset from the current physical printer
8368 printer.delete_preset(m_presets->get_edited_preset().name);
8369 // select first from the possible presets for this printer
8370 physical_printers.select_printer(printer);
8371
8372 this->select_preset(physical_printers.get_selected_printer_preset_name());
8373 return;
8374 }
8375
8376 // delete selected preset from printers and printer, if it's needed
8377 if (m_type == Preset::TYPE_PRINTER && !physical_printers.empty())
8378 physical_printers.delete_preset_from_printers(current_preset.name);
8379
8380 // Select will handle of the preset dependencies, of saving & closing the depending profiles, and
8381 // finally of deleting the preset.
8382 this->select_preset("", true);
8383
8384 BOOST_LOG_TRIVIAL(info) << boost::format("delete preset finished");
8385}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
static std::string get_type_string(Preset::Type type)
Definition Preset.cpp:590
#define SLIC3R_APP_FULL_NAME
Definition libslic3r.h:11
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:22
#define _u8L(s)
Definition I18N.hpp:11
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96

References _L, _L_PLURAL, _u8L, count, delete_preset(), Slic3r::PhysicalPrinter::delete_preset(), Slic3r::PhysicalPrinterCollection::delete_preset_from_printers(), Slic3r::PhysicalPrinterCollection::empty(), Slic3r::GUI::format_wxstr(), Slic3r::from_u8(), Slic3r::PhysicalPrinterCollection::get_printers_with_only_preset(), Slic3r::PhysicalPrinterCollection::get_printers_with_preset(), Slic3r::PhysicalPrinterCollection::get_selected_printer(), Slic3r::PhysicalPrinterCollection::get_selected_printer_preset_name(), Slic3r::Preset::get_type_string(), m_preset_bundle, m_presets, m_presets_choice, m_type, parent(), select_preset(), Slic3r::PhysicalPrinterCollection::select_printer(), Slic3r::GUI::DPIAware< P >::ShowModal(), SLIC3R_APP_FULL_NAME, title(), Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::TYPE_PRINTER.

Referenced by create_preset_tab(), and delete_preset().

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

◆ description_line_widget()

wxSizer * Slic3r::GUI::Tab::description_line_widget ( wxWindow * parent,
ogStaticText ** StaticText,
wxString text = wxEmptyString )
5342{
5343 *StaticText = new ogStaticText(parent, text);
5344
5345// auto font = (new wxSystemSettings)->GetFont(wxSYS_DEFAULT_GUI_FONT);
5346 (*StaticText)->SetFont(wxGetApp().normal_font());
5347
5348 auto sizer = new wxBoxSizer(wxHORIZONTAL);
5349 sizer->Add(*StaticText, 1, wxEXPAND|wxALL, 0);
5350 return sizer;
5351}

References description_line_widget(), and parent().

Referenced by build_preset_description_line(), and description_line_widget().

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

◆ edit_custom_gcode()

void Slic3r::GUI::Tab::edit_custom_gcode ( const t_config_option_key & opt_key)
4379{
4380 EditGCodeDialog dlg = EditGCodeDialog(this, opt_key, get_custom_gcode(opt_key));
4381 if (dlg.ShowModal() == wxID_OK) {
4382 const std::string edited_gcode = dlg.get_edited_gcode();
4383 // Orca: this dialog writes the value straight into the config, bypassing the field's change
4384 // handler, so the reserved keyword check has to run here as it does when editing in place.
4386 set_custom_gcode(opt_key, edited_gcode);
4387 update_dirty();
4388 update();
4389 }
4390}
static bool validate_custom_gcode(const wxString &title, const std::string &gcode)
Definition Tab.cpp:4333
virtual void set_custom_gcode(const t_config_option_key &opt_key, const std::string &value)
Definition Tab.cpp:4397
virtual const std::string & get_custom_gcode(const t_config_option_key &opt_key)
Definition Tab.cpp:4392
friend class EditGCodeDialog
Definition Tab.hpp:565
bool validate_custom_gcodes_was_shown
Definition Tab.hpp:521
static wxString custom_gcode_group_title(const Page *page, const t_config_option_key &opt_key)
Definition Tab.cpp:4368

References Slic3r::GUI::custom_gcode_group_title(), EditGCodeDialog, get_custom_gcode(), Slic3r::GUI::EditGCodeDialog::get_edited_gcode(), m_active_page, set_custom_gcode(), Slic3r::GUI::DPIAware< P >::ShowModal(), update(), update_dirty(), validate_custom_gcode(), and validate_custom_gcodes_was_shown.

Referenced by Slic3r::GUI::TabFilament::build(), Slic3r::GUI::TabPrint::build(), and Slic3r::GUI::TabPrinter::build_fff().

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

◆ filter_diff_option()

void Slic3r::GUI::Tab::filter_diff_option ( std::vector< std::string > & options)
protected
1088{
1089 for (auto &opt : options) {
1090 const auto hash_pos = opt.find_last_of('#');
1091 if (hash_pos == std::string::npos) continue;
1092 bool found = false;
1093 for (auto page : m_pages) {
1094 if (auto iter = page->m_opt_id_map.find(opt); iter != page->m_opt_id_map.end()) {
1095 opt = iter->second;
1096 found = true;
1097 break;
1098 }
1099 }
1100 if (!found) opt = opt.substr(0, hash_pos);
1101 }
1102 options.erase(std::remove(options.begin(), options.end(), ""), options.end());
1103}

References m_pages.

Referenced by Slic3r::GUI::TabPrintModel::activate_selected_page(), Slic3r::GUI::TabPrintModel::reload_config(), update_changed_ui(), and Slic3r::GUI::TabPrintModel::update_model_config().

Here is the caller graph for this function:

◆ generate_extruder_options()

std::vector< wxString > Slic3r::GUI::Tab::generate_extruder_options ( )
8931{
8932 std::vector<wxString> options;
8934 auto variants = m_config->option<ConfigOptionStrings>("filament_extruder_variant");
8935 if (!variants)
8936 return options;
8937
8938 for (auto &v : variants->values) {
8939 std::string drive, nozzle;
8940
8941 static std::vector<std::string> known_nozzle_types;
8942 if (known_nozzle_types.empty()) {
8943 for (auto nvt : get_valid_nozzle_volume_type()) {
8944 known_nozzle_types.push_back(get_nozzle_volume_type_string(nvt));
8945 }
8946 std::sort(known_nozzle_types.begin(), known_nozzle_types.end(),
8947 [](const std::string& a, const std::string& b) { return a.size() > b.size(); });
8948 }
8949 bool found = false;
8950 for (const auto& nozzle_type : known_nozzle_types) {
8951 if (v.size() > nozzle_type.size() &&
8952 v.substr(v.size() - nozzle_type.size()) == nozzle_type &&
8953 v[v.size() - nozzle_type.size() - 1] == ' ') {
8954 drive = v.substr(0, v.size() - nozzle_type.size() - 1);
8955 nozzle = nozzle_type;
8956 found = true;
8957 break;
8958 }
8959 }
8960 if (!found) {
8961 size_t pos = v.rfind(' ');
8962 if (pos != std::string::npos) {
8963 drive = v.substr(0, pos);
8964 nozzle = v.substr(pos + 1);
8965 } else {
8966 drive = v;
8967 nozzle = "";
8968 }
8969 }
8970 options.push_back(wxString::Format("%s %s", _L(drive), short_nozzle_volume_name(nozzle)));
8971 }
8972 return options;
8973 }
8974
8975 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
8976 auto nozzle_volumes_def = m_preset_bundle->project_config.def()->get("nozzle_volume_type");
8977 int extruder_nums = m_preset_bundle->get_printer_extruder_count();
8978
8979 if (!nozzle_volumes || extruder_nums <= 0) {
8980 return options;
8981 }
8982
8983 // Orca: the printer tab has one tag per extruder, named as its former "Extruder N" pages were.
8984 // parse_extruder_selection() counts a hybrid extruder as two tags; that still lines up because
8985 // only the last extruder can be hybrid.
8987 for (int i = 0; i < extruder_nums; ++i)
8988 options.push_back(translate_category(wxString::Format("Extruder %d", i + 1), m_type));
8989 return options;
8990 }
8991
8992 std::string pt = m_preset_bundle->printers.get_edited_preset().get_printer_type(m_preset_bundle);
8993 // Orca: the main/deputy toolhead names describe a Bambu dual-nozzle printer, where extruder 0 is
8994 // the left (deputy) and extruder 1 the right (main) nozzle. Other printers number their tools.
8995 const bool toolhead_names = extruder_nums == 2 && m_preset_bundle->is_bbl_vendor();
8996 for (int i = 0; i < extruder_nums; ++i) {
8997 wxString extruder_name = !toolhead_names ? wxString::Format("T%d", i + 1) :
8998 _L(DevPrinterConfigUtil::get_toolhead_display_name(
8999 pt, (i == 0) ? DEPUTY_EXTRUDER_ID : MAIN_EXTRUDER_ID,
9001 NozzleVolumeType volume_type = NozzleVolumeType(nozzle_volumes->values[i]);
9002
9003 if (volume_type == NozzleVolumeType::nvtHybrid) {
9004 options.push_back(wxString::Format("%s %s", extruder_name, short_nozzle_volume_name(get_nozzle_volume_type_string(NozzleVolumeType::nvtStandard))));
9005 options.push_back(wxString::Format("%s %s", extruder_name, short_nozzle_volume_name(get_nozzle_volume_type_string(NozzleVolumeType::nvtHighFlow))));
9006 } else {
9007 options.push_back(wxString::Format("%s %s", extruder_name,
9009 }
9010 }
9011 return options;
9012}
#define DEPUTY_EXTRUDER_ID
Definition DevDefs.h:102
#define MAIN_EXTRUDER_ID
Definition DevDefs.h:101
static wxString short_nozzle_volume_name(const std::string &volume_name)
Definition Tab.cpp:8908
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
ToolHeadComponent
Toolhead component type (extruder / nozzle / hotend).
Definition DevConfigUtil.h:33
@ Nozzle
Definition DevConfigUtil.h:35
std::string get_nozzle_volume_type_string(NozzleVolumeType nozzle_volume_type)
Definition PrintConfig.cpp:860
static std::set< NozzleVolumeType > get_valid_nozzle_volume_type()
Definition PrintConfig.hpp:679
ToolHeadNameCase
Name case style for toolhead display names.
Definition DevConfigUtil.h:40
@ TitleCase
Definition DevConfigUtil.h:41

References _L, DEPUTY_EXTRUDER_ID, generate_extruder_options(), Slic3r::get_nozzle_volume_type_string(), Slic3r::DevPrinterConfigUtil::get_toolhead_display_name(), Slic3r::get_valid_nozzle_volume_type(), m_config, m_preset_bundle, m_type, MAIN_EXTRUDER_ID, Slic3r::Nozzle, Slic3r::nozzle_type(), Slic3r::nvtHighFlow, Slic3r::nvtHybrid, Slic3r::nvtStandard, Slic3r::GUI::short_nozzle_volume_name(), Slic3r::TitleCase, translate_category(), Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::TYPE_PRINTER.

Referenced by generate_extruder_options(), update_changed_tree_ui(), update_extruder_switch_colors(), and update_extruder_variants().

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

◆ get_actual_nozzle_volume_type()

NozzleVolumeType Slic3r::GUI::Tab::get_actual_nozzle_volume_type ( int extruder_id)
9080{
9081 int extruder_count = m_preset_bundle->get_printer_extruder_count();
9082 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
9083 if (extruder_count == 1) {
9084 if (extruder_id < 0)
9086
9087 return NozzleVolumeType(nozzle_volumes->values[extruder_id]);
9088 }
9089
9090 if (extruder_id < 0 || extruder_id >= extruder_count)
9092
9093 if (m_actual_nozzle_volumes.size() != static_cast<size_t>(extruder_count))
9095
9096 return m_actual_nozzle_volumes[extruder_id];
9097}

References get_actual_nozzle_volume_type(), m_actual_nozzle_volumes, m_preset_bundle, and Slic3r::nvtStandard.

Referenced by Slic3r::GUI::TabPrinter::activate_option(), Slic3r::GUI::TabPrinter::extruder_variant_index(), get_actual_nozzle_volume_type(), get_extruder_sync_enable_state(), switch_excluder(), sync_excluder(), and update_extruder_variants().

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

◆ get_category_icon_map()

const std::map< wxString, std::string > & Slic3r::GUI::Tab::get_category_icon_map ( )
inline
506{ return m_category_icon; }

References m_category_icon.

Referenced by Slic3r::GUI::ActionRegistry::materialize_setting_actions().

Here is the caller graph for this function:

◆ get_combo_box()

TabPresetComboBox * Slic3r::GUI::Tab::get_combo_box ( )
inline
495{ return m_presets_choice; }

References m_presets_choice.

Referenced by Slic3r::anonymous_namespace{PluginHostPresets.cpp}::bind_filament_target(), Slic3r::anonymous_namespace{PluginHostPresets.cpp}::bind_preset_target(), and Slic3r::GUI::Sidebar::update_presets().

Here is the caller graph for this function:

◆ get_config()

DynamicPrintConfig * Slic3r::GUI::Tab::get_config ( )
inline
493{ return m_config; }

References m_config.

Referenced by Slic3r::GUI::ObjectList::add_settings_item(), and Slic3r::GUI::PresetComboBox::get_tooltip().

Here is the caller graph for this function:

◆ get_config_manipulation()

ConfigManipulation Slic3r::GUI::Tab::get_config_manipulation ( )
protected
9949{
9950 auto load_config = [this]()
9951 {
9952 update_dirty();
9953 // Initialize UI components with the config values.
9954 reload_config();
9955 update();
9956 };
9957
9958 auto cb_toggle_field = [this](const t_config_option_key& opt_key, bool toggle, int opt_index) {
9959 return toggle_option(opt_key, toggle, opt_index >= 0 ? opt_index + 256 : opt_index);
9960 };
9961
9962 auto cb_toggle_line = [this](const t_config_option_key &opt_key, bool toggle, int opt_index) {
9963 return toggle_line(opt_key, toggle, opt_index >= 0 ? opt_index + 256 : opt_index);
9964 };
9965
9966 auto cb_set_option_label = [this](const t_config_option_key &opt_key, const wxString &label, int opt_index) {
9967 return set_option_label(opt_key, label, opt_index >= 0 ? opt_index + 256 : opt_index);
9968 };
9969
9970 auto cb_value_change = [this](const std::string& opt_key, const boost::any& value) {
9971 return on_value_change(opt_key, value);
9972 };
9973
9974 return ConfigManipulation(load_config, cb_toggle_field, cb_toggle_line, cb_value_change, nullptr, this, cb_set_option_label);
9975}
void toggle_line(const std::string &opt_key, bool toggle, int opt_index=-1)
Definition Tab.cpp:1970
void set_option_label(const std::string &opt_key, const wxString &label, int opt_index=-1)
Definition Tab.cpp:1981
virtual void on_value_change(const std::string &opt_key, const boost::any &value)
Definition Tab.cpp:2071
void load_config(const DynamicPrintConfig &config)
Definition Tab.cpp:1635
void toggle_option(const std::string &opt_key, bool toggle, int opt_index=-1)
Definition Tab.cpp:1961
std::string t_config_option_key
Definition Config.hpp:96

References load_config(), on_value_change(), reload_config(), set_option_label(), toggle_line(), toggle_option(), update(), and update_dirty().

Referenced by Tab().

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

◆ get_current_active_extruder()

int Slic3r::GUI::Tab::get_current_active_extruder ( )
742{
743 if (m_extruder_switch && m_extruder_switch->IsThisEnabled()) {
744 int selection = m_extruder_switch->GetSelection();
745 int extruder_id;
747 parse_extruder_selection(selection, extruder_id, nozzle_type);
748 return extruder_id;
749 }
750 return 0;
751}

References m_extruder_switch, Slic3r::nozzle_type(), and parse_extruder_selection().

Referenced by Slic3r::GUI::TabPrinter::activate_option(), Slic3r::GUI::TabPrinter::build_unregular_pages(), Slic3r::GUI::TabPrinter::on_value_change(), switch_excluder(), sync_excluder(), Slic3r::GUI::TabPrinter::toggle_options(), and update_variant_sizer_visibility().

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

◆ get_custom_ctrl_with_blinking_ptr()

std::pair< OG_CustomCtrl *, bool * > Slic3r::GUI::Tab::get_custom_ctrl_with_blinking_ptr ( const t_config_option_key & opt_key,
int opt_index = -1 )
1934{
1935 if (!m_active_page)
1936 return {nullptr, nullptr};
1937
1938 std::pair<OG_CustomCtrl*, bool*> ret = {nullptr, nullptr};
1939
1940 for (auto opt_group : m_active_page->m_optgroups) {
1941 ret = opt_group->get_custom_ctrl_with_blinking_ptr(opt_key, opt_index);
1942 if (ret.first && ret.second)
1943 break;
1944 }
1945 return ret;
1946}

References get_custom_ctrl_with_blinking_ptr(), and m_active_page.

Referenced by activate_option(), and get_custom_ctrl_with_blinking_ptr().

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

◆ get_custom_gcode()

const std::string & Slic3r::GUI::Tab::get_custom_gcode ( const t_config_option_key & opt_key)
virtual

Reimplemented in Slic3r::GUI::TabFilament.

4393{
4394 return m_config->opt_string(opt_key);
4395}

References m_config.

Referenced by edit_custom_gcode().

Here is the caller graph for this function:

◆ get_extruder_sync_enable_state()

bool Slic3r::GUI::Tab::get_extruder_sync_enable_state ( int extruder_id)
9100{
9101 Preset& printer_preset = m_preset_bundle->printers.get_edited_preset();
9102 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
9103 auto extruders = printer_preset.config.option<ConfigOptionEnumsGeneric>("extruder_type");
9104 // Orca: every rule below describes the two toolheads of a dual-nozzle printer as left/right.
9105 // A printer with any other extruder count has no single counterpart to copy to, so it gets no
9106 // sync button (a toolchanger would need a target to be chosen).
9107 if (nozzle_volumes->values.size() != 2 || extruders->values.size() != 2) {
9108 return false;
9109 }
9110
9111 NozzleVolumeType left_nozzle = NozzleVolumeType(nozzle_volumes->values[0]);
9112 NozzleVolumeType right_nozzle = NozzleVolumeType(nozzle_volumes->values[1]);
9113 ExtruderType left_extruder = ExtruderType(extruders->values[0]);
9114 ExtruderType right_extruder = ExtruderType(extruders->values[1]);
9115
9116 if (left_extruder != right_extruder) {
9117 return false;
9118 }
9119
9120 if (left_nozzle == right_nozzle) {
9121 return true;
9122 }
9123
9124 if (left_nozzle != NozzleVolumeType::nvtHybrid && right_nozzle != NozzleVolumeType::nvtHybrid) {
9125 return false;
9126 }
9127
9128 if (left_nozzle == NozzleVolumeType::nvtHybrid && right_nozzle == NozzleVolumeType::nvtHybrid) {
9129 return true;
9130 }
9131
9132 // Hybrid rules
9133 auto current_nozzle = get_actual_nozzle_volume_type(extruder_id);
9134 if (left_nozzle != NozzleVolumeType::nvtHybrid) {
9135 if (extruder_id == 0) {
9136 return true;
9137 }
9138 if (extruder_id == 1 && current_nozzle == left_nozzle) {
9139 return true;
9140 }
9141 return false;
9142 }
9143 if (right_nozzle != NozzleVolumeType::nvtHybrid) {
9144 if (extruder_id == 1) {
9145 return true;
9146 }
9147 if (extruder_id == 0 && current_nozzle == right_nozzle) {
9148 return true;
9149 }
9150 return false;
9151 }
9152 return false;
9153}
NozzleVolumeType get_actual_nozzle_volume_type(int extruder_id)
Definition Tab.cpp:9079

References Slic3r::Preset::config, get_actual_nozzle_volume_type(), get_extruder_sync_enable_state(), m_preset_bundle, Slic3r::nvtHybrid, Slic3r::ConfigBase::option(), and Slic3r::ConfigOptionVector< int >::values.

Referenced by get_extruder_sync_enable_state(), switch_excluder(), sync_excluder(), and update_variant_sizer_visibility().

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

◆ get_field() [1/2]

Field * Slic3r::GUI::Tab::get_field ( const t_config_option_key & opt_key,
int opt_index = -1 ) const
1924{
1925 return m_active_page ? m_active_page->get_field(opt_key, opt_index) : nullptr;
1926}

References get_field(), and m_active_page.

Referenced by activate_option(), commit_preset_config_value(), compatible_widget_create(), compatible_widget_reload(), decorate(), get_field(), get_field(), on_value_change(), Slic3r::GUI::TabPrinter::refresh_printer_agent_dropdown(), Slic3r::GUI::TabPrinter::toggle_options(), Slic3r::GUI::TabPrinter::update_input_shaper_menu(), and update_label_colours().

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

◆ get_field() [2/2]

Field * Slic3r::GUI::Tab::get_field ( const t_config_option_key & opt_key,
Page ** selected_page,
int opt_index = -1 )
1949{
1950 Field* field = nullptr;
1951 for (auto page : m_pages) {
1952 field = page->get_field(opt_key, opt_index);
1953 if (field != nullptr) {
1954 *selected_page = page.get();
1955 return field;
1956 }
1957 }
1958 return field;
1959}

References get_field(), and m_pages.

Here is the call graph for this function:

◆ get_line()

Line * Slic3r::GUI::Tab::get_line ( const t_config_option_key & opt_key)
1929{
1930 return m_active_page ? m_active_page->get_line(opt_key) : nullptr;
1931}

References get_line(), and m_active_page.

Referenced by decorate(), get_line(), and update_label_colours().

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

◆ get_presets()

PresetCollection * Slic3r::GUI::Tab::get_presets ( )
inline
494{ return m_presets; }

References m_presets.

Referenced by Slic3r::GUI::SavePresetDialog::Item::Item(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), and Slic3r::GUI::PresetComboBox::get_tooltip().

Here is the caller graph for this function:

◆ get_sys_and_mod_flags()

void Slic3r::GUI::Tab::get_sys_and_mod_flags ( const std::string & opt_key,
bool & sys_page,
bool & modified_page )
1418{
1419 auto opt = m_options_list.find(opt_key);
1420 if (opt == m_options_list.end())
1421 return;
1422 // If the value is empty, clear the system flag
1423 if (opt_key == "compatible_printers" || opt_key == "compatible_prints") {
1424 auto* compatible_values = m_config->option<ConfigOptionStrings>(opt_key);
1425 if (compatible_values && compatible_values->values.empty()) {
1426 sys_page = false; // Empty value should NOT be treated as a system value
1427 }
1428 } else if (sys_page) {
1429 sys_page = (opt->second & osSystemValue) != 0;
1430 }
1431
1432 modified_page |= (opt->second & osInitValue) == 0;
1433
1434 //if (sys_page) sys_page = (opt->second & osSystemValue) != 0;
1435 //modified_page |= (opt->second & osInitValue) == 0;
1436}

References get_sys_and_mod_flags(), m_config, m_options_list, osInitValue, and osSystemValue.

Referenced by decorate(), get_sys_and_mod_flags(), and update_changed_tree_ui().

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

◆ init_options_list()

void Slic3r::GUI::Tab::init_options_list ( )
virtual

Reimplemented in Slic3r::GUI::TabFilament, and Slic3r::GUI::TabPrinter.

1377{
1378 if (!m_options_list.empty())
1379 m_options_list.clear();
1380
1381 for (const std::string& opt_key : m_config->keys())
1383}
std::string options_list_storage_key(const std::string &opt_key) const
Definition Tab.cpp:1160
int m_opt_status_value
Definition Tab.hpp:273

References init_options_list(), m_config, m_opt_status_value, m_options_list, and options_list_storage_key().

Referenced by Slic3r::GUI::TabPrintModel::build(), init_options_list(), Slic3r::GUI::TabPrinter::init_options_list(), and load_current_preset().

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

◆ is_printer_extruder_page()

bool Slic3r::GUI::Tab::is_printer_extruder_page ( const Page * page) const
inline
399{ return m_type == Preset::TYPE_PRINTER && page && page->title() == "Extruder"; }

References m_type, Slic3r::GUI::Page::title(), and Slic3r::Preset::TYPE_PRINTER.

Referenced by check_extruder_options_status(), switch_excluder(), update_changed_tree_ui(), update_extruder_switch_colors(), and update_variant_sizer_visibility().

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

◆ load_config()

void Slic3r::GUI::Tab::load_config ( const DynamicPrintConfig & config)
1636{
1637 bool modified = 0;
1638 for(auto opt_key : m_config->diff(config)) {
1639 m_config->set_key_value(opt_key, config.option(opt_key)->clone());
1640 modified = 1;
1641 }
1642 if (modified) {
1643 update_dirty();
1644 //# Initialize UI components with the config values.
1645 reload_config();
1646 update();
1647 }
1648}

References Slic3r::ConfigOption::clone(), load_config(), m_config, Slic3r::ConfigBase::option(), reload_config(), update(), and update_dirty().

Referenced by get_config_manipulation(), Slic3r::GUI::MainFrame::load_config(), load_config(), set_custom_gcode(), Slic3r::GUI::TabFilament::set_custom_gcode(), and Slic3r::GUI::Sidebar::priv::switch_diameter().

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

◆ load_current_preset()

void Slic3r::GUI::Tab::load_current_preset ( )
7134{
7135 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<<boost::format(": enter, m_type %1%")%Preset::get_type_string(m_type);
7136 const Preset& preset = m_presets->get_edited_preset();
7137 std::vector<std::string> prev_variant_list;
7138 int prev_extruder_count = 0;
7139
7141
7143 // For the printer profile, generate the extruder pages.
7144 if (preset.printer_technology() == ptFFF) {
7145 prev_variant_list = static_cast<TabPrinter*>(this)->m_extruder_variant_list;
7146 prev_extruder_count = static_cast<TabPrinter*>(this)->m_extruders_count;
7148 }
7149 else
7150 wxGetApp().obj_list()->update_objects_list_filament_column(1);
7151 }
7152 if (m_type == Preset::TYPE_PRINT) {
7153 if (auto tab = wxGetApp().plate_tab) {
7154 tab->m_config->apply(*m_config);
7155 tab->update_extruder_variants();
7156 }
7157 for (auto tab : wxGetApp().model_tabs_list) {
7158 tab->m_config->apply(*m_config);
7159 tab->update_extruder_variants();
7160 }
7161 }
7162 update();
7163
7164 // Reload preset pages with the new configuration values.
7165 update_extruder_variants(-1, false);
7166 reload_config();
7167
7168 update_ui_items_related_on_parent_preset(m_presets->get_selected_preset_parent());
7169
7170// m_undo_to_sys_btn->Enable(!preset.is_default);
7171
7172#if 0
7173 // use CallAfter because some field triggers schedule on_change calls using CallAfter,
7174 // and we don't want them to be called after this update_dirty() as they would mark the
7175 // preset dirty again
7176 // (not sure this is true anymore now that update_dirty is idempotent)
7177 wxTheApp->CallAfter([this]
7178#endif
7179 {
7180 // checking out if this Tab exists till this moment
7181 if (!wxGetApp().checked_tab(this))
7182 return;
7183 update_tab_ui();
7184
7185 // update show/hide tabs
7187 const PrinterTechnology printer_technology = m_presets->get_edited_preset().printer_technology();
7188 if (printer_technology != static_cast<TabPrinter*>(this)->m_printer_technology)
7189 {
7190 // The change of the technology requires to remove some of unrelated Tabs
7191 // During this action, wxNoteBook::RemovePage invoke wxEVT_NOTEBOOK_PAGE_CHANGED
7192 // and as a result a function select_active_page() is called fron Tab::OnActive()
7193 // But we don't need it. So, to avoid activation of the page, set m_active_page to NULL
7194 // till unusable Tabs will be deleted
7195 Page* tmp_page = m_active_page;
7196 m_active_page = nullptr;
7197 for (auto tab : wxGetApp().tabs_list) {
7198 if (tab->type() == Preset::TYPE_PRINTER) { // Printer tab is shown every time
7199 int cur_selection = wxGetApp().tab_panel()->GetSelection();
7200 if (cur_selection != 0)
7201 wxGetApp().tab_panel()->SetSelection(wxGetApp().tab_panel()->GetPageCount() - 1);
7202 continue;
7203 }
7204 if (tab->supports_printer_technology(printer_technology))
7205 {
7206#ifdef _MSW_DARK_MODE
7207 if (!wxGetApp().tabs_as_menu()) {
7208 std::string bmp_name = tab->type() == Slic3r::Preset::TYPE_FILAMENT ? "spool" :
7209 tab->type() == Slic3r::Preset::TYPE_SLA_MATERIAL ? "" : "cog";
7210 tab->Hide(); // #ys_WORKAROUND : Hide tab before inserting to avoid unwanted rendering of the tab
7211 dynamic_cast<Notebook*>(wxGetApp().tab_panel())->InsertPage(wxGetApp().tab_panel()->FindPage(this), wxString(), tab, tab->title(), bmp_name);
7212 }
7213 else
7214#endif
7215 wxGetApp().tab_panel()->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab, tab->title(), "");
7216 #ifdef __linux__ // the tabs apparently need to be explicitly shown on Linux (pull request #1563)
7217 int page_id = wxGetApp().tab_panel()->FindPage(tab);
7218 wxGetApp().tab_panel()->GetPage(page_id)->Show(true);
7219 #endif // __linux__
7220 }
7221 else {
7222 int page_id = wxGetApp().tab_panel()->FindPage(tab);
7223 wxGetApp().tab_panel()->GetPage(page_id)->Show(false);
7224 wxGetApp().tab_panel()->RemovePage(page_id);
7225 }
7226 }
7227 static_cast<TabPrinter*>(this)->m_printer_technology = printer_technology;
7228 m_active_page = tmp_page;
7229#ifdef _MSW_DARK_MODE
7230 if (!wxGetApp().tabs_as_menu())
7231 dynamic_cast<Notebook*>(wxGetApp().tab_panel())->SetPageImage(wxGetApp().tab_panel()->FindPage(this), printer_technology == ptFFF ? "printer" : "sla_printer");
7232#endif
7233 }
7234 //update the object config due to extruder count change
7235 DynamicPrintConfig& new_print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
7236 std::vector<std::string> new_variant_list = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionStrings>("printer_extruder_variant")->values;
7237 int new_extruder_count = wxGetApp().preset_bundle->get_printer_extruder_count();
7238 if (prev_extruder_count != new_extruder_count || prev_variant_list.size() != new_variant_list.size())
7239 {
7240 //process the object params here
7241 Model& model = wxGetApp().plater()->model();
7242 size_t num_objects = model.objects.size();
7243 for (int i = 0; i < num_objects; ++i) {
7244 ModelObject* object = model.objects[i];
7245 DynamicPrintConfig object_config = object->config.get();
7246 if (!object_config.empty()) {
7247 object_config.update_values_from_multi_to_multi_2(prev_variant_list, new_variant_list, new_print_config, print_options_with_variant);
7248 object->config.assign_config(std::move(object_config));
7249 }
7250 for (ModelVolume* v : object->volumes) {
7251 if (v->is_model_part() || v->is_modifier()) {
7252 DynamicPrintConfig volume_config = v->config.get();
7253 if (!volume_config.empty()) {
7254 volume_config.update_values_from_multi_to_multi_2(prev_variant_list,new_variant_list,new_print_config, print_options_with_variant);
7255 v->config.assign_config(std::move(volume_config));
7256 }
7257 }
7258 }
7259
7260 for (auto &layer_config_it : object->layer_config_ranges) {
7261 ModelConfig& layer_model_config = layer_config_it.second;
7262 DynamicPrintConfig layer_config = layer_model_config.get();
7263 if (!layer_config.empty()) {
7264 layer_config.update_values_from_multi_to_multi_2(prev_variant_list,new_variant_list,new_print_config, print_options_with_variant);
7265 layer_model_config.assign_config(std::move(layer_config));
7266 }
7267 }
7268 }
7269 }
7270
7272 if (printer_technology == ptFFF) {
7273 static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<const ConfigOptionFloats*>(m_presets->get_selected_preset().config.option("nozzle_diameter"))->values.size(); //static_cast<TabPrinter*>(this)->m_extruders_count;
7274 const Preset* parent_preset = m_presets->get_selected_preset_parent();
7275 static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
7276 static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
7277 }
7278 }
7279 else {
7283 }
7284 m_opt_status_value = (m_presets->get_selected_preset_parent() ? osSystemValue : 0) | osInitValue;
7286 if (m_type == Preset::TYPE_PRINT) {
7287 for (auto tab : wxGetApp().model_tabs_list) {
7288 tab->init_options_list();
7289 }
7290 }
7293 }
7294#if 0
7295 );
7296#endif
7297 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<<boost::format(": exit");
7298}
std::vector< double > values
Definition Config.hpp:418
void update_tab_ui(bool update_plater_presets=false)
Definition Tab.cpp:1624
void on_presets_changed()
Definition Tab.cpp:2771
void update_extruder_variants(int extruder_id=-1, bool reload=true)
Call from: 1: on_value_change "nozzle_volume_type" 2: on_preset_loaded (extruder_id = -1).
Definition Tab.cpp:8835
virtual void init_options_list()
Definition Tab.cpp:1376
void update_frequently_changed_parameters()
Definition Tab.cpp:2957
void update_btns_enabling()
Definition Tab.cpp:7364
void update_visibility()
Definition Tab.cpp:1807
void update_ui_items_related_on_parent_preset(const Preset *selected_preset_parent)
Definition Tab.cpp:7114
virtual void on_preset_loaded()
Definition Tab.hpp:415
@ TYPE_SLA_PRINT
Definition Preset.hpp:247
std::set< std::string > print_options_with_variant
Definition PrintConfig.cpp:10102
ConfigOptionFloatsTempl< false > ConfigOptionFloats
Definition Config.hpp:1015

References Slic3r::ModelConfig::assign_config(), Slic3r::ModelVolume::config, Slic3r::Preset::config, Slic3r::DynamicConfig::empty(), Slic3r::ModelConfig::get(), Slic3r::Preset::get_type_string(), init_options_list(), Slic3r::ModelVolume::is_model_part(), Slic3r::ModelVolume::is_modifier(), Slic3r::ModelObject::layer_config_ranges, load_current_preset(), m_active_page, m_config, m_opt_status_value, m_presets, m_type, Slic3r::Model::objects, on_preset_loaded(), on_presets_changed(), Slic3r::ConfigBase::option(), osInitValue, osSystemValue, Slic3r::print_options_with_variant, Slic3r::GUI::printer_technology(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, reload_config(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, Slic3r::Preset::TYPE_SLA_PRINT, update(), update_btns_enabling(), update_changed_ui(), update_extruder_variants(), update_frequently_changed_parameters(), update_tab_ui(), update_ui_items_related_on_parent_preset(), Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi_2(), update_visibility(), and Slic3r::ModelObject::volumes.

Referenced by load_current_preset(), on_presets_changed(), select_preset(), and transfer_options().

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

◆ load_initial_data()

void Slic3r::GUI::Tab::load_initial_data ( )
773{
774 m_config = &m_presets->get_edited_preset().config;
775 bool has_parent = m_presets->get_selected_preset_parent() != nullptr;
779}
wxString m_tt_value_unlock
Definition Tab.hpp:253
wxString * m_ttg_non_system
Definition Tab.hpp:246
wxString m_ttg_white_bullet_ns
Definition Tab.hpp:244
wxString m_ttg_value_unlock
Definition Tab.hpp:243

References m_bmp_non_system, m_bmp_value_unlock, m_bmp_white_bullet, m_config, m_presets, m_tt_non_system, m_tt_value_unlock, m_ttg_non_system, m_ttg_value_unlock, and m_ttg_white_bullet_ns.

Referenced by Slic3r::GUI::TabFilament::build(), Slic3r::GUI::TabPrint::build(), Slic3r::GUI::TabPrinter::build(), Slic3r::GUI::TabPrintPlate::build(), Slic3r::GUI::TabSLAMaterial::build(), and Slic3r::GUI::TabSLAPrint::build().

Here is the caller graph for this function:

◆ load_key_value()

void Slic3r::GUI::Tab::load_key_value ( const std::string & opt_key,
const boost::any & value,
bool saved_value = false )
protected
2019{
2020 if (!saved_value) change_opt_value(*m_config, opt_key, value);
2021 // Mark the print & filament enabled if they are compatible with the currently selected preset.
2022 if (opt_key == "compatible_printers" || opt_key == "compatible_prints") {
2023 // Don't select another profile if this profile happens to become incompatible.
2025 }
2026 if (m_presets_choice)
2027 m_presets_choice->update_dirty();
2029 update();
2030}
void change_opt_value(DynamicPrintConfig &config, const t_config_option_key &opt_key, const boost::any &value, int opt_index)
Definition GUI.cpp:140

References Slic3r::GUI::change_opt_value(), load_key_value(), m_config, m_preset_bundle, m_presets_choice, Slic3r::Never, on_presets_changed(), and update().

Referenced by apply_preset_config_values(), compatible_widget_create(), Slic3r::GUI::TabPrinter::create_bed_shape_widget(), load_key_value(), and on_roll_back_value().

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

◆ may_discard_current_dirty_preset()

bool Slic3r::GUI::Tab::may_discard_current_dirty_preset ( PresetCollection * presets = nullptr,
const std::string & new_printer_name = "",
bool no_transfer = false,
bool no_transfer_variant = false )
7719{
7720 if (presets == nullptr) presets = m_presets;
7721
7722 UnsavedChangesDialog dlg(m_type, presets, new_printer_name, no_transfer);
7723 if (dlg.ShowModal() == wxID_CANCEL)
7724 return false;
7725
7726 if (dlg.save_preset()) // save selected changes
7727 {
7728 const std::vector<std::string>& unselected_options = dlg.get_unselected_options(presets->type());
7729 const std::string& name = dlg.get_preset_name();
7730 //BBS: add project embedded preset relate logic
7731 bool save_to_project = dlg.get_save_to_project_option();
7732
7733 if (m_type == presets->type()) // save changes for the current preset from this tab
7734 {
7735 // revert unselected options to the old values
7736 presets->get_edited_preset().config.apply_only(presets->get_selected_preset().config, unselected_options);
7737 //BBS: add project embedded preset relate logic
7738 save_preset(name, false, save_to_project);
7739 //save_preset(name);
7740 }
7741 else
7742 {
7743 //BBS: add project embedded preset relate logic
7744 m_preset_bundle->save_changes_for_preset(name, presets->type(), unselected_options, save_to_project);
7745 //m_preset_bundle->save_changes_for_preset(name, presets->type(), unselected_options);
7746
7747 // If filament preset is saved for multi-material printer preset,
7748 // there are cases when filament comboboxs are updated for old (non-modified) colors,
7749 // but in full_config a filament_colors option aren't.
7750 if (presets->type() == Preset::TYPE_FILAMENT && wxGetApp().extruders_edited_cnt() > 1)
7751 wxGetApp().plater()->force_filament_colors_update();
7752 }
7753 }
7754 else if (dlg.transfer_changes()) // move selected changes
7755 {
7756 std::vector<std::string> selected_options = dlg.get_selected_options();
7757 if (!no_transfer && no_transfer_variant) {
7758 auto & options_list = wxGetApp().get_tab(presets->type())->m_options_list;
7759 bool has_variants = false;
7760 for (auto &opt : selected_options) {
7761 if (auto n = opt.find('#'); n != std::string::npos) {
7762 auto iter = options_list.lower_bound(opt.substr(0, n));
7763 if (iter == options_list.end() || opt.compare(0, n, iter->first)) {
7764 has_variants = true;
7765 opt.clear();
7766 }
7767 }
7768 }
7769 if (has_variants) {
7770 auto msg = _L("Switching to a printer with different extruder types or numbers will discard or reset changes to extruder or multi-nozzle-related parameters.");
7771 MessageDialog(wxGetApp().plater(), msg, _L("Use Modified Value"), wxOK | wxICON_WARNING).ShowModal();
7772 selected_options.erase(std::remove(selected_options.begin(), selected_options.end(), ""), selected_options.end());
7773 }
7774 }
7775
7776 if (m_type == presets->type()) // move changes for the current preset from this tab
7777 {
7779 auto it = std::find(selected_options.begin(), selected_options.end(), "extruders_count");
7780 if (it != selected_options.end()) {
7781 // erase "extruders_count" option from the list
7782 selected_options.erase(it);
7783 // cache the extruders count
7784 static_cast<TabPrinter*>(this)->cache_extruder_cnt();
7785 }
7786 }
7787
7788 // copy selected options to the cache from edited preset
7789 cache_config_diff(selected_options);
7790 }
7791 else
7792 wxGetApp().get_tab(presets->type())->cache_config_diff(selected_options);
7793 }
7794
7795 return true;
7796}
std::string name() const
Definition Tab.hpp:349
void cache_config_diff(const std::vector< std::string > &selected_options, const DynamicPrintConfig *config=nullptr)
Definition Tab.cpp:2739

References _L, Slic3r::ConfigBase::apply_only(), cache_config_diff(), Slic3r::Preset::config, Slic3r::PresetCollection::get_edited_preset(), Slic3r::GUI::UnsavedChangesDialog::get_preset_name(), Slic3r::GUI::UnsavedChangesDialog::get_save_to_project_option(), Slic3r::GUI::UnsavedChangesDialog::get_selected_options(), Slic3r::PresetCollection::get_selected_preset(), Slic3r::GUI::UnsavedChangesDialog::get_unselected_options(), m_preset_bundle, m_presets, m_type, may_discard_current_dirty_preset(), name(), Slic3r::GUI::plater(), save_preset(), Slic3r::GUI::UnsavedChangesDialog::save_preset(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::GUI::UnsavedChangesDialog::ShowModal(), Slic3r::GUI::UnsavedChangesDialog::transfer_changes(), Slic3r::PresetCollection::type(), Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::TYPE_PRINTER.

Referenced by may_discard_current_dirty_preset(), and select_preset().

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

◆ msw_rescale()

void Slic3r::GUI::Tab::msw_rescale ( )
virtual

Reimplemented in Slic3r::GUI::TabPrinter.

1825{
1827
1828 m_top_sizer->SetMinSize(-1, 3 * m_em_unit);
1829
1830 //BBS: GUI refactor
1831 //if (m_mode_sizer)
1832 // m_mode_sizer->msw_rescale();
1833 if (m_presets_choice)
1834 m_presets_choice->msw_rescale();
1835
1836 m_tabctrl->SetMinSize(wxSize(20 * m_em_unit, -1));
1837
1838 // rescale buttons and cached bitmaps
1839 for (const auto btn : m_scaled_buttons)
1840 btn->msw_rescale();
1841 for (const auto bmp : m_scaled_bitmaps)
1842 bmp->msw_rescale();
1843
1844 if (m_mode_view)
1845 m_mode_view->Rescale();
1847 m_extruder_switch->Rescale();
1848 if (m_variant_combo)
1849 m_variant_combo->Rescale();
1850
1852 m_detach_preset_btn->msw_rescale();
1853
1854 // rescale icons for tree_ctrl
1855 for (ScalableBitmap& bmp : m_scaled_icons_list)
1856 bmp.msw_rescale();
1857 // recreate and set new ImageList for tree_ctrl
1858 m_icons->RemoveAll();
1859 m_icons = new wxImageList(m_scaled_icons_list.front().bmp().GetWidth(), m_scaled_icons_list.front().bmp().GetHeight(), false);
1860 for (ScalableBitmap& bmp : m_scaled_icons_list)
1861 //m_icons->Add(bmp.bmp());
1862 m_tabctrl->AssignImageList(m_icons);
1863
1864 // rescale options_groups
1865 if (m_active_page)
1866 m_active_page->msw_rescale();
1867
1868 m_tabctrl->Rescale();
1869
1870 //BBS: GUI refactor
1871 //Layout();
1872 m_parent->Layout();
1873}

References em_unit(), m_active_page, m_detach_preset_btn, m_em_unit, m_extruder_switch, m_icons, m_mode_view, m_parent, m_presets_choice, m_scaled_bitmaps, m_scaled_buttons, m_scaled_icons_list, m_tabctrl, m_top_sizer, m_variant_combo, and msw_rescale().

Referenced by msw_rescale(), and Slic3r::GUI::TabPrinter::msw_rescale().

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

◆ name()

std::string Slic3r::GUI::Tab::name ( ) const
inline
349{ return m_presets->name(); }

References m_presets.

Referenced by may_discard_current_dirty_preset(), OnTreeSelChange(), save_preset(), and update_preset_description_line().

Here is the caller graph for this function:

◆ on_preset_loaded()

virtual void Slic3r::GUI::Tab::on_preset_loaded ( )
inlinevirtual

Reimplemented in Slic3r::GUI::TabPrinter.

415{}

Referenced by load_current_preset(), and Slic3r::GUI::Sidebar::update_presets().

Here is the caller graph for this function:

◆ on_presets_changed()

void Slic3r::GUI::Tab::on_presets_changed ( )
protected
2772{
2773 if (wxGetApp().plater() == nullptr)
2774 return;
2775
2776 // Instead of PostEvent (EVT_TAB_PRESETS_CHANGED) just call update_presets
2777 wxGetApp().plater()->sidebar().update_presets(m_type);
2778
2779 // Check if printer agent needs switching
2781 wxGetApp().switch_printer_agent();
2782
2783 // Trigger per-vendor preset update check
2784 const Preset& printer_preset = m_preset_bundle->printers.get_edited_preset();
2785 if (printer_preset.vendor) {
2786 wxGetApp().get_preset_updater()->check_vendor_update(printer_preset.vendor->id);
2787 }
2788 }
2789
2790 bool is_bbl_vendor_preset = m_preset_bundle->is_bbl_vendor();
2791 if (is_bbl_vendor_preset) {
2792 wxGetApp().plater()->get_partplate_list().set_render_option(true, true);
2793 if (m_preset_bundle->printers.get_edited_preset().has_cali_lines(wxGetApp().preset_bundle)) {
2794 wxGetApp().plater()->get_partplate_list().set_render_cali(true);
2795 } else {
2796 wxGetApp().plater()->get_partplate_list().set_render_cali(false);
2797 }
2798 } else {
2799 wxGetApp().plater()->get_partplate_list().set_render_option(false, true);
2800 wxGetApp().plater()->get_partplate_list().set_render_cali(false);
2801 }
2802
2803 // Printer selected at the Printer tab, update "compatible" marks at the print and filament selectors.
2804 for (auto t: m_dependent_tabs)
2805 {
2806 Tab* tab = wxGetApp().get_tab(t);
2807 // If the printer tells us that the print or filament/sla_material preset has been switched or invalidated,
2808 // refresh the print or filament/sla_material tab page.
2809 // But if there are options, moved from the previously selected preset, update them to edited preset
2810 tab->apply_config_from_cache();
2811 tab->load_current_preset();
2812 }
2813 // clear m_dependent_tabs after first update from select_preset()
2814 // to avoid needless preset loading from update() function
2815 m_dependent_tabs.clear();
2816
2817 wxGetApp().plater()->update_project_dirty_from_presets();
2818
2819 // ORCA also update states of plates for plates toolbar. same method exist on Plater::priv::on_select_preset()
2820 auto& plate_list = wxGetApp().plater()->get_partplate_list();
2821 for (auto plate : plate_list.get_plate_list())
2822 plate->update_slice_result_valid_state(false);
2823}
std::vector< Preset::Type > m_dependent_tabs
Definition Tab.hpp:269
Tab(ParamsPanel *parent, const wxString &title, Preset::Type type)
Definition Tab.cpp:207

References Tab(), apply_config_from_cache(), Slic3r::VendorProfile::id, load_current_preset(), m_dependent_tabs, m_preset_bundle, m_type, on_presets_changed(), Slic3r::GUI::plater(), Slic3r::Preset::TYPE_PRINTER, and Slic3r::Preset::vendor.

Referenced by Slic3r::GUI::TabPrinter::create_bed_shape_widget(), load_current_preset(), load_key_value(), on_presets_changed(), on_value_change(), save_preset(), select_preset(), update_dirty(), and update_tab_ui().

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

◆ on_roll_back_value()

void Slic3r::GUI::Tab::on_roll_back_value ( const bool to_sys = false)
1529{
1530 // BBS: restore all pages in preset
1531 // if (!m_active_page) return;
1532
1533 int os;
1534 if (to_sys) {
1535 if (!m_is_nonsys_values) return;
1536 os = osSystemValue;
1537 }
1538 else {
1539 // BBS: restore all pages in preset
1540 if (!m_presets->get_edited_preset().is_dirty) return;
1541 os = osInitValue;
1542 }
1543
1544 m_postpone_update_ui = true;
1545
1546 // BBS: restore all preset
1547 for (auto page : m_pages)
1548 for (auto group : page->m_optgroups) {
1549 if (group->title == "Capabilities") {
1550 if ((m_options_list["extruders_count"] & os) == 0)
1551 to_sys ? group->back_to_sys_value("extruders_count") : group->back_to_initial_value("extruders_count");
1552 }
1553 if (group->title == "Size and coordinates") {
1554 if ((m_options_list["printable_area"] & os) == 0) {
1555 to_sys ? group->back_to_sys_value("printable_area") : group->back_to_initial_value("printable_area");
1556 load_key_value("printable_area", true/*some value*/, true);
1557 }
1558 }
1559 if (group->title == "Profile dependencies") {
1560 if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) {
1561 to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers");
1562 load_key_value("compatible_printers", true/*some value*/, true);
1563 }
1564 if ((m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL) && (m_options_list["compatible_prints"] & os) == 0) {
1565 to_sys ? group->back_to_sys_value("compatible_prints") : group->back_to_initial_value("compatible_prints");
1566 load_key_value("compatible_prints", true/*some value*/, true);
1567 }
1568 }
1569 for (const auto &kvp : group->opt_map()) {
1570 const std::string &opt_key = kvp.first;
1571 auto iter = m_options_list.find(opt_key);
1572 if (iter != m_options_list.end() && (iter->second & os) == 0)
1573 to_sys ? group->back_to_sys_value(opt_key) : group->back_to_initial_value(opt_key);
1574 }
1575 }
1576
1577 // BBS: restore all pages in preset
1578 m_presets->discard_current_changes();
1579
1580 m_postpone_update_ui = false;
1581
1582 // Orca: the restored config may have another extruder count than the tab shows.
1583 if (auto printer_tab = dynamic_cast<TabPrinter *>(this))
1584 printer_tab->sync_extruders_count();
1585
1586 // When all values are rolled, then we have to update whole tab in respect to the reverted values
1587 update();
1588 if (m_active_page)
1589 m_active_page->update_visibility(m_mode, true);
1590
1591 // BBS: restore all pages in preset, update_dirty also update combobox
1592 update_dirty();
1593
1594 if (m_compatible_printers.checkbox) {
1595 bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
1596 m_compatible_printers.checkbox->SetValue(is_empty);
1597 is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable();
1598 }
1599 if (m_compatible_prints.checkbox) {
1600 bool is_empty = m_config->option<ConfigOptionStrings>("compatible_prints")->values.empty();
1601 m_compatible_prints.checkbox->SetValue(is_empty);
1602 is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
1603 }
1604
1605 m_page_view->GetParent()->Layout();
1606}
bool m_postpone_update_ui
Definition Tab.hpp:277
bool m_is_nonsys_values
Definition Tab.hpp:276

References Slic3r::ConfigOptionVector< T >::empty(), load_key_value(), m_active_page, m_compatible_printers, m_compatible_prints, m_config, m_is_nonsys_values, m_mode, m_options_list, m_page_view, m_pages, m_postpone_update_ui, m_presets, m_type, on_roll_back_value(), osInitValue, osSystemValue, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, update(), and update_dirty().

Referenced by create_preset_tab(), and on_roll_back_value().

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

◆ on_value_change()

void Slic3r::GUI::Tab::on_value_change ( const std::string & opt_key,
const boost::any & value )
virtual

!!! ysFIXME ????

Reimplemented in Slic3r::GUI::TabFilament, Slic3r::GUI::TabPrinter, Slic3r::GUI::TabPrintModel, and Slic3r::GUI::TabPrintPlate.

2072{
2073 // Orca:
2074 // TODO: Move filament-specific checks to TabFilament::on_value_change()
2075 // TODO: Move printer-specific checks to TabPrinter::on_value_change()
2076
2077 if (wxGetApp().plater() == nullptr) {
2078 return;
2079 }
2080
2081 // The bed-area point option cannot store collision-volume syntax. Offer to
2082 // copy it to the volume setting while retaining the area's previous value.
2083 if (opt_key == "bed_exclude_area" && m_type == Preset::TYPE_PRINTER) {
2084 const std::string *definition = boost::any_cast<std::string>(&value);
2085 if (definition != nullptr && is_bed_exclusion_volume_syntax(*definition)) {
2086 const double printable_height = m_config->opt_float("printable_height");
2088 show_error(wxGetApp().plater(), _L("Invalid collision volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |."));
2089 reload_config();
2090 return;
2091 }
2092
2093 MessageDialog dialog(
2094 wxGetApp().plater(),
2095 _L("This definition contains collision-volume syntax. Add it to the toolhead collision volumes for G-code checking and travel avoidance? The existing excluded bed area will be preserved."),
2096 _L("Add collision volumes"), wxICON_QUESTION | wxYES | wxNO);
2097 if (dialog.ShowModal() == wxID_YES) {
2098 DynamicPrintConfig converted = *m_config;
2099 append_bed_exclude_volumes(converted, *definition);
2100 load_config(converted);
2101 reload_config();
2103 wxGetApp().plater()->update();
2104 } else {
2105 reload_config();
2106 }
2107 return;
2108 }
2109 }
2110
2111 // Keep this preset's "plugins" manifest in sync when a plugin picker changes, so full_config() and
2112 // save_to_json() always find resolved "name;uuid;capability" references and rebuild it nowhere else.
2113 // Also drop any plugin config override entries for a capability the change just stopped
2114 // referencing (e.g. a plugin removed from slicing_pipeline_plugin), so a saved preset never
2115 // carries configuration for a capability it no longer names. The Configure button is a separate
2116 // field holding its own cached copy of that value, so it needs to be told explicitly, or it
2117 // keeps showing the stale count until something else happens to refresh it.
2118 if (const ConfigOptionDef* opt_def = m_config->def()->get(opt_key);
2119 opt_def && opt_def->is_plugin_backed()) {
2120 m_config->update_plugin_manifest();
2121 const std::string overrides_key = Preset::plugin_overrides_key(m_type);
2122 if (prune_stale_plugin_overrides(*m_config, overrides_key)) {
2123 if (Field* overrides_field = get_field(overrides_key))
2124 overrides_field->set_value(boost::any(m_config->opt_string(overrides_key)), false);
2125 }
2126 }
2127
2128 if (opt_key == "gcode_flavor" && m_type == Preset::TYPE_PRINTER) {
2129 if (auto printer_tab = dynamic_cast<TabPrinter*>(this))
2130 printer_tab->on_gcode_flavor_changed();
2131 }
2132
2133 if (opt_key == "bed_exclude_volume_mode" && m_type == Preset::TYPE_PRINTER &&
2134 m_config->opt_enum<BedExcludeVolumeMode>("bed_exclude_volume_mode") == BedExcludeVolumeMode::PerExtruder) {
2135 auto *per_extruder = m_config->option<ConfigOptionStrings>("extruder_bed_exclude_volumes");
2136 const auto *shared = m_config->option<ConfigOptionString>("bed_exclude_volumes");
2137 const size_t extruder_count = m_config->option<ConfigOptionFloats>("nozzle_diameter")->size();
2138 const bool definitions_empty = per_extruder == nullptr ||
2139 std::all_of(per_extruder->values.begin(), per_extruder->values.end(), [](const std::string &entry) { return entry.empty(); });
2140
2141 if (definitions_empty && shared != nullptr && extruder_count > 0) {
2142 const std::string serialized = shared->value;
2143 const bool valid_shared_definition =
2144 is_valid_bed_exclude_volumes_string(serialized, std::numeric_limits<double>::max());
2145 DynamicPrintConfig new_conf = *m_config;
2146 new_conf.set_key_value("extruder_bed_exclude_volumes",
2147 new ConfigOptionStrings(std::vector<std::string>(extruder_count, valid_shared_definition ? serialized : std::string{})));
2148 m_config_manipulation.apply(m_config, &new_conf);
2149 }
2150 }
2151
2152 if (opt_key == "compatible_prints")
2154 if (opt_key == "compatible_printers")
2156
2157 const bool is_fff = supports_printer_technology(ptFFF);
2158 ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff);
2159 //BBS: GUI refactor
2160 if (og_freq_chng_params) {
2161 if (opt_key == "sparse_infill_density" || opt_key == "pad_enable")
2162 {
2163 boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
2164 og_freq_chng_params->set_value(opt_key, val);
2165 }
2166
2167 if (opt_key == "pad_around_object") {
2168 for (PageShp& pg : m_pages) {
2169 Field* fld = pg->get_field(opt_key);
2170 if (fld) fld->set_value(value, false);
2171 }
2172 }
2173
2174 if (is_fff ?
2175 (opt_key == "enable_support" || opt_key == "support_type" || opt_key == "support_on_build_plate_only") :
2176 (opt_key == "supports_enable" || opt_key == "support_buildplate_only"))
2177 og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
2178
2179 if (!is_fff && (opt_key == "pad_enable" || opt_key == "pad_around_object"))
2180 og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
2181
2182 if (opt_key == "brim_width")
2183 {
2184 bool val = m_config->opt_float("brim_width") > 0.0 ? true : false;
2185 og_freq_chng_params->set_value("brim", val);
2186 }
2187 }
2188
2189 if (opt_key == "single_extruder_multi_material" || opt_key == "extruders_count" )
2191
2192
2193 if (opt_key == "pellet_flow_coefficient")
2194 {
2195 double double_value = Preset::convert_pellet_flow_to_filament_diameter(boost::any_cast<double>(value));
2196 m_config->set_key_value("filament_diameter", new ConfigOptionFloats{double_value});
2197 }
2198
2199 if (opt_key == "filament_diameter") {
2200 double double_value = Preset::convert_filament_diameter_to_pellet_flow(boost::any_cast<double>(value));
2201 m_config->set_key_value("pellet_flow_coefficient", new ConfigOptionFloats{double_value});
2202 }
2203
2204
2205 if (opt_key == "single_extruder_multi_material" ){
2206 wxGetApp().sidebar().show_SEMM_buttons();
2207 wxGetApp().get_tab(Preset::TYPE_PRINT)->update();
2208 }
2209
2210 if(opt_key == "purge_in_prime_tower")
2211 wxGetApp().get_tab(Preset::TYPE_PRINT)->update();
2212
2213
2214 if (opt_key == "enable_prime_tower") {
2215 auto timelapse_type = m_config->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
2216 bool timelapse_enabled = timelapse_type->value == TimelapseType::tlSmooth;
2217 if (!boost::any_cast<bool>(value)) {
2218 // Disabling the prime tower on a multi-nozzle printer degrades quality because nozzle changes rely
2219 // on it. Gate on any extruder having extruder_max_nozzle_count > 1 so single-nozzle and dual-extruder
2220 // (H2D, {1,1}) printers keep their exact existing behavior.
2221 // Orca: gate on any_of(count > 1) rather than the sum of counts >= 2. The sum form would also fire for
2222 // H2D ({1,1} sums to 2); any_of(>1) preserves H2D's current no-dialog behavior.
2223 auto *max_nozzle_counts_opt = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionIntsNullable>("extruder_max_nozzle_count");
2224 const bool has_multiple_nozzle = max_nozzle_counts_opt &&
2225 std::any_of(max_nozzle_counts_opt->values.begin(), max_nozzle_counts_opt->values.end(),
2226 [](int v) { return v > 1 && v != ConfigOptionIntsNullable::nil_value(); });
2227 if (has_multiple_nozzle) {
2228 MessageDialog dlg(wxGetApp().plater(),
2229 _L("Prime tower is required for nozzle changing. There may be flaws on the model without prime tower. Are you sure you want to disable prime tower?"),
2230 _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2231 if (dlg.ShowModal() == wxID_NO) {
2232 DynamicPrintConfig new_conf = *m_config;
2233 new_conf.set_key_value("enable_prime_tower", new ConfigOptionBool(true));
2234 m_config_manipulation.apply(m_config, &new_conf);
2235 }
2236 }
2237 }
2238 bool enable_wrapping = m_config->option<ConfigOptionBool>("enable_wrapping_detection")->value;
2239 if (!boost::any_cast<bool>(value) && (timelapse_enabled || enable_wrapping)) {
2240 bool set_enable_prime_tower = false;
2241 if (timelapse_enabled) {
2242 MessageDialog dlg(wxGetApp().plater(), _L("A prime tower is required for smooth timelapse mode. There may be flaws on the model without a prime tower. Are you sure you want to disable the prime tower\?"),
2243 _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2244 if (dlg.ShowModal() == wxID_NO) {
2245 DynamicPrintConfig new_conf = *m_config;
2246 new_conf.set_key_value("enable_prime_tower", new ConfigOptionBool(true));
2247 m_config_manipulation.apply(m_config, &new_conf);
2248 set_enable_prime_tower = true;
2249 }
2250 }
2251 if (enable_wrapping && !set_enable_prime_tower) {
2252 MessageDialog dlg(wxGetApp().plater(),
2253 _L("A prime tower is required for clumping detection. There may be flaws on the model without prime tower. Are you sure you want to disable prime tower?"),
2254 _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2255 if (dlg.ShowModal() == wxID_NO) {
2256 DynamicPrintConfig new_conf = *m_config;
2257 new_conf.set_key_value("enable_prime_tower", new ConfigOptionBool(true));
2258 m_config_manipulation.apply(m_config, &new_conf);
2259 set_enable_prime_tower = true;
2260 }
2261 }
2262 wxGetApp().plater()->update();
2263 }
2264 bool is_precise_z_height = m_config->option<ConfigOptionBool>("precise_z_height")->value;
2265 if (boost::any_cast<bool>(value) && is_precise_z_height) {
2266 MessageDialog dlg(wxGetApp().plater(), _L("Enabling both precise Z height and the prime tower may cause slicing errors. Do you still want to enable?"),
2267 _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2268 if (dlg.ShowModal() == wxID_NO) {
2269 DynamicPrintConfig new_conf = *m_config;
2270 new_conf.set_key_value("enable_prime_tower", new ConfigOptionBool(false));
2271 m_config_manipulation.apply(m_config, &new_conf);
2272 }
2273 wxGetApp().plater()->update();
2274 }
2276 }
2277
2278
2279 if (opt_key == "single_extruder_multi_material" ){
2280 wxGetApp().sidebar().show_SEMM_buttons();
2281 wxGetApp().get_tab(Preset::TYPE_PRINT)->update();
2282 }
2283
2284 if(opt_key == "purge_in_prime_tower")
2285 wxGetApp().get_tab(Preset::TYPE_PRINT)->update();
2286
2287 if (opt_key == "enable_wrapping_detection") {
2288 bool wipe_tower_enabled = m_config->option<ConfigOptionBool>("enable_prime_tower")->value;
2289 if (boost::any_cast<bool>(value) && !wipe_tower_enabled) {
2290 MessageDialog dlg(wxGetApp().plater(),
2291 _L("A prime tower is required for clumping detection. There may be flaws on the model without prime tower. Do you still want to enable clumping detection?"),
2292 _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2293 if (dlg.ShowModal() == wxID_NO) {
2294 DynamicPrintConfig new_conf = *m_config;
2295 new_conf.set_key_value("enable_wrapping_detection", new ConfigOptionBool(false));
2296 m_config_manipulation.apply(m_config, &new_conf);
2297 wxGetApp().plater()->update();
2298 }
2299 } else {
2300 wxGetApp().plater()->update();
2301 }
2302 }
2303
2304 if (opt_key == "precise_z_height") {
2305 bool wipe_tower_enabled = m_config->option<ConfigOptionBool>("enable_prime_tower")->value;
2306 if (boost::any_cast<bool>(value) && wipe_tower_enabled) {
2307 MessageDialog dlg(wxGetApp().plater(), _L("Enabling both precise Z height and the prime tower may cause slicing errors. Do you still want to enable precise Z height?"),
2308 _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2309 if (dlg.ShowModal() == wxID_NO) {
2310 DynamicPrintConfig new_conf = *m_config;
2311 new_conf.set_key_value("precise_z_height", new ConfigOptionBool(false));
2312 m_config_manipulation.apply(m_config, &new_conf);
2313 }
2314 wxGetApp().plater()->update();
2315 }
2316 }
2317
2318 // reload scene to update timelapse wipe tower
2319 if (opt_key == "timelapse_type") {
2320 // Smooth timelapse parks the nozzle on the prime tower every layer, so it needs a tower on
2321 // every layer. That is exactly what "No sparse layers" removes, and with both on the tower is
2322 // planned full height and then dropped on emission. Drop "No sparse layers" and tell the user.
2323 if (boost::any_cast<int>(value) == (int) TimelapseType::tlSmooth && m_config->opt_bool("wipe_tower_no_sparse_layers")) {
2324 MessageDialog dlg(wxGetApp().plater(),
2325 _L("Smooth timelapse needs a prime tower on every layer, which is not compatible with \"No sparse layers\". "
2326 "\"No sparse layers\" has been turned off."),
2327 _L("Warning"), wxICON_WARNING | wxOK);
2328 dlg.ShowModal();
2329 DynamicPrintConfig new_conf = *m_config;
2330 new_conf.set_key_value("wipe_tower_no_sparse_layers", new ConfigOptionBool(false));
2331 m_config_manipulation.apply(m_config, &new_conf);
2332 }
2333
2334 bool wipe_tower_enabled = m_config->option<ConfigOptionBool>("enable_prime_tower")->value;
2335 if (!wipe_tower_enabled && boost::any_cast<int>(value) == (int)TimelapseType::tlSmooth) {
2336 MessageDialog dlg(wxGetApp().plater(), _L("A prime tower is required for smooth timelapse mode. There may be flaws on the model without prime tower. Do you want to enable the prime tower\?"),
2337 _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2338 if (dlg.ShowModal() == wxID_YES) {
2339 DynamicPrintConfig new_conf = *m_config;
2340 new_conf.set_key_value("enable_prime_tower", new ConfigOptionBool(true));
2341 m_config_manipulation.apply(m_config, &new_conf);
2342 wxGetApp().plater()->update();
2343 }
2344 } else {
2345 wxGetApp().plater()->update();
2346 }
2347 }
2348
2349 // Mirror of the timelapse_type branch above: enabling "No sparse layers" while smooth timelapse
2350 // is active would leave the tower on every layer anyway, so fall back to traditional timelapse.
2351 if (opt_key == "wipe_tower_no_sparse_layers" && boost::any_cast<bool>(value)) {
2352 auto timelapse_type = m_config->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
2353 if (timelapse_type && timelapse_type->value == TimelapseType::tlSmooth) {
2354 MessageDialog dlg(wxGetApp().plater(),
2355 _L("\"No sparse layers\" is not compatible with smooth timelapse, which needs a prime tower on every layer. "
2356 "Timelapse has been switched to traditional mode."),
2357 _L("Warning"), wxICON_WARNING | wxOK);
2358 dlg.ShowModal();
2359 DynamicPrintConfig new_conf = *m_config;
2360 new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(TimelapseType::tlTraditional));
2361 m_config_manipulation.apply(m_config, &new_conf);
2362 wxGetApp().plater()->update();
2363 }
2364 }
2365
2366 if (opt_key == "print_sequence" && m_config->opt_enum<PrintSequence>("print_sequence") == PrintSequence::ByObject) {
2367 auto printer_structure_opt = m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure");
2368 if (printer_structure_opt && printer_structure_opt->value == PrinterStructure::psI3) {
2369 wxString msg_text = _(L("The current printer does not support timelapse in Traditional Mode when printing By-Object."));
2370 msg_text += "\n\n" + _(L("Still print by object?"));
2371
2372 MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO);
2373 auto answer = dialog.ShowModal();
2374 if (answer == wxID_NO) {
2375 DynamicPrintConfig new_conf = *m_config;
2376 new_conf.set_key_value("print_sequence", new ConfigOptionEnum<PrintSequence>(PrintSequence::ByLayer));
2377 m_config_manipulation.apply(m_config, &new_conf);
2378 wxGetApp().plater()->update();
2379 }
2380 }
2381 }
2382
2383 // BBS set support style to default when support type changes
2384 // Orca: do this only in simple mode
2385 if (opt_key == "support_type" && m_mode == comSimple) {
2386 DynamicPrintConfig new_conf = *m_config;
2387 new_conf.set_key_value("support_style", new ConfigOptionEnum<SupportMaterialStyle>(smsDefault));
2388 m_config_manipulation.apply(m_config, &new_conf);
2389 }
2390
2391 if (opt_key == "support_filament") {
2392 int filament_id = m_config->opt_int("support_filament") - 1; // the displayed id is based from 1, while internal id is based from 0
2393 int interface_filament_id = m_config->opt_int("support_interface_filament") - 1;
2394 if (is_support_filament(filament_id, false) && !is_soluble_filament(filament_id) && !has_filaments({"TPU", "TPU-AMS"})) {
2395 wxString msg_text = _L("Non-soluble support materials are not recommended for support base.\n"
2396 "Are you sure to use them for support base?\n");
2397 MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO);
2398 DynamicPrintConfig new_conf = *m_config;
2399 if (dialog.ShowModal() == wxID_NO) {
2400 new_conf.set_key_value("support_filament", new ConfigOptionInt(0));
2401 m_config_manipulation.apply(m_config, &new_conf);
2402 on_value_change(opt_key, 0);
2403 }
2404 wxGetApp().plater()->update();
2405 }
2406 }
2407
2408 // BBS popup a message to ask the user to set optimum parameters for support interface if support materials are used
2409 if (opt_key == "support_interface_filament") {
2410 int filament_id = m_config->opt_int("support_filament") - 1;
2411 int interface_filament_id = m_config->opt_int("support_interface_filament") - 1; // the displayed id is based from 1, while internal id is based from 0
2412 if ((is_support_filament(interface_filament_id, false) &&
2413 !(m_config->opt_float("support_top_z_distance") == 0 && m_config->opt_float("support_interface_spacing") == 0 &&
2415 (is_soluble_filament(interface_filament_id) && !is_soluble_filament(filament_id))) {
2416 wxString msg_text;
2417 if (!is_soluble_filament(interface_filament_id)) {
2418 msg_text = _L("When using support material for the support interface, we recommend the following settings:\n"
2419 "0 top Z distance, 0 interface spacing, interlaced rectilinear pattern and disable independent support layer height.");
2420 msg_text += "\n\n" + _L("Change these settings automatically\?\nYes - Change these settings automatically.\nNo - Do not change these settings for me.");
2421 } else {
2422 msg_text = _L("When using soluble material for the support interface, we recommend the following settings:\n"
2423 "0 top Z distance, 0 interface spacing, interlaced rectilinear pattern, disable independent support layer height\n"
2424 "and use soluble materials for both support interface and support base.");
2425 msg_text += "\n\n" + _L("Change these settings automatically\?\nYes - Change these settings automatically.\nNo - Do not change these settings for me.");
2426 }
2427 MessageDialog dialog(wxGetApp().plater(), msg_text, _L("Suggestion"), wxICON_WARNING | wxYES | wxNO);
2428 DynamicPrintConfig new_conf = *m_config;
2429 if (dialog.ShowModal() == wxID_YES) {
2430 auto &filament_presets = Slic3r::GUI::wxGetApp().preset_bundle->filament_presets;
2431 auto &filaments = Slic3r::GUI::wxGetApp().preset_bundle->filaments;
2432 Slic3r::Preset *filament = filaments.find_preset(filament_presets[interface_filament_id]);
2433 std::string filament_type = filament->config.option<ConfigOptionStrings>("filament_type")->values[0];
2434
2435 new_conf.set_key_value("support_top_z_distance", new ConfigOptionFloat(0));
2436 new_conf.set_key_value("support_interface_spacing", new ConfigOptionFloat(0));
2437 new_conf.set_key_value("support_interface_pattern", new ConfigOptionEnum<SupportMaterialInterfacePattern>(SupportMaterialInterfacePattern::smipRectilinearInterlaced));
2438 new_conf.set_key_value("independent_support_layer_height", new ConfigOptionBool(false));
2439 if ((filament_type == "PLA" && has_filaments({"TPU", "TPU-AMS"})) || (is_soluble_filament(interface_filament_id) && !is_soluble_filament(filament_id)))
2440 new_conf.set_key_value("support_filament", new ConfigOptionInt(interface_filament_id + 1));
2441 m_config_manipulation.apply(m_config, &new_conf);
2442 }
2443 wxGetApp().plater()->update();
2444 }
2445 }
2446
2447 if(opt_key == "make_overhang_printable"){
2448 if(m_config->opt_bool("make_overhang_printable")){
2449 wxString msg_text = _(
2450 L("Enabling this option will modify the model's shape. If your print requires precise dimensions or is part of an "
2451 "assembly, it's important to double-check whether this change in geometry impacts the functionality of your print."));
2452 msg_text += "\n\n" + _(L("Are you sure you want to enable this option?"));
2453 MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO);
2454 dialog.SetButtonLabel(wxID_YES, _L("Enable"));
2455 dialog.SetButtonLabel(wxID_NO, _L("Cancel"));
2456 if (dialog.ShowModal() == wxID_NO) {
2457 DynamicPrintConfig new_conf = *m_config;
2458 new_conf.set_key_value("make_overhang_printable", new ConfigOptionBool(false));
2459 m_config_manipulation.apply(m_config, &new_conf);
2460 wxGetApp().plater()->update();
2461 }
2462 }
2463 }
2464
2465 if (opt_key == "sparse_infill_rotate_template") {
2466 // Orca: show warning dialog if rotate template for solid infill if not support
2467 const auto _sparse_infill_pattern = m_config->option<ConfigOptionEnum<InfillPattern>>("sparse_infill_pattern")->value;
2468 bool is_safe_to_rotate = _sparse_infill_pattern == ipRectilinear || _sparse_infill_pattern == ipLine ||
2469 _sparse_infill_pattern == ipZigZag || _sparse_infill_pattern == ipCrossZag ||
2470 _sparse_infill_pattern == ipLockedZag;
2471
2472 auto new_value = boost::any_cast<std::string>(value);
2473 is_safe_to_rotate = is_safe_to_rotate || new_value.empty();
2474 const bool had_previous_value = !m_last_sparse_infill_rotate_template_value.empty();
2475
2476 if (!is_safe_to_rotate && !had_previous_value) {
2477 wxString msg_text = _(
2478 L("Infill patterns are typically designed to handle rotation automatically to ensure proper printing and achieve their "
2479 "intended effects (e.g., Gyroid, Cubic). Rotating the current sparse infill pattern may lead to insufficient support. "
2480 "Please proceed with caution and thoroughly check for any potential printing issues. "
2481 "Are you sure you want to enable this option?"));
2482 msg_text += "\n\n" + _(L("Are you sure you want to enable this option?"));
2483 MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO);
2484 dialog.SetButtonLabel(wxID_YES, _L("Enable"));
2485 dialog.SetButtonLabel(wxID_NO, _L("Cancel"));
2486 if (dialog.ShowModal() == wxID_NO) {
2487 DynamicPrintConfig new_conf = *m_config;
2488 new_conf.set_key_value("sparse_infill_rotate_template", new ConfigOptionString(""));
2489 m_config_manipulation.apply(m_config, &new_conf);
2490 wxGetApp().plater()->update();
2491 }
2492 }
2493
2494 m_last_sparse_infill_rotate_template_value = m_config->opt_string("sparse_infill_rotate_template");
2495 }
2496
2497 if (opt_key == "layer_height") {
2498 if (m_config_manipulation.check_layer_height(m_config))
2499 wxGetApp().plater()->update();
2500 }
2501
2502 std::string opt_key_without_idx = opt_key.substr(0, opt_key.find('#'));
2503
2504 if (opt_key_without_idx == "long_retractions_when_cut") {
2505 unsigned char activate = boost::any_cast<unsigned char>(value);
2506 if (activate == 1) {
2507 MessageDialog dialog(wxGetApp().plater(),
2508 _L("Experimental feature: Retracting and cutting off the filament at a greater distance during filament changes to minimize flush. "
2509 "Although it can notably reduce flush, it may also elevate the risk of nozzle clogs or other printing complications."), "", wxICON_WARNING | wxOK);
2510 dialog.ShowModal();
2511 }
2512 if (wxGetApp().app_config->get("auto_calculate_flush") == "all"){
2513 wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(-1);
2514 }
2515 }
2516
2517 if (opt_key == "filament_long_retractions_when_cut"){
2518 unsigned char activate = boost::any_cast<unsigned char>(value);
2519 if (activate == 1) {
2520 MessageDialog dialog(wxGetApp().plater(),
2521 _L("Experimental feature: Retracting and cutting off the filament at a greater distance during filament changes to minimize flush. "
2522 "Although it can notably reduce flush, it may also elevate the risk of nozzle clogs or other printing complications. "
2523 "Please use with the latest printer firmware."), "", wxICON_WARNING | wxOK);
2524 dialog.ShowModal();
2525 }
2526 if (wxGetApp().app_config->get("auto_calculate_flush") == "all"){
2527 wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(-1);
2528 }
2529 }
2530
2531
2532 //Orca: sync filament num if it's a multi tool printer
2533 if (opt_key == "extruders_count" && !m_config->opt_bool("single_extruder_multi_material")){
2534 const size_t num_extruder = boost::any_cast<size_t>(value);
2535 auto *bundle = wxGetApp().preset_bundle;
2536 Sidebar &sidebar = wxGetApp().plater()->sidebar();
2537 // A tool changer feeds filament N from nozzle N, so the extruder count sizes the physical
2538 // run only; mixed slots are virtual and keep the tail. Go one slot at a time through the
2539 // sidebar's own +/- calls: they insert ahead of the mixed tail and renumber filament ids,
2540 // painted facets, custom g-code and mixed components, which a bulk resize clamps away.
2541 // Both also refresh the print tab and export the selections, so nothing to do afterwards.
2542 size_t physical = bundle->num_physical_filaments();
2543 while (physical != num_extruder) {
2544 if (physical < num_extruder)
2545 sidebar.add_custom_filament(Plater::get_next_color_for_filament());
2546 else
2547 sidebar.delete_filament(physical - 1); // physical > num_extruder >= 1
2548 const size_t updated = bundle->num_physical_filaments();
2549 if (updated == physical)
2550 break; // the call declined, e.g. the total slot limit - do not spin
2551 physical = updated;
2552 }
2553 }
2554
2555 //Orca: disable purge_in_prime_tower if single_extruder_multi_material is disabled
2556 if (opt_key == "single_extruder_multi_material" && m_config->opt_bool("single_extruder_multi_material") == false){
2557 DynamicPrintConfig new_conf = *m_config;
2558 new_conf.set_key_value("purge_in_prime_tower", new ConfigOptionBool(false));
2559 m_config_manipulation.apply(m_config, &new_conf);
2560 }
2561
2562 if (opt_key.find("nozzle_volume_type") != std::string::npos) {
2563 int extruder_idx = std::atoi(opt_key.substr(opt_key.find_last_of('#') + 1).c_str());
2564 update_all_extruder_variants(extruder_idx);
2565 if (wxGetApp().app_config->get("auto_calculate_flush") == "all") {
2566 wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(-1,extruder_idx);
2567 }
2568 }
2569
2570 // Orca: allow different layer height for non-bbl printers
2571 // TODO: allow this for BBL printers too?
2572 if (m_preset_bundle->get_printer_extruder_count() > 1 && m_preset_bundle->is_bbl_vendor()) {
2573 int extruder_idx = std::atoi(opt_key.substr(opt_key.find_last_of('#') + 1).c_str());
2574 if (opt_key.find("min_layer_height") != std::string::npos) {
2575 auto min_layer_height_from_nozzle = m_preset_bundle->full_config().option<ConfigOptionFloats>("min_layer_height")->values;
2576 if (extruder_idx < min_layer_height_from_nozzle.size()) {
2577 double value = min_layer_height_from_nozzle[extruder_idx];
2578 std::fill(min_layer_height_from_nozzle.begin(), min_layer_height_from_nozzle.end(), value);
2579 }
2580 auto new_conf = *m_config;
2581 new_conf.set_key_value("min_layer_height", new ConfigOptionFloats(min_layer_height_from_nozzle));
2582 m_config_manipulation.apply(m_config, &new_conf);
2583 }
2584 else if (opt_key.find("max_layer_height") != std::string::npos) {
2585 auto max_layer_height_from_nozzle = m_preset_bundle->full_config().option<ConfigOptionFloats>("max_layer_height")->values;
2586 if (extruder_idx < max_layer_height_from_nozzle.size()) {
2587 double value = max_layer_height_from_nozzle[extruder_idx];
2588 std::fill(max_layer_height_from_nozzle.begin(), max_layer_height_from_nozzle.end(), value);
2589 }
2590 auto new_conf = *m_config;
2591 new_conf.set_key_value("max_layer_height", new ConfigOptionFloats(max_layer_height_from_nozzle));
2592 m_config_manipulation.apply(m_config, &new_conf);
2593 }
2594 }
2595
2596 if (opt_key == "parallel_printheads_count" || opt_key == "parallel_printheads_bed_exclude_areas") {
2597 if (m_config->opt_bool("support_parallel_printheads")) {
2598 const int count = opt_key == "parallel_printheads_count" ? boost::any_cast<int>(value) : m_config->opt_int("parallel_printheads_count");
2599 if (auto *field = this->get_field("bed_exclude_area")) {
2600 wxString exclude_area;
2601 if (count > 0) {
2602 if (const auto *areas = m_config->option<ConfigOptionStrings>("parallel_printheads_bed_exclude_areas");
2603 areas != nullptr) {
2604 const size_t index = static_cast<size_t>(count - 1);
2605 if (index < areas->values.size())
2606 exclude_area = wxString::FromUTF8(areas->values[index]);
2607 }
2608 }
2609
2610 field->set_value(exclude_area, true);
2611 field->propagate_value();
2612 }
2613 }
2614 }
2615
2617 // It means that not all values are rolled to the system/last saved values jet.
2618 // And call of the update() can causes a redundant check of the config values,
2619 return;
2620 }
2621
2622 update();
2623 if(m_active_page)
2624 m_active_page->update_visibility(m_mode, true);
2625 m_page_view->GetParent()->Layout();
2626
2627 // ORCA also update states of plates for plates toolbar. same method exist on Plater::priv::on_select_preset()
2628 auto& plate_list = wxGetApp().plater()->get_partplate_list();
2629 for (auto plate : plate_list.get_plate_list())
2630 plate->update_slice_result_valid_state(false);
2631}
ConfigOption * option(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2768
static wxColour get_next_color_for_filament()
Definition Plater.cpp:8511
void update_wiping_button_visibility()
Definition Tab.cpp:2645
void compatible_widget_reload(PresetDependencies &deps)
Definition Tab.cpp:9350
std::string m_last_sparse_infill_rotate_template_value
Definition Tab.hpp:563
virtual bool supports_printer_technology(const PrinterTechnology tech) const =0
static double convert_filament_diameter_to_pellet_flow(double filament_diameter)
Definition Preset.hpp:441
static const char * plugin_overrides_key(Type type)
Definition Preset.cpp:1726
DynamicPrintConfig config
Definition Preset.hpp:300
static double convert_pellet_flow_to_filament_diameter(double pellet_flow_coefficient)
Definition Preset.hpp:436
bool is_soluble_filament(int extruder_id)
Definition GUI_App.cpp:10456
static wxString support_combo_value_for_config(const DynamicPrintConfig &config, bool is_fff)
Definition Tab.cpp:2032
void show_error(wxWindow *parent, const wxString &message, bool has_code_excerpts)
Definition GUI.cpp:296
static void update_all_extruder_variants(int extruder_idx=-1)
Definition Tab.cpp:2061
bool has_filaments(const std::vector< std::string > &model_filaments)
Definition GUI_App.cpp:10472
static wxString pad_combo_value_for_config(const DynamicPrintConfig &config)
Definition Tab.cpp:2055
bool is_support_filament(int extruder_id, bool strict_check)
Definition GUI_App.cpp:10492
bool prune_stale_plugin_overrides(DynamicConfig &config, const std::string &overrides_key)
Definition PluginConfig.cpp:358
zaa_minimize_perimeter_height ConfigOptionFloat
Definition PrintConfig.hpp:1954
@ comSimple
Definition Config.hpp:222
@ ipZigZag
Definition PrintConfig.hpp:128
@ ipCrossZag
Definition PrintConfig.hpp:128
@ ipLine
Definition PrintConfig.hpp:129
@ ipRectilinear
Definition PrintConfig.hpp:128
@ ipLockedZag
Definition PrintConfig.hpp:128
SupportMaterialInterfacePattern
Definition PrintConfig.hpp:373
@ smipRectilinearInterlaced
Definition PrintConfig.hpp:374
coordf_t max_layer_height_from_nozzle(const PrintConfig &print_config, int idx_nozzle)
Definition Slicing.cpp:46
bool is_bed_exclusion_volume_syntax(const std::string &value)
Definition PrintConfig.cpp:14293
ConfigOptionIntsTempl< true > ConfigOptionIntsNullable
Definition Config.hpp:1155
zaa_minimize_perimeter_height filament_type((ConfigOptionBools, filament_soluble))((ConfigOptionStrings
coordf_t min_layer_height_from_nozzle(const PrintConfig &print_config, int idx_nozzle)
Definition Slicing.cpp:38
@ tlSmooth
Definition PrintConfig.hpp:470
@ tlTraditional
Definition PrintConfig.hpp:469
PrintSequence
Definition PrintConfig.hpp:310
@ ByObject
Definition PrintConfig.hpp:312
@ ByLayer
Definition PrintConfig.hpp:311
zaa_minimize_perimeter_height printable_height((ConfigOptionFloatsNullable, extruder_printable_height))((ConfigOptionPoint
zaa_minimize_perimeter_height ConfigOptionString
Definition PrintConfig.hpp:1702
void append_bed_exclude_volumes(DynamicPrintConfig &config, const std::string &definition)
Definition PrintConfig.cpp:14319
@ psI3
Definition PrintConfig.hpp:560
@ smsDefault
Definition PrintConfig.hpp:363
bool is_valid_bed_exclude_volumes_string(const std::string &value, const double printable_height)
Definition PrintConfig.cpp:14298
BedExcludeVolumeMode
Definition PrintConfig.hpp:642
@ PerExtruder
Definition PrintConfig.hpp:645

References _, _L, Slic3r::GUI::Sidebar::add_custom_filament(), Slic3r::append_bed_exclude_volumes(), Slic3r::ByLayer, Slic3r::ByObject, compatible_widget_reload(), Slic3r::comSimple, Slic3r::Preset::config, Slic3r::ConfigOptionFloat, Slic3r::ConfigOptionString, Slic3r::Preset::convert_filament_diameter_to_pellet_flow(), Slic3r::Preset::convert_pellet_flow_to_filament_diameter(), count, Slic3r::GUI::Sidebar::delete_filament(), Slic3r::filament_type(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), get_field(), Slic3r::GUI::Plater::get_next_color_for_filament(), Slic3r::GUI::has_filaments(), Slic3r::ipCrossZag, Slic3r::ipLine, Slic3r::ipLockedZag, Slic3r::ipRectilinear, Slic3r::ipZigZag, Slic3r::is_bed_exclusion_volume_syntax(), Slic3r::GUI::is_soluble_filament(), Slic3r::GUI::is_support_filament(), Slic3r::is_valid_bed_exclude_volumes_string(), L, Slic3r::load_config(), m_active_page, m_compatible_printers, m_compatible_prints, m_config, m_config_manipulation, m_last_sparse_infill_rotate_template_value, m_mode, m_page_view, m_pages, m_postpone_update_ui, m_preset_bundle, m_type, Slic3r::max_layer_height_from_nozzle(), Slic3r::min_layer_height_from_nozzle(), on_presets_changed(), on_value_change(), Slic3r::ConfigBase::option(), Slic3r::GUI::pad_combo_value_for_config(), Slic3r::PerExtruder, Slic3r::GUI::plater(), Slic3r::Preset::plugin_overrides_key(), Slic3r::printable_height(), Slic3r::prune_stale_plugin_overrides(), Slic3r::psI3, Slic3r::ptFFF, reload_config(), Slic3r::DynamicConfig::set_key_value(), Slic3r::GUI::Field::set_value(), Slic3r::GUI::OptionsGroup::set_value(), Slic3r::GUI::MsgDialog::SetButtonLabel(), Slic3r::GUI::show_error(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::smipRectilinearInterlaced, Slic3r::smsDefault, Slic3r::GUI::support_combo_value_for_config(), supports_printer_technology(), Slic3r::tlSmooth, Slic3r::tlTraditional, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, update(), Slic3r::GUI::update_all_extruder_variants(), update_wiping_button_visibility(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by get_config_manipulation(), on_value_change(), Slic3r::GUI::TabFilament::on_value_change(), Slic3r::GUI::TabPrinter::on_value_change(), Slic3r::GUI::TabPrintModel::on_value_change(), Slic3r::GUI::validate_custom_gcode_cb(), and Slic3r::GUI::validate_custom_gcode_cb().

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

◆ OnActivate()

void Slic3r::GUI::Tab::OnActivate ( )
virtual
844{
845 //BBS: GUI refactor
846 //noUpdates seems not working
847 //wxWindowUpdateLocker noUpdates(this);
848/*#ifdef __WXOSX__
849// wxWindowUpdateLocker noUpdates(this);
850 auto size = GetSizer()->GetSize();
851 m_tmp_panel->GetSizer()->SetMinSize(size.x + m_size_move, size.y);
852 Fit();
853 m_size_move *= -1;
854#endif // __WXOSX__*/
855
856#ifdef __WXMSW__
857 // Workaround for tooltips over Tree Controls displayed over excessively long
858 // tree control items, stealing the window focus.
859 //
860 // In case the Tab was reparented from the MainFrame to the floating dialog,
861 // the tooltip created by the Tree Control before reparenting is not reparented,
862 // but it still points to the MainFrame. If the tooltip pops up, the MainFrame
863 // is incorrectly focussed, stealing focus from the floating dialog.
864 //
865 // The workaround is to delete the tooltip control.
866 // Vojtech tried to reparent the tooltip control, but it did not work,
867 // and if the Tab was later reparented back to MainFrame, the tooltip was displayed
868 // at an incorrect position, therefore it is safer to just discard the tooltip control
869 // altogether.
870 HWND hwnd_tt = TreeView_GetToolTips(m_tabctrl->GetHandle());
871 if (hwnd_tt) {
872 HWND hwnd_toplevel = find_toplevel_parent(m_tabctrl)->GetHandle();
873 HWND hwnd_parent = ::GetParent(hwnd_tt);
874 if (hwnd_parent != hwnd_toplevel) {
875 ::DestroyWindow(hwnd_tt);
876 TreeView_SetToolTips(m_tabctrl->GetHandle(), nullptr);
877 }
878 }
879#endif
880
881 // The OnActivate() that shows the tab builds the page.
882 if (wxGetApp().mainframe != nullptr && !wxGetApp().mainframe->is_active_and_shown_tab(m_parent))
883 return;
884
885 // BBS: select on first active
886 if (!m_active_page)
888
889 //BBS: GUI refactor
890 m_page_view->Freeze();
891
892 // create controls on active page
894 //BBS: GUI refactor
895 //m_main_sizer->Layout();
896 m_parent->Layout();
897
898#ifdef _MSW_DARK_MODE
899 // Because of DarkMode we use our own Notebook (inherited from wxSiplebook) instead of wxNotebook
900 // And it looks like first Layout of the page doesn't update a size of the m_presets_choice
901 // So we have to set correct size explicitely
902 /* if (wxSize ok_sz = wxSize(35 * m_em_unit, m_presets_choice->GetBestSize().y);
903 ok_sz != m_presets_choice->GetSize()) {
904 m_presets_choice->SetMinSize(ok_sz);
905 m_presets_choice->SetSize(ok_sz);
906 GetSizer()->GetItem(size_t(0))->GetSizer()->Layout();
907 if (wxGetApp().tabs_as_menu())
908 m_presets_choice->update();
909 }*/
910#endif // _MSW_DARK_MODE
911 Refresh();
912
913 //BBS: GUI refactor
914 m_page_view->Thaw();
915}
virtual void activate_selected_page(std::function< void()> throw_if_canceled)
Definition Tab.cpp:7878
wxTopLevelWindow * find_toplevel_parent(wxWindow *window)
Definition GUI_Utils.cpp:155

References activate_selected_page(), Slic3r::GUI::find_toplevel_parent(), m_active_page, m_page_view, m_parent, m_tabctrl, and restore_last_select_item().

Referenced by Slic3r::GUI::ParamsPanel::OnActivate(), Slic3r::GUI::MainFrame::select_tab(), Slic3r::GUI::PlaterPresetComboBox::switch_to_tab(), and tree_sel_change_delayed().

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

◆ OnKeyDown()

void Slic3r::GUI::Tab::OnKeyDown ( wxKeyEvent & event)
8077{
8078 if (event.GetKeyCode() == WXK_TAB)
8079 m_tabctrl->Navigate(event.ShiftDown() ? wxNavigationKeyEvent::IsBackward : wxNavigationKeyEvent::IsForward);
8080 else
8081 event.Skip();
8082}

References m_tabctrl, and OnKeyDown().

Referenced by create_preset_tab(), and OnKeyDown().

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

◆ OnTreeSelChange()

void Slic3r::GUI::Tab::OnTreeSelChange ( wxCommandEvent & event)

References name().

Here is the call graph for this function:

◆ options_list_storage_key()

std::string Slic3r::GUI::Tab::options_list_storage_key ( const std::string & opt_key) const
1161{
1162 if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "compatible_prints" ||
1163 opt_key == "compatible_printers" || opt_key == "thumbnails" || opt_key == "wrapping_exclude_area")
1164 return opt_key;
1165
1166 if (m_config == nullptr || !m_config->has(opt_key))
1167 return opt_key;
1168
1169 const ConfigOption* option = m_config->option(opt_key);
1170 if (option == nullptr || !option->is_vector())
1171 return opt_key;
1172
1173 const ConfigOptionDef* def = m_config->def()->get(opt_key);
1174 if (def == nullptr)
1175 return opt_key;
1176
1177 const bool serialized = def->gui_flags == "serialized";
1178 const bool is_plugin_field = def->gui_type == ConfigOptionDef::GUIType::plugin_picker;
1179 return (serialized || is_plugin_field) ? opt_key : opt_key + "#0";
1180}
@ plugin_picker
Definition Config.hpp:2334

References Slic3r::ConfigOptionDef::gui_flags, Slic3r::ConfigOptionDef::gui_type, Slic3r::ConfigOption::is_vector(), m_config, and Slic3r::ConfigOptionDef::plugin_picker.

Referenced by init_options_list().

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

◆ page_build_pending()

bool Slic3r::GUI::Tab::page_build_pending ( ) const
7857{
7858 return m_active_page != nullptr && (m_active_page->build_pending() || m_active_page->visibility_pending());
7859}

References m_active_page, and page_build_pending().

Referenced by Slic3r::GUI::ParamsPanel::SettingsPagePrebuild::built(), page_build_pending(), and page_build_step().

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

◆ page_build_step()

bool Slic3r::GUI::Tab::page_build_step ( )
7862{
7863 if (m_active_page == nullptr)
7864 return false;
7865 if (m_active_page->build_pending())
7866 m_active_page->build_step(m_mode);
7867 else
7868 m_active_page->update_visibility(m_mode, true);
7869 return page_build_pending();
7870}
bool page_build_pending() const
Definition Tab.cpp:7856

References m_active_page, m_mode, page_build_pending(), and page_build_step().

Referenced by Slic3r::GUI::ParamsPanel::SettingsPagePrebuild::build_step(), and page_build_step().

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

◆ parent()

◆ parse_extruder_selection()

void Slic3r::GUI::Tab::parse_extruder_selection ( int selection,
int & extruder_id,
NozzleVolumeType & nozzle_type )
683{
684 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
685 int extruder_nums = m_preset_bundle->get_printer_extruder_count();
686
687 int current_index = 0;
688
689 for (int i = 0; i < extruder_nums; ++i) {
690 NozzleVolumeType volume_type = NozzleVolumeType(nozzle_volumes->values[i]);
691
692 if (volume_type == NozzleVolumeType::nvtHybrid) {
693 if (selection == current_index) {
694 extruder_id = i;
696 return;
697 } else if (selection == current_index + 1) {
698 extruder_id = i;
700 return;
701 }
702 current_index += 2;
703 } else {
704 if (selection == current_index) {
705 extruder_id = i;
706 nozzle_type = volume_type;
707 return;
708 }
709 current_index += 1;
710 }
711 }
712
713 extruder_id = 0;
715}

References m_preset_bundle, Slic3r::nozzle_type(), Slic3r::nvtHighFlow, Slic3r::nvtHybrid, and Slic3r::nvtStandard.

Referenced by check_extruder_options_status(), create_preset_tab(), and get_current_active_extruder().

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

◆ reactive_preset_combo_box()

void Slic3r::GUI::Tab::reactive_preset_combo_box ( )
7125{
7126 if (!m_presets_choice) return;
7127 //BBS: add workaround to fix the issue caused by wxwidget 3.15 upgrading
7128 m_presets_choice->Enable(false);
7129 m_presets_choice->Enable(true);
7130}

References m_presets_choice, and reactive_preset_combo_box().

Referenced by reactive_preset_combo_box().

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

◆ rebuild_page_tree()

void Slic3r::GUI::Tab::rebuild_page_tree ( )
7302{
7303 // get label of the currently selected item
7304 auto sel_item = m_tabctrl->GetSelection();
7305 // BBS: fix new layout, record last select
7306 if (sel_item < 0)
7307 sel_item = m_last_select_item;
7308 const auto selected = sel_item >= 0 ? m_tabctrl->GetItemText(sel_item) : "";
7309
7310 int item = -1;
7311
7312 // Delete/Append events invoke wxEVT_TAB_SEL_CHANGED event.
7313 // To avoid redundant clear/activate functions call
7314 // suppress activate page before page_tree rebuilding
7316
7317 int curr_item = 0;
7318 for (auto p : m_pages)
7319 {
7320 if (!p->get_show())
7321 continue;
7322 if (m_tabctrl->GetCount() <= curr_item) {
7323 m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
7324 } else {
7325 m_tabctrl->SetItemText(curr_item, translate_category(p->title(), m_type));
7326 }
7327 m_tabctrl->SetItemTextColour(curr_item, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
7328 std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
7329 std::make_pair(p->get_item_colour(), (int) StateColor::Normal)));
7330 if (translate_category(p->title(), m_type) == selected)
7331 item = curr_item;
7332 curr_item++;
7333 }
7334 while (m_tabctrl->GetCount() > curr_item) {
7335 m_tabctrl->DeleteItem(m_tabctrl->GetCount() - 1);
7336 }
7337
7338 // BBS: on mac, root is selected, this fix it
7339 m_tabctrl->Unselect();
7340 // BBS: not select on hide tab
7341 if (item == -1 && m_parent->is_active_and_shown_tab(this)) {
7342 // this is triggered on first load, so we don't disable the sel change event
7343 item = m_tabctrl->GetFirstVisibleItem();
7344 }
7345 // BBS: fix new layout, record last select
7346 if (sel_item == m_last_select_item)
7347 m_last_select_item = item;
7348 else
7350
7351 // allow activate page before selection of a page_tree item
7353 //BBS: GUI refactor
7354 if (item >= 0)
7355 {
7356 bool ret = update_current_page_in_background(item);
7357 //if m_active_page is changed in update_current_page_in_background
7358 //will just update the selected item of the treectrl
7359 if (m_parent->is_active_and_shown_tab(this)) // FIX: modify state not update
7360 m_tabctrl->SelectItem(item);
7361 }
7362}
bool update_current_page_in_background(int &item)
Definition Tab.cpp:7900
int m_last_select_item
Definition Tab.hpp:267
@ NotChecked
Definition StateColor.hpp:23

References m_disable_tree_sel_changed_event, m_last_select_item, m_modified_label_clr, m_pages, m_parent, m_tabctrl, m_type, StateColor::Normal, StateColor::NotChecked, rebuild_page_tree(), translate_category(), and update_current_page_in_background().

Referenced by Slic3r::GUI::TabPrinter::build_unregular_pages(), create_preset_tab(), rebuild_page_tree(), Slic3r::GUI::TabPrinter::update_pages(), and update_visibility().

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

◆ reload_config()

void Slic3r::GUI::Tab::reload_config ( )
virtual

◆ restore_last_select_item()

void Slic3r::GUI::Tab::restore_last_select_item ( )
7849{
7850 auto item = m_last_select_item;
7851 if (item == -1)
7852 item = m_tabctrl->GetFirstVisibleItem();
7853 m_tabctrl->SelectItem(item);
7854}

References m_last_select_item, m_tabctrl, and restore_last_select_item().

Referenced by create_preset_tab(), Slic3r::GUI::Plater::priv::on_modify_filament(), OnActivate(), restore_last_select_item(), Slic3r::GUI::ParamsPanel::set_active_tab(), and Slic3r::GUI::PlaterPresetComboBox::switch_to_tab().

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

◆ save_preset()

void Slic3r::GUI::Tab::save_preset ( std::string name = std::string(),
bool detach = false,
bool save_to_project = false,
bool from_input = false,
std::string input_name = "" )

m_tabctrl->OnSetFocus();

8122{
8123 // ORCA: Validate before opening any save-name UI for filament presets.
8125 return;
8126
8127 // since buttons(and choices too) don't get focus on Mac, we set focus manually
8128 // to the treectrl so that the EVT_* events are fired for the input field having
8129 // focus currently.is there anything better than this ?
8131 if (from_input) {
8132 SavePresetDialog dlg(m_parent, m_type, m_mode, detach ? _u8L("Detached") : "");
8133 dlg.Show(false);
8134 dlg.input_name_from_other(input_name);
8135 wxCommandEvent evt(wxEVT_TEXT, GetId());
8136 dlg.GetEventHandler()->ProcessEvent(evt);
8137 dlg.confirm_from_other();
8138 name = input_name;
8139 detach = dlg.get_detach_value(m_type);
8140 }
8141
8142 if (name.empty()) {
8143 SavePresetDialog dlg(m_parent, m_type, m_mode, detach ? _u8L("Detached") : "");
8144 if (!m_just_edit) {
8145 if (dlg.ShowModal() != wxID_OK)
8146 return;
8147 }
8148 name = dlg.get_name();
8149 //BBS: add project embedded preset relate logic
8150 save_to_project = dlg.get_save_to_project_selection(m_type);
8151 detach = dlg.get_detach_value(m_type);
8152 }
8153
8154 //BBS record current preset name
8155 Preset& edited_preset = m_presets->get_edited_preset();
8156 std::string curr_preset_name = edited_preset.name;
8157
8158 bool exist_preset = false;
8159 Preset* new_preset = m_presets->find_preset(name, false);
8160 if (new_preset) {
8161 exist_preset = true;
8162 }
8163
8164 // Orca: check if compatible_printers exists and is not empty, set it to the current printer if it is empty
8165 // Ensures that custom filaments based on system are not accidentally allowed for all printers
8166 // Can still be set for all after creation
8167 if (m_presets->type() == Preset::TYPE_FILAMENT && !exist_preset && edited_preset.is_system) {
8168 Preset* _curr_printer = const_cast<Preset*>(&wxGetApp().preset_bundle->printers.get_selected_preset_base());
8169 ConfigOptionStrings* compatible_printers = m_config->option<ConfigOptionStrings>("compatible_printers");
8170 if (nullptr != _curr_printer && compatible_printers && compatible_printers->values.empty())
8171 compatible_printers->values.push_back(_curr_printer->name);
8172 }
8173 // Save the preset into Slic3r::data_dir / presets / section_name / preset_name.json
8174 m_presets->save_current_preset(name, detach, save_to_project, nullptr);
8175
8176 //BBS create new settings
8177 new_preset = m_presets->find_preset(name, false, true);
8178 //Preset* preset = &m_presets.preset(it - m_presets.begin(), true);
8179 if (!new_preset) {
8180 BOOST_LOG_TRIVIAL(info) << "create new preset failed";
8181 return;
8182 }
8183
8184 // set sync_info for sync service
8185 if (exist_preset) {
8186 new_preset->sync_info = "update";
8187 BOOST_LOG_TRIVIAL(info) << "sync_preset: update preset = " << new_preset->name;
8188 }
8189 else {
8190 new_preset->sync_info = "create";
8191 if (wxGetApp().is_user_login())
8192 new_preset->user_id = wxGetApp().getAgent()->get_user_id();
8193 BOOST_LOG_TRIVIAL(info) << "sync_preset: create preset = " << new_preset->name;
8194 }
8195 new_preset->save_info();
8196
8197 // Mark the print & filament enabled if they are compatible with the currently selected preset.
8198 // If saving the preset changes compatibility with other presets, keep the now incompatible dependent presets selected, however with a "red flag" icon showing that they are no more compatible.
8200 // Add the new item into the UI component, remove dirty flags and activate the saved item.
8201 update_tab_ui();
8202
8203 // Update the selection boxes at the plater.
8205
8206 //BBS if create a new prset name, preset changed from preset name to new preset name
8207 if (!exist_preset) {
8208 wxGetApp().plater()->sidebar().update_presets_from_to(m_type, curr_preset_name, new_preset->name);
8209 }
8210
8211 // If current profile is saved, "delete preset" button have to be enabled
8212 m_btn_delete_preset->Show();
8213 m_btn_delete_preset->GetParent()->Layout();
8214
8216 static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<TabPrinter*>(this)->m_extruders_count;
8217
8218 // Parent preset is "default" after detaching, so we should to update UI values, related on parent preset
8219 if (detach)
8220 update_ui_items_related_on_parent_preset(m_presets->get_selected_preset_parent());
8221
8223
8224 /* If filament preset is saved for multi-material printer preset,
8225 * there are cases when filament comboboxs are updated for old (non-modified) colors,
8226 * but in full_config a filament_colors option aren't.*/
8227 if (m_type == Preset::TYPE_FILAMENT && wxGetApp().extruders_edited_cnt() > 1)
8228 wxGetApp().plater()->force_filament_colors_update();
8229
8230 {
8231 // Profile compatiblity is updated first when the profile is saved.
8232 // Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
8233 std::vector<Preset::Type> dependent;
8234 switch (m_type) {
8235 case Preset::TYPE_PRINT:
8236 dependent = { Preset::TYPE_FILAMENT };
8237 break;
8239 dependent = { Preset::TYPE_SLA_MATERIAL };
8240 break;
8242 if (static_cast<const TabPrinter*>(this)->m_printer_technology == ptFFF)
8244 else
8246 break;
8247 default:
8248 break;
8249 }
8250 for (Preset::Type preset_type : dependent)
8251 wxGetApp().get_tab(preset_type)->update_tab_ui();
8252 }
8253
8254 // show() reloads the presets, so only a visible Compare dialog needs updating.
8255 DiffPresetDialog* diff_dialog = DiffPresetDialog::if_built();
8256 if (diff_dialog != nullptr && diff_dialog->IsShown())
8257 diff_dialog->update_presets(m_type);
8258}
static DiffPresetDialog * if_built()
Definition Lazy.hpp:183
bool m_just_edit
Definition Tab.hpp:208
bool validate_filament_temperature_pairs()
Definition Tab.cpp:8722
Type
Definition Preset.hpp:244

References _u8L, Slic3r::GUI::SavePresetDialog::confirm_from_other(), Slic3r::GUI::SavePresetDialog::get_detach_value(), Slic3r::GUI::SavePresetDialog::get_name(), Slic3r::GUI::SavePresetDialog::get_save_to_project_selection(), Slic3r::GUI::LazyInstance< DiffPresetDialog >::if_built(), Slic3r::GUI::SavePresetDialog::input_name_from_other(), Slic3r::Preset::is_system, m_btn_delete_preset, m_config, Slic3r::GUI::TabPrinter::m_extruders_count, m_just_edit, m_mode, m_parent, m_preset_bundle, m_presets, m_type, name(), Slic3r::Preset::name, Slic3r::Never, on_presets_changed(), Slic3r::ptFFF, Slic3r::Preset::save_info(), save_preset(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::Preset::sync_info, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, Slic3r::Preset::TYPE_SLA_PRINT, update_changed_ui(), Slic3r::GUI::DiffPresetDialog::update_presets(), update_tab_ui(), update_ui_items_related_on_parent_preset(), Slic3r::Preset::user_id, validate_filament_temperature_pairs(), and Slic3r::ConfigOptionVector< T >::values.

Referenced by build_preset_description_line(), create_preset_tab(), may_discard_current_dirty_preset(), and save_preset().

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

◆ saved_preset_is_dirty()

bool Slic3r::GUI::Tab::saved_preset_is_dirty ( ) const
5387{ return m_presets->saved_is_dirty(); }

References m_presets, and saved_preset_is_dirty().

Referenced by saved_preset_is_dirty().

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

◆ select_preset()

bool Slic3r::GUI::Tab::select_preset ( std::string preset_name = "",
bool delete_current = false,
const std::string & last_selected_ph_printer_name = "",
bool force_select = false,
bool force_no_transfer = false )
7389{
7390 BOOST_LOG_TRIVIAL(info) << boost::format("select preset, name %1%, delete_current %2%")
7391 %preset_name %delete_current;
7392 if (preset_name.empty()) {
7393 if (delete_current) {
7394 // Find an alternate preset to be selected after the current preset is deleted.
7395 const std::deque<Preset> &presets = m_presets->get_presets();
7396 size_t idx_current = m_presets->get_idx_selected();
7397 // Find the next visible preset.
7398 preset_name = presets[idx_current].inherits();
7399 if (preset_name.empty()) {
7400 size_t idx_new = idx_current + 1;
7401 if (idx_new < presets.size())
7402 for (; idx_new < presets.size() && ! presets[idx_new].is_visible; ++ idx_new) ;
7403 if (idx_new == presets.size())
7404 for (idx_new = idx_current - 1; idx_new > 0 && ! presets[idx_new].is_visible; -- idx_new);
7405 preset_name = presets[idx_new].name;
7406 BOOST_LOG_TRIVIAL(info) << boost::format("cause by delete current ,choose the next visible, idx %1%, name %2%")
7407 %idx_new %preset_name;
7408 } else {
7409 BOOST_LOG_TRIVIAL(info) << boost::format("cause by delete current ,choose base, name %1%") % preset_name;
7410 }
7411 } else {
7412 //BBS select first visible item first
7413 const std::deque<Preset> &presets = this->m_presets->get_presets();
7414 size_t idx_new = 0;
7415 if (idx_new < presets.size())
7416 for (; idx_new < presets.size() && ! presets[idx_new].is_visible; ++ idx_new) ;
7417 preset_name = presets[idx_new].name;
7418 if (idx_new == presets.size()) {
7419 // If no name is provided, select the "-- default --" preset.
7420 preset_name = m_presets->default_preset().name;
7421 }
7422 BOOST_LOG_TRIVIAL(info) << boost::format("not cause by delete current ,choose the first visible, idx %1%, name %2%")
7423 %idx_new %preset_name;
7424 }
7425 }
7426 //BBS: add project embedded preset logic and refine is_external
7427 assert(! delete_current || (m_presets->get_edited_preset().name != preset_name && (m_presets->get_edited_preset().is_user() || m_presets->get_edited_preset().is_project_embedded)));
7428 //assert(! delete_current || (m_presets->get_edited_preset().name != preset_name && m_presets->get_edited_preset().is_user()));
7429 bool current_dirty = ! delete_current && m_presets->current_is_dirty();
7430 bool print_tab = m_presets->type() == Preset::TYPE_PRINT || m_presets->type() == Preset::TYPE_SLA_PRINT;
7431 bool printer_tab = m_presets->type() == Preset::TYPE_PRINTER;
7432 bool canceled = false;
7433 bool no_transfer = false;
7434 bool technology_changed = false;
7435 m_dependent_tabs.clear();
7436 if ((m_presets->type() == Preset::TYPE_FILAMENT) && !preset_name.empty())
7437 {
7438 Preset *to_be_selected = m_presets->find_preset(preset_name, false, true);
7439 if (to_be_selected) {
7440 std::string current_type, to_select_type;
7441 ConfigOptionStrings* cur_opt = dynamic_cast <ConfigOptionStrings *>(m_presets->get_edited_preset().config.option("filament_type"));
7442 ConfigOptionStrings* to_select_opt = dynamic_cast <ConfigOptionStrings *>(to_be_selected->config.option("filament_type"));
7443 if (cur_opt && (cur_opt->values.size() > 0)) {
7444 current_type = cur_opt->values[0];
7445 }
7446 if (to_select_opt && (to_select_opt->values.size() > 0)) {
7447 to_select_type = to_select_opt->values[0];
7448 }
7449 if (current_type != to_select_type)
7450 no_transfer = true;
7451 }
7452 }
7453 else if (printer_tab)
7454 no_transfer = true;
7455
7456 if (force_no_transfer) {
7457 no_transfer = true;
7458 }
7459 if (current_dirty && ! may_discard_current_dirty_preset(nullptr, preset_name, no_transfer) && !force_select) {
7460 canceled = true;
7461 BOOST_LOG_TRIVIAL(info) << boost::format("current dirty and cancelled");
7462 } else if (print_tab) {
7463 // Before switching the print profile to a new one, verify, whether the currently active filament or SLA material
7464 // are compatible with the new print.
7465 // If it is not compatible and the current filament or SLA material are dirty, let user decide
7466 // whether to discard the changes or keep the current print selection.
7467 PresetWithVendorProfile printer_profile = m_preset_bundle->printers.get_edited_preset_with_vendor_profile();
7468 PrinterTechnology printer_technology = printer_profile.preset.printer_technology();
7469 PresetCollection &dependent = (printer_technology == ptFFF) ? m_preset_bundle->filaments : m_preset_bundle->sla_materials;
7470 bool old_preset_dirty = dependent.current_is_dirty();
7471 bool new_preset_compatible = is_compatible_with_print(dependent.get_edited_preset_with_vendor_profile(),
7472 m_presets->get_preset_with_vendor_profile(*m_presets->find_preset(preset_name, true)), printer_profile);
7473 if (! canceled)
7474 canceled = old_preset_dirty && ! may_discard_current_dirty_preset(&dependent, preset_name) && ! new_preset_compatible && !force_select;
7475 if (! canceled) {
7476 // The preset will be switched to a different, compatible preset, or the '-- default --'.
7478 if (old_preset_dirty && ! new_preset_compatible)
7479 dependent.discard_current_changes();
7480 }
7481 BOOST_LOG_TRIVIAL(info) << boost::format("select process, new_preset_compatible %1%, old_preset_dirty %2%, cancelled %3%")
7482 %new_preset_compatible %old_preset_dirty % canceled;
7483 } else if (printer_tab) {
7484 // Before switching the printer to a new one, verify, whether the currently active print and filament
7485 // are compatible with the new printer.
7486 // If they are not compatible and the current print or filament are dirty, let user decide
7487 // whether to discard the changes or keep the current printer selection.
7488 //
7489 // With the introduction of the SLA printer types, we need to support switching between
7490 // the FFF and SLA printers.
7491 const Preset &new_printer_preset = *m_presets->find_preset(preset_name, true);
7492 const PresetWithVendorProfile new_printer_preset_with_vendor_profile = m_presets->get_preset_with_vendor_profile(new_printer_preset);
7493 PrinterTechnology old_printer_technology = m_presets->get_edited_preset().printer_technology();
7494 PrinterTechnology new_printer_technology = new_printer_preset.printer_technology();
7495 if (new_printer_technology == ptSLA && old_printer_technology == ptFFF && !wxGetApp().may_switch_to_SLA_preset(_omitL("New printer preset selected")))
7496 canceled = true;
7497 else {
7498 struct PresetUpdate {
7499 Preset::Type tab_type;
7500 PresetCollection *presets;
7501 PrinterTechnology technology;
7502 bool old_preset_dirty;
7503 bool new_preset_compatible;
7504 };
7505 std::vector<PresetUpdate> updates = {
7507 //{ Preset::Type::TYPE_SLA_PRINT, &m_preset_bundle->sla_prints, ptSLA },
7509 //{ Preset::Type::TYPE_SLA_MATERIAL, &m_preset_bundle->sla_materials,ptSLA }
7510 };
7511 Preset *to_be_selected = m_presets->find_preset(preset_name, false, true);
7512 ConfigOptionStrings* cur_opt2 = dynamic_cast <ConfigOptionStrings *>(m_presets->get_edited_preset().config.option("printer_extruder_variant"));
7513 ConfigOptionStrings* to_select_opt2 = dynamic_cast <ConfigOptionStrings *>(to_be_selected->config.option("printer_extruder_variant"));
7514 bool no_transfer_variant = cur_opt2->values != to_select_opt2->values;
7515 for (PresetUpdate &pu : updates) {
7516 pu.old_preset_dirty = (old_printer_technology == pu.technology) && pu.presets->current_is_dirty();
7517 pu.new_preset_compatible = (new_printer_technology == pu.technology) && is_compatible_with_printer(pu.presets->get_edited_preset_with_vendor_profile(), new_printer_preset_with_vendor_profile);
7518 if (!canceled)
7519 canceled = pu.old_preset_dirty && !may_discard_current_dirty_preset(pu.presets, preset_name, false, no_transfer_variant) && !pu.new_preset_compatible && !force_select;
7520 }
7521 if (!canceled) {
7522 for (PresetUpdate &pu : updates) {
7523 // The preset will be switched to a different, compatible preset, or the '-- default --'.
7524 if (pu.technology == new_printer_technology)
7525 m_dependent_tabs.emplace_back(pu.tab_type);
7526 if (pu.old_preset_dirty && !pu.new_preset_compatible)
7527 pu.presets->discard_current_changes();
7528 }
7529 }
7530 }
7531 if (! canceled)
7532 technology_changed = old_printer_technology != new_printer_technology;
7533
7534 BOOST_LOG_TRIVIAL(info) << boost::format("select machine, technology_changed %1%, canceled %2%")
7535 %technology_changed % canceled;
7536 }
7537
7538 BOOST_LOG_TRIVIAL(info) << boost::format("before delete action, canceled %1%, delete_current %2%") %canceled %delete_current;
7539 bool delete_third_printer = false;
7540 std::deque<Preset> filament_presets;
7541 std::deque<Preset> process_presets;
7542 if (! canceled && delete_current) {
7543 // Delete the file and select some other reasonable preset.
7544 // It does not matter which preset will be made active as the preset will be re-selected from the preset_name variable.
7545 // The 'external' presets will only be removed from the preset list, their files will not be deleted.
7546 try {
7547 //BBS delete preset
7548 Preset &current_preset = m_presets->get_selected_preset();
7549
7550 // Obtain compatible filament and process presets for printers
7551 if (m_preset_bundle && m_presets->get_preset_base(current_preset) == &current_preset && printer_tab && !current_preset.is_system && !current_preset.is_from_bundle()) {
7552 delete_third_printer = true;
7553 for (const Preset &preset : m_preset_bundle->filaments.get_presets()) {
7554 if (preset.is_compatible && !preset.is_default) {
7555 if (preset.inherits() != "")
7556 filament_presets.push_front(preset);
7557 else
7558 filament_presets.push_back(preset);
7559 }
7560 }
7561 for (const Preset &preset : m_preset_bundle->prints.get_presets()) {
7562 if (preset.is_compatible && !preset.is_default) {
7563 if (preset.inherits() != "")
7564 process_presets.push_front(preset);
7565 else
7566 process_presets.push_back(preset);
7567 }
7568 }
7569 }
7570 if (!current_preset.setting_id.empty()) {
7571 wxGetApp().delete_preset_from_cloud(current_preset.setting_id, current_preset.file);
7572 }
7573 BOOST_LOG_TRIVIAL(info) << "delete preset = " << current_preset.name << ", setting_id = " << current_preset.setting_id;
7574 BOOST_LOG_TRIVIAL(info) << boost::format("will delete current preset...");
7575 m_presets->delete_current_preset();
7576 } catch (const std::exception & ex) {
7577 //FIXME add some error reporting!
7578 canceled = true;
7579 BOOST_LOG_TRIVIAL(info) << boost::format("found exception when delete: %1%") %ex.what();
7580 }
7581 }
7582
7583 if (canceled) {
7584 BOOST_LOG_TRIVIAL(info) << boost::format("canceled delete, update ui...");
7586 if (!last_selected_ph_printer_name.empty() &&
7587 m_presets->get_edited_preset().name == PhysicalPrinter::get_preset_name(last_selected_ph_printer_name)) {
7588 // If preset selection was canceled and previously was selected physical printer, we should select it back
7589 m_preset_bundle->physical_printers.select_printer(last_selected_ph_printer_name);
7590 }
7591 if (m_preset_bundle->physical_printers.has_selection()) {
7592 // If preset selection was canceled and physical printer was selected
7593 // we must disable selection marker for the physical printers
7594 m_preset_bundle->physical_printers.unselect_printer();
7595 }
7596 }
7597
7598 update_tab_ui();
7599
7600 // Trigger the on_presets_changed event so that we also restore the previous value in the plater selector,
7601 // if this action was initiated from the plater.
7603 } else {
7604 BOOST_LOG_TRIVIAL(info) << boost::format("successfully delete, will update compatibility");
7605 if (current_dirty)
7606 m_presets->discard_current_changes();
7607
7608 const bool is_selected = m_presets->select_preset_by_name(preset_name, false) || delete_current;
7609 assert(m_presets->get_edited_preset().name == preset_name || ! is_selected);
7610 // Mark the print & filament enabled if they are compatible with the currently selected preset.
7611 // The following method should not discard changes of current print or filament presets on change of a printer profile,
7612 // if they are compatible with the current printer.
7613 auto update_compatible_type = [delete_current](bool technology_changed, bool on_page, bool show_incompatible_presets) {
7614 return (delete_current || technology_changed) ? PresetSelectCompatibleType::Always :
7617 };
7618 if (current_dirty || delete_current || print_tab || printer_tab)
7619 m_preset_bundle->update_compatible(
7620 update_compatible_type(technology_changed, print_tab, (print_tab ? this : wxGetApp().get_tab(Preset::TYPE_PRINT))->m_show_incompatible_presets),
7621 update_compatible_type(technology_changed, false, wxGetApp().get_tab(Preset::TYPE_FILAMENT)->m_show_incompatible_presets));
7622 // Initialize the UI from the current preset.
7623 if (printer_tab)
7624 static_cast<TabPrinter*>(this)->update_pages();
7625
7626 if (! is_selected && printer_tab)
7627 {
7628 /* There is a case, when :
7629 * after Config Wizard applying we try to select previously selected preset, but
7630 * in a current configuration this one:
7631 * 1. doesn't exist now,
7632 * 2. have another printer_technology
7633 * So, it is necessary to update list of dependent tabs
7634 * to the corresponding printer_technology
7635 */
7636 const PrinterTechnology printer_technology = m_presets->get_edited_preset().printer_technology();
7641 }
7642
7643 // check if there is something in the cache to move to the new selected preset
7645
7646 // Orca: update presets for the selected printer
7647 if (m_type == Preset::TYPE_PRINTER && wxGetApp().app_config->get_bool("remember_printer_config")) {
7648 m_preset_bundle->update_selections(*wxGetApp().app_config);
7649 wxGetApp().plater()->sidebar().on_filament_count_change(m_preset_bundle->filament_presets.size());
7650 }
7652
7653 // Wait for the settings dialog to close; its edits are still provisional.
7654 if (printer_tab && is_selected) {
7655 Plater *plater = wxGetApp().plater();
7656 ParamsDialog *dialog = wxGetApp().params_dialog();
7657 if (plater && !plater->is_loading_project() &&
7658 (!dialog || !dialog->IsShown()))
7660 }
7661
7662 {
7663 Slic3r::LifecycleEventContext ctx;
7664 ctx.name = preset_name;
7666 switch (m_type) {
7667 case Preset::TYPE_PRINT: ctx.msg = "print"; break;
7668 case Preset::TYPE_SLA_PRINT: ctx.msg = "sla_print"; break;
7669 case Preset::TYPE_FILAMENT: ctx.msg = "filament"; break;
7670 case Preset::TYPE_SLA_MATERIAL: ctx.msg = "sla_material"; break;
7671 case Preset::TYPE_PRINTER: ctx.msg = "printer"; break;
7672 default: break;
7673 }
7675 }
7676
7677 if (delete_third_printer) {
7678 wxGetApp().CallAfter([filament_presets, process_presets]() {
7679 PresetBundle *preset_bundle = wxGetApp().preset_bundle;
7680 std::string old_filament_name = preset_bundle->filaments.get_edited_preset().name;
7681 std::string old_process_name = preset_bundle->prints.get_edited_preset().name;
7682
7683 for (const Preset &preset : filament_presets) {
7684 if (!preset.setting_id.empty()) {
7685 wxGetApp().delete_preset_from_cloud(preset.setting_id, preset.file);
7686 }
7687 BOOST_LOG_TRIVIAL(info) << "delete filament preset = " << preset.name << ", setting_id = " << preset.setting_id;
7688 preset_bundle->filaments.delete_preset(preset.name);
7689 }
7690
7691 for (const Preset &preset : process_presets) {
7692 if (!preset.setting_id.empty()) {
7693 wxGetApp().delete_preset_from_cloud(preset.setting_id, preset.file);
7694 }
7695 BOOST_LOG_TRIVIAL(info) << "delete print preset = " << preset.name << ", setting_id = " << preset.setting_id;
7696 preset_bundle->prints.delete_preset(preset.name);
7697 }
7698
7699 preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
7700 preset_bundle->filaments.select_preset_by_name(old_filament_name, true);
7701 preset_bundle->prints.select_preset_by_name(old_process_name, true);
7702 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " old filament name is:" << old_filament_name << " old process name is: " << old_process_name;
7703
7704 });
7705 }
7706
7707 }
7708
7709 if (technology_changed)
7710 wxGetApp().mainframe->technology_changed();
7711 BOOST_LOG_TRIVIAL(info) << boost::format("select preset, exit");
7712
7713 return !canceled;
7714}
void normalize_bed_types(bool printer_setting_changed)
Definition Plater.cpp:15672
bool is_loading_project() const
Definition Plater.hpp:1074
bool may_discard_current_dirty_preset(PresetCollection *presets=nullptr, const std::string &new_printer_name="", bool no_transfer=false, bool no_transfer_variant=false)
Definition Tab.cpp:7718
void load_current_preset()
Definition Tab.cpp:7133
void apply_config_from_cache()
Definition Tab.cpp:2745
static std::string get_preset_name(std::string full_name)
Definition Preset.cpp:4707
@ Plater
Definition Shortcuts.hpp:21
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config)
Definition Preset.cpp:909
std::string name
Definition LifecycleEvents.hpp:75
std::string msg
Definition LifecycleEvents.hpp:83
@ ptSLA
Definition Config.hpp:233
@ PresetSelected
Definition LifecycleEvents.hpp:47
@ Ok
Definition LifecycleEvents.hpp:68
bool is_compatible_with_print(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_print, const PresetWithVendorProfile &active_printer)
Definition Preset.cpp:871
LifecycleEvtCode code
Definition LifecycleEvents.hpp:79
void fire_lifecycle_event(LifecycleEvent event, const LifecycleEventContext &ctx)
Definition LifecycleEvents.hpp:234
@ OnlyIfWasCompatible
Definition Preset.hpp:525
@ Always
Definition Preset.hpp:527
#define _omitL(s)
Definition I18N.hpp:9

References _omitL, Slic3r::Always, apply_config_from_cache(), Slic3r::LifecycleEventContext::code, Slic3r::Preset::config, Slic3r::PresetCollection::current_is_dirty(), Slic3r::PresetCollection::delete_preset(), Slic3r::PresetCollection::discard_current_changes(), Slic3r::PresetBundle::filaments, Slic3r::Preset::file, Slic3r::fire_lifecycle_event(), Slic3r::PresetCollection::get_edited_preset(), Slic3r::PresetCollection::get_edited_preset_with_vendor_profile(), Slic3r::PhysicalPrinter::get_preset_name(), Slic3r::is_compatible_with_print(), Slic3r::is_compatible_with_printer(), Slic3r::Preset::is_from_bundle(), Slic3r::Preset::is_system, load_current_preset(), m_dependent_tabs, m_preset_bundle, m_presets, m_show_incompatible_presets, m_type, may_discard_current_dirty_preset(), Slic3r::LifecycleEventContext::msg, Slic3r::LifecycleEventContext::name, Slic3r::Preset::name, Slic3r::Never, Slic3r::Ok, on_presets_changed(), Slic3r::OnlyIfWasCompatible, Slic3r::ConfigBase::option(), Slic3r::GUI::plater(), Slic3r::PresetWithVendorProfile::preset, Slic3r::PresetSelected, Slic3r::GUI::printer_technology(), Slic3r::Preset::printer_technology(), Slic3r::PresetBundle::prints, Slic3r::ptFFF, Slic3r::ptSLA, select_preset(), Slic3r::PresetCollection::select_preset_by_name(), Slic3r::Preset::setting_id, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, Slic3r::Preset::TYPE_SLA_PRINT, Slic3r::PresetBundle::update_compatible(), update_tab_ui(), and Slic3r::ConfigOptionVector< T >::values.

Referenced by Slic3r::anonymous_namespace{PluginHostPresets.cpp}::bind_filament_target(), Slic3r::anonymous_namespace{PluginHostPresets.cpp}::bind_preset_target(), create_preset_tab(), delete_preset(), Slic3r::GUI::Plater::priv::on_modify_filament(), select_preset(), Slic3r::GUI::PresetComboBox::selection_is_changed_according_to_physical_printers(), Slic3r::GUI::Sidebar::priv::sync_extruder_list(), and transfer_options().

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

◆ set_custom_gcode()

void Slic3r::GUI::Tab::set_custom_gcode ( const t_config_option_key & opt_key,
const std::string & value )
virtual

Reimplemented in Slic3r::GUI::TabFilament.

4398{
4399 DynamicPrintConfig new_conf = *m_config;
4400 new_conf.set_key_value(opt_key, new ConfigOptionString(value));
4401 load_config(new_conf);
4402}

References Slic3r::ConfigOptionString, load_config(), m_config, and Slic3r::DynamicConfig::set_key_value().

Referenced by edit_custom_gcode().

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

◆ set_expanded()

void Slic3r::GUI::Tab::set_expanded ( bool value)
7833{
7834 if (value) {
7835 if (m_presets_choice)
7837 m_main_sizer->Show(m_tabctrl);
7838 }
7839 else {
7840 m_active_page = NULL;
7841 if (m_presets_choice)
7843 m_main_sizer->Hide(m_tabctrl);
7844 }
7845}

References m_active_page, m_main_sizer, m_presets_choice, m_tabctrl, and set_expanded().

Referenced by set_expanded().

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

◆ set_just_edit()

void Slic3r::GUI::Tab::set_just_edit ( bool just_edit)
8817{
8818 m_just_edit = just_edit;
8819 if (just_edit) {
8820 m_presets_choice->Disable();
8821 m_btn_delete_preset->Disable();
8822 } else {
8823 m_presets_choice->Enable();
8824 m_btn_delete_preset->Enable();
8825 }
8826}

References m_btn_delete_preset, m_just_edit, m_presets_choice, and set_just_edit().

Referenced by Slic3r::GUI::Plater::priv::on_modify_filament(), Slic3r::GUI::ParamsDialog::Popup(), and set_just_edit().

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

◆ set_option_label()

void Slic3r::GUI::Tab::set_option_label ( const std::string & opt_key,
const wxString & label,
int opt_index = -1 )
1982{
1983 // Same as toggle_line: a runtime rename (brim_width -> "Brim ear radius") must reach every page
1984 // so the Speed Dial titles the setting before the page has been shown.
1985 for (const PageShp& page : m_pages) {
1986 if (!page) continue;
1987 if (Line *line = page->get_line(opt_key, opt_index))
1988 line->set_label(label);
1989 }
1990}

References m_pages, and set_option_label().

Referenced by get_config_manipulation(), and set_option_label().

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

◆ set_tooltips_text()

void Slic3r::GUI::Tab::set_tooltips_text ( )
protected
9364{
9365 // --- Tooltip text for reset buttons (for whole options group)
9366 // Text to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
9367 //m_ttg_value_lock = _(L("LOCKED LOCK icon indicates that the settings are the same as the system (or default) values "
9368 // "for the current option group"));
9369 //m_ttg_value_unlock = _(L("UNLOCKED LOCK icon indicates that some settings were changed and are not equal "
9370 // "to the system (or default) values for the current option group.\n"
9371 // "Click to reset all settings for current option group to the system (or default) values."));
9372 //m_ttg_white_bullet_ns = _(L("WHITE BULLET icon indicates a non system (or non default) preset."));
9373 //m_ttg_non_system = &m_ttg_white_bullet_ns;
9374 // Text to be shown on the "Undo user changes" button next to each input field.
9375 //m_ttg_white_bullet = _(L("WHITE BULLET icon indicates that the settings are the same as in the last saved "
9376 // "preset for the current option group."));
9377 //m_ttg_value_revert = _(L("BACK ARROW icon indicates that the settings were changed and are not equal to "
9378 // "the last saved preset for the current option group.\n"
9379 // "Click to reset all settings for the current option group to the last saved preset."));
9380
9381 // --- Tooltip text for reset buttons (for each option in group)
9382 // Text to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
9383 //m_tt_value_lock = _(L("LOCKED LOCK icon indicates that the value is the same as the system (or default) value."));
9384 m_tt_value_unlock = _(L("Click to reset current value and attach to the global value."));
9385 // m_tt_white_bullet_ns= _(L("WHITE BULLET icon indicates a non system preset."));
9386 //m_tt_non_system = &m_ttg_white_bullet_ns;
9387 // Text to be shown on the "Undo user changes" button next to each input field.
9388 //m_tt_white_bullet = _(L("WHITE BULLET icon indicates that the value is the same as in the last saved preset."));
9389 m_tt_value_revert = _(L("Click to drop current modifications and reset to saved value."));
9390}

References _, L, m_tt_value_revert, m_tt_value_unlock, and set_tooltips_text().

Referenced by create_preset_tab(), and set_tooltips_text().

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

◆ set_type()

void Slic3r::GUI::Tab::set_type ( )
protected
249{
251 else if (m_name == "sla_print") { m_type = Slic3r::Preset::TYPE_SLA_PRINT; }
253 else if (m_name == "sla_material") { m_type = Slic3r::Preset::TYPE_SLA_MATERIAL; }
255 else { m_type = Slic3r::Preset::TYPE_INVALID; assert(false); }
256}
#define PRESET_PRINTER_NAME
Definition Preset.hpp:35
#define PRESET_PRINT_NAME
Definition Preset.hpp:34
#define PRESET_FILAMENT_NAME
Definition Preset.hpp:33
std::string m_name
Definition Tab.hpp:162
@ TYPE_INVALID
Definition Preset.hpp:245

References m_name, m_type, PRESET_FILAMENT_NAME, PRESET_PRINT_NAME, PRESET_PRINTER_NAME, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_INVALID, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, and Slic3r::Preset::TYPE_SLA_PRINT.

◆ setting_row_state()

Tab::SettingRowState Slic3r::GUI::Tab::setting_row_state ( const std::string & opt_id) const
1993{
1994 bool found = false;
1995 for (const PageShp& page : m_pages) {
1996 if (!page) continue;
1997 for (const ConfigOptionsGroupShp& group : page->m_optgroups) {
1998 if (!group) continue;
1999 for (const Line& line : group->get_lines()) {
2000 for (const Option& opt : line.get_options()) {
2001 if (opt.opt_id != opt_id)
2002 continue;
2003 if (line.toggle_visible) // shown on any owning page is enough
2004 return {true, line.label, line.label_en, line.get_options().size() > 1};
2005 found = true;
2006 }
2007 }
2008 }
2009 }
2010 // Never registered on a page -> visible, but with no row label to contribute.
2011 return {!found, wxString(), wxString(), false};
2012}

References m_pages, and setting_row_state().

Referenced by Slic3r::GUI::ActionRegistry::materialize_setting_actions(), and setting_row_state().

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

◆ show_timelapse_warning_dialog()

void Slic3r::GUI::Tab::show_timelapse_warning_dialog ( )
2633 {
2635 wxString msg_text = _(L("When recording timelapse without toolhead, it is recommended to add a \"Timelapse Wipe Tower\" \n"
2636 "by right-click the empty position of build plate and choose \"Add Primitive\"->\"Timelapse Wipe Tower\"."));
2637 msg_text += "\n";
2638 MessageDialog dialog(nullptr, msg_text, "", wxICON_WARNING | wxOK);
2639 dialog.ShowModal();
2641 }
2642}
bool m_is_timelapse_wipe_tower_already_prompted
Definition Tab.hpp:308

References _, L, m_is_timelapse_wipe_tower_already_prompted, show_timelapse_warning_dialog(), and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by show_timelapse_warning_dialog().

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

◆ supports_printer_technology()

virtual bool Slic3r::GUI::Tab::supports_printer_technology ( const PrinterTechnology tech) const
pure virtual

Implemented in Slic3r::GUI::TabFilament, Slic3r::GUI::TabPrint, Slic3r::GUI::TabPrinter, Slic3r::GUI::TabSLAMaterial, and Slic3r::GUI::TabSLAPrint.

References parent(), and style.

Referenced by on_value_change(), Slic3r::anonymous_namespace{PluginHostPresets.cpp}::require_tab(), and update_frequently_changed_parameters().

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

◆ switch_excluder()

void Slic3r::GUI::Tab::switch_excluder ( int extruder_id = -1,
bool reload = true )
9178{
9179 Preset & printer_preset = m_preset_bundle->printers.get_edited_preset();
9180 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
9181 auto extruders = printer_preset.config.option<ConfigOptionEnumsGeneric>("extruder_type");
9182
9183 // Orca: the printer tab re-targets its pages to the extruder selected on the switch. Resolved before
9184 // the range check below, which keeps the extruder_type read in get_index_for_extruder in range.
9185 if (m_type == Preset::TYPE_PRINTER && extruder_id == -1)
9186 extruder_id = get_current_active_extruder();
9187 if (!m_variant_combo && (extruder_id >= (int)nozzle_volumes->size() || extruder_id >= (int)extruders->size()))
9188 extruder_id = 0;
9189 if (m_extruder_switch) {
9190 int current_extruder = get_current_active_extruder();
9191 bool sync_enable = get_extruder_sync_enable_state(current_extruder);
9193 m_extruder_sync->Show();
9195 if (extruder_id == -1)
9196 extruder_id = current_extruder;
9197 else if (extruder_id != current_extruder)
9198 return;
9199 }
9200 } else if (m_variant_combo) {
9201 int current_variant = m_variant_combo->GetSelection();
9202 if (current_variant < 0)
9203 current_variant = 0;
9204 if (extruder_id == -1)
9205 extruder_id = current_variant;
9206 else if (extruder_id != current_variant)
9207 return;
9208 }
9209 auto get_index_for_extruder =
9210 [this, &extruders, variant_keys = extruder_variant_keys[m_type >= Preset::TYPE_COUNT ? Preset::TYPE_PRINT : m_type]](int extruder_id, int stride = 1) {
9211 return m_config->get_index_for_extruder(extruder_id + 1, variant_keys.first,
9212 ExtruderType(extruders->values[extruder_id]), get_actual_nozzle_volume_type(extruder_id), variant_keys.second, stride);
9213 };
9214 auto index = m_variant_combo ? extruder_id : get_index_for_extruder(extruder_id == -1 ? 0 : extruder_id);
9215 if (index < 0)
9216 return;
9217 if (m_extruder_switch) m_extruder_switch->SetClientData(reinterpret_cast<void*>(static_cast<std::uintptr_t>(index)));
9218 if (m_variant_combo) m_variant_combo->SetClientData(reinterpret_cast<void *>(static_cast<std::uintptr_t>(index)));
9219 for (auto page : m_pages) {
9220 bool is_extruder = false;
9221 int page_index = index;
9223 if (page->title() == "Extruder")
9224 is_extruder = true;
9225 else if (page->title().StartsWith("Motion ability"))
9226 page_index = get_index_for_extruder(extruder_id == -1 ? 0 : extruder_id, 2);
9227 }
9228 page->m_opt_id_map.clear();
9229 for (auto group : page->m_optgroups) {
9230 for (auto &opt : group->opt_map()) {
9231 if (is_extruder && opt.second.second >= 0) {
9232 // Per-variant options use the variant column, the others (nozzle_diameter,
9233 // extruder_offset, ...) are sized by the extruder count and use the extruder.
9234 const int idx = printer_options_with_variant_1.count(opt.second.first) > 0 ? page_index : extruder_id;
9235 const_cast<int &>(opt.second.second) = idx;
9236 page->m_opt_id_map.insert({opt.second.first + "#" + std::to_string(idx), opt.first});
9237 continue;
9238 }
9239 auto iter = std::find(printer_extruder_options.begin(), printer_extruder_options.end(), opt.second.first);
9240 if (iter != printer_extruder_options.end()) {
9241 page->m_opt_id_map.insert({opt.first, opt.first});
9242 continue;
9243 }
9244
9245 if (opt.second.second >= 0) {
9246 const_cast<int &>(opt.second.second) = page_index;
9247 page->m_opt_id_map.insert({opt.second.first + "#" + std::to_string(page_index), opt.first});
9248 group->draw_multi_extruder = variant_switch_active();
9249 }
9250 }
9251 }
9252 }
9253 if (reload) {
9254 reload_config();
9257 if (m_active_page)
9258 m_active_page->update_visibility(m_mode, true);
9259 m_page_view->GetParent()->Layout();
9260 }
9261}
bool get_extruder_sync_enable_state(int extruder_id)
Definition Tab.cpp:9099
bool m_extruder_switch_variants
Definition Tab.hpp:338
int get_current_active_extruder()
Definition Tab.cpp:741
bool variant_switch_active() const
Definition Tab.cpp:9155
std::set< std::string > printer_extruder_options
Definition PrintConfig.cpp:10224

References Slic3r::Preset::config, Slic3r::GUI::extruder_variant_keys, get_actual_nozzle_volume_type(), get_current_active_extruder(), get_extruder_sync_enable_state(), is_printer_extruder_page(), m_active_page, m_config, m_extruder_switch, m_extruder_switch_variants, m_extruder_sync, m_mode, m_page_view, m_pages, m_preset_bundle, m_type, m_variant_combo, Slic3r::ConfigBase::option(), Slic3r::printer_extruder_options, Slic3r::printer_options_with_variant_1, reload_config(), Slic3r::ConfigOptionVector< int >::size(), switch_excluder(), toggle_options(), Slic3r::Preset::TYPE_COUNT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, update_changed_ui(), Slic3r::ConfigOptionVector< int >::values, Slic3r::GUI::variant_keys(), and variant_switch_active().

Referenced by create_preset_tab(), switch_excluder(), and update_extruder_variants().

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

◆ sync_excluder()

void Slic3r::GUI::Tab::sync_excluder ( )
9264{
9265 Preset & printer_preset = m_preset_bundle->printers.get_edited_preset();
9266 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
9267 auto extruders = printer_preset.config.option<ConfigOptionEnumsGeneric>("extruder_type");
9268 // Motion ability options hold a (normal, silent) pair per variant, so switch_excluder indexes that page with stride 2.
9269 const int stride = m_active_page->title().StartsWith("Motion ability") ? 2 : 1;
9270 auto get_index_for_extruder =
9272 return m_config->get_index_for_extruder(extruder_id + 1, variant_keys.first,
9273 ExtruderType(extruders->values[extruder_id]), nozzle_type, variant_keys.second, stride);
9274 };
9275 int active_index = get_current_active_extruder();
9276 // The button copies to the other toolhead, so it is only offered when that other one exists;
9277 // without this the `1 - active_index` below would index an extruder that is not there.
9278 if (!get_extruder_sync_enable_state(active_index))
9279 return;
9280 auto active_nozzle = get_actual_nozzle_volume_type(active_index);
9281 int from_index = get_index_for_extruder(active_index, active_nozzle);
9282 int dest_index = get_index_for_extruder(1 - active_index, active_nozzle);
9283 if (from_index < 0 || dest_index < 0) // no variant column for this nozzle on one of the extruders
9284 return;
9285 auto dirty_options = m_presets->current_dirty_options(true);
9286 DynamicConfig config_origin, config_to_apply;
9287 for (int i = 0; i < dirty_options.size(); ++i) {
9288 auto &opt = dirty_options[i];
9289 auto n= opt.find('#');
9290 if (n == std::string::npos)
9291 continue;
9292 auto field = m_active_page->get_field(opt.substr(0, n), from_index + 256);
9293 auto line = m_active_page->get_line(opt.substr(0, n), from_index + 256);
9294 if (field == nullptr || line == nullptr)
9295 continue;
9296 ++n;
9297 auto is_from_slot = [&](const std::string &dirty_opt) {
9298 int slot = std::atoi(dirty_opt.c_str() + n);
9299 return slot >= from_index && slot < from_index + stride;
9300 };
9301 bool dirty = is_from_slot(opt);
9302 while (i + 1 < dirty_options.size() && dirty_options[i + 1].compare(0, n, opt, 0, n) == 0) {
9303 dirty |= is_from_slot(dirty_options[i + 1]);
9304 ++i;
9305 }
9306 if (dirty) {
9307 auto key = opt.substr(0, n - 1);
9308 auto option = dynamic_cast<ConfigOptionVectorBase*>(m_config->option(key));
9309 auto option2 = dynamic_cast<ConfigOptionVectorBase*>(option->clone());
9310 for (int s = 0; s < stride; ++s)
9311 option2->set_at(option, dest_index + s, from_index + s);
9312 if (*option == *option2) {
9313 delete option2;
9314 continue;
9315 }
9316 config_origin.set_key_value(key, option->clone());
9317 config_to_apply.set_key_value(key, option2);
9318 }
9319 }
9320 if (config_to_apply.empty()) {
9321 MessageDialog md(wxGetApp().plater(), _L("No modifications need to be copied."), _L("Copy parameters"), wxICON_INFORMATION | wxOK);
9322 md.ShowModal();
9323 return;
9324 }
9325
9326 std::string pt = m_preset_bundle->printers.get_edited_preset().get_printer_type(m_preset_bundle);
9329 wxString title = wxString::Format(_L("Modify parameters of %s"), _L(active_nozzle_name));
9330 wxString header = wxString::Format(_L("Do you want to modify the following parameters of the %s to that of the %s?"),
9331 _L(active_nozzle_name), _L(other_nozzle_name));
9332 UnsavedChangesDialog dlg(title, header, &config_origin, from_index, dest_index, active_index == 0, active_nozzle);
9333 dlg.ShowModal();
9334 if (dlg.transfer_changes()) {
9335 m_config->apply(config_to_apply);
9336 auto &applying_keys = const_cast<t_config_option_keys&>(m_config_manipulation.applying_keys());
9338 applying_keys = config_to_apply.keys();
9339 reload_config();
9341 applying_keys.clear();
9343 update();
9344 if (m_active_page)
9345 m_active_page->update_visibility(m_mode, true);
9346 m_page_view->GetParent()->Layout();
9347 }
9348}
static std::string get_toolhead_display_name(const std::string &type_str, int ext_id, ToolHeadComponent component, ToolHeadNameCase name_case=ToolHeadNameCase::TitleCase, bool short_name=false)
Definition DevConfigUtil.cpp:379
std::vector< std::string > t_config_option_keys
Definition Config.hpp:97
@ LowerCase
Definition DevConfigUtil.h:43

References _L, Slic3r::Preset::config, Slic3r::DynamicConfig::empty(), Slic3r::GUI::extruder_variant_keys, get_actual_nozzle_volume_type(), get_current_active_extruder(), get_extruder_sync_enable_state(), Slic3r::DevPrinterConfigUtil::get_toolhead_display_name(), Slic3r::DynamicConfig::keys(), Slic3r::LowerCase, m_active_page, m_config, m_config_manipulation, m_mode, m_page_view, m_preset_bundle, m_presets, m_type, Slic3r::Nozzle, Slic3r::nozzle_type(), Slic3r::ConfigBase::option(), Slic3r::GUI::plater(), reload_config(), Slic3r::ConfigOptionVectorBase::set_at(), Slic3r::DynamicConfig::set_key_value(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::GUI::UnsavedChangesDialog::ShowModal(), sync_excluder(), title(), Slic3r::GUI::UnsavedChangesDialog::transfer_changes(), Slic3r::Preset::TYPE_COUNT, Slic3r::Preset::TYPE_PRINT, update(), update_changed_ui(), Slic3r::ConfigOptionVector< int >::values, and Slic3r::GUI::variant_keys().

Referenced by create_preset_tab(), and sync_excluder().

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

◆ sys_color_changed()

void Slic3r::GUI::Tab::sys_color_changed ( )
virtual
1876{
1877 if (m_presets_choice)
1878 m_presets_choice->sys_color_changed();
1879
1880 // update buttons and cached bitmaps
1881 for (const auto btn : m_scaled_buttons)
1882 btn->msw_rescale();
1883 for (const auto bmp : m_scaled_bitmaps)
1884 bmp->msw_rescale();
1886 m_detach_preset_btn->msw_rescale();
1887
1888 // update icons for tree_ctrl
1889 for (ScalableBitmap& bmp : m_scaled_icons_list)
1890 bmp.msw_rescale();
1891 // recreate and set new ImageList for tree_ctrl
1892 m_icons->RemoveAll();
1893 m_icons = new wxImageList(m_scaled_icons_list.front().bmp().GetWidth(), m_scaled_icons_list.front().bmp().GetHeight(), false);
1894 for (ScalableBitmap& bmp : m_scaled_icons_list)
1895 //m_icons->Add(bmp.bmp());
1896 m_tabctrl->AssignImageList(m_icons);
1897
1898 // Colors for ui "decoration"
1900#ifdef _WIN32
1901 wxWindowUpdateLocker noUpdates(this);
1902 //BBS: GUI refactor
1903 //if (m_mode_sizer)
1904 // m_mode_sizer->msw_rescale();
1905 wxGetApp().UpdateDarkUI(this);
1906 wxGetApp().UpdateDarkUI(m_tabctrl);
1907#endif
1909
1910 // update options_groups
1911 if (m_active_page)
1912 m_active_page->sys_color_changed();
1914 m_extruder_switch->Rescale();
1915 if (m_variant_combo)
1916 m_variant_combo->Rescale();
1917
1918 //BBS: GUI refactor
1919 //Layout();
1920 m_parent->Layout();
1921}
void update_label_colours()
Definition Tab.cpp:917
void update_changed_tree_ui()
Definition Tab.cpp:1438

References m_active_page, m_detach_preset_btn, m_extruder_switch, m_icons, m_parent, m_presets_choice, m_scaled_bitmaps, m_scaled_buttons, m_scaled_icons_list, m_tabctrl, m_variant_combo, sys_color_changed(), update_changed_tree_ui(), and update_label_colours().

Referenced by sys_color_changed().

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

◆ title()

wxString Slic3r::GUI::Tab::title ( ) const
inline

◆ toggle_line()

void Slic3r::GUI::Tab::toggle_line ( const std::string & opt_key,
bool toggle,
int opt_index = -1 )
1971{
1972 // Apply to every page that owns the option, not just m_active_page. ConfigManipulation runs while
1973 // each tab updates at preset load, so the Speed Dial sees the same visibility regardless of page.
1974 for (const PageShp& page : m_pages) {
1975 if (!page) continue;
1976 if (Line *line = page->get_line(opt_key, opt_index))
1977 line->toggle_visible = toggle;
1978 }
1979};

References m_pages, and toggle_line().

Referenced by get_config_manipulation(), toggle_line(), Slic3r::GUI::TabFilament::toggle_options(), Slic3r::GUI::TabPrinter::toggle_options(), and Slic3r::GUI::TabFilament::update_filament_overrides_page().

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

◆ toggle_option()

void Slic3r::GUI::Tab::toggle_option ( const std::string & opt_key,
bool toggle,
int opt_index = -1 )
1962{
1963 if (!m_active_page)
1964 return;
1965 Field* field = m_active_page->get_field(opt_key, opt_index);
1966 if (field)
1967 field->toggle(toggle);
1968}

References m_active_page, Slic3r::GUI::Field::toggle(), and toggle_option().

Referenced by get_config_manipulation(), toggle_option(), Slic3r::GUI::TabFilament::toggle_options(), Slic3r::GUI::TabPrint::toggle_options(), Slic3r::GUI::TabPrinter::toggle_options(), and Slic3r::GUI::TabPrintPlate::update_mixed_filament_seq_state().

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

◆ toggle_options()

virtual void Slic3r::GUI::Tab::toggle_options ( )
pure virtual

Implemented in Slic3r::GUI::TabFilament, Slic3r::GUI::TabPrint, Slic3r::GUI::TabPrinter, Slic3r::GUI::TabSLAMaterial, and Slic3r::GUI::TabSLAPrint.

Referenced by activate_selected_page(), create_preset_tab(), switch_excluder(), and update_mode().

Here is the caller graph for this function:

◆ toggle_show_hide_incompatible()

void Slic3r::GUI::Tab::toggle_show_hide_incompatible ( )
8388{
8390 if (m_presets_choice)
8391 m_presets_choice->set_show_incompatible_presets(m_show_incompatible_presets);
8393 update_tab_ui();
8394}
void update_show_hide_incompatible_button()
Definition Tab.cpp:8396

References m_presets_choice, m_show_incompatible_presets, toggle_show_hide_incompatible(), update_show_hide_incompatible_button(), and update_tab_ui().

Referenced by toggle_show_hide_incompatible().

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

◆ transfer_options()

void Slic3r::GUI::Tab::transfer_options ( const std::string & name_from,
const std::string & name_to,
std::vector< std::string > options )
8090{
8091 if (options.empty())
8092 return;
8093
8094 Preset* preset_from = m_presets->find_preset(name_from);
8095 Preset* preset_to = m_presets->find_preset(name_to);
8096
8098 auto it = std::find(options.begin(), options.end(), "extruders_count");
8099 if (it != options.end()) {
8100 // erase "extruders_count" option from the list
8101 options.erase(it);
8102 // cache the extruders count
8103 static_cast<TabPrinter*>(this)->cache_extruder_cnt(&preset_from->config);
8104 }
8105 }
8106 cache_config_diff(options, &preset_from->config);
8107
8108 if (name_to != m_presets->get_edited_preset().name )
8109 select_preset(preset_to->name);
8110
8113}

References apply_config_from_cache(), cache_config_diff(), Slic3r::Preset::config, load_current_preset(), m_presets, m_type, Slic3r::Preset::name, select_preset(), transfer_options(), and Slic3r::Preset::TYPE_PRINTER.

Referenced by transfer_options().

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

◆ translate_category()

wxString Slic3r::GUI::Tab::translate_category ( const wxString & title,
Preset::Type preset_type,
bool translate = true )
static
824{
825 auto tr = [translate](const wxString& s) { return translate ? _(s) : s; };
826 if (preset_type == Preset::TYPE_PRINTER && title.Contains("Extruder ")) {
827 auto preset = wxGetApp().preset_bundle;
828 if (preset && preset->is_bbl_vendor()) {
829 if (title == "Extruder 1") return tr(L("Left Extruder"));
830 if (title == "Extruder 2") return tr(L("Right Extruder"));
831 }
832 return tr(L("Extruder")) + title.SubString(8, title.Last());
833 }
834 // Orca: one "Extruder" page serves all extruders; name it "Extruders" when there are several.
835 if (preset_type == Preset::TYPE_PRINTER && title == "Extruder") {
836 auto preset = wxGetApp().preset_bundle;
837 if (preset && preset->get_printer_extruder_count() > 1)
838 return tr(L("Extruders"));
839 }
840 return tr(title);
841}
void translate(ExPolygonsWithIds &e, const Point &p)
Definition Emboss.cpp:1368

References _, L, title(), Slic3r::translate(), and Slic3r::Preset::TYPE_PRINTER.

Referenced by activate_option(), Slic3r::GUI::PublishSettingsDialog::build_option_model(), generate_extruder_options(), Slic3r::Search::make_option(), Slic3r::GUI::ActionRegistry::materialize_setting_actions(), rebuild_page_tree(), tree_sel_change_delayed(), update_changed_tree_ui(), update_current_page_in_background(), update_label_colours(), Slic3r::GUI::UnsavedChangesDialog::update_tree(), and Slic3r::GUI::UnsavedChangesDialog::update_tree().

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

◆ tree_sel_change_delayed()

bool Slic3r::GUI::Tab::tree_sel_change_delayed ( wxCommandEvent & event)
protected
7951{
7952 // The issue apparently manifests when Show()ing a window with overlay scrollbars while the UI is frozen. For this reason,
7953 // we will Thaw the UI prematurely on Linux. This means destroing the no_updates object prematurely.
7954#ifdef __linux__
7955 std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(this));
7956#else
7957 /* On Windows we use DoubleBuffering during rendering,
7958 * so on Window is no needed to call a Freeze/Thaw functions.
7959 * But under OSX (builds compiled with MacOSX10.14.sdk) wxStaticBitmap rendering is broken without Freeze/Thaw call.
7960 */
7961//#ifdef __WXOSX__ // Use Freeze/Thaw to avoid flickering during clear/activate new page
7962// wxWindowUpdateLocker noUpdates(this);
7963//#endif
7964#endif
7965
7966 //BBS: GUI refactor
7967 Page* page = nullptr;
7968 const auto sel_item = m_tabctrl->GetSelection();
7969 // BBS: bold selection
7970 //OutputDebugStringA("tree_sel_change_delayed ");
7971 //OutputDebugStringA(m_title.c_str());
7972 m_tabctrl->SetItemBold(sel_item, true);
7973 const auto selection = sel_item >= 0 ? m_tabctrl->GetItemText(sel_item) : "";
7974 //OutputDebugString(selection);
7975 //OutputDebugStringA("\n");
7976 for (auto p : m_pages)
7977 if (translate_category(p->title(), m_type) == selection)
7978 {
7979 page = p.get();
7980 m_is_nonsys_values = page->m_is_nonsys_values;
7981 m_is_modified_values = page->m_is_modified_values;
7982 break;
7983 }
7984
7985 //BBS: GUI refactor
7986 if (page == nullptr)
7987 {
7988 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format("can not find page with current selection %1%\n") % selection;
7989 return false;
7990 }
7991 void* item_data = m_tabctrl->GetItemData(sel_item);
7992 if (item_data)
7993 {
7994 //from update_current_page_in_background in not active tab
7995 m_tabctrl->SetItemData(sel_item, NULL);
7996 return false;
7997 }
7998
7999 if (!m_parent->is_active_and_shown_tab((wxPanel*)this))
8000 {
8001 Tab* current_tab = dynamic_cast<Tab*>(m_parent->get_current_tab());
8002
8003 m_page_view->Freeze();
8004
8005 if (current_tab)
8006 {
8007 current_tab->clear_pages();
8008 current_tab->unselect_tree_item();
8009 }
8010 m_active_page = page;
8011 // BBS: not changed
8012 // update_undo_buttons();
8013 this->OnActivate();
8014 m_parent->set_active_tab(this);
8016
8017 m_page_view->Thaw();
8018 return false;
8019 }
8020
8021 //process logic in the same tab when select treeCtrlItem
8022 if (m_active_page == page)
8023 return false;
8024
8025 m_active_page = page;
8027
8028 auto throw_if_canceled = std::function<void()>([this](){
8029#ifdef WIN32
8030 //BBS: GUI refactor
8031 //TODO: remove this call currently, after refactor, there is Paint event in the queue
8032 //this call will cause OnPaint immediately, which will cause crash
8033 //wxCheckForInterrupt(m_tabctrl);
8035 throw UIBuildCanceled();
8036#else // WIN32
8037 (void)this; // silence warning
8038#endif
8039 });
8040
8041 try {
8042 m_page_view->Freeze();
8043 // clear pages from the controls
8044 clear_pages();
8045 throw_if_canceled();
8046
8047 //BBS: GUI refactor
8048 if (wxGetApp().mainframe!=nullptr && wxGetApp().mainframe->is_active_and_shown_tab(m_parent))
8049 activate_selected_page(throw_if_canceled);
8050
8051 #ifdef __linux__
8052 no_updates.reset(nullptr);
8053 #endif
8054
8055 // BBS: not changed
8056 // update_undo_buttons();
8057 throw_if_canceled();
8058
8059 //BBS: GUI refactor
8060 //m_hsizer->Layout();
8061 m_parent->Layout();
8062 throw_if_canceled();
8063 // Refresh();
8064
8065 m_page_view->Thaw();
8066 } catch (const UIBuildCanceled&) {
8067 if (m_active_page)
8068 m_active_page->clear();
8069 m_page_view->Thaw();
8070 return true;
8071 }
8072
8073 return false;
8074}
bool m_is_modified_values
Definition Tab.hpp:275
void update_variant_sizer_visibility()
Definition Tab.cpp:9162
virtual void clear_pages()
Definition Tab.cpp:7798
virtual void OnActivate()
Definition Tab.cpp:843

References Tab(), activate_selected_page(), clear_pages(), m_active_page, Slic3r::GUI::Page::m_is_modified_values, m_is_modified_values, Slic3r::GUI::Page::m_is_nonsys_values, m_is_nonsys_values, m_page_switch_planned, m_page_view, m_pages, m_parent, m_tabctrl, m_type, OnActivate(), translate_category(), tree_sel_change_delayed(), unselect_tree_item(), and update_variant_sizer_visibility().

Referenced by create_preset_tab(), and tree_sel_change_delayed().

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

◆ type()

Preset::Type Slic3r::GUI::Tab::type ( ) const
inline
350{ return m_type; }

References m_type.

Referenced by Tab(), Slic3r::GUI::TabPrint::TabPrint(), Slic3r::GUI::MainFrame::add_created_tab(), Slic3r::GUI::TabPrinter::build_unregular_pages(), Slic3r::GUI::ParamsPanel::set_active_tab(), Slic3r::GUI::TabPrinter::set_extruder_volume_type(), and Slic3r::GUI::TabPrinter::update_input_shaper_menu().

Here is the caller graph for this function:

◆ unselect_tree_item()

void Slic3r::GUI::Tab::unselect_tree_item ( )
7822{
7823 // BBS: bold selection
7824 const auto sel_item = m_tabctrl->GetSelection();
7825 m_last_select_item = sel_item;
7826 m_tabctrl->SetItemBold(sel_item, false);
7827 m_tabctrl->Unselect();
7828 m_active_page = nullptr;
7829}

References m_active_page, m_last_select_item, m_tabctrl, and unselect_tree_item().

Referenced by tree_sel_change_delayed(), and unselect_tree_item().

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

◆ update()

virtual void Slic3r::GUI::Tab::update ( )
pure virtual

◆ update_all_extruder_options_status()

void Slic3r::GUI::Tab::update_all_extruder_options_status ( )
1215{
1217 return;
1218 }
1220
1221 int extruder_count = m_preset_bundle->get_printer_extruder_count();
1222 auto extruders = m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnumsGeneric>("extruder_type");
1223 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
1224
1225 std::set<int> all_config_indices;
1226 for (int extruder_id = 0; extruder_id < extruder_count; ++extruder_id) {
1229 int config_index = m_config->get_index_for_extruder(
1230 extruder_id + 1,
1231 variant_keys.first,
1232 ExtruderType(extruders->values[extruder_id]),
1234 variant_keys.second
1235 );
1236 if (config_index >= 0) {
1237 all_config_indices.insert(config_index);
1238 }
1239 }
1240 }
1241
1242 auto dirty_options = m_presets->current_dirty_options(true);
1243 auto nonsys_options = m_presets->current_different_from_parent_options(true);
1245 update_custom_dirty(dirty_options, nonsys_options);
1246 auto filter_extruder_options = [](const std::vector<std::string>& options) {
1247 std::vector<std::string> filtered_options;
1248 for (const auto& opt : options) {
1249 if (opt.find('#') != std::string::npos) {
1250 filtered_options.push_back(opt);
1251 }
1252 }
1253 return filtered_options;
1254 };
1255
1256 auto filtered_dirty_options = filter_extruder_options(dirty_options);
1257 auto filtered_nonsys_options = filter_extruder_options(nonsys_options);
1258
1259 for (int config_index : all_config_indices) {
1260 int status_value = m_opt_status_value;
1261 for (const auto &opt_key : filtered_dirty_options) {
1262 m_all_extruder_options_status[opt_key] = status_value & ~osInitValue;
1263 }
1264 for (const auto &opt_key : filtered_nonsys_options) {
1265 auto iter = m_all_extruder_options_status.find(opt_key);
1266 if (iter != m_all_extruder_options_status.end()) {
1267 iter->second &= ~osSystemValue;
1268 } else {
1269 m_all_extruder_options_status[opt_key] = status_value & ~osSystemValue;
1270 }
1271 }
1272 }
1273}
virtual void update_custom_dirty(std::vector< std::string > &dirty_options, std::vector< std::string > &nonsys_options)
Definition Tab.hpp:421

References Slic3r::GUI::extruder_variant_keys, Slic3r::get_valid_nozzle_volume_type(), m_all_extruder_options_status, m_config, m_extruder_switch, m_opt_status_value, m_preset_bundle, m_presets, m_type, m_variant_combo, Slic3r::nozzle_type(), osInitValue, osSystemValue, Slic3r::Preset::TYPE_COUNT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, update_all_extruder_options_status(), update_custom_dirty(), and Slic3r::GUI::variant_keys().

Referenced by update_all_extruder_options_status(), and update_changed_ui().

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

◆ update_btns_enabling()

void Slic3r::GUI::Tab::update_btns_enabling ( )
7365{
7366 // we can delete any preset from the physical printer
7367 // and any user preset
7368 const Preset& preset = m_presets->get_edited_preset();
7369 m_btn_delete_preset->Show((m_type == Preset::TYPE_PRINTER && m_preset_bundle->physical_printers.has_selection())
7370 || preset.can_overwrite());
7371
7372 //if (m_btn_edit_ph_printer)
7373 // m_btn_edit_ph_printer->SetToolTip( m_preset_bundle->physical_printers.has_selection() ?
7374 // _L("Edit physical printer") : _L("Add physical printer"));
7375}

References Slic3r::Preset::can_overwrite(), m_btn_delete_preset, m_preset_bundle, m_presets, m_type, Slic3r::Preset::TYPE_PRINTER, and update_btns_enabling().

Referenced by load_current_preset(), update_btns_enabling(), and update_preset_choice().

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

◆ update_changed_tree_ui()

void Slic3r::GUI::Tab::update_changed_tree_ui ( )
1439{
1440 if (m_options_list.empty()) {
1442 for (auto page : m_pages) {
1443 page->m_is_nonsys_values = false;
1444 }
1445 }
1446 return;
1447 }
1448 auto cur_item = m_tabctrl->GetFirstVisibleItem();
1449 if (cur_item < 0 || !m_tabctrl->IsVisible(cur_item))
1450 return;
1451
1452 auto selected_item = m_tabctrl->GetSelection();
1453 auto selection = selected_item >= 0 ? m_tabctrl->GetItemText(selected_item) : "";
1454
1455 while (cur_item >= 0) {
1456 auto title = m_tabctrl->GetItemText(cur_item);
1457 for (auto page : m_pages)
1458 {
1459 if (translate_category(page->title(), m_type) != title)
1460 continue;
1461 bool sys_page = true;
1462 bool modified_page = false;
1463 if (page->title() == "General") {
1464 std::initializer_list<const char*> optional_keys{ "extruders_count", "printable_area" };
1465 for (auto &opt_key : optional_keys) {
1466 get_sys_and_mod_flags(opt_key, sys_page, modified_page);
1467 }
1468 }
1469 if (page->title() == "Dependencies") {
1471 sys_page = m_presets->get_selected_preset_parent() != nullptr;
1472 modified_page = false;
1473 } else {
1475 get_sys_and_mod_flags("compatible_prints", sys_page, modified_page);
1476 get_sys_and_mod_flags("compatible_printers", sys_page, modified_page);
1477 }
1478 }
1479 if (page->title() == "Speed" || page->title() == "Motion ability" || page->title() == "Filament" || page->title() == "Setting Overrides" || page->title() == "Multimaterial" || is_printer_extruder_page(page.get())) {
1480 auto options = generate_extruder_options();
1481 for (size_t switch_index = 0; switch_index < options.size(); ++switch_index) {
1482 std::vector<PageShp> pages_to_check = { page };
1483 check_extruder_options_status(switch_index, sys_page, modified_page, pages_to_check);
1484 }
1485 }
1486 for (auto group : page->m_optgroups)
1487 {
1488 if (!sys_page && modified_page)
1489 break;
1490 for (const auto &kvp : group->opt_map()) {
1491 const std::string &opt_key = kvp.first;
1492 get_sys_and_mod_flags(opt_key, sys_page, modified_page);
1493 }
1494 }
1495
1496 const wxColor *clr = sys_page ? (m_is_default_preset ? &m_default_text_clr : &m_sys_label_clr) :
1497 (modified_page || m_type >= Preset::TYPE_COUNT) ? &m_modified_label_clr : &m_default_text_clr;
1498
1499 if (page->set_item_colour(clr))
1500 m_tabctrl->SetItemTextColour(cur_item, clr == &m_modified_label_clr ? *clr : StateColor(
1501 std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
1502 std::make_pair(*clr, (int) StateColor::Normal)));
1503
1504 page->m_is_nonsys_values = !sys_page;
1505 page->m_is_modified_values = modified_page;
1506
1507 if (selection == title) {
1508 m_is_nonsys_values = page->m_is_nonsys_values;
1509 m_is_modified_values = page->m_is_modified_values;
1510 }
1511 break;
1512 }
1513 auto next_item = m_tabctrl->GetNextVisible(cur_item);
1514 cur_item = next_item;
1515 }
1516}
void check_extruder_options_status(int index, bool &sys_extruder, bool &modified_extruder, const std::vector< PageShp > &pages_to_check)
Definition Tab.cpp:1309
std::vector< wxString > generate_extruder_options()
Definition Tab.cpp:8930
@ TYPE_PLATE
Definition Preset.hpp:256
static constexpr const std::initializer_list< const char * > optional_keys
Definition Preset.cpp:4072

References check_extruder_options_status(), generate_extruder_options(), get_sys_and_mod_flags(), is_printer_extruder_page(), m_default_text_clr, m_is_default_preset, m_is_modified_values, m_is_nonsys_values, m_modified_label_clr, m_options_list, m_pages, m_presets, m_sys_label_clr, m_tabctrl, m_type, StateColor::Normal, StateColor::NotChecked, Slic3r::optional_keys, title(), translate_category(), Slic3r::Preset::TYPE_COUNT, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PLATE, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, and update_changed_tree_ui().

Referenced by sys_color_changed(), update_changed_tree_ui(), update_changed_ui(), and update_mode().

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

◆ update_changed_ui()

void Slic3r::GUI::Tab::update_changed_ui ( )
1107{
1109 return;
1110
1111 const bool deep_compare = (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_PRINT || m_type == Preset::TYPE_FILAMENT
1113 auto dirty_options = m_presets->current_dirty_options(deep_compare);
1114 auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare);
1115 if (m_type == Preset::TYPE_PRINTER && static_cast<TabPrinter*>(this)->m_printer_technology == ptFFF) {
1116 TabPrinter* tab = static_cast<TabPrinter*>(this);
1117 if (tab->m_initial_extruders_count != tab->m_extruders_count)
1118 dirty_options.emplace_back("extruders_count");
1119 if (tab->m_sys_extruders_count != tab->m_extruders_count)
1120 nonsys_options.emplace_back("extruders_count");
1121 }
1122
1123 update_custom_dirty(dirty_options, nonsys_options);
1125
1126 filter_diff_option(dirty_options);
1127 filter_diff_option(nonsys_options);
1128
1129 for (auto& it : m_options_list)
1130 it.second = m_opt_status_value;
1131
1132 for (auto opt_key : dirty_options) {
1133 auto iter = m_options_list.find(opt_key);
1134 if (iter != m_options_list.end())
1135 iter->second &= ~osInitValue;
1136 }
1137 for (auto opt_key : nonsys_options) {
1138 auto iter = m_options_list.find(opt_key);
1139 if (iter != m_options_list.end())
1140 iter->second &= ~osSystemValue;
1141 }
1142
1143 decorate();
1145
1146 wxTheApp->CallAfter([this]() {
1147 if (parent()) //To avoid a crash, parent should be exist for a moment of a tree updating
1149 });
1150 // BBS:
1152}
void update_undo_buttons()
Definition Tab.cpp:1518
void update_all_extruder_options_status()
Definition Tab.cpp:1214
void decorate()
Definition Tab.cpp:976
void update_extruder_switch_colors()
Definition Tab.cpp:1275
void filter_diff_option(std::vector< std::string > &options)
Definition Tab.cpp:1087

References decorate(), filter_diff_option(), Slic3r::GUI::TabPrinter::m_extruders_count, Slic3r::GUI::TabPrinter::m_initial_extruders_count, m_opt_status_value, m_options_list, m_postpone_update_ui, m_presets, Slic3r::GUI::TabPrinter::m_sys_extruders_count, m_type, osInitValue, osSystemValue, parent(), Slic3r::ptFFF, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_MODEL, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, update_all_extruder_options_status(), update_changed_tree_ui(), update_custom_dirty(), update_extruder_switch_colors(), and update_undo_buttons().

Referenced by activate_selected_page(), compatible_widget_create(), Slic3r::GUI::TabPrinter::create_bed_shape_widget(), create_preset_tab(), load_current_preset(), Slic3r::GUI::TabPrintModel::on_value_change(), Slic3r::GUI::TabPrintPlate::on_value_change(), Slic3r::anonymous_namespace{PluginHostPresets.cpp}::reload_local_bundle(), save_preset(), switch_excluder(), sync_excluder(), update_dirty(), and update_pages_with_multi_variant().

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

◆ update_current_page_in_background()

bool Slic3r::GUI::Tab::update_current_page_in_background ( int & item)
7901{
7902 Page* page = nullptr;
7903
7904 const auto selection = item >= 0 ? m_tabctrl->GetItemText(item) : "";
7905 for (auto p : m_pages)
7906 if (translate_category(p->title(), m_type) == selection)
7907 {
7908 page = p.get();
7909 break;
7910 }
7911
7912 if (page == nullptr || m_active_page == page)
7913 return false;
7914
7915 bool active_tab = false;
7916 if (wxGetApp().mainframe != nullptr && wxGetApp().mainframe->is_active_and_shown_tab(m_parent))
7917 active_tab = true;
7918
7919 if (!active_tab || (!m_parent->is_active_and_shown_tab((wxPanel*)this)))
7920 {
7921 m_is_nonsys_values = page->m_is_nonsys_values;
7922 m_is_modified_values = page->m_is_modified_values;
7923 // BBS: not need active
7924 // m_active_page = page;
7925
7926 // invalidated highlighter, if any exists
7927 m_highlighter.invalidate();
7928
7929 // clear pages from the controlls
7930 // BBS: fix after new layout, clear page in backgroud
7931 for (auto p : m_pages)
7932 p->clear();
7933 if (m_parent->is_active_and_shown_tab((wxPanel*)this))
7934 m_parent->clear_page();
7935
7937
7938 // BBS: this is not used, because we not SelectItem in background
7939 //todo: update selected item of tree_ctrl
7940 // wxTreeItemData item_data;
7941 // m_tabctrl->SetItemData(item, &item_data);
7942
7943 return false;
7944 }
7945
7946 return true;
7947}

References m_active_page, m_highlighter, Slic3r::GUI::Page::m_is_modified_values, m_is_modified_values, Slic3r::GUI::Page::m_is_nonsys_values, m_is_nonsys_values, m_pages, m_parent, m_tabctrl, m_type, translate_category(), update_current_page_in_background(), and update_undo_buttons().

Referenced by rebuild_page_tree(), and update_current_page_in_background().

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

◆ update_custom_dirty()

virtual void Slic3r::GUI::Tab::update_custom_dirty ( std::vector< std::string > & dirty_options,
std::vector< std::string > & nonsys_options )
inlinevirtual

Reimplemented in Slic3r::GUI::TabPrinter, Slic3r::GUI::TabPrintLayer, Slic3r::GUI::TabPrintModel, and Slic3r::GUI::TabPrintPlate.

421{}

Referenced by update_all_extruder_options_status(), and update_changed_ui().

Here is the caller graph for this function:

◆ update_description_lines()

void Slic3r::GUI::Tab::update_description_lines ( )
virtual

Reimplemented in Slic3r::GUI::TabFilament, Slic3r::GUI::TabPrint, and Slic3r::GUI::TabSLAPrint.

7873{
7874 if (m_active_page && m_active_page->title() == "Dependencies" && m_parent_preset_description_line)
7876}
void update_preset_description_line()
Definition Tab.cpp:2873

References m_active_page, m_parent_preset_description_line, update_description_lines(), and update_preset_description_line().

Referenced by activate_selected_page(), Slic3r::GUI::TabPrinter::update(), Slic3r::GUI::TabSLAMaterial::update(), update_description_lines(), Slic3r::GUI::TabFilament::update_description_lines(), Slic3r::GUI::TabPrint::update_description_lines(), Slic3r::GUI::TabSLAPrint::update_description_lines(), and update_visibility().

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

◆ update_dirty()

void Slic3r::GUI::Tab::update_dirty ( )
1611{
1613 return;
1614
1615 if (m_presets_choice) {
1616 m_presets_choice->update_dirty();
1618 } else {
1619 m_presets->update_dirty();
1620 }
1622}

References m_postpone_update_ui, m_presets, m_presets_choice, on_presets_changed(), update_changed_ui(), and update_dirty().

Referenced by apply_config_from_cache(), apply_preset_config_values(), Slic3r::GUI::TabFilament::build(), Slic3r::GUI::TabPrinter::build_fff(), Slic3r::GUI::TabPrinter::build_unregular_pages(), edit_custom_gcode(), get_config_manipulation(), load_config(), on_roll_back_value(), Slic3r::GUI::TabFilament::on_value_change(), Slic3r::GUI::TabPrinter::on_value_change(), Slic3r::GUI::TabFilament::toggle_options(), update_dirty(), Slic3r::GUI::TabPrintModel::update_model_config(), Slic3r::GUI::validate_custom_gcode_cb(), and Slic3r::GUI::validate_custom_gcode_cb().

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

◆ update_extruder_switch_colors()

void Slic3r::GUI::Tab::update_extruder_switch_colors ( )
1276{
1278 return;
1279 }
1280
1281 auto options = generate_extruder_options();
1282
1283 std::vector<PageShp> pages_to_check;
1284 if (m_active_page) {
1285 const wxString t = m_active_page->title();
1286 if (t == "Speed" || t == "Motion ability" || t == "Filament" ||
1287 t == "Setting Overrides" || t == "Multimaterial" || is_printer_extruder_page(m_active_page)) {
1288 for (auto &p : m_pages){
1289 if (p.get() == m_active_page) {
1290 pages_to_check.push_back(p);
1291 break;
1292 }
1293 }
1294 }
1295 }
1296
1297 for (size_t switch_index = 0; switch_index < options.size(); ++switch_index) {
1298 bool sys_extruder = true;
1299 bool modified_extruder = false;
1300 if (!pages_to_check.empty())
1301 check_extruder_options_status((int) switch_index, sys_extruder, modified_extruder, pages_to_check);
1302 // no matching page: clear the flag so the tag doesn't keep a stale color
1303
1304 if (m_extruder_switch) m_extruder_switch->SetModified(switch_index, modified_extruder);
1305 if (m_variant_combo) m_variant_combo->SetModified(switch_index, modified_extruder);
1306 }
1307}

References check_extruder_options_status(), generate_extruder_options(), is_printer_extruder_page(), m_active_page, m_extruder_switch, m_pages, m_variant_combo, and update_extruder_switch_colors().

Referenced by update_changed_ui(), update_extruder_switch_colors(), and update_extruder_variants().

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

◆ update_extruder_variants()

void Slic3r::GUI::Tab::update_extruder_variants ( int extruder_id = -1,
bool reload = true )

Call from: 1: on_value_change "nozzle_volume_type" 2: on_preset_loaded (extruder_id = -1).

Parameters
extruder_id
8836{
8837 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << extruder_id;
8838 if (m_extruder_switch) {
8839 auto nozzle_volumes = m_preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
8840 int extruder_nums = m_preset_bundle->get_printer_extruder_count();
8841 nozzle_volumes->values.resize(extruder_nums);
8842
8843 // Orca: update `m_actual_nozzle_volumes` to current selected ones
8845 for (int i = 0; i < extruder_nums; i++) m_actual_nozzle_volumes[i] = (NozzleVolumeType)nozzle_volumes->values[i];
8846
8847 // Orca: when every extruder uses the same variant (e.g. a non-Bambu dual-nozzle printer), the
8848 // switch has no nozzle variants to select and nothing to sync. The printer tab still enables it
8849 // to choose the extruder its Extruder and Motion ability pages edit.
8850 m_extruder_switch_variants = extruder_nums >= 2 && m_preset_bundle->support_different_extruders();
8851 if (m_extruder_switch_variants || (m_type == Preset::TYPE_PRINTER && extruder_nums >= 2)) {
8852 auto options = generate_extruder_options();
8853 m_extruder_switch->SetOptions(options);
8854 int item_n = options.empty() ? 0 : options.size();
8855 if (m_type == Preset::TYPE_PRINTER){ // we are on printer settings dialog and larger padding can be used
8856 int h_pad = item_n > 8 ? 6 : (item_n > 6 ? 9 : (item_n > 5 ? 12 : (item_n > 4 ? 18 : (item_n > 3 ? 24 : (item_n > 2 ? 36 : 48)))));
8857 m_extruder_switch->SetButtonPadding(wxSize(h_pad, 3));
8858 }
8859 else {
8860 int h_pad = item_n > 6 ? 6 : (item_n > 4 ? 10 : (item_n > 2 ? 20 : 36));
8861 m_extruder_switch->SetButtonPadding(wxSize(h_pad, 3));
8862 }
8863
8864 int selection_index;
8865 if (extruder_id >= 0) {
8866 NozzleVolumeType current_nozzle_type = get_actual_nozzle_volume_type(extruder_id);
8867 selection_index = calculate_selection_index_for_extruder(extruder_id, current_nozzle_type);
8868 } else {
8869 selection_index = m_extruder_switch->GetSelection();
8870 if (selection_index < 0) {
8871 selection_index = 0;
8872 }
8873 }
8874
8875 m_extruder_switch->SetSelection(selection_index);
8876 m_extruder_switch->Enable(true);
8877 m_extruder_sync->Enable(true);
8878 } else {
8879 m_extruder_switch->Enable(false);
8880 m_extruder_sync->Enable(false);
8881 }
8882 } else if (m_variant_combo) {
8883 if (extruder_id >= 0)
8884 return;
8885
8886 const int selection = m_variant_combo->GetSelection();
8887 auto options = generate_extruder_options();
8888 m_variant_combo->SetOptions(options);
8889 int item_n = options.empty() ? 0 : options.size();
8890 int h_pad = item_n > 6 ? 6 : (item_n > 4 ? 8 : (item_n > 2 ? 20 : 36));
8891 m_variant_combo->SetButtonPadding(wxSize(h_pad, 3));
8892
8893 if (!options.empty())
8894 m_variant_combo->SetSelection(selection < 0 || selection >= (int) options.size() ? 0 : selection);
8895
8896 m_variant_combo->Enable(options.size() > 1);
8897 }
8898 switch_excluder(extruder_id, reload);
8899 if (m_type == Preset::TYPE_PRINT) {
8901 }
8904}
void update_pages_with_multi_variant()
Definition Tab.cpp:5353
int calculate_selection_index_for_extruder(int extruder_id, NozzleVolumeType nozzle_type)
Definition Tab.cpp:717

References calculate_selection_index_for_extruder(), generate_extruder_options(), get_actual_nozzle_volume_type(), m_actual_nozzle_volumes, m_extruder_switch, m_extruder_switch_variants, m_extruder_sync, m_preset_bundle, m_type, m_variant_combo, Slic3r::nvtStandard, switch_excluder(), Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, update_extruder_switch_colors(), update_extruder_variants(), update_pages_with_multi_variant(), and update_variant_sizer_visibility().

Referenced by load_current_preset(), and update_extruder_variants().

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

◆ update_frequently_changed_parameters()

void Slic3r::GUI::Tab::update_frequently_changed_parameters ( )
protected
2958{
2959 const bool is_fff = supports_printer_technology(ptFFF);
2960 auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff);
2961 if (!og_freq_chng_params) return;
2962
2963 og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
2964 if (! is_fff)
2965 og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
2966
2967 const std::string updated_value_key = is_fff ? "sparse_infill_density" : "pad_enable";
2968
2969 const boost::any val = og_freq_chng_params->get_config_value(*m_config, updated_value_key);
2970 og_freq_chng_params->set_value(updated_value_key, val);
2971
2972 if (is_fff)
2973 {
2974 og_freq_chng_params->set_value("brim", bool(m_config->opt_float("brim_width") > 0.0));
2976 }
2977}

References m_config, Slic3r::GUI::pad_combo_value_for_config(), Slic3r::ptFFF, Slic3r::GUI::support_combo_value_for_config(), supports_printer_technology(), update_frequently_changed_parameters(), and update_wiping_button_visibility().

Referenced by load_current_preset(), and update_frequently_changed_parameters().

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

◆ update_label_colours()

void Slic3r::GUI::Tab::update_label_colours ( )
918{
919 m_default_text_clr = wxGetApp().get_label_clr_default();
920 if (m_sys_label_clr == wxGetApp().get_label_clr_sys() && m_modified_label_clr == wxGetApp().get_label_clr_modified())
921 return;
922 m_sys_label_clr = wxGetApp().get_label_clr_sys();
923 m_modified_label_clr = wxGetApp().get_label_clr_modified();
924
925 //update options "decoration"
926 for (const auto& opt : m_options_list)
927 {
928 const wxColour *color = &m_sys_label_clr;
929
930 // value isn't equal to system value
931 if ((opt.second & osSystemValue) == 0) {
932 // value is equal to last saved
933 if ((opt.second & osInitValue) != 0)
934 color = &m_default_text_clr;
935 // value is modified
936 else
937 color = &m_modified_label_clr;
938 }
939 if (opt.first == "printable_area" ||
940 opt.first == "compatible_prints" || opt.first == "compatible_printers" ) {
941 if (Line* line = get_line(opt.first))
942 line->set_label_colour(color);
943 continue;
944 }
945
946 Field* field = get_field(opt.first);
947 if (field == nullptr) continue;
948 field->set_label_colour(color);
949 }
950
951 auto cur_item = m_tabctrl->GetFirstVisibleItem();
952 if (cur_item < 0 || !m_tabctrl->IsVisible(cur_item))
953 return;
954 while (cur_item >= 0) {
955 auto title = m_tabctrl->GetItemText(cur_item);
956 for (auto page : m_pages)
957 {
958 if (translate_category(page->title(), m_type) != title)
959 continue;
960
961 const wxColor *clr = !page->m_is_nonsys_values ? &m_sys_label_clr :
962 page->m_is_modified_values ? &m_modified_label_clr :
964
965 m_tabctrl->SetItemTextColour(cur_item, clr == &m_modified_label_clr ? *clr : StateColor(
966 std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
967 std::make_pair(*clr, (int) StateColor::Normal)));
968 break;
969 }
970 cur_item = m_tabctrl->GetNextVisible(cur_item);
971 }
972
973 decorate();
974}

References decorate(), get_field(), get_line(), m_default_text_clr, m_modified_label_clr, m_options_list, m_pages, m_sys_label_clr, m_tabctrl, m_type, StateColor::Normal, StateColor::NotChecked, osInitValue, osSystemValue, Slic3r::GUI::UndoValueUIManager::set_label_colour(), title(), translate_category(), and Slic3r::Preset::TYPE_COUNT.

Referenced by sys_color_changed().

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

◆ update_mode()

void Slic3r::GUI::Tab::update_mode ( )
1792{
1793 m_mode = wxGetApp().get_mode();
1794
1795 // toggle_options reads m_mode to gate Lines whose contents are mode-mixed
1796 // (e.g., a multi-option row where some options are Advanced and some Expert):
1797 // when all of a Line's options would be hidden, we hide the Line itself.
1798 // Without refreshing here, the toggle_visible state stays stale across mode
1799 // switches and Lines stay hidden.
1801
1803
1805}

References m_mode, toggle_options(), update_changed_tree_ui(), update_mode(), and update_visibility().

Referenced by update_mode().

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

◆ update_pages_with_multi_variant()

void Slic3r::GUI::Tab::update_pages_with_multi_variant ( )
5354{
5355 if (!m_active_page) {
5356 return;
5357 }
5358 // TODO: Orca: support multi variant field
5359 //for (auto optgroup : m_active_page->m_optgroups) {
5360 // Field *multi_variant_field = nullptr;
5361 // std::string opt_key;
5362
5363 // for (const auto& opt : multi_variant_text_ctrl_options) {
5364 // Field* field = optgroup->get_fieldc(opt, 0);
5365 // if (field) {
5366 // auto *multi_variant = dynamic_cast<MultiVariantTextCtrl *>(field);
5367 // if (multi_variant) {;
5368 // multi_variant_field = field;
5369 // opt_key = opt;
5370 // }
5371 // break;
5372 // }
5373 // }
5374 // if (multi_variant_field) {
5375 // auto * multi_variant_ctrl = dynamic_cast<MultiVariantTextCtrl*>(multi_variant_field);
5376 // multi_variant_ctrl->refresh_text_ctrls_layout(optgroup->ctrl_parent());
5377 // if (optgroup->custom_ctrl) {
5378 // optgroup->custom_ctrl->update_line_height_for_field(opt_key);
5379 // }
5380 // }
5381 // m_page_view->GetParent()->Layout();
5382 // m_parent->Layout();
5383 //}
5385}

References m_active_page, update_changed_ui(), and update_pages_with_multi_variant().

Referenced by update_extruder_variants(), and update_pages_with_multi_variant().

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

◆ update_preset_choice()

void Slic3r::GUI::Tab::update_preset_choice ( )
7378{
7379 if (m_presets_choice)
7380 m_presets_choice->update();
7382}

References m_presets_choice, update_btns_enabling(), and update_preset_choice().

Referenced by update_preset_choice().

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

◆ update_preset_description_line()

void Slic3r::GUI::Tab::update_preset_description_line ( )
protected
2874{
2875 const Preset* parent = m_presets->get_selected_preset_parent();
2876 const Preset& preset = m_presets->get_edited_preset();
2877
2878 wxString description_line;
2879
2880 if (preset.is_default) {
2881 description_line = _(L("This is a default preset."));
2882 } else if (preset.is_system) {
2883 description_line = _(L("This is a system preset."));
2884 } else if (parent == nullptr) {
2885 description_line = _(L("Current preset is inherited from the default preset."));
2886 } else {
2887 std::string name = parent->name;
2888 boost::replace_all(name, "&", "&&");
2889 description_line = _(L("Current preset is inherited from")) + ":\n\t" + from_u8(name);
2890 }
2891
2892 if (preset.is_default || preset.is_system)
2893 description_line += "\n\t" + _(L("It can't be deleted or modified.")) +
2894 "\n\t" + _(L("Any modifications should be saved as a new preset inherited from this one.")) +
2895 "\n\t" + _(L("To do that please specify a new name for the preset."));
2896
2897 if (parent && parent->vendor)
2898 {
2899 description_line += "\n\n" + _(L("Additional information:")) + "\n";
2900 description_line += "\t" + _(L("vendor")) + ": " + (m_type == Slic3r::Preset::TYPE_PRINTER ? "\n\t\t" : "") + parent->vendor->name +
2901 // TRN Short for "version"
2902 ", " + _L("ver") + ": " + parent->vendor->config_version.to_string();
2904 const std::string &printer_model = preset.config.opt_string("printer_model");
2905 if (! printer_model.empty())
2906 description_line += "\n\n\t" + _(L("printer model")) + ": \n\t\t" + printer_model;
2907 switch (preset.printer_technology()) {
2908 case ptFFF:
2909 {
2910 //FIXME add prefered_sla_material_profile for SLA
2911 const std::string &default_print_profile = preset.config.opt_string("default_print_profile");
2912 const std::vector<std::string> &default_filament_profiles = preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
2913 if (!default_print_profile.empty())
2914 description_line += "\n\n\t" + _(L("default print profile")) + ": \n\t\t" + default_print_profile;
2915 if (!default_filament_profiles.empty())
2916 {
2917 description_line += "\n\n\t" + _(L("default filament profile")) + ": \n\t\t";
2918 for (auto& profile : default_filament_profiles) {
2919 if (&profile != &*default_filament_profiles.begin())
2920 description_line += ", ";
2921 description_line += profile;
2922 }
2923 }
2924 break;
2925 }
2926 case ptSLA:
2927 {
2928 //FIXME add prefered_sla_material_profile for SLA
2929 const std::string &default_sla_material_profile = preset.config.opt_string("default_sla_material_profile");
2930 if (!default_sla_material_profile.empty())
2931 description_line += "\n\n\t" + _(L("default SLA material profile")) + ": \n\t\t" + default_sla_material_profile;
2932
2933 const std::string &default_sla_print_profile = preset.config.opt_string("default_sla_print_profile");
2934 if (!default_sla_print_profile.empty())
2935 description_line += "\n\n\t" + _(L("default SLA print profile")) + ": \n\t\t" + default_sla_print_profile;
2936 break;
2937 }
2938 default: break;
2939 }
2940 }
2941 else if (!preset.alias.empty())
2942 {
2943 description_line += "\n\n\t" + _(L("full profile name")) + ": \n\t\t" + preset.name;
2944 description_line += "\n\t" + _(L("symbolic profile name")) + ": \n\t\t" + preset.alias;
2945 }
2946 }
2947
2948 m_parent_preset_description_line->SetText(description_line, false);
2949
2951 m_detach_preset_btn->Show(parent && parent->is_system && !preset.is_default);
2952 //BBS: GUI refactor
2953 //Layout();
2954 m_parent->Layout();
2955}

References _, _L, Slic3r::Preset::alias, Slic3r::Preset::config, Slic3r::from_u8(), Slic3r::Preset::is_default, Slic3r::Preset::is_system, L, m_detach_preset_btn, m_parent, m_parent_preset_description_line, m_presets, m_type, name(), Slic3r::Preset::name, Slic3r::DynamicConfig::opt_string(), Slic3r::ConfigBase::option(), parent(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, Slic3r::ptSLA, Slic3r::Preset::TYPE_PRINTER, and update_preset_description_line().

Referenced by update_description_lines(), and update_preset_description_line().

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

◆ update_printer_agent_if_needed()

void Slic3r::GUI::Tab::update_printer_agent_if_needed ( )
protected

◆ update_saved_preset_from_current_preset()

void Slic3r::GUI::Tab::update_saved_preset_from_current_preset ( )
5388{ m_presets->update_saved_preset_from_current_preset(); }

References m_presets, and update_saved_preset_from_current_preset().

Referenced by update_saved_preset_from_current_preset().

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

◆ update_show_hide_incompatible_button()

void Slic3r::GUI::Tab::update_show_hide_incompatible_button ( )
8397{
8398 //BBS: GUI refactor
8399 /*m_btn_hide_incompatible_presets->SetBitmap_(m_show_incompatible_presets ?
8400 m_bmp_show_incompatible_presets : m_bmp_hide_incompatible_presets);
8401 m_btn_hide_incompatible_presets->SetToolTip(m_show_incompatible_presets ?
8402 "Both compatible an incompatible presets are shown. Click to hide presets not compatible with the current printer." :
8403 "Only compatible presets are shown. Click to show both the presets compatible and not compatible with the current printer.");*/
8404}

References update_show_hide_incompatible_button().

Referenced by toggle_show_hide_incompatible(), update_show_hide_incompatible_button(), and update_ui_from_settings().

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

◆ update_tab_ui()

void Slic3r::GUI::Tab::update_tab_ui ( bool update_plater_presets = false)
1625{
1626 if (m_presets_choice) {
1627 m_presets_choice->update();
1628 if (update_plater_presets)
1630 }
1631}

References m_presets_choice, on_presets_changed(), and update_tab_ui().

Referenced by load_current_preset(), Slic3r::GUI::TabFilament::on_value_change(), Slic3r::GUI::TabPrinter::on_value_change(), save_preset(), select_preset(), toggle_show_hide_incompatible(), update_tab_ui(), and update_ui_from_settings().

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

◆ update_ui_from_settings()

void Slic3r::GUI::Tab::update_ui_from_settings ( )
8407{
8408 // Show the 'show / hide presets' button only for the print and filament tabs, and only if enabled
8409 // in application preferences.
8412 //BBS: GUI refactor
8413 //Layout();
8414 m_parent->Layout();
8415 //show ? m_btn_hide_incompatible_presets->Show() : m_btn_hide_incompatible_presets->Hide();
8416 // If the 'show / hide presets' button is hidden, hide the incompatible presets.
8417 if (show) {
8419 }
8420 else {
8423 update_tab_ui();
8424 }
8425 }
8426}
bool m_show_btn_incompatible_presets
Definition Tab.hpp:312

References m_parent, m_show_btn_incompatible_presets, m_show_incompatible_presets, m_type, Slic3r::Preset::TYPE_PRINTER, update_show_hide_incompatible_button(), update_tab_ui(), and update_ui_from_settings().

Referenced by update_ui_from_settings().

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

◆ update_ui_items_related_on_parent_preset()

void Slic3r::GUI::Tab::update_ui_items_related_on_parent_preset ( const Preset * selected_preset_parent)
7115{
7116 m_is_default_preset = selected_preset_parent != nullptr && selected_preset_parent->is_default;
7117
7118 m_bmp_non_system = selected_preset_parent ? &m_bmp_value_unlock : &m_bmp_white_bullet;
7119 m_ttg_non_system = selected_preset_parent ? &m_ttg_value_unlock : &m_ttg_white_bullet_ns;
7120 m_tt_non_system = selected_preset_parent ? &m_tt_value_unlock : &m_ttg_white_bullet_ns;
7121}

References Slic3r::Preset::is_default, m_bmp_non_system, m_bmp_value_unlock, m_bmp_white_bullet, m_is_default_preset, m_tt_non_system, m_tt_value_unlock, m_ttg_non_system, m_ttg_value_unlock, m_ttg_white_bullet_ns, and update_ui_items_related_on_parent_preset().

Referenced by load_current_preset(), save_preset(), and update_ui_items_related_on_parent_preset().

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

◆ update_undo_buttons()

void Slic3r::GUI::Tab::update_undo_buttons ( )
1519{
1520 // BBS: restore all pages in preset
1521 m_undo_btn-> SetBitmap_(m_presets->get_edited_preset().is_dirty ? m_bmp_value_revert: m_bmp_white_bullet);
1522 //m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
1523
1524 m_undo_btn->SetToolTip(m_presets->get_edited_preset().is_dirty ? _L("Click to reset all settings to the last saved preset.") : m_ttg_white_bullet);
1525 //m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_ttg_non_system : m_ttg_value_lock);
1526}
wxString m_ttg_white_bullet
Definition Tab.hpp:248

References _L, m_bmp_value_revert, m_bmp_white_bullet, m_presets, m_ttg_white_bullet, m_undo_btn, and update_undo_buttons().

Referenced by update_changed_ui(), update_current_page_in_background(), and update_undo_buttons().

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

◆ update_variant_sizer_visibility()

void Slic3r::GUI::Tab::update_variant_sizer_visibility ( )
9163{
9164 if (!m_variant_sizer)
9165 return;
9166 const bool show = variant_switch_active() && m_active_page && !m_active_page->m_opt_id_map.empty();
9167 m_main_sizer->Show(m_variant_sizer, show);
9168 if (m_extruder_sync) {
9169 m_extruder_sync->Show(show);
9170 // Orca: copying between extruders is offered only between nozzle variants, and not on the Extruder page.
9173 }
9174 GetParent()->Layout();
9175}

References get_current_active_extruder(), get_extruder_sync_enable_state(), is_printer_extruder_page(), m_active_page, m_extruder_switch_variants, m_extruder_sync, m_main_sizer, m_variant_sizer, update_variant_sizer_visibility(), and variant_switch_active().

Referenced by tree_sel_change_delayed(), update_extruder_variants(), and update_variant_sizer_visibility().

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

◆ update_visibility()

void Slic3r::GUI::Tab::update_visibility ( )
1808{
1809 Freeze(); // There is needed Freeze/Thaw to avoid a flashing after Show/Layout
1810
1811 for (auto page : m_pages)
1812 page->update_visibility(m_mode, page.get() == m_active_page);
1814
1817
1818 //BBS: GUI refactor
1819 //Layout();
1820 m_parent->Layout();
1821 Thaw();
1822}

References m_active_page, m_mode, m_pages, m_parent, m_type, rebuild_page_tree(), Slic3r::Preset::TYPE_SLA_PRINT, update_description_lines(), and update_visibility().

Referenced by load_current_preset(), update_mode(), and update_visibility().

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

◆ update_wiping_button_visibility()

void Slic3r::GUI::Tab::update_wiping_button_visibility ( )
2645 {
2646 if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA)
2647 return; // ys_FIXME
2648 // Orca: it's not used
2649 //
2650 // bool wipe_tower_enabled = dynamic_cast<ConfigOptionBool*>( (m_preset_bundle->prints.get_edited_preset().config ).option("enable_prime_tower"))->value;
2651 // bool multiple_extruders = dynamic_cast<ConfigOptionFloats*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1;
2652 // auto wiping_dialog_button = wxGetApp().sidebar().get_wiping_dialog_button();
2653 // if (wiping_dialog_button) {
2654 // wiping_dialog_button->Show(wipe_tower_enabled && multiple_extruders);
2655 // wiping_dialog_button->GetParent()->Layout();
2656 // }
2657
2658}

References m_preset_bundle, Slic3r::ptSLA, and update_wiping_button_visibility().

Referenced by on_value_change(), update_frequently_changed_parameters(), and update_wiping_button_visibility().

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

◆ validate_custom_gcode()

bool Slic3r::GUI::Tab::validate_custom_gcode ( const wxString & title,
const std::string & gcode )
static
4334{
4335 std::vector<std::string> tags;
4336 bool invalid = GCodeProcessor::contains_reserved_tags(gcode, 5, tags, wxGetApp().preset_bundle->is_bbl_vendor());
4337 if (invalid) {
4338 std::string lines = ":\n";
4339 for (const std::string& keyword : tags)
4340 lines += ";" + keyword + "\n";
4341 wxString reports = format_wxstr(
4342 _L_PLURAL("Following line %s contains reserved keywords.\nPlease remove it, or G-code visualization and print time estimation will be broken.",
4343 "Following lines %s contain reserved keywords.\nPlease remove them, or G-code visualization and print time estimation will be broken.",
4344 tags.size()),
4345 lines);
4346 //wxMessageDialog dialog(wxGetApp().mainframe, reports, _L("Found reserved keywords in") + " " + _(title), wxICON_WARNING | wxOK);
4347 // TRN %1% is the name of the custom G-code setting, e.g. "Machine start G-code".
4348 MessageDialog dialog(wxGetApp().mainframe, reports, format_wxstr(_L("Reserved keywords found in %1%"), _(title)), wxICON_WARNING | wxOK);
4349 dialog.ShowModal();
4350 }
4351 return !invalid;
4352}
static bool contains_reserved_tags(const std::string &gcode, unsigned int max_count, std::vector< std::string > &found_tag, bool is_bbl_printer)
Definition GCodeProcessor.cpp:2789
static std::string gcode(Type type)
Definition IMSlider.cpp:111

References _, _L, _L_PLURAL, Slic3r::GCodeProcessor::contains_reserved_tags(), Slic3r::GUI::format_wxstr(), Slic3r::GUI::gcode(), Slic3r::GUI::DPIAware< P >::ShowModal(), and title().

Referenced by edit_custom_gcode(), Slic3r::GUI::validate_custom_gcode_cb(), Slic3r::GUI::validate_custom_gcode_cb(), and validate_custom_gcodes().

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

◆ validate_custom_gcodes()

bool Slic3r::GUI::Tab::validate_custom_gcodes ( )
8691{
8693 (m_type != Preset::TYPE_PRINTER || static_cast<TabPrinter*>(this)->m_printer_technology != ptFFF))
8694 return true;
8695 if (m_active_page->title() != L("Custom G-code"))
8696 return true;
8697
8698 // When we switch Settings tab after editing of the custom g-code, then warning message could ba already shown after KillFocus event
8699 // and then it's no need to show it again
8702 return true;
8703 }
8704
8705 bool valid = true;
8706 for (auto opt_group : m_active_page->m_optgroups) {
8707 assert(opt_group->opt_map().size() == 1);
8708 if (!opt_group->is_activated())
8709 break;
8710 std::string key = opt_group->opt_map().begin()->first;
8711 valid &= validate_custom_gcode(opt_group->title, boost::any_cast<std::string>(opt_group->get_value(key)));
8712 if (!valid)
8713 break;
8714 }
8715 return valid;
8716}

References L, m_active_page, m_type, Slic3r::ptFFF, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINTER, validate_custom_gcode(), validate_custom_gcodes(), and validate_custom_gcodes_was_shown.

Referenced by validate_custom_gcodes().

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

◆ validate_filament_temperature_pairs()

bool Slic3r::GUI::Tab::validate_filament_temperature_pairs ( )
8723{
8724 if (m_type != Preset::TYPE_FILAMENT || m_presets == nullptr)
8725 return true;
8726
8727 // Warn only for newly edited state, not for unchanged presets.
8728 if (!m_presets->current_is_dirty())
8729 return true;
8730
8731 Preset& edited_preset = m_presets->get_edited_preset();
8732 DynamicPrintConfig& config = edited_preset.config;
8733 const std::string suppress_key = edited_preset.name;
8734 // User opted out for this preset during current app session.
8735 if (!suppress_key.empty() && s_filament_temp_pair_warning_suppressed_for_session.count(suppress_key) > 0)
8736 return true;
8737
8738 struct TempPairRule
8739 {
8740 wxString label;
8741 std::string first_layer_key;
8742 std::string other_layer_key;
8743 int max_delta;
8744 };
8745
8746 std::vector<TempPairRule> temp_pair_rules;
8747 temp_pair_rules.push_back({_L("Nozzle"), "nozzle_temperature_initial_layer", "nozzle_temperature", 30});
8748
8749 // Derive bed labels/keys from curr_bed_type metadata (BedType order excludes btDefault).
8750 if (const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type");
8751 bed_type_def != nullptr) {
8752 for (int bt = static_cast<int>(btPC); bt < static_cast<int>(btCount); ++bt) {
8753 const BedType bed_type = static_cast<BedType>(bt);
8754 const size_t label_idx = static_cast<size_t>(bt - static_cast<int>(btPC));
8755 const std::string first_key = get_bed_temp_1st_layer_key(bed_type);
8756 const std::string other_key = get_bed_temp_key(bed_type);
8757 if (first_key.empty() || other_key.empty())
8758 continue;
8759
8760 wxString label = _(bed_type_def->enum_labels[label_idx]);
8761 temp_pair_rules.push_back({label, first_key, other_key, 15});
8762 }
8763 }
8764
8765 wxString invalid_pairs;
8766 int invalid_count = 0;
8767
8768 for (const TempPairRule& rule : temp_pair_rules) {
8769 if (!config.has(rule.first_layer_key) || !config.has(rule.other_layer_key))
8770 continue;
8771
8772 const ConfigOptionInts* first_opt = config.option<ConfigOptionInts>(rule.first_layer_key);
8773 const ConfigOptionInts* other_opt = config.option<ConfigOptionInts>(rule.other_layer_key);
8774 if (first_opt == nullptr || other_opt == nullptr || first_opt->values.empty() || other_opt->values.empty())
8775 continue;
8776
8777 const int first_temp = first_opt->get_at(0);
8778 const int other_temp = other_opt->get_at(0);
8779
8780 // Keep existing semantics: 0 means unsupported/off for these temperatures.
8781 if (first_temp <= 0 || other_temp <= 0)
8782 continue;
8783
8784 const int delta = std::abs(first_temp - other_temp);
8785 if (delta <= rule.max_delta)
8786 continue;
8787
8788 const wxString deg_c = wxString::FromUTF8(u8"\u2103" /* °C */);
8789 const wxString bullet = wxString::FromUTF8("•");
8790 invalid_pairs += wxString::Format(_L(" - %s:\n %s first layer %d %s, other layers %d %s\n %s max delta %d %s, current delta %d %s\n"),
8791 rule.label, bullet, first_temp, deg_c, other_temp, deg_c, bullet, rule.max_delta, deg_c, delta, deg_c);
8792 ++invalid_count;
8793 }
8794
8795 if (invalid_count == 0)
8796 return true;
8797
8798 wxString msg_text = _L("Some first-layer and other-layer temperature pairs exceed safety limits.\n");
8799 msg_text += _L("\nInvalid pairs:\n");
8800 msg_text += invalid_pairs;
8801 msg_text += _L("\nYou can go back to edit values, or continue if this is intentional.");
8802 msg_text += _L("\n\nContinue anyway?");
8803
8804 RichMessageDialog dialog(parent(), msg_text, _L("Temperature Safety Check"), wxYES | wxNO | wxICON_WARNING);
8805 dialog.SetButtonLabel(wxID_YES, _L("Continue"), true);
8806 dialog.SetButtonLabel(wxID_NO, _L_CONTEXT("Back", "Navigation"));
8807 dialog.ShowCheckBox(_L("Don't warn again for this preset"));
8808 const int answer = dialog.ShowModal();
8809 // Session-only suppression (does not modify/save filament preset data).
8810 if (dialog.IsCheckBoxChecked() && !suppress_key.empty())
8812
8813 return answer == wxID_YES;
8814}
const ConfigOptionDef * get(const t_config_option_key &opt_key) const
Definition Config.hpp:2662
const int & get_at(size_t i) const
Definition Config.hpp:676
static std::unordered_set< std::string > s_filament_temp_pair_warning_suppressed_for_session
Definition Tab.cpp:8719
static std::string get_bed_temp_key(const BedType type)
Definition PrintConfig.hpp:732
BedType
Definition PrintConfig.hpp:507
@ btPC
Definition PrintConfig.hpp:509
@ btCount
Definition PrintConfig.hpp:515
const PrintConfigDef print_config_def
Definition PrintConfig.cpp:10099
ConfigOptionIntsTempl< false > ConfigOptionInts
Definition Config.hpp:1154
static std::string get_bed_temp_1st_layer_key(const BedType type)
Definition PrintConfig.hpp:755
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References _, _L, _L_CONTEXT, Slic3r::btCount, Slic3r::btPC, Slic3r::Preset::config, Slic3r::ConfigOptionVector< int >::get_at(), Slic3r::get_bed_temp_1st_layer_key(), Slic3r::get_bed_temp_key(), Slic3r::ConfigOptionResolver::has(), Slic3r::GUI::RichMessageDialog::IsCheckBoxChecked(), m_presets, m_type, Slic3r::Preset::name, Slic3r::ConfigBase::option(), parent(), Slic3r::print_config_def, Slic3r::GUI::s_filament_temp_pair_warning_suppressed_for_session, Slic3r::GUI::MsgDialog::SetButtonLabel(), Slic3r::GUI::RichMessageDialog::ShowCheckBox(), Slic3r::GUI::RichMessageDialog::ShowModal(), Slic3r::Preset::TYPE_FILAMENT, validate_filament_temperature_pairs(), and Slic3r::ConfigOptionVector< int >::values.

Referenced by save_preset(), and validate_filament_temperature_pairs().

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

◆ variant_switch_active()

bool Slic3r::GUI::Tab::variant_switch_active ( ) const
9156{
9158 return m_extruder_switch->IsThisEnabled();
9159 return m_variant_combo && m_variant_combo->IsThisEnabled();
9160}

References m_extruder_switch, m_variant_combo, and variant_switch_active().

Referenced by switch_excluder(), update_variant_sizer_visibility(), and variant_switch_active().

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

◆ EditGCodeDialog

friend class EditGCodeDialog
friend

References EditGCodeDialog.

Referenced by edit_custom_gcode(), and EditGCodeDialog.

◆ PublishSettingsDialog

friend class PublishSettingsDialog
friend

References PublishSettingsDialog.

Referenced by PublishSettingsDialog.

Member Data Documentation

◆ m_active_page

◆ m_actual_nozzle_volumes

std::vector<NozzleVolumeType> Slic3r::GUI::Tab::m_actual_nozzle_volumes

◆ m_all_extruder_options_status

std::map<std::string, int> Slic3r::GUI::Tab::m_all_extruder_options_status
protected

◆ m_bmp_edit_value

ScalableBitmap Slic3r::GUI::Tab::m_bmp_edit_value
protected

Referenced by create_preset_tab(), and decorate().

◆ m_bmp_hide_incompatible_presets

ScalableBitmap Slic3r::GUI::Tab::m_bmp_hide_incompatible_presets
protected

Referenced by create_preset_tab().

◆ m_bmp_non_system

ScalableBitmap* Slic3r::GUI::Tab::m_bmp_non_system
protected

◆ m_bmp_show_incompatible_presets

ScalableBitmap Slic3r::GUI::Tab::m_bmp_show_incompatible_presets
protected

Referenced by create_preset_tab().

◆ m_bmp_value_lock

ScalableBitmap Slic3r::GUI::Tab::m_bmp_value_lock
protected

Referenced by create_preset_tab(), and decorate().

◆ m_bmp_value_revert

ScalableBitmap Slic3r::GUI::Tab::m_bmp_value_revert
protected

◆ m_bmp_value_unlock

ScalableBitmap Slic3r::GUI::Tab::m_bmp_value_unlock
protected

◆ m_bmp_white_bullet

◆ m_btn_compare_preset

ScalableButton* Slic3r::GUI::Tab::m_btn_compare_preset
protected

◆ m_btn_delete_preset

ScalableButton* Slic3r::GUI::Tab::m_btn_delete_preset
protected

◆ m_btn_save_preset

ScalableButton* Slic3r::GUI::Tab::m_btn_save_preset
protected

Referenced by create_preset_tab().

◆ m_btn_search

ScalableButton* Slic3r::GUI::Tab::m_btn_search
protected

Referenced by create_preset_tab().

◆ m_cache_config

DynamicPrintConfig Slic3r::GUI::Tab::m_cache_config
protected

◆ m_cache_options

std::vector<std::string> Slic3r::GUI::Tab::m_cache_options
protected

◆ m_category_icon

std::map<wxString, std::string> Slic3r::GUI::Tab::m_category_icon
protected

◆ m_colored_Label_colors

std::map<std::string, wxColour> Slic3r::GUI::Tab::m_colored_Label_colors

◆ m_compatible_printers

◆ m_compatible_prints

◆ m_completed

bool Slic3r::GUI::Tab::m_completed { false }
protected
283{ false };

Referenced by completed(), and create_preset_tab().

◆ m_config

DynamicPrintConfig* Slic3r::GUI::Tab::m_config

Referenced by Slic3r::GUI::TabFilament::add_filament_overrides_page(), add_options_page(), apply_preset_config_values(), apply_searcher(), Slic3r::GUI::TabPrinter::build(), Slic3r::GUI::TabPrintPlate::build(), Slic3r::GUI::TabPrinter::build_fff(), Slic3r::GUI::TabPrinter::build_unregular_pages(), check_extruder_options_status(), compatible_widget_create(), compatible_widget_reload(), Slic3r::GUI::TabPrinter::create_bed_shape_widget(), Slic3r::GUI::TabPrinter::extruder_variant_index(), generate_extruder_options(), get_config(), get_custom_gcode(), Slic3r::GUI::TabFilament::get_custom_gcode(), get_sys_and_mod_flags(), init_options_list(), Slic3r::GUI::TabFilament::init_options_list(), load_config(), load_current_preset(), load_initial_data(), load_key_value(), Slic3r::GUI::TabPrinter::on_gcode_flavor_changed(), Slic3r::GUI::TabPrinter::on_preset_loaded(), on_roll_back_value(), on_value_change(), Slic3r::GUI::TabFilament::on_value_change(), Slic3r::GUI::TabPrinter::on_value_change(), Slic3r::GUI::TabPrintModel::on_value_change(), Slic3r::GUI::TabPrintPlate::on_value_change(), options_list_storage_key(), reload_config(), Slic3r::GUI::TabPrinter::reload_config(), Slic3r::GUI::TabPrintModel::reload_config(), Slic3r::GUI::TabPrintModel::reset_model_config(), Slic3r::GUI::TabPrintPlate::reset_model_config(), save_preset(), set_custom_gcode(), Slic3r::GUI::TabFilament::set_custom_gcode(), switch_excluder(), sync_excluder(), Slic3r::GUI::TabPrinter::sync_extruders_count(), Slic3r::GUI::TabFilament::toggle_options(), Slic3r::GUI::TabPrint::toggle_options(), Slic3r::GUI::TabPrinter::toggle_options(), Slic3r::GUI::TabSLAPrint::toggle_options(), Slic3r::GUI::TabFilament::update(), Slic3r::GUI::TabPrint::update(), Slic3r::GUI::TabPrinter::update(), Slic3r::GUI::TabSLAMaterial::update(), Slic3r::GUI::TabSLAPrint::update(), update_all_extruder_options_status(), Slic3r::GUI::TabPrinter::update_custom_dirty(), Slic3r::GUI::TabPrintPlate::update_custom_dirty(), Slic3r::GUI::TabPrinter::update_fff(), Slic3r::GUI::TabFilament::update_filament_overrides_page(), update_frequently_changed_parameters(), Slic3r::GUI::TabPrinter::update_input_shaper_menu(), and Slic3r::GUI::TabPrintModel::update_model_config().

◆ m_config_manipulation

◆ m_default_text_clr

wxColour Slic3r::GUI::Tab::m_default_text_clr
protected

◆ m_dependent_tabs

std::vector<Preset::Type> Slic3r::GUI::Tab::m_dependent_tabs
protected

◆ m_detach_preset_btn

◆ m_disable_tree_sel_changed_event

bool Slic3r::GUI::Tab::m_disable_tree_sel_changed_event {false}
protected
265{false};

Referenced by create_preset_tab(), and rebuild_page_tree().

◆ m_em_unit

int Slic3r::GUI::Tab::m_em_unit
protected

Referenced by Tab(), create_preset_tab(), and msw_rescale().

◆ m_extruder_switch

◆ m_extruder_switch_variants

bool Slic3r::GUI::Tab::m_extruder_switch_variants = false

◆ m_extruder_sync

◆ m_extruder_sync_box

wxPanel* Slic3r::GUI::Tab::m_extruder_sync_box = nullptr

Referenced by create_preset_tab().

◆ m_highlighter

struct Slic3r::GUI::Tab::Highlighter Slic3r::GUI::Tab::m_highlighter
protected

◆ m_icon_count

int Slic3r::GUI::Tab::m_icon_count
protected

◆ m_icon_index

std::map<std::string, size_t> Slic3r::GUI::Tab::m_icon_index
protected

Referenced by add_options_page().

◆ m_icons

wxImageList* Slic3r::GUI::Tab::m_icons
protected

◆ m_is_default_preset

bool Slic3r::GUI::Tab::m_is_default_preset {false}
protected

◆ m_is_modified_values

bool Slic3r::GUI::Tab::m_is_modified_values { false }
protected

◆ m_is_nonsys_values

bool Slic3r::GUI::Tab::m_is_nonsys_values { true }
protected

◆ m_is_timelapse_wipe_tower_already_prompted

bool Slic3r::GUI::Tab::m_is_timelapse_wipe_tower_already_prompted = false
protected

◆ m_just_edit

bool Slic3r::GUI::Tab::m_just_edit {false}
protected
208{false};

Referenced by save_preset(), and set_just_edit().

◆ m_last_select_item

int Slic3r::GUI::Tab::m_last_select_item = -1
protected

◆ m_last_sparse_infill_rotate_template_value

std::string Slic3r::GUI::Tab::m_last_sparse_infill_rotate_template_value
protected

Referenced by on_value_change(), and reload_config().

◆ m_main_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_main_sizer
protected

◆ m_mode

◆ m_mode_icon

ScalableButton* Slic3r::GUI::Tab::m_mode_icon = nullptr

Referenced by create_preset_tab().

◆ m_mode_view

ModeSwitchButton* Slic3r::GUI::Tab::m_mode_view = nullptr

Referenced by create_preset_tab(), and msw_rescale().

◆ m_modified_label_clr

wxColour Slic3r::GUI::Tab::m_modified_label_clr
protected

◆ m_name

std::string Slic3r::GUI::Tab::m_name
protected

Referenced by set_type().

◆ m_opt_status_value

◆ m_options_list

◆ m_page_switch_planned

bool Slic3r::GUI::Tab::m_page_switch_planned = false
protected

◆ m_page_switch_running

bool Slic3r::GUI::Tab::m_page_switch_running = false
protected

Referenced by create_preset_tab().

◆ m_page_view

◆ m_pages

◆ m_parent

◆ m_parent_preset_description_line

ogStaticText* Slic3r::GUI::Tab::m_parent_preset_description_line = nullptr

◆ m_postpone_update_ui

◆ m_preset_bundle

PresetBundle* Slic3r::GUI::Tab::m_preset_bundle

Referenced by Slic3r::GUI::TabFilament::add_filament_overrides_page(), apply_preset_config_values(), Slic3r::GUI::TabFilament::build(), Slic3r::GUI::TabPrint::build(), Slic3r::GUI::TabPrinter::build(), Slic3r::GUI::TabPrintPlate::build(), Slic3r::GUI::TabSLAMaterial::build(), Slic3r::GUI::TabSLAPrint::build(), Slic3r::GUI::TabPrinter::build_unregular_pages(), calculate_selection_index_for_extruder(), check_extruder_options_status(), compatible_widget_create(), Slic3r::GUI::TabPrinter::create_bed_shape_widget(), create_preset_tab(), delete_preset(), Slic3r::GUI::TabPrinter::extruders_count_changed(), generate_extruder_options(), get_actual_nozzle_volume_type(), get_extruder_sync_enable_state(), load_key_value(), may_discard_current_dirty_preset(), Slic3r::GUI::TabPrinter::on_preset_loaded(), on_presets_changed(), on_value_change(), Slic3r::GUI::TabFilament::on_value_change(), parse_extruder_selection(), Slic3r::GUI::TabFilament::reload_config(), save_preset(), select_preset(), Slic3r::GUI::TabPrinter::set_extruder_volume_type(), switch_excluder(), sync_excluder(), Slic3r::GUI::TabFilament::toggle_options(), Slic3r::GUI::TabPrint::toggle_options(), Slic3r::GUI::TabPrinter::toggle_options(), Slic3r::GUI::TabSLAMaterial::toggle_options(), Slic3r::GUI::TabFilament::update(), Slic3r::GUI::TabPrint::update(), Slic3r::GUI::TabSLAMaterial::update(), Slic3r::GUI::TabSLAPrint::update(), update_all_extruder_options_status(), update_btns_enabling(), Slic3r::GUI::TabPrintPlate::update_custom_dirty(), Slic3r::GUI::TabPrint::update_description_lines(), update_extruder_variants(), Slic3r::GUI::TabFilament::update_filament_overrides_page(), Slic3r::GUI::TabPrintPlate::update_mixed_filament_seq_state(), Slic3r::GUI::TabPrintModel::update_model_config(), Slic3r::GUI::TabPrinter::update_pages(), and update_wiping_button_visibility().

◆ m_presets

PresetCollection* Slic3r::GUI::Tab::m_presets = nullptr

◆ m_presets_choice

◆ m_scaled_bitmaps

std::vector<ScalableBitmap*> Slic3r::GUI::Tab::m_scaled_bitmaps = {}
protected

◆ m_scaled_buttons

std::vector<ScalableButton*> Slic3r::GUI::Tab::m_scaled_buttons = {}
protected

◆ m_scaled_icons_list

std::vector<ScalableBitmap> Slic3r::GUI::Tab::m_scaled_icons_list = {}
protected

◆ m_search_input

TextInput* Slic3r::GUI::Tab::m_search_input
protected

Referenced by create_preset_tab().

◆ m_search_item

StaticBox* Slic3r::GUI::Tab::m_search_item
protected

Referenced by create_preset_tab().

◆ m_select_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_select_sizer
protected

◆ m_show_btn_incompatible_presets

bool Slic3r::GUI::Tab::m_show_btn_incompatible_presets = false

Referenced by update_ui_from_settings().

◆ m_show_incompatible_presets

bool Slic3r::GUI::Tab::m_show_incompatible_presets
protected

◆ m_sys_label_clr

wxColour Slic3r::GUI::Tab::m_sys_label_clr
protected

◆ m_tabctrl

◆ m_title

const wxString Slic3r::GUI::Tab::m_title
protected

Referenced by Tab(), create_preset_tab(), and title().

◆ m_top_left_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_top_left_sizer
protected

◆ m_top_panel

wxPanel* Slic3r::GUI::Tab::m_top_panel
protected

Referenced by create_preset_tab().

◆ m_top_right_sizer

wxGridSizer* Slic3r::GUI::Tab::m_top_right_sizer
protected

◆ m_top_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_top_sizer
protected

Referenced by create_preset_tab(), and msw_rescale().

◆ m_tree_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_tree_sizer
protected

◆ m_tt_non_system

wxString* Slic3r::GUI::Tab::m_tt_non_system
protected

◆ m_tt_value_lock

wxString Slic3r::GUI::Tab::m_tt_value_lock
protected

Referenced by decorate().

◆ m_tt_value_revert

wxString Slic3r::GUI::Tab::m_tt_value_revert
protected

Referenced by decorate(), and set_tooltips_text().

◆ m_tt_value_unlock

wxString Slic3r::GUI::Tab::m_tt_value_unlock
protected

◆ m_tt_white_bullet

wxString Slic3r::GUI::Tab::m_tt_white_bullet
protected

◆ m_ttg_non_system

wxString* Slic3r::GUI::Tab::m_ttg_non_system
protected

◆ m_ttg_value_lock

wxString Slic3r::GUI::Tab::m_ttg_value_lock
protected

◆ m_ttg_value_revert

wxString Slic3r::GUI::Tab::m_ttg_value_revert
protected

◆ m_ttg_value_unlock

wxString Slic3r::GUI::Tab::m_ttg_value_unlock
protected

◆ m_ttg_white_bullet

wxString Slic3r::GUI::Tab::m_ttg_white_bullet
protected

Referenced by update_undo_buttons().

◆ m_ttg_white_bullet_ns

wxString Slic3r::GUI::Tab::m_ttg_white_bullet_ns
protected

◆ m_type

◆ m_undo_btn

ScalableButton* Slic3r::GUI::Tab::m_undo_btn
protected

◆ m_undo_to_sys_btn

ScalableButton* Slic3r::GUI::Tab::m_undo_to_sys_btn
protected

Referenced by create_preset_tab().

◆ m_update_cnt

◆ m_variant_combo

◆ m_variant_sizer

wxSizer* Slic3r::GUI::Tab::m_variant_sizer = nullptr

◆ validate_custom_gcodes_was_shown

bool Slic3r::GUI::Tab::validate_custom_gcodes_was_shown { false }

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