mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 09:09:06 +08:00
Fix
../src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp:3021:58: error: use of deleted function 'std::optional<wxFont>& std::optional<wxFont>::operator=(std::optional<wxFont>&&)' ../src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp:3026:55: error: use of deleted function 'std::optional<wxFont>& std::optional<wxFont>::operator=(std::optional<wxFont>&&)'
This commit is contained in:
parent
225fb7d8aa
commit
a8318ee4f3
@ -3016,43 +3016,46 @@ bool GLGizmoEmboss::load_configuration(ModelVolume *volume)
|
|||||||
return es.name == style.name;
|
return es.name == style.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::optional<wxFont> wx_font_opt;
|
int wx_font_opt;
|
||||||
if (style.type == WxFontUtils::get_actual_type())
|
wxFont wx_font;
|
||||||
wx_font_opt = WxFontUtils::load_wxFont(style.path);
|
|
||||||
bool is_path_changed = false;
|
bool is_path_changed = false;
|
||||||
if (!wx_font_opt.has_value()) {
|
if (style.type == WxFontUtils::get_actual_type())
|
||||||
|
wx_font = WxFontUtils::load_wxFont(style.path);
|
||||||
|
if (!wx_font.IsOk()) {
|
||||||
create_notification_not_valid_font(tc);
|
create_notification_not_valid_font(tc);
|
||||||
// Try create similar wx font
|
// Try create similar wx font
|
||||||
wx_font_opt = WxFontUtils::create_wxFont(style);
|
wx_font = WxFontUtils::create_wxFont(style);
|
||||||
is_path_changed = wx_font_opt.has_value();
|
is_path_changed = wx_font.IsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& styles = m_style_manager.get_styles();
|
const auto& styles = m_style_manager.get_styles();
|
||||||
auto it = std::find_if(styles.begin(), styles.end(), has_same_name);
|
auto it = std::find_if(styles.begin(), styles.end(), has_same_name);
|
||||||
if (it == styles.end()) {
|
if (it == styles.end()) {
|
||||||
// style was not found
|
// style was not found
|
||||||
if (wx_font_opt.has_value())
|
if (wx_font.IsOk())
|
||||||
m_style_manager.load_style(style, *wx_font_opt);
|
m_style_manager.load_style(style, wx_font);
|
||||||
} else {
|
} else {
|
||||||
size_t style_index = it - styles.begin();
|
size_t style_index = it - styles.begin();
|
||||||
if (!m_style_manager.load_style(style_index)) {
|
if (!m_style_manager.load_style(style_index)) {
|
||||||
// can`t load stored style
|
// can`t load stored style
|
||||||
m_style_manager.erase(style_index);
|
m_style_manager.erase(style_index);
|
||||||
if (wx_font_opt.has_value())
|
if (wx_font.IsOk())
|
||||||
m_style_manager.load_style(style, *wx_font_opt);
|
m_style_manager.load_style(style, wx_font);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// stored style is loaded, now set modification of style
|
// stored style is loaded, now set modification of style
|
||||||
m_style_manager.get_style() = style;
|
m_style_manager.get_style() = style;
|
||||||
m_style_manager.set_wx_font(*wx_font_opt);
|
m_style_manager.set_wx_font(wx_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_path_changed)
|
if (is_path_changed) {
|
||||||
m_style_manager.get_style().path = WxFontUtils::store_wxFont(*wx_font_opt);
|
std::string path = WxFontUtils::store_wxFont(wx_font);
|
||||||
|
m_style_manager.get_style().path = path;
|
||||||
|
}
|
||||||
|
|
||||||
m_text = tc.text;
|
m_text = tc.text;
|
||||||
m_volume = volume;
|
m_volume = volume;
|
||||||
|
|
||||||
// store volume state before edit
|
// store volume state before edit
|
||||||
m_unmodified_volume = {*volume->get_mesh_shared_ptr(), // copy
|
m_unmodified_volume = {*volume->get_mesh_shared_ptr(), // copy
|
||||||
|
@ -171,13 +171,11 @@ std::string WxFontUtils::store_wxFont(const wxFont &font)
|
|||||||
return std::string(font_descriptor.c_str());
|
return std::string(font_descriptor.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<wxFont> WxFontUtils::load_wxFont(
|
wxFont WxFontUtils::load_wxFont(const std::string &font_descriptor)
|
||||||
const std::string &font_descriptor)
|
|
||||||
{
|
{
|
||||||
wxString font_descriptor_wx(font_descriptor);
|
wxString font_descriptor_wx(font_descriptor);
|
||||||
std::optional<wxFont> res = std::make_optional<wxFont>(font_descriptor_wx);
|
wxFont wx_font(font_descriptor_wx);
|
||||||
if (!res->IsOk()) return {};
|
return wx_font;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using TypeToFamily = boost::bimap<wxFontFamily, std::string_view>;
|
using TypeToFamily = boost::bimap<wxFontFamily, std::string_view>;
|
||||||
@ -212,7 +210,7 @@ const TypeToWeight WxFontUtils::type_to_weight =
|
|||||||
(wxFONTWEIGHT_HEAVY, "heavy")
|
(wxFONTWEIGHT_HEAVY, "heavy")
|
||||||
(wxFONTWEIGHT_EXTRAHEAVY, "extraHeavy");
|
(wxFONTWEIGHT_EXTRAHEAVY, "extraHeavy");
|
||||||
|
|
||||||
std::optional<wxFont> WxFontUtils::create_wxFont(const EmbossStyle &style)
|
wxFont WxFontUtils::create_wxFont(const EmbossStyle &style)
|
||||||
{
|
{
|
||||||
const FontProp &fp = style.prop;
|
const FontProp &fp = style.prop;
|
||||||
double point_size = static_cast<double>(fp.size_in_mm);
|
double point_size = static_cast<double>(fp.size_in_mm);
|
||||||
@ -244,9 +242,12 @@ std::optional<wxFont> WxFontUtils::create_wxFont(const EmbossStyle &style)
|
|||||||
// default:
|
// default:
|
||||||
//}
|
//}
|
||||||
|
|
||||||
std::optional<wxFont> res = std::make_optional<wxFont>(info);
|
wxFont wx_font(info);
|
||||||
if (!res->IsOk()) return {};
|
// Check if exist font file
|
||||||
return res;
|
std::unique_ptr<Emboss::FontFile> ff = create_font_file(wx_font);
|
||||||
|
if (ff == nullptr) return {};
|
||||||
|
|
||||||
|
return wx_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WxFontUtils::update_property(FontProp &font_prop, const wxFont &font)
|
void WxFontUtils::update_property(FontProp &font_prop, const wxFont &font)
|
||||||
|
@ -32,11 +32,11 @@ public:
|
|||||||
static std::string get_human_readable_name(const wxFont &font);
|
static std::string get_human_readable_name(const wxFont &font);
|
||||||
|
|
||||||
// serialize / deserialize font
|
// serialize / deserialize font
|
||||||
static std::string store_wxFont(const wxFont &font);
|
static std::string store_wxFont(const wxFont &font);
|
||||||
static std::optional<wxFont> load_wxFont(const std::string &font_descriptor);
|
static wxFont load_wxFont(const std::string &font_descriptor);
|
||||||
|
|
||||||
// Try to create similar font, loaded from 3mf from different Computer
|
// Try to create similar font, loaded from 3mf from different Computer
|
||||||
static std::optional<wxFont> create_wxFont(const EmbossStyle &style);
|
static wxFont create_wxFont(const EmbossStyle &style);
|
||||||
// update font property by wxFont - without emboss depth and font size
|
// update font property by wxFont - without emboss depth and font size
|
||||||
static void update_property(FontProp &font_prop, const wxFont &font);
|
static void update_property(FontProp &font_prop, const wxFont &font);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user