mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
New feature: bring back gcode window as well as optimized the show/hide logic a bit
This commit is contained in:
parent
6191b4b6dd
commit
64f0c96283
3 changed files with 14 additions and 17 deletions
|
@ -710,11 +710,9 @@ void GCodeViewer::SequentialView::render(const bool has_render_path, float legen
|
||||||
if (wxGetApp().is_editor())
|
if (wxGetApp().is_editor())
|
||||||
bottom -= wxGetApp().plater()->get_view_toolbar().get_height();
|
bottom -= wxGetApp().plater()->get_view_toolbar().get_height();
|
||||||
#endif
|
#endif
|
||||||
//gcode_window.render(legend_height, bottom, static_cast<uint64_t>(gcode_ids[current.last]));
|
if (has_render_path)
|
||||||
if (wxGetApp().get_mode() == ConfigOptionMode::comDevelop) {
|
gcode_window.render(legend_height + 2, std::max(10.f, (float)canvas_height - 40), (float)canvas_width,
|
||||||
if (has_render_path)
|
static_cast<uint64_t>(gcode_ids[current.last]));
|
||||||
gcode_window.render(legend_height, (float)canvas_height, (float)canvas_width, static_cast<uint64_t>(gcode_ids[current.last]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<GCodeViewer::Color> GCodeViewer::Extrusion_Role_Colors {{
|
const std::vector<GCodeViewer::Color> GCodeViewer::Extrusion_Role_Colors {{
|
||||||
|
@ -994,11 +992,10 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
|
||||||
m_gcode_result = &gcode_result;
|
m_gcode_result = &gcode_result;
|
||||||
m_only_gcode_in_preview = only_gcode;
|
m_only_gcode_in_preview = only_gcode;
|
||||||
|
|
||||||
if (mode == ConfigOptionMode::comDevelop) {
|
m_sequential_view.gcode_window.load_gcode(gcode_result.filename,
|
||||||
m_sequential_view.gcode_window.load_gcode(gcode_result.filename,
|
// Stealing out lines_ends should be safe because this gcode_result is
|
||||||
// Stealing out lines_ends should be safe because this gcode_result is processed only once (see the 1st if in this function).
|
// processed only once (see the 1st if in this function).
|
||||||
std::move(const_cast<std::vector<size_t>&>(gcode_result.lines_ends)));
|
std::move(const_cast<std::vector<size_t> &>(gcode_result.lines_ends)));
|
||||||
}
|
|
||||||
|
|
||||||
//BBS: add only gcode mode
|
//BBS: add only gcode mode
|
||||||
//if (wxGetApp().is_gcode_viewer())
|
//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_settings_ids = gcode_result.settings_ids;
|
||||||
m_filament_diameters = gcode_result.filament_diameters;
|
m_filament_diameters = gcode_result.filament_diameters;
|
||||||
m_filament_densities = gcode_result.filament_densities;
|
m_filament_densities = gcode_result.filament_densities;
|
||||||
|
m_sequential_view.m_show_gcode_window = false;
|
||||||
|
|
||||||
//BBS: always load shell at preview
|
//BBS: always load shell at preview
|
||||||
/*if (wxGetApp().is_editor())
|
/*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
|
//BBS fixed bottom_margin for space to render horiz slider
|
||||||
int bottom_margin = 64;
|
int bottom_margin = 64;
|
||||||
|
m_sequential_view.m_show_gcode_window =
|
||||||
//BBS always render the hotend-marker
|
m_sequential_view.m_show_gcode_window ||
|
||||||
//if (m_sequential_view.current.last != m_sequential_view.endpoints.last && !m_no_render_path) {
|
(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_position(m_sequential_view.current_position);
|
||||||
m_sequential_view.marker.set_world_offset(m_sequential_view.current_offset);
|
m_sequential_view.marker.set_world_offset(m_sequential_view.current_offset);
|
||||||
//BBS fixed buttom margin. m_moves_slider.pos_y
|
//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);
|
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
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
render_statistics();
|
render_statistics();
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
|
@ -697,7 +697,7 @@ public:
|
||||||
GCodeWindow gcode_window;
|
GCodeWindow gcode_window;
|
||||||
std::vector<unsigned int> gcode_ids;
|
std::vector<unsigned int> gcode_ids;
|
||||||
float m_scale = 1.0;
|
float m_scale = 1.0;
|
||||||
|
bool m_show_gcode_window = false;
|
||||||
//BBS: GUI refactor: add canvas size
|
//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;
|
void render(const bool has_render_path, float legend_height, int canvas_width, int canvas_height, const EViewType& view_type) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3079,10 +3079,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
}
|
}
|
||||||
//case 'B':
|
//case 'B':
|
||||||
//case 'b': { zoom_to_bed(); break; }
|
//case 'b': { zoom_to_bed(); break; }
|
||||||
#if !BBL_RELEASE_TO_PUBLIC
|
|
||||||
case 'C':
|
case 'C':
|
||||||
case 'c': { m_gcode_viewer.toggle_gcode_window_visibility(); m_dirty = true; request_extra_frame(); break; }
|
case 'c': { m_gcode_viewer.toggle_gcode_window_visibility(); m_dirty = true; request_extra_frame(); break; }
|
||||||
#endif
|
|
||||||
//case 'G':
|
//case 'G':
|
||||||
//case 'g': {
|
//case 'g': {
|
||||||
// if ((evt.GetModifiers() & shiftMask) != 0) {
|
// if ((evt.GetModifiers() & shiftMask) != 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue