diff options
-rw-r--r-- | gui/fpgaviewwidget.cc | 21 | ||||
-rw-r--r-- | gui/fpgaviewwidget.h | 14 |
2 files changed, 28 insertions, 7 deletions
diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index 7d9d3727..19f7cf0d 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -243,6 +243,13 @@ void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection) FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), moveX_(0), moveY_(0), zoom_(10.0f), lineShader_(this), ctx_(nullptr) { + backgroundColor = QColor("#ffffff"); + gridColor = QColor("#ddd"); + belColor = QColor("#303030"); + wireColor = QColor("#303030"); + pipColor = QColor("#303030"); + groupColor = QColor("#303030"); + frameColor = QColor("#0066ba"); auto fmt = format(); fmt.setMajorVersion(3); fmt.setMinorVersion(1); @@ -309,7 +316,7 @@ void FPGAViewWidget::initializeGL() log_error("Could not compile shader.\n"); } initializeOpenGLFunctions(); - glClearColor(1.0, 1.0, 1.0, 0.0); + glClearColor(backgroundColor.red()/255, backgroundColor.green()/255, backgroundColor.blue()/255, 0.0); } void FPGAViewWidget::drawElement(LineShaderData &out, const GraphicElement &el) @@ -346,7 +353,7 @@ void FPGAViewWidget::paintGL() matrix.translate(moveX_, -moveY_, 0); // Draw grid. - auto grid = LineShaderData(0.001f, QColor("#DDD")); + auto grid = LineShaderData(0.001f, gridColor); for (float i = -100.0f; i < 100.0f; i += 1.0f) { PolyLine(-100.0f, i, 100.0f, i).build(grid); PolyLine(i, -100.0f, i, 100.0f).build(grid); @@ -354,7 +361,7 @@ void FPGAViewWidget::paintGL() lineShader_.draw(grid, matrix); // Draw Bels. - auto bels = LineShaderData(0.0005f, QColor("#b000ba")); + auto bels = LineShaderData(0.0005f, belColor); if (ctx_) { for (auto bel : ctx_->getBels()) { for (auto &el : ctx_->getBelGraphics(bel)) @@ -364,7 +371,7 @@ void FPGAViewWidget::paintGL() } // Draw Wires. - auto wires = LineShaderData(0.0005f, QColor("#b000ba")); + auto wires = LineShaderData(0.0005f, wireColor); if (ctx_) { for (auto wire : ctx_->getWires()) { for (auto &el : ctx_->getWireGraphics(wire)) @@ -374,7 +381,7 @@ void FPGAViewWidget::paintGL() } // Draw Pips. - auto pips = LineShaderData(0.0005f, QColor("#b000ba")); + auto pips = LineShaderData(0.0005f, pipColor); if (ctx_) { for (auto wire : ctx_->getPips()) { for (auto &el : ctx_->getPipGraphics(wire)) @@ -384,7 +391,7 @@ void FPGAViewWidget::paintGL() } // Draw Groups. - auto groups = LineShaderData(0.0005f, QColor("#b000ba")); + auto groups = LineShaderData(0.0005f, groupColor); if (ctx_) { for (auto group : ctx_->getGroups()) { for (auto &el : ctx_->getGroupGraphics(group)) @@ -394,7 +401,7 @@ void FPGAViewWidget::paintGL() } // Draw Frame Graphics. - auto frames = LineShaderData(0.002f, QColor("#0066ba")); + auto frames = LineShaderData(0.002f, frameColor); if (ctx_) { for (auto &el : ctx_->getFrameGraphics()) { drawElement(frames, el); diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index c281fd77..8114a686 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -216,6 +216,13 @@ class LineShader class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions { Q_OBJECT + Q_PROPERTY(QColor backgroundColor MEMBER backgroundColor DESIGNABLE true) + Q_PROPERTY(QColor belColor MEMBER belColor DESIGNABLE true) + Q_PROPERTY(QColor gridColor MEMBER gridColor DESIGNABLE true) + Q_PROPERTY(QColor wireColor MEMBER wireColor DESIGNABLE true) + Q_PROPERTY(QColor pipColor MEMBER pipColor DESIGNABLE true) + Q_PROPERTY(QColor groupColor MEMBER groupColor DESIGNABLE true) + Q_PROPERTY(QColor frameColor MEMBER frameColor DESIGNABLE true) public: FPGAViewWidget(QWidget *parent = 0); @@ -253,6 +260,13 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions float startDragX_; float startDragY_; Context *ctx_; + QColor backgroundColor; + QColor gridColor; + QColor belColor; + QColor wireColor; + QColor pipColor; + QColor groupColor; + QColor frameColor; }; NEXTPNR_NAMESPACE_END |