Fix typo 'activ_' to 'active_'
This commit is contained in:
parent
9d1204d6f5
commit
5266c6be8e
3 changed files with 18 additions and 18 deletions
|
@ -2013,9 +2013,9 @@ void GLGizmoEmboss::draw_delete_style_button() {
|
|||
if (draw_button(IconType::erase, !can_delete)) {
|
||||
while (true) {
|
||||
// NOTE: can't use previous loaded activ index -> erase could change index
|
||||
size_t activ_index = m_style_manager.get_style_index();
|
||||
next_style_index = (activ_index > 0) ? activ_index - 1 :
|
||||
activ_index + 1;
|
||||
size_t active_index = m_style_manager.get_style_index();
|
||||
next_style_index = (active_index > 0) ? active_index - 1 :
|
||||
active_index + 1;
|
||||
if (next_style_index >= m_style_manager.get_styles().size()) {
|
||||
// can't remove last font style
|
||||
// TODO: inform user
|
||||
|
@ -2029,7 +2029,7 @@ void GLGizmoEmboss::draw_delete_style_button() {
|
|||
}
|
||||
|
||||
// load back
|
||||
m_style_manager.load_style(activ_index);
|
||||
m_style_manager.load_style(active_index);
|
||||
ImGui::OpenPopup(popup_id);
|
||||
break;
|
||||
}
|
||||
|
@ -2050,9 +2050,9 @@ void GLGizmoEmboss::draw_delete_style_button() {
|
|||
std::string text_in_popup = GUI::format(_L("Are you sure,\nthat you want permanently and unrecoverable \nremove style \"%1%\"?"), style_name);
|
||||
ImGui::Text("%s", text_in_popup.c_str());
|
||||
if (ImGui::Button(_u8L("Yes").c_str())) {
|
||||
size_t activ_index = m_style_manager.get_style_index();
|
||||
size_t active_index = m_style_manager.get_style_index();
|
||||
m_style_manager.load_style(next_style_index);
|
||||
m_style_manager.erase(activ_index);
|
||||
m_style_manager.erase(active_index);
|
||||
m_style_manager.store_styles_to_app_config(wxGetApp().app_config);
|
||||
ImGui::CloseCurrentPopup();
|
||||
process();
|
||||
|
|
|
@ -39,19 +39,19 @@ void StyleManager::init(AppConfig *app_config, const EmbossStyles &default_style
|
|||
m_style_items.push_back({style});
|
||||
}
|
||||
|
||||
std::optional<size_t> activ_index_opt = (app_config != nullptr) ?
|
||||
std::optional<size_t> active_index_opt = (app_config != nullptr) ?
|
||||
EmbossStylesSerializable::load_style_index(*app_config) :
|
||||
std::optional<size_t>{};
|
||||
|
||||
size_t activ_index = 0;
|
||||
if (activ_index_opt.has_value()) activ_index = *activ_index_opt;
|
||||
if (activ_index >= m_style_items.size()) activ_index = 0;
|
||||
size_t active_index = 0;
|
||||
if (active_index_opt.has_value()) active_index = *active_index_opt;
|
||||
if (active_index >= m_style_items.size()) active_index = 0;
|
||||
|
||||
// find valid font item
|
||||
if (!load_style(activ_index)) {
|
||||
m_style_items.erase(m_style_items.begin() + activ_index);
|
||||
activ_index = 0;
|
||||
while (m_style_items.empty() || !load_style(activ_index))
|
||||
if (!load_style(active_index)) {
|
||||
m_style_items.erase(m_style_items.begin() + active_index);
|
||||
active_index = 0;
|
||||
while (m_style_items.empty() || !load_style(active_index))
|
||||
m_style_items.erase(m_style_items.begin());
|
||||
// no one style from config is loadable
|
||||
if (m_style_items.empty()) {
|
||||
|
@ -61,14 +61,14 @@ void StyleManager::init(AppConfig *app_config, const EmbossStyles &default_style
|
|||
m_style_items.push_back({std::move(style)});
|
||||
}
|
||||
// try to load first default font
|
||||
[[maybe_unused]] bool loaded = load_style(activ_index);
|
||||
[[maybe_unused]] bool loaded = load_style(active_index);
|
||||
assert(loaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool StyleManager::store_styles_to_app_config(bool use_modification,
|
||||
bool store_activ_index)
|
||||
bool store_active_index)
|
||||
{
|
||||
assert(m_app_config != nullptr);
|
||||
if (m_app_config == nullptr) return false;
|
||||
|
@ -87,7 +87,7 @@ bool StyleManager::store_styles_to_app_config(bool use_modification,
|
|||
m_style_cache.stored_wx_font = m_style_cache.wx_font;
|
||||
}
|
||||
|
||||
if (store_activ_index)
|
||||
if (store_active_index)
|
||||
{
|
||||
size_t style_index = exist_stored_style() ?
|
||||
m_style_cache.style_index :
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
/// <param name="use_modification">When true cache state will be used for store</param>
|
||||
/// <param name="use_modification">When true store activ index into configuration</param>
|
||||
/// <returns>True on succes otherwise False.</returns>
|
||||
bool store_styles_to_app_config(bool use_modification = true, bool store_activ_index = true);
|
||||
bool store_styles_to_app_config(bool use_modification = true, bool store_active_index = true);
|
||||
|
||||
/// <summary>
|
||||
/// Append actual style to style list
|
||||
|
|
Loading…
Add table
Reference in a new issue