📄 guiapp_action_hsgcontrolmenu.c
字号:
/*************************************************************************
** TEXAS INSTRUMENTS PROPRIETARY INFORMATION
**
** (c) Copyright, Texas Instruments Incorporated, 2005, 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.h"
#include "osd.h"
#include "ddp2230_rtos_include.h"
#include "guiApp_action_menu_values.h"
#include "eeprom.h"
#include "datapath.h"
#include "pictcont.h"
extern uint32 gID_MemPool;
extern uint16 activeHSGColor;
GUI_HSG_CONTROL_MENU_VALUES_STRUCT *HSGControlMenuValues;
/* Initialize the items */
int08 guiApp_action_HSGControlMenu_OnStart( int16 menuId, GUIMSG *msg )
{
DP_SOURCEDESC *srcDesc;
int16 min, max;
if( RTA_MemRequest( gID_MemPool, sizeof( GUI_HSG_CONTROL_MENU_VALUES_STRUCT ), (void **)&HSGControlMenuValues ) == PASS )
{
datapath_GetSourceDesc( &srcDesc );
if( srcDesc->sourceActive )
{
/* read all settings on the image menu from the eeprom */
EE_GETVAR( UserMachine.ConnectorSettings[srcDesc->connector].HSGColorValues[activeHSGColor].Hue, HSGControlMenuValues->hue );
EE_GETVAR( UserMachine.ConnectorSettings[srcDesc->connector].HSGColorValues[activeHSGColor].Saturation, HSGControlMenuValues->saturation );
EE_GETVAR( UserMachine.ConnectorSettings[srcDesc->connector].HSGColorValues[activeHSGColor].Gain, HSGControlMenuValues->gain );
/* hue init */
pictcont_GetHSGHueLimits( &min, &max );
HSGControlMenuValues->hue = LMT( min, HSGControlMenuValues->hue, max );
guiStyle_item_SetSingleValue( ITEM_HUEITEM, HSGControlMenuValues->hue, min, max );
/* saturation init */
pictcont_GetHSGSaturationLimits( &min, &max );
HSGControlMenuValues->saturation = LMT( min, HSGControlMenuValues->saturation, max );
guiStyle_item_SetSingleValue( ITEM_SATURATIONITEM, HSGControlMenuValues->saturation, min, max );
/* gain init */
pictcont_GetHSGGainLimits( &min, &max );
HSGControlMenuValues->gain = LMT( min, HSGControlMenuValues->gain, max );
guiStyle_item_SetSingleValue( ITEM_GAINITEM, HSGControlMenuValues->gain, min, max );
}
}
else
{
guiStyle_HideItem( menuId, ITEM_HUEITEM, TRUE );
guiStyle_HideItem( menuId, ITEM_SATURATIONITEM, TRUE );
guiStyle_HideItem( menuId, ITEM_GAINITEM, TRUE );
}
return PASS;
}
int08 guiApp_action_HSGControlMenu_OnClose( int16 menuId )
{
DP_SOURCEDESC *srcDesc;
datapath_GetSourceDesc( &srcDesc );
if( srcDesc->sourceActive )
{
/* save all settings on the HSG control menu to the eeprom */
EE_PUTVAR( UserMachine.ConnectorSettings[srcDesc->connector].HSGColorValues[activeHSGColor].Hue, HSGControlMenuValues->hue );
EE_PUTVAR( UserMachine.ConnectorSettings[srcDesc->connector].HSGColorValues[activeHSGColor].Saturation, HSGControlMenuValues->saturation );
EE_PUTVAR( UserMachine.ConnectorSettings[srcDesc->connector].HSGColorValues[activeHSGColor].Gain, HSGControlMenuValues->gain );
}
/* release HSG control menu memory structure requested in onStart */
RTA_MemRelease( HSGControlMenuValues );
return PASS;
}
/* specify the highlight window as required by the GUI Style ADL */
int08 guiApp_action_HSGControlMenu_GetHighlightWindow( int16 menuId, uint08 *window )
{
*window = WIND_HSGCONTROLMENUHIGHLIGHT;
return PASS;
}
/* implement item behavior, system interaction */
int08 guiApp_action_HSGControlMenu_GuiMsg( int16 menuId, int16 itemId, GUIMSG *msg )
{
int16 min, max;
if( msg == NULL )
return FAIL;
switch( itemId )
{
case ITEM_HUEITEM:
switch( msg->type )
{
case GUIMSG_DEC:
if( pictcont_GetHSGHueLimits( &min, &max ) == PASS )
{
if( pictcont_SetHSGHue( activeHSGColor, HSGControlMenuValues->hue - 1 ) == PASS )
{
HSGControlMenuValues->hue--;
guiStyle_item_SetSingleValue( itemId, HSGControlMenuValues->hue, min, max );
}
}
break;
case GUIMSG_INC:
if( pictcont_GetHSGHueLimits( &min, &max ) == PASS )
{
if( pictcont_SetHSGHue( activeHSGColor, HSGControlMenuValues->hue + 1 ) == PASS )
{
HSGControlMenuValues->hue++;
guiStyle_item_SetSingleValue( itemId, HSGControlMenuValues->hue, min, max );
}
}
break;
default:
break;
}
break;
case ITEM_SATURATIONITEM:
switch( msg->type )
{
case GUIMSG_DEC:
if( pictcont_GetHSGSaturationLimits( &min, &max ) == PASS )
{
if( pictcont_SetHSGSaturation( activeHSGColor, HSGControlMenuValues->saturation - 1 ) == PASS )
{
HSGControlMenuValues->saturation--;
guiStyle_item_SetSingleValue( itemId, HSGControlMenuValues->saturation, min, max );
}
}
break;
case GUIMSG_INC:
if( pictcont_GetHSGSaturationLimits( &min, &max ) == PASS )
{
if( pictcont_SetHSGSaturation( activeHSGColor, HSGControlMenuValues->saturation + 1 ) == PASS )
{
HSGControlMenuValues->saturation++;
guiStyle_item_SetSingleValue( itemId, HSGControlMenuValues->saturation, min, max );
}
}
break;
default:
break;
}
break;
case ITEM_GAINITEM:
switch( msg->type )
{
case GUIMSG_DEC:
if( pictcont_GetHSGGainLimits( &min, &max ) == PASS )
{
if( pictcont_SetHSGGain( activeHSGColor, HSGControlMenuValues->gain - 1 ) == PASS )
{
HSGControlMenuValues->gain--;
guiStyle_item_SetSingleValue( itemId, HSGControlMenuValues->gain, min, max );
}
}
break;
case GUIMSG_INC:
if( pictcont_GetHSGGainLimits( &min, &max ) == PASS )
{
if( pictcont_SetHSGGain( activeHSGColor, HSGControlMenuValues->gain + 1 ) == PASS )
{
HSGControlMenuValues->gain++;
guiStyle_item_SetSingleValue( itemId, HSGControlMenuValues->gain, min, max );
}
}
break;
default:
break;
}
break;
default:
return FAIL;
}
return PASS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -