X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-libraries.git;a=blobdiff_plain;f=minimenu%2Fmmconf.c;h=d0db0ba94a6033446114c055b285480e52a4e8e1;hp=1c1ef6177eecc1f10ea13c7122f0dccf11845f70;hb=d53e58a30480ca4e5eeec0eb28a72e7642df3dc3;hpb=f1ed7f28ae003a7a01539b63c910a6e8059f8dee diff --git a/minimenu/mmconf.c b/minimenu/mmconf.c index 1c1ef61..d0db0ba 100644 --- a/minimenu/mmconf.c +++ b/minimenu/mmconf.c @@ -28,14 +28,17 @@ confitem_t page_general[] = { { "Set CPU speed within Minimenu", "Whether the next setting is applied or not", "0", "minimenu.use_mm_speed", ct_boolean }, { "CPU speed within Minimenu", "Set low; speed to run Minimenu at", "400", "minimenu.mm_speed", ct_cpu_speed }, #endif - { "Set CPU speed when leaving", "Whether the next setting is applied or not", "0", "minimenu.use_run_speed", ct_boolean }, - { "CPU speed when leaving", "Before running app, set this speed; app may override.", "500", "minimenu.run_speed", ct_cpu_speed }, { "Show 'All' tab", "Whethor an All tab is shown or not", "1", "categories.do_all_cat", ct_boolean }, { "Show directory browser tabs", "Show a tab for each SD card?", "0", "filesystem.do_browser", ct_boolean }, + { "Detail panel on start?", "Show or hide the detail panel when menu starts", "1", "display.show_detail_pane", ct_boolean }, + { "Sub-categories as folders?", "If no, uses tabs instead of folders within tabs.", "1", "tabs.subcat_as_folders", ct_boolean }, { "Start with app selected", "Whethor selection is placed by default or not", "0", "minimenu.start_selected", ct_boolean }, + { "Auto discover pnd apps?", "If no, turn on diectory browser to manually find apps", "1", "filesystem.do_pnd_disco", ct_boolean }, + { "Keep bad categories in Other?", "Lazy dev! Put broken categories into Other to keep clean", "1", "categories.good_cats_only", ct_boolean }, + { "Set CPU speed when leaving", "Whether the next setting is applied or not", "0", "minimenu.use_run_speed", ct_boolean }, + { "CPU speed when leaving", "Before running app, set this speed; app may override.", "500", "minimenu.run_speed", ct_cpu_speed }, { "Wrap tab change", "Changing tab left or right, does it wrap around?", "0", "tabs.wraparound", ct_boolean }, { "Grid stop vertical", "Changing selection up or down, does it stop or wrap?", "0", "grid.wrap_vert_stop", ct_boolean }, - { "Detail panel on start?", "Show or hide the detail panel when menu starts", "1", "display.show_detail_pane", ct_boolean }, { "Live (not exit) on app run?", "Normally menu exits (to save ram) on app run", "0", "minimenu.live_on_run", ct_boolean }, { "Force wallpaper with..", "You can force an override over themes background", "/pandora/appdata/mmenu/wallpaper.png", "minimenu.force_wallpaper", ct_filename }, { "", "", NULL, NULL, ct_nil }, @@ -69,10 +72,6 @@ confitem_t pages[] = { extern pnd_conf_handle g_conf; extern SDL_Surface *sdl_realscreen; extern mm_imgcache_t g_imagecache [ IMG_TRUEMAX ]; -extern mm_category_t *g_categories; -extern unsigned char g_categorycount; -extern mm_category_t _categories_invis [ MAX_CATS ]; -extern unsigned char _categories_inviscount; extern pnd_box_handle g_active_apps; unsigned char conf_run_menu ( confitem_t *toplevel ) { @@ -178,21 +177,21 @@ unsigned char conf_run_menu ( confitem_t *toplevel ) { if ( v ) { unsigned char n = 0; for ( n = 0; n < g_categorycount; n++ ) { - if ( strcmp ( v, g_categories [ n ].catname ) == 0 ) { + if ( strcmp ( v, g_categories [ n ] -> catname ) == 0 ) { break; } } if ( n < g_categorycount ) { if ( left && n ) { - pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ n - 1 ].catname ); + pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ n - 1 ] -> catname ); } else if ( ! left && n + 1 < g_categorycount ) { - pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ n + 1 ].catname ); + pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ n + 1 ] -> catname ); } } else { - pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ 0 ].catname ); + pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ 0 ] -> catname ); } } else { - pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ 0 ].catname ); + pnd_conf_set_char ( g_conf, page [ sel ].key, g_categories [ 0 ] -> catname ); } } // if category count } @@ -308,6 +307,27 @@ void conf_display_page ( confitem_t *page, unsigned int selitem, unsigned int fi dest += conf_render_text ( g_big_font, "Minimenu Configuration", dest, 10, 10, CONF_UNSELECTED ); dest += conf_render_line ( dest, 45 ); + // scrollable hints + { + + // up + if ( first_visible > 0 ) { + dest -> x = 10; + dest -> y = 65; + SDL_BlitSurface ( g_imagecache [ IMG_ARROW_UP ].i, NULL /* whole image */, sdl_realscreen, dest ); + dest++; + } // scroll arrow up + + // down + if ( first_visible + max_visible < conf_determine_pagelength ( page ) ) { + dest -> x = 10; + dest -> y = 345; + SDL_BlitSurface ( g_imagecache [ IMG_ARROW_DOWN ].i, NULL /* whole image */, sdl_realscreen, dest ); + dest++; + } // scroll arrow up + + } // scrollbar + // items tx = 50; ty = 70; unsigned char counter = first_visible; @@ -542,60 +562,52 @@ unsigned char conf_prepare_page ( confitem_t *page ) { template -> text = ""; // so it won't get repopulated again later - typedef struct { - mm_category_t *cat; - unsigned char n; - } _foo; - _foo cats [ 2 ]; - cats [ 0 ].cat = g_categories; - cats [ 0 ].n = g_categorycount; - cats [ 1 ].cat = _categories_invis; - cats [ 1 ].n = _categories_inviscount; + // switch categories being published + category_publish ( CFALL, NULL ); // for each tab - unsigned int i, j; - for ( j = 0; j < 2; j++ ) { - mm_category_t *cc = cats [ j ].cat; - unsigned char cn = cats [ j ].n; - char catname [ 512 ]; - char *actual_catname; - - for ( i = 0; i < cn; i++ ) { - - // if this is an invisi-guy, it has parent-cat prepended; we want the real cat name. - strncpy ( catname, cc [ i ].catname, 500 ); - if ( ( actual_catname = strchr ( catname, '.' ) ) ) { - actual_catname++; // skip the period - } else { - actual_catname = catname; - } - //fprintf ( stderr, "conf ui; got '%s' but showing '%s'\n", cc [ i ].catname, actual_catname ); + unsigned int i; + char catname [ 512 ]; + char *actual_catname; - if ( strncmp ( cc [ i ].catname, "All ", 4 ) == 0 ) { - // skip All tab, since it is generated, and managed by another config item - continue; - } + for ( i = 0; i < g_categorycount; i++ ) { + + // if this is an invisi-guy, it has parent-cat prepended; we want the real cat name. + strncpy ( catname, g_categories [ i ] -> catname, 500 ); - p -> text = strndup ( actual_catname, 40 ); - p -> desc = NULL; - p -> def = NULL; + if ( ( actual_catname = strchr ( catname, '.' ) ) ) { + actual_catname++; // skip the period + } else { + actual_catname = catname; + } + //fprintf ( stderr, "conf ui; got '%s' but showing '%s'\n", cc [ i ].catname, actual_catname ); - sprintf ( buffer, "%s.%s", template -> key, actual_catname ); - p -> key = strdup ( buffer ); - p -> type = ct_boolean; - p -> newhead = NULL; + if ( strncmp ( g_categories [ i ] -> catname, "All ", 4 ) == 0 ) { + // skip All tab, since it is generated, and managed by another config item + continue; + } - // create to positive if not existant - if ( ! pnd_conf_get_as_char ( g_conf, buffer ) ) { - pnd_conf_set_char ( g_conf, buffer, "1" ); - } + p -> text = strndup ( actual_catname, 40 ); + p -> desc = NULL; + p -> def = NULL; - //fprintf ( stderr, "Created tabshow entry '%s'\n", cc [ i ].catname ); + sprintf ( buffer, "%s.%s", template -> key, actual_catname ); + p -> key = strdup ( buffer ); + p -> type = ct_boolean; + p -> newhead = NULL; - p++; + // create to positive if not existant + if ( ! pnd_conf_get_as_char ( g_conf, buffer ) ) { + pnd_conf_set_char ( g_conf, buffer, "1" ); } - } + //fprintf ( stderr, "Created tabshow entry '%s'\n", cc [ i ].catname ); + + p++; + } // for + + // switch categories being published + category_publish ( CFNORMAL, NULL ); break; }