📄 osddlg.c
字号:
} else { RegionInfo.dwTAddr = dwBufferAddr; } } RegionInfo.wWidth = GDI_REGION_WIDTH; RegionInfo.wHeight = _DLG_FrameAttr.rect.wBottom; OSD_SetRegion(0, TRUE, &RegionInfo);#else RegionInfo.wWidth = GDI_REGION_WIDTH; RegionInfo.wHeight = GDI_REGION_HEIGHT; RegionInfo.dwTAddr = DS_OSDFRAME_ST; OSD_SetRegion(0, FALSE, &RegionInfo);#endif #endif // #ifdef ENLARGE_OSD_FOR_PAL_MODE }}//**********************************************************************// Function : OSDCOMDLG_Trigger // Abstract : Trigger function // Arguments : bType : only OSD_TRIGGER_CONTROL is valid.// wTime : the time // Return : none.// Side Effect : none.// Notes : //**********************************************************************// LLY2.53, expand time value unit from WORD to DWORD// Since, we will use [23:16]:hour, [15:8]: min, [7:0]: sec//void OSDCOMDLG_Trigger(BYTE bType, WORD wTime)void OSDCOMDLG_Trigger(BYTE bType, DWORD dwTime){ if (0 == _bWaitingTime) return; if (OSD_TRIGGER_CONTROL != bType) return; if (OS_GetSysTimer() - _dwLastTime < COUNT_1_SEC) return; if (_bWaitingTime > 0) { _bWaitingTime--; OSDUTL_PrepareOutputString(); OSDUTL_OutputNumFromIndex((WORD)_bWaitingTime); _DLG_StrAttr.bTextColor = OSDND_PALETTE_ENTRY_MUTE_ICON_SHADOW_2; _DLG_StrAttr.bBackground = OSDND_PALETTE_ENTRY_MUTEOFF_ICON_SHADOW_2; _DLG_StrAttr.wX = (_DLG_FrameAttr.rect.wLeft + _DLG_FrameAttr.rect.wRight) / 2; _DLG_StrAttr.wY = _DLG_FrameAttr.rect.wBottom - 4 * GDI_GetStringWidth(aOSDCOMDLG_OK); //GDI_DrawString_909(0, &_DLG_StrAttr, __wOSDUTLStringBuf); _OSDDLG_DrawDynamicString(__wOSDUTLStringBuf); //Alex1.07a 20031009 if the waittime < 0 , stop the pscan if(_bWaitingTime <= 0) { if (_pTimeoutFunc) (_pTimeoutFunc)(); } _dwLastTime = OS_GetSysTimer(); }}/////////////////////// Private Functions ////////////////////////////////void _OSDCOMDLG_InitPalette(void){ GDI_ChangePALEntry(OSDCOMDLG_ENTRY_BUTTON, OSDCOMDLG_VALUE_COLOR_BUTTON, FALSE); GDI_ChangePALEntry(OSDCOMDLG_ENTRY_HIGHLIGHT, OSDCOMDLG_VALUE_COLOR_HIGHLIGHT, FALSE); GDI_ChangePALEntry(OSDCOMDLG_ENTRY_STRING, OSDCOMDLG_VALUE_COLOR_STRING, FALSE); GDI_ChangePALEntry(OSDCOMDLG_ENTRY_FRAME_BRIGHT, OSDCOMDLG_VALUE_FRAME_BRIGHT, FALSE); GDI_ChangePALEntry(OSDCOMDLG_ENTRY_FRAME_DARK, OSDCOMDLG_VALUE_FRAME_DARK, FALSE); GDI_ChangePALEntry(OSDCOMDLG_ENTRY_FRAME_CENTER, OSDCOMDLG_VALUE_FRAME_CENTER, FALSE); GDI_WaitPaletteComplete();}void _OSDCOMDLG_ClearUI(void){ GDI_FillRect_909(0, &_DLG_RectAttr); OSD_ChangeUI(OSD_UI_COMMON_DLG, OSD_EXIT_UI);}void _OSDCOMDLG_DrawButtons(void){ PARM_RECT _DLG_ButtonAttr; WORD wCenterX; WORD wStrLength = 0; wCenterX = (_DLG_FrameAttr.rect.wLeft + _DLG_FrameAttr.rect.wRight) / 2; if (1 == _bButtonNum) { if (_bOK_Cancel_ButtonType) wStrLength = GDI_GetStringWidth(aOSDCOMDLG_OK); else wStrLength = GDI_GetStringWidth(aOSDCOMDLG_Yes); _DLG_ButtonAttr.bColor = OSDCOMDLG_ENTRY_BUTTON; _DLG_ButtonAttr.rect.wLeft = wCenterX - ButtonWidth/2 + HIGHTLIGHT_BORDER; _DLG_ButtonAttr.rect.wRight = wCenterX + ButtonWidth/2 - HIGHTLIGHT_BORDER; _DLG_ButtonAttr.rect.wBottom = _DLG_FrameAttr.rect.wBottom - BOTTOM_MARGIN - HIGHTLIGHT_BORDER; _DLG_ButtonAttr.rect.wTop = _DLG_FrameAttr.rect.wBottom - BOTTOM_MARGIN - GDI_GetStringHeight(aOSDCOMDLG_Cancel) - HIGHTLIGHT_BORDER; GDI_FillRoundRect(0, 13, &_DLG_ButtonAttr); _DLG_StrAttr.wX = wCenterX - wStrLength/2; _DLG_StrAttr.wY = _DLG_ButtonAttr.rect.wTop; _DLG_StrAttr.bTextColor = OSDND_PALETTE_ENTRY_MUTE_ICON_SHADOW_2; _DLG_StrAttr.bBackground = OSDND_PALETTE_ENTRY_UPPER_RIGHT_STRING; if (_bOK_Cancel_ButtonType) //GDI_DrawString_909(0, &_DLG_StrAttr, aOSDCOMDLG_OK); _OSDDLG_DrawDynamicString(aOSDCOMDLG_OK); else //GDI_DrawString_909(0, &_DLG_StrAttr, aOSDCOMDLG_Yes); _OSDDLG_DrawDynamicString(aOSDCOMDLG_Yes); } else if (2 == _bButtonNum) { if (_bOK_Cancel_ButtonType) wStrLength = GDI_GetStringWidth(aOSDCOMDLG_OK); else wStrLength = GDI_GetStringWidth(aOSDCOMDLG_Yes); _DLG_ButtonAttr.bColor = OSDCOMDLG_ENTRY_BUTTON; _DLG_ButtonAttr.rect.wLeft = wCenterX - BUTTON_SPACE - ButtonWidth + HIGHTLIGHT_BORDER; _DLG_ButtonAttr.rect.wRight = wCenterX - BUTTON_SPACE - HIGHTLIGHT_BORDER; _DLG_ButtonAttr.rect.wBottom = _DLG_FrameAttr.rect.wBottom - BOTTOM_MARGIN - HIGHTLIGHT_BORDER; _DLG_ButtonAttr.rect.wTop = _DLG_FrameAttr.rect.wBottom - BOTTOM_MARGIN - GDI_GetStringHeight(aOSDCOMDLG_Cancel) - HIGHTLIGHT_BORDER; GDI_FillRoundRect(0, 13, &_DLG_ButtonAttr); _DLG_StrAttr.wX = (_DLG_ButtonAttr.rect.wLeft + _DLG_ButtonAttr.rect.wRight)/2 - wStrLength/2; _DLG_StrAttr.wY = _DLG_ButtonAttr.rect.wTop; _DLG_StrAttr.bTextColor = OSDND_PALETTE_ENTRY_MUTE_ICON_SHADOW_2; _DLG_StrAttr.bBackground = _DLG_ButtonAttr.bColor; if (_bOK_Cancel_ButtonType) //GDI_DrawString_909(0, &_DLG_StrAttr, aOSDCOMDLG_OK); _OSDDLG_DrawDynamicString(aOSDCOMDLG_OK); else //GDI_DrawString_909(0, &_DLG_StrAttr, aOSDCOMDLG_Yes); _OSDDLG_DrawDynamicString(aOSDCOMDLG_Yes); if (_bOK_Cancel_ButtonType) wStrLength = GDI_GetStringWidth(aOSDCOMDLG_Cancel); else wStrLength = GDI_GetStringWidth(aOSDCOMDLG_No); _DLG_ButtonAttr.rect.wLeft = wCenterX + BUTTON_SPACE + HIGHTLIGHT_BORDER; _DLG_ButtonAttr.rect.wRight = wCenterX + BUTTON_SPACE + ButtonWidth - HIGHTLIGHT_BORDER; GDI_FillRoundRect(0, 13, &_DLG_ButtonAttr); _DLG_StrAttr.wX = (_DLG_ButtonAttr.rect.wLeft + _DLG_ButtonAttr.rect.wRight)/2 - (wStrLength/2); if (_bOK_Cancel_ButtonType) //GDI_DrawString_909(0, &_DLG_StrAttr, aOSDCOMDLG_Cancel); _OSDDLG_DrawDynamicString(aOSDCOMDLG_Cancel); else //GDI_DrawString_909(0, &_DLG_StrAttr, aOSDCOMDLG_No); _OSDDLG_DrawDynamicString(aOSDCOMDLG_No); }}void _OSDCOMDLG_HighlightButton(BYTE bButton){ PARM_RECT _DLG_ButtonAttr; WORD wCenterX; wCenterX = (_DLG_FrameAttr.rect.wLeft + _DLG_FrameAttr.rect.wRight) / 2; if (2 == _bButtonNum) { if (BUTTON_OK_YES == bButton) { _DLG_ButtonAttr.bColor = OSDCOMDLG_ENTRY_HIGHLIGHT; _DLG_ButtonAttr.rect.wLeft = wCenterX - ButtonWidth - BUTTON_SPACE; _DLG_ButtonAttr.rect.wRight = _DLG_ButtonAttr.rect.wLeft + ButtonWidth; _DLG_ButtonAttr.rect.wBottom = _DLG_FrameAttr.rect.wBottom - BOTTOM_MARGIN; _DLG_ButtonAttr.rect.wTop = _DLG_ButtonAttr.rect.wBottom - GDI_GetStringHeight(aOSDCOMDLG_Cancel) - 2 * HIGHTLIGHT_BORDER; GDI_FillRoundRect(0, 17, &_DLG_ButtonAttr); } else { _DLG_ButtonAttr.bColor = OSDCOMDLG_ENTRY_HIGHLIGHT; _DLG_ButtonAttr.rect.wLeft = wCenterX + BUTTON_SPACE; _DLG_ButtonAttr.rect.wRight = _DLG_ButtonAttr.rect.wLeft + ButtonWidth; _DLG_ButtonAttr.rect.wBottom = _DLG_FrameAttr.rect.wBottom - BOTTOM_MARGIN; _DLG_ButtonAttr.rect.wTop = _DLG_ButtonAttr.rect.wBottom - GDI_GetStringHeight(aOSDCOMDLG_Cancel) - 2 * HIGHTLIGHT_BORDER; GDI_FillRoundRect(0, 17, &_DLG_ButtonAttr); } } else if (1 == _bButtonNum) { _DLG_ButtonAttr.bColor = OSDCOMDLG_ENTRY_HIGHLIGHT; _DLG_ButtonAttr.rect.wLeft = wCenterX - ButtonWidth/2; _DLG_ButtonAttr.rect.wRight = _DLG_ButtonAttr.rect.wLeft + ButtonWidth; _DLG_ButtonAttr.rect.wBottom = _DLG_FrameAttr.rect.wBottom - BOTTOM_MARGIN; _DLG_ButtonAttr.rect.wTop = _DLG_ButtonAttr.rect.wBottom - GDI_GetStringHeight(aOSDCOMDLG_Cancel) - 2 * HIGHTLIGHT_BORDER; GDI_FillRoundRect(0, 17, &_DLG_ButtonAttr); }}void _OSDCOMDLG_ClearButtonsArea(void){ PARM_RECT _DLG_ButtonAttr; WORD wCenterX; wCenterX = (_DLG_FrameAttr.rect.wLeft + _DLG_FrameAttr.rect.wRight) / 2; _DLG_ButtonAttr.bColor = OSDCOMDLG_ENTRY_FRAME_CENTER; _DLG_ButtonAttr.rect.wLeft = wCenterX - BUTTON_SPACE - ButtonWidth; _DLG_ButtonAttr.rect.wRight = wCenterX + BUTTON_SPACE + ButtonWidth; _DLG_ButtonAttr.rect.wBottom = _DLG_FrameAttr.rect.wBottom - FRAME_THICKNESS; _DLG_ButtonAttr.rect.wTop = _DLG_ButtonAttr.rect.wBottom - BOTTOM_MARGIN - GDI_GetStringHeight(aOSDCOMDLG_Cancel) - 2 * HIGHTLIGHT_BORDER - 1; GDI_FillRect(0, &_DLG_ButtonAttr);}BOOL _OSDCOMDLG_DrawStringWithAutoWrap(WORD wX, WORD wY, WORD* pwString){ WORD wSpaceW = (_DLG_FrameAttr.rect.wRight - _DLG_FrameAttr.rect.wLeft) - 2*wX; if (0 == pwString[0]) return TRUE; if (GDI_GetStringWidth(pwString) > wSpaceW) { WORD aDrawString[32], wTemp; WORD wIndex = 1; WORD wCharNum = pwString[0]; WORD wDrawXPos = wX; WORD wDrawYPos = wY; while (0 < wCharNum) { for (wTemp = 0; wTemp < wCharNum; wTemp++) { if (CHAR_SPACE == pwString[wIndex + wTemp]) break; } while (CHAR_SPACE == pwString[wIndex + wTemp]) { wTemp++; } memcpy(&(aDrawString[1]), &(pwString[wIndex]), wTemp*sizeof(WORD)); aDrawString[0] = wTemp; if (GDI_GetStringWidth(aDrawString) > wSpaceW) { while (CHAR_SPACE == aDrawString[aDrawString[0]] && aDrawString[0] > 0) { aDrawString[0]--; if (GDI_GetStringWidth(aDrawString) <= wSpaceW) break; } if (0 == aDrawString[0] || wTemp == aDrawString[0]) { wDrawXPos= wX; wDrawYPos += LINE_HEIGHT; wSpaceW = (_DLG_FrameAttr.rect.wRight - _DLG_FrameAttr.rect.wLeft) - 2*wX; aDrawString[0] = wTemp; // draw sting } else { if (GDI_GetStringWidth(aDrawString) > wSpaceW) { wDrawXPos= wX; wDrawYPos += LINE_HEIGHT; wSpaceW = (_DLG_FrameAttr.rect.wRight - _DLG_FrameAttr.rect.wLeft) - 2*wX; } } } else { // draw sting } OSDCOMDLG_DrawString(wDrawXPos, wDrawYPos, aDrawString); wSpaceW -= GDI_GetStringWidth(aDrawString); wDrawXPos += GDI_GetStringWidth(aDrawString); wIndex += aDrawString[0]; wCharNum -= aDrawString[0]; } } else { OSDCOMDLG_DrawString(wX, wY, pwString); } return TRUE;}//CoCo1.20, reduce code size.void _OSDDLG_DrawDynamicString(WORD *pwString){ GDI_DrawString_909(0, &_DLG_StrAttr, pwString);}//*********************************************************************************************************// Function : OSDDLG_ConfigOSDRegion// Abstract : This function will config the OSD region. And it is exported for OSD kernel usage.// Arguments : none.// Return : none.// Side Effect : none.// Notes : //*********************************************************************************************************void OSDDLG_ConfigOSDRegion(void){ GDI_REGION_INFO RegionInfo;#ifdef BORROW_FRAME_BUFFER DWORD dwBufferAddr;#endif // RegionInfo.bColorMode = GDI_OSD_8B_MODE; RegionInfo.wWidth = GDI_REGION_WIDTH;// RegionInfo.wHeight = OSDDLG_OSD_REGION_HEIGHT;#ifdef ENLARGE_OSD_FOR_PAL_MODE if ((__bTVType == SETUP_SCREEN_TV_SYSTEM_NTSC) || (__bTVType == SETUP_SCREEN_TV_SYSTEM_PAL_M)) { RegionInfo.wHeight = GDI_REGION_HEIGHT; } else { RegionInfo.wHeight = GDI_REGION_HEIGHT_PAL; } RegionInfo.dwTAddr = DS_OSDFRAME_ST;#else#ifdef BORROW_FRAME_BUFFER RegionInfo.wHeight = OSDDLG_OSD_REGION_HEIGHT; if (GDI_REGION_WIDTH <= __RegionList[0].wWidth && OSDDLG_OSD_REGION_HEIGHT <= __RegionList[0].wHeight && GDI_OSD_8B_MODE == __RegionList[0].bColorMode) { // Use OSD buffer and Frame buffer 0 RegionInfo.dwTAddr = DS_OSDFRAME_ST; } else { // Use Frame buffer 1 or 2 dwBufferAddr = DISP_QueryAvailableBuffer(); if (0 == dwBufferAddr) { RegionInfo.dwTAddr = DS_OSDFRAME_ST; printf("DISP can't find an available buffer for OSD region\n"); } else { RegionInfo.dwTAddr = dwBufferAddr; } }#else RegionInfo.wHeight = GDI_REGION_HEIGHT; RegionInfo.dwTAddr = DS_OSDFRAME_ST;#endif // #ifdef BORROW_FRAME_BUFFER#endif // #ifdef ENLARGE_OSD_FOR_PAL_MODE#ifdef BORROW_FRAME_BUFFER GDI_ClearRegion(0); //Alan2.30, fix mantis bug #1886 OSD_SetRegion(0, TRUE, &RegionInfo);#else OSD_SetRegion(0, FALSE, &RegionInfo);#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -