modify_browse_func.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:43k
- /*****************************************************
- HISTORY:
- Creater: xiongyuyue
- Date : 2003/6/28
- Description: browse function using
- modifier : zhaoyanhua
- date: 2003-12-6 16:18
- changed the some function of NEW_STYLE_WINDOw:
- VCD: DELETE ITEM : playtime
- ADD ITEM: : disctime、track time
- DVD: DELETE ITEM : time
-
- *****************************************************/
- #ifndef DVDRELEASE
- //#define BROWSE_DBG
- #endif
- #ifdef DYNAMIC_SPECTRUM //fengjl 3-10-30 12:34
- extern BYTE band_onoff;
- extern void Show3dspectrum(void); //axel 2003/12/2 11:31pm
- #endif
- #define browse_puts() ((void)0)
- #define browse_show_function() ((void)0)
- #if 1
- #ifdef BROWSE_DBG
- #include "sio.h"
- #include "emuio.h"
- #undef browse_puts
- #undef browse_show_function
- #define browse_puts puts_w
- #define browse_show_function() do {browse_puts(__FUNCTION__); browse_puts("n");} while (0)
- #endif
- #endif
- /////////////////////////////////////////////////////////////////////////
- //wanghaoying 2003-8-12 19:50 added
- extern void set_video_aspect(void);
- extern void startup_vpp_now(void);
- extern void set_vpp_disp_window(UINT32,UINT32,UINT32,UINT32);
- /////////////////////////////////////////////////////////////////////////
- extern UINT16 mp3_file_count(void); //axel 2003/12/2 11:30pm
- ///////////////////////////////////////////////////////////////////
- //zhaoyanhua add 2003-12-18 15:39
- extern BYTE memory_config_saved;//reset.h
- extern BYTE GetConfigMode(int config);//memcfg.c
- extern void osd_init_newstyle_window_PAL(void);//osd1.c
- extern void osd_init_newstyle_window_NTSC(void);//osd1.c
- ///////////////////////////////////////////////////////////////////
- #ifdef NEWSTYLE_WINDOW //xiongyuyue
- BYTE bInputState = NON_INPUT_STATE;
- int bInputIndex = 0; //for title/chapter search function,
- BYTE bTimeInput = 0;
- BYTE update_definition = 40;
- extern UINT32 PlayBackLength;
- void br_Draw8space(BYTE fontColor,BYTE bkColor,BYTE index)
- {//erase displayed word and disp new word when press updown key(for draw left item)
- strcpy(linebuf," "); //fengjl changed space from 8 to 12 3-11-24 18:52
- osd_DrawRegionString(brArea[BR_ITEM_AREA].xStart,brArea[BR_ITEM_AREA].yStart+ITEM_HEIGHT*index,
- linebuf,fontColor,bkColor,arc_region_loc.region);
- }
- void br_Draw18space(BYTE fontColor,BYTE bkColor,BYTE index)
- {//erase displayed word and disp new word when press updown key(for draw right item)
- strcpy(linebuf," ");
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*index,
- linebuf,fontColor,bkColor,arc_region_loc.region);
- }
- void br_DrawLeftItemStr(BYTE hl_index,BYTE str_index,BYTE fontColor,BYTE bkColor)
- {
- br_Draw8space(fontColor,bkColor,hl_index);//xyy 2003-7-29 17:12
- if(cd_type_loaded==CDDVD)
- psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][string_index_dvd[str_index]]);
- else if(cd_type_loaded==CDROM || cd_type_loaded==CDDA)
- psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][string_index_cd[str_index]]);
- else
- psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][string_index_vcd[str_index]]);
- osd_DrawRegionString(brArea[BR_ITEM_AREA].xStart,brArea[BR_ITEM_AREA].yStart+ITEM_HEIGHT*(hl_index),
- linebuf,fontColor,bkColor,arc_region_loc.region);
- }
- void browse_HL_leftItem(BYTE index,BYTE fontColor,BYTE pre_bkColor,BYTE bkColor,BYTE UPDN)
- {
- if(UPDN == 0)//when press down key
- {
- if(index>1)
- br_DrawLeftItemStr(index-2,info_index-1,fontColor,pre_bkColor);//xyy 2003-7-29 20:05
- br_DrawLeftItemStr(index-1,info_index,fontColor,bkColor);//xyy 2003-7-29 20:05
- }
- else if(UPDN == 1)//when press up key
- {
- if(index < ITEM_PER_PAGE)
- br_DrawLeftItemStr(index,info_index+1,fontColor,pre_bkColor);//xyy 2003-7-29 20:05
- br_DrawLeftItemStr(index-1,info_index,fontColor,bkColor);//xyy 2003-7-29 20:05
- }
- }
-
- void br_Draw_TT_info(void)
- {
- BYTE dvd_title_Ns;
-
- if(cd_type_loaded==CDDVD)
- {
- dvd_title=get_tt_info(DISP_TT);
- dvd_title_Ns = get_tt_info(DISP_TT_Ns);
- }
- else
- {
- /*
- dvd_title=disp_trk_now;
- dvd_title_Ns = cd_total_trk();
- */
- dvd_title=disp_trk_now;
- if(cd_type_loaded==CDROM)//xyy 2003-9-11 17:12
- dvd_title_Ns = mp3_file_count();
- else
- dvd_title_Ns = cd_total_trk();
- }
- psprintf(linebuf, "%02d/%02d",dvd_title,dvd_title_Ns);
- if(bBrowseLevel==1 && info_index==0)
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart,
- linebuf,INFO_FONTCOL,INFO_BKCOL,arc_region_loc.region);
- else
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart,
- linebuf,INFO_FONTCOL,INFO_PRE_BKCOL,arc_region_loc.region);
- }
- void br_Draw_CHP_info(void)
- {
- BYTE dvd_chp_Ns;
- dvd_chapter=get_tt_info(DISP_CH);
- dvd_chp_Ns = get_tt_info(DISP_CH_Ns);
- psprintf(linebuf, "%02d/%02d",dvd_chapter,dvd_chp_Ns);
- if(bBrowseLevel==1 && info_index==1)
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*1,
- linebuf,INFO_FONTCOL,INFO_BKCOL,arc_region_loc.region);
- else
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*1,
- linebuf,INFO_FONTCOL,INFO_PRE_BKCOL,arc_region_loc.region);
- }
- void browse_func_up(void)
- {
- BYTE i,j;
- if(bBrowseLevel==1 || info_index==0)
- return;
- else
- info_index--;
-
- if((info_index<ITEM_PER_PAGE)||(info_index == 5)|| (info_index == 6))
- bInputState = NON_INPUT_STATE;
-
-
- HL_index--;
- if((info_index+1)%ITEM_PER_PAGE==0)
- {
- for(i=info_index-(ITEM_PER_PAGE-1),j=0;j<ITEM_PER_PAGE;i++,j++)
- br_DrawLeftItem(i,j,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_DrawRightItem();
- browse_HL_leftItem(ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL,INFO_BKCOL,1);
- }
- if(HL_index>0)
- browse_HL_leftItem(HL_index,INFO_FONTCOL,INFO_PRE_BKCOL,INFO_BKCOL,1);
- else
- HL_index = ITEM_PER_PAGE;
- }
- void browse_func_down(void)
- {
- BYTE i,j;
- if(bBrowseLevel==1)
- return;
- if((cd_type_loaded==CDROM || cd_type_loaded==CDDA) && info_index==2)//xyy 2003-9-12 14:22
- return;
- if(cd_type_loaded==CDDVD)
- {
- if(info_index>=DVD_MAXITEM-1)
- return;
- else
- info_index++;
- }
- else
- {
- if(info_index>=VCD_MAXITEM-1)
- return;
- else
- info_index++;
- }
- if(info_index>=ITEM_PER_PAGE)
- {
- if((info_index == 5)|| (info_index == 6))
- bInputState = NON_INPUT_STATE;//zhaoyanhua modify2003-12-7 14:54
- else
- bInputState = INPUT_STATE;
- }
- HL_index++;
- if((info_index%ITEM_PER_PAGE==0) && (info_index<DVD_MAXITEM))
- {
- for(i=info_index,j=0;j<ITEM_PER_PAGE;i++,j++)
- br_DrawLeftItem(i,j,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_DrawRightItem();
- browse_HL_leftItem(1,INFO_FONTCOL,INFO_PRE_BKCOL,INFO_BKCOL,0);
- }
- if(HL_index<=ITEM_PER_PAGE)
- browse_HL_leftItem(HL_index,INFO_FONTCOL,INFO_PRE_BKCOL,INFO_BKCOL,0);
- else
- HL_index = 1;
- }
- void init_time_search(void)
- {
- bTimeInput = 1;
- goto_time = 0;
- psprintf(linebuf,"%02d:%02d:%02d",0,0,0);
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*(HL_index-1),
- linebuf,INFO_FONTCOL,INFO_BKCOL,arc_region_loc.region);
- br_Draw_tmhl(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*(HL_index-1),"_",INFO_FONTCOL,INFO_BKCOL);
- }
- #ifdef SUPPORT_PLAYBACK_ICON
- void br_Draw_FBicon(void)
- {
- memset(linebuf,0,sizeof(linebuf));
- strcat1(linebuf, OSD_ICON_FB);
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*(HL_index-1),
- linebuf,INFO_FONTCOL,INFO_BKCOL,arc_region_loc.region);//xyy 2003-8-11 16:25
- }
- void br_Draw_FFicon(void)
- {
- strcat1(linebuf, OSD_ICON_FF);
- osd_DrawRegionString(brArea[BR_CONTENT_AREA].xStart+ITEM_WIDTH,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*(HL_index-1),
- linebuf,INFO_FONTCOL,INFO_BKCOL,arc_region_loc.region); //xyy 2003-8-11 16:25
- }
- #endif
- void br_Draw_underline(BYTE xStart, BYTE yStart, BYTE lineColor,BYTE bkColor)
- {
- BYTE *s="__";
- bInputState = INPUT_STATE;
- if(bInputIndex==0)
- osd_DrawRegionString(xStart,yStart,s,lineColor,bkColor,arc_region_loc.region);
- }
- extern void preDealGoto_time(void);
- extern void time_trans2hms(void);
- extern void exe_timesearch_func(UINT32 goto_ff,UINT32 fail);
- void exe_time_goto(void)
- {
- #define DISCTIME_SEARCH 1
- #define TRACKTIME_SEARCH 2
-
- BYTE search_mode = 0;
-
- index_x=0;
- time_trans2hms(); //xyy 2003-7-29 13:17
- preDealGoto_time();//xyy 2003-7-29 13:18
-
- if(cd_type_loaded != CDDVD)
- {
- switch(info_index)
- {
- case 1:
- search_mode = DISCTIME_SEARCH;
- break;
- case 2:
- search_mode = TRACKTIME_SEARCH;
- break;
- }
- if(goto_time)
- {
- printf("browse function : goto_time :%d---n",goto_time);
- exe_timesearch_func(0,search_mode);//xyy 2003-7-29 13:25
- }
- }
- else//for DVD
- {
- printf("****exe_time_goto****goto_hour = %2d goto_min = %2d goto_sec = %2d n",goto_hour,goto_min,goto_sec);
-
- if(goto_time) ircmd_post_func(CMD_FUNC|CMD_FUNC_GOTO); //axel 2004/1/27 10:00pm return while min>60 or sec>60
- }
-
- bInputState = NON_INPUT_STATE;
- bTimeInput=0;
- }
- void br_Draw_rtSpecialItem(void)//include audio language,sub-picture,repeat_all,multi-angle
- {
- br_Draw18space(INFO_FONTCOL,INFO_PRE_BKCOL,HL_index-1);//xyy 2003-7-29 17:32
- br_Draw_FBicon();//xyy 2003-7-29 15:52
-
- switch(info_index)
- {
- //info_index:the index of string_index_dvd array or string_index_vcd array
-
- case 2://DVD:STR_OS_subtitle ;;CD:STR_OS_REP
- if(cd_type_loaded==CDROM || cd_type_loaded==CDDA)
- ircmd_repeat_all();
-
-
- if(cd_type_loaded == CDDVD)
- ircmd_sub_picture();
- break;
-
- case 3://DVD:STR_OS_AUDIO_LANG_SETUP; VCD:STR_OS_REP
- if(cd_type_loaded==CDDVD)
- ircmd_audio_language();
-
- else
- ircmd_repeat_all();
-
- break;
- case 4://DVD:STR_OS_ANGLE
- ircmd_angle();
- break;
- case 7://DVD:STR_OS_REP
- ircmd_repeat_all();
- break;
- }
-
- br_Draw_FFicon();//xyy 2003-7-29 16:51
- }
- void browse_func_select(void)
- {
- //info_index:the index of string_index_dvd array or string_index_vcd array
- //which is defined in file browse_gui.h
- if(cd_type_loaded==CDDVD)
- {
- if(info_index<=1 && bInputIndex<2 && bBrowseLevel==1)
- return;
- }
- else
- {
- if(info_index==0 && bInputIndex<2 && bBrowseLevel==1)
- return;
- }
- if(bBrowseLevel==0)
- {
- #if defined(ADJUSTING_ACTION_VALID_RIGHT_NOW)//xyy 2003-9-9 16:10
- action_click = 2; // alan, 2003/8/28 05:45PM
- #else
- action_click = 0;
- #endif
- // action_click = 2; // alan, 2003/8/28 05:45PM
- switch(info_index)
- {
- case 0://title(DVD) or track(VCD/CD/MP3) information
- bBrowseLevel = 1; //xyy 2003-8-11 17:14
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_Draw_TT_info();
- br_Draw_underline(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*(HL_index-1),UNDERLINECOL,INFO_BKCOL);
- break;
- case 1://chaprter(DVD) or disc time (VCD)playtime(CD/MP3) information
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- if(cd_type_loaded==CDDVD)
- {
- bBrowseLevel = 1; //xyy 2003-8-11 17:14
- br_Draw_CHP_info();
- br_Draw_underline(brArea[BR_CONTENT_AREA].xStart,brArea[BR_CONTENT_AREA].yStart+ITEM_HEIGHT*(HL_index-1),UNDERLINECOL,INFO_BKCOL); //xyy 2003-8-11 16:16
- }
- else
- init_time_search();
-
- break;
- case 2://sub_title(DVD) or track time(VCD) or repeat setup(CD/MP3)information
-
- if(cd_type_loaded==CDROM || cd_type_loaded==CDDA)//xyy 2003-9-12 13:38
- {
- bBrowseLevel = 1;
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_Draw_rtSpecialItem();
- }
- //zhaoyanhua add 2003-12-7 13:30
- else if(cd_type_loaded==CDDVD)
- {
- // if(pDSV->dAv_SPST_Ns<2)
- // return;
- bBrowseLevel = 1;
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_Draw_rtSpecialItem();
- }
- else //disc time VCD
- {
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- init_time_search();
- }
-
-
- break;
- case 3://audio language (DVD), repeat (VCD) information
-
- if(cd_type_loaded==CDDVD)
- {
- if(pDSV->dAv_AST_Ns<=1)
- return;
- }
- else//VCD
- {
- #if !defined(PULIANG_DVD)
- if( IsPBCOn() )
- return;
- #endif
- }
- bBrowseLevel = 1;
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_Draw_rtSpecialItem();
- //br_Draw_rtSpecialItem();
- break;
- case 4://multi-angle(only DVD)information
- if(get_angle_Ns()<1)
- return;
- bBrowseLevel = 1;
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_Draw_rtSpecialItem();
- break;
- //zhaoyanhua add 2003-12-7 13:55
- case 5:
- case 6:
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- init_time_search();
- break;
- case 7://repeat setup(DVD)information
- bBrowseLevel = 1;
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_PRE_BKCOL);
- br_Draw_rtSpecialItem();
- break;
-
- }
- bBrowseLevel = 1;
- }
- else if(bBrowseLevel == 1)
- {
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_BKCOL);//xyy 2003-8-11 16:08
- switch(info_index)
- {
- case 0://title(DVD) or track(VCD/CD/MP3) information
- if(bInputIndex==1)
- return;
- if(bInputIndex > 1)
- {
- bInputIndex = 0;
- if(cd_type_loaded==CDDVD)
- {
- if(info_index==0)
- dvd_chapter = 1;
-
- if(UOP_check(UOP_PTT_PS)&&(dvd_chapter==1))
- dvd_chapter = 0;//TT play,terry,3-8-23 19:35
-
- ircmd_post_func(CMD_FUNC|CMD_PTT_PLAY);
- }
- else
- ircmd_post_func(CMD_SELECT | dvd_title);
- bInputState = NON_INPUT_STATE;
- }
- break;
- case 1://chaprter(DVD) or disc time(VCD)or playtime(CD/MP3) information
- if(cd_type_loaded==CDDVD)
- {
- if(bInputIndex==1)
- return;
- if(bInputIndex > 1)
- {
- bInputIndex = 0;
-
- if(UOP_check(UOP_PTT_PS)&&(dvd_chapter==1))
- dvd_chapter = 0;//TT play,terry,3-8-23 19:35
-
- ircmd_post_func(CMD_FUNC|CMD_PTT_PLAY);
- bInputState = NON_INPUT_STATE;
- }
- }
- else
- {
- exe_time_goto();
- bInputState = NON_INPUT_STATE;
- br_DrawRightItem();//zhaoyanhua add 2003-12-6 15:56
- }
- break;
- case 2://sub_title(DVD) track time(VCD) or repeat setup(CD/MP3)information
- if(cd_type_loaded == CDDVD)
- {
- br_DrawRightItem();
- }
- else if((cd_type_loaded == CDVCD10)||(cd_type_loaded ==CDVCD20)||(cd_type_loaded == CDSVCD))
- {
- exe_time_goto();
- bInputState = NON_INPUT_STATE;
- br_DrawRightItem();//zhaoyanhua add 2003-12-6 15:56
- }
-
- break;
- case 5:
- case 6:
- exe_time_goto();
- br_DrawRightItem();//zhaoyanhua add 2003-12-6 15:56
- break;
- case 3:////audio language setup(DVD) or repeat setup(VCD) information
- case 4://multi-angle(only DVD)information
- case 7://repeat setup(DVD)information
- br_DrawRightItem();
- break;
- }
- bBrowseLevel = 0;
- }
- }
- #ifdef CLEAR_KEY_IN_WINDOW //Maoyong 2004.02.18
- void browse_func_clear(void)
- {
- //DVD not in CHP, TT, CHP and TT time item, no use
- if(cd_type_loaded == CDDVD)
- {
- if((info_index != 5)&&(info_index != 6)&&(info_index != 0)&&(info_index != 1))
- return;
- }
- else //CDROM, CDVCD..., not DVD
- {
- if( (info_index != 0) && (info_index != 1) && (info_index != 2) )
- return;
- }
- index_x=0;
- bBrowseLevel = 0;
- bInputState = NON_INPUT_STATE;
- bInputIndex = 0;
- browse_func_select();
- }
- #endif
- UINT32 ten_power(BYTE exponent)
- {
- UINT32 temp=1,i;
- for(i=0;i<exponent;i++)
- temp = temp*10;
- return temp;
- }
- void browse_func_left(void)
- {
- if(bBrowseLevel==0)
- return;
- if((cd_type_loaded==CDDVD && info_index <= 1) || (cd_type_loaded!=CDDVD && info_index==0))
- {
- bInputState = NON_INPUT_STATE;
- bInputIndex = 0;
- bBrowseLevel = 0;
- UpdateTT_CHP_info();
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_BKCOL);//xyy 2003-8-11 17:06
- }
- else if((cd_type_loaded==CDDVD && info_index == 5) ||((cd_type_loaded==CDDVD) && (info_index == 6))
- || (cd_type_loaded!=CDDVD && info_index==1)|| (cd_type_loaded!=CDDVD && info_index==2))
- {//for VCD :info_index 1/2 //zhaoyanhua add 2003-12-6 16:55
- #ifdef BROWSE_DBG
- printf("==========DRaw left Item =========n");
- #endif
- br_DrawLeftItem(info_index,info_index%ITEM_PER_PAGE,INFO_FONTCOL,INFO_BKCOL);//xyy 2003-8-11 17:06
- br_DrawRightItem();
- bBrowseLevel = 0;
- bTimeInput = 0;
- index_x = 0; // alan, 2003/9/5 02:16