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

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

Inheritance diagram for Slic3r::GUI::ObjectTableSettings:
Collaboration diagram for Slic3r::GUI::ObjectTableSettings:

Public Member Functions

 ObjectTableSettings (wxWindow *parent, ObjectGridTable *table)
 ~ObjectTableSettings ()
bool update_settings_list (bool is_object, bool is_multiple_selection, ModelObject *object, ModelConfig *config, const std::string &category)
bool add_missed_options (ModelConfig *config_to, const DynamicPrintConfig &config_from)
int update_extra_column_visible_status (ConfigOptionsGroup *option_group, const std::vector< SimpleSettingData > &option_keys, ModelConfig *config)
void update_config_values (bool is_object, ModelObject *object, ModelConfig *config, const std::string &category, const std::string &changed_opt_key="")
void UpdateAndShowRow (int row, const bool show, bool is_object, bool is_multiple_selection, ModelObject *object, ModelConfig *config, const std::string &category)
void ValueChanged (int row, bool is_object, ModelObject *object, ModelConfig *config, const std::string &category, const std::string &key)
void resetAllValues (int row, bool is_object, ModelObject *object, ModelConfig *config, const std::string &category)
void msw_rescale ()
virtual bool IsShown ()
virtual void Show (const bool show)
virtual void Hide ()
virtual void UpdateAndShow (const bool show)
virtual wxSizer * get_sizer ()
ConfigOptionsGroup * get_og ()
wxWindow * parent () const

Protected Attributes

std::shared_ptr< ConfigOptionsGroup > m_og
wxWindow * m_parent

Private Attributes

wxBoxSizer * m_settings_list_sizer { nullptr }
std::vector< std::shared_ptr< ConfigOptionsGroup > > m_og_settings
DynamicPrintConfig m_current_config
DynamicPrintConfig m_origin_config
ScalableBitmap m_bmp_reset
ScalableBitmap m_bmp_reset_focus
ScalableBitmap m_bmp_reset_disable
ObjectGridTable * m_table { nullptr }
int m_current_row { 0 }
std::string m_current_category
int m_current_different { 0 }
std::map< std::string, int > m_different_map

Detailed Description

Constructor & Destructor Documentation

◆ ObjectTableSettings()

Slic3r::GUI::ObjectTableSettings::ObjectTableSettings ( wxWindow * parent,
ObjectGridTable * table )
78 :
79 OTG_Settings(parent, true), m_table(table)
80{
81 m_og->activate();
82 //m_og->set_name(_(L("Per-Object Settings")));
83
84 m_settings_list_sizer = new wxBoxSizer(wxVERTICAL);
85 m_og->sizer->Add(m_settings_list_sizer, 1, wxEXPAND | wxLEFT, 5);
86
87 m_bmp_reset = ScalableBitmap(parent, "lock_normal");
88 m_bmp_reset_focus = ScalableBitmap(parent, "lock_normal");
89 //TODO, adjust later
90 m_bmp_reset_disable = ScalableBitmap(parent, "dot");
91}
OTG_Settings(wxWindow *parent, const bool staticbox)
Definition GUI_ObjectTableSettings.cpp:43
std::shared_ptr< ConfigOptionsGroup > m_og
Definition GUI_ObjectTableSettings.hpp:31
wxWindow * parent() const
Definition GUI_ObjectTableSettings.hpp:44
wxBoxSizer * m_settings_list_sizer
Definition GUI_ObjectTableSettings.hpp:51
ScalableBitmap m_bmp_reset_disable
Definition GUI_ObjectTableSettings.hpp:59
ObjectGridTable * m_table
Definition GUI_ObjectTableSettings.hpp:61
ScalableBitmap m_bmp_reset_focus
Definition GUI_ObjectTableSettings.hpp:58
ScalableBitmap m_bmp_reset
Definition GUI_ObjectTableSettings.hpp:57

References Slic3r::GUI::OTG_Settings::OTG_Settings(), m_bmp_reset, m_bmp_reset_disable, m_bmp_reset_focus, Slic3r::GUI::OTG_Settings::m_og, m_settings_list_sizer, m_table, and Slic3r::GUI::OTG_Settings::parent().

Here is the call graph for this function:

◆ ~ObjectTableSettings()

Slic3r::GUI::ObjectTableSettings::~ObjectTableSettings ( )
inline
70 {
71 m_different_map.clear();
72 }
std::map< std::string, int > m_different_map
Definition GUI_ObjectTableSettings.hpp:65

References m_different_map.

Member Function Documentation

◆ add_missed_options()

bool Slic3r::GUI::ObjectTableSettings::add_missed_options ( ModelConfig * config_to,
const DynamicPrintConfig & config_from )
337{
338 bool is_added = false;
339 if (wxGetApp().plater()->printer_technology() == ptFFF)
340 {
341 if (config_to->has("sparse_infill_density") && !config_to->has("sparse_infill_pattern"))
342 {
343 if (config_from.option<ConfigOptionPercent>("sparse_infill_density")->value == 100) {
344 config_to->set_key_value("sparse_infill_pattern", config_from.option("sparse_infill_pattern")->clone());
345 is_added = true;
346 }
347 }
348 }
349
350 return is_added;
351}
static PrinterTechnology printer_technology()
Definition GUI_Factories.cpp:60
static Plater * plater()
Definition GUI_Factories.cpp:400
@ ptFFF
Definition Config.hpp:231

References Slic3r::ConfigOption::clone(), Slic3r::ModelConfig::has(), Slic3r::ConfigBase::option(), Slic3r::GUI::plater(), Slic3r::GUI::printer_technology(), Slic3r::ptFFF, Slic3r::ModelConfig::set_key_value(), and Slic3r::ConfigOptionSingle< T >::value.

Here is the call graph for this function:

◆ get_og()

ConfigOptionsGroup * Slic3r::GUI::OTG_Settings::get_og ( )
inlineinherited
43{ return m_og.get(); }

References m_og.

◆ get_sizer()

wxSizer * Slic3r::GUI::OTG_Settings::get_sizer ( )
virtualinherited
72{
73 return m_og->sizer;
74}

References m_og.

◆ Hide()

void Slic3r::GUI::OTG_Settings::Hide ( )
virtualinherited
61{
62 Show(false);
63}
virtual void Show(const bool show)
Definition GUI_ObjectTableSettings.cpp:55

References Show().

Here is the call graph for this function:

◆ IsShown()

bool Slic3r::GUI::OTG_Settings::IsShown ( )
virtualinherited
51{
52 return m_og->sizer->IsEmpty() ? false : m_og->sizer->IsShown(size_t(0));
53}

References m_og.

◆ msw_rescale()

void Slic3r::GUI::ObjectTableSettings::msw_rescale ( )
553{
554 for (auto group : m_og_settings)
555 group->msw_rescale();
556}
std::vector< std::shared_ptr< ConfigOptionsGroup > > m_og_settings
Definition GUI_ObjectTableSettings.hpp:53

References m_og_settings.

◆ parent()

wxWindow * Slic3r::GUI::OTG_Settings::parent ( ) const
inlineinherited
44{return m_parent; }
wxWindow * m_parent
Definition GUI_ObjectTableSettings.hpp:32

References m_parent.

Referenced by Slic3r::GUI::ObjectTableSettings::ObjectTableSettings(), OTG_Settings(), and Slic3r::GUI::ObjectTableSettings::update_settings_list().

Here is the caller graph for this function:

◆ resetAllValues()

void Slic3r::GUI::ObjectTableSettings::resetAllValues ( int row,
bool is_object,
ModelObject * object,
ModelConfig * config,
const std::string & category )
515{
516 if ((row != m_current_row) || (category != m_current_category))
517 return;
518
519 if (category == ObjectGridTable::category_all) {
520 std::map<std::string, std::vector<SimpleSettingData>> cat_options;
521
522 //get the category and settings
523 cat_options = SettingsFactory::get_all_visible_options(!is_object);
524 std::map<std::string, std::vector<SimpleSettingData>>::iterator it1 = cat_options.begin();
525
526 while (it1 != cat_options.end())
527 {
528 std::vector<SimpleSettingData>& settings = it1->second;
529 std::vector<SimpleSettingData>::iterator it2 = settings.begin();
530
531 while ( it2 != settings.end() )
532 {
533 config->erase(it2->name);
534 it2++;
535 }
536 it1++;
537 }
538 }
539 else {
540 // Initialize UI components with the config values.
541 std::vector<SimpleSettingData> category_settings = SettingsFactory::get_visible_options(category, !is_object);
542 for (auto& opt : category_settings)
543 {
544 config->erase(opt.name);
545 }
546 }
548 m_current_config.apply(config->get(), true);
549 update_config_values(is_object, object, config, category);
550}
static std::string category_all
Definition GUI_ObjectTable.hpp:286
DynamicPrintConfig m_current_config
Definition GUI_ObjectTableSettings.hpp:55
void update_config_values(bool is_object, ModelObject *object, ModelConfig *config, const std::string &category, const std::string &changed_opt_key="")
Definition GUI_ObjectTableSettings.cpp:389
int m_current_row
Definition GUI_ObjectTableSettings.hpp:62
DynamicPrintConfig m_origin_config
Definition GUI_ObjectTableSettings.hpp:56
std::string m_current_category
Definition GUI_ObjectTableSettings.hpp:63
static std::vector< SimpleSettingData > get_visible_options(const std::string &category, const bool is_part)
Definition GUI_Factories.cpp:220
static std::map< std::string, std::vector< SimpleSettingData > > get_all_visible_options(const bool is_part)
Definition GUI_Factories.cpp:268

References Slic3r::GUI::ObjectGridTable::category_all, Slic3r::ModelConfig::erase(), Slic3r::ModelConfig::get(), Slic3r::GUI::SettingsFactory::get_all_visible_options(), Slic3r::GUI::SettingsFactory::get_visible_options(), m_current_category, m_current_config, m_current_row, m_origin_config, and update_config_values().

Here is the call graph for this function:

◆ Show()

void Slic3r::GUI::OTG_Settings::Show ( const bool show)
virtualinherited
56{
57 m_og->Show(show);
58}

References m_og.

Referenced by Hide(), Slic3r::GUI::ObjectTableSettings::update_settings_list(), and UpdateAndShow().

Here is the caller graph for this function:

◆ update_config_values()

void Slic3r::GUI::ObjectTableSettings::update_config_values ( bool is_object,
ModelObject * object,
ModelConfig * config,
const std::string & category,
const std::string & changed_opt_key = "" )
390{
391 int different_count = 0;
392 const auto printer_technology = wxGetApp().plater()->printer_technology();
393
394 if (!object || !config)
395 return;
396
397 // update config values according to configuration hierarchy
398 DynamicPrintConfig &main_config = m_current_config;
399
400
401 auto toggle_field = [this](const t_config_option_key & opt_key, bool toggle, int opt_index)
402 {
403 Field* field = nullptr;
404 for (auto og : m_og_settings) {
405 field = og->get_fieldc(opt_key, opt_index);
406 if (field != nullptr)
407 break;
408 }
409 if (field)
410 field->toggle(toggle);
411 };
412 auto toggle_line = [this](const t_config_option_key &opt_key, bool toggle, int opt_index) {
413 for (auto og : m_og_settings) {
414 Line *line = og->get_line(opt_key);
415 if (line) { line->toggle_visible = toggle; break; }
416 }
417 };
418
419 ConfigManipulation config_manipulation(nullptr, toggle_field, toggle_line, nullptr, &m_current_config);
420
421 config_manipulation.set_is_BBL_Printer(wxGetApp().preset_bundle->is_bbl_vendor());
422
423 if (printer_technology == ptFFF && changed_opt_key == "layer_height")
424 config_manipulation.check_layer_height(&main_config);
425
426 printer_technology == ptFFF ? config_manipulation.update_print_fff_config(&main_config) :
427 config_manipulation.update_print_sla_config(&main_config) ;
428
429 printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&main_config, 0) :
430 config_manipulation.toggle_print_sla_options(&main_config) ;
431 for (auto og : m_og_settings) {
432 og->update_visibility(wxGetApp().get_mode());
433 }
434 m_parent->Layout();
435 m_parent->Fit();
436 m_parent->GetParent()->Layout();
437 t_config_option_keys diff_keys;
438 for (const t_config_option_key &opt_key : main_config.keys()) {
439 const ConfigOption *this_opt = main_config.option(opt_key);
440 const ConfigOption *other_opt = m_origin_config.option(opt_key);
441 if (this_opt != nullptr && (other_opt == nullptr || *this_opt != *other_opt))
442 diff_keys.emplace_back(opt_key);
443 }
444
445 // load checked values from main_config to config
446 config->reset();
447 config->apply_only(main_config, diff_keys, true);
448 // Initialize UI components with the config values.
449 std::vector<SimpleSettingData> category_settings = SettingsFactory::get_visible_options(category, !is_object);
450 std::string current_category;
451 for (auto og : m_og_settings)
452 {
453 current_category = GUI::into_u8(og->config_category());
454 og->reload_config();
455 if (category == ObjectGridTable::category_all) {
456 category_settings = SettingsFactory::get_visible_options(current_category, !is_object);
457 different_count = update_extra_column_visible_status(og.get(), category_settings, config);
458 if (different_count > 0)
459 m_different_map[current_category] = different_count;
460 else
461 m_different_map.erase(current_category);
462 }
463 else if (category == current_category){
464 different_count = update_extra_column_visible_status(og.get(), category_settings, config);
465 if (different_count > 0)
466 m_different_map[current_category] = different_count;
467 else
468 m_different_map.erase(current_category);
469 }
470 }
471 if (m_different_map.size() > 0)
472 m_table->enable_reset_all_button(true);
473 else
474 m_table->enable_reset_all_button(false);
475
476 //update the table and volume settings
477 m_table->reload_cell_data(m_current_row, category);
478}
int update_extra_column_visible_status(ConfigOptionsGroup *option_group, const std::vector< SimpleSettingData > &option_keys, ModelConfig *config)
Definition GUI_ObjectTableSettings.cpp:353
std::string into_u8(const wxString &str)
Definition GUI.cpp:549
std::string t_config_option_key
Definition Config.hpp:96
std::vector< std::string > t_config_option_keys
Definition Config.hpp:97

References Slic3r::ModelConfig::apply_only(), Slic3r::GUI::ObjectGridTable::category_all, Slic3r::GUI::ConfigManipulation::check_layer_height(), Slic3r::GUI::SettingsFactory::get_visible_options(), Slic3r::GUI::into_u8(), Slic3r::DynamicConfig::keys(), m_current_config, m_current_row, m_different_map, m_og_settings, m_origin_config, Slic3r::GUI::OTG_Settings::m_parent, m_table, Slic3r::ConfigBase::option(), Slic3r::GUI::printer_technology(), Slic3r::ptFFF, Slic3r::ModelConfig::reset(), Slic3r::GUI::ConfigManipulation::set_is_BBL_Printer(), Slic3r::GUI::Field::toggle(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GUI::ConfigManipulation::toggle_print_sla_options(), Slic3r::GUI::Line::toggle_visible, update_extra_column_visible_status(), Slic3r::GUI::ConfigManipulation::update_print_fff_config(), and Slic3r::GUI::ConfigManipulation::update_print_sla_config().

Referenced by resetAllValues(), update_settings_list(), and ValueChanged().

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

◆ update_extra_column_visible_status()

int Slic3r::GUI::ObjectTableSettings::update_extra_column_visible_status ( ConfigOptionsGroup * option_group,
const std::vector< SimpleSettingData > & option_keys,
ModelConfig * config )
354{
355 int count = 0;
356
357 for (auto& opt : option_keys)
358 {
359 auto line = option_group->get_line(opt.name);
360 Field* field = option_group->get_fieldc(opt.name, -1);
361 wxWindow *reset_window = field?field->getWindow():nullptr;
362 if (line) {
363 if ((config->has(opt.name)) && reset_window&&reset_window->IsEnabled()) {
364 line->extra_widget_win->Enable();
365
366 #ifdef __WXOSX_MAC__
367 wxCommandEvent event(EVT_LOCK_ENABLE);
368 event.SetEventObject(line->extra_widget_win);
369 wxPostEvent(line->extra_widget_win, event);
370 #endif
371
372 count++;
373 } else {
374 line->extra_widget_win->Disable();
375 #ifdef __WXOSX_MAC__
376 wxCommandEvent event(EVT_LOCK_DISABLE);
377 event.SetEventObject(line->extra_widget_win);
378 wxPostEvent(line->extra_widget_win, event);
379 #endif
380 }
381 }
382 }
383 wxGridSizer* grid_sizer = option_group->get_grid_sizer();
384 grid_sizer->Layout();
385
386 return count;
387}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246

References count, Slic3r::GUI::ConfigOptionsGroup::get_fieldc(), Slic3r::GUI::OptionsGroup::get_grid_sizer(), Slic3r::GUI::OptionsGroup::get_line(), Slic3r::GUI::Field::getWindow(), and Slic3r::ModelConfig::has().

Referenced by update_config_values(), and update_settings_list().

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

◆ update_settings_list()

bool Slic3r::GUI::ObjectTableSettings::update_settings_list ( bool is_object,
bool is_multiple_selection,
ModelObject * object,
ModelConfig * config,
const std::string & category )
94{
95 std::string group_category;
96 int different_count = 0;
97
98 m_settings_list_sizer->Clear(true);
99 m_og_settings.resize(0);
100 Show(true);
101
102 if (!config || is_multiple_selection || !object)
103 return false;
104
105 const auto printer_technology = wxGetApp().plater()->printer_technology();
106
107 // update config values according to configuration hierarchy
109 wxGetApp().preset_bundle->prints.get_edited_preset().config :
110 wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
111
112 //ConfigManipulation config_manipulation(load_config, toggle_field, nullptr, config);
113
114 if (!is_object)
115 {
116 m_current_config.apply(object->config.get(), true);
117 }
118
120 m_current_config.apply(config->get(), true);
121
122 //SettingsFactory::Bundle cat_options = SettingsFactory::get_bundle(&config->get(), is_object);
123 std::map<std::string, std::vector<SimpleSettingData>> cat_options;
124 std::vector<SimpleSettingData> category_settings = SettingsFactory::get_visible_options(category, !is_object);
125 bool display_multiple = false;
126 auto is_option_modified = [this](std::string key) {
127 ConfigOption* config_option1 = m_origin_config.option(key);
128 ConfigOption* config_option2 = m_current_config.option(key);
129 if (!config_option1 && config_option2)
130 return true;
131 else if (config_option1 && config_option2 && (*config_option1 != *config_option2))
132 return true;
133
134 return false;
135 };
136
137 //get the category and settings
138 if (category_settings.size() == 0) {
139 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "can not find settings for category " <<category <<", display all the modified settings instead!!!" << std::endl;
140 //return false;
141 cat_options = SettingsFactory::get_all_visible_options(!is_object);
142 std::map<std::string, std::vector<SimpleSettingData>>::iterator it1 = cat_options.begin();
143
144 while (it1 != cat_options.end())
145 {
146 std::vector<SimpleSettingData>& settings = it1->second;
147 std::vector<SimpleSettingData>::iterator it2 = settings.begin();
148
149 while ( it2 != settings.end() )
150 {
151 if (!is_option_modified(it2->name)) {
152 it2 = settings.erase(it2);
153 }
154 else {
155 BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" category %1% , keep option %2%")%it1->first % it2->name;
156 it2++;
157 }
158 }
159 if (settings.size() > 0)
160 it1++;
161 else
162 it1 = cat_options.erase(it1);
163 }
164 display_multiple = true;
165 }
166 else {
167 cat_options.emplace(category, category_settings);
168 }
169 std::vector<std::string> categories;
170 categories.reserve(cat_options.size());
171
172 for (auto& cat : cat_options)
173 {
174 categories.push_back(cat.first);
175 group_category = cat.first;
176
177 auto extra_column = [this, is_object, object, config, group_category](wxWindow* parent, const Line& line)
178 {
179 auto opt_key = (line.get_options())[0].opt_id; //we assume that we have one option per line
180
181 auto btn = new ScalableButton(parent, wxID_ANY, m_bmp_reset);
182 btn->SetToolTip(_(L("Reset parameter")));
183
184 #ifdef __WINDOWS__
185 btn->SetBackgroundColour(parent->GetBackgroundColour());
186 #endif // DEBUG
187
188
189 btn->SetBitmapFocus(m_bmp_reset_focus.bmp());
190 btn->SetBitmapHover(m_bmp_reset_focus.bmp());
191
192 #ifdef __WINDOWS__
193 btn->SetBitmapDisabled(m_bmp_reset_disable.bmp());
194 #endif
195
196 #ifdef __WXOSX_MAC__
197 btn->Bind(EVT_LOCK_DISABLE, [this, btn](auto &e) { btn->SetBitmap(m_bmp_reset_disable.bmp()); });
198 btn->Bind(EVT_LOCK_ENABLE, [this, btn](auto &e) { btn->SetBitmap(m_bmp_reset_focus.bmp()); });
199 #endif
200
201 btn->Bind(wxEVT_BUTTON, [opt_key, this, is_object, object, config, group_category](wxEvent &event) {
202 //wxGetApp().plater()->take_snapshot(from_u8((boost::format(_utf8(L("Reset Option %s"))) % opt_key).str()));
203 config->erase(opt_key);
204 //btn->Hide();
205 wxGetApp().obj_list()->changed_object();
206 /*wxTheApp->CallAfter([this, is_object, object, config, category]() {
207 wxWindowUpdateLocker noUpdates(m_parent);
208 update_settings_list(is_object, false, object, config, category);
209 });*/
210 this->m_parent->Freeze();
211 /* Check overriden options list after deleting.
212 * Some options couldn't be deleted because of another one.
213 * Like, we couldn't delete fill pattern, if fill density is set to 100%
214 */
216 m_current_config.apply(config->get(), true);
217 update_config_values(is_object, object, config, group_category);
218 this->m_parent->Thaw();
219
220 #ifdef __WXOSX_MAC__
221 // The handler is bound on the button, so the event source is that button.
222 if (auto *btn = dynamic_cast<ScalableButton *>(event.GetEventObject())) {
223 if (!btn->IsEnabled()) {
224 btn->SetBitmap(m_bmp_reset_disable.bmp());
225 } else {
226 btn->SetBitmap(m_bmp_reset_focus.bmp());
227 }
228 }
229 #endif
230 });
231 (const_cast<Line&>(line)).extra_widget_win = btn;
232 return btn;
233 };
234
235 auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(cat.first), &m_current_config, false, extra_column);
236 optgroup->label_width = 20; // ORCA match label width with sidebar
237 optgroup->sidetext_width = Field::def_width_thinner();
238 optgroup->set_config_category_and_type(GUI::from_u8(group_category), Preset::TYPE_PRINT);
239
240 std::weak_ptr<ConfigOptionsGroup> weak_optgroup(optgroup);
241 optgroup->m_on_change = [this, is_object, object, config, group_category](const t_config_option_key &opt_id, const boost::any &value) {
242 this->m_parent->Freeze();
243 this->update_config_values(is_object, object, config, group_category, opt_id);
244 wxGetApp().obj_list()->changed_object();
245 this->m_parent->Thaw();
246 //update_extra_column_visible_status(optgroup.get(), cat.second, config);
247 };
248
249 // call back for rescaling of the extracolumn control
250 optgroup->rescale_extra_column_item = [this](wxWindow* win) {
251 auto *ctrl = dynamic_cast<ScalableButton*>(win);
252 if (ctrl == nullptr)
253 return;
254 ctrl->SetBitmap_(m_bmp_reset);
255 ctrl->SetBitmapFocus(m_bmp_reset_focus.bmp());
256 ctrl->SetBitmapHover(m_bmp_reset_focus.bmp());
257 #ifdef __WINDOWS__
258 ctrl->SetBitmapDisabled(m_bmp_reset_disable.bmp());
259 #endif
260 };
261
262 const bool is_extruders_cat = cat.first == "Extruders";
263 for (auto& opt : cat.second)
264 {
265 Option option = optgroup->get_option(opt.name);
266 option.opt.width = Field::def_width_wider(); // ORCA match parameter box width
267 if (is_extruders_cat)
268 option.opt.max = wxGetApp().extruders_edited_cnt();
269 optgroup->append_single_option_line(option);
270
271 if (!opt.label.empty()) {
272 auto line = optgroup->get_line(opt.name);
273 if (line)
274 line->label = GUI::from_u8(opt.label);
275 }
276 }
277 optgroup->activate();
278 for (auto& opt : cat.second)
279 optgroup->get_field(opt.name)->m_on_change = [weak_optgroup](const std::string& opt_id, const boost::any& value) {
280 // first of all take a snapshot and then change value in configuration
281 wxGetApp().plater()->take_snapshot((boost::format("Change Option %s") % opt_id).str());
282 weak_optgroup.lock()->on_change_OG(opt_id, value);
283 };
284
285 optgroup->reload_config();
286 different_count = update_extra_column_visible_status(optgroup.get(), cat.second, config);
287 m_current_different += different_count;
288 if (different_count > 0)
289 m_different_map[group_category] = different_count;
290 /*for (auto& opt : cat.second)
291 {
292 auto line = optgroup->get_line(opt);
293 if (line) {
294 if (config->has(opt))
295 line->extra_widget_win->Show(true);
296 else
297 line->extra_widget_win->Hide();
298 }
299 }*/
300
301 m_settings_list_sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 0);
302 m_og_settings.push_back(optgroup);
303
304 auto toggle_field = [optgroup](const t_config_option_key & opt_key, bool toggle, int opt_index)
305 {
306 Field* field = optgroup->get_fieldc(opt_key, opt_index);;
307 if (field)
308 field->toggle(toggle);
309 };
310 auto toggle_line = [optgroup](const t_config_option_key &opt_key, bool toggle, int opt_index)
311 {
312 Line* line = optgroup->get_line(opt_key);
313 if (line) line->toggle_visible = toggle;
314 };
315 ConfigManipulation config_manipulation(nullptr, toggle_field, toggle_line, nullptr, &m_current_config);
316
317 bool is_BBL_printer = wxGetApp().preset_bundle->is_bbl_vendor();
318 config_manipulation.set_is_BBL_Printer(is_BBL_printer);
319
320 printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&m_current_config, 0) :
321 config_manipulation.toggle_print_sla_options(&m_current_config) ;
322 optgroup->update_visibility(wxGetApp().get_mode());
323 }
324
325 //if (!categories.empty()) {
326 // update_config_values(is_object, object, config, category);
327 //}
328 if (m_current_different > 0)
329 m_table->enable_reset_all_button(true);
330 else
331 m_table->enable_reset_all_button(false);
332
333 return true;
334}
#define _(s)
Definition 3mf.cpp:306
#define L(s)
Definition ExtrusionEntity.cpp:25
static int def_width_wider()
Definition Field.cpp:402
static int def_width_thinner()
Definition Field.cpp:403
int m_current_different
Definition GUI_ObjectTableSettings.hpp:64
@ TYPE_PRINT
Definition Preset.hpp:246
wxString from_u8(const std::string &str)
Definition GUI.cpp:544

References _, Slic3r::ModelObject::config, Slic3r::GUI::Field::def_width_thinner(), Slic3r::GUI::Field::def_width_wider(), Slic3r::GUI::from_u8(), Slic3r::ModelConfig::get(), Slic3r::GUI::SettingsFactory::get_all_visible_options(), Slic3r::GUI::SettingsFactory::get_visible_options(), L, m_bmp_reset, m_bmp_reset_disable, m_bmp_reset_focus, m_current_config, m_current_different, m_different_map, Slic3r::GUI::OTG_Settings::m_og, m_og_settings, m_origin_config, Slic3r::GUI::OTG_Settings::m_parent, m_settings_list_sizer, m_table, Slic3r::ConfigOptionDef::max, Slic3r::GUI::Option::opt, Slic3r::GUI::OTG_Settings::parent(), Slic3r::GUI::printer_technology(), Slic3r::ptFFF, Slic3r::GUI::ConfigManipulation::set_is_BBL_Printer(), ScalableButton::SetBitmap_(), Slic3r::GUI::OTG_Settings::Show(), Slic3r::GUI::Field::toggle(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GUI::ConfigManipulation::toggle_print_sla_options(), Slic3r::GUI::Line::toggle_visible, Slic3r::Preset::TYPE_PRINT, update_config_values(), update_extra_column_visible_status(), and Slic3r::ConfigOptionDef::width.

Referenced by UpdateAndShowRow().

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

◆ UpdateAndShow()

void Slic3r::GUI::OTG_Settings::UpdateAndShow ( const bool show)
virtualinherited
66{
67 Show(show);
68// m_parent->Layout();
69}

References Show().

Referenced by Slic3r::GUI::ObjectTableSettings::UpdateAndShowRow().

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

◆ UpdateAndShowRow()

void Slic3r::GUI::ObjectTableSettings::UpdateAndShowRow ( int row,
const bool show,
bool is_object,
bool is_multiple_selection,
ModelObject * object,
ModelConfig * config,
const std::string & category )
481{
482 m_current_row = row;
483 m_current_category = category;
485 m_different_map.clear();
486 //OTG_Settings::UpdateAndShow(show ? update_settings_list(is_object, is_multiple_selection, object, config, category) : false);
487 if (show) {
488 update_settings_list(is_object, is_multiple_selection, object, config, category);
489 }
490 else
492}
virtual void UpdateAndShow(const bool show)
Definition GUI_ObjectTableSettings.cpp:65
bool update_settings_list(bool is_object, bool is_multiple_selection, ModelObject *object, ModelConfig *config, const std::string &category)
Definition GUI_ObjectTableSettings.cpp:93

References m_current_category, m_current_different, m_current_row, m_different_map, update_settings_list(), and Slic3r::GUI::OTG_Settings::UpdateAndShow().

Here is the call graph for this function:

◆ ValueChanged()

void Slic3r::GUI::ObjectTableSettings::ValueChanged ( int row,
bool is_object,
ModelObject * object,
ModelConfig * config,
const std::string & category,
const std::string & key )
495{
496 if ((row != m_current_row)
498 return;
499
500 ConfigOption *my_opt = m_current_config.option(key, true);
501 if (config->has(key)) {
502 my_opt->set(config->option(key));
503 }
504 else {
505 ConfigOption* config_option = m_origin_config.option(key);
506 if (config_option)
507 my_opt->set(config_option);
508 else
509 m_current_config.erase(key);
510 }
511 update_config_values(is_object, object, config, category);
512}

References Slic3r::GUI::ObjectGridTable::category_all, Slic3r::ModelConfig::has(), m_current_category, m_current_config, m_current_row, m_origin_config, Slic3r::ModelConfig::option(), Slic3r::ConfigOption::set(), and update_config_values().

Here is the call graph for this function:

Member Data Documentation

◆ m_bmp_reset

ScalableBitmap Slic3r::GUI::ObjectTableSettings::m_bmp_reset
private

◆ m_bmp_reset_disable

ScalableBitmap Slic3r::GUI::ObjectTableSettings::m_bmp_reset_disable
private

◆ m_bmp_reset_focus

ScalableBitmap Slic3r::GUI::ObjectTableSettings::m_bmp_reset_focus
private

◆ m_current_category

std::string Slic3r::GUI::ObjectTableSettings::m_current_category
private

◆ m_current_config

DynamicPrintConfig Slic3r::GUI::ObjectTableSettings::m_current_config
private

◆ m_current_different

int Slic3r::GUI::ObjectTableSettings::m_current_different { 0 }
private
64{ 0 };

Referenced by update_settings_list(), and UpdateAndShowRow().

◆ m_current_row

int Slic3r::GUI::ObjectTableSettings::m_current_row { 0 }
private

◆ m_different_map

std::map<std::string, int> Slic3r::GUI::ObjectTableSettings::m_different_map
private

◆ m_og

◆ m_og_settings

std::vector<std::shared_ptr<ConfigOptionsGroup> > Slic3r::GUI::ObjectTableSettings::m_og_settings
private

◆ m_origin_config

DynamicPrintConfig Slic3r::GUI::ObjectTableSettings::m_origin_config
private

◆ m_parent

wxWindow* Slic3r::GUI::OTG_Settings::m_parent
protectedinherited

◆ m_settings_list_sizer

wxBoxSizer* Slic3r::GUI::ObjectTableSettings::m_settings_list_sizer { nullptr }
private
51{ nullptr };

Referenced by ObjectTableSettings(), and update_settings_list().

◆ m_table

ObjectGridTable* Slic3r::GUI::ObjectTableSettings::m_table { nullptr }
private

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