From 8edb4e42aedbe48e8c1e1d4caa54f116c83e2e18 Mon Sep 17 00:00:00 2001 From: Soeren Moch Date: Sat, 13 Feb 2021 14:03:29 +0100 Subject: Use MessageBox for DisplayMenu Besides the unified message view this allows great code simplification. Signed-off-by: Soeren Moch --- messagebox.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'messagebox.c') diff --git a/messagebox.c b/messagebox.c index 70398be..47fdbc1 100644 --- a/messagebox.c +++ b/messagebox.c @@ -3,7 +3,7 @@ #include "imageloader.h" #include "messagebox.h" -cNopacityMessageBox::cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const cRect &Rect, eMessageType Type, const char *Text) { +cNopacityMessageBox::cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const cRect &Rect, eMessageType Type, const char *Text, bool isMenuMessage) { osd = Osd; pixmap = osd->CreatePixmap(7, Rect); pixmapBackground = osd->CreatePixmap(6, Rect); @@ -51,13 +51,13 @@ cNopacityMessageBox::cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const DrawRoundedCornersWithBorder(pixmapBackground, col, config.GetValue("cornerRadius"), Rect.Width(), Rect.Height()); } } - int textWidth = fontManager->messageText->Width(Text); - pixmap->DrawText(cPoint((Rect.Width() - textWidth) / 2, - (Rect.Height() - fontManager->messageText->Height()) / 2), + cFont *font = isMenuMessage ? fontManager->menuMessage : fontManager->messageText; + pixmap->DrawText(cPoint((Rect.Width() - font->Width(Text)) / 2, + (Rect.Height() - font->Height()) / 2), Text, colFont, clrTransparent, - fontManager->messageText); + font); } cNopacityMessageBox::~cNopacityMessageBox() { -- cgit v1.2.3