📄 poweronmenu.c
字号:
//Change the icon to highlight icon
if (bClear)
{
DrawBitmap.bBitmapID = bCursorIndex;
}
else
{
DrawBitmap.bBitmapID = bCursorIndex+POWERONMENU_TOTAL_ICON;
}
DrawBitmap.wDestX = PowerOnMenuIcon[bCursorIndex].wStartX;
DrawBitmap.wDestY = PowerOnMenuIcon[bCursorIndex].wStartY;
DrawBitmap.bDestRegion = 0;
//GDI_DrawBitmapBySW(&DrawBitmap, _aPOWERONMENUBMPArray);
GDI_DrawZipBitmap(&DrawBitmap, _aPOWERONMENUBMPArray, (PBYTE)POWERPNMENU_ICON_UNZIP_ADDR, POWERPNMENU_UNZIP_WINDOW_ADDR);
//Update the background of the icon
if (bClear)
{
GDI_ChangePALEntry(PowerOnMenuIcon[bCursorIndex].bNormalBGPaletteIndex, 0x5a000000, FALSE);
_POWERONMENU_DrawIconText(bCursorIndex, FALSE);
}
else
{
GDI_ChangePALEntry(PowerOnMenuIcon[bCursorIndex].bHighlightBGPaletteIndex, POWERONMENU_PALETTE_COLOR_ICON_HIGHLIGHT_BACKGROUND, FALSE);
_POWERONMENU_DrawIconText(bCursorIndex, TRUE);
}
}
// ***************************************************************************
// Function : POWERONMENU_ConfigOSDRegion
// Description :
// Arguments : None.
// Return : None.
// Side Effect :
// ***************************************************************************
void POWERONMENU_ConfigOSDRegion(void)
{
GDI_REGION_INFO RegionInfo;
#ifdef BORROW_FRAME_BUFFER
DWORD dwBufferAddr;
#endif //
GDI_ClearRegion(0);
#ifdef BORROW_FRAME_BUFFER
if ((POWERPNMENU_WIDTH == __RegionList[0].wWidth) && (POWERPNMENU_HEIGHT <= __RegionList[0].wHeight) &&
(GDI_OSD_8B_MODE == __RegionList[0].bColorMode))
{
return;
}
else if (__RegionList[0].bColorMode != GDI_OSD_8B_MODE) // Thumbnail mode & preview mode
{
// Use Frame buffer 1 or 2
dwBufferAddr = DISP_QueryAvailableBuffer();
if (0 == dwBufferAddr)
{
RegionInfo.dwTAddr = DS_OSDFRAME_ST;
}
else
{
RegionInfo.dwTAddr = dwBufferAddr;
}
}
else
{
// Use OSD buffer and Frame buffer 0
RegionInfo.dwTAddr = DS_OSDFRAME_ST; // Use OSD buffer and Frame buffer 0
}
#else
RegionInfo.dwTAddr = DS_OSDFRAME_ST;
#endif // #ifdef BORROW_FRAME_BUFFER
RegionInfo.wWidth = POWERPNMENU_WIDTH;
RegionInfo.wHeight = POWERPNMENU_HEIGHT;
RegionInfo.bColorMode = GDI_OSD_8B_MODE;
#ifdef BORROW_FRAME_BUFFER
OSD_SetRegion(0, TRUE, &RegionInfo);
#else
OSD_SetRegion(0, FALSE, &RegionInfo);
#endif
}
void _POWERONMENU_GotoDownIcon(void)
{
BYTE bIconIndex;
DWORD dwDistance = 0;
DWORD dwShortestDistance = 0xFFFFFFFF;
WORD wX, wY;
BYTE bLatestIndex = _bPOWERONMENUCursorIndex;
for (bIconIndex = 0; bIconIndex < POWERONMENU_TOTAL_ICON; bIconIndex++)
{
if (PowerOnMenuIcon[bIconIndex].wStartY > PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY)
{
if (PowerOnMenuIcon[bIconIndex].wStartX >= PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX)
{
wX = PowerOnMenuIcon[bIconIndex].wStartX-PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX;
}
else
{
wX = PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX-PowerOnMenuIcon[bIconIndex].wStartX;
}
wY = PowerOnMenuIcon[bIconIndex].wStartY-PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY;
dwDistance = wX*wX+wY*wY;
if (dwDistance < dwShortestDistance)
{
dwShortestDistance = dwDistance;
bLatestIndex = bIconIndex;
}
}
}
_POWERONMENU_MoveCursor(bLatestIndex);
}
void _POWERONMENU_GotoUpIcon(void)
{
BYTE bIconIndex;
DWORD dwDistance = 0;
DWORD dwShortestDistance = 0xFFFFFFFF;
WORD wX, wY;
BYTE bLatestIndex = _bPOWERONMENUCursorIndex;
for (bIconIndex = 0; bIconIndex < POWERONMENU_TOTAL_ICON; bIconIndex++)
{
if (PowerOnMenuIcon[bIconIndex].wStartY < PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY)
{
if (PowerOnMenuIcon[bIconIndex].wStartX >= PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX)
{
wX = PowerOnMenuIcon[bIconIndex].wStartX-PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX;
}
else
{
wX = PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX-PowerOnMenuIcon[bIconIndex].wStartX;
}
wY = PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY-PowerOnMenuIcon[bIconIndex].wStartY;
dwDistance = wX*wX+wY*wY;
if (dwDistance < dwShortestDistance)
{
dwShortestDistance = dwDistance;
bLatestIndex = bIconIndex;
}
}
}
_POWERONMENU_MoveCursor(bLatestIndex);
}
void _POWERONMENU_MoveCursor(BYTE bNewCursorIndex)
{
if (bNewCursorIndex != _bPOWERONMENUCursorIndex)
{
_POWERONMENU_UpdateCursor(_bPOWERONMENUCursorIndex, TRUE);
_bPOWERONMENUCursorIndex = bNewCursorIndex;
_POWERONMENU_UpdateCursor(_bPOWERONMENUCursorIndex, FALSE);
}
}
void _POWERONMENU_GotoRightIcon(void)
{
BYTE bIconIndex;
DWORD dwDistance = 0;
DWORD dwShortestDistance = 0xFFFFFFFF;
WORD wX, wY;
BYTE bLatestIndex = _bPOWERONMENUCursorIndex;
for (bIconIndex = 0; bIconIndex < POWERONMENU_TOTAL_ICON; bIconIndex++)
{
if (PowerOnMenuIcon[bIconIndex].wStartX > PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX)
{
if (PowerOnMenuIcon[bIconIndex].wStartY >= PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY)
{
wY = PowerOnMenuIcon[bIconIndex].wStartY-PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY;
}
else
{
wY = PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY-PowerOnMenuIcon[bIconIndex].wStartY;
}
wX = PowerOnMenuIcon[bIconIndex].wStartX-PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX;
dwDistance = wX*wX+wY*wY;
if (dwDistance < dwShortestDistance)
{
dwShortestDistance = dwDistance;
bLatestIndex = bIconIndex;
}
}
}
_POWERONMENU_MoveCursor(bLatestIndex);
}
void _POWERONMENU_GotoLeftIcon(void)
{
BYTE bIconIndex;
DWORD dwDistance = 0;
DWORD dwShortestDistance = 0xFFFFFFFF;
WORD wX, wY;
BYTE bLatestIndex = _bPOWERONMENUCursorIndex;
for (bIconIndex = 0; bIconIndex < POWERONMENU_TOTAL_ICON; bIconIndex++)
{
if (PowerOnMenuIcon[bIconIndex].wStartX < PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX)
{
if (PowerOnMenuIcon[bIconIndex].wStartY >= PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY)
{
wY = PowerOnMenuIcon[bIconIndex].wStartY-PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY;
}
else
{
wY = PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartY-PowerOnMenuIcon[bIconIndex].wStartY;
}
wX = PowerOnMenuIcon[_bPOWERONMENUCursorIndex].wStartX - PowerOnMenuIcon[bIconIndex].wStartX;
dwDistance = wX*wX+wY*wY;
if (dwDistance < dwShortestDistance)
{
dwShortestDistance = dwDistance;
bLatestIndex = bIconIndex;
}
}
}
_POWERONMENU_MoveCursor(bLatestIndex);
}
//*********************************************************************************************************
// Function : POWERONMENU_Recover
// Abstract : Call this function to do recovery.
// Arguments : bRecoverRegion: OSD_RECOVER_UPPER_REGION/OSD_RECOVER_BOTTOM_REGION.
// Return : TRUE: The region is recovered.
// : FALSE: The region doesn't need to be recovered in THUMB UI.
// Side Effect : none.
// Notes :
//*********************************************************************************************************
BYTE POWERONMENU_Recover(BYTE bRecoverRegion)
{
if (bRecoverRegion == OSD_RECOVER_ALL)
{
switch (_bPOWERONMENUSubUIMode)
{
case POWERONMENU_SUB_UI_CALENDAR:
CALENDAR_Recover();
break;
case POWERONMENU_SUB_UI_CLOCK:
CLOCK_Recover(bRecoverRegion);
break;
case POWERONMENU_SUB_UI_ALARM:
ALARM_Recover(bRecoverRegion);
break;
case POWERONMENU_SUB_UI_AUTO_POWER:
AUTOPWR_Recover(bRecoverRegion);
break;
case POWERONMENU_SUB_UI_EDIT:
EDIT_Recover();
break;
#ifdef SUPPORT_GAME_ICON
case POWERONMENU_SUB_UI_GAME:
MAINMENU_Game_Menu_Recover();
break;
#endif //#ifdef SUPPORT_GAME_ICON
case POWERONMENU_SUB_UI_MODE_NONE:
default:
_POWERONMENU_DrawAllUI();
break;
}
}
return TRUE;
}
//*********************************************************************************************************
// Function : POWERONMENU_BackToMainMenu
// Abstract : Call this function to return to the main menu.
// Arguments : none.
// Return : none.
// Side Effect : none.
// Notes :
//*********************************************************************************************************
void POWERONMENU_BackToMainMenu(void)
{
_bPOWERONMENUSubUIMode = POWERONMENU_SUB_UI_MODE_NONE;
#if (DRAM_CONFIGURATION_TYPE == DRAM_SIZE_16)
OSDND_ConfigOSDRegion();
//GDI_ClearRegion(0);
#endif
_POWERONMENU_DrawAllUI();
}
//*********************************************************************************************************
// Function : POWERONMENU_Exit
// Abstract : This function will prepare all things to exit power on menu.
// Arguments : bExitMode: OSD_UI_EXIT_ALL/OSD_UI_EXIT_CONTROL_ONLY.
// Return : none.
// Side Effect : none.
// Notes :
//*********************************************************************************************************
void POWERONMENU_Exit(BYTE bExitMode)
{
__bPOWERONMENUInitial = FALSE;
switch (_bPOWERONMENUSubUIMode)
{
case POWERONMENU_SUB_UI_CALENDAR:
CALENDAR_Exit(FALSE);
break;
case POWERONMENU_SUB_UI_CLOCK:
CLOCK_Exit(FALSE);
break;
case POWERONMENU_SUB_UI_ALARM:
ALARM_Exit(FALSE);
break;
case POWERONMENU_SUB_UI_AUTO_POWER:
AUTOPWR_Exit(FALSE);
break;
case POWERONMENU_SUB_UI_EDIT:
EDIT_Exit(FALSE);
break;
#ifdef SUPPORT_GAME_ICON
case POWERONMENU_SUB_UI_GAME:
MAINMENU_Game_Menu_Exit(FALSE);
break;
#endif //#ifdef SUPPORT_GAME_ICON
case POWERONMENU_SUB_UI_MODE_NONE:
default:
break;
}
if (bExitMode == OSD_UI_EXIT_ALL)
{
GDI_ClearRegion(0);
}
}
void POWERONMENU_InternalExit(void)
{
POWERONMENU_Exit(OSD_UI_EXIT_ALL);
OSD_ChangeUI(OSD_UI_POWERON_MENU, OSD_EXIT_UI);
}
void POWERONMENU_ClearScreen(void)
{
// Clear the display buffer refer to current state (playing mode, power on menu/submenu, screen saver mode).
if (__bAttrPlay & TYPE_CDROM_AV)
{
HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_MPEG, HAL_DISP_CURRENTFRAME);
}
else if (__bAttrPlay == ATTR_JPG)
{
HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_JPEG, HAL_DISP_CURRENTFRAME);
}
else if (__bLOGO != LOGO_NONE)
{
HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_JPEG, HAL_DISP_CURRENTFRAME);
__bLOGO = LOGO_NONE;
}
#ifndef NO_SCREEN_SAVER
#ifdef OSDSS_JPEG_SCREEN_SAVER
else if (_bOSDSSScreenSaverMode)
{
HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_JPEG, HAL_DISP_CURRENTFRAME);
}
#endif
#endif
}
void _POWERONMENU_DrawIconText(BYTE bIconIndex, BYTE bHighlight)
{
PARM_DRAW_STRING IconStringAttr;
MAINMENU_UseColorKey(&IconStringAttr);
if (bHighlight)
{
IconStringAttr.bTextColor = POWERONMENU_PALETTE_ENTRY_ICON_HIGHLIGHT_TEXT;
}
else //normal
{
IconStringAttr.bTextColor = POWERONMENU_PALETTE_ENTRY_ICON_NORMAL_TEXT;
}
switch (PowerOnMenuIcon[bIconIndex].bIconID)
{
#ifdef SUPPORT_PHOTO_ICON
case POWERONMENU_ICON_ID_PHOTO:
__pOSDUTLOutputString = aPOWERONIconPhoto;
break;
#endif //SUPPORT_PHOTO_ICON
#ifdef SUPPORT_MUSIC_ICON
case POWERONMENU_ICON_ID_MUSIC:
__pOSDUTLOutputString = aPOWERONIconMusic;
break;
#endif //SUPPORT_MUSIC_ICON
#ifdef SUPPORT_PHOTO_MUSIC_ICON
case POWERONMENU_ICON_ID_PHOTO_PLUS_MUSIC:
__pOSDUTLOutputString = aPOWERONIconPhotoMusic;
break;
#endif //SUPPORT_PHOTO_MUSIC_ICON
#ifdef SUPPORT_MOVIE_ICON
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -