FIX: empty param page remain in part tab
Change-Id: I41e90b53b0671df926ede7615e84b586e337b37a Jira: STUDIO-9072
This commit is contained in:
parent
5407c58de8
commit
0948b983d7
|
@ -146,6 +146,21 @@ void OptionsGroup::set_max_win_width(int max_win_width)
|
|||
custom_ctrl->set_max_win_width(max_win_width);
|
||||
}
|
||||
|
||||
void OptionsGroup::remove_option_if(std::function<bool(std::string const &)> const &comp)
|
||||
{
|
||||
for (auto &l : m_lines) {
|
||||
auto &opts = const_cast<std::vector<Option> &>(l.get_options());
|
||||
opts.erase(std::remove_if(opts.begin(), opts.end(), [&comp](Option &o) { return comp(o.opt.opt_key); }), opts.end());
|
||||
l.undo_to_sys = true;
|
||||
}
|
||||
for (int i = m_lines.size() - 1; i >= 0; --i) {
|
||||
if (m_lines[i].get_options().empty())
|
||||
m_options_mode.erase(m_options_mode.begin() + i);
|
||||
}
|
||||
m_lines.erase(std::remove_if(m_lines.begin(), m_lines.end(), [](auto &l) { return l.get_options().empty(); }), m_lines.end());
|
||||
// TODO: remove items from g->m_options;
|
||||
}
|
||||
|
||||
void OptionsGroup::show_field(const t_config_option_key& opt_key, bool show/* = true*/)
|
||||
{
|
||||
Field* field = get_field(opt_key);
|
||||
|
|
|
@ -194,6 +194,7 @@ public:
|
|||
|
||||
bool is_activated() { return sizer != nullptr; }
|
||||
|
||||
void remove_option_if(std::function<bool(std::string const &)> const & comp);
|
||||
protected:
|
||||
std::map<t_config_option_key, Option> m_options;
|
||||
wxWindow* m_parent {nullptr};
|
||||
|
|
|
@ -2419,18 +2419,7 @@ void TabPrintModel::build()
|
|||
|
||||
for (auto p : m_pages) {
|
||||
for (auto g : p->m_optgroups) {
|
||||
auto & lines = const_cast<std::vector<Line>&>(g->get_lines());
|
||||
for (auto & l : lines) {
|
||||
auto & opts = const_cast<std::vector<Option>&>(l.get_options());
|
||||
opts.erase(std::remove_if(opts.begin(), opts.end(), [this](auto & o) {
|
||||
return !has_key(o.opt.opt_key);
|
||||
}), opts.end());
|
||||
l.undo_to_sys = true;
|
||||
}
|
||||
lines.erase(std::remove_if(lines.begin(), lines.end(), [](auto & l) {
|
||||
return l.get_options().empty();
|
||||
}), lines.end());
|
||||
// TODO: remove items from g->m_options;
|
||||
g->remove_option_if([this](auto &key) { return !has_key(key); });
|
||||
g->have_sys_config = [this] { m_back_to_sys = true; return true; };
|
||||
}
|
||||
p->m_optgroups.erase(std::remove_if(p->m_optgroups.begin(), p->m_optgroups.end(), [](auto & g) {
|
||||
|
|
Loading…
Reference in New Issue