ENABLE_GCODE_VIEWER set as default in:

MainFrame hpp/cpp

Plater hpp/cpp
This commit is contained in:
enricoturri1966 2020-11-19 14:59:46 +01:00
parent ef9cea76c2
commit a1905d9b9e
4 changed files with 5 additions and 392 deletions

View file

@ -117,7 +117,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
// Load the icon either from the exe, or from the ico file.
#if _WIN32
{
#if ENABLE_GCODE_VIEWER
wxString src_path;
wxFileName::SplitPath(wxStandardPaths::Get().GetExecutablePath(), &src_path, nullptr, nullptr, wxPATH_NATIVE);
switch (wxGetApp().get_app_mode()) {
@ -128,22 +127,14 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
wxIconLocation icon_location;
icon_location.SetFileName(src_path);
SetIcon(icon_location);
#else
TCHAR szExeFileName[MAX_PATH];
GetModuleFileName(nullptr, szExeFileName, MAX_PATH);
SetIcon(wxIcon(szExeFileName, wxBITMAP_TYPE_ICO));
#endif // ENABLE_GCODE_VIEWER
}
#else
#if ENABLE_GCODE_VIEWER
switch (wxGetApp().get_app_mode())
{
default:
case GUI_App::EAppMode::Editor:
{
#endif // ENABLE_GCODE_VIEWER
SetIcon(wxIcon(Slic3r::var("PrusaSlicer_128px.png"), wxBITMAP_TYPE_PNG));
#if ENABLE_GCODE_VIEWER
break;
}
case GUI_App::EAppMode::GCodeViewer:
@ -152,15 +143,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
break;
}
}
#endif // ENABLE_GCODE_VIEWER
#endif // _WIN32
// initialize status bar
m_statusbar = std::make_shared<ProgressStatusBar>(this);
m_statusbar->set_font(GUI::wxGetApp().normal_font());
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor())
#endif // ENABLE_GCODE_VIEWER
m_statusbar->embed(this);
m_statusbar->set_status_text(_L("Version") + " " +
SLIC3R_VERSION + " - " +
@ -168,7 +156,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
// initialize tabpanel and menubar
init_tabpanel();
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_gcode_viewer())
init_menubar_as_gcodeviewer();
else
@ -186,9 +173,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
wxAcceleratorTable accel(6, entries);
SetAcceleratorTable(accel);
#endif // _WIN32
#else
init_menubar();
#endif // ENABLE_GCODE_VIEWER
// set default tooltip timer in msec
// SetAutoPop supposedly accepts long integers but some bug doesn't allow for larger values
@ -256,9 +240,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
update_ui_from_settings(); // FIXME (?)
if (m_plater != nullptr) {
#if ENABLE_GCODE_VIEWER
m_plater->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1");
#endif // ENABLE_GCODE_VIEWER
m_plater->show_action_buttons(true);
}
}
@ -301,16 +283,10 @@ void MainFrame::update_layout()
Layout();
};
#if ENABLE_GCODE_VIEWER
ESettingsLayout layout = wxGetApp().is_gcode_viewer() ? ESettingsLayout::GCodeViewer :
(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("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old);
#else
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("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old;
#endif // ENABLE_GCODE_VIEWER
if (m_layout == layout)
return;
@ -374,7 +350,6 @@ void MainFrame::update_layout()
m_plater->Show();
break;
}
#if ENABLE_GCODE_VIEWER
case ESettingsLayout::GCodeViewer:
{
m_main_sizer->Add(m_plater, 1, wxEXPAND);
@ -384,7 +359,6 @@ void MainFrame::update_layout()
m_plater->Show();
break;
}
#endif // ENABLE_GCODE_VIEWER
}
#ifdef __WXMSW__
@ -453,7 +427,6 @@ void MainFrame::shutdown()
}
#endif // _WIN32
#if ENABLE_GCODE_VIEWER
if (m_plater != nullptr) {
m_plater->stop_jobs();
@ -466,19 +439,6 @@ void MainFrame::shutdown()
// see: https://github.com/prusa3d/PrusaSlicer/issues/3964
m_plater->reset_canvas_volumes();
}
#else
if (m_plater)
m_plater->stop_jobs();
// Unbinding of wxWidgets event handling in canvases needs to be done here because on MAC,
// when closing the application using Command+Q, a mouse event is triggered after this lambda is completed,
// causing a crash
if (m_plater) m_plater->unbind_canvas_event_handlers();
// 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
if (m_plater) m_plater->reset_canvas_volumes();
#endif // ENABLE_GCODE_VIEWER
// Weird things happen as the Paint messages are floating around the windows being destructed.
// Avoid the Paint messages by hiding the main window.
@ -526,11 +486,7 @@ void MainFrame::update_title()
title += (project + " - ");
}
#if ENABLE_GCODE_VIEWER
std::string build_id = wxGetApp().is_editor() ? SLIC3R_BUILD_ID : GCODEVIEWER_BUILD_ID;
#else
std::string build_id = SLIC3R_BUILD_ID;
#endif // ENABLE_GCODE_VIEWER
size_t idx_plus = build_id.find('+');
if (idx_plus != build_id.npos) {
// Parse what is behind the '+'. If there is a number, then it is a build number after the label, and full build ID is shown.
@ -545,13 +501,10 @@ void MainFrame::update_title()
#endif
}
}
#if ENABLE_GCODE_VIEWER
title += wxString(build_id);
if (wxGetApp().is_editor())
title += (" " + _L("based on Slic3r"));
#else
title += (wxString(build_id) + " " + _L("based on Slic3r"));
#endif // ENABLE_GCODE_VIEWER
SetTitle(title);
}
@ -600,9 +553,7 @@ void MainFrame::init_tabpanel()
// or when the preset's "modified" status changes.
Bind(EVT_TAB_PRESETS_CHANGED, &MainFrame::on_presets_changed, this); // #ys_FIXME_to_delete
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor())
#endif // ENABLE_GCODE_VIEWER
create_preset_tabs();
if (m_plater) {
@ -811,9 +762,7 @@ bool MainFrame::can_change_view() const
int page_id = m_tabpanel->GetSelection();
return page_id != wxNOT_FOUND && dynamic_cast<const Slic3r::GUI::Plater*>(m_tabpanel->GetPage((size_t)page_id)) != nullptr;
}
#if ENABLE_GCODE_VIEWER
case ESettingsLayout::GCodeViewer: { return true; }
#endif // ENABLE_GCODE_VIEWER
}
}
@ -905,7 +854,6 @@ void MainFrame::on_sys_color_changed()
msw_rescale_menu(menu_bar->GetMenu(id));
}
#if ENABLE_GCODE_VIEWER
#ifdef _MSC_VER
// \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.
@ -940,17 +888,13 @@ static wxMenu* generate_help_menu()
[](wxCommandEvent&) { Slic3r::GUI::desktop_open_datadir_folder(); });
append_menu_item(helpMenu, wxID_ANY, _L("Report an I&ssue"), wxString::Format(_L("Report an issue on %s"), SLIC3R_APP_NAME),
[](wxCommandEvent&) { wxLaunchDefaultBrowser("https://github.com/prusa3d/slic3r/issues/new"); });
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor())
#endif // ENABLE_GCODE_VIEWER
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), SLIC3R_APP_NAME), _L("Show about dialog"),
[](wxCommandEvent&) { Slic3r::GUI::about(); });
#if ENABLE_GCODE_VIEWER
else
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"),
[](wxCommandEvent&) { Slic3r::GUI::about(); });
#endif // ENABLE_GCODE_VIEWER
helpMenu->AppendSeparator();
helpMenu->AppendSeparator();
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "&?", _L("Show the list of the keyboard shortcuts"),
[](wxCommandEvent&) { wxGetApp().keyboard_shortcuts(); });
#if ENABLE_THUMBNAIL_GENERATOR_DEBUG
@ -985,9 +929,6 @@ static void add_common_view_menu_items(wxMenu* view_menu, MainFrame* mainFrame,
}
void MainFrame::init_menubar_as_editor()
#else
void MainFrame::init_menubar()
#endif // ENABLE_GCODE_VIEWER
{
#ifdef __APPLE__
wxMenuBar::SetAutoWindowMenu(false);
@ -1158,18 +1099,6 @@ void MainFrame::init_menubar()
[this](wxCommandEvent&) { Close(false); }, "exit");
}
#if !ENABLE_GCODE_VIEWER
#ifdef _MSC_VER
// \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.
wxString sep = "\t\xA0";
wxString sep_space = "\xA0";
#else
wxString sep = " - ";
wxString sep_space = "";
#endif
#endif // !ENABLE_GCODE_VIEWER
// Edit menu
wxMenu* editMenu = nullptr;
if (m_plater != nullptr)
@ -1252,21 +1181,6 @@ void MainFrame::init_menubar()
[this](){return can_change_view(); }, this);
}
#if !ENABLE_GCODE_VIEWER
#if _WIN32
// This is needed on Windows to fake the CTRL+# of the window menu when using the numpad
wxAcceleratorEntry entries[6];
entries[0].Set(wxACCEL_CTRL, WXK_NUMPAD1, wxID_HIGHEST + 1);
entries[1].Set(wxACCEL_CTRL, WXK_NUMPAD2, wxID_HIGHEST + 2);
entries[2].Set(wxACCEL_CTRL, WXK_NUMPAD3, wxID_HIGHEST + 3);
entries[3].Set(wxACCEL_CTRL, WXK_NUMPAD4, wxID_HIGHEST + 4);
entries[4].Set(wxACCEL_CTRL, WXK_NUMPAD5, wxID_HIGHEST + 5);
entries[5].Set(wxACCEL_CTRL, WXK_NUMPAD6, wxID_HIGHEST + 6);
wxAcceleratorTable accel(6, entries);
SetAcceleratorTable(accel);
#endif // _WIN32
#endif // !ENABLE_GCODE_VIEWER
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Print &Host Upload Queue") + "\tCtrl+J", _L("Display the Print Host Upload Queue window"),
[this](wxCommandEvent&) { m_printhost_queue_dlg->Show(); }, "upload_queue", nullptr, []() {return true; }, this);
@ -1281,28 +1195,7 @@ void MainFrame::init_menubar()
wxMenu* viewMenu = nullptr;
if (m_plater) {
viewMenu = new wxMenu();
#if ENABLE_GCODE_VIEWER
add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this));
#else
// The camera control accelerators are captured by GLCanvas3D::on_char().
append_menu_item(viewMenu, wxID_ANY, _L("Iso") + sep + "&0", _L("Iso View"), [this](wxCommandEvent&) { select_view("iso"); },
"", nullptr, [this](){return can_change_view(); }, this);
viewMenu->AppendSeparator();
//TRN To be shown in the main menu View->Top
append_menu_item(viewMenu, wxID_ANY, _L("Top") + sep + "&1", _L("Top View"), [this](wxCommandEvent&) { select_view("top"); },
"", nullptr, [this](){return can_change_view(); }, this);
//TRN To be shown in the main menu View->Bottom
append_menu_item(viewMenu, wxID_ANY, _L("Bottom") + sep + "&2", _L("Bottom View"), [this](wxCommandEvent&) { select_view("bottom"); },
"", nullptr, [this](){return can_change_view(); }, this);
append_menu_item(viewMenu, wxID_ANY, _L("Front") + sep + "&3", _L("Front View"), [this](wxCommandEvent&) { select_view("front"); },
"", nullptr, [this](){return can_change_view(); }, this);
append_menu_item(viewMenu, wxID_ANY, _L("Rear") + sep + "&4", _L("Rear View"), [this](wxCommandEvent&) { select_view("rear"); },
"", nullptr, [this](){return can_change_view(); }, this);
append_menu_item(viewMenu, wxID_ANY, _L("Left") + sep + "&5", _L("Left View"), [this](wxCommandEvent&) { select_view("left"); },
"", 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"); },
"", nullptr, [this](){return can_change_view(); }, this);
#endif // ENABLE_GCODE_VIEWER
viewMenu->AppendSeparator();
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &labels") + sep + "E", _L("Show object/instance labels in 3D scene"),
[this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this,
@ -1313,49 +1206,11 @@ void MainFrame::init_menubar()
}
// Help menu
#if ENABLE_GCODE_VIEWER
auto helpMenu = generate_help_menu();
#else
auto helpMenu = new wxMenu();
{
append_menu_item(helpMenu, wxID_ANY, _L("Prusa 3D &Drivers"), _L("Open the Prusa3D drivers download page in your browser"),
[this](wxCommandEvent&) { wxGetApp().open_web_page_localized("https://www.prusa3d.com/downloads"); });
append_menu_item(helpMenu, wxID_ANY, _L("Software &Releases"), _L("Open the software releases page in your browser"),
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://github.com/prusa3d/PrusaSlicer/releases"); });
//# my $versioncheck = $self->_append_menu_item($helpMenu, "Check for &Updates...", "Check for new Slic3r versions", sub{
//# wxTheApp->check_version(1);
//# });
//# $versioncheck->Enable(wxTheApp->have_version_check);
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("%s &Website"), SLIC3R_APP_NAME),
wxString::Format(_L("Open the %s website in your browser"), SLIC3R_APP_NAME),
[this](wxCommandEvent&) { wxGetApp().open_web_page_localized("https://www.prusa3d.com/slicerweb"); });
// append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("%s &Manual"), SLIC3R_APP_NAME),
// wxString::Format(_L("Open the %s manual in your browser"), SLIC3R_APP_NAME),
// [this](wxCommandEvent&) { wxLaunchDefaultBrowser("http://manual.slic3r.org/"); });
helpMenu->AppendSeparator();
append_menu_item(helpMenu, wxID_ANY, _L("System &Info"), _L("Show system information"),
[this](wxCommandEvent&) { wxGetApp().system_info(); });
append_menu_item(helpMenu, wxID_ANY, _L("Show &Configuration Folder"), _L("Show user configuration folder (datadir)"),
[this](wxCommandEvent&) { Slic3r::GUI::desktop_open_datadir_folder(); });
append_menu_item(helpMenu, wxID_ANY, _L("Report an I&ssue"), wxString::Format(_L("Report an issue on %s"), SLIC3R_APP_NAME),
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://github.com/prusa3d/slic3r/issues/new"); });
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), SLIC3R_APP_NAME), _L("Show about dialog"),
[this](wxCommandEvent&) { Slic3r::GUI::about(); });
helpMenu->AppendSeparator();
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "&?", _L("Show the list of the keyboard shortcuts"),
[this](wxCommandEvent&) { wxGetApp().keyboard_shortcuts(); });
#if ENABLE_THUMBNAIL_GENERATOR_DEBUG
helpMenu->AppendSeparator();
append_menu_item(helpMenu, wxID_ANY, "DEBUG gcode thumbnails", "DEBUG ONLY - read the selected gcode file and generates png for the contained thumbnails",
[this](wxCommandEvent&) { wxGetApp().gcode_thumbnails_debug(); });
#endif // ENABLE_THUMBNAIL_GENERATOR_DEBUG
}
#endif // ENABLE_GCODE_VIEWER
// menubar
// assign menubar to frame after appending items, otherwise special items
// will not be handled correctly
#if ENABLE_GCODE_VIEWER
m_menubar = new wxMenuBar();
m_menubar->Append(fileMenu, _L("&File"));
if (editMenu) m_menubar->Append(editMenu, _L("&Edit"));
@ -1365,26 +1220,11 @@ void MainFrame::init_menubar()
wxGetApp().add_config_menu(m_menubar);
m_menubar->Append(helpMenu, _L("&Help"));
SetMenuBar(m_menubar);
#else
auto menubar = new wxMenuBar();
menubar->Append(fileMenu, _L("&File"));
if (editMenu) menubar->Append(editMenu, _L("&Edit"));
menubar->Append(windowMenu, _L("&Window"));
if (viewMenu) menubar->Append(viewMenu, _L("&View"));
// Add additional menus from C++
wxGetApp().add_config_menu(menubar);
menubar->Append(helpMenu, _L("&Help"));
SetMenuBar(menubar);
#endif // ENABLE_GCODE_VIEWER
#ifdef __APPLE__
// 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
#if ENABLE_GCODE_VIEWER
wxMenu* apple_menu = m_menubar->OSXGetAppleMenu();
#else
wxMenu *apple_menu = menubar->OSXGetAppleMenu();
#endif // ENABLE_GCODE_VIEWER
if (apple_menu != nullptr) {
apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent &) {
Close();
@ -1396,7 +1236,6 @@ void MainFrame::init_menubar()
update_menubar();
}
#if ENABLE_GCODE_VIEWER
void MainFrame::init_menubar_as_gcodeviewer()
{
wxMenu* fileMenu = new wxMenu;
@ -1429,10 +1268,8 @@ void MainFrame::init_menubar_as_gcodeviewer()
m_menubar = new wxMenuBar();
m_menubar->Append(fileMenu, _L("&File"));
if (viewMenu != nullptr) m_menubar->Append(viewMenu, _L("&View"));
#if ENABLE_GCODE_VIEWER
// Add additional menus from C++
wxGetApp().add_config_menu(m_menubar);
#endif // ENABLE_GCODE_VIEWER
m_menubar->Append(helpMenu, _L("&Help"));
SetMenuBar(m_menubar);
@ -1447,14 +1284,11 @@ void MainFrame::init_menubar_as_gcodeviewer()
}
#endif // __APPLE__
}
#endif // ENABLE_GCODE_VIEWER
void MainFrame::update_menubar()
{
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_gcode_viewer())
return;
#endif // ENABLE_GCODE_VIEWER
const bool is_fff = plater()->printer_technology() == ptFFF;
@ -1983,10 +1817,8 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX, "settings_dialog"),
m_main_frame(mainframe)
{
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_gcode_viewer())
return;
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_WX_3_1_3_DPI_CHANGED_EVENT && defined(__WXMSW__)
// ys_FIXME! temporary workaround for correct font scaling
@ -2059,10 +1891,8 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
void SettingsDialog::on_dpi_changed(const wxRect& suggested_rect)
{
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_gcode_viewer())
return;
#endif // ENABLE_GCODE_VIEWER
const int& em = em_unit();
const wxSize& size = wxSize(85 * em, 50 * em);

View file

@ -71,9 +71,7 @@ class MainFrame : public DPIFrame
wxString m_qs_last_input_file = wxEmptyString;
wxString m_qs_last_output_file = wxEmptyString;
wxString m_last_config = wxEmptyString;
#if ENABLE_GCODE_VIEWER
wxMenuBar* m_menubar{ nullptr };
#endif // ENABLE_GCODE_VIEWER
#if 0
wxMenuItem* m_menu_item_repeat { nullptr }; // doesn't used now
@ -128,9 +126,7 @@ class MainFrame : public DPIFrame
Old,
New,
Dlg,
#if ENABLE_GCODE_VIEWER
GCodeViewer
#endif // ENABLE_GCODE_VIEWER
};
ESettingsLayout m_layout{ ESettingsLayout::Unknown };
@ -159,12 +155,8 @@ public:
// Register Win32 RawInput callbacks (3DConnexion) and removable media insert / remove callbacks.
// Called from wxEVT_ACTIVATE, as wxEVT_CREATE was not reliable (bug in wxWidgets?).
void register_win32_callbacks();
#if ENABLE_GCODE_VIEWER
void init_menubar_as_editor();
void init_menubar_as_gcodeviewer();
#else
void init_menubar();
#endif // ENABLE_GCODE_VIEWER
void update_menubar();
void update_ui_from_settings(bool apply_free_camera_correction = true);

View file

@ -1169,7 +1169,6 @@ void Sidebar::update_sliced_info_sizer()
wxString::Format("%.2f", ps.total_cost);
p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
#if ENABLE_GCODE_VIEWER
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
else {
@ -1191,56 +1190,6 @@ void Sidebar::update_sliced_info_sizer()
}
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
}
#else
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
else {
new_label = _L("Estimated printing time") + ":";
info_text = "";
wxString str_color = _L("Color");
wxString str_pause = _L("Pause");
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGCode::Type, std::string>>& times,
wxString& new_label, wxString& info_text)
{
int color_change_count = 0;
for (auto time : times)
if (time.first == CustomGCode::ColorChange)
color_change_count++;
for (int i = (int)times.size() - 1; i >= 0; --i)
{
if (i == 0 || times[i - 1].first == CustomGCode::PausePrint)
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count);
else if (times[i - 1].first == CustomGCode::ColorChange)
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count--);
if (i != (int)times.size() - 1 && times[i].first == CustomGCode::PausePrint)
new_label += format_wxstr(" -> %1%", str_pause);
info_text += format_wxstr("\n%1%", times[i].second);
}
};
if (ps.estimated_normal_print_time != "N/A") {
new_label += format_wxstr("\n - %1%", _L("normal mode"));
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time);
fill_labels(ps.estimated_normal_custom_gcode_print_times, new_label, info_text);
// uncomment next line to not disappear slicing finished notif when colapsing sidebar before time estimate
//if (p->plater->is_sidebar_collapsed())
p->plater->get_notification_manager()->set_slicing_complete_large(p->plater->is_sidebar_collapsed());
p->plater->get_notification_manager()->set_slicing_complete_print_time("Estimated printing time: " + ps.estimated_normal_print_time);
}
if (ps.estimated_silent_print_time != "N/A") {
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time);
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
}
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
}
#endif // !ENABLE_GCODE_VIEWER
// if there is a wipe tower, insert number of toolchanges info into the array:
p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", ps.total_toolchanges) : "N/A");
@ -1333,9 +1282,7 @@ void Sidebar::collapse(bool collapse)
p->plater->Layout();
// save collapsing state to the AppConfig
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor())
#endif // ENABLE_GCODE_VIEWER
wxGetApp().app_config->set("collapsed_sidebar", collapse ? "1" : "0");
}
@ -1375,15 +1322,11 @@ private:
Plater *plater;
static const std::regex pattern_drop;
#if ENABLE_GCODE_VIEWER
static const std::regex pattern_gcode_drop;
#endif // ENABLE_GCODE_VIEWER
};
const std::regex PlaterDropTarget::pattern_drop(".*[.](stl|obj|amf|3mf|prusa)", std::regex::icase);
#if ENABLE_GCODE_VIEWER
const std::regex PlaterDropTarget::pattern_gcode_drop(".*[.](gcode|g)", std::regex::icase);
#endif // ENABLE_GCODE_VIEWER
enum class LoadType : unsigned char
{
@ -1453,7 +1396,6 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
{
std::vector<fs::path> paths;
#if ENABLE_GCODE_VIEWER
#ifdef WIN32
// hides the system icon
this->MSWUpdateDragImageOnLeave();
@ -1478,17 +1420,14 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
}
return false;
}
#endif // ENABLE_GCODE_VIEWER
// editor section
for (const auto &filename : filenames) {
fs::path path(into_path(filename));
if (std::regex_match(path.string(), pattern_drop))
paths.push_back(std::move(path));
#if ENABLE_GCODE_VIEWER
else if (std::regex_match(path.string(), pattern_gcode_drop))
start_new_gcodeviewer(&filename);
#endif // ENABLE_GCODE_VIEWER
else
return false;
}
@ -1605,11 +1544,7 @@ struct Plater::priv
Slic3r::SLAPrint sla_print;
Slic3r::Model model;
PrinterTechnology printer_technology = ptFFF;
#if ENABLE_GCODE_VIEWER
Slic3r::GCodeProcessor::Result gcode_result;
#else
Slic3r::GCodePreviewData gcode_preview_data;
#endif // ENABLE_GCODE_VIEWER
// GUI elements
wxSizer* panel_sizer{ nullptr };
@ -1717,13 +1652,11 @@ struct Plater::priv
bool init_view_toolbar();
bool init_collapse_toolbar();
#if ENABLE_GCODE_VIEWER
void update_preview_bottom_toolbar();
void update_preview_moves_slider();
void enable_preview_moves_slider(bool enable);
void reset_gcode_toolpaths();
#endif // ENABLE_GCODE_VIEWER
void reset_all_gizmos();
void update_ui_from_settings(bool apply_free_camera_correction = true);
@ -1945,11 +1878,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
background_process.set_fff_print(&fff_print);
background_process.set_sla_print(&sla_print);
#if ENABLE_GCODE_VIEWER
background_process.set_gcode_result(&gcode_result);
#else
background_process.set_gcode_preview_data(&gcode_preview_data);
#endif // ENABLE_GCODE_VIEWER
background_process.set_thumbnail_cb([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background)
{
std::packaged_task<void(ThumbnailsList&, const Vec2ds&, bool, bool, bool, bool)> task([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) {
@ -1974,11 +1903,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
this->q->Bind(EVT_SLICING_UPDATE, &priv::on_slicing_update, this);
view3D = new View3D(q, &model, config, &background_process);
#if ENABLE_GCODE_VIEWER
preview = new Preview(q, &model, config, &background_process, &gcode_result, [this]() { schedule_background_process(); });
#else
preview = new Preview(q, &model, config, &background_process, &gcode_preview_data, [this]() { schedule_background_process(); });
#endif // ENABLE_GCODE_VIEWER
#ifdef __APPLE__
// set default view_toolbar icons size equal to GLGizmosManager::Default_Icons_Size
@ -2009,22 +1934,16 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
// Events:
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor()) {
#endif // ENABLE_GCODE_VIEWER
// Preset change event
sidebar->Bind(wxEVT_COMBOBOX, &priv::on_select_preset, this);
sidebar->Bind(EVT_OBJ_LIST_OBJECT_SELECT, [this](wxEvent&) { priv::selection_changed(); });
sidebar->Bind(EVT_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas();
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor()) {
#endif // ENABLE_GCODE_VIEWER
// 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);
@ -2066,10 +1985,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);
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
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(); });
@ -2077,37 +1994,24 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [this](SimpleEvent&) { this->q->collapse_sidebar(!this->q->is_sidebar_collapsed()); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_JUMP_TO, [this](wxKeyEvent& evt) { preview->jump_layers_slider(evt); });
#if ENABLE_GCODE_VIEWER
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, [this](wxKeyEvent& evt) { preview->move_layers_slider(evt); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_layers_slider(evt); });
#else
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, [this](wxKeyEvent& evt) { preview->move_double_slider(evt); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_double_slider(evt); });
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor()) {
#endif // ENABLE_GCODE_VIEWER
q->Bind(EVT_SLICING_COMPLETED, &priv::on_slicing_completed, this);
q->Bind(EVT_PROCESS_COMPLETED, &priv::on_process_completed, this);
q->Bind(EVT_EXPORT_BEGAN, &priv::on_export_began, this);
q->Bind(EVT_GLVIEWTOOLBAR_3D, [q](SimpleEvent&) { q->select_view_3D("3D"); });
q->Bind(EVT_GLVIEWTOOLBAR_PREVIEW, [q](SimpleEvent&) { q->select_view_3D("Preview"); });
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
// Drop target:
q->SetDropTarget(new PlaterDropTarget(q)); // if my understanding is right, wxWindow takes the owenership
q->Layout();
#if ENABLE_GCODE_VIEWER
set_current_panel(wxGetApp().is_editor() ? (wxPanel*)view3D : (wxPanel*)preview);
if (wxGetApp().is_gcode_viewer())
preview->hide_layers_slider();
#else
set_current_panel(view3D);
#endif // ENABLE_GCODE_VIEWER
// updates camera type from .ini file
camera.enable_update_config_on_type_change(true);
@ -2133,9 +2037,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
#endif /* _WIN32 */
notification_manager = new NotificationManager(this->q);
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor()) {
#endif // ENABLE_GCODE_VIEWER
this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); });
this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); });
this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [this](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
@ -2161,9 +2063,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
this->q->Bind(EVT_VOLUME_ATTACHED, [this](VolumeAttachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
this->q->Bind(EVT_VOLUME_DETACHED, [this](VolumeDetachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
#endif /* _WIN32 */
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
// Initialize the Undo / Redo stack with a first snapshot.
this->take_snapshot(_L("New Project"));
@ -2178,14 +2078,10 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
wxGetApp().other_instance_message_handler()->init(this->q);
// collapse sidebar according to saved value
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor()) {
#endif // ENABLE_GCODE_VIEWER
bool is_collapsed = wxGetApp().app_config->get("collapsed_sidebar") == "1";
sidebar->collapse(is_collapsed);
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
}
Plater::priv::~priv()
@ -2234,9 +2130,7 @@ void Plater::priv::select_view_3D(const std::string& name)
else if (name == "Preview")
set_current_panel(preview);
#if ENABLE_GCODE_VIEWER
wxGetApp().update_ui_from_settings(false);
#endif // ENABLE_GCODE_VIEWER
}
void Plater::priv::select_next_view_3D()
@ -2765,11 +2659,6 @@ void Plater::priv::deselect_all()
void Plater::priv::remove(size_t obj_idx)
{
#if !ENABLE_GCODE_VIEWER
// Prevent toolpaths preview from rendering while we modify the Print object
preview->set_enabled(false);
#endif // !ENABLE_GCODE_VIEWER
if (view3D->is_layers_editing_enabled())
view3D->enable_layers_editing(false);
@ -2800,18 +2689,11 @@ void Plater::priv::reset()
set_project_filename(wxEmptyString);
#if !ENABLE_GCODE_VIEWER
// Prevent toolpaths preview from rendering while we modify the Print object
preview->set_enabled(false);
#endif // !ENABLE_GCODE_VIEWER
if (view3D->is_layers_editing_enabled())
view3D->enable_layers_editing(false);
#if ENABLE_GCODE_VIEWER
reset_gcode_toolpaths();
gcode_result.reset();
#endif // ENABLE_GCODE_VIEWER
// Stop and reset the Print content.
this->background_process.reset();
@ -2958,19 +2840,12 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
this->sidebar->show_sliced_info_sizer(false);
// Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared.
// Otherwise they will be just refreshed.
#if ENABLE_GCODE_VIEWER
if (this->preview != nullptr) {
// If the preview is not visible, the following line just invalidates the preview,
// but the G-code paths or SLA preview are calculated first once the preview is made visible.
reset_gcode_toolpaths();
this->preview->reload_print();
}
#else
if (this->preview != nullptr)
// If the preview is not visible, the following line just invalidates the preview,
// but the G-code paths or SLA preview are calculated first once the preview is made visible.
this->preview->reload_print();
#endif // ENABLE_GCODE_VIEWER
// In FDM mode, we need to reload the 3D scene because of the wipe tower preview box.
// In SLA mode, we need to reload the 3D scene every time to show the support structures.
if (this->printer_technology == ptSLA || (this->printer_technology == ptFFF && this->config->opt_bool("wipe_tower")))
@ -4136,10 +4011,8 @@ void Plater::priv::reset_canvas_volumes()
bool Plater::priv::init_view_toolbar()
{
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_gcode_viewer())
return true;
#endif // ENABLE_GCODE_VIEWER
if (view_toolbar.get_items_count() > 0)
// already initialized
@ -4186,10 +4059,8 @@ bool Plater::priv::init_view_toolbar()
bool Plater::priv::init_collapse_toolbar()
{
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_gcode_viewer())
return true;
#endif // ENABLE_GCODE_VIEWER
if (collapse_toolbar.get_items_count() > 0)
// already initialized
@ -4230,7 +4101,6 @@ bool Plater::priv::init_collapse_toolbar()
return true;
}
#if ENABLE_GCODE_VIEWER
void Plater::priv::update_preview_bottom_toolbar()
{
preview->update_bottom_toolbar();
@ -4250,7 +4120,6 @@ void Plater::priv::reset_gcode_toolpaths()
{
preview->get_canvas3d()->reset_gcode_toolpaths();
}
#endif // ENABLE_GCODE_VIEWER
bool Plater::priv::can_set_instance_to_object() const
{
@ -4807,7 +4676,6 @@ void Plater::extract_config_from_project()
load_files(input_paths, false, true);
}
#if ENABLE_GCODE_VIEWER
void Plater::load_gcode()
{
// Ask user for a gcode file name.
@ -4858,7 +4726,6 @@ void Plater::refresh_print()
{
p->preview->refresh_print();
}
#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); }
@ -5363,9 +5230,7 @@ void Plater::reslice()
if ((state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) != 0)
return;
#if ENABLE_GCODE_VIEWER
bool clean_gcode_toolpaths = true;
#endif // ENABLE_GCODE_VIEWER
if (p->background_process.running())
{
if (wxGetApp().get_mode() == comSimple)
@ -5378,7 +5243,6 @@ void Plater::reslice()
}
else if (!p->background_process.empty() && !p->background_process.idle())
p->show_action_buttons(true);
#if ENABLE_GCODE_VIEWER
else
clean_gcode_toolpaths = false;
@ -5387,10 +5251,6 @@ void Plater::reslice()
// update type of preview
p->preview->update_view_type(!clean_gcode_toolpaths);
#else
// update type of preview
p->preview->update_view_type(true);
#endif // ENABLE_GCODE_VIEWER
}
void Plater::reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages)
@ -5607,9 +5467,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
// print technology is changed, so we should to update a search list
p->sidebar->update_searcher();
p->sidebar->show_sliced_info_sizer(false);
#if ENABLE_GCODE_VIEWER
p->reset_gcode_toolpaths();
#endif // ENABLE_GCODE_VIEWER
}
else if (opt_key == "bed_shape" || opt_key == "bed_custom_texture" || opt_key == "bed_custom_model") {
bed_shape_changed = true;
@ -5652,23 +5510,15 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
void Plater::set_bed_shape() const
{
#if ENABLE_GCODE_VIEWER
set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values,
p->config->option<ConfigOptionString>("bed_custom_texture")->value,
p->config->option<ConfigOptionString>("bed_custom_model")->value);
#else
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_model")->value);
#endif // ENABLE_GCODE_VIEWER
}
#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
{
p->set_bed_shape(shape, custom_texture, custom_model, force_as_custom);
}
#endif // ENABLE_GCODE_VIEWER
void Plater::force_filament_colors_update()
{
@ -5724,17 +5574,11 @@ void Plater::on_activate()
}
// Get vector of extruder colors considering filament color, if extruder color is undefined.
#if ENABLE_GCODE_VIEWER
std::vector<std::string> Plater::get_extruder_colors_from_plater_config(const GCodeProcessor::Result* const result) const
#else
std::vector<std::string> Plater::get_extruder_colors_from_plater_config() const
#endif // ENABLE_GCODE_VIEWER
{
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_gcode_viewer() && result != nullptr)
return result->extruder_colors;
else {
#endif // ENABLE_GCODE_VIEWER
const Slic3r::DynamicPrintConfig* config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
std::vector<std::string> extruder_colors;
if (!config->has("extruder_colour")) // in case of a SLA print
@ -5750,23 +5594,15 @@ std::vector<std::string> Plater::get_extruder_colors_from_plater_config() const
extruder_colors[i] = filament_colours[i];
return extruder_colors;
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
}
/* Get vector of colors used for rendering of a Preview scene in "Color print" mode
* It consists of extruder colors and colors, saved in model.custom_gcode_per_print_z
*/
#if ENABLE_GCODE_VIEWER
std::vector<std::string> Plater::get_colors_for_color_print(const GCodeProcessor::Result* const result) const
{
std::vector<std::string> colors = get_extruder_colors_from_plater_config(result);
#else
std::vector<std::string> Plater::get_colors_for_color_print() const
{
std::vector<std::string> colors = get_extruder_colors_from_plater_config();
#endif // ENABLE_GCODE_VIEWER
colors.reserve(colors.size() + p->model.custom_gcode_per_print_z.gcodes.size());
for (const CustomGCode::Item& code : p->model.custom_gcode_per_print_z.gcodes)
@ -5848,23 +5684,13 @@ PrinterTechnology Plater::printer_technology() const
const DynamicPrintConfig * Plater::config() const { return p->config; }
#if ENABLE_GCODE_VIEWER
bool Plater::set_printer_technology(PrinterTechnology printer_technology)
#else
void Plater::set_printer_technology(PrinterTechnology printer_technology)
#endif // ENABLE_GCODE_VIEWER
{
p->printer_technology = printer_technology;
#if ENABLE_GCODE_VIEWER
bool ret = p->background_process.select_technology(printer_technology);
if (ret) {
// Update the active presets.
}
#else
if (p->background_process.select_technology(printer_technology)) {
// Update the active presets.
}
#endif // ENABLE_GCODE_VIEWER
//FIXME for SLA synchronize
//p->background_process.apply(Model)!
@ -5878,9 +5704,7 @@ void Plater::set_printer_technology(PrinterTechnology printer_technology)
p->sidebar->get_searcher().set_printer_technology(printer_technology);
#if ENABLE_GCODE_VIEWER
return ret;
#endif // ENABLE_GCODE_VIEWER
}
void Plater::changed_object(int obj_idx)
@ -6028,24 +5852,20 @@ bool Plater::init_view_toolbar()
return p->init_view_toolbar();
}
#if ENABLE_GCODE_VIEWER
void Plater::enable_view_toolbar(bool enable)
{
p->view_toolbar.set_enabled(enable);
}
#endif // ENABLE_GCODE_VIEWER
bool Plater::init_collapse_toolbar()
{
return p->init_collapse_toolbar();
}
#if ENABLE_GCODE_VIEWER
void Plater::enable_collapse_toolbar(bool enable)
{
p->collapse_toolbar.set_enabled(enable);
}
#endif // ENABLE_GCODE_VIEWER
const Camera& Plater::get_camera() const
{
@ -6100,7 +5920,6 @@ GLToolbar& Plater::get_collapse_toolbar()
return p->collapse_toolbar;
}
#if ENABLE_GCODE_VIEWER
void Plater::update_preview_bottom_toolbar()
{
p->update_preview_bottom_toolbar();
@ -6120,7 +5939,6 @@ void Plater::reset_gcode_toolpaths()
{
p->reset_gcode_toolpaths();
}
#endif // ENABLE_GCODE_VIEWER
const Mouse3DController& Plater::get_mouse3d_controller() const
{
@ -6189,9 +6007,7 @@ 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_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(); }
#if ENABLE_GCODE_VIEWER
void Plater::clear_undo_redo_stack_main() { p->undo_redo_stack_main().clear(); }
#endif // ENABLE_GCODE_VIEWER
void Plater::enter_gizmos_stack() { p->enter_gizmos_stack(); }
void Plater::leave_gizmos_stack() { p->leave_gizmos_stack(); }
bool Plater::inside_snapshot_capture() { return p->inside_snapshot_capture(); }

View file

@ -11,9 +11,7 @@
#include "libslic3r/Preset.hpp"
#include "libslic3r/BoundingBox.hpp"
#if ENABLE_GCODE_VIEWER
#include "libslic3r/GCode/GCodeProcessor.hpp"
#endif // ENABLE_GCODE_VIEWER
#include "Jobs/Job.hpp"
#include "Search.hpp"
@ -144,11 +142,9 @@ public:
void add_model(bool imperial_units = false);
void import_sl1_archive();
void extract_config_from_project();
#if ENABLE_GCODE_VIEWER
void load_gcode();
void load_gcode(const wxString& filename);
void refresh_print();
#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);
// To be called when providing a list of files to the GUI slic3r on command line.
@ -223,9 +219,7 @@ public:
bool search_string_getter(int idx, const char** label, const char** tooltip);
// For the memory statistics.
const Slic3r::UndoRedo::Stack& undo_redo_stack_main() const;
#if ENABLE_GCODE_VIEWER
void clear_undo_redo_stack_main();
#endif // ENABLE_GCODE_VIEWER
// Enter / leave the Gizmos specific Undo / Redo stack. To be used by the SLA support point editing gizmo.
void enter_gizmos_stack();
void leave_gizmos_stack();
@ -236,13 +230,8 @@ public:
void force_print_bed_update();
// On activating the parent window.
void on_activate();
#if ENABLE_GCODE_VIEWER
std::vector<std::string> get_extruder_colors_from_plater_config(const GCodeProcessor::Result* const result = nullptr) const;
std::vector<std::string> get_colors_for_color_print(const GCodeProcessor::Result* const result = nullptr) const;
#else
std::vector<std::string> get_extruder_colors_from_plater_config() const;
std::vector<std::string> get_colors_for_color_print() const;
#endif // ENABLE_GCODE_VIEWER
void update_object_menu();
void show_action_buttons(const bool is_ready_to_slice) const;
@ -268,11 +257,7 @@ public:
PrinterTechnology printer_technology() const;
const DynamicPrintConfig * config() const;
#if ENABLE_GCODE_VIEWER
bool set_printer_technology(PrinterTechnology printer_technology);
#else
void set_printer_technology(PrinterTechnology printer_technology);
#endif // ENABLE_GCODE_VIEWER
void copy_selection_to_clipboard();
void paste_from_clipboard();
@ -298,13 +283,9 @@ public:
void sys_color_changed();
bool init_view_toolbar();
#if ENABLE_GCODE_VIEWER
void enable_view_toolbar(bool enable);
#endif // ENABLE_GCODE_VIEWER
bool init_collapse_toolbar();
#if ENABLE_GCODE_VIEWER
void enable_collapse_toolbar(bool enable);
#endif // ENABLE_GCODE_VIEWER
const Camera& get_camera() const;
Camera& get_camera();
@ -323,23 +304,19 @@ public:
const GLToolbar& get_collapse_toolbar() const;
GLToolbar& get_collapse_toolbar();
#if ENABLE_GCODE_VIEWER
void update_preview_bottom_toolbar();
void update_preview_moves_slider();
void enable_preview_moves_slider(bool enable);
void reset_gcode_toolpaths();
void reset_last_loaded_gcode() { m_last_loaded_gcode = ""; }
#endif // ENABLE_GCODE_VIEWER
const Mouse3DController& get_mouse3d_controller() const;
Mouse3DController& get_mouse3d_controller();
void set_bed_shape() const;
#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;
#endif // ENABLE_GCODE_VIEWER
const NotificationManager* get_notification_manager() const;
NotificationManager* get_notification_manager();
@ -394,9 +371,7 @@ private:
bool m_tracking_popup_menu = false;
wxString m_tracking_popup_menu_error_message;
#if ENABLE_GCODE_VIEWER
wxString m_last_loaded_gcode;
#endif // ENABLE_GCODE_VIEWER
void suppress_snapshots();
void allow_snapshots();