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

📄 mm_ui.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 5 页
字号:
//////////////////////////////////////////////////////////////
// ****** All necessary including files Area ******
#include    "winav.h"
// wyc0.60-909, include ctkav.h and <cyg/kernel/kapi.h> for thread control.
#include "ctkav.h"
#include    <string.h>
#include    "input.h"
#include    "infofilter.h"
#include    "cc.h"
#include    "osd.h"
#include    "mmanager.h"
#include    "utl.h"
#include    "initial.h" 
#include    "SrcFilter.h"
#include    "monitor.h"
#include    "setup.h"
#include    "chips.h"
#include    "hal.h"
#include    "linear.h"
#include    "thumb.h" 
#include    "osdmm.h"
#include    "panel.h"
#include    "parser.h"
#include    "disp.h"
#include    "jpegdec.h"
#include    "disp.h" 
#include    "media.h"
#include    "osddlg.h"
#ifdef CT950_STYLE
#include "rtcdrv.h"
#include "autopower.h"
#endif //CT950_STYLE

#ifdef SUPPORT_POWERON_MENU
#include "poweronmenu.h"
#endif //SUPPORT_POWERON_MENU

#include "gdi.h" 
#include "comutl.h"

#include "debug.h"
#undef PRINTF
#undef printf
// Micky2.17c
#ifdef	APPLICATION_WINDOWS
#define PRINTF		DBG_Printf_Simple
#define printf		DBG_Printf_Simple
#else
#define PRINTF(x, y...)     DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR, x, ## y)
#define printf(x, y...)     DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, x, ## y)
#endif

//////////////////////////////////////////////////////////////
// wyc1.05, add a new variable to record the next going directory, purpose is to moving highlight between directories when issuing KEY_UP/KEY_DOWN.
// Keep the next to go directory ID, index from '0' -- WYC1.05
BYTE    _bMMNextSelectDir;

// wyc1.05, add a new variable to record the type of moving cursor across boundary. One is KEY_NEXT/KEY_PREVher is KEY_UP/KEY_DOWN.
// Record the type of moving cursor across boundary.
BYTE    _bMMAcrossDirType;
//////////////////////////////////////////////////////////////
CURSOR_INFO __MMPlayingItem ;
CURSOR_INFO __MMSelectCursor;
WORD    __wMMNewCursorIndex;
//////////////////////////////////////////////////////////////
BYTE __bMMMenuID; // =MM_MENU_NONE;
BYTE __bMMPopMenuID;
BYTE __bMMInitMenu;
//////////////////////////////////////////////////////////////
DWORD __dwMMKeyToDo;
//////////////////////////////////////////////////////////////
#ifdef SUPPORT_AUDIO_EFFECT
BYTE _bAudioEQ = 0;
#endif //SUPPORT_AUDIO_EFFECT
///////////////////////////////////////////////////////////
extern  BYTE    __bMMSaveProgress;

///////////////////////////////////////////////////////////
extern  BIT     __btInputProgram;
extern DWORD __dwMMJPGBuffEmptyTime;#ifdef IMAGE_FRAME_SETUP //CoCo2.38
extern IMAGE_FRAME_SETUPINFO __ImageFrameSetupInfo;
#endif //IMAGE_FRAME_SETUP

extern BYTE CC_PWRCtrl(void);
///////////////////////////////////////////////////////////

//  ***************************************************************************
//  Function    :   MM_UpdateMenuInfo
//  Description :   Update the highlight/ selection info for Menu
//  Arguments   :   bKey    : The user key
//  Return      :   KEY_NO_KEY  , the input key is processed
//              :   INVALID_KEY , the input key is not allowed under this mode
//              :   KEY_xxx     , the main program need do more process for the key.
//  Side Effect :
//  Global      :
//  ***************************************************************************
BYTE MM_UpdateMenuInfo(BYTE bKey)
{
    BYTE    bMMRet;

    switch(bKey)
    {
    case KEY_THUMBNAIL:
        if ((__MMSelectCursor.wIndex < __pMMVolumeDirTree[__MMSelectCursor.wDirID].bNoOfSubDir)
            || (__pMMFileRecordStart[MM_ID_RelativeToAbsolute(__MMSelectCursor.wDirID, (__MMSelectCursor.wIndex-__pMMVolumeDirTree[__MMSelectCursor.wDirID].bNoOfSubDir))].FileName.bExtID != EXTNAME_JPG))
		{
            return INVALID_KEY;
		}
        __bMMMenuID=MM_MENU_NONE;
        OSDMM_Update(OSDMM_MSG_EXIT,0);
        MM_EnterThumbMode();
        return KEY_NO_KEY;

#ifdef SUPPORT_COPY_FILE_IN_MM_UI
    case    KEY_MM_FILECOPY:
         MM_InitialMenu(MM_MENU_ENCODE_FILE, FALSE);
        break;
#endif //
    case    KEY_PROGRAM:
#ifdef SUPPORT_FM_PROGRAM //CoCo1.05, use "SUPPORT_FM_PROGRAM" define to open/close program function.
        if ((!__btInputProgram) && (!__btPlayingProgram))
        {
             LINEAR_Program(LINEAR_PROGRAM_MODE,(BYTE)NULL);

            // Set __bProgramCurrentIndex as __bProgramMaxEnty while enter program mode
            // Otherwise, previous program mode data will be destroyed
            // while program mode playing --> enter program mode again
            // Notice: must put this procedure after LINEAR_PROGRAM_MODE
            // because __bProgramCurrentIndex value will be set to zero wihtin it
            __bProgramCurrentIndex=__bProgramMaxEntry;
            __bRepeat = REPEAT_NONE;

            if (__wDiscType & CDROM_PICTURECD)
            {
                if (__bMMMenuID != MM_MENU_NONE) //CoCo1.26, slide show==>File Manager doesn't need to do this.
                    OSDMM_Update(OSDMM_MSG_CLEAR_HIGHLIGHT, 0); 

                if (__pMMFilterFilesOfDir[__MMSelectCursor.wDirID] != 0) //If the active dir doesn't have file, don't move the cursor. This will cause the unpredicted error for MM_IndexConvert error.
                {
                    __MMSelectCursor.bPosition=POS_FILE_LIST;
                    // convert cursor index from relative to absolute coordinate
                    __MMSelectCursor.wIndex=MM_IndexConvert(MM_INDEX_CONVERT_REL2ABS_FILE_LIST,
                        __MMSelectCursor.wDirID, 0x0);
                }
            }

            if (__bMMMenuID != MM_MENU_NONE)
            {
                MM_InitialMenu(MM_MENU_EDITPROG, TRUE);
            }
            else //Use OSDMM_MSG_SHOW to recover UI.
            {
                if ((__bAttrPlay & TYPE_CDROM_AV) || (__bPBReady == FALSE))
                {
                    CC_KeyCommand(KEY_STOP);
                     OSD_RemoveUI(OSD_UI_DISPLAY);
                    HAL_PlayCommand(COMMAND_STOP, 0);
                    HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_MPEG, HAL_DISP_CURRENTFRAME);
                }
                // wyc1.10-909, need to clear ZOOM mode after entering MM program edit mode.
#ifdef SUPPORT_GRAPH_ZOOM
                if (__bZoomFactor != VIEW_NORMAL)
                {
                    __bZoomFactor = VIEW_NORMAL;
                    HAL_Zoom (VIEW_NORMAL);
                    OSD_OUTPUT_MACRO ( MSG_ZOOM, (WORD)__bZoomFactor, 0x3 ); //Clear PIP and OSD
                    OSD_OUTPUT_MACRO ( MSG_ZOOM_TEXT, (WORD)__bZoomFactor, 0x3 ); //Clear PIP and OSD
                }
#endif
                __MMSelectCursor.bPosition = POS_FILE_LIST;
                __MMSelectCursor.wIndex = __wPlayItem-1;
                __MMPlayingItem.wIndex = __MMSelectCursor.wIndex;
                __bMMMenuID = MM_MENU_EDITPROG;
                MM_InitialMenu(MM_MENU_EDITPROG, FALSE);
                if (__bAttrPlay == ATTR_JPG)
                {
                    MM_JPEGPreview();
                }
            }
            // wyc0.85a, update the button status correctly.
            // wyc2.35-909S, disable program list menu when playing mode.
            // wyc2.36-909S, when preview mode, don't disable the button.
#ifndef NO_MM_BUTTON
            if ((__btPlaying) && (__dwMMJPEGPreview == FALSE))
            {
                OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_PROG_LIST);
            }
            else
            {
                OSDMM_Update(OSDMM_MSG_ENABLE_BUTTON, MM_BTN_PROG_LIST);
            }
            OSDMM_Update(OSDMM_MSG_ENABLE_BUTTON, MM_BTN_PLAY);
#endif //
            OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT,0);
        }
        else
        {
            if (__bMMMenuID == MM_MENU_PROGLIST)
                return INVALID_KEY;
            if (__bMMMenuID == MM_MENU_NONE)
            {
                __MMSelectCursor.bPosition = POS_FILE_LIST;
                __MMSelectCursor.wIndex = __wPlayItem-1;
            }
            // wyc0.85a, when select cursor stay in button & playing and then press KEY_PROGRAM to enter normal mode, should move
            // cursot to other part depend on if files in dir. Because of button should be disabled and cursor can't stay in button list.
            if ((__MMSelectCursor.bPosition == POS_BUTTON_LIST) && (__bMMMenuID == MM_MENU_EDITPROG) && (__btPlaying))
            {
                if (__pMMFilterFilesOfDir[__MMSelectCursor.wDirID] == 0)
                {
                    // go to the active directory position
                    _MM_SetCursorToActiveDirPos();
                }
                else
                {
                    __MMSelectCursor.bPosition=POS_FILE_LIST;
                    __MMSelectCursor.wIndex=__MMPlayingItem.wIndex;
                }
            }
            LINEAR_Program(LINEAR_PROGRAM_CLEAR,(BYTE)NULL);

            // Reset max program entry as zero while exit program mode
            __bProgramMaxEntry=0;

            // wyc0.85a, when program playing JPG and press KEY_PROGRAM, just clear program mode and don't update button and select cursor.
            if (__bMMMenuID == MM_MENU_NONE)
                return KEY_NO_KEY;

#ifndef NO_MM_BUTTON
            if (__btPlaying)
            {
                OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_FILTER);
                OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_SORT);
            }
            else
            {
                OSDMM_Update(OSDMM_MSG_ENABLE_BUTTON, MM_BTN_FILTER);
                OSDMM_Update(OSDMM_MSG_ENABLE_BUTTON, MM_BTN_SORT);
            }
#endif //
            OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT,0);
        }
        return KEY_NO_KEY;
#else
        return INVALID_KEY;
#endif // SUPPORT_FM_PROGRAM

    // LLY2.81, re-adjust the KEY_RESUME procedure
    // real IR key or transfering key all go here
    case    KEY_RESUME:
#ifdef  SUPPORT_MP3_RESUME
        // wyc2.05-909S, add this code to avoid doing resume function when file auto play end.
        if((__bCountStop!=0) && (__bLastPlayItem == FALSE)) // non-playing mode
        {
            {
                // always display "MSG_RESUME" (don't care the key source)
                // Because, it will return KEY_PLAY to CC module
                // So, there is no chance to sending MSG_RESUME within CC
                OSD_OUTPUT_MACRO ( MSG_RESUME, __wTemp, 0x3 );

                // clear selection cursor
                OSDMM_Update(OSDMM_MSG_CLEAR_HIGHLIGHT, 0); //CoCo.CT909, OSDMM_Update needs two parameters.

                // wyc2.00-909S, need to update dir id to resume item, otherwise will play wrong resume item.
                // LLY2.05, need keep desired playing dir/ index for resume (old procedure is not enough)
                // And, need update it for selection cursor
                __MMPlayingItem.wDirID = HIWORD(__dwResumeItem);
                __MMPlayingItem.wIndex = MM_IndexConvert(MM_INDEX_CONVERT_REL2ABS_FILE_LIST,
                        (BYTE)(HIWORD(__dwResumeItem)), LOWORD(__dwResumeItem-1));
                __MMPlayingItem.bPosition = POS_FILE_LIST;
                __MMSelectCursor.wDirID = __MMPlayingItem.wDirID;
                __MMSelectCursor.wIndex = __MMPlayingItem.wIndex;
                __MMSelectCursor.bPosition = __MMPlayingItem.bPosition;

                // LLY2.05, need prepare the file info list and re-draw the menu
                // Since, we don't know where directory and file are for KEY_RESUME
                MM_PreparePage(MM_PREPARE_FILEPAGE,__MMSelectCursor.wDirID, __bMMExtFilterMode, __bMMSortMethod);
                OSDMM_Update(OSDMM_MSG_UPDATE_CHANGE_DIR_LEVEL, 0); 

                // wyc0.71, need to update highlight again
                OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0);

                // LLY0.83b-2, Update the desired playing item & playing directory
                // wyc1.02-909, need to update __wPlayItem to __dwMMResumeItem
                __wPlayItem = LOWORD(__dwResumeItem);

#ifndef NO_MM_BUTTON
                if (__bMMMenuID == MM_MENU_NORMAL)
                {
                    OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_FILTER);
                    OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_SORT);
                }
                else
                {
                    OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_PROG_LIST);
                    OSDMM_Update(OSDMM_MSG_ENABLE_BUTTON, MM_BTN_PLAY);
                }

⌨️ 快捷键说明

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