From b099d5c05ed6c57961a95b3223668b41231c58ce Mon Sep 17 00:00:00 2001 From: Enrico Turri <enricoturri@seznam.cz> Date: Thu, 3 Jan 2019 12:59:06 +0100 Subject: [PATCH] Removal of wxNotebook from plater set as default --- src/libslic3r/Technologies.hpp | 2 - src/slic3r/GUI/GLCanvas3D.cpp | 54 ------ src/slic3r/GUI/GLCanvas3D.hpp | 16 -- src/slic3r/GUI/GLToolbar.cpp | 31 ---- src/slic3r/GUI/GLToolbar.hpp | 9 - src/slic3r/GUI/GUI_Preview.cpp | 30 --- src/slic3r/GUI/GUI_Preview.hpp | 16 -- src/slic3r/GUI/MainFrame.cpp | 14 -- src/slic3r/GUI/Plater.cpp | 327 +-------------------------------- src/slic3r/GUI/Plater.hpp | 3 +- 10 files changed, 5 insertions(+), 497 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 38d0f5b6e..c32fe3e8d 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -28,8 +28,6 @@ #define DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI (1 && ENABLE_IMGUI) // Modified Sla support gizmo #define ENABLE_SLA_SUPPORT_GIZMO_MOD (1 && ENABLE_1_42_0_ALPHA1) -// Removes the wxNotebook from plater -#define ENABLE_REMOVE_TABS_FROM_PLATER (1 && ENABLE_1_42_0_ALPHA1) // Use wxDataViewRender instead of wxDataViewCustomRenderer #define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0_ALPHA1) // Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index a49a130ee..1695a532b 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3635,9 +3635,7 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const } } -#if ENABLE_REMOVE_TABS_FROM_PLATER wxDEFINE_EVENT(EVT_GLCANVAS_INIT, SimpleEvent); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER wxDEFINE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_VIEWPORT_CHANGED, SimpleEvent); @@ -3662,9 +3660,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) , m_context(nullptr) , m_in_render(false) , m_toolbar(GLToolbar::Normal) -#if ENABLE_REMOVE_TABS_FROM_PLATER , m_view_toolbar(nullptr) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER , m_use_clipping_planes(false) , m_sidebar_field("") , m_config(nullptr) @@ -3813,9 +3809,7 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl) return false; #endif // ENABLE_SIDEBAR_VISUAL_HINTS -#if ENABLE_REMOVE_TABS_FROM_PLATER post_event(SimpleEvent(EVT_GLCANVAS_INIT)); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER m_initialized = true; @@ -3862,21 +3856,12 @@ void GLCanvas3D::reset_volumes() _reset_warning_texture(); } -#if ENABLE_REMOVE_TABS_FROM_PLATER int GLCanvas3D::check_volumes_outside_state() const { ModelInstance::EPrintVolumeState state; m_volumes.check_outside_state(m_config, &state); return (int)state; } -#else -int GLCanvas3D::check_volumes_outside_state(const DynamicPrintConfig* config) const -{ - ModelInstance::EPrintVolumeState state; - m_volumes.check_outside_state(config, &state); - return (int)state; -} -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void GLCanvas3D::set_config(DynamicPrintConfig* config) { @@ -4141,10 +4126,6 @@ void GLCanvas3D::render() float theta = m_camera.get_theta(); bool is_custom_bed = m_bed.is_custom(); -#if !ENABLE_REMOVE_TABS_FROM_PLATER - set_tooltip(""); -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER - #if ENABLE_IMGUI wxGetApp().imgui()->new_frame(); #endif // ENABLE_IMGUI @@ -4200,13 +4181,9 @@ void GLCanvas3D::render() _render_gizmos_overlay(); _render_warning_texture(); _render_legend_texture(); -#if ENABLE_REMOVE_TABS_FROM_PLATER _resize_toolbars(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER _render_toolbar(); -#if ENABLE_REMOVE_TABS_FROM_PLATER _render_view_toolbar(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER _render_layer_editing_overlay(); #if ENABLE_IMGUI @@ -4902,9 +4879,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_layers_editing.last_object_id = layer_editing_object_idx; bool gizmos_overlay_contains_mouse = m_gizmos.overlay_contains_mouse(*this, m_mouse.position); int toolbar_contains_mouse = m_toolbar.contains_mouse(m_mouse.position, *this); -#if ENABLE_REMOVE_TABS_FROM_PLATER int view_toolbar_contains_mouse = (m_view_toolbar != nullptr) ? m_view_toolbar->contains_mouse(m_mouse.position, *this) : -1; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER if (evt.Entering()) { @@ -5001,13 +4976,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) if (m_gizmos.get_current_type() == Gizmos::SlaSupports) m_gizmos.delete_current_grabber(); } -#if ENABLE_REMOVE_TABS_FROM_PLATER else if (view_toolbar_contains_mouse != -1) { if (m_view_toolbar != nullptr) m_view_toolbar->do_action((unsigned int)view_toolbar_contains_mouse, *this); } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER else if (toolbar_contains_mouse != -1) { m_toolbar_action_running = true; @@ -5292,7 +5265,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) else if (evt.Moving()) { m_mouse.position = pos.cast<double>(); -#if ENABLE_REMOVE_TABS_FROM_PLATER std::string tooltip = ""; // updates gizmos overlay @@ -5314,7 +5286,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } set_tooltip(tooltip); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // Only refresh if picking is enabled, in that case the objects may get highlighted if the mouse cursor hovers over. if (m_picking_enabled) @@ -6074,20 +6045,6 @@ void GLCanvas3D::_picking_pass() const } _update_volumes_hover_state(); - -#if !ENABLE_REMOVE_TABS_FROM_PLATER - // updates gizmos overlay - if (!m_selection.is_empty()) - { - std::string name = m_gizmos.update_hover_state(*this, pos, m_selection); - if (!name.empty()) - set_tooltip(name); - } - else - m_gizmos.reset_all_states(); - - m_toolbar.update_hover_state(pos); -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER } } @@ -6346,19 +6303,14 @@ void GLCanvas3D::_render_gizmos_overlay() const void GLCanvas3D::_render_toolbar() const { -#if !ENABLE_REMOVE_TABS_FROM_PLATER - _resize_toolbar(); -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER m_toolbar.render(*this); } -#if ENABLE_REMOVE_TABS_FROM_PLATER void GLCanvas3D::_render_view_toolbar() const { if (m_view_toolbar != nullptr) m_view_toolbar->render(*this); } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER #if ENABLE_SHOW_CAMERA_TARGET void GLCanvas3D::_render_camera_target() const @@ -7972,11 +7924,7 @@ bool GLCanvas3D::_is_any_volume_outside() const return false; } -#if ENABLE_REMOVE_TABS_FROM_PLATER void GLCanvas3D::_resize_toolbars() const -#else -void GLCanvas3D::_resize_toolbar() const -#endif // ENABLE_REMOVE_TABS_FROM_PLATER { Size cnv_size = get_canvas_size(); float zoom = get_camera_zoom(); @@ -8023,7 +7971,6 @@ void GLCanvas3D::_resize_toolbar() const } } -#if ENABLE_REMOVE_TABS_FROM_PLATER if (m_view_toolbar != nullptr) { // places the toolbar on the bottom-left corner of the 3d scene @@ -8031,7 +7978,6 @@ void GLCanvas3D::_resize_toolbar() const float left = -0.5f * (float)cnv_size.get_width() * inv_zoom; m_view_toolbar->set_position(top, left); } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } const Print* GLCanvas3D::fff_print() const diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index a46168094..73aa4bd02 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -97,9 +97,7 @@ template <size_t N> using Vec2dsEvent = ArrayEvent<Vec2d, N>; using Vec3dEvent = Event<Vec3d>; template <size_t N> using Vec3dsEvent = ArrayEvent<Vec3d, N>; -#if ENABLE_REMOVE_TABS_FROM_PLATER wxDECLARE_EVENT(EVT_GLCANVAS_INIT, SimpleEvent); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER wxDECLARE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_VIEWPORT_CHANGED, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_RIGHT_CLICK, Vec2dEvent); @@ -787,9 +785,7 @@ private: Mouse m_mouse; mutable Gizmos m_gizmos; mutable GLToolbar m_toolbar; -#if ENABLE_REMOVE_TABS_FROM_PLATER GLToolbar* m_view_toolbar; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER ClippingPlane m_clipping_planes[2]; bool m_use_clipping_planes; mutable SlaCap m_sla_caps[2]; @@ -838,9 +834,7 @@ public: wxGLCanvas* get_wxglcanvas() { return m_canvas; } -#if ENABLE_REMOVE_TABS_FROM_PLATER void set_view_toolbar(GLToolbar* toolbar) { m_view_toolbar = toolbar; } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER bool init(bool useVBOs, bool use_legacy_opengl); void post_event(wxEvent &&event); @@ -853,11 +847,7 @@ public: unsigned int get_volumes_count() const; void reset_volumes(); -#if ENABLE_REMOVE_TABS_FROM_PLATER int check_volumes_outside_state() const; -#else - int check_volumes_outside_state(const DynamicPrintConfig* config) const; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void set_config(DynamicPrintConfig* config); void set_process(BackgroundSlicingProcess* process); @@ -1017,9 +1007,7 @@ private: void _render_current_gizmo() const; void _render_gizmos_overlay() const; void _render_toolbar() const; -#if ENABLE_REMOVE_TABS_FROM_PLATER void _render_view_toolbar() const; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER #if ENABLE_SHOW_CAMERA_TARGET void _render_camera_target() const; #endif // ENABLE_SHOW_CAMERA_TARGET @@ -1086,11 +1074,7 @@ private: bool _is_any_volume_outside() const; -#if ENABLE_REMOVE_TABS_FROM_PLATER void _resize_toolbars() const; -#else - void _resize_toolbar() const; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER static std::vector<float> _parse_colors(const std::vector<std::string>& colors); diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 9bd2358bd..0efc19dee 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -355,30 +355,16 @@ bool GLToolbar::is_item_disabled(const std::string& name) const return false; } -#if ENABLE_REMOVE_TABS_FROM_PLATER std::string GLToolbar::update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent) -#else -void GLToolbar::update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER { -#if ENABLE_REMOVE_TABS_FROM_PLATER if (!m_enabled) return ""; -#else - if (!m_enabled) - return; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER switch (m_layout.type) { default: -#if ENABLE_REMOVE_TABS_FROM_PLATER case Layout::Horizontal: { return update_hover_state_horizontal(mouse_pos, parent); } case Layout::Vertical: { return update_hover_state_vertical(mouse_pos, parent); } -#else - case Layout::Horizontal: { update_hover_state_horizontal(mouse_pos, parent); break; } - case Layout::Vertical: { update_hover_state_vertical(mouse_pos, parent); break; } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } } @@ -512,11 +498,7 @@ float GLToolbar::get_main_size() const return size; } -#if ENABLE_REMOVE_TABS_FROM_PLATER std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent) -#else -void GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER { float zoom = parent.get_camera_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; @@ -606,19 +588,10 @@ void GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D } } -#if ENABLE_REMOVE_TABS_FROM_PLATER return tooltip; -#else - if (!tooltip.empty()) - m_parent.set_tooltip(tooltip); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } -#if ENABLE_REMOVE_TABS_FROM_PLATER std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent) -#else -void GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER { float zoom = parent.get_camera_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; @@ -708,11 +681,7 @@ void GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& } } -#if ENABLE_REMOVE_TABS_FROM_PLATER return tooltip; -#else - m_parent.set_tooltip(tooltip); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } int GLToolbar::contains_mouse_horizontal(const Vec2d& mouse_pos, const GLCanvas3D& parent) const diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 49296796d..37eef5708 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -224,11 +224,7 @@ public: bool is_item_pressed(const std::string& name) const; bool is_item_disabled(const std::string& name) const; -#if ENABLE_REMOVE_TABS_FROM_PLATER std::string update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent); -#else - void update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // returns the id of the item under the given mouse position or -1 if none int contains_mouse(const Vec2d& mouse_pos, const GLCanvas3D& parent) const; @@ -244,13 +240,8 @@ private: float get_height_horizontal() const; float get_height_vertical() const; float get_main_size() const; -#if ENABLE_REMOVE_TABS_FROM_PLATER std::string update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent); std::string update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent); -#else - void update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent); - void update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER int contains_mouse_horizontal(const Vec2d& mouse_pos, const GLCanvas3D& parent) const; int contains_mouse_vertical(const Vec2d& mouse_pos, const GLCanvas3D& parent) const; diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 59b4a727d..1092c761f 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -27,7 +27,6 @@ namespace Slic3r { namespace GUI { -#if ENABLE_REMOVE_TABS_FROM_PLATER View3D::View3D(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process) : m_canvas_widget(nullptr) , m_canvas(nullptr) @@ -184,13 +183,8 @@ void View3D::render() if (m_canvas != nullptr) m_canvas->render(); } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER -#if ENABLE_REMOVE_TABS_FROM_PLATER Preview::Preview(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process_func) -#else -Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process_func) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER : m_canvas_widget(nullptr) , m_canvas(nullptr) , m_double_slider_sizer(nullptr) @@ -211,42 +205,20 @@ Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSli , m_enabled(false) , m_schedule_background_process(schedule_background_process_func) { -#if ENABLE_REMOVE_TABS_FROM_PLATER if (init(parent, config, process, gcode_preview_data)) { show_hide_ui_elements("none"); load_print(); } -#else - if (init(notebook, config, process, gcode_preview_data)) - { - notebook->AddPage(this, _(L("Preview"))); - show_hide_ui_elements("none"); - load_print(); - } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } -#if ENABLE_REMOVE_TABS_FROM_PLATER bool Preview::init(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data) -#else -bool Preview::init(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER { -#if ENABLE_REMOVE_TABS_FROM_PLATER if ((config == nullptr) || (process == nullptr) || (gcode_preview_data == nullptr)) return false; if (!Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)) return false; -#else - if ((notebook == nullptr) || (config == nullptr) || (process == nullptr) || (gcode_preview_data == nullptr)) - return false; - - // creates this panel add append it to the given notebook as a new page - if (!Create(notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize)) - return false; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER m_canvas_widget = GLCanvas3DManager::create_wxglcanvas(this); _3DScene::add_canvas(m_canvas_widget); @@ -361,13 +333,11 @@ Preview::~Preview() } } -#if ENABLE_REMOVE_TABS_FROM_PLATER void Preview::set_view_toolbar(GLToolbar* toolbar) { if (m_canvas != nullptr) m_canvas->set_view_toolbar(toolbar); } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void Preview::set_number_extruders(unsigned int number_extruders) { diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp index e04946255..ccff885f2 100644 --- a/src/slic3r/GUI/GUI_Preview.hpp +++ b/src/slic3r/GUI/GUI_Preview.hpp @@ -21,18 +21,13 @@ class DynamicPrintConfig; class Print; class BackgroundSlicingProcess; class GCodePreviewData; -#if ENABLE_REMOVE_TABS_FROM_PLATER class Model; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER namespace GUI { class GLCanvas3D; -#if ENABLE_REMOVE_TABS_FROM_PLATER class GLToolbar; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER -#if ENABLE_REMOVE_TABS_FROM_PLATER class View3D : public wxPanel { wxGLCanvas* m_canvas_widget; @@ -79,7 +74,6 @@ public: private: bool init(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process); }; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER class Preview : public wxPanel { @@ -111,18 +105,12 @@ class Preview : public wxPanel PrusaDoubleSlider* m_slider {nullptr}; public: -#if ENABLE_REMOVE_TABS_FROM_PLATER Preview(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process = [](){}); -#else - Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process = [](){}); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER virtual ~Preview(); wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; } -#if ENABLE_REMOVE_TABS_FROM_PLATER void set_view_toolbar(GLToolbar* toolbar); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void set_number_extruders(unsigned int number_extruders); void set_canvas_as_dirty(); @@ -138,11 +126,7 @@ public: void refresh_print(); private: -#if ENABLE_REMOVE_TABS_FROM_PLATER bool init(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data); -#else - bool init(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void bind_event_handlers(); void unbind_event_handlers(); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 33c4cf32b..734285db7 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -323,19 +323,13 @@ void MainFrame::init_menubar() { size_t tab_offset = 0; if (m_plater) { -#if ENABLE_REMOVE_TABS_FROM_PLATER append_menu_item(windowMenu, wxID_HIGHEST + 1, L("Plater Tab\tCtrl+1"), L("Show the plater"), [this](wxCommandEvent&) { select_tab(0); }, "application_view_tile.png"); -#else - append_menu_item(windowMenu, wxID_ANY, L("Select Plater Tab\tCtrl+1"), L("Show the plater"), - [this](wxCommandEvent&) { select_tab(0); }, "application_view_tile.png"); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER tab_offset += 1; } if (tab_offset > 0) { windowMenu->AppendSeparator(); } -#if ENABLE_REMOVE_TABS_FROM_PLATER append_menu_item(windowMenu, wxID_HIGHEST + 2, L("Print Settings Tab\tCtrl+2"), L("Show the print settings"), [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 0); }, "cog.png"); append_menu_item(windowMenu, wxID_HIGHEST + 3, L("Filament Settings Tab\tCtrl+3"), L("Show the filament settings"), @@ -365,14 +359,6 @@ void MainFrame::init_menubar() wxAcceleratorTable accel(6, entries); SetAcceleratorTable(accel); #endif // _WIN32 -#else - append_menu_item(windowMenu, wxID_ANY, L("Select Print Settings Tab\tCtrl+2"), L("Show the print settings"), - [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 0); }, "cog.png"); - append_menu_item(windowMenu, wxID_ANY, L("Select Filament Settings Tab\tCtrl+3"), L("Show the filament settings"), - [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 1); }, "spool.png"); - append_menu_item(windowMenu, wxID_ANY, L("Select Printer Settings Tab\tCtrl+4"), L("Show the printer settings"), - [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 2); }, "printer_empty.png"); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER windowMenu->AppendSeparator(); append_menu_item(windowMenu, wxID_ANY, L("Print Host Upload Queue"), L("Display the Print Host Upload Queue window"), diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 179aa9476..c9440a9d0 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -900,28 +900,12 @@ struct Plater::priv Slic3r::GCodePreviewData gcode_preview_data; // GUI elements -#if ENABLE_REMOVE_TABS_FROM_PLATER wxSizer* panel_sizer; wxPanel* current_panel; std::vector<wxPanel*> panels; -#else - wxNotebook *notebook; - EventGuard guard_on_notebook_changed; - // Note: ^ The on_notebook_changed is guarded here because the wxNotebook d-tor tends to generate - // wxEVT_NOTEBOOK_PAGE_CHANGED events on some platforms, which causes them to be received by a freed Plater. - // EventGuard unbinds the handler in its d-tor. -#endif // ENABLE_REMOVE_TABS_FROM_PLATER Sidebar *sidebar; -#if ENABLE_REMOVE_TABS_FROM_PLATER View3D* view3D; GLToolbar view_toolbar; -#else -#if !ENABLE_IMGUI - wxPanel *panel3d; -#endif // not ENABLE_IMGUI - wxGLCanvas *canvas3Dwidget; // TODO: Use GLCanvas3D when we can - GLCanvas3D *canvas3D; -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER Preview *preview; wxString project_filename; @@ -942,10 +926,8 @@ struct Plater::priv void update(bool force_full_scene_refresh = false); void select_view(const std::string& direction); -#if ENABLE_REMOVE_TABS_FROM_PLATER void select_view_3D(const std::string& name); void select_next_view_3D(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void update_ui_from_settings(); ProgressStatusBar* statusbar(); std::string get_config(const std::string &key) const; @@ -999,11 +981,8 @@ struct Plater::priv void reload_from_disk(); void fix_through_netfabb(const int obj_idx); -#if ENABLE_REMOVE_TABS_FROM_PLATER void set_current_panel(wxPanel* panel); -#else - void on_notebook_changed(wxBookCtrlEvent&); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER + void on_select_preset(wxCommandEvent&); void on_slicing_update(SlicingStatusEvent&); void on_slicing_completed(wxCommandEvent&); @@ -1030,9 +1009,7 @@ private: bool complit_init_object_menu(); bool complit_init_sla_object_menu(); bool complit_init_part_menu(); -#if ENABLE_REMOVE_TABS_FROM_PLATER void init_view_toolbar(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER bool can_delete_object() const; bool can_increase_instances() const; @@ -1064,20 +1041,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) "wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "extruder_colour", "filament_colour", "max_print_height", "printer_model", "printer_technology" })) -#if !ENABLE_REMOVE_TABS_FROM_PLATER - , notebook(new wxNotebook(q, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM)) - , guard_on_notebook_changed(notebook, wxEVT_NOTEBOOK_PAGE_CHANGED, &priv::on_notebook_changed, this) -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER , sidebar(new Sidebar(q)) -#if !ENABLE_REMOVE_TABS_FROM_PLATER -#if ENABLE_IMGUI - , canvas3Dwidget(GLCanvas3DManager::create_wxglcanvas(notebook)) -#else - , panel3d(new wxPanel(notebook, wxID_ANY)) - , canvas3Dwidget(GLCanvas3DManager::create_wxglcanvas(panel3d)) -#endif // ENABLE_IMGUI - , canvas3D(nullptr) -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER , delayed_scene_refresh(false) , project_filename(wxEmptyString) , view_toolbar(GLToolbar::Radio) @@ -1100,27 +1064,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) sla_print.set_status_callback(statuscb); this->q->Bind(EVT_SLICING_UPDATE, &priv::on_slicing_update, this); -#if !ENABLE_REMOVE_TABS_FROM_PLATER - _3DScene::add_canvas(canvas3Dwidget); - this->canvas3D = _3DScene::get_canvas(this->canvas3Dwidget); - this->canvas3D->allow_multisample(GLCanvas3DManager::can_multisample()); -#if ENABLE_IMGUI - notebook->AddPage(canvas3Dwidget, _(L("3D"))); -#else - auto *panel3dsizer = new wxBoxSizer(wxVERTICAL); - panel3dsizer->Add(canvas3Dwidget, 1, wxEXPAND); - auto *panel_gizmo_widgets = new wxPanel(panel3d, wxID_ANY); - panel_gizmo_widgets->SetSizer(new wxBoxSizer(wxVERTICAL)); - panel3dsizer->Add(panel_gizmo_widgets, 0, wxEXPAND); - - panel3d->SetSizer(panel3dsizer); - notebook->AddPage(panel3d, _(L("3D"))); - - canvas3D->set_external_gizmo_widgets_parent(panel_gizmo_widgets); -#endif // ENABLE_IMGUI -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER - -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D = new View3D(q, &model, config, &background_process); preview = new Preview(q, config, &background_process, &gcode_preview_data, [this](){ schedule_background_process(); }); // Let the Tab key switch between the 3D view and the layer preview. @@ -1129,51 +1072,24 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) panels.push_back(view3D); panels.push_back(preview); -#else - preview = new GUI::Preview(notebook, config, &background_process, &gcode_preview_data, [this](){ schedule_background_process(); }); - - // XXX: If have OpenGL - this->canvas3D->enable_picking(true); - this->canvas3D->enable_moving(true); - // XXX: more config from 3D.pm - this->canvas3D->set_model(&model); - this->canvas3D->set_process(&background_process); - this->canvas3D->set_config(config); - this->canvas3D->enable_gizmos(true); - this->canvas3D->enable_toolbar(true); - this->canvas3D->enable_force_zoom_to_bed(true); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER this->background_process_timer.SetOwner(this->q, 0); this->q->Bind(wxEVT_TIMER, [this](wxTimerEvent &evt) { this->update_restart_background_process(false, false); }); auto *bed_shape = config->opt<ConfigOptionPoints>("bed_shape"); -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->set_bed_shape(bed_shape->values); -#else - this->canvas3D->set_bed_shape(bed_shape->values); - this->canvas3D->zoom_to_bed(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER preview->set_bed_shape(bed_shape->values); update(); auto *hsizer = new wxBoxSizer(wxHORIZONTAL); -#if ENABLE_REMOVE_TABS_FROM_PLATER panel_sizer = new wxBoxSizer(wxHORIZONTAL); panel_sizer->Add(view3D, 1, wxEXPAND | wxALL, 0); panel_sizer->Add(preview, 1, wxEXPAND | wxALL, 0); hsizer->Add(panel_sizer, 1, wxEXPAND | wxALL, 0); -#else - hsizer->Add(notebook, 1, wxEXPAND | wxTOP, 1); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER hsizer->Add(sidebar, 0, wxEXPAND | wxLEFT | wxRIGHT, 0); q->SetSizer(hsizer); -//#if ENABLE_REMOVE_TABS_FROM_PLATER -// set_current_panel(view3D); -//#endif // ENABLE_REMOVE_TABS_FROM_PLATER - init_object_menu(); // Events: @@ -1184,7 +1100,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) 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_REMOVE_TABS_FROM_PLATER wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas(); // 3DScene events: view3D_canvas->Bind(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); }); @@ -1217,47 +1132,17 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this); view3D_canvas->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this); view3D_canvas->Bind(EVT_GLCANVAS_INIT, [this](SimpleEvent&) { init_view_toolbar(); }); -#else - // 3DScene events: - canvas3Dwidget->Bind(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); }); - canvas3Dwidget->Bind(EVT_GLCANVAS_OBJECT_SELECT, &priv::on_object_select, this); - canvas3Dwidget->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this); - canvas3Dwidget->Bind(EVT_GLCANVAS_RIGHT_CLICK, &priv::on_right_click, this); - canvas3Dwidget->Bind(EVT_GLCANVAS_MODEL_UPDATE, [this](SimpleEvent&) { this->schedule_background_process(); }); - canvas3Dwidget->Bind(EVT_GLCANVAS_REMOVE_OBJECT, [q](SimpleEvent&) { q->remove_selected(); }); - canvas3Dwidget->Bind(EVT_GLCANVAS_ARRANGE, [this](SimpleEvent&) { arrange(); }); - canvas3Dwidget->Bind(EVT_GLCANVAS_INCREASE_INSTANCES, [this](Event<int> &evt) - { if (evt.data == 1) this->q->increase_instances(); else if (this->can_decrease_instances()) this->q->decrease_instances(); }); - canvas3Dwidget->Bind(EVT_GLCANVAS_INSTANCE_MOVED, [this](SimpleEvent&) { update(); }); - canvas3Dwidget->Bind(EVT_GLCANVAS_WIPETOWER_MOVED, &priv::on_wipetower_moved, this); - canvas3Dwidget->Bind(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, [this](Event<bool> &evt) { this->sidebar->enable_buttons(evt.data); }); - canvas3Dwidget->Bind(EVT_GLCANVAS_UPDATE_GEOMETRY, &priv::on_update_geometry, this); - canvas3Dwidget->Bind(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, &priv::on_3dcanvas_mouse_dragging_finished, this); - // 3DScene/Toolbar: - canvas3Dwidget->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_DELETE, [q](SimpleEvent&) { q->remove_selected(); } ); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_DELETE_ALL, [this](SimpleEvent&) { reset(); }); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_ARRANGE, [this](SimpleEvent&) { arrange(); }); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_MORE, [q](SimpleEvent&) { q->increase_instances(); }); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_FEWER, [q](SimpleEvent&) { q->decrease_instances(); }); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_SPLIT_OBJECTS, &priv::on_action_split_objects, this); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this); - canvas3Dwidget->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // Preview events: preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this); preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); -#if ENABLE_REMOVE_TABS_FROM_PLATER + view3D_canvas->Bind(EVT_GLCANVAS_INIT, [this](SimpleEvent&) { init_view_toolbar(); }); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER q->Bind(EVT_SLICING_COMPLETED, &priv::on_slicing_completed, this); q->Bind(EVT_PROCESS_COMPLETED, &priv::on_process_completed, this); -#if ENABLE_REMOVE_TABS_FROM_PLATER q->Bind(EVT_GLVIEWTOOLBAR_3D, [q](SimpleEvent&) { q->select_view_3D("3D"); }); q->Bind(EVT_GLVIEWTOOLBAR_PREVIEW, [q](SimpleEvent&) { q->select_view_3D("Preview"); }); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // Drop target: q->SetDropTarget(new PlaterDropTarget(q)); // if my understanding is right, wxWindow takes the owenership @@ -1265,9 +1150,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) update_ui_from_settings(); q->Layout(); -#if ENABLE_REMOVE_TABS_FROM_PLATER set_current_panel(view3D); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::priv::update(bool force_full_scene_refresh) @@ -1286,11 +1169,7 @@ void Plater::priv::update(bool force_full_scene_refresh) // Update the SLAPrint from the current Model, so that the reload_scene() // pulls the correct data. update_status = this->update_background_process(); -#if ENABLE_REMOVE_TABS_FROM_PLATER this->view3D->reload_scene(false, force_full_scene_refresh); -#else - this->canvas3D->reload_scene(false, force_full_scene_refresh); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER this->preview->reload_print(); if (this->printer_technology == ptSLA) this->restart_background_process(update_status); @@ -1298,7 +1177,6 @@ void Plater::priv::update(bool force_full_scene_refresh) this->schedule_background_process(); } -#if ENABLE_REMOVE_TABS_FROM_PLATER void Plater::priv::select_view(const std::string& direction) { if (current_panel == view3D) @@ -1322,20 +1200,6 @@ void Plater::priv::select_next_view_3D() else if (current_panel == preview) set_current_panel(view3D); } -#else -void Plater::priv::select_view(const std::string& direction) -{ - int page_id = notebook->GetSelection(); - if (page_id != wxNOT_FOUND) - { - const wxString& page_text = notebook->GetPageText(page_id); - if (page_text == _(L("3D"))) - this->canvas3D->select_view(direction); - else if (page_text == _(L("Preview"))) - preview->select_view(direction); - } -} -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // Called after the Preferences dialog is closed and the program settings are saved. // Update the UI based on the current preferences. @@ -1641,20 +1505,12 @@ std::unique_ptr<CheckboxFileDialog> Plater::priv::get_export_file(GUI::FileType const GLCanvas3D::Selection& Plater::priv::get_selection() const { -#if ENABLE_REMOVE_TABS_FROM_PLATER return view3D->get_canvas3d()->get_selection(); -#else - return canvas3D->get_selection(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } GLCanvas3D::Selection& Plater::priv::get_selection() { -#if ENABLE_REMOVE_TABS_FROM_PLATER return view3D->get_canvas3d()->get_selection(); -#else - return canvas3D->get_selection(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } int Plater::priv::get_selected_object_idx() const @@ -1677,7 +1533,6 @@ int Plater::priv::get_selected_volume_idx() const void Plater::priv::selection_changed() { -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->enable_toolbar_item("delete", can_delete_object()); view3D->enable_toolbar_item("more", can_increase_instances()); view3D->enable_toolbar_item("fewer", can_decrease_instances()); @@ -1686,48 +1541,24 @@ void Plater::priv::selection_changed() view3D->enable_toolbar_item("layersediting", layers_height_allowed()); // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears) view3D->render(); -#else - this->canvas3D->enable_toolbar_item("delete", can_delete_object()); - this->canvas3D->enable_toolbar_item("more", can_increase_instances()); - this->canvas3D->enable_toolbar_item("fewer", can_decrease_instances()); - this->canvas3D->enable_toolbar_item("splitobjects", can_split/*_to_objects*/()); - this->canvas3D->enable_toolbar_item("splitvolumes", can_split/*_to_volumes*/()); - this->canvas3D->enable_toolbar_item("layersediting", layers_height_allowed()); - // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears) - this->canvas3D->render(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::priv::object_list_changed() { -#if ENABLE_REMOVE_TABS_FROM_PLATER // Enable/disable buttons depending on whether there are any objects on the platter. view3D->enable_toolbar_item("deleteall", can_delete_all()); view3D->enable_toolbar_item("arrange", can_arrange()); -#else - // Enable/disable buttons depending on whether there are any objects on the platter. - this->canvas3D->enable_toolbar_item("deleteall", can_delete_all()); - this->canvas3D->enable_toolbar_item("arrange", can_arrange()); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER const bool export_in_progress = this->background_process.is_export_scheduled(); // || ! send_gcode_file.empty()); // XXX: is this right? -#if ENABLE_REMOVE_TABS_FROM_PLATER const bool model_fits = view3D->check_volumes_outside_state() == ModelInstance::PVS_Inside; -#else - const bool model_fits = this->canvas3D->check_volumes_outside_state(config) == ModelInstance::PVS_Inside; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER sidebar->enable_buttons(!model.objects.empty() && !export_in_progress && model_fits); } void Plater::priv::select_all() { -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->select_all(); -#else - this->canvas3D->select_all(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER this->sidebar->obj_list()->update_selections(); } @@ -1736,13 +1567,8 @@ void Plater::priv::remove(size_t obj_idx) // Prevent toolpaths preview from rendering while we modify the Print object preview->set_enabled(false); -#if ENABLE_REMOVE_TABS_FROM_PLATER if (view3D->is_layers_editing_enabled()) view3D->enable_layers_editing(false); -#else - if (this->canvas3D->is_layers_editing_enabled()) - this->canvas3D->enable_layers_editing(false); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER model.delete_object(obj_idx); // Delete object from Sidebar list @@ -1767,13 +1593,8 @@ void Plater::priv::reset() // Prevent toolpaths preview from rendering while we modify the Print object preview->set_enabled(false); -#if ENABLE_REMOVE_TABS_FROM_PLATER if (view3D->is_layers_editing_enabled()) view3D->enable_layers_editing(false); -#else - if (this->canvas3D->is_layers_editing_enabled()) - this->canvas3D->enable_layers_editing(false); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // Stop and reset the Print content. this->background_process.reset(); @@ -1791,11 +1612,7 @@ void Plater::priv::reset() void Plater::priv::mirror(Axis axis) { -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->mirror_selection(axis); -#else - this->canvas3D->mirror_selection(axis); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::priv::arrange() @@ -1807,11 +1624,7 @@ void Plater::priv::arrange() arranging.store(true); // Disable the arrange button (to prevent reentrancies, we will call wxYied) -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->enable_toolbar_item("arrange", can_arrange()); -#else - this->canvas3D->enable_toolbar_item("arrange", can_arrange()); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER this->background_process.stop(); unsigned count = 0; @@ -1881,11 +1694,7 @@ void Plater::priv::arrange() arranging.store(false); // We enable back the arrange button -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->enable_toolbar_item("arrange", can_arrange()); -#else - this->canvas3D->enable_toolbar_item("arrange", can_arrange()); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // Do a full refresh of scene tree, including regenerating all the GLVolumes. //FIXME The update function shall just reload the modified matrices. @@ -2022,13 +1831,8 @@ unsigned int Plater::priv::update_background_process() Print::ApplyStatus invalidated = this->background_process.apply(this->q->model(), wxGetApp().preset_bundle->full_config()); // Just redraw the 3D canvas without reloading the scene to consume the update of the layer height profile. -#if ENABLE_REMOVE_TABS_FROM_PLATER if (view3D->is_layers_editing_enabled()) view3D->get_wxglcanvas()->Refresh(); -#else - if (this->canvas3D->is_layers_editing_enabled()) - this->canvas3Dwidget->Refresh(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER if (invalidated == Print::APPLY_STATUS_INVALIDATED) { // Some previously calculated data on the Print was invalidated. @@ -2111,11 +1915,8 @@ void Plater::priv::export_gcode(fs::path output_path, PrintHostJob upload_job) // bitmask of UpdateBackgroundProcessReturnState unsigned int state = update_background_process(); if (state & priv::UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE) -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->reload_scene(false); -#else - canvas3D->reload_scene(false); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER + if ((state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) != 0) return; @@ -2133,11 +1934,8 @@ void Plater::priv::update_restart_background_process(bool force_update_scene, bo // bitmask of UpdateBackgroundProcessReturnState unsigned int state = this->update_background_process(); if (force_update_scene || (state & UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE) != 0) -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->reload_scene(false); -#else - this->canvas3D->reload_scene(false); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER + if (force_update_preview) this->preview->reload_print(); this->restart_background_process(state); @@ -2148,11 +1946,7 @@ void Plater::priv::update_fff_scene() if (this->preview != nullptr) this->preview->reload_print(); // In case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth: -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->reload_scene(true); -#else - this->canvas3D->reload_scene(true); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::priv::update_sla_scene() @@ -2225,7 +2019,6 @@ void Plater::priv::fix_through_netfabb(const int obj_idx) remove(obj_idx); } -#if ENABLE_REMOVE_TABS_FROM_PLATER void Plater::priv::set_current_panel(wxPanel* panel) { if (std::find(panels.begin(), panels.end(), panel) == panels.end()) @@ -2277,34 +2070,6 @@ void Plater::priv::set_current_panel(wxPanel* panel) current_panel->SetFocusFromKbd(); } -#else -void Plater::priv::on_notebook_changed(wxBookCtrlEvent&) -{ - wxCHECK_RET(canvas3D != nullptr, "on_notebook_changed on freed Plater"); - - const auto current_id = notebook->GetCurrentPage()->GetId(); -#if ENABLE_IMGUI - if (current_id == canvas3Dwidget->GetId()) { -#else - if (current_id == panel3d->GetId()) { -#endif // ENABLE_IMGUI - if (this->canvas3D->is_reload_delayed()) { - // Delayed loading of the 3D scene. - if (this->printer_technology == ptSLA) { - // Update the SLAPrint from the current Model, so that the reload_scene() - // pulls the correct data. - this->update_restart_background_process(true, false); - } else - this->canvas3D->reload_scene(true); - } - // sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably) - this->canvas3D->set_as_dirty(); - } else if (current_id == preview->GetId()) { - preview->reload_print(); - preview->set_canvas_as_dirty(); - } -} -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void Plater::priv::on_select_preset(wxCommandEvent &evt) { @@ -2356,11 +2121,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) this->update_fff_scene(); break; case ptSLA: -#if ENABLE_REMOVE_TABS_FROM_PLATER if (view3D->is_dragging()) -#else - if (this->canvas3D->is_dragging()) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER delayed_scene_refresh = true; else this->update_sla_scene(); @@ -2376,11 +2137,7 @@ void Plater::priv::on_slicing_completed(wxCommandEvent &) this->update_fff_scene(); break; case ptSLA: -#if ENABLE_REMOVE_TABS_FROM_PLATER if (view3D->is_dragging()) -#else - if (this->canvas3D->is_dragging()) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER delayed_scene_refresh = true; else this->update_sla_scene(); @@ -2423,11 +2180,7 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt) this->update_fff_scene(); break; case ptSLA: -#if ENABLE_REMOVE_TABS_FROM_PLATER if (view3D->is_dragging()) -#else - if (this->canvas3D->is_dragging()) -#endif // ENABLE_REMOVE_TABS_FROM_PLATER delayed_scene_refresh = true; else this->update_sla_scene(); @@ -2437,22 +2190,12 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt) void Plater::priv::on_layer_editing_toggled(bool enable) { -#if ENABLE_REMOVE_TABS_FROM_PLATER view3D->enable_layers_editing(enable); if (enable && !view3D->is_layers_editing_enabled()) { // Initialization of the OpenGL shaders failed. Disable the tool. view3D->enable_toolbar_item("layersediting", false); } view3D->set_as_dirty(); -#else - this->canvas3D->enable_layers_editing(enable); - if (enable && !this->canvas3D->is_layers_editing_enabled()) { - // Initialization of the OpenGL shaders failed. Disable the tool. - this->canvas3D->enable_toolbar_item("layersediting", false); - } - canvas3Dwidget->Refresh(); - canvas3Dwidget->Update(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::priv::on_action_add(SimpleEvent&) @@ -2473,17 +2216,10 @@ void Plater::priv::on_action_split_volumes(SimpleEvent&) void Plater::priv::on_action_layersediting(SimpleEvent&) { -#if ENABLE_REMOVE_TABS_FROM_PLATER bool enable = !view3D->is_layers_editing_enabled(); view3D->enable_layers_editing(enable); if (enable && !view3D->is_layers_editing_enabled()) view3D->enable_toolbar_item("layersediting", false); -#else - bool enable = !this->canvas3D->is_layers_editing_enabled(); - this->canvas3D->enable_layers_editing(enable); - if (enable && !this->canvas3D->is_layers_editing_enabled()) - this->canvas3D->enable_toolbar_item("layersediting", false); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::priv::on_object_select(SimpleEvent& evt) @@ -2495,17 +2231,10 @@ void Plater::priv::on_object_select(SimpleEvent& evt) void Plater::priv::on_viewport_changed(SimpleEvent& evt) { wxObject* o = evt.GetEventObject(); -#if ENABLE_REMOVE_TABS_FROM_PLATER if (o == preview->get_wxglcanvas()) preview->set_viewport_into_scene(view3D->get_canvas3d()); else if (o == view3D->get_wxglcanvas()) preview->set_viewport_from_scene(view3D->get_canvas3d()); -#else - if (o == preview->get_wxglcanvas()) - preview->set_viewport_into_scene(canvas3D); - else if (o == canvas3Dwidget) - preview->set_viewport_from_scene(canvas3D); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::priv::on_right_click(Vec2dEvent& evt) @@ -2685,7 +2414,6 @@ bool Plater::priv::complit_init_part_menu() return true; } -#if ENABLE_REMOVE_TABS_FROM_PLATER void Plater::priv::init_view_toolbar() { ItemsIconsTexture::Metadata icons_data; @@ -2735,7 +2463,6 @@ void Plater::priv::init_view_toolbar() view3D->set_view_toolbar(&view_toolbar); preview->set_view_toolbar(&view_toolbar); } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER bool Plater::priv::can_delete_object() const { @@ -2780,11 +2507,7 @@ bool Plater::priv::can_split() const bool Plater::priv::layers_height_allowed() const { int obj_idx = get_selected_object_idx(); -#if ENABLE_REMOVE_TABS_FROM_PLATER return (0 <= obj_idx) && (obj_idx < (int)model.objects.size()) && config->opt_bool("variable_layer_height") && view3D->is_layers_editing_allowed(); -#else - return (0 <= obj_idx) && (obj_idx < (int)model.objects.size()) && config->opt_bool("variable_layer_height") && this->canvas3D->is_layers_editing_allowed(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } bool Plater::priv::can_delete_all() const @@ -2817,10 +2540,6 @@ Plater::Plater(wxWindow *parent, MainFrame *main_frame) Plater::~Plater() { -#if !ENABLE_REMOVE_TABS_FROM_PLATER - _3DScene::remove_canvas(p->canvas3Dwidget); - p->canvas3D = nullptr; -#endif // !ENABLE_REMOVE_TABS_FROM_PLATER } Sidebar& Plater::sidebar() { return *p->sidebar; } @@ -2881,9 +2600,7 @@ void Plater::update_ui_from_settings() { p->update_ui_from_settings(); } void Plater::select_view(const std::string& direction) { p->select_view(direction); } -#if ENABLE_REMOVE_TABS_FROM_PLATER void Plater::select_view_3D(const std::string& name) { p->select_view_3D(name); } -#endif // ENABLE_REMOVE_TABS_FROM_PLATER void Plater::select_all() { p->select_all(); } @@ -2894,11 +2611,7 @@ void Plater::delete_object_from_model(size_t obj_idx) { p->delete_object_from_mo void Plater::remove_selected() { -#if ENABLE_REMOVE_TABS_FROM_PLATER this->p->view3D->delete_selected(); -#else - this->p->canvas3D->delete_selected(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } void Plater::increase_instances(size_t num) @@ -3127,11 +2840,7 @@ void Plater::reslice() // bitmask of UpdateBackgroundProcessReturnState unsigned int state = this->p->update_background_process(); if (state & priv::UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE) -#if ENABLE_REMOVE_TABS_FROM_PLATER this->p->view3D->reload_scene(false); -#else - this->p->canvas3D->reload_scene(false); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER // Only restarts if the state is valid. this->p->restart_background_process(state | priv::UPDATE_BACKGROUND_PROCESS_FORCE_RESTART); } @@ -3196,11 +2905,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) if (opt_key == "printer_technology") this->set_printer_technology(config.opt_enum<PrinterTechnology>(opt_key)); else if (opt_key == "bed_shape") { -#if ENABLE_REMOVE_TABS_FROM_PLATER if (p->view3D) p->view3D->set_bed_shape(p->config->option<ConfigOptionPoints>(opt_key)->values); -#else - this->p->canvas3D->set_bed_shape(p->config->option<ConfigOptionPoints>(opt_key)->values); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER if (p->preview) p->preview->set_bed_shape(p->config->option<ConfigOptionPoints>(opt_key)->values); update_scheduled = true; } @@ -3211,24 +2916,12 @@ void Plater::on_config_change(const DynamicPrintConfig &config) } else if(opt_key == "variable_layer_height") { if (p->config->opt_bool("variable_layer_height") != true) { -#if ENABLE_REMOVE_TABS_FROM_PLATER p->view3D->enable_toolbar_item("layersediting", false); p->view3D->enable_layers_editing(false); p->view3D->set_as_dirty(); -#else - p->canvas3D->enable_toolbar_item("layersediting", false); - p->canvas3D->enable_layers_editing(0); - p->canvas3Dwidget->Refresh(); - p->canvas3Dwidget->Update(); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } -#if ENABLE_REMOVE_TABS_FROM_PLATER else if (p->view3D->is_layers_editing_allowed()) { p->view3D->enable_toolbar_item("layersediting", true); -#else - else if (p->canvas3D->is_layers_editing_allowed()) { - p->canvas3D->enable_toolbar_item("layersediting", true); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } } else if(opt_key == "extruder_colour") { @@ -3238,11 +2931,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) update_scheduled = true; } else if(opt_key == "printer_model") { // update to force bed selection(for texturing) -#if ENABLE_REMOVE_TABS_FROM_PLATER if (p->view3D) p->view3D->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values); -#else - p->canvas3D->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER if (p->preview) p->preview->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values); update_scheduled = true; } else if (opt_key == "host_type" && this->p->printer_technology == ptSLA) { @@ -3284,11 +2973,7 @@ bool Plater::is_single_full_object_selection() const GLCanvas3D* Plater::canvas3D() { -#if ENABLE_REMOVE_TABS_FROM_PLATER return p->view3D->get_canvas3d(); -#else - return p->canvas3D; -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } PrinterTechnology Plater::printer_technology() const @@ -3324,11 +3009,7 @@ void Plater::changed_object(int obj_idx) // pulls the correct data, update the 3D scene. this->p->update_restart_background_process(true, false); } else -#if ENABLE_REMOVE_TABS_FROM_PLATER p->view3D->reload_scene(false); -#else - p->canvas3D->reload_scene(false); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER } // update print diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 334ab740a..f433d655d 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -119,9 +119,8 @@ public: void update(); void select_view(const std::string& direction); -#if ENABLE_REMOVE_TABS_FROM_PLATER void select_view_3D(const std::string& name); -#endif // ENABLE_REMOVE_TABS_FROM_PLATER + // Called after the Preferences dialog is closed and the program settings are saved. // Update the UI based on the current preferences. void update_ui_from_settings();