From bf9462749faf9e4fad6673b20c034fdf87e9e1f3 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 9 Jun 2020 16:12:57 +0200 Subject: [PATCH] Fixed Editing of the Template custom Gcode Fixed reloading of the legend, when preview type was changed --- src/slic3r/GUI/DoubleSlider.cpp | 12 ++++++++++-- src/slic3r/GUI/GUI_Preview.cpp | 10 +++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index 7ada7733b..a4b65c1b8 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -1619,6 +1619,8 @@ static void upgrade_text_entry_dialog(wxTextEntryDialog* dlg, double min = -1.0, if (!textctrl) return; + textctrl->SetInsertionPointEnd(); + wxButton* btn_OK = static_cast(dlg->FindWindowById(wxID_OK)); btn_OK->Bind(wxEVT_UPDATE_UI, [textctrl, min, max](wxUpdateUIEvent& evt) { @@ -2035,7 +2037,7 @@ bool TickCodeInfo::edit_tick(std::set::iterator it, double print_z) else if (it->type == PausePrint) edited_value = get_pause_print_msg(it->extra, print_z); else - edited_value = get_custom_code(it->extra, print_z); + edited_value = get_custom_code(it->type == Template ? gcode(Template) : it->extra, print_z); if (edited_value.empty()) return false; @@ -2046,7 +2048,13 @@ bool TickCodeInfo::edit_tick(std::set::iterator it, double print_z) return false; changed_tick.color = edited_value; } - else if (it->type == Custom || it->type == PausePrint){ + else if (it->type == Template) { + if (gcode(Template) == edited_value) + return false; + changed_tick.extra = edited_value; + changed_tick.type = Custom; + } + else if (it->type == Custom || it->type == PausePrint) { if (it->extra == edited_value) return false; changed_tick.extra = edited_value; diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 51f5c8d2d..c1e8b4c33 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -578,10 +578,10 @@ void Preview::update_view_type(bool slice_completed) const wxString& choice = !wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes.empty() /*&& (wxGetApp().extruders_edited_cnt()==1 || !slice_completed) */? - _(L("Color Print")) : + _L("Color Print") : config.option("wiping_volumes_matrix")->values.size() > 1 ? - _(L("Tool")) : - _(L("Feature type")); + _L("Tool") : + _L("Feature type"); int type = m_choice_view_type->FindString(choice); if (m_choice_view_type->GetSelection() != type) { @@ -590,6 +590,8 @@ void Preview::update_view_type(bool slice_completed) m_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type; m_preferred_color_mode = "feature"; } + + reload_print(); } void Preview::create_double_slider() @@ -618,8 +620,6 @@ void Preview::create_double_slider() m_schedule_background_process(); update_view_type(false); - - reload_print(); }); }