From 1b1267674f2b1d632097e60f1284f6ba97b10e00 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 23 Feb 2008 10:50:28 +0100 Subject: [PATCH] The scrollbar handle now always has a height that is at least the width of the scrollbar --- HISTORY | 5 +++-- PLUGINS/src/skincurses/HISTORY | 5 +++-- PLUGINS/src/skincurses/skincurses.c | 7 ++++--- skinclassic.c | 7 ++++--- skinsttng.c | 7 ++++--- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/HISTORY b/HISTORY index 3b6d78bc..7c980bd5 100644 --- a/HISTORY +++ b/HISTORY @@ -5644,7 +5644,7 @@ Video Disk Recorder Revision History should be used. - Fixed calculating the scrollbar sizes in the skins. -2008-02-21: Version 1.5.16 +2008-02-23: Version 1.5.16 - Fixed setting the current subtitle track in Transfer-Mode (reported by Petri Helin, thanks to Reinhard Nissl for pointing out that cDevice::Transferring() doesn't @@ -5655,4 +5655,5 @@ Video Disk Recorder Revision History - Updated the Italian OSD texts (thanks to Diego Pierotto). - Fixed the format in cRemote::Put() to use "%016llX" instead of "%016LX" (thanks to Ludwig Nussel for pointing this out). -- Revised the fix of calculating the scrollbar height in the skins. +- Revised the fix of calculating the scrollbar height in the skins. The scrollbar + handle now always has a height that is at least the width of the scrollbar. diff --git a/PLUGINS/src/skincurses/HISTORY b/PLUGINS/src/skincurses/HISTORY index 117286b6..6088c8b6 100644 --- a/PLUGINS/src/skincurses/HISTORY +++ b/PLUGINS/src/skincurses/HISTORY @@ -71,6 +71,7 @@ VDR Plugin 'skincurses' Revision History - Using cString::sprintf() instead of asprintf(). - Implemented cSkinCursesDisplayMenu::SetScrollbar(). -2008-02-22: Version 0.1.6 +2008-02-23: Version 0.1.6 -- Revised the fix of calculating the scrollbar height in the skins. +- Revised the fix of calculating the scrollbar height in the skins. The scrollbar + handle now always has a height that is at least the width of the scrollbar. diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c index 833eb6aa..ed30a5e7 100644 --- a/PLUGINS/src/skincurses/skincurses.c +++ b/PLUGINS/src/skincurses/skincurses.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: skincurses.c 1.21 2008/02/22 17:02:31 kls Exp $ + * $Id: skincurses.c 1.22 2008/02/23 10:38:04 kls Exp $ */ #include @@ -299,8 +299,9 @@ void cSkinCursesDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, int int yb = yt + Height; int st = yt; int sb = yb; - int tt = st + (sb - st) * double(Offset) / Total + 0.5; - int tb = tt + (sb - st) * double(Shown) / Total + 0.5; + int th = max(int((sb - st) * double(Shown) / Total + 0.5), 1); + int tt = min(int(st + (sb - st) * double(Offset) / Total + 0.5), sb - th); + int tb = min(tt + th, sb); int xl = ScOsdWidth - 1; osd->DrawRectangle(xl, st, xl, sb - 1, clrWhite); osd->DrawRectangle(xl, tt, xl, tb - 1, clrCyan); diff --git a/skinclassic.c b/skinclassic.c index 30d7fc65..6c36278b 100644 --- a/skinclassic.c +++ b/skinclassic.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skinclassic.c 1.26 2008/02/22 16:56:29 kls Exp $ + * $Id: skinclassic.c 1.27 2008/02/23 10:31:58 kls Exp $ */ #include "skinclassic.h" @@ -236,8 +236,9 @@ void cSkinClassicDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, in int yb = yt + Height; int st = yt; int sb = yb; - int tt = st + (sb - st) * double(Offset) / Total + 0.5; - int tb = tt + (sb - st) * double(Shown) / Total + 0.5; + int th = max(int((sb - st) * double(Shown) / Total + 0.5), ScrollWidth); + int tt = min(int(st + (sb - st) * double(Offset) / Total + 0.5), sb - th); + int tb = min(tt + th, sb); int xl = x3 - ScrollWidth; osd->DrawRectangle(xl, st, x3 - 1, sb - 1, Theme.Color(clrMenuScrollbarTotal)); osd->DrawRectangle(xl, tt, x3 - 1, tb - 1, Theme.Color(clrMenuScrollbarShown)); diff --git a/skinsttng.c b/skinsttng.c index 95f4ebe3..f6298411 100644 --- a/skinsttng.c +++ b/skinsttng.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skinsttng.c 1.27 2008/02/22 16:56:30 kls Exp $ + * $Id: skinsttng.c 1.28 2008/02/23 10:23:44 kls Exp $ */ // Star Trek: The Next Generation® is a registered trademark of Paramount Pictures @@ -445,8 +445,9 @@ void cSkinSTTNGDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, int int yb = yt + Height; int st = yt + h + Gap; int sb = yb - h - Gap; - int tt = st + (sb - st) * double(Offset) / Total + 0.5; - int tb = tt + (sb - st) * double(Shown) / Total + 0.5; + int th = max(int((sb - st) * double(Shown) / Total + 0.5), ScrollWidth); + int tt = min(int(st + (sb - st) * double(Offset) / Total + 0.5), sb - th); + int tb = min(tt + th, sb); osd->DrawRectangle(x5, st, x5 + ScrollWidth - 1, sb - 1, Theme.Color(clrMenuScrollbarTotal)); osd->DrawRectangle(x5, tt, x5 + ScrollWidth - 1, tb - 1, Theme.Color(clrMenuScrollbarShown)); osd->DrawRectangle(x5, yt, x6 - 1, yt + h - 1, frameColor);