diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index c746baeb2c..4a29d088cc 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -710,11 +710,9 @@ void GCodeViewer::SequentialView::render(const bool has_render_path, float legen if (wxGetApp().is_editor()) bottom -= wxGetApp().plater()->get_view_toolbar().get_height(); #endif - //gcode_window.render(legend_height, bottom, static_cast(gcode_ids[current.last])); - if (wxGetApp().get_mode() == ConfigOptionMode::comDevelop) { - if (has_render_path) - gcode_window.render(legend_height, (float)canvas_height, (float)canvas_width, static_cast(gcode_ids[current.last])); - } + if (has_render_path) + gcode_window.render(legend_height + 2, std::max(10.f, (float)canvas_height - 40), (float)canvas_width, + static_cast(gcode_ids[current.last])); } const std::vector GCodeViewer::Extrusion_Role_Colors {{ @@ -994,11 +992,10 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr m_gcode_result = &gcode_result; m_only_gcode_in_preview = only_gcode; - if (mode == ConfigOptionMode::comDevelop) { - m_sequential_view.gcode_window.load_gcode(gcode_result.filename, - // Stealing out lines_ends should be safe because this gcode_result is processed only once (see the 1st if in this function). - std::move(const_cast&>(gcode_result.lines_ends))); - } + m_sequential_view.gcode_window.load_gcode(gcode_result.filename, + // Stealing out lines_ends should be safe because this gcode_result is + // processed only once (see the 1st if in this function). + std::move(const_cast &>(gcode_result.lines_ends))); //BBS: add only gcode mode //if (wxGetApp().is_gcode_viewer()) @@ -1018,6 +1015,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr m_settings_ids = gcode_result.settings_ids; m_filament_diameters = gcode_result.filament_diameters; m_filament_densities = gcode_result.filament_densities; + m_sequential_view.m_show_gcode_window = false; //BBS: always load shell at preview /*if (wxGetApp().is_editor()) @@ -1282,14 +1280,15 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin) //BBS fixed bottom_margin for space to render horiz slider int bottom_margin = 64; - - //BBS always render the hotend-marker - //if (m_sequential_view.current.last != m_sequential_view.endpoints.last && !m_no_render_path) { + m_sequential_view.m_show_gcode_window = + m_sequential_view.m_show_gcode_window || + (m_sequential_view.current.last != m_sequential_view.endpoints.last && !m_no_render_path); + if (m_sequential_view.m_show_gcode_window) { m_sequential_view.marker.set_world_position(m_sequential_view.current_position); m_sequential_view.marker.set_world_offset(m_sequential_view.current_offset); //BBS fixed buttom margin. m_moves_slider.pos_y m_sequential_view.render(!m_no_render_path, legend_height, canvas_width - right_margin * m_scale, canvas_height - bottom_margin * m_scale, m_view_type); - //} + } #if ENABLE_GCODE_VIEWER_STATISTICS render_statistics(); #endif // ENABLE_GCODE_VIEWER_STATISTICS diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index 2fed7a7016..9f8d46cf53 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -697,7 +697,7 @@ public: GCodeWindow gcode_window; std::vector gcode_ids; float m_scale = 1.0; - + bool m_show_gcode_window = false; //BBS: GUI refactor: add canvas size void render(const bool has_render_path, float legend_height, int canvas_width, int canvas_height, const EViewType& view_type) const; }; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 4a1f2ff4cd..ce9a441b42 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3079,10 +3079,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) } //case 'B': //case 'b': { zoom_to_bed(); break; } -#if !BBL_RELEASE_TO_PUBLIC case 'C': case 'c': { m_gcode_viewer.toggle_gcode_window_visibility(); m_dirty = true; request_extra_frame(); break; } -#endif //case 'G': //case 'g': { // if ((evt.GetModifiers() & shiftMask) != 0) {