?? gdi_main.c
字號:
/******************************************************************************/
/**
* @brief Clears the TDC chapter.
*
* @param --
*
* @return --
******************************************************************************/
void GDI_ClearScreen(void)
{
uint16_t sizeOfTdc = TDC_SIZE;
data uint16_t i = 0;
data uint8_t buf2 = 0x01; /* foreground colour light grey (DEFAULT) */
#ifdef __DEMO_LOOP__
if (demoSequenceStatus_g != DEMO_END) /* demo loop active */
{
sizeOfTdc = TDC_SIZE - (NUM_COLS*3); /* don't clear row 24 of OSD area */
}
#endif
if (globalState_g == SERVICEMODE)
buf2 = 0x1C; /* set foreground colour white */
do
{
DisplayBuffer[i++] = CHR_SPACE; /* Cdw byte 0 */
DisplayBuffer[i++] = 0x00; /* Cdw byte 1 */
DisplayBuffer[i++] = buf2; /* Cdw byte 2 */
}
while (i < sizeOfTdc);
if(gstView.info_key==VISIBLE) //wzh2006-04-20
{
SDH1=0;
SDH0 = GDI_GetSdh();
gstView.info_key=INVISIBLE;
}
}
/******************************************************************************/
/**
* @brief Paints a rectangle on screen with corresponding Cdw attributes for
* the menu system.
*
* @param type [in] type of rectangle
*
* @return --
******************************************************************************/
void GDI_Rectangle(const gdi_rectangles_t type)
{
switch (type)
{
case GDI_RECTANGLE_HEADER_FOOTER: /* header and helpline */
cdw_g.bClutSelect = SUBCLUT2;
cdw_g.bFgColor = COLOR6;
cdw_g.bBgColor = COLOR2;
break;
case GDI_RECTANGLE_HELP: /* help menu background/foreground */
cdw_g.bClutSelect = SUBCLUT2;
cdw_g.bFgColor = COLOR2;
cdw_g.bBgColor = COLOR5;
break;
case GDI_CLEAR_RECTANGLE: /* clear rectangle */
GDI_SetCdwAttrDefaults(CLEAR_SCREEN);
break;
case GDI_RECTANGLE_WELCOME:
cdw_g.bClutSelect = SUBCLUT2;
cdw_g.bFgColor = COLOR3;
cdw_g.bBgColor = COLOR1;
break;
case GDI_RECTANGLE_CURSOR:
cdw_g.bClutSelect = SUBCLUT2;
cdw_g.bFgColor = COLOR3;
cdw_g.bBgColor = COLOR5;
if (rectangle_g.StartRow != rectangle_g.StopRow)
cdw_g.bDoubleHeight = SYS_TRUE;
break;
case GDI_RECTANGLE_BAR:
cdw_g.bClutSelect = SUBCLUT3;
cdw_g.bFgColor = COLOR4;
cdw_g.bBgColor = COLOR2;
break;
case GDI_RECTANGLE_BIG_ICONS:
cdw_g.bClutSelect = SUBCLUT2;
cdw_g.bFgColor = COLOR1;
cdw_g.bBgColor = COLOR1;
break;
case GDI_RECTANGLE_BACKGROUND: /* Fall through */
default: /* normal menu background */
cdw_g.bClutSelect = SUBCLUT2;
cdw_g.bFgColor = COLOR7;
cdw_g.bBgColor = COLOR1;
}
for (activeRow_g = rectangle_g.StartRow;
activeRow_g <= rectangle_g.StopRow;
activeRow_g++)
{
for (activeCol_g = rectangle_g.StartCol;
activeCol_g <= rectangle_g.StopCol;
activeCol_g++)
{
GDI_WriteCdwAttributes();
if (type != GDI_RECTANGLE_CURSOR && type != GDI_RECTANGLE_BAR)
GDI_WriteCdwCharacter(CHR_SPACE);
}
if (cdw_g.bDoubleHeight == SYS_TRUE)
activeRow_g++;
}
GDI_SetCdwAttrDefaults(OSD_TV);
}
/******************************************************************************/
/**
* @brief Paints a bar for analogue values (e.g. volume).
*
* @param value [in] length of the bar (0-55)
*
* @return --
******************************************************************************/
void GDI_DrawBar(uint8_t value)
{
uint8_t cntfull;
uint8_t cntpart;
uint8_t i;
uint16_t barChar[6] = {CHR_BAR_EMPTY,
CHR_BAR1,
CHR_BAR2,
CHR_BAR3,
CHR_BAR4,
CHR_BAR5};
if (value > MAXBARVALUE)
value = MAXBARVALUE;
cntfull = (value / 6); /* count full chars to display */
cntpart = (value % 6); /* count part chars to display */
cdw_g.bClutSelect = SUBCLUT7;
#ifdef __X_RAM__
if (xRamLanguage_g == SYS_TRUE)
{
activeRow_g++;
GDI_WriteCdwAttrLength(13);
activeRow_g--;
cdw_g.bDoubleHeight = SYS_TRUE;
}
#endif
GDI_WriteCdwAttrLength(13);
/* write "start" character */
GDI_WriteCdwCharacter(CHR_BAR_START);
/* write "end" character */
activeCol_g += 12;
GDI_WriteCdwCharacter(CHR_END);
activeCol_g -= 11;
/* write "full" characters */
for (i = 0; i < cntfull; i++)
{
GDI_WriteCdwCharacter(CHR_BAR6);
activeCol_g++;
}
if (cntfull < 11)
{
/* write "end" character */
GDI_WriteCdwCharacter(barChar[cntpart]);
activeCol_g++;
cntfull++; /* for remaining empty chars calculation */
}
/* write remaining empty chars */
for (i = cntfull; i < 11; i++)
{
GDI_WriteCdwCharacter(CHR_BAR_EMPTY);
activeCol_g++;
}
cdw_g.bDoubleHeight = SYS_FALSE;
}
/******************************************************************************/
/**
* @brief Paints a marker for analogue values (e.g. balance).
*
* @param value [in] length of the bar (0-55)
*
* @return --
******************************************************************************/
void GDI_DrawMarker(uint8_t value)
{
uint8_t cntfull, cntpart;
uint8_t i, j;
uint16_t markerCharLeft[6] = {
CHR_MARKER6,
CHR_MARKER1,
CHR_MARKER2,
CHR_MARKER3,
CHR_MARKER4,
CHR_MARKER5};
uint16_t markerCharRight[6] = {
CHR_BAR6,
CHR_BAR1,
CHR_BAR2,
CHR_BAR3,
CHR_BAR4,
CHR_BAR5};
cdw_g.bClutSelect = SUBCLUT7;
GDI_WriteCdwAttrLength(13);
#ifdef __X_RAM__
if (xRamLanguage_g == SYS_TRUE)
{
activeRow_g++;
GDI_WriteCdwAttrLength(13);
activeRow_g--;
cdw_g.bDoubleHeight = SYS_TRUE;
}
#endif
if (value > MAXMARKERVALUE)
value = MAXMARKERVALUE;
/* write "start" character */
GDI_WriteCdwCharacter(CHR_MARKER_START);
/* write "end" character */
activeCol_g += 12;
GDI_WriteCdwCharacter(CHR_END);
activeCol_g -= 6;
if (value == (MAXMARKERVALUE + 1) / 2)
{
activeCol_g -= 5;
for (i = 0; i < 11; i++)
{
if (i == 5)
GDI_WriteCdwCharacter(CHR_MID_MARKER);
else
GDI_WriteCdwCharacter(CHR_BAR_EMPTY); /* fill empty */
activeCol_g++;
}
return;
}
if (value < (MAXMARKERVALUE + 1) / 2)
{
value = (MAXMARKERVALUE + 1) / 2 - value;
j = 1; /* negativ marker */
}
else
{
value -= (MAXMARKERVALUE + 1) / 2;
j = 0; /* positiv marker */
}
cntfull = value / 6; /* count full chars to display */
cntpart = value % 6; /* count part chars to display */
if (j == 1)
{
for (i = 0; i < 5; i++)
{
activeCol_g++;
GDI_WriteCdwCharacter(CHR_BAR_EMPTY); /* fill empty right */
}
activeCol_g -= 5;
GDI_WriteCdwCharacter(CHR_MID_LEFT);
i = 0;
for (; cntfull > 0; cntfull--) /* full chars */
{
activeCol_g--;
GDI_WriteCdwCharacter(CHR_MARKER6);
i++;
}
if (i < 5)
{
if (cntpart != 0)
{
activeCol_g--;
GDI_WriteCdwCharacter(markerCharLeft[cntpart]); /* part char */
i++;
}
while (i < 5)
{
activeCol_g--;
GDI_WriteCdwCharacter(CHR_BAR_EMPTY); /* fill empty left */
i++;
}
}
}
else
{
for (i = 0; i < 5; i++)
{
activeCol_g--;
GDI_WriteCdwCharacter(CHR_BAR_EMPTY); /* fill empty left */
}
activeCol_g += 5;
GDI_WriteCdwCharacter(CHR_MID_RIGHT);
i = 0;
for (; cntfull > 0; cntfull--) /* full chars */
{
activeCol_g++;
GDI_WriteCdwCharacter(CHR_BAR6);
i++;
}
if (i < 5)
{
if (cntpart != 0)
{
activeCol_g++;
GDI_WriteCdwCharacter(markerCharRight[cntpart]); /* part char */
i++;
}
while (i < 5)
{
activeCol_g++;
GDI_WriteCdwCharacter(CHR_BAR_EMPTY); /* fill empty left */
i++;
}
}
}
cdw_g.bDoubleHeight = SYS_FALSE;
}
/******************************************************************************/
/**
* @brief Enables the OSD output
*
* @param --
*
* @return --
******************************************************************************/
void GDI_EnableOsd(void)
{
/* enable OSD */
OSD_CTRL |= 0x6c;
}
/******************************************************************************/
/**
* @brief Disables the OSD output
*
* @param --
*
* @return --
******************************************************************************/
void GDI_DisableOsd(void)
{
#ifdef __VCHIP__
if (VCHIP_GetLockState() == SYS_TRUE)
OSD_CTRL &= 0xFB;
else
#endif
#ifndef __OSD_DEBUG__
#ifndef DEBUG_IN_OSD
OSD_CTRL &= 0xFA;
#endif
#endif
;
}
/******************************************************************************/
/**
* @brief Switches to OSD mode.
*
* @param --
*
* @return --
******************************************************************************/
void GDI_SwitchOsdOn(void)
{
if (TEXT_IsModeActive(TEXT_MODE_OSD) == SYS_FALSE)
{
GDI_ClearScreen();
GDI_SetGdw(GDW_OSD);
osd();
}
#ifdef __CAPTION__
#ifdef __X_RAM__
if (xRamLanguage_g == SYS_TRUE)
CORE_SwitchToXRamFont();
else
#endif
CORE_SwitchToRomFont();
GDI_SetGdw(GDW_OSD);
OSD_CTRL |= 0x0D; /* enable OSD */
#endif
}
/******************************************************************************/
/**
* @brief Switches the OSD mode off.
*
* @param --
*
* @return --
******************************************************************************/
void GDI_SwitchOsdOff(void)
{
if (TEXT_IsModeActive(TEXT_MODE_OSD) == SYS_TRUE)
osd(); /* toggle command to switch osd on/off */
GDI_ClearScreen();
#ifdef __CAPTION__
/* HandleFont(); */
if (dataServiceMode_g == DATA_SERVICE_TELETEXT)
{
GDI_SetGdw(GDW_TV);
}
else
{
if (RomFontPointer[1] == 0x00) /* Teletext font active ? */
{
SwitchToCaptionFont();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -