1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#ifndef slic3r_ConfigManipulation_hpp_
#define slic3r_ConfigManipulation_hpp_
/* Class for validation config options
* and update (enable/disable) IU components
*
* Used for config validation for global config (Print Settings Tab)
* and local config (overrides options on sidebar)
* */
#include "libslic3r/PrintConfig.hpp"
#include "Field.hpp"
namespace Slic3r {
class ModelConfig;
namespace GUI {
class ConfigManipulation
{
bool is_msg_dlg_already_exist{ false };
bool m_is_initialized_support_material_overhangs_queried{ false };
bool m_support_material_overhangs_queried{ false };
// function to loading of changed configuration
std::function<void()> load_config = nullptr;
std::function<void (const std::string&, bool toggle, int opt_index)> cb_toggle_field = nullptr;
// callback to propagation of changed value, if needed
std::function<void(const std::string&, const boost::any&)> cb_value_change = nullptr;
ModelConfig* local_config = nullptr;
wxWindow* m_msg_dlg_parent {nullptr};
public:
ConfigManipulation(std::function<void()> load_config,
std::function<void(const std::string&, bool toggle, int opt_index)> cb_toggle_field,
std::function<void(const std::string&, const boost::any&)> cb_value_change,
ModelConfig* local_config = nullptr,
wxWindow* msg_dlg_parent = nullptr) :
load_config(load_config),
cb_toggle_field(cb_toggle_field),
cb_value_change(cb_value_change),
m_msg_dlg_parent(msg_dlg_parent),
local_config(local_config) {}
ConfigManipulation() {}
~ConfigManipulation() {
load_config = nullptr;
cb_toggle_field = nullptr;
cb_value_change = nullptr;
}
void apply(DynamicPrintConfig* config, DynamicPrintConfig* new_config);
void toggle_field(const std::string& field_key, const bool toggle, int opt_index = -1);
// FFF print
void update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config = false);
void toggle_print_fff_options(DynamicPrintConfig* config);
// SLA print
void update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config = false);
void toggle_print_sla_options(DynamicPrintConfig* config);
bool is_initialized_support_material_overhangs_queried() { return m_is_initialized_support_material_overhangs_queried; }
void initialize_support_material_overhangs_queried(bool queried)
{
m_is_initialized_support_material_overhangs_queried = true;
m_support_material_overhangs_queried = queried;
}
};
} // GUI
} // Slic3r
#endif /* slic3r_ConfigManipulation_hpp_ */
|