From 8d1996cae99ff80a2d9390b94db54217ed1d8726 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Jul 2018 19:44:37 +0200 Subject: display selected object from tree --- gui/fpgaviewwidget.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'gui/fpgaviewwidget.cc') diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index 21ce5b67..f8fefd97 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -241,7 +241,7 @@ void LineShader::draw(const LineShaderData &line, const QColor &color, const flo vao_.release(); } -FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr) +FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr), selectedItemsChanged(false) { backgroundColor_ = QColor("#000000"); gridColor_ = QColor("#333"); @@ -249,6 +249,7 @@ FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), lineSha gHiddenColor_ = QColor("#606060"); gInactiveColor_ = QColor("#303030"); gActiveColor_ = QColor("#f0f0f0"); + gSelectedColor_ = QColor("#ff6600"); frameColor_ = QColor("#0066ba"); auto fmt = format(); @@ -364,15 +365,32 @@ void FPGAViewWidget::paintGL() // Draw Frame Graphics. drawDecal(proxy, shaders_, ctx_->getFrameDecal()); } + + if (selectedItemsChanged) + { + selectedItemsChanged = false; + selectedShader_.clear(); + for (auto decal : selectedItems_) { + drawDecal(proxy, selectedShader_, 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); + lineShader_.draw(selectedShader_, gSelectedColor_, thick11Px, matrix); //lineShader_.draw(frame, matrix); } +void FPGAViewWidget::onSelectedArchItem(std::vector decals) +{ + selectedItems_ = decals; + selectedItemsChanged = true; + update(); +} + void FPGAViewWidget::resizeGL(int width, int height) {} void FPGAViewWidget::mousePressEvent(QMouseEvent *event) { lastPos_ = event->pos(); } -- cgit v1.2.3