aboutsummaryrefslogtreecommitdiffstats
path: root/gui/fpgaviewwidget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gui/fpgaviewwidget.cc')
-rw-r--r--gui/fpgaviewwidget.cc36
1 files changed, 32 insertions, 4 deletions
diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc
index cb60bc76..2d8d4cef 100644
--- a/gui/fpgaviewwidget.cc
+++ b/gui/fpgaviewwidget.cc
@@ -241,7 +241,7 @@ void LineShader::draw(const LineShaderData &line, const QColor &color, float thi
}
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
- : QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr), selectedItemsChanged(false)
+ : QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr), selectedItemsChanged_(false)
{
backgroundColor_ = QColor("#000000");
gridColor_ = QColor("#333");
@@ -251,6 +251,16 @@ FPGAViewWidget::FPGAViewWidget(QWidget *parent)
gActiveColor_ = QColor("#f0f0f0");
gSelectedColor_ = QColor("#ff6600");
frameColor_ = QColor("#0066ba");
+ highlightColors[0] = QColor("#6495ed");
+ highlightColors[1] = QColor("#7fffd4");
+ highlightColors[2] = QColor("#98fb98");
+ highlightColors[3] = QColor("#ffd700");
+ highlightColors[4] = QColor("#cd5c5c");
+ highlightColors[5] = QColor("#fa8072");
+ highlightColors[6] = QColor("#ff69b4");
+ highlightColors[7] = QColor("#da70d6");
+ for (int i = 0; i < 8; i++)
+ highlightItemsChanged_[i] = false;
auto fmt = format();
fmt.setMajorVersion(3);
@@ -413,26 +423,44 @@ void FPGAViewWidget::paintGL()
drawDecal(shaders, ctx_->getGroupDecal(group));
}
- if (selectedItemsChanged) {
- selectedItemsChanged = false;
+ if (selectedItemsChanged_) {
+ selectedItemsChanged_ = false;
selectedShader_.clear();
for (auto decal : selectedItems_) {
drawDecal(selectedShader_, decal);
}
}
+ for (int i = 0; i < 8; i++) {
+ if (highlightItemsChanged_[i]) {
+ highlightItemsChanged_[i] = false;
+ highlightShader_[i].clear();
+ for (auto decal : highlightItems_[i]) {
+ drawDecal(highlightShader_[i], decal);
+ }
+ }
+ }
}
lineShader_.draw(shaders[0], gFrameColor_, thick11Px, matrix);
lineShader_.draw(shaders[1], gHiddenColor_, thick11Px, matrix);
lineShader_.draw(shaders[2], gInactiveColor_, thick11Px, matrix);
lineShader_.draw(shaders[3], gActiveColor_, thick11Px, matrix);
+ for (int i = 0; i < 8; i++)
+ lineShader_.draw(highlightShader_[i], highlightColors[i], thick11Px, matrix);
lineShader_.draw(selectedShader_, gSelectedColor_, thick11Px, matrix);
}
void FPGAViewWidget::onSelectedArchItem(std::vector<DecalXY> decals)
{
selectedItems_ = decals;
- selectedItemsChanged = true;
+ selectedItemsChanged_ = true;
+ update();
+}
+
+void FPGAViewWidget::onHighlightGroupChanged(std::vector<DecalXY> decals, int group)
+{
+ highlightItems_[group] = decals;
+ highlightItemsChanged_[group] = true;
update();
}