📄 poweronmenu.c
字号:
#ifdef SUPPORT_POWER_SWITCH
if (!__bPowerSw_StandBy)
UTL_ShowLogo();
#else
UTL_ShowLogo();
#endif //SUPPORT_POWER_SWITCH
MEDIA_ClearUSBSwitchState();
#ifdef SUPPORT_POWER_SWITCH
if (!__bPowerSw_StandBy)
DISP_DisplayCtrl(DISP_MAINVIDEO, TRUE);
#endif //SUPPORT_POWER_SWITCH
#ifdef POWERON_STANDBY
DISP_DisplayCtrl(DISP_MAINVIDEO, TRUE);
#endif //POWERON_STANDBY
_bPOWERONMENUCursorIndex = 0;
__bPOWERONMENUInitial = TRUE;
_bPOWERONMENUSubUIMode = POWERONMENU_SUB_UI_MODE_NONE;
//CoCo2.51
//DISP_DisplayCtrl(DISP_TFT_MODE, FALSE);
_POWERONMENU_DrawAllUI();
OSDSS_ResetTime();
}
void _POWERONMENU_DrawAllUI(void)
{
if (__bLOGO == LOGO_NONE)
{
DISP_DisplayCtrl(DISP_MAINVIDEO, FALSE);
UTL_ShowLogo();
}
POWERONMENU_ConfigOSDRegion();
_POWERONMENU_InitializeGDI();
#ifdef SUPPORT_SYSTEM_SHORTCUT_KEY
if(Disable_Init_Menu())
return;
#endif
_POWERONMENU_ShowIcon();
_POWERONMENU_UpdateCursor(_bPOWERONMENUCursorIndex, FALSE);
}
//*********************************************************************************************************
// Function : POWERONMENU_ProcessKey
// Abstract : Call this function to process the keys.
// Arguments : none.
// Return : KEY_NO_KEY: The input key is processed.
// : INVALID_KEY: The input key is not allowed.
// : KEY_BYPASS: Will not process this key and pass it to main flow to process it.
// : KEY_XXX: The main program need do more process for the key.
// Side Effect : none.
// Notes :
//*********************************************************************************************************
#ifdef SUPPORT_SYSTEM_SHORTCUT_KEY
BYTE DisInitMenuFlag=FALSE;
BYTE Shortcut_Key_Entry(BYTE bkey)
{
switch(bkey)
{
case KEY_PHOTO:
_POWERONMENU_EnterPhotoMode();
bkey=KEY_NO_KEY;
break;
case KEY_MUSIC:
_POWERONMENU_EnterMusicMode();
bkey=KEY_NO_KEY;
break;
case KEY_PHOTO_MUSIC:
_POWERONMENU_EnterPhotoMusicMode();
bkey=KEY_NO_KEY;
break;
case KEY_MOVIE:
_POWERONMENU_EnterMovieMode();
bkey=KEY_NO_KEY;
break;
case KEY_DATE:
_bPOWERONMENUCursorIndex=POWERONMENU_ICON_ID_CALENDAR;
_bPOWERONMENUSubUIMode = POWERONMENU_SUB_UI_CALENDAR;
CALENDAR_Entry(CALENDAR_MODE_DISPLAY_CLOCK_AND_TIME);
bkey=KEY_NO_KEY;
break;
case KEY_TIME:
_bPOWERONMENUCursorIndex=POWERONMENU_ICON_ID_CLOCK;
_bPOWERONMENUSubUIMode = POWERONMENU_SUB_UI_CLOCK;
DisInitMenuFlag=TRUE;
CLOCK_Entry();
DisInitMenuFlag=FALSE;
bkey=KEY_NO_KEY;
break;
default:
break;
}
return bkey;
}
BYTE POWERONMENU_CheckKey(BYTE Prekey)
{
if(__bPOWERONMENUInitial)
{
if((_bPOWERONMENUSubUIMode>=POWERONMENU_SUB_UI_CALENDAR)&&(_bPOWERONMENUSubUIMode<=POWERONMENU_SUB_UI_EDIT))
{ extern BYTE _bCALENDARMode;
extern BYTE _bCLOCKMode;;
switch(Prekey)
{
case KEY_PHOTO:
case KEY_MUSIC:
case KEY_PHOTO_MUSIC:
case KEY_MOVIE:
POWERONMENU_Exit(OSD_UI_EXIT_ALL);
break;
case KEY_DATE:
if((_bPOWERONMENUCursorIndex==POWERONMENU_ICON_ID_CALENDAR)&&(_bPOWERONMENUSubUIMode == POWERONMENU_SUB_UI_CALENDAR)&&(_bCALENDARMode==CALENDAR_MODE_DISPLAY_CLOCK_AND_TIME))
{
Prekey=KEY_INVALID;
}
else
{
POWERONMENU_Exit(OSD_UI_EXIT_ALL);
}
break;
case KEY_TIME:
if((_bPOWERONMENUCursorIndex==POWERONMENU_ICON_ID_CLOCK)&&(_bPOWERONMENUSubUIMode == POWERONMENU_SUB_UI_CLOCK)&&(_bCLOCKMode == CLOCK_MODE_SHOW_CLOCK))
{
Prekey=KEY_INVALID;
}
else
{
POWERONMENU_Exit(OSD_UI_EXIT_ALL);
}
break;
default:
break;
}
}
}
else
{
switch(Prekey)
{
case KEY_PHOTO:
if(__bMMExtFilterMode==EXT_BIT_JPG)
{
Prekey=KEY_INVALID;
}
break;
case KEY_MUSIC:
if(__bMMExtFilterMode==(EXT_BIT_MP3|EXT_BIT_MP2|EXT_BIT_WMA))
{
Prekey=KEY_INVALID;
}
break;
case KEY_PHOTO_MUSIC:
if(__bMMExtFilterMode==( EXT_BIT_JPG|EXT_BIT_MP3|EXT_BIT_MP2|EXT_BIT_WMA))
{
Prekey=KEY_INVALID;
}
break;
case KEY_MOVIE:
if(__bMMExtFilterMode==( EXT_BIT_DAT|EXT_BIT_MPG|EXT_BIT_VOB|EXT_BIT_AVI))
{
Prekey=KEY_INVALID;
}
break;
case KEY_THUMBNAIL:
if (__bMMJPEGAudioMode)
{
Prekey=KEY_INVALID;
}
default:
break;
}
}
return Prekey;
}
BYTE POWERONMENU_PrevKey(BYTE Prekey)
{
Prekey=POWERONMENU_CheckKey(Prekey);
if ((Prekey != KEY_PHOTO) && (Prekey != KEY_MUSIC) && (Prekey != KEY_PHOTO_MUSIC) && (Prekey != KEY_MOVIE)&& (Prekey != KEY_DATE)&& (Prekey != KEY_TIME))
{
return Prekey;
}
if (__btPowerDown)
{
return KEY_NO_KEY;
}
if(__bPOWERONMENUInitial)
{
Prekey=Shortcut_Key_Entry(Prekey);
}
else
{
if (__btPowerDown)
{
return KEY_NO_KEY;
}
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (__bMMJPEGAudioMode)
{
MM_ExitJPEGAudioMode();
DisInitMenuFlag=TRUE;
POWERONMENU_Initial();
DisInitMenuFlag=FALSE;
}
else
#endif
{
#ifdef SUPPORT_COPY_FILE_IN_SLIDE_SHOW
MM_CopyDeleteMode_Exit();
#endif //SUPPORT_COPY_FILE_IN_SLIDE_SHOW
MEDIA_ExitUSBSRC();
DisInitMenuFlag=TRUE;
POWERONMENU_Initial();
DisInitMenuFlag=FALSE;
}
Prekey=Shortcut_Key_Entry(Prekey);
}
return Prekey;
}
BOOL Disable_Init_Menu(void)
{
return DisInitMenuFlag;
}
#endif
BYTE POWERONMENU_ProcessKey(void)
{
BYTE bMediaStatus;
#ifdef SUPPORT_SYSTEM_SHORTCUT_KEY
__bKey=POWERONMENU_PrevKey(__bKey);
#endif
if (!__bPOWERONMENUInitial)
{
if (__bKey == KEY_FUNCTION)
{
//Fix the problem about system dead when power off==>KEY_FUNCTION==>power on.
if (__btPowerDown)
{
return KEY_NO_KEY;
}
//elmer2.38a, exit USB for MM UI.
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (__bMMJPEGAudioMode)
{
if ((__bKey != KEY_PHOTO) && (__bKey != KEY_MUSIC) && (__bKey != KEY_PHOTO_MUSIC) && (__bKey != KEY_MOVIE))
{
MM_ExitJPEGAudioMode();
__bFWKey = KEY_FUNCTION;
return KEY_NO_KEY;
}
else
{
POWERONMENU_CheckModeKey();
}
}
else
{
#endif //SUPPORT_JPEG_AUDIO_PLAYING
MEDIA_ExitUSBSRC();
bMediaStatus = MediaInfo[_MapSourceID2Index(__SF_SourceGBL[__dwSFStreamID].bSourceIndex)].bState;
// wyc1.50-909, when doing pre-scan action, don't allow entering media select UI, otherwise system will auto play after exit
// media select UI but system should pause when entering media select UI.
/*
if ((bMediaStatus == MEDIA_INSERT) || (bMediaStatus == MEDIA_PARSING) || (bMediaStatus == MEDIA_RECOGNIZE) || ((__wDiscType & CDROM_M1) && (__bMotionState == MOTION_STATE_PRESCAN)))
{
return INVALID_KEY;
}
else
*/
{
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (__bMMJPEGAudioMode)
{
__bMMJPEGAudioMode = FALSE;
}
#endif //SUPPORT_JPEG_AUDIO_PLAYING
#ifdef SUPPORT_COPY_FILE_IN_SLIDE_SHOW
MM_CopyDeleteMode_Exit();
#endif //SUPPORT_COPY_FILE_IN_SLIDE_SHOW
POWERONMENU_Initial();
return KEY_NO_KEY;
}
}
}
else
{
return KEY_BYPASS;
}
}
if (__bKey == KEY_POWER)
return KEY_BYPASS;
if (__bKey == KEY_PLAY_PAUSE)
{
__bKey = KEY_ENTER;
}
POWERONMENU_CheckModeKey();
//CoCo1.11, clear the "Show Playable message".
if (_bPOWERONMENUShowPlayableFile)
{
OSDND_ClearRegion(OSD_ND_UPPER_RIGHT_REGION);
_bPOWERONMENUShowPlayableFile = FALSE;
}
switch (_bPOWERONMENUSubUIMode)
{
case POWERONMENU_SUB_UI_CALENDAR:
CALENDAR_ProcessKey();
break;
case POWERONMENU_SUB_UI_CLOCK:
CLOCK_ProcessKey();
break;
case POWERONMENU_SUB_UI_ALARM:
ALARM_ProcessKey();
break;
case POWERONMENU_SUB_UI_AUTO_POWER:
AUTOPWR_ProcessKey();
break;
case POWERONMENU_SUB_UI_EDIT:
EDIT_ProcessKey();
break;
#ifdef SUPPORT_GAME_ICON
case POWERONMENU_SUB_UI_GAME:
MAINMENU_Game_Menu_ProcessKey(__bKey);
break;
#endif //#ifdef SUPPORT_GAME_ICON
case POWERONMENU_SUB_UI_MODE_NONE:
default:
{
switch (__bKey)
{
case KEY_UP:
_POWERONMENU_GotoUpIcon();
break;
case KEY_DOWN:
_POWERONMENU_GotoDownIcon();
break;
case KEY_LEFT:
_POWERONMENU_GotoLeftIcon();
break;
case KEY_RIGHT:
_POWERONMENU_GotoRightIcon();
break;
case KEY_ENTER:
case KEY_PLAY:
return _POWERONMENU_ProcessIcon();
break;
default:
break;
}
}
break;
}
return KEY_NO_KEY;
}
void _POWERONMENU_ShowIcon(void)
{
BYTE bIconIndex;
PARM_DRAW_BITMAP DrawBitmap;
//Load palette for Navigaor's icons.
GDI_PALETTE_INFO PaletteInfo_PowerOnMenu = {POWERONMENU_BITMAP_PALETTE_INDEX_START, PAL_ADDR, _aPOWERONMENU_Palette};
GDI_LoadPalette(&PaletteInfo_PowerOnMenu);
//GDI_LoadBMP(_aPOWERONMENUBMPArray, POWERONMENU_TOTAL_ICON*2);
for (bIconIndex = 0; bIconIndex < POWERONMENU_TOTAL_ICON; bIconIndex++)
{
GDI_ChangePALEntry(PowerOnMenuIcon[bIconIndex].bNormalBGPaletteIndex, 0x5a000000, FALSE);
}
GDI_WaitPaletteComplete();
for (bIconIndex = 0; bIconIndex < POWERONMENU_TOTAL_ICON; bIconIndex++)
{
//Draw icon
DrawBitmap.bBitmapID = bIconIndex;
DrawBitmap.wDestX = PowerOnMenuIcon[bIconIndex].wStartX;
DrawBitmap.wDestY = PowerOnMenuIcon[bIconIndex].wStartY;
DrawBitmap.bDestRegion = 0;
//GDI_DrawBitmapBySW(&DrawBitmap, _aPOWERONMENUBMPArray);
GDI_DrawZipBitmap(&DrawBitmap, _aPOWERONMENUBMPArray, (PBYTE)POWERPNMENU_ICON_UNZIP_ADDR, POWERPNMENU_UNZIP_WINDOW_ADDR);
_POWERONMENU_DrawIconText(bIconIndex, FALSE);
}
}
void _POWERONMENU_UpdateCursor(BYTE bCursorIndex, BYTE bClear)
{
PARM_DRAW_BITMAP DrawBitmap;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -