setup_tab_ui_SFM.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:34k
源码类别:

DVD

开发平台:

C/C++

  1. /*
  2.  * FileName:       setup_tab_ui_SFM.c
  3.  * Author:         ChenZhao  Version:   Date: 2004-9-2
  4.  * Description:    include in setup_tab.c when defined SOFT_MENU
  5.  * Version:        
  6.  * Function List:  UI function,
  7.  *                 LEFT,RIGHT, UP, DOWN,  SELECT, ShowSetupPage,ExitSeupPage
  8.  * History:        
  9.  *     <author>   <time>    <version >   <desc>
  10.  */
  11. #ifndef __SETUP_TAB_UI_SFM
  12. #define __SETUP_TAB_UI_SFM
  13. #ifndef SETUP_UI_DBG
  14. #undef ui_printf
  15. #undef ui_print_block
  16. #define ui_printf(f, a...) do {} while (0)
  17. #define ui_print_block(x,y) do {} while (0)
  18. #else
  19. #define ui_printf printf
  20. #define ui_print_block print_block
  21. #endif
  22. #include "setup_ui_ext_func.h"
  23. #include "setup_ui_def.h"
  24. //===============================================
  25. void ShowSetupSelect(BYTE index,BYTE border);//border=0:draw string only;1:with border;2:clear border;
  26. void ShowSetupItem(BYTE index,BYTE border);//border=0:draw string only;1:with border;2:clear border:
  27. void ShowSetupPage(BYTE refresh);
  28. void ShowSetupPassword(const char *buf);
  29. #ifdef TEST_INTERLACE//Modifed by ChenZhao on 2004-9-20 11:39  
  30. void test_interlace(int dir);
  31. void osd_interlace(int x, int y, BYTE direct, BYTE fontColor, BYTE bkColor);
  32. #endif//TEST_INTERLACE
  33. #ifdef VIDEOSETUPGUI
  34. void revise_val(int dir, INT8 * x, int max, int min);
  35. void CookVideoSetupGui(int dir);
  36. #endif
  37. void osd_changeAlpha(UINT32 a);
  38. void osd_draw_roundcorner(int x, int y, BYTE direct, unsigned fontColor, unsigned bkColor);
  39. void osd_DrawSlantCorner(INT32 xStart,INT32 yStart,INT32 xEnd,INT32 yEnd,BYTE direct,BYTE lineOnly,BYTE fontColor);
  40. void osd_DrawIcon_Trans(int xStart, int yStart, unsigned index, BYTE mask, BYTE fontColor);
  41. UINT32 osd_StringDrawLength(const BYTE * str);
  42. //=============================================
  43. static UINT32 item_width,title_height,item_arena_height;
  44. static UINT32 oldpassword,newpassword,confirmpassword;
  45. static UINT8 passwordstate,setup_gui_state;
  46. #ifdef VIDEOSETUPGUI
  47. static UINT8 video_state;
  48. #endif//VIDEOSETUPGUI
  49. //=============================================
  50. //for setup re-engineering //added by JS 20040728 //Modifed by ChenZhao on 2004-8-31 10:37 WP
  51. #include "setup_ui_down_SFM.c"
  52. #include "setup_ui_up_SFM.c"
  53. #include "setup_ui_left_SFM.c"
  54. #include "setup_ui_right_SFM.c"
  55. #include "setup_ui_sel_SFM.c"
  56. //==============================================
  57. //#define SHOW_SYSTEM_CLOCK
  58. //=============================================
  59. void Draw_Border(UINT32  xStart,UINT32 yStart,UINT32 xLen,UINT32 yLen,BYTE fontColor,BYTE bkColor,BYTE fillColor)
  60. {
  61. osd_draw_rect( xStart<<1,  yStart,  xLen<<1, yLen, fontColor);
  62. osd_draw_rect( (xStart+1)<<1,  yStart+2,  (xLen-2)<<1, yLen-4, fillColor);
  63. osd_draw_roundcorner(xStart,yStart,16,bkColor, fillColor);
  64. osd_draw_roundcorner(xStart+xLen-4,yStart,17,bkColor, fillColor);
  65. osd_draw_roundcorner(xStart+xLen-4,yStart+yLen-8,18,bkColor, fillColor);
  66. osd_draw_roundcorner(xStart,yStart+yLen-8,19,bkColor, fillColor);
  67. osd_draw_roundcorner(xStart,yStart,12,fontColor, bkColor);
  68. osd_draw_roundcorner(xStart+xLen-4,yStart,13,fontColor, bkColor);
  69. osd_draw_roundcorner(xStart+xLen-4,yStart+yLen-8,14,fontColor, bkColor);
  70. osd_draw_roundcorner(xStart,yStart+yLen-8,15,fontColor, bkColor);
  71. }
  72. void Draw_RoundBox(UINT32  xStart,UINT32 yStart,UINT32 xLen,UINT32 yLen,BYTE fontColor,BYTE bkColor)
  73. {
  74. osd_draw_rect( (xStart+4)<<1,  yStart, (xLen-8)<<1, yLen, fontColor);
  75. osd_draw_rect( xStart<<1,  yStart+8, xLen<<1, yLen-16, fontColor);
  76. osd_draw_roundcorner(xStart,yStart,8,fontColor, bkColor);
  77. osd_draw_roundcorner(xStart+xLen-4,yStart,9,fontColor, bkColor);
  78. osd_draw_roundcorner(xStart+xLen-4,yStart+yLen-8,10,fontColor, bkColor);
  79. osd_draw_roundcorner(xStart,yStart+yLen-8,11,fontColor, bkColor);
  80. }
  81. #ifdef VIDEOSETUPGUI
  82. void ShowVideoSetupGui(void)
  83. {
  84. const char *vstr;
  85. int val;
  86. UINT8 maxBlock,cBlock,i;
  87. switch(video_state)
  88. {
  89. case VIDEOSTATE_BRIHTNESS:
  90. index_y=0;
  91. id=setup_item[page][index_y][1];
  92. vstr=setup_SetItemString();
  93. val=SETUP_BRIGHTNESS-2;
  94. maxBlock=12;
  95. cBlock=val;
  96. break;
  97. case VIDEOSTATE_CONTRAST:
  98. index_y=1;
  99. id=setup_item[page][index_y][1];
  100. vstr=setup_SetItemString();
  101. val=SETUP_CONTRAST-2;
  102. maxBlock=12;
  103. cBlock=val;
  104. break;
  105. case VIDEOSTATE_HUE:
  106. index_y=2;
  107. id=setup_item[page][index_y][1];
  108. vstr=setup_SetItemString();
  109. val=SETUP_HUE-8;
  110. maxBlock=12;
  111. cBlock=val+6;
  112. break;
  113. case VIDEOSTATE_SATURATION:
  114. index_y=3;
  115. id=setup_item[page][index_y][1];
  116. vstr=setup_SetItemString();
  117. val=SETUP_SATURATION-2;
  118. maxBlock=12;
  119. cBlock=val;
  120. break;
  121. default:
  122. return;
  123. break;
  124. }
  125. osd_DrawString_ori(ITEM_XSTART,SETUP_REGION_HEIGHT-SETUP_BUTTON_HEIGHT*2,vstr,ITEM_FONTCOLOR,ITEM_BGCOLOR);
  126. for(i=0;i<cBlock;i++)
  127. linebuf[i]=N_longbar;
  128. for(i=cBlock;i<maxBlock;i++)
  129. linebuf[i]=N_shortbar;
  130. psprintf(linebuf+maxBlock,"%3d",val);
  131. osd_DrawString_ori(ITEM_XSTART,SETUP_REGION_HEIGHT-SETUP_BUTTON_HEIGHT,linebuf,ITEM_FONTCOLOR,ITEM_BGCOLOR);
  132. }
  133. void CookVideoSetupGui(int dir)
  134. {
  135. switch(video_state)
  136. {
  137. case VIDEOSTATE_BRIHTNESS:
  138. revise_val(dir, &SETUP_BRIGHTNESS, 14, 2);
  139. SetBrightness(SETUP_BRIGHTNESS - 2);
  140. ShowVideoSetupGui();
  141. break;
  142. case VIDEOSTATE_CONTRAST:
  143. revise_val(dir, &SETUP_CONTRAST, 14, 2);
  144. SetContrast(SETUP_CONTRAST - 2);
  145. ShowVideoSetupGui();
  146. break;
  147. case VIDEOSTATE_HUE:
  148. revise_val(dir, &SETUP_HUE, 14, 2);
  149. SetHUE(SETUP_HUE - 2);
  150. ShowVideoSetupGui();
  151. break;
  152. case VIDEOSTATE_SATURATION:
  153. revise_val(dir, &SETUP_SATURATION, 14, 2);
  154. SetSaturation(SETUP_SATURATION - 2);
  155. ShowVideoSetupGui();
  156. break;
  157. default:
  158. break;
  159. }
  160. }
  161. void InitVideoSetupGUI(void)
  162. {
  163.     page = VIDEOPAGE;
  164. video_state=VIDEOSTATE_BRIHTNESS;
  165. setup_gui_state=SETUPGUI_VIDEO;
  166.     full_scrn=SETUP;       //setup menu
  167.     //read_setup_select();   // read data from EEPROM or Flush
  168.     osd_init_setup();
  169. ShowVideoSetupGui();
  170. }
  171. int IsVideoSetupExit_NextVideoSetup()
  172. {
  173. if((SETUPGUI_VIDEO!=setup_gui_state)|| !(full_scrn&SETUP))
  174. return 1;
  175. else
  176. {
  177. switch(video_state)
  178. {
  179. case VIDEOSTATE_BRIHTNESS:
  180. video_state=VIDEOSTATE_CONTRAST;
  181. run_save_sel_cmd(page,index_y);
  182. ShowVideoSetupGui();
  183. break;
  184. case VIDEOSTATE_CONTRAST:
  185. video_state=VIDEOSTATE_HUE;
  186. run_save_sel_cmd(page,index_y);
  187. ShowVideoSetupGui();
  188. break;
  189. case VIDEOSTATE_HUE:
  190. video_state=VIDEOSTATE_SATURATION;
  191. run_save_sel_cmd(page,index_y);
  192. ShowVideoSetupGui();
  193. break;
  194. case VIDEOSTATE_SATURATION:
  195. run_save_sel_cmd(page,index_y);
  196. setup_gui_state=SETUPGUI_MENU;
  197. return 1;
  198. break;
  199. default:
  200. setup_gui_state=SETUPGUI_MENU;
  201. return 1;
  202. break;
  203. }
  204. }
  205. return 0;
  206. }
  207. #endif//VIDEOSETUPGUI
  208. void ShowSetupPassword(const char *buf)
  209. {
  210. switch(passwordstate)
  211. {
  212. case PASSWORDS_INIT:
  213. oldpassword=0;
  214. newpassword=0xffff; //liumzh
  215. confirmpassword=0xffff;
  216. reset_passwd_cnt();
  217. Draw_RoundBox(PASSWORDGUI_XSTART,PASSWORDGUI_YSTART+PASSWORDGUI_SCYLEN,PASSWORDGUI_XLEN,PASSWORDGUI_YLEN-PASSWORDGUI_SCYLEN, PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
  218. Draw_RoundBox(PASSWORDGUI_XSTART,PASSWORDGUI_YSTART,PASSWORDGUI_XLEN-PASSWORDGUI_SCXLEN,PASSWORDGUI_YLEN, PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
  219. osd_DrawSlantCorner(PASSWORDGUI_SCXS,PASSWORDGUI_SCYS,PASSWORDGUI_SCXE,PASSWORDGUI_SCYE,0,0,PASSWORDGUI_BGCOLOR);
  220. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4,"SET PASSWORD",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  221. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,"CURRENT:",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  222. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,"NEW:",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  223. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"CONFIRM:",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  224. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  225. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO RETURN.",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  226. 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);
  227. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
  228. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  229. passwordstate=PASSWORDS_OLD;
  230. break;
  231. case PASSWORDS_OLD:
  232. if(digit_cnt<PASSWORD_LENGTH)
  233. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,buf,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
  234. else
  235. {
  236. Draw_RoundBox(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
  237. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT,"XXXX",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  238. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO SET .  ",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
  239. oldpassword=tmp_passwd;
  240. reset_passwd_cnt();
  241. passwordstate=PASSWORDS_ENTER;
  242. }
  243. break;
  244. case PASSWORDS_NEW:
  245. if(digit_cnt<PASSWORD_LENGTH)
  246. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,buf,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
  247. else
  248. {
  249. 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);
  250. Draw_RoundBox(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
  251. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*2,"XXXX",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  252. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"----",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
  253. newpassword=tmp_passwd;
  254. reset_passwd_cnt();
  255. passwordstate=PASSWORDS_CONFIRM;
  256. }
  257. break;
  258. case PASSWORDS_CONFIRM:
  259. if(digit_cnt<PASSWORD_LENGTH)
  260. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,buf,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
  261. else
  262. {
  263. Draw_Border(PASSWORDGUI_XSTART+1,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,6+22*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR,PASSWORDGUI_FILLCOLOR);
  264. Draw_RoundBox(PASSWORDGUI_XSTART-1+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,10+4*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
  265. osd_DrawString_ori(PASSWORDGUI_XSTART+4+PASSWORDGUI_XPW,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*3,"XXXX",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  266. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO SET.",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_FILLCOLOR);
  267. confirmpassword=tmp_passwd;
  268. reset_passwd_cnt();
  269. passwordstate=PASSWORDS_ENTER;
  270. }
  271. break;
  272. case PASSWORDS_ENTER:
  273. break;
  274. case PASSWORDS_UNLOCK:
  275. #ifdef MODIFY_PASSWORD_3308
  276.                         if((oldpassword!=UserSet.parent_passwd)&&(oldpassword!=USER_SUPER_PASSWORD))
  277. #else
  278. if(oldpassword!=UserSet.parent_passwd)
  279. #endif
  280. {
  281. passwordstate=PASSWORDS_INIT;
  282. ShowSetupPassword("");
  283. }
  284. else 
  285. {
  286. if(confirmpassword==newpassword)
  287. {
  288.       if(newpassword!=0xffff)
  289. UserSet.parent_passwd=newpassword;
  290. UserSet.parental_ststus=C_UNLOCK;
  291. passwordstate=PASSWORDS_NULL;
  292. setupLevel=1;
  293. setup_gui_state=SETUPGUI_MENU;
  294. ShowSetupPage(REFRESH_ITEM);
  295. }
  296. else
  297. {
  298. reset_passwd_cnt();
  299. passwordstate=PASSWORDS_NEW;
  300. Draw_RoundBox(PASSWORDGUI_XSTART+1,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,6+22*8,SETUP_BUTTON_HEIGHT,PASSWORDGUI_BGCOLOR,PASSWORDGUI_BGCOLOR);
  301. osd_DrawString_ori(PASSWORDGUI_XSTART+4,PASSWORDGUI_YSTART+4+SETUP_BUTTON_HEIGHT*4,"PRESS ENTER TO CANCEL.",PASSWORDGUI_FONTCOLOR,PASSWORDGUI_BGCOLOR);
  302. 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);
  303. ShowSetupPassword("----");
  304. }
  305. }
  306. break;
  307. case PASSWORDS_NULL:
  308. break;
  309. default:
  310. passwordstate=PASSWORDS_NULL;
  311. break;
  312. }
  313. }
  314. #ifdef TEST_INTERLACE//Modifed by ChenZhao on 2004-9-20 11:39  
  315. void test_interlace(int dir)
  316. {
  317. int i,x,y;
  318. static int c=1,s=0;
  319. c=(c+dir+16)%16;
  320. s=(s+2+dir/16)%2;
  321. x=4*((SETUP_REGION_WIDTH-24*4)/8);
  322. y=8*((SETUP_REGION_HEIGHT-48*4)/16);
  323. osd_DrawString_ori(x,0,"ODD  ", (4+c)%16,(19-c)%16);
  324. osd_DrawString_ori(x+8*5 ,0+32 ,"EVEN ", (19-c)%16,(4+c)%16);
  325. osd_DrawString_ori(x ,0+32 ,"FONT ", c,15-c);
  326. osd_DrawString_ori(x+8*5 ,0 ,"BACK ", 15-c,c);
  327. psprintf(linebuf,"COLOR DISTENCE:%+2d %s",c,s?"HORIZONTAL":"VERTICAL  ");
  328. osd_DrawString_ori(ITEM_XSTART+ITEM_TEXT_XSTART,y+48*4,linebuf, 1,2);
  329. osd_DrawString_ori(ITEM_XSTART+ITEM_TEXT_XSTART,y+48*4+32,"PRESS ENTER TO EXIT", 1,2);
  330. osd_draw_rect(x*2,y,48*4,48*4,1);
  331. for(i=0;i<16;i++)
  332. {
  333. osd_interlace(x+4+(i&0x03)*24 ,y+8+(i>>2)*48 ,s,(i+c)%16,i);
  334. osd_interlace(x+4+(i&0x03)*24+8 ,y+8+(i>>2)*48+16,s,i,(i+c)%16);
  335. osd_interlace(x+4+(i&0x03)*24 ,y+8+(i>>2)*48+16,0,(i+c)%16,(i+c)%16);
  336. osd_interlace(x+4+(i&0x03)*24+8 ,y+8+(i>>2)*48 ,0,i,i);
  337. }
  338. }
  339. #endif//TEST_INTERLACE
  340. void ShowSetupPasswordCustm(const char *buf)
  341. {
  342. 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);
  343. }
  344. void ShowSetupSelect(BYTE index,BYTE border)//border=0:draw string only;1:with border;2:clear border;
  345. {
  346.     const char   *str;
  347. UINT32 sub_xstart,sub_xwidth,sub_ystart;
  348. if((LANGPAGE==page)|(STR_OS_REGION_CODE==setup_item[page][index_y][1]))
  349. sub_ystart=title_height+BORDER_WIDTH+(index-MIN_ITEM_SEL)*SETUP_BUTTON_HEIGHT;
  350. else
  351. sub_ystart=title_height+BORDER_WIDTH+(index-MIN_ITEM_SEL+index_y)*SETUP_BUTTON_HEIGHT;
  352. #ifdef RATING_8
  353. if(STR_OS_RATING==setup_item[page][index_y][1])
  354. {
  355. sub_xwidth=SELECT_WIDTH/2;
  356. sub_xstart=SELECT_XSTART+SELECT_TEXT_XSTART+(index % 2)*sub_xwidth;
  357. sub_ystart=title_height+BORDER_WIDTH+((index-MIN_ITEM_SEL)/2+index_y)*SETUP_BUTTON_HEIGHT;
  358. }
  359. else
  360. {
  361. sub_xwidth=SELECT_WIDTH;
  362. sub_xstart=SELECT_XSTART+SELECT_TEXT_XSTART;
  363. }
  364. #else//RATING_8
  365. sub_xwidth=SELECT_WIDTH;
  366. sub_xstart=SELECT_XSTART+SELECT_TEXT_XSTART;
  367. #endif//RATING_8
  368. if(1==border)//draw border
  369. Draw_Border(sub_xstart-5,sub_ystart,sub_xwidth-6,SETUP_BUTTON_HEIGHT,SELECT_FONTCOLOR,SELECT_BGCOLOR,SELECT_FILLCOLOR);
  370. else if(2==border)//clear border
  371. Draw_RoundBox(sub_xstart-5,sub_ystart,sub_xwidth-6,SETUP_BUTTON_HEIGHT,SELECT_BGCOLOR,SELECT_BGCOLOR);
  372. //draw background
  373. if(1!=border)
  374. Draw_RoundBox(sub_xstart-4,sub_ystart+2,sub_xwidth-8,SETUP_BUTTON_HEIGHT-4,SELECT_FONTBGCOLOR,SELECT_BGCOLOR);
  375. id=setup_item[page][index_y][index];
  376. str = setup_SetItemString();
  377. osd_DrawString_ori(sub_xstart,sub_ystart, str, (index==setup_sel[page][index_y])?SELECT_ANTIFONTCOLOR:SELECT_FONTCOLOR,(1==border)?SELECT_FILLCOLOR:SELECT_FONTBGCOLOR);
  378. }
  379. void ShowSetupItem(BYTE index,BYTE border)//border=0:draw string only;1:with border;2:clear border:
  380. {
  381.     const char   *str;
  382. if(1==border)
  383. {
  384. 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);
  385. //Draw_RoundBox(ITEM_XSTART+3,title_height+BORDER_WIDTH+1+index*SETUP_BUTTON_HEIGHT,item_width-6,SETUP_BUTTON_HEIGHT-1,SANTIBGCOLOR,SBGCOLOR);
  386. }
  387. else if(2==border)
  388. {
  389. Draw_RoundBox(ITEM_XSTART+2,title_height+BORDER_WIDTH+index*SETUP_BUTTON_HEIGHT,item_width-4,SETUP_BUTTON_HEIGHT,ITEM_BGCOLOR,ITEM_BGCOLOR);
  390. }
  391. id = setup_item[page][index][1];
  392. if (id==STR_OS_RETURN_MAIN_SETUP)  // no main page, so this item changes to exit_setup_menu
  393. id=STR_OS_EXIT_MENU;
  394. str = _OsdMessegeFont1[osd_font_mode][id];
  395. 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);
  396. if(SET_FUNC==setup_item[page][index][0])
  397. {
  398. if(2!=setupLevel)
  399. {
  400. id=setup_item[page][index][setup_sel[page][index]];
  401. str = setup_SetItemString();
  402. 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);
  403. }
  404. if(!(index_y!=index && 2==setupLevel))
  405. 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);
  406. }
  407. else if(SET_SCALE==setup_item[page][index][0])
  408. {
  409. if(!(index_y!=index && 2==setupLevel))
  410. 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);
  411. }
  412. else if(SET_NM==setup_item[page][index][0])
  413. {
  414. if(2!=setupLevel)
  415. {
  416. if(full_scrn&CUSTM)
  417. {
  418. psprintf(linebuf,"%04d", UserSet.parent_passwd);
  419. 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);
  420. }
  421. else
  422. {
  423. id=setup_item[page][index][2+UserSet.parental_ststus];
  424. str = setup_SetItemString();
  425. 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);
  426. }
  427. }
  428. }
  429. return;
  430. }
  431. void Draw_arrow(UINT32  xStart,UINT32 yStart,UINT32 xLen,UINT32 yLen,BYTE fontColor,BYTE direct)
  432. {
  433. UINT32 xm,ym,x1,y1,x2,y2;
  434. BYTE dir1,dir2;
  435. direct=(4+direct%4)%4;
  436. //direct 0:up,2:down,1:left,3:right;
  437. xm=(direct%2)?((1==direct)?0:xLen-1):xLen/2;
  438. ym=(direct%2)?yLen/2:((0==direct)?0:yLen-1);
  439. x1=(1==direct)?xLen-1:0;
  440. y1=(0==direct)?yLen-1:0;
  441. x2=(direct%2)?x1:(xLen-x1-1);
  442. y2=(direct%2)?(yLen-y1-1):y1;
  443. //printf("d%d:%d %d,%d %d,%d %dn",direct,xm,ym,x1,y1,x2,y2);
  444. dir2=dir1=(!(direct%2))||(1==direct);
  445. if(!(direct%2))dir2=!dir2;
  446. osd_DrawSlantCorner(xStart+xm,yStart+ym,xStart+x1,yStart+y1,dir1,0,fontColor);
  447. osd_DrawSlantCorner(xStart+xm,yStart+ym,xStart+x2,yStart+y2,dir2,0,fontColor);
  448. }
  449. #ifdef SHOW_PAGE_TITLE
  450. void ShowPageTitle()
  451. {
  452.     const char   *str;
  453.     osd_draw_rect(TITLE_XSTART*2,TITLE_YSTART,TITLE_XWIDTH*2,TITLE_HEIGHT,TITLE_BGCOLOR);
  454.     osd_draw_roundcorner(TITLE_XSTART,TITLE_YSTART, R_CORNER_LU, TITLE_BGCOLOR,SETUP_BGCOLOR );
  455.     osd_draw_roundcorner(TITLE_XSTART+TITLE_XWIDTH-4,TITLE_YSTART, R_CORNER_RU,TITLE_BGCOLOR , SETUP_BGCOLOR);
  456.     osd_draw_roundcorner(TITLE_XSTART+TITLE_XWIDTH,TITLE_HEIGHT-8, R_CORNER_LD|R_CORNER_TRANS|R_CORNER_INVERT,TITLE_BGCOLOR , SETUP_BGCOLOR);
  457.     //osd_draw_roundcorner(TITLE_XSTART-4,TITLE_HEIGHT-8,R_CORNER_RD|R_CORNER_TRANS|R_CORNER_INVERT, TITLE_BGCOLOR, SETUP_BGCOLOR);
  458. id = setup_MainP[page][0];
  459. if (id==STR_OS_RETURN_MAIN_SETUP)  // no main page, so this item changes to exit_setup_menu
  460. id=STR_OS_EXIT_MENU;
  461. str = _OsdMessegeFont1[osd_font_mode][id];
  462.     osd_DrawString_ori(TITLE_XSTART+(TITLE_XWIDTH-osd_StringDrawLength(str))/2,TITLE_YSTART,str,TITLE_FONTCOLOR,TITLE_BGCOLOR);
  463. }
  464. #endif//SHOW_PAGE_TITLE
  465. #ifdef SHOW_SETUP_GUIDE
  466. void ShowSetupGuide(void)
  467. {
  468. const char *str1="TO SET PRESS              THEN";
  469. const char *str2="TO QUIT PRESS";
  470. const char *str3="ENTER";
  471. const char *str4="SETUP";
  472. osd_DrawString_ori(GUIDE_XSTART,GUIDE_YSTART,str1, GUIDE_FONTCOLOR,GUIDE_BGCOLOR);
  473. osd_DrawString_ori(GUIDE_XSTART,GUIDE_YSTART+SETUP_BUTTON_HEIGHT,str2, GUIDE_FONTCOLOR,GUIDE_BGCOLOR);
  474. Draw_RoundBox(GUIDE_XSTART+osd_StringDrawLength(str1)+4,GUIDE_YSTART+2,osd_StringDrawLength(str3)+8,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
  475. osd_DrawString_ori(GUIDE_XSTART+osd_StringDrawLength(str1)+8,GUIDE_YSTART,str3, GUIDE_FONTCOLOR,GUIDE_FILLCOLOR);
  476. 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);
  477. osd_DrawString_ori(GUIDE_XSTART+osd_StringDrawLength(str2)+8,GUIDE_YSTART+SETUP_BUTTON_HEIGHT,str4, GUIDE_FONTCOLOR,GUIDE_FILLCOLOR);
  478. Draw_RoundBox(GUIDE_XSTART+106,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
  479. Draw_RoundBox(GUIDE_XSTART+130,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
  480. Draw_RoundBox(GUIDE_XSTART+154,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
  481. Draw_RoundBox(GUIDE_XSTART+178,GUIDE_YSTART+2,20,SETUP_BUTTON_HEIGHT-4,GUIDE_FILLCOLOR,GUIDE_BGCOLOR);
  482. Draw_arrow(GUIDE_XSTART+110,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,0);
  483. Draw_arrow(GUIDE_XSTART+134,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,1);
  484. Draw_arrow(GUIDE_XSTART+158,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,2);
  485. Draw_arrow(GUIDE_XSTART+182,GUIDE_YSTART+5,11,21,GUIDE_FONTCOLOR,3);
  486. //ReadFromI2c(0xa0, 0x01,linebuf,4);
  487. //printf("readed=0x%xn",*((UINT32 *)linebuf));
  488. }
  489. #endif//SHOW_SETUP_GUIDE
  490. void ShowSetupPage(BYTE refresh)
  491. {
  492. int i;
  493. BYTE iItemType;
  494. if(2==setupLevel)
  495. item_width=ITEM_WIDTH;
  496. else
  497. item_width=ITEM_WIDTH+SELECT_WIDTH;
  498. if(full_scrn&CUSTM)
  499. {
  500. title_height=TITLE_HEIGHT+SETUP_BUTTON_HEIGHT*CUSTM_YSTART;
  501. item_arena_height=ITEM_ARENA_HEIGHT+TITLE_HEIGHT-title_height;
  502. }
  503. else
  504. {
  505. title_height=TITLE_HEIGHT;
  506. item_arena_height=ITEM_ARENA_HEIGHT;
  507. }
  508. switch(refresh)
  509. {
  510. case REFRESH_SETUP:
  511. passwordstate=PASSWORDS_NULL;
  512. setup_gui_state=SETUPGUI_MENU;
  513.             #ifdef SHOW_SETUP_GUIDE
  514. ShowSetupGuide();
  515.             #endif//SHOW_SETUP_GUIDE
  516. case REFRESH_PAGE:
  517.             #ifdef SHOW_PAGE_TITLE
  518.             ShowPageTitle();
  519.             #endif//SHOW_PAGE_TITLE
  520. Draw_RoundBox(PAGE_XSTART,title_height,PAGE_XWIDTH,item_arena_height,PAGE_BGCOLOR,SETUP_BGCOLOR);
  521.             #ifdef ICON_BUTTON
  522.                 #if ITEM_XSTART>PAGE_XSTART+PAGE_WIDTH
  523.     osd_draw_rect((PAGE_XSTART+PAGE_XWIDTH)*2,title_height,(ITEM_XSTART-PAGE_XSTART-PAGE_XWIDTH)*2,item_arena_height,SETUP_BGCOLOR);
  524.                 #endif
  525. //if(0==setupLevel)
  526. {
  527. 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);
  528. osd_draw_roundcorner(PAGE_XSTART, title_height+4*BORDER_WIDTH+page*PAGE_TITLE_HEIGHT, 0, ITEM_BGCOLOR, PAGE_BGCOLOR);
  529. osd_draw_roundcorner(ITEM_XSTART-4,title_height+4*BORDER_WIDTH+PAGE_TITLE_HEIGHT+page*PAGE_TITLE_HEIGHT, 25,ITEM_BGCOLOR , PAGE_BGCOLOR);
  530. osd_draw_roundcorner(ITEM_XSTART-4,title_height+4*BORDER_WIDTH-8+page*PAGE_TITLE_HEIGHT, 26,ITEM_BGCOLOR , PAGE_BGCOLOR);
  531. osd_draw_roundcorner(PAGE_XSTART,title_height+4*BORDER_WIDTH+PAGE_TITLE_HEIGHT+page*PAGE_TITLE_HEIGHT-8, 3, ITEM_BGCOLOR, PAGE_BGCOLOR);
  532. }
  533.             #endif//ICON_BUTTON
  534. for(i=0;i<=MAX_SHOW_PAGE;i++)
  535. {
  536. if(i==page)
  537. if(0==setupLevel)
  538. {
  539. osd_DrawIcon_Trans(PAGE_XSTART+PAGE_ICON_XSTART,title_height+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],1,PAGE_SDCOLOR);
  540. 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);
  541. }
  542. else
  543. {
  544. #ifndef ICON_BUTTON
  545. 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);
  546.                         #endif//ICON_BUTTON
  547. osd_DrawIcon_Trans(PAGE_XSTART+PAGE_ICON_XSTART,title_height+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],0,0);
  548. }
  549. else
  550. osd_DrawIcon_Trans(PAGE_XSTART+PAGE_ICON_XSTART,title_height+6*BORDER_WIDTH+i*PAGE_TITLE_HEIGHT,setup_MainP[i][1],0,0);
  551. }
  552. case REFRESH_ITEM:
  553. if(full_scrn&CUSTM)
  554. {
  555. osd_draw_roundcorner(SELECT_XSTART+SELECT_WIDTH-4,title_height-8,2,ITEM_BGCOLOR,SETUP_BGCOLOR);
  556. osd_draw_roundcorner(ITEM_XSTART+item_width-4,TITLE_HEIGHT+ITEM_ARENA_HEIGHT-8,2,ITEM_BGCOLOR,SETUP_BGCOLOR);
  557. Draw_RoundBox(ITEM_XSTART,TITLE_HEIGHT,item_width,ITEM_ARENA_HEIGHT,ITEM_BGCOLOR,SETUP_BGCOLOR);
  558. ShowCUSTMMsg();//printf("full_scrn=%xn",full_scrn);
  559. }
  560. else
  561. {
  562.                 #ifdef SHOW_PAGE_TITLE
  563. osd_draw_roundcorner(ITEM_XSTART,title_height,R_CORNER_LU|R_CORNER_INVERT|R_CORNER_TRANS,ITEM_BGCOLOR,SETUP_BGCOLOR);
  564.                 #endif//SHOW_PAGE_TITLE
  565. osd_draw_roundcorner(ITEM_XSTART+item_width-4,title_height,1,ITEM_BGCOLOR,SETUP_BGCOLOR);
  566. osd_draw_roundcorner(ITEM_XSTART+item_width-4,title_height+item_arena_height-8,2,ITEM_BGCOLOR,SETUP_BGCOLOR);
  567. Draw_RoundBox(ITEM_XSTART,title_height,item_width,item_arena_height,ITEM_BGCOLOR,SETUP_BGCOLOR);
  568. }
  569. if(0==setupLevel)
  570. {
  571. for (i=0; i<MAX_PAGE_ITEM; i++)
  572. {
  573. iItemType=setup_item[page][i][0];
  574. if (iItemType == SET_SPACE) continue;
  575. if (iItemType == SET_NE) break;
  576. ShowSetupItem(i,0);
  577. }
  578. setupItemNum[1] = i;
  579. }
  580. else
  581. {for(i=0;i<setupItemNum[1];i++)
  582. {
  583. ShowSetupItem(i,((index_y==i)&&(1==setupLevel))?1:0);
  584. }
  585. }
  586. case REFRESH_SELECT:
  587. if(2==setupLevel)
  588. {
  589. osd_draw_rect(SELECT_XSTART<<1,title_height,SELECT_WIDTH<<1,item_arena_height, SELECT_BGCOLOR);
  590. if(full_scrn&CUSTM)
  591. osd_draw_roundcorner(SELECT_XSTART,title_height,16,ITEM_BGCOLOR,SELECT_BGCOLOR);
  592. if(SET_FUNC==setup_item[page][index_y][0])
  593. {for(i=MIN_ITEM_SEL;i<MAX_ITEM_SEL;i++)
  594. {
  595. if(0==setup_item[page][index_y][i]) break;
  596. ShowSetupSelect(i,(index_y2==i)?1:0);
  597. }
  598. setupItemNum[2] = i;
  599. }
  600. else if(SET_SCALE==setup_item[page][index_y][0])
  601. {setup_PrepareScaleItem(setup_item[page][index_y][1],1);
  602. }
  603. }
  604. break;
  605. case REFRESH_CUSTM:
  606. page=MAX_SHOW_PAGE+1;
  607. setupLevel=1;
  608. index_y=CUSTM_YSTART;
  609. for (i=0; i<MAX_PAGE_ITEM; i++)
  610. {
  611. iItemType=setup_item[page][i][0];
  612. if (iItemType == SET_SPACE) continue;
  613. if (iItemType == SET_NE) break;
  614. }
  615. setupItemNum[1] = i;
  616. passwordstate=PASSWORDS_NULL;
  617. setup_gui_state=SETUPGUI_MENU;
  618. ShowSetupPage(REFRESH_ITEM);
  619. break;
  620. default:
  621. break;
  622. }
  623. }
  624. //=============================================
  625. void ShowCUSTMMsg(void)
  626. {
  627.     BYTE    buf[40];
  628.     BYTE    *pVersion;
  629. #ifdef DVD_SERVO
  630.     extern const UINT8 ServoVersion[];
  631. #endif
  632.     extern const UINT8 KernelVersion[];     // moved to libkern.a, leochen 2004/4/19 09:43