Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GUI::Tab Class Referenceabstract

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

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

Classes

struct  PresetDependencies
 

Public Member Functions

 Tab (wxBookCtrlBase *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)
 
virtual void load_current_preset ()
 
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 may_discard_current_dirty_preset (PresetCollection *presets=nullptr, const std::string &new_printer_name="")
 
virtual void clear_pages ()
 
virtual void update_description_lines ()
 
virtual void activate_selected_page (std::function< void()> throw_if_canceled)
 
void OnTreeSelChange (wxTreeEvent &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)
 
void rename_preset ()
 
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 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 ()
 
void emplace_option (const std::string &opt_key, bool respect_vec_values=false)
 
void load_initial_data ()
 
void update_dirty ()
 
void update_tab_ui ()
 
void load_config (const DynamicPrintConfig &config)
 
virtual void reload_config ()
 
void update_mode ()
 
void update_mode_markers ()
 
void update_visibility ()
 
virtual void msw_rescale ()
 
virtual void sys_color_changed ()
 
Fieldget_field (const t_config_option_key &opt_key, int opt_index=-1) const
 
Lineget_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)
 
Fieldget_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)
 
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 ()
 
DynamicPrintConfigget_config ()
 
PresetCollectionget_presets ()
 
const PresetCollectionget_presets () const
 
void on_value_change (const std::string &opt_key, const boost::any &value)
 
void update_wiping_button_visibility ()
 
void activate_option (const std::string &opt_key, const wxString &category)
 
void cache_config_diff (const std::vector< std::string > &selected_options, const DynamicPrintConfig *config=nullptr)
 
void apply_config_from_cache ()
 
const std::map< wxString, std::string > & get_category_icon_map ()
 
bool validate_custom_gcodes ()
 

Static Public Member Functions

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

Public Attributes

PresetBundlem_preset_bundle
 
bool m_show_btn_incompatible_presets = false
 
PresetCollectionm_presets
 
DynamicPrintConfigm_config
 
ogStaticTextm_parent_preset_description_line = nullptr
 
ScalableButtonm_detach_preset_btn = nullptr
 
int m_update_cnt = 0
 
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 tree_sel_change_delayed ()
 
void on_presets_changed ()
 
void build_preset_description_line (ConfigOptionsGroup *optgroup)
 
void update_preset_description_line ()
 
void update_frequently_changed_parameters ()
 
void fill_icon_descriptions ()
 
void set_tooltips_text ()
 
virtual bool select_preset_by_name (const std::string &name_w_suffix, bool force)
 
virtual bool save_current_preset (const std::string &new_name, bool detach)
 
virtual bool delete_current_preset ()
 
ConfigManipulation get_config_manipulation ()
 

Protected Attributes

Preset::Type m_type
 
std::string m_name
 
const wxString m_title
 
TabPresetComboBoxm_presets_choice
 
ScalableButtonm_search_btn
 
ScalableButtonm_btn_compare_preset
 
ScalableButtonm_btn_save_preset
 
ScalableButtonm_btn_rename_preset
 
ScalableButtonm_btn_delete_preset
 
ScalableButtonm_btn_edit_ph_printer {nullptr}
 
ScalableButtonm_btn_hide_incompatible_presets
 
wxBoxSizer * m_top_hsizer
 
wxBoxSizer * m_hsizer
 
wxBoxSizer * m_h_buttons_sizer
 
wxBoxSizer * m_left_sizer
 
wxTreeCtrl * m_treectrl
 
wxScrolledWindow * m_page_view {nullptr}
 
wxBoxSizer * m_page_sizer {nullptr}
 
ModeSizerm_mode_sizer {nullptr}
 
PresetDependencies m_compatible_printers
 
PresetDependencies m_compatible_prints
 
bool m_is_default_preset {false}
 
ScalableButtonm_undo_btn
 
ScalableButtonm_undo_to_sys_btn
 
ScalableButtonm_question_btn
 
ScalableBitmap m_bmp_value_lock
 
ScalableBitmap m_bmp_value_unlock
 
ScalableBitmap m_bmp_white_bullet
 
ScalableBitmapm_bmp_non_system
 
ScalableBitmap m_bmp_value_revert
 
std::vector< ScalableButton * > m_scaled_buttons = {}
 
std::vector< ScalableBitmap * > m_scaled_bitmaps = {}
 
std::vector< ScalableBitmapm_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< PageShpm_pages
 
Pagem_active_page {nullptr}
 
bool m_disable_tree_sel_changed_event {false}
 
bool m_show_incompatible_presets
 
std::vector< Preset::Typem_dependent_tabs
 
std::map< std::string, int > m_options_list
 
int m_opt_status_value = 0
 
std::vector< GUI_Descriptions::ButtonEntrym_icon_descriptions = {}
 
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 = comExpert
 
HighlighterForWx m_highlighter
 
DynamicPrintConfig m_cache_config
 
bool m_page_switch_running = false
 
bool m_page_switch_planned = false
 
ConfigManipulation m_config_manipulation
 

Private Attributes

wxBookCtrlBase * m_parent
 

Detailed Description


Class Documentation

◆ Slic3r::GUI::Tab::PresetDependencies

struct Slic3r::GUI::Tab::PresetDependencies
+ Collaboration diagram for Slic3r::GUI::Tab::PresetDependencies:
Class Members
ScalableButton * btn = nullptr
wxCheckBox * checkbox = nullptr
wxString dialog_label
wxString dialog_title
string key_condition
string key_list
Type type = Preset::TYPE_INVALID

Member Enumeration Documentation

◆ OptStatus

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

Constructor & Destructor Documentation

◆ Tab()

Slic3r::GUI::Tab::Tab ( wxBookCtrlBase *  parent,
const wxString &  title,
Preset::Type  type 
)
58 :
60{
61 Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL/*, name*/);
62 this->SetFont(Slic3r::GUI::wxGetApp().normal_font());
63
64 wxGetApp().UpdateDarkUI(this);
65
67 m_compatible_printers.key_list = "compatible_printers";
68 m_compatible_printers.key_condition = "compatible_printers_condition";
69 m_compatible_printers.dialog_title = _L("Compatible printers");
70 m_compatible_printers.dialog_label = _L("Select the printers this profile is compatible with.");
71
73 m_compatible_prints.key_list = "compatible_prints";
74 m_compatible_prints.key_condition = "compatible_prints_condition";
75 m_compatible_prints.dialog_title = _L("Compatible print profiles");
76 m_compatible_prints.dialog_label = _L("Select the print profiles this profile is compatible with.");
77
78 wxGetApp().tabs_list.push_back(this);
79
80 m_em_unit = em_unit(m_parent); //wxGetApp().em_unit();
81
83
84 Bind(wxEVT_SIZE, ([](wxSizeEvent &evt) {
85 //for (auto page : m_pages)
86 // if (! page.get()->IsShown())
87 // page->layout_valid = false;
88 evt.Skip();
89 }));
90
92}
void set_timer_owner(wxWindow *owner, int timerid=wxID_ANY)
Definition wxExtensions.cpp:930
wxBookCtrlBase * m_parent
Definition Tab.hpp:158
wxString dialog_title
Definition Tab.hpp:192
wxWindow * parent() const
Definition Tab.hpp:297
std::string key_list
Definition Tab.hpp:190
ConfigManipulation get_config_manipulation()
Definition Tab.cpp:5291
const wxString m_title
Definition Tab.hpp:166
std::string key_condition
Definition Tab.hpp:191
PresetDependencies m_compatible_printers
Definition Tab.hpp:195
PresetDependencies m_compatible_prints
Definition Tab.hpp:196
wxString dialog_label
Definition Tab.hpp:193
Preset::Type type() const
Definition Tab.hpp:300
Preset::Type m_type
Definition Tab.hpp:164
wxString title() const
Definition Tab.hpp:298
int m_em_unit
Definition Tab.hpp:266
HighlighterForWx m_highlighter
Definition Tab.hpp:271
Preset::Type type
Definition Tab.hpp:187
ConfigManipulation m_config_manipulation
Definition Tab.hpp:411
@ TYPE_PRINTER
Definition Preset.hpp:116
@ TYPE_PRINT
Definition Preset.hpp:112
#define _L(s)
Definition I18N.hpp:3
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:388

References _L, Slic3r::GUI::Tab::PresetDependencies::dialog_label, Slic3r::GUI::Tab::PresetDependencies::dialog_title, em_unit(), get_config_manipulation(), Slic3r::GUI::Tab::PresetDependencies::key_condition, Slic3r::GUI::Tab::PresetDependencies::key_list, m_compatible_printers, m_compatible_prints, m_config_manipulation, m_em_unit, m_highlighter, m_parent, parent(), Slic3r::GUI::Highlighter::set_timer_owner(), Slic3r::GUI::Tab::PresetDependencies::type, Slic3r::Preset::TYPE_PRINT, and Slic3r::Preset::TYPE_PRINTER.

+ Here is the call graph for this function:

◆ ~Tab()

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

Member Function Documentation

◆ activate_option()

void Slic3r::GUI::Tab::activate_option ( const std::string &  opt_key,
const wxString &  category 
)
1142{
1143 wxString page_title = translate_category(category, m_type);
1144
1145 auto cur_item = m_treectrl->GetFirstVisibleItem();
1146 if (!cur_item)
1147 return;
1148
1149 // We should to activate a tab with searched option, if it doesn't.
1150 // And do it before finding of the cur_item to avoid a case when Tab isn't activated jet and all treeItems are invisible
1151 wxGetApp().mainframe->select_tab(this);
1152
1153 while (cur_item) {
1154 auto title = m_treectrl->GetItemText(cur_item);
1155 if (page_title != title) {
1156 cur_item = m_treectrl->GetNextVisible(cur_item);
1157 continue;
1158 }
1159
1160 m_treectrl->SelectItem(cur_item);
1161 break;
1162 }
1163
1164 auto set_focus = [](wxWindow* win) {
1165 win->SetFocus();
1166#ifdef WIN32
1167 if (wxTextCtrl* text = dynamic_cast<wxTextCtrl*>(win))
1168 text->SetSelection(-1, -1);
1169 else if (wxSpinCtrl* spin = dynamic_cast<wxSpinCtrl*>(win))
1170 spin->SetSelection(-1, -1);
1171#endif // WIN32
1172 };
1173
1174 Field* field = get_field(opt_key);
1175
1176 // focused selected field
1177 if (field)
1178 set_focus(field->getWindow());
1179 else if (category == "Single extruder MM setup") {
1180 // When we show and hide "Single extruder MM setup" page,
1181 // related options are still in the search list
1182 // So, let's hightlighte a "single_extruder_multi_material" option,
1183 // as a "way" to show hidden page again
1184 field = get_field("single_extruder_multi_material");
1185 if (field)
1186 set_focus(field->getWindow());
1187 }
1188
1190}
void init(BlinkingBitmap *blinking_bitmap)
Definition wxExtensions.cpp:981
static wxString translate_category(const wxString &title, Preset::Type preset_type)
Definition Tab.cpp:417
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:995
wxTreeCtrl * m_treectrl
Definition Tab.hpp:179
Field * get_field(const t_config_option_key &opt_key, int opt_index=-1) const
Definition Tab.cpp:985

References Slic3r::GUI::Field::getWindow().

+ Here is the call 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.

3795{
3796 if (!m_active_page)
3797 return;
3798
3799 m_active_page->activate(m_mode, throw_if_canceled);
3800
3801 if (m_active_page->title() == "Dependencies") {
3806 }
3807
3811}
void activate(ConfigOptionMode mode, std::function< void()> throw_if_canceled)
Definition Tab.cpp:4855
const wxString & title() const
Definition Tab.hpp:120
ConfigOptionMode m_mode
Definition Tab.hpp:269
virtual void toggle_options()=0
void compatible_widget_reload(PresetDependencies &deps)
Definition Tab.cpp:4741
wxCheckBox * checkbox
Definition Tab.hpp:188
Page * m_active_page
Definition Tab.hpp:249
virtual void update_description_lines()
Definition Tab.cpp:3788
void update_changed_ui()
Definition Tab.cpp:611

◆ add_options_page()

Slic3r::GUI::PageShp Slic3r::GUI::Tab::add_options_page ( const wxString &  title,
const std::string &  icon,
bool  is_extruder_pages = false 
)
383{
384 // Index of icon in an icon list $self->{icons}.
385 auto icon_idx = 0;
386 if (!icon.empty()) {
387 icon_idx = (m_icon_index.find(icon) == m_icon_index.end()) ? -1 : m_icon_index.at(icon);
388 if (icon_idx == -1) {
389 // Add a new icon to the icon list.
390 m_scaled_icons_list.push_back(ScalableBitmap(this, icon));
391 icon_idx = ++m_icon_count;
392 m_icon_index[icon] = icon_idx;
393 }
394
395 if (m_category_icon.find(title) == m_category_icon.end()) {
396 // Add new category to the category_to_icon list.
397 m_category_icon[title] = icon;
398 }
399 }
400 // Initialize the page.
401 PageShp page(new Page(m_page_view, title, icon_idx));
402// page->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
403#ifdef __WINDOWS__
404// page->SetDoubleBuffered(true);
405#endif //__WINDOWS__
406
407 if (!is_extruder_pages)
408 m_pages.push_back(page);
409
410 page->set_config(m_config);
411 return page;
412}
Definition wxExtensions.hpp:136
DynamicPrintConfig * m_config
Definition Tab.hpp:283
int m_icon_count
Definition Tab.hpp:245
wxScrolledWindow * m_page_view
Definition Tab.hpp:181
std::map< wxString, std::string > m_category_icon
Definition Tab.hpp:247
std::vector< ScalableBitmap > m_scaled_icons_list
Definition Tab.hpp:219
std::vector< PageShp > m_pages
Definition Tab.hpp:248
std::map< std::string, size_t > m_icon_index
Definition Tab.hpp:246
std::shared_ptr< Page > PageShp
Definition Tab.hpp:155

Referenced by Slic3r::GUI::TabSLAMaterial::build(), and Slic3r::GUI::TabSLAPrint::build().

+ 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 
)
368{
369 bmp = ScalableBitmap(parent, icon_name);
370 m_scaled_bitmaps.push_back(&bmp);
371}
std::vector< ScalableBitmap * > m_scaled_bitmaps
Definition Tab.hpp:218

Referenced by create_preset_tab().

+ 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 
)
360{
361 *btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, style);
362 m_scaled_buttons.push_back(*btn);
363}
#define style
Definition WipeTowerDialog.cpp:68
Definition wxExtensions.hpp:217
std::vector< ScalableButton * > m_scaled_buttons
Definition Tab.hpp:217

References style.

Referenced by create_preset_tab().

+ Here is the caller graph for this function:

◆ apply_config_from_cache()

void Slic3r::GUI::Tab::apply_config_from_cache ( )
1198{
1199 bool was_applied = false;
1200 // check and apply extruders count for printer preset
1202 was_applied = static_cast<TabPrinter*>(this)->apply_extruder_cnt_from_cache();
1203
1204 if (!m_cache_config.empty()) {
1207
1208 was_applied = true;
1209 }
1210
1211 if (was_applied)
1212 update_dirty();
1213}
void apply(const ConfigBase &other, bool ignore_nonexistent=false)
Definition Config.hpp:2209
void clear()
Definition Config.hpp:2400
bool empty() const
Definition Config.hpp:2426
PresetCollection * m_presets
Definition Tab.hpp:282
DynamicPrintConfig m_cache_config
Definition Tab.hpp:273
void update_dirty()
Definition Tab.cpp:856
Preset & get_edited_preset()
Definition Preset.hpp:379
DynamicPrintConfig config
Definition Preset.hpp:159

References Slic3r::Preset::TYPE_PRINTER.

Referenced by on_presets_changed().

+ Here is the caller graph for this function:

◆ build()

◆ build_preset_description_line()

void Slic3r::GUI::Tab::build_preset_description_line ( ConfigOptionsGroup optgroup)
protected
1249{
1250 auto description_line = [this](wxWindow* parent) {
1252 };
1253
1254 auto detach_preset_btn = [this](wxWindow* parent) {
1255 m_detach_preset_btn = new ScalableButton(parent, wxID_ANY, "lock_open_sys", _L("Detach from system preset"),
1256 wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT);
1258 btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
1259
1260 auto sizer = new wxBoxSizer(wxHORIZONTAL);
1261 sizer->Add(btn);
1262
1263 btn->Bind(wxEVT_BUTTON, [this, parent](wxCommandEvent&)
1264 {
1265 bool system = m_presets->get_edited_preset().is_system;
1266 bool dirty = m_presets->get_edited_preset().is_dirty;
1267 wxString msg_text = system ?
1268 _(L("A copy of the current system preset will be created, which will be detached from the system preset.")) :
1269 _(L("The current custom preset will be detached from the parent system preset."));
1270 if (dirty) {
1271 msg_text += "\n\n";
1272 msg_text += _(L("Modifications to the current profile will be saved."));
1273 }
1274 msg_text += "\n\n";
1275 msg_text += _(L("This action is not revertible.\nDo you want to proceed?"));
1276
1277 //wxMessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL);
1278 MessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL);
1279 if (dialog.ShowModal() == wxID_YES)
1280 save_preset(m_presets->get_edited_preset().is_system ? std::string() : m_presets->get_edited_preset().name, true);
1281 });
1282
1283 btn->Hide();
1284
1285 return sizer;
1286 };
1287
1288 Line line = Line{ "", "" };
1289 line.full_width = 1;
1290
1291 line.append_widget(description_line);
1292 line.append_widget(detach_preset_btn);
1293 optgroup->append_line(line);
1294}
wxSizer * description_line_widget(wxWindow *parent, ogStaticText **StaticText, wxString text=wxEmptyString)
Definition Tab.cpp:2325
void save_preset(std::string name=std::string(), bool detach=false)
Definition Tab.cpp:3949
ogStaticText * m_parent_preset_description_line
Definition Tab.hpp:284
std::string name() const
Definition Tab.hpp:299
ScalableButton * m_detach_preset_btn
Definition Tab.hpp:285
bool is_system
Definition Preset.hpp:134
#define _(msgid)
Definition getopt.c:87
#define L(s)
Definition I18N.hpp:18
#define wxEVT_BUTTON
Definition wxinit.h:18

References _, _L, Slic3r::GUI::OptionsGroup::append_line(), Slic3r::GUI::Line::append_widget(), Slic3r::GUI::Line::full_width, L, and wxEVT_BUTTON.

Referenced by Slic3r::GUI::TabSLAMaterial::build(), and Slic3r::GUI::TabSLAPrint::build().

+ 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 
)
1193{
1194 m_cache_config.apply_only(config ? *config : m_presets->get_edited_preset().config, selected_options);
1195}
void apply_only(const ConfigBase &other, const t_config_option_keys &keys, bool ignore_nonexistent=false)
Definition Config.cpp:466

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

+ Here is the caller graph for this function:

◆ clear_pages()

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

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

3769{
3770 // invalidated highlighter, if any exists
3772 m_page_sizer->Clear(true);
3773 // clear pages from the controlls
3774 for (auto p : m_pages)
3775 p->clear();
3776
3777 // nulling pointers
3779 m_detach_preset_btn = nullptr;
3780
3782 m_compatible_printers.btn = nullptr;
3783
3784 m_compatible_prints.checkbox = nullptr;
3785 m_compatible_prints.btn = nullptr;
3786}
void invalidate()
Definition wxExtensions.cpp:991
wxBoxSizer * m_page_sizer
Definition Tab.hpp:182
ScalableButton * btn
Definition Tab.hpp:189

Referenced by Slic3r::GUI::TabSLAPrint::clear_pages().

+ Here is the caller graph for this function:

◆ compare_preset()

void Slic3r::GUI::Tab::compare_preset ( )
3914{
3915 wxGetApp().mainframe->diff_dialog.show(m_type);
3916}

◆ compatible_widget_create()

wxSizer * Slic3r::GUI::Tab::compatible_widget_create ( wxWindow *  parent,
PresetDependencies deps 
)
protected
4261{
4262 deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
4263 deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
4264 wxGetApp().UpdateDarkUI(deps.checkbox, false, true);
4265 deps.btn = new ScalableButton(parent, wxID_ANY, "printer", format_wxstr(" %s %s", _L("Set"), dots),
4266 wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT);
4267 deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
4268 deps.btn->SetSize(deps.btn->GetBestSize());
4269
4270 auto sizer = new wxBoxSizer(wxHORIZONTAL);
4271 sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL);
4272 sizer->Add((deps.btn), 0, wxALIGN_CENTER_VERTICAL);
4273
4274 deps.checkbox->Bind(wxEVT_CHECKBOX, ([this, &deps](wxCommandEvent e)
4275 {
4276 deps.btn->Enable(! deps.checkbox->GetValue());
4277 // All printers have been made compatible with this preset.
4278 if (deps.checkbox->GetValue())
4279 this->load_key_value(deps.key_list, std::vector<std::string> {});
4280 this->get_field(deps.key_condition)->toggle(deps.checkbox->GetValue());
4281 this->update_changed_ui();
4282 }) );
4283
4284 deps.btn->Bind(wxEVT_BUTTON, ([this, parent, &deps](wxCommandEvent e)
4285 {
4286 // Collect names of non-default non-external profiles.
4288 PresetCollection &depending_presets = (deps.type == Preset::TYPE_PRINTER) ? m_preset_bundle->printers :
4289 (printer_technology == ptFFF) ? m_preset_bundle->prints : m_preset_bundle->sla_prints;
4290 wxArrayString presets;
4291 for (size_t idx = 0; idx < depending_presets.size(); ++ idx)
4292 {
4293 Preset& preset = depending_presets.preset(idx);
4294 bool add = ! preset.is_default && ! preset.is_external;
4295 if (add && deps.type == Preset::TYPE_PRINTER)
4296 // Only add printers with the same technology as the active printer.
4297 add &= preset.printer_technology() == printer_technology;
4298 if (add)
4299 presets.Add(from_u8(preset.name));
4300 }
4301
4302 wxMultiChoiceDialog dlg(parent, deps.dialog_title, deps.dialog_label, presets);
4303 wxGetApp().UpdateDlgDarkUI(&dlg);
4304 // Collect and set indices of depending_presets marked as compatible.
4305 wxArrayInt selections;
4306 auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(m_config->option(deps.key_list));
4307 if (compatible_printers != nullptr || !compatible_printers->values.empty())
4308 for (auto preset_name : compatible_printers->values)
4309 for (size_t idx = 0; idx < presets.GetCount(); ++idx)
4310 if (presets[idx] == preset_name) {
4311 selections.Add(idx);
4312 break;
4313 }
4314 dlg.SetSelections(selections);
4315 std::vector<std::string> value;
4316 // Show the dialog.
4317 if (dlg.ShowModal() == wxID_OK) {
4318 selections.Clear();
4319 selections = dlg.GetSelections();
4320 for (auto idx : selections)
4321 value.push_back(presets[idx].ToUTF8().data());
4322 if (value.empty()) {
4323 deps.checkbox->SetValue(1);
4324 deps.btn->Disable();
4325 }
4326 // All depending_presets have been made compatible with this preset.
4327 this->load_key_value(deps.key_list, value);
4328 this->update_changed_ui();
4329 }
4330 }));
4331
4332 return sizer;
4333}
ConfigOption * option(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2169
void toggle(bool en)
Fires the enable or disable function, based on the input.
Definition Field.hpp:193
void load_key_value(const std::string &opt_key, const boost::any &value, bool saved_value=false)
Definition Tab.cpp:1036
PresetBundle * m_preset_bundle
Definition Tab.hpp:280
PrinterPresetCollection printers
Definition PresetBundle.hpp:52
static PrinterTechnology printer_technology(const DynamicPrintConfig &cfg)
Definition Preset.hpp:200
static PrinterTechnology printer_technology()
Definition GUI_Factories.cpp:30
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:42
wxString from_u8(const std::string &str)
Definition GUI.cpp:437
static wxString dots("…", wxConvUTF8)
PrinterTechnology
Definition Config.hpp:205
@ ptFFF
Definition Config.hpp:207
constexpr auto data(C &c) -> decltype(c.data())
Definition span.hpp:195

References _, _L, Slic3r::GUI::Tab::PresetDependencies::btn, Slic3r::GUI::Tab::PresetDependencies::checkbox, Slic3r::GUI::Tab::PresetDependencies::dialog_label, Slic3r::GUI::Tab::PresetDependencies::dialog_title, Slic3r::GUI::format_wxstr(), Slic3r::GUI::from_u8(), Slic3r::Preset::is_default, Slic3r::Preset::is_external, Slic3r::GUI::Tab::PresetDependencies::key_condition, Slic3r::GUI::Tab::PresetDependencies::key_list, L, Slic3r::Preset::name, Slic3r::PresetCollection::preset(), Slic3r::printer_technology(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, Slic3r::PresetCollection::size(), Slic3r::GUI::Tab::PresetDependencies::type, and wxEVT_BUTTON.

+ Here is the call graph for this function:

◆ compatible_widget_reload()

void Slic3r::GUI::Tab::compatible_widget_reload ( PresetDependencies deps)
protected
4742{
4743 Field* field = this->get_field(deps.key_condition);
4744 if (!field)
4745 return;
4746
4747 bool has_any = ! m_config->option<ConfigOptionStrings>(deps.key_list)->values.empty();
4748 has_any ? deps.btn->Enable() : deps.btn->Disable();
4749 deps.checkbox->SetValue(! has_any);
4750
4751 field->toggle(! has_any);
4752}

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

+ Here is the call graph for this function:

◆ completed()

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

References m_completed.

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

+ Here is the caller graph for this function:

◆ 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
4244{
4245 Line line = optgroup->create_single_option_line(opt_key);
4246 line.widget = widget;
4247 line.label_path = path;
4248
4249 // set default undo ui
4250 line.set_undo_bitmap(&m_bmp_white_bullet);
4251 line.set_undo_to_sys_bitmap(&m_bmp_white_bullet);
4252 line.set_undo_tooltip(&m_tt_white_bullet);
4253 line.set_undo_to_sys_tooltip(&m_tt_white_bullet);
4254 line.set_label_colour(&m_default_text_clr);
4255
4256 optgroup->append_line(line);
4257}
wxString m_tt_white_bullet
Definition Tab.hpp:242
wxColour m_default_text_clr
Definition Tab.hpp:224
ScalableBitmap m_bmp_white_bullet
Definition Tab.hpp:211

References Slic3r::GUI::OptionsGroup::append_line(), Slic3r::GUI::ConfigOptionsGroup::create_single_option_line(), Slic3r::GUI::Line::label_path, 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::TabSLAMaterial::build(), and Slic3r::GUI::TabSLAPrint::build().

+ 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 ( )
106{
107#ifdef __WINDOWS__
108 SetDoubleBuffered(true);
109#endif //__WINDOWS__
110
111 m_preset_bundle = wxGetApp().preset_bundle;
112
113 // Vertical sizer to hold the choice menu and the rest of the page.
114#ifdef __WXOSX__
115 auto *main_sizer = new wxBoxSizer(wxVERTICAL);
116 main_sizer->SetSizeHints(this);
117 this->SetSizer(main_sizer);
118
119 // Create additional panel to Fit() it from OnActivate()
120 // It's needed for tooltip showing on OSX
121 m_tmp_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
122 auto panel = m_tmp_panel;
123 auto sizer = new wxBoxSizer(wxVERTICAL);
124 m_tmp_panel->SetSizer(sizer);
125 m_tmp_panel->Layout();
126
127 main_sizer->Add(m_tmp_panel, 1, wxEXPAND | wxALL, 0);
128#else
129 Tab *panel = this;
130 auto *sizer = new wxBoxSizer(wxVERTICAL);
131 sizer->SetSizeHints(panel);
132 panel->SetSizer(sizer);
133#endif //__WXOSX__
134
135 // preset chooser
136 m_presets_choice = new TabPresetComboBox(panel, m_type);
137 m_presets_choice->set_selection_changed_function([this](int selection) {
139 {
140 if (m_type == Preset::TYPE_PRINTER && !m_presets_choice->is_selected_physical_printer())
141 m_preset_bundle->physical_printers.unselect_printer();
142
143 // select preset
144 std::string preset_name = m_presets_choice->GetString(selection).ToUTF8().data();
145 select_preset(Preset::remove_suffix_modified(preset_name));
146 }
147 });
148
149 auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
150
151 //buttons
152 m_scaled_buttons.reserve(6);
153 m_scaled_buttons.reserve(2);
154
155 add_scaled_button(panel, &m_btn_compare_preset, "compare");
156 add_scaled_button(panel, &m_btn_save_preset, "save");
157 add_scaled_button(panel, &m_btn_rename_preset, "edit");
158 add_scaled_button(panel, &m_btn_delete_preset, "cross");
161
163
165
166 //TRN Settings Tab: tooltip for toolbar button
167 m_btn_compare_preset->SetToolTip(_L("Compare preset with another"));
168 //TRN Settings Tab: tooltip for toolbar button
169 m_btn_save_preset ->SetToolTip(_L("Save preset"));
170 //TRN Settings Tab: tooltip for toolbar button
171 m_btn_rename_preset->SetToolTip(_L("Rename preset"));
172 m_btn_rename_preset->Hide();
173 //TRN Settings Tab: tooltip for toolbar button
174 m_btn_delete_preset->SetToolTip(_(L("Delete preset")));
175 m_btn_delete_preset->Hide();
176
177 add_scaled_button(panel, &m_question_btn, "question");
178 m_question_btn->SetToolTip(_(L("Hover the cursor over buttons to find more information \n"
179 "or click this button.")));
180
181 add_scaled_button(panel, &m_search_btn, "search");
182 m_search_btn->SetToolTip(format_wxstr(_L("Search in settings [%1%]"), "Ctrl+F"));
183
184 // Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
185 add_scaled_bitmap(this, m_bmp_value_lock , "lock_closed");
186 add_scaled_bitmap(this, m_bmp_value_unlock, "lock_open");
188 // Bitmaps to be shown on the "Undo user changes" button next to each input field.
191
194
197
198 m_undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(); }));
199 m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); }));
200 m_question_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) {
201 GUI_Descriptions::Dialog dlg(this, m_icon_descriptions);
202 if (dlg.ShowModal() == wxID_OK)
203 wxGetApp().update_label_colours();
204 });
205 m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent) { wxGetApp().plater()->search(false); });
206
207 // Colors for ui "decoration"
208 m_sys_label_clr = wxGetApp().get_label_clr_sys();
209 m_modified_label_clr = wxGetApp().get_label_clr_modified();
210 m_default_text_clr = wxGetApp().get_label_clr_default();
211
212#ifdef _MSW_DARK_MODE
213 // Sizer with buttons for mode changing
214 if (wxGetApp().tabs_as_menu())
215#endif
216 m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this)));
217
218 const float scale_factor = em_unit(this)*0.1;// GetContentScaleFactor();
219 m_top_hsizer = new wxBoxSizer(wxHORIZONTAL);
220 sizer->Add(m_top_hsizer, 0, wxEXPAND | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 3);
221 m_top_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
222 m_top_hsizer->AddSpacer(int(4*scale_factor));
223
224 m_h_buttons_sizer = new wxBoxSizer(wxHORIZONTAL);
225 m_h_buttons_sizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL);
226 m_h_buttons_sizer->AddSpacer(int(4*scale_factor));
227 m_h_buttons_sizer->Add(m_btn_rename_preset, 0, wxALIGN_CENTER_VERTICAL);
228 m_h_buttons_sizer->AddSpacer(int(4 * scale_factor));
229 m_h_buttons_sizer->Add(m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL);
231 m_h_buttons_sizer->AddSpacer(int(4 * scale_factor));
232 m_h_buttons_sizer->Add(m_btn_edit_ph_printer, 0, wxALIGN_CENTER_VERTICAL);
233 }
234 m_h_buttons_sizer->AddSpacer(int(/*16*/8 * scale_factor));
235 m_h_buttons_sizer->Add(m_btn_hide_incompatible_presets, 0, wxALIGN_CENTER_VERTICAL);
236 m_h_buttons_sizer->AddSpacer(int(8 * scale_factor));
237 m_h_buttons_sizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL);
238 m_h_buttons_sizer->AddSpacer(int(32 * scale_factor));
239 m_h_buttons_sizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
240 m_h_buttons_sizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL);
241 m_h_buttons_sizer->AddSpacer(int(32 * scale_factor));
242 m_h_buttons_sizer->Add(m_search_btn, 0, wxALIGN_CENTER_VERTICAL);
243 m_h_buttons_sizer->AddSpacer(int(8*scale_factor));
244 m_h_buttons_sizer->Add(m_btn_compare_preset, 0, wxALIGN_CENTER_VERTICAL);
245
246 m_top_hsizer->Add(m_h_buttons_sizer, 1, wxEXPAND | wxALIGN_CENTRE_VERTICAL);
247 m_top_hsizer->AddSpacer(int(16*scale_factor));
248 // StretchSpacer has a strange behavior under OSX, so
249 // There is used just additional sizer for m_mode_sizer with right alignment
250 if (m_mode_sizer) {
251 auto mode_sizer = new wxBoxSizer(wxVERTICAL);
252 // Don't set the 2nd parameter to 1, making the sizer rubbery scalable in Y axis may lead
253 // to wrong vertical size assigned to wxBitmapComboBoxes, see GH issue #7176.
254 mode_sizer->Add(m_mode_sizer, 0, wxALIGN_RIGHT);
255 m_top_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10);
256 }
257 // hide whole top sizer to correct layout later
258 m_top_hsizer->ShowItems(false);
259
260 //Horizontal sizer to hold the tree and the selected page.
261 m_hsizer = new wxBoxSizer(wxHORIZONTAL);
262 sizer->Add(m_hsizer, 1, wxEXPAND, 0);
263
264 //left vertical sizer
265 m_left_sizer = new wxBoxSizer(wxVERTICAL);
266 m_hsizer->Add(m_left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3);
267
268 // tree
269 m_treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(20 * m_em_unit, -1),
270 wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS);
271 m_treectrl->SetFont(wxGetApp().normal_font());
272 m_left_sizer->Add(m_treectrl, 1, wxEXPAND);
273 // Index of the last icon inserted into m_treectrl
274 m_icon_count = -1;
275 m_treectrl->AddRoot("root");
276 m_treectrl->SetIndent(0);
277 wxGetApp().UpdateDarkUI(m_treectrl);
278
279 // Delay processing of the following handler until the message queue is flushed.
280 // This helps to process all the cursor key events on Windows in the tree control,
281 // so that the cursor jumps to the last item.
282 m_treectrl->Bind(wxEVT_TREE_SEL_CHANGED, [this](wxTreeEvent&) {
283#ifdef __linux__
284 // Events queue is opposite On Linux. wxEVT_SET_FOCUS invokes after wxEVT_TREE_SEL_CHANGED,
285 // and a result wxEVT_KILL_FOCUS doesn't invoke for the TextCtrls.
286 // see https://github.com/prusa3d/PrusaSlicer/issues/5720
287 // So, call SetFocus explicitly for this control before changing of the selection
288 m_treectrl->SetFocus();
289#endif
290 if (!m_disable_tree_sel_changed_event && !m_pages.empty()) {
291 if (m_page_switch_running)
292 m_page_switch_planned = true;
293 else {
294 m_page_switch_running = true;
295 do {
296 m_page_switch_planned = false;
297 m_treectrl->Update();
298 } while (this->tree_sel_change_delayed());
299 m_page_switch_running = false;
300 }
301 }
302 });
303
304 m_treectrl->Bind(wxEVT_KEY_DOWN, &Tab::OnKeyDown, this);
305
306 // Initialize the page.
307#ifdef __WXOSX__
308 auto page_parent = m_tmp_panel;
309#else
310 auto page_parent = this;
311#endif
312
313 m_page_view = new wxScrolledWindow(page_parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
314 m_page_sizer = new wxBoxSizer(wxVERTICAL);
315 m_page_view->SetSizer(m_page_sizer);
316 m_page_view->SetScrollbars(1, 20, 1, 2);
317 m_hsizer->Add(m_page_view, 1, wxEXPAND | wxLEFT, 5);
318
319 m_btn_compare_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { compare_preset(); }));
320 m_btn_save_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { save_preset(); }));
321 m_btn_rename_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { rename_preset(); }));
322 m_btn_delete_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { delete_preset(); }));
323 m_btn_hide_incompatible_presets->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) {
325 }));
326
328 m_btn_edit_ph_printer->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) {
331 else
333 });
334
335 // Initialize the DynamicPrintConfig by default keys/values.
336 build();
337
338 if (!m_scaled_icons_list.empty()) {
339 // update icons for tree_ctrl
340 wxVector<wxBitmapBundle> img_bundles;
341 for (const ScalableBitmap& bmp : m_scaled_icons_list)
342 img_bundles.push_back(bmp.bmp());
343 m_treectrl->SetImages(img_bundles);
344 }
345
346 // ys_FIXME: Following should not be needed, the function will be called later
347 // (update_mode->update_visibility->rebuild_page_tree). This does not work, during the
348 // second call of rebuild_page_tree m_treectrl->GetFirstVisibleItem(); returns zero
349 // for some unknown reason (and the page is not refreshed until user does a selection).
351
352 m_completed = true;
353}
#define wxOSX
Definition Field.cpp:26
Definition wxExtensions.hpp:319
const std::string & name() const
Definition wxExtensions.hpp:151
bool selection_is_changed_according_to_physical_printers()
Definition PresetComboBoxes.cpp:555
void set_selection_changed_function(std::function< void(int)> sel_changed)
Definition PresetComboBoxes.hpp:54
void edit_physical_printer()
Definition PresetComboBoxes.cpp:362
void add_physical_printer()
Definition PresetComboBoxes.cpp:372
TabPresetComboBox * m_presets_choice
Definition Tab.hpp:167
ScalableButton * m_undo_to_sys_btn
Definition Tab.hpp:205
ScalableButton * m_btn_delete_preset
Definition Tab.hpp:172
ScalableButton * m_undo_btn
Definition Tab.hpp:204
wxColour m_modified_label_clr
Definition Tab.hpp:223
ScalableButton * m_btn_compare_preset
Definition Tab.hpp:169
ScalableButton * m_btn_hide_incompatible_presets
Definition Tab.hpp:174
bool m_show_incompatible_presets
Definition Tab.hpp:251
void add_scaled_bitmap(wxWindow *parent, ScalableBitmap &btn, const std::string &icon_name)
Definition Tab.cpp:365
wxBoxSizer * m_top_hsizer
Definition Tab.hpp:175
wxBoxSizer * m_hsizer
Definition Tab.hpp:176
ScalableButton * m_btn_rename_preset
Definition Tab.hpp:171
void rebuild_page_tree()
Definition Tab.cpp:3473
ScalableButton * m_btn_save_preset
Definition Tab.hpp:170
void fill_icon_descriptions()
Definition Tab.cpp:4754
Tab(wxBookCtrlBase *parent, const wxString &title, Preset::Type type)
Definition Tab.cpp:58
void OnKeyDown(wxKeyEvent &event)
Definition Tab.cpp:3905
ScalableButton * m_search_btn
Definition Tab.hpp:168
ScalableBitmap m_bmp_value_lock
Definition Tab.hpp:209
ScalableBitmap * m_bmp_non_system
Definition Tab.hpp:213
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:355
ScalableButton * m_btn_edit_ph_printer
Definition Tab.hpp:173
ModeSizer * m_mode_sizer
Definition Tab.hpp:184
void rename_preset()
Definition Tab.cpp:4050
wxColour m_sys_label_clr
Definition Tab.hpp:222
ScalableBitmap m_bmp_value_unlock
Definition Tab.hpp:210
std::vector< GUI_Descriptions::ButtonEntry > m_icon_descriptions
Definition Tab.hpp:258
ScalableBitmap m_bmp_value_revert
Definition Tab.hpp:215
bool m_disable_tree_sel_changed_event
Definition Tab.hpp:250
void compare_preset()
Definition Tab.cpp:3913
virtual void build()=0
void delete_preset()
Definition Tab.cpp:4124
void toggle_show_hide_incompatible()
Definition Tab.cpp:4207
wxBoxSizer * m_left_sizer
Definition Tab.hpp:178
void set_tooltips_text()
Definition Tab.cpp:4780
ScalableButton * m_question_btn
Definition Tab.hpp:206
void on_roll_back_value(const bool to_sys=false)
Definition Tab.cpp:790
wxBoxSizer * m_h_buttons_sizer
Definition Tab.hpp:177
bool has_selection() const
Definition Preset.cpp:2090
PhysicalPrinterCollection physical_printers
Definition PresetBundle.hpp:53

References _, _L, add_scaled_bitmap(), add_scaled_button(), em_unit(), fill_icon_descriptions(), Slic3r::GUI::format_wxstr(), L, m_bmp_non_system, m_bmp_value_lock, m_bmp_value_revert, m_bmp_value_unlock, m_bmp_white_bullet, m_btn_compare_preset, m_btn_delete_preset, m_btn_edit_ph_printer, m_btn_hide_incompatible_presets, m_btn_rename_preset, m_btn_save_preset, m_default_text_clr, m_disable_tree_sel_changed_event, m_em_unit, m_h_buttons_sizer, m_hsizer, m_icon_count, m_icon_descriptions, m_left_sizer, m_mode_sizer, m_modified_label_clr, m_pages, m_preset_bundle, m_presets_choice, m_question_btn, m_scaled_buttons, m_search_btn, m_show_incompatible_presets, m_sys_label_clr, m_top_hsizer, m_treectrl, m_type, m_undo_btn, m_undo_to_sys_btn, ScalableBitmap::name(), on_roll_back_value(), Slic3r::GUI::PresetComboBox::selection_is_changed_according_to_physical_printers(), Slic3r::GUI::PresetComboBox::set_selection_changed_function(), set_tooltips_text(), Slic3r::Preset::TYPE_PRINTER, wxEVT_BUTTON, and wxOSX.

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
2339{ return m_presets->current_is_dirty(); }
bool current_is_dirty() const
Definition Preset.hpp:476

◆ decorate()

void Slic3r::GUI::Tab::decorate ( )
542{
543 for (const auto& opt : m_options_list)
544 {
545 Field* field = nullptr;
546 bool option_without_field = false;
547
549 option_without_field = true;
550
551 if (!option_without_field) {
552 field = get_field(opt.first);
553 if (!field)
554 continue;
555 }
556
557 bool is_nonsys_value = false;
558 bool is_modified_value = true;
559 const ScalableBitmap* sys_icon = &m_bmp_value_lock;
560 const ScalableBitmap* icon = &m_bmp_value_revert;
561
562 const wxColour* color = m_is_default_preset ? &m_default_text_clr : &m_sys_label_clr;
563
564 const wxString* sys_tt = &m_tt_value_lock;
565 const wxString* tt = &m_tt_value_revert;
566
567 // value isn't equal to system value
568 if ((opt.second & osSystemValue) == 0) {
569 is_nonsys_value = true;
570 sys_icon = m_bmp_non_system;
571 sys_tt = m_tt_non_system;
572 // value is equal to last saved
573 if ((opt.second & osInitValue) != 0)
574 color = &m_default_text_clr;
575 // value is modified
576 else
577 color = &m_modified_label_clr;
578 }
579 if ((opt.second & osInitValue) != 0)
580 {
581 is_modified_value = false;
582 icon = &m_bmp_white_bullet;
583 tt = &m_tt_white_bullet;
584 }
585
586 if (option_without_field) {
587 if (Line* line = get_line(opt.first)) {
588 line->set_undo_bitmap(icon);
589 line->set_undo_to_sys_bitmap(sys_icon);
590 line->set_undo_tooltip(tt);
591 line->set_undo_to_sys_tooltip(sys_tt);
592 line->set_label_colour(color);
593 }
594 continue;
595 }
596
597 field->m_is_nonsys_value = is_nonsys_value;
598 field->m_is_modified_value = is_modified_value;
599 field->set_undo_bitmap(icon);
600 field->set_undo_to_sys_bitmap(sys_icon);
601 field->set_undo_tooltip(tt);
602 field->set_undo_to_sys_tooltip(sys_tt);
603 field->set_label_colour(color);
604 }
605
606 if (m_active_page)
608}
static bool is_option_without_field(const std::string &opt_key)
Definition OptionsGroup.cpp:1025
void refresh()
Definition Tab.cpp:4885
std::map< std::string, int > m_options_list
Definition Tab.hpp:255
wxString * m_tt_non_system
Definition Tab.hpp:240
bool m_is_default_preset
Definition Tab.hpp:202
Line * get_line(const t_config_option_key &opt_key)
Definition Tab.cpp:990
wxString m_tt_value_revert
Definition Tab.hpp:243
wxString m_tt_value_lock
Definition Tab.hpp:237

References Slic3r::GUI::Field::m_is_modified_value, Slic3r::GUI::Field::m_is_nonsys_value, 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(), and Slic3r::GUI::UndoValueUIManager::set_undo_tooltip().

+ Here is the call graph for this function:

◆ delete_current_preset()

bool Slic3r::GUI::Tab::delete_current_preset ( )
protectedvirtual

Reimplemented in Slic3r::GUI::TabFilament.

4823{
4825}
bool delete_current_preset()
Definition Preset.cpp:1024

◆ delete_preset()

void Slic3r::GUI::Tab::delete_preset ( )
4125{
4126 auto current_preset = m_presets->get_selected_preset();
4127 // Don't let the user delete the ' - default - ' configuration.
4128 wxString action = current_preset.is_external ? _L("remove") : _L("delete");
4129
4130 PhysicalPrinterCollection& physical_printers = m_preset_bundle->physical_printers;
4131 wxString msg;
4133 {
4134 PhysicalPrinter& printer = physical_printers.get_selected_printer();
4135 if (printer.preset_names.size() == 1) {
4136 if (m_presets_choice->del_physical_printer(_L("It's a last preset for this physical printer.")))
4137 Layout();
4138 return;
4139 }
4140
4141 msg = format_wxstr(_L("Are you sure you want to delete \"%1%\" preset from the physical printer \"%2%\"?"), current_preset.name, printer.name);
4142 }
4143 else
4144 {
4145 if (m_type == Preset::TYPE_PRINTER && !physical_printers.empty())
4146 {
4147 // Check preset for delete in physical printers
4148 // Ask a customer about next action, if there is a printer with just one preset and this preset is equal to delete
4149 std::vector<std::string> ph_printers = physical_printers.get_printers_with_preset(current_preset.name, false);
4150 std::vector<std::string> ph_printers_only = physical_printers.get_printers_with_only_preset(current_preset.name);
4151
4152 if (!ph_printers.empty()) {
4153 msg += _L_PLURAL("The physical printer below is based on the preset, you are going to delete.",
4154 "The physical printers below are based on the preset, you are going to delete.", ph_printers.size());
4155 for (const std::string& printer : ph_printers)
4156 msg += "\n \"" + from_u8(printer) + "\",";
4157 msg.RemoveLast();
4158 msg += "\n" + _L_PLURAL("Note, that the selected preset will be deleted from this printer too.",
4159 "Note, that the selected preset will be deleted from these printers too.", ph_printers.size()) + "\n\n";
4160 }
4161
4162 if (!ph_printers_only.empty()) {
4163 msg += _L_PLURAL("The physical printer below is based only on the preset, you are going to delete.",
4164 "The physical printers below are based only on the preset, you are going to delete.", ph_printers_only.size());
4165 for (const std::string& printer : ph_printers_only)
4166 msg += "\n \"" + from_u8(printer) + "\",";
4167 msg.RemoveLast();
4168 msg += "\n" + _L_PLURAL("Note, that this printer will be deleted after deleting the selected preset.",
4169 "Note, that these printers will be deleted after deleting the selected preset.", ph_printers_only.size()) + "\n\n";
4170 }
4171 }
4172
4173 // TRN "remove/delete"
4174 msg += from_u8((boost::format(_u8L("Are you sure you want to %1% the selected preset?")) % action).str());
4175 }
4176
4177 action = current_preset.is_external ? _L("Remove") : _L("Delete");
4178 // TRN Settings Tabs: Button in toolbar: "Remove/Delete"
4179 wxString title = format_wxstr(_L("%1% Preset"), action);
4180 if (current_preset.is_default ||
4181 //wxID_YES != wxMessageDialog(parent(), msg, title, wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal())
4182 wxID_YES != MessageDialog(parent(), msg, title, wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal())
4183 return;
4184
4185 // if we just delete preset from the physical printer
4187 PhysicalPrinter& printer = physical_printers.get_selected_printer();
4188
4189 // just delete this preset from the current physical printer
4190 printer.delete_preset(m_presets->get_edited_preset().name);
4191 // select first from the possible presets for this printer
4192 physical_printers.select_printer(printer);
4193
4194 this->select_preset(physical_printers.get_selected_printer_preset_name());
4195 return;
4196 }
4197
4198 // delete selected preset from printers and printer, if it's needed
4199 if (m_type == Preset::TYPE_PRINTER && !physical_printers.empty())
4200 physical_printers.delete_preset_from_printers(current_preset.name);
4201
4202 // Select will handle of the preset dependencies, of saving & closing the depending profiles, and
4203 // finally of deleting the preset.
4204 this->select_preset("", true);
4205}
#define _u8L(s)
macro used to mark string used at localization, return same string
Definition SLAPrint.cpp:29
bool del_physical_printer(const wxString &note_string=wxEmptyString)
Definition PresetComboBoxes.cpp:386
bool is_selected_physical_printer()
Definition PresetComboBoxes.cpp:548
bool select_preset(std::string preset_name="", bool delete_current=false, const std::string &last_selected_ph_printer_name="")
Definition Tab.cpp:3533
PhysicalPrinter & get_selected_printer()
Definition Preset.hpp:754
Preset & get_selected_preset()
Definition Preset.hpp:365
std::string name
Definition Preset.hpp:147
bool is_external
Definition Preset.hpp:132
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:93

References _L, _L_PLURAL, _u8L, Slic3r::PhysicalPrinter::delete_preset(), Slic3r::PhysicalPrinterCollection::delete_preset_from_printers(), Slic3r::PhysicalPrinterCollection::empty(), Slic3r::GUI::format_wxstr(), Slic3r::GUI::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::PhysicalPrinter::name, Slic3r::PhysicalPrinter::preset_names, and Slic3r::PhysicalPrinterCollection::select_printer().

+ Here is the call graph for this function:

◆ description_line_widget()

wxSizer * Slic3r::GUI::Tab::description_line_widget ( wxWindow *  parent,
ogStaticText **  StaticText,
wxString  text = wxEmptyString 
)
2326{
2327 *StaticText = new ogStaticText(parent, text);
2328
2329// auto font = (new wxSystemSettings)->GetFont(wxSYS_DEFAULT_GUI_FONT);
2330 (*StaticText)->SetFont(wxGetApp().normal_font());
2331
2332 auto sizer = new wxBoxSizer(wxHORIZONTAL);
2333 sizer->Add(*StaticText, 1, wxEXPAND|wxALL, 0);
2334 return sizer;
2335}

Referenced by Slic3r::GUI::TabSLAPrint::build_sla_support_params().

+ Here is the caller graph for this function:

◆ emplace_option()

void Slic3r::GUI::Tab::emplace_option ( const std::string &  opt_key,
bool  respect_vec_values = false 
)
672{
673 if (respect_vec_values) {
674 switch (m_config->option(opt_key)->type())
675 {
676 case coInts: add_correct_opts_to_options_list<ConfigOptionInts >(opt_key, m_options_list, this, m_opt_status_value); break;
677 case coBools: add_correct_opts_to_options_list<ConfigOptionBools >(opt_key, m_options_list, this, m_opt_status_value); break;
678 case coFloats: add_correct_opts_to_options_list<ConfigOptionFloats >(opt_key, m_options_list, this, m_opt_status_value); break;
679 case coStrings: add_correct_opts_to_options_list<ConfigOptionStrings >(opt_key, m_options_list, this, m_opt_status_value); break;
680 case coPercents:add_correct_opts_to_options_list<ConfigOptionPercents >(opt_key, m_options_list, this, m_opt_status_value); break;
681 case coPoints: add_correct_opts_to_options_list<ConfigOptionPoints >(opt_key, m_options_list, this, m_opt_status_value); break;
682 case coFloatsOrPercents: add_correct_opts_to_options_list<ConfigOptionFloatsOrPercents >(opt_key, m_options_list, this, m_opt_status_value); break;
683 default: m_options_list.emplace(opt_key, m_opt_status_value); break;
684 }
685 }
686 else
687 m_options_list.emplace(opt_key, m_opt_status_value);
688}
virtual ConfigOptionType type() const =0
int m_opt_status_value
Definition Tab.hpp:256
@ coFloatsOrPercents
Definition Config.hpp:182
@ coBools
Definition Config.hpp:192
@ coPercents
Definition Config.hpp:178
@ coInts
Definition Config.hpp:170
@ coPoints
Definition Config.hpp:186
@ coStrings
Definition Config.hpp:174
@ coFloats
Definition Config.hpp:166

References Slic3r::coBools, Slic3r::coFloats, Slic3r::coFloatsOrPercents, Slic3r::coInts, Slic3r::coPercents, Slic3r::coPoints, and Slic3r::coStrings.

◆ fill_icon_descriptions()

void Slic3r::GUI::Tab::fill_icon_descriptions ( )
protected
4755{
4756 m_icon_descriptions.emplace_back(&m_bmp_value_lock, L("LOCKED LOCK"),
4757 // TRN Description for "LOCKED LOCK"
4758 L("indicates that the settings are the same as the system (or default) values for the current option group"));
4759
4760 m_icon_descriptions.emplace_back(&m_bmp_value_unlock, L("UNLOCKED LOCK"),
4761 // TRN Description for "UNLOCKED LOCK"
4762 L("indicates that some settings were changed and are not equal to the system (or default) values for "
4763 "the current option group.\n"
4764 "Click the UNLOCKED LOCK icon to reset all settings for current option group to "
4765 "the system (or default) values."));
4766
4767 m_icon_descriptions.emplace_back(&m_bmp_white_bullet, L("WHITE BULLET"),
4768 // TRN Description for "WHITE BULLET"
4769 L("for the left button: indicates a non-system (or non-default) preset,\n"
4770 "for the right button: indicates that the settings hasn't been modified."));
4771
4772 m_icon_descriptions.emplace_back(&m_bmp_value_revert, L("BACK ARROW"),
4773 // TRN Description for "BACK ARROW"
4774 L("indicates that the settings were changed and are not equal to the last saved preset for "
4775 "the current option group.\n"
4776 "Click the BACK ARROW icon to reset all settings for the current option group to "
4777 "the last saved preset."));
4778}

References L.

Referenced by create_preset_tab().

+ 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
386{ return m_category_icon; }

References m_category_icon.

◆ get_config()

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

References m_config.

◆ get_config_manipulation()

ConfigManipulation Slic3r::GUI::Tab::get_config_manipulation ( )
protected
5292{
5293 auto load_config = [this]()
5294 {
5295 update_dirty();
5296 // Initialize UI components with the config values.
5297 reload_config();
5298 update();
5299 };
5300
5301 auto cb_toggle_field = [this](const t_config_option_key& opt_key, bool toggle, int opt_index) {
5302 return toggle_option(opt_key, toggle, opt_index);
5303 };
5304
5305 auto cb_value_change = [this](const std::string& opt_key, const boost::any& value) {
5306 return on_value_change(opt_key, value);
5307 };
5308
5309 return ConfigManipulation(load_config, cb_toggle_field, cb_value_change, nullptr, this);
5310}
void on_value_change(const std::string &opt_key, const boost::any &value)
Definition Tab.cpp:1070
virtual void reload_config()
Definition Tab.cpp:886
void load_config(const DynamicPrintConfig &config)
Definition Tab.cpp:870
void toggle_option(const std::string &opt_key, bool toggle, int opt_index=-1)
Definition Tab.cpp:1023
virtual void update()=0
std::string t_config_option_key
Definition Config.hpp:76

References load_config(), on_value_change(), reload_config(), 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_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 
)
996{
997 if (!m_active_page)
998 return {nullptr, nullptr};
999
1000 std::pair<OG_CustomCtrl*, bool*> ret = {nullptr, nullptr};
1001
1002 for (auto opt_group : m_active_page->m_optgroups) {
1003 ret = opt_group->get_custom_ctrl_with_blinking_ptr(opt_key, opt_index);
1004 if (ret.first && ret.second)
1005 break;
1006 }
1007 return ret;
1008}

◆ get_field() [1/2]

Field * Slic3r::GUI::Tab::get_field ( const t_config_option_key opt_key,
int  opt_index = -1 
) const
986{
987 return m_active_page ? m_active_page->get_field(opt_key, opt_index) : nullptr;
988}
Field * get_field(const t_config_option_key &opt_key, int opt_index=-1) const
Definition Tab.cpp:4891

◆ get_field() [2/2]

Field * Slic3r::GUI::Tab::get_field ( const t_config_option_key opt_key,
Page **  selected_page,
int  opt_index = -1 
)
1011{
1012 Field* field = nullptr;
1013 for (auto page : m_pages) {
1014 field = page->get_field(opt_key, opt_index);
1015 if (field != nullptr) {
1016 *selected_page = page.get();
1017 return field;
1018 }
1019 }
1020 return field;
1021}

◆ get_line()

Line * Slic3r::GUI::Tab::get_line ( const t_config_option_key opt_key)
991{
992 return m_active_page ? m_active_page->get_line(opt_key) : nullptr;
993}
Line * get_line(const t_config_option_key &opt_key)
Definition Tab.cpp:4902

◆ get_presets() [1/2]

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

References m_presets.

◆ get_presets() [2/2]

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

References m_presets.

◆ 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 
)
699{
700 auto opt = m_options_list.find(opt_key);
701 if (opt == m_options_list.end())
702 return;
703
704 if (sys_page) sys_page = (opt->second & osSystemValue) != 0;
705 modified_page |= (opt->second & osInitValue) == 0;
706}

◆ init_options_list()

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

Reimplemented in Slic3r::GUI::TabPrinter.

656{
657 m_options_list.clear();
658
659 for (const std::string& opt_key : m_config->keys())
660 emplace_option(opt_key, m_type != Preset::TYPE_FILAMENT && !PresetCollection::is_independent_from_extruder_number_option(opt_key));
661}
void emplace_option(const std::string &opt_key, bool respect_vec_values=false)
Definition Tab.cpp:671

References Slic3r::PresetCollection::is_independent_from_extruder_number_option(), and Slic3r::Preset::TYPE_FILAMENT.

+ Here is the call graph for this function:

◆ load_config()

void Slic3r::GUI::Tab::load_config ( const DynamicPrintConfig config)
871{
872 bool modified = 0;
873 for(auto opt_key : m_config->diff(config)) {
874 m_config->set_key_value(opt_key, config.option(opt_key)->clone());
875 modified = 1;
876 }
877 if (modified) {
878 update_dirty();
879 //# Initialize UI components with the config values.
881 update();
882 }
883}
bool set_key_value(const std::string &opt_key, ConfigOption *opt)
Definition Config.hpp:2431
Slic3r::Polygons diff(const Slic3r::Polygon &subject, const Slic3r::Polygon &clip, ApplySafetyOffset do_safety_offset)
Definition ClipperUtils.cpp:672

References Slic3r::ConfigOption::clone(), and Slic3r::ConfigBase::option().

Referenced by Slic3r::GUI::FreqChangedParams::FreqChangedParams(), Slic3r::GUI::TabSLAMaterial::build(), get_config_manipulation(), and Slic3r::GUI::Plater::priv::undo_redo_to().

+ 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 ( )
virtual

Reimplemented in Slic3r::GUI::TabFilament.

3366{
3367 const Preset& preset = m_presets->get_edited_preset();
3368
3370
3371 update();
3373 // For the printer profile, generate the extruder pages.
3374 if (preset.printer_technology() == ptFFF)
3376 else
3377 wxGetApp().sidebar().update_objects_list_extruder_column(1);
3378 }
3379 // Reload preset pages with the new configuration values.
3380 reload_config();
3381
3383
3384// m_undo_to_sys_btn->Enable(!preset.is_default);
3385
3386#if 0
3387 // use CallAfter because some field triggers schedule on_change calls using CallAfter,
3388 // and we don't want them to be called after this update_dirty() as they would mark the
3389 // preset dirty again
3390 // (not sure this is true anymore now that update_dirty is idempotent)
3391 wxTheApp->CallAfter([this]
3392#endif
3393 {
3394 // checking out if this Tab exists till this moment
3395 if (!wxGetApp().checked_tab(this))
3396 return;
3397 update_tab_ui();
3398
3399 // update show/hide tabs
3402 if (printer_technology != static_cast<TabPrinter*>(this)->m_printer_technology)
3403 {
3404 // The change of the technology requires to remove some of unrelated Tabs
3405 // During this action, wxNoteBook::RemovePage invoke wxEVT_NOTEBOOK_PAGE_CHANGED
3406 // and as a result a function select_active_page() is called fron Tab::OnActive()
3407 // But we don't need it. So, to avoid activation of the page, set m_active_page to NULL
3408 // till unusable Tabs will be deleted
3409 Page* tmp_page = m_active_page;
3410 m_active_page = nullptr;
3411 for (auto tab : wxGetApp().tabs_list) {
3412 if (tab->type() == Preset::TYPE_PRINTER) { // Printer tab is shown every time
3413 int cur_selection = wxGetApp().tab_panel()->GetSelection();
3414 if (cur_selection != 0)
3415 wxGetApp().tab_panel()->SetSelection(wxGetApp().tab_panel()->GetPageCount() - 1);
3416 continue;
3417 }
3418 if (tab->supports_printer_technology(printer_technology))
3419 {
3420#ifdef _MSW_DARK_MODE
3421 if (!wxGetApp().tabs_as_menu()) {
3422 std::string bmp_name = tab->type() == Slic3r::Preset::TYPE_FILAMENT ? "spool" :
3423 tab->type() == Slic3r::Preset::TYPE_SLA_MATERIAL ? "resin" : "cog";
3424 tab->Hide(); // #ys_WORKAROUND : Hide tab before inserting to avoid unwanted rendering of the tab
3425 dynamic_cast<Notebook*>(wxGetApp().tab_panel())->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab, tab->title(), bmp_name);
3426 }
3427 else
3428#endif
3429 wxGetApp().tab_panel()->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab, tab->title());
3430 #ifdef __linux__ // the tabs apparently need to be explicitly shown on Linux (pull request #1563)
3431 int page_id = wxGetApp().tab_panel()->FindPage(tab);
3432 wxGetApp().tab_panel()->GetPage(page_id)->Show(true);
3433 #endif // __linux__
3434 }
3435 else {
3436 int page_id = wxGetApp().tab_panel()->FindPage(tab);
3437 wxGetApp().tab_panel()->GetPage(page_id)->Show(false);
3438 wxGetApp().tab_panel()->RemovePage(page_id);
3439 }
3440 }
3441 static_cast<TabPrinter*>(this)->m_printer_technology = printer_technology;
3442 m_active_page = tmp_page;
3443#ifdef _MSW_DARK_MODE
3444 if (!wxGetApp().tabs_as_menu())
3445 dynamic_cast<Notebook*>(wxGetApp().tab_panel())->SetPageImage(wxGetApp().tab_panel()->FindPage(this), printer_technology == ptFFF ? "printer" : "sla_printer");
3446#endif
3447 }
3449 if (printer_technology == ptFFF) {
3450 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;
3451 const Preset* parent_preset = m_presets->get_selected_preset_parent();
3452 static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
3453 static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
3454 }
3455 }
3456 else {
3460 }
3461
3466 }
3467#if 0
3468 );
3469#endif
3470}
void update_tab_ui()
Definition Tab.cpp:863
void on_presets_changed()
Definition Tab.cpp:1221
virtual void init_options_list()
Definition Tab.cpp:655
void update_frequently_changed_parameters()
Definition Tab.cpp:1377
void update_btns_enabling()
Definition Tab.cpp:3508
void update_visibility()
Definition Tab.cpp:915
void update_ui_items_related_on_parent_preset(const Preset *selected_preset_parent)
Definition Tab.cpp:3355
virtual void on_preset_loaded()
Definition Tab.hpp:348
const Preset * get_selected_preset_parent() const
Definition Preset.cpp:1069
@ TYPE_SLA_PRINT
Definition Preset.hpp:113
@ TYPE_SLA_MATERIAL
Definition Preset.hpp:115
@ TYPE_FILAMENT
Definition Preset.hpp:114
#define const
Definition getopt.c:38
Definition getopt.h:102
ConfigOptionFloatsTempl< false > ConfigOptionFloats
Definition Config.hpp:716
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References Slic3r::Preset::config, Slic3r::ConfigBase::option(), Slic3r::printer_technology(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, Slic3r::ConfigOptionVector< T >::size(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINTER, and Slic3r::Preset::TYPE_SLA_MATERIAL.

Referenced by on_presets_changed().

+ 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 ( )
374{
376 bool has_parent = m_presets->get_selected_preset_parent() != nullptr;
380}
wxString m_tt_value_unlock
Definition Tab.hpp:238
wxString * m_ttg_non_system
Definition Tab.hpp:231
wxString m_ttg_white_bullet_ns
Definition Tab.hpp:229
wxString m_ttg_value_unlock
Definition Tab.hpp:228

Referenced by 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
1037{
1038 if (!saved_value) change_opt_value(*m_config, opt_key, value);
1039 // Mark the print & filament enabled if they are compatible with the currently selected preset.
1040 if (opt_key == "compatible_printers" || opt_key == "compatible_prints") {
1041 // Don't select another profile if this profile happens to become incompatible.
1043 }
1046 update();
1047}
void update_dirty()
Definition PresetComboBoxes.cpp:1318
void update_compatible(PresetSelectCompatibleType select_other_print_if_incompatible, PresetSelectCompatibleType select_other_filament_if_incompatible)
Definition PresetBundle.cpp:1811
void change_opt_value(DynamicPrintConfig &config, const t_config_option_key &opt_key, const boost::any &value, int opt_index)
Definition GUI.cpp:103

References Slic3r::GUI::change_opt_value(), and Slic3r::Never.

+ Here is the call 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 = "" 
)
3714{
3715 if (presets == nullptr) presets = m_presets;
3716
3717 UnsavedChangesDialog dlg(m_type, presets, new_printer_name);
3718 if (wxGetApp().app_config->get("default_action_on_select_preset") == "none" && dlg.ShowModal() == wxID_CANCEL)
3719 return false;
3720
3721 if (dlg.save_preset()) // save selected changes
3722 {
3723 const std::vector<std::string>& unselected_options = dlg.get_unselected_options(presets->type());
3724 const std::string& name = dlg.get_preset_name();
3725
3726 if (m_type == presets->type()) // save changes for the current preset from this tab
3727 {
3728 // revert unselected options to the old values
3729 presets->get_edited_preset().config.apply_only(presets->get_selected_preset().config, unselected_options);
3731 }
3732 else
3733 {
3734 m_preset_bundle->save_changes_for_preset(name, presets->type(), unselected_options);
3735
3736 // If filament preset is saved for multi-material printer preset,
3737 // there are cases when filament comboboxs are updated for old (non-modified) colors,
3738 // but in full_config a filament_colors option aren't.
3739 if (presets->type() == Preset::TYPE_FILAMENT && wxGetApp().extruders_edited_cnt() > 1)
3740 wxGetApp().plater()->force_filament_colors_update();
3741 }
3742 }
3743 else if (dlg.transfer_changes()) // move selected changes
3744 {
3745 std::vector<std::string> selected_options = dlg.get_selected_options();
3746 if (m_type == presets->type()) // move changes for the current preset from this tab
3747 {
3749 auto it = std::find(selected_options.begin(), selected_options.end(), "extruders_count");
3750 if (it != selected_options.end()) {
3751 // erase "extruders_count" option from the list
3752 selected_options.erase(it);
3753 // cache the extruders count
3754 static_cast<TabPrinter*>(this)->cache_extruder_cnt();
3755 }
3756 }
3757
3758 // copy selected options to the cache from edited preset
3759 cache_config_diff(selected_options);
3760 }
3761 else
3762 wxGetApp().get_tab(presets->type())->cache_config_diff(selected_options);
3763 }
3764
3765 return true;
3766}
void cache_config_diff(const std::vector< std::string > &selected_options, const DynamicPrintConfig *config=nullptr)
Definition Tab.cpp:1192
void save_changes_for_preset(const std::string &new_name, Preset::Type type, const std::vector< std::string > &unselected_options)
Definition PresetBundle.cpp:472

References Slic3r::ConfigBase::apply_only(), Slic3r::Preset::config, Slic3r::PresetCollection::get_edited_preset(), Slic3r::GUI::UnsavedChangesDialog::get_preset_name(), Slic3r::GUI::UnsavedChangesDialog::get_selected_options(), Slic3r::PresetCollection::get_selected_preset(), Slic3r::GUI::UnsavedChangesDialog::get_unselected_options(), Slic3r::GUI::UnsavedChangesDialog::save_preset(), Slic3r::GUI::UnsavedChangesDialog::transfer_changes(), and Slic3r::PresetCollection::type().

+ Here is the call graph for this function:

◆ msw_rescale()

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

Reimplemented in Slic3r::GUI::TabFilament.

931{
933
935 m_treectrl->SetMinSize(wxSize(20 * m_em_unit, -1));
936
937 // rescale options_groups
938 if (m_active_page)
940
941 Layout();
942}
void msw_rescale()
Definition Tab.cpp:4873
void msw_rescale() override
Definition PresetComboBoxes.cpp:1310

References em_unit().

+ Here is the call graph for this function:

◆ name()

std::string Slic3r::GUI::Tab::name ( ) const
inline
299{ return m_presets->name(); }
std::string name() const
Definition Preset.cpp:1482

References m_presets, and Slic3r::PresetCollection::name().

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

+ Here is the call graph for this function:
+ 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.

348{}

◆ on_presets_changed()

void Slic3r::GUI::Tab::on_presets_changed ( )
protected
1222{
1223 if (wxGetApp().plater() == nullptr)
1224 return;
1225
1226 // Instead of PostEvent (EVT_TAB_PRESETS_CHANGED) just call update_presets
1227 wxGetApp().plater()->sidebar().update_presets(m_type);
1228
1229 // Printer selected at the Printer tab, update "compatible" marks at the print and filament selectors.
1230 for (auto t: m_dependent_tabs)
1231 {
1232 Tab* tab = wxGetApp().get_tab(t);
1233 // If the printer tells us that the print or filament/sla_material preset has been switched or invalidated,
1234 // refresh the print or filament/sla_material tab page.
1235 // But if there are options, moved from the previously selected preset, update them to edited preset
1236 tab->apply_config_from_cache();
1237 tab->load_current_preset();
1238 }
1239 // clear m_dependent_tabs after first update from select_preset()
1240 // to avoid needless preset loading from update() function
1241 m_dependent_tabs.clear();
1242
1243 // Update Project dirty state, update application title bar.
1244 if (wxGetApp().mainframe)
1245 wxGetApp().plater()->update_project_dirty_from_presets();
1246}
std::vector< Preset::Type > m_dependent_tabs
Definition Tab.hpp:253
static Plater * plater()
Definition GUI_Factories.cpp:174

References apply_config_from_cache(), and load_current_preset().

+ Here is the call graph for this function:

◆ on_roll_back_value()

void Slic3r::GUI::Tab::on_roll_back_value ( const bool  to_sys = false)
791{
792 if (!m_active_page) return;
793
794 int os;
795 if (to_sys) {
796 if (!m_is_nonsys_values) return;
797 os = osSystemValue;
798 }
799 else {
800 if (!m_is_modified_values) return;
801 os = osInitValue;
802 }
803
805
806 for (auto group : m_active_page->m_optgroups) {
807 if (group->title == "Capabilities") {
808 if ((m_options_list["extruders_count"] & os) == 0)
809 to_sys ? group->back_to_sys_value("extruders_count") : group->back_to_initial_value("extruders_count");
810 }
811 if (group->title == "Size and coordinates") {
812 if ((m_options_list["bed_shape"] & os) == 0) {
813 to_sys ? group->back_to_sys_value("bed_shape") : group->back_to_initial_value("bed_shape");
814 load_key_value("bed_shape", true/*some value*/, true);
815 }
816 }
817 if (group->title == "Toolchange parameters with single extruder MM printers") {
818 if ((m_options_list["filament_ramming_parameters"] & os) == 0)
819 to_sys ? group->back_to_sys_value("filament_ramming_parameters") : group->back_to_initial_value("filament_ramming_parameters");
820 }
821 if (group->title == "G-code Substitutions") {
822 if ((m_options_list["gcode_substitutions"] & os) == 0) {
823 to_sys ? group->back_to_sys_value("gcode_substitutions") : group->back_to_initial_value("gcode_substitutions");
824 load_key_value("gcode_substitutions", true/*some value*/, true);
825 }
826 }
827 if (group->title == "Profile dependencies") {
828 // "compatible_printers" option doesn't exists in Printer Settimgs Tab
829 if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) {
830 to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers");
831 load_key_value("compatible_printers", true/*some value*/, true);
832 }
833 // "compatible_prints" option exists only in Filament Settimgs and Materials Tabs
834 if ((m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL) && (m_options_list["compatible_prints"] & os) == 0) {
835 to_sys ? group->back_to_sys_value("compatible_prints") : group->back_to_initial_value("compatible_prints");
836 load_key_value("compatible_prints", true/*some value*/, true);
837 }
838 }
839 for (const auto &kvp : group->opt_map()) {
840 const std::string& opt_key = kvp.first;
841 if ((m_options_list[opt_key] & os) == 0)
842 to_sys ? group->back_to_sys_value(opt_key) : group->back_to_initial_value(opt_key);
843 }
844 }
845
846 m_postpone_update_ui = false;
847
848 // When all values are rolled, then we have to update whole tab in respect to the reverted values
849 update();
850
852}
bool m_is_modified_values
Definition Tab.hpp:260
bool m_postpone_update_ui
Definition Tab.hpp:262
bool m_is_nonsys_values
Definition Tab.hpp:261

References Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINTER, and Slic3r::Preset::TYPE_SLA_MATERIAL.

Referenced by create_preset_tab().

+ 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 
)

!!! ysFIXME ????

1071{
1072 if (wxGetApp().plater() == nullptr) {
1073 return;
1074 }
1075
1076 if (opt_key == "compatible_prints")
1078 if (opt_key == "compatible_printers")
1080
1081 const bool is_fff = supports_printer_technology(ptFFF);
1082 ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff);
1083 if (opt_key == "fill_density" || opt_key == "pad_enable")
1084 {
1085 boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
1086 og_freq_chng_params->set_value(opt_key, val);
1087 }
1088
1089 if (opt_key == "pad_around_object") {
1090 for (PageShp &pg : m_pages) {
1091 Field * fld = pg->get_field(opt_key);
1092 if (fld) fld->set_value(value, false);
1093 }
1094 }
1095
1096 if (is_fff ?
1097 (opt_key == "support_material" || opt_key == "support_material_auto" || opt_key == "support_material_buildplate_only") :
1098 (opt_key == "supports_enable" || opt_key == "support_tree_type" || opt_key == get_sla_suptree_prefix(*m_config) + "support_buildplate_only" || opt_key == "support_enforcers_only"))
1099 og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
1100
1101 if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_around_object"))
1102 og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
1103
1104 if (opt_key == "brim_width")
1105 {
1106 bool val = m_config->opt_float("brim_width") > 0.0 ? true : false;
1107 og_freq_chng_params->set_value("brim", val);
1108 }
1109
1110 if (opt_key == "wipe_tower" || opt_key == "single_extruder_multi_material" || opt_key == "extruders_count" )
1112
1113 if (opt_key == "extruders_count")
1114 wxGetApp().plater()->on_extruders_change(boost::any_cast<size_t>(value));
1115
1117 // It means that not all values are rolled to the system/last saved values jet.
1118 // And call of the update() can causes a redundant check of the config values,
1119 // see https://github.com/prusa3d/PrusaSlicer/issues/7146
1120 return;
1121 }
1122
1123 update();
1124}
double & opt_float(const t_config_option_key &opt_key)
Definition Config.hpp:2281
void update_wiping_button_visibility()
Definition Tab.cpp:1127
virtual bool supports_printer_technology(const PrinterTechnology tech) const =0
static wxString support_combo_value_for_config(const DynamicPrintConfig &config, bool is_fff)
Definition Tab.cpp:1049
static wxString pad_combo_value_for_config(const DynamicPrintConfig &config)
Definition Tab.cpp:1065
std::string get_sla_suptree_prefix(const DynamicPrintConfig &config)
Definition PrintConfig.cpp:4968

References Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::get_sla_suptree_prefix(), Slic3r::GUI::pad_combo_value_for_config(), Slic3r::ptFFF, Slic3r::GUI::Field::set_value(), Slic3r::GUI::OptionsGroup::set_value(), and Slic3r::GUI::support_combo_value_for_config().

Referenced by Slic3r::GUI::TabSLAMaterial::build(), get_config_manipulation(), Slic3r::GUI::Plater::priv::process_validation_warning(), 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
426{
427 wxWindowUpdateLocker noUpdates(this);
428#ifdef __WXOSX__
429// wxWindowUpdateLocker noUpdates(this);
430 auto size = GetSizer()->GetSize();
431 m_tmp_panel->GetSizer()->SetMinSize(size.x + m_size_move, size.y);
432 Fit();
433 m_size_move *= -1;
434#endif // __WXOSX__
435
436#ifdef __WXMSW__
437 // Workaround for tooltips over Tree Controls displayed over excessively long
438 // tree control items, stealing the window focus.
439 //
440 // In case the Tab was reparented from the MainFrame to the floating dialog,
441 // the tooltip created by the Tree Control before reparenting is not reparented,
442 // but it still points to the MainFrame. If the tooltip pops up, the MainFrame
443 // is incorrectly focussed, stealing focus from the floating dialog.
444 //
445 // The workaround is to delete the tooltip control.
446 // Vojtech tried to reparent the tooltip control, but it did not work,
447 // and if the Tab was later reparented back to MainFrame, the tooltip was displayed
448 // at an incorrect position, therefore it is safer to just discard the tooltip control
449 // altogether.
450 HWND hwnd_tt = TreeView_GetToolTips(m_treectrl->GetHandle());
451 if (hwnd_tt) {
452 HWND hwnd_toplevel = find_toplevel_parent(m_treectrl)->GetHandle();
453 HWND hwnd_parent = ::GetParent(hwnd_tt);
454 if (hwnd_parent != hwnd_toplevel) {
455 ::DestroyWindow(hwnd_tt);
456 TreeView_SetToolTips(m_treectrl->GetHandle(), nullptr);
457 }
458 }
459#endif
460
461 // create controls on active page
463 m_hsizer->Layout();
464
465 if (m_presets_choice->IsShown())
466 Refresh(); // Just refresh page, if m_presets_choice is already shown
467 else {
468 // From the tab creation whole top sizer is hidden to correct update of preset combobox's size
469 // (see https://github.com/prusa3d/PrusaSlicer/issues/10746)
470
471 // On first OnActivate call show top sizer
472 m_top_hsizer->ShowItems(true);
473 // Size and layouts of all items are correct now,
474 // but ALL items of top sizer are visible.
475 // So, update visibility of each item according to the ui settings
478 if (TabFilament* tab = dynamic_cast<TabFilament*>(this))
479 tab->update_extruder_combobox();
480
481 Layout();
482 }
483}
virtual void activate_selected_page(std::function< void()> throw_if_canceled)
Definition Tab.cpp:3794
bool m_show_btn_incompatible_presets
Definition Tab.hpp:281
wxTopLevelWindow * find_toplevel_parent(wxWindow *window)
Definition GUI_Utils.cpp:33

References Slic3r::GUI::find_toplevel_parent(), and Slic3r::Preset::TYPE_PRINTER.

Referenced by Slic3r::GUI::MainFrame::init_tabpanel(), and Slic3r::GUI::MainFrame::select_tab().

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

◆ OnKeyDown()

void Slic3r::GUI::Tab::OnKeyDown ( wxKeyEvent &  event)
3906{
3907 if (event.GetKeyCode() == WXK_TAB)
3908 m_treectrl->Navigate(event.ShiftDown() ? wxNavigationKeyEvent::IsBackward : wxNavigationKeyEvent::IsForward);
3909 else
3910 event.Skip();
3911}

◆ OnTreeSelChange()

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

◆ parent()

wxWindow * Slic3r::GUI::Tab::parent ( ) const
inline
297{ return m_parent; }

References m_parent.

Referenced by Tab(), Slic3r::GUI::TabSLAMaterial::build(), Slic3r::GUI::TabSLAPrint::build(), and Slic3r::GUI::TabSLAPrint::build_sla_support_params().

+ Here is the caller graph for this function:

◆ rebuild_page_tree()

void Slic3r::GUI::Tab::rebuild_page_tree ( )
3474{
3475 // get label of the currently selected item
3476 const auto sel_item = m_treectrl->GetSelection();
3477 const auto selected = sel_item ? m_treectrl->GetItemText(sel_item) : "";
3478 const auto rootItem = m_treectrl->GetRootItem();
3479
3480 wxTreeItemId item;
3481
3482 // Delete/Append events invoke wxEVT_TREE_SEL_CHANGED event.
3483 // To avoid redundant clear/activate functions call
3484 // suppress activate page before page_tree rebuilding
3486 m_treectrl->DeleteChildren(rootItem);
3487
3488 for (auto p : m_pages)
3489 {
3490 if (!p->get_show())
3491 continue;
3492 auto itemId = m_treectrl->AppendItem(rootItem, translate_category(p->title(), m_type), p->iconID());
3493 m_treectrl->SetItemTextColour(itemId, p->get_item_colour());
3494 if (translate_category(p->title(), m_type) == selected)
3495 item = itemId;
3496 }
3497 if (!item) {
3498 // this is triggered on first load, so we don't disable the sel change event
3499 item = m_treectrl->GetFirstVisibleItem();
3500 }
3501
3502 // allow activate page before selection of a page_tree item
3504 if (item)
3505 m_treectrl->SelectItem(item);
3506}

◆ reload_config()

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

Reimplemented in Slic3r::GUI::TabPrinter.

887{
888 if (m_active_page)
890}
void reload_config()
Definition Tab.cpp:4836

Referenced by Slic3r::GUI::FreqChangedParams::FreqChangedParams(), and get_config_manipulation().

+ Here is the caller graph for this function:

◆ rename_preset()

void Slic3r::GUI::Tab::rename_preset ( )
4051{
4053 return;
4054
4055 wxString msg;
4056
4058 // Check preset for rename in physical printers
4060 if (!ph_printers.empty()) {
4061 msg += _L_PLURAL("The physical printer below is based on the preset, you are going to rename.",
4062 "The physical printers below are based on the preset, you are going to rename.", ph_printers.size());
4063 for (const std::string& printer : ph_printers)
4064 msg += "\n \"" + from_u8(printer) + "\",";
4065 msg.RemoveLast();
4066 msg += "\n" + _L_PLURAL("Note, that the selected preset will be renamed in this printer too.",
4067 "Note, that the selected preset will be renamed in these printers too.", ph_printers.size()) + "\n\n";
4068 }
4069 }
4070
4071 // get new name
4072
4073 SavePresetDialog dlg(m_parent, m_type, msg);
4074 if (dlg.ShowModal() != wxID_OK)
4075 return;
4076
4077 const std::string new_name = into_u8(dlg.get_name());
4078 if (new_name.empty() || new_name == m_presets->get_selected_preset().name)
4079 return;
4080
4081 // Note: selected preset can be changed, if in SavePresetDialog was selected name of existing preset
4082 Preset& selected_preset = m_presets->get_selected_preset();
4083 Preset& edited_preset = m_presets->get_edited_preset();
4084
4085 const std::string old_name = selected_preset.name;
4086 const std::string old_file_name = selected_preset.file;
4087
4088 assert(old_name == edited_preset.name);
4089
4090 using namespace boost;
4091 try {
4092 // rename selected and edited presets
4093
4094 selected_preset.name = new_name;
4095 replace_last(selected_preset.file, old_name, new_name);
4096
4097 edited_preset.name = new_name;
4098 replace_last(edited_preset.file, old_name, new_name);
4099
4100 // rename file with renamed preset configuration
4101
4102 filesystem::rename(old_file_name, selected_preset.file);
4103
4104 // rename selected preset in printers, if it's needed
4105
4106 if (!msg.IsEmpty())
4108 }
4109 catch (const exception& ex) {
4110 const std::string exception = diagnostic_information(ex);
4111 printf("Can't rename a preset : %s", exception.c_str());
4112 }
4113
4114 // sort presets after renaming
4115 std::sort(m_presets->begin(), m_presets->end());
4116 // update selection
4117 select_preset_by_name(new_name, true);
4118
4121}
virtual bool select_preset_by_name(const std::string &name_w_suffix, bool force)
Definition Tab.cpp:4812
void update() override
Definition PresetComboBoxes.cpp:1135
void rename_preset_in_printers(const std::string &old_name, const std::string &new_name)
Definition Preset.cpp:2016
bool empty() const
Definition Preset.hpp:720
std::vector< std::string > get_printers_with_preset(const std::string &preset_name, bool respect_only_preset=true)
Definition Preset.cpp:2027
Iterator begin()
Definition Preset.hpp:291
Iterator end()
Definition Preset.hpp:294
std::string into_u8(const wxString &str)
Definition GUI.cpp:442
Definition args.hpp:18

References _L_PLURAL, Slic3r::Preset::file, Slic3r::GUI::from_u8(), Slic3r::GUI::SavePresetDialog::get_name(), Slic3r::GUI::into_u8(), and Slic3r::Preset::name.

+ Here is the call graph for this function:

◆ save_current_preset()

bool Slic3r::GUI::Tab::save_current_preset ( const std::string &  new_name,
bool  detach 
)
protectedvirtual

Reimplemented in Slic3r::GUI::TabFilament.

4818{
4819 return m_presets->save_current_preset(new_name, detach);
4820}
bool save_current_preset(const std::string &new_name, bool detach=false)
Definition Preset.cpp:901

◆ save_preset()

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

m_treectrl->OnSetFocus();

3950{
3951 // since buttons(and choices too) don't get focus on Mac, we set focus manually
3952 // to the treectrl so that the EVT_* events are fired for the input field having
3953 // focus currently.is there anything better than this ?
3955
3956 Preset& edited_preset = m_presets->get_edited_preset();
3957 bool from_template = false;
3958 std::string edited_printer;
3959 if (m_type == Preset::TYPE_FILAMENT && edited_preset.vendor && edited_preset.vendor->templates_profile) {
3960 edited_printer = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_model");
3961 from_template = !edited_printer.empty();
3962 }
3963
3964 if (name.empty()) {
3965 SavePresetDialog dlg(m_parent, { m_type }, detach ? _u8L("Detached") : "", from_template);
3966 if (dlg.ShowModal() != wxID_OK)
3967 return;
3968 name = dlg.get_name();
3969 if (from_template)
3970 from_template = dlg.get_template_filament_checkbox();
3971 }
3972
3973 if (detach && m_type == Preset::TYPE_PRINTER)
3974 m_config->opt_string("printer_model", true) = "";
3975
3976 // Update compatible printers
3977 if (from_template && !edited_printer.empty()) {
3978 std::string cond = edited_preset.compatible_printers_condition();
3979 if (!cond.empty())
3980 cond += " and ";
3981 cond += "printer_model == \"" + edited_printer + "\"";
3982 edited_preset.config.opt_string("compatible_printers_condition") = cond;
3983 }
3984
3985 // Save the preset into Slic3r::data_dir / presets / section_name / preset_name.ini
3986 save_current_preset(name, detach);
3987
3988 if (detach && m_type == Preset::TYPE_PRINTER)
3989 wxGetApp().mainframe->on_config_changed(m_config);
3990
3991
3992 // Mark the print & filament enabled if they are compatible with the currently selected preset.
3993 // 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.
3995 // Add the new item into the UI component, remove dirty flags and activate the saved item.
3996 update_tab_ui();
3997 // Update the selection boxes at the plater.
3999 // If current profile is saved, "delete/rename preset" buttons have to be shown
4000 m_btn_delete_preset->Show();
4002 m_btn_delete_preset->GetParent()->Layout();
4003
4005 static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<TabPrinter*>(this)->m_extruders_count;
4006
4007 // Parent preset is "default" after detaching, so we should to update UI values, related on parent preset
4008 if (detach)
4010
4012
4013 /* If filament preset is saved for multi-material printer preset,
4014 * there are cases when filament comboboxs are updated for old (non-modified) colors,
4015 * but in full_config a filament_colors option aren't.*/
4016 if (m_type == Preset::TYPE_FILAMENT && wxGetApp().extruders_edited_cnt() > 1)
4017 wxGetApp().plater()->force_filament_colors_update();
4018
4019 {
4020 // Profile compatiblity is updated first when the profile is saved.
4021 // Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
4022 std::vector<Preset::Type> dependent;
4023 switch (m_type) {
4024 case Preset::TYPE_PRINT:
4025 dependent = { Preset::TYPE_FILAMENT };
4026 break;
4028 dependent = { Preset::TYPE_SLA_MATERIAL };
4029 break;
4031 if (static_cast<const TabPrinter*>(this)->m_printer_technology == ptFFF)
4033 else
4035 break;
4036 default:
4037 break;
4038 }
4039 for (Preset::Type preset_type : dependent)
4040 wxGetApp().get_tab(preset_type)->update_tab_ui();
4041 }
4042
4043 // update preset comboboxes in DiffPresetDlg
4044 wxGetApp().mainframe->diff_dialog.update_presets(m_type);
4045
4046 if (detach)
4048}
std::string & opt_string(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2276
virtual bool save_current_preset(const std::string &new_name, bool detach)
Definition Tab.cpp:4817
Type
Definition Preset.hpp:110

References _u8L, Slic3r::Preset::compatible_printers_condition(), Slic3r::Preset::config, Slic3r::GUI::SavePresetDialog::get_name(), Slic3r::GUI::TabPrinter::m_extruders_count, Slic3r::ConfigBase::opt_string(), Slic3r::ptFFF, Slic3r::VendorProfile::templates_profile, and Slic3r::Preset::vendor.

+ Here is the call graph for this function:

◆ saved_preset_is_dirty()

bool Slic3r::GUI::Tab::saved_preset_is_dirty ( ) const
2337{ return m_presets->saved_is_dirty(); }
bool saved_is_dirty() const
Definition Preset.hpp:486

◆ select_preset()

bool Slic3r::GUI::Tab::select_preset ( std::string  preset_name = "",
bool  delete_current = false,
const std::string &  last_selected_ph_printer_name = "" 
)
3534{
3535 if (preset_name.empty()) {
3536 if (delete_current) {
3537 // Find an alternate preset to be selected after the current preset is deleted.
3538 const std::deque<Preset> &presets = m_presets->get_presets();
3539 size_t idx_current = m_presets->get_idx_selected();
3540 // Find the next visible preset.
3541 size_t idx_new = idx_current + 1;
3542 if (idx_new < presets.size())
3543 for (; idx_new < presets.size() && ! presets[idx_new].is_visible; ++ idx_new) ;
3544 if (idx_new == presets.size())
3545 for (idx_new = idx_current - 1; idx_new > 0 && ! presets[idx_new].is_visible; -- idx_new);
3546 preset_name = presets[idx_new].name;
3547 } else {
3548 // If no name is provided, select the "-- default --" preset.
3549 preset_name = m_presets->default_preset().name;
3550 }
3551 }
3552 assert(! delete_current || (m_presets->get_edited_preset().name != preset_name && m_presets->get_edited_preset().is_user()));
3553 bool current_dirty = ! delete_current && m_presets->current_is_dirty();
3554 bool print_tab = m_presets->type() == Preset::TYPE_PRINT || m_presets->type() == Preset::TYPE_SLA_PRINT;
3555 bool printer_tab = m_presets->type() == Preset::TYPE_PRINTER;
3556 bool canceled = false;
3557 bool technology_changed = false;
3558 m_dependent_tabs.clear();
3559 if (current_dirty && ! may_discard_current_dirty_preset(nullptr, preset_name)) {
3560 canceled = true;
3561 } else if (print_tab) {
3562 // Before switching the print profile to a new one, verify, whether the currently active filament or SLA material
3563 // are compatible with the new print.
3564 // If it is not compatible and the current filament or SLA material are dirty, let user decide
3565 // whether to discard the changes or keep the current print selection.
3566 PresetWithVendorProfile printer_profile = m_preset_bundle->printers.get_edited_preset_with_vendor_profile();
3567 PrinterTechnology printer_technology = printer_profile.preset.printer_technology();
3568 PresetCollection &dependent = (printer_technology == ptFFF) ? m_preset_bundle->filaments : m_preset_bundle->sla_materials;
3569 bool old_preset_dirty = dependent.current_is_dirty();
3570 bool new_preset_compatible = is_compatible_with_print(dependent.get_edited_preset_with_vendor_profile(),
3571 m_presets->get_preset_with_vendor_profile(*m_presets->find_preset(preset_name, true)), printer_profile);
3572 if (! canceled)
3573 canceled = old_preset_dirty && ! new_preset_compatible && ! may_discard_current_dirty_preset(&dependent, preset_name);
3574 if (! canceled) {
3575 // The preset will be switched to a different, compatible preset, or the '-- default --'.
3576 m_dependent_tabs.emplace_back((printer_technology == ptFFF) ? Preset::Type::TYPE_FILAMENT : Preset::Type::TYPE_SLA_MATERIAL);
3577 if (old_preset_dirty && ! new_preset_compatible)
3578 dependent.discard_current_changes();
3579 }
3580 } else if (printer_tab) {
3581 // Before switching the printer to a new one, verify, whether the currently active print and filament
3582 // are compatible with the new printer.
3583 // If they are not compatible and the current print or filament are dirty, let user decide
3584 // whether to discard the changes or keep the current printer selection.
3585 //
3586 // With the introduction of the SLA printer types, we need to support switching between
3587 // the FFF and SLA printers.
3588 const Preset &new_printer_preset = *m_presets->find_preset(preset_name, true);
3589 const PresetWithVendorProfile new_printer_preset_with_vendor_profile = m_presets->get_preset_with_vendor_profile(new_printer_preset);
3591 PrinterTechnology new_printer_technology = new_printer_preset.printer_technology();
3592 if (new_printer_technology == ptSLA && old_printer_technology == ptFFF && !wxGetApp().may_switch_to_SLA_preset(_L("New printer preset selected")))
3593 canceled = true;
3594 else {
3595 struct PresetUpdate {
3596 Preset::Type tab_type;
3597 PresetCollection *presets;
3598 PrinterTechnology technology;
3599 bool old_preset_dirty;
3600 bool new_preset_compatible;
3601 };
3602 std::vector<PresetUpdate> updates = {
3607 };
3608 for (PresetUpdate &pu : updates) {
3609 pu.old_preset_dirty = (old_printer_technology == pu.technology) && pu.presets->current_is_dirty();
3610 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);
3611 if (!canceled)
3612 canceled = pu.old_preset_dirty && !pu.new_preset_compatible && !may_discard_current_dirty_preset(pu.presets, preset_name);
3613 }
3614 if (!canceled) {
3615 for (PresetUpdate &pu : updates) {
3616 // The preset will be switched to a different, compatible preset, or the '-- default --'.
3617 if (pu.technology == new_printer_technology)
3618 m_dependent_tabs.emplace_back(pu.tab_type);
3619 if (pu.old_preset_dirty && !pu.new_preset_compatible)
3620 pu.presets->discard_current_changes();
3621 }
3622 }
3623 }
3624 if (! canceled)
3625 technology_changed = old_printer_technology != new_printer_technology;
3626 }
3627
3628 if (! canceled && delete_current) {
3629 // Delete the file and select some other reasonable preset.
3630 // It does not matter which preset will be made active as the preset will be re-selected from the preset_name variable.
3631 // The 'external' presets will only be removed from the preset list, their files will not be deleted.
3632 try {
3633 // cache previously selected names
3635 } catch (const std::exception & /* e */) {
3636 //FIXME add some error reporting!
3637 canceled = true;
3638 }
3639 }
3640
3641 if (canceled) {
3643 if (!last_selected_ph_printer_name.empty() &&
3644 m_presets->get_edited_preset().name == PhysicalPrinter::get_preset_name(last_selected_ph_printer_name)) {
3645 // If preset selection was canceled and previously was selected physical printer, we should select it back
3646 m_preset_bundle->physical_printers.select_printer(last_selected_ph_printer_name);
3647 }
3649 // If preset selection was canceled and physical printer was selected
3650 // we must disable selection marker for the physical printers
3652 }
3653 }
3654
3655 // update_tab_ui(); //! ysFIXME delete after testing
3656
3657 // Trigger the on_presets_changed event so that we also restore the previous value in the plater selector,
3658 // if this action was initiated from the plater.
3660 } else {
3661 if (current_dirty)
3663
3664 const bool is_selected = select_preset_by_name(preset_name, false) || delete_current;
3665 assert(m_presets->get_edited_preset().name == preset_name || ! is_selected);
3666 // Mark the print & filament enabled if they are compatible with the currently selected preset.
3667 // The following method should not discard changes of current print or filament presets on change of a printer profile,
3668 // if they are compatible with the current printer.
3669 auto update_compatible_type = [delete_current](bool technology_changed, bool on_page, bool show_incompatible_presets) {
3670 return (delete_current || technology_changed) ? PresetSelectCompatibleType::Always :
3673 };
3674 if (current_dirty || delete_current || print_tab || printer_tab)
3676 update_compatible_type(technology_changed, print_tab, (print_tab ? this : wxGetApp().get_tab(Preset::TYPE_PRINT))->m_show_incompatible_presets),
3677 update_compatible_type(technology_changed, false, wxGetApp().get_tab(Preset::TYPE_FILAMENT)->m_show_incompatible_presets));
3678 // Initialize the UI from the current preset.
3679 if (printer_tab)
3680 static_cast<TabPrinter*>(this)->update_pages();
3681
3682 if (! is_selected && printer_tab)
3683 {
3684 /* There is a case, when :
3685 * after Config Wizard applying we try to select previously selected preset, but
3686 * in a current configuration this one:
3687 * 1. doesn't exist now,
3688 * 2. have another printer_technology
3689 * So, it is necessary to update list of dependent tabs
3690 * to the corresponding printer_technology
3691 */
3697 }
3698
3699 // check if there is something in the cache to move to the new selected preset
3701
3703 }
3704
3705 if (technology_changed)
3706 wxGetApp().mainframe->technology_changed();
3707
3708 return !canceled;
3709}
virtual void load_current_preset()
Definition Tab.cpp:3365
bool may_discard_current_dirty_preset(PresetCollection *presets=nullptr, const std::string &new_printer_name="")
Definition Tab.cpp:3713
void apply_config_from_cache()
Definition Tab.cpp:1197
virtual bool delete_current_preset()
Definition Tab.cpp:4822
void select_printer(const std::string &full_name)
Definition Preset.cpp:2058
void unselect_printer()
Definition Preset.cpp:2095
static std::string get_preset_name(std::string full_name)
Definition Preset.cpp:1732
PresetCollection sla_prints
Definition PresetBundle.hpp:47
PresetCollection sla_materials
Definition PresetBundle.hpp:49
PresetCollection prints
Definition PresetBundle.hpp:46
PresetCollection filaments
Definition PresetBundle.hpp:48
Preset::Type type() const
Definition Preset.hpp:300
const std::deque< Preset > & get_presets() const
Definition Preset.hpp:393
void discard_current_changes()
Definition Preset.hpp:404
Preset * find_preset(const std::string &name, bool first_visible_if_not_found=false, bool respect_active_preset=true)
Definition Preset.cpp:1164
PresetWithVendorProfile get_preset_with_vendor_profile(const Preset &preset) const
Definition Preset.cpp:1122
size_t get_idx_selected()
Definition Preset.hpp:394
PresetWithVendorProfile get_edited_preset_with_vendor_profile() const
Definition Preset.hpp:387
Preset & default_preset(size_t idx=0)
Definition Preset.hpp:398
bool is_user() const
Definition Preset.hpp:144
static LISTID updates
Definition main.c:186
Type
Definition CustomGCode.hpp:14
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config)
Definition Preset.cpp:361
@ ptSLA
Definition Config.hpp:209
bool is_compatible_with_print(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_print, const PresetWithVendorProfile &active_printer)
Definition Preset.cpp:338

References _L, Slic3r::PresetCollection::current_is_dirty(), Slic3r::PresetCollection::discard_current_changes(), Slic3r::PresetCollection::get_edited_preset_with_vendor_profile(), Slic3r::is_compatible_with_print(), Slic3r::is_compatible_with_printer(), Slic3r::PresetWithVendorProfile::preset, Slic3r::printer_technology(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, Slic3r::ptSLA, and updates.

Referenced by Slic3r::GUI::Plater::priv::on_select_preset(), and Slic3r::GUI::PresetComboBox::selection_is_changed_according_to_physical_printers().

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

◆ select_preset_by_name()

bool Slic3r::GUI::Tab::select_preset_by_name ( const std::string &  name_w_suffix,
bool  force 
)
protectedvirtual

Reimplemented in Slic3r::GUI::TabFilament.

4813{
4814 return m_presets->select_preset_by_name(name_w_suffix, force);
4815}
bool select_preset_by_name(const std::string &name, bool force)
Definition Preset.cpp:1383

◆ set_tooltips_text()

void Slic3r::GUI::Tab::set_tooltips_text ( )
protected
4781{
4782 // --- Tooltip text for reset buttons (for whole options group)
4783 // Text to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
4784 m_ttg_value_lock = _(L("LOCKED LOCK icon indicates that the settings are the same as the system (or default) values "
4785 "for the current option group"));
4786 m_ttg_value_unlock = _(L("UNLOCKED LOCK icon indicates that some settings were changed and are not equal "
4787 "to the system (or default) values for the current option group.\n"
4788 "Click to reset all settings for current option group to the system (or default) values."));
4789 m_ttg_white_bullet_ns = _(L("WHITE BULLET icon indicates a non system (or non default) preset."));
4791 // Text to be shown on the "Undo user changes" button next to each input field.
4792 m_ttg_white_bullet = _(L("WHITE BULLET icon indicates that the settings are the same as in the last saved "
4793 "preset for the current option group."));
4794 m_ttg_value_revert = _(L("BACK ARROW icon indicates that the settings were changed and are not equal to "
4795 "the last saved preset for the current option group.\n"
4796 "Click to reset all settings for the current option group to the last saved preset."));
4797
4798 // --- Tooltip text for reset buttons (for each option in group)
4799 // Text to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
4800 m_tt_value_lock = _(L("LOCKED LOCK icon indicates that the value is the same as the system (or default) value."));
4801 m_tt_value_unlock = _(L("UNLOCKED LOCK icon indicates that the value was changed and is not equal "
4802 "to the system (or default) value.\n"
4803 "Click to reset current value to the system (or default) value."));
4804 // m_tt_white_bullet_ns= _(L("WHITE BULLET icon indicates a non system preset."));
4806 // Text to be shown on the "Undo user changes" button next to each input field.
4807 m_tt_white_bullet = _(L("WHITE BULLET icon indicates that the value is the same as in the last saved preset."));
4808 m_tt_value_revert = _(L("BACK ARROW icon indicates that the value was changed and is not equal to the last saved preset.\n"
4809 "Click to reset current value to the last saved preset."));
4810}
wxString m_ttg_white_bullet
Definition Tab.hpp:233
wxString m_ttg_value_lock
Definition Tab.hpp:227
wxString m_ttg_value_revert
Definition Tab.hpp:234

References _, and L.

Referenced by create_preset_tab().

+ Here is the caller graph for this function:

◆ set_type()

void Slic3r::GUI::Tab::set_type ( )
protected
95{
96 if (m_name == "print") { m_type = Slic3r::Preset::TYPE_PRINT; }
97 else if (m_name == "sla_print") { m_type = Slic3r::Preset::TYPE_SLA_PRINT; }
98 else if (m_name == "filament") { m_type = Slic3r::Preset::TYPE_FILAMENT; }
99 else if (m_name == "sla_material") { m_type = Slic3r::Preset::TYPE_SLA_MATERIAL; }
100 else if (m_name == "printer") { m_type = Slic3r::Preset::TYPE_PRINTER; }
101 else { m_type = Slic3r::Preset::TYPE_INVALID; assert(false); }
102}
std::string m_name
Definition Tab.hpp:165
@ TYPE_INVALID
Definition Preset.hpp:111

References m_name, m_type, 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.

◆ supports_printer_technology()

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

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

Referenced by Slic3r::GUI::MainFrame::add_created_tab(), and Slic3r::GUI::MainFrame::init_tabpanel().

+ Here is the caller graph for this function:

◆ sys_color_changed()

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

Reimplemented in Slic3r::GUI::TabFilament.

945{
947
948 // update buttons and cached bitmaps
949 for (const auto btn : m_scaled_buttons)
950 btn->sys_color_changed();
951 for (const auto bmp : m_scaled_bitmaps)
952 bmp->sys_color_changed();
955
957
958 // update icons for tree_ctrl
959 wxVector <wxBitmapBundle> img_bundles;
961 bmp.sys_color_changed();
962 img_bundles.push_back(bmp.bmp());
963 }
964 m_treectrl->SetImages(img_bundles);
965
966 // Colors for ui "decoration"
968#ifdef _WIN32
969 wxWindowUpdateLocker noUpdates(this);
970 if (m_mode_sizer)
972 wxGetApp().UpdateDarkUI(this);
973 wxGetApp().UpdateDarkUI(m_treectrl);
974#endif
976
977 // update options_groups
978 if (m_active_page)
980
981 Layout();
982 Refresh();
983}
void sys_color_changed()
Definition wxExtensions.cpp:740
virtual void sys_color_changed()
Definition wxExtensions.cpp:885
void sys_color_changed()
Definition Tab.cpp:4879
virtual void sys_color_changed()
Definition PresetComboBoxes.cpp:437
void update_label_colours()
Definition Tab.cpp:485
virtual void sys_color_changed()
Definition Tab.cpp:944
void update_changed_tree_ui()
Definition Tab.cpp:708
void update_show_hide_incompatible_button()
Definition Tab.cpp:4215

◆ title()

wxString Slic3r::GUI::Tab::title ( ) const
inline
298{ return m_title; }

References m_title.

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

+ 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 
)
1024{
1025 if (!m_active_page)
1026 return;
1027 Field* field = m_active_page->get_field(opt_key, opt_index);
1028 if (field)
1029 field->toggle(toggle);
1030};

References Slic3r::GUI::Field::toggle().

Referenced by get_config_manipulation().

+ 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

◆ toggle_show_hide_incompatible()

void Slic3r::GUI::Tab::toggle_show_hide_incompatible ( )

◆ transfer_options()

void Slic3r::GUI::Tab::transfer_options ( const std::string &  name_from,
const std::string &  name_to,
std::vector< std::string >  options 
)
3919{
3920 if (options.empty())
3921 return;
3922
3923 Preset* preset_from = m_presets->find_preset(name_from);
3924 Preset* preset_to = m_presets->find_preset(name_to);
3925
3927 auto it = std::find(options.begin(), options.end(), "extruders_count");
3928 if (it != options.end()) {
3929 // erase "extruders_count" option from the list
3930 options.erase(it);
3931 // cache the extruders count
3932 static_cast<TabPrinter*>(this)->cache_extruder_cnt(&preset_from->config);
3933 }
3934 }
3935 cache_config_diff(options, &preset_from->config);
3936
3937 if (name_to != m_presets->get_edited_preset().name )
3938 select_preset(preset_to->name);
3939
3942}

References Slic3r::Preset::config, and Slic3r::Preset::name.

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

+ Here is the caller graph for this function:

◆ translate_category()

wxString Slic3r::GUI::Tab::translate_category ( const wxString &  title,
Preset::Type  preset_type 
)
static
418{
419 if (preset_type == Preset::TYPE_PRINTER && title.Contains("Extruder ")) {
420 return _("Extruder") + title.SubString(8, title.Last());
421 }
422 return _(title);
423}

References _, and Slic3r::Preset::TYPE_PRINTER.

Referenced by Slic3r::Search::OptionsSearcher::append_options(), and Slic3r::Search::create_option().

+ Here is the caller graph for this function:

◆ tree_sel_change_delayed()

bool Slic3r::GUI::Tab::tree_sel_change_delayed ( )
protected
3836{
3837 // There is a bug related to Ubuntu overlay scrollbars, see https://github.com/prusa3d/PrusaSlicer/issues/898 and https://github.com/prusa3d/PrusaSlicer/issues/952.
3838 // The issue apparently manifests when Show()ing a window with overlay scrollbars while the UI is frozen. For this reason,
3839 // we will Thaw the UI prematurely on Linux. This means destroing the no_updates object prematurely.
3840#ifdef __linux__
3841 std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(this));
3842#else
3843 /* On Windows we use DoubleBuffering during rendering,
3844 * so on Window is no needed to call a Freeze/Thaw functions.
3845 * But under OSX (builds compiled with MacOSX10.14.sdk) wxStaticBitmap rendering is broken without Freeze/Thaw call.
3846 */
3847//#ifdef __WXOSX__ // Use Freeze/Thaw to avoid flickering during clear/activate new page
3848 wxWindowUpdateLocker noUpdates(this);
3849//#endif
3850#endif
3851
3852 Page* page = nullptr;
3853 const auto sel_item = m_treectrl->GetSelection();
3854 const auto selection = sel_item ? m_treectrl->GetItemText(sel_item) : "";
3855 for (auto p : m_pages)
3856 if (translate_category(p->title(), m_type) == selection)
3857 {
3858 page = p.get();
3859 m_is_nonsys_values = page->m_is_nonsys_values;
3860 m_is_modified_values = page->m_is_modified_values;
3861 break;
3862 }
3863 if (page == nullptr || m_active_page == page)
3864 return false;
3865
3866 // clear pages from the controls
3867 m_active_page = page;
3868
3869 auto throw_if_canceled = std::function<void()>([this](){
3870#ifdef WIN32
3871 CheckForInterrupt(m_treectrl);
3873 throw UIBuildCanceled();
3874#else // WIN32
3875 (void)this; // silence warning
3876#endif
3877 });
3878
3879 try {
3880 clear_pages();
3881 throw_if_canceled();
3882
3883 if (wxGetApp().mainframe!=nullptr && wxGetApp().mainframe->is_active_and_shown_tab(this))
3884 activate_selected_page(throw_if_canceled);
3885
3886 #ifdef __linux__
3887 no_updates.reset(nullptr);
3888 #endif
3889
3891 throw_if_canceled();
3892
3893 m_hsizer->Layout();
3894 throw_if_canceled();
3895 Refresh();
3896 } catch (const UIBuildCanceled&) {
3897 if (m_active_page)
3899 return true;
3900 }
3901
3902 return false;
3903}
void clear()
Definition Tab.cpp:4867
void update_undo_buttons()
Definition Tab.cpp:778
virtual void clear_pages()
Definition Tab.cpp:3768
bool m_page_switch_planned
Definition Tab.hpp:277
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
if(!(yy_init))
Definition lexer.c:1190

References Slic3r::GUI::Page::m_is_modified_values, Slic3r::GUI::Page::m_is_nonsys_values, and void().

+ Here is the call graph for this function:

◆ type()

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

References m_type.

◆ update()

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

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

Referenced by Slic3r::GUI::FreqChangedParams::FreqChangedParams(), and get_config_manipulation().

+ Here is the caller graph for this function:

◆ update_btns_enabling()

void Slic3r::GUI::Tab::update_btns_enabling ( )
3509{
3510 // we can delete any preset from the physical printer
3511 // and any user preset
3512 const Preset& preset = m_presets->get_edited_preset();
3514 || (!preset.is_default && !preset.is_system));
3515 m_btn_rename_preset->Show(!preset.is_default && !preset.is_system && !preset.is_external &&
3516 !wxGetApp().preset_bundle->physical_printers.has_selection());
3517
3520 _L("Edit physical printer") : _L("Add physical printer"));
3521 m_h_buttons_sizer->Layout();
3522}

References _L, Slic3r::Preset::is_default, Slic3r::Preset::is_external, and Slic3r::Preset::is_system.

◆ update_changed_tree_ui()

void Slic3r::GUI::Tab::update_changed_tree_ui ( )
709{
710 if (m_options_list.empty())
711 return;
712 auto cur_item = m_treectrl->GetFirstVisibleItem();
713 if (!cur_item || !m_treectrl->IsVisible(cur_item))
714 return;
715
716 auto selected_item = m_treectrl->GetSelection();
717 auto selection = selected_item ? m_treectrl->GetItemText(selected_item) : "";
718
719 while (cur_item) {
720 auto title = m_treectrl->GetItemText(cur_item);
721 for (auto page : m_pages)
722 {
723 if (translate_category(page->title(), m_type) != title)
724 continue;
725 bool sys_page = true;
726 bool modified_page = false;
727 if (page->title() == "General") {
728 std::initializer_list<const char*> optional_keys{ "extruders_count", "bed_shape" };
729 for (auto &opt_key : optional_keys) {
730 get_sys_and_mod_flags(opt_key, sys_page, modified_page);
731 }
732 }
733 if (m_type == Preset::TYPE_FILAMENT && page->title() == "Advanced") {
734 get_sys_and_mod_flags("filament_ramming_parameters", sys_page, modified_page);
735 }
736 if (page->title() == "Dependencies") {
738 sys_page = m_presets->get_selected_preset_parent() != nullptr;
739 modified_page = false;
740 } else {
742 get_sys_and_mod_flags("compatible_prints", sys_page, modified_page);
743 get_sys_and_mod_flags("compatible_printers", sys_page, modified_page);
744 }
745 }
746 for (auto group : page->m_optgroups)
747 {
748 if (!sys_page && modified_page)
749 break;
750 for (const auto &kvp : group->opt_map()) {
751 const std::string& opt_key = kvp.first;
752 get_sys_and_mod_flags(opt_key, sys_page, modified_page);
753 }
754 }
755
756 const wxColor *clr = sys_page ? (m_is_default_preset ? &m_default_text_clr : &m_sys_label_clr) :
757 modified_page ? &m_modified_label_clr :
759
760 if (page->set_item_colour(clr))
761 m_treectrl->SetItemTextColour(cur_item, *clr);
762
763 page->m_is_nonsys_values = !sys_page;
764 page->m_is_modified_values = modified_page;
765
766 if (selection == title) {
767 m_is_nonsys_values = page->m_is_nonsys_values;
768 m_is_modified_values = page->m_is_modified_values;
769 }
770 break;
771 }
772 auto next_item = m_treectrl->GetNextVisible(cur_item);
773 cur_item = next_item;
774 }
776}
void get_sys_and_mod_flags(const std::string &opt_key, bool &sys_page, bool &modified_page)
Definition Tab.cpp:698
static constexpr const std::initializer_list< const char * > optional_keys
Definition Preset.cpp:1331

References Slic3r::optional_keys, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINTER, and Slic3r::Preset::TYPE_SLA_MATERIAL.

◆ update_changed_ui()

void Slic3r::GUI::Tab::update_changed_ui ( )
612{
614 return;
615
616 const bool deep_compare = m_type != Preset::TYPE_FILAMENT;
617 auto dirty_options = m_presets->current_dirty_options(deep_compare);
618 auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare);
620 {
621 auto check_bed_custom_options = [](std::vector<std::string>& keys) {
622 size_t old_keys_size = keys.size();
623 keys.erase(std::remove_if(keys.begin(), keys.end(), [](const std::string& key) {
624 return key == "bed_custom_texture" || key == "bed_custom_model"; }), keys.end());
625 if (old_keys_size != keys.size() && std::find(keys.begin(), keys.end(), "bed_shape") == keys.end())
626 keys.emplace_back("bed_shape");
627 };
628 check_bed_custom_options(dirty_options);
629 check_bed_custom_options(nonsys_options);
630 }
631
632 if (static_cast<TabPrinter*>(this)->m_printer_technology == ptFFF) {
633 TabPrinter* tab = static_cast<TabPrinter*>(this);
634 if (tab->m_initial_extruders_count != tab->m_extruders_count)
635 dirty_options.emplace_back("extruders_count");
636 if (tab->m_sys_extruders_count != tab->m_extruders_count)
637 nonsys_options.emplace_back("extruders_count");
638 }
639 }
640
641 for (auto& it : m_options_list)
642 it.second = m_opt_status_value;
643
644 for (auto opt_key : dirty_options) m_options_list[opt_key] &= ~osInitValue;
645 for (auto opt_key : nonsys_options) m_options_list[opt_key] &= ~osSystemValue;
646
647 decorate();
648
649 wxTheApp->CallAfter([this]() {
650 if (parent()) //To avoid a crash, parent should be exist for a moment of a tree updating
652 });
653}
void decorate()
Definition Tab.cpp:541
std::vector< std::string > current_dirty_options(const bool deep_compare=false) const
Definition Preset.hpp:479
std::vector< std::string > current_different_from_parent_options(const bool deep_compare=false) const
Definition Preset.hpp:482

References Slic3r::GUI::TabPrinter::m_extruders_count, Slic3r::GUI::TabPrinter::m_initial_extruders_count, Slic3r::GUI::TabPrinter::m_sys_extruders_count, Slic3r::ptFFF, Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::TYPE_PRINTER.

◆ update_description_lines()

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

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

3789{
3792}
void update_preset_description_line()
Definition Tab.cpp:1296

Referenced by Slic3r::GUI::TabSLAMaterial::update(), and Slic3r::GUI::TabSLAPrint::update_description_lines().

+ Here is the caller graph for this function:

◆ update_dirty()

void Slic3r::GUI::Tab::update_dirty ( )

Referenced by Slic3r::GUI::FreqChangedParams::FreqChangedParams(), Slic3r::GUI::TabSLAMaterial::build(), get_config_manipulation(), Slic3r::GUI::Plater::priv::undo_redo_to(), and Slic3r::GUI::validate_custom_gcode_cb().

+ Here is the caller graph for this function:

◆ update_frequently_changed_parameters()

void Slic3r::GUI::Tab::update_frequently_changed_parameters ( )
protected
1378{
1379 const bool is_fff = supports_printer_technology(ptFFF);
1380 auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff);
1381 if (!og_freq_chng_params) return;
1382
1383 og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
1384 if (! is_fff)
1385 og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
1386
1387 const std::string updated_value_key = is_fff ? "fill_density" : "pad_enable";
1388
1389 const boost::any val = og_freq_chng_params->get_config_value(*m_config, updated_value_key);
1390 og_freq_chng_params->set_value(updated_value_key, val);
1391
1392 if (is_fff)
1393 {
1394 og_freq_chng_params->set_value("brim", bool(m_config->opt_float("brim_width") > 0.0));
1396 }
1397}

References Slic3r::GUI::pad_combo_value_for_config(), Slic3r::ptFFF, and Slic3r::GUI::support_combo_value_for_config().

+ Here is the call graph for this function:

◆ update_label_colours()

void Slic3r::GUI::Tab::update_label_colours ( )
486{
487 m_default_text_clr = wxGetApp().get_label_clr_default();
488 if (m_sys_label_clr == wxGetApp().get_label_clr_sys() && m_modified_label_clr == wxGetApp().get_label_clr_modified())
489 return;
490 m_sys_label_clr = wxGetApp().get_label_clr_sys();
491 m_modified_label_clr = wxGetApp().get_label_clr_modified();
492
493 //update options "decoration"
494 for (const auto& opt : m_options_list)
495 {
496 const wxColour *color = &m_sys_label_clr;
497
498 // value isn't equal to system value
499 if ((opt.second & osSystemValue) == 0) {
500 // value is equal to last saved
501 if ((opt.second & osInitValue) != 0)
502 color = &m_default_text_clr;
503 // value is modified
504 else
505 color = &m_modified_label_clr;
506 }
508 if (Line* line = get_line(opt.first))
509 line->set_label_colour(color);
510 continue;
511 }
512
513 Field* field = get_field(opt.first);
514 if (field == nullptr) continue;
515 field->set_label_colour(color);
516 }
517
518 auto cur_item = m_treectrl->GetFirstVisibleItem();
519 if (!cur_item || !m_treectrl->IsVisible(cur_item))
520 return;
521 while (cur_item) {
522 auto title = m_treectrl->GetItemText(cur_item);
523 for (auto page : m_pages)
524 {
525 if (translate_category(page->title(), m_type) != title)
526 continue;
527
528 const wxColor *clr = !page->m_is_nonsys_values ? &m_sys_label_clr :
529 page->m_is_modified_values ? &m_modified_label_clr :
531
532 m_treectrl->SetItemTextColour(cur_item, *clr);
533 break;
534 }
535 cur_item = m_treectrl->GetNextVisible(cur_item);
536 }
537
538 decorate();
539}

References Slic3r::GUI::UndoValueUIManager::set_label_colour().

+ Here is the call graph for this function:

◆ update_mode()

void Slic3r::GUI::Tab::update_mode ( )
893{
894 m_mode = wxGetApp().get_mode();
895
896 // update mode for ModeSizer
897 if (m_mode_sizer)
899
901
903}
void SetMode(const int mode)
Definition wxExtensions.cpp:722

◆ update_mode_markers()

void Slic3r::GUI::Tab::update_mode_markers ( )
906{
907 // update mode for ModeSizer
908 if (m_mode_sizer)
910
911 if (m_active_page)
913}
void update_mode_markers()
Definition wxExtensions.cpp:746

◆ update_preset_choice()

void Slic3r::GUI::Tab::update_preset_choice ( )
3525{
3528}

Referenced by Slic3r::GUI::PresetComboBox::selection_is_changed_according_to_physical_printers().

+ Here is the caller graph for this function:

◆ update_preset_description_line()

void Slic3r::GUI::Tab::update_preset_description_line ( )
protected
1297{
1298 const Preset* parent = m_presets->get_selected_preset_parent();
1299 const Preset& preset = m_presets->get_edited_preset();
1300
1301 wxString description_line;
1302
1303 if (preset.is_default) {
1304 description_line = _(L("This is a default preset."));
1305 } else if (preset.is_system) {
1306 description_line = _(L("This is a system preset."));
1307 } else if (parent == nullptr) {
1308 description_line = _(L("Current preset is inherited from the default preset."));
1309 } else {
1310 std::string name = parent->name;
1311 boost::replace_all(name, "&", "&&");
1312 description_line = _(L("Current preset is inherited from")) + ":\n\t" + from_u8(name);
1313 }
1314
1315 if (preset.is_default || preset.is_system)
1316 description_line += "\n\t" + _(L("It can't be deleted or modified.")) +
1317 "\n\t" + _(L("Any modifications should be saved as a new preset inherited from this one.")) +
1318 "\n\t" + _(L("To do that please specify a new name for the preset."));
1319
1320 if (parent && parent->vendor)
1321 {
1322 description_line += "\n\n" + _(L("Additional information:")) + "\n";
1323 description_line += "\t" + _(L("vendor")) + ": " + (m_type == Slic3r::Preset::TYPE_PRINTER ? "\n\t\t" : "") + parent->vendor->name +
1324 ", ver: " + parent->vendor->config_version.to_string();
1326 const std::string &printer_model = preset.config.opt_string("printer_model");
1327 if (! printer_model.empty())
1328 description_line += "\n\n\t" + _(L("printer model")) + ": \n\t\t" + printer_model;
1329 switch (preset.printer_technology()) {
1330 case ptFFF:
1331 {
1332 //FIXME add prefered_sla_material_profile for SLA
1333 const std::string &default_print_profile = preset.config.opt_string("default_print_profile");
1334 const std::vector<std::string> &default_filament_profiles = preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
1335 if (!default_print_profile.empty())
1336 description_line += "\n\n\t" + _(L("default print profile")) + ": \n\t\t" + default_print_profile;
1337 if (!default_filament_profiles.empty())
1338 {
1339 description_line += "\n\n\t" + _(L("default filament profile")) + ": \n\t\t";
1340 for (auto& profile : default_filament_profiles) {
1341 if (&profile != &*default_filament_profiles.begin())
1342 description_line += ", ";
1343 description_line += profile;
1344 }
1345 }
1346 break;
1347 }
1348 case ptSLA:
1349 {
1350 //FIXME add prefered_sla_material_profile for SLA
1351 const std::string &default_sla_material_profile = preset.config.opt_string("default_sla_material_profile");
1352 if (!default_sla_material_profile.empty())
1353 description_line += "\n\n\t" + _(L("default SLA material profile")) + ": \n\t\t" + default_sla_material_profile;
1354
1355 const std::string &default_sla_print_profile = preset.config.opt_string("default_sla_print_profile");
1356 if (!default_sla_print_profile.empty())
1357 description_line += "\n\n\t" + _(L("default SLA print profile")) + ": \n\t\t" + default_sla_print_profile;
1358 break;
1359 }
1360 default: break;
1361 }
1362 }
1363 else if (!preset.alias.empty())
1364 {
1365 description_line += "\n\n\t" + _(L("full profile name")) + ": \n\t\t" + preset.name;
1366 description_line += "\n\t" + _(L("symbolic profile name")) + ": \n\t\t" + preset.alias;
1367 }
1368 }
1369
1370 m_parent_preset_description_line->SetText(description_line, false);
1371
1373 m_detach_preset_btn->Show(parent && parent->is_system && !preset.is_default);
1374 Layout();
1375}
void SetText(const wxString &value, bool wrap=true)
Definition OptionsGroup.cpp:1045

References _, Slic3r::Preset::alias, Slic3r::Preset::config, Slic3r::VendorProfile::config_version, Slic3r::GUI::from_u8(), Slic3r::Preset::is_default, Slic3r::Preset::is_system, L, Slic3r::VendorProfile::name, Slic3r::Preset::name, Slic3r::ConfigBase::opt_string(), Slic3r::ConfigBase::option(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, Slic3r::ptSLA, Slic3r::Semver::to_string(), Slic3r::Preset::TYPE_PRINTER, and Slic3r::Preset::vendor.

+ Here is the call graph for this function:

◆ update_saved_preset_from_current_preset()

void Slic3r::GUI::Tab::update_saved_preset_from_current_preset ( )
void update_saved_preset_from_current_preset()
Definition Preset.hpp:492

◆ update_show_hide_incompatible_button()

void Slic3r::GUI::Tab::update_show_hide_incompatible_button ( )
4216{
4217 m_btn_hide_incompatible_presets->SetBitmap(*get_bmp_bundle(m_show_incompatible_presets ? "flag_red" : "flag_green"));
4219 "Both compatible an incompatible presets are shown. Click to hide presets not compatible with the current printer." :
4220 "Only compatible presets are shown. Click to show both the presets compatible and not compatible with the current printer.");
4221}
wxBitmapBundle * get_bmp_bundle(const std::string &bmp_name_in, int px_cnt, const std::string &new_color)
Definition wxExtensions.cpp:420

References get_bmp_bundle().

+ Here is the call graph for this function:

◆ update_tab_ui()

void Slic3r::GUI::Tab::update_tab_ui ( )
864{
866}

◆ update_ui_from_settings()

void Slic3r::GUI::Tab::update_ui_from_settings ( )
4224{
4225 // Show the 'show / hide presets' button only for the print and filament tabs, and only if enabled
4226 // in application preferences.
4227 m_show_btn_incompatible_presets = wxGetApp().app_config->get("show_incompatible_presets")[0] == '1' ? true : false;
4229 Layout();
4231 // If the 'show / hide presets' button is hidden, hide the incompatible presets.
4232 if (show) {
4234 }
4235 else {
4238 update_tab_ui();
4239 }
4240 }
4241}

References Slic3r::Preset::TYPE_PRINTER.

◆ update_ui_items_related_on_parent_preset()

void Slic3r::GUI::Tab::update_ui_items_related_on_parent_preset ( const Preset selected_preset_parent)
3356{
3357 m_is_default_preset = selected_preset_parent != nullptr && selected_preset_parent->is_default;
3358
3359 m_bmp_non_system = selected_preset_parent ? &m_bmp_value_unlock : &m_bmp_white_bullet;
3360 m_ttg_non_system = selected_preset_parent ? &m_ttg_value_unlock : &m_ttg_white_bullet_ns;
3361 m_tt_non_system = selected_preset_parent ? &m_tt_value_unlock : &m_ttg_white_bullet_ns;
3362}

References Slic3r::Preset::is_default.

◆ update_undo_buttons()

void Slic3r::GUI::Tab::update_undo_buttons ( )
779{
782
783 //m_undo_btn-> SetBitmap_(m_is_modified_values ? m_bmp_value_revert: m_bmp_white_bullet);
784 //m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
785
788}

◆ update_visibility()

void Slic3r::GUI::Tab::update_visibility ( )
916{
917 Freeze(); // There is needed Freeze/Thaw to avoid a flashing after Show/Layout
918
919 for (auto page : m_pages)
920 page->update_visibility(m_mode, page.get() == m_active_page);
922
925
926 Layout();
927 Thaw();
928}
constexpr auto get(span< E, S > s) -> decltype(s[N])
Definition span.hpp:590

References Slic3r::Preset::TYPE_PRINTER.

◆ update_wiping_button_visibility()

void Slic3r::GUI::Tab::update_wiping_button_visibility ( )
1127 {
1129 return; // ys_FIXME
1130 bool wipe_tower_enabled = dynamic_cast<ConfigOptionBool*>( (m_preset_bundle->prints.get_edited_preset().config ).option("wipe_tower"))->value;
1131 bool multiple_extruders = dynamic_cast<ConfigOptionFloats*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1;
1132 bool single_extruder_multi_material = dynamic_cast<ConfigOptionBool*>((m_preset_bundle->printers.get_edited_preset().config).option("single_extruder_multi_material"))->value;
1133
1134 auto wiping_dialog_button = wxGetApp().sidebar().get_wiping_dialog_button();
1135 if (wiping_dialog_button) {
1136 wiping_dialog_button->Show(wipe_tower_enabled && multiple_extruders && single_extruder_multi_material);
1137 wiping_dialog_button->GetParent()->Layout();
1138 }
1139}
ConfigOptionBool
Definition PrintConfig.hpp:665

References Slic3r::ptSLA, and Slic3r::ConfigOptionVector< T >::size().

+ Here is the call graph for this function:

◆ validate_custom_gcode()

bool Slic3r::GUI::Tab::validate_custom_gcode ( const wxString &  title,
const std::string &  gcode 
)
static
1812{
1813 std::vector<std::string> tags;
1814 bool invalid = GCodeProcessor::contains_reserved_tags(gcode, 5, tags);
1815 if (invalid) {
1816 std::string lines = ":\n";
1817 for (const std::string& keyword : tags)
1818 lines += ";" + keyword + "\n";
1819 wxString reports = format_wxstr(
1820 _L_PLURAL("The following line %s contains reserved keywords.\nPlease remove it, as it may cause problems in G-code visualization and printing time estimation.",
1821 "The following lines %s contain reserved keywords.\nPlease remove them, as they may cause problems in G-code visualization and printing time estimation.",
1822 tags.size()),
1823 lines);
1824 //wxMessageDialog dialog(wxGetApp().mainframe, reports, _L("Found reserved keywords in") + " " + _(title), wxICON_WARNING | wxOK);
1825 MessageDialog dialog(wxGetApp().mainframe, reports, _L("Found reserved keywords in") + " " + _(title), wxICON_WARNING | wxOK);
1826 dialog.ShowModal();
1827 }
1828 return !invalid;
1829}
static bool contains_reserved_tags(const std::string &gcode, unsigned int max_count, std::vector< std::string > &found_tag)
Definition GCodeProcessor.cpp:514
TOKEN * keyword(int primary)
Definition config.c:261

References _, _L, _L_PLURAL, Slic3r::GCodeProcessor::contains_reserved_tags(), Slic3r::GUI::format_wxstr(), and keyword().

Referenced by Slic3r::DoubleSlider::get_custom_code().

+ 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 ( )
4693{
4695 (m_type != Preset::TYPE_PRINTER || static_cast<TabPrinter*>(this)->m_printer_technology != ptFFF))
4696 return true;
4697 if (m_active_page->title() != L("Custom G-code"))
4698 return true;
4699
4700 // When we switch Settings tab after editing of the custom g-code, then warning message could ba already shown after KillFocus event
4701 // and then it's no need to show it again
4704 return true;
4705 }
4706
4707 bool valid = true;
4708 for (auto opt_group : m_active_page->m_optgroups) {
4709 assert(opt_group->opt_map().size() == 1);
4710 if (!opt_group->is_activated())
4711 break;
4712 std::string key = opt_group->opt_map().begin()->first;
4713 if (key == "autoemit_temperature_commands")
4714 continue;
4715 valid &= validate_custom_gcode(opt_group->title, boost::any_cast<std::string>(opt_group->get_value(key)));
4716 if (!valid)
4717 break;
4718 }
4719 return valid;
4720}
static bool validate_custom_gcode(const wxString &title, const std::string &gcode)
Definition Tab.cpp:1811
bool validate_custom_gcodes_was_shown
Definition Tab.hpp:390

References L, and Slic3r::ptFFF.

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_active_page

Page* Slic3r::GUI::Tab::m_active_page {nullptr}
protected

◆ m_bmp_non_system

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

Referenced by create_preset_tab().

◆ m_bmp_value_lock

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

Referenced by create_preset_tab().

◆ m_bmp_value_revert

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

Referenced by create_preset_tab().

◆ m_bmp_value_unlock

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

Referenced by create_preset_tab().

◆ m_bmp_white_bullet

ScalableBitmap Slic3r::GUI::Tab::m_bmp_white_bullet
protected

Referenced by create_preset_tab().

◆ m_btn_compare_preset

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

Referenced by create_preset_tab().

◆ m_btn_delete_preset

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

Referenced by create_preset_tab().

◆ m_btn_edit_ph_printer

ScalableButton* Slic3r::GUI::Tab::m_btn_edit_ph_printer {nullptr}
protected

Referenced by create_preset_tab().

◆ m_btn_hide_incompatible_presets

ScalableButton* Slic3r::GUI::Tab::m_btn_hide_incompatible_presets
protected

Referenced by create_preset_tab().

◆ m_btn_rename_preset

ScalableButton* Slic3r::GUI::Tab::m_btn_rename_preset
protected

Referenced by create_preset_tab().

◆ m_btn_save_preset

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

Referenced by create_preset_tab().

◆ m_cache_config

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

◆ m_category_icon

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

Referenced by get_category_icon_map().

◆ m_compatible_printers

PresetDependencies Slic3r::GUI::Tab::m_compatible_printers
protected

Referenced by Tab().

◆ m_compatible_prints

PresetDependencies Slic3r::GUI::Tab::m_compatible_prints
protected

Referenced by Tab().

◆ m_completed

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

Referenced by completed().

◆ m_config

◆ m_config_manipulation

◆ m_default_text_clr

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

Referenced by create_preset_tab().

◆ m_dependent_tabs

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

◆ m_detach_preset_btn

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

◆ m_disable_tree_sel_changed_event

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

Referenced by create_preset_tab().

◆ m_em_unit

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

Referenced by Tab(), and create_preset_tab().

◆ m_h_buttons_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_h_buttons_sizer
protected

Referenced by create_preset_tab().

◆ m_highlighter

HighlighterForWx Slic3r::GUI::Tab::m_highlighter
protected

Referenced by Tab().

◆ m_hsizer

wxBoxSizer* Slic3r::GUI::Tab::m_hsizer
protected

Referenced by create_preset_tab().

◆ m_icon_count

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

Referenced by create_preset_tab().

◆ m_icon_descriptions

std::vector<GUI_Descriptions::ButtonEntry> Slic3r::GUI::Tab::m_icon_descriptions = {}
protected

Referenced by create_preset_tab().

◆ m_icon_index

std::map<std::string, size_t> Slic3r::GUI::Tab::m_icon_index
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_left_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_left_sizer
protected

Referenced by create_preset_tab().

◆ m_mode

ConfigOptionMode Slic3r::GUI::Tab::m_mode = comExpert
protected

◆ m_mode_sizer

ModeSizer* Slic3r::GUI::Tab::m_mode_sizer {nullptr}
protected

Referenced by create_preset_tab().

◆ m_modified_label_clr

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

Referenced by create_preset_tab().

◆ m_name

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

Referenced by set_type().

◆ m_opt_status_value

int Slic3r::GUI::Tab::m_opt_status_value = 0
protected

◆ m_options_list

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

◆ m_page_sizer

wxBoxSizer* Slic3r::GUI::Tab::m_page_sizer {nullptr}
protected

◆ 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

◆ m_page_view

wxScrolledWindow* Slic3r::GUI::Tab::m_page_view {nullptr}
protected

◆ m_pages

std::vector<PageShp> Slic3r::GUI::Tab::m_pages
protected

Referenced by create_preset_tab().

◆ m_parent

wxBookCtrlBase* Slic3r::GUI::Tab::m_parent
private

Referenced by Tab(), and parent().

◆ m_parent_preset_description_line

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

◆ m_postpone_update_ui

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

◆ m_preset_bundle

◆ m_presets

◆ m_presets_choice

TabPresetComboBox* Slic3r::GUI::Tab::m_presets_choice
protected

Referenced by create_preset_tab().

◆ m_question_btn

ScalableButton* Slic3r::GUI::Tab::m_question_btn
protected

Referenced by create_preset_tab().

◆ 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

Referenced by create_preset_tab().

◆ m_scaled_icons_list

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

◆ m_search_btn

ScalableButton* Slic3r::GUI::Tab::m_search_btn
protected

Referenced by create_preset_tab().

◆ m_show_btn_incompatible_presets

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

◆ m_show_incompatible_presets

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

Referenced by create_preset_tab().

◆ m_sys_label_clr

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

Referenced by create_preset_tab().

◆ m_title

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

Referenced by title().

◆ m_top_hsizer

wxBoxSizer* Slic3r::GUI::Tab::m_top_hsizer
protected

Referenced by create_preset_tab().

◆ m_treectrl

wxTreeCtrl* Slic3r::GUI::Tab::m_treectrl
protected

Referenced by create_preset_tab().

◆ 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

◆ m_tt_value_revert

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

◆ 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

◆ m_ttg_white_bullet_ns

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

◆ m_type

Preset::Type Slic3r::GUI::Tab::m_type
protected

Referenced by create_preset_tab(), set_type(), and type().

◆ m_undo_btn

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

Referenced by create_preset_tab().

◆ m_undo_to_sys_btn

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

Referenced by create_preset_tab().

◆ m_update_cnt

int Slic3r::GUI::Tab::m_update_cnt = 0

◆ 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: