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

📄 menu_new_pal.c

📁 lcd tv : MST9E19A原代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            case INPUTSOURCE_SVIDEO:
        #if (ENABLE_SCART)
            case INPUTSOURCE_SCART:
        #endif
                msOsdDrawStr_M(menuItem->XPos+1,menuItem->YPos,InputVideoText());
                break;

            case INPUTSOURCE_YPBPR:
                msOsdDrawStr_M(menuItem->XPos+1,menuItem->YPos,InputYPbPrText());
                break;
        }
    }
}

void DrawOsdMainFrame(void)
{
    BYTE i;
    WORD wTemp;
    msClearFbBlock(FONT_ASCII_SPACE, WRITECODEBASE, MAIN_MENU_H_SIZE, SUB_ICON_Y1-1); // Clear code
#if(FONT_UNIT==UI_2x1)
    msClearFbBlock(CP_YELLOWCOLOR, WRITEATTRBASE, MAIN_MENU_H_SIZE, SUB_ICON_Y1-1); // Clear attribute
#elif(FONT_UNIT==UI_1x1)    
    msClearFbBlock(CP_DARKBLUECOLOR, WRITEATTRBASE, MAIN_MENU_H_SIZE, SUB_ICON_Y1-1); // Clear attribute
#endif    
    wTemp = MAIN_MENU_H_SIZE*SUB_ICON_Y1;
    msClearFbBlock(FONT_ASCII_SPACE, WRITECODEBASE+wTemp, MAIN_MENU_H_SIZE, SUB_ICON_HEIGHT); // Clear code
#if(FONT_UNIT==UI_2x1)
    msClearFbBlock(CP_YELLOWCOLOR, WRITEATTRBASE+wTemp, MAIN_MENU_H_SIZE, SUB_ICON_HEIGHT); // Clear attribute
#elif(FONT_UNIT==UI_1x1)    
    msClearFbBlock(CP_DARKBLUECOLOR, WRITEATTRBASE+wTemp, MAIN_MENU_H_SIZE, SUB_ICON_HEIGHT); // Clear attribute//dragon 1110.
#endif
    msOsdSetTextColor(CT_MENU_COLORICON , COLORFONT);
    DrawOsdStr1_M(SUB_TITLE_X, SUB_TITLE_Y, MainFrame1());
    DrawOsdStr1_M(SUB_TAIL_X, SUB_TAIL_Y, MainFrame2());

    for (i = SUB_AREA_Y; i < SUB_TAIL_Y; i++)
    {
    #if(FONT_UNIT==UI_1x1)
    	msOsdDrawChar(SUB_TITLE_X, i, 0x2E);//0x2A);
    	msOsdDrawChar(MAIN_MENU_H_SIZE - 1, i, 0x2F);//0x2B);//dragon 1110.
    #else   //UI_2x1
    	msOsdDrawChar(SUB_TITLE_X, i, 0x52);
    	msOsdDrawChar(MAIN_MENU_H_SIZE - 1, i, 0x53);
    #endif
    }
}

//============================================================================
void DrawOsdMenuPage(MenuPageIndexType MenuPageIdx)
{
    BYTE uc;

    // draw osd menu item
    for(uc = 0; uc < tblMenus[MenuPageIdx].MenuItemCount; uc++)
    {
        DrawOsdMenuItemText(MenuPageIdx, uc);
        DrawOsdSubMenuGroup(MenuPageIdx, uc);
    }
}

//============================================================================
// draw menu item
void DrawOsdMenuItem(MenuPageIndexType MenuPageIdx, BYTE MenuItemIdx)
{
    DrawOsdMenuItemText(MenuPageIdx, MenuItemIdx);
    DrawOsdSubMenuGroup(MenuPageIdx, MenuItemIdx);
}

//============================================================================
void DrawOsdItemSelect(MenuPageType* menupage, BYTE ucItem)
{
    BYTE ucX, ucY, ucSubWinLen, ucColorType;
    MenuItemType* menuItem;

    menuItem = &menupage->MenuItems[ucItem];

    msOsdDisableSubWinAll();

    // draw selected color bar of menu item
    ucSubWinLen = menupage->ItemSelLength;
    if (ucSubWinLen)
    {
        ucX = menuItem->XPos;
        ucY = menuItem->YPos;
        ucColorType = menuItem->SelColorType;

        msOsdDrawSubWin(OSD_SUBWIN0, ucX, ucY, ucSubWinLen, ucColorType);
    }

    // draw selected color bar of menu item sub group
    if (menuItem->DrawSubMenuGroup)
    {
        ucSubWinLen = menupage->ItemSubGroupSelLength;
        if (ucSubWinLen)
        {
            ucX = menuItem->DrawSubMenuGroup->XPos;
            ucY = menuItem->DrawSubMenuGroup->YPos;
            ucColorType = menuItem->DrawSubMenuGroup->SelColorType;

            msOsdDrawSubWin(OSD_SUBWIN1, ucX, ucY, ucSubWinLen, ucColorType);
        }
    }
}

///////////////////////////////////////////////////////////////////////////
void DrawOsdStr1_M(BYTE ucX, BYTE ucY, WORD wStr)
{          
    BYTE* pStr;
    if(wStr==MainFrame1())
        pStr=MainFrame1_M();
    else if(wStr==MainFrame2())
        pStr=MainFrame2_M();
    else
        pStr=MainFrame1_M();

    msOsdDrawStr1(ucX,ucY,pStr);   
}

void DrawOsdColorIcon_M(BYTE ucX, BYTE ucY, WORD wStr, BYTE ucFlag )
{
    BYTE* pStr = NULL;
    WORD wAddress;
    BYTE ucWidth, ucHeight;
    BYTE ucHWPaleGroupIdx, ucAttr = 0;
    BYTE ucBorderAttr = 0;
    BYTE ucBank;
    StuFontInfo* pFontInfo;

    if(wStr==PictureIcon())
        pStr=PictureIcon_M();
    else if(wStr==SoundIcon())
        pStr=SoundIcon_M();
    else if(wStr==ChannelIcon())
        pStr=ChannelIcon_M();
    else if(wStr==FunctionIcon())
        pStr=FunctionIcon_M();
    else if(wStr==PcIcon())
        pStr=PcIcon_M();
    else if(wStr==OsdIcon())
        pStr=OsdIcon_M();
    else if(wStr==LogoIcon())
        pStr=LogoIcon_M();
    else
        pStr=PictureIcon_M();

    if( NULL == pStr )
        return;

    ucBank = msReadByte(BK0_00);
    msWriteByte(BK0_00, REG_BANK_SCALER);

    ucWidth = HINIBBLE(pStr[0]);
    ucHeight = LONIBBLE(pStr[0]);

    // Get the correct icon information
    if( ucFlag > 0 )
    {
        pStr += (3 + ucWidth*ucHeight)*ucFlag;
        ucWidth = HINIBBLE(pStr[0]);
        ucHeight = LONIBBLE(pStr[0]);
    }
    //===========================================================
    // Get Border color information
    pFontInfo = &(g_tFontInfoTbl[pStr[2]]);
    if( plttGetTblVar(pFontInfo->ucPaletteIdx, PALETTE_SIZE)&1 )
        ucBorderAttr |= 1;
    ucHWPaleGroupIdx = pFontInfo->ucHWPaletteIdx&0x7F;
    ucBorderAttr |= (ucHWPaleGroupIdx << 4);
    //==========================================================

    // Get font information
    pFontInfo = &(g_tFontInfoTbl[pStr[1]]);

    // Use tranparent color
    if( plttGetTblVar(pFontInfo->ucPaletteIdx, PALETTE_SIZE)&1 )
        ucAttr |= 1;

    // Use HW palette
    ucHWPaleGroupIdx = pFontInfo->ucHWPaletteIdx&0x7F;

    ucAttr |= (ucHWPaleGroupIdx << 4);
    // Check if the icon need downloading dynamic palette
    if( DOWNLOAD_PALETTE&pFontInfo->ucHWPaletteIdx )
    {
        // Download pallette
        msOsdLoadColor( ucHWPaleGroupIdx, pFontInfo->ucPaletteIdx, PALETTE_SIZE);
    }
    // Check if the icon need downloading dynamic font
    if( NULL != pFontInfo->pcFontData )
    {
    // Download font
        msOsdLoadFont(DRAM_COLOR_FONT_BUS|COMPRESS_DATA, pFontInfo->ucFontAddr, pFontInfo->pcFontData, pFontInfo->fpGetFontSize() );
    }
    // Set color font
    msWriteByte(BK0_AE, msReadByte(BK0_AE) | _BIT3);

    // Write OSD
    pStr += 3;
    wAddress = (WORD)(ucY * g_ucOsdWindowWidth) + ucX; // get real address
    for (ucY=0; ucY!=ucHeight; ucY++)
    {
        if(*(pStr)>0xFF)
            msWriteBit(BK0_AE, _ENABLE, _BIT0);
        else
            msWriteBit(BK0_AE, _DISABLE, _BIT0);

        msWrite2Bytes(BK0_A5, wAddress);

        // Write code
        msOsdSetIoAccess(DRAM_CODE_BUS | OSD_IO_BURST_MODE | OSD_IO_AUTO_INCREASE); // OSD code bus enable
        msOsdChkFifoFull(); // wait buffer not full
        for (ucX=0; ucX!=ucWidth; ucX++)
            msWriteByte(BK0_A7, *(pStr++));

        msOsdSetIoAccess(OSD_IO_WRITE_END | OSD_IO_BURST_MODE | OSD_IO_AUTO_INCREASE); // write end
        msOsdChkFifoEmpty(); // wait buffer empty

        // Write attr
        msWrite2Bytes(BK0_A8, wAddress);

        msOsdSetIoAccess(DRAM_ATTRIBUTE_BUS | OSD_IO_BURST_MODE | OSD_IO_AUTO_INCREASE); // OSD code bus enable
        msOsdChkFifoFull(); // wait buffer not full
        if(ucY==0 || ucY==(ucHeight-1))//draw top and bottom border
        {
            for (ucX=0; ucX!=ucWidth; ucX++)
                msWriteByte(BK0_AA, ucBorderAttr );
        }
        else
        {
            for (ucX=0; ucX!=ucWidth; ucX++)
            {
                if(ucX==0 || ucX==(ucWidth-1))//draw left and right border
                    msWriteByte(BK0_AA, ucBorderAttr );
                else
                    msWriteByte(BK0_AA, ucAttr );//draw icon
            }
        }

        msOsdSetIoAccess(OSD_IO_WRITE_END | OSD_IO_BURST_MODE | OSD_IO_AUTO_INCREASE); // write end
        msOsdChkFifoEmpty(); // wait buffer empty

        wAddress += g_ucOsdWindowWidth; // next address
    } // for
    
    msWriteBit(BK0_AE, _DISABLE, _BIT0);  //Disable bit8

    msWriteByte(BK0_00, ucBank);
}

//============================================================================
BYTE GetMenuDeep( BYTE ucMenuIdx )
{
    switch( ucMenuIdx )
    {
        case MENU_MAIN:
            return 1;
        case MENU_PICTURE:
        case MENU_SOUND:
        case MENU_CHANNEL:
        case MENU_FUNCTION:
        case MENU_PC:
        case MENU_PC_GEOMETRY:
        case MENU_OSD:

        case MENU_OSD_INFORMATION:
        case MENU_PC_COLORMODE:
        case MENU_SOUND_SUB_EQUALIZER:            
            return 2;
    }
    return 3;
}

BOOL IsItemSelectable( BYTE ucItemFlag )
{
    BOOL bRet=FALSE;

    switch(ucItemFlag)
    {
        case MI_SELECTABLE:
            bRet = TRUE;
            break;
         case MI_PC_ONLY:
            if( SrcTypeIsPC() )
                bRet = TRUE;
            break;
        case MI_VGA_ONLY:
             if( SRC_TYPE_IS_VGA() )
                bRet = TRUE;
            break;
        case MI_VIDEO_ONLY:
            if( SrcTypeIsVideo() )
                bRet = TRUE;
            break;
        case MI_TV_ONLY:
            if( SRC_TYPE_IS_TV() )
                bRet = TRUE;
            break;
        case MI_NTSC_ONLY:
            if( ( SrcTypeIsVideo() && g_SrcInfo.ucVideoSystem == SIG_NTSC ) &&
                ( g_VideoSetting.VideoPictureMode == PICTURE_MODE_USER ) )
                bRet = TRUE;
            break;
        case MI_SCART_FUNC_ONLY:
            if( IsScartInUse() )
                bRet = TRUE;
            break;
        case MI_VIDEO_NONE_TV_ONLY:
            if( IsVideoInUse() && !IsTVInUse())
                bRet = TRUE;
            break;
        case MI_3D_ONLY:
            if(IS_SRC_USE_3DDI())
                bRet = TRUE;
            break;
        case MI_ADC_ONLY:
            if (IsSrcUseAdcPort())
                bRet = TRUE;
            break;
        case MI_DYNAMIC0:
            if (g_VideoSetting.VideoPictureMode == PICTURE_MODE_USER)
                bRet = TRUE;
            break;
        case MI_DYNAMIC1:
            if (g_SoundSetting.SoundMode == SOUND_MODE_USER)
                bRet = TRUE;
            break;
        case MI_DYNAMIC2:
            if (g_PCColorSetting.ColorTempIndex == PC_COLOR_TEMP_USER)
                bRet = TRUE;
            break;
    }

    return bRet;
}

void DrawOsdMenu(void)
{
    XDATA BYTE ucBank;
    BOOL bRedraw;

    if(g_ucMenuPageIndex<MENU_FACTORY)
        g_ucFactoryFlag&=0x7F;//EXIT FACTORY MODE

    //printf("\r\nPageD=%x",g_ucMenuPageIndex);
    //printf("\r\nItemD=%x",g_ucMenuItemIndex);

    ucBank = msReadByte( BK0_00 );
    msWriteByte( BK0_00, REG_BANK_SCALER);

    if(CURRENT_MENU.Flags & MP_INVISIBLE)
    {
        msOsdHide();
    }
    else
    {
        // setup osd window & position
        bRedraw = FALSE;
        if(CURRENT_MENU.XSize != g_ucOsdWindowWidth || CURRENT_MENU.YSize != g_ucOsdWindowHeight ||
            !(msOsdReadByte(OSD_0C) & _BIT0) || g_ucMenuPageIndex==MENU_INPUT_MESSAGE

⌨️ 快捷键说明

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