mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 02:35:55 +08:00
Fix typo 'activ_' to 'active_'
This commit is contained in:
parent
9d1204d6f5
commit
5266c6be8e
@ -2013,9 +2013,9 @@ void GLGizmoEmboss::draw_delete_style_button() {
|
|||||||
if (draw_button(IconType::erase, !can_delete)) {
|
if (draw_button(IconType::erase, !can_delete)) {
|
||||||
while (true) {
|
while (true) {
|
||||||
// NOTE: can't use previous loaded activ index -> erase could change index
|
// NOTE: can't use previous loaded activ index -> erase could change index
|
||||||
size_t activ_index = m_style_manager.get_style_index();
|
size_t active_index = m_style_manager.get_style_index();
|
||||||
next_style_index = (activ_index > 0) ? activ_index - 1 :
|
next_style_index = (active_index > 0) ? active_index - 1 :
|
||||||
activ_index + 1;
|
active_index + 1;
|
||||||
if (next_style_index >= m_style_manager.get_styles().size()) {
|
if (next_style_index >= m_style_manager.get_styles().size()) {
|
||||||
// can't remove last font style
|
// can't remove last font style
|
||||||
// TODO: inform user
|
// TODO: inform user
|
||||||
@ -2029,7 +2029,7 @@ void GLGizmoEmboss::draw_delete_style_button() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load back
|
// load back
|
||||||
m_style_manager.load_style(activ_index);
|
m_style_manager.load_style(active_index);
|
||||||
ImGui::OpenPopup(popup_id);
|
ImGui::OpenPopup(popup_id);
|
||||||
break;
|
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);
|
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());
|
ImGui::Text("%s", text_in_popup.c_str());
|
||||||
if (ImGui::Button(_u8L("Yes").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.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);
|
m_style_manager.store_styles_to_app_config(wxGetApp().app_config);
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
process();
|
process();
|
||||||
|
@ -39,19 +39,19 @@ void StyleManager::init(AppConfig *app_config, const EmbossStyles &default_style
|
|||||||
m_style_items.push_back({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) :
|
EmbossStylesSerializable::load_style_index(*app_config) :
|
||||||
std::optional<size_t>{};
|
std::optional<size_t>{};
|
||||||
|
|
||||||
size_t activ_index = 0;
|
size_t active_index = 0;
|
||||||
if (activ_index_opt.has_value()) activ_index = *activ_index_opt;
|
if (active_index_opt.has_value()) active_index = *active_index_opt;
|
||||||
if (activ_index >= m_style_items.size()) activ_index = 0;
|
if (active_index >= m_style_items.size()) active_index = 0;
|
||||||
|
|
||||||
// find valid font item
|
// find valid font item
|
||||||
if (!load_style(activ_index)) {
|
if (!load_style(active_index)) {
|
||||||
m_style_items.erase(m_style_items.begin() + activ_index);
|
m_style_items.erase(m_style_items.begin() + active_index);
|
||||||
activ_index = 0;
|
active_index = 0;
|
||||||
while (m_style_items.empty() || !load_style(activ_index))
|
while (m_style_items.empty() || !load_style(active_index))
|
||||||
m_style_items.erase(m_style_items.begin());
|
m_style_items.erase(m_style_items.begin());
|
||||||
// no one style from config is loadable
|
// no one style from config is loadable
|
||||||
if (m_style_items.empty()) {
|
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)});
|
m_style_items.push_back({std::move(style)});
|
||||||
}
|
}
|
||||||
// try to load first default font
|
// try to load first default font
|
||||||
[[maybe_unused]] bool loaded = load_style(activ_index);
|
[[maybe_unused]] bool loaded = load_style(active_index);
|
||||||
assert(loaded);
|
assert(loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StyleManager::store_styles_to_app_config(bool use_modification,
|
bool StyleManager::store_styles_to_app_config(bool use_modification,
|
||||||
bool store_activ_index)
|
bool store_active_index)
|
||||||
{
|
{
|
||||||
assert(m_app_config != nullptr);
|
assert(m_app_config != nullptr);
|
||||||
if (m_app_config == nullptr) return false;
|
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;
|
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() ?
|
size_t style_index = exist_stored_style() ?
|
||||||
m_style_cache.style_index :
|
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 cache state will be used for store</param>
|
||||||
/// <param name="use_modification">When true store activ index into configuration</param>
|
/// <param name="use_modification">When true store activ index into configuration</param>
|
||||||
/// <returns>True on succes otherwise False.</returns>
|
/// <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>
|
/// <summary>
|
||||||
/// Append actual style to style list
|
/// Append actual style to style list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user