mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-12 08:11:46 +08:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_gcode_z_offset
This commit is contained in:
commit
803d797bd7
@ -2,6 +2,7 @@
|
|||||||
#include "../Utils.hpp"
|
#include "../Utils.hpp"
|
||||||
|
|
||||||
#include <cctype> // isalpha
|
#include <cctype> // isalpha
|
||||||
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
@ -74,7 +74,8 @@ const char* GCodeReader::parse_line_internal(const char *ptr, const char *end, G
|
|||||||
if (axis != NUM_AXES_WITH_UNKNOWN) {
|
if (axis != NUM_AXES_WITH_UNKNOWN) {
|
||||||
// Try to parse the numeric value.
|
// Try to parse the numeric value.
|
||||||
double v;
|
double v;
|
||||||
auto [pend, ec] = fast_float::from_chars(++ c, end, v);
|
c = skip_whitespaces(++c);
|
||||||
|
auto [pend, ec] = fast_float::from_chars(c, end, v);
|
||||||
if (pend != c && is_end_of_word(*pend)) {
|
if (pend != c && is_end_of_word(*pend)) {
|
||||||
// The axis value has been parsed correctly.
|
// The axis value has been parsed correctly.
|
||||||
if (axis != UNKNOWN_AXIS)
|
if (axis != UNKNOWN_AXIS)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <charconv>
|
#include <charconv>
|
||||||
#endif
|
#endif
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include <fast_float/fast_float.h>
|
#include <fast_float/fast_float.h>
|
||||||
|
|
||||||
|
@ -1136,6 +1136,7 @@ void add_correct_opts_to_diff(const std::string &opt_key, t_config_option_keys&
|
|||||||
// list of options with vector variable, which is independent from number of extruders
|
// list of options with vector variable, which is independent from number of extruders
|
||||||
static const std::vector<std::string> independent_from_extruder_number_options = {
|
static const std::vector<std::string> independent_from_extruder_number_options = {
|
||||||
"bed_shape",
|
"bed_shape",
|
||||||
|
"thumbnails",
|
||||||
"filament_ramming_parameters",
|
"filament_ramming_parameters",
|
||||||
"gcode_substitutions",
|
"gcode_substitutions",
|
||||||
"compatible_prints",
|
"compatible_prints",
|
||||||
|
@ -245,7 +245,7 @@ MessageDialog::MessageDialog(wxWindow* parent,
|
|||||||
long style/* = wxOK*/)
|
long style/* = wxOK*/)
|
||||||
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_NAME) : caption, wxEmptyString, style)
|
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_NAME) : caption, wxEmptyString, style)
|
||||||
{
|
{
|
||||||
add_msg_content(this, content_sizer, message);
|
add_msg_content(this, content_sizer, get_wraped_wxString(message));
|
||||||
finalize();
|
finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ RichMessageDialog::RichMessageDialog(wxWindow* parent,
|
|||||||
long style/* = wxOK*/)
|
long style/* = wxOK*/)
|
||||||
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_NAME) : caption, wxEmptyString, style)
|
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_NAME) : caption, wxEmptyString, style)
|
||||||
{
|
{
|
||||||
add_msg_content(this, content_sizer, message);
|
add_msg_content(this, content_sizer, get_wraped_wxString(message));
|
||||||
|
|
||||||
m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText);
|
m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText);
|
||||||
wxGetApp().UpdateDarkUI(m_checkBox);
|
wxGetApp().UpdateDarkUI(m_checkBox);
|
||||||
@ -291,6 +291,43 @@ InfoDialog::InfoDialog(wxWindow* parent, const wxString &title, const wxString&
|
|||||||
finalize();
|
finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString get_wraped_wxString(const wxString& text_in, size_t line_len /*=80*/)
|
||||||
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
char slash = '\\';
|
||||||
|
#else
|
||||||
|
char slash = '/';
|
||||||
|
#endif
|
||||||
|
char space = ' ';
|
||||||
|
char new_line = '\n';
|
||||||
|
|
||||||
|
wxString text = text_in;
|
||||||
|
|
||||||
|
int idx = -1;
|
||||||
|
size_t cur_len = 0;
|
||||||
|
size_t text_len = text.Len();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < text_len; i++) {
|
||||||
|
cur_len++;
|
||||||
|
if (text[i] == space || text[i] == slash)
|
||||||
|
idx = i;
|
||||||
|
if (text[i] == new_line) {
|
||||||
|
idx = -1;
|
||||||
|
cur_len = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (cur_len >= line_len && idx >= 0) {
|
||||||
|
if (text[idx] == slash) {
|
||||||
|
text.insert(static_cast<size_t>(idx) + 1, 1, new_line);
|
||||||
|
text_len++;
|
||||||
|
}
|
||||||
|
else // space
|
||||||
|
text[idx] = new_line;
|
||||||
|
cur_len = i - static_cast<size_t>(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,8 @@ public:
|
|||||||
virtual ~WarningDialog() = default;
|
virtual ~WarningDialog() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
wxString get_wraped_wxString(const wxString& text_in, size_t line_len = 80);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Generic static line, used intead of wxStaticLine
|
// Generic static line, used intead of wxStaticLine
|
||||||
class StaticLine: public wxTextCtrl
|
class StaticLine: public wxTextCtrl
|
||||||
@ -283,7 +285,7 @@ public:
|
|||||||
const wxString& message,
|
const wxString& message,
|
||||||
const wxString& caption = wxEmptyString,
|
const wxString& caption = wxEmptyString,
|
||||||
long style = wxOK)
|
long style = wxOK)
|
||||||
: wxMessageDialog(parent, message, caption, style) {}
|
: wxMessageDialog(parent, get_wraped_wxString(message), caption, style) {}
|
||||||
~MessageDialog() {}
|
~MessageDialog() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -295,7 +297,7 @@ public:
|
|||||||
const wxString& message,
|
const wxString& message,
|
||||||
const wxString& caption = wxEmptyString,
|
const wxString& caption = wxEmptyString,
|
||||||
long style = wxOK)
|
long style = wxOK)
|
||||||
: wxRichMessageDialog(parent, message, caption, style) {
|
: wxRichMessageDialog(parent, get_wraped_wxString(message), caption, style) {
|
||||||
this->SetEscapeId(wxID_CANCEL);
|
this->SetEscapeId(wxID_CANCEL);
|
||||||
}
|
}
|
||||||
~RichMessageDialog() {}
|
~RichMessageDialog() {}
|
||||||
|
@ -596,8 +596,8 @@ void ConfigOptionsGroup::back_to_config_value(const DynamicPrintConfig& config,
|
|||||||
value = int(nozzle_diameter->values.size());
|
value = int(nozzle_diameter->values.size());
|
||||||
}
|
}
|
||||||
else if (m_opt_map.find(opt_key) == m_opt_map.end() ||
|
else if (m_opt_map.find(opt_key) == m_opt_map.end() ||
|
||||||
// This option don't have corresponded field
|
// This option doesn't have corresponded field
|
||||||
PresetCollection::is_independent_from_extruder_number_option(opt_key) ) {
|
is_option_without_field(opt_key) ) {
|
||||||
value = get_config_value(config, opt_key);
|
value = get_config_value(config, opt_key);
|
||||||
this->change_opt_value(opt_key, value);
|
this->change_opt_value(opt_key, value);
|
||||||
return;
|
return;
|
||||||
@ -980,6 +980,11 @@ bool OptionsGroup::launch_browser(const std::string& path_end)
|
|||||||
return wxGetApp().open_browser_with_warning_dialog(OptionsGroup::get_url(path_end), wxGetApp().mainframe->m_tabpanel);
|
return wxGetApp().open_browser_with_warning_dialog(OptionsGroup::get_url(path_end), wxGetApp().mainframe->m_tabpanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OptionsGroup::is_option_without_field(const std::string& opt_key)
|
||||||
|
{
|
||||||
|
return opt_key!= "thumbnails" // "thumbnails" has related field
|
||||||
|
&& PresetCollection::is_independent_from_extruder_number_option(opt_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------
|
||||||
|
@ -225,6 +225,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
static wxString get_url(const std::string& path_end);
|
static wxString get_url(const std::string& path_end);
|
||||||
static bool launch_browser(const std::string& path_end);
|
static bool launch_browser(const std::string& path_end);
|
||||||
|
static bool is_option_without_field(const std::string& opt_key);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigOptionsGroup: public OptionsGroup {
|
class ConfigOptionsGroup: public OptionsGroup {
|
||||||
|
@ -5265,7 +5265,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string& filename)
|
|||||||
_L("Import config only") };
|
_L("Import config only") };
|
||||||
|
|
||||||
main_sizer->Add(new wxStaticText(this, wxID_ANY,
|
main_sizer->Add(new wxStaticText(this, wxID_ANY,
|
||||||
_L("Select an action to apply to the file") + ": " + from_u8(filename)), 0, wxEXPAND | wxALL, 10);
|
get_wraped_wxString(_L("Select an action to apply to the file") + ": " + from_u8(filename))), 0, wxEXPAND | wxALL, 10);
|
||||||
|
|
||||||
m_action = std::clamp(std::stoi(wxGetApp().app_config->get("drop_project_action")),
|
m_action = std::clamp(std::stoi(wxGetApp().app_config->get("drop_project_action")),
|
||||||
static_cast<int>(LoadType::OpenProject), static_cast<int>(LoadType::LoadConfig)) - 1;
|
static_cast<int>(LoadType::OpenProject), static_cast<int>(LoadType::LoadConfig)) - 1;
|
||||||
|
@ -532,7 +532,7 @@ void Tab::update_label_colours()
|
|||||||
else
|
else
|
||||||
color = &m_modified_label_clr;
|
color = &m_modified_label_clr;
|
||||||
}
|
}
|
||||||
if (PresetCollection::is_independent_from_extruder_number_option(opt.first)) {
|
if (OptionsGroup::is_option_without_field(opt.first)) {
|
||||||
if (m_colored_Label_colors.find(opt.first) != m_colored_Label_colors.end())
|
if (m_colored_Label_colors.find(opt.first) != m_colored_Label_colors.end())
|
||||||
m_colored_Label_colors.at(opt.first) = *color;
|
m_colored_Label_colors.at(opt.first) = *color;
|
||||||
continue;
|
continue;
|
||||||
@ -573,7 +573,7 @@ void Tab::decorate()
|
|||||||
Field* field = nullptr;
|
Field* field = nullptr;
|
||||||
wxColour* colored_label_clr = nullptr;
|
wxColour* colored_label_clr = nullptr;
|
||||||
|
|
||||||
if(PresetCollection::is_independent_from_extruder_number_option(opt.first))
|
if(OptionsGroup::is_option_without_field(opt.first))
|
||||||
colored_label_clr = (m_colored_Label_colors.find(opt.first) == m_colored_Label_colors.end()) ? nullptr : &m_colored_Label_colors.at(opt.first);
|
colored_label_clr = (m_colored_Label_colors.find(opt.first) == m_colored_Label_colors.end()) ? nullptr : &m_colored_Label_colors.at(opt.first);
|
||||||
|
|
||||||
if (!colored_label_clr) {
|
if (!colored_label_clr) {
|
||||||
|
@ -587,8 +587,10 @@ void LockButton::OnButton(wxCommandEvent& event)
|
|||||||
|
|
||||||
void LockButton::SetLock(bool lock)
|
void LockButton::SetLock(bool lock)
|
||||||
{
|
{
|
||||||
m_is_pushed = lock;
|
if (m_is_pushed != lock) {
|
||||||
update_button_bitmaps();
|
m_is_pushed = lock;
|
||||||
|
update_button_bitmaps();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LockButton::msw_rescale()
|
void LockButton::msw_rescale()
|
||||||
@ -603,7 +605,6 @@ void LockButton::msw_rescale()
|
|||||||
|
|
||||||
void LockButton::update_button_bitmaps()
|
void LockButton::update_button_bitmaps()
|
||||||
{
|
{
|
||||||
Slic3r::GUI::wxGetApp().UpdateDarkUI(this);
|
|
||||||
SetBitmap(m_is_pushed ? m_bmp_lock_closed.bmp() : m_bmp_lock_open.bmp());
|
SetBitmap(m_is_pushed ? m_bmp_lock_closed.bmp() : m_bmp_lock_open.bmp());
|
||||||
SetBitmapHover(m_is_pushed ? m_bmp_lock_closed_f.bmp() : m_bmp_lock_open_f.bmp());
|
SetBitmapHover(m_is_pushed ? m_bmp_lock_closed_f.bmp() : m_bmp_lock_open_f.bmp());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user