From 96608c8d07dd149c033c98172e79d15e7bd2b69c Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Fri, 27 Jul 2018 02:28:01 +0100 Subject: gui: allow selecting pips --- gui/basewindow.cc | 2 ++ gui/designwidget.cc | 8 ++++++++ gui/designwidget.h | 1 + gui/fpgaviewwidget.cc | 2 ++ gui/fpgaviewwidget.h | 1 + 5 files changed, 14 insertions(+) (limited to 'gui') diff --git a/gui/basewindow.cc b/gui/basewindow.cc index 96799e85..6e997011 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -2,6 +2,7 @@ * nextpnr -- Next Generation Place and Route * * Copyright (C) 2018 Miodrag Milanovic + * Copyright (C) 2018 Serge Bazanski * * 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, QWidget *parent SLOT(onSelectedArchItem(std::vector, 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, int)), fpgaView, SLOT(onHighlightGroupChanged(std::vector, int))); diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 674c74c7..d55c84e9 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -2,6 +2,7 @@ * nextpnr -- Next Generation Place and Route * * Copyright (C) 2018 Miodrag Milanovic + * Copyright (C) 2018 Serge Bazanski * * 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) diff --git a/gui/designwidget.h b/gui/designwidget.h index a11ed062..60291cf3 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -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; diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index d51250bf..31271965 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -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); } } } diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index 335ee51b..690b12b8 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -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 -- cgit v1.2.3