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

DVD

开发平台:

C/C++

  1. /***************************************************************
  2. *  setup_get_pos.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. * setup menu navigator, 
  9. * locate new position in setup menu according to
  10. * 1. current position 
  11. * 2. moving direction (IR_cmd/user input)
  12. *
  13. ****************************************************************/
  14. void setup_GetPos(UINT8 direction);
  15. void setup_GetPosL0(UINT8 direction);
  16. void setup_GetPosL1(UINT8 direction);
  17. void setup_GetPosL2(UINT8 direction);
  18. void setup_GetPosL3(UINT8 direction);
  19. void setup_GetPosCUS(UINT8 direction); //for custm page
  20. void setup_GetPos(UINT8 direction)
  21. {
  22. //printf("setup_GetPos dir:%dn", direction);
  23. //record last position
  24. setup_last_pos[SETUP_ML0] = setup_pos[SETUP_ML0];
  25. setup_last_pos[SETUP_ML1] = setup_pos[SETUP_ML1];
  26. setup_last_pos[SETUP_ML2] = setup_pos[SETUP_ML2];
  27. setup_last_pos[SETUP_ML3] = setup_pos[SETUP_ML3];
  28. setup_VA2sel();
  29. if(full_scrn&CUSTM)
  30. {
  31. //printf("custm pagen");
  32. setup_GetPosCUS(direction);
  33. }
  34. else
  35. {
  36. switch(setup_pos[SETUP_ML0]) //switch by setup_level
  37. {
  38. case SETUP_ML0:
  39. setup_GetPosL0(direction);
  40. break;
  41. case SETUP_ML1:
  42. setup_GetPosL1(direction);
  43. break;
  44. case SETUP_ML2:
  45. setup_GetPosL2(direction);
  46. break;
  47. case SETUP_ML3:
  48. setup_GetPosL3(direction);
  49. break;
  50. }
  51. }
  52. //page = setup_pos[setup_L1];
  53. //printf("nn================================n");
  54. //printf("direction:%d setup_level:%d last_level:%dn", direction, setup_pos[0], setup_last_pos[0]);
  55. //printf("setup_last_pos %d %d %dn", setup_last_pos[1], setup_last_pos[2], setup_last_pos[3]);
  56. //printf("setup_pos %d %d %dnn", setup_pos[1], setup_pos[2], setup_pos[3]);
  57. //printf("==================================nn");
  58. //show setup page via OSD
  59. if(setup_pos[0] != 0) {
  60. setup_ShowPage();
  61. //run_save_sel_cmd(setup_pos[1], setup_pos[2]);
  62. }
  63. }//end of setup_GetPos
  64. //======================================================================
  65. void setup_GetPosL0(UINT8 direction)
  66. {
  67. switch(direction)
  68. {
  69. case SETUP_ENTER:
  70. setup_mLevel = SETUP_ML1;
  71. setup_pos[SETUP_ML0] = setup_mLevel; 
  72. setup_pos[SETUP_ML1] = 0;
  73. setup_pos[SETUP_ML2] = 0;//MAX_PAGE_ITEM;
  74. setup_pos[SETUP_ML3] = 0;
  75. break;
  76. case SETUP_UP:
  77. case SETUP_DOWN:
  78. case SETUP_LEFT:
  79. case SETUP_RIGHT:
  80. case SETUP_SELECTION:
  81. break;
  82. }
  83. }
  84. //======================================================================
  85. void setup_GetPosL1(UINT8 direction)
  86. {
  87. UINT8 itemType, iDo;
  88. switch(direction)
  89. {
  90. case SETUP_ENTER:
  91. setup_mLevel = SETUP_ML0;
  92. setup_pos[SETUP_ML0] = setup_mLevel;
  93. setup_pos[SETUP_ML1] = 0;
  94. setup_pos[SETUP_ML2] = 0;
  95. setup_pos[SETUP_ML3] = 0;
  96. break;
  97. case SETUP_UP:
  98. setup_mLevel = SETUP_ML2;
  99. setup_pos[SETUP_ML2] = MAX_PAGE_ITEM;//-1;
  100. do
  101. {
  102. itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
  103. if(((itemType == SET_NE)||(itemType == SET_SPACE))&&(setup_pos[SETUP_ML2] > 0))
  104. {
  105. setup_pos[SETUP_ML2]--;
  106. iDo = 1;
  107. }
  108. else
  109. {
  110. iDo = 0;
  111. }
  112. }while(iDo);
  113. if(setup_pos[SETUP_ML2] == 0){
  114. setup_mLevel = SETUP_ML1;
  115. }
  116. setup_pos[SETUP_ML0] = setup_mLevel;
  117. break;
  118. case SETUP_DOWN:
  119. setup_mLevel = SETUP_ML2;
  120. setup_pos[SETUP_ML2] = 1;
  121. do
  122. {
  123. itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
  124. if(((itemType == SET_NE)||(itemType == SET_SPACE))&&(setup_pos[SETUP_ML2] <= MAX_PAGE_ITEM))
  125. {
  126. setup_pos[SETUP_ML2]++;
  127. iDo = 1;
  128. }
  129. else
  130. {
  131. iDo = 0;
  132. }
  133. } while(iDo);
  134. if(setup_pos[SETUP_ML2] > MAX_PAGE_ITEM){
  135. setup_mLevel = SETUP_ML1;
  136. setup_pos[SETUP_ML2] = 0;
  137. }
  138. setup_pos[SETUP_ML0] = setup_mLevel;
  139. break;
  140. case SETUP_LEFT:
  141. if(setup_pos[SETUP_ML1]>=setup_max_icon)
  142. {
  143. setup_pos[SETUP_ML1] = setup_item[setup_pos[1]][0][2];
  144. }
  145. if(setup_pos[SETUP_ML1] == 0)
  146. {
  147. setup_pos[SETUP_ML1] = setup_max_icon;
  148. }
  149. setup_pos[SETUP_ML1] --;
  150. break;
  151. case SETUP_RIGHT:
  152. if(setup_pos[SETUP_ML1]>=setup_max_icon)
  153. {
  154. setup_pos[SETUP_ML1] = setup_item[setup_pos[1]][0][2];
  155. }
  156. setup_pos[SETUP_ML1]++;
  157. if(setup_pos[SETUP_ML1] == setup_max_icon)
  158. {
  159. setup_pos[SETUP_ML1] = 0;
  160. }
  161. break;
  162. case SETUP_SELECTION:
  163. break;
  164. }
  165. }
  166. //======================================================================
  167. void setup_GetPosL2(UINT8 direction)
  168. {
  169. UINT8 itemType, iDo;
  170. switch(direction)
  171. {
  172. case SETUP_ENTER:
  173. setup_mLevel = SETUP_ML0;
  174. setup_pos[SETUP_ML0] = setup_mLevel;
  175. setup_pos[SETUP_ML1] = 0;
  176. setup_pos[SETUP_ML2] = 0;
  177. setup_pos[SETUP_ML3] = 0;
  178. break;
  179. case SETUP_UP:
  180. setup_pos[SETUP_ML2]--;
  181. do
  182. {
  183. itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
  184. if(((itemType == SET_NE)||(itemType == SET_SPACE)) && (setup_pos[SETUP_ML2] > 0))
  185. {
  186. setup_pos[SETUP_ML2]--;
  187. iDo = 1;
  188. }
  189. else
  190. {
  191. iDo = 0;
  192. }
  193. }while(iDo);
  194. if(setup_pos[SETUP_ML2] == 0){
  195. setup_mLevel = SETUP_ML1;
  196. }
  197. setup_pos[SETUP_ML0] = setup_mLevel;
  198. break;
  199. case SETUP_DOWN:
  200. setup_pos[SETUP_ML2]++;
  201. do
  202. {
  203. itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
  204. if(((itemType == SET_NE)||(itemType == SET_SPACE)) && (setup_pos[SETUP_ML2] <= MAX_PAGE_ITEM))
  205. {
  206. setup_pos[SETUP_ML2]++;
  207. iDo = 1;
  208. }
  209. else
  210. {
  211. iDo = 0;
  212. }
  213. }while(iDo);
  214. if(setup_pos[SETUP_ML2] > MAX_PAGE_ITEM)
  215. {
  216. setup_mLevel = SETUP_ML1;
  217. setup_pos[SETUP_ML2] = 0;
  218. }
  219. setup_pos[SETUP_ML0] = setup_mLevel;
  220. break;
  221. case SETUP_LEFT:
  222. break;
  223. case SETUP_RIGHT:
  224. itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
  225. switch(itemType)
  226. {
  227. case SET_FUNC: 
  228. id = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][1];
  229. if((id == STR_OS_RATING) && (UserSet.parental_ststus == C_LOCK))
  230. {}
  231. else
  232. {
  233. setup_mLevel = SETUP_ML3;
  234. setup_pos[SETUP_ML3] = setup_sel[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]];
  235. setup_pos[SETUP_ML0] = setup_mLevel;
  236. }
  237. break;
  238. case SET_SCALE:
  239. case SET_NM:
  240. reset_passwd_cnt();
  241. setup_mLevel = SETUP_ML3;
  242. setup_pos[SETUP_ML3] = setup_sel[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]];
  243. setup_pos[SETUP_ML0] = setup_mLevel;
  244. break;
  245. }
  246. break;
  247. case SETUP_SELECTION:
  248. itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
  249. switch(itemType)
  250. {
  251. case SET_FUNC: 
  252. id = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][1];
  253. if((id == STR_OS_RATING) && (UserSet.parental_ststus == C_LOCK))
  254. {}
  255. else
  256. {
  257. setup_mLevel = SETUP_ML3;
  258. setup_pos[SETUP_ML3] = setup_sel[setup_pos[1]][setup_pos[2]];
  259. setup_pos[SETUP_ML0] = setup_mLevel;
  260. }
  261. break;
  262. case SET_SCALE:
  263. case SET_NM:
  264. setup_mLevel = SETUP_ML3;
  265. setup_pos[SETUP_ML3] = setup_sel[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]];
  266. setup_pos[SETUP_ML0] = setup_mLevel;
  267. break;
  268. case SET_SH:
  269. if(setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][1] == STR_OS_EXIT_MENU)
  270. {
  271. setup_ExitPage();
  272. }
  273. break;
  274. case SET_LINK:
  275. setup_mLevel = SETUP_ML1;
  276. setup_pos[SETUP_ML0] = setup_mLevel;
  277. setup_pos[SETUP_ML1] = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][2];
  278. setup_pos[SETUP_ML2] = 0;
  279. setup_pos[SETUP_ML3] = 0;
  280. break;
  281. }
  282. break;
  283. }
  284. }
  285. //======================================================================
  286. void setup_GetPosL3(UINT8 direction)
  287. {
  288. UINT8 itemType;
  289. switch(direction)
  290. {
  291. case SETUP_ENTER:
  292. setup_mLevel = SETUP_ML0;
  293. setup_pos[SETUP_ML0] = setup_mLevel;
  294. setup_pos[SETUP_ML1] = 0;
  295. setup_pos[SETUP_ML2] = 0;
  296. setup_pos[SETUP_ML3] = 0;
  297. break;
  298. case SETUP_UP:
  299. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  300. switch(itemType)
  301. {
  302. case SET_FUNC:
  303. if(setup_pos[SETUP_ML3] > MIN_ITEM_SEL)
  304. {
  305. setup_pos[SETUP_ML3]--;
  306. }
  307. break;
  308. case SET_SCALE:
  309. if(setup_pos[SETUP_ML3] < (setup_item[setup_pos[1]][setup_pos[2]][4]+2))
  310. {
  311. setup_pos[SETUP_ML3]++;
  312. setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
  313. setup_execFunc();
  314. setup_saveVal();
  315. }
  316. break;
  317. }
  318. break;
  319. case SETUP_DOWN:
  320. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  321. switch(itemType)
  322. {
  323. case SET_FUNC:
  324. if(setup_pos[SETUP_ML3] < MAX_ITEM_SEL)
  325. {
  326. if(setup_item[setup_pos[1]][setup_pos[2]][setup_pos[3]+1] != 0)
  327. {
  328. setup_pos[SETUP_ML3]++;
  329. }
  330. }
  331. break;
  332. case SET_SCALE:
  333. if(setup_pos[SETUP_ML3] > (setup_item[setup_pos[1]][setup_pos[2]][3]+2))
  334. {
  335. setup_pos[SETUP_ML3]--;
  336. setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
  337. setup_execFunc();
  338. setup_saveVal();
  339. }
  340. break;
  341. }
  342. break;
  343. case SETUP_LEFT:
  344. setup_mLevel = SETUP_ML2;
  345. setup_pos[SETUP_ML0] = setup_mLevel;
  346. setup_pos[SETUP_ML3] = 0;
  347. break;
  348. case SETUP_RIGHT:
  349. break;
  350. case SETUP_SELECTION:
  351. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  352. switch(itemType)
  353. {
  354. case SET_FUNC:
  355. id = setup_item[setup_pos[1]][setup_pos[2]][1];
  356. if(id==STR_OS_DEFAULT_SETUP){
  357. set_default_value();
  358. run_set_variable();
  359. run_save_total_sel();
  360. ShowSetupPage(1);//refresh Setup Menu
  361. }else{
  362. BYTE VA;
  363. setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
  364. VA = setup_item[setup_pos[1]][setup_pos[2]][MAX_ITEM_SEL+1];
  365. setup_VA[VA] = setup_sel[setup_pos[1]][setup_pos[2]];
  366. setup_execFunc();
  367. setup_saveVal();
  368. }
  369. break;
  370. case SET_SCALE:
  371. break;
  372. case SET_NM:
  373. setup_checkPassword();
  374. setup_saveVal();
  375. break;
  376. }
  377. // go back to item level(setup_L2)
  378. setup_mLevel = SETUP_ML2;
  379. setup_pos[SETUP_ML0] = setup_mLevel;
  380. setup_pos[SETUP_ML3] = 0;
  381. break;
  382. }
  383. }
  384. //======================================================================
  385. // this function is for CUSTM page only, can be move to another file
  386. void setup_GetPosCUS(UINT8 direction)
  387. {
  388. UINT8 itemType;
  389. switch(setup_pos[0])
  390. {
  391. case SETUP_ML0:
  392. setup_mLevel = SETUP_ML2;
  393. setup_pos[SETUP_ML0] = setup_mLevel; 
  394. setup_pos[SETUP_ML1] = MAX_SETUP_PAGE;
  395. setup_pos[SETUP_ML2] = 3;
  396. setup_pos[SETUP_ML3] = 0;
  397. setup_last_pos[SETUP_ML2] = MAX_PAGE_ITEM;
  398. break;
  399. case SETUP_ML2:
  400. switch(direction)
  401. {
  402. case SETUP_ENTER:
  403. setup_mLevel = SETUP_ML0;
  404. setup_pos[SETUP_ML0] = setup_mLevel;
  405. setup_pos[SETUP_ML1] = 0;
  406. setup_pos[SETUP_ML2] = MAX_PAGE_ITEM;
  407. setup_pos[SETUP_ML3] = 0;
  408. break;
  409. case SETUP_UP:
  410. if(setup_pos[2]>3)
  411. setup_pos[2]--;
  412. break;
  413. case SETUP_DOWN:
  414. if(setup_pos[2]<6)
  415. setup_pos[2]++;
  416. break;
  417. case SETUP_LEFT:
  418. break;
  419. case SETUP_RIGHT:
  420. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  421. switch(itemType)
  422. {
  423. case SET_FUNC: 
  424. case SET_NM:
  425. setup_mLevel = SETUP_ML3;
  426. setup_pos[SETUP_ML0] = setup_mLevel;
  427. setup_pos[SETUP_ML3] = setup_sel[setup_pos[1]][setup_pos[2]];
  428. break;
  429. }
  430. break;
  431. case SETUP_SELECTION:
  432. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  433. switch(itemType){
  434. case SET_FUNC:
  435. case SET_NM:
  436. setup_mLevel = SETUP_ML3;
  437. setup_pos[0] = setup_mLevel;
  438. setup_pos[SETUP_ML3] = setup_sel[setup_pos[1]][setup_pos[2]];
  439. break;
  440. case SET_SH:
  441. setup_ExitPage();
  442. break;
  443. }
  444. break;
  445. }
  446. break;
  447. case SETUP_ML3:
  448. switch(direction)
  449. {
  450. case SETUP_ENTER:
  451. setup_mLevel = SETUP_ML0;
  452. setup_pos[SETUP_ML0] = setup_mLevel;
  453. setup_pos[SETUP_ML1] = 0;
  454. setup_pos[SETUP_ML2] = MAX_PAGE_ITEM;
  455. setup_pos[SETUP_ML3] = 0;
  456. break;
  457. case SETUP_UP:
  458. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  459. switch(itemType)
  460. {
  461. case SET_FUNC:
  462. if(setup_pos[SETUP_ML3] > MIN_ITEM_SEL)
  463. setup_pos[SETUP_ML3]--;
  464. break;
  465. }
  466. break;
  467. case SETUP_DOWN:
  468. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  469. switch(itemType)
  470. {
  471. case SET_FUNC:
  472. if(setup_pos[SETUP_ML3] < MAX_ITEM_SEL)
  473. {
  474. if(setup_item[setup_pos[1]][setup_pos[2]][setup_pos[3]+1] != 0)
  475. setup_pos[SETUP_ML3]++;
  476. }
  477. break;
  478. }
  479. break;
  480. case SETUP_LEFT:
  481. setup_mLevel = SETUP_ML2;
  482. setup_pos[SETUP_ML0] = setup_mLevel;
  483. setup_pos[SETUP_ML3] = 0;
  484. break;
  485. case SETUP_RIGHT:
  486. break;
  487. case SETUP_SELECTION:
  488. itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
  489. switch(itemType)
  490. {
  491. case SET_FUNC:
  492. setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
  493. setup_execFunc();
  494. setup_saveVal();
  495. break;
  496. case SET_NM:
  497. break;
  498. }
  499. // go back to item level(setup_L2)
  500. setup_mLevel = SETUP_ML2;
  501. setup_pos[SETUP_ML0] = setup_mLevel;
  502. setup_pos[SETUP_ML3] = 0;
  503. break;
  504. }
  505. break;
  506. }
  507. }
  508. //======================================================================