mso_message.c

来自「ZORAN 962/966 SOURCE CODE,DVD chip」· C语言 代码 · 共 216 行

C
216
字号
/****************************************************************************************************
*  Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: o_message.c
*
* Description:
* =========
* This is the basic message-handler object, from which the other (specific)
* message handlers are derived. It is unlikely that this object type would
* be used directly - check your design.
****************************************************************************************************/
#include "Config.h"		// Global Configuration - do not remove!
#include "include\sysdefs.h"	// Global definition - do not remove!

/****************************************************************************************************
*	INCLUDE FILES
****************************************************************************************************/
// Include C Standard
#include <stdio.h>
#include <string.h>

// Include project specific
#include "GUI\Menu_system\ms_object.h"
#include "GUI\Menu_system\ms_container.h"
#include "GUI\Menu_system\ms_component.h"
#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_display.h"
#include "GUI\Menu_system\osd_rendering.h"

#include "GUI\Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "GUI\Object_class\Message\mso_message.h"
#include "Playcore\scpad\scmgr.h"

/****************************************************************************************************
*	DEFINITION: Private named constants 
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private macros
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private typedefs
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Public (global) variables
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private (static) variables
****************************************************************************************************/
/****************************************************************************************************
*	DECLARATION: Private (static) functions
****************************************************************************************************/

/****************************************************************************************************
*	DEFINITION: Public functions
****************************************************************************************************/
/****************************************************************************************************
* Function	: OMESSAGE_Operation
*
* Input		: Parameter_1 - description
*			  Parameter_2 - description
*
* Output		: Parameter_3 - description
*			  Parameter_4 - description
*
* Return		: Describe_possible_returned_values_and_their_meaning
*
* Description	: Describe_what_the_function_does_in_English
*	
****************************************************************************************************/
MS_OP OMESSAGE_Operation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	MS_OP *pMsOpMsg;
	MSO_MESSAGE __NEAR* pMessage = (MSO_MESSAGE __NEAR*)pThis;

	switch(MsOp)
	{
// TODO: Remove and never add code using mMsOpMsgPrevious 
#ifdef D_TEMPORARILY_KEEP_MS_OP_MSG_PREVIOUS_FOR_BRANCHED_OUT_CUSTOMERS
		pMessage->moParam.mMsOpMsgPrevious = MS_OP_NONE;
#endif //D_TEMPORARILY_KEEP_MS_OP_MSG_PREVIOUS_FOR_BRANCHED_OUT_CUSTOMERS

	// Initialize the ScFormUniStr, Icon and the MS_OP_MSG
	case MS_OP_INIT:
	case MS_OP_ON_DEFROST:
		pMessage->moParam.mMsOpMsg = MS_OP_NONE;
		MS_SetInvisible(pThis);
		pMessage->moParam.mwCoreTimer = 0;
		pMessage->moParam.mpIcon = NULL;
		pMessage->moParam.mScFormUniStr = OSDR_MallocScFormUniStr();
		break;

	// Free the mScFormUniStr
	case MS_OP_EMPTY:
	case MS_OP_PREPARE_FOR_FREEZE:
		OSDR_FreeScFormUniStr(pMessage->moParam.mScFormUniStr);
		pMessage->moParam.mScFormUniStr = NULL_HANDLE;
		break;

	// Handle the timeout
	// Setting itself invisible if time is out
	// To set infinite time, set the timer to 0
	case MS_OP_TICK:
		if(pMessage->moParam.mwCoreTimer)
		{
			pMessage->moParam.mwCoreTimer--;
		}
		else if(pMessage->moParam.mwTimer)
		{
			pMessage->moParam.mwTimer--;
			if (0 == pMessage->moParam.mwTimer)
			{
				// We don't change the OSD layer to avoid changing the order of the message objects
				// Just make the message dissappear, but it stays in same layer
				MS_SetInvisible(pThis);
				MS_DisplayObject(pThis);
    				pMessage->moParam.mMsOpMsg = MS_OP_NONE;
				pMessage->moParam.mpIcon = NULL;
			}
		}
		break;		

// TODO: Remove compile switch 
#ifndef D_TEMPORARILY_KEEP_MS_OP_MSG_PREVIOUS_FOR_BRANCHED_OUT_CUSTOMERS
	case MS_OP_MSO_MESSAGE_BUILD:
		OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)lParam, pMessage->moParam.mScFormUniStr);
		pMessage->moParam.mwCoreTimer = ((MS_DESCRIPTOR_MESSAGE*)(pThis->mpDescriptor))->mwCoreTime;
		MS_ClearInvisible(pThis);
		return MS_OP_NONE;
#endif //D_TEMPORARILY_KEEP_MS_OP_MSG_PREVIOUS_FOR_BRANCHED_OUT_CUSTOMERS

	case MS_OP_IS_MSG_DISPLAYED:
		// The parameter lParam contains the message identifier:
		pMsOpMsg = (MS_OP *)lParam;

		// Is this message the one on display currently?
		if (*pMsOpMsg == pMessage->moParam.mMsOpMsg)
		{
			// Yes - set the identifier to NONE to indicate this:
			*pMsOpMsg = MS_OP_NONE;
			// This operation has been handled here:
			MsOp = MS_OP_NONE;
		}
		break;
	}

	return(MsOp);
}

/****************************************************************************************************
* Function	: OMESSAGE_FillOSDSeg
*
* Input		: Parameter_1 - description
*			  Parameter_2 - description
*
* Output		: Parameter_3 - description
*			  Parameter_4 - description
*
* Return		: Describe_possible_returned_values_and_their_meaning
*
* Description	: Describe_what_the_function_does_in_English
*	
****************************************************************************************************/
BOOL OMESSAGE_FillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
	MSO_MESSAGE __NEAR* pMessage = (MSO_MESSAGE __NEAR*)pThis;
	MS_DESCRIPTOR_MESSAGE* pDescriptorMessage = (MS_DESCRIPTOR_MESSAGE*)pThis->mpDescriptor;
	FORMATED_UNICODE_STRING oFormUniStr;

	// Is there a bitmap associated with this message?
	if (NULL != pDescriptorMessage->mpBgBmp)
	{
		// Yes - display it:
		OSDR_FillOsdSegBitmapFitArea(pDescriptorMessage->mpBgBmp, pAbsArea);
	}

	// Is there an icon associated with this message?
	if (NULL != pMessage->moParam.mpIcon)
	{
		// Yes - display it:
		OSDR_FillOsdSegBitmap(	pMessage->moParam.mpIcon,
								pAbsArea,
								pDescriptorMessage->mwIconX,
								pDescriptorMessage->mwIconY,
								pDescriptorMessage->mcIconHorizontal,
								pDescriptorMessage->mcIconVertical,
								NULL_EXPANSION,
								NULL_EXPANSION);
	}

	// Is there text associated with this message?
	if(MS_OP_NONE != pMessage->moParam.mMsOpMsg)
	{
		// Yes - get it from the scratch-pad:
		OSDR_GetFormUniStr_ScFormatted(	(FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
										(UINT32)pMessage->moParam.mScFormUniStr);

		// Display it:
		OSDR_FillOsdSegUniString(	(FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
									pAbsArea,
									OSDR_AlignmentGetOffsetInObject(	ALIGN_H_CENTER,
																			oFormUniStr.mwPixelWidth,
																			pAbsArea->mwW) + pDescriptorMessage->mwTextX,
									OSDR_AlignmentGetOffsetInObject(	ALIGN_V_CENTER,
																			oFormUniStr.mcPixelHeight,
																			pAbsArea->mwH) + pDescriptorMessage->mwTextY,
									pDescriptorMessage->mcTextHorizontal,
									pDescriptorMessage->mcTextVertical,
									pDescriptorMessage->mwTextColor);
	}	
	return FALSE;
}


⌨️ 快捷键说明

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