From 9f78686da5e76262b673275753bedc9154edbcdd Mon Sep 17 00:00:00 2001 From: skeezix Date: Tue, 9 Mar 2010 12:42:42 -0500 Subject: [PATCH] Category scroll offscreen left/right added Conf file now instructs which of the 6 categories to use (main, main sub1, main sub2, and the alt 3 as well); default is main and alt only (no subs) --- deployment/etc/pandora/conf/mmenu.conf | 95 ++++++++++++++++++++++++++ minimenu/TODO.txt | 6 +- minimenu/mmenu.c | 37 +++++++++- minimenu/mmenu.conf | 6 ++ minimenu/mmui.c | 23 ++++++- 5 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 deployment/etc/pandora/conf/mmenu.conf diff --git a/deployment/etc/pandora/conf/mmenu.conf b/deployment/etc/pandora/conf/mmenu.conf new file mode 100644 index 0000000..46eb120 --- /dev/null +++ b/deployment/etc/pandora/conf/mmenu.conf @@ -0,0 +1,95 @@ +# for the mmenu 'minimenu' +# + +[minimenu] +static_art_path ./minimenu/skin/default +font Vera.ttf +font_ptsize 24 +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 +loglevel 3 # 0 is debug, lots of crap; 3 is better, means 'errors only'. Output may screw up the wrapper! + +[apps] +searchpath ./testdata/app2:./testdata/app3:/media/*/pandora/desktop + +[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 + +[tabs] +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 +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 120 # 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 +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 1 # 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 + +[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 312 # 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 + +[graphics] +IMG_BACKGROUND_800480 800480_6.png +IMG_BACKGROUND_TABMASK tab1mask.png +IMG_DETAIL_PANEL detailpane2.png +IMG_DETAIL_BG 800480_4.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_ICON_MISSING pandora60.png +IMG_PREVIEW_MISSING pandora60.png +IMG_ARROW_UP arrowup.png +IMG_ARROW_DOWN arrowdown.png +IMG_ARROW_SCROLLBAR arrowscroller.png diff --git a/minimenu/TODO.txt b/minimenu/TODO.txt index 554ad59..d652ea4 100644 --- a/minimenu/TODO.txt +++ b/minimenu/TODO.txt @@ -5,18 +5,16 @@ - libpnd: appdata-dir-name -- shoulders on panda - - menu - zotmenu? - rescan - shutdown - quit +- defer preview pics + - deploy.. - .desktop for deply - - Makefile change for building with sdl for djw? - - cp files to deply - tell ED how to launch it - display diff --git a/minimenu/mmenu.c b/minimenu/mmenu.c index c2eb25e..96b5c3d 100644 --- a/minimenu/mmenu.c +++ b/minimenu/mmenu.c @@ -232,12 +232,47 @@ int main ( int argc, char *argv[] ) { } // push the categories - if ( iter -> main_category ) { + // + + // main categories + if ( iter -> main_category && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat", 1 ) ) { if ( ! category_push ( iter -> main_category, iter ) ) { pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category, IFNULL(iter -> title_en, "No Name") ); } } + if ( iter -> main_category1 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat1", 0 ) ) { + if ( ! category_push ( iter -> main_category1, iter ) ) { + pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category1, IFNULL(iter -> title_en, "No Name") ); + } + } + + if ( iter -> main_category2 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat2", 0 ) ) { + if ( ! category_push ( iter -> main_category2, iter ) ) { + pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category2, IFNULL(iter -> title_en, "No Name") ); + } + } + + // alt categories + if ( iter -> alt_category && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat", 0 ) ) { + if ( ! category_push ( iter -> alt_category, iter ) ) { + pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category, IFNULL(iter -> title_en, "No Name") ); + } + } + + if ( iter -> alt_category1 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat1", 0 ) ) { + if ( ! category_push ( iter -> alt_category1, iter ) ) { + pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category1, IFNULL(iter -> title_en, "No Name") ); + } + } + + if ( iter -> alt_category2 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat2", 0 ) ) { + if ( ! category_push ( iter -> alt_category2, iter ) ) { + pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category2, IFNULL(iter -> title_en, "No Name") ); + } + } + + // next iter = pnd_box_get_next ( iter ); } // while diff --git a/minimenu/mmenu.conf b/minimenu/mmenu.conf index ae3108e..267faef 100644 --- a/minimenu/mmenu.conf +++ b/minimenu/mmenu.conf @@ -22,6 +22,12 @@ font_rgba_b 220 # RGBA for the display text font_rgba_a 20 # RGBA for the display text [tabs] +top_maincat 1 # include maincat in top tab bar +top_maincat1 0 # include maincat subcat 1 in top tab bar +top_maincat2 0 # include maincat subcat 1 in top tab bar +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 font Vera.ttf font_ptsize 16 diff --git a/minimenu/mmui.c b/minimenu/mmui.c index d8d108a..40da1cd 100644 --- a/minimenu/mmui.c +++ b/minimenu/mmui.c @@ -370,7 +370,7 @@ void ui_render ( unsigned int render_mask ) { src.y = 0; src.w = tab_width; src.h = tab_height; - dest -> x = tab_offset_x + ( col * tab_width ); + 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 ); @@ -385,7 +385,7 @@ void ui_render ( unsigned int render_mask ) { src.y = 0; src.w = rtext -> w < text_width ? rtext -> w : text_width; src.h = rtext -> h; - dest -> x = tab_offset_x + ( col * tab_width ) + text_offset_x; + 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_UpdateRects ( sdl_realscreen, 1, &dest ); @@ -929,12 +929,23 @@ void ui_push_ltrigger ( void ) { ui_selected = NULL; } + // make tab visible? + if ( ui_catshift > 0 && ui_category == ui_catshift - 1 ) { + ui_catshift--; + } + + // unscroll + ui_rows_scrolled_down = 0; + 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 ); + unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" ); + if ( ui_category < ( g_categorycount - 1 ) ) { ui_category++; } else { @@ -947,6 +958,14 @@ void ui_push_rtrigger ( void ) { ui_selected = NULL; } + // make tab visible? + if ( ui_category > ui_catshift + ( screen_width / tab_width ) - 1 ) { + ui_catshift++; + } + + // unscroll + ui_rows_scrolled_down = 0; + return; } -- 2.39.2