From 7b9b2bef3c622bd54225c1c44ee63a211e0e1d3e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 12 Jul 2018 18:02:57 +0200 Subject: make colors configurable, changed to gray --- gui/fpgaviewwidget.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'gui/fpgaviewwidget.cc') 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); -- cgit v1.2.3