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

📄 osdfm.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    //Get button's name for each mode
    switch (__FMCtlBTNList[bButtonIndex].bButtonID)
    {
    case CTL_BTN_NEXT:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_40x40;
        GDI_CopyCodeString(aFMNextButton);
        break;
    case CTL_BTN_PREV:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_40x40;
        GDI_CopyCodeString(aFMPreviousButton);
        break;
    case CTL_BTN_PLAY:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_40x40;
        GDI_CopyCodeString(aFMPlayButton);
        break;
    case CTL_BTN_PROG:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_120x40;
        GDI_CopyCodeString(aFMProgramButton[_bOSDLang]);
        break;
    case CTL_BTN_THUMB:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_120x40;
        GDI_CopyCodeString(aFMThumbnailButton[_bOSDLang]);
        break;
    case CTL_BTN_RETURN:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_120x40;
        GDI_CopyCodeString(aFMReturnButton[_bOSDLang]);
        break;
    case CTL_BTN_PROG_LIST:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_120x40;
        GDI_CopyCodeString(aFMProgramListButton[_bOSDLang]);
        break;
    case CTL_BTN_CLEAR_ALL:
        __GDIParm.u.Button.bButtonId = BUTTON_ID_120x40;
        GDI_CopyCodeString(aFMClearAllButton[_bOSDLang]);
        break;
    default:
        break;
    }       

    //paste the button to the exact position.
    GDI_DrawButton((PPARM_BUTTON)&__GDIParm);
}

//***************************************************************************
//  Function    :   OSDFM_DrawButton
//  Abstract    :   This function will draw the specified button.
//  Arguments   :   bButtonIndex: The index of the button.
//              :   bHighlight: TRUE: The button is highlighted.
//              :               FALSE: The button is not highlighted.
//  Return		:   none.
//  Side Effect :   none.
//  Notes       :   
//***************************************************************************
void OSDFM_DrawButton(BYTE bButtonIndex, BYTE bHighlight)
{
    if (__bFMHide) //Don't draw the button.
        return;

    _OSDFM_GetButtonPos(OSDFM_BUTTON_START_H, bButtonIndex);

    SET_RECT(__GDIParm.u.Button.rect, _wHPos, OSDFM_BUTTON_START_V, (_wHPos+_OSDFM_GetButtonWidth(bButtonIndex)), (OSDFM_BUTTON_START_V+OSDFM_BUTTON_HEIGHT));

    if (bHighlight)
    {
        __GDIParm.u.Button.bStyle = BUTTON_HIGHLIGHT;
        GDI_SetTextColor(TEXT_BG_COLOR, BMP_ENTRY_BUTTON_COLOR_HIGHLIGHT);
        GDI_SetTextColor(TEXT_FG_COLOR, OSDFM_PALETTE_ENTRY_HIGHLIGHT_BUTTON_STRING);
    }
    else
    {
        if (__FMCtlBTNList[bButtonIndex].bStatus == BTN_ENABLE)
        {
            __GDIParm.u.Button.bStyle = BUTTON_NORMAL;
            GDI_SetTextColor(TEXT_BG_COLOR, BMP_ENTRY_BUTTON_COLOR_NORMAL);
            GDI_SetTextColor(TEXT_FG_COLOR, OSDFM_PALETTE_ENTRY_ENABLE_BUTTON_STRING);
        }
        else if (__FMCtlBTNList[bButtonIndex].bStatus == BTN_DISABLE)
        {
            __GDIParm.u.Button.bStyle = BUTTON_DISABLED;
            GDI_SetTextColor(TEXT_BG_COLOR, BMP_ENTRY_BUTTON_COLOR_DISABLE);
            GDI_SetTextColor(TEXT_FG_COLOR, OSDFM_PALETTE_ENTRY_DISABLE_BUTTON_STRING);
        }
    }

    _OSDFM_SetButtonAttribute(bButtonIndex);

    GDI_DRAW_STRING((_wHPos + ((_OSDFM_GetButtonWidth(bButtonIndex) - GDI_GetStringWidth()) >> 1)), (OSDFM_BUTTON_START_V + ((OSDFM_BUTTON_HEIGHT - GDI_GetStringHeight()) >> 1)));
}

//***************************************************************************
//  Function    :   _OSDFM_GetButtonPos
//  Abstract    :   Get the position of the button. The result will be saved in _wHPos.
//  Arguments   :   bStart: The starting position we want to display the button.
//              :   bButtonIndex: The index of the button.
//  Return		:   none.
//  Side Effect :   none.
//  Notes       :   
//***************************************************************************
void _OSDFM_GetButtonPos(BYTE bStart, BYTE bButtonIndex)
{
    _wHPos = bStart;
    
    for (__bTemp = 0; __bTemp < bButtonIndex; __bTemp++)
    {
        _wHPos += _OSDFM_GetButtonWidth(__bTemp);
        _wHPos += OSDFM_BUTTON_DISTANCE;
    }
}

//***************************************************************************
//  Function    :   _OSDFM_GetButtonWidth
//  Abstract    :   Call this function to get the width of the button.
//  Arguments   :   bButtonIndex: The index of the button.
//  Return		:   The width of the button.
//  Side Effect :   none.
//  Notes       :   
//***************************************************************************
BYTE _OSDFM_GetButtonWidth(BYTE bButtonIndex)
{
    switch (__FMCtlBTNList[bButtonIndex].bButtonID)
    {
    case CTL_BTN_NEXT:
    case CTL_BTN_PREV:
    case CTL_BTN_PLAY:
        return OSDFM_CIRCLE_BUTTON_WIDTH; 
    case CTL_BTN_PROG:
    case CTL_BTN_THUMB:
    case CTL_BTN_RETURN:
    case CTL_BTN_PROG_LIST:
    case CTL_BTN_CLEAR_ALL:
    default:
        return OSDFM_RECTANGLE_BUTTON_WIDTH;
    }
}

//***************************************************************************
//  Function    :   _OSDFM_DrawAllButtons
//  Abstract    :   This function will draw all buttons.
//  Arguments   :   bMode: OSDFM_FILE_MANAGER_MODE: Draw all buttons for File Manager.
//              :          OSDFM_PROGRAM_LIST_MODE: Draw all buttons for Program List.
//  Return		:   none.
//  Side Effect :   none.
//  Notes       :   
//***************************************************************************         
void _OSDFM_DrawAllButtons(BYTE bMode)
{
    //draw all buttons
    _bOSDFMTemp = 0;
    while (_bOSDFMTemp < MAX_BUTTON_NUM)
    {
        if (__FMCtlBTNList[_bOSDFMTemp].bButtonID != CTL_BTN_END)
        {
            if (bMode == OSDFM_FILE_MANAGER_MODE)
            {
                OSDFM_DrawButton(_bOSDFMTemp, FALSE);
            }
            else if (bMode == OSDFM_PROGRAM_LIST_MODE)
            {
                OSDPL_DrawButton(_bOSDFMTemp, FALSE);
            }
        }
        else
            return;

        _bOSDFMTemp++;
    }
}

#endif //SUPPORT_FM_BUTTONS

//***************************************************************************
//  Function    :   _OSDFM_Initial
//  Abstract    :   Call this function to initialize the UI.
//  Arguments   :   none.
//  Return		:   none.
//  Side Effect :   none.
//  Notes       :   
//***************************************************************************
void _OSDFM_Initial(BYTE bMode)
{
    _OSDFM_InitializeGDI();    
    
    //Set the color of the background, color of the text, and vertical starting position for upper right message.
    __bOSDBg = OSDFM_PALETTE_ENTRY_GENERAL_BACKGROUND;
    __bOSDFg = OSDFM_PALETTE_ENTRY_TITLE_STRING;
    __wOSDUpVPos = OSDFM_DISPLAY_TITLE_START_V;
    __wOSDUpHPos = OSDFM_DISPLAY_BIG_FRAME_H+OSDFM_DISPLAY_BIG_FRAME_WIDTH;
    __wOSDBottomVPos = OSDFM_DISPLAY_HELP_STRING_START_V;
    __wOSDBottomHPos = OSDFM_DISPLAY_HELP_STRING_START_H;

    //For active playing file.
    _OSDFMFlashCount = 0;

    __bActiveDirChange = FALSE;
    _bRecoverUI = FALSE;

    _bOSDFMHelpType = OSDFM_HELP_TYPE_NONE;   //Initialize the type of the help.
    _bOSDFMTitleType = OSDFM_TITLE_TYPE_NONE; //Initialize the type of the title.

    // Brian0.84-2nd, inform OSD module that the we are entering FM
    // this statement will be moved to Fmanager module later
    //_bCurrentUI = OSD_UI_FM; //For OSD control
    OSD_Output(MSG_GUI, OSD_UI_FM, 0xFF);

    _OSDFM_DrawBigFrame();

    //draw vertical separate frame
    _OSDFM_DrawSeparateFrame(OSDFM_VERTICAL_SEPARATE_FRAME);

    //draw horizontal separate frame
#ifdef SUPPORT_JPEG_PREVIEW
    _OSDFM_DrawSeparateFrame(OSDFM_HORIZONTAL_SEPARATE_FRAME);
#endif
            
    _OSDFM_DrawLeftFileWindow();
       
    if (bMode == MODE_INITIAL_UI)
    {
        if (__FMSelectCursor.bPosition == POS_FILE_LIST)
        {
            __wStartDrawItem = (__FMSelectCursor.wIndex / OSDFM_MAX_ITEM_IN_FILE_WINDOW)*OSDFM_MAX_ITEM_IN_FILE_WINDOW;
        }
        else
            __wStartDrawItem = 0;

        _bOSDFMPlayingTitle = FALSE;
    }
    else //KEY_MENU to show UI.
    {
        if (__FMSelectCursor.bPosition == POS_FILE_LIST)
        {
            if (!_bResetState) //keep the previos state.
            {
                if (__FMSelectCursor.wIndex < __wStartDrawItem) //scroll up
                {
                    __wStartDrawItem = __FMSelectCursor.wIndex;
                }
                else if (__FMSelectCursor.wIndex > (__wStartDrawItem + OSDFM_MAX_ITEM_IN_FILE_WINDOW - 1))
                {
                    __wStartDrawItem = __FMSelectCursor.wIndex + 1 -  OSDFM_MAX_ITEM_IN_FILE_WINDOW;
                }
            }
            else //Reset the state. Change DIR.
            {
                __wStartDrawItem = (__FMSelectCursor.wIndex / OSDFM_MAX_ITEM_IN_FILE_WINDOW)*OSDFM_MAX_ITEM_IN_FILE_WINDOW;
            }            
        }
        else
            __wStartDrawItem = 0;

        if (_bOSDFMPlayingTitle && (!__btInputProgram))
        {
            _OSDFM_UpdatePlayingTitle();
        }
    }

    //Don't put this flag before calculating __wStartDrawItem
    _bResetState = FALSE;

    _OSDFM_DrawRightFileWindow();

#ifdef SUPPORT_FM_BUTTONS    
    //draw all buttons
    _OSDFM_DrawAllButtons(OSDFM_FILE_MANAGER_MODE);
#endif

    _OSDFM_UpdateHighlight(UPDATE_HIGHLIGHT_DRAW);
}


//***************************************************************************
//  Function    :   _OSDFM_PrepareUpdateTitle
//  Abstract    :   Call this function to prepare to update the title string.
//  Arguments   :   none.
//  Return		:   none.
//  Side Effect :   none.
//  Notes       :   
//***************************************************************************
void _OSDFM_PrepareUpdateTitle(void)
{
    _bOSDFMTemp = _bOSDFMTitleType;
    _bOSDFMUpdate = FALSE;
    
    if (__btInputProgram)
    {
        _bOSDFMTitleType = OSDFM_TITLE_TYPE_PROGRAM;
    }
    else //general mode
    {
        switch (__FMSelectCursor.bPosition)
        {
        case POS_DIR_LIST:

⌨️ 快捷键说明

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