setup_tab_ui_SFM.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:34k
- /*
- * FileName: setup_tab_ui_SFM.c
- * Author: ChenZhao Version: Date: 2004-9-2
- * Description: include in setup_tab.c when defined SOFT_MENU
- * Version:
- * Function List: UI function,
- * LEFT,RIGHT, UP, DOWN, SELECT, ShowSetupPage,ExitSeupPage
- * History:
- * <author> <time> <version > <desc>
- */
- #ifndef __SETUP_TAB_UI_SFM
- #define __SETUP_TAB_UI_SFM
- #ifndef SETUP_UI_DBG
- #undef ui_printf
- #undef ui_print_block
- #define ui_printf(f, a...) do {} while (0)
- #define ui_print_block(x,y) do {} while (0)
- #else
- #define ui_printf printf
- #define ui_print_block print_block
- #endif
- #include "setup_ui_ext_func.h"
- #include "setup_ui_def.h"
- //===============================================
- void ShowSetupSelect(BYTE index,BYTE border);//border=0:draw string only;1:with border;2:clear border;
- void ShowSetupItem(BYTE index,BYTE border);//border=0:draw string only;1:with border;2:clear border:
- void ShowSetupPage(BYTE refresh);
- void ShowSetupPassword(const char *buf);
- #ifdef TEST_INTERLACE//Modifed by ChenZhao on 2004-9-20 11:39
- void test_interlace(int dir);
- void osd_interlace(int x, int y, BYTE direct, BYTE fontColor, BYTE bkColor);
- #endif//TEST_INTERLACE
- #ifdef VIDEOSETUPGUI
- void revise_val(int dir, INT8 * x, int max, int min);
- void CookVideoSetupGui(int dir);
- #endif
- void osd_changeAlpha(UINT32 a);
- void osd_draw_roundcorner(int x, int y, BYTE direct, unsigned fontColor, unsigned bkColor);
- void osd_DrawSlantCorner(INT32 xStart,INT32 yStart,INT32 xEnd,INT32 yEnd,BYTE direct,BYTE lineOnly,BYTE fontColor);
- void osd_DrawIcon_Trans(int xStart, int yStart, unsigned index, BYTE mask, BYTE fontColor);
- UINT32 osd_StringDrawLength(const BYTE * str);
- //=============================================
- static UINT32 item_width,title_height,item_arena_height;
- static UINT32 oldpassword,newpassword,confirmpassword;
- static UINT8 passwordstate,setup_gui_state;
- #ifdef VIDEOSETUPGUI
- static UINT8 video_state;
- #endif//VIDEOSETUPGUI
- //=============================================
- //for setup re-engineering //added by JS 20040728 //Modifed by ChenZhao on 2004-8-31 10:37 WP
- #include "setup_ui_down_SFM.c"
- #include "setup_ui_up_SFM.c"
- #include "setup_ui_left_SFM.c"
- #include "setup_ui_right_SFM.c"
- #include "setup_ui_sel_SFM.c"
- //==============================================
- //#define SHOW_SYSTEM_CLOCK
- //=============================================
- void Draw_Border(UINT32 xStart,UINT32 yStart,UINT32 xLen,UINT32 yLen,BYTE fontColor,BYTE bkColor,BYTE fillColor)
- {
- osd_draw_rect( xStart<<1, yStart, xLen<<1, yLen, fontColor);
- osd_draw_rect( (xStart+1)<<1, yStart+2, (xLen-2)<<1, yLen-4, fillColor);
- osd_draw_roundcorner(xStart,yStart,16,bkColor, fillColor);
- osd_draw_roundcorner(xStart+xLen-4,yStart,17,bkColor, fillColor);
- osd_draw_roundcorner(xStart+xLen-4,yStart+yLen-8,18,bkColor, fillColor);
- osd_draw_roundcorner(xStart,yStart+yLen-8,19,bkColor, fillColor);
- osd_draw_roundcorner(xStart,yStart,12,fontColor, bkColor);
- osd_draw_roundcorner(xStart+xLen-4,yStart,13,fontColor, bkColor);
- osd_draw_roundcorner(xStart+xLen-4,yStart+yLen-8,14,fontColor, bkColor);
- osd_draw_roundcorner(xStart,yStart+yLen-8,15,fontColor, bkColor);
- }
- void Draw_RoundBox(UINT32 xStart,UINT32 yStart,UINT32 xLen,UINT32 yLen,BYTE fontColor,BYTE bkColor)
- {
- osd_draw_rect( (xStart+4)<<1, yStart, (xLen-8)<<1, yLen, fontColor);
- osd_draw_rect( xStart<<1, yStart+8, xLen<<1, yLen-16, fontColor);
- osd_draw_roundcorner(xStart,yStart,8,fontColor, bkColor);
- osd_draw_roundcorner(xStart+xLen-4,yStart,9,fontColor, bkColor);
- osd_draw_roundcorner(xStart+xLen-4,yStart+yLen-8,10,fontColor, bkColor);
- osd_draw_roundcorner(xStart,yStart+yLen-8,11,fontColor, bkColor);
- }
- #ifdef VIDEOSETUPGUI
- void ShowVideoSetupGui(void)
- {
- const char *vstr;
- int val;
- UINT8 maxBlock,cBlock,i;
- switch(video_state)
- {
- case VIDEOSTATE_BRIHTNESS:
- index_y=0;
- id=setup_item[page][index_y][1];
- vstr=setup_SetItemString();
- val=SETUP_BRIGHTNESS-2;
- maxBlock=12;
- cBlock=val;
- break;
-
- case VIDEOSTATE_CONTRAST:
- index_y=1;
- id=setup_item[page][index_y][1];
- vstr=setup_SetItemString();
- val=SETUP_CONTRAST-2;
- maxBlock=12;
- cBlock=val;
- break;
-
- case VIDEOSTATE_HUE:
- index_y=2;
- id=setup_item[page][index_y][1];
- vstr=setup_SetItemString();
- val=SETUP_HUE-8;
- maxBlock=12;
- cBlock=val+6;
- break;
-
- case VIDEOSTATE_SATURATION:
- index_y=3;
- id=setup_item[page][index_y][1];
- vstr=setup_SetItemString();
- val=SETUP_SATURATION-2;
- maxBlock=12;
- cBlock=val;
- break;
-
- default:
- return;
- break;
- }
- osd_DrawString_ori(ITEM_XSTART,SETUP_REGION_HEIGHT-SETUP_BUTTON_HEIGHT*2,vstr,ITEM_FONTCOLOR,ITEM_BGCOLOR);
- for(i=0;i<cBlock;i++)
- linebuf[i]=N_longbar;
- for(i=cBlock;i<maxBlock;i++)
- linebuf[i]=N_shortbar;
- psprintf(linebuf+maxBlock,"%3d",val);
- osd_DrawString_ori(ITEM_XSTART,SETUP_REGION_HEIGHT-SETUP_BUTTON_HEIGHT,linebuf,ITEM_FONTCOLOR,ITEM_BGCOLOR);
- }
- void CookVideoSetupGui(int dir)
- {
- switch(video_state)
- {
- case VIDEOSTATE_BRIHTNESS:
- revise_val(dir, &SETUP_BRIGHTNESS, 14, 2);
- SetBrightness(SETUP_BRIGHTNESS - 2);
- ShowVideoSetupGui();
- break;
-
- case VIDEOSTATE_CONTRAST:
- revise_val(dir, &SETUP_CONTRAST, 14, 2);
- SetContrast(SETUP_CONTRAST - 2);
- ShowVideoSetupGui();
- break;
-
- case VIDEOSTATE_HUE:
- revise_val(dir, &SETUP_HUE, 14, 2);
- SetHUE(SETUP_HUE - 2);
- ShowVideoSetupGui();
- break;
-
- case VIDEOSTATE_SATURATION:
- revise_val(dir, &SETUP_SATURATION, 14, 2);
- SetSaturation(SETUP_SATURATION - 2);
- ShowVideoSetupGui();
- break;
-
- default:
- break;
- }
- }
- void InitVideoSetupGUI(void)
- {
- page = VIDEOPAGE;
- video_state=VIDEOSTATE_BRIHTNESS;
- setup_gui_state=SETUPGUI_VIDEO;
- full_scrn=SETUP; //setup menu
- //read_setup_select(); // read data from EEPROM or Flush
- osd_init_setup();
- ShowVideoSetupGui();
- }
- int IsVideoSetupExit_NextVideoSetup()
- {
- if((SETUPGUI_VIDEO!=setup_gui_state)|| !(full_scrn&SETUP))
- return 1;
- else
- {
- switch(video_state)
- {
- case VIDEOSTATE_BRIHTNESS:
- video_state=VIDEOSTATE_CONTRAST;
- run_save_sel_cmd(page,index_y);
- ShowVideoSetupGui();
- break;
-
- case VIDEOSTATE_CONTRAST:
- video_state=VIDEOSTATE_HUE;
- run_save_sel_cmd(page,index_y);
- ShowVideoSetupGui();
- break;
-
- case VIDEOSTATE_HUE:
- video_state=VIDEOSTATE_SATURATION;
- run_save_sel_cmd(page,index_y);
- ShowVideoSetupGui();
- break;
-
- case VIDEOSTATE_SATURATION:
- run_save_sel_cmd(page,index_y);
- setup_gui_state=SETUPGUI_MENU;
- return 1;
- break;
-
- default:
- setup_gui_state=SETUPGUI_MENU;
- return 1;
- break;
- }
-
- }
- return 0;
- }
- #endif//VIDEOSETUPGUI
- void ShowSetupPassword(const char *buf)
- {
- switch(passwordstate)
- {
- case PASSWORDS_INIT:
- oldpassword=0;
- newpassword=0xffff; //liumzh
- confirmpassword=0xffff;
- reset_passwd_cnt();
- Draw_RoundBox(PASSWORDGUI_XSTART,PASSWORDGUI_YSTART+PASSWORDGUI_SCYLEN,PASSWORDGUI_XLEN,PASSWORDGUI_YLEN-PASSWORDGUI_SCYLEN, PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
- Draw_RoundBox(PASSWORDGUI_XSTART,PASSWORDGUI_YSTART,PASSWORDGUI_XLEN-PASSWORDGUI_SCXLEN,PASSWORDGUI_YLEN, PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawSlantCorner(PASSWORDGUI_SCXS,PASSWORDGUI_SCYS,PASSWORDGUI_SCXE,PASSWORDGUI_SCYE,0,0,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4,"SET PASSWORD",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,"CURRENT:",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,"NEW:",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"CONFIRM:",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO RETURN.",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- Draw_Border(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR,PASSWORDGUI_FILLCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- passwordstate=PASSWORDS_OLD;
- break;
-
- case PASSWORDS_OLD:
- if(digit_cnt<PASSWORD_LENGTH)
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,buf,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
- else
- {
- Draw_RoundBox(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,"XXXX",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO SET . ",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
- oldpassword=tmp_passwd;
- reset_passwd_cnt();
- passwordstate=PASSWORDS_ENTER;
- }
- break;
-
- case PASSWORDS_NEW:
- if(digit_cnt<PASSWORD_LENGTH)
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,buf,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
- else
- {
- Draw_Border(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR,PASSWORDGUI_FILLCOLOR);
- Draw_RoundBox(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,"XXXX",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
- newpassword=tmp_passwd;
- reset_passwd_cnt();
- passwordstate=PASSWORDS_CONFIRM;
- }
- break;
-
- case PASSWORDS_CONFIRM:
- if(digit_cnt<PASSWORD_LENGTH)
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,buf,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
- else
- {
- Draw_Border(PASSWORDGUI_XSTART+1,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,6+22*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR,PASSWORDGUI_FILLCOLOR);
- Draw_RoundBox(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"XXXX",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO SET.",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
- confirmpassword=tmp_passwd;
- reset_passwd_cnt();
- passwordstate=PASSWORDS_ENTER;
- }
- break;
- case PASSWORDS_ENTER:
- break;
-
- case PASSWORDS_UNLOCK:
- #ifdef MODIFY_PASSWORD_3308
- if((oldpassword!=UserSet.parent_passwd)&&(oldpassword!=USER_SUPER_PASSWORD))
- #else
- if(oldpassword!=UserSet.parent_passwd)
- #endif
- {
- passwordstate=PASSWORDS_INIT;
- ShowSetupPassword("");
- }
- else
- {
- if(confirmpassword==newpassword)
- {
- if(newpassword!=0xffff)
- UserSet.parent_passwd=newpassword;
- UserSet.parental_ststus=C_UNLOCK;
- passwordstate=PASSWORDS_NULL;
- setupLevel=1;
- setup_gui_state=SETUPGUI_MENU;
- ShowSetupPage(REFRESH_ITEM);
- }
- else
- {
- reset_passwd_cnt();
- passwordstate=PASSWORDS_NEW;
- Draw_RoundBox(PASSWORDGUI_XSTART+1,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,6+22*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
- osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO CANCEL.",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
- Draw_Border(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR,PASSWORDGUI_FILLCOLOR);
- ShowSetupPassword("----");
- }
- }
- break;
-
- case PASSWORDS_NULL:
- break;
-
- default:
- passwordstate=PASSWORDS_NULL;
- break;
- }
- }
- #ifdef TEST_INTERLACE//Modifed by ChenZhao on 2004-9-20 11:39
- void test_interlace(int dir)
- {
- int i,x,y;
- static int c=1,s=0;
- c=(c+dir+16)%16;
- s=(s+2+dir/16)%2;
- x=4*((SETUP_REGION_WIDTH-24*4)/8);
- y=8*((SETUP_REGION_HEIGHT-48*4)/16);
- osd_DrawString_ori(x,0,"ODD ", (4+c)%16,(19-c)%16);
- osd_DrawString_ori(x+8*5 ,0+32 ,"EVEN ", (19-c)%16,(4+c)%16);
- osd_DrawString_ori(x ,0+32 ,"FONT ", c,15-c);
- osd_DrawString_ori(x+8*5 ,0 ,"BACK ", 15-c,c);
- psprintf(linebuf,"COLOR DISTENCE:%+2d %s",c,s?"HORIZONTAL":"VERTICAL ");
- osd_DrawString_ori(ITEM_XSTART+ITEM_TEXT_XSTART,y+48*4,linebuf, 1,2);
- osd_DrawString_ori(ITEM_XSTART+ITEM_TEXT_XSTART,y+48*4+32,"PRESS ENTER TO EXIT", 1,2);
- osd_draw_rect(x*2,y,48*4,48*4,1);
- for(i=0;i<16;i++)
- {
- osd_interlace(x+4+(i&0x03)*24 ,y+8+(i>>2)*48 ,s,(i+c)%16,i);
- osd_interlace(x+4+(i&0x03)*24+8 ,y+8+(i>>2)*48+16,s,i,(i+c)%16);
- osd_interlace(x+4+(i&0x03)*24 ,y+8+(i>>2)*48+16,0,(i+c)%16,(i+c)%16);
- osd_interlace(x+4+(i&0x03)*24+8 ,y+8+(i>>2)*48 ,0,i,i);
- }
- }
- #endif//TEST_INTERLACE
- void ShowSetupPasswordCustm(const char *buf)
- {
- osd_DrawString_ori(ITEM_XSTART-ITEM_TEXT_XSTART+item_width-osd_StringDrawLength(buf),title_height+BORDER_WIDTH+index_y*SETUP_BUTTON_HEIGHT, buf, ITEM_FONTCOLOR, ITEM_FILLCOLOR);
- }
- void ShowSetupSelect(BYTE index,BYTE border)//border=0:draw string only;1:with border;2:clear border;
- {
- const char *str;
- UINT32 sub_xstart,sub_xwidth,sub_ystart;
- if((LANGPAGE==page)|(STR_OS_REGION_CODE==setup_item[page][index_y][1]))
- sub_ystart=title_height+BORDER_WIDTH+(index-MIN_ITEM_SEL)*SETUP_BUTTON_HEIGHT;
- else
- sub_ystart=title_height+BORDER_WIDTH+(index-MIN_ITEM_SEL+index_y)*SETUP_BUTTON_HEIGHT;
- #ifdef RATING_8
- if(STR_OS_RATING==setup_item[page][index_y][1])
- {
- sub_xwidth=SELECT_WIDTH/2;
- sub_xstart=SELECT_XSTART+SELECT_TEXT_XSTART+(index % 2)*sub_xwidth;
- sub_ystart=title_height+BORDER_WIDTH+((index-MIN_ITEM_SEL)/2+index_y)*SETUP_BUTTON_HEIGHT;
- }
- else
- {
- sub_xwidth=SELECT_WIDTH;
- sub_xstart=SELECT_XSTART+SELECT_TEXT_XSTART;
- }
- #else//RATING_8
- sub_xwidth=SELECT_WIDTH;
- sub_xstart=SELECT_XSTART+SELECT_TEXT_XSTART;
- #endif//RATING_8
- if(1==border)//draw border
- Draw_Border(sub_xstart-5,sub_ystart,sub_xwidth-6,SETUP_BUTTON_HEIGHT,SELECT_FONTCOLOR,SELECT_BGCOLOR,SELECT_FILLCOLOR);
- else if(2==border)//clear border
- Draw_RoundBox(sub_xstart-5,sub_ystart,sub_xwidth-6,SETUP_BUTTON_HEIGHT,SELECT_BGCOLOR,SELECT_BGCOLOR);
- //draw background
- if(1!=border)
- Draw_RoundBox(sub_xstart-4,sub_ystart+2,sub_xwidth-8,SETUP_BUTTON_HEIGHT-4,SELECT_FONTBGCOLOR,SELECT_BGCOLOR);
-
- id=setup_item[page][index_y][index];
- str = setup_SetItemString();
- osd_DrawString_ori(sub_xstart,sub_ystart, str, (index==setup_sel[page][index_y])?SELECT_ANTIFONTCOLOR:SELECT_FONTCOLOR,(1==border)?SELECT_FILLCOLOR:SELECT_FONTBGCOLOR);
- }
- void ShowSetupItem(BYTE index,BYTE border)//border=0:draw string only;1:with border;2:clear border:
- {
- const char *str;
- if(1==border)
- {
- Draw_Border(ITEM_XSTART+2,title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT,item_width-4,SETUP_BUTTON_HEIGHT,ITEM_FONTCOLOR,ITEM_BGCOLOR,ITEM_FILLCOLOR);
- //Draw_RoundBox(ITEM_XSTART+3,title_height+BORDER_WIDTH+1+index*SETUP_BUTTON_HEIGHT,item_width-6,SETUP_BUTTON_HEIGHT-1,SANTIBGCOLOR,SBGCOLOR);
- }
- else if(2==border)
- {
- Draw_RoundBox(ITEM_XSTART+2,title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT,item_width-4,SETUP_BUTTON_HEIGHT,ITEM_BGCOLOR,ITEM_BGCOLOR);
- }
- id = setup_item[page][index][1];
- if (id==STR_OS_RETURN_MAIN_SETUP) // no main page, so this item changes to exit_setup_menu
- id=STR_OS_EXIT_MENU;
- str = _OsdMessegeFont1[osd_font_mode][id];
- osd_DrawString_ori(ITEM_XSTART+ITEM_TEXT_XSTART,title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT, str, ITEM_FONTCOLOR, (1==border)?ITEM_FILLCOLOR:ITEM_BGCOLOR);
- if(SET_FUNC==setup_item[page][index][0])
- {
- if(2!=setupLevel)
- {
- id=setup_item[page][index][setup_sel[page][index]];
- str = setup_SetItemString();
- osd_DrawString_ori(ITEM_XSTART-ITEM_TEXT_XSTART-8+item_width-osd_StringDrawLength(str),title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT, str, ITEM_FONTCOLOR, (1==border)?ITEM_FILLCOLOR:ITEM_BGCOLOR);
- }
- if(!(index_y!=index && 2==setupLevel))
- osd_DrawString_ori(ITEM_XSTART-ITEM_TEXT_XSTART-8+item_width,title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT, Ch_arrorR, ITEM_FONTCOLOR, (1==border)?ITEM_FILLCOLOR:ITEM_BGCOLOR);
- }
- else if(SET_SCALE==setup_item[page][index][0])
- {
- if(!(index_y!=index && 2==setupLevel))
- osd_DrawString_ori(ITEM_XSTART-ITEM_TEXT_XSTART-8+item_width,title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT, Ch_arrorR, ITEM_FONTCOLOR, (1==border)?ITEM_FILLCOLOR:ITEM_BGCOLOR);
- }
- else if(SET_NM==setup_item[page][index][0])
- {
- if(2!=setupLevel)
- {
- if(full_scrn&CUSTM)
- {
- psprintf(linebuf,"%04d", UserSet.parent_passwd);
- osd_DrawString_ori(ITEM_XSTART-ITEM_TEXT_XSTART+item_width-osd_StringDrawLength(linebuf),title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT, linebuf, ITEM_FONTCOLOR, (1==border)?ITEM_FILLCOLOR:ITEM_BGCOLOR);
- }
- else
- {
- id=setup_item[page][index][2+UserSet.parental_ststus];
- str = setup_SetItemString();
- osd_DrawString_ori(ITEM_XSTART-ITEM_TEXT_XSTART+item_width-osd_StringDrawLength(str),title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT, str, ITEM_FONTCOLOR, (1==border)?ITEM_FILLCOLOR:ITEM_BGCOLOR);
- }
- }
- }
- return;
- }
- void Draw_arrow(UINT32 xStart,UINT32 yStart,UINT32 xLen,UINT32 yLen,BYTE fontColor,BYTE direct)
- {
- UINT32 xm,ym,x1,y1,x2,y2;
- BYTE dir1,dir2;
- direct=(4+direct%4)%4;
- //direct 0:up,2:down,1:left,3:right;
- xm=(direct%2)?((1==direct)?0:xLen-1):xLen/2;
- ym=(direct%2)?yLen/2:((0==direct)?0:yLen-1);
- x1=(1==direct)?xLen-1:0;
- y1=(0==direct)?yLen-1:0;
- x2=(direct%2)?x1:(xLen-x1-1);
- y2=(direct%2)?(yLen-y1-1):y1;
- //printf("d%d:%d %d,%d %d,%d %dn",direct,xm,ym,x1,y1,x2,y2);
- dir2=dir1=(!(direct%2))||(1==direct);
- if(!(direct%2))dir2=!dir2;
- osd_DrawSlantCorner(xStart+xm,yStart+ym,xStart+x1,yStart+y1,dir1,0,fontColor);
- osd_DrawSlantCorner(xStart+xm,yStart+ym,xStart+x2,yStart+y2,dir2,0,fontColor);
- }
- #ifdef SHOW_PAGE_TITLE
- void ShowPageTitle()
- {
- const char *str;
- osd_draw_rect(TITLE_XSTART*2,TITLE_YSTART,TITLE_XWIDTH*2,TITLE_HEIGHT,TITLE_BGCOLOR);
- osd_draw_roundcorner(TITLE_XSTART,TITLE_YSTART, R_CORNER_LU, TITLE_BGCOLOR,SETUP_BGCOLOR );
- osd_draw_roundcorner(TITLE_XSTART+TITLE_XWIDTH-4,TITLE_YSTART, R_CORNER_RU,TITLE_BGCOLOR , SETUP_BGCOLOR);
- osd_draw_roundcorner(TITLE_XSTART+TITLE_XWIDTH,TITLE_HEIGHT-8, R_CORNER_LD|R_CORNER_TRANS|R_CORNER_INVERT,TITLE_BGCOLOR , SETUP_BGCOLOR);
- //osd_draw_roundcorner(TITLE_XSTART-4,TITLE_HEIGHT-8,R_CORNER_RD|R_CORNER_TRANS|R_CORNER_INVERT, TITLE_BGCOLOR, SETUP_BGCOLOR);
- id = setup_MainP[page][0];
- if (id==STR_OS_RETURN_MAIN_SETUP) // no main page, so this item changes to exit_setup_menu
- id=STR_OS_EXIT_MENU;
- str = _OsdMessegeFont1[osd_font_mode][id];
- osd_DrawString_ori(TITLE_XSTART+(TITLE_XWIDTH-osd_StringDrawLength(str))/2,TITLE_YSTART,str,TITLE_FONTCOLOR,TITLE_BGCOLOR);
- }
- #endif//SHOW_PAGE_TITLE
- #ifdef SHOW_SETUP_GUIDE
- void ShowSetupGuide(void)
- {
- const char *str1="TO SET PRESS THEN";
- const char *str2="TO QUIT PRESS";
- const char *str3="ENTER";
- const char *str4="SETUP";
- osd_DrawString_ori(GUIDE_XSTART,GUIDE_YSTART,str1, GUIDE_FONTCOLOR,GUIDE_BGCOLOR);
- osd_DrawString_ori(GUIDE_XSTART,GUIDE_YSTART+SETUP_BUTTON_HEIGHT,str2, GUIDE_FONTCOLOR,GUIDE_BGCOLOR);
- Draw_RoundBox(GUIDE_XSTART+osd_StringDrawLength(str1)+4,GUIDE_YSTART+2,osd_StringDrawLength(str3)+8,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
- osd_DrawString_ori(GUIDE_XSTART+osd_StringDrawLength(str1)+8,GUIDE_YSTART,str3, GUIDE_FONTCOLOR,GUIDE_FILLCOLOR);
- Draw_RoundBox(GUIDE_XSTART+osd_StringDrawLength(str2)+4,GUIDE_YSTART+SETUP_BUTTON_HEIGHT+2,osd_StringDrawLength(str4)+8,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
- osd_DrawString_ori(GUIDE_XSTART+osd_StringDrawLength(str2)+8,GUIDE_YSTART+SETUP_BUTTON_HEIGHT,str4, GUIDE_FONTCOLOR,GUIDE_FILLCOLOR);
- Draw_RoundBox(GUIDE_XSTART+106,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
- Draw_RoundBox(GUIDE_XSTART+130,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
- Draw_RoundBox(GUIDE_XSTART+154,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
- Draw_RoundBox(GUIDE_XSTART+178,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
- Draw_arrow(GUIDE_XSTART+110,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,0);
- Draw_arrow(GUIDE_XSTART+134,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,1);
- Draw_arrow(GUIDE_XSTART+158,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,2);
- Draw_arrow(GUIDE_XSTART+182,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,3);
- //ReadFromI2c(0xa0, 0x01,linebuf,4);
- //printf("readed=0x%xn",*((UINT32 *)linebuf));
- }
- #endif//SHOW_SETUP_GUIDE
- void ShowSetupPage(BYTE refresh)
- {
- int i;
- BYTE iItemType;
- if(2==setupLevel)
- item_width=ITEM_WIDTH;
- else
- item_width=ITEM_WIDTH+SELECT_WIDTH;
-
- if(full_scrn&CUSTM)
- {
- title_height=TITLE_HEIGHT+SETUP_BUTTON_HEIGHT*CUSTM_YSTART;
- item_arena_height=ITEM_ARENA_HEIGHT+TITLE_HEIGHT-title_height;
- }
- else
- {
- title_height=TITLE_HEIGHT;
- item_arena_height=ITEM_ARENA_HEIGHT;
- }
-
- switch(refresh)
- {
- case REFRESH_SETUP:
- passwordstate=PASSWORDS_NULL;
- setup_gui_state=SETUPGUI_MENU;
- #ifdef SHOW_SETUP_GUIDE
- ShowSetupGuide();
- #endif//SHOW_SETUP_GUIDE
- case REFRESH_PAGE:
- #ifdef SHOW_PAGE_TITLE
- ShowPageTitle();
- #endif//SHOW_PAGE_TITLE
- Draw_RoundBox(PAGE_XSTART,title_height,PAGE_XWIDTH,item_arena_height,PAGE_BGCOLOR,SETUP_BGCOLOR);
- #ifdef ICON_BUTTON
- #if ITEM_XSTART>PAGE_XSTART+PAGE_WIDTH
- osd_draw_rect((PAGE_XSTART+PAGE_XWIDTH)*2,title_height,(ITEM_XSTART-PAGE_XSTART-PAGE_XWIDTH)*2,item_arena_height,SETUP_BGCOLOR);
- #endif
- //if(0==setupLevel)
- {
- osd_draw_rect(PAGE_XSTART*2,title_height+4*BORDER_WIDTH+page*PAGE_TITLE_HEIGHT,(ITEM_XSTART-PAGE_XSTART)*2,PAGE_TITLE_HEIGHT,ITEM_BGCOLOR);
- osd_draw_roundcorner(PAGE_XSTART, title_height+4*BORDER_WIDTH+page*PAGE_TITLE_HEIGHT, 0, ITEM_BGCOLOR, PAGE_BGCOLOR);
- osd_draw_roundcorner(ITEM_XSTART-4,title_height+4*BORDER_WIDTH+PAGE_TITLE_HEIGHT+page*PAGE_TITLE_HEIGHT, 25,ITEM_BGCOLOR , PAGE_BGCOLOR);
- osd_draw_roundcorner(ITEM_XSTART-4,title_height+4*BORDER_WIDTH-8+page*PAGE_TITLE_HEIGHT, 26,ITEM_BGCOLOR , PAGE_BGCOLOR);
- osd_draw_roundcorner(PAGE_XSTART,title_height+4*BORDER_WIDTH+PAGE_TITLE_HEIGHT+page*PAGE_TITLE_HEIGHT-8, 3, ITEM_BGCOLOR, PAGE_BGCOLOR);
- }
- #endif//ICON_BUTTON
- for(i=0;i<=MAX_SHOW_PAGE;i++)
- {
- if(i==page)
- if(0==setupLevel)
- {
- osd_DrawIcon_Trans(PAGE_XSTART+PAGE_ICON_XSTART,title_height+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],1,PAGE_SDCOLOR);
- osd_DrawIcon_Trans(PAGE_XSTART-3+PAGE_ICON_XSTART,title_height-6+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],0,0);
- }
- else
- {
- #ifndef ICON_BUTTON
- osd_DrawIcon_Trans(PAGE_XSTART+3+PAGE_ICON_XSTART,title_height+6+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],1,PAGE_SDCOLOR);
- #endif//ICON_BUTTON
- osd_DrawIcon_Trans(PAGE_XSTART+PAGE_ICON_XSTART,title_height+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],0,0);
- }
- else
- osd_DrawIcon_Trans(PAGE_XSTART+PAGE_ICON_XSTART,title_height+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],0,0);
- }
- case REFRESH_ITEM:
- if(full_scrn&CUSTM)
- {
- osd_draw_roundcorner(SELECT_XSTART+SELECT_WIDTH-4,title_height-8,2,ITEM_BGCOLOR,SETUP_BGCOLOR);
- osd_draw_roundcorner(ITEM_XSTART+item_width-4,TITLE_HEIGHT+ITEM_ARENA_HEIGHT-8,2,ITEM_BGCOLOR,SETUP_BGCOLOR);
- Draw_RoundBox(ITEM_XSTART,TITLE_HEIGHT,item_width,ITEM_ARENA_HEIGHT,ITEM_BGCOLOR,SETUP_BGCOLOR);
- ShowCUSTMMsg();//printf("full_scrn=%xn",full_scrn);
- }
- else
- {
- #ifdef SHOW_PAGE_TITLE
- osd_draw_roundcorner(ITEM_XSTART,title_height,R_CORNER_LU|R_CORNER_INVERT|R_CORNER_TRANS,ITEM_BGCOLOR,SETUP_BGCOLOR);
- #endif//SHOW_PAGE_TITLE
- osd_draw_roundcorner(ITEM_XSTART+item_width-4,title_height,1,ITEM_BGCOLOR,SETUP_BGCOLOR);
- osd_draw_roundcorner(ITEM_XSTART+item_width-4,title_height+item_arena_height-8,2,ITEM_BGCOLOR,SETUP_BGCOLOR);
- Draw_RoundBox(ITEM_XSTART,title_height,item_width,item_arena_height,ITEM_BGCOLOR,SETUP_BGCOLOR);
- }
- if(0==setupLevel)
- {
- for (i=0; i<MAX_PAGE_ITEM; i++)
- {
- iItemType=setup_item[page][i][0];
- if (iItemType == SET_SPACE) continue;
- if (iItemType == SET_NE) break;
- ShowSetupItem(i,0);
- }
- setupItemNum[1] = i;
- }
- else
- {for(i=0;i<setupItemNum[1];i++)
- {
- ShowSetupItem(i,((index_y==i)&&(1==setupLevel))?1:0);
- }
- }
- case REFRESH_SELECT:
- if(2==setupLevel)
- {
- osd_draw_rect(SELECT_XSTART<<1,title_height,SELECT_WIDTH<<1,item_arena_height, SELECT_BGCOLOR);
- if(full_scrn&CUSTM)
- osd_draw_roundcorner(SELECT_XSTART,title_height,16,ITEM_BGCOLOR,SELECT_BGCOLOR);
- if(SET_FUNC==setup_item[page][index_y][0])
- {for(i=MIN_ITEM_SEL;i<MAX_ITEM_SEL;i++)
- {
- if(0==setup_item[page][index_y][i]) break;
- ShowSetupSelect(i,(index_y2==i)?1:0);
- }
- setupItemNum[2] = i;
- }
- else if(SET_SCALE==setup_item[page][index_y][0])
- {setup_PrepareScaleItem(setup_item[page][index_y][1],1);
- }
- }
- break;
- case REFRESH_CUSTM:
- page=MAX_SHOW_PAGE+1;
- setupLevel=1;
- index_y=CUSTM_YSTART;
- for (i=0; i<MAX_PAGE_ITEM; i++)
- {
- iItemType=setup_item[page][i][0];
- if (iItemType == SET_SPACE) continue;
- if (iItemType == SET_NE) break;
- }
- setupItemNum[1] = i;
- passwordstate=PASSWORDS_NULL;
- setup_gui_state=SETUPGUI_MENU;
- ShowSetupPage(REFRESH_ITEM);
- break;
-
- default:
- break;
- }
- }
- //=============================================
- void ShowCUSTMMsg(void)
- {
- BYTE buf[40];
- BYTE *pVersion;
- #ifdef DVD_SERVO
- extern const UINT8 ServoVersion[];
- #endif
- extern const UINT8 KernelVersion[]; // moved to libkern.a, leochen 2004/4/19 09:43