setup_OSD_util.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:9k
- /***************************************************************
- * setup_OSD_util.c
- * include in setup_tab_ui1.c when defined DVD_SETUP_REENG
- *
- * Creator: JSLin
- * Date: 2004/07/28
- *
- * Description :
- * adapterr,
- * hookup presentation engine(setup_show_page.c) with OSD module
- *
- ****************************************************************/
- /*
- * setup_item = setup_button + setup_string
- */
- void setup_draw_item(BYTE xStart, BYTE yStart, BYTE xLen, BYTE itemID, BYTE itemType)//BYTE xOffset, BYTE fColor, BYTE bgColor, BYTE upDown, BYTE itemID)
- {
- const char *str;
- BYTE xOffset = 0;
- BYTE upDown = 0;
- BYTE fColor = 0;
- BYTE bgColor = 0;
- //printf(">>>>> draw item ID:%dn", itemID);
- switch(itemType){
- case SETUP_itemNormal:
- xOffset = 1;
- upDown = 0;
- if(xStart==SETUP_MENU_XSTART)
- {
- fColor = setupFcolorIN;
- bgColor = setupBGcolorIN;
- }
- else if(xStart==SETUP_SUB_XSTART)
- {
- fColor = setupFcolorSN;
- bgColor = setupBGcolorSN;
- }
- break;
- case SETUP_itemMark:
- xOffset = 1;
- upDown = 1;
- if(xStart==SETUP_MENU_XSTART)
- {
- fColor = setupFcolorIM;
- bgColor = setupBGcolorIM;
- }
- else if(xStart==SETUP_SUB_XSTART)
- {
- fColor = setupFcolorSM;
- bgColor = setupBGcolorSM;
- }
- break;
- case SETUP_itemSelected:
- xOffset = 1;
- upDown = 0;
- if(xStart==SETUP_MENU_XSTART)
- {
- fColor = setupFcolorIS;
- bgColor = setupBGcolorIS;
- }
- else if(xStart==SETUP_SUB_XSTART)
- {
- fColor = setupFcolorSS;
- bgColor = setupBGcolorSS;
- }
- break;
- }
-
- osd_draw_setup_button(xStart,yStart,xLen, bgColor, upDown);
- if((setup_item[setup_pos[SETUP_ML1]][0][1] == STR_OS_LANG_SETUP) && (xStart == SETUP_SUB_XSTART))
- {
- if (itemID==STR_OS_OFF)
- str = _OsdMessegeFont1[osd_font_mode][itemID];
- else
- str = lang_names[osd_font_mode][itemID];
- }
- else
- {
- str = _OsdMessegeFont1[osd_font_mode][itemID];
- }
-
- osd_DrawString(xStart+xOffset, yStart, str, fColor, bgColor);
-
- }
- void setup_DrawScaleString(UINT8 id, BYTE fontColor, BYTE bgColor)
- {
- UINT8 xString, yString;
- t_osd_str osdstr_scale[MAX_ITEM_SEL - MIN_ITEM_SEL];
- int i;
- xString = SETUP_SUB_XSTART+1;
- yString = SETUP_MENU_YSTART + setup_item[setup_pos[1]][setup_pos[2]][MAX_ITEM_SEL];
- for (i=0; i<(MAX_ITEM_SEL - MIN_ITEM_SEL); i++)
- {
- osdstr_scale[i].xst = xString;
- osdstr_scale[i].yst = yString+i+1;
- osdstr_scale[i].str = NULL;
- }
- if (id==STR_OS_ECHO) {
- osdstr_scale[0].str = " - - 8";
- osdstr_scale[1].str = " - - 6";
- osdstr_scale[2].str = " - - 4";
- osdstr_scale[3].str = " - - 2";
- osdstr_scale[4].str = " - - OFF";
- }
- else if (id==STR_OS_BRIGHTNESS){
- osdstr_scale[0].str = " - - 12";
- osdstr_scale[1].str = " - - 10";
- osdstr_scale[2].str = " - - 8";
- osdstr_scale[3].str = " - - 6";
- osdstr_scale[4].str = " - - 4";
- osdstr_scale[5].str = " - - 2";
- osdstr_scale[6].str = " - - 0";
- }
- else if (id==STR_OS_CONTRAST){
- osdstr_scale[0].str = " - - 12";
- osdstr_scale[1].str = " - - 10";
- osdstr_scale[2].str = " - - 8";
- osdstr_scale[3].str = " - - 6";
- osdstr_scale[4].str = " - - 4";
- osdstr_scale[5].str = " - - 2";
- osdstr_scale[6].str = " - - 0";
- }
- else if (id==STR_OS_HUE){
- osdstr_scale[0].str = " - - +6";
- osdstr_scale[1].str = " - - +4";
- osdstr_scale[2].str = " - - +2";
- osdstr_scale[3].str = " - - 0";
- osdstr_scale[4].str = " - - -2";
- osdstr_scale[5].str = " - - -4";
- osdstr_scale[6].str = " - - -6";
- }
- else if (id==STR_OS_SATURATION){
- osdstr_scale[0].str = " - - 12";
- osdstr_scale[1].str = " - - 10";
- osdstr_scale[2].str = " - - 8";
- osdstr_scale[3].str = " - - 6";
- osdstr_scale[4].str = " - - 4";
- osdstr_scale[5].str = " - - 2";
- osdstr_scale[6].str = " - - 0";
- }
- else if (id==STR_OS_KEY) {
- osdstr_scale[0].str = " - - " Ch_ukey;
- osdstr_scale[1].str = " - - +4";
- osdstr_scale[2].str = " - - +2";
- osdstr_scale[3].str = " - - 0";
- osdstr_scale[4].str = " - - -2";
- osdstr_scale[5].str = " - - -4";
- osdstr_scale[6].str = " - - " Ch_dkey;
- }
- else if (id==STR_OS_DYNAMICRANGE) {
- osdstr_scale[0].str = " - - FULL";
- osdstr_scale[1].str = " - - 6/8";
- osdstr_scale[2].str = " - - 4/8";
- osdstr_scale[3].str = " - - 2/8";
- osdstr_scale[4].str = " - - OFF";
- }
- else if (id==STR_OS_MIC_VOL) {
- osdstr_scale[0].str = " - - 8";
- osdstr_scale[1].str = " - - 6";
- osdstr_scale[2].str = " - - 4";
- osdstr_scale[3].str = " - - 2";
- osdstr_scale[4].str = " - - OFF";
- }
- else if (id==STR_OS_CSPK_DELAY) {
- osdstr_scale[0].str = " - - +";
- osdstr_scale[1].str = " - - 4 MS";
- osdstr_scale[2].str = " - - 2 MS";
- osdstr_scale[3].str = " - - 0 MS";
- }
- else if (id==STR_OS_SSPK_DELAY) {
- osdstr_scale[0].str = " - - +";
- osdstr_scale[1].str = " - - 12 MS";
- osdstr_scale[2].str = " - - 6 MS";
- osdstr_scale[3].str = " - - 0 MS";
- }
- else { //show ERROR
- osdstr_scale[0].str = " ERROR";
- }
- osd_DrawStrings(osdstr_scale, fontColor, bgColor);
- }
- void setup_DrawScaleForm(UINT8 id, BYTE upDown)
- {
- BYTE eColorTL, eColorBR;
- BYTE fontColor, bgColor; //font, background color
- UINT32 xStart, yStart;
- UINT32 yDelta=0;
- UINT32 yOffset = 0;
- //BYTE buf[15];
- BYTE xWidth;
- //int val = echo_level; // give a default value
-
- if (upDown) { //down
- eColorTL = setupEcolorSPTLD;
- eColorBR = setupEcolorSPBRD;
- fontColor = setupFcolorSSD;
- bgColor = setupBGcolorSPD;
- } else { //up
- eColorTL = setupEcolorSPTLU;
- eColorBR = setupEcolorSPBRU;
- fontColor = setupFcolorSSU;
- bgColor = setupBGcolorSPU;
- }
- xStart = SETUP_SUB_XSTART * 16;
- xWidth = 14 *16;
- yOffset = setup_item[setup_pos[1]][setup_pos[2]][MAX_ITEM_SEL];
- yStart = (yOffset+ SETUP_MENU_YSTART)*SETUP_BUTTON_HEIGHT+32;
- yDelta = setup_item[setup_pos[1]][setup_pos[2]][2] *SETUP_BUTTON_HEIGHT;
- osd_draw_rect(xStart, yStart, xWidth, yDelta, bgColor);
- //show the string in scale form
- setup_DrawScaleString(id, fontColor, bgColor);
- //draw the edges of scale form
- if (p_scan==1)
- osd_DrawLine(xStart, yStart, xStart+xWidth, yStart, eColorTL, 2);
- else
- osd_DrawLine(xStart, yStart, xStart+xWidth, yStart, eColorTL, 1);
- //left
- osd_DrawLine(xStart, yStart, xStart, yStart+yDelta, eColorTL, 1);
- //bottom
- if (p_scan==1)
- osd_DrawLine(xStart, yStart+yDelta, xStart+xWidth, yStart+yDelta, eColorBR, 2);
- else
- osd_DrawLine(xStart, yStart+yDelta, xStart+xWidth, yStart+yDelta, eColorBR, 1);
- //right
- osd_DrawLine(xStart+xWidth, yStart, xStart+xWidth, yStart+yDelta, eColorBR, 1);
- }
- void setup_DrawScaleCursor(UINT8 id, BYTE upDown)
- {
- BYTE eColorTL, eColorBR;
- BYTE barColor, cursorColor; //bar, cursor color
- BYTE clrCursorColor;
- UINT32 xStart, yStart, yOffset;
- UINT32 yDelta=0;
- UINT32 yEnd;
-
- if (upDown) { //down
- eColorTL = setupEcolorSCTLD;
- eColorBR = setupEcolorSCBRD;
- barColor = setupBGcolorSCBD;
- cursorColor = setupBGcolorSCD;
- clrCursorColor = setupBGcolorSPD;
- } else { //up
- eColorTL = setupEcolorSCTLU;
- eColorBR = setupEcolorSCBRU;
- barColor = setupBGcolorSCBU;
- cursorColor = setupBGcolorSCU;
- clrCursorColor = setupBGcolorSPU;
- }
- xStart = SETUP_SUB_XSTART * 16 + 76;
- yOffset = setup_item[setup_pos[1]][setup_pos[2]][MAX_ITEM_SEL];
- yStart = (yOffset+SETUP_MENU_YSTART)*SETUP_BUTTON_HEIGHT + 40;
- yDelta = setup_item[setup_pos[1]][setup_pos[2]][2] *SETUP_BUTTON_HEIGHT - 12;
- // flush cursor area
- osd_draw_rect(xStart-20, yStart-1, 40, yDelta+2, clrCursorColor);
- // draw cursor bar
- osd_DrawLine(xStart, yStart, xStart, yStart+yDelta, barColor, 3);
- // draw cursor body
- yEnd = yStart+yDelta - (setup_sel[setup_pos[1]][setup_pos[2]]-2+1)*SETUP_BUTTON_HEIGHT/2;
- xStart = SETUP_SUB_XSTART * 16 + 60;
- osd_draw_rect(xStart, yEnd, 32, 8, cursorColor);
- //draw the edges of scale cursor
- if (p_scan==1)
- osd_DrawLine(xStart, yEnd, xStart+36, yEnd, eColorTL, 2);
- else
- osd_DrawLine(xStart, yEnd, xStart+36, yEnd, eColorTL, 1);
- //left
- osd_DrawLine(xStart, yEnd, xStart, yEnd+8, eColorTL, 1);
- //bottom
- if (p_scan==1)
- osd_DrawLine(xStart, yEnd+8, xStart+36, yEnd+8, eColorBR, 2);
- else
- osd_DrawLine(xStart, yEnd+8, xStart+36, yEnd+8, eColorBR, 1);
- //right
- osd_DrawLine(xStart+34, yEnd, xStart+34, yEnd+8, eColorBR, 1);
- }