added 'subcats as folders' option and support, set default ON.
[pandora-libraries.git] / minimenu / mmui.c
index 7a2e21d..2b34fa5 100644 (file)
@@ -34,6 +34,8 @@
 #include "mmcache.h"
 #include "mmui.h"
 #include "mmwrapcmd.h"
+#include "mmconf.h"
+#include "mmui_context.h"
 
 #define CHANGED_NOTHING     (0)
 #define CHANGED_CATEGORY    (1<<0)  /* changed to different category */
@@ -43,6 +45,8 @@
 #define CHANGED_EVERYTHING  (1<<4)  /* redraw it all! */
 unsigned int render_mask = CHANGED_EVERYTHING;
 
+#define MIMETYPE_EXE "/usr/bin/file"     /* check for file type prior to invocation */
+
 /* SDL
  */
 SDL_Surface *sdl_realscreen = NULL;
@@ -73,11 +77,9 @@ int ui_rows_scrolled_down = 0;          // number of rows that should be missing
 mm_appref_t *ui_selected = NULL;
 unsigned char ui_category = 0;          // current category
 unsigned char ui_catshift = 0;          // how many cats are offscreen to the left
-
-extern mm_category_t *g_categories;
-extern unsigned char g_categorycount;
-extern mm_category_t _categories_invis [ MAX_CATS ];
-extern unsigned char _categories_inviscount;
+ui_context_t ui_display_context;        // display paramaters: see mmui_context.h
+unsigned char ui_detail_hidden = 0;     // if >0, detail panel is hidden
+// FUTURE: If multiple panels can be shown/hidden, convert ui_detail_hidden to a bitmask
 
 static SDL_Surface *ui_scale_image ( SDL_Surface *s, unsigned int maxwidth, int maxheight ); // height -1 means ignore
 static int ui_selected_index ( void );
@@ -143,6 +145,9 @@ unsigned char ui_setup ( void ) {
   }
 #endif
 
+  // key repeat
+  SDL_EnableKeyRepeat ( 500, 150 );
+
   // images
   //IMG_Init ( IMG_INIT_JPG | IMG_INIT_PNG );
 
@@ -192,6 +197,14 @@ unsigned char ui_setup ( void ) {
     return ( 0 ); // couldn't set up SDL TTF
   }
 
+  // determine display context
+  if ( pnd_conf_get_as_int_d ( g_conf, "display.show_detail_pane", 1 ) > 0 ) {
+    ui_detail_hidden = 0;
+  } else {
+    ui_detail_hidden = 1;
+  }
+  ui_recache_context ( &ui_display_context );
+
   return ( 1 );
 }
 
@@ -323,56 +336,36 @@ void ui_render ( void ) {
   unsigned int row, displayrow, col;
   mm_appref_t *appiter;
 
-  unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
-
-  unsigned char row_max = pnd_conf_get_as_int_d ( g_conf, "grid.row_max", 4 );
-  unsigned char col_max = pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 );
-
-  unsigned int font_rgba_r = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_r", 200 );
-  unsigned int font_rgba_g = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_g", 200 );
-  unsigned int font_rgba_b = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_b", 200 );
-  unsigned int font_rgba_a = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_a", 100 );
-
-  unsigned int grid_offset_x = pnd_conf_get_as_int ( g_conf, "grid.grid_offset_x" );
-  unsigned int grid_offset_y = pnd_conf_get_as_int ( g_conf, "grid.grid_offset_y" );
-
-  unsigned int icon_offset_x = pnd_conf_get_as_int ( g_conf, "grid.icon_offset_x" );
-  unsigned int icon_offset_y = pnd_conf_get_as_int ( g_conf, "grid.icon_offset_y" );
-  unsigned int icon_max_width = pnd_conf_get_as_int ( g_conf, "grid.icon_max_width" );
-  unsigned int icon_max_height = pnd_conf_get_as_int ( g_conf, "grid.icon_max_height" );
-  unsigned int sel_icon_offset_x = pnd_conf_get_as_int_d ( g_conf, "grid.sel_offoffset_x", 0 );
-  unsigned int sel_icon_offset_y = pnd_conf_get_as_int_d ( g_conf, "grid.sel_offoffset_y", 0 );
-
-  unsigned int text_width = pnd_conf_get_as_int ( g_conf, "grid.text_width" );
-  unsigned int text_clip_x = pnd_conf_get_as_int ( g_conf, "grid.text_clip_x" );
-  unsigned int text_offset_x = pnd_conf_get_as_int ( g_conf, "grid.text_offset_x" );
-  unsigned int text_offset_y = pnd_conf_get_as_int ( g_conf, "grid.text_offset_y" );
-
-  unsigned int cell_width = pnd_conf_get_as_int ( g_conf, "grid.cell_width" );
-  unsigned int cell_height = pnd_conf_get_as_int ( g_conf, "grid.cell_height" );
+  ui_context_t *c = &ui_display_context; // for convenience and shorthand
 
   // how many total rows do we need?
-  icon_rows = g_categories [ ui_category ].refcount / col_max;
-  if ( g_categories [ ui_category ].refcount % col_max > 0 ) {
-    icon_rows++;
+  if ( g_categorycount ) {
+    icon_rows = g_categories [ ui_category ] -> refcount / c -> col_max;
+    if ( g_categories [ ui_category ] -> refcount % c -> col_max > 0 ) {
+      icon_rows++;
+    }
+  } else {
+    icon_rows = 0;
   }
 
+#if 1
   // if no selected app yet, select the first one
-#if 0
-  if ( ! ui_selected ) {
-    ui_selected = g_categories [ ui_category ].refs;
+  if ( ! ui_selected && pnd_conf_get_as_int_d ( g_conf, "minimenu.start_selected", 0 ) ) {
+    ui_selected = g_categories [ ui_category ] -> refs;
   }
 #endif
 
   // reset touchscreen regions
-  ui_register_reset();
+  if ( render_jobs_b ) {
+    ui_register_reset();
+  }
 
   // ensure selection is visible
   if ( ui_selected ) {
 
     int index = ui_selected_index();
-    int topleft = col_max * ui_rows_scrolled_down;
-    int botright = ( col_max * ( ui_rows_scrolled_down + row_max ) - 1 );
+    int topleft = c -> col_max * ui_rows_scrolled_down;
+    int botright = ( c -> col_max * ( ui_rows_scrolled_down + c -> row_max ) - 1 );
 
     if ( index < topleft ) {
       ui_rows_scrolled_down -= pnd_conf_get_as_int_d ( g_conf, "grid.scroll_increment", 1 );
@@ -416,16 +409,28 @@ void ui_render ( void ) {
 
   // tabs
   if ( g_imagecache [ IMG_TAB_SEL ].i && g_imagecache [ IMG_TAB_UNSEL ].i ) {
-    unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" );
-    unsigned int tab_height = pnd_conf_get_as_int ( g_conf, "tabs.tab_height" );
-    //unsigned int tab_selheight = pnd_conf_get_as_int ( g_conf, "tabs.tab_selheight" );
-    unsigned int tab_offset_x = pnd_conf_get_as_int ( g_conf, "tabs.tab_offset_x" );
-    unsigned int tab_offset_y = pnd_conf_get_as_int ( g_conf, "tabs.tab_offset_y" );
-    unsigned int text_offset_x = pnd_conf_get_as_int ( g_conf, "tabs.text_offset_x" );
-    unsigned int text_offset_y = pnd_conf_get_as_int ( g_conf, "tabs.text_offset_y" );
-    unsigned int text_width = pnd_conf_get_as_int ( g_conf, "tabs.text_width" );
-    unsigned int maxtab = ( screen_width / tab_width ) < g_categorycount ? ( screen_width / tab_width ) + ui_catshift : g_categorycount + ui_catshift;
-    unsigned int maxtabspot = ( screen_width / tab_width );
+    static unsigned int tab_width;
+    static unsigned int tab_height;
+    static unsigned int tab_offset_x;
+    static unsigned int tab_offset_y;
+    static unsigned int text_offset_x;
+    static unsigned int text_offset_y;
+    static unsigned int text_width;
+
+    static unsigned char tab_first_run = 1;
+    if ( tab_first_run ) {
+      tab_first_run = 0;
+      tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" );
+      tab_height = pnd_conf_get_as_int ( g_conf, "tabs.tab_height" );
+      tab_offset_x = pnd_conf_get_as_int ( g_conf, "tabs.tab_offset_x" );
+      tab_offset_y = pnd_conf_get_as_int ( g_conf, "tabs.tab_offset_y" );
+      text_offset_x = pnd_conf_get_as_int ( g_conf, "tabs.text_offset_x" );
+      text_offset_y = pnd_conf_get_as_int ( g_conf, "tabs.text_offset_y" );
+      text_width = pnd_conf_get_as_int ( g_conf, "tabs.text_width" );
+    }
+
+    unsigned int maxtab = ( c -> screen_width / tab_width ) < g_categorycount ? ( c -> screen_width / tab_width ) + ui_catshift : g_categorycount + ui_catshift;
+    unsigned int maxtabspot = ( c -> screen_width / tab_width );
 
     if ( g_categorycount > 0 ) {
 
@@ -512,8 +517,7 @@ void ui_render ( void ) {
 
          // draw text
          SDL_Surface *rtext;
-         SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-         rtext = TTF_RenderText_Blended ( g_tab_font, g_categories [ col ].catname, tmpfontcolor );
+         rtext = TTF_RenderText_Blended ( g_tab_font, g_categories [ col ] -> catname, c -> fontcolor );
          src.x = 0;
          src.y = 0;
          src.w = rtext -> w < text_width ? rtext -> w : text_width;
@@ -560,8 +564,8 @@ void ui_render ( void ) {
 
     // up?
     if ( ui_rows_scrolled_down && g_imagecache [ IMG_ARROW_UP ].i ) {
-      dest -> x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_up_x", 450 );
-      dest -> y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_up_y", 80 );
+      dest -> x = c -> arrow_up_x;
+      dest -> y = c -> arrow_up_y;
       SDL_BlitSurface ( g_imagecache [ IMG_ARROW_UP ].i, NULL /* whole image */, sdl_realscreen, dest );
       dest++;
 
@@ -569,9 +573,9 @@ void ui_render ( void ) {
     }
 
     // down?
-    if ( ui_rows_scrolled_down + row_max < icon_rows && g_imagecache [ IMG_ARROW_DOWN ].i ) {
-      dest -> x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_down_x", 450 );
-      dest -> y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_down_y", 80 );
+    if ( ui_rows_scrolled_down + c -> row_max < icon_rows && g_imagecache [ IMG_ARROW_DOWN ].i ) {
+      dest -> x = c -> arrow_down_x;
+      dest -> y = c -> arrow_down_y;
       SDL_BlitSurface ( g_imagecache [ IMG_ARROW_DOWN ].i, NULL /* whole image */, sdl_realscreen, dest );
       dest++;
 
@@ -582,10 +586,10 @@ void ui_render ( void ) {
       // show scrollbar as well
       src.x = 0;
       src.y = 0;
-      src.w = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_clip_w", 10 );
-      src.h = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_clip_h", 100 );
-      dest -> x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_x", 450 );
-      dest -> y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_y", 100 );
+      src.w = c -> arrow_bar_clip_w;
+      src.h = c -> arrow_bar_clip_h;
+      dest -> x = c -> arrow_bar_x;
+      dest -> y = c -> arrow_bar_y;
       SDL_BlitSurface ( g_imagecache [ IMG_ARROW_SCROLLBAR ].i, &src /* whole image */, sdl_realscreen, dest );
       dest++;
     } // bar
@@ -593,7 +597,7 @@ void ui_render ( void ) {
   } // r_bg, scroll bars
 
   // render detail pane bg
-  if ( render_jobs_b & R_DETAIL ) {
+  if ( render_jobs_b & R_DETAIL && ui_detail_hidden == 0 ) {
 
     if ( pnd_conf_get_as_int_d ( g_conf, "detailpane.show", 1 ) ) {
 
@@ -622,18 +626,18 @@ void ui_render ( void ) {
   } // r_details
 
   // anything to render?
-  if ( render_jobs_b & R_GRID ) {
+  if ( render_jobs_b & R_GRID && g_categorycount ) {
 
     // if just rendering grid, and nothing else, better clear it first
     if ( ! ( render_jobs_b & R_BG ) ) {
       if ( g_imagecache [ IMG_BACKGROUND_800480 ].i ) {
-       src.x = grid_offset_x;
-       src.y = grid_offset_y + sel_icon_offset_y;
-       src.w = col_max * cell_width;
-       src.h = row_max * cell_height;
+       src.x = c -> grid_offset_x;
+       src.y = c -> grid_offset_y + c -> sel_icon_offset_y;
+       src.w = c -> col_max * c -> cell_width;
+       src.h = c -> row_max * c -> cell_height;
 
-       dest -> x = grid_offset_x;
-       dest -> y = grid_offset_y + sel_icon_offset_y;
+       dest -> x = c -> grid_offset_x;
+       dest -> y = c -> grid_offset_y + c -> sel_icon_offset_y;
 
        SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_800480 ].i, &src, sdl_realscreen, dest );
        dest++;
@@ -641,16 +645,16 @@ void ui_render ( void ) {
       }
     }
 
-    if ( g_categories [ ui_category ].refs ) {
+    if ( g_categories [ ui_category ] -> refs ) {
 
-      appiter = g_categories [ ui_category ].refs;
+      appiter = g_categories [ ui_category ] -> refs;
       row = 0;
       displayrow = 0;
 
       // until we run out of apps, or run out of space
       while ( appiter != NULL ) {
 
-       for ( col = 0; col < col_max && appiter != NULL; col++ ) {
+       for ( col = 0; col < c -> col_max && appiter != NULL; col++ ) {
 
          // do we even need to render it? or are we suppressing it due to rows scrolled off the top?
          if ( row >= ui_rows_scrolled_down ) {
@@ -660,14 +664,14 @@ void ui_render ( void ) {
              SDL_Surface *s = g_imagecache [ IMG_SELECTED_ALPHAMASK ].i;
              // icon
              //dest -> x = grid_offset_x + ( col * cell_width ) + icon_offset_x + ( ( icon_max_width - s -> w ) / 2 );
-             dest -> x = grid_offset_x + ( col * cell_width ) + icon_offset_x + sel_icon_offset_x;
+             dest -> x = c -> grid_offset_x + ( col * c -> cell_width ) + c -> icon_offset_x + c -> sel_icon_offset_x;
              //dest -> y = grid_offset_y + ( displayrow * cell_height ) + icon_offset_y + ( ( icon_max_height - s -> h ) / 2 );
-             dest -> y = grid_offset_y + ( displayrow * cell_height ) + icon_offset_y + sel_icon_offset_y;
+             dest -> y = c -> grid_offset_y + ( displayrow * c -> cell_height ) + c -> icon_offset_y + c -> sel_icon_offset_y;
              SDL_BlitSurface ( s, NULL /* all */, sdl_realscreen, dest );
              dest++;
              // text
-             dest -> x = grid_offset_x + ( col * cell_width ) + text_clip_x;
-             dest -> y = grid_offset_y + ( displayrow * cell_height ) + pnd_conf_get_as_int ( g_conf, "grid.text_hilite_offset_y" );
+             dest -> x = c -> grid_offset_x + ( col * c -> cell_width ) + c -> text_clip_x;
+             dest -> y = c -> grid_offset_y + ( displayrow * c -> cell_height ) + c -> text_hilite_offset_y;
              SDL_BlitSurface ( g_imagecache [ IMG_SELECTED_HILITE ].i, NULL /* all */, sdl_realscreen, dest );
              dest++;
            } // selected?
@@ -702,8 +706,8 @@ void ui_render ( void ) {
              src.y = 0;
              src.w = 60;
              src.h = 60;
-             dest -> x = grid_offset_x + ( col * cell_width ) + icon_offset_x + (( icon_max_width - iconsurface -> w ) / 2);
-             dest -> y = grid_offset_y + ( displayrow * cell_height ) + icon_offset_y + (( icon_max_height - iconsurface -> h ) / 2);
+             dest -> x = c -> grid_offset_x + ( col * c -> cell_width ) + c -> icon_offset_x + (( c -> icon_max_width - iconsurface -> w ) / 2);
+             dest -> y = c -> grid_offset_y + ( displayrow * c -> cell_height ) + c -> icon_offset_y + (( c -> icon_max_height - iconsurface -> h ) / 2);
 
              SDL_BlitSurface ( iconsurface, &src, sdl_realscreen, dest );
 
@@ -717,18 +721,17 @@ void ui_render ( void ) {
            // show text
            if ( appiter -> ref -> title_en ) {
              SDL_Surface *rtext;
-             SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-             rtext = TTF_RenderText_Blended ( g_grid_font, appiter -> ref -> title_en, tmpfontcolor );
+             rtext = TTF_RenderText_Blended ( g_grid_font, appiter -> ref -> title_en, c -> fontcolor );
              src.x = 0;
              src.y = 0;
-             src.w = text_width < rtext -> w ? text_width : rtext -> w;
+             src.w = c -> text_width < rtext -> w ? c -> text_width : rtext -> w;
              src.h = rtext -> h;
-             if ( rtext -> w > text_width ) {
-               dest -> x = grid_offset_x + ( col * cell_width ) + text_clip_x;
+             if ( rtext -> w > c -> text_width ) {
+               dest -> x = c -> grid_offset_x + ( col * c -> cell_width ) + c -> text_clip_x;
              } else {
-               dest -> x = grid_offset_x + ( col * cell_width ) + text_offset_x - ( rtext -> w / 2 );
+               dest -> x = c -> grid_offset_x + ( col * c -> cell_width ) + c -> text_offset_x - ( rtext -> w / 2 );
              }
-             dest -> y = grid_offset_y + ( displayrow * cell_height ) + text_offset_y;
+             dest -> y = c -> grid_offset_y + ( displayrow * c -> cell_height ) + c -> text_offset_y;
              SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
              SDL_FreeSurface ( rtext );
              dest++;
@@ -748,7 +751,7 @@ void ui_render ( void ) {
        row ++;
 
        // are we done displaying rows?
-       if ( displayrow >= row_max ) {
+       if ( displayrow >= c -> row_max ) {
          break;
        }
 
@@ -761,8 +764,8 @@ void ui_render ( void ) {
 
   } // r_grid
 
-  // detail panel
-  if ( ui_selected && render_jobs_b & R_DETAIL ) {
+  // detail panel - show app details or blank-message
+  if ( render_jobs_b & R_DETAIL && ui_detail_hidden == 0 ) {
 
     unsigned int cell_offset_x = pnd_conf_get_as_int ( g_conf, "detailtext.cell_offset_x" );
     unsigned int cell_offset_y = pnd_conf_get_as_int ( g_conf, "detailtext.cell_offset_y" );
@@ -770,91 +773,157 @@ void ui_render ( void ) {
 
     unsigned int desty = cell_offset_y;
 
-    char buffer [ 256 ];
+    if ( ui_selected ) {
 
-    // full name
-    if ( ui_selected -> ref -> title_en ) {
-      SDL_Surface *rtext;
-      SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-      rtext = TTF_RenderText_Blended ( g_detailtext_font, ui_selected -> ref -> title_en, tmpfontcolor );
-      src.x = 0;
-      src.y = 0;
-      src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
-      src.h = rtext -> h;
-      dest -> x = cell_offset_x;
-      dest -> y = desty;
-      SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
-      SDL_FreeSurface ( rtext );
-      dest++;
-      desty += src.h;
-    }
+      char buffer [ 256 ];
+
+      // full name
+      if ( ui_selected -> ref -> title_en ) {
+       SDL_Surface *rtext;
+       rtext = TTF_RenderText_Blended ( g_detailtext_font, ui_selected -> ref -> title_en, c -> fontcolor );
+       src.x = 0;
+       src.y = 0;
+       src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
+       src.h = rtext -> h;
+       dest -> x = cell_offset_x;
+       dest -> y = desty;
+       SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
+       SDL_FreeSurface ( rtext );
+       dest++;
+       desty += src.h;
+      }
 
-    // category
+      // category
 #if 0
-    if ( ui_selected -> ref -> main_category ) {
+      if ( ui_selected -> ref -> main_category ) {
 
-      sprintf ( buffer, "Category: %s", ui_selected -> ref -> main_category );
+       sprintf ( buffer, "Category: %s", ui_selected -> ref -> main_category );
 
-      SDL_Surface *rtext;
-      SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-      rtext = TTF_RenderText_Blended ( g_detailtext_font, buffer, tmpfontcolor );
-      src.x = 0;
-      src.y = 0;
-      src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
-      src.h = rtext -> h;
-      dest -> x = cell_offset_x;
-      dest -> y = desty;
-      SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
-      SDL_FreeSurface ( rtext );
-      dest++;
-      desty += src.h;
-    }
+       SDL_Surface *rtext;
+       rtext = TTF_RenderText_Blended ( g_detailtext_font, buffer, c -> fontcolor );
+       src.x = 0;
+       src.y = 0;
+       src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
+       src.h = rtext -> h;
+       dest -> x = cell_offset_x;
+       dest -> y = desty;
+       SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
+       SDL_FreeSurface ( rtext );
+       dest++;
+       desty += src.h;
+      }
 #endif
 
-    // clock
-    if ( ui_selected -> ref -> clockspeed ) {
+      // clock
+      if ( ui_selected -> ref -> clockspeed ) {
 
-      sprintf ( buffer, "CPU Clock: %s", ui_selected -> ref -> clockspeed );
+       sprintf ( buffer, "CPU Clock: %s", ui_selected -> ref -> clockspeed );
 
-      SDL_Surface *rtext;
-      SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-      rtext = TTF_RenderText_Blended ( g_detailtext_font, buffer, tmpfontcolor );
-      src.x = 0;
-      src.y = 0;
-      src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
-      src.h = rtext -> h;
-      dest -> x = cell_offset_x;
-      dest -> y = desty;
-      SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
-      SDL_FreeSurface ( rtext );
-      dest++;
-      desty += src.h;
-    }
-
-    // show sub-app# on right side of cpu clock?
-    //if ( ui_selected -> ref -> subapp_number )
-    {
-      sprintf ( buffer, "(app#%u)", ui_selected -> ref -> subapp_number );
+       SDL_Surface *rtext;
+       rtext = TTF_RenderText_Blended ( g_detailtext_font, buffer, c -> fontcolor );
+       src.x = 0;
+       src.y = 0;
+       src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
+       src.h = rtext -> h;
+       dest -> x = cell_offset_x;
+       dest -> y = desty;
+       SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
+       SDL_FreeSurface ( rtext );
+       dest++;
+       desty += src.h;
+      }
 
-      SDL_Surface *rtext;
-      SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-      rtext = TTF_RenderText_Blended ( g_grid_font, buffer, tmpfontcolor );
-      dest -> x = cell_offset_x + cell_width - rtext -> w;
-      dest -> y = desty - src.h;
-      SDL_BlitSurface ( rtext, NULL /* full src */, sdl_realscreen, dest );
-      SDL_FreeSurface ( rtext );
-      dest++;
-    }
+      // show sub-app# on right side of cpu clock?
+      //if ( ui_selected -> ref -> subapp_number )
+      {
+       sprintf ( buffer, "(app#%u)", ui_selected -> ref -> subapp_number );
+
+       SDL_Surface *rtext;
+       rtext = TTF_RenderText_Blended ( g_grid_font, buffer, c -> fontcolor );
+       dest -> x = cell_offset_x + cell_width - rtext -> w;
+       dest -> y = desty - src.h;
+       SDL_BlitSurface ( rtext, NULL /* full src */, sdl_realscreen, dest );
+       SDL_FreeSurface ( rtext );
+       dest++;
+      }
 
-    // info hint
+      // info hint
 #if 0 // merged into hint-line
-    if ( ui_selected -> ref -> info_filename ) {
+      if ( ui_selected -> ref -> info_filename ) {
+
+       sprintf ( buffer, "Documentation - hit Y" );
+
+       SDL_Surface *rtext;
+       rtext = TTF_RenderText_Blended ( g_detailtext_font, buffer, c -> fontcolor );
+       src.x = 0;
+       src.y = 0;
+       src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
+       src.h = rtext -> h;
+       dest -> x = cell_offset_x;
+       dest -> y = desty;
+       SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
+       SDL_FreeSurface ( rtext );
+       dest++;
+       desty += src.h;
+      }
+#endif
+
+      // notes
+      if ( ui_selected -> ovrh ) {
+       char *n;
+       unsigned char i;
+       char buffer [ 50 ];
+
+       desty += 5; // a touch of spacing can't hurt
+
+       for ( i = 1; i < 4; i++ ) {
+         sprintf ( buffer, "Application-%u.note-%u", ui_selected -> ref -> subapp_number, i );
+         n = pnd_conf_get_as_char ( ui_selected -> ovrh, buffer );
+
+         if ( n ) {
+           SDL_Surface *rtext;
+           rtext = TTF_RenderText_Blended ( g_detailtext_font, n, c -> fontcolor );
+           src.x = 0;
+           src.y = 0;
+           src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
+           src.h = rtext -> h;
+           dest -> x = cell_offset_x;
+           dest -> y = desty;
+           SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
+           SDL_FreeSurface ( rtext );
+           dest++;
+           desty += rtext -> h;
+         }
+       } // for
+
+      } // r_detail -> notes
+
+      // preview pic
+      mm_cache_t *ic = cache_query_preview ( ui_selected -> ref -> unique_id );
+      SDL_Surface *previewpic;
+
+      if ( ic ) {
+       previewpic = ic -> i;
+      } else {
+       previewpic = g_imagecache [ IMG_PREVIEW_MISSING ].i;
+      }
 
-      sprintf ( buffer, "Documentation - hit Y" );
+      if ( previewpic ) {
+       dest -> x = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_offset_x", 50 ) +
+         ( ( pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_width", 50 ) - previewpic -> w ) / 2 );
+       dest -> y = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_offset_y", 50 );
+       SDL_BlitSurface ( previewpic, NULL /* whole image */, sdl_realscreen, dest );
+       dest++;
+      }
+
+    } else {
+
+      char *empty_message = "Press SELECT for menu";
 
       SDL_Surface *rtext;
-      SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-      rtext = TTF_RenderText_Blended ( g_detailtext_font, buffer, tmpfontcolor );
+
+      rtext = TTF_RenderText_Blended ( g_detailtext_font, empty_message, c -> fontcolor );
+
       src.x = 0;
       src.y = 0;
       src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
@@ -864,60 +933,12 @@ void ui_render ( void ) {
       SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
       SDL_FreeSurface ( rtext );
       dest++;
-      desty += src.h;
-    }
-#endif
-
-    // notes
-    if ( ui_selected -> ovrh ) {
-      char *n;
-      unsigned char i;
-      char buffer [ 50 ];
-
-      desty += 5; // a touch of spacing can't hurt
-
-      for ( i = 1; i < 4; i++ ) {
-       sprintf ( buffer, "Application-%u.note-%u", ui_selected -> ref -> subapp_number, i );
-       n = pnd_conf_get_as_char ( ui_selected -> ovrh, buffer );
 
-       if ( n ) {
-         SDL_Surface *rtext;
-         SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-         rtext = TTF_RenderText_Blended ( g_detailtext_font, n, tmpfontcolor );
-         src.x = 0;
-         src.y = 0;
-         src.w = rtext -> w < cell_width ? rtext -> w : cell_width;
-         src.h = rtext -> h;
-         dest -> x = cell_offset_x;
-         dest -> y = desty;
-         SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
-         SDL_FreeSurface ( rtext );
-         dest++;
-         desty += rtext -> h;
-       }
-      } // for
-
-    } // r_detail -> notes
-
-    // preview pic
-    mm_cache_t *ic = cache_query_preview ( ui_selected -> ref -> unique_id );
-    SDL_Surface *previewpic;
-
-    if ( ic ) {
-      previewpic = ic -> i;
-    } else {
-      previewpic = g_imagecache [ IMG_PREVIEW_MISSING ].i;
-    }
+      desty += src.h;
 
-    if ( previewpic ) {
-      dest -> x = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_offset_x", 50 ) +
-       ( ( pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_width", 50 ) - previewpic -> w ) / 2 );
-      dest -> y = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_offset_y", 50 );
-      SDL_BlitSurface ( previewpic, NULL /* whole image */, sdl_realscreen, dest );
-      dest++;
-    }
+    } // r_detail && selected?
 
-  } // r_detail && selected?
+  } // r_detail
 
   // extras
   //
@@ -936,8 +957,7 @@ void ui_render ( void ) {
     sprintf ( buffer, "Battery: %u%%", batterylevel );
 
     SDL_Surface *rtext;
-    SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-    rtext = TTF_RenderText_Blended ( g_grid_font, buffer, tmpfontcolor );
+    rtext = TTF_RenderText_Blended ( g_grid_font, buffer, c -> fontcolor );
     dest -> x = pnd_conf_get_as_int_d ( g_conf, "display.battery_x", 20 );
     dest -> y = pnd_conf_get_as_int_d ( g_conf, "display.battery_y", 450 );
     SDL_BlitSurface ( rtext, NULL /* all */, sdl_realscreen, dest );
@@ -960,8 +980,7 @@ void ui_render ( void ) {
     }
 
     SDL_Surface *rtext;
-    SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-    rtext = TTF_RenderText_Blended ( g_grid_font, buffer, tmpfontcolor );
+    rtext = TTF_RenderText_Blended ( g_grid_font, buffer, c -> fontcolor );
 
     // clear bg
     if ( ! ( render_jobs_b & R_BG ) ) {
@@ -995,8 +1014,7 @@ void ui_render ( void ) {
     strftime ( buffer, 50, "%a %H:%M %F", tm );
 
     SDL_Surface *rtext;
-    SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-    rtext = TTF_RenderText_Blended ( g_grid_font, buffer, tmpfontcolor );
+    rtext = TTF_RenderText_Blended ( g_grid_font, buffer, c -> fontcolor );
     dest -> x = pnd_conf_get_as_int_d ( g_conf, "display.clock_x", 700 );
     dest -> y = pnd_conf_get_as_int_d ( g_conf, "display.clock_y", 450 );
     SDL_BlitSurface ( rtext, NULL /* all */, sdl_realscreen, dest );
@@ -1031,6 +1049,10 @@ void ui_process_input ( unsigned char block_p ) {
        // timer went off, time to load something
        if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.load_previews_later", 0 ) ) {
 
+         if ( ! ui_selected ) {
+           break;
+         }
+
          // load the preview pics now!
          pnd_disco_t *iter = ui_selected -> ref;
 
@@ -1173,11 +1195,14 @@ void ui_process_input ( unsigned char block_p ) {
 #endif
 
 #if 1 // keyboard events
-    case SDL_KEYUP:
+    //case SDL_KEYUP:
+    case SDL_KEYDOWN:
 
       //pnd_log ( pndn_debug, "key up %u\n", event.key.keysym.sym );
 
       // SDLK_LALT -> Start
+      // page up/down for y/x
+      // home/end for a and b
 
       // directional
       if ( event.key.keysym.sym == SDLK_RIGHT ) {
@@ -1192,16 +1217,25 @@ void ui_process_input ( unsigned char block_p ) {
       } else if ( event.key.keysym.sym == SDLK_DOWN ) {
        ui_push_down();
        ui_event++;
-      } else if ( event.key.keysym.sym == SDLK_SPACE || event.key.keysym.sym == SDLK_END ) {
+      } else if ( event.key.keysym.sym == SDLK_SPACE || event.key.keysym.sym == SDLK_END ) { // space or B
        ui_push_exec();
        ui_event++;
-      } else if ( event.key.keysym.sym == SDLK_RSHIFT ) {
+      } else if ( event.key.keysym.sym == SDLK_TAB || event.key.keysym.sym == SDLK_HOME ) { // tab or A
+       // if detail panel is togglable, then toggle it
+       // if not, make sure its ruddy well shown!
+       if ( ui_is_detail_hideable() ) {
+         ui_toggle_detail_pane();
+       } else {
+         ui_detail_hidden = 0;
+       }
+       ui_event++;
+      } else if ( event.key.keysym.sym == SDLK_RSHIFT || event.key.keysym.sym == SDLK_COMMA ) { // left trigger or comma
        ui_push_ltrigger();
        ui_event++;
-      } else if ( event.key.keysym.sym == SDLK_RCTRL ) {
+      } else if ( event.key.keysym.sym == SDLK_RCTRL || event.key.keysym.sym == SDLK_PERIOD ) { // right trigger or period
        ui_push_rtrigger();
        ui_event++;
-      } else if ( event.key.keysym.sym == SDLK_PAGEUP ) {
+      } else if ( event.key.keysym.sym == SDLK_PAGEUP ) { // Y
        // info
        if ( ui_selected ) {
          ui_show_info ( pnd_run_script, ui_selected -> ref );
@@ -1216,6 +1250,7 @@ void ui_process_input ( unsigned char block_p ) {
        char *opts [ 20 ] = {
          "Reveal hidden category",
          "Shutdown Pandora",
+         "Configure Minimenu",
          "Rescan for applications",
          "Cache previews to SD now",
          "Run a terminal/console",
@@ -1224,7 +1259,7 @@ void ui_process_input ( unsigned char block_p ) {
          "Select a Minimenu skin",
          "About Minimenu"
        };
-       int sel = ui_modal_single_menu ( opts, 9, "Minimenu", "Enter to select; other to return." );
+       int sel = ui_modal_single_menu ( opts, 10, "Minimenu", "Enter to select; other to return." );
 
        char buffer [ 100 ];
        if ( sel == 0 ) {
@@ -1235,12 +1270,19 @@ void ui_process_input ( unsigned char block_p ) {
          sprintf ( buffer, "sudo poweroff" );
          system ( buffer );
        } else if ( sel == 2 ) {
+         // configure mm
+         unsigned char restart = conf_run_menu ( NULL );
+         conf_write ( g_conf, conf_determine_location ( g_conf ) );
+         if ( restart ) {
+           emit_and_quit ( MM_RESTART );
+         }
+       } else if ( sel == 3 ) {
          // rescan apps
          pnd_log ( pndn_debug, "Freeing up applications\n" );
          applications_free();
          pnd_log ( pndn_debug, "Rescanning applications\n" );
          applications_scan();
-       } else if ( sel == 3 ) {
+       } else if ( sel == 4 ) {
          // cache preview to SD now
          extern pnd_box_handle g_active_apps;
          pnd_box_handle h = g_active_apps;
@@ -1263,7 +1305,7 @@ void ui_process_input ( unsigned char block_p ) {
            iter = pnd_box_get_next ( iter );
          } // while
 
-       } else if ( sel == 4 ) {
+       } else if ( sel == 5 ) {
          // run terminal
          char *argv[5];
          argv [ 0 ] = pnd_conf_get_as_char ( g_conf, "utility.terminal" );
@@ -1273,18 +1315,18 @@ void ui_process_input ( unsigned char block_p ) {
            ui_forkexec ( argv );
          }
 
-       } else if ( sel == 5 ) {
+       } else if ( sel == 6 ) {
          char buffer [ PATH_MAX ];
          sprintf ( buffer, "%s %s\n", MM_RUN, "/usr/pandora/scripts/op_switchgui.sh" );
          emit_and_quit ( buffer );
-       } else if ( sel == 6 ) {
-         emit_and_quit ( MM_QUIT );
        } else if ( sel == 7 ) {
+         emit_and_quit ( MM_QUIT );
+       } else if ( sel == 8 ) {
          // select skin
          if ( ui_pick_skin() ) {
            emit_and_quit ( MM_RESTART );
          }
-       } else if ( sel == 8 ) {
+       } else if ( sel == 9 ) {
          // about
          char buffer [ PATH_MAX ];
          sprintf ( buffer, "%s/about.txt", g_skinpath );
@@ -1300,16 +1342,31 @@ void ui_process_input ( unsigned char block_p ) {
        // many SDLK_keycodes map to ASCII ("a" is ascii(a)), so try to jump to a filename of that name, in this category?
        // and if already there, try to jump to next, maybe?
        // future: look for sequence typing? ie: user types 'm' then 'a', look for 'ma*' instead of 'm' then 'a' matching
-       if ( isalpha ( event.key.keysym.sym ) && g_categories [ ui_category ].refcount > 0 ) {
-         mm_appref_t *app = g_categories [ ui_category ].refs;
+       if ( isalpha ( event.key.keysym.sym ) && g_categories [ ui_category ] -> refcount > 0 ) {
+         mm_appref_t *app = g_categories [ ui_category ] -> refs;
+
+         //fprintf ( stderr, "sel %s next %s\n", ui_selected -> ref -> title_en, ui_selected -> next -> ref -> title_en );
+
+         // are we already matching the same char? and next item is also same char?
+         if ( app && ui_selected &&
+              ui_selected -> ref -> title_en && ui_selected -> next -> ref -> title_en &&
+              toupper ( ui_selected -> ref -> title_en [ 0 ] ) == toupper ( ui_selected -> next -> ref -> title_en [ 0 ] ) &&
+              toupper ( ui_selected -> ref -> title_en [ 0 ] ) == toupper ( event.key.keysym.sym )
+            )
+         {
+           // just skip down one
+           app = ui_selected -> next;
+         } else {
 
-         // walk the category, looking for a first-char match
-         while ( app ) {
-           if ( app -> ref -> title_en && toupper ( app -> ref -> title_en [ 0 ] ) == toupper ( event.key.keysym.sym ) ) {
-             break;
+           // walk the category, looking for a first-char match
+           while ( app ) {
+             if ( app -> ref -> title_en && toupper ( app -> ref -> title_en [ 0 ] ) == toupper ( event.key.keysym.sym ) ) {
+               break;
+             }
+             app = app -> next;
            }
-           app = app -> next;
-         }
+
+         } // same start letter, or new run?
 
          // found something, or no?
          if ( app ) {
@@ -1318,13 +1375,17 @@ void ui_process_input ( unsigned char block_p ) {
            ui_set_selected ( ui_selected );
          }
 
+
+
+
+
        } // SDLK_alphanumeric?
 
       } // SDLK_....
 
       // extras
-#if 0
-      if ( event.key.keysym.sym == SDLK_q ) {
+#if 1
+      if ( event.key.keysym.sym == SDLK_ESCAPE ) {
        emit_and_quit ( MM_QUIT );
       }
 #endif
@@ -1379,18 +1440,18 @@ void ui_push_left ( unsigned char forcecoil ) {
        pnd_conf_get_as_int_d ( g_conf, "grid.wrap_horiz_samerow", 0 ) &&
        col == 0 )
   {
-    unsigned int i = pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 ) - 1;
+    unsigned int i = ui_display_context.col_max - 1;
     while ( i && ui_selected -> next ) {
       ui_push_right ( 0 );
       i--;
     }
 
-  } else if ( g_categories [ ui_category ].refs == ui_selected ) {
+  } else if ( g_categories [ ui_category ] -> refs == ui_selected ) {
     // can't go any more left, we're at the head
 
   } else {
     // figure out the previous item; yay for singly linked list :/
-    mm_appref_t *i = g_categories [ ui_category ].refs;
+    mm_appref_t *i = g_categories [ ui_category ] -> refs;
     while ( i ) {
       if ( i -> next == ui_selected ) {
        ui_selected = i;
@@ -1416,7 +1477,7 @@ void ui_push_right ( unsigned char forcecoil ) {
     if ( forcecoil == 0 &&
         pnd_conf_get_as_int_d ( g_conf, "grid.wrap_horiz_samerow", 0 ) &&
         // and selected is far-right, or last icon in category (might not be far right)
-        ( ( col == pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 ) - 1 ) ||
+        ( ( col == ui_display_context.col_max - 1 ) ||
           ( ui_selected -> next == NULL ) )
        )
     {
@@ -1437,7 +1498,7 @@ void ui_push_right ( unsigned char forcecoil ) {
     }
 
   } else {
-    ui_selected = g_categories [ ui_category ].refs;
+    ui_selected = g_categories [ ui_category ] -> refs;
   }
 
   ui_set_selected ( ui_selected );
@@ -1446,7 +1507,7 @@ void ui_push_right ( unsigned char forcecoil ) {
 }
 
 void ui_push_up ( void ) {
-  unsigned char col_max = pnd_conf_get_as_int ( g_conf, "grid.col_max" );
+  unsigned char col_max = ui_display_context.col_max;
 
   if ( ! ui_selected ) {
     return;
@@ -1456,14 +1517,14 @@ void ui_push_up ( void ) {
   unsigned int row = ui_determine_row ( ui_selected );
 
   if ( row == 0 &&
-       pnd_conf_get_as_int_d ( g_conf, "grid.wrap_vert_stop", 1 ) == 0 )
+       pnd_conf_get_as_int_d ( g_conf, "grid.wrap_vert_stop", 0 ) == 0 )
   {
     // wrap around instead
 
     unsigned int col = ui_determine_screen_col ( ui_selected );
 
     // go to end
-    ui_selected = g_categories [ ui_category ].refs;
+    ui_selected = g_categories [ ui_category ] -> refs;
     while ( ui_selected -> next ) {
       ui_selected = ui_selected -> next;
     }
@@ -1480,7 +1541,7 @@ void ui_push_up ( void ) {
 
     // scroll down to show it
     int r = ui_determine_row ( ui_selected ) - 1;
-    if ( r - pnd_conf_get_as_int ( g_conf, "grid.row_max" ) > 0 ) {
+    if ( r - ui_display_context.row_max > 0 ) {
       ui_rows_scrolled_down = (unsigned int) r;
     }
 
@@ -1498,7 +1559,7 @@ void ui_push_up ( void ) {
 }
 
 void ui_push_down ( void ) {
-  unsigned char col_max = pnd_conf_get_as_int ( g_conf, "grid.col_max" );
+  unsigned char col_max = ui_display_context.col_max;
 
   if ( ui_selected ) {
 
@@ -1506,19 +1567,19 @@ void ui_push_down ( void ) {
     unsigned int row = ui_determine_row ( ui_selected );
 
     // max rows?
-    unsigned int icon_rows = g_categories [ ui_category ].refcount / col_max;
-    if ( g_categories [ ui_category ].refcount % col_max > 0 ) {
+    unsigned int icon_rows = g_categories [ ui_category ] -> refcount / col_max;
+    if ( g_categories [ ui_category ] -> refcount % col_max > 0 ) {
       icon_rows++;
     }
 
     // we at the end?
     if ( row == ( icon_rows - 1 ) &&
-        pnd_conf_get_as_int_d ( g_conf, "grid.wrap_vert_stop", 1 ) == 0 )
+        pnd_conf_get_as_int_d ( g_conf, "grid.wrap_vert_stop", 0 ) == 0 )
     {
 
       unsigned char col = ui_determine_screen_col ( ui_selected );
 
-      ui_selected = g_categories [ ui_category ].refs;
+      ui_selected = g_categories [ ui_category ] -> refs;
 
       while ( col ) {
        ui_selected = ui_selected -> next;
@@ -1559,40 +1620,83 @@ void ui_push_exec ( void ) {
     }
 
     if ( ui_selected -> ref -> object_type == pnd_object_type_directory ) {
-      // delve up/down the dir tree
 
-      if ( strcmp ( ui_selected -> ref -> title_en, ".." ) == 0 ) {
-       // go up
-       char *c;
+      // check if this guy is a dir-browser tab, or is a directory on a pnd tab
+      if ( ! g_categories [ ui_category] -> fspath ) {
+       // pnd subcat as dir
 
-       // lop off last word; if the thing ends with /, lop that one, then the next word.
-       while ( ( c = strrchr ( g_categories [ ui_category].fspath, '/' ) ) ) {
-         *c = '\0'; // lop off the last hunk
-         if ( *(c+1) != '\0' ) {
-           break;
+       static char *ui_category_stack = NULL;
+
+       // are we already in a subcat? if so, go back to parent; there is no grandparenting or deeper
+       if ( g_categories [ ui_category ] -> parent_catname ) {
+         // go back up
+
+         // set to first cat!
+         ui_category = 0;
+         // republish cats .. shoudl just be the one
+         category_publish ( CFNORMAL, NULL );
+
+         if ( ui_category_stack ) {
+           ui_category = category_index ( ui_category_stack );
          }
-       } // while
 
-       // nothing left?
-       if ( g_categories [ ui_category].fspath [ 0 ] == '\0' ) {
-         strcpy ( g_categories [ ui_category].fspath, "/" );
+       } else {
+         // delve into subcat
+
+         // set to first cat!
+         ui_category_stack = g_categories [ ui_category ] -> catname;
+         ui_category = 0;
+         // republish cats .. shoudl just be the one
+         category_publish ( CFBYNAME, ui_selected -> ref -> object_path );
+
        }
 
+       // forget the selection, nolonger applies
+       ui_selected = NULL;
+       ui_set_selected ( ui_selected );
+       // redraw the grid
+       render_mask |= CHANGED_EVERYTHING;
+
       } else {
-       // go down
-       strcat ( g_categories [ ui_category].fspath, "/" );
-       strcat ( g_categories [ ui_category].fspath, ui_selected -> ref -> title_en );
-      }
 
-      pnd_log ( pndn_debug, "Cat %s is now in path %s\n", g_categories [ ui_category ].catname, g_categories [ ui_category ].fspath );
+       // delve up/down the dir tree
+       if ( strcmp ( ui_selected -> ref -> title_en, ".." ) == 0 ) {
+         // go up
+         char *c;
 
-      // rescan the dir
-      category_fs_restock ( &(g_categories [ ui_category]) );
-      // forget the selection, nolonger applies
-      ui_selected = NULL;
-      ui_set_selected ( ui_selected );
-      // redraw the grid
-      render_mask |= CHANGED_SELECTION;
+         // lop off last word; if the thing ends with /, lop that one, then the next word.
+         while ( ( c = strrchr ( g_categories [ ui_category] -> fspath, '/' ) ) ) {
+           *c = '\0'; // lop off the last hunk
+           if ( *(c+1) != '\0' ) {
+             break;
+           }
+         } // while
+
+         // nothing left?
+         if ( g_categories [ ui_category] -> fspath [ 0 ] == '\0' ) {
+           free ( g_categories [ ui_category] -> fspath );
+           g_categories [ ui_category] -> fspath = strdup ( "/" );
+         }
+
+       } else {
+         // go down
+         char *temp = malloc ( strlen ( g_categories [ ui_category] -> fspath ) + strlen ( ui_selected -> ref -> title_en ) + 1 + 1 );
+         sprintf ( temp, "%s/%s", g_categories [ ui_category] -> fspath, ui_selected -> ref -> title_en );
+         free ( g_categories [ ui_category] -> fspath );
+         g_categories [ ui_category] -> fspath = temp;
+       }
+
+       pnd_log ( pndn_debug, "Cat %s is now in path %s\n", g_categories [ ui_category ] -> catname, g_categories [ ui_category ]-> fspath );
+
+       // forget the selection, nolonger applies
+       ui_selected = NULL;
+       ui_set_selected ( ui_selected );
+       // rescan the dir
+       category_fs_restock ( g_categories [ ui_category ] );
+       // redraw the grid
+       render_mask |= CHANGED_SELECTION;
+
+      } // directory browser or pnd subcat?
 
     } else {
       // just run it arbitrarily?
@@ -1607,32 +1711,114 @@ void ui_push_exec ( void ) {
          pnd_apps_exec_disco ( pnd_run_script, d, PND_EXEC_OPTION_NORUN, NULL );
          char buffer [ PATH_MAX ];
          sprintf ( buffer, "%s %s\n", MM_RUN, pnd_apps_exec_runline() );
-         emit_and_quit ( buffer );
+         if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.live_on_run", 0 ) == 0 ) {
+           emit_and_quit ( buffer );
+         } else {
+           emit_and_run ( buffer );
+         }
        }
 
       } else {
        // random bin file
+
+       // is it even executable? if we don't have handlers for non-executables yet (Jan 2011 we don't),
+       // then don't even try to run things not-flagged as executable.. but wait most people are on
+       // FAT filesystems, what a drag, we can't tell at the fs level.
+       // ... but we can still invoke 'file' and grep out the good bits, at least.
+       //
+       // open a stream reading 'file /path/to/file' and check output for 'executable'
+       // -- not checking for "ARM" so it can pick up x86 (or whatever native) executables in build environment
+       unsigned char is_executable = 0;
+
+       // popen test
+       {
+         char popenbuf [ FILENAME_MAX ];
+         snprintf ( popenbuf, FILENAME_MAX, "%s %s/%s", MIMETYPE_EXE, g_categories [ ui_category ] -> fspath, ui_selected -> ref -> title_en );
+
+         FILE *marceau;
+         if ( ! ( marceau = popen ( popenbuf, "r" ) ) ) {
+           return; // error, we need some useful error handling and dialog boxes here
+         }
+
+         if ( fgets ( popenbuf, FILENAME_MAX, marceau ) ) {
+           //printf ( "File test returns: %s\n", popenbuf );
+           if ( strstr ( popenbuf, "executable" ) != NULL ) {
+             is_executable = 1;
+           }
+         }
+
+         pclose ( marceau );
+
+       } // popen test
+
+       if ( ! is_executable ) {
+         fprintf ( stderr, "ERROR: File to invoke is not executable, skipping. (%s)\n", ui_selected -> ref -> title_en );
+         return; // need some error handling here
+       }
+
+#if 0 // eat up any pending SDL events and toss 'em?
+       {
+         SDL_PumpEvents();
+         SDL_Event e;
+         while ( SDL_PeepEvents ( &e, 1, SDL_GETEVENT, SDL_ALLEVENTS ) > 0 ) {
+           // spin
+         }
+       }
+#endif
+
 #if 1
+       // just exec it
+       //
+
+       // get CWD so we can restore it on return
        char cwd [ PATH_MAX ];
        getcwd ( cwd, PATH_MAX );
 
-       chdir ( g_categories [ ui_category ].fspath );
-       pnd_exec_no_wait_1 ( ui_selected -> ref -> title_en, NULL );
+       // full path to executable so we don't rely on implicit "./"
+       char execbuf [ FILENAME_MAX ];
+       snprintf ( execbuf, FILENAME_MAX, "%s/%s", g_categories [ ui_category ] -> fspath, ui_selected -> ref -> title_en );
+
+       // do it!
+       chdir ( g_categories [ ui_category ] -> fspath );
+       exec_raw_binary ( execbuf /*ui_selected -> ref -> title_en*/ );
        chdir ( cwd );
 #else
+       // DEPRECATED / NOT TESTED
+       // get mmwrapper to run it
        char buffer [ PATH_MAX ];
-       sprintf ( buffer, "%s %s/%s\n", MM_RUN, g_categories [ ui_category ].fspath, ui_selected -> ref -> title_en );
-       emit_and_quit ( buffer );
+       sprintf ( buffer, "%s %s/%s\n", MM_RUN, g_categories [ ui_category ] -> fspath, ui_selected -> ref -> title_en );
+       if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.live_on_run", 0 ) == 0 ) {
+         emit_and_quit ( buffer );
+       } else {
+         emit_and_run ( buffer );
+       }
 #endif
       } // pnd or bin?
 
     } // dir or file?
 
   } else {
+
+    // set app-run speed
+    int use_run_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.use_run_speed", 0 );
+    if ( use_run_speed > 0 ) {
+      int mm_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.run_speed", -1 );
+      if ( mm_speed > -1 ) {
+       char buffer [ 512 ];
+       snprintf ( buffer, 500, "sudo /usr/pandora/scripts/op_cpuspeed.sh %d", mm_speed );
+       system ( buffer );
+      }
+    } // do speed change?
+
+    // request app to run and quit mmenu
     pnd_apps_exec_disco ( pnd_run_script, ui_selected -> ref, PND_EXEC_OPTION_NORUN, NULL );
     char buffer [ PATH_MAX ];
     sprintf ( buffer, "%s %s\n", MM_RUN, pnd_apps_exec_runline() );
-    emit_and_quit ( buffer );
+    if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.live_on_run", 0 ) == 0 ) {
+      emit_and_quit ( buffer );
+    } else {
+      emit_and_run ( buffer );
+    }
   }
 
   return;
@@ -1640,7 +1826,7 @@ void ui_push_exec ( void ) {
 
 void ui_push_ltrigger ( void ) {
   unsigned char oldcat = ui_category;
-  unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
+  unsigned int screen_width = ui_display_context.screen_width;
   unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" );
 
   if ( g_categorycount == 0 ) {
@@ -1649,7 +1835,7 @@ void ui_push_ltrigger ( void ) {
 
   if ( ui_category > 0 ) {
     ui_category--;
-    category_fs_restock ( &(g_categories [ ui_category ]) );
+    category_fs_restock ( g_categories [ ui_category ] );
   } else {
     if ( pnd_conf_get_as_int_d ( g_conf, "tabs.wraparound", 0 ) > 0 ) {
       ui_category = g_categorycount - 1;
@@ -1657,7 +1843,7 @@ void ui_push_ltrigger ( void ) {
       if ( ui_category >= ( screen_width / tab_width ) ) {
        ui_catshift = ui_category - ( screen_width / tab_width ) + 1;
       }
-      category_fs_restock ( &(g_categories [ ui_category ]) );
+      category_fs_restock ( g_categories [ ui_category ] );
     }
   }
 
@@ -1686,17 +1872,17 @@ void ui_push_rtrigger ( void ) {
     return;
   }
 
-  unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
+  unsigned int screen_width = ui_display_context.screen_width;
   unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" );
 
   if ( ui_category < ( g_categorycount - 1 ) ) {
     ui_category++;
-    category_fs_restock ( &(g_categories [ ui_category ]) );
+    category_fs_restock ( g_categories [ ui_category ] );
   } else {
     if ( pnd_conf_get_as_int_d ( g_conf, "tabs.wraparound", 0 ) > 0 ) {
       ui_category = 0;
       ui_catshift = 0;
-      category_fs_restock ( &(g_categories [ ui_category ]) );
+      category_fs_restock ( g_categories [ ui_category ] );
     }
   }
 
@@ -1750,18 +1936,12 @@ void ui_loadscreen ( void ) {
 
   SDL_Rect dest;
 
-  unsigned int font_rgba_r = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_r", 200 );
-  unsigned int font_rgba_g = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_g", 200 );
-  unsigned int font_rgba_b = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_b", 200 );
-  unsigned int font_rgba_a = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_a", 100 );
-
   // clear the screen
   SDL_FillRect( SDL_GetVideoSurface(), NULL, 0 );
 
   // render text
   SDL_Surface *rtext;
-  SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-  rtext = TTF_RenderText_Blended ( g_big_font, "Setting up menu...", tmpfontcolor );
+  rtext = TTF_RenderText_Blended ( g_big_font, "Setting up menu...", ui_display_context.fontcolor );
   dest.x = 20;
   dest.y = 20;
   SDL_BlitSurface ( rtext, NULL /* full src */, sdl_realscreen, &dest );
@@ -1775,11 +1955,6 @@ void ui_discoverscreen ( unsigned char clearscreen ) {
 
   SDL_Rect dest;
 
-  unsigned int font_rgba_r = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_r", 200 );
-  unsigned int font_rgba_g = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_g", 200 );
-  unsigned int font_rgba_b = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_b", 200 );
-  unsigned int font_rgba_a = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_a", 100 );
-
   // clear the screen
   if ( clearscreen ) {
     SDL_FillRect( SDL_GetVideoSurface(), NULL, 0 );
@@ -1798,8 +1973,7 @@ void ui_discoverscreen ( unsigned char clearscreen ) {
 
   // render text
   SDL_Surface *rtext;
-  SDL_Color tmpfontcolor = { font_rgba_r, font_rgba_g, font_rgba_b, font_rgba_a };
-  rtext = TTF_RenderText_Blended ( g_big_font, "Looking for applications...", tmpfontcolor );
+  rtext = TTF_RenderText_Blended ( g_big_font, "Looking for applications...", ui_display_context.fontcolor );
   if ( clearscreen ) {
     dest.x = 20;
     dest.y = 20;
@@ -1914,7 +2088,7 @@ int ui_selected_index ( void ) {
     return ( -1 ); // no index
   }
 
-  mm_appref_t *r = g_categories [ ui_category ].refs;
+  mm_appref_t *r = g_categories [ ui_category ] -> refs;
   int counter = 0;
   while ( r ) {
     if ( r == ui_selected ) {
@@ -1999,16 +2173,16 @@ int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *f
 
     // show dialog background
     if ( g_imagecache [ IMG_DETAIL_BG ].i ) {
-      src.x = pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_x", 460 );
-      src.y = pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_y", 60 );
-      src.w = ((SDL_Surface*)(g_imagecache [ IMG_DETAIL_PANEL ].i)) -> w;
-      src.h = ((SDL_Surface*)(g_imagecache [ IMG_DETAIL_PANEL ].i)) -> h;
+      src.x = 0;
+      src.y = 0;
+      src.w = ((SDL_Surface*)(g_imagecache [ IMG_DETAIL_BG ].i)) -> w;
+      src.h = ((SDL_Surface*)(g_imagecache [ IMG_DETAIL_BG ].i)) -> h;
       dest -> x = pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_x", 460 );
       dest -> y = pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_y", 60 );
       SDL_BlitSurface ( g_imagecache [ IMG_DETAIL_BG ].i, &src, sdl_realscreen, dest );
       // repeat for darken?
-      SDL_BlitSurface ( g_imagecache [ IMG_DETAIL_BG ].i, &src, sdl_realscreen, dest );
-      SDL_BlitSurface ( g_imagecache [ IMG_DETAIL_BG ].i, &src, sdl_realscreen, dest );
+      //SDL_BlitSurface ( g_imagecache [ IMG_DETAIL_BG ].i, &src, sdl_realscreen, dest );
+      //SDL_BlitSurface ( g_imagecache [ IMG_DETAIL_BG ].i, &src, sdl_realscreen, dest );
       //SDL_UpdateRects ( sdl_realscreen, 1, &dest );
       dest++;
     }
@@ -2070,7 +2244,8 @@ int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *f
 
       switch ( event.type ) {
 
-      case SDL_KEYUP:
+      //case SDL_KEYUP:
+      case SDL_KEYDOWN:
 
        if ( event.key.keysym.sym == SDLK_UP ) {
          if ( sel ) {
@@ -2120,29 +2295,29 @@ int ui_modal_single_menu ( char *argv[], unsigned int argc, char *title, char *f
 unsigned char ui_determine_row ( mm_appref_t *a ) {
   unsigned int row = 0;
 
-  mm_appref_t *i = g_categories [ ui_category ].refs;
+  mm_appref_t *i = g_categories [ ui_category ] -> refs;
   while ( i != a ) {
     i = i -> next;
     row++;
   } // while
-  row /= pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 );
+  row /= ui_display_context.col_max;
 
   return ( row );
 }
 
 unsigned char ui_determine_screen_row ( mm_appref_t *a ) {
-  return ( ui_determine_row ( a ) % pnd_conf_get_as_int_d ( g_conf, "grid.row_max", 5 ) );
+  return ( ui_determine_row ( a ) % ui_display_context.row_max );
 }
 
 unsigned char ui_determine_screen_col ( mm_appref_t *a ) {
   unsigned int col = 0;
 
-  mm_appref_t *i = g_categories [ ui_category ].refs;
+  mm_appref_t *i = g_categories [ ui_category ] -> refs;
   while ( i != a ) {
     i = i -> next;
     col++;
   } // while
-  col %= pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 );
+  col %= ui_display_context.col_max;
 
   return ( col );
 }
@@ -2297,6 +2472,8 @@ void ui_touch_act ( unsigned int x, unsigned int y ) {
        }
        ui_category = t -> catnum;
        render_mask |= CHANGED_CATEGORY;
+       // rescan the dir
+       category_fs_restock ( g_categories [ ui_category ] );
       }
 
       break;
@@ -2376,10 +2553,10 @@ void ui_post_scan ( void ) {
     // default behaviour will pick first cat (ie: usually All)
     unsigned int i;
     for ( i = 0; i < g_categorycount; i++ ) {
-      if ( strcasecmp ( g_categories [ i ].catname, dc ) == 0 ) {
+      if ( strcasecmp ( g_categories [ i ] -> catname, dc ) == 0 ) {
        ui_category = i;
        // ensure visibility
-       unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
+       unsigned int screen_width = ui_display_context.screen_width;
        unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" );
        if ( ui_category > ui_catshift + ( screen_width / tab_width ) - 1 ) {
          ui_catshift = ui_category - ( screen_width / tab_width ) + 1;
@@ -2394,6 +2571,12 @@ void ui_post_scan ( void ) {
 
   } // default cat
 
+  // if we're sent right to a dirbrowser tab, restock it now (normally we restock on entry)
+  if ( g_categories [ ui_category ] -> fspath ) {
+    printf ( "Restock on start: '%s'\n", g_categories [ ui_category ] -> fspath );
+    category_fs_restock ( g_categories [ ui_category ] );
+  }
+
   // redraw all
   render_mask |= CHANGED_EVERYTHING;
 
@@ -2723,7 +2906,7 @@ void ui_aboutscreen ( char *textpath ) {
 
        SDL_Event e;
 
-       if ( SDL_PeepEvents ( &e, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_KEYUP) ) > 0 ) {
+       if ( SDL_PeepEvents ( &e, 1, SDL_GETEVENT, SDL_EVENTMASK(/*SDL_KEYUP|*/SDL_KEYDOWN) ) > 0 ) {
          return;
        }
 
@@ -2755,43 +2938,46 @@ void ui_revealscreen ( void ) {
   unsigned int labelmax = 0;
   unsigned int i;
 
-  if ( ! _categories_inviscount ) {
+  if ( ! category_count ( CFHIDDEN ) ) {
     return; // nothing to do
   }
 
-  for ( i = 0; i < _categories_inviscount; i++ ) {
-    labels [ labelmax++ ] = _categories_invis [ i ].catname;
+  // switch to hidden categories
+  category_publish ( CFHIDDEN, NULL );
+
+  // build up labels to show in menu
+  for ( i = 0; i < g_categorycount; i++ ) {
+    labels [ labelmax++ ] = g_categories [ i ] -> catname;
   }
 
+  // show menu
   int sel = ui_modal_single_menu ( labels, labelmax, "Temporary Category Reveal",
                                   "Enter to select; other to return." );
 
+  // if selected, try to set this guy to visible
   if ( sel >= 0 ) {
 
-    if ( category_query ( _categories_invis [ sel ].catname ) ) {
-      // already present
-      return;
-    }
-
     // fix up category name, if its been hacked
-    if ( strchr ( _categories_invis [ sel ].catname, '.' ) ) {
-      char *t = _categories_invis [ sel ].catname;
-      _categories_invis [ sel ].catname = strdup ( strchr ( _categories_invis [ sel ].catname, '.' ) + 1 );
+    if ( strchr ( g_categories [ sel ] -> catname, '.' ) ) {
+      char *t = g_categories [ sel ] -> catname;
+      g_categories [ sel ] -> catname = strdup ( strchr ( g_categories [ sel ] -> catname, '.' ) + 1 );
       free ( t );
     }
-    // copy invisi-cat into live-cat
-    memmove ( &(g_categories [ g_categorycount ]), &(_categories_invis [ sel ]), sizeof(mm_category_t) );
-    g_categorycount++;
-    // move subsequent invisi-cats up, so the selected invisi-cat is nolonger existing in invisi-list at
-    // all (avoid double-free() later)
-    memmove ( &(_categories_invis [ sel ]), &(_categories_invis [ sel + 1 ]), sizeof(mm_category_t) * ( _categories_inviscount - sel - 1 ) );
-    _categories_inviscount--;
 
-    // switch to the new category
-    ui_category = g_categorycount - 1;
+    // reflag this guy to be visible
+    g_categories [ sel ] -> catflags = CFNORMAL;
+
+    // switch to the new category.. cache name.
+    char *switch_to_name = g_categories [ sel ] -> catname;
+
+    // republish categories
+    category_publish ( CFNORMAL, NULL );
+
+    // switch to the new category.. with the cached name!
+    ui_category = category_index ( switch_to_name );
 
     // ensure visibility
-    unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
+    unsigned int screen_width = ui_display_context.screen_width;
     unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" );
     if ( ui_category > ui_catshift + ( screen_width / tab_width ) - 1 ) {
       ui_catshift = ui_category - ( screen_width / tab_width ) + 1;
@@ -2803,3 +2989,109 @@ void ui_revealscreen ( void ) {
 
   return;
 }
+
+void ui_recache_context ( ui_context_t *c ) {
+
+  c -> screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
+
+  c -> font_rgba_r = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_r", 200 );
+  c -> font_rgba_g = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_g", 200 );
+  c -> font_rgba_b = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_b", 200 );
+  c -> font_rgba_a = pnd_conf_get_as_int_d ( g_conf, "display.font_rgba_a", 100 );
+
+  c -> grid_offset_x = pnd_conf_get_as_int ( g_conf, "grid.grid_offset_x" );
+  c -> grid_offset_y = pnd_conf_get_as_int ( g_conf, "grid.grid_offset_y" );
+
+  c -> icon_offset_x = pnd_conf_get_as_int ( g_conf, "grid.icon_offset_x" );
+  c -> icon_offset_y = pnd_conf_get_as_int ( g_conf, "grid.icon_offset_y" );
+  c -> icon_max_width = pnd_conf_get_as_int ( g_conf, "grid.icon_max_width" );
+  c -> icon_max_height = pnd_conf_get_as_int ( g_conf, "grid.icon_max_height" );
+  c -> sel_icon_offset_x = pnd_conf_get_as_int_d ( g_conf, "grid.sel_offoffset_x", 0 );
+  c -> sel_icon_offset_y = pnd_conf_get_as_int_d ( g_conf, "grid.sel_offoffset_y", 0 );
+
+  c -> text_width = pnd_conf_get_as_int ( g_conf, "grid.text_width" );
+  c -> text_clip_x = pnd_conf_get_as_int ( g_conf, "grid.text_clip_x" );
+  c -> text_offset_x = pnd_conf_get_as_int ( g_conf, "grid.text_offset_x" );
+  c -> text_offset_y = pnd_conf_get_as_int ( g_conf, "grid.text_offset_y" );
+  c -> text_hilite_offset_y = pnd_conf_get_as_int ( g_conf, "grid.text_hilite_offset_y" );
+
+  c -> row_max = pnd_conf_get_as_int_d ( g_conf, "grid.row_max", 4 );
+  c -> col_max = pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 );
+
+  c -> cell_width = pnd_conf_get_as_int ( g_conf, "grid.cell_width" );
+  c -> cell_height = pnd_conf_get_as_int ( g_conf, "grid.cell_height" );
+
+  c -> arrow_bar_x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_x", 450 );
+  c -> arrow_bar_y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_y", 100 );
+  c -> arrow_bar_clip_w = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_clip_w", 10 );
+  c -> arrow_bar_clip_h = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_clip_h", 100 );
+  c -> arrow_up_x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_up_x", 450 );
+  c -> arrow_up_y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_up_y", 80 );
+  c -> arrow_down_x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_down_x", 450 );
+  c -> arrow_down_y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_down_y", 80 );
+
+  // font colour
+  SDL_Color tmp = { c -> font_rgba_r, c -> font_rgba_g, c -> font_rgba_b, c -> font_rgba_a };
+  c -> fontcolor = tmp;
+
+  // now that we've got 'normal' (detail pane shown) param's, lets check if detail pane
+  // is hidden; if so, override some values with those alternate skin values where possible.
+  if ( ui_detail_hidden ) {
+    // if detail panel is hidden, and theme cannot support it, unhide the bloody thing. (This may help
+    // when someone is amid theme hacking or changing.)
+    if ( ! ui_is_detail_hideable() ) {
+      ui_detail_hidden = 0;
+    }
+
+    // still hidden?
+    if ( ui_detail_hidden ) {
+
+      c -> row_max = pnd_conf_get_as_int_d ( g_conf, "grid.row_max_w", c -> row_max );
+      c -> col_max = pnd_conf_get_as_int_d ( g_conf, "grid.col_max_w", c -> col_max );
+
+      c -> cell_width = pnd_conf_get_as_int_d ( g_conf, "grid.cell_width_w", c -> cell_width );
+      c -> cell_height = pnd_conf_get_as_int_d ( g_conf, "grid.cell_height_w", c -> cell_height );
+
+      c -> arrow_bar_x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_x_w", 450 );
+      c -> arrow_bar_y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_bar_y_w", 100 );
+      c -> arrow_up_x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_up_x_w", 450 );
+      c -> arrow_up_y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_up_y_w", 80 );
+      c -> arrow_down_x = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_down_x_w", 450 );
+      c -> arrow_down_y = pnd_conf_get_as_int_d ( g_conf, "grid.arrow_down_y_w", 80 );
+
+    } // if detail hidden.. still.
+
+  } // if detail hidden
+
+  return;
+}
+
+unsigned char ui_is_detail_hideable ( void ) {
+
+  // if skin has a bit of info for wide-mode, we assume wide-mode is available
+  if ( pnd_conf_get_as_char ( g_conf, "grid.row_max_w" ) != NULL ) {
+    return ( 1 );
+  }
+
+  // else not!
+  return ( 0 );
+}
+
+void ui_toggle_detail_pane ( void ) {
+
+  // no bitmask trickery here; I like it to be stand-out obvious at 3am.
+
+  if ( ui_detail_hidden ) {
+    ui_detail_hidden = 0;
+  } else {
+    ui_detail_hidden = 1;
+  }
+
+  // repull skin config
+  ui_recache_context ( &ui_display_context );
+
+  // redraw
+  render_mask |= CHANGED_EVERYTHING;
+
+  return;
+}