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

📄 mm_ui.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 5 页
字号:
                        // wyc0.75, need to check if preview mode, if TRUE need to issue stop command and reset preview state.
                        if (__dwMMJPEGPreview == TRUE)
                        {
                            MM_ResetPreviewMode();
                            // wyc1.02-909, when play from pre-stop mode, need to set __dwMMKeyToDo to TRUE to go TODO mode. If not do it,
                            // otherwise _CC_PreProcessKey will transfer KEY_PLAY to KEY_RESUME.
                            if (__bCountStop == 1)
                                __dwMMKeyToDo = TRUE;
                        }
                        // wyc0.75, when key from FW, that mean this key is not processed by CC_DoKeyAction yet and will process this
                        // time. So we can't clear the __dwMMJPEGPreview to let it will do preview this time.
                        if (__bKeySource == KEY_FROM_ISR)
						{
                            __dwMMJPEGPreview = FALSE; 
						}
                        return _MM_SettingAndPlayItem();
                    }
                    // everything is done, so retun no key
                    return KEY_NO_KEY;
                }
            }
        }
        else if(__MMSelectCursor.bPosition == POS_BUTTON_LIST)
        {
            // Do corresponding action base on desired button
            return _MM_ButtonAction();
        }
        else if (__MMSelectCursor.bPosition == POS_PROG_LIST)
        {
            // Delete the content and re-arrange the list
            // Notice: 3rd & 4th parameter is un-necessary for this case
            LINEAR_ProgramEntryOperation(LINEAR_DELETE_ENTRY_BY_INDEX_W_REARRANGE, __MMSelectCursor.wIndex, (BYTE)NULL, (WORD)NULL);

            // Decrease current program index by '1' for next empty entry
            __bProgramCurrentIndex--;

            // Decrease max program entry number by '1' while delete one element
            if (__MMSelectCursor.wIndex == (__bProgramMaxEntry-1))
            {
                if (__MMSelectCursor.wIndex == 0)
                {
                    __MMSelectCursor.bPosition = POS_BUTTON_LIST;
                    __MMSelectCursor.wIndex = MM_BTN_RETURN;
#ifndef NO_MM_BUTTON
                    OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_DELETE_ALL);
#endif //
                }
                else
                    __MMSelectCursor.wIndex--;
            }
            __bProgramMaxEntry--;
            MM_PreparePage(MM_PREPARE_PROGLIST,__MMSelectCursor.wDirID, __bMMExtFilterMode, __bMMSortMethod);
            if (((__MMSelectCursor.wIndex+1) % OSDMM_MAX_ITEM_IN_FILE_WINDOW) == 0)
            {
                OSDMM_Update(OSDMM_MSG_UPDATE_FILE_WINDOW_PREVIOUS, 0);
                OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0);
            }
            else
                OSDMM_Update(OSDMM_MSG_PROGRAM_DELETE, 0);
            MM_JPEGPreview();
            return KEY_NO_KEY;
        }
        else if (__MMSelectCursor.bPosition == POS_DLG_ITEM)
        {
            if (__bMMPopMenuID == MM_POP_MENU_FILTER)
            {
                if (((__bMMExtFilterMode >> __MMSelectCursor.wIndex) & 0x1) == 0x1)
                {
                    __bMMExtFilterMode &= ~(0x1<<__MMSelectCursor.wIndex);
                }
                else
                {
                    __bMMExtFilterMode |= (0x1<<__MMSelectCursor.wIndex);
                }
            }
            else if (__bMMPopMenuID == MM_POP_MENU_SORT)
            {
                if (__MMSelectCursor.wIndex < MM_SORT_TYPE)
                    __bMMSortMethod = (0x1 << __MMSelectCursor.wIndex);
                else
                    __bMMSortSequence = 0x10 << (__MMSelectCursor.wIndex-MM_SORT_TYPE);
            }
            __bMMExtFilterModeInMMMode = __bMMExtFilterMode;
            
            OSDMM_Update(OSDMM_MSG_UPDATE_DLG_ITEM, 0);
            return KEY_NO_KEY;
        }
        break;

    case    KEY_PREV:
    case    KEY_NEXT:
        // wyc0.85, because current solution support JPG preview, so need to reset this value when move cursor. Otherwise the state
        // will be wrong state from JPG preview when cursor stay in other files.
        if (__dwMMTriggerMode == MM_IMAGE_TRIGGER_MODE)
        {
            __bMMStage = MM_STAGE_NONE;
            __btPlaying = FALSE;
        }
    case    KEY_SCF:
    case    KEY_SCB:
        // wyc1.07a, not allow KEY_NEXT / KEY_PREV when file playing and UI is in program list mode.
        if ((__bAttrPlay & TYPE_CDROM_AUDIO) && (__bCountStop==0))
        {
            // wyc1.20-909, when KEY_NEXT/KEY_PREV in program list mode & audio play mode. Don't call OSDMM_MSG_STOP, otherwise the help
            // message in bottom will disappear when KEY_NEXT/KEY_PREV.
            if (__bMMMenuID != MM_MENU_PROGLIST)
                OSDMM_Update(OSDMM_MSG_STOP, 0);

            return bKey;
        }
        else // playing mode
        {
            // Transfer input key as KEY_UP/ KEY_DOWN
            // wyc0.87, make KEY_NEXT / KEY_PREV in stop mode to enter next / prev page in FM UI mode.
            if ((bKey==KEY_NEXT) || (bKey == KEY_SCF))
            {
                // When highlight in program list mode, need to support the KEY_NEXT to next program list page.
                if (__MMSelectCursor.bPosition == POS_PROG_LIST)
                {
                    if((__wOSDMMStartDrawItem+OSDMM_MAX_ITEM_IN_FILE_WINDOW) >= __bProgramMaxEntry) //CoCo.CT909
                        return INVALID_KEY;
                    OSDMM_Update(OSDMM_MSG_UPDATE_FILE_WINDOW_NEXT, 0);
                    __MMSelectCursor.wIndex += OSDMM_MAX_ITEM_IN_FILE_WINDOW;
                    if (__MMSelectCursor.wIndex > (__bProgramMaxEntry-1))
                        __MMSelectCursor.wIndex = __bProgramMaxEntry-1;
                }
                else
                {
                    // wyc0.70, to support KEY_NEXT / KEY_PREV OK in sort/filter mode, so need to add new checking mechanism here.
                    _dwMMTemp7=(DWORD)(__pMMFilterFilesOfDir[__MMSelectCursor.wDirID] + __pMMVolumeDirTree[__MMSelectCursor.wDirID].bNoOfSubDir);
                    if((__wOSDMMStartDrawItem+OSDMM_MAX_ITEM_IN_FILE_WINDOW) >= _dwMMTemp7)
					{
                        return INVALID_KEY;
					}

                    if (__MMSelectCursor.bPosition == POS_FILE_LIST)
					{
                        __MMSelectCursor.wIndex += OSDMM_MAX_ITEM_IN_FILE_WINDOW;
					}
                    OSDMM_Update(OSDMM_MSG_UPDATE_FILE_WINDOW_NEXT, 0);
                    // wyc0.85, when cursor is bigger than existed files in directory, need to update select cursor to max. existed
                    // files. Otherwisr will see select cursor stay in wrong position.
                    if ((__MMSelectCursor.bPosition == POS_FILE_LIST) && (__MMSelectCursor.wIndex >= _dwMMTemp7))
					{
                        __MMSelectCursor.wIndex = (WORD)(_dwMMTemp7-1);
					}
                }
            }
            else  // KEY_PREV
            {
                if (__wOSDMMStartDrawItem <= 0)
				{
                    return INVALID_KEY;
				}

                if ((__MMSelectCursor.bPosition == POS_FILE_LIST) || (__MMSelectCursor.bPosition == POS_PROG_LIST))
                {
                    if (__MMSelectCursor.wIndex < OSDMM_MAX_ITEM_IN_FILE_WINDOW)
					{
                        __MMSelectCursor.wIndex = 0;
					}
                    else
					{
                        __MMSelectCursor.wIndex -= OSDMM_MAX_ITEM_IN_FILE_WINDOW;
					}
                }

                OSDMM_Update(OSDMM_MSG_UPDATE_FILE_WINDOW_PREVIOUS, 0); 
            }

            OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0);
            MM_JPEGPreview();
            return KEY_NO_KEY;
        }
    case    KEY_UP:
    case    KEY_DOWN:
        // wyc0.85, because current solution support JPG preview, so need to reset this value when move cursor. Otherwise the state
        // will be wrong state from JPG preview when cursor stay in other files.
        if (__dwMMTriggerMode == MM_IMAGE_TRIGGER_MODE)
        {
            __bMMStage = MM_STAGE_NONE;
            __btPlaying = FALSE;
            // wyc1.11c, fix when move cursor to dir part when JPG decode not OK, then press number
            // key to re-play JPG, then only show preview picture problem.
            __dwMMJPEGPreview = FALSE;
        }

        // selection cursor @ directory list
        if (__MMSelectCursor.bPosition == POS_VOL_DIR_LIST)
        {
            // Process KEY_UP case
            if (bKey==KEY_UP)
            {
                // Calculate final desired active directory ID first
                // underflow, return invalid key
                if(__MMSelectCursor.wIndex==0)
                {
                    return INVALID_KEY;
                }
                else
                {
                    _dwMMTemp5=(BYTE)MM_IndexConvert(MM_INDEX_CONVERT_ABS2REL_DIR_LIST, __MMSelectCursor.wDirID, (WORD)(__MMSelectCursor.wIndex-1));

                    // Update __bActiveDirChange flage as TRUE
                    // while final directory & current directory ID are different
                    // Notice: __bActiveDirChange value must be ready first
                    //         becasue OSDMM_MSG_CLEAR_HIGHLIGHT will reference it
                    // If the value == TRUE, means old folder icon will be closed
                    // The flage will be cleared after OSDFM referenced done.
                    if (_dwMMTemp5 != __MMSelectCursor.wDirID)
					{
                        __bActiveDirChange=TRUE;
					}

                    // clear selection cursor first
                    OSDMM_Update(OSDMM_MSG_CLEAR_HIGHLIGHT, 0); 

                    // decrease cursor index by '1'
                    __MMSelectCursor.wIndex--;
                }
            }
            else // Process KEY_DOWN case
            {
                // overflow, return invalid key
                // Notice: cursor index from '0'
                if((__MMSelectCursor.wIndex+1)==_MM_QueryInfo2(MM_QUERY2_TOTAL_ITEM_OF_DIRPAGE,__MMSelectCursor.wDirID))
                {
                    return INVALID_KEY;
                }
                else
                {
                    // Calculate final desired active directory ID first
                    _dwMMTemp5=(BYTE)MM_IndexConvert(MM_INDEX_CONVERT_ABS2REL_DIR_LIST, __MMSelectCursor.wDirID, (WORD)(__MMSelectCursor.wIndex+1));

                    // Update __bActiveDirChange flage as TRUE
                    // while final directory & current directory ID are different
                    // Notice: __bActiveDirChange value must be ready first
                    //         becasue OSDMM_MSG_CLEAR_HIGHLIGHT will reference it
                    // If the value == TRUE, means folder icon will be closed
                    // The flage will be cleared after OSDFM referenced done.
                    if (_dwMMTemp5 != __MMSelectCursor.wDirID)
					{
                        __bActiveDirChange=TRUE;
					}

                    // clear selection cursor first
                    OSDMM_Update(OSDMM_MSG_CLEAR_HIGHLIGHT, 0); 

                    // increase cursor index by '1'
                    __MMSelectCursor.wIndex++;
                }
            }
            // Update final active directory ID
            __MMSelectCursor.wDirID=_dwMMTemp5;
            _bMMNextSelectDir = __MMSelectCursor.wDirID;

            // Prepare the file info. for file list
            MM_PreparePage(MM_PREPARE_FILEPAGE,__MMSelectCursor.wDirID, __bMMExtFilterMode, __bMMSortMethod);
            // Re-draw Menu
            OSDMM_Update(OSDMM_MSG_UPDATE_CHANGE_DIR, 0); 
        }
        // selection cursor @ file list
        else if(__MMSelectCursor.bPosition == POS_FILE_LIST)
        {
            // process KEY_UP case
            if ((bKey==KEY_UP) || (bKey==KEY_DOWN))
            {
                if (((__MMSelectCursor.wIndex==0) && (bKey==KEY_UP)) || ((__MMSelectCursor.wIndex==(_MM_QueryInfo2(MM_QUERY2_TOTAL_SORT_FILTER_ITEM,__MMSelectCursor.wDirID)-1) && (bKey==KEY_DOWN))))
                {
                    // wyc1.05, supporting moving KEY_UP / KEY_DOWN to acrossing directory boundary.
                    // wyc1.10, support a define to ring the select cursor in same directory.
                    if (bKey == KEY_UP)
                    {
#ifndef  SUPPORT_FM_CURSOR_RING_SAME_DIRECTORY
                        if (__MMSelectCursor.wDirID > 0)
						{
                            _bMMNextSelectDir = __MMSelectCursor.wDirID - 1;
						}
                        else
						{
                            _bMMNextSelectDir = (__bMMTotalDirs-1);
						}
#else
                        _bMMNextSelectDir = __MMSelectCursor.wDirID;
#endif //SUPPORT_FM_CURSOR_RING_SAME_DIRECTORY
                    }
                    else //KEY_DOWN
                    {
#ifndef  SUPPORT_FM_CURSOR_RING_SAME_DIRECTORY
                        if (__MMSelectCursor.wDirID < (__bMMTotalDirs-1))
						{
                            _bMMNextSelectDir = __MMSelectCursor.wDirID + 1;
						}
                        else
						{
                            _bMMNextSelectDir = 0;
						}
#endif //SUPPORT_FM_CURSOR_RING_SAME_DIRECTORY

⌨️ 快捷键说明

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