mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
Tech ENABLE_VALIDATE_CUSTOM_GCODE set as default
This commit is contained in:
parent
b80fb40fcd
commit
5faac3c105
11 changed files with 3 additions and 277 deletions
|
|
@ -2175,7 +2175,6 @@ static std::string get_custom_code(const std::string& code_in, double height)
|
|||
wxTextEntryDialogStyle | wxTE_MULTILINE);
|
||||
upgrade_text_entry_dialog(&dlg);
|
||||
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
bool valid = true;
|
||||
std::string value;
|
||||
do {
|
||||
|
|
@ -2186,12 +2185,6 @@ static std::string get_custom_code(const std::string& code_in, double height)
|
|||
valid = GUI::Tab::validate_custom_gcode("Custom G-code", value);
|
||||
} while (!valid);
|
||||
return value;
|
||||
#else
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return "";
|
||||
|
||||
return into_u8(dlg.GetValue());
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
}
|
||||
|
||||
static std::string get_pause_print_msg(const std::string& msg_in, double height)
|
||||
|
|
|
|||
|
|
@ -675,14 +675,12 @@ void MainFrame::init_tabpanel()
|
|||
#else
|
||||
m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
|
||||
#endif
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
if (int old_selection = e.GetOldSelection();
|
||||
old_selection != wxNOT_FOUND && old_selection < static_cast<int>(m_tabpanel->GetPageCount())) {
|
||||
Tab* old_tab = dynamic_cast<Tab*>(m_tabpanel->GetPage(old_selection));
|
||||
if (old_tab)
|
||||
old_tab->validate_custom_gcodes();
|
||||
}
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
|
||||
wxWindow* panel = m_tabpanel->GetCurrentPage();
|
||||
Tab* tab = dynamic_cast<Tab*>(panel);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
#include "libslic3r/PresetBundle.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
#include "libslic3r/GCode/GCodeProcessor.hpp"
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
|
||||
#include "slic3r/Utils/Http.hpp"
|
||||
#include "slic3r/Utils/PrintHost.hpp"
|
||||
|
|
@ -1744,7 +1742,6 @@ void TabPrint::clear_pages()
|
|||
m_top_bottom_shell_thickness_explanation = nullptr;
|
||||
}
|
||||
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
bool Tab::validate_custom_gcode(const wxString& title, const std::string& gcode)
|
||||
{
|
||||
std::vector<std::string> tags;
|
||||
|
|
@ -1770,7 +1767,6 @@ static void validate_custom_gcode_cb(Tab* tab, ConfigOptionsGroupShp opt_group,
|
|||
tab->update_dirty();
|
||||
tab->on_value_change(opt_key, value);
|
||||
}
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
|
||||
void TabFilament::add_filament_overrides_page()
|
||||
{
|
||||
|
|
@ -1996,11 +1992,9 @@ void TabFilament::build()
|
|||
|
||||
page = add_options_page(L("Custom G-code"), "cog");
|
||||
optgroup = page->new_optgroup(L("Start G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("start_filament_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2008,11 +2002,9 @@ void TabFilament::build()
|
|||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("End G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("end_filament_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2323,11 +2315,9 @@ void TabPrinter::build_fff()
|
|||
const int notes_field_height = 25; // 250
|
||||
page = add_options_page(L("Custom G-code"), "cog");
|
||||
optgroup = page->new_optgroup(L("Start G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("start_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2335,11 +2325,9 @@ void TabPrinter::build_fff()
|
|||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("End G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("end_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2347,11 +2335,9 @@ void TabPrinter::build_fff()
|
|||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Before layer change G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("before_layer_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2359,11 +2345,9 @@ void TabPrinter::build_fff()
|
|||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("After layer change G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("layer_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2371,11 +2355,9 @@ void TabPrinter::build_fff()
|
|||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Tool change G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("toolchange_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2383,11 +2365,9 @@ void TabPrinter::build_fff()
|
|||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Between objects G-code (for sequential printing)"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("between_objects_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
|
|
@ -2395,33 +2375,27 @@ void TabPrinter::build_fff()
|
|||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Color Change G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("color_change_gcode");
|
||||
option.opt.is_code = true;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Pause Print G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("pause_print_gcode");
|
||||
option.opt.is_code = true;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Template Custom G-code"), 0);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
option = optgroup->get_option("template_custom_gcode");
|
||||
option.opt.is_code = true;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
|
|
@ -3904,7 +3878,6 @@ void TabPrinter::apply_extruder_cnt_from_cache()
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
bool Tab::validate_custom_gcodes()
|
||||
{
|
||||
if (m_type != Preset::TYPE_FILAMENT &&
|
||||
|
|
@ -3930,7 +3903,6 @@ bool Tab::validate_custom_gcodes()
|
|||
}
|
||||
return valid;
|
||||
}
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
|
||||
void TabPrinter::update_machine_limits_description(const MachineLimitsUsage usage)
|
||||
{
|
||||
|
|
@ -4157,7 +4129,6 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
|
|||
return optgroup;
|
||||
}
|
||||
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
const ConfigOptionsGroupShp Page::get_optgroup(const wxString& title) const
|
||||
{
|
||||
for (ConfigOptionsGroupShp optgroup : m_optgroups) {
|
||||
|
|
@ -4167,7 +4138,6 @@ const ConfigOptionsGroupShp Page::get_optgroup(const wxString& title) const
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
|
||||
void TabSLAMaterial::build()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,9 +79,7 @@ public:
|
|||
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
|
||||
bool set_value(const t_config_option_key& opt_key, const boost::any& value);
|
||||
ConfigOptionsGroupShp new_optgroup(const wxString& title, int noncommon_label_width = -1);
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
const ConfigOptionsGroupShp get_optgroup(const wxString& title) const;
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
|
||||
bool set_item_colour(const wxColour *clr) {
|
||||
if (m_item_color != clr) {
|
||||
|
|
@ -357,11 +355,9 @@ public:
|
|||
|
||||
const std::map<wxString, std::string>& get_category_icon_map() { return m_category_icon; }
|
||||
|
||||
#if ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
static bool validate_custom_gcode(const wxString& title, const std::string& gcode);
|
||||
bool validate_custom_gcodes();
|
||||
bool validate_custom_gcodes_was_shown { false };
|
||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||
bool validate_custom_gcodes_was_shown{ false };
|
||||
|
||||
protected:
|
||||
void create_line_with_widget(ConfigOptionsGroup* optgroup, const std::string& opt_key, const wxString& path, widget_t widget);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue