📄 nav_menu.c
字号:
icon_id = ICON_DISC; }else#endif { icon_id = ICON_MP3; }#if (defined MP3 || defined WMA_DEC) if ( 0#ifdef MP3 || ((STREAM_type == MP3_ID) && (MPG_frames)) #endif#ifdef WMA_DEC || ((STREAM_type == WMA_ID) && (wma_smpl_num))#endif ) { AUD_service(); }#endif /* MP3 || WMA_DEC */ if ( (switch_page==1) || (j==mp3_select) || (j==pre_item) ) redraw_item = 1; else redraw_item = 0; hli = (j==mp3_select)?1:0; if( mp3_menu_changed || redraw_item){ color_mapping(0, hli, &color1, &color2); button_erase(x, y, BTN_LENGTH, 1, BACK_COLOR); ICON_charset_select(VWENGLISH_FONTS); ICON_set_bkcolor(BACK_COLOR); ICON_auto_mapping(1); show_icon(icon_id, x, y, 0, 2); ICON_auto_mapping(0); ICON_charset_restore(); CG_map_color_array(BACK_COLOR, 13, 3); show_text(iso9660_file[i].name, x, y, 40, 2, 0); ICON_set_bkcolor(0); } frame_color_restore(0,hli,x,y,CG_FRAME_DX); j++;#ifdef MP3_VERT_LISTING#ifdef LONG_FILENAME_SUPP y++; if (y >= 10) break;#else y++; if (y >= 10) { y = 0; x += HorzSpace; if (x > (HorzSpace+1)) break; } #endif LONG_FILENAME_SUPP#else x += HorzSpace; if (x > (HorzSpace+1)){ x = 1; y++; if (y >= 10) break; }#endif /* MP3_VERT_LISTING */ } file_cnt++; } } if( (!mp3_menu_changed) && (switch_page!=1) ) return; for ( i=j; i<ItemNum; i++ ) { button_erase(x, y, BTN_LENGTH, 1, BACK_COLOR); CG_show_frame(x,y,CG_FRAME_DX,1,0); #ifdef MP3_VERT_LISTING#ifdef LONG_FILENAME_SUPP y++; if (y >= 10) break;#else y++; if (y >= 10) { y = 0; x += HorzSpace; if (x > (HorzSpace+1)) break; }#endif LONG_FILENAME_SUPP#else x += HorzSpace; if (x > (HorzSpace+1)){ x = 1; y++; if (y >= 10) break; }#endif /* MP3_VERT_LISTING */ }}/* list MP3 root (those directories with MP3 files */static void MP3_menu(){ int i,hli,j=0; int x=1,y=4; int color1,color2; unsigned char pmsg[20]; int pre_item; int redraw_item = 0; int switch_page = 0; int prev_dir_page = -1; prev_dir_page = mp3_root_page; if(mp3_menu_changed) prev_dir_page = -1; mp3_root_page = mp3_dir/ItemNum; mp3_select = mp3_dir-mp3_root_page*ItemNum; pre_item = prev_dir_item - mp3_root_page*ItemNum; if( prev_dir_page != mp3_root_page) switch_page = 1; MP3_page_buf(mp3_root_page+1, mp3_total_page+1); CG_map_color_array(BACK_COLOR, 13, 3); show_text(MP3_PAGE, MP3_PAGE_XSTART, MP3_PAGE_YSTART, 0, 6, 0); memcpy(MP3_DIR, MSG_root, 5); CG_map_color_array(BACK_COLOR, 13, 3); show_text(MP3_DIR, 1,1,0,6,0); for (i=mp3_root_page*ItemNum; i<real_track_cnt; i++){ if( (switch_page==1) || (j==mp3_select) || (j==pre_item) ) redraw_item = 1; else redraw_item = 0; hli = (j==mp3_select)?1:0; if (mp3_menu_changed || redraw_item ){ color_mapping(0, hli, &color1, &color2); button_erase(x, y, BTN_LENGTH, 1, BACK_COLOR); ICON_charset_select(VWENGLISH_FONTS); ICON_set_bkcolor(BACK_COLOR); show_icon(ICON_FOLDER, x, y, 0, 2); ICON_charset_restore(); CG_map_color_array(BACK_COLOR, 13, 3); show_text(iso9660_dir[real_track[i]].name, x, y, 40, 2, 0); ICON_set_bkcolor(0); } frame_color_restore(0,hli,x,y,CG_FRAME_DX); j++; #ifdef MP3_VERT_LISTING#ifdef LONG_FILENAME_SUPP y++; if (y >= 10) break;#else y++; if (y >= 10) { y = 0; x += HorzSpace; if (x > (HorzSpace+1)) break; }#endif LONG_FILENAME_SUPP#else x += HorzSpace; if (x > (HorzSpace+1)){ x = 1; y++; if (y >= 10) break; }#endif /* MP3_VERT_LISTING */ } if ( (!mp3_menu_changed) && (switch_page!=1) ) return; for ( i=j; i<ItemNum; i++ ) { button_erase(x, y, BTN_LENGTH, 1, BACK_COLOR); CG_show_frame(x, y, CG_FRAME_DX, 1, 0);#ifdef MP3_VERT_LISTING#ifdef LONG_FILENAME_SUPP y++; if (y >= 10) break;#else y++; if (y >= 10) { y = 0; x += HorzSpace; if (x > (HorzSpace+1)) break; }#endif LONG_FILENAME_SUPP#else x += HorzSpace; if (x > (HorzSpace+1)){ x = 1; y++; if (y >= 10) break; }#endif /* MP3_VERT_LISTING */ }}/* list MP3 info */void MP3_select(){#ifdef MP3CDG if (MP3CDG_started) { mp3_menu_changed = 0; return; }#endif if (mp3_menu_changed == 1){ if (in_mp3_root) { MP3_draw_box(); MP3_menu(); } else { MP3_draw_box(); MP3_track(); } } else if (mp3_menu_changed == 2) { CG_map_color_array(BACK_COLOR, 13, 3); show_text(MP3_PAGE, MP3_PAGE_XSTART, MP3_PAGE_YSTART, 0, 6, 0); } else if (mp3_menu_changed == 3) { CG_map_color_array(BACK_COLOR, 13, 3); show_text(MP3_DIR, 1,1,0,6,0); } mp3_menu_changed = 0;}/* move MP3 item selection */void MP3_item(int des){ if (in_mp3_root){ prev_dir_item = -1; mp3_dir += des; if ((des > 0) && (mp3_dir >= real_track_cnt)) mp3_dir = 0; if ((des < 0) && (mp3_dir < 0)) mp3_dir = real_track_cnt - 1; MP3_menu(); } else{ prev_file_item = mp3_song; prev_dir_item = mp3_dir; mp3_song += des; if ((des > 0) && (mp3_song >= iso9660_dir[real_track[mp3_dir]].dir)) mp3_song = 0; if ((des < 0) && (mp3_song < 0)) mp3_song = iso9660_dir[real_track[mp3_dir]].dir - 1; MP3_track(); }}/* convert selection to real MP3 fileno. */int MP3_song(){ int i; int tmp = 0; for (i=0;i<mp3_dir;i++){ tmp += iso9660_dir[real_track[i]].dir; } tmp += (mp3_song+1); return(tmp);}/* real MP3 fileno to directory+songno. * * NOTE: This function redraws the menu which causes audio-breaks * for MP3/WMA if not used properly. For audio files, avoid * calling this function outside play_data_file(). */void track_to_mp3(int track){ int id; int reload_menu = 0; prev_dir_item = mp3_dir; prev_file_item = mp3_song; if(in_mp3_root) prev_dir_item = -1; in_mp3_root = 0; MP3_VBR_gain = DEF_VBR_GAIN; /* Set to default value */ mp3_dir = 0; mp3_song = 0;#ifdef DATA_CD id = (iso9660_file[track-1].loc)>>24;#endif track--; while (track >= iso9660_dir[real_track[mp3_dir]].dir){ track -= iso9660_dir[real_track[mp3_dir]].dir; mp3_dir++; } mp3_song = track; if(prev_dir_item != mp3_dir) reload_menu = 1; if ((id == MP3_ID)||(id == WMA_ID)) { if(is_jpeg || !CG_menu_on || reload_menu){ /*we just redraw menu when back from JPEG*/ mp3_menu_changed = 9; /*I just need a value > 0*/ CLEARALLOSD(); MP3_draw_box(); } MP3_track(); mp3_menu_changed = 0; }}#endif /* DATA_CD */#ifdef HOST_SLAVE/*******************************************************************//* For MP3 dics, in Entry_state change the cussor position and *//* update the display Page according the global variable: mp3_song *//* Input: mp3_song *//* Output: cur_track_index; mp3_dir. *//*******************************************************************/ int haottt=0;int temp_song_num=0, sub_sum_song_num=0;void mp3_osd_change(){ unsigned char i; temp_mp3_song = mp3_song; haottt = mp3_song; for (i=0; i < real_track_cnt; i++) { sub_sum_song_num = temp_song_num; temp_song_num += iso9660_dir[real_track[i]].dir; if ((haottt-1) < temp_song_num) { mp3_dir = i; haottt = haottt - sub_sum_song_num -1 ; temp_song_num=0; sub_sum_song_num=0; break; } } mp3_song = haottt; in_mp3_root=0; mp3_menu_changed=1; MP3_draw_box(); MP3_track(); mp3_menu_changed=0;}extern int cur_track_index;int get_track_index_from_mp3song(){ /* get absolute cur_track_index based on zero */ int i, temp_number=0; for (i=0; i<mp3_dir; i++) { temp_number += iso9660_dir[real_track[i]].dir; } temp_number += mp3_song; cur_track_index = temp_number; return (temp_number);}void mp3_osd_change_dir(int dir_id){ int i, temp_absolute_num=0; mp3_dir = dir_id; /* mp3_dir= (0 ... real_track_cnt) */ for (i=0; i<real_track_cnt; i++) { temp_absolute_num += iso9660_dir[real_track[i]].dir; } cur_track_index = temp_absolute_num; mp3_song = 0; in_mp3_root=0; mp3_menu_changed=1; MP3_track(); mp3_menu_changed=0; }void mp3_osd_back_root(){ int old_mp3_dir; in_mp3_root = 1; MP3_menu(); cur_track_index=0;}void mp3_osd_enter_subdir(){ mp3_song=0; in_mp3_root = 0; mp3_osd_change_dir(mp3_dir); mp3_song = 0;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -