Fixed Editing of the Template custom Gcode

Fixed reloading of the legend, when preview type was changed
This commit is contained in:
YuSanka 2020-06-09 16:12:57 +02:00
parent f74b1c6547
commit bf9462749f
2 changed files with 15 additions and 7 deletions

View File

@ -1619,6 +1619,8 @@ static void upgrade_text_entry_dialog(wxTextEntryDialog* dlg, double min = -1.0,
if (!textctrl) if (!textctrl)
return; return;
textctrl->SetInsertionPointEnd();
wxButton* btn_OK = static_cast<wxButton*>(dlg->FindWindowById(wxID_OK)); wxButton* btn_OK = static_cast<wxButton*>(dlg->FindWindowById(wxID_OK));
btn_OK->Bind(wxEVT_UPDATE_UI, [textctrl, min, max](wxUpdateUIEvent& evt) btn_OK->Bind(wxEVT_UPDATE_UI, [textctrl, min, max](wxUpdateUIEvent& evt)
{ {
@ -2035,7 +2037,7 @@ bool TickCodeInfo::edit_tick(std::set<TickCode>::iterator it, double print_z)
else if (it->type == PausePrint) else if (it->type == PausePrint)
edited_value = get_pause_print_msg(it->extra, print_z); edited_value = get_pause_print_msg(it->extra, print_z);
else 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()) if (edited_value.empty())
return false; return false;
@ -2046,7 +2048,13 @@ bool TickCodeInfo::edit_tick(std::set<TickCode>::iterator it, double print_z)
return false; return false;
changed_tick.color = edited_value; 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) if (it->extra == edited_value)
return false; return false;
changed_tick.extra = edited_value; changed_tick.extra = edited_value;

View File

@ -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() /*&& const wxString& choice = !wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes.empty() /*&&
(wxGetApp().extruders_edited_cnt()==1 || !slice_completed) */? (wxGetApp().extruders_edited_cnt()==1 || !slice_completed) */?
_(L("Color Print")) : _L("Color Print") :
config.option<ConfigOptionFloats>("wiping_volumes_matrix")->values.size() > 1 ? config.option<ConfigOptionFloats>("wiping_volumes_matrix")->values.size() > 1 ?
_(L("Tool")) : _L("Tool") :
_(L("Feature type")); _L("Feature type");
int type = m_choice_view_type->FindString(choice); int type = m_choice_view_type->FindString(choice);
if (m_choice_view_type->GetSelection() != type) { 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_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type;
m_preferred_color_mode = "feature"; m_preferred_color_mode = "feature";
} }
reload_print();
} }
void Preview::create_double_slider() void Preview::create_double_slider()
@ -618,8 +620,6 @@ void Preview::create_double_slider()
m_schedule_background_process(); m_schedule_background_process();
update_view_type(false); update_view_type(false);
reload_print();
}); });
} }