Fix current used face name in warning message
This commit is contained in:
parent
95c6f83b1b
commit
fbd39e376b
2 changed files with 21 additions and 25 deletions
|
@ -1104,17 +1104,9 @@ bool GLGizmoEmboss::set_volume(ModelVolume *volume)
|
||||||
m_style_manager.set_wx_font(wx_font);
|
m_style_manager.set_wx_font(wx_font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_exact_font) {
|
if (!is_exact_font)
|
||||||
create_notification_not_valid_font(tc);
|
create_notification_not_valid_font(tc);
|
||||||
|
|
||||||
// update changed wxFont path
|
|
||||||
std::string path = WxFontUtils::store_wxFont(wx_font);
|
|
||||||
// current used style
|
|
||||||
EmbossStyle &act_style = m_style_manager.get_style();
|
|
||||||
act_style.path = path;
|
|
||||||
act_style.type = WxFontUtils::get_actual_type();
|
|
||||||
}
|
|
||||||
|
|
||||||
// The change of volume could show or hide part with setter on volume type
|
// The change of volume could show or hide part with setter on volume type
|
||||||
if (m_volume == nullptr ||
|
if (m_volume == nullptr ||
|
||||||
|
@ -3405,31 +3397,31 @@ void GLGizmoEmboss::create_notification_not_valid_font(
|
||||||
auto level =
|
auto level =
|
||||||
NotificationManager::NotificationLevel::WarningNotificationLevel;
|
NotificationManager::NotificationLevel::WarningNotificationLevel;
|
||||||
|
|
||||||
const EmbossStyle &es = m_style_manager.get_style();
|
const EmbossStyle &es = m_style_manager.get_style();
|
||||||
const auto &origin_family = tc.style.prop.face_name;
|
const auto &face_name_opt = es.prop.face_name;
|
||||||
const auto &actual_family = es.prop.face_name;
|
const auto &face_name_3mf_opt = tc.style.prop.face_name;
|
||||||
|
|
||||||
const std::string &origin_font_name = origin_family.has_value() ?
|
const std::string &face_name_3mf = face_name_3mf_opt.has_value() ?
|
||||||
*origin_family :
|
*face_name_3mf_opt :
|
||||||
tc.style.path;
|
tc.style.path;
|
||||||
|
|
||||||
std::string actual_wx_face_name;
|
std::string face_name_by_wx;
|
||||||
if (!actual_family.has_value()) {
|
if (!face_name_opt.has_value()) {
|
||||||
auto& wx_font = m_style_manager.get_wx_font();
|
const auto& wx_font = m_style_manager.get_wx_font();
|
||||||
if (wx_font.has_value()) {
|
if (wx_font.has_value()) {
|
||||||
wxString wx_face_name = wx_font->GetFaceName();
|
wxString wx_face_name = wx_font->GetFaceName();
|
||||||
actual_wx_face_name = std::string((const char *) wx_face_name.ToUTF8());
|
face_name_by_wx = std::string((const char *) wx_face_name.ToUTF8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &actual_font_name = actual_family.has_value() ? *actual_family :
|
const std::string &face_name = face_name_opt.has_value() ? *face_name_opt :
|
||||||
(!actual_wx_face_name.empty() ? actual_wx_face_name : es.path);
|
(!face_name_by_wx.empty() ? face_name_by_wx : es.path);
|
||||||
|
|
||||||
std::string text =
|
std::string text =
|
||||||
GUI::format(_L("Can't load exactly same font(\"%1%\"), "
|
GUI::format(_L("Can't load exactly same font(\"%1%\"), "
|
||||||
"Aplication select similar one(\"%2%\"). "
|
"Aplication select similar one(\"%2%\"). "
|
||||||
"You have to specify font for enable edit text."),
|
"You have to specify font for enable edit text."),
|
||||||
origin_font_name, actual_font_name);
|
face_name_3mf, face_name);
|
||||||
auto notification_manager = wxGetApp().plater()->get_notification_manager();
|
auto notification_manager = wxGetApp().plater()->get_notification_manager();
|
||||||
notification_manager->push_notification(type, level, text);
|
notification_manager->push_notification(type, level, text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,9 +192,13 @@ bool StyleManager::load_style(const EmbossStyle &style) {
|
||||||
|
|
||||||
bool StyleManager::load_style(const EmbossStyle &style, const wxFont &font)
|
bool StyleManager::load_style(const EmbossStyle &style, const wxFont &font)
|
||||||
{
|
{
|
||||||
|
m_style_cache.style = style; // copy
|
||||||
|
|
||||||
|
// wx font property has bigger priority to set
|
||||||
|
// it must be after copy of the style
|
||||||
if (!set_wx_font(font)) return false;
|
if (!set_wx_font(font)) return false;
|
||||||
m_style_cache.style = style; // copy
|
|
||||||
m_style_cache.style_index = std::numeric_limits<size_t>::max();
|
m_style_cache.style_index = std::numeric_limits<size_t>::max();
|
||||||
m_style_cache.stored_wx_font = {};
|
m_style_cache.stored_wx_font = {};
|
||||||
m_style_cache.truncated_name.clear();
|
m_style_cache.truncated_name.clear();
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue