diff options
author | YuSanka <yusanka@gmail.com> | 2019-08-22 14:19:01 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2019-08-22 14:19:01 +0300 |
commit | 8828ec78608e9a9efae05cea2a980750f2346888 (patch) | |
tree | 42c343d0d986a98152cee2c4c3ec94d7f2d36029 /src/slic3r/GUI/ConfigManipulation.hpp | |
parent | 7ff68ad210386a8d77fe247c201f098127aae933 (diff) |
Code refactoring: ConfigManipulation moved to separate files.
Use of ConfigManipulation inside of TabPrint(TabSLAPrint)::update().
Diffstat (limited to 'src/slic3r/GUI/ConfigManipulation.hpp')
-rw-r--r-- | src/slic3r/GUI/ConfigManipulation.hpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/slic3r/GUI/ConfigManipulation.hpp b/src/slic3r/GUI/ConfigManipulation.hpp new file mode 100644 index 000000000..1dbadc2bd --- /dev/null +++ b/src/slic3r/GUI/ConfigManipulation.hpp @@ -0,0 +1,62 @@ +#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" +//#include <boost-1_70/boost/any.hpp> + +namespace Slic3r { +namespace GUI { + +class ConfigManipulation +{ + bool is_msg_dlg_already_exist{ false }; + bool support_material_overhangs_queried{ false }; + + // function to loading of changed configuration + std::function<void()> load_config = nullptr; + std::function<Field* (const std::string&, int opt_index)> get_field = nullptr; + // callback to propagation of changed value, if needed + std::function<void(const std::string&, const boost::any&)> cb_value_change = nullptr; + DynamicPrintConfig* local_config = nullptr; + +public: + ConfigManipulation(std::function<void()> load_config, + std::function<Field* (const std::string&, int opt_index)> get_field, + std::function<void(const std::string&, const boost::any&)> cb_value_change, + DynamicPrintConfig* local_config = nullptr) : + load_config(load_config), + get_field(get_field), + cb_value_change(cb_value_change), + local_config(local_config) {} + ConfigManipulation() {} + + ~ConfigManipulation() { + load_config = nullptr; + get_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); +}; + +} // GUI +} // Slic3r + +#endif /* slic3r_ConfigManipulation_hpp_ */ |