Fixed handling of cSkinDisplayMenu::GetTextAreaFont()

This commit is contained in:
Klaus Schmidinger 2024-07-13 09:12:18 +02:00
parent 87410442b6
commit b3ad9ec699
5 changed files with 8 additions and 10 deletions

View File

@ -3414,6 +3414,7 @@ Matthias Senzel <matthias.senzel@t-online.de>
for fixing height calculation in progress display
for fixing an unnecessary double display of the current menu item in page up/down
for fixing an unnecessary double display of menu items in the Recordings menu
for reporting a bug in handling cSkinDisplayMenu::GetTextAreaFont()
Marek Nazarko <mnazarko@gmail.com>
for translating OSD texts to the Polish language

View File

@ -9944,3 +9944,4 @@ Video Disk Recorder Revision History
- Fixed a crash in strreplace() for multiple replacements with strings of different
lengths (reported by Markus Ehrnsperger).
- Fixed handling of cSkinDisplayMenu::GetTextAreaFont() (reported by Matthias Senzel).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.c 5.1 2020/12/26 15:49:01 kls Exp $
* $Id: menuitems.c 5.2 2024/07/13 09:12:18 kls Exp $
*/
#include "menuitems.h"
@ -497,10 +497,7 @@ void cMenuEditStrItem::AdvancePos(void)
void cMenuEditStrItem::Set(void)
{
if (InEditMode()) {
// This is an ugly hack to make editing strings work with the 'skincurses' plugin.
const cFont *font = dynamic_cast<cSkinDisplayMenu *>(cSkinDisplay::Current())->GetTextAreaFont(false);
if (!font || font->Width("W") != 1) // all characters have width == 1 in the font used by 'skincurses'
font = cFont::GetFont(fontOsd);
int width = cSkinDisplay::Current()->EditableWidth();
width -= font->Width("[]");

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skins.c 5.1 2024/01/17 21:15:48 kls Exp $
* $Id: skins.c 5.2 2024/07/13 09:12:18 kls Exp $
*/
#include "skins.h"
@ -139,9 +139,9 @@ int cSkinDisplayMenu::GetTextAreaWidth(void) const
return 0;
}
const cFont *cSkinDisplayMenu::GetTextAreaFont(bool) const
const cFont *cSkinDisplayMenu::GetTextAreaFont(bool FixedFont) const
{
return NULL;
return cFont::GetFont(FixedFont ? fontFix : fontOsd);
}
// --- cSkinDisplayReplay::cProgressBar --------------------------------------

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skins.h 5.2 2024/06/11 12:43:25 kls Exp $
* $Id: skins.h 5.3 2024/07/13 09:12:18 kls Exp $
*/
#ifndef __SKINS_H
@ -310,8 +310,7 @@ public:
virtual const cFont *GetTextAreaFont(bool FixedFont) const;
///< Returns a pointer to the font which is used to display text with SetText().
///< The parameter FixedFont has the same meaning as in SetText(). The default
///< implementation returns NULL. Therefore a caller of this method must be
///< prepared to receive NULL if the plugin doesn't implement this method.
///< implementation returns the font defined in the setup.
///< The returned pointer is valid a long as the instance of cSkinDisplayMenu
///< exists.
};