Code refactoring: ConfigManipulation moved to separate files.

Use of ConfigManipulation inside of TabPrint(TabSLAPrint)::update().
This commit is contained in:
YuSanka 2019-08-22 13:19:01 +02:00
parent 7ff68ad210
commit 8828ec7860
6 changed files with 482 additions and 398 deletions

View file

@ -32,6 +32,7 @@
#include "ButtonsDescription.hpp"
#include "Event.hpp"
#include "wxExtensions.hpp"
#include "ConfigManipulation.hpp"
namespace Slic3r {
namespace GUI {
@ -313,6 +314,9 @@ protected:
void update_frequently_changed_parameters();
void fill_icon_descriptions();
void set_tooltips_text();
ConfigManipulation m_config_manipulation;
ConfigManipulation get_config_manipulation();
};
class TabPrint : public Tab
@ -444,42 +448,6 @@ public:
std::string get_name() { return m_chosen_name; }
};
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&)> 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&)> 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() {
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);
void update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config = false);
void toggle_print_fff_options(DynamicPrintConfig* config);
void update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config = false);
void toggle_print_sla_options(DynamicPrintConfig* config);
};
} // GUI
} // Slic3r