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

DVD

开发平台:

C/C++

  1. /***************************************************************
  2. *  setup_ui_util.c
  3. *  include  in setup_tab_ui1.c   when defined DVD_SETUP_REENG
  4. * Creator:  JSLin 
  5. * Date:   2004/07/28
  6. *
  7. * Description :
  8. * function dispatcher ???
  9. *
  10. ****************************************************************/
  11. #ifndef _SETUP_UI_UTIL
  12. #define _SETUP_UI_UTIL
  13. void setup_saveVal(void);
  14. void setup_execFunc(void);
  15. void setup_execScaleFunc(void);
  16. void setup_setPasswd(void);
  17. void setup_showPasswd(BYTE num);
  18. void setup_checkPassword(void);
  19. void setup_VA2sel(void);
  20. void setup_sel2VA(void);
  21. UINT32 setup_getSelPos(UINT8 selection);
  22. UINT16 setup_getItemPos(UINT8 item);
  23. //==================================================
  24. #ifdef OSD_COLOR_ADJUST_BY_BRIGHTNESS_AND_CONTRAST  // 2004/11/12 yltseng
  25. void UpdateSetupmenuPalette()
  26. {
  27.     extern void osd_update_setupmenu_palette();
  28.     osd_update_setupmenu_palette();
  29. }
  30. #else
  31. #define UpdateSetupmenuPalette()
  32. #endif
  33. void setup_saveVal(void)
  34. {
  35. BYTE VA;
  36. printf(">>>>>setup_saveVal<<<<<n");
  37. VA = setup_item[setup_pos[1]][setup_pos[2]][MAX_ITEM_SEL+1];
  38. setup_VA[VA] = setup_sel[setup_pos[1]][setup_pos[2]];
  39. run_save_sel_cmd(setup_VA[VA], VA);
  40. /*
  41. // for CUSTM page saving corresponding valus
  42. if(full_scrn&CUSTM){
  43. int p1, p2;
  44. for (p1=0; p1<MAX_SETUP_PAGE; p1++){
  45. for (p2=0; p2<MAX_PAGE_ITEM; p2++){
  46. if(setup_item[p1][p2][1]==setup_item[setup_pos[1]][setup_pos[2]][1]){
  47. setup_sel[p1][p2] = setup_sel[setup_pos[1]][setup_pos[2]];
  48. //run_save_sel_cmd(p1, p2);
  49. }
  50. }
  51. }
  52. }//end of if(full_scrn&CUSTM)
  53. */
  54. }
  55. //===================================================
  56. void setup_execFunc(void)
  57. {
  58. UINT8 itemType;
  59. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  60. if(itemType == SET_SCALE){
  61. setup_execScaleFunc();
  62. } else if(itemType == SET_FUNC){
  63. printf("nn exe_setup_function n");
  64. exe_setup_function(setup_item[setup_pos[1]][setup_pos[2]][1], setup_item[setup_pos[1]][setup_pos[2]][setup_pos[3]], 1);
  65. }
  66. }
  67. //===================================================
  68. void setup_execScaleFunc(void)
  69. {
  70. UINT32 funcID;
  71. printf("nn setup_execScaleFuncn");
  72. funcID = setup_item[setup_pos[1]][setup_pos[2]][1];
  73. switch(funcID){
  74. case STR_OS_BRIGHTNESS:
  75. SetBrightness(setup_pos[3]-MIN_ITEM_SEL);
  76. UpdateSetupmenuPalette();   // 2004/11/12 yltseng
  77. break;
  78. case STR_OS_CONTRAST:
  79. SetContrast(setup_pos[3]-MIN_ITEM_SEL);
  80. UpdateSetupmenuPalette();   // 2004/11/12 yltseng
  81. break;
  82. case STR_OS_HUE:
  83. SetHUE(setup_pos[3]-MIN_ITEM_SEL);
  84. break;
  85. case STR_OS_SATURATION:
  86. SetSaturation(setup_pos[3]-MIN_ITEM_SEL);
  87. break;
  88. case STR_OS_KEY:
  89. audio_key = setup_pos[3]-MIN_ITEM_SEL-6;
  90. AUDIF_Set_Key(setup_pos[3]);//2004AUDDRV AudioSetKey(setup_pos[3]);
  91. //printf("nn>>>> audio_key:%dn", audio_key);
  92. break;
  93. case STR_OS_ECHO:
  94. echo_level=setup_pos[3]-MIN_ITEM_SEL;
  95. #ifdef USE_MIC_ECHO_PARAM
  96.              AUDIF_Set_EchoPara(setup_pos[3]-MIN_ITEM_SEL);//2004AUDDRV AudioSetEchoPara(setup_pos[3]-MIN_ITEM_SEL);
  97. #else
  98.              AUDIF_Set_Echo(setup_pos[3]-MIN_ITEM_SEL, setup_pos[3]-MIN_ITEM_SEL);//2004AUDDRV AudioSetEcho(setup_pos[3]-MIN_ITEM_SEL, setup_pos[3]-MIN_ITEM_SEL);
  99. #endif
  100. break;
  101. case STR_OS_MIC_VOL:
  102. case STR_OS_MIC_VOL_1:
  103. mic_volume=setup_pos[3]-MIN_ITEM_SEL;
  104. AUDIF_Set_MICVol(setup_pos[3]-MIN_ITEM_SEL);//2004AUDDRV AudioSetMICVol(setup_pos[3]-MIN_ITEM_SEL);
  105. break;
  106. case STR_OS_MIC_VOL_2:
  107. mic_volume=setup_pos[3]-MIN_ITEM_SEL;
  108. AUDIF_Set_MICVol2(setup_pos[3]-MIN_ITEM_SEL);//2004AUDDRV AudioSetMICVol_2(setup_pos[3]-MIN_ITEM_SEL);
  109. break;
  110. case STR_OS_CSPK_DELAY:
  111. AUDIF_Set_SpkDelay(1, setup_pos[3]-2);//2004AUDDRV AudioSetSpkDelay(1, setup_pos[3]-2);
  112. break;
  113. case STR_OS_SSPK_DELAY:
  114. AUDIF_Set_SpkDelay(2, (setup_pos[3]-2)*3);//2004AUDDRV AudioSetSpkDelay(2, (setup_pos[3]-2)*3);
  115. break;
  116. case STR_OS_DYNAMICRANGE: //inconsistent
  117. ac3_dynarange=setup_pos[3]-MIN_ITEM_SEL;
  118. set_AC3DynamicRange();
  119. break;
  120. }
  121. }
  122. //===================================================
  123. void setup_setPasswd(void)
  124. {
  125. if(setup_pos[0] != SETUP_ML3) return;
  126. if(ir_select_number >= 10) return;
  127. if(setup_item[setup_pos[1]][setup_pos[2]][0] == SET_NM)
  128. {
  129.      id=setup_item[setup_pos[1]][setup_pos[2]][1];
  130. if(digit_cnt>=PASSWORD_LENGTH)
  131.          digit_cnt=0;
  132.         digit_cnt++;
  133.                 
  134.         setup_showPasswd(ir_select_number);
  135. }
  136. }
  137. //===================================================
  138. void setup_showPasswd(BYTE num)
  139. {
  140.     UINT8   i;
  141.     //BYTE    yStart;
  142.     BYTE    buf[40];
  143.     #define CH_STAR 0x58//X  //jhuang pending
  144.     #define CH_DASH 0x2d//-
  145.     #define CH_SPACE 0x20
  146.     #define CH_LOCK   0xff
  147.     #define CH_UNLOCK 0x67
  148.     if(num == CLREAR_PASSWD) {
  149.         reset_passwd_cnt();
  150.     }
  151. #ifdef SETUP_6_DIGIT_PASSWORD
  152. tmp_passwd=(tmp_passwd*10+num)%1000000;
  153. #else
  154. tmp_passwd=(tmp_passwd*10+num)%10000;
  155. #endif
  156.         // fill char
  157.         for(i=1;i<=digit_cnt;i++)
  158. linebuf[i-1] = CH_STAR;
  159.         for(i=digit_cnt+1;i<=PASSWORD_LENGTH;i++)
  160.             linebuf[i-1] = CH_DASH;
  161.         linebuf[PASSWORD_LENGTH] = CH_SPACE;
  162.         {
  163.    if(UserSet.parental_ststus==C_LOCK)
  164.  linebuf[PASSWORD_LENGTH+1] = CH_LOCK;
  165.   else
  166.    linebuf[PASSWORD_LENGTH+1] = CH_UNLOCK;
  167. }
  168. linebuf[PASSWORD_LENGTH+2] = 0;
  169. if(full_scrn&CUSTM)
  170. {
  171. UserSet.parent_passwd = tmp_passwd;
  172. #ifdef SETUP_6_DIGIT_PASSWORD
  173. psprintf(buf, "%06d", UserSet.parent_passwd);
  174. #else
  175. psprintf(buf, "%04d", UserSet.parent_passwd);
  176. #endif
  177. }
  178. else
  179. {
  180. psprintf(buf,"%s",linebuf);
  181. }
  182. osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+setup_pos[2], buf, setupFcolorSM, setupBGcolorSM);
  183. }
  184. //===================================================
  185. void setup_checkPassword(void)
  186. {
  187. printf("setup_checkPassword mark 1, tmp_passwd:%d", tmp_passwd);
  188. if(digit_cnt == PASSWORD_LENGTH)
  189. {
  190. if(UserSet.parental_ststus == C_LOCK)
  191. {
  192. if((tmp_passwd == UserSet.parent_passwd)
  193. #ifdef USER_SUPER_PASSWORD
  194. ||(tmp_passwd == USER_SUPER_PASSWORD)
  195. #endif
  196. )
  197. {
  198. UserSet.parental_ststus = C_UNLOCK;
  199. setup_sel[setup_pos[1]][setup_pos[2]] = 3;
  200. }
  201. }
  202. else if(UserSet.parental_ststus == C_UNLOCK)
  203. {
  204. UserSet.parent_passwd = tmp_passwd;
  205. UserSet.parental_ststus = C_LOCK;
  206. setup_sel[setup_pos[1]][setup_pos[2]] = 2;
  207. }
  208. }
  209. reset_passwd_cnt();
  210. }
  211. //===================================================
  212. void setup_VA2sel(void)
  213. {
  214. int i, j, VA;
  215. printf("setup_VA[] >>> setup_set[][]n");
  216. for(i=0; i<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); i++)
  217. {
  218. for(j=1; j<=MAX_PAGE_ITEM; j++)
  219. {
  220. VA = setup_item[i][j][MAX_ITEM_SEL+1];
  221. if(VA < MAX_SETUP_VA)
  222. {
  223. setup_sel[i][j] = setup_VA[VA];
  224. }
  225. }
  226. }
  227. }
  228. //===================================================
  229. void setup_sel2VA(void)
  230. {
  231. int i, j, VA;
  232. printf("setup_VA[] <<< setup_set[][]n");
  233. for(i=0; i<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); i++)
  234. {
  235. for(j=1; j<=MAX_PAGE_ITEM; j++)
  236. {
  237. VA = setup_item[i][j][MAX_ITEM_SEL+1];
  238. if(VA < MAX_SETUP_VA)
  239. {
  240. setup_VA[VA] = setup_sel[i][j];
  241. }
  242. }
  243. }
  244. }
  245. //===================================================
  246. UINT32 setup_getSelPos(UINT8 selection)
  247. {
  248. UINT32 selPos;
  249. UINT8 P, I, S;
  250. selPos= 0xffffff;
  251. for(P=0; P<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); P++)
  252. {
  253. for(I=1; I<=MAX_PAGE_ITEM; I++)
  254. {
  255. for(S=2; S<MAX_ITEM_SEL; S++){
  256. if(selection == setup_item[P][I][S])
  257. {
  258. selPos = (P<<16)+(I<<8)+S;
  259. break;
  260. }
  261. }
  262. if(selPos!=0xffffff) {break;}
  263. }
  264. if(selPos!=0xffffff) {break;}
  265. }
  266. //printf("nn====================================n");
  267. //printf("  P:%d I:%d S:%dn", (selPos>>16), ((selPos>>8)&0xff), (selPos&0xff));
  268. //printf("====================================nnn");
  269. return selPos;
  270. }
  271. //===================================================
  272. UINT16 setup_getItemPos(UINT8 item)
  273. {
  274. UINT16 itemPos;
  275. UINT8 P, I;
  276. itemPos= 0xffff;
  277. for(P=0; P<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); P++)
  278. {
  279. for(I=1; I<=MAX_PAGE_ITEM; I++)
  280. {
  281. if(item == setup_item[P][I][1])
  282. {
  283. itemPos = (P<<8)+I;
  284. break;
  285. }
  286. }
  287. if(itemPos!=0xffff) {break;}
  288. }
  289. //printf("nn====================================n");
  290. //printf("  P:%d I:%dn", (itemPos>>8),(itemPos&0xff));
  291. //printf("====================================nnn");
  292. return itemPos;
  293. }
  294. #endif
  295. //===================================================