Add various extra customization options for custom themes. Fixes #40

This commit is contained in:
Gericom
2026-03-29 14:48:12 +02:00
parent 53727e5fdd
commit cf9ce63db5
17 changed files with 494 additions and 56 deletions

View File

@@ -2,14 +2,15 @@
#include "gui/GraphicsContext.h"
#include "gui/IVramManager.h"
#include "themes/IFontRepository.h"
#include "themes/custom/CustomThemeInfo.h"
#include "CustomFileInfoView.h"
CustomFileInfoView::CustomFileInfoView(const IFontRepository* fontRepository)
: _firstLine(176, 16, 50, fontRepository->GetFont(FontType::Medium11))
, _secondLine(176, 16, 50, fontRepository->GetFont(FontType::Regular10))
, _thirdLine(176, 16, 50, fontRepository->GetFont(FontType::Regular10))
, _filenameLabelView(220, 16, 200, fontRepository->GetFont(FontType::Medium7_5))
, _backgroundColor(200, 200, 200), _textColor(30, 30, 30)
CustomFileInfoView::CustomFileInfoView(const CustomThemeInfo* customThemeInfo, const IFontRepository* fontRepository)
: _firstLine(customThemeInfo->topBannerTextLine0Info.GetWidth(), 16, 50, fontRepository->GetFont(FontType::Medium11))
, _secondLine(customThemeInfo->topBannerTextLine1Info.GetWidth(), 16, 50, fontRepository->GetFont(FontType::Regular10))
, _thirdLine(customThemeInfo->topBannerTextLine2Info.GetWidth(), 16, 50, fontRepository->GetFont(FontType::Regular10))
, _filenameLabelView(customThemeInfo->topFileNameTextInfo.GetWidth(), 16, 256, fontRepository->GetFont(FontType::Medium7_5))
, _customThemeInfo(customThemeInfo)
{
AddChildTail(&_firstLine);
AddChildTail(&_secondLine);
@@ -21,32 +22,32 @@ CustomFileInfoView::CustomFileInfoView(const IFontRepository* fontRepository)
void CustomFileInfoView::Update()
{
BannerView::Update();
_firstLine.SetPosition(_position.x + 70, _position.y + 130 - 4);
_secondLine.SetPosition(_position.x + 70, _position.y + 145 - 4);
_thirdLine.SetPosition(_position.x + 70, _position.y + 159 - 4);
_filenameLabelView.SetPosition(_position.x + 18, _position.y + 170);
_firstLine.SetPosition(_customThemeInfo->topBannerTextLine0Info.GetPosition());
_secondLine.SetPosition(_customThemeInfo->topBannerTextLine1Info.GetPosition());
_thirdLine.SetPosition(_customThemeInfo->topBannerTextLine2Info.GetPosition());
_filenameLabelView.SetPosition(_customThemeInfo->topFileNameTextInfo.GetPosition());
if (_icon)
{
_icon->SetPosition(_position.x + 24, _position.y + 136 - 4);
_icon->SetPosition(_customThemeInfo->topIconInfo.GetPosition());
_icon->Update();
}
}
void CustomFileInfoView::Draw(GraphicsContext& graphicsContext)
{
_firstLine.SetBackgroundColor(_backgroundColor);
_firstLine.SetForegroundColor(_textColor);
_secondLine.SetBackgroundColor(_backgroundColor);
_secondLine.SetForegroundColor(_textColor);
_thirdLine.SetBackgroundColor(_backgroundColor);
_thirdLine.SetForegroundColor(_textColor);
_filenameLabelView.SetBackgroundColor(_backgroundColor);
_filenameLabelView.SetForegroundColor(_textColor);
_firstLine.SetBackgroundColor(_customThemeInfo->topBannerTextLine0Info.GetBlendColor());
_firstLine.SetForegroundColor(_customThemeInfo->topBannerTextLine0Info.GetTextColor());
_secondLine.SetBackgroundColor(_customThemeInfo->topBannerTextLine1Info.GetBlendColor());
_secondLine.SetForegroundColor(_customThemeInfo->topBannerTextLine1Info.GetTextColor());
_thirdLine.SetBackgroundColor(_customThemeInfo->topBannerTextLine2Info.GetBlendColor());
_thirdLine.SetForegroundColor(_customThemeInfo->topBannerTextLine2Info.GetTextColor());
_filenameLabelView.SetBackgroundColor(_customThemeInfo->topFileNameTextInfo.GetBlendColor());
_filenameLabelView.SetForegroundColor(_customThemeInfo->topFileNameTextInfo.GetTextColor());
BannerView::Draw(graphicsContext);
if (_icon)
{
_icon->Draw(graphicsContext, _backgroundColor);
_icon->Draw(graphicsContext, _customThemeInfo->topIconInfo.GetBlendColor());
}
}