--- a/src/ui/canvas.cpp Wed May 25 20:36:34 2022 +0300 +++ b/src/ui/canvas.cpp Mon Jun 06 22:01:22 2022 +0300 @@ -1,12 +1,11 @@ #include <QMouseEvent> #include <QPainter> -#include "modeleditor.h" #include "document.h" #include "canvas.h" Canvas::Canvas( Model* model, - Document *document, + EditorTabWidget *document, DocumentManager* documents, const ldraw::ColorTable& colorTable, QWidget* parent) : @@ -21,9 +20,9 @@ * @param selectedIds IDs of objects to select * @param deselectedIds IDs of objects to deselect. */ -void Canvas::handleSelectionChange(const QSet<ldraw::id_t>& selectedIds, const QSet<ldraw::id_t>& deselectedIds) +void Canvas::handleSelectionChange(const QSet<ModelId> &selectedIds, const QSet<ModelId> &deselectedIds) { - Q_ASSERT(not selectedIds.contains(ldraw::NULL_ID)); + Q_ASSERT(not selectedIds.contains({0})); this->selection.subtract(deselectedIds); this->selection.unite(selectedIds); gl::setModelShaderSelectedObjects(&this->shaders, this->selection); @@ -34,7 +33,7 @@ * @brief Updates vertex rendering * @param document Document to get vertices from */ -void Canvas::rebuildVertices(Document* document) +void Canvas::rebuildVertices(EditorTabWidget* document) { if (this->vertexProgram.has_value()) { @@ -45,7 +44,7 @@ void Canvas::mouseMoveEvent(QMouseEvent* event) { - const ldraw::id_t id = this->pick(event->pos()); + const ModelId id = this->pick(event->pos()); this->highlighted = id; this->totalMouseMove += (event->pos() - this->lastMousePosition).manhattanLength(); this->worldPosition = this->screenToModelCoordinates(event->pos(), this->gridPlane); @@ -339,7 +338,7 @@ /** * @returns the ids of the currently selected objects */ -const QSet<ldraw::id_t> Canvas::selectedObjects() const +const QSet<ModelId> Canvas::selectedObjects() const { return this->selection; }