FIX: object table setting toggle line

Change-Id: I77f40d5563ca22d292ffa3ace67284766a4fa87e
This commit is contained in:
chunmao.guo 2023-06-15 15:42:24 +08:00 committed by Lane.Wei
parent 4733a9a602
commit 8bc581d662
3 changed files with 32 additions and 9 deletions

View File

@ -2699,7 +2699,7 @@ ObjectTablePanel::ObjectTablePanel( wxWindow* parent, wxWindowID id, const wxPoi
SetSize(wxSize(-1, FromDIP(450)));
SetMinSize(wxSize(-1, FromDIP(450)));
SetMaxSize(wxSize(-1, FromDIP(450)));
//SetMaxSize(wxSize(-1, FromDIP(450)));
//m_search_line = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
@ -2769,7 +2769,7 @@ ObjectTablePanel::ObjectTablePanel( wxWindow* parent, wxWindowID id, const wxPoi
m_top_sizer->Add(m_object_grid, 1, wxEXPAND,0);
m_top_sizer->Add(m_line_left, 0, wxEXPAND, 0);
m_top_sizer->Add(m_side_window,0,0,0);
m_top_sizer->Add(m_side_window, 0, wxEXPAND, 0);
//wxBoxSizer * page_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -3418,9 +3418,9 @@ void ObjectTableDialog::OnSize(wxSizeEvent& event)
SetMinSize(wxSize(GetSize().x, -1));
SetSize(wxSize(GetSize().x, -1));
m_obj_panel->SetSize(wxSize(-1, GetSize().y));
m_obj_panel->SetMinSize(wxSize(-1, GetSize().y));
m_obj_panel->SetMaxSize(wxSize(-1, GetSize().y));
//m_obj_panel->SetSize(wxSize(-1, GetSize().y));
//m_obj_panel->SetMinSize(wxSize(-1, GetSize().y));
//m_obj_panel->SetMaxSize(wxSize(-1, GetSize().y));
event.Skip();
}

View File

@ -290,10 +290,16 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
if (field)
field->toggle(toggle);
};
ConfigManipulation config_manipulation(nullptr, toggle_field, nullptr, nullptr, &m_current_config);
auto toggle_line = [this, optgroup](const t_config_option_key & opt_key, bool toggle)
{
Line* line = optgroup->get_line(opt_key);
if (line) line->toggle_visible = toggle;
};
ConfigManipulation config_manipulation(nullptr, toggle_field, toggle_line, nullptr, &m_current_config);
printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&m_current_config) :
config_manipulation.toggle_print_sla_options(&m_current_config) ;
optgroup->update_visibility(wxGetApp().get_mode());
}
//if (!categories.empty()) {
@ -383,15 +389,26 @@ void ObjectTableSettings::update_config_values(bool is_object, ModelObject* obje
if (field)
field->toggle(toggle);
};
auto toggle_line = [this](const t_config_option_key &opt_key, bool toggle) {
for (auto og : m_og_settings) {
Line *line = og->get_line(opt_key);
if (line) { line->toggle_visible = toggle; break; }
}
};
ConfigManipulation config_manipulation(nullptr, toggle_field, nullptr, nullptr, &m_current_config);
ConfigManipulation config_manipulation(nullptr, toggle_field, toggle_line, nullptr, &m_current_config);
printer_technology == ptFFF ? config_manipulation.update_print_fff_config(&main_config) :
config_manipulation.update_print_sla_config(&main_config) ;
printer_technology == ptFFF ? config_manipulation.toggle_print_fff_options(&main_config) :
config_manipulation.toggle_print_sla_options(&main_config) ;
for (auto og : m_og_settings) {
og->update_visibility(wxGetApp().get_mode());
}
m_parent->Layout();
m_parent->Fit();
m_parent->GetParent()->Layout();
t_config_option_keys diff_keys;
for (const t_config_option_key &opt_key : main_config.keys()) {
const ConfigOption *this_opt = main_config.option(opt_key);

View File

@ -793,8 +793,14 @@ bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode)
int coef = 0;
int hidden_row_cnt = 0;
const int cols = m_grid_sizer->GetCols();
Line * line = &m_lines.front();
size_t line_opt_end = line->get_options().size();
for (auto opt_mode : m_options_mode) {
const bool show = opt_mode <= mode;
const bool show = opt_mode <= mode && line->toggle_visible;
if (--line_opt_end == 0) {
++line;
line_opt_end = line->get_options().size();
}
if (!show) {
hidden_row_cnt++;
for (int i = 0; i < cols; ++i)