Thu, 09 Feb 2017 11:53:55 +0200
Created a new GLRenderer derivative class "Canvas" and made MainWindow use it
CMakeLists.txt | file | annotate | diff | comparison | revisions | |
src/canvas.cpp | file | annotate | diff | comparison | revisions | |
src/canvas.h | file | annotate | diff | comparison | revisions | |
src/dialogs/configdialog.cpp | file | annotate | diff | comparison | revisions | |
src/glRenderer.cpp | file | annotate | diff | comparison | revisions | |
src/ldDocument.cpp | file | annotate | diff | comparison | revisions | |
src/ldObject.cpp | file | annotate | diff | comparison | revisions | |
src/mainwindow.cpp | file | annotate | diff | comparison | revisions | |
src/mainwindow.h | file | annotate | diff | comparison | revisions | |
src/toolsets/basictoolset.cpp | file | annotate | diff | comparison | revisions | |
src/toolsets/filetoolset.cpp | file | annotate | diff | comparison | revisions | |
src/toolsets/movetoolset.cpp | file | annotate | diff | comparison | revisions | |
src/toolsets/viewtoolset.cpp | file | annotate | diff | comparison | revisions |
--- a/CMakeLists.txt Thu Feb 09 01:08:57 2017 +0200 +++ b/CMakeLists.txt Thu Feb 09 11:53:55 2017 +0200 @@ -28,6 +28,7 @@ set (LDFORGE_SOURCES src/basics.cpp + src/canvas.cpp src/colors.cpp src/crashCatcher.cpp src/dialogs.cpp @@ -82,6 +83,7 @@ set (LDFORGE_HEADERS src/basics.h + src/canvas.h src/colors.h src/crashCatcher.h src/dialogs.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/canvas.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -0,0 +1,26 @@ +/* + * LDForge: LDraw parts authoring CAD + * Copyright (C) 2013 - 2017 Teemu Piippo + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "canvas.h" +#include "ldDocument.h" + +Canvas::Canvas(LDDocument* document, QWidget* parent) : + GLRenderer {document, parent} +{ + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/canvas.h Thu Feb 09 11:53:55 2017 +0200 @@ -0,0 +1,26 @@ +/* + * LDForge: LDraw parts authoring CAD + * Copyright (C) 2013 - 2017 Teemu Piippo + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once +#include "glRenderer.h" + +class Canvas : public GLRenderer +{ +public: + Canvas(LDDocument* document, QWidget* parent = nullptr); +};
--- a/src/dialogs/configdialog.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/dialogs/configdialog.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -34,7 +34,7 @@ #include "../main.h" #include "../ldDocument.h" #include "../miscallenous.h" -#include "../glRenderer.h" +#include "../canvas.h" #include "../guiutilities.h" #include "../documentmanager.h" #include "colorselector.h"
--- a/src/glRenderer.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/glRenderer.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -1302,7 +1302,7 @@ ref->setFileInfo (m_documents->getDocumentByName (primitiveName)); currentDocument()->addToSelection(ref); m_window->buildObjectList(); - m_window->renderer()->refresh(); + refresh(); ev->acceptProposedAction(); } }
--- a/src/ldDocument.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/ldDocument.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -21,6 +21,7 @@ #include "ldDocument.h" #include "miscallenous.h" #include "mainwindow.h" +#include "canvas.h" #include "glCompiler.h" #include "documentloader.h" #include "dialogs/openprogressdialog.h"
--- a/src/ldObject.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/ldObject.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -23,7 +23,7 @@ #include "miscallenous.h" #include "mainwindow.h" #include "editHistory.h" -#include "glRenderer.h" +#include "canvas.h" #include "colors.h" #include "glCompiler.h"
--- a/src/mainwindow.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/mainwindow.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -23,7 +23,7 @@ #include <QPushButton> #include <QSettings> #include "main.h" -#include "glRenderer.h" +#include "canvas.h" #include "mainwindow.h" #include "ldDocument.h" #include "miscallenous.h" @@ -959,9 +959,9 @@ // --------------------------------------------------------------------------------------------------------------------- // -GLRenderer* MainWindow::renderer() +Canvas* MainWindow::renderer() { - return static_cast<GLRenderer*>(ui.rendererStack->currentWidget()); + return static_cast<Canvas*>(ui.rendererStack->currentWidget()); } // --------------------------------------------------------------------------------------------------------------------- @@ -1172,7 +1172,7 @@ return; m_currentDocument = document; - GLRenderer* renderer = getRendererForDocument(document); + Canvas* renderer = getRendererForDocument(document); ui.rendererStack->setCurrentWidget(renderer); if (document) @@ -1188,14 +1188,14 @@ /* * Returns the associated renderer for the given document */ -GLRenderer* MainWindow::getRendererForDocument(LDDocument *document) +Canvas* MainWindow::getRendererForDocument(LDDocument *document) { - GLRenderer* renderer = m_renderers.value(document); + Canvas* renderer = m_renderers.value(document); if (not renderer) { print("MainWindow: Couldn't find a renderer for %1, creating one now", document->getDisplayName()); - renderer = new GLRenderer {document, this}; + renderer = new Canvas {document, this}; print("Created renderer: %1", renderer); m_renderers[document] = renderer; ui.rendererStack->addWidget(renderer); @@ -1214,7 +1214,7 @@ if (currentDocument() == document) currentDocumentClosed(); - GLRenderer* renderer = m_renderers.value(document); + Canvas* renderer = m_renderers.value(document); if (renderer) {
--- a/src/mainwindow.h Thu Feb 09 01:08:57 2017 +0200 +++ b/src/mainwindow.h Thu Feb 09 11:53:55 2017 +0200 @@ -32,7 +32,7 @@ class MainWindow; class QToolButton; class QDialogButtonBox; -class GLRenderer; +class Canvas; class QComboBox; class QProgressBar; class Toolset; @@ -87,7 +87,7 @@ QTreeWidget* getPrimitivesTree() const; class QSettings* getSettings() { return m_settings; } LDColor getUniformSelectedColor(); - GLRenderer* getRendererForDocument(LDDocument* document); + Canvas* getRendererForDocument(LDDocument* document); Grid* grid(); class GuiUtilities* guiUtilities(); void loadShortcuts(); @@ -96,7 +96,7 @@ LDDocument* newDocument (bool cache = false); void openDocumentForEditing(LDDocument* document); PrimitiveManager* primitives(); - GLRenderer* renderer(); + Canvas* renderer(); void refresh(); void refreshObjectList(); bool ringToolHiRes() const; @@ -138,7 +138,7 @@ Configuration& m_config; class GuiUtilities* m_guiUtilities; MessageManager* m_messageLog = nullptr; - QMap<LDDocument*, GLRenderer*> m_renderers; + QMap<LDDocument*, Canvas*> m_renderers; PrimitiveManager* m_primitives; Grid* m_grid; MathFunctions* m_mathFunctions;
--- a/src/toolsets/basictoolset.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/toolsets/basictoolset.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -22,7 +22,7 @@ #include <QDialogButtonBox> #include <QTextEdit> #include <QVBoxLayout> -#include "../glRenderer.h" +#include "../canvas.h" #include "../ldDocument.h" #include "../ldObject.h" #include "../ldobjectiterator.h"
--- a/src/toolsets/filetoolset.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/toolsets/filetoolset.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -19,7 +19,7 @@ #include <QFileDialog> #include <QMessageBox> #include "../dialogs.h" -#include "../glRenderer.h" +#include "../canvas.h" #include "../ldDocument.h" #include "../mainwindow.h" #include "../partdownloader.h"
--- a/src/toolsets/movetoolset.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/toolsets/movetoolset.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -23,7 +23,7 @@ #include "movetoolset.h" #include "ui_rotpoint.h" #include "../grid.h" -#include "../glRenderer.h" +#include "../canvas.h" MoveToolset::MoveToolset (MainWindow* parent) : Toolset (parent) {}
--- a/src/toolsets/viewtoolset.cpp Thu Feb 09 01:08:57 2017 +0200 +++ b/src/toolsets/viewtoolset.cpp Thu Feb 09 11:53:55 2017 +0200 @@ -21,7 +21,7 @@ #include "../mainwindow.h" #include "../ldDocument.h" #include "../miscallenous.h" -#include "../glRenderer.h" +#include "../canvas.h" #include "../primitives.h" #include "../colors.h" #include "../dialogs.h"