fix switching between styles

This commit is contained in:
Filip Sykala - NTB T15p 2022-08-04 15:35:44 +02:00
parent a6ffbb63f0
commit 41aaa13ce7
4 changed files with 113 additions and 191 deletions

View File

@ -351,7 +351,7 @@ bool GLGizmoEmboss::on_mouse_for_translate(const wxMouseEvent &mouse_event)
// with Mesa driver OR on Linux // with Mesa driver OR on Linux
if (!m_temp_transformation.has_value()) return false; if (!m_temp_transformation.has_value()) return false;
// TODO: Disable apply common transformation after draggig // TODO: Disable applying of common transformation after draggig
// Call after is used for apply transformation after common dragging to rewrite it // Call after is used for apply transformation after common dragging to rewrite it
Transform3d volume_trmat = Transform3d volume_trmat =
gl_volume->get_instance_transformation().get_matrix().inverse() * gl_volume->get_instance_transformation().get_matrix().inverse() *
@ -724,8 +724,7 @@ void GLGizmoEmboss::initialize()
init_icons(); init_icons();
// initialize text styles // initialize text styles
const AppConfig *app_cfg = wxGetApp().app_config; m_style_manager.init(wxGetApp().app_config, create_default_styles());
m_style_manager.init(app_cfg, create_default_styles());
set_default_text(); set_default_text();
} }
@ -1512,7 +1511,7 @@ void GLGizmoEmboss::draw_style_rename_popup() {
} }
m_style_manager.rename(new_name); m_style_manager.rename(new_name);
m_style_manager.store_styles_to_app_config(wxGetApp().app_config); m_style_manager.store_styles_to_app_config();
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
} }
@ -1540,16 +1539,17 @@ void GLGizmoEmboss::draw_style_save_button(bool is_modified)
{ {
if (draw_button(IconType::save, !is_modified)) { if (draw_button(IconType::save, !is_modified)) {
// save styles to app config // save styles to app config
m_style_manager.store_styles_to_app_config(wxGetApp().app_config); m_style_manager.store_styles_to_app_config();
}else if (ImGui::IsItemHovered()) { }else if (ImGui::IsItemHovered()) {
std::string tooltip;
if (!m_style_manager.exist_stored_style()) { if (!m_style_manager.exist_stored_style()) {
ImGui::SetTooltip("%s", _u8L("First Add style to list.").c_str()); tooltip = _u8L("First Add style to list.");
} else if (is_modified) { } else if (is_modified) {
ImGui::SetTooltip("%s", _u8L("Save changes into style.").c_str()); tooltip = GUI::format(_L("Save %1% style"), m_style_manager.get_style().name);
} else { } else {
ImGui::SetTooltip("%s", _u8L("No changes to save into style").c_str()); tooltip = _u8L("No changes to save.");
} }
ImGui::SetTooltip( ImGui::SetTooltip("%s", tooltip.c_str());
} }
} }
@ -1589,8 +1589,8 @@ void GLGizmoEmboss::draw_style_save_as_popup() {
} }
if (save_style && allow_change) { if (save_style && allow_change) {
m_style_manager.store_style(new_name); m_style_manager.add_style(new_name);
m_style_manager.store_styles_to_app_config(wxGetApp().app_config); m_style_manager.store_styles_to_app_config();
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
} }
@ -1692,52 +1692,6 @@ void GLGizmoEmboss::draw_delete_style_button() {
} }
} }
//void GLGizmoEmboss::discard_changes_in_style()
//{
// if (!m_style_manager.exist_stored_style()) return;
//
// EmbossStyle &emboss_style = m_style_manager.get_style();
// const EmbossStyle* stored_style = m_style_manager.get_stored_style();
// assert(stored_style != nullptr);
//
// // is rotation changed
// auto &angle = emboss_style.prop.angle;
// const auto &angle_ = stored_style->prop.angle;
// // TODO: compare with approx
// if (angle.has_value() != angle_.has_value() ||
// (angle.has_value() && !is_approx(*angle, *angle_))) {
// auto &tc = m_volume->text_configuration;
// if (m_volume != nullptr && tc.has_value()) {
// // change actual text configuration
// tc->style.prop.angle = angle_;
// float act_angle = angle_.has_value() ? *angle_ : .0f;
// float prev_angle = angle.has_value() ? *angle : .0f;
// do_rotate(act_angle - prev_angle);
// }
// }
//
// // is distance changed
// auto &distance = emboss_style.prop.distance;
// const auto &distance_ = stored_style->prop.distance;
// if (distance.has_value() != distance_.has_value() ||
// (distance.has_value() && !is_approx(*distance, *distance_))) {
// auto &tc = m_volume->text_configuration;
// if (m_volume != nullptr && tc.has_value()) {
// tc->style.prop.distance = distance_;
// float act_distance = distance_.has_value() ? *distance_ : .0f;
// float prev_distance = distance.has_value() ? *distance : .0f;
// do_translate(Vec3d::UnitZ() * (act_distance - prev_distance));
// }
// }
//
// if (emboss_style.path != stored_style->path) {
// // NOTE: load font file again
// m_style_manager.load_style(m_style_manager.get_style_index());
// //m_style_manager.get_wx_font() = WxFontUtils::load_wxFont(emboss_style.path);
// //m_style_manager.wx_font_changed();
// }
//}
void GLGizmoEmboss::draw_revert_all_styles_button() { void GLGizmoEmboss::draw_revert_all_styles_button() {
if (draw_button(IconType::revert_all)) { if (draw_button(IconType::revert_all)) {
m_style_manager = EmbossStyleManager(m_imgui->get_glyph_ranges()); m_style_manager = EmbossStyleManager(m_imgui->get_glyph_ranges());
@ -1748,6 +1702,29 @@ void GLGizmoEmboss::draw_revert_all_styles_button() {
ImGui::SetTooltip("%s", _u8L("Revert all styles").c_str()); ImGui::SetTooltip("%s", _u8L("Revert all styles").c_str());
} }
void GLGizmoEmboss::fix_transformation(const FontProp &from,
const FontProp &to)
{
// fix Z rotation when exists difference in styles
const std::optional<float> &f_angle_opt = from.angle;
const std::optional<float> &t_angle_opt = to.angle;
if (!is_approx(f_angle_opt, t_angle_opt)) {
// fix rotation
float f_angle = f_angle_opt.has_value() ? *f_angle_opt : .0f;
float t_angle = t_angle_opt.has_value() ? *t_angle_opt : .0f;
do_rotate(t_angle - f_angle);
}
// fix distance (Z move) when exists difference in styles
const std::optional<float> &f_move_opt = from.distance;
const std::optional<float> &t_move_opt = to.distance;
if (!is_approx(f_move_opt, t_move_opt)) {
float f_move = f_move_opt.has_value() ? *f_move_opt : .0f;
float t_move = t_move_opt.has_value() ? *t_move_opt : .0f;
do_translate(Vec3d::UnitZ() * (t_move - f_move));
}
}
void GLGizmoEmboss::draw_style_list() { void GLGizmoEmboss::draw_style_list() {
if (!m_style_manager.is_activ_font()) return; if (!m_style_manager.is_activ_font()) return;
@ -1784,25 +1761,25 @@ void GLGizmoEmboss::draw_style_list() {
const std::vector<EmbossStyleManager::Item> &styles = m_style_manager.get_styles(); const std::vector<EmbossStyleManager::Item> &styles = m_style_manager.get_styles();
for (const auto &item : styles) { for (const auto &item : styles) {
size_t index = &item - &styles.front(); size_t index = &item - &styles.front();
const EmbossStyle &es = item.style; const EmbossStyle &style = item.style;
const std::string &actual_style_name = es.name; const std::string &actual_style_name = style.name;
ImGui::PushID(actual_style_name.c_str()); ImGui::PushID(actual_style_name.c_str());
bool is_selected = (&es == &actual_style); bool is_selected = (index == m_style_manager.get_style_index());
ImVec2 select_size(0,m_gui_cfg->max_style_image_size.y()); // 0,0 --> calculate in draw ImVec2 select_size(0,m_gui_cfg->max_style_image_size.y()); // 0,0 --> calculate in draw
const std::optional<EmbossStyleManager::StyleImage> img = item.image; const std::optional<EmbossStyleManager::StyleImage> img = item.image;
// allow click delete button // allow click delete button
ImGuiSelectableFlags_ flags = ImGuiSelectableFlags_AllowItemOverlap; ImGuiSelectableFlags_ flags = ImGuiSelectableFlags_AllowItemOverlap;
if (ImGui::Selectable(item.truncated_name.c_str(), is_selected, flags, select_size)) { if (ImGui::Selectable(item.truncated_name.c_str(), is_selected, flags, select_size)) {
fix_transformation(actual_style.prop, style.prop);
if (m_style_manager.load_style(index)) { if (m_style_manager.load_style(index)) {
// TODO:
// fix volume transformation after change style -->
// rotation or z-move
// HELP: discard_changes_in_style()
// void style_changed(const FontProp &prev, const FontProp &act);
process(); process();
} else { } else {
// TODO: inform user that can't load and erase style wxString title = _L("Not valid style.");
wxString message = GUI::format_wxstr(_L("Style '%1%' can't be used and will be removed from list."), style.name);
MessageDialog not_loaded_style_message(nullptr, message, title, wxOK);
not_loaded_style_message.ShowModal();
m_style_manager.erase(index);
} }
} else if (ImGui::IsItemHovered()) } else if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", actual_style_name.c_str()); ImGui::SetTooltip("%s", actual_style_name.c_str());
@ -2045,17 +2022,10 @@ void GLGizmoEmboss::draw_style_edit() {
assert(wx_font_opt.has_value()); assert(wx_font_opt.has_value());
if (!wx_font_opt.has_value()) { if (!wx_font_opt.has_value()) {
// TODO: should not be there ImGui::TextColored(ImGuiWrapper::COL_ORANGE_DARK, "%s", _u8L("WxFont is not loaded properly."));
// when actual font not loaded try to load
if (style.type == WxFontUtils::get_actual_type()) {
std::optional<wxFont> new_wx_font = WxFontUtils::load_wxFont(style.path);
}
ImGui::TextColored(ImGuiWrapper::COL_ORANGE_DARK, "%s", _u8L("Font is not loaded properly. "));
return; return;
} }
bool exist_stored_style = m_style_manager.exist_stored_style(); bool exist_stored_style = m_style_manager.exist_stored_style();
bool is_font_changed = false; bool is_font_changed = false;
if (exist_stored_style && wx_font_opt.has_value()) { if (exist_stored_style && wx_font_opt.has_value()) {
@ -2635,7 +2605,7 @@ EmbossDataBase GLGizmoEmboss::create_emboss_data_base() {
// volume must store valid path // volume must store valid path
assert(m_style_manager.get_wx_font().has_value()); assert(m_style_manager.get_wx_font().has_value());
assert(es.path.compare(WxFontUtils::store_wxFont(*m_style_manager.get_wx_font())) == 0); assert(es.path.compare(WxFontUtils::store_wxFont(*m_style_manager.get_wx_font())) == 0);
//es.path = WxFontUtils::store_wxFont(*m_style_manager.get_wx_font()); //style.path = WxFontUtils::store_wxFont(*m_style_manager.get_wx_font());
return TextConfiguration{es, m_text}; return TextConfiguration{es, m_text};
}; };

View File

@ -99,6 +99,7 @@ private:
void draw_window(); void draw_window();
void draw_text_input(); void draw_text_input();
void draw_model_type(); void draw_model_type();
void fix_transformation(const FontProp &from, const FontProp &to);
void draw_style_list(); void draw_style_list();
void draw_delete_style_button(); void draw_delete_style_button();
void draw_revert_all_styles_button(); void draw_revert_all_styles_button();

View File

@ -17,20 +17,22 @@ using namespace Slic3r::GUI;
EmbossStyleManager::EmbossStyleManager(const ImWchar *language_glyph_range) EmbossStyleManager::EmbossStyleManager(const ImWchar *language_glyph_range)
: m_imgui_init_glyph_range(language_glyph_range) : m_imgui_init_glyph_range(language_glyph_range)
, m_exist_style_images(false) , m_exist_style_images(false)
, m_change_order(false)
, m_stored_activ_index(std::numeric_limits<size_t>::max())
, m_temp_style_images(nullptr) , m_temp_style_images(nullptr)
, m_app_config(nullptr)
, m_last_style_index(std::numeric_limits<size_t>::max())
{} {}
EmbossStyleManager::~EmbossStyleManager() { EmbossStyleManager::~EmbossStyleManager() {
clear_imgui_font(); clear_imgui_font();
free_style_images(); free_style_images();
store_styles_to_app_config(false);
} }
void EmbossStyleManager::init(const AppConfig *cfg, const EmbossStyles &default_styles) void EmbossStyleManager::init(AppConfig *app_config, const EmbossStyles &default_styles)
{ {
EmbossStyles styles = (cfg != nullptr) ? m_app_config = app_config;
EmbossStylesSerializable::load_styles(*cfg) : EmbossStyles styles = (app_config != nullptr) ?
EmbossStylesSerializable::load_styles(*app_config) :
default_styles; default_styles;
if (styles.empty()) styles = default_styles; if (styles.empty()) styles = default_styles;
for (EmbossStyle &style : styles) { for (EmbossStyle &style : styles) {
@ -38,15 +40,12 @@ void EmbossStyleManager::init(const AppConfig *cfg, const EmbossStyles &default_
m_style_items.push_back({style}); m_style_items.push_back({style});
} }
std::optional<size_t> activ_index_opt = (cfg != nullptr) ? std::optional<size_t> activ_index_opt = (app_config != nullptr) ?
EmbossStylesSerializable::load_style_index(*cfg) : EmbossStylesSerializable::load_style_index(*app_config) :
std::optional<size_t>{}; std::optional<size_t>{};
size_t activ_index = 0; size_t activ_index = 0;
if (activ_index_opt.has_value()) { if (activ_index_opt.has_value()) activ_index = *activ_index_opt;
m_stored_activ_index = *activ_index_opt;
activ_index = *activ_index_opt;
}
if (activ_index >= m_style_items.size()) activ_index = 0; if (activ_index >= m_style_items.size()) activ_index = 0;
// find valid font item // find valid font item
@ -69,10 +68,11 @@ void EmbossStyleManager::init(const AppConfig *cfg, const EmbossStyles &default_
} }
} }
bool EmbossStyleManager::store_styles_to_app_config(AppConfig *cfg) bool EmbossStyleManager::store_styles_to_app_config(bool use_modification)
{ {
assert(cfg != nullptr); assert(m_app_config != nullptr);
if (cfg == nullptr) return false; if (m_app_config == nullptr) return false;
if (use_modification) {
if (exist_stored_style()) { if (exist_stored_style()) {
// update stored item // update stored item
m_style_items[m_style_cache.style_index].style = m_style_cache.style; m_style_items[m_style_cache.style_index].style = m_style_cache.style;
@ -84,18 +84,17 @@ bool EmbossStyleManager::store_styles_to_app_config(AppConfig *cfg)
m_style_items.push_back({style}); m_style_items.push_back({style});
m_style_cache.stored_wx_font = m_style_cache.wx_font; m_style_cache.stored_wx_font = m_style_cache.wx_font;
} }
}
EmbossStylesSerializable::store_style_index(*cfg, m_style_cache.style_index); EmbossStylesSerializable::store_style_index(*m_app_config, m_style_cache.style_index);
m_stored_activ_index = m_style_cache.style_index; EmbossStyles styles;
EmbossStyles font_list; styles.reserve(m_style_items.size());
font_list.reserve(m_style_items.size()); for (const Item &item : m_style_items) styles.push_back(item.style);
for (const Item &item : m_style_items) font_list.push_back(item.style); EmbossStylesSerializable::store_styles(*m_app_config, styles);
EmbossStylesSerializable::store_styles(*cfg, font_list);
m_change_order = false;
return true; return true;
} }
void EmbossStyleManager::store_style(const std::string &name) { void EmbossStyleManager::add_style(const std::string &name) {
EmbossStyle& style = m_style_cache.style; EmbossStyle& style = m_style_cache.style;
style.name = name; style.name = name;
make_unique_name(style.name); make_unique_name(style.name);
@ -109,7 +108,6 @@ void EmbossStyleManager::swap(size_t i1, size_t i2) {
if (i1 >= m_style_items.size() || if (i1 >= m_style_items.size() ||
i2 >= m_style_items.size()) return; i2 >= m_style_items.size()) return;
std::swap(m_style_items[i1], m_style_items[i2]); std::swap(m_style_items[i1], m_style_items[i2]);
m_change_order = true;
// fix selected index // fix selected index
if (!exist_stored_style()) return; if (!exist_stored_style()) return;
if (m_style_cache.style_index == i1) { if (m_style_cache.style_index == i1) {
@ -120,27 +118,13 @@ void EmbossStyleManager::swap(size_t i1, size_t i2) {
} }
void EmbossStyleManager::discard_style_changes() { void EmbossStyleManager::discard_style_changes() {
if (exist_stored_style()) { if (exist_stored_style() && load_style(m_style_cache.style_index))
if (m_style_cache.style == m_style_items[m_stored_activ_index].style &&
m_style_cache.wx_font == m_style_cache.stored_wx_font)
return; // already loaded
if (load_style(m_style_cache.style_index))
return; // correct reload style return; // correct reload style
}
if (load_style(m_stored_activ_index))
return; // correct reload last activ font
// try to save situation by load some font // try to save situation by load some font
load_first_valid_font(); load_first_valid_font();
} }
bool EmbossStyleManager::is_style_order_changed() const { return m_change_order; }
bool EmbossStyleManager::is_activ_style_changed() const {
if (m_stored_activ_index == std::numeric_limits<size_t>::max())
return true;
return m_style_cache.style_index != m_stored_activ_index;
};
void EmbossStyleManager::erase(size_t index) { void EmbossStyleManager::erase(size_t index) {
if (index >= m_style_items.size()) return; if (index >= m_style_items.size()) return;
@ -170,6 +154,7 @@ bool EmbossStyleManager::load_style(size_t style_index)
if (!load_style(m_style_items[style_index].style)) return false; if (!load_style(m_style_items[style_index].style)) return false;
m_style_cache.style_index = style_index; m_style_cache.style_index = style_index;
m_style_cache.stored_wx_font = m_style_cache.wx_font; // copy m_style_cache.stored_wx_font = m_style_cache.wx_font; // copy
m_last_style_index = style_index;
return true; return true;
} }
@ -219,20 +204,6 @@ const EmbossStyle* EmbossStyleManager::get_stored_style() const
return &m_style_items[m_style_cache.style_index].style; return &m_style_items[m_style_cache.style_index].style;
} }
const std::optional<wxFont> &EmbossStyleManager::get_stored_wx_font() const { return m_style_cache.stored_wx_font; }
const EmbossStyle &EmbossStyleManager::get_style() const { return m_style_cache.style; }
EmbossStyle &EmbossStyleManager::get_style() { return m_style_cache.style; }
const FontProp &EmbossStyleManager::get_font_prop() const { return get_style().prop; }
FontProp &EmbossStyleManager::get_font_prop() { return get_style().prop; }
const std::optional<wxFont> &EmbossStyleManager::get_wx_font() const { return m_style_cache.wx_font; }
bool EmbossStyleManager::exist_stored_style() const { return m_style_cache.style_index != std::numeric_limits<size_t>::max(); }
size_t EmbossStyleManager::get_style_index() const { return m_style_cache.style_index; }
Emboss::FontFileWithCache &EmbossStyleManager::get_font_file_with_cache() { return m_style_cache.font_file; }
std::string &EmbossStyleManager::get_truncated_name() { return m_style_cache.truncated_name; }
const ImFontAtlas &EmbossStyleManager::get_atlas() const { return m_style_cache.atlas; }
void EmbossStyleManager::clear_glyphs_cache() void EmbossStyleManager::clear_glyphs_cache()
{ {
Emboss::FontFileWithCache &ff = m_style_cache.font_file; Emboss::FontFileWithCache &ff = m_style_cache.font_file;

View File

@ -13,10 +13,10 @@ class wxFont;
namespace Slic3r::GUI { namespace Slic3r::GUI {
/// <summary> /// <summary>
/// GUI list of loaded fonts /// Manage Emboss text styles
/// Keep pointer to ImGui font pointers /// Cache actual state of style
/// Keep file data of TTF files /// + imgui font
/// Cache wx font objects /// + wx font
/// </summary> /// </summary>
class EmbossStyleManager class EmbossStyleManager
{ {
@ -24,28 +24,35 @@ class EmbossStyleManager
public: public:
EmbossStyleManager(const ImWchar *language_glyph_range); EmbossStyleManager(const ImWchar *language_glyph_range);
/// <summary>
/// Release imgui font and style images from GPU
/// Store order and last activ font index
/// </summary>
~EmbossStyleManager(); ~EmbossStyleManager();
/// <summary> /// <summary>
/// Load font style list from config /// Load font style list from config
/// Also select actual activ font /// Also select actual activ font
/// </summary> /// </summary>
/// <param name="cfg">Application configuration loaded from file "PrusaSlicer.ini"</param> /// <param name="app_config">Application configuration loaded from file "PrusaSlicer.ini"
/// + cfg is stored to privat variable</param>
/// <param name="default_styles">Used when list is not loadable from config</param> /// <param name="default_styles">Used when list is not loadable from config</param>
void init(const AppConfig *cfg, const EmbossStyles &default_styles); void init(AppConfig *app_config, const EmbossStyles &default_styles);
/// <summary> /// <summary>
/// Write font list into AppConfig /// Write font list into AppConfig
/// </summary> /// </summary>
/// <param name="cfg">Stor into this configuration</param>
/// <param name="item_to_store">Configuration</param> /// <param name="item_to_store">Configuration</param>
bool store_styles_to_app_config(AppConfig *cfg); /// <param name="use_modification">Flag that store should use actual modification</param>
/// <returns>True on succes otherwise False.</returns>
bool store_styles_to_app_config(bool use_modification = true);
/// <summary> /// <summary>
/// Append actual style to style list /// Append actual style to style list
/// </summary> /// </summary>
/// <param name="name">New name for style</param> /// <param name="name">New name for style</param>
void store_style(const std::string& name); void add_style(const std::string& name);
/// <summary> /// <summary>
/// Change order of style item in m_style_items. /// Change order of style item in m_style_items.
@ -57,22 +64,10 @@ public:
/// <summary> /// <summary>
/// Discard changes in activ style /// Discard changes in activ style
/// When no activ style use last used /// When no activ style use last used OR first loadable
/// </summary> /// </summary>
void discard_style_changes(); void discard_style_changes();
/// <summary>
/// Track using of swap between saves
/// </summary>
/// <returns>True when swap was call after save otherwise false</returns>
bool is_style_order_changed() const;
/// <summary>
/// Check that actual selected style is same as activ style stored in "PrusaSlicer.ini"
/// </summary>
/// <returns>True when actual selection is not stored otherwise False</returns>
bool is_activ_style_changed() const;
/// <summary> /// <summary>
/// Remove style from m_style_items. /// Remove style from m_style_items.
/// Fix selected font index when index is under m_font_selected /// Fix selected font index when index is under m_font_selected
@ -104,37 +99,22 @@ public:
// remove cached imgui font for actual selected font // remove cached imgui font for actual selected font
void clear_imgui_font(); void clear_imgui_font();
// getter on stored EmbossStyle // getters for private data
const EmbossStyle *get_stored_style() const; const EmbossStyle *get_stored_style() const;
// getter on stored wxFont const EmbossStyle &get_style() const { return m_style_cache.style; }
const std::optional<wxFont> &get_stored_wx_font() const; EmbossStyle &get_style() { return m_style_cache.style; }
size_t get_style_index() const { return m_style_cache.style_index; }
// getter on active font item for access to font property std::string &get_truncated_name() { return m_style_cache.truncated_name; }
const EmbossStyle &get_style() const; const ImFontAtlas &get_atlas() const { return m_style_cache.atlas; }
EmbossStyle &get_style(); const FontProp &get_font_prop() const { return get_style().prop; }
FontProp &get_font_prop() { return get_style().prop; }
// getter on active font property const std::optional<wxFont> &get_wx_font() const { return m_style_cache.wx_font; }
const FontProp &get_font_prop() const; const std::optional<wxFont> &get_stored_wx_font() const { return m_style_cache.stored_wx_font; }
FontProp &get_font_prop(); Emboss::FontFileWithCache &get_font_file_with_cache() { return m_style_cache.font_file; }
const ImFontAtlas& get_atlas() const;
// getter on activ wx font
const std::optional<wxFont> &get_wx_font() const;
// True when activ style has same name as some of stored style // True when activ style has same name as some of stored style
bool exist_stored_style() const; bool exist_stored_style() const { return m_style_cache.style_index != std::numeric_limits<size_t>::max(); }
size_t get_style_index() const;
// getter on font file with cache
Emboss::FontFileWithCache &get_font_file_with_cache();
// Getter for cached trucated name for style list selector
std::string &get_truncated_name();
// setter of wx font for actual selection
/// <summary> /// <summary>
/// Setter on wx_font when changed /// Setter on wx_font when changed
@ -259,8 +239,8 @@ private:
// Privat member // Privat member
std::vector<Item> m_style_items; std::vector<Item> m_style_items;
bool m_change_order; AppConfig *m_app_config;
size_t m_stored_activ_index; size_t m_last_style_index;
/// <summary> /// <summary>
/// Keep data needed to create Font Style Images in Job /// Keep data needed to create Font Style Images in Job
@ -290,7 +270,7 @@ private:
// vector of inputs // vector of inputs
StyleImagesData::Items styles; StyleImagesData::Items styles;
// job output // job output
std::vector<EmbossStyleManager::StyleImage> images; std::vector<StyleImage> images;
}; };
// place to store result in main thread in Finalize // place to store result in main thread in Finalize