#5360 - GCode Viewer -> Added menu command to reload gcode file

This commit is contained in:
enricoturri1966 2020-12-03 13:48:54 +01:00
parent 0a33aedc3a
commit 2a0a9af0c9
4 changed files with 26 additions and 5 deletions

View file

@ -2002,9 +2002,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
sidebar->Bind(EVT_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
}
wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas();
wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas();
if (wxGetApp().is_editor()) {
if (wxGetApp().is_editor()) {
// 3DScene events:
view3D_canvas->Bind(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
view3D_canvas->Bind(EVT_GLCANVAS_OBJECT_SELECT, &priv::on_object_select, this);
@ -2046,8 +2046,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_OBJECTS, &priv::on_action_split_objects, this);
view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this);
view3D_canvas->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this);
}
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
}
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
// Preview events:
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
@ -2064,6 +2064,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, [this](wxKeyEvent& evt) { preview->move_layers_slider(evt); });
#endif // ENABLE_ARROW_KEYS_WITH_SLIDERS
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_layers_slider(evt); });
if (wxGetApp().is_gcode_viewer())
preview->Bind(EVT_GLCANVAS_RELOAD_FROM_DISK, [this](SimpleEvent&) { this->q->reload_gcode_from_disk(); });
if (wxGetApp().is_editor()) {
q->Bind(EVT_SLICING_COMPLETED, &priv::on_slicing_completed, this);
@ -4806,6 +4808,13 @@ void Plater::load_gcode(const wxString& filename)
set_project_filename(filename);
}
void Plater::reload_gcode_from_disk()
{
wxString filename(m_last_loaded_gcode);
m_last_loaded_gcode.clear();
load_gcode(filename);
}
void Plater::refresh_print()
{
p->preview->refresh_print();