?? mso_choice.c
字號:
/* **************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: o_choice.c $
*
* Description:
* ============
* Project definition of the MSO_CHOICE functions
*
****************************************************************************************/
#include "Config.h" // Global Configuration - do not remove!
#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //DEBUG_UI_TRACE
#include "Include\SysDefs.h"
/***************************************************************************************
* Include files
****************************************************************************************/
#include <stdio.h>
#include <string.h>
#include "include\math-macro.h"
#include "Playcore\ScPad\SCMGR.h"
#include "GUI\Menu_system\ms_object.h"
#include "GUI\menu_system\osd_rendering.h"
#include "GUI\menu_system\ms_display.h"
#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_send_op.h"
#include "GUI\Object_class\Choice\mso_choice.h"
#include "GUI\Object_class\Vlist\mso_vlist.h"
//#include "Menu\menu_operation_def.h"
#include "GUI\Resource\Bitmap\bitmap.h"
// Include configuration header file: named constants, macros and typedefs.
#include "GUI\Object_class\Choice\mso_choice_config.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "GUI\Object_class\Choice\mso_choice_custom.h"
#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif
/***************************************************************************************
* Named Constants
****************************************************************************************/
/***************************************************************************************
* Private Macros
****************************************************************************************/
#define COLON L":"
/***************************************************************************************
* Operation functions
****************************************************************************************/
/***************************************************************************************
* Function : ListItemOperation
*
* In : pThis = Pointer to the list item (MSO_LISTITEM) object.
*
* MsOp = Operation ID.
*
* lParam = Parameter associated with an MS_OP if any.
*
* Out : None.
*
* Return : ID of the operation that is to be propagated once processing is done,
* otherwise MS_OP_NONE.
*
* Desc : This function default operation function of MSO_LISTITEM objects.
****************************************************************************************/
#pragma argsused
MS_OP ListItemOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
switch(MsOp)
{
case MS_OP_FOCUS_CHANGE:
// We have gained or lost focus. Ask for a redisplay.
if (!MS_IsInvisible(pThis))
MS_DisplayAddObject(pThis);
break;
// This code is the generic behaviour for closing a VLIST. It is enough to get you started, and will work in most cases.
// If you want different behaviour, or are using a VSCROLL LIST, you will need to override this behaviour.
case MS_OP_LEFT: // FALL THRU
case MS_OP_ENTER:
{
MSO_LISTITEM __NEAR* pListItem = (MSO_LISTITEM __NEAR*)pThis;
MSO_VLIST __NEAR* pList = (MSO_VLIST __NEAR*)pThis->mpParent;
MSO_OBJECT __NEAR* pParamVList = (MSO_OBJECT __NEAR*)((MSO_OBJECT __NEAR*)((MSO_OBJECT __NEAR*)pList)->mpParent)->mpParent;
MS_DESCRIPTOR_CHOICE* pDescriptorChoice = (MS_DESCRIPTOR_CHOICE*)pList->moParam.mdwData;
MSO_CHOICE __NEAR* pChoice = (MSO_CHOICE __NEAR*)MS_FindObjectFromDescriptor((MSO_CONTAINER __NEAR*)pParamVList,
(MS_DESCRIPTOR*)pDescriptorChoice);
// Is the selected value different to the current value of this choice?
if(mpfMutatorNull != pDescriptorChoice->mpfMutator)
pDescriptorChoice->mpfMutator((MSO_OBJECT __NEAR*)pChoice, eMutatorSet, pListItem->moParam.mwValue);
// Remove the vertical list from the screen:
MS_SetInvisible(pList);
// Restore size and layer information of the concerned MSO_CHOICE object.
pChoice->moObject.moArea.mwW = pChoice->moObject.mpDescriptor->moArea.mwW;
MS_ScreenSetFocusObject((MSO_OBJECT __NEAR*)pChoice);
MS_CHOICE_DISPLAY_NORMAL(pChoice);
MS_DisplayAddObject(pParamVList);
}
return MS_OP_NONE;
default:
break;
}
return MsOp;
}
/***************************************************************************************
* Function : ChoiceOperation
*
* In : pThis = Pointer to the Choice (MSO_CHOICE) object.
*
* MsOp = Operation ID.
*
* lParam = Parameter associated with an MS_OP if any.
*
* Out : None.
*
* Return : ID of the operation that is to be propagated once processing is done,
* otherwise MS_OP_NONE.
*
* Desc : This function default operation function of MSO_CHOICE objects.
****************************************************************************************/
#pragma argsused
MS_OP ChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
switch(MsOp)
{
// Initialise the choice with the correct starting value.
case MS_OP_INIT:
case MS_OP_ON_DEFROST:
case MS_OP_REFRESH:
if(mpfMutatorNull != ((MS_DESCRIPTOR_CHOICE*)pThis->mpDescriptor)->mpfMutator)
((MS_DESCRIPTOR_CHOICE*)pThis->mpDescriptor)->mpfMutator(pThis, eMutatorGet, 0);
if (MS_OP_REFRESH == MsOp)
MS_DisplayAddObject(pThis);
break;
case MS_OP_RIGHT:
// If the choice is closed and the MS_ATTR_CHOICE_OPEN_ON_RIGHT_PRESS,
// then open the choice by falling through to the next case.
if(!MS_IS_CHOICE_OPEN_ON_RIGHT_PRESS(pThis))
{
break;
}
// else FALL THRU
case MS_OP_ENTER:
return MS_OP_NONE;
case MS_OP_FOCUS_CHANGE:
// We have gained or lost focus. Ask for a redisplay.
MS_DisplayAddObject(pThis);
break;
default:
break;
}
return MsOp;
}
/***************************************************************************************
* Function : ChoiceOperation
*
* In :
*
* Out :
*
* Desc : The Repeat mode choice operation function.
****************************************************************************************/
MS_OP ChoiceNoExpandingOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
// Pre-processing
switch(MsOp)
{
case MS_OP_ENTER:
if (mpfMutatorNull == ((MS_DESCRIPTOR_CHOICE*)(pThis->mpDescriptor))->mpfMutator)
break;
if (!MS_IS_CHOICE_DISABLED(pThis))
{
UINT16 wValueIndex;
UINT16 wValueIndexMax;
UINT16 wValue;
UINT16 wLoop;
wValueIndex = ((MSO_CHOICE __NEAR*)pThis)->moParam.mwCurrValIndex;
MS_ASSERT(((MS_DESCRIPTOR_CHOICE*)(pThis->mpDescriptor))->mcTotalValues > 0);
wValueIndexMax = ((MS_DESCRIPTOR_CHOICE*)(pThis->mpDescriptor))->mcTotalValues - 1;
wLoop = 0;
// Avoid infinite loop
while (wLoop++ < wValueIndexMax)
{
// Increase the index in table of possible values
wValueIndex++;
if (wValueIndex > wValueIndexMax)
wValueIndex = 0;
// Get the value to set from the new index
wValue = OCHOICE_GetValueFromIndex(pThis, wValueIndex);
((MS_DESCRIPTOR_CHOICE*)(pThis->mpDescriptor))->mpfMutator(pThis, eMutatorSet, wValue);
// Mutator doesn't return a result, so we get the index and compare the associated value with the value we tried to set
((MS_DESCRIPTOR_CHOICE*)(pThis->mpDescriptor))->mpfMutator(pThis, eMutatorGet, 0);
// If the value set succed, then it's finished, else we continue
if (wValueIndex == ((MSO_CHOICE __NEAR*)pThis)->moParam.mwCurrValIndex)
break;
}
// Refresh the display of the choice
MS_SendOperation(pThis, MS_OP_REFRESH, 0);
return MS_OP_NONE;
}
break;
default:
break;
}
return ChoiceOperation(pThis, MsOp, lParam);
}
/***************************************************************************************
* Display functions
****************************************************************************************/
/***************************************************************************************
* Function : ListItemFillOSDSeg
*
* In : pThis = Pointer to a list item.
*
* pAbsArea = Absolute area of pThis object.
*
* Out : None.
*
* Return : None.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -