From 06f44a9e4b7962e910f3c9a65276b04ffe160e37 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 27 Jun 2018 12:49:38 +0200 Subject: Code cleanup --- xs/src/slic3r/GUI/3DScene.cpp | 17 -------- xs/src/slic3r/GUI/3DScene.hpp | 6 --- xs/src/slic3r/GUI/GLCanvas3D.cpp | 75 --------------------------------- xs/src/slic3r/GUI/GLCanvas3D.hpp | 14 ------ xs/src/slic3r/GUI/GLCanvas3DManager.cpp | 61 --------------------------- xs/src/slic3r/GUI/GLCanvas3DManager.hpp | 8 ---- 6 files changed, 181 deletions(-) (limited to 'xs') diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index ac2304c69..09e10ac28 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -1754,23 +1754,6 @@ bool _3DScene::init(wxGLCanvas* canvas) return s_canvas_mgr.init(canvas); } -//################################################################################################################# -//bool _3DScene::set_current(wxGLCanvas* canvas, bool force) -//{ -// return s_canvas_mgr.set_current(canvas, force); -//} -// -//void _3DScene::reset_current_canvas() -//{ -// s_canvas_mgr.set_current(nullptr, false); -//} -// -//void _3DScene::set_active(wxGLCanvas* canvas, bool active) -//{ -// s_canvas_mgr.set_active(canvas, active); -//} -//################################################################################################################# - void _3DScene::set_as_dirty(wxGLCanvas* canvas) { s_canvas_mgr.set_as_dirty(canvas); diff --git a/xs/src/slic3r/GUI/3DScene.hpp b/xs/src/slic3r/GUI/3DScene.hpp index d34a79ee3..9016f984d 100644 --- a/xs/src/slic3r/GUI/3DScene.hpp +++ b/xs/src/slic3r/GUI/3DScene.hpp @@ -516,12 +516,6 @@ public: static bool init(wxGLCanvas* canvas); -//################################################################################################################# -// static bool set_current(wxGLCanvas* canvas, bool force); -// static void reset_current_canvas(); -// -// static void set_active(wxGLCanvas* canvas, bool active); -//################################################################################################################# static void set_as_dirty(wxGLCanvas* canvas); static unsigned int get_volumes_count(wxGLCanvas* canvas); diff --git a/xs/src/slic3r/GUI/GLCanvas3D.cpp b/xs/src/slic3r/GUI/GLCanvas3D.cpp index e3a3b1572..adea27fa4 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.cpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.cpp @@ -1408,23 +1408,14 @@ GLGizmoBase* GLCanvas3D::Gizmos::_get_current() const return (it != m_gizmos.end()) ? it->second : nullptr; } -//################################################################################################################# GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) -//GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context) -//################################################################################################################# : m_canvas(canvas) -//################################################################################################################# , m_context(nullptr) -// , m_context(context) -//################################################################################################################# , m_timer(nullptr) , m_config(nullptr) , m_print(nullptr) , m_model(nullptr) , m_dirty(true) -//################################################################################################################# -// , m_active(true) -//################################################################################################################# , m_initialized(false) , m_use_VBOs(false) , m_force_zoom_to_bed_enabled(false) @@ -1441,16 +1432,11 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) , m_drag_by("instance") , m_reload_delayed(false) { -//################################################################################################################# if (m_canvas != nullptr) { m_context = new wxGLContext(m_canvas); m_timer = new wxTimer(m_canvas); } - -// if (m_canvas != nullptr) -// m_timer = new wxTimer(m_canvas); -//################################################################################################################# } GLCanvas3D::~GLCanvas3D() @@ -1463,13 +1449,11 @@ GLCanvas3D::~GLCanvas3D() m_timer = nullptr; } -//################################################################################################################# if (m_context != nullptr) { delete m_context; m_context = nullptr; } -//################################################################################################################# _deregister_callbacks(); } @@ -1479,10 +1463,8 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl) if (m_initialized) return true; -//################################################################################################################# if ((m_canvas == nullptr) || (m_context == nullptr)) return false; -//################################################################################################################# ::glClearColor(1.0f, 1.0f, 1.0f, 1.0f); ::glClearDepth(1.0f); @@ -1549,32 +1531,14 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl) return true; } -//################################################################################################################# bool GLCanvas3D::set_current() { if ((m_canvas != nullptr) && (m_context != nullptr)) -// if (m_active && (m_canvas != nullptr) && (m_context != nullptr)) return m_canvas->SetCurrent(*m_context); return false; } -//bool GLCanvas3D::set_current(bool force) -//{ -// if ((force || m_active) && (m_canvas != nullptr) && (m_context != nullptr)) -// return m_canvas->SetCurrent(*m_context); -// -// return false; -//} -//################################################################################################################# - -//################################################################################################################# -//void GLCanvas3D::set_active(bool active) -//{ -// m_active = active; -//} -//################################################################################################################# - void GLCanvas3D::set_as_dirty() { m_dirty = true; @@ -1591,10 +1555,7 @@ void GLCanvas3D::reset_volumes() if (!m_volumes.empty()) { // ensures this canvas is current -//################################################################################################################# if (!set_current()) -// if ((m_canvas == nullptr) || !_3DScene::set_current(m_canvas, true)) -//################################################################################################################# return; m_volumes.release_geometry(); @@ -1701,9 +1662,7 @@ void GLCanvas3D::set_bed_shape(const Pointfs& shape) m_axes.origin = Pointf3(0.0, 0.0, (coordf_t)GROUND_Z); set_axes_length(0.3f * (float)m_bed.get_bounding_box().max_size()); -//########################################################################################################################### m_dirty = true; -//########################################################################################################################### } void GLCanvas3D::set_auto_bed_shape() @@ -1899,10 +1858,7 @@ void GLCanvas3D::render() return; // ensures this canvas is current and initialized -//################################################################################################################# if (!set_current() || !_3DScene::init(m_canvas)) -// if (!_3DScene::set_current(m_canvas, false) || !_3DScene::init(m_canvas)) -//################################################################################################################# return; if (m_force_zoom_to_bed_enabled) @@ -1985,10 +1941,7 @@ void GLCanvas3D::reload_scene(bool force) reset_volumes(); // ensures this canvas is current -//################################################################################################################# if (!set_current()) -// if (!_3DScene::set_current(m_canvas, true)) -//################################################################################################################# return; set_bed_shape(dynamic_cast(m_config->option("bed_shape"))->values); @@ -2063,10 +2016,7 @@ void GLCanvas3D::reload_scene(bool force) void GLCanvas3D::load_print_toolpaths() { // ensures this canvas is current -//################################################################################################################# if (!set_current()) -// if (!_3DScene::set_current(m_canvas, true)) -//################################################################################################################# return; if (m_print == nullptr) @@ -2434,10 +2384,7 @@ void GLCanvas3D::load_gcode_preview(const GCodePreviewData& preview_data, const if ((m_canvas != nullptr) && (m_print != nullptr)) { // ensures that this canvas is current -//################################################################################################################# if (!set_current()) -// if (!_3DScene::set_current(m_canvas, true)) -//################################################################################################################# return; if (m_volumes.empty()) @@ -2754,15 +2701,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) #endif } else if (evt.LeftDClick() && (m_hover_volume_id != -1)) - { -//################################################################################################################# -// m_active = false; -//################################################################################################################# m_on_double_click_callback.call(); -//################################################################################################################# -// m_active = true; -//################################################################################################################# - } else if (evt.LeftDown() || evt.RightDown()) { // If user pressed left or right button we first check whether this happened @@ -2858,15 +2797,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) { // if right clicking on volume, propagate event through callback if (m_volumes.volumes[volume_idx]->hover) - { -//################################################################################################################# -// m_active = false; -//################################################################################################################# m_on_right_click_callback.call(pos.x, pos.y); -//################################################################################################################# -// m_active = true; -//################################################################################################################# - } } } } @@ -3073,10 +3004,7 @@ Point GLCanvas3D::get_local_mouse_position() const bool GLCanvas3D::_is_shown_on_screen() const { -//################################################################################################################# return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false; -// return (m_canvas != nullptr) ? m_active && m_canvas->IsShownOnScreen() : false; -//################################################################################################################# } void GLCanvas3D::_force_zoom_to_bed() @@ -3091,10 +3019,7 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h) return; // ensures that this canvas is current -//################################################################################################################# set_current(); -// _3DScene::set_current(m_canvas, false); -//################################################################################################################# ::glViewport(0, 0, w, h); ::glMatrixMode(GL_PROJECTION); diff --git a/xs/src/slic3r/GUI/GLCanvas3D.hpp b/xs/src/slic3r/GUI/GLCanvas3D.hpp index 2ab7863aa..b0706a05d 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.hpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.hpp @@ -401,11 +401,6 @@ private: Model* m_model; bool m_dirty; -//################################################################################################################# -// // the active member has been introduced to overcome a bug in wxWidgets method IsShownOnScreen() which always return true -// // when a window is inside a wxNotebook -// bool m_active; -//################################################################################################################# bool m_initialized; bool m_use_VBOs; bool m_force_zoom_to_bed_enabled; @@ -446,22 +441,13 @@ private: PerlCallback m_on_gizmo_scale_uniformly_callback; public: -//################################################################################################################# GLCanvas3D(wxGLCanvas* canvas); -// GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context); -//################################################################################################################# ~GLCanvas3D(); bool init(bool useVBOs, bool use_legacy_opengl); -//################################################################################################################# bool set_current(); -// bool set_current(bool force); -//################################################################################################################# -//################################################################################################################# -// void set_active(bool active); -//################################################################################################################# void set_as_dirty(); unsigned int get_volumes_count() const; diff --git a/xs/src/slic3r/GUI/GLCanvas3DManager.cpp b/xs/src/slic3r/GUI/GLCanvas3DManager.cpp index 660f1f41f..f817e7739 100644 --- a/xs/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/xs/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -114,25 +114,13 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten } GLCanvas3DManager::GLCanvas3DManager() -//################################################################################################################# : m_current(nullptr) -// : m_context(nullptr) -// , m_current(nullptr) -//################################################################################################################# , m_gl_initialized(false) , m_use_legacy_opengl(false) , m_use_VBOs(false) { } -GLCanvas3DManager::~GLCanvas3DManager() -{ -//################################################################################################################# -// if (m_context != nullptr) -// delete m_context; -//################################################################################################################# -} - bool GLCanvas3DManager::add(wxGLCanvas* canvas) { if (canvas == nullptr) @@ -141,19 +129,7 @@ bool GLCanvas3DManager::add(wxGLCanvas* canvas) if (_get_canvas(canvas) != m_canvases.end()) return false; -//################################################################################################################# -// if (m_context == nullptr) -// { -// m_context = new wxGLContext(canvas); -// if (m_context == nullptr) -// return false; -// } -//################################################################################################################# - -//################################################################################################################# GLCanvas3D* canvas3D = new GLCanvas3D(canvas); -// GLCanvas3D* canvas3D = new GLCanvas3D(canvas, m_context); -//################################################################################################################# if (canvas3D == nullptr) return false; @@ -223,43 +199,6 @@ bool GLCanvas3DManager::init(wxGLCanvas* canvas) return false; } -//################################################################################################################# -//bool GLCanvas3DManager::set_current(wxGLCanvas* canvas, bool force) -//{ -// // given canvas is already current, return -// if (m_current == canvas) -// return true; -// -// if (canvas == nullptr) -// { -// m_current = nullptr; -// return true; -// } -// -// // set given canvas as current -// CanvasesMap::iterator it = _get_canvas(canvas); -// if (it != m_canvases.end()) -// { -// bool res = it->second->set_current(force); -// if (res) -// { -// m_current = canvas; -// return true; -// } -// } -// -// m_current = nullptr; -// return false; -//} -// -//void GLCanvas3DManager::set_active(wxGLCanvas* canvas, bool active) -//{ -// CanvasesMap::iterator it = _get_canvas(canvas); -// if (it != m_canvases.end()) -// it->second->set_active(active); -//} -//################################################################################################################# - void GLCanvas3DManager::set_as_dirty(wxGLCanvas* canvas) { CanvasesMap::iterator it = _get_canvas(canvas); diff --git a/xs/src/slic3r/GUI/GLCanvas3DManager.hpp b/xs/src/slic3r/GUI/GLCanvas3DManager.hpp index c5b03a553..9d9285601 100644 --- a/xs/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/xs/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -43,9 +43,6 @@ class GLCanvas3DManager typedef std::map CanvasesMap; -//################################################################################################################# -// wxGLContext* m_context; -//################################################################################################################# CanvasesMap m_canvases; wxGLCanvas* m_current; GLInfo m_gl_info; @@ -55,7 +52,6 @@ class GLCanvas3DManager public: GLCanvas3DManager(); - ~GLCanvas3DManager(); bool add(wxGLCanvas* canvas); bool remove(wxGLCanvas* canvas); @@ -72,10 +68,6 @@ public: bool init(wxGLCanvas* canvas); -//################################################################################################################# -// bool set_current(wxGLCanvas* canvas, bool force); -// void set_active(wxGLCanvas* canvas, bool active); -//################################################################################################################# void set_as_dirty(wxGLCanvas* canvas); unsigned int get_volumes_count(wxGLCanvas* canvas) const; -- cgit v1.2.3