Fixed a preview mode selection after updating of a PrusaDoubleSlider

This commit is contained in:
YuSanka 2019-02-27 13:37:16 +01:00
parent 773f1c35cf
commit a76bd40c62
2 changed files with 12 additions and 15 deletions

View file

@ -563,8 +563,12 @@ void Preview::create_double_slider()
auto& config = wxGetApp().preset_bundle->project_config;
((config.option<ConfigOptionFloats>("colorprint_heights"))->values) = (m_slider->GetTicksValues());
m_schedule_background_process();
bool color_print = !config.option<ConfigOptionFloats>("colorprint_heights")->values.empty();
int type = m_choice_view_type->FindString(color_print ? _(L("Color Print")) : _(L("Feature type")) );
const wxString& choise = !config.option<ConfigOptionFloats>("colorprint_heights")->values.empty() ? _(L("Color Print")) :
config.option<ConfigOptionFloats>("wiping_volumes_matrix")->values.size() > 1 ?
_(L("Tool")) : _(L("Feature type"));
int type = m_choice_view_type->FindString(choise);
if (m_choice_view_type->GetSelection() != type) {
m_choice_view_type->SetSelection(type);
if ((0 <= type) && (type < (int)GCodePreviewData::Extrusion::Num_View_Types))
@ -638,18 +642,6 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool for
const auto& config = wxGetApp().preset_bundle->project_config;
const std::vector<double> &ticks_from_config = (config.option<ConfigOptionFloats>("colorprint_heights"))->values;
// Switch to the "Feature type" from the very beginning of a new object slicing after deleting of the old one
if (ticks_from_config.empty())
{
const int& type = m_choice_view_type->FindString(_(L("Feature type")));
if (m_choice_view_type->GetSelection() != type) {
m_choice_view_type->SetSelection(type);
if (0 <= type && type < int(GCodePreviewData::Extrusion::Num_View_Types))
m_gcode_preview_data->extrusion.view_type = GCodePreviewData::Extrusion::EViewType(type);
m_preferred_color_mode = "feature";
reload_print();
}
}
m_slider->SetTicksValues(ticks_from_config);
bool color_print_enable = (wxGetApp().plater()->printer_technology() == ptFFF);