Tech ENABLE_GCODE_VIEWER_AS_STATE set as default

This commit is contained in:
enricoturri1966 2020-08-03 15:00:19 +02:00
parent 0eb6ba96d6
commit 0840b2328a
13 changed files with 91 additions and 144 deletions

View File

@ -1147,7 +1147,6 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f) else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f)
type = EMoveType::Travel; type = EMoveType::Travel;
#if ENABLE_GCODE_VIEWER_AS_STATE
if (type == EMoveType::Extrude && (m_width == 0.0f || m_height == 0.0f)) { if (type == EMoveType::Extrude && (m_width == 0.0f || m_height == 0.0f)) {
if (m_extrusion_role != erCustom) { if (m_extrusion_role != erCustom) {
m_width = 0.5f; m_width = 0.5f;
@ -1155,10 +1154,6 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
} }
type = EMoveType::Travel; type = EMoveType::Travel;
} }
#else
if (type == EMoveType::Extrude && (m_width == 0.0f || m_height == 0.0f || !is_valid_extrusion_role(m_extrusion_role)))
type = EMoveType::Travel;
#endif // ENABLE_GCODE_VIEWER_AS_STATE
return type; return type;
}; };

View File

@ -244,10 +244,8 @@ namespace Slic3r {
{ {
unsigned int id; unsigned int id;
std::vector<MoveVertex> moves; std::vector<MoveVertex> moves;
#if ENABLE_GCODE_VIEWER_AS_STATE
Pointfs bed_shape; Pointfs bed_shape;
std::vector<std::string> extruder_colors; std::vector<std::string> extruder_colors;
#endif // ENABLE_GCODE_VIEWER_AS_STATE
PrintEstimatedTimeStatistics time_statistics; PrintEstimatedTimeStatistics time_statistics;
#if ENABLE_GCODE_VIEWER_STATISTICS #if ENABLE_GCODE_VIEWER_STATISTICS
@ -256,19 +254,15 @@ namespace Slic3r {
{ {
time = 0; time = 0;
moves = std::vector<MoveVertex>(); moves = std::vector<MoveVertex>();
#if ENABLE_GCODE_VIEWER_AS_STATE
bed_shape = Pointfs(); bed_shape = Pointfs();
extruder_colors = std::vector<std::string>(); extruder_colors = std::vector<std::string>();
#endif // ENABLE_GCODE_VIEWER_AS_STATE
} }
#else #else
void reset() void reset()
{ {
moves = std::vector<MoveVertex>(); moves = std::vector<MoveVertex>();
#if ENABLE_GCODE_VIEWER_AS_STATE
bed_shape = Pointfs(); bed_shape = Pointfs();
extruder_colors = std::vector<std::string>(); extruder_colors = std::vector<std::string>();
#endif // ENABLE_GCODE_VIEWER_AS_STATE
} }
#endif // ENABLE_GCODE_VIEWER_STATISTICS #endif // ENABLE_GCODE_VIEWER_STATISTICS
}; };

View File

@ -58,7 +58,6 @@
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1) #define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER) #define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
#define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (0 && ENABLE_GCODE_VIEWER) #define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (0 && ENABLE_GCODE_VIEWER)
#define ENABLE_GCODE_VIEWER_AS_STATE (1 && ENABLE_GCODE_VIEWER)
#define ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR (1 && ENABLE_GCODE_VIEWER) #define ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR (1 && ENABLE_GCODE_VIEWER)
#define ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG (1 && ENABLE_GCODE_VIEWER) #define ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG (1 && ENABLE_GCODE_VIEWER)

View File

@ -7,9 +7,7 @@
#include "libslic3r/Model.hpp" #include "libslic3r/Model.hpp"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
#if ENABLE_GCODE_VIEWER_AS_STATE
#include "MainFrame.hpp" #include "MainFrame.hpp"
#endif // ENABLE_GCODE_VIEWER_AS_STATE
#include "Plater.hpp" #include "Plater.hpp"
#include "PresetBundle.hpp" #include "PresetBundle.hpp"
#include "Camera.hpp" #include "Camera.hpp"
@ -314,13 +312,9 @@ void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print&
reset(); reset();
load_toolpaths(gcode_result); load_toolpaths(gcode_result);
#if ENABLE_GCODE_VIEWER_AS_STATE
if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer) if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer)
#endif // ENABLE_GCODE_VIEWER_AS_STATE
load_shells(print, initialized); load_shells(print, initialized);
else {
#if ENABLE_GCODE_VIEWER_AS_STATE
if (wxGetApp().mainframe->get_mode() == MainFrame::EMode::GCodeViewer) {
Pointfs bed_shape; Pointfs bed_shape;
if (!gcode_result.bed_shape.empty()) if (!gcode_result.bed_shape.empty())
// bed shape detected in the gcode // bed shape detected in the gcode
@ -337,7 +331,6 @@ void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print&
} }
wxGetApp().plater()->set_bed_shape(bed_shape, "", "", true); wxGetApp().plater()->set_bed_shape(bed_shape, "", "", true);
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE
m_time_statistics = gcode_result.time_statistics; m_time_statistics = gcode_result.time_statistics;
} }
@ -351,12 +344,10 @@ void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std:
if (m_vertices_count == 0) if (m_vertices_count == 0)
return; return;
#if ENABLE_GCODE_VIEWER_AS_STATE
if (m_view_type == EViewType::Tool && !gcode_result.extruder_colors.empty()) if (m_view_type == EViewType::Tool && !gcode_result.extruder_colors.empty())
// update tool colors from config stored in the gcode // update tool colors from config stored in the gcode
m_tool_colors = decode_colors(gcode_result.extruder_colors); m_tool_colors = decode_colors(gcode_result.extruder_colors);
else else
#endif // ENABLE_GCODE_VIEWER_AS_STATE
// update tool colors // update tool colors
m_tool_colors = decode_colors(str_tool_colors); m_tool_colors = decode_colors(str_tool_colors);
@ -841,17 +832,13 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
for (size_t i = 0; i < m_vertices_count; ++i) { for (size_t i = 0; i < m_vertices_count; ++i) {
const GCodeProcessor::MoveVertex& move = gcode_result.moves[i]; const GCodeProcessor::MoveVertex& move = gcode_result.moves[i];
#if ENABLE_GCODE_VIEWER_AS_STATE
if (wxGetApp().mainframe->get_mode() == MainFrame::EMode::GCodeViewer) if (wxGetApp().mainframe->get_mode() == MainFrame::EMode::GCodeViewer)
// for the gcode viewer we need all moves to correctly size the printbed // for the gcode viewer we need all moves to correctly size the printbed
m_paths_bounding_box.merge(move.position.cast<double>()); m_paths_bounding_box.merge(move.position.cast<double>());
else { else {
#endif // ENABLE_GCODE_VIEWER_AS_STATE
if (move.type == EMoveType::Extrude && move.width != 0.0f && move.height != 0.0f) if (move.type == EMoveType::Extrude && move.width != 0.0f && move.height != 0.0f)
m_paths_bounding_box.merge(move.position.cast<double>()); m_paths_bounding_box.merge(move.position.cast<double>());
#if ENABLE_GCODE_VIEWER_AS_STATE
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE
} }
// add origin // add origin

View File

@ -1913,12 +1913,12 @@ void GLCanvas3D::zoom_to_selection()
_zoom_to_box(m_selection.get_bounding_box()); _zoom_to_box(m_selection.get_bounding_box());
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void GLCanvas3D::zoom_to_gcode() void GLCanvas3D::zoom_to_gcode()
{ {
_zoom_to_box(m_gcode_viewer.get_paths_bounding_box(), 1.05); _zoom_to_box(m_gcode_viewer.get_paths_bounding_box(), 1.05);
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
void GLCanvas3D::select_view(const std::string& direction) void GLCanvas3D::select_view(const std::string& direction)
{ {
@ -2696,9 +2696,7 @@ static void load_gcode_retractions(const GCodePreviewData::Retraction& retractio
void GLCanvas3D::load_gcode_preview(const GCodeProcessor::Result& gcode_result) void GLCanvas3D::load_gcode_preview(const GCodeProcessor::Result& gcode_result)
{ {
m_gcode_viewer.load(gcode_result, *this->fff_print(), m_initialized); m_gcode_viewer.load(gcode_result, *this->fff_print(), m_initialized);
#if ENABLE_GCODE_VIEWER_AS_STATE
if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer) if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer)
#endif // ENABLE_GCODE_VIEWER_AS_STATE
_show_warning_texture_if_needed(WarningTexture::ToolpathOutside); _show_warning_texture_if_needed(WarningTexture::ToolpathOutside);
} }
@ -4280,17 +4278,15 @@ void GLCanvas3D::update_ui_from_settings()
} }
#endif // ENABLE_RETINA_GL #endif // ENABLE_RETINA_GL
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
if (wxGetApp().mainframe != nullptr && wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer) if (wxGetApp().mainframe != nullptr && wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer)
wxGetApp().plater()->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1"); wxGetApp().plater()->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1");
#else #else
bool enable_collapse = wxGetApp().app_config->get("show_collapse_button") == "1"; bool enable_collapse = wxGetApp().app_config->get("show_collapse_button") == "1";
wxGetApp().plater()->get_collapse_toolbar().set_enabled(enable_collapse); wxGetApp().plater()->get_collapse_toolbar().set_enabled(enable_collapse);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
} }
GLCanvas3D::WipeTowerInfo GLCanvas3D::get_wipe_tower_info() const GLCanvas3D::WipeTowerInfo GLCanvas3D::get_wipe_tower_info() const
{ {
WipeTowerInfo wti; WipeTowerInfo wti;
@ -5385,22 +5381,16 @@ static BoundingBoxf3 print_volume(const DynamicPrintConfig& config)
void GLCanvas3D::_render_background() const void GLCanvas3D::_render_background() const
{ {
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER_AS_STATE
bool use_error_color = false; bool use_error_color = false;
if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer) { if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer) {
use_error_color = m_dynamic_background_enabled; use_error_color = m_dynamic_background_enabled;
#else
bool use_error_color = m_dynamic_background_enabled;
#endif // ENABLE_GCODE_VIEWER_AS_STATE
if (!m_volumes.empty()) if (!m_volumes.empty())
use_error_color &= _is_any_volume_outside(); use_error_color &= _is_any_volume_outside();
else { else {
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3(); BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
use_error_color &= (test_volume.radius() > 0.0) ? !test_volume.contains(m_gcode_viewer.get_paths_bounding_box()) : false; use_error_color &= (test_volume.radius() > 0.0) ? !test_volume.contains(m_gcode_viewer.get_paths_bounding_box()) : false;
} }
#if ENABLE_GCODE_VIEWER_AS_STATE
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE
#endif // ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
@ -7119,20 +7109,13 @@ void GLCanvas3D::_show_warning_texture_if_needed(WarningTexture::Warning warning
bool show = false; bool show = false;
if (!m_volumes.empty()) if (!m_volumes.empty())
show = _is_any_volume_outside(); show = _is_any_volume_outside();
else else {
{ if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer) {
#if ENABLE_GCODE_VIEWER_AS_STATE
if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer)
{
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3(); BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
const BoundingBoxf3& paths_volume = m_gcode_viewer.get_paths_bounding_box(); const BoundingBoxf3& paths_volume = m_gcode_viewer.get_paths_bounding_box();
if (test_volume.radius() > 0.0 && paths_volume.radius() > 0.0) if (test_volume.radius() > 0.0 && paths_volume.radius() > 0.0)
show = !test_volume.contains(paths_volume); show = !test_volume.contains(paths_volume);
} }
#else
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
show = (test_volume.radius() > 0.0) ? !test_volume.contains(m_gcode_viewer.get_bounding_box()) : false;
#endif // ENABLE_GCODE_VIEWER_AS_STATE
} }
_set_warning_texture(warning, show); _set_warning_texture(warning, show);
#else #else

View File

@ -625,9 +625,9 @@ public:
void zoom_to_bed(); void zoom_to_bed();
void zoom_to_volumes(); void zoom_to_volumes();
void zoom_to_selection(); void zoom_to_selection();
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void zoom_to_gcode(); void zoom_to_gcode();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
void select_view(const std::string& direction); void select_view(const std::string& direction);
void update_volumes_colors_by_extruder(); void update_volumes_colors_by_extruder();

View File

@ -754,7 +754,7 @@ void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files) const
dialog.GetPaths(input_files); dialog.GetPaths(input_files);
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void GUI_App::load_gcode(wxWindow* parent, wxString& input_file) const void GUI_App::load_gcode(wxWindow* parent, wxString& input_file) const
{ {
input_file.Clear(); input_file.Clear();
@ -766,7 +766,7 @@ void GUI_App::load_gcode(wxWindow* parent, wxString& input_file) const
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
input_file = dialog.GetPath(); input_file = dialog.GetPath();
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
bool GUI_App::switch_language() bool GUI_App::switch_language()
{ {

View File

@ -156,9 +156,9 @@ public:
void keyboard_shortcuts(); void keyboard_shortcuts();
void load_project(wxWindow *parent, wxString& input_file) const; void load_project(wxWindow *parent, wxString& input_file) const;
void import_model(wxWindow *parent, wxArrayString& input_files) const; void import_model(wxWindow *parent, wxArrayString& input_files) const;
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void load_gcode(wxWindow* parent, wxString& input_file) const; void load_gcode(wxWindow* parent, wxString& input_file) const;
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
static bool catch_error(std::function<void()> cb, const std::string& err); static bool catch_error(std::function<void()> cb, const std::string& err);

View File

@ -13,9 +13,9 @@
#include "PresetBundle.hpp" #include "PresetBundle.hpp"
#include "DoubleSlider.hpp" #include "DoubleSlider.hpp"
#include "Plater.hpp" #include "Plater.hpp"
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
#include "MainFrame.hpp" #include "MainFrame.hpp"
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/glcanvas.h> #include <wx/glcanvas.h>
@ -1196,11 +1196,11 @@ void Preview::update_double_slider_from_canvas(wxKeyEvent & event)
void Preview::load_print_as_fff(bool keep_z_range) void Preview::load_print_as_fff(bool keep_z_range)
{ {
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
if (wxGetApp().mainframe == nullptr) if (wxGetApp().mainframe == nullptr)
// avoid proessing while mainframe is being constructed // avoid proessing while mainframe is being constructed
return; return;
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
if (m_loaded || m_process->current_printer_technology() != ptFFF) if (m_loaded || m_process->current_printer_technology() != ptFFF)
return; return;
@ -1225,11 +1225,11 @@ void Preview::load_print_as_fff(bool keep_z_range)
} }
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer && !has_layers) if (wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer && !has_layers)
#else #else
if (! has_layers) if (! has_layers)
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
{ {
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
hide_layers_slider(); hide_layers_slider();
@ -1265,11 +1265,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
GCodeViewer::EViewType gcode_view_type = m_canvas->get_gcode_view_preview_type(); GCodeViewer::EViewType gcode_view_type = m_canvas->get_gcode_view_preview_type();
#if ENABLE_GCODE_VIEWER_AS_STATE
bool gcode_preview_data_valid = !m_gcode_result->moves.empty(); bool gcode_preview_data_valid = !m_gcode_result->moves.empty();
#else
bool gcode_preview_data_valid = print->is_step_done(psGCodeExport);
#endif // ENABLE_GCODE_VIEWER_AS_STATE
#else #else
bool gcode_preview_data_valid = print->is_step_done(psGCodeExport) && ! m_gcode_preview_data->empty(); bool gcode_preview_data_valid = print->is_step_done(psGCodeExport) && ! m_gcode_preview_data->empty();
#endif // ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER

View File

@ -111,7 +111,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
// initialize tabpanel and menubar // initialize tabpanel and menubar
init_tabpanel(); init_tabpanel();
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
init_editor_menubar(); init_editor_menubar();
init_gcodeviewer_menubar(); init_gcodeviewer_menubar();
@ -129,7 +129,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
#endif // _WIN32 #endif // _WIN32
#else #else
init_menubar(); init_menubar();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
// set default tooltip timer in msec // set default tooltip timer in msec
// SetAutoPop supposedly accepts long integers but some bug doesn't allow for larger values // SetAutoPop supposedly accepts long integers but some bug doesn't allow for larger values
@ -243,9 +243,9 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
update_ui_from_settings(); // FIXME (?) update_ui_from_settings(); // FIXME (?)
if (m_plater != nullptr) { if (m_plater != nullptr) {
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
m_plater->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1"); m_plater->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1");
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
m_plater->show_action_buttons(true); m_plater->show_action_buttons(true);
} }
} }
@ -291,7 +291,7 @@ void MainFrame::update_layout()
Layout(); Layout();
}; };
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
ESettingsLayout layout = (m_mode == EMode::GCodeViewer) ? ESettingsLayout::GCodeViewer : ESettingsLayout layout = (m_mode == EMode::GCodeViewer) ? ESettingsLayout::GCodeViewer :
(wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old : (wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old :
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::New : wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::New :
@ -300,7 +300,7 @@ void MainFrame::update_layout()
ESettingsLayout layout = wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old : ESettingsLayout layout = wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old :
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::New : wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::New :
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old; wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old;
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
if (m_layout == layout) if (m_layout == layout)
return; return;
@ -356,14 +356,14 @@ void MainFrame::update_layout()
m_plater->Show(); m_plater->Show();
break; break;
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
case ESettingsLayout::GCodeViewer: case ESettingsLayout::GCodeViewer:
{ {
m_main_sizer->Add(m_plater, 1, wxEXPAND); m_main_sizer->Add(m_plater, 1, wxEXPAND);
m_plater->Show(); m_plater->Show();
break; break;
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
} }
//#ifdef __APPLE__ //#ifdef __APPLE__
@ -398,7 +398,7 @@ void MainFrame::shutdown()
} }
#endif // _WIN32 #endif // _WIN32
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
if (m_plater != nullptr) { if (m_plater != nullptr) {
m_plater->stop_jobs(); m_plater->stop_jobs();
@ -423,7 +423,7 @@ void MainFrame::shutdown()
// Cleanup of canvases' volumes needs to be done here or a crash may happen on some Linux Debian flavours // Cleanup of canvases' volumes needs to be done here or a crash may happen on some Linux Debian flavours
// see: https://github.com/prusa3d/PrusaSlicer/issues/3964 // see: https://github.com/prusa3d/PrusaSlicer/issues/3964
if (m_plater) m_plater->reset_canvas_volumes(); if (m_plater) m_plater->reset_canvas_volumes();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
// Weird things happen as the Paint messages are floating around the windows being destructed. // Weird things happen as the Paint messages are floating around the windows being destructed.
// Avoid the Paint messages by hiding the main window. // Avoid the Paint messages by hiding the main window.
@ -436,11 +436,11 @@ void MainFrame::shutdown()
m_settings_dialog.Close(); m_settings_dialog.Close();
if (m_plater != nullptr) { if (m_plater != nullptr) {
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
// restore sidebar if it was hidden when switching to gcode viewer mode // restore sidebar if it was hidden when switching to gcode viewer mode
if (m_restore_from_gcode_viewer.collapsed_sidebar) if (m_restore_from_gcode_viewer.collapsed_sidebar)
m_plater->collapse_sidebar(false); m_plater->collapse_sidebar(false);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
// Stop the background thread (Windows and Linux). // Stop the background thread (Windows and Linux).
// Disconnect from a 3DConnextion driver (OSX). // Disconnect from a 3DConnextion driver (OSX).
m_plater->get_mouse3d_controller().shutdown(); m_plater->get_mouse3d_controller().shutdown();
@ -781,7 +781,7 @@ void MainFrame::on_sys_color_changed()
msw_rescale_menu(menu_bar->GetMenu(id)); msw_rescale_menu(menu_bar->GetMenu(id));
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
#ifdef _MSC_VER #ifdef _MSC_VER
// \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators, // \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators,
// as the simple numeric accelerators spoil all numeric data entry. // as the simple numeric accelerators spoil all numeric data entry.
@ -855,7 +855,7 @@ static void add_common_view_menu_items(wxMenu* view_menu, MainFrame* mainFrame,
void MainFrame::init_editor_menubar() void MainFrame::init_editor_menubar()
#else #else
void MainFrame::init_menubar() void MainFrame::init_menubar()
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
{ {
#ifdef __APPLE__ #ifdef __APPLE__
wxMenuBar::SetAutoWindowMenu(false); wxMenuBar::SetAutoWindowMenu(false);
@ -1015,7 +1015,7 @@ void MainFrame::init_menubar()
append_menu_item(fileMenu, wxID_ANY, _L("&Repair STL file") + dots, _L("Automatically repair an STL file"), append_menu_item(fileMenu, wxID_ANY, _L("&Repair STL file") + dots, _L("Automatically repair an STL file"),
[this](wxCommandEvent&) { repair_stl(); }, "wrench", nullptr, [this](wxCommandEvent&) { repair_stl(); }, "wrench", nullptr,
[this]() { return true; }, this); [this]() { return true; }, this);
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
append_menu_item(fileMenu, wxID_ANY, _L("&G-code preview"), _L("Switch to G-code preview mode"), append_menu_item(fileMenu, wxID_ANY, _L("&G-code preview"), _L("Switch to G-code preview mode"),
[this](wxCommandEvent&) { [this](wxCommandEvent&) {
@ -1023,13 +1023,13 @@ void MainFrame::init_menubar()
set_mode(EMode::GCodeViewer); set_mode(EMode::GCodeViewer);
}, "", nullptr, }, "", nullptr,
[this]() { return m_plater != nullptr && m_plater->printer_technology() != ptSLA; }, this); [this]() { return m_plater != nullptr && m_plater->printer_technology() != ptSLA; }, this);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME), append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
[this](wxCommandEvent&) { Close(false); }); [this](wxCommandEvent&) { Close(false); });
} }
#if !ENABLE_GCODE_VIEWER_AS_STATE #if !ENABLE_GCODE_VIEWER
#ifdef _MSC_VER #ifdef _MSC_VER
// \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators, // \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators,
// as the simple numeric accelerators spoil all numeric data entry. // as the simple numeric accelerators spoil all numeric data entry.
@ -1039,7 +1039,7 @@ void MainFrame::init_menubar()
wxString sep = " - "; wxString sep = " - ";
wxString sep_space = ""; wxString sep_space = "";
#endif #endif
#endif // !ENABLE_GCODE_VIEWER_AS_STATE #endif // !ENABLE_GCODE_VIEWER
// Edit menu // Edit menu
wxMenu* editMenu = nullptr; wxMenu* editMenu = nullptr;
@ -1123,7 +1123,7 @@ void MainFrame::init_menubar()
[this](){return can_change_view(); }, this); [this](){return can_change_view(); }, this);
} }
#if !ENABLE_GCODE_VIEWER_AS_STATE #if !ENABLE_GCODE_VIEWER
#if _WIN32 #if _WIN32
// This is needed on Windows to fake the CTRL+# of the window menu when using the numpad // This is needed on Windows to fake the CTRL+# of the window menu when using the numpad
wxAcceleratorEntry entries[6]; wxAcceleratorEntry entries[6];
@ -1136,7 +1136,7 @@ void MainFrame::init_menubar()
wxAcceleratorTable accel(6, entries); wxAcceleratorTable accel(6, entries);
SetAcceleratorTable(accel); SetAcceleratorTable(accel);
#endif // _WIN32 #endif // _WIN32
#endif // !ENABLE_GCODE_VIEWER_AS_STATE #endif // !ENABLE_GCODE_VIEWER
windowMenu->AppendSeparator(); windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Print &Host Upload Queue") + "\tCtrl+J", _L("Display the Print Host Upload Queue window"), append_menu_item(windowMenu, wxID_ANY, _L("Print &Host Upload Queue") + "\tCtrl+J", _L("Display the Print Host Upload Queue window"),
@ -1148,7 +1148,7 @@ void MainFrame::init_menubar()
wxMenu* viewMenu = nullptr; wxMenu* viewMenu = nullptr;
if (m_plater) { if (m_plater) {
viewMenu = new wxMenu(); viewMenu = new wxMenu();
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this)); add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this));
#else #else
// The camera control accelerators are captured by GLCanvas3D::on_char(). // The camera control accelerators are captured by GLCanvas3D::on_char().
@ -1169,7 +1169,7 @@ void MainFrame::init_menubar()
"", nullptr, [this](){return can_change_view(); }, this); "", nullptr, [this](){return can_change_view(); }, this);
append_menu_item(viewMenu, wxID_ANY, _L("Right") + sep + "&6", _L("Right View"), [this](wxCommandEvent&) { select_view("right"); }, append_menu_item(viewMenu, wxID_ANY, _L("Right") + sep + "&6", _L("Right View"), [this](wxCommandEvent&) { select_view("right"); },
"", nullptr, [this](){return can_change_view(); }, this); "", nullptr, [this](){return can_change_view(); }, this);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
#if ENABLE_SLOPE_RENDERING #if ENABLE_SLOPE_RENDERING
wxMenu* options_menu = new wxMenu(); wxMenu* options_menu = new wxMenu();
@ -1191,7 +1191,7 @@ void MainFrame::init_menubar()
} }
// Help menu // Help menu
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
auto helpMenu = generate_help_menu(); auto helpMenu = generate_help_menu();
#else #else
auto helpMenu = new wxMenu(); auto helpMenu = new wxMenu();
@ -1228,12 +1228,12 @@ void MainFrame::init_menubar()
[this](wxCommandEvent&) { wxGetApp().gcode_thumbnails_debug(); }); [this](wxCommandEvent&) { wxGetApp().gcode_thumbnails_debug(); });
#endif // ENABLE_THUMBNAIL_GENERATOR_DEBUG #endif // ENABLE_THUMBNAIL_GENERATOR_DEBUG
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
// menubar // menubar
// assign menubar to frame after appending items, otherwise special items // assign menubar to frame after appending items, otherwise special items
// will not be handled correctly // will not be handled correctly
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
m_editor_menubar = new wxMenuBar(); m_editor_menubar = new wxMenuBar();
m_editor_menubar->Append(fileMenu, _L("&File")); m_editor_menubar->Append(fileMenu, _L("&File"));
if (editMenu) m_editor_menubar->Append(editMenu, _L("&Edit")); if (editMenu) m_editor_menubar->Append(editMenu, _L("&Edit"));
@ -1253,16 +1253,16 @@ void MainFrame::init_menubar()
wxGetApp().add_config_menu(menubar); wxGetApp().add_config_menu(menubar);
menubar->Append(helpMenu, _(L("&Help"))); menubar->Append(helpMenu, _(L("&Help")));
SetMenuBar(menubar); SetMenuBar(menubar);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
#ifdef __APPLE__ #ifdef __APPLE__
// This fixes a bug on Mac OS where the quit command doesn't emit window close events // This fixes a bug on Mac OS where the quit command doesn't emit window close events
// wx bug: https://trac.wxwidgets.org/ticket/18328 // wx bug: https://trac.wxwidgets.org/ticket/18328
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
wxMenu* apple_menu = m_editor_menubar->OSXGetAppleMenu(); wxMenu* apple_menu = m_editor_menubar->OSXGetAppleMenu();
#else #else
wxMenu *apple_menu = menubar->OSXGetAppleMenu(); wxMenu *apple_menu = menubar->OSXGetAppleMenu();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
if (apple_menu != nullptr) { if (apple_menu != nullptr) {
apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent &) { apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent &) {
Close(); Close();
@ -1271,14 +1271,14 @@ void MainFrame::init_menubar()
#endif #endif
if (plater()->printer_technology() == ptSLA) if (plater()->printer_technology() == ptSLA)
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
update_editor_menubar(); update_editor_menubar();
#else #else
update_menubar(); update_menubar();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void MainFrame::init_gcodeviewer_menubar() void MainFrame::init_gcodeviewer_menubar()
{ {
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
@ -1412,13 +1412,13 @@ void MainFrame::set_mode(EMode mode)
} }
} }
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void MainFrame::update_editor_menubar() void MainFrame::update_editor_menubar()
#else #else
void MainFrame::update_menubar() void MainFrame::update_menubar()
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
{ {
const bool is_fff = plater()->printer_technology() == ptFFF; const bool is_fff = plater()->printer_technology() == ptFFF;

View File

@ -68,7 +68,7 @@ class MainFrame : public DPIFrame
wxString m_qs_last_input_file = wxEmptyString; wxString m_qs_last_input_file = wxEmptyString;
wxString m_qs_last_output_file = wxEmptyString; wxString m_qs_last_output_file = wxEmptyString;
wxString m_last_config = wxEmptyString; wxString m_last_config = wxEmptyString;
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
wxMenuBar* m_editor_menubar{ nullptr }; wxMenuBar* m_editor_menubar{ nullptr };
wxMenuBar* m_gcodeviewer_menubar{ nullptr }; wxMenuBar* m_gcodeviewer_menubar{ nullptr };
@ -79,7 +79,7 @@ class MainFrame : public DPIFrame
}; };
RestoreFromGCodeViewer m_restore_from_gcode_viewer; RestoreFromGCodeViewer m_restore_from_gcode_viewer;
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
#if 0 #if 0
wxMenuItem* m_menu_item_repeat { nullptr }; // doesn't used now wxMenuItem* m_menu_item_repeat { nullptr }; // doesn't used now
@ -134,14 +134,14 @@ class MainFrame : public DPIFrame
Old, Old,
New, New,
Dlg, Dlg,
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
GCodeViewer GCodeViewer
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
}; };
ESettingsLayout m_layout{ ESettingsLayout::Unknown }; ESettingsLayout m_layout{ ESettingsLayout::Unknown };
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
public: public:
enum class EMode : unsigned char enum class EMode : unsigned char
{ {
@ -151,7 +151,7 @@ public:
private: private:
EMode m_mode{ EMode::Editor }; EMode m_mode{ EMode::Editor };
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
protected: protected:
virtual void on_dpi_changed(const wxRect &suggested_rect); virtual void on_dpi_changed(const wxRect &suggested_rect);
@ -173,7 +173,7 @@ public:
void init_tabpanel(); void init_tabpanel();
void create_preset_tabs(); void create_preset_tabs();
void add_created_tab(Tab* panel); void add_created_tab(Tab* panel);
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void init_editor_menubar(); void init_editor_menubar();
void update_editor_menubar(); void update_editor_menubar();
void init_gcodeviewer_menubar(); void init_gcodeviewer_menubar();
@ -183,7 +183,7 @@ public:
#else #else
void init_menubar(); void init_menubar();
void update_menubar(); void update_menubar();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
void update_ui_from_settings(); void update_ui_from_settings();
bool is_loaded() const { return m_loaded; } bool is_loaded() const { return m_loaded; }

View File

@ -33,13 +33,11 @@
#include "libslic3r/Format/STL.hpp" #include "libslic3r/Format/STL.hpp"
#include "libslic3r/Format/AMF.hpp" #include "libslic3r/Format/AMF.hpp"
#include "libslic3r/Format/3mf.hpp" #include "libslic3r/Format/3mf.hpp"
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
#include "libslic3r/GCode/GCodeProcessor.hpp" #include "libslic3r/GCode/GCodeProcessor.hpp"
#else #else
#if !ENABLE_GCODE_VIEWER
#include "libslic3r/GCode/PreviewData.hpp" #include "libslic3r/GCode/PreviewData.hpp"
#endif // !ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER
#endif // ENABLE_GCODE_VIEWER_AS_STATE
#include "libslic3r/GCode/ThumbnailData.hpp" #include "libslic3r/GCode/ThumbnailData.hpp"
#include "libslic3r/Model.hpp" #include "libslic3r/Model.hpp"
#include "libslic3r/SLA/Hollowing.hpp" #include "libslic3r/SLA/Hollowing.hpp"
@ -2767,10 +2765,8 @@ void Plater::priv::reset()
#if ENABLE_GCODE_VIEWER #if ENABLE_GCODE_VIEWER
reset_gcode_toolpaths(); reset_gcode_toolpaths();
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER_AS_STATE
gcode_result.reset(); gcode_result.reset();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
// Stop and reset the Print content. // Stop and reset the Print content.
this->background_process.reset(); this->background_process.reset();
@ -4633,7 +4629,7 @@ void Plater::extract_config_from_project()
load_files(input_paths, false, true); load_files(input_paths, false, true);
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void Plater::load_gcode() void Plater::load_gcode()
{ {
// Ask user for a gcode file name. // Ask user for a gcode file name.
@ -4669,7 +4665,7 @@ void Plater::load_gcode(const wxString& filename)
p->preview->reload_print(false); p->preview->reload_print(false);
p->preview->get_canvas3d()->zoom_to_gcode(); p->preview->get_canvas3d()->zoom_to_gcode();
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
std::vector<size_t> Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units /*= false*/) { return p->load_files(input_files, load_model, load_config, imperial_units); } std::vector<size_t> Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units /*= false*/) { return p->load_files(input_files, load_model, load_config, imperial_units); }
@ -5443,7 +5439,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
void Plater::set_bed_shape() const void Plater::set_bed_shape() const
{ {
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values, set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values,
p->config->option<ConfigOptionString>("bed_custom_texture")->value, p->config->option<ConfigOptionString>("bed_custom_texture")->value,
p->config->option<ConfigOptionString>("bed_custom_model")->value); p->config->option<ConfigOptionString>("bed_custom_model")->value);
@ -5451,15 +5447,15 @@ void Plater::set_bed_shape() const
p->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values, p->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values,
p->config->option<ConfigOptionString>("bed_custom_texture")->value, p->config->option<ConfigOptionString>("bed_custom_texture")->value,
p->config->option<ConfigOptionString>("bed_custom_model")->value); p->config->option<ConfigOptionString>("bed_custom_model")->value);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void Plater::set_bed_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) const void Plater::set_bed_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) const
{ {
p->set_bed_shape(shape, custom_texture, custom_model, force_as_custom); p->set_bed_shape(shape, custom_texture, custom_model, force_as_custom);
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
void Plater::force_filament_colors_update() void Plater::force_filament_colors_update()
{ {
@ -5634,11 +5630,11 @@ void Plater::set_printer_technology(PrinterTechnology printer_technology)
p->label_btn_send = printer_technology == ptFFF ? L("Send G-code") : L("Send to printer"); p->label_btn_send = printer_technology == ptFFF ? L("Send G-code") : L("Send to printer");
if (wxGetApp().mainframe != nullptr) if (wxGetApp().mainframe != nullptr)
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
wxGetApp().mainframe->update_editor_menubar(); wxGetApp().mainframe->update_editor_menubar();
#else #else
wxGetApp().mainframe->update_menubar(); wxGetApp().mainframe->update_menubar();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
p->update_main_toolbar_tooltips(); p->update_main_toolbar_tooltips();
@ -5790,24 +5786,24 @@ bool Plater::init_view_toolbar()
return p->init_view_toolbar(); return p->init_view_toolbar();
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void Plater::enable_view_toolbar(bool enable) void Plater::enable_view_toolbar(bool enable)
{ {
p->view_toolbar.set_enabled(enable); p->view_toolbar.set_enabled(enable);
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
bool Plater::init_collapse_toolbar() bool Plater::init_collapse_toolbar()
{ {
return p->init_collapse_toolbar(); return p->init_collapse_toolbar();
} }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void Plater::enable_collapse_toolbar(bool enable) void Plater::enable_collapse_toolbar(bool enable)
{ {
p->collapse_toolbar.set_enabled(enable); p->collapse_toolbar.set_enabled(enable);
} }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
const Camera& Plater::get_camera() const const Camera& Plater::get_camera() const
{ {
@ -5936,9 +5932,9 @@ bool Plater::can_undo() const { return p->undo_redo_stack().has_undo_snapshot();
bool Plater::can_redo() const { return p->undo_redo_stack().has_redo_snapshot(); } bool Plater::can_redo() const { return p->undo_redo_stack().has_redo_snapshot(); }
bool Plater::can_reload_from_disk() const { return p->can_reload_from_disk(); } bool Plater::can_reload_from_disk() const { return p->can_reload_from_disk(); }
const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); } const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); }
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void Plater::clear_undo_redo_stack_main() { p->undo_redo_stack_main().clear(); } void Plater::clear_undo_redo_stack_main() { p->undo_redo_stack_main().clear(); }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
void Plater::enter_gizmos_stack() { p->enter_gizmos_stack(); } void Plater::enter_gizmos_stack() { p->enter_gizmos_stack(); }
void Plater::leave_gizmos_stack() { p->leave_gizmos_stack(); } void Plater::leave_gizmos_stack() { p->leave_gizmos_stack(); }
bool Plater::inside_snapshot_capture() { return p->inside_snapshot_capture(); } bool Plater::inside_snapshot_capture() { return p->inside_snapshot_capture(); }

View File

@ -173,10 +173,10 @@ public:
void add_model(bool imperial_units = false); void add_model(bool imperial_units = false);
void import_sl1_archive(); void import_sl1_archive();
void extract_config_from_project(); void extract_config_from_project();
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void load_gcode(); void load_gcode();
void load_gcode(const wxString& filename); void load_gcode(const wxString& filename);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
std::vector<size_t> load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true, bool imperial_units = false); std::vector<size_t> load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true, bool imperial_units = false);
// To be called when providing a list of files to the GUI slic3r on command line. // To be called when providing a list of files to the GUI slic3r on command line.
@ -256,9 +256,9 @@ public:
bool search_string_getter(int idx, const char** label, const char** tooltip); bool search_string_getter(int idx, const char** label, const char** tooltip);
// For the memory statistics. // For the memory statistics.
const Slic3r::UndoRedo::Stack& undo_redo_stack_main() const; const Slic3r::UndoRedo::Stack& undo_redo_stack_main() const;
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void clear_undo_redo_stack_main(); void clear_undo_redo_stack_main();
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
// Enter / leave the Gizmos specific Undo / Redo stack. To be used by the SLA support point editing gizmo. // Enter / leave the Gizmos specific Undo / Redo stack. To be used by the SLA support point editing gizmo.
void enter_gizmos_stack(); void enter_gizmos_stack();
void leave_gizmos_stack(); void leave_gizmos_stack();
@ -322,13 +322,13 @@ public:
void sys_color_changed(); void sys_color_changed();
bool init_view_toolbar(); bool init_view_toolbar();
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void enable_view_toolbar(bool enable); void enable_view_toolbar(bool enable);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
bool init_collapse_toolbar(); bool init_collapse_toolbar();
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void enable_collapse_toolbar(bool enable); void enable_collapse_toolbar(bool enable);
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
const Camera& get_camera() const; const Camera& get_camera() const;
Camera& get_camera(); Camera& get_camera();
@ -352,19 +352,16 @@ public:
void update_preview_moves_slider(); void update_preview_moves_slider();
void reset_gcode_toolpaths(); void reset_gcode_toolpaths();
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER_AS_STATE
void reset_last_loaded_gcode() { m_last_loaded_gcode = ""; } void reset_last_loaded_gcode() { m_last_loaded_gcode = ""; }
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
const Mouse3DController& get_mouse3d_controller() const; const Mouse3DController& get_mouse3d_controller() const;
Mouse3DController& get_mouse3d_controller(); Mouse3DController& get_mouse3d_controller();
void set_bed_shape() const; void set_bed_shape() const;
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
void set_bed_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false) const; void set_bed_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false) const;
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
// ROII wrapper for suppressing the Undo / Redo snapshot to be taken. // ROII wrapper for suppressing the Undo / Redo snapshot to be taken.
class SuppressSnapshots class SuppressSnapshots
@ -415,9 +412,9 @@ private:
bool m_tracking_popup_menu = false; bool m_tracking_popup_menu = false;
wxString m_tracking_popup_menu_error_message; wxString m_tracking_popup_menu_error_message;
#if ENABLE_GCODE_VIEWER_AS_STATE #if ENABLE_GCODE_VIEWER
wxString m_last_loaded_gcode; wxString m_last_loaded_gcode;
#endif // ENABLE_GCODE_VIEWER_AS_STATE #endif // ENABLE_GCODE_VIEWER
void suppress_snapshots(); void suppress_snapshots();
void allow_snapshots(); void allow_snapshots();