Tech ENABLE_PREVIEW_LAYOUT - Replace options combo in bottom toolbar with toolbar in legend

This commit is contained in:
enricoturri1966 2021-09-24 09:22:50 +02:00
parent fee31084bd
commit e12cf58c91
8 changed files with 191 additions and 24 deletions
src/slic3r/GUI

View file

@ -224,7 +224,6 @@ bool Preview::init(wxWindow* parent, Model* model)
m_choice_view_type->Append(_L("Tool"));
m_choice_view_type->Append(_L("Color Print"));
m_choice_view_type->SetSelection(0);
#endif // !ENABLE_PREVIEW_LAYOUT
m_label_show = new wxStaticText(m_bottom_toolbar_panel, wxID_ANY, _L("Show"));
@ -233,7 +232,7 @@ bool Preview::init(wxWindow* parent, Model* model)
#else
long combo_style = wxCB_READONLY;
#endif
#if !ENABLE_PREVIEW_LAYOUT
m_combochecklist_features = new wxComboCtrl();
m_combochecklist_features->Create(m_bottom_toolbar_panel, wxID_ANY, _L("Feature types"), wxDefaultPosition, wxDefaultSize, combo_style);
std::string feature_items = GUI::into_u8(
@ -254,7 +253,6 @@ bool Preview::init(wxWindow* parent, Model* model)
_L("Custom") + "|1"
);
Slic3r::GUI::create_combochecklist(m_combochecklist_features, GUI::into_u8(_L("Feature types")), feature_items);
#endif // !ENABLE_PREVIEW_LAYOUT
m_combochecklist_options = new wxComboCtrl();
m_combochecklist_options->Create(m_bottom_toolbar_panel, wxID_ANY, _L("Options"), wxDefaultPosition, wxDefaultSize, combo_style);
@ -273,6 +271,7 @@ bool Preview::init(wxWindow* parent, Model* model)
get_option_type_string(OptionType::Legend) + "|1"
);
Slic3r::GUI::create_combochecklist(m_combochecklist_options, GUI::into_u8(_L("Options")), options_items);
#endif // !ENABLE_PREVIEW_LAYOUT
m_left_sizer = new wxBoxSizer(wxVERTICAL);
m_left_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
@ -288,17 +287,15 @@ bool Preview::init(wxWindow* parent, Model* model)
bottom_toolbar_sizer->AddSpacer(5);
bottom_toolbar_sizer->Add(m_label_view_type, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
bottom_toolbar_sizer->Add(m_choice_view_type, 0, wxALIGN_CENTER_VERTICAL, 0);
#endif // !ENABLE_PREVIEW_LAYOUT
bottom_toolbar_sizer->AddSpacer(5);
bottom_toolbar_sizer->Add(m_label_show, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
bottom_toolbar_sizer->Add(m_combochecklist_options, 0, wxALIGN_CENTER_VERTICAL, 0);
#if !ENABLE_PREVIEW_LAYOUT
// change the following number if editing the layout of the bottom toolbar sizer. It is used into update_bottom_toolbar()
m_combochecklist_features_pos = 6;
bottom_toolbar_sizer->Add(m_combochecklist_features, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5);
bottom_toolbar_sizer->Hide(m_combochecklist_features);
#endif // !ENABLE_PREVIEW_LAYOUT
bottom_toolbar_sizer->AddSpacer(5);
#endif // !ENABLE_PREVIEW_LAYOUT
bottom_toolbar_sizer->Add(m_moves_slider, 1, wxALL | wxEXPAND, 0);
m_bottom_toolbar_panel->SetSizer(bottom_toolbar_sizer);
@ -360,7 +357,9 @@ void Preview::load_print(bool keep_z_range)
else if (tech == ptSLA)
load_print_as_sla();
#if !ENABLE_PREVIEW_LAYOUT
update_bottom_toolbar();
#endif // !ENABLE_PREVIEW_LAYOUT
Layout();
}
@ -430,9 +429,9 @@ void Preview::sys_color_changed()
wxGetApp().UpdateDarkUI(m_choice_view_type);
wxGetApp().UpdateDarkUI(m_combochecklist_features);
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_features->GetPopupControl()));
#endif // !ENABLE_PREVIEW_LAYOUT
wxGetApp().UpdateDarkUI(m_combochecklist_options);
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_options->GetPopupControl()));
#endif // !ENABLE_PREVIEW_LAYOUT
#endif
if (m_layers_slider != nullptr)
@ -456,23 +455,23 @@ void Preview::edit_layers_slider(wxKeyEvent& evt)
void Preview::bind_event_handlers()
{
this->Bind(wxEVT_SIZE, &Preview::on_size, this);
Bind(wxEVT_SIZE, &Preview::on_size, this);
#if !ENABLE_PREVIEW_LAYOUT
m_choice_view_type->Bind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
m_combochecklist_features->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
#endif // !ENABLE_PREVIEW_LAYOUT
m_combochecklist_options->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
#endif // !ENABLE_PREVIEW_LAYOUT
m_moves_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
}
void Preview::unbind_event_handlers()
{
this->Unbind(wxEVT_SIZE, &Preview::on_size, this);
Unbind(wxEVT_SIZE, &Preview::on_size, this);
#if !ENABLE_PREVIEW_LAYOUT
m_choice_view_type->Unbind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
m_combochecklist_features->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
#endif // !ENABLE_PREVIEW_LAYOUT
m_combochecklist_options->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
#endif // !ENABLE_PREVIEW_LAYOUT
m_moves_slider->Unbind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
}
@ -510,7 +509,6 @@ void Preview::on_combochecklist_features(wxCommandEvent& evt)
m_canvas->set_toolpath_role_visibility_flags(flags);
refresh_print();
}
#endif // !ENABLE_PREVIEW_LAYOUT
void Preview::on_combochecklist_options(wxCommandEvent& evt)
{
@ -526,12 +524,9 @@ void Preview::on_combochecklist_options(wxCommandEvent& evt)
void Preview::update_bottom_toolbar()
{
#if !ENABLE_PREVIEW_LAYOUT
combochecklist_set_flags(m_combochecklist_features, m_canvas->get_toolpath_role_visibility_flags());
#endif // !ENABLE_PREVIEW_LAYOUT
combochecklist_set_flags(m_combochecklist_options, m_canvas->get_gcode_options_visibility_flags());
#if !ENABLE_PREVIEW_LAYOUT
// updates visibility of features combobox
if (m_bottom_toolbar_panel->IsShown()) {
wxSizer* sizer = m_bottom_toolbar_panel->GetSizer();
@ -554,8 +549,8 @@ void Preview::update_bottom_toolbar()
}
}
}
#endif // !ENABLE_PREVIEW_LAYOUT
}
#endif // !ENABLE_PREVIEW_LAYOUT
wxBoxSizer* Preview::create_layers_slider_sizer()
{
@ -1077,6 +1072,7 @@ void Preview::on_moves_slider_scroll_changed(wxCommandEvent& event)
m_canvas->render();
}
#if !ENABLE_PREVIEW_LAYOUT
wxString Preview::get_option_type_string(OptionType type) const
{
switch (type)
@ -1096,6 +1092,7 @@ wxString Preview::get_option_type_string(OptionType type) const
default: { return ""; }
}
}
#endif // !ENABLE_PREVIEW_LAYOUT
} // namespace GUI
} // namespace Slic3r