gui: allow selecting pips

This commit is contained in:
Sergiusz Bazanski 2018-07-27 02:28:01 +01:00
parent e1dfbc0241
commit 96608c8d07
5 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@
* nextpnr -- Next Generation Place and Route
*
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
* Copyright (C) 2018 Serge Bazanski <q3k@symbioticeda.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -84,6 +85,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
SLOT(onSelectedArchItem(std::vector<DecalXY>, bool)));
connect(fpgaView, SIGNAL(clickedBel(BelId, bool)), designview, SLOT(onClickedBel(BelId, bool)));
connect(fpgaView, SIGNAL(clickedWire(WireId, bool)), designview, SLOT(onClickedWire(WireId, bool)));
connect(fpgaView, SIGNAL(clickedPip(PipId, bool)), designview, SLOT(onClickedPip(PipId, bool)));
connect(designview, SIGNAL(highlight(std::vector<DecalXY>, int)), fpgaView,
SLOT(onHighlightGroupChanged(std::vector<DecalXY>, int)));

View File

@ -2,6 +2,7 @@
* nextpnr -- Next Generation Place and Route
*
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
* Copyright (C) 2018 Serge Bazanski <q3k@symbioticeda.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -521,6 +522,13 @@ void DesignWidget::onClickedWire(WireId wire, bool keep)
Q_EMIT selected(getDecals(ElementType::WIRE, ctx->getWireName(wire)), keep);
}
void DesignWidget::onClickedPip(PipId pip, bool keep)
{
QTreeWidgetItem *item = nameToItem[getElementIndex(ElementType::PIP)].value(ctx->getPipName(pip).c_str(ctx));
treeWidget->setCurrentItem(item);
Q_EMIT selected(getDecals(ElementType::PIP, ctx->getPipName(pip)), keep);
}
void DesignWidget::onItemSelectionChanged()
{
if (treeWidget->selectedItems().size() == 0)

View File

@ -77,6 +77,7 @@ class DesignWidget : public QWidget
void updateTree();
void onClickedBel(BelId bel, bool keep);
void onClickedWire(WireId wire, bool keep);
void onClickedPip(PipId pip, bool keep);
private:
Context *ctx;

View File

@ -592,6 +592,8 @@ void FPGAViewWidget::mousePressEvent(QMouseEvent *event)
clickedBel(closest.element.bel, ctrl);
} else if (closest.type == ElementType::WIRE) {
clickedWire(closest.element.wire, ctrl);
} else if (closest.type == ElementType::PIP) {
clickedPip(closest.element.pip, ctrl);
}
}
}

View File

@ -121,6 +121,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
Q_SIGNALS:
void clickedBel(BelId bel, bool add);
void clickedWire(WireId wire, bool add);
void clickedPip(PipId pip, bool add);
private:
const float zoomNear_ = 0.1f; // do not zoom closer than this