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

📄 guiapp_action_lut.c

📁 IT projecotr reference design.
💻 C
字号:
/*****************************************************************************
**             TEXAS INSTRUMENTS PROPRIETARY INFORMATION
**
**  (c) Copyright, Texas Instruments Incorporated, 2006.
**      All Rights Reserved.
**
**  Property of Texas Instruments Incorporated. Restricted Rights -
**  Use, duplication, or disclosure is subject to restrictions set
**  forth in TI's program license agreement and associated documentation.
******************************************************************************/

#include "common.h"
#include "guiStyle.h"
#include "guiApp_action_lut.h"
#include "guiApp_action.h"

/* private declaration */
int08 guiApp_action_FindIndex( int16 menuId, uint16 *index );

/***************************************************************
 * Menu function pointer Lookup Table
 * 
 * Add entries here when adding menus to the design
 ***************************************************************/ 
const GUI_ACTION_FUNCTIONLUT menuIdLut[] =
{
    /* menuId,                  OnStart,                                OnClose,                        GuiMsg,                                     Redraw,                                 GetHighlightWindow */
    { MENU_MAINMENU,            guiApp_action_MainMenu_OnStart,         guiApp_action_MainMenu_OnClose, guiApp_action_MainMenu_GuiMsg,              guiApp_action_MainMenu_Redraw,          guiApp_action_MainMenu_GetHighlightWindow },
    { MENU_DISPLAYMENU,         guiApp_action_DisplayMenu_OnStart,      guiApp_action_DisplayMenu_OnClose, guiApp_action_DisplayMenu_GuiMsg,        0,                                      guiApp_action_DisplayMenu_GetHighlightWindow },
    { MENU_IMAGEMENU,           guiApp_action_ImageMenu_OnStart,        guiApp_action_ImageMenu_OnClose, guiApp_action_ImageMenu_GuiMsg,            0,                                      guiApp_action_ImageMenu_GetHighlightWindow },
    { MENU_AUTOLOCKMENU,        guiApp_action_AutolockMenu_OnStart,     guiApp_action_AutolockMenu_OnClose, guiApp_action_AutolockMenu_GuiMsg,       0,                                      guiApp_action_AutolockMenu_GetHighlightWindow },
    { MENU_LANGUAGEMENU,        guiApp_action_LanguageMenu_OnStart,     guiApp_action_LanguageMenu_OnClose, guiApp_action_LanguageMenu_GuiMsg,      0,                                      guiApp_action_LanguageMenu_GetHighlightWindow },
    { MENU_ADVANCEDMENU,        guiApp_action_AdvancedMenu_OnStart,     guiApp_action_AdvancedMenu_OnClose, guiApp_action_AdvancedMenu_GuiMsg,      0,                                      guiApp_action_AdvancedMenu_GetHighlightWindow },
    { MENU_ABOUTMENU,           guiApp_action_AboutMenu_OnStart,        0,                              0,                                          0,                                      0 },
    { MENU_AUTOLOCKSAVESUBMENU, 0,                                      0,                              guiApp_action_AutolockSaveSubMenu_GuiMsg,   0,                                      guiApp_action_AutolockSaveSubMenu_GetHighlightWindow },
    { MENU_POWERDOWNMENU,       guiApp_action_Powerdown_OnStart,        0,                              guiApp_action_Powerdown_GuiMsg,             guiApp_action_Powerdown_Redraw,         0 },
    { MENU_CONFIRMRESETMENU,    guiApp_action_ConfirmResetMenu_OnStart, 0,                              guiApp_action_ConfirmResetMenu_GuiMsg,      guiApp_action_ConfirmResetMenu_Redraw,  0 },
    { MENU_KEYSTONEPOPUP,       guiApp_action_KeystoneMenu_OnStart,     guiApp_action_KeystoneMenu_OnClose, guiApp_action_KeystoneMenu_GuiMsg,      guiApp_action_KeystoneMenu_Redraw,      0 },
    { MENU_WARNINGDIALOG,       guiApp_action_WarningDialog_OnStart,    0,                              guiApp_action_WarningDialog_GuiMsg,         guiApp_action_WarningDialog_Redraw,     0 },
    { MENU_SOURCESTATUSMENU,    guiApp_action_SourceStatusMenu_OnStart, 0,                              guiApp_action_SourceStatusMenu_GuiMsg,      guiApp_action_SourceStatusMenu_Redraw,  0 },
    { MENU_CONFIRMATIONSCREENCAPTUREMENU,    guiApp_action_ConfirmScreenCaptureMenu_OnStart, 0,         guiApp_action_ConfirmScreenCaptureMenu_GuiMsg, guiApp_action_ConfirmScreenCaptureMenu_Redraw,  0 },
    { MENU_SCREENCAPTUREPROGRESSMENU,guiApp_action_ScreenCaptureProgressMenu_OnStart, 0,                guiApp_action_ScreenCaptureProgressMenu_GuiMsg,  guiApp_action_ScreenCaptureProgressMenu_Redraw,  0 },
    { MENU_IMAGEPOSITIONPOPUP,  guiApp_action_ImagePositionMenu_OnStart,guiApp_action_ImagePositionMenu_OnClose, guiApp_action_ImagePositionMenu_GuiMsg, guiApp_action_ImagePositionMenu_Redraw,  0 },
    { MENU_PANANDSCANPOPUP,     guiApp_action_PanandScanMenu_OnStart,   0,                              guiApp_action_PanandScanMenu_GuiMsg,         guiApp_action_PanandScanMenu_Redraw,   0 },
    { MENU_MAGNIFYPOPUP,        guiApp_action_MagnifyMenu_OnStart,      0,                              guiApp_action_MagnifyMenu_GuiMsg,           guiApp_action_MagnifyMenu_Redraw,       0 },
    { MENU_BRIGHTNESSPOPUP,     guiApp_action_BrightnessMenu_OnStart,   guiApp_action_BrightnessMenu_OnClose, guiApp_action_BrightnessMenu_GuiMsg,  guiApp_action_BrightnessMenu_Redraw,    0 },
    { MENU_IMAGESIZEPOPUP,      guiApp_action_ImageSizeMenu_OnStart,    guiApp_action_ImageSizeMenu_OnClose, guiApp_action_ImageSizeMenu_GuiMsg,    guiApp_action_ImageSizeMenu_Redraw,     0 },
    { MENU_HSGMENU,             guiApp_action_HSGMenu_OnStart,          guiApp_action_HSGMenu_OnClose,  guiApp_action_HSGMenu_GuiMsg,               guiApp_action_HSGMenu_Redraw,           guiApp_action_HSGMenu_GetHighlightWindow },
    { MENU_HSGCONTROLMENU,      guiApp_action_HSGControlMenu_OnStart,   guiApp_action_HSGControlMenu_OnClose, guiApp_action_HSGControlMenu_GuiMsg,  0,                                      guiApp_action_HSGControlMenu_GetHighlightWindow },
    { MENU_HSGWHITEGAINSCONTROLMENU,guiApp_action_HSGWhiteGainsControlMenu_OnStart,guiApp_action_HSGWhiteGainsControlMenu_OnClose,guiApp_action_HSGWhiteGainsControlMenu_GuiMsg,  0,                                      guiApp_action_HSGControlMenu_GetHighlightWindow },

    { MENU_LAST, 0, 0, 0, 0, 0 }
};

/***************************************************************
 * The following functions implement the interface
 * of the GUI Action code.  These functions search the lookup
 * table for a specified menu's functions.  This decouples
 * the GUI Action code from the GUI Style code. 
 *
 * If the menu specified by the "GUI_OPEN_MENU *menu" parameter
 * has an entry in the LUT, the menu's function will be called
 ***************************************************************/ 

int08 guiApp_action_OnStart( int16 menuId, GUIMSG *msg )
{
    uint16 index;

    /* Search for an entry for the menu */
    if( guiApp_action_FindIndex( menuId, &index ) != PASS )
        return FAIL;

    /* Check if the menu entry has an OnStart function */
    if( menuIdLut[index].OnStart == NULL )
        return FAIL;

    /* Call the menu's OnStart function */
    return menuIdLut[index].OnStart( menuId, msg );
}

int08 guiApp_action_OnClose( int16 menuId )
{
    uint16 index;

    /* Search for an entry for the menu */
    if( guiApp_action_FindIndex( menuId, &index ) != PASS )
        return FAIL;
        
    /* Check if the menu entry has an OnClose function */
    if( menuIdLut[index].OnClose == NULL )
        return FAIL;
        
    /* Call the menu's OnClose function */
    return menuIdLut[index].OnClose( menuId );
}

int08 guiApp_action_GuiMsg( int16 menuId, int16 itemId, GUIMSG *msg )
{
    uint16 index;
   
    /* Search for an entry for the menu */
    if( guiApp_action_FindIndex( menuId, &index ) != PASS )
        return FAIL;
    
    /* Check if the menu entry has a GuiMsg function */
    if( menuIdLut[index].GuiMsg == NULL )
        return FAIL;
        
    /* Call the menu's GuiMsg function */
    return menuIdLut[index].GuiMsg( menuId, itemId, msg );
}

int08 guiApp_action_Redraw( int16 menuId, GUIMSG *msg )
{
    uint16 index;

    /* Search for an entry for the menu */
    if( guiApp_action_FindIndex( menuId, &index ) != PASS )
        return FAIL;
    
    /* Check if the menu entry has an Redraw function */
    if( menuIdLut[index].Redraw == NULL )
        return FAIL;
        
    /* Call the menu's Redraw function */
    return menuIdLut[index].Redraw( menuId, msg );
}

int08 guiApp_action_GetHighlightWindow( int16 menuId, uint08 *window )
{
    uint16 index;

    /* Search for an entry for the menu */
    if( guiApp_action_FindIndex( menuId, &index ) != PASS )
        return FAIL;
    
    /* Check if the menu entry has a GetHighlightWindow function */
    if( menuIdLut[index].GetHighlightWindow == NULL )
        return FAIL;
        
    /* Call the menu's GetHighlightWindow function */
    return menuIdLut[index].GetHighlightWindow( menuId, window );
}

/* guiApp_action_FindIndex searches the function LUT for a menu entry */
int08 guiApp_action_FindIndex( int16 menuId, uint16 *index )
{
    uint16 i;
    
    for( i=0; i<0xFFFF; i++ )
    {
        if( menuIdLut[i].menuId == MENU_LAST )
            return FAIL;
        
        if( menuIdLut[i].menuId == menuId )
        {
            *index = i;
            return PASS;
        }
    }
    return FAIL;
}

⌨️ 快捷键说明

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