From dc46eea24d37311e28bc5830e899a77a625a075e Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Fri, 27 Jul 2018 13:46:44 +0100 Subject: gui: allow building for ECP5 and on Windows --- gui/fpgaviewwidget.h | 20 ++++++++++++++++++++ gui/quadtree.h | 10 +++++----- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index 690b12b8..73021dbe 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -143,12 +143,32 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions Inner(WireId _wire) : wire(_wire) {} Inner(PipId _pip) : pip(_pip) {} Inner(GroupId _group) : group(_group) {} + Inner() {} } element; float x, y; // Decal X and Y PickedElement(BelId bel, float x, float y) : type(ElementType::BEL), element(bel), x(x), y(y) {} PickedElement(WireId wire, float x, float y) : type(ElementType::WIRE), element(wire), x(x), y(y) {} PickedElement(PipId pip, float x, float y) : type(ElementType::PIP), element(pip), x(x), y(y) {} PickedElement(GroupId group, float x, float y) : type(ElementType::GROUP), element(group), x(x), y(y) {} + PickedElement(const PickedElement &other) : type(other.type) + { + switch (type) { + case ElementType::BEL: + element.bel = other.element.bel; + break; + case ElementType::WIRE: + element.wire = other.element.wire; + break; + case ElementType::PIP: + element.pip = other.element.pip; + break; + case ElementType::GROUP: + element.group = other.element.group; + break; + default: + NPNR_ASSERT_FALSE("Invalid ElementType"); + } + } DecalXY decal(Context *ctx) const { diff --git a/gui/quadtree.h b/gui/quadtree.h index 22065c2f..b3ebf81c 100644 --- a/gui/quadtree.h +++ b/gui/quadtree.h @@ -157,7 +157,7 @@ template class QuadTreeNode // - any of the 4 children nodes. enum Quadrant { - THIS = -1, + THIS_NODE = -1, NW = 0, NE = 1, SW = 2, @@ -171,7 +171,7 @@ template class QuadTreeNode Quadrant quadrant(const BoundingBox &b) const { if (children_ == nullptr) { - return THIS; + return THIS_NODE; } bool west0 = b.x0_ < splitx_; @@ -187,7 +187,7 @@ template class QuadTreeNode return SW; if (!west0 && !west1 && !north0 && !north1) return SE; - return THIS; + return THIS_NODE; } // Checks whether this node should split. @@ -252,7 +252,7 @@ template class QuadTreeNode // Put the element either recursively into a child if it fits // entirely or keep it for ourselves if not. auto quad = quadrant(k); - if (quad == THIS) { + if (quad == THIS_NODE) { elems_.push_back(BoundElement(k, std::move(v))); } else { return children_[quad].insert(k, std::move(v)); @@ -286,7 +286,7 @@ template class QuadTreeNode auto it = elems_.begin(); while (it != elems_.end()) { auto quad = quadrant(it->bb_); - if (quad != THIS) { + if (quad != THIS_NODE) { // Move to one of the children. if (!children_[quad].insert(it->bb_, std::move(it->elem_))) return false; -- cgit v1.2.3