Some code refactoring follow-up 33aa6be7b7 and 92b1302a08

This commit is contained in:
YuSanka 2021-02-24 15:50:18 +01:00
parent 18ac892ed6
commit 88bd189047
4 changed files with 39 additions and 94 deletions
src/slic3r/GUI

View file

@ -10,6 +10,7 @@
#include "libslic3r/AppConfig.hpp"
#include "GUI_Utils.hpp"
#include "MsgDialog.hpp"
#include "Tab.hpp"
#include <wx/button.h>
#include <wx/dialog.h>
@ -2033,27 +2034,6 @@ static void upgrade_text_entry_dialog(wxTextEntryDialog* dlg, double min = -1.0,
}, btn_OK->GetId());
}
#if ENABLE_VALIDATE_CUSTOM_GCODE
static bool validate_custom_gcode(const std::string& gcode, const wxString& title)
{
std::vector<std::string> tags;
bool invalid = GCodeProcessor::contains_reserved_tags(gcode, 5, tags);
if (invalid) {
wxString reports = _L_PLURAL("The following line", "The following lines", tags.size());
reports += ":\n";
for (const std::string& keyword : tags) {
reports += ";" + keyword + "\n";
}
reports += _L("contain reserved keywords.") + "\n";
reports += _L("Please remove them, as they may cause problems in g-code visualization and printing time estimation.");
wxMessageDialog dialog(nullptr, reports, _L("Found reserved keywords in") + " " + title, wxICON_WARNING | wxOK);
dialog.ShowModal();
}
return !invalid;
}
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
static std::string get_custom_code(const std::string& code_in, double height)
{
wxString msg_text = _L("Enter custom G-code used on current layer") + ":";
@ -2072,7 +2052,7 @@ static std::string get_custom_code(const std::string& code_in, double height)
return "";
value = dlg.GetValue().ToStdString();
valid = validate_custom_gcode(value, _L("Custom G-code"));
valid = GUI::Tab::validate_custom_gcode("Custom G-code", value);
} while (!valid);
return value;
#else