Add options to enable/disable displayed elements
This commit is contained in:
parent
a05954249a
commit
d399346de0
@ -24,5 +24,9 @@
|
|||||||
<file>resources/open_json.png</file>
|
<file>resources/open_json.png</file>
|
||||||
<file>resources/save_json.png</file>
|
<file>resources/save_json.png</file>
|
||||||
<file>resources/py.png</file>
|
<file>resources/py.png</file>
|
||||||
|
<file>resources/bel.png</file>
|
||||||
|
<file>resources/wire.png</file>
|
||||||
|
<file>resources/pip.png</file>
|
||||||
|
<file>resources/group.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -225,6 +225,38 @@ void BaseMainWindow::createMenusAndBars()
|
|||||||
actionZoomOutbound->setIcon(QIcon(":/icons/resources/shape_square.png"));
|
actionZoomOutbound->setIcon(QIcon(":/icons/resources/shape_square.png"));
|
||||||
connect(actionZoomOutbound, &QAction::triggered, fpgaView, &FPGAViewWidget::zoomOutbound);
|
connect(actionZoomOutbound, &QAction::triggered, fpgaView, &FPGAViewWidget::zoomOutbound);
|
||||||
|
|
||||||
|
actionDisplayBel = new QAction("Enable/Disable Bels", this);
|
||||||
|
actionDisplayBel->setIcon(QIcon(":/icons/resources/bel.png"));
|
||||||
|
actionDisplayBel->setCheckable(true);
|
||||||
|
actionDisplayBel->setChecked(true);
|
||||||
|
connect(actionDisplayBel, &QAction::triggered, this, &BaseMainWindow::enableDisableDecals);
|
||||||
|
|
||||||
|
actionDisplayWire = new QAction("Enable/Disable Wires", this);
|
||||||
|
actionDisplayWire->setIcon(QIcon(":/icons/resources/wire.png"));
|
||||||
|
actionDisplayWire->setCheckable(true);
|
||||||
|
actionDisplayWire->setChecked(true);
|
||||||
|
connect(actionDisplayWire, &QAction::triggered, this, &BaseMainWindow::enableDisableDecals);
|
||||||
|
|
||||||
|
actionDisplayPip = new QAction("Enable/Disable Pips", this);
|
||||||
|
actionDisplayPip->setIcon(QIcon(":/icons/resources/pip.png"));
|
||||||
|
actionDisplayPip->setCheckable(true);
|
||||||
|
#ifdef ARCH_ECP5
|
||||||
|
actionDisplayPip->setChecked(false);
|
||||||
|
#else
|
||||||
|
actionDisplayPip->setChecked(true);
|
||||||
|
#endif
|
||||||
|
connect(actionDisplayPip, &QAction::triggered, this, &BaseMainWindow::enableDisableDecals);
|
||||||
|
|
||||||
|
actionDisplayGroups = new QAction("Enable/Disable Groups", this);
|
||||||
|
actionDisplayGroups->setIcon(QIcon(":/icons/resources/group.png"));
|
||||||
|
actionDisplayGroups->setCheckable(true);
|
||||||
|
actionDisplayGroups->setChecked(true);
|
||||||
|
connect(actionDisplayGroups, &QAction::triggered, this, &BaseMainWindow::enableDisableDecals);
|
||||||
|
|
||||||
|
// set initial state
|
||||||
|
fpgaView->enableDisableDecals(actionDisplayBel->isChecked(), actionDisplayWire->isChecked(),
|
||||||
|
actionDisplayPip->isChecked(), actionDisplayGroups->isChecked());
|
||||||
|
|
||||||
// Add main menu
|
// Add main menu
|
||||||
menuBar = new QMenuBar();
|
menuBar = new QMenuBar();
|
||||||
menuBar->setGeometry(QRect(0, 0, 1024, 27));
|
menuBar->setGeometry(QRect(0, 0, 1024, 27));
|
||||||
@ -281,6 +313,11 @@ void BaseMainWindow::createMenusAndBars()
|
|||||||
deviceViewToolBar->addAction(actionZoomOut);
|
deviceViewToolBar->addAction(actionZoomOut);
|
||||||
deviceViewToolBar->addAction(actionZoomSelected);
|
deviceViewToolBar->addAction(actionZoomSelected);
|
||||||
deviceViewToolBar->addAction(actionZoomOutbound);
|
deviceViewToolBar->addAction(actionZoomOutbound);
|
||||||
|
deviceViewToolBar->addSeparator();
|
||||||
|
deviceViewToolBar->addAction(actionDisplayBel);
|
||||||
|
deviceViewToolBar->addAction(actionDisplayWire);
|
||||||
|
deviceViewToolBar->addAction(actionDisplayPip);
|
||||||
|
deviceViewToolBar->addAction(actionDisplayGroups);
|
||||||
|
|
||||||
// Add status bar with progress bar
|
// Add status bar with progress bar
|
||||||
statusBar = new QStatusBar();
|
statusBar = new QStatusBar();
|
||||||
@ -293,6 +330,13 @@ void BaseMainWindow::createMenusAndBars()
|
|||||||
setStatusBar(statusBar);
|
setStatusBar(statusBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseMainWindow::enableDisableDecals()
|
||||||
|
{
|
||||||
|
fpgaView->enableDisableDecals(actionDisplayBel->isChecked(), actionDisplayWire->isChecked(),
|
||||||
|
actionDisplayPip->isChecked(), actionDisplayGroups->isChecked());
|
||||||
|
ctx->refreshUi();
|
||||||
|
}
|
||||||
|
|
||||||
void BaseMainWindow::open_json()
|
void BaseMainWindow::open_json()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, QString("Open JSON"), QString(), QString("*.json"));
|
QString fileName = QFileDialog::getOpenFileName(this, QString("Open JSON"), QString(), QString("*.json"));
|
||||||
|
@ -56,6 +56,7 @@ class BaseMainWindow : public QMainWindow
|
|||||||
protected:
|
protected:
|
||||||
void createMenusAndBars();
|
void createMenusAndBars();
|
||||||
void disableActions();
|
void disableActions();
|
||||||
|
void enableDisableDecals();
|
||||||
|
|
||||||
virtual void onDisableActions(){};
|
virtual void onDisableActions(){};
|
||||||
virtual void onUpdateActions(){};
|
virtual void onUpdateActions(){};
|
||||||
@ -122,6 +123,11 @@ class BaseMainWindow : public QMainWindow
|
|||||||
QAction *actionPlay;
|
QAction *actionPlay;
|
||||||
QAction *actionPause;
|
QAction *actionPause;
|
||||||
QAction *actionStop;
|
QAction *actionStop;
|
||||||
|
|
||||||
|
QAction *actionDisplayBel;
|
||||||
|
QAction *actionDisplayWire;
|
||||||
|
QAction *actionDisplayPip;
|
||||||
|
QAction *actionDisplayGroups;
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -66,6 +66,11 @@ FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
|||||||
renderRunner_->start();
|
renderRunner_->start();
|
||||||
renderRunner_->startTimer(1000 / 2); // render lines 2 times per second
|
renderRunner_->startTimer(1000 / 2); // render lines 2 times per second
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
|
displayBel_ = false;
|
||||||
|
displayWire_ = false;
|
||||||
|
displayPip_ = false;
|
||||||
|
displayGroup_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FPGAViewWidget::~FPGAViewWidget() {}
|
FPGAViewWidget::~FPGAViewWidget() {}
|
||||||
@ -333,6 +338,14 @@ void FPGAViewWidget::paintGL()
|
|||||||
|
|
||||||
void FPGAViewWidget::pokeRenderer(void) { renderRunner_->poke(); }
|
void FPGAViewWidget::pokeRenderer(void) { renderRunner_->poke(); }
|
||||||
|
|
||||||
|
void FPGAViewWidget::enableDisableDecals(bool bels, bool wires, bool pips, bool groups)
|
||||||
|
{
|
||||||
|
displayBel_ = bels;
|
||||||
|
displayWire_ = wires;
|
||||||
|
displayPip_ = pips;
|
||||||
|
displayGroup_ = groups;
|
||||||
|
}
|
||||||
|
|
||||||
void FPGAViewWidget::renderLines(void)
|
void FPGAViewWidget::renderLines(void)
|
||||||
{
|
{
|
||||||
if (ctx_ == nullptr)
|
if (ctx_ == nullptr)
|
||||||
@ -379,17 +392,25 @@ void FPGAViewWidget::renderLines(void)
|
|||||||
|
|
||||||
// Local copy of decals, taken as fast as possible to not block the P&R.
|
// Local copy of decals, taken as fast as possible to not block the P&R.
|
||||||
if (decalsChanged) {
|
if (decalsChanged) {
|
||||||
for (auto bel : ctx_->getBels()) {
|
if (displayBel_) {
|
||||||
belDecals.push_back({ctx_->getBelDecal(bel), bel});
|
for (auto bel : ctx_->getBels()) {
|
||||||
|
belDecals.push_back({ctx_->getBelDecal(bel), bel});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (auto wire : ctx_->getWires()) {
|
if (displayWire_) {
|
||||||
wireDecals.push_back({ctx_->getWireDecal(wire), wire});
|
for (auto wire : ctx_->getWires()) {
|
||||||
|
wireDecals.push_back({ctx_->getWireDecal(wire), wire});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (auto pip : ctx_->getPips()) {
|
if (displayPip_) {
|
||||||
pipDecals.push_back({ctx_->getPipDecal(pip), pip});
|
for (auto pip : ctx_->getPips()) {
|
||||||
|
pipDecals.push_back({ctx_->getPipDecal(pip), pip});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (auto group : ctx_->getGroups()) {
|
if (displayGroup_) {
|
||||||
groupDecals.push_back({ctx_->getGroupDecal(group), group});
|
for (auto group : ctx_->getGroups()) {
|
||||||
|
groupDecals.push_back({ctx_->getGroupDecal(group), group});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,20 +451,28 @@ void FPGAViewWidget::renderLines(void)
|
|||||||
data->bbGlobal.clear();
|
data->bbGlobal.clear();
|
||||||
|
|
||||||
// Draw Bels.
|
// Draw Bels.
|
||||||
for (auto const &decal : belDecals) {
|
if (displayBel_) {
|
||||||
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
for (auto const &decal : belDecals) {
|
||||||
|
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Draw Wires.
|
// Draw Wires.
|
||||||
for (auto const &decal : wireDecals) {
|
if (displayWire_) {
|
||||||
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
for (auto const &decal : wireDecals) {
|
||||||
|
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Draw Pips.
|
// Draw Pips.
|
||||||
for (auto const &decal : pipDecals) {
|
if (displayPip_) {
|
||||||
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
for (auto const &decal : pipDecals) {
|
||||||
|
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Draw Groups.
|
// Draw Groups.
|
||||||
for (auto const &decal : groupDecals) {
|
if (displayGroup_) {
|
||||||
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
for (auto const &decal : groupDecals) {
|
||||||
|
renderArchDecal(data->gfxByStyle, data->bbGlobal, decal.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bounding box should be calculated by now.
|
// Bounding box should be calculated by now.
|
||||||
|
@ -119,6 +119,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
void zoomOut();
|
void zoomOut();
|
||||||
void zoomSelected();
|
void zoomSelected();
|
||||||
void zoomOutbound();
|
void zoomOutbound();
|
||||||
|
void enableDisableDecals(bool bels, bool wires, bool pips, bool groups);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void clickedBel(BelId bel, bool add);
|
void clickedBel(BelId bel, bool add);
|
||||||
@ -227,6 +228,11 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
QMatrix4x4 viewMove_;
|
QMatrix4x4 viewMove_;
|
||||||
float zoom_;
|
float zoom_;
|
||||||
|
|
||||||
|
bool displayBel_;
|
||||||
|
bool displayWire_;
|
||||||
|
bool displayPip_;
|
||||||
|
bool displayGroup_;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
QColor background;
|
QColor background;
|
||||||
|
BIN
gui/resources/bel.png
Normal file
BIN
gui/resources/bel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 516 B |
BIN
gui/resources/group.png
Normal file
BIN
gui/resources/group.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 529 B |
BIN
gui/resources/pip.png
Normal file
BIN
gui/resources/pip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 B |
BIN
gui/resources/wire.png
Normal file
BIN
gui/resources/wire.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 365 B |
Loading…
Reference in New Issue
Block a user