setup_get_pos.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:13k
- /***************************************************************
- * setup_get_pos.c
- * include in setup_tab_ui1.c when defined DVD_SETUP_REENG
- *
- * Creator: JSLin
- * Date: 2004/07/28
- *
- * Description :
- * setup menu navigator,
- * locate new position in setup menu according to
- * 1. current position
- * 2. moving direction (IR_cmd/user input)
- *
- ****************************************************************/
- void setup_GetPos(UINT8 direction);
- void setup_GetPosL0(UINT8 direction);
- void setup_GetPosL1(UINT8 direction);
- void setup_GetPosL2(UINT8 direction);
- void setup_GetPosL3(UINT8 direction);
- void setup_GetPosCUS(UINT8 direction); //for custm page
- void setup_GetPos(UINT8 direction)
- {
- //printf("setup_GetPos dir:%dn", direction);
- //record last position
- setup_last_pos[SETUP_ML0] = setup_pos[SETUP_ML0];
- setup_last_pos[SETUP_ML1] = setup_pos[SETUP_ML1];
- setup_last_pos[SETUP_ML2] = setup_pos[SETUP_ML2];
- setup_last_pos[SETUP_ML3] = setup_pos[SETUP_ML3];
- setup_VA2sel();
- if(full_scrn&CUSTM)
- {
- //printf("custm pagen");
- setup_GetPosCUS(direction);
- }
- else
- {
- switch(setup_pos[SETUP_ML0]) //switch by setup_level
- {
- case SETUP_ML0:
- setup_GetPosL0(direction);
- break;
- case SETUP_ML1:
- setup_GetPosL1(direction);
- break;
- case SETUP_ML2:
- setup_GetPosL2(direction);
- break;
- case SETUP_ML3:
- setup_GetPosL3(direction);
- break;
- }
- }
-
- //page = setup_pos[setup_L1];
- //printf("nn================================n");
- //printf("direction:%d setup_level:%d last_level:%dn", direction, setup_pos[0], setup_last_pos[0]);
- //printf("setup_last_pos %d %d %dn", setup_last_pos[1], setup_last_pos[2], setup_last_pos[3]);
- //printf("setup_pos %d %d %dnn", setup_pos[1], setup_pos[2], setup_pos[3]);
- //printf("==================================nn");
-
- //show setup page via OSD
- if(setup_pos[0] != 0) {
- setup_ShowPage();
- //run_save_sel_cmd(setup_pos[1], setup_pos[2]);
- }
- }//end of setup_GetPos
- //======================================================================
- void setup_GetPosL0(UINT8 direction)
- {
- switch(direction)
- {
- case SETUP_ENTER:
- setup_mLevel = SETUP_ML1;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = 0;
- setup_pos[SETUP_ML2] = 0;//MAX_PAGE_ITEM;
- setup_pos[SETUP_ML3] = 0;
- break;
- case SETUP_UP:
- case SETUP_DOWN:
- case SETUP_LEFT:
- case SETUP_RIGHT:
- case SETUP_SELECTION:
- break;
- }
- }
- //======================================================================
- void setup_GetPosL1(UINT8 direction)
- {
- UINT8 itemType, iDo;
-
- switch(direction)
- {
- case SETUP_ENTER:
- setup_mLevel = SETUP_ML0;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = 0;
- setup_pos[SETUP_ML2] = 0;
- setup_pos[SETUP_ML3] = 0;
- break;
- case SETUP_UP:
- setup_mLevel = SETUP_ML2;
- setup_pos[SETUP_ML2] = MAX_PAGE_ITEM;//-1;
- do
- {
- itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
- if(((itemType == SET_NE)||(itemType == SET_SPACE))&&(setup_pos[SETUP_ML2] > 0))
- {
- setup_pos[SETUP_ML2]--;
- iDo = 1;
- }
- else
- {
- iDo = 0;
- }
- }while(iDo);
-
- if(setup_pos[SETUP_ML2] == 0){
- setup_mLevel = SETUP_ML1;
- }
- setup_pos[SETUP_ML0] = setup_mLevel;
- break;
- case SETUP_DOWN:
- setup_mLevel = SETUP_ML2;
- setup_pos[SETUP_ML2] = 1;
- do
- {
- itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
- if(((itemType == SET_NE)||(itemType == SET_SPACE))&&(setup_pos[SETUP_ML2] <= MAX_PAGE_ITEM))
- {
- setup_pos[SETUP_ML2]++;
- iDo = 1;
- }
- else
- {
- iDo = 0;
- }
- } while(iDo);
-
- if(setup_pos[SETUP_ML2] > MAX_PAGE_ITEM){
- setup_mLevel = SETUP_ML1;
- setup_pos[SETUP_ML2] = 0;
- }
- setup_pos[SETUP_ML0] = setup_mLevel;
- break;
- case SETUP_LEFT:
- if(setup_pos[SETUP_ML1]>=setup_max_icon)
- {
- setup_pos[SETUP_ML1] = setup_item[setup_pos[1]][0][2];
- }
- if(setup_pos[SETUP_ML1] == 0)
- {
- setup_pos[SETUP_ML1] = setup_max_icon;
- }
- setup_pos[SETUP_ML1] --;
- break;
- case SETUP_RIGHT:
- if(setup_pos[SETUP_ML1]>=setup_max_icon)
- {
- setup_pos[SETUP_ML1] = setup_item[setup_pos[1]][0][2];
- }
- setup_pos[SETUP_ML1]++;
- if(setup_pos[SETUP_ML1] == setup_max_icon)
- {
- setup_pos[SETUP_ML1] = 0;
- }
- break;
- case SETUP_SELECTION:
- break;
- }
- }
- //======================================================================
- void setup_GetPosL2(UINT8 direction)
- {
- UINT8 itemType, iDo;
-
- switch(direction)
- {
- case SETUP_ENTER:
- setup_mLevel = SETUP_ML0;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = 0;
- setup_pos[SETUP_ML2] = 0;
- setup_pos[SETUP_ML3] = 0;
- break;
-
- case SETUP_UP:
- setup_pos[SETUP_ML2]--;
- do
- {
- itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
- if(((itemType == SET_NE)||(itemType == SET_SPACE)) && (setup_pos[SETUP_ML2] > 0))
- {
- setup_pos[SETUP_ML2]--;
- iDo = 1;
- }
- else
- {
- iDo = 0;
- }
- }while(iDo);
- if(setup_pos[SETUP_ML2] == 0){
- setup_mLevel = SETUP_ML1;
- }
- setup_pos[SETUP_ML0] = setup_mLevel;
- break;
-
- case SETUP_DOWN:
- setup_pos[SETUP_ML2]++;
- do
- {
- itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
- if(((itemType == SET_NE)||(itemType == SET_SPACE)) && (setup_pos[SETUP_ML2] <= MAX_PAGE_ITEM))
- {
- setup_pos[SETUP_ML2]++;
- iDo = 1;
- }
- else
- {
- iDo = 0;
- }
- }while(iDo);
- if(setup_pos[SETUP_ML2] > MAX_PAGE_ITEM)
- {
- setup_mLevel = SETUP_ML1;
- setup_pos[SETUP_ML2] = 0;
- }
- setup_pos[SETUP_ML0] = setup_mLevel;
- break;
-
- case SETUP_LEFT:
- break;
-
- case SETUP_RIGHT:
- itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- id = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][1];
- if((id == STR_OS_RATING) && (UserSet.parental_ststus == C_LOCK))
- {}
- else
- {
- setup_mLevel = SETUP_ML3;
- setup_pos[SETUP_ML3] = setup_sel[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]];
- setup_pos[SETUP_ML0] = setup_mLevel;
- }
- break;
- case SET_SCALE:
- case SET_NM:
- reset_passwd_cnt();
- setup_mLevel = SETUP_ML3;
- setup_pos[SETUP_ML3] = setup_sel[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]];
- setup_pos[SETUP_ML0] = setup_mLevel;
- break;
- }
- break;
-
- case SETUP_SELECTION:
- itemType = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- id = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][1];
- if((id == STR_OS_RATING) && (UserSet.parental_ststus == C_LOCK))
- {}
- else
- {
- setup_mLevel = SETUP_ML3;
- setup_pos[SETUP_ML3] = setup_sel[setup_pos[1]][setup_pos[2]];
- setup_pos[SETUP_ML0] = setup_mLevel;
- }
- break;
- case SET_SCALE:
- case SET_NM:
- setup_mLevel = SETUP_ML3;
- setup_pos[SETUP_ML3] = setup_sel[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]];
- setup_pos[SETUP_ML0] = setup_mLevel;
- break;
- case SET_SH:
- if(setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][1] == STR_OS_EXIT_MENU)
- {
- setup_ExitPage();
- }
- break;
- case SET_LINK:
- setup_mLevel = SETUP_ML1;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = setup_item[setup_pos[SETUP_ML1]][setup_pos[SETUP_ML2]][2];
- setup_pos[SETUP_ML2] = 0;
- setup_pos[SETUP_ML3] = 0;
- break;
- }
- break;
- }
- }
- //======================================================================
- void setup_GetPosL3(UINT8 direction)
- {
- UINT8 itemType;
-
- switch(direction)
- {
- case SETUP_ENTER:
- setup_mLevel = SETUP_ML0;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = 0;
- setup_pos[SETUP_ML2] = 0;
- setup_pos[SETUP_ML3] = 0;
- break;
- case SETUP_UP:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- if(setup_pos[SETUP_ML3] > MIN_ITEM_SEL)
- {
- setup_pos[SETUP_ML3]--;
- }
- break;
- case SET_SCALE:
- if(setup_pos[SETUP_ML3] < (setup_item[setup_pos[1]][setup_pos[2]][4]+2))
- {
- setup_pos[SETUP_ML3]++;
- setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
- setup_execFunc();
- setup_saveVal();
- }
- break;
- }
- break;
- case SETUP_DOWN:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- if(setup_pos[SETUP_ML3] < MAX_ITEM_SEL)
- {
- if(setup_item[setup_pos[1]][setup_pos[2]][setup_pos[3]+1] != 0)
- {
- setup_pos[SETUP_ML3]++;
- }
- }
- break;
- case SET_SCALE:
- if(setup_pos[SETUP_ML3] > (setup_item[setup_pos[1]][setup_pos[2]][3]+2))
- {
- setup_pos[SETUP_ML3]--;
- setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
- setup_execFunc();
- setup_saveVal();
- }
- break;
- }
- break;
- case SETUP_LEFT:
- setup_mLevel = SETUP_ML2;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML3] = 0;
- break;
- case SETUP_RIGHT:
- break;
- case SETUP_SELECTION:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- id = setup_item[setup_pos[1]][setup_pos[2]][1];
- if(id==STR_OS_DEFAULT_SETUP){
- set_default_value();
- run_set_variable();
- run_save_total_sel();
- ShowSetupPage(1);//refresh Setup Menu
- }else{
- BYTE VA;
- setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
- VA = setup_item[setup_pos[1]][setup_pos[2]][MAX_ITEM_SEL+1];
- setup_VA[VA] = setup_sel[setup_pos[1]][setup_pos[2]];
- setup_execFunc();
- setup_saveVal();
- }
- break;
- case SET_SCALE:
- break;
- case SET_NM:
- setup_checkPassword();
- setup_saveVal();
- break;
- }
- // go back to item level(setup_L2)
- setup_mLevel = SETUP_ML2;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML3] = 0;
- break;
- }
- }
- //======================================================================
- // this function is for CUSTM page only, can be move to another file
- void setup_GetPosCUS(UINT8 direction)
- {
- UINT8 itemType;
-
- switch(setup_pos[0])
- {
- case SETUP_ML0:
- setup_mLevel = SETUP_ML2;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = MAX_SETUP_PAGE;
- setup_pos[SETUP_ML2] = 3;
- setup_pos[SETUP_ML3] = 0;
- setup_last_pos[SETUP_ML2] = MAX_PAGE_ITEM;
- break;
- case SETUP_ML2:
- switch(direction)
- {
- case SETUP_ENTER:
- setup_mLevel = SETUP_ML0;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = 0;
- setup_pos[SETUP_ML2] = MAX_PAGE_ITEM;
- setup_pos[SETUP_ML3] = 0;
- break;
- case SETUP_UP:
- if(setup_pos[2]>3)
- setup_pos[2]--;
- break;
- case SETUP_DOWN:
- if(setup_pos[2]<6)
- setup_pos[2]++;
- break;
- case SETUP_LEFT:
- break;
- case SETUP_RIGHT:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- case SET_NM:
- setup_mLevel = SETUP_ML3;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML3] = setup_sel[setup_pos[1]][setup_pos[2]];
- break;
- }
- break;
- case SETUP_SELECTION:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType){
- case SET_FUNC:
- case SET_NM:
- setup_mLevel = SETUP_ML3;
- setup_pos[0] = setup_mLevel;
- setup_pos[SETUP_ML3] = setup_sel[setup_pos[1]][setup_pos[2]];
- break;
- case SET_SH:
- setup_ExitPage();
- break;
- }
- break;
- }
- break;
- case SETUP_ML3:
- switch(direction)
- {
- case SETUP_ENTER:
- setup_mLevel = SETUP_ML0;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML1] = 0;
- setup_pos[SETUP_ML2] = MAX_PAGE_ITEM;
- setup_pos[SETUP_ML3] = 0;
- break;
- case SETUP_UP:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- if(setup_pos[SETUP_ML3] > MIN_ITEM_SEL)
- setup_pos[SETUP_ML3]--;
- break;
- }
- break;
- case SETUP_DOWN:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- if(setup_pos[SETUP_ML3] < MAX_ITEM_SEL)
- {
- if(setup_item[setup_pos[1]][setup_pos[2]][setup_pos[3]+1] != 0)
- setup_pos[SETUP_ML3]++;
- }
- break;
- }
- break;
- case SETUP_LEFT:
- setup_mLevel = SETUP_ML2;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML3] = 0;
- break;
- case SETUP_RIGHT:
- break;
- case SETUP_SELECTION:
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- switch(itemType)
- {
- case SET_FUNC:
- setup_sel[setup_pos[1]][setup_pos[2]] = setup_pos[3];
- setup_execFunc();
- setup_saveVal();
- break;
- case SET_NM:
- break;
- }
- // go back to item level(setup_L2)
- setup_mLevel = SETUP_ML2;
- setup_pos[SETUP_ML0] = setup_mLevel;
- setup_pos[SETUP_ML3] = 0;
- break;
- }
- break;
- }
- }
- //======================================================================