1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Adapted menu column widths of 'skincurses' to the wider HD OSD sizes

This commit is contained in:
Klaus Schmidinger 2012-03-11 14:44:49 +01:00
parent 7958688ae1
commit ea16f64773
5 changed files with 14 additions and 8 deletions

View File

@ -7021,3 +7021,4 @@ Video Disk Recorder Revision History
- Dropped the meanwhile obsolete script 'i18n-to-gettext'. - Dropped the meanwhile obsolete script 'i18n-to-gettext'.
- Removed the obsolete function cPlugin::RegisterI18n(). - Removed the obsolete function cPlugin::RegisterI18n().
- Removed the obsolete typedef tI18nPhrase. - Removed the obsolete typedef tI18nPhrase.
- Adapted menu column widths of 'skincurses' to the wider HD OSD sizes.

View File

@ -92,3 +92,7 @@ VDR Plugin 'skincurses' Revision History
2011-05-15: Version 0.1.10 2011-05-15: Version 0.1.10
- Avoiding a gcc 4.6 compiler error (thanks to Tobias Grimm). - Avoiding a gcc 4.6 compiler error (thanks to Tobias Grimm).
2012-03-11: Version 0.1.11
- Adapted menu column widths of 'skincurses' to the wider HD OSD sizes.

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: skincurses.c 2.7 2011/08/21 11:04:38 kls Exp $ * $Id: skincurses.c 2.8 2012/03/11 14:42:52 kls Exp $
*/ */
#include <ncurses.h> #include <ncurses.h>
@ -11,7 +11,7 @@
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include <vdr/skins.h> #include <vdr/skins.h>
static const char *VERSION = "0.1.10"; static const char *VERSION = "0.1.11";
static const char *DESCRIPTION = trNOOP("A text only skin"); static const char *DESCRIPTION = trNOOP("A text only skin");
static const char *MAINMENUENTRY = NULL; static const char *MAINMENUENTRY = NULL;
@ -375,13 +375,13 @@ void cSkinCursesDisplayMenu::SetItem(const char *Text, int Index, bool Current,
for (int i = 0; i < MaxTabs; i++) { for (int i = 0; i < MaxTabs; i++) {
const char *s = GetTabbedText(Text, i); const char *s = GetTabbedText(Text, i);
if (s) { if (s) {
int xt = Tab(i) / 12;// Tab() is in "pixel" - see also skins.c!!! int xt = Tab(i) / AvgCharWidth();// Tab() is in "pixel" - see also skins.c!!!
osd->DrawText(xt, y, s, ColorFg, ColorBg, &Font, ScOsdWidth - 2 - xt); osd->DrawText(xt, y, s, ColorFg, ColorBg, &Font, ScOsdWidth - 2 - xt);
} }
if (!Tab(i + 1)) if (!Tab(i + 1))
break; break;
} }
SetEditableWidth(ScOsdWidth - 2 - Tab(1) / 12); // Tab() is in "pixel" - see also skins.c!!! SetEditableWidth(ScOsdWidth - 2 - Tab(1) / AvgCharWidth()); // Tab() is in "pixel" - see also skins.c!!!
} }
void cSkinCursesDisplayMenu::SetScrollbar(int Total, int Offset) void cSkinCursesDisplayMenu::SetScrollbar(int Total, int Offset)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: skins.c 2.4 2012/02/20 11:47:15 kls Exp $ * $Id: skins.c 2.5 2012/03/11 14:36:11 kls Exp $
*/ */
#include "skins.h" #include "skins.h"
@ -78,9 +78,8 @@ void cSkinDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5)
tabs[3] = Tab3 ? tabs[2] + Tab3 : 0; tabs[3] = Tab3 ? tabs[2] + Tab3 : 0;
tabs[4] = Tab4 ? tabs[3] + Tab4 : 0; tabs[4] = Tab4 ? tabs[3] + Tab4 : 0;
tabs[5] = Tab5 ? tabs[4] + Tab5 : 0; tabs[5] = Tab5 ? tabs[4] + Tab5 : 0;
int AvgCharWidth = Setup.FontOsdSize * 4 / 6; // just an estimate
for (int i = 1; i < MaxTabs; i++) for (int i = 1; i < MaxTabs; i++)
tabs[i] *= AvgCharWidth; tabs[i] *= AvgCharWidth();
} }
void cSkinDisplayMenu::Scroll(bool Up, bool Page) void cSkinDisplayMenu::Scroll(bool Up, bool Page)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: skins.h 2.1 2011/12/04 13:38:17 kls Exp $ * $Id: skins.h 2.2 2012/03/11 14:38:23 kls Exp $
*/ */
#ifndef __SKINS_H #ifndef __SKINS_H
@ -28,6 +28,8 @@ private:
public: public:
cSkinDisplay(void); cSkinDisplay(void);
virtual ~cSkinDisplay(); virtual ~cSkinDisplay();
static int AvgCharWidth(void) { return Setup.FontOsdSize * 4 / 6; }
///< Returns the average width of a character in pixel (just a raw estimate).
int EditableWidth(void) { return editableWidth; } int EditableWidth(void) { return editableWidth; }
void SetEditableWidth(int Width) { editableWidth = Width; } void SetEditableWidth(int Width) { editableWidth = Width; }
///< If an item is set through a call to cSkinDisplayMenu::SetItem(), this ///< If an item is set through a call to cSkinDisplayMenu::SetItem(), this