Aesthetic changes to conf panel; minor fix to libpnd that no one but mmenu will notice.
[pandora-libraries.git] / minimenu / mmui.c
index d0d3f78..08d8dac 100644 (file)
@@ -1,9 +1,14 @@
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
+#include <stdio.h> /* for FILE etc */
+#include <stdlib.h> /* for malloc */
+#include <unistd.h> /* for unlink */
+#include <limits.h> /* for PATH_MAX */
+#include <sys/types.h>
+#include <sys/stat.h>
+#define __USE_GNU /* for strcasestr */
+#include <string.h> /* for making ftw.h happy */
 #include <time.h>
-#include <unistd.h>
+#include <ftw.h>
 #include "SDL.h"
 #include "SDL_audio.h"
 #include "SDL_image.h"
@@ -11,6 +16,7 @@
 #include "SDL_gfxPrimitives.h"
 #include "SDL_rotozoom.h"
 #include "SDL_thread.h"
+#include <dirent.h>
 
 #include "pnd_conf.h"
 #include "pnd_logger.h"
 #include "pnd_discovery.h"
 #include "pnd_apps.h"
 #include "pnd_device.h"
+#include "../lib/pnd_pathiter.h"
+#include "pnd_utility.h"
+#include "pnd_pndfiles.h"
 
 #include "mmenu.h"
 #include "mmcat.h"
 #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 */
+#define CHANGED_SELECTION   (1<<1)  /* changed app selection */
+#define CHANGED_DATAUPDATE  (1<<2)  /* deferred preview pic or icon came in */
+#define CHANGED_APPRELOAD   (1<<3)  /* new set of applications entirely */
+#define CHANGED_EVERYTHING  (1<<4)  /* redraw it all! */
+unsigned int render_mask = CHANGED_EVERYTHING;
 
 /* SDL
  */
@@ -56,9 +75,14 @@ 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
+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
 
-extern mm_category_t g_categories [ MAX_CATS ];
+extern mm_category_t *g_categories;
 extern unsigned char g_categorycount;
+extern mm_category_t _categories_invis [ MAX_CATS ];
+extern unsigned char _categories_inviscount;
 
 static SDL_Surface *ui_scale_image ( SDL_Surface *s, unsigned int maxwidth, int maxheight ); // height -1 means ignore
 static int ui_selected_index ( void );
@@ -124,6 +148,9 @@ unsigned char ui_setup ( void ) {
   }
 #endif
 
+  // key repeat
+  SDL_EnableKeyRepeat ( 500, 150 );
+
   // images
   //IMG_Init ( IMG_INIT_JPG | IMG_INIT_PNG );
 
@@ -147,11 +174,11 @@ unsigned char ui_setup ( void ) {
   }
 
   // grid font
-  sprintf ( fullpath, "%s/%s", g_skinpath, pnd_conf_get_as_char ( g_conf, MMENU_GRID_FONT ) );
-  g_grid_font = TTF_OpenFont ( fullpath, pnd_conf_get_as_int_d ( g_conf, MMENU_GRID_FONTSIZE, 10 ) );
+  sprintf ( fullpath, "%s/%s", g_skinpath, pnd_conf_get_as_char ( g_conf, "grid.font" ) );
+  g_grid_font = TTF_OpenFont ( fullpath, pnd_conf_get_as_int_d ( g_conf, "grid.font_ptsize", 10 ) );
   if ( ! g_grid_font ) {
     pnd_log ( pndn_error, "ERROR: Couldn't load font '%s' for size %u\n",
-             pnd_conf_get_as_char ( g_conf, MMENU_GRID_FONT ), pnd_conf_get_as_int_d ( g_conf, MMENU_GRID_FONTSIZE, 10 ) );
+             pnd_conf_get_as_char ( g_conf, "grid.font" ), pnd_conf_get_as_int_d ( g_conf, "grid.font_ptsize", 10 ) );
     return ( 0 ); // couldn't set up SDL TTF
   }
 
@@ -173,6 +200,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 );
 }
 
@@ -183,7 +218,11 @@ mm_imgcache_t g_imagecache [ IMG_TRUEMAX ] = {
   { IMG_DETAIL_BG,            "graphics.IMG_DETAIL_BG" },
   { IMG_SELECTED_ALPHAMASK,   "graphics.IMG_SELECTED_ALPHAMASK" },
   { IMG_TAB_SEL,              "graphics.IMG_TAB_SEL" },
+  { IMG_TAB_SEL_L,            "graphics.IMG_TAB_SEL_L" },
+  { IMG_TAB_SEL_R,            "graphics.IMG_TAB_SEL_R" },
   { IMG_TAB_UNSEL,            "graphics.IMG_TAB_UNSEL" },
+  { IMG_TAB_UNSEL_L,          "graphics.IMG_TAB_UNSEL_L" },
+  { IMG_TAB_UNSEL_R,          "graphics.IMG_TAB_UNSEL_R" },
   { IMG_TAB_LINE,             "graphics.IMG_TAB_LINE" },
   { IMG_TAB_LINEL,            "graphics.IMG_TAB_LINEL" },
   { IMG_TAB_LINER,            "graphics.IMG_TAB_LINER" },
@@ -193,6 +232,9 @@ mm_imgcache_t g_imagecache [ IMG_TRUEMAX ] = {
   { IMG_ARROW_UP,             "graphics.IMG_ARROW_UP", },
   { IMG_ARROW_DOWN,           "graphics.IMG_ARROW_DOWN", },
   { IMG_ARROW_SCROLLBAR,      "graphics.IMG_ARROW_SCROLLBAR", },
+  { IMG_HOURGLASS,            "graphics.IMG_HOURGLASS", },
+  { IMG_FOLDER,               "graphics.IMG_FOLDER", },
+  { IMG_EXECBIN,              "graphics.IMG_EXECBIN", },
   { IMG_MAX,                  NULL },
 };
 
@@ -216,7 +258,11 @@ unsigned char ui_imagecache ( char *basepath ) {
       return ( 0 );
     }
 
-    sprintf ( fullpath, "%s/%s", basepath, filename );
+    if ( filename [ 0 ] == '/' ) {
+      strncpy ( fullpath, filename, PATH_MAX );
+    } else {
+      sprintf ( fullpath, "%s/%s", basepath, filename );
+    }
 
     if ( ! ( g_imagecache [ i ].i = IMG_Load ( fullpath ) ) ) {
       pnd_log ( pndn_error, "ERROR: Couldn't load static cache image: %s\n", fullpath );
@@ -233,7 +279,6 @@ unsigned char ui_imagecache ( char *basepath ) {
   //
 
   // scale icons
-  g_imagecache [ IMG_SELECTED_ALPHAMASK ].i = ui_scale_image ( g_imagecache [ IMG_SELECTED_ALPHAMASK ].i, pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_width", 50 ), -1 );
   g_imagecache [ IMG_ICON_MISSING ].i = ui_scale_image ( g_imagecache [ IMG_ICON_MISSING ].i, pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_width", 50 ), -1 );
   // scale text hilight
   g_imagecache [ IMG_SELECTED_HILITE ].i = ui_scale_image ( g_imagecache [ IMG_SELECTED_HILITE ].i, pnd_conf_get_as_int_d ( g_conf, "grid.text_width", 50 ), -1 );
@@ -243,18 +288,47 @@ unsigned char ui_imagecache ( char *basepath ) {
                                                            pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_height", 50 ) );
 
   // set alpha on detail panel
-  SDL_SetAlpha ( g_imagecache [ IMG_DETAIL_BG ].i, SDL_SRCALPHA, pnd_conf_get_as_int_d ( g_conf, "display.detail_bg_alpha", 50 ) );
+  //SDL_SetAlpha ( g_imagecache [ IMG_DETAIL_BG ].i, SDL_SRCALPHA, pnd_conf_get_as_int_d ( g_conf, "display.detail_bg_alpha", 50 ) );
 
   return ( 1 );
 } // ui_imagecache
 
-void ui_render ( unsigned int render_mask ) {
+void ui_render ( void ) {
 
   // 800x480:
   // divide width: 550 / 250
   // divide left side: 5 columns == 110px width
   //   20px buffer either side == 70px wide icon + 20 + 20?
 
+  // what jobs to do during render?
+  //
+
+#define R_BG     (1<<0)
+#define R_TABS   (1<<1)
+#define R_DETAIL (1<<2)
+#define R_GRID   (1<<3)
+
+#define R_ALL (R_BG|R_TABS|R_DETAIL|R_GRID)
+
+  unsigned int render_jobs_b = 0;
+
+  if ( render_mask & CHANGED_EVERYTHING ) {
+    render_jobs_b |= R_ALL;
+  }
+
+  if ( render_mask & CHANGED_SELECTION ) {
+    render_jobs_b |= R_GRID;
+    render_jobs_b |= R_DETAIL;
+  }
+
+  if ( render_mask & CHANGED_CATEGORY ) {
+    render_jobs_b |= R_ALL;
+  }
+
+  render_mask = CHANGED_NOTHING;
+
+  // render everything
+  //
   unsigned int icon_rows;
 
 #define MAXRECTS 200
@@ -265,61 +339,39 @@ void ui_render ( unsigned int render_mask ) {
   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, MMENU_DISP_ROWMAX, 4 );
-  unsigned char col_max = pnd_conf_get_as_int_d ( g_conf, MMENU_DISP_COLMAX, 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 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 = g_categories [ ui_category ].refcount / c -> col_max;
+  if ( g_categories [ ui_category ].refcount % c -> col_max > 0 ) {
     icon_rows++;
   }
 
+#if 1
   // if no selected app yet, select the first one
-#if 0
-  if ( ! ui_selected ) {
+  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 );
-
-    //pnd_log ( PND_LOG_DEFAULT, "index %u tl %u br %u\n", index, topleft, botright );
+    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 );
+      render_jobs_b |= R_ALL;
     } else if ( index > botright ) {
       ui_rows_scrolled_down += pnd_conf_get_as_int_d ( g_conf, "grid.scroll_increment", 1 );
+      render_jobs_b |= R_ALL;
     }
 
     if ( ui_rows_scrolled_down < 0 ) {
@@ -331,76 +383,165 @@ void ui_render ( unsigned int render_mask ) {
   } // ensire visible
 
   // render background
-  if ( g_imagecache [ IMG_BACKGROUND_800480 ].i ) {
-    dest -> x = 0;
-    dest -> y = 0;
-    dest -> w = sdl_realscreen -> w;
-    dest -> h = sdl_realscreen -> h;
-    SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_800480 ].i, NULL /* whole image */, sdl_realscreen, dest /* 0,0 */ );
-    dest++;
-  }
+  if ( render_jobs_b & R_BG ) {
 
-  // tabmask
-  if ( g_imagecache [ IMG_BACKGROUND_TABMASK ].i ) {
-    dest -> x = 0;
-    dest -> y = 0;
-    dest -> w = sdl_realscreen -> w;
-    dest -> h = sdl_realscreen -> h;
-    SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_TABMASK ].i, NULL /* whole image */, sdl_realscreen, dest /* 0,0 */ );
-    dest++;
-  }
+    if ( g_imagecache [ IMG_BACKGROUND_800480 ].i ) {
+      dest -> x = 0;
+      dest -> y = 0;
+      dest -> w = sdl_realscreen -> w;
+      dest -> h = sdl_realscreen -> h;
+      SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_800480 ].i, NULL /* whole image */, sdl_realscreen, dest /* 0,0 */ );
+      dest++;
+    }
+
+    // tabmask
+    if ( g_imagecache [ IMG_BACKGROUND_TABMASK ].i ) {
+      dest -> x = 0;
+      dest -> y = 0;
+      dest -> w = sdl_realscreen -> w;
+      dest -> h = sdl_realscreen -> h;
+      SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_TABMASK ].i, NULL /* whole image */, sdl_realscreen, dest /* 0,0 */ );
+      dest++;
+    }
+
+  } // r_bg
 
   // 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;
-
-    // draw tabs with categories
-    for ( col = ui_catshift;
-         col < maxtab;
-         col++ )
-    {
+    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" );
+    }
 
-      SDL_Surface *s;
-      if ( col == ui_category ) {
-       s = g_imagecache [ IMG_TAB_SEL ].i;
-      } else {
-       s = g_imagecache [ IMG_TAB_UNSEL ].i;
-      }
+    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 );
 
-      // draw tab
-      src.x = 0;
-      src.y = 0;
-      src.w = tab_width;
-      if ( col == ui_category ) {
-       src.h = tab_selheight;
-      } else {
-       src.h = tab_height;
-      }
-      dest -> x = tab_offset_x + ( (col-ui_catshift) * tab_width );
-      dest -> y = tab_offset_y;
-      //pnd_log ( pndn_debug, "tab %u at %ux%u\n", col, dest.x, dest.y );
-      SDL_BlitSurface ( s, &src, sdl_realscreen, dest );
+    if ( g_categorycount > 0 ) {
 
-      // store touch info
-      ui_register_tab ( col, dest -> x, dest -> y, tab_width, tab_height );
+      // draw tabs with categories
+      for ( col = ui_catshift;
+           col < maxtab;
+           col++ )
+      {
 
-      dest++;
+       SDL_Surface *s;
+
+       // if this is the first (leftmost) tab, we use different artwork
+       // than if the other tabs (so skinner can link lines up nicely.)
+       if ( col == ui_catshift ) {
+         // leftmost tab, special case
+
+         if ( col == ui_category ) {
+           s = g_imagecache [ IMG_TAB_SEL_L ].i;
+         } else {
+           s = g_imagecache [ IMG_TAB_UNSEL_L ].i;
+         }
+
+       } else if ( col == maxtab - 1 ) {
+         // rightmost tab, special case
+
+         if ( col == ui_category ) {
+           s = g_imagecache [ IMG_TAB_SEL_R ].i;
+         } else {
+           s = g_imagecache [ IMG_TAB_UNSEL_R ].i;
+         }
+
+       } else {
+         // normal (not leftmost) tab
+
+         if ( col == ui_category ) {
+           s = g_imagecache [ IMG_TAB_SEL ].i;
+         } else {
+           s = g_imagecache [ IMG_TAB_UNSEL ].i;
+         }
+
+       } // first col, or not first col?
+
+       // draw tab
+       src.x = 0;
+       src.y = 0;
+#if 0
+       src.w = tab_width;
+       if ( col == ui_category ) {
+         src.h = tab_selheight;
+       } else {
+         src.h = tab_height;
+       }
+#else
+       src.w = s -> w;
+       src.h = s -> h;
+#endif
+       dest -> x = tab_offset_x + ( (col-ui_catshift) * tab_width );
+       dest -> y = tab_offset_y;
+
+       // store touch info
+       ui_register_tab ( col, dest -> x, dest -> y, tab_width, tab_height );
+
+       if ( render_jobs_b & R_TABS ) {
+         //pnd_log ( pndn_debug, "tab %u at %ux%u\n", col, dest.x, dest.y );
+         SDL_BlitSurface ( s, &src, sdl_realscreen, dest );
+         dest++;
+
+         // draw tab line
+         if ( col == ui_category ) {
+           // no line for selected tab
+         } else {
+           if ( col - ui_catshift == 0 ) {
+             s = g_imagecache [ IMG_TAB_LINEL ].i;
+           } else if ( col - ui_catshift == maxtabspot - 1 ) {
+             s = g_imagecache [ IMG_TAB_LINER ].i;
+           } else {
+             s = g_imagecache [ IMG_TAB_LINE ].i;
+           }
+           dest -> x = tab_offset_x + ( (col-ui_catshift) * tab_width );
+           dest -> y = tab_offset_y + tab_height;
+           SDL_BlitSurface ( s, NULL /* whole image */, sdl_realscreen, dest );
+           dest++;
+         }
+
+         // draw text
+         SDL_Surface *rtext;
+         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;
+         src.h = rtext -> h;
+         dest -> x = tab_offset_x + ( (col-ui_catshift) * tab_width ) + text_offset_x;
+         dest -> y = tab_offset_y + text_offset_y;
+         SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
+         SDL_FreeSurface ( rtext );
+         dest++;
+
+       } // r_tabs
+
+      } // for
+
+    } // if we got categories
+
+    if ( render_jobs_b & R_TABS ) {
+
+      // draw tab lines under where tabs would be if we had categories
+      for ( /* foo */; col < maxtabspot; col++ ) {
+       SDL_Surface *s;
 
-      // draw tab line
-      if ( col == ui_category ) {
-       // no line for selected tab
-      } else {
        if ( col - ui_catshift == 0 ) {
          s = g_imagecache [ IMG_TAB_LINEL ].i;
-       } else if ( col - ui_catshift == maxtab - 1 ) {
+       } else if ( col - ui_catshift == maxtabspot - 1 ) {
          s = g_imagecache [ IMG_TAB_LINER ].i;
        } else {
          s = g_imagecache [ IMG_TAB_LINE ].i;
@@ -409,53 +550,21 @@ void ui_render ( unsigned int render_mask ) {
        dest -> y = tab_offset_y + tab_height;
        SDL_BlitSurface ( s, NULL /* whole image */, sdl_realscreen, dest );
        dest++;
-      }
 
-      // 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 );
-      src.x = 0;
-      src.y = 0;
-      src.w = rtext -> w < text_width ? rtext -> w : text_width;
-      src.h = rtext -> h;
-      dest -> x = tab_offset_x + ( (col-ui_catshift) * tab_width ) + text_offset_x;
-      dest -> y = tab_offset_y + text_offset_y;
-      SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
-      SDL_FreeSurface ( rtext );
-      dest++;
+      } // for
 
-    } // for
-
-    // draw tab lines under where tabs would be if we had categories
-    maxtab = ( screen_width / tab_width );
-    for ( /* foo */; col < maxtab; col++ ) {
-      SDL_Surface *s;
-
-      if ( col - ui_catshift == 0 ) {
-       s = g_imagecache [ IMG_TAB_LINEL ].i;
-      } else if ( col - ui_catshift == maxtab - 1 ) {
-       s = g_imagecache [ IMG_TAB_LINER ].i;
-      } else {
-       s = g_imagecache [ IMG_TAB_LINE ].i;
-      }
-      dest -> x = tab_offset_x + ( (col-ui_catshift) * tab_width );
-      dest -> y = tab_offset_y + tab_height;
-      SDL_BlitSurface ( s, NULL /* whole image */, sdl_realscreen, dest );
-      dest++;
-
-    } // for
+    } // r_tabs
 
   } // tabs
 
   // scroll bars and arrows
-  {
+  if ( render_jobs_b & R_BG ) {
     unsigned char show_bar = 0;
 
     // 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++;
 
@@ -463,9 +572,9 @@ void ui_render ( unsigned int render_mask ) {
     }
 
     // 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++;
 
@@ -476,144 +585,186 @@ void ui_render ( unsigned int render_mask ) {
       // 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
 
-  } // scroll bars
+  } // r_bg, scroll bars
 
   // render detail pane bg
-  if ( pnd_conf_get_as_int_d ( g_conf, "detailpane.show", 1 ) ) {
+  if ( render_jobs_b & R_DETAIL && ui_detail_hidden == 0 ) {
+
+    if ( pnd_conf_get_as_int_d ( g_conf, "detailpane.show", 1 ) ) {
+
+      // render detail bg
+      if ( g_imagecache [ IMG_DETAIL_BG ].i ) {
+       src.x = 0; // pnd_conf_get_as_int_d ( g_conf, "detailpane.pane_offset_x", 460 );
+       src.y = 0; // 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;
+       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 );
+       dest++;
+      }
 
-    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;
-      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 );
-      dest++;
-    }
+      // render detail pane
+      if ( g_imagecache [ IMG_DETAIL_PANEL ].i ) {
+       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_PANEL ].i, NULL /* whole image */, sdl_realscreen, dest );
+       dest++;
+      }
 
-    // render detail pane
-    if ( g_imagecache [ IMG_DETAIL_PANEL ].i ) {
-      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_PANEL ].i, NULL /* whole image */, sdl_realscreen, dest );
-      dest++;
-    }
+    } // detailpane frame/bg
 
-  } // detailpane frame/bg
+  } // r_details
 
   // anything to render?
-  if ( g_categories [ ui_category ].refs ) {
+  if ( render_jobs_b & R_GRID ) {
 
-    appiter = g_categories [ ui_category ].refs;
-    row = 0;
-    displayrow = 0;
+    // 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 = 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;
 
-    // until we run out of apps, or run out of space
-    while ( appiter != NULL ) {
+       dest -> x = c -> grid_offset_x;
+       dest -> y = c -> grid_offset_y + c -> sel_icon_offset_y;
 
-      for ( col = 0; col < col_max && appiter != NULL; col++ ) {
+       SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_800480 ].i, &src, sdl_realscreen, dest );
+       dest++;
 
-       // 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 ) {
+      }
+    }
 
-         // selected? show hilights
-         if ( appiter == ui_selected ) {
-           // icon
-           dest -> x = grid_offset_x + ( col * cell_width ) + icon_offset_x;
-           dest -> y = grid_offset_y + ( displayrow * cell_height ) + icon_offset_y;
-           SDL_BlitSurface ( g_imagecache [ IMG_SELECTED_ALPHAMASK ].i, 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" );
-           SDL_BlitSurface ( g_imagecache [ IMG_SELECTED_HILITE ].i, NULL /* all */, sdl_realscreen, dest );
-           dest++;
-         } // selected?
+    if ( 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 < 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 ) {
+
+           // selected? show hilights
+           if ( appiter == ui_selected ) {
+             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 = 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 = 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 = 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?
+
+           // show icon
+           mm_cache_t *ic = cache_query_icon ( appiter -> ref -> unique_id );
+           SDL_Surface *iconsurface;
+           if ( ic ) {
+             iconsurface = ic -> i;
+           } else {
+             //pnd_log ( pndn_warning, "WARNING: TBD: Need Missin-icon icon for '%s'\n", IFNULL(appiter -> ref -> title_en,"No Name") );
+
+             // no icon override; was this a pnd-file (show the unknown icon then), or was this generated from
+             // filesystem (file or directory icon)
+             if ( appiter -> ref -> object_flags & PND_DISCO_GENERATED ) {
+               if ( appiter -> ref -> object_type == pnd_object_type_directory ) {
+                 iconsurface = g_imagecache [ IMG_FOLDER ].i;
+               } else {
+                 iconsurface = g_imagecache [ IMG_EXECBIN ].i;
+               }
+             } else {
+               iconsurface = g_imagecache [ IMG_ICON_MISSING ].i;
+             }
 
-         // show icon
-         mm_cache_t *ic = cache_query_icon ( appiter -> ref -> unique_id );
-         SDL_Surface *iconsurface;
-         if ( ic ) {
-           iconsurface = ic -> i;
-         } else {
-           //pnd_log ( pndn_warning, "WARNING: TBD: Need Missin-icon icon for '%s'\n", IFNULL(appiter -> ref -> title_en,"No Name") );
-           iconsurface = g_imagecache [ IMG_ICON_MISSING ].i;
-         }
-         if ( iconsurface ) {
-           //pnd_log ( pndn_debug, "Got an icon for '%s'\n", IFNULL(appiter -> ref -> title_en,"No Name") );
+           }
 
-           src.x = 0;
-           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);
+           // got an icon I hope?
+           if ( iconsurface ) {
+             //pnd_log ( pndn_debug, "Got an icon for '%s'\n", IFNULL(appiter -> ref -> title_en,"No Name") );
 
-           SDL_BlitSurface ( iconsurface, &src, sdl_realscreen, dest );
+             src.x = 0;
+             src.y = 0;
+             src.w = 60;
+             src.h = 60;
+             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);
 
-           // store touch info
-           ui_register_app ( appiter, dest -> x, dest -> y, src.w, src.h );
+             SDL_BlitSurface ( iconsurface, &src, sdl_realscreen, dest );
 
-           dest++;
+             // store touch info
+             ui_register_app ( appiter, dest -> x, dest -> y, src.w, src.h );
 
-         }
+             dest++;
 
-         // 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 );
-           src.x = 0;
-           src.y = 0;
-           src.w = text_width < rtext -> w ? text_width : rtext -> w;
-           src.h = rtext -> h;
-           if ( rtext -> w > text_width ) {
-             dest -> x = grid_offset_x + ( col * cell_width ) + text_clip_x;
-           } else {
-             dest -> x = grid_offset_x + ( col * cell_width ) + text_offset_x - ( rtext -> w / 2 );
            }
-           dest -> y = grid_offset_y + ( displayrow * cell_height ) + text_offset_y;
-           SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
-           SDL_FreeSurface ( rtext );
-           dest++;
-         }
 
-       } // display now? or scrolled away..
+           // show text
+           if ( appiter -> ref -> title_en ) {
+             SDL_Surface *rtext;
+             rtext = TTF_RenderText_Blended ( g_grid_font, appiter -> ref -> title_en, c -> fontcolor );
+             src.x = 0;
+             src.y = 0;
+             src.w = c -> text_width < rtext -> w ? c -> text_width : rtext -> w;
+             src.h = rtext -> h;
+             if ( rtext -> w > c -> text_width ) {
+               dest -> x = c -> grid_offset_x + ( col * c -> cell_width ) + c -> text_clip_x;
+             } else {
+               dest -> x = c -> grid_offset_x + ( col * c -> cell_width ) + c -> text_offset_x - ( rtext -> w / 2 );
+             }
+             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++;
+           }
 
-       // next
-       appiter = appiter -> next;
+         } // display now? or scrolled away..
 
-      } // for column 1...X
+         // next
+         appiter = appiter -> next;
 
-      if ( row >= ui_rows_scrolled_down ) {
-       displayrow++;
-      }
+       } // for column 1...X
 
-      row ++;
+       if ( row >= ui_rows_scrolled_down ) {
+         displayrow++;
+       }
 
-      // are we done displaying rows?
-      if ( displayrow >= row_max ) {
-       break;
-      }
+       row ++;
 
-    } // while
+       // are we done displaying rows?
+       if ( displayrow >= c -> row_max ) {
+         break;
+       }
 
-  } else {
-    // no apps to render?
-    pnd_log ( pndn_rem, "No applications to render?\n" );
-  } // apps to renser?
+      } // while
 
-  // detail panel
-  if ( ui_selected ) {
+    } else {
+      // no apps to render?
+      pnd_log ( pndn_rem, "No applications to render?\n" );
+    } // apps to renser?
+
+  } // r_grid
+
+  // 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" );
@@ -621,88 +772,157 @@ void ui_render ( unsigned int render_mask ) {
 
     unsigned int desty = cell_offset_y;
 
-    char buffer [ 256 ];
+    if ( ui_selected ) {
+
+      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;
+      }
 
-    // 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;
-    }
+      // category
+#if 0
+      if ( ui_selected -> ref -> main_category ) {
+
+       sprintf ( buffer, "Category: %s", ui_selected -> ref -> main_category );
+
+       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
 
-    // category
-    if ( ui_selected -> ref -> main_category ) {
+      // clock
+      if ( ui_selected -> ref -> clockspeed ) {
+
+       sprintf ( buffer, "CPU Clock: %s", ui_selected -> ref -> clockspeed );
+
+       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;
+      }
 
-      sprintf ( buffer, "Category: %s", ui_selected -> ref -> main_category );
+      // 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++;
+      }
 
-      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;
-    }
+      // info hint
+#if 0 // merged into hint-line
+      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
 
-    // clock
-    if ( ui_selected -> ref -> clockspeed ) {
+      // notes
+      if ( ui_selected -> ovrh ) {
+       char *n;
+       unsigned char i;
+       char buffer [ 50 ];
 
-      sprintf ( buffer, "CPU Clock: %s", ui_selected -> ref -> clockspeed );
+       desty += 5; // a touch of spacing can't hurt
 
-      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;
-    }
+       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 );
 
-    // show sub-app# on right side of cpu clock?
-    //if ( ui_selected -> ref -> subapp_number )
-    {
-      sprintf ( buffer, "(app#%u)", ui_selected -> ref -> subapp_number );
+         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
 
-      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++;
-    }
+      } // r_detail -> notes
 
-    // info hint
-    if ( ui_selected -> ref -> clockspeed && ui_selected -> ref -> info_filename ) {
+      // preview pic
+      mm_cache_t *ic = cache_query_preview ( ui_selected -> ref -> unique_id );
+      SDL_Surface *previewpic;
 
-      sprintf ( buffer, "Documentation - hit Y" );
+      if ( ic ) {
+       previewpic = ic -> i;
+      } else {
+       previewpic = g_imagecache [ IMG_PREVIEW_MISSING ].i;
+      }
+
+      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;
@@ -712,34 +932,18 @@ void ui_render ( unsigned int render_mask ) {
       SDL_BlitSurface ( rtext, &src, sdl_realscreen, dest );
       SDL_FreeSurface ( rtext );
       dest++;
-      desty += src.h;
-    }
-
-    // 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?
 
-  } // selected?
+  } // r_detail
 
   // extras
   //
 
   // battery
-  if ( 1 ) {
+  if ( render_jobs_b & R_BG ) {
     static int last_battlevel = 0;
     static unsigned char batterylevel = 0;
     char buffer [ 100 ];
@@ -752,8 +956,7 @@ void ui_render ( unsigned int render_mask ) {
     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 );
@@ -763,19 +966,46 @@ void ui_render ( unsigned int render_mask ) {
 
   // hints
   if ( pnd_conf_get_as_char ( g_conf, "display.hintline" ) ) {
-    char *buffer = pnd_conf_get_as_char ( g_conf, "display.hintline" );
+    char *buffer;
+    unsigned int hintx, hinty;
+    hintx = pnd_conf_get_as_int_d ( g_conf, "display.hint_x", 40 );
+    hinty = pnd_conf_get_as_int_d ( g_conf, "display.hint_y", 450 );
+    static unsigned int lastwidth = 3000;
+
+    if ( ui_selected && ui_selected -> ref -> info_filename ) {
+      buffer = "Documentation - hit Y";
+    } else {
+      buffer = pnd_conf_get_as_char ( g_conf, "display.hintline" );
+    }
+
     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 = pnd_conf_get_as_int_d ( g_conf, "display.hint_x", 40 );
-    dest -> y = pnd_conf_get_as_int_d ( g_conf, "display.hint_y", 450 );
+    rtext = TTF_RenderText_Blended ( g_grid_font, buffer, c -> fontcolor );
+
+    // clear bg
+    if ( ! ( render_jobs_b & R_BG ) ) {
+      src.x = hintx;
+      src.y = hinty;
+      src.w = lastwidth;
+      src.h = rtext -> h;
+      dest -> x = hintx;
+      dest -> y = hinty;
+      SDL_BlitSurface ( g_imagecache [ IMG_BACKGROUND_TABMASK ].i, &src, sdl_realscreen, dest );
+      dest++;
+      lastwidth = rtext -> w;
+    }
+
+    // now render text
+    dest -> x = hintx;
+    dest -> y = hinty;
     SDL_BlitSurface ( rtext, NULL /* all */, sdl_realscreen, dest );
     SDL_FreeSurface ( rtext );
     dest++;
   }
 
-  // hints
-  if ( pnd_conf_get_as_int_d ( g_conf, "display.clock_x", -1 ) != -1 ) {
+  // clock time
+  if ( render_jobs_b & R_BG &&
+       pnd_conf_get_as_int_d ( g_conf, "display.clock_x", -1 ) != -1 )
+  {
     char buffer [ 50 ];
 
     time_t t = time ( NULL );
@@ -783,8 +1013,7 @@ void ui_render ( unsigned int render_mask ) {
     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 );
@@ -793,6 +1022,8 @@ void ui_render ( unsigned int render_mask ) {
   }
 
   // update all the rects and send it all to sdl
+  // - at this point, we could probably just do 1 rect, of the
+  //   whole screen, and be faster :/
   SDL_UpdateRects ( sdl_realscreen, dest - rects, rects );
 
 } // ui_render
@@ -817,14 +1048,13 @@ 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 ) ) {
 
-         pnd_log ( pndn_debug, "Deferred preview pic load ----------\n" );
-
          // load the preview pics now!
          pnd_disco_t *iter = ui_selected -> ref;
 
          if ( iter -> preview_pic1 ) {
 
            if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.threaded_preview", 0 ) ) {
+             // load in bg thread, make user experience chuggy
 
              g_preview_thread = SDL_CreateThread ( (void*)ui_threaded_defered_preview, iter );
 
@@ -833,6 +1063,7 @@ void ui_process_input ( unsigned char block_p ) {
              }
 
            } else {
+             // load it now, make user wait
 
              if ( ! cache_preview ( iter, pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_width", 200 ),
                                     pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_height", 180 ) )
@@ -846,8 +1077,6 @@ void ui_process_input ( unsigned char block_p ) {
 
          } // got a preview at all?
 
-         pnd_log ( pndn_debug, "Deferred preview pic load finish ---\n" );
-
          ui_event++;
        }
 
@@ -865,6 +1094,8 @@ void ui_process_input ( unsigned char block_p ) {
 
       }
 
+      render_mask |= CHANGED_EVERYTHING;
+
       break;
 
 #if 0 // joystick motion
@@ -959,11 +1190,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 ) {
@@ -978,16 +1212,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_z || 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_x || 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_y || 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 );
@@ -1000,40 +1243,64 @@ void ui_process_input ( unsigned char block_p ) {
 
       } else if ( event.key.keysym.sym == SDLK_LCTRL /*LALT*/ ) { // select button
        char *opts [ 20 ] = {
-         "Return to Minimenu",
+         "Reveal hidden category",
          "Shutdown Pandora",
-         "Rescan for Applications",
-         "Run xfce4 from Minimenu",
+         "Configure Minimenu",
+         "Rescan for applications",
+         "Cache previews to SD now",
          "Run a terminal/console",
-         "Exit and run xfce4",
-         "Exit and run pmenu",
+         "Run another GUI (xfce, etc)",
          "Quit (<- beware)",
+         "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 ) {
          // do nothing
+         ui_revealscreen();
        } else if ( sel == 1 ) {
          // shutdown
          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();
-         // reset view
-         ui_selected = NULL;
-         ui_rows_scrolled_down = 0;
-       } else if ( sel == 3 ) {
-         // run xfce
-         char buffer [ PATH_MAX ];
-         sprintf ( buffer, "%s %s\n", MM_RUN, "/usr/bin/startxfce4" );
-         emit_and_quit ( buffer );
        } else if ( sel == 4 ) {
+         // cache preview to SD now
+         extern pnd_box_handle g_active_apps;
+         pnd_box_handle h = g_active_apps;
+
+         unsigned int maxwidth, maxheight;
+         maxwidth = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_width", 200 );
+         maxheight = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_height", 180 );
+
+         pnd_disco_t *iter = pnd_box_get_head ( h );
+
+         while ( iter ) {
+
+           // cache it
+           if ( ! cache_preview ( iter, maxwidth, maxheight ) ) {
+             pnd_log ( pndn_debug, "Force cache: Couldn't load preview pic: '%s' -> '%s'\n",
+                       IFNULL(iter->title_en,"No Name"), iter -> preview_pic1 );
+           }
+
+           // next
+           iter = pnd_box_get_next ( iter );
+         } // while
+
+       } else if ( sel == 5 ) {
          // run terminal
          char *argv[5];
          argv [ 0 ] = pnd_conf_get_as_char ( g_conf, "utility.terminal" );
@@ -1043,33 +1310,80 @@ void ui_process_input ( unsigned char block_p ) {
            ui_forkexec ( argv );
          }
 
-       } else if ( sel == 5 ) {
-         // set env to xfce
-         sprintf ( buffer, "echo startxfce4 > /tmp/gui.load" );
-         system ( buffer );
-         //sprintf ( buffer, "sudo poweroff" );
-         //system ( buffer );
-         exit ( 0 );
        } else if ( sel == 6 ) {
-         // set env to pmenu
-         sprintf ( buffer, "echo pmenu > /tmp/gui.load" );
-         system ( buffer );
-         //sprintf ( buffer, "sudo poweroff" );
-         //system ( buffer );
-         exit ( 0 );
+         char buffer [ PATH_MAX ];
+         sprintf ( buffer, "%s %s\n", MM_RUN, "/usr/pandora/scripts/op_switchgui.sh" );
+         emit_and_quit ( buffer );
        } 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 == 9 ) {
          // about
+         char buffer [ PATH_MAX ];
+         sprintf ( buffer, "%s/about.txt", g_skinpath );
+         ui_aboutscreen ( buffer );
        }
 
        ui_event++;
-      }
+       render_mask |= CHANGED_EVERYTHING;
+
+      } else {
+       // unknown SDLK_ keycode?
+
+       // 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;
+
+         //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;
+             }
+             app = app -> next;
+           }
+
+         } // same start letter, or new run?
+
+         // found something, or no?
+         if ( app ) {
+           // looks like we found a potential match; try switching it to visible selection
+           ui_selected = app;
+           ui_set_selected ( ui_selected );
+         }
+
+
+
+
+
+       } // SDLK_alphanumeric?
+
+      } // SDLK_....
 
       // extras
-      if ( event.key.keysym.sym == SDLK_q ) {
+#if 1
+      if ( event.key.keysym.sym == SDLK_ESCAPE ) {
        emit_and_quit ( MM_QUIT );
       }
+#endif
 
       break;
 #endif
@@ -1116,13 +1430,13 @@ void ui_push_left ( unsigned char forcecoil ) {
   // what column we in?
   unsigned int col = ui_determine_screen_col ( ui_selected );
 
-  // are we alreadt at first item?
+  // are we already at first item?
   if ( forcecoil == 0 &&
        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;
-    while ( i ) {
+    unsigned int i = ui_display_context.col_max - 1;
+    while ( i && ui_selected -> next ) {
       ui_push_right ( 0 );
       i--;
     }
@@ -1157,13 +1471,16 @@ void ui_push_right ( unsigned char forcecoil ) {
     // wrap same or no?
     if ( forcecoil == 0 &&
         pnd_conf_get_as_int_d ( g_conf, "grid.wrap_horiz_samerow", 0 ) &&
-        col == pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 ) - 1 )
+        // and selected is far-right, or last icon in category (might not be far right)
+        ( ( col == ui_display_context.col_max - 1 ) ||
+          ( ui_selected -> next == NULL ) )
+       )
     {
       // same wrap
-      unsigned int i = pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 ) - 1;
-      while ( i ) {
+      //unsigned int i = pnd_conf_get_as_int_d ( g_conf, "grid.col_max", 5 ) - 1;
+      while ( col /*i*/ ) {
        ui_push_left ( 0 );
-       i--;
+       col--; //i--;
       }
 
     } else {
@@ -1185,7 +1502,7 @@ void ui_push_right ( unsigned char forcecoil ) {
 }
 
 void ui_push_up ( void ) {
-  unsigned char col_max = pnd_conf_get_as_int ( g_conf, MMENU_DISP_COLMAX );
+  unsigned char col_max = ui_display_context.col_max;
 
   if ( ! ui_selected ) {
     return;
@@ -1195,7 +1512,7 @@ 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
 
@@ -1219,7 +1536,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, MMENU_DISP_ROWMAX ) > 0 ) {
+    if ( r - ui_display_context.row_max > 0 ) {
       ui_rows_scrolled_down = (unsigned int) r;
     }
 
@@ -1237,7 +1554,7 @@ void ui_push_up ( void ) {
 }
 
 void ui_push_down ( void ) {
-  unsigned char col_max = pnd_conf_get_as_int ( g_conf, MMENU_DISP_COLMAX );
+  unsigned char col_max = ui_display_context.col_max;
 
   if ( ui_selected ) {
 
@@ -1252,51 +1569,168 @@ void ui_push_down ( void ) {
 
     // 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;
+       col--;
+      }
+
+      ui_rows_scrolled_down = 0;
+
+      render_mask |= CHANGED_EVERYTHING;
+
+    } else {
+
+      while ( col_max ) {
+       ui_push_right ( 1 );
+       col_max--;
+      }
+
+    }
+
+  } else {
+    ui_push_right ( 0 );
+  }
+
+  return;
+}
+
+void ui_push_exec ( void ) {
+
+  if ( ! ui_selected ) {
+    return;
+  }
+
+  // was this icon generated from filesystem, or from pnd-file?
+  if ( ui_selected -> ref -> object_flags & PND_DISCO_GENERATED ) {
+
+    if ( ! ui_selected -> ref -> title_en ) {
+      return; // no filename
+    }
+
+    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;
+
+       // 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' ) {
+         strcpy ( g_categories [ ui_category].fspath, "/" );
+       }
 
-      while ( col ) {
-       ui_selected = ui_selected -> next;
-       col--;
+      } else {
+       // go down
+       strcat ( g_categories [ ui_category].fspath, "/" );
+       strcat ( g_categories [ ui_category].fspath, ui_selected -> ref -> title_en );
       }
 
-      ui_rows_scrolled_down = 0;
+      pnd_log ( pndn_debug, "Cat %s is now in path %s\n", g_categories [ ui_category ].catname, g_categories [ ui_category ].fspath );
+
+      // 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;
 
     } else {
+      // just run it arbitrarily?
 
-      while ( col_max ) {
-       ui_push_right ( 1 );
-       col_max--;
-      }
+      // if this a pnd-file, or just some executable?
+      if ( strcasestr ( ui_selected -> ref -> object_filename, PND_PACKAGE_FILEEXT ) ) {
+       // looks like a pnd, now what do we do..
+       pnd_box_handle h = pnd_disco_file ( ui_selected -> ref -> object_path, ui_selected -> ref -> object_filename );
 
-    }
+       if ( h ) {
+         pnd_disco_t *d = pnd_box_get_head ( h );
+         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() );
+         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 {
-    ui_push_right ( 0 );
-  }
+      } 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.
+
+#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
 
-  return;
-}
+#if 1
+       // just exec it
+       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 );
+       chdir ( cwd );
+#else
+       // 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 );
+       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?
 
-void ui_push_exec ( void ) {
+    } // dir or file?
 
-  if ( ui_selected ) {
+  } 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", ui_selected -> ref -> object_path, ui_selected -> ref -> object_filename );
-    pnd_apps_exec ( pnd_run_script,
-                   buffer,
-                   ui_selected -> ref -> unique_id,
-                   ui_selected -> ref -> exec,
-                   ui_selected -> ref -> startdir,
-                   ui_selected -> ref -> execargs,
-                   atoi ( ui_selected -> ref -> clockspeed ),
-                   PND_EXEC_OPTION_NORUN );
     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;
@@ -1304,12 +1738,24 @@ void ui_push_exec ( void ) {
 
 void ui_push_ltrigger ( void ) {
   unsigned char oldcat = ui_category;
+  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 ) {
+    return;
+  }
 
   if ( ui_category > 0 ) {
     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;
+      ui_catshift = 0;
+      if ( ui_category >= ( screen_width / tab_width ) ) {
+       ui_catshift = ui_category - ( screen_width / tab_width ) + 1;
+      }
+      category_fs_restock ( &(g_categories [ ui_category ]) );
     }
   }
 
@@ -1326,20 +1772,29 @@ void ui_push_ltrigger ( void ) {
   // unscroll
   ui_rows_scrolled_down = 0;
 
+  render_mask |= CHANGED_CATEGORY;
+
   return;
 }
 
 void ui_push_rtrigger ( void ) {
   unsigned char oldcat = ui_category;
 
-  unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
+  if ( g_categorycount == 0 ) {
+    return;
+  }
+
+  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 ]) );
   } 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 ]) );
     }
   }
 
@@ -1356,6 +1811,8 @@ void ui_push_rtrigger ( void ) {
   // unscroll
   ui_rows_scrolled_down = 0;
 
+  render_mask |= CHANGED_CATEGORY;
+
   return;
 }
 
@@ -1391,18 +1848,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 );
@@ -1416,11 +1867,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 );
@@ -1439,8 +1885,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;
@@ -1571,6 +2016,8 @@ int ui_selected_index ( void ) {
 static mm_appref_t *timer_ref = NULL;
 void ui_set_selected ( mm_appref_t *r ) {
 
+  render_mask |= CHANGED_SELECTION;
+
   if ( ! pnd_conf_get_as_int_d ( g_conf, "minimenu.load_previews_later", 0 ) ) {
     return; // no desire to defer anything
   }
@@ -1608,6 +2055,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 );
 
@@ -1636,16 +2085,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++;
     }
@@ -1682,7 +2131,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 ) {
@@ -1691,7 +2140,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++;
@@ -1707,22 +2156,37 @@ 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 ) {
            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 ) {
+       } else if ( event.key.keysym.sym == SDLK_RETURN || event.key.keysym.sym == SDLK_END ) { // return, or "B"
          return ( sel );
 
+#if 0
        } else if ( event.key.keysym.sym == SDLK_q ) {
          exit ( 0 );
+#endif
 
        } else {
          return ( -1 ); // nada
@@ -1748,13 +2212,13 @@ unsigned char ui_determine_row ( mm_appref_t *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 ) {
@@ -1765,7 +2229,7 @@ unsigned char ui_determine_screen_col ( mm_appref_t *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 );
 }
@@ -1915,7 +2379,13 @@ void ui_touch_act ( unsigned int x, unsigned int y ) {
        ui_selected = t -> ref;
        ui_push_exec();
       } else {
+       if ( ui_category != t -> catnum ) {
+         ui_selected = NULL;
+       }
        ui_category = t -> catnum;
+       render_mask |= CHANGED_CATEGORY;
+       // rescan the dir
+       category_fs_restock ( &(g_categories [ ui_category ]) );
       }
 
       break;
@@ -1980,6 +2450,42 @@ void ui_post_scan ( void ) {
 
   } // deferred icon load
 
+  // reset view
+  ui_selected = NULL;
+  ui_rows_scrolled_down = 0;
+  // set back to first tab, to be safe
+  ui_category = 0;
+  ui_catshift = 0;
+
+  // do we have a preferred category to jump to?
+  char *dc = pnd_conf_get_as_char ( g_conf, "categories.default_cat" );
+  if ( dc ) {
+
+    // attempt to find default cat; if we do find it, select it; otherwise
+    // 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 ) {
+       ui_category = i;
+       // ensure visibility
+       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;
+       }
+       break;
+      }
+    }
+
+    if ( i == g_categorycount ) {
+      pnd_log ( pndn_warning, "  User defined default category '%s' but not found, so using default behaviour\n", dc );
+    }
+
+  } // default cat
+
+  // redraw all
+  render_mask |= CHANGED_EVERYTHING;
+
   return;
 }
 
@@ -1988,8 +2494,8 @@ unsigned char ui_threaded_defered_icon ( void *p ) {
   pnd_box_handle h = g_active_apps;
 
   unsigned char maxwidth, maxheight;
-  maxwidth = pnd_conf_get_as_int_d ( g_conf, MMENU_DISP_ICON_MAX_WIDTH, 50 );
-  maxheight = pnd_conf_get_as_int_d ( g_conf, MMENU_DISP_ICON_MAX_HEIGHT, 50 );
+  maxwidth = pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_width", 50 );
+  maxheight = pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_height", 50 );
 
   pnd_disco_t *iter = pnd_box_get_head ( h );
 
@@ -2020,3 +2526,475 @@ unsigned char ui_threaded_defered_icon ( void *p ) {
 
   return ( 0 );
 }
+
+void ui_show_hourglass ( unsigned char updaterect ) {
+
+  SDL_Rect dest;
+  SDL_Surface *s = g_imagecache [ IMG_HOURGLASS ].i;
+
+  dest.x = ( 800 - s -> w ) / 2;
+  dest.y = ( 480 - s -> h ) / 2;
+
+  SDL_BlitSurface ( s, NULL /* whole image */, sdl_realscreen, &dest );
+
+  if ( updaterect ) {
+    SDL_UpdateRects ( sdl_realscreen, 1, &dest );
+  }
+
+  return;
+}
+
+unsigned char ui_pick_skin ( void ) {
+#define MAXSKINS 10
+  char *skins [ MAXSKINS ];
+  unsigned char iter;
+
+  char *searchpath = pnd_conf_get_as_char ( g_conf, "minimenu.skin_searchpath" );
+  char tempname [ 100 ];
+
+  iter = 0;
+
+  skins [ iter++ ] = "No skin change";
+
+  SEARCHPATH_PRE
+  {
+    DIR *d = opendir ( buffer );
+
+    if ( d ) {
+      struct dirent *dd;
+
+      while ( ( dd = readdir ( d ) ) ) {
+
+       if ( dd -> d_name [ 0 ] == '.' ) {
+         // ignore
+       } else if ( ( dd -> d_type == DT_DIR || dd -> d_type == DT_UNKNOWN ) &&
+                   iter < MAXSKINS )
+       {
+         snprintf ( tempname, 100, "Skin: %s", dd -> d_name );
+         skins [ iter++ ] = strdup ( tempname );
+       }
+
+      }
+
+      closedir ( d );
+    }
+
+  }
+  SEARCHPATH_POST
+
+  int sel = ui_modal_single_menu ( skins, iter, "Skins", "Enter to select; other to return." );
+
+  // did they pick one?
+  if ( sel > 0 ) {
+    FILE *f;
+
+    char *s = strdup ( pnd_conf_get_as_char ( g_conf, "minimenu.skin_selected" ) );
+    s = pnd_expand_tilde ( s );
+
+    f = fopen ( s, "w" );
+
+    free ( s );
+
+    if ( f ) {
+      fprintf ( f, "%s\n", skins [ sel ] + 6 );
+      fclose ( f );
+    }
+
+    return ( 1 );
+  }
+
+  return ( 0 );
+}
+
+void ui_aboutscreen ( char *textpath ) {
+#define PIXELW 7
+#define PIXELH 7
+#define MARGINW 3
+#define MARGINH 3
+#define SCRW 800
+#define SCRH 480
+#define ROWS SCRH / ( PIXELH + MARGINH )
+#define COLS SCRW / ( PIXELW + MARGINW )
+
+  unsigned char pixelboard [ ROWS * COLS ]; // pixel heat
+  bzero ( pixelboard, ROWS * COLS );
+
+  SDL_Surface *rtext;
+  SDL_Rect r;
+
+  SDL_Color rtextc = { 200, 200, 200, 100 };
+
+  // pixel scroller
+  char *textloop [ 500 ];
+  unsigned int textmax = 0;
+  bzero ( textloop, 500 * sizeof(char*) );
+
+  // cursor scroller
+  char cbuffer [ 50000 ];
+  bzero ( cbuffer, 50000 );
+  unsigned int crevealed = 0;
+
+  FILE *f = fopen ( textpath, "r" );
+
+  if ( ! f ) {
+    pnd_log ( pndn_error, "ERROR: Couldn't open about text: %s\n", textpath );
+    return;
+  }
+
+  char textbuf [ 100 ];
+  while ( fgets ( textbuf, 100, f ) ) {
+
+    // add to full buffer
+    strncat ( cbuffer, textbuf, 50000 );
+
+    // chomp
+    if ( strchr ( textbuf, '\n' ) ) {
+      * strchr ( textbuf, '\n' ) = '\0';
+    }
+
+    // add to pixel loop
+    if ( 1||textbuf [ 0 ] ) {
+      textloop [ textmax ] = strdup ( textbuf );
+      textmax++;
+    }
+
+  } // while fgets
+
+  fclose ( f );
+
+  unsigned int textiter = 0;
+  while ( textiter < textmax ) {
+    char *text = textloop [ textiter ];
+
+    rtext = NULL;
+    if ( text [ 0 ] ) {
+      // render to surface
+      rtext = TTF_RenderText_Blended ( g_grid_font, text, rtextc );
+
+      // render font to pixelboard
+      unsigned int px, py;
+      unsigned char *ph;
+      unsigned int *pixels = rtext -> pixels;
+      unsigned char cr, cg, cb, ca;
+      for ( py = 0; py < rtext -> h; py ++ ) {
+       for ( px = 0; px < ( rtext -> w > COLS ? COLS : rtext -> w ); px++ ) {
+
+         SDL_GetRGBA ( pixels [ ( py * rtext -> pitch / 4 ) + px ],
+                       rtext -> format, &cr, &cg, &cb, &ca );
+
+         if ( ca != 0 ) {
+
+           ph = pixelboard + ( /*y offset */ 30 * COLS ) + ( py * COLS ) + px /* / 2 */;
+
+           if ( *ph < 100 ) {
+             *ph = 100;
+           }
+
+           ca /= 5;
+           if ( *ph + ca < 250 ) {
+             *ph += ca;
+           }
+
+         } // got a pixel?
+
+       } // x
+      } // y
+
+    } // got text?
+
+    unsigned int runcount = 10;
+    while ( runcount-- ) {
+
+      // clear display
+      SDL_FillRect( sdl_realscreen, NULL /* whole */, 0 );
+
+      // render pixelboard
+      unsigned int x, y;
+      unsigned int c;
+      for ( y = 0; y < ROWS; y++ ) {
+       for ( x = 0; x < COLS; x++ ) {
+
+         if ( 1||pixelboard [ ( y * COLS ) + x ] ) {
+
+           // position
+           r.x = x * ( PIXELW + MARGINW );
+           r.y = y * ( PIXELH + MARGINH );
+           r.w = PIXELW;
+           r.h = PIXELH;
+           // heat -> colour
+           c = SDL_MapRGB ( sdl_realscreen -> format, 100 /* r */, 0 /* g */, pixelboard [ ( y * COLS ) + x ] );
+           // render
+           SDL_FillRect( sdl_realscreen, &r /* whole */, c );
+
+         }
+
+       } // x
+      } // y
+
+      // cool pixels
+      unsigned char *pc = pixelboard;
+      for ( y = 0; y < ROWS; y++ ) {
+       for ( x = 0; x < COLS; x++ ) {
+
+         if ( *pc > 10 ) {
+           (*pc) -= 3;
+         }
+
+         pc++;
+       } // x
+      } // y
+
+      // slide pixels upwards
+      memmove ( pixelboard, pixelboard + COLS, ( COLS * ROWS ) - COLS );
+
+      // render actual readable text
+      {
+
+       // display up to cursor
+       SDL_Rect dest;
+       unsigned int cdraw = 0;
+       SDL_Surface *cs;
+       char ctb [ 2 ];
+
+       if ( crevealed > 200 ) {
+         cdraw = crevealed - 200;
+       }
+
+       dest.x = 400;
+       dest.y = 20;
+
+       for ( ; cdraw < crevealed; cdraw++ ) {
+         ctb [ 0 ] = cbuffer [ cdraw ];
+         ctb [ 1 ] = '\0';
+         // move over or down
+         if ( cbuffer [ cdraw ] == '\n' ) {
+           // EOL
+           dest.x = 400;
+           dest.y += 14;
+
+           if ( dest.y > 450 ) {
+             dest.y = 450;
+           }
+
+         } else {
+           // draw the char
+           cs = TTF_RenderText_Blended ( g_tab_font, ctb, rtextc );
+           if ( cs ) {
+             SDL_BlitSurface ( cs, NULL /* all */, sdl_realscreen, &dest );
+             SDL_FreeSurface ( cs );
+             // over
+             dest.x += cs -> w;
+           }
+         }
+
+       }
+
+       dest.w = 10;
+       dest.h = 20;
+       SDL_FillRect ( sdl_realscreen, &dest /* whole */, 220 );
+
+       // increment cursor to next character
+       if ( cbuffer [ crevealed ] != '\0' ) {
+         crevealed++;
+       }
+
+      } // draw cursor text
+
+      // reveal
+      //
+      SDL_UpdateRect ( sdl_realscreen, 0, 0, 0, 0 ); // whole screen
+
+      usleep ( 50000 );
+
+      // any button? if so, about
+      {
+       SDL_PumpEvents();
+
+       SDL_Event e;
+
+       if ( SDL_PeepEvents ( &e, 1, SDL_GETEVENT, SDL_EVENTMASK(/*SDL_KEYUP|*/SDL_KEYDOWN) ) > 0 ) {
+         return;
+       }
+
+      }
+
+    } // while cooling
+
+    if ( rtext ) {
+      SDL_FreeSurface ( rtext );
+    }
+
+    textiter++;
+  } // while more text
+
+  // free up
+  unsigned int i;
+  for ( i = 0; i < textmax; i++ ) {
+    if ( textloop [ i ] ) {
+      free ( textloop [ i ] );
+      textloop [ i ] = 0;
+    }
+  }
+
+  return;
+}
+
+void ui_revealscreen ( void ) {
+  char *labels [ 500 ];
+  unsigned int labelmax = 0;
+  unsigned int i;
+
+  if ( ! _categories_inviscount ) {
+    return; // nothing to do
+  }
+
+  for ( i = 0; i < _categories_inviscount; i++ ) {
+    labels [ labelmax++ ] = _categories_invis [ i ].catname;
+  }
+
+  int sel = ui_modal_single_menu ( labels, labelmax, "Temporary Category Reveal",
+                                  "Enter to select; other to return." );
+
+  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 );
+      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;
+
+    // ensure visibility
+    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;
+    }
+
+    // redraw tabs
+    render_mask |= CHANGED_CATEGORY;
+  }
+
+  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;
+}