📄 osdfm.c
字号:
#define OSDFM_MAIN_FILE
#include "winav.h"
#include "osd.h"
#include "OSDFM.h"
#include "Fmanager.h"
#include "cdinfo.h"
#include "hal.h"
#include "cc.h"
#include "utl.h"
#include "comutl.h"
#include "linear.h"
#include "servo.h"
#include "String.lan"
//***************************************************************************
//Note: Don't translate the following strings.
WORD code aFMRootIcon[] = {1, CHAR_ROOT_26};
WORD code aFMUpFolderIcon[] = {1, CHAR_UPFOLDER_26};
WORD code aFMFolderIcon[] = {1, CHAR_FOLDER_26};
WORD code aFMOpenFolderIcon[] = {1, CHAR_OPENFOLDER_26};
WORD code aFMJPEGIcon[] = {1, CHAR_JPEG_26};
WORD code aFMMP3Icon[] = {1, CHAR_MP3_26};
WORD code aFMWMAIcon[] = {1, CHAR_WMA_26};
#ifdef SUPPORT_DISPLAY_INVALID_AUDIO_FILE //CoCo2.39, support displaying invalid audio file.
WORD code aFMQuestionIcon[] = {1, CHAR_QUESTION};
#endif
#ifdef DOLBY_CERTIFICATION
WORD code aFMAC3Icon[] = {1, CHAR_AC3_26};
#endif
#ifdef SUPPORT_FM_VOB
WORD code aFMVOBIcon[] = {1, CHAR_VOB_26};
#endif
WORD code aFMMPGIcon[] = {1, CHAR_MPG_26};
#if defined(SUPPORT_CDROM_DAT) || defined(SUPPORT_DVDROM_DAT)
WORD code aFMDATIcon[] = {1, CHAR_DAT_26};
#endif
WORD code aFMSlash[][2] = {{1, CHAR_SLASH_26},
{1, CHAR_SLASH}};
WORD code aFMSpace[][2] = {{1, CHAR_SPACE_26},
{1, CHAR_SPACE}};
WORD code aFMMouhow[][2] = {{1, CHAR_MH_26},
{1, CHAR_MOUHOW}};
//Playing file
WORD code aFMPlayingFileTitle[] = {2, CHAR_N_TITLE, CHAR_MH_26};
WORD code aFMPlayingFolderTitle[] = {1, CHAR_OPENFOLDER_26};
#ifdef SUPPORT_FM_BUTTONS
//string for item (Program List UI)
WORD code aPLItemString[] = {2, CHAR_DOT, CHAR_SPACE};
//The string in the JPEG's window
WORD code aPLMP3[] = {3, CHAR_M, CHAR_P, CHAR_3};
WORD code aPLAC3[] = {3, CHAR_A, CHAR_C, CHAR_3};
WORD code aPLWMA[] = {3, CHAR_W, CHAR_M, CHAR_A};
WORD code aPLMPG[] = {3, CHAR_M, CHAR_P, CHAR_G};
WORD code aPLDAT[] = {3, CHAR_D, CHAR_A, CHAR_T};
WORD code aPLVOB[] = {3, CHAR_V, CHAR_O, CHAR_B};
WORD code aPLJPEG[] = {4, CHAR_J, CHAR_P, CHAR_E, CHAR_G};
#endif
//***************************************************************************
WORD __wStartDrawItem; //The staring item in the right file window.
BYTE __bStartDrawDir; //The starting item in the left file window.
BYTE __bActiveDirChange;
WORD _wOSDFMTemp;
BYTE _bOSDFMTemp, _bOSDFMTemp1, _bOSDFMTemp2, _bOSDFMTemp3;
BYTE _bOSDFMHelpType;
BYTE _bOSDFMTitleType;
BYTE _bOSDFMUpdate;
BYTE _bRecoverUI;
WORD _wTransformFileIndex;
BYTE _bOSDFMPlayingTitle;
WORD _wFileIndex;
BYTE _bResetState;
BYTE _OSDFMFlashCount;
BYTE _bOSDFMIconType;
BYTE _bOSDFMDrawUnicodeString; //CoCo.236, support UNICODE string.
WORD _wOSDFMMaxStringSpace; //CoCo.236, support UNICODE string.
extern WORD _wHPos;
extern WORD __wVStart;
extern BYTE DATA _bOSDLang;
//OSD global variables
extern BYTE __bOSDFg;
extern BYTE __bOSDBg;
extern WORD __wOSDUpVPos;
extern WORD __wOSDUpHPos;
extern WORD __wOSDBottomVPos;
extern WORD __wOSDBottomHPos;
extern BYTE _bCurrentUI;
extern BYTE __bFMHide;
extern BYTE __bDumpPage;
extern BYTE __bJolietTitle; //CoCo.236, support UNICODE string.
extern PFILE_RECORD __pFMFileRecord; //CoCo1.25, New structure of File Manager
//***************************************************************************
// Function : OSDFM_Update
// Abstract : Update the File Manager UI according to the message.
// Arguments : OSDFM_MSG_INITIAL: Send this message when enter Program List at first time.
// : OSDFM_MSG_UPDATE_HIGHLIGHT: Send this message when you want to update highlight.
// : OSDFM_MSG_CLEAR_HIGHLIGHT: Send this message when you want to clear highlight.
// : OSDFM_MSG_DRAW_FRAME: Send this message when you want to draw the frame for JPEG.
// : OSDFM_MSG_CLEAR_FRAME: Send this message when you want to clear the frame if it not a JPEG file.
// : OSDFM_MSG_UPDATE_CHANGE_DIR: Send this message when you change the directory at the same level.
// : OSDFM_MSG_DRAW_PROGRAM: Send this message when you want to draw a selected frame for current cursor in Program Mode.
// : OSDFM_MSG_CLEAR_PROGRAM: Send this message when you want to clear a selected frame for current cursor in Program Mode.
// : OSDFM_MSG_UPDATE_FILE_WINDOW_NEXT: Send this message when user press KEY_NEXT or "Next" button.
// : OSDFM_MSG_UPDATE_FILE_WINDOW_PREVIOUS: Send this message when user press KEY_PREVIOUS or "previous" button.
// : OSDFM_MSG_UPDATE_CHANGE_DIR_LEVEL: Send this message when you change the directory level.
// Return : none.
// Side Effect : none.
// Notes :
//***************************************************************************
void OSDFM_Update(BYTE bMessage)
{
switch (bMessage)
{
case OSDFM_MSG_INITIAL:
if (!__bFMHide)
{
#ifdef SUPPORT_JPEG_3_FRAMES
GDI_SetFonTableAddr(FONT_TABLE_NORMAL);
#endif
_OSDFM_Initial(MODE_INITIAL_UI);
}
break;
case OSDFM_MSG_SHOW:
_OSDFM_CloseCDIF();
#ifdef SUPPORT_JPEG_3_FRAMES
GDI_SetFonTableAddr(FONT_TABLE_NORMAL);
#endif
_OSDFM_Initial(MODE_SHOW_UI);
break;
case OSDFM_MSG_UPDATE_HIGHLIGHT:
if (!__bFMHide)
_OSDFM_UpdateHighlight(UPDATE_HIGHLIGHT_DRAW);
break;
case OSDFM_MSG_CLEAR_HIGHLIGHT:
if (!__bFMHide)
_OSDFM_UpdateHighlight(UPDATE_HIGHLIGHT_CLEAR);
break;
//CoCo1.01, for moving cursor when playing
case OSDFM_MSG_CLEAR_ACTIVE_PLAYING_FILE:
if (!__bFMHide)
_OSDFM_UpdateActivePlayingFile(UPDATE_ACTIVE_PLAYING_FILE_CLEAR);
break;
case OSDFM_MSG_PLAYING:
if (!__bFMHide)
_OSDFM_UpdatePlayingTitle();
break;
case OSDFM_MSG_FLASH_PLAYING_FILE:
if (!__bFMHide)
_OSDFM_FlashPlayingFile(FALSE);
break;
case OSDFM_MSG_STOP:
if (!__bFMHide)
{
_OSDFM_UpdateTitle();
_OSDFMFlashCount = (OSDFM_FLASH_ACTIVE_FILE_COUNT << 1) - 1;
_OSDFM_FlashPlayingFile(FALSE);
//Clear time region
_OSDFM_ClearRegion(OSDFM_CLEAR_RECOVER_UPPER_REGION);
}
_OSDFMFlashCount = 0;
_bOSDFMTitleType = OSDFM_TITLE_TYPE_NONE;
_bOSDFMPlayingTitle = FALSE;
break;
//CoCo1.01, for moving cursor when playing
case OSDFM_MSG_UPDATE_ACTIVE_PLAYING_FILE:
if (!__bFMHide)
_OSDFM_UpdateActivePlayingFile(UPDATE_ACTIVE_PLAYING_FILE_DRAW);
break;
#ifdef SUPPORT_JPEG_PREVIEW //CoCo2.31, reduce code size
case OSDFM_MSG_DRAW_FRAME:
if (!__bFMHide)
_OSDFM_DrawJPEGFrame(UPDATE_FRAME_DRAW);
break;
case OSDFM_MSG_CLEAR_FRAME:
if (!__bFMHide)
_OSDFM_DrawJPEGFrame(UPDATE_FRAME_CLEAR);
break;
#endif
case OSDFM_MSG_UPDATE_CHANGE_DIR:
if (__bFMHide)
_bResetState = TRUE;
else
{
// wyc1.07, close CDIF when call this message to re-draw menu to avoid audio buffer overflow when MP3 playing and moving highlight. Close CDIF
// before this message is because follow message will spend long time to re-draw.
_OSDFM_CloseCDIF();
_OSDFM_ChangeDir();
}
break;
case OSDFM_MSG_UPDATE_PROGRAM_ITEM:
if (!__bFMHide)
{
//assign the file's index to _wFileIndex before calling _OSDFM_DrawSelectedFrame.
//Thus _OSDFM_DrawSelectedFrame() can draw the selected frame according to the width of the file's name.
_wFileIndex = (WORD)(__FMSelectCursor.wIndex - __pFMDirTree[__bFMActiveDir].bNoOfSubDir);
if (LINEAR_ProgramEntryOperation(LINEAR_QUERY_INDEX, 0, __bFMActiveDir, (WORD)(__FMSelectCursor.wIndex - __pFMDirTree[__bFMActiveDir].bNoOfSubDir+1)) != 0xFF)
{
//draw the selected frame
_OSDFM_DrawSelectedFrame(UPDATE_FRAME_DRAW, (BYTE)((__FMSelectCursor.wIndex - __wStartDrawItem)%OSDFM_MAX_ITEM_IN_FILE_WINDOW));
}
else
_OSDFM_DrawSelectedFrame(UPDATE_FRAME_CLEAR, (BYTE)((__FMSelectCursor.wIndex - __wStartDrawItem)%OSDFM_MAX_ITEM_IN_FILE_WINDOW));
}
break;
case OSDFM_MSG_UPDATE_FILE_WINDOW_NEXT:
if (!__bFMHide)
{
// wyc1.07, close CDIF when call this message to re-draw menu to avoid audio buffer overflow when MP3 playing and moving highlight. Close CDIF
// before this message is because follow message will spend long time to re-draw.
_OSDFM_CloseCDIF();
_OSDFM_ChangePage(CHANGE_PAGE_NEXT);
}
break;
case OSDFM_MSG_UPDATE_FILE_WINDOW_PREVIOUS:
if (!__bFMHide)
{
// wyc1.07, close CDIF when call this message to re-draw menu to avoid audio buffer overflow when MP3 playing and moving highlight. Close CDIF
// before this message is because follow message will spend long time to re-draw.
_OSDFM_CloseCDIF();
_OSDFM_ChangePage(CHANGE_PAGE_PREVIOUS);
}
break;
case OSDFM_MSG_UPDATE_CHANGE_DIR_LEVEL:
if (__bFMHide)
_bResetState = TRUE;
else
{
// wyc1.07, close CDIF when call this message to re-draw menu to avoid audio buffer overflow when MP3 playing and moving highlight. Close CDIF
// before this message is because follow message will spend long time to re-draw.
_OSDFM_CloseCDIF();
_OSDFM_ChangeDirLevel();
}
break;
case OSD_MSG_RECOVER_UPPPER_REGION:
if (!__bFMHide)
_OSDFM_RecoverDisplayUpperRegion();
break;
case OSD_MSG_RECOVER_BOTTOM_REGION:
if (!__bFMHide)
_OSDFM_RecoverDisplayBottomRegion();
break;
case OSDFM_MSG_CHANGE_MODE: //CoCo1.10, for changing mode recovery.
_OSDFM_CloseCDIF();
_OSDFM_ChangeMode();
break;
#ifdef SUPPORT_DISPLAY_INVALID_AUDIO_FILE //CoCo2.39, support displaying invalid audio file.
case OSDFM_MSG_INVALID_AUDIO_FILE:
_OSDFM_ShowInvalidAudioFile();
break;
#endif
//show time
case MSG_ABSTIME:
case MSG_RELTIME:
case MSG_TITLE_TIME:
case MSG_CHAPTER_TIME:
case MSG_REMAIN_ABSTIME:
case MSG_REMAIN_RELTIME:
case MSG_REMAIN_TITLE_TIME:
case MSG_REMAIN_CHAPTER_TIME:
if (!__bFMHide)
_OSDFM_ShowTime();
break;
default:
break;
}
}
#ifdef SUPPORT_FM_BUTTONS
//***************************************************************************
// Function : _OSDFM_SetButtonAttribute
// Abstract : This function will set common attributes for the button including draw the button and it's name.
// Arguments : bButtonIndex: The index of the button in the button list array.
// : bHighlight: The button is highlighted or not. TRUE==>highlight. FALSE==>not highlighted.
// Return : none.
// Side Effect : none.
// Notes :
//***************************************************************************
void _OSDFM_SetButtonAttribute(BYTE bButtonIndex)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -