--- a/src/glRenderer.cpp Wed Feb 08 17:07:19 2017 +0200 +++ b/src/glRenderer.cpp Thu Feb 09 00:32:24 2017 +0200 @@ -67,21 +67,29 @@ // ============================================================================= // -GLRenderer::GLRenderer (QWidget* parent) : - QGLWidget (parent), - HierarchyElement (parent) +GLRenderer::GLRenderer(LDDocument* document, QWidget* parent) : + QGLWidget {parent}, + HierarchyElement {parent}, + m_document {document} { m_camera = (Camera) m_config->camera(); m_currentEditMode = AbstractEditMode::createByType (this, EditModeType::Select); m_compiler = new GLCompiler (this); - m_messageLog = new MessageManager (this); - m_messageLog->setRenderer (this); m_toolTipTimer = new QTimer (this); m_toolTipTimer->setSingleShot (true); m_thinBorderPen = QPen (QColor (0, 0, 0, 208), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); m_thinBorderPen.setWidth (1); setAcceptDrops (true); connect (m_toolTipTimer, SIGNAL (timeout()), this, SLOT (slot_toolTipTimer())); + initOverlaysFromObjects(); + + if (not currentDocumentData().init) + { + resetAllAngles(); + currentDocumentData().init = true; + } + + currentDocumentData().needZoomToFit = true; // Init camera icons for (Camera camera : iterateEnum<Camera>()) @@ -105,9 +113,6 @@ // GLRenderer::~GLRenderer() { - if (messageLog()) - messageLog()->setRenderer (nullptr); - m_compiler->setRenderer (nullptr); delete m_compiler; delete m_currentEditMode; @@ -178,11 +183,6 @@ m_isDrawOnly = value; } -MessageManager* GLRenderer::messageLog() const -{ - return m_messageLog; -} - LDDocument* GLRenderer::document() const { return m_document; @@ -682,13 +682,13 @@ } // Message log - if (messageLog()) + if (m_window->messageLog()) { int y = 0; int margin = 2; QColor penColor = textPen().color(); - for (const MessageManager::Line& line : messageLog()->getLines()) + for (const MessageManager::Line& line : m_window->messageLog()->getLines()) { penColor.setAlphaF(line.alpha); painter.setPen(penColor); @@ -880,7 +880,6 @@ { m_camera = camera; m_config->setCamera(int {camera}); - m_window->updateEditModeActions(); } } @@ -1023,26 +1022,6 @@ // ============================================================================= // -void GLRenderer::setDocument (LDDocument* document) -{ - m_document = document; - - if (document) - { - initOverlaysFromObjects(); - - if (not currentDocumentData().init) - { - resetAllAngles(); - currentDocumentData().init = true; - } - - currentDocumentData().needZoomToFit = true; - } -} - -// ============================================================================= -// void GLRenderer::setPicking(bool value) { m_isDrawingSelectionScene = value;