Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2022-01-28 19:11:27 +0300
committerYuSanka <yusanka@gmail.com>2022-01-28 19:11:27 +0300
commit07a27c9e2d767db44dd835a405aae461d59cb4ca (patch)
tree5f2a8b3b08a6eb2668a73707cfd1df8b5a921e7d
parentcfdf7d2a00c3979ae52946e2ae0a920b8e8d514e (diff)
G-code substitutions: Added path to helper
Fixed a bugs: * Notes wasn't correctly save to 3mf * Button "Delete All" wasn't hidden when last substitution was deleted
-rw-r--r--src/slic3r/GUI/Tab.cpp13
-rw-r--r--src/slic3r/GUI/Tab.hpp8
2 files changed, 17 insertions, 4 deletions
diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp
index 2acde3f6f..b08eed47b 100644
--- a/src/slic3r/GUI/Tab.cpp
+++ b/src/slic3r/GUI/Tab.cpp
@@ -1703,7 +1703,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Other"));
- create_line_with_widget(optgroup.get(), "gcode_substitutions", "", [this](wxWindow* parent) {
+ create_line_with_widget(optgroup.get(), "gcode_substitutions", "g-code-substitutions_301694", [this](wxWindow* parent) {
return create_manage_substitution_widget(parent);
});
line = { "", "" };
@@ -4016,8 +4016,8 @@ void SubstitutionManager::add_substitution( int substitution_id,
};
add_text_editor(from_u8(plain_pattern), 0, 3);
- add_text_editor(from_u8(format), 1, 3);
- add_text_editor(from_u8(notes), 1, 2);
+ add_text_editor(from_u8(format), 1, 3);
+ add_text_editor(from_u8(notes), 3, 2);
auto params_sizer = new wxBoxSizer(wxHORIZONTAL);
bool regexp = strchr(params.c_str(), 'r') != nullptr || strchr(params.c_str(), 'R') != nullptr;
@@ -4079,7 +4079,9 @@ void SubstitutionManager::update_from_config()
m_grid_sizer->Clear(true);
std::vector<std::string>& subst = m_config->option<ConfigOptionStrings>("gcode_substitutions")->values;
- if (!subst.empty())
+ if (subst.empty())
+ hide_delete_all_btn();
+ else
create_legend();
validate_lenth();
@@ -4162,6 +4164,9 @@ wxSizer* TabPrint::create_substitutions_widget(wxWindow* parent)
update_dirty();
wxGetApp().mainframe->on_config_changed(m_config); // invalidate print
});
+ m_subst_manager.set_cb_hide_delete_all_btn([this]() {
+ m_del_all_substitutions_btn->Hide();
+ });
parent->GetParent()->Layout();
return grid_sizer;
diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp
index 512e8b6af..d1b0f44bf 100644
--- a/src/slic3r/GUI/Tab.hpp
+++ b/src/slic3r/GUI/Tab.hpp
@@ -54,6 +54,7 @@ class SubstitutionManager
int m_em{10};
std::function<void()> m_cb_edited_substitution{ nullptr };
+ std::function<void()> m_cb_hide_delete_all_btn{ nullptr };
void validate_lenth();
bool is_compatibile_with_ui();
@@ -83,6 +84,13 @@ public:
if (m_cb_edited_substitution)
m_cb_edited_substitution();
}
+ void set_cb_hide_delete_all_btn(std::function<void()> cb_hide_delete_all_btn) {
+ m_cb_hide_delete_all_btn = cb_hide_delete_all_btn;
+ }
+ void hide_delete_all_btn() {
+ if (m_cb_hide_delete_all_btn)
+ m_cb_hide_delete_all_btn();
+ }
bool is_empty_substitutions();
};