summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-05-01 17:10:30 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-05-01 17:10:30 +0200
commitd9b10f103ab2d86072ee1dd66bcb79ae140576f0 (patch)
tree3ee601e31628586606e8f7edf1e5192f1e96a75e /plugingui
parent29c8e1fce3b84d5b2a561e2bd7407cce90f7ff7a (diff)
Draw axis texts with painter.
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/powerwidget.cc27
-rw-r--r--plugingui/powerwidget.h4
2 files changed, 12 insertions, 19 deletions
diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc
index 2843d85..e618d16 100644
--- a/plugingui/powerwidget.cc
+++ b/plugingui/powerwidget.cc
@@ -52,15 +52,6 @@ PowerWidget::PowerWidget(GUI::Widget* parent,
shelf_label.resize(59, 16);
shelf_checkbox.resize(59, 40);
- input_label.setText("in");
- input_label.resize(20, 16);
- input_label.setAlignment(GUI::TextAlignment::center);
- input_label.setColour(GUI::Colour(1.0f, 1.0f, 1.0f, 0.2f));
- output_label.setText("out");
- output_label.resize(20, 16);
- output_label.setAlignment(GUI::TextAlignment::left);
- output_label.setColour(GUI::Colour(1.0f, 1.0f, 1.0f, 0.2f));
-
CONNECT(&settings_notifier, powermap_shelf, &shelf_checkbox,
&GUI::CheckBox::setChecked);
}
@@ -89,8 +80,6 @@ void PowerWidget::resize(std::size_t width, std::size_t height)
shelf_label.move(width - 59 + 5 - 32 , 0);
shelf_checkbox.move(width - 59 + 5 - 32, 16);
- input_label.move((width-64-59)/2, height-30);
- output_label.move(20, height/2);
}
PowerWidget::Canvas::Canvas(GUI::Widget* parent,
@@ -198,22 +187,26 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent)
// draw the fixed nodes of the spline
float rad = radius * width();
p.setColour(GUI::Colour{0.0f, 1.0f, 0.0f, 0.7f});
- p.drawFilledCircle(x0 + std::round(settings.powermap_fixed0_x.load() * width0),
- y0 + height0 - std::round(settings.powermap_fixed0_y.load() * height0), rad);
+ p.drawFilledCircle(x0 + settings.powermap_fixed0_x.load() * width0,
+ y0 + height0 - settings.powermap_fixed0_y.load() * height0, rad);
p.drawCircle(x0 + std::round(power_map.getFixed0().in * width0),
y0 + height0 - std::round(power_map.getFixed0().out * height0), rad + 1);
p.setColour(GUI::Colour{1.0f, 1.0f, 0.0f, 0.7f});
- p.drawFilledCircle(x0 + std::round(settings.powermap_fixed1_x.load() * width0),
- y0 + height0 - std::round(settings.powermap_fixed1_y.load() * height0), rad);
+ p.drawFilledCircle(x0 + settings.powermap_fixed1_x.load() * width0,
+ y0 + height0 - settings.powermap_fixed1_y.load() * height0, rad);
p.drawCircle(x0 + std::round(power_map.getFixed1().in * width0),
y0 + height0 - std::round(power_map.getFixed1().out * height0), rad + 1);
p.setColour(GUI::Colour{1.0f, 0.0f, 0.0f, 0.7f});
- p.drawFilledCircle(x0 + std::round(settings.powermap_fixed2_x.load() * width0),
- y0 + height0 - std::round(settings.powermap_fixed2_y.load() * height0), rad);
+ p.drawFilledCircle(x0 + settings.powermap_fixed2_x.load() * width0,
+ y0 + height0 - settings.powermap_fixed2_y.load() * height0, rad);
p.drawCircle(x0 + std::round(power_map.getFixed2().in * width0),
y0 + height0 - std::round(power_map.getFixed2().out * height0), rad + 1);
+
+ p.setColour(GUI::Colour(1.0f, 1.0f, 1.0f, 0.2f));
+ p.drawText(width() / 2, height() - 8, font, "in");
+ p.drawText(16, height() / 2 + 8, font, "out");
}
void PowerWidget::Canvas::buttonEvent(GUI::ButtonEvent* buttonEvent)
diff --git a/plugingui/powerwidget.h b/plugingui/powerwidget.h
index 562383b..c5c6665 100644
--- a/plugingui/powerwidget.h
+++ b/plugingui/powerwidget.h
@@ -32,6 +32,7 @@
#include <knob.h>
#include <checkbox.h>
#include <label.h>
+#include <font.h>
#include <powermap.h>
struct Settings;
@@ -83,6 +84,7 @@ private:
int in_point{-1};
const float radius = 0.02f;
const float brd = 6.0f;
+ GUI::Font font{":resources/fontemboss.png"};
};
void chk_shelf(bool v);
@@ -90,8 +92,6 @@ private:
Canvas canvas;
GUI::Label shelf_label{this};
GUI::CheckBox shelf_checkbox{this};
- GUI::Label input_label{this};
- GUI::Label output_label{this};
Settings& settings;
};