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

Fixed handling tabbed item display in 'skincurses'

This commit is contained in:
Klaus Schmidinger 2006-06-03 13:21:33 +02:00
parent a12a504fad
commit 9966e03e29
6 changed files with 20 additions and 11 deletions

View File

@ -4763,3 +4763,4 @@ Video Disk Recorder Revision History
- Fixed handling the display of the '*' indicator in the "What's on now/next?"
menu, so that events that haven't been "seen" in the data stream within 30
seconds won't be shown as "running".
- Fixed handling tabbed item display in 'skincurses'.

View File

@ -29,3 +29,7 @@ VDR Plugin 'skincurses' Revision History
2006-04-14: Version 0.0.6
- Added a missing "Key$" in skincurses.c.
2006-06-03: Version 0.0.7
- Fixed handling tabbed item display.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: skincurses.c 1.8 2006/04/14 11:35:59 kls Exp $
* $Id: skincurses.c 1.9 2006/06/03 13:21:33 kls Exp $
*/
#include <ncurses.h>
@ -11,7 +11,7 @@
#include <vdr/plugin.h>
#include <vdr/skins.h>
static const char *VERSION = "0.0.6";
static const char *VERSION = "0.0.7";
static const char *DESCRIPTION = "A text only skin";
static const char *MAINMENUENTRY = NULL;
@ -277,6 +277,7 @@ public:
virtual void SetEvent(const cEvent *Event);
virtual void SetRecording(const cRecording *Recording);
virtual void SetText(const char *Text, bool FixedFont);
virtual const cFont *GetTextAreaFont(bool FixedFont) const { return &Font; }
virtual void Flush(void);
};
@ -366,13 +367,13 @@ void cSkinCursesDisplayMenu::SetItem(const char *Text, int Index, bool Current,
for (int i = 0; i < MaxTabs; i++) {
const char *s = GetTabbedText(Text, i);
if (s) {
int xt = Tab(i);
int xt = Tab(i) / 12;// Tab() is in "pixel" - see also skins.c!!!
osd->DrawText(xt, y, s, ColorFg, ColorBg, &Font, OsdWidth - xt);
}
if (!Tab(i + 1))
break;
}
SetEditableWidth(OsdWidth - Tab(1));
SetEditableWidth(OsdWidth - Tab(1) / 12); // Tab() is in "pixel" - see also skins.c!!!
}
void cSkinCursesDisplayMenu::SetEvent(const cEvent *Event)

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 1.44 2006/04/25 15:59:02 kls Exp $
* $Id: menuitems.c 1.45 2006/06/03 13:20:01 kls Exp $
*/
#include "menuitems.h"
@ -296,7 +296,10 @@ void cMenuEditStrItem::Set(void)
char buf[1000];
if (InEditMode()) {
const cFont *font = cFont::GetFont(fontOsd);
// 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 with == 1 in the font used by 'skincurses'
font = cFont::GetFont(fontOsd);
strncpy(buf, value, pos);
snprintf(buf + pos, sizeof(buf) - pos - 2, insert && newchar ? "[]%c%s" : "[%c]%s", *(value + pos), value + pos + 1);
int width = cSkinDisplay::Current()->EditableWidth();

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 1.9 2006/04/09 11:25:30 kls Exp $
* $Id: skins.c 1.10 2006/06/03 10:18:07 kls Exp $
*/
#include "skins.h"
@ -79,7 +79,7 @@ void cSkinDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5)
tabs[4] = Tab4 ? tabs[3] + Tab4 : 0;
tabs[5] = Tab5 ? tabs[4] + Tab5 : 0;
for (int i = 1; i < MaxTabs; i++)
tabs[i] *= 12;//XXX average character width of font used for items!!!
tabs[i] *= 12;//XXX average character width of font used for items - see also skincurses.c!!!
}
void cSkinDisplayMenu::Scroll(bool Up, bool Page)

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 1.13 2006/04/09 11:23:35 kls Exp $
* $Id: skins.h 1.14 2006/06/03 10:21:45 kls Exp $
*/
#ifndef __SKINS_H
@ -95,7 +95,7 @@ protected:
cTextScroller textScroller;
int Tab(int n) { return (n >= 0 && n < MaxTabs) ? tabs[n] : 0; }
///< Returns the offset of the given tab from the left border of the
///< item display area. The value returned is in pixel.//XXX ncurses???
///< item display area. The value returned is in pixel.
const char *GetTabbedText(const char *s, int Tab);
///< Returns the part of the given string that follows the given
///< Tab (where 0 indicates the beginning of the string). If no such
@ -104,7 +104,7 @@ public:
cSkinDisplayMenu(void);
virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0);
///< Sets the tab columns to the given values, which are the number of
///< characters in each column.//XXX ncurses???
///< characters in each column.
virtual void Scroll(bool Up, bool Page);
///< If this menu contains a text area that can be scrolled, this function
///< will be called to actually scroll the text. Up indicates whether the