setup_ui_util.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:9k
- /***************************************************************
- * setup_ui_util.c
- * include in setup_tab_ui1.c when defined DVD_SETUP_REENG
- *
- * Creator: JSLin
- * Date: 2004/07/28
- *
- * Description :
- * function dispatcher ???
- *
- ****************************************************************/
- #ifndef _SETUP_UI_UTIL
- #define _SETUP_UI_UTIL
- void setup_saveVal(void);
- void setup_execFunc(void);
- void setup_execScaleFunc(void);
- void setup_setPasswd(void);
- void setup_showPasswd(BYTE num);
- void setup_checkPassword(void);
- void setup_VA2sel(void);
- void setup_sel2VA(void);
- UINT32 setup_getSelPos(UINT8 selection);
- UINT16 setup_getItemPos(UINT8 item);
- //==================================================
- #ifdef OSD_COLOR_ADJUST_BY_BRIGHTNESS_AND_CONTRAST // 2004/11/12 yltseng
- void UpdateSetupmenuPalette()
- {
- extern void osd_update_setupmenu_palette();
- osd_update_setupmenu_palette();
- }
- #else
- #define UpdateSetupmenuPalette()
- #endif
- void setup_saveVal(void)
- {
- BYTE VA;
- printf(">>>>>setup_saveVal<<<<<n");
- VA = setup_item[setup_pos[1]][setup_pos[2]][MAX_ITEM_SEL+1];
- setup_VA[VA] = setup_sel[setup_pos[1]][setup_pos[2]];
- run_save_sel_cmd(setup_VA[VA], VA);
- /*
- // for CUSTM page saving corresponding valus
- if(full_scrn&CUSTM){
- int p1, p2;
- for (p1=0; p1<MAX_SETUP_PAGE; p1++){
- for (p2=0; p2<MAX_PAGE_ITEM; p2++){
- if(setup_item[p1][p2][1]==setup_item[setup_pos[1]][setup_pos[2]][1]){
- setup_sel[p1][p2] = setup_sel[setup_pos[1]][setup_pos[2]];
- //run_save_sel_cmd(p1, p2);
- }
- }
- }
- }//end of if(full_scrn&CUSTM)
- */
- }
- //===================================================
- void setup_execFunc(void)
- {
- UINT8 itemType;
- itemType = setup_item[setup_pos[1]][setup_pos[2]][0];
- if(itemType == SET_SCALE){
- setup_execScaleFunc();
- } else if(itemType == SET_FUNC){
- printf("nn exe_setup_function n");
- exe_setup_function(setup_item[setup_pos[1]][setup_pos[2]][1], setup_item[setup_pos[1]][setup_pos[2]][setup_pos[3]], 1);
- }
- }
- //===================================================
- void setup_execScaleFunc(void)
- {
- UINT32 funcID;
- printf("nn setup_execScaleFuncn");
- funcID = setup_item[setup_pos[1]][setup_pos[2]][1];
- switch(funcID){
- case STR_OS_BRIGHTNESS:
- SetBrightness(setup_pos[3]-MIN_ITEM_SEL);
- UpdateSetupmenuPalette(); // 2004/11/12 yltseng
- break;
- case STR_OS_CONTRAST:
- SetContrast(setup_pos[3]-MIN_ITEM_SEL);
- UpdateSetupmenuPalette(); // 2004/11/12 yltseng
- break;
- case STR_OS_HUE:
- SetHUE(setup_pos[3]-MIN_ITEM_SEL);
- break;
- case STR_OS_SATURATION:
- SetSaturation(setup_pos[3]-MIN_ITEM_SEL);
- break;
- case STR_OS_KEY:
- audio_key = setup_pos[3]-MIN_ITEM_SEL-6;
- AUDIF_Set_Key(setup_pos[3]);//2004AUDDRV AudioSetKey(setup_pos[3]);
- //printf("nn>>>> audio_key:%dn", audio_key);
- break;
- case STR_OS_ECHO:
- echo_level=setup_pos[3]-MIN_ITEM_SEL;
- #ifdef USE_MIC_ECHO_PARAM
- AUDIF_Set_EchoPara(setup_pos[3]-MIN_ITEM_SEL);//2004AUDDRV AudioSetEchoPara(setup_pos[3]-MIN_ITEM_SEL);
- #else
- 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);
- #endif
- break;
- case STR_OS_MIC_VOL:
- case STR_OS_MIC_VOL_1:
- mic_volume=setup_pos[3]-MIN_ITEM_SEL;
- AUDIF_Set_MICVol(setup_pos[3]-MIN_ITEM_SEL);//2004AUDDRV AudioSetMICVol(setup_pos[3]-MIN_ITEM_SEL);
- break;
- case STR_OS_MIC_VOL_2:
- mic_volume=setup_pos[3]-MIN_ITEM_SEL;
- AUDIF_Set_MICVol2(setup_pos[3]-MIN_ITEM_SEL);//2004AUDDRV AudioSetMICVol_2(setup_pos[3]-MIN_ITEM_SEL);
- break;
- case STR_OS_CSPK_DELAY:
- AUDIF_Set_SpkDelay(1, setup_pos[3]-2);//2004AUDDRV AudioSetSpkDelay(1, setup_pos[3]-2);
- break;
- case STR_OS_SSPK_DELAY:
- AUDIF_Set_SpkDelay(2, (setup_pos[3]-2)*3);//2004AUDDRV AudioSetSpkDelay(2, (setup_pos[3]-2)*3);
- break;
- case STR_OS_DYNAMICRANGE: //inconsistent
- ac3_dynarange=setup_pos[3]-MIN_ITEM_SEL;
- set_AC3DynamicRange();
- break;
- }
- }
- //===================================================
- void setup_setPasswd(void)
- {
- if(setup_pos[0] != SETUP_ML3) return;
-
- if(ir_select_number >= 10) return;
-
- if(setup_item[setup_pos[1]][setup_pos[2]][0] == SET_NM)
- {
- id=setup_item[setup_pos[1]][setup_pos[2]][1];
- if(digit_cnt>=PASSWORD_LENGTH)
- digit_cnt=0;
- digit_cnt++;
-
- setup_showPasswd(ir_select_number);
- }
- }
- //===================================================
- void setup_showPasswd(BYTE num)
- {
- UINT8 i;
- //BYTE yStart;
- BYTE buf[40];
- #define CH_STAR 0x58//X //jhuang pending
- #define CH_DASH 0x2d//-
- #define CH_SPACE 0x20
- #define CH_LOCK 0xff
- #define CH_UNLOCK 0x67
- if(num == CLREAR_PASSWD) {
- reset_passwd_cnt();
- }
- #ifdef SETUP_6_DIGIT_PASSWORD
- tmp_passwd=(tmp_passwd*10+num)%1000000;
- #else
- tmp_passwd=(tmp_passwd*10+num)%10000;
- #endif
- // fill char
- for(i=1;i<=digit_cnt;i++)
- linebuf[i-1] = CH_STAR;
- for(i=digit_cnt+1;i<=PASSWORD_LENGTH;i++)
- linebuf[i-1] = CH_DASH;
- linebuf[PASSWORD_LENGTH] = CH_SPACE;
- {
- if(UserSet.parental_ststus==C_LOCK)
- linebuf[PASSWORD_LENGTH+1] = CH_LOCK;
- else
- linebuf[PASSWORD_LENGTH+1] = CH_UNLOCK;
- }
- linebuf[PASSWORD_LENGTH+2] = 0;
- if(full_scrn&CUSTM)
- {
- UserSet.parent_passwd = tmp_passwd;
- #ifdef SETUP_6_DIGIT_PASSWORD
- psprintf(buf, "%06d", UserSet.parent_passwd);
- #else
- psprintf(buf, "%04d", UserSet.parent_passwd);
- #endif
- }
- else
- {
- psprintf(buf,"%s",linebuf);
- }
- osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+setup_pos[2], buf, setupFcolorSM, setupBGcolorSM);
- }
- //===================================================
- void setup_checkPassword(void)
- {
- printf("setup_checkPassword mark 1, tmp_passwd:%d", tmp_passwd);
- if(digit_cnt == PASSWORD_LENGTH)
- {
- if(UserSet.parental_ststus == C_LOCK)
- {
- if((tmp_passwd == UserSet.parent_passwd)
- #ifdef USER_SUPER_PASSWORD
- ||(tmp_passwd == USER_SUPER_PASSWORD)
- #endif
- )
- {
- UserSet.parental_ststus = C_UNLOCK;
- setup_sel[setup_pos[1]][setup_pos[2]] = 3;
- }
- }
- else if(UserSet.parental_ststus == C_UNLOCK)
- {
- UserSet.parent_passwd = tmp_passwd;
- UserSet.parental_ststus = C_LOCK;
- setup_sel[setup_pos[1]][setup_pos[2]] = 2;
- }
- }
- reset_passwd_cnt();
- }
- //===================================================
- void setup_VA2sel(void)
- {
- int i, j, VA;
- printf("setup_VA[] >>> setup_set[][]n");
-
- for(i=0; i<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); i++)
- {
- for(j=1; j<=MAX_PAGE_ITEM; j++)
- {
- VA = setup_item[i][j][MAX_ITEM_SEL+1];
- if(VA < MAX_SETUP_VA)
- {
- setup_sel[i][j] = setup_VA[VA];
- }
- }
- }
- }
- //===================================================
- void setup_sel2VA(void)
- {
- int i, j, VA;
- printf("setup_VA[] <<< setup_set[][]n");
-
- for(i=0; i<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); i++)
- {
- for(j=1; j<=MAX_PAGE_ITEM; j++)
- {
- VA = setup_item[i][j][MAX_ITEM_SEL+1];
- if(VA < MAX_SETUP_VA)
- {
- setup_VA[VA] = setup_sel[i][j];
- }
- }
- }
- }
- //===================================================
- UINT32 setup_getSelPos(UINT8 selection)
- {
- UINT32 selPos;
- UINT8 P, I, S;
- selPos= 0xffffff;
- for(P=0; P<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); P++)
- {
- for(I=1; I<=MAX_PAGE_ITEM; I++)
- {
- for(S=2; S<MAX_ITEM_SEL; S++){
- if(selection == setup_item[P][I][S])
- {
- selPos = (P<<16)+(I<<8)+S;
- break;
- }
- }
- if(selPos!=0xffffff) {break;}
- }
- if(selPos!=0xffffff) {break;}
- }
- //printf("nn====================================n");
- //printf(" P:%d I:%d S:%dn", (selPos>>16), ((selPos>>8)&0xff), (selPos&0xff));
- //printf("====================================nnn");
-
- return selPos;
- }
- //===================================================
- UINT16 setup_getItemPos(UINT8 item)
- {
- UINT16 itemPos;
- UINT8 P, I;
- itemPos= 0xffff;
- for(P=0; P<(MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE); P++)
- {
- for(I=1; I<=MAX_PAGE_ITEM; I++)
- {
- if(item == setup_item[P][I][1])
- {
- itemPos = (P<<8)+I;
- break;
- }
- }
- if(itemPos!=0xffff) {break;}
- }
- //printf("nn====================================n");
- //printf(" P:%d I:%dn", (itemPos>>8),(itemPos&0xff));
- //printf("====================================nnn");
-
- return itemPos;
- }
- #endif
- //===================================================