minimenu is now skinnable and has skin selector
authorskeezix <skeezix@flotsam-vm.(none)>
Fri, 26 Mar 2010 20:52:30 +0000 (16:52 -0400)
committerskeezix <skeezix@flotsam-vm.(none)>
Fri, 26 Mar 2010 20:52:30 +0000 (16:52 -0400)
deployment/etc/pandora/conf/mmenu.conf
minimenu/TODO.txt
minimenu/mmenu.c
minimenu/mmenu.conf
minimenu/mmenu.h
minimenu/mmui.c
minimenu/mmui.h
minimenu/mmwrapcmd.h
minimenu/skin/default/mmskin.conf [new file with mode: 0644]

index d8905a7..b5aa584 100644 (file)
@@ -1,13 +1,21 @@
 # for the mmenu 'minimenu'
 #
 
 # for the mmenu 'minimenu'
 #
 
+# Note on overriding whats in a .pnd-application/PXML.xml
 # Note that you can perform icon name, clockspeed setting and category overrides via an .ovr file
 # Note that the icon can be overridden for a pnd-file by making a same-name .png file, in the same location
 # Note that you can perform icon name, clockspeed setting and category overrides via an .ovr file
 # Note that the icon can be overridden for a pnd-file by making a same-name .png file, in the same location
+# "Notes" can be added to an icon using the .ovr file, as well.
+
+# Skins
+# There is a a searchpath to find skin subdirs in; built in skins are in /etc/pandora/mmenu/skins,
+# so any subdirectory of that is a skin-name. (ie: /etc/pandora/mmenu/skins/default is skin named 'default')
+# Each skin will have its own mmskin.conf file defining how the skin works. All other options should be
+# here, so that skin-changes do not break user preferences
 
 [minimenu]
 
 [minimenu]
-static_art_searchpath  /etc/pandora/mmenu/skins/default:./minimenu/skin/default
-font                   Vera.ttf
-font_ptsize            24
+skin_searchpath                /media/*/pandora/mmenu/skins:/etc/pandora/mmenu/skins:./minimenu/skin
+skin_selected          ~/.mmenuskinchoice
+skin_confname          mmskin.conf
 pndrun                 /usr/pandora/scripts:./testdata/scripts # searchpath to locate "pnd_run.sh"; why aren't I looking in /etc/pandora/conf/apps for this?
 load_previews_now      0       # if >0, will try to load preview pics from pnds at boot time, not defer till later
 load_previews_later    1       # if >0, will try to load preview pics sometime (see defer_timer_ms as well)
 pndrun                 /usr/pandora/scripts:./testdata/scripts # searchpath to locate "pnd_run.sh"; why aren't I looking in /etc/pandora/conf/apps for this?
 load_previews_now      0       # if >0, will try to load preview pics from pnds at boot time, not defer till later
 load_previews_later    1       # if >0, will try to load preview pics sometime (see defer_timer_ms as well)
@@ -26,18 +34,6 @@ terminal             /usr/bin/Terminal       # could also be /usr/bin/xterm, or a sh-script, or w
 [display]
 fullscreen             1       # 0 for windowed, >0 for fullscreen
 screen_width           800     # for some calculations
 [display]
 fullscreen             1       # 0 for windowed, >0 for fullscreen
 screen_width           800     # for some calculations
-detail_bg_alpha                100     # when rendering the detail panel background, how transparent?
-font_rgba_r            220     # RGBA for the display text
-font_rgba_g            220     # RGBA for the display text
-font_rgba_b            220     # RGBA for the display text
-font_rgba_a            20      # RGBA for the display text
-battery_x              10      # (x,y) for battery level
-battery_y              450     # (x,y) for battery level
-hintline               Push SELECT for options # shown at bottom of screen
-hint_x                 300     # (x,y) for hint line
-hint_y                 450     # (x,y) for hint line
-clock_x                        650     # (x,y) for clock
-clock_y                        450     # (x,y) for clock
 
 [tabs]
 top_maincat            1       # include maincat in top tab bar
 
 [tabs]
 top_maincat            1       # include maincat in top tab bar
@@ -47,94 +43,20 @@ top_altcat          1       # include alt cat in top tab bar
 top_altcat1            0       # include alt cat subcat 1 in top tab bar
 top_altcat2            0       # include alt cat subcat 1 in top tab bar
 wraparound             0       # if 1, last tab wraps around to first when going right; going left from first tab goes to last
 top_altcat1            0       # include alt cat subcat 1 in top tab bar
 top_altcat2            0       # include alt cat subcat 1 in top tab bar
 wraparound             0       # if 1, last tab wraps around to first when going right; going left from first tab goes to last
-font                   Vera.ttf
-font_ptsize            16
-tab_offset_x           4       # from left screen to first tab left
-tab_offset_y           3       # from top of screen to first tab top
-tab_width              132     # width of tab
-tab_height             35      # height of tab (for vertical clip)
-tab_selheight          39      # height of tab when its selected (for vertical clip)
-text_offset_x          10      # from left edge of tab to left edge of text
-text_offset_y          10      # from top edge of tab to top edge of text
-text_width             110     # clip text to this width
 
 [grid]
 
 [grid]
-font                   Vera.ttf
-font_ptsize            12
-icon_max_width         60      # scale icons to..
-icon_max_height                60      # scale icons to..
-grid_offset_x          17      # from left screen to first cell column
-grid_offset_y          60      # from top screen to first cell row
-icon_offset_x          12      # from left edge of cell to left edge of icon in cell
-icon_offset_y          0       # from top edge of cell to top edge of icon in cell
-text_offset_x          42      # from left edge of cell to center of text centering (ie: center of icon presumably)
-text_offset_y          65      # from top of cell to top of text
-text_width             75      # max width of the text
-text_clip_x            5       # offset from cell edge to left edge of text, when the text width is being clipped to fit
-sel_offoffset_x                -5      # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
-sel_offoffset_y                -5      # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
-cell_width             85      # cell location is grid_offset_x + ( cell_width * column_number )
-cell_height            92      # cell location is grid_offset_y + ( cell_height * column_number )
-col_max                        5       # number of columns to render into grid
-row_max                        4       # number of rows to display before we stop rendering
-text_hilite_offset_y   62      # from top of cell to top of hilight
 scroll_increment       4       # number of rows to scroll when jumping up or down (recommend 1, or same as row_max for full page jump)
 scroll_increment       4       # number of rows to scroll when jumping up or down (recommend 1, or same as row_max for full page jump)
-arrow_up_x             450     # left edge of up-arrow showing more icons scrolled away
-arrow_up_y             80      # top edge of up-arrow showing more icons scrolled away
-arrow_down_x           450     # left edge of down-arrow showing more icons scrolled away
-arrow_down_y           380     # top edge of down-arrow showing more icons scrolled away
-arrow_bar_x            455     # left edge of scrollbar
-arrow_bar_y            100     # top edge of scrollbar
-arrow_bar_clip_w       10      # clip scrollbar artwork to width-X
-arrow_bar_clip_h       274     # clip scrollbar artwork to height-X
-scale_up_bool          1       # if 0, will not try to scale up icons
 wrap_horiz_samerow     1       # if 0, wraps to prev/next row; if 1, stays on same row
 wrap_vert_stop         0       # if 0, wrap to other end; if 1, stops at top/bottom
 
 wrap_horiz_samerow     1       # if 0, wraps to prev/next row; if 1, stays on same row
 wrap_vert_stop         0       # if 0, wrap to other end; if 1, stops at top/bottom
 
-[detailpane]
-show                   1       # if 0, don't show detail pane artwork at all
-pane_offset_x          475     # left edge of detail pane graphic
-pane_offset_y          60      # top edge of detail pane graphic
-
-[detailtext]
-font                   Vera.ttf
-font_ptsize            16
-cell_offset_x          488     # left edge of text cell
-cell_offset_y          300     # top edge of text cell
-cell_width             250     # width of cell (for text clipping)
-
 [previewpic]
 defer_timer_ms         1500    # after setting selection, how long to wait before we try to load the previewpic
 [previewpic]
 defer_timer_ms         1500    # after setting selection, how long to wait before we try to load the previewpic
-cell_offset_x          480     # left edge of text cell
-cell_offset_y          90      # top edge of text cell
-cell_width             285
-cell_height            180
-scale_up_bool          1       # if 0, will not try to scale up preview
 do_cache               1       # if 1, will try to cache previews to SD, for performance boost
 cache_searchpath       /media/mmcblk[12]p?        # devices to consider for caching to, in order
 cache_minfree          500             # if free space is less than this (in KB), move to next device
 cache_path             /pandora/appdata/mmenu.pvwcache              # where to write cached images to
 cache_findpath         /media/mmcblk[12]p?/pandora/appdata/mmenu.pvwcache           # where to look for cached preview pics
 
 do_cache               1       # if 1, will try to cache previews to SD, for performance boost
 cache_searchpath       /media/mmcblk[12]p?        # devices to consider for caching to, in order
 cache_minfree          500             # if free space is less than this (in KB), move to next device
 cache_path             /pandora/appdata/mmenu.pvwcache              # where to write cached images to
 cache_findpath         /media/mmcblk[12]p?/pandora/appdata/mmenu.pvwcache           # where to look for cached preview pics
 
-[graphics]
-IMG_BACKGROUND_800480    800480_6.png
-IMG_BACKGROUND_TABMASK   tab1mask.png
-IMG_DETAIL_PANEL         detailpane2.png
-IMG_DETAIL_BG            detailpanebg.png
-IMG_SELECTED_ALPHAMASK   select.png
-IMG_SELECTED_HILITE     hilite.png
-IMG_TAB_SEL              tab_sel_tall.png
-IMG_TAB_UNSEL            tab_unsel.png
-IMG_TAB_LINE            tabline.png    # line under the unselected tab, but not left/right corners
-IMG_TAB_LINEL           tablinel.png   # line under unselected tab on far left
-IMG_TAB_LINER           tabliner.png   # line under unselected tab on far right
-IMG_ICON_MISSING        pandora60.png
-IMG_PREVIEW_MISSING     pandora60.png
-IMG_ARROW_UP            arrowup.png
-IMG_ARROW_DOWN          arrowdown.png
-IMG_ARROW_SCROLLBAR     arrowscroller.png
-IMG_HOURGLASS           hourglass.png
-
 [categories]
 do_all_cat             1               # if >0, will show an All category; if 0, skip it, just your cats.
 # Normally for mmenu, an encountered category is just used as is. 5 cats exist, you get 5 tabs.
 [categories]
 do_all_cat             1               # if >0, will show an All category; if 0, skip it, just your cats.
 # Normally for mmenu, an encountered category is just used as is. 5 cats exist, you get 5 tabs.
index 7370511..d36c241 100644 (file)
@@ -5,10 +5,9 @@
 
 - libpnd: appdata-dir-name?
 
 
 - libpnd: appdata-dir-name?
 
+- BJ dpad for demo
 - add font and fontcolour control to conf
 - About screen and shoutouts // konami code?
 - add font and fontcolour control to conf
 - About screen and shoutouts // konami code?
-- skinning .. mmenu.conf and then skin.conf in each skin dir?
-  - skin picker/saver
 
 - some ultra primtive frame draw, so the 'detail menu' and any 'sub menus' can draw
   their own frame rather than depand on skin frame to exist
 
 - some ultra primtive frame draw, so the 'detail menu' and any 'sub menus' can draw
   their own frame rather than depand on skin frame to exist
index 557920a..d0f1280 100644 (file)
@@ -60,11 +60,14 @@ pnd_conf_handle g_conf = 0;
 pnd_conf_handle g_desktopconf = 0;
 
 char *pnd_run_script = NULL;
 pnd_conf_handle g_desktopconf = 0;
 
 char *pnd_run_script = NULL;
-char *g_skinpath = NULL;
 unsigned char g_x11_present = 1; // >0 if X is present
 unsigned char g_catmap = 0; // if 1, we're doing category mapping
 unsigned char g_pvwcache = 0; // if 1, we're trying to do preview caching
 
 unsigned char g_x11_present = 1; // >0 if X is present
 unsigned char g_catmap = 0; // if 1, we're doing category mapping
 unsigned char g_pvwcache = 0; // if 1, we're trying to do preview caching
 
+char g_skin_selected [ 100 ] = "default";
+char *g_skinpath = NULL; // where 'skin_selected' is located .. the fullpath including skin-dir-name
+pnd_conf_handle g_skinconf = NULL;
+
 int main ( int argc, char *argv[] ) {
   int logall = -1; // -1 means normal logging rules; >=0 means log all!
   int i;
 int main ( int argc, char *argv[] ) {
   int logall = -1; // -1 means normal logging rules; >=0 means log all!
   int i;
@@ -207,28 +210,61 @@ int main ( int argc, char *argv[] ) {
 
   pnd_log ( pndn_rem, "Found pnd_run.sh at '%s'\n", pnd_run_script );
 
 
   pnd_log ( pndn_rem, "Found pnd_run.sh at '%s'\n", pnd_run_script );
 
-  // figure out skin path
-  if ( ! pnd_conf_get_as_char ( g_conf, MMENU_ARTPATH ) ||
-       ! pnd_conf_get_as_char ( g_conf, "minimenu.font" )
-     )
-  {
-    pnd_log ( pndn_error, "ERROR: Couldn't set up skin!\n" );
-    emit_and_quit ( MM_QUIT );
+  // figure out what skin is selected (or default)
+  FILE *f;
+  char *s = strdup ( pnd_conf_get_as_char ( g_conf, "minimenu.skin_selected" ) );
+  s = pnd_expand_tilde ( s );
+  if ( ( f = fopen ( s, "r" ) ) ) {
+    char buffer [ 100 ];
+    if ( fgets ( buffer, 100, f ) ) {
+      // see if that dir can be located
+      if ( strchr ( buffer, '\n' ) ) {
+       * strchr ( buffer, '\n' ) = '\0';
+      }
+      char *found = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, "minimenu.skin_searchpath" ), buffer );
+      if ( found ) {
+       strncpy ( g_skin_selected, buffer, 100 );
+       g_skinpath = strdup ( found );
+      } else {
+       pnd_log ( pndn_warning, "Couldn't locate skin named '%s' so falling back.\n", buffer );
+      }
+    }
+    fclose ( f );
   }
   }
+  free ( s );
 
 
-  g_skinpath = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, MMENU_ARTPATH ),
-                                    pnd_conf_get_as_char ( g_conf, "minimenu.font" ) );
+  if ( g_skinpath ) {
+    pnd_log ( pndn_rem, "Skin is selected: '%s'\n", g_skin_selected );
+  } else {
+    pnd_log ( pndn_rem, "Skin falling back to: '%s'\n", g_skin_selected );
+
+    char *found = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, "minimenu.skin_searchpath" ),
+                                       g_skin_selected );
+    if ( found ) {
+      g_skinpath = strdup ( found );
+    } else {
+      pnd_log ( pndn_error, "Couldn't locate skin named '%s'.\n", g_skin_selected );
+      emit_and_quit ( MM_QUIT );
+    }
 
 
-  if ( ! g_skinpath ) {
-    pnd_log ( pndn_error, "ERROR: Couldn't locate skin font!\n" );
-    emit_and_quit ( MM_QUIT );
   }
   }
+  pnd_log ( pndn_rem, "Skin path determined to be: '%s'\n", g_skinpath );
 
 
-  g_skinpath = strdup ( g_skinpath ); // so we don't lose it next pnd_locate
+  // lets see if this skin-path actually has a skin conf
+  {
+    char fullpath [ PATH_MAX ];
+    sprintf ( fullpath, "%s/%s", g_skinpath, pnd_conf_get_as_char ( g_conf, "minimenu.skin_confname" ) );
+    g_skinconf = pnd_conf_fetch_by_path ( fullpath );
+  }
 
 
-  * strstr ( g_skinpath, pnd_conf_get_as_char ( g_conf, "minimenu.font" ) ) = '\0';
+  // figure out skin path if we didn't get it already
+  if ( ! g_skinconf ) {
+    pnd_log ( pndn_error, "ERROR: Couldn't set up skin!\n" );
+    emit_and_quit ( MM_QUIT );
+  }
 
 
-  pnd_log ( pndn_debug, "Looks like skin is at '%s'\n", g_skinpath );
+  // lets just merge the skin conf onto the regular conf, so it just magicly works
+  pnd_box_append ( g_conf, g_skinconf );
 
   // attempt to set up UI
   if ( ! ui_setup() ) {
 
   // attempt to set up UI
   if ( ! ui_setup() ) {
@@ -367,8 +403,8 @@ void applications_scan ( void ) {
   g_active_appcount = pnd_box_get_size ( g_active_apps );
 
   unsigned char maxwidth, maxheight;
   g_active_appcount = pnd_box_get_size ( 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 );
 
   // show cache screen
   ui_cachescreen ( 1 /* clear screen */, NULL );
 
   // show cache screen
   ui_cachescreen ( 1 /* clear screen */, NULL );
index 9c4369e..a4937d7 100644 (file)
@@ -1,13 +1,21 @@
 # for the mmenu 'minimenu'
 #
 
 # for the mmenu 'minimenu'
 #
 
+# Note on overriding whats in a .pnd-application/PXML.xml
 # Note that you can perform icon name, clockspeed setting and category overrides via an .ovr file
 # Note that the icon can be overridden for a pnd-file by making a same-name .png file, in the same location
 # Note that you can perform icon name, clockspeed setting and category overrides via an .ovr file
 # Note that the icon can be overridden for a pnd-file by making a same-name .png file, in the same location
+# "Notes" can be added to an icon using the .ovr file, as well.
+
+# Skins
+# There is a a searchpath to find skin subdirs in; built in skins are in /etc/pandora/mmenu/skins,
+# so any subdirectory of that is a skin-name. (ie: /etc/pandora/mmenu/skins/default is skin named 'default')
+# Each skin will have its own mmskin.conf file defining how the skin works. All other options should be
+# here, so that skin-changes do not break user preferences
 
 [minimenu]
 
 [minimenu]
-static_art_searchpath  /etc/pandora/mmenu/skins/default:./minimenu/skin/default
-font                   Vera.ttf
-font_ptsize            24
+skin_searchpath                /media/*/pandora/mmenu/skins:/etc/pandora/mmenu/skins:./minimenu/skin
+skin_selected          ~/.mmenuskinchoice
+skin_confname          mmskin.conf
 pndrun                 /usr/pandora/scripts:./testdata/scripts # searchpath to locate "pnd_run.sh"; why aren't I looking in /etc/pandora/conf/apps for this?
 load_previews_now      0       # if >0, will try to load preview pics from pnds at boot time, not defer till later
 load_previews_later    0       # if >0, will try to load preview pics sometime (see defer_timer_ms as well)
 pndrun                 /usr/pandora/scripts:./testdata/scripts # searchpath to locate "pnd_run.sh"; why aren't I looking in /etc/pandora/conf/apps for this?
 load_previews_now      0       # if >0, will try to load preview pics from pnds at boot time, not defer till later
 load_previews_later    0       # if >0, will try to load preview pics sometime (see defer_timer_ms as well)
@@ -26,18 +34,6 @@ terminal             /usr/bin/Terminal       # could also be /usr/bin/xterm, or a sh-script, or w
 [display]
 fullscreen             0       # 0 for windowed, >0 for fullscreen
 screen_width           800     # for some calculations
 [display]
 fullscreen             0       # 0 for windowed, >0 for fullscreen
 screen_width           800     # for some calculations
-detail_bg_alpha                100     # when rendering the detail panel background, how transparent?
-font_rgba_r            220     # RGBA for the display text
-font_rgba_g            220     # RGBA for the display text
-font_rgba_b            220     # RGBA for the display text
-font_rgba_a            20      # RGBA for the display text
-battery_x              10      # (x,y) for battery level
-battery_y              450     # (x,y) for battery level
-hintline               Push SELECT for options # shown at bottom of screen
-hint_x                 300     # (x,y) for hint line
-hint_y                 450     # (x,y) for hint line
-clock_x                        650     # (x,y) for clock
-clock_y                        450     # (x,y) for clock
 
 [tabs]
 top_maincat            1       # include maincat in top tab bar
 
 [tabs]
 top_maincat            1       # include maincat in top tab bar
@@ -47,94 +43,20 @@ top_altcat          1       # include alt cat in top tab bar
 top_altcat1            0       # include alt cat subcat 1 in top tab bar
 top_altcat2            0       # include alt cat subcat 1 in top tab bar
 wraparound             0       # if 1, last tab wraps around to first when going right; going left from first tab goes to last
 top_altcat1            0       # include alt cat subcat 1 in top tab bar
 top_altcat2            0       # include alt cat subcat 1 in top tab bar
 wraparound             0       # if 1, last tab wraps around to first when going right; going left from first tab goes to last
-font                   Vera.ttf
-font_ptsize            16
-tab_offset_x           4       # from left screen to first tab left
-tab_offset_y           3       # from top of screen to first tab top
-tab_width              132     # width of tab
-tab_height             35      # height of tab (for vertical clip)
-tab_selheight          39      # height of tab when its selected (for vertical clip)
-text_offset_x          10      # from left edge of tab to left edge of text
-text_offset_y          10      # from top edge of tab to top edge of text
-text_width             110     # clip text to this width
 
 [grid]
 
 [grid]
-font                   Vera.ttf
-font_ptsize            12
-icon_max_width         60      # scale icons to..
-icon_max_height                60      # scale icons to..
-grid_offset_x          17      # from left screen to first cell column
-grid_offset_y          60      # from top screen to first cell row
-icon_offset_x          12      # from left edge of cell to left edge of icon in cell
-icon_offset_y          0       # from top edge of cell to top edge of icon in cell
-text_offset_x          42      # from left edge of cell to center of text centering (ie: center of icon presumably)
-text_offset_y          65      # from top of cell to top of text
-text_width             75      # max width of the text
-text_clip_x            5       # offset from cell edge to left edge of text, when the text width is being clipped to fit
-sel_offoffset_x                -5      # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
-sel_offoffset_y                -5      # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
-cell_width             85      # cell location is grid_offset_x + ( cell_width * column_number )
-cell_height            92      # cell location is grid_offset_y + ( cell_height * column_number )
-col_max                        5       # number of columns to render into grid
-row_max                        4       # number of rows to display before we stop rendering
-text_hilite_offset_y   62      # from top of cell to top of hilight
 scroll_increment       4       # number of rows to scroll when jumping up or down (recommend 1, or same as row_max for full page jump)
 scroll_increment       4       # number of rows to scroll when jumping up or down (recommend 1, or same as row_max for full page jump)
-arrow_up_x             450     # left edge of up-arrow showing more icons scrolled away
-arrow_up_y             80      # top edge of up-arrow showing more icons scrolled away
-arrow_down_x           450     # left edge of down-arrow showing more icons scrolled away
-arrow_down_y           380     # top edge of down-arrow showing more icons scrolled away
-arrow_bar_x            455     # left edge of scrollbar
-arrow_bar_y            100     # top edge of scrollbar
-arrow_bar_clip_w       10      # clip scrollbar artwork to width-X
-arrow_bar_clip_h       274     # clip scrollbar artwork to height-X
-scale_up_bool          1       # if 0, will not try to scale up icons
 wrap_horiz_samerow     1       # if 0, wraps to prev/next row; if 1, stays on same row
 wrap_vert_stop         0       # if 0, wrap to other end; if 1, stops at top/bottom
 
 wrap_horiz_samerow     1       # if 0, wraps to prev/next row; if 1, stays on same row
 wrap_vert_stop         0       # if 0, wrap to other end; if 1, stops at top/bottom
 
-[detailpane]
-show                   1       # if 0, don't show detail pane artwork at all
-pane_offset_x          475     # left edge of detail pane graphic
-pane_offset_y          60      # top edge of detail pane graphic
-
-[detailtext]
-font                   Vera.ttf
-font_ptsize            16
-cell_offset_x          488     # left edge of text cell
-cell_offset_y          300     # top edge of text cell
-cell_width             250     # width of cell (for text clipping)
-
 [previewpic]
 defer_timer_ms         1500    # after setting selection, how long to wait before we try to load the previewpic
 [previewpic]
 defer_timer_ms         1500    # after setting selection, how long to wait before we try to load the previewpic
-cell_offset_x          480     # left edge of text cell
-cell_offset_y          90      # top edge of text cell
-cell_width             285
-cell_height            180
-scale_up_bool          1       # if 0, will not try to scale up preview
 do_cache               1       # if 1, will try to cache previews to SD, for performance boost
 cache_searchpath       /media/mmcblk[12]p?        # devices to consider for caching to, in order
 cache_minfree          500             # if free space is less than this (in KB), move to next device
 cache_path             /pandora/appdata/mmenu.pvwcache              # where to write cached images to
 cache_findpath         /media/mmcblk[12]p?/pandora/appdata/mmenu.pvwcache           # where to look for cached preview pics
 
 do_cache               1       # if 1, will try to cache previews to SD, for performance boost
 cache_searchpath       /media/mmcblk[12]p?        # devices to consider for caching to, in order
 cache_minfree          500             # if free space is less than this (in KB), move to next device
 cache_path             /pandora/appdata/mmenu.pvwcache              # where to write cached images to
 cache_findpath         /media/mmcblk[12]p?/pandora/appdata/mmenu.pvwcache           # where to look for cached preview pics
 
-[graphics]
-IMG_BACKGROUND_800480    800480_6.png
-IMG_BACKGROUND_TABMASK   tab1mask.png
-IMG_DETAIL_PANEL         detailpane2.png
-IMG_DETAIL_BG            detailpanebg.png
-IMG_SELECTED_ALPHAMASK   select.png
-IMG_SELECTED_HILITE     hilite.png
-IMG_TAB_SEL              tab_sel_tall.png
-IMG_TAB_UNSEL            tab_unsel.png
-IMG_TAB_LINE            tabline.png    # line under the unselected tab, but not left/right corners
-IMG_TAB_LINEL           tablinel.png   # line under unselected tab on far left
-IMG_TAB_LINER           tabliner.png   # line under unselected tab on far right
-IMG_ICON_MISSING        pandora60.png
-IMG_PREVIEW_MISSING     pandora60.png
-IMG_ARROW_UP            arrowup.png
-IMG_ARROW_DOWN          arrowdown.png
-IMG_ARROW_SCROLLBAR     arrowscroller.png
-IMG_HOURGLASS           hourglass.png
-
 [categories]
 do_all_cat             1               # if >0, will show an All category; if 0, skip it, just your cats.
 # Normally for mmenu, an encountered category is just used as is. 5 cats exist, you get 5 tabs.
 [categories]
 do_all_cat             1               # if >0, will show an All category; if 0, skip it, just your cats.
 # Normally for mmenu, an encountered category is just used as is. 5 cats exist, you get 5 tabs.
index 031443c..98e84d4 100644 (file)
@@ -11,17 +11,6 @@ extern char *g_skinpath;
 #define MMENU_CONF "mmenu.conf"
 #define MMENU_CONF_SEARCHPATH "/etc/pandora/conf:./minimenu"
 
 #define MMENU_CONF "mmenu.conf"
 #define MMENU_CONF_SEARCHPATH "/etc/pandora/conf:./minimenu"
 
-// keys
-#define MMENU_ARTPATH "minimenu.static_art_searchpath"
-
-#define MMENU_GRID_FONT "grid.font"
-#define MMENU_GRID_FONTSIZE "grid.font_ptsize"
-
-#define MMENU_DISP_COLMAX "grid.col_max"
-#define MMENU_DISP_ROWMAX "grid.row_max"
-#define MMENU_DISP_ICON_MAX_WIDTH "grid.icon_max_width"
-#define MMENU_DISP_ICON_MAX_HEIGHT "grid.icon_max_height"
-
 typedef enum {
   pndn_debug = 0,
   pndn_rem,          // will set default log level to here, so 'debug' is omitted
 typedef enum {
   pndn_debug = 0,
   pndn_rem,          // will set default log level to here, so 'debug' is omitted
index 467678e..e589ce9 100644 (file)
@@ -11,6 +11,8 @@
 #include "SDL_gfxPrimitives.h"
 #include "SDL_rotozoom.h"
 #include "SDL_thread.h"
 #include "SDL_gfxPrimitives.h"
 #include "SDL_rotozoom.h"
 #include "SDL_thread.h"
+#include <sys/types.h>
+#include <dirent.h>
 
 #include "pnd_conf.h"
 #include "pnd_logger.h"
 
 #include "pnd_conf.h"
 #include "pnd_logger.h"
@@ -19,6 +21,8 @@
 #include "pnd_discovery.h"
 #include "pnd_apps.h"
 #include "pnd_device.h"
 #include "pnd_discovery.h"
 #include "pnd_apps.h"
 #include "pnd_device.h"
+#include "../lib/pnd_pathiter.h"
+#include "pnd_utility.h"
 
 #include "mmenu.h"
 #include "mmcat.h"
 
 #include "mmenu.h"
 #include "mmcat.h"
@@ -155,11 +159,11 @@ unsigned char ui_setup ( void ) {
   }
 
   // grid font
   }
 
   // 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",
   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
   }
 
     return ( 0 ); // couldn't set up SDL TTF
   }
 
@@ -308,8 +312,8 @@ void ui_render ( void ) {
 
   unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
 
 
   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 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_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 );
@@ -1159,9 +1163,10 @@ void ui_process_input ( unsigned char block_p ) {
          "Exit and run xfce4",
          "Exit and run pmenu",
          "Quit (<- beware)",
          "Exit and run xfce4",
          "Exit and run pmenu",
          "Quit (<- beware)",
+         "Select a Minimenu skin",
          "About Minimenu"
        };
          "About Minimenu"
        };
-       int sel = ui_modal_single_menu ( opts, 9, "Minimenu", "Enter to select; other to return." );
+       int sel = ui_modal_single_menu ( opts, 11, "Minimenu", "Enter to select; other to return." );
 
        char buffer [ 100 ];
        if ( sel == 0 ) {
 
        char buffer [ 100 ];
        if ( sel == 0 ) {
@@ -1236,6 +1241,11 @@ void ui_process_input ( unsigned char block_p ) {
        } else if ( sel == 8 ) {
          emit_and_quit ( MM_QUIT );
        } else if ( sel == 9 ) {
        } else if ( sel == 8 ) {
          emit_and_quit ( MM_QUIT );
        } else if ( sel == 9 ) {
+         // select skin
+         if ( ui_pick_skin() ) {
+           emit_and_quit ( MM_RESTART );
+         }
+       } else if ( sel == 10 ) {
          // about
        }
 
          // about
        }
 
@@ -1362,7 +1372,7 @@ void ui_push_right ( unsigned char forcecoil ) {
 }
 
 void ui_push_up ( void ) {
 }
 
 void ui_push_up ( void ) {
-  unsigned char col_max = pnd_conf_get_as_int ( g_conf, MMENU_DISP_COLMAX );
+  unsigned char col_max = pnd_conf_get_as_int ( g_conf, "grid.col_max" );
 
   if ( ! ui_selected ) {
     return;
 
   if ( ! ui_selected ) {
     return;
@@ -1396,7 +1406,7 @@ void ui_push_up ( void ) {
 
     // scroll down to show it
     int r = ui_determine_row ( ui_selected ) - 1;
 
     // 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 - pnd_conf_get_as_int ( g_conf, "grid.row_max" ) > 0 ) {
       ui_rows_scrolled_down = (unsigned int) r;
     }
 
       ui_rows_scrolled_down = (unsigned int) r;
     }
 
@@ -1414,7 +1424,7 @@ void ui_push_up ( void ) {
 }
 
 void ui_push_down ( void ) {
 }
 
 void ui_push_down ( void ) {
-  unsigned char col_max = pnd_conf_get_as_int ( g_conf, MMENU_DISP_COLMAX );
+  unsigned char col_max = pnd_conf_get_as_int ( g_conf, "grid.col_max" );
 
   if ( ui_selected ) {
 
 
   if ( ui_selected ) {
 
@@ -2167,8 +2177,8 @@ unsigned char ui_threaded_defered_icon ( void *p ) {
   pnd_box_handle h = g_active_apps;
 
   unsigned char maxwidth, maxheight;
   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 );
 
 
   pnd_disco_t *iter = pnd_box_get_head ( h );
 
@@ -2216,3 +2226,65 @@ void ui_show_hourglass ( unsigned char updaterect ) {
 
   return;
 }
 
   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 );
+}
index 7eb2462..e3efc8f 100644 (file)
@@ -56,6 +56,7 @@ typedef enum {
 
 unsigned char ui_setup ( void );
 unsigned char ui_imagecache ( char *basepath );
 
 unsigned char ui_setup ( void );
 unsigned char ui_imagecache ( char *basepath );
+unsigned char ui_pick_skin ( void ); // return >0 if skin has changed
 
 void ui_render ( void );
 
 
 void ui_render ( void );
 
index ca21479..144e71f 100644 (file)
@@ -8,5 +8,6 @@
 
 #define MM_QUIT "--->quit"
 #define MM_RUN "--->run"
 
 #define MM_QUIT "--->quit"
 #define MM_RUN "--->run"
+#define MM_RESTART "--->restart"
 
 #endif
 
 #endif
diff --git a/minimenu/skin/default/mmskin.conf b/minimenu/skin/default/mmskin.conf
new file mode 100644 (file)
index 0000000..d29c8be
--- /dev/null
@@ -0,0 +1,104 @@
+
+#
+# mmskin.conf -- defines the art filenames, artwork positioning and other skin-related parameters.
+# Everything user-configurable should be in mmenu.conf, so they can switch skins without breaking their
+# functionality.
+#
+
+[minimenu]
+font                   Vera.ttf
+font_ptsize            24
+
+[display]
+detail_bg_alpha                100     # when rendering the detail panel background, how transparent?
+font_rgba_r            220     # RGBA for the display text
+font_rgba_g            220     # RGBA for the display text
+font_rgba_b            220     # RGBA for the display text
+font_rgba_a            20      # RGBA for the display text
+battery_x              10      # (x,y) for battery level
+battery_y              450     # (x,y) for battery level
+hintline               Push SELECT for options # shown at bottom of screen
+hint_x                 300     # (x,y) for hint line
+hint_y                 450     # (x,y) for hint line
+clock_x                        650     # (x,y) for clock
+clock_y                        450     # (x,y) for clock
+
+[tabs]
+font                   Vera.ttf
+font_ptsize            16
+tab_offset_x           4       # from left screen to first tab left
+tab_offset_y           3       # from top of screen to first tab top
+tab_width              132     # width of tab
+tab_height             35      # height of tab (for vertical clip)
+tab_selheight          39      # height of tab when its selected (for vertical clip)
+text_offset_x          10      # from left edge of tab to left edge of text
+text_offset_y          10      # from top edge of tab to top edge of text
+text_width             110     # clip text to this width
+
+[grid]
+font                   Vera.ttf
+font_ptsize            12
+icon_max_width         60      # scale icons to..
+icon_max_height                60      # scale icons to..
+grid_offset_x          17      # from left screen to first cell column
+grid_offset_y          60      # from top screen to first cell row
+icon_offset_x          12      # from left edge of cell to left edge of icon in cell
+icon_offset_y          0       # from top edge of cell to top edge of icon in cell
+text_offset_x          42      # from left edge of cell to center of text centering (ie: center of icon presumably)
+text_offset_y          65      # from top of cell to top of text
+text_width             75      # max width of the text
+text_clip_x            5       # offset from cell edge to left edge of text, when the text width is being clipped to fit
+sel_offoffset_x                -5      # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
+sel_offoffset_y                -5      # so selection can be a little bigger than main cell, this is selection offset relative to top corner of icon
+cell_width             85      # cell location is grid_offset_x + ( cell_width * column_number )
+cell_height            92      # cell location is grid_offset_y + ( cell_height * column_number )
+col_max                        5       # number of columns to render into grid
+row_max                        4       # number of rows to display before we stop rendering
+text_hilite_offset_y   62      # from top of cell to top of hilight
+arrow_up_x             450     # left edge of up-arrow showing more icons scrolled away
+arrow_up_y             80      # top edge of up-arrow showing more icons scrolled away
+arrow_down_x           450     # left edge of down-arrow showing more icons scrolled away
+arrow_down_y           380     # top edge of down-arrow showing more icons scrolled away
+arrow_bar_x            455     # left edge of scrollbar
+arrow_bar_y            100     # top edge of scrollbar
+arrow_bar_clip_w       10      # clip scrollbar artwork to width-X
+arrow_bar_clip_h       274     # clip scrollbar artwork to height-X
+scale_up_bool          1       # if 0, will not try to scale up icons
+
+[detailpane]
+show                   1       # if 0, don't show detail pane artwork at all
+pane_offset_x          475     # left edge of detail pane graphic
+pane_offset_y          60      # top edge of detail pane graphic
+
+[detailtext]
+font                   Vera.ttf
+font_ptsize            16
+cell_offset_x          488     # left edge of text cell
+cell_offset_y          300     # top edge of text cell
+cell_width             250     # width of cell (for text clipping)
+
+[previewpic]
+cell_offset_x          480     # left edge of text cell
+cell_offset_y          90      # top edge of text cell
+cell_width             285
+cell_height            180
+scale_up_bool          1       # if 0, will not try to scale up preview
+
+[graphics]
+IMG_BACKGROUND_800480    800480_6.png
+IMG_BACKGROUND_TABMASK   tab1mask.png
+IMG_DETAIL_PANEL         detailpane2.png
+IMG_DETAIL_BG            detailpanebg.png
+IMG_SELECTED_ALPHAMASK   select.png
+IMG_SELECTED_HILITE     hilite.png
+IMG_TAB_SEL              tab_sel_tall.png
+IMG_TAB_UNSEL            tab_unsel.png
+IMG_TAB_LINE            tabline.png    # line under the unselected tab, but not left/right corners
+IMG_TAB_LINEL           tablinel.png   # line under unselected tab on far left
+IMG_TAB_LINER           tabliner.png   # line under unselected tab on far right
+IMG_ICON_MISSING        pandora60.png
+IMG_PREVIEW_MISSING     pandora60.png
+IMG_ARROW_UP            arrowup.png
+IMG_ARROW_DOWN          arrowdown.png
+IMG_ARROW_SCROLLBAR     arrowscroller.png
+IMG_HOURGLASS           hourglass.png