[MPlayer-cvslog] r25007 - in trunk/libmenu: menu_list.c menu_list.h
ulion
subversion at mplayerhq.hu
Sat Nov 10 03:01:41 CET 2007
Author: ulion
Date: Sat Nov 10 03:01:41 2007
New Revision: 25007
Log:
Make page up and down with proper page size instead of always 10 rows.
Modified:
trunk/libmenu/menu_list.c
trunk/libmenu/menu_list.h
Modified: trunk/libmenu/menu_list.c
==============================================================================
--- trunk/libmenu/menu_list.c (original)
+++ trunk/libmenu/menu_list.c Sat Nov 10 03:01:41 2007
@@ -78,30 +78,32 @@ void menu_list_draw(menu_t* menu,mp_imag
need_h = count * (mpriv->vspace + vo_font->height) - mpriv->vspace;
if( need_h + th > dh) {
int start,end;
- int maxl = (dh + mpriv->vspace - th) / (mpriv->vspace + vo_font->height);
- if(maxl < 4) {
+ mpriv->disp_lines = (dh + mpriv->vspace - th) / (mpriv->vspace + vo_font->height);
+ if(mpriv->disp_lines < 4) {
th = 0;
- maxl = (dh + mpriv->vspace) / ( vo_font->height + mpriv->vspace);
+ mpriv->disp_lines = (dh + mpriv->vspace) / ( vo_font->height + mpriv->vspace);
}
// Too smoll
- if(maxl < 1) return;
- need_h = maxl*(mpriv->vspace + vo_font->height) - mpriv->vspace;
+ if(mpriv->disp_lines < 1) return;
+ need_h = mpriv->disp_lines*(mpriv->vspace + vo_font->height) - mpriv->vspace;
- start = sidx - (maxl/2);
+ start = sidx - (mpriv->disp_lines/2);
if(start < 0) start = 0;
- end = start + maxl;
+ end = start + mpriv->disp_lines;
if(end > count) {
end = count;
- if(end - start < maxl)
- start = end - maxl < 0 ? 0 : end - maxl;
+ if(end - start < mpriv->disp_lines)
+ start = end - mpriv->disp_lines < 0 ? 0 : end - mpriv->disp_lines;
}
m = mpriv->menu;
for(i = 0 ; m->next && i < start ; ) {
if(!m->hide) i++;
m = m->next;
}
- } else
+ } else {
m = mpriv->menu;
+ mpriv->disp_lines = count;
+ }
bg_w = need_w+2*mpriv->minb;
if(th > 0) {
@@ -219,13 +221,13 @@ void menu_list_read_key(menu_t* menu,int
mpriv->current = m;
break;
case KEY_PAGE_UP:
- for(i = 0, m = mpriv->current ; m && m->prev && i < 10 ; m = m->prev, i++)
+ for(i = 0, m = mpriv->current ; m && m->prev && i < mpriv->disp_lines ; m = m->prev, i++)
/**/;
if(m)
mpriv->current = m;
break;
case KEY_PAGE_DOWN:
- for(i = 0, m = mpriv->current ; m && m->next && i < 10 ; m = m->next, i++)
+ for(i = 0, m = mpriv->current ; m && m->next && i < mpriv->disp_lines ; m = m->next, i++)
/**/;
if(m)
mpriv->current = m;
Modified: trunk/libmenu/menu_list.h
==============================================================================
--- trunk/libmenu/menu_list.h (original)
+++ trunk/libmenu/menu_list.h Sat Nov 10 03:01:41 2007
@@ -28,6 +28,7 @@ typedef struct menu_priv_s {
int x,y;
int w,h;
int vspace, minb;
+ int disp_lines;
char* ptr;
int title_bg,title_bg_alpha;
int item_bg,item_bg_alpha;
@@ -55,6 +56,7 @@ extern const menu_list_priv_t menu_list_
-1,-1, \
0,0, \
5, 3, \
+ 0, \
NULL, \
0xFF, 0xFF, \
0xFF, 0xFF, \
More information about the MPlayer-cvslog
mailing list