summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/button.cc1
-rw-r--r--plugingui/button.h3
-rw-r--r--plugingui/knob.cc1
-rw-r--r--plugingui/knob.h4
-rw-r--r--plugingui/label.cc2
-rw-r--r--plugingui/label.h4
6 files changed, 10 insertions, 5 deletions
diff --git a/plugingui/button.cc b/plugingui/button.cc
index baa3067..f547cba 100644
--- a/plugingui/button.cc
+++ b/plugingui/button.cc
@@ -126,7 +126,6 @@ void Button::repaintEvent(RepaintEvent* repaintEvent)
break;
}
- Font font(":fontemboss.png");
p.setColour(Colour(0.1));
p.drawText(width()/2-(text.length()*3)+(draw_state==up?0:1),
height()/2+5+1+(draw_state==up?0:1), font, text, true);
diff --git a/plugingui/button.h b/plugingui/button.h
index e33c3a8..e5de6f1 100644
--- a/plugingui/button.h
+++ b/plugingui/button.h
@@ -31,6 +31,7 @@
#include "widget.h"
#include "painter.h"
#include "notifier.h"
+#include "font.h"
namespace GUI {
@@ -69,6 +70,8 @@ private:
std::string text;
+ Font font{":fontemboss.png"};
+
state_t draw_state;
state_t button_state;
};
diff --git a/plugingui/knob.cc b/plugingui/knob.cc
index 7b784ab..ab2eca9 100644
--- a/plugingui/knob.cc
+++ b/plugingui/knob.cc
@@ -152,7 +152,6 @@ void Knob::repaintEvent(RepaintEvent* repaintEvent)
char buf[64];
sprintf(buf, "%.2f", currentValue * maximum);
- Font font;
p.drawText(center_x - font.textWidth(buf) / 2 + 1,
center_y + font.textHeight(buf) / 2 + 1, font, buf);
diff --git a/plugingui/knob.h b/plugingui/knob.h
index 3ad8887..4a71b2e 100644
--- a/plugingui/knob.h
+++ b/plugingui/knob.h
@@ -27,9 +27,8 @@
#pragma once
#include "widget.h"
-
#include "image.h"
-
+#include "font.h"
#include "notifier.h"
namespace GUI {
@@ -75,6 +74,7 @@ private:
Image img_knob;
int mouse_offset_x;
+ Font font;
};
} // GUI::
diff --git a/plugingui/label.cc b/plugingui/label.cc
index 1de715b..18ba1e8 100644
--- a/plugingui/label.cc
+++ b/plugingui/label.cc
@@ -33,6 +33,7 @@ namespace GUI {
Label::Label(GUI::Widget *parent)
: Widget(parent)
+ , font(":fontemboss.png")
{
}
@@ -50,7 +51,6 @@ void Label::repaintEvent(GUI::RepaintEvent* repaintEvent)
p.setColour(Colour(1));
- Font font(":fontemboss.png");
p.drawText(10, (height() + font.textHeight()) / 2, font, _text, true);
}
diff --git a/plugingui/label.h b/plugingui/label.h
index 0ba67c5..3f0b93f 100644
--- a/plugingui/label.h
+++ b/plugingui/label.h
@@ -28,6 +28,8 @@
#include "widget.h"
+#include "font.h"
+
#include <string>
namespace GUI {
@@ -44,6 +46,8 @@ protected:
private:
std::string _text;
+ Font font{":fontemboss.png"};
+
};
} // GUI::