make colors configurable, changed to gray
This commit is contained in:
parent
a8a3ba2647
commit
7b9b2bef3c
@ -243,6 +243,13 @@ void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
|||||||
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
||||||
: QOpenGLWidget(parent), moveX_(0), moveY_(0), zoom_(10.0f), lineShader_(this), ctx_(nullptr)
|
: 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();
|
auto fmt = format();
|
||||||
fmt.setMajorVersion(3);
|
fmt.setMajorVersion(3);
|
||||||
fmt.setMinorVersion(1);
|
fmt.setMinorVersion(1);
|
||||||
@ -309,7 +316,7 @@ void FPGAViewWidget::initializeGL()
|
|||||||
log_error("Could not compile shader.\n");
|
log_error("Could not compile shader.\n");
|
||||||
}
|
}
|
||||||
initializeOpenGLFunctions();
|
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)
|
void FPGAViewWidget::drawElement(LineShaderData &out, const GraphicElement &el)
|
||||||
@ -346,7 +353,7 @@ void FPGAViewWidget::paintGL()
|
|||||||
matrix.translate(moveX_, -moveY_, 0);
|
matrix.translate(moveX_, -moveY_, 0);
|
||||||
|
|
||||||
// Draw grid.
|
// 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) {
|
for (float i = -100.0f; i < 100.0f; i += 1.0f) {
|
||||||
PolyLine(-100.0f, i, 100.0f, i).build(grid);
|
PolyLine(-100.0f, i, 100.0f, i).build(grid);
|
||||||
PolyLine(i, -100.0f, i, 100.0f).build(grid);
|
PolyLine(i, -100.0f, i, 100.0f).build(grid);
|
||||||
@ -354,7 +361,7 @@ void FPGAViewWidget::paintGL()
|
|||||||
lineShader_.draw(grid, matrix);
|
lineShader_.draw(grid, matrix);
|
||||||
|
|
||||||
// Draw Bels.
|
// Draw Bels.
|
||||||
auto bels = LineShaderData(0.0005f, QColor("#b000ba"));
|
auto bels = LineShaderData(0.0005f, belColor);
|
||||||
if (ctx_) {
|
if (ctx_) {
|
||||||
for (auto bel : ctx_->getBels()) {
|
for (auto bel : ctx_->getBels()) {
|
||||||
for (auto &el : ctx_->getBelGraphics(bel))
|
for (auto &el : ctx_->getBelGraphics(bel))
|
||||||
@ -364,7 +371,7 @@ void FPGAViewWidget::paintGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw Wires.
|
// Draw Wires.
|
||||||
auto wires = LineShaderData(0.0005f, QColor("#b000ba"));
|
auto wires = LineShaderData(0.0005f, wireColor);
|
||||||
if (ctx_) {
|
if (ctx_) {
|
||||||
for (auto wire : ctx_->getWires()) {
|
for (auto wire : ctx_->getWires()) {
|
||||||
for (auto &el : ctx_->getWireGraphics(wire))
|
for (auto &el : ctx_->getWireGraphics(wire))
|
||||||
@ -374,7 +381,7 @@ void FPGAViewWidget::paintGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw Pips.
|
// Draw Pips.
|
||||||
auto pips = LineShaderData(0.0005f, QColor("#b000ba"));
|
auto pips = LineShaderData(0.0005f, pipColor);
|
||||||
if (ctx_) {
|
if (ctx_) {
|
||||||
for (auto wire : ctx_->getPips()) {
|
for (auto wire : ctx_->getPips()) {
|
||||||
for (auto &el : ctx_->getPipGraphics(wire))
|
for (auto &el : ctx_->getPipGraphics(wire))
|
||||||
@ -384,7 +391,7 @@ void FPGAViewWidget::paintGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw Groups.
|
// Draw Groups.
|
||||||
auto groups = LineShaderData(0.0005f, QColor("#b000ba"));
|
auto groups = LineShaderData(0.0005f, groupColor);
|
||||||
if (ctx_) {
|
if (ctx_) {
|
||||||
for (auto group : ctx_->getGroups()) {
|
for (auto group : ctx_->getGroups()) {
|
||||||
for (auto &el : ctx_->getGroupGraphics(group))
|
for (auto &el : ctx_->getGroupGraphics(group))
|
||||||
@ -394,7 +401,7 @@ void FPGAViewWidget::paintGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw Frame Graphics.
|
// Draw Frame Graphics.
|
||||||
auto frames = LineShaderData(0.002f, QColor("#0066ba"));
|
auto frames = LineShaderData(0.002f, frameColor);
|
||||||
if (ctx_) {
|
if (ctx_) {
|
||||||
for (auto &el : ctx_->getFrameGraphics()) {
|
for (auto &el : ctx_->getFrameGraphics()) {
|
||||||
drawElement(frames, el);
|
drawElement(frames, el);
|
||||||
|
@ -216,6 +216,13 @@ class LineShader
|
|||||||
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
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:
|
public:
|
||||||
FPGAViewWidget(QWidget *parent = 0);
|
FPGAViewWidget(QWidget *parent = 0);
|
||||||
@ -253,6 +260,13 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
float startDragX_;
|
float startDragX_;
|
||||||
float startDragY_;
|
float startDragY_;
|
||||||
Context *ctx_;
|
Context *ctx_;
|
||||||
|
QColor backgroundColor;
|
||||||
|
QColor gridColor;
|
||||||
|
QColor belColor;
|
||||||
|
QColor wireColor;
|
||||||
|
QColor pipColor;
|
||||||
|
QColor groupColor;
|
||||||
|
QColor frameColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
Loading…
Reference in New Issue
Block a user