minimenu; 'menu' in the detail pane now has configurable max-visible count and can...
authorskeezix <skeezix@flotsam-vm.(none)>
Fri, 16 Apr 2010 19:03:14 +0000 (15:03 -0400)
committerskeezix <skeezix@flotsam-vm.(none)>
Fri, 16 Apr 2010 19:03:14 +0000 (15:03 -0400)
minimenu/mmui.c
minimenu/skin/default/mmskin.conf
minimenu/skin/perty/mmskin.conf

index 46b143b..b3ce9f7 100644 (file)
@@ -1937,6 +1937,8 @@ int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *f
   SDL_Rect *dest = rects;
   SDL_Rect src;
   SDL_Surface *rtext;
+  unsigned char max_visible = pnd_conf_get_as_int_d ( g_conf, "detailtext.max_visible" , 11 );
+  unsigned char first_visible = 0;
 
   bzero ( rects, sizeof(SDL_Rect) * 40 );
 
@@ -2011,7 +2013,7 @@ int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *f
     }
 
     // show options
-    for ( i = 0; i < argc; i++ ) {
+    for ( i = first_visible; i < first_visible + max_visible && i < argc; i++ ) {
 
       // show options
       if ( sel == i ) {
@@ -2020,7 +2022,7 @@ int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *f
        rtext = TTF_RenderText_Blended ( g_tab_font, argv [ i ], tmpfontcolor );
       }
       dest -> x = pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_x", 460 ) + 20;
-      dest -> y = pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_y", 60 ) + 40 + ( 20 * ( i + 1 ) );
+      dest -> y = pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_y", 60 ) + 40 + ( 20 * ( i + 1 - first_visible ) );
       SDL_BlitSurface ( rtext, NULL /* full src */, sdl_realscreen, dest );
       SDL_FreeSurface ( rtext );
       dest++;
@@ -2041,10 +2043,22 @@ int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *f
        if ( event.key.keysym.sym == SDLK_UP ) {
          if ( sel ) {
            sel--;
+
+           if ( sel < first_visible ) {
+             first_visible--;
+           }
+
          }
        } else if ( event.key.keysym.sym == SDLK_DOWN ) {
+
          if ( sel < argc - 1 ) {
            sel++;
+
+           // ensure visibility
+           if ( sel >= first_visible + max_visible ) {
+             first_visible++;
+           }
+
          }
 
        } else if ( event.key.keysym.sym == SDLK_RETURN ) {
index a516f2e..17646bc 100644 (file)
@@ -77,6 +77,7 @@ font_ptsize           16
 cell_offset_x          488     # left edge of text cell
 cell_offset_y          292     # top edge of text cell
 cell_width             250     # width of cell (for text clipping)
+max_visible            11      # max number of menu items can show in detail pane
 
 [previewpic]
 cell_offset_x          482     # left edge of text cell
index 796f465..0209410 100644 (file)
@@ -76,6 +76,7 @@ font_ptsize           16
 cell_offset_x          488     # left edge of text cell
 cell_offset_y          300     # top edge of text cell
 cell_width             250     # width of cell (for text clipping)
+max_visible            11      # max number of menu items can show in detail pane
 
 [previewpic]
 cell_offset_x          480     # left edge of text cell