⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osddlg.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 3 页
字号:
//#include  "ctkav.h"#include "winav.h"#include "input.h"#include "osd.h"#include "gdi.h"#include "fontindex.h" //++CoCo2.37P#include "osdnd.h"#include "cc.h"#include "osddlg.h"#include "utl.h"#include "media.h"#include "setup.h"#include "disp.h"#include "notransl.h"BYTE _bOSDDLGTemp;WORD _wOSDDLGTemp, _wOSDDLGTemp1;WORD _wOSDDLGButtonWidth;PARM_RECT _OSDDLGRect;DLG_ATTRIBUTE _OSDDLGAttribute;PARM_DRAW_STRING _OSDDLGStringAttr;extern BYTE __bChooseMedia; //0==>CDROM/DVDROM, 1==>USBextern BYTE __bTVType;//********************************************************************************************************//  Function    :   OSDDLG_Update//  Abstract    :   Update the dialog box according to the message.//  Arguments   :   bMessage: OSDDLG_MSG_SHOW_DLG==>Show the dialog box. //              :             OSDDLG_MSG_DRAW_HIGHLIGHT: Draw highlighted button. bParam is the index of the button.//              :             OSDDLG_MSG_CLEAR_HIGHLIGHT: Draw normal button (clear the highlighted state). //              :             bParam is the index of the button.//              :             OSDDLG_MSG_EXIT: Exit the dialog box.//  Return		:   none.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************void OSDDLG_MEDIA_SELECT_Update(BYTE bMessage, BYTE bParam){    switch (bMessage)    {    case OSDDLG_MSG_SHOW_DLG:#ifdef SUPPORT_STB        if (__bChooseMedia == MEDIA_SELECT_STB)        {            GDI_ClearRegion(0);        }#endif //SUPPORT_STB        _OSDDLG_MEDIA_SELECT_ShowDialogBox(OSDDLG_SHOW_DLG_INITIAL, bParam);        break;    case OSDDLG_MSG_DRAW_HIGHLIGHT:        _OSDDLG_MEDIA_SELECT_DrawButton(bParam, OSDDLG_BUTTON_STATE_HIGHLIGHT);        break;    case OSDDLG_MSG_CLEAR_HIGHLIGHT:        _OSDDLG_MEDIA_SELECT_DrawButton(bParam, OSDDLG_BUTTON_STATE_NORMAL);        break;    case OSDDLG_MSG_EXIT:        _OSDDLG_MEDIA_SELECT_UpdateDlgBackground(OSDDLG_UPDATE_CLEAR);        if (bParam == OSD_UI_CLEAR_NORMAL)        {            //Tell OSD that the "Media Select" dialog box exits.            OSD_ChangeUI(OSD_UI_MEDIA_SELECT_DLG, OSD_EXIT_UI);        }        break;    default:        break;    }}//********************************************************************************************************//  Function    :   _OSDDLG_MEDIA_SELECT_ShowDialogBox//  Abstract    :   This function will show the dialog box according to the ID.//  Arguments   :   bDisplayMode: OSDDLG_SHOW_DLG_INITIAL/OSDDLG_SHOW_DLG_RECOVER.//  Return		:   none.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************void _OSDDLG_MEDIA_SELECT_ShowDialogBox(BYTE bDisplayMode, BYTE bBackgroudMode){    BYTE bIndex;    if (bDisplayMode == OSDDLG_SHOW_DLG_INITIAL)    {        //Tell OSD that the "Media Select" dialog box enters.        OSD_ChangeUI(OSD_UI_MEDIA_SELECT_DLG, OSD_ENTER_UI);                //Initialize the attribute of the dialog box.        _OSDDLGAttribute.wWidth = _OSDDLG_MEDIA_SELECT_GetMaxButtonWidth()+(WORD)((OSDDLG_MEDIA_SELECT_BACKGROUND_BUTTON_DISTANCE_H<<1));        _OSDDLGAttribute.wHeight = _OSDDLG_MEDIA_SELECT_GetDlgHeight();        _OSDDLGAttribute.wStartH = ((OSD_PLANE_WIDTH -  _OSDDLGAttribute.wWidth) >> 1);        _OSDDLGAttribute.wStartV = ((OSD_PLANE_HEIGHT - _OSDDLGAttribute.wHeight) >> 1);    }        //Initialize palette    _OSDDLG_MEDIA_SELECT_InitializeGDI();    //Clear background    if (bBackgroudMode == OSDDLG_MEDIA_SELECT_BACKGROUND_GENERAL_MODE)    {        //Clear the region except normal-upper message and normal bottom message        _OSDDLGRect.rect.wLeft = 0;        _OSDDLGRect.rect.wTop = __OSDNDUpMsgAttr.wY+OSDND_FONT_HEIGHT;        _OSDDLGRect.rect.wRight = GDI_REGION_WIDTH-1;        _OSDDLGRect.rect.wBottom = __OSDNDBottomMsgAttr.wY-1;        _OSDDLGRect.bColor = PAL_ENTRY_COLOR_TRANSPARENT;                   GDI_FillRect_909(0, &_OSDDLGRect);            }    else if (bBackgroudMode == OSDDLG_MEDIA_SELECT_BACKGROUND_MM_MODE)    {        GDI_ClearRegion(0); //clear region 0    }    //Draw the background of the dialog box.    _OSDDLG_MEDIA_SELECT_UpdateDlgBackground(OSDDLG_UPDATE_DRAW);    //Draw buttons    for (bIndex = 0; bIndex < OSDDLG_MEDIA_SELECT_TOTAL_BUTTONS; bIndex++)    {        /*        if (bIndex == OSDDLG_MEDIA_SELECT_DEFAULT_HIGHLIGHT_BUTTON)            _OSDDLG_MEDIA_SELECT_DrawButton(bIndex, OSDDLG_BUTTON_STATE_HIGHLIGHT);        else        */        _OSDDLG_MEDIA_SELECT_DrawButton(bIndex, OSDDLG_BUTTON_STATE_NORMAL);    }}//********************************************************************************************************//  Function    :   _OSDDLG_MEDIA_SELECT_InitializeGDI//  Abstract    :   This function will initialize the palette.//  Arguments   :   none.//  Return		:   none.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************void _OSDDLG_MEDIA_SELECT_InitializeGDI(void){        GDI_ChangePALEntry(OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_GENERAL_BACKGROUND, OSDDLG_MEDIA_SELECT_PALETTE_COLOR_GENERAL_BACKGROUND, TRUE);    GDI_ChangePALEntry(OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_HIGHLIGHT_BUTTON, OSDDLG_MEDIA_SELECT_PALETTE_COLOR_HIGHLIGHT_BUTTON, FALSE);    GDI_ChangePALEntry(OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_NORMAL_BUTTON, OSDDLG_MEDIA_SELECT_PALETTE_COLOR_NORMAL_BUTTON, FALSE);    GDI_ChangePALEntry(OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_HIGHLIGHT_BUTTON_STRING, OSDDLG_MEDIA_SELECT_PALETTE_COLOR_HIGHLIGHT_BUTTON_STRING, FALSE);    GDI_ChangePALEntry(OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_NORMAL_BUTTON_STRING, OSDDLG_MEDIA_SELECT_PALETTE_COLOR_NORMAL_BUTTON_STRING, FALSE);    GDI_WaitPaletteComplete();    //GDI_SetMixRatio(OSDDLG_MEDIA_SELECT_DLG_MIX_RATIO_BACKGROUND); //The mix ration just effects the background        GDI_ActivateRegion(0); //open GDI}//*********************************************************************************************************//  Function    :   _OSDDLG_MEDIA_SELECT_FillButtonString//  Abstract    :   This function will fill the string of the button.//  Arguments   :   bIndex: the index of the button.//  Return		:   none.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************void _OSDDLG_MEDIA_SELECT_FillButtonString(BYTE bIndex){    switch (bIndex)    {    case OSDDLG_MEDIA_SELECT_BUTTON_DVDROM:        __pOSDUTLOutputString = aDLGBtnDVDROM;        break;#ifdef SUPPORT_STB            case OSDDLG_MEDIA_SELECT_BUTTON_STB:        __pOSDUTLOutputString = aDLGBtnSTB;              break;#endif        #ifdef SUPPORT_USB_SOURCE    case OSDDLG_MEDIA_SELECT_BUTTON_OTHERS:        __pOSDUTLOutputString = aDLGBtnUSB;        break;#endif //#ifdef SUPPORT_BUILDIN_CARD_READER    case OSDDLG_MEDIA_SELECT_BUTTON_CARD_READER:        __pOSDUTLOutputString = aDLGBtnCardReader;        break;#endif //SUPPORT_BUILDIN_CARD_READER#ifdef SUPPORT_AV_IN    case OSDDLG_MEDIA_SELECT_BUTTON_AVIN:        __pOSDUTLOutputString = aDLGBtnAVIN;              break;#endif// SUPPORT_AV_IN    default:        break;    }}//*********************************************************************************************************//  Function    :   _OSDDLG_MEDIA_SELECT_GetMaxButtonWidth//  Abstract    :   This function will fill the string of the button.//  Arguments   :   none.//  Return		:   Max. button width.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************WORD _OSDDLG_MEDIA_SELECT_GetMaxButtonWidth(void){    _wOSDDLGTemp1 = 0; //Use it and max. width.    for (_bOSDDLGTemp = 0; _bOSDDLGTemp < OSDDLG_MEDIA_SELECT_TOTAL_BUTTONS; _bOSDDLGTemp++)    {        //Fill string        _OSDDLG_MEDIA_SELECT_FillButtonString(_bOSDDLGTemp);        _wOSDDLGTemp = GDI_GetStringWidth_909(__pOSDUTLOutputString);        if (_wOSDDLGTemp1 < _wOSDDLGTemp)            _wOSDDLGTemp1 = _wOSDDLGTemp;    }    _wOSDDLGTemp1 += (OSDDLG_MEDIA_SELECT_BUTTON_TEXT_DISTANCE_H << 1);    return _wOSDDLGTemp1;}//*********************************************************************************************************//  Function    :   _OSDDLG_MEDIA_SELECT_GetDlgHeight//  Abstract    :   This function will calculate the height of the dialog box.//  Arguments   :   none.//  Return		:   The height of the dialog box.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************WORD _OSDDLG_MEDIA_SELECT_GetDlgHeight(void){    _wOSDDLGTemp1 = 0;    for (_bOSDDLGTemp = 0; _bOSDDLGTemp < OSDDLG_MEDIA_SELECT_TOTAL_BUTTONS; _bOSDDLGTemp++)    {        _wOSDDLGTemp1 += OSDDLG_MEDIA_SELECT_BUTTON_HEIGHT;    }    _wOSDDLGTemp1 += OSDDLG_MEDIA_SELECT_BUTTON_BUTTON_DISTANCE_V * (OSDDLG_MEDIA_SELECT_TOTAL_BUTTONS - 1);    _wOSDDLGTemp1 += (OSDDLG_MEDIA_SELECT_BACKGROUND_BUTTON_DISTANCE_V << 1);    return _wOSDDLGTemp1;}//*********************************************************************************************************//  Function    :   _OSDDLG_MEDIA_SELECT_DrawButton//  Abstract    :   This function will draw the button.//  Arguments   :   bIndex: the index of the button. bButtonState: The state of the button.  //  Return		:   none.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************void _OSDDLG_MEDIA_SELECT_DrawButton(BYTE bIndex, BYTE bButtonState){        _wOSDDLGButtonWidth = _OSDDLG_MEDIA_SELECT_GetMaxButtonWidth();    if (bButtonState == OSDDLG_BUTTON_STATE_HIGHLIGHT)        _OSDDLGRect.bColor = OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_HIGHLIGHT_BUTTON;        else        _OSDDLGRect.bColor = OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_NORMAL_BUTTON;        _OSDDLGRect.rect.wLeft = _OSDDLGAttribute.wStartH+OSDDLG_MEDIA_SELECT_BACKGROUND_BUTTON_DISTANCE_H;    _OSDDLGRect.rect.wTop = _OSDDLGAttribute.wStartV+OSDDLG_MEDIA_SELECT_BACKGROUND_BUTTON_DISTANCE_V+(bIndex*(OSDDLG_MEDIA_SELECT_BUTTON_HEIGHT+OSDDLG_MEDIA_SELECT_BUTTON_BUTTON_DISTANCE_V));    _OSDDLGRect.rect.wRight = _OSDDLGRect.rect.wLeft+_wOSDDLGButtonWidth;    _OSDDLGRect.rect.wBottom = _OSDDLGRect.rect.wTop+OSDDLG_MEDIA_SELECT_BUTTON_HEIGHT;    GDI_FillRect_909(0, &_OSDDLGRect);    //Fill string    _OSDDLG_MEDIA_SELECT_FillButtonString(bIndex);    //Draw string.    if (bButtonState == OSDDLG_BUTTON_STATE_HIGHLIGHT)        _OSDDLGStringAttr.bBackground = OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_HIGHLIGHT_BUTTON;    else        _OSDDLGStringAttr.bBackground = OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_NORMAL_BUTTON;    _OSDDLGStringAttr.bShadow1 = PAL_ENTRY_COLOR_TRANSPARENT;    _OSDDLGStringAttr.bShadow2 = PAL_ENTRY_COLOR_TRANSPARENT;    _OSDDLGStringAttr.bColorKey = 0;    if (bButtonState == OSDDLG_BUTTON_STATE_HIGHLIGHT)        _OSDDLGStringAttr.bTextColor = OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_HIGHLIGHT_BUTTON_STRING;    else        _OSDDLGStringAttr.bTextColor = OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_NORMAL_BUTTON_STRING;    _OSDDLGStringAttr.wX = _OSDDLGRect.rect.wLeft + ((_wOSDDLGButtonWidth - GDI_GetStringWidth_909(__pOSDUTLOutputString)) >> 1);    _OSDDLGStringAttr.wY = _OSDDLGRect.rect.wTop + ((OSDDLG_MEDIA_SELECT_BUTTON_HEIGHT - GDI_GetStringHeight_909(__pOSDUTLOutputString)) >> 1);            GDI_DrawString_909(0, &_OSDDLGStringAttr, __pOSDUTLOutputString);}//*********************************************************************************************************//  Function    :   _OSDDLG_MEDIA_SELECT_UpdateDlgBackground//  Abstract    :   This function will draw/clear the dialog box.//  Arguments   :   OSDDLG_UPDATE_DRAW/OSDDLG_UPDATE_CLEAR. //  Return		:   none.//  Side Effect :   none.//  Notes       :   _OSDDLGAttribute should be initialized before calling this function.//*********************************************************************************************************void _OSDDLG_MEDIA_SELECT_UpdateDlgBackground(BYTE bUpdate){    if (bUpdate == OSDDLG_UPDATE_DRAW)        _OSDDLGRect.bColor = OSDDLG_MEDIA_SELECT_PALETTE_ENTRY_GENERAL_BACKGROUND;        else        _OSDDLGRect.bColor = PAL_ENTRY_COLOR_TRANSPARENT;        _OSDDLGRect.rect.wLeft = _OSDDLGAttribute.wStartH;    _OSDDLGRect.rect.wTop = _OSDDLGAttribute.wStartV;    _OSDDLGRect.rect.wRight = _OSDDLGRect.rect.wLeft + _OSDDLGAttribute.wWidth;    _OSDDLGRect.rect.wBottom = _OSDDLGRect.rect.wTop+_OSDDLGAttribute.wHeight;    GDI_FillRect_909(0, &_OSDDLGRect);}//*********************************************************************************************************//  Function    :   OSDDLG_MEDIA_SELECT_Recover//  Abstract    :   This function will be called by OSD to do this UI's recovery.//  Arguments   :   bRecoverRegion: OSD_RECOVER_UPPER_REGION/OSD_RECOVER_BOTTOM_REGION/OSD_RECOVER_ALL//  Return		:   none.//  Side Effect :   none.//  Notes       :   //*********************************************************************************************************BYTE OSDDLG_MEDIA_SELECT_Recover(BYTE bRecoverRegion){    if (bRecoverRegion == OSD_RECOVER_ALL)    {        _OSDDLG_MEDIA_SELECT_ShowDialogBox(OSDDLG_SHOW_DLG_RECOVER, OSDDLG_MEDIA_SELECT_BACKGROUND_GENERAL_MODE);        return TRUE;    }    else        return FALSE;}#define OSDCOMDLG_MAIN_FILE//#include "string.lan"#include "OSDString\\strextrn.h"#define FRAME_THICKNESS      2#define OSDCOMDLG_MARGIN_H   50#define OSDCOMDLG_MARGIN_V   20#define LINE_HEIGHT       30#define ButtonWidth       90#define HIGHTLIGHT_BORDER 4#define BOTTOM_MARGIN     25#define BUTTON_SPACE      5PARM_RECT        _DLG_RectAttr;       // For clearing UIPARM_FRAME       _DLG_FrameAttr;PARM_DRAW_STRING _DLG_StrAttr;TIMEOUT_FUNC _pTimeoutFunc = NULL;CALLBACK_FUNC _pCallbackFunc = NULL;RECOVER_FUNC  _pRecoverFunc = NULL;WORD*     _pwString = NULL;BYTE      _bButtonNum = 0;BYTE      _bSelectButton = BUTTON_OK_YES;BOOL      _bOK_Cancel_ButtonType = TRUE;BOOL      _bDialogShowUp = FALSE;BYTE      _bWaitingTime = 0;DWORD     _dwLastTime = 0;extern BYTE __bSetupMode;extern void _OSDCOMDLG_InitPalette(void);extern void _OSDCOMDLG_ClearUI(void);extern void _OSDCOMDLG_DrawButtons(void);extern void _OSDCOMDLG_HighlightButton(BYTE bButton);extern void _OSDCOMDLG_ClearButtonsArea(void);extern BOOL _OSDCOMDLG_DrawStringWithAutoWrap(WORD wX, WORD wY, WORD* pwString);//**********************************************************************//  Function    :   OSDCOMDLG_Set_Buttons_Type //  Abstract    :   This function will set to show//                  "OK-Cancel" or "Yes-No" buttons.//  Arguments   :   bOK_Cancel_Buttons : //                                TRUE : Show "OK-Cancel" buttons//                               FALSE : Show "Yes-No" buttons//  Return	:   none.//  Side Effect :   none.//  Notes       :   //**********************************************************************void OSDCOMDLG_Set_Buttons_Type(BOOL bOK_Cancel_Buttons){    _bOK_Cancel_ButtonType = bOK_Cancel_Buttons;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -