mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-08 22:38:42 -05:00
Restructure DashboardItems
- Add a new class DashboardTextItem that is a DashboardItem that can render text with font
This commit is contained in:
@@ -40,23 +40,6 @@
|
||||
#include <ghoul/misc/profiling.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* KeyFontMono = "Mono";
|
||||
|
||||
constexpr const float DefaultFontSize = 10.f;
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo FontNameInfo = {
|
||||
"FontName",
|
||||
"Font Name",
|
||||
"This value is the name of the font that is used. It can either refer to an "
|
||||
"internal name registered previously, or it can refer to a path that is used."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo FontSizeInfo = {
|
||||
"FontSize",
|
||||
"Font Size",
|
||||
"This value determines the size of the font that is used to render the date."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceTypeInfo = {
|
||||
"SourceType",
|
||||
"Source Type",
|
||||
@@ -118,18 +101,6 @@ documentation::Documentation DashboardItemAngle::Documentation() {
|
||||
new StringEqualVerifier("DashboardItemAngle"),
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
FontNameInfo.identifier,
|
||||
new StringVerifier,
|
||||
Optional::Yes,
|
||||
FontNameInfo.description
|
||||
},
|
||||
{
|
||||
FontSizeInfo.identifier,
|
||||
new IntVerifier,
|
||||
Optional::Yes,
|
||||
FontSizeInfo.description
|
||||
},
|
||||
{
|
||||
SourceTypeInfo.identifier,
|
||||
new StringInListVerifier({
|
||||
@@ -177,7 +148,7 @@ documentation::Documentation DashboardItemAngle::Documentation() {
|
||||
}
|
||||
|
||||
DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
: DashboardItem(dictionary)
|
||||
: DashboardTextItem(dictionary)
|
||||
, _source{
|
||||
properties::OptionProperty(
|
||||
SourceTypeInfo,
|
||||
@@ -202,8 +173,6 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
properties::StringProperty(DestinationNodeNameInfo),
|
||||
nullptr
|
||||
}
|
||||
, _fontName(FontNameInfo, KeyFontMono)
|
||||
, _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
@@ -211,23 +180,6 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
"DashboardItemAngle"
|
||||
);
|
||||
|
||||
if (dictionary.hasKey(FontNameInfo.identifier)) {
|
||||
_fontName = dictionary.value<std::string>(FontNameInfo.identifier);
|
||||
}
|
||||
if (dictionary.hasKey(FontSizeInfo.identifier)) {
|
||||
_fontSize = static_cast<float>(dictionary.value<double>(FontSizeInfo.identifier));
|
||||
}
|
||||
|
||||
_fontName.onChange([this]() {
|
||||
_font = global::fontManager->font(_fontName, _fontSize);
|
||||
});
|
||||
addProperty(_fontName);
|
||||
|
||||
_fontSize.onChange([this]() {
|
||||
_font = global::fontManager->font(_fontName, _fontSize);
|
||||
});
|
||||
addProperty(_fontSize);
|
||||
|
||||
_source.type.addOptions({
|
||||
{ Type::Node, "Node" },
|
||||
{ Type::Focus, "Focus" },
|
||||
@@ -352,7 +304,6 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
addProperty(_destination.nodeName);
|
||||
|
||||
_font = global::fontManager->font(_fontName, _fontSize);
|
||||
_buffer.resize(128);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user