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

📄 mso_text.c

📁 ZORAN 962/966 SOURCE CODE,DVD chip
💻 C
字号:
/* **************************************************************************************
*  Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: $Workfile: o_text.c $
*
* Description:
* ============
* Project definition of the MSO_TEXT 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 "Bitmap\bitmap_defs.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\Text\mso_text.h"
#include "Playcore\ScPad\SCMGR.h"

#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef	dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif

#define pObjectText ((MSO_TEXT __NEAR*)pThis)
#define pDescriptorText ((MS_DESCRIPTOR_TEXT*)(pThis->mpDescriptor))

CONST UINT8* OTEXT_GetBitmapFromSet(MSO_OBJECT __NEAR* pThis, MS_BITMAP_SET *pBmpSet)
{
	if(pBmpSet == NULL)
		return NULL;

	// Not focusable is highest priority
	if(!MS_IsFocusable(pThis))
		return (pBmpSet->mpNotFocusable ? pBmpSet->mpNotFocusable : pBmpSet->mpDefault);

	// Then comes the selection state
			if(MS_IsSelected(pThis))
				return (pBmpSet->mpAction ? pBmpSet->mpAction : pBmpSet->mpDefault);

	// else display the default
	return (pBmpSet->mpDefault);
}

UINT8 OTEXT_GetColorFromSet(MSO_OBJECT __NEAR* pThis, MS_COLOR_SET *pColorSet)
{
	if(MS_IsFocusable(pThis))
	{
		if(MS_IsFocused(pThis))
		{
			if(MS_IsSelected(pThis))
				return (pColorSet->mcAction ? pColorSet->mcAction : pColorSet->mcDefault);

			return (pColorSet->mcFocused ? pColorSet->mcFocused : pColorSet->mcDefault);;
		}
		return pColorSet->mcDefault;
	}
	return (pColorSet->mcNotFocusable ? pColorSet->mcNotFocusable : pColorSet->mcDefault);
}

/**************************************************************************
*	Function	:	TextOperation
*
*	In		:
*
*	Out 		:
*
*	Desc		:
 ***************************************************************************/
MS_OP OTEXT_Operation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch (MsOp)
	{

	case MS_OP_REFRESH:
	case MS_OP_FOCUS_CHANGE:
        	// We have gained or lost focus.
            // Ask for a redisplay:
            MS_DisplayAddObject(pThis);
            break;

	// When building the text string requested in menus (not on MS_OP_INIT or MS_OP_DEFROST) 
	// the user can change the string, so the parameter in the OSD_TEXT is only for initialization.
	case MS_OP_BUILD_TEXT_STRING:
		{
			FORMATED_UNICODE_STRING oFormUniStr;

			if(pDescriptorText->mText != NULL)
			{
				oFormUniStr.mtFontIndex = pDescriptorText->mtFontIndex;
				pDescriptorText->mText->mGetStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, lParam);
			}
			else
			{
				oFormUniStr.mszUniStr[0] = 0;
			}
			OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pObjectText->moParam.wScFormUniStr);
		}
		return MS_OP_NONE;

	case MS_OP_ON_DEFROST:
    	case MS_OP_INIT:
		// All text are dynamically allocated, might want to add attribute to the text descriptor to specify static text
		{
			// Allocate scratchpad memory to hold a unicode formatted string.
			pObjectText->moParam.wScFormUniStr = OSDR_MallocScFormUniStr();
			MS_ASSERT(NULL_HANDLE != pObjectText->moParam.wScFormUniStr);

			MS_SendOperation(pThis, MS_OP_BUILD_TEXT_STRING, pDescriptorText->mText->mParam);
    		}
        	break;

	case MS_OP_PREPARE_FOR_FREEZE:
       case MS_OP_EMPTY:
		{
			// Release the scratchpad memory:
			OSDR_FreeScFormUniStr(pObjectText->moParam.wScFormUniStr);
			pObjectText->moParam.wScFormUniStr = NULL_HANDLE;
        	}
		break;

	}

	return(MsOp);
}

/**************************************************************************
*	Function	:	TextFillOSDSeg
*
*	In		:
*
*	Out 		:
*
*	Desc		:
 ***************************************************************************/
BOOL OTEXT_FillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
	FORMATED_UNICODE_STRING oFormUniStr;
	MS_X_Y_ALIGN			*pXYAlignText  =  (((MS_DESCRIPTOR_TEXT*)(pThis->mpDescriptor))->mpXYAlignText);
	// display bitmap underneath text
	OSDR_FillOsdSegBitmapFitArea(OTEXT_GetBitmapFromSet(pThis, pDescriptorText->mpBmpSetBg), pAbsArea);

	if(MS_IsFocused(pThis) && (NULL != pDescriptorText->mpBmpSetBg))
		OSDR_FillOsdSegBitmapFitArea(pDescriptorText->mpBmpSetBg->mpFocused, pAbsArea);

	// if an icon exists
	if(pDescriptorText->mpBmpSetIcon != NULL)
	{
		CONST UINT8 *pcIcon = OTEXT_GetBitmapFromSet(pThis, pDescriptorText->mpBmpSetIcon);
		MS_X_Y_ALIGN	*pXYAlignIcon = (((MS_DESCRIPTOR_TEXT*)(pThis->mpDescriptor))->mpXYAlignIcon) ;
		OSDR_FillOsdSegBitmap(pcIcon,
							pAbsArea,
							TEXT_GetAlignXPosition(pXYAlignIcon, BMP_GetWidth(pcIcon), pAbsArea->mwW) ,
							TEXT_GetAlignYPosition(pXYAlignIcon, BMP_GetHeight(pcIcon), pAbsArea->mwH),
							TEXT_GetAlignHorizontal(pXYAlignIcon),
							TEXT_GetAlignVertical(pXYAlignIcon) ,
							NULL_EXPANSION,
							NULL_EXPANSION);
	}

	// Get the formatted message from it's storage location:
	OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)(pObjectText->moParam.wScFormUniStr));

	OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
							pAbsArea,
							TEXT_GetAlignXPosition(pXYAlignText, oFormUniStr.mwPixelWidth, pAbsArea->mwW)	,
							TEXT_GetAlignYPosition(pXYAlignText, oFormUniStr.mcPixelHeight, pAbsArea->mwH)	,
							TEXT_GetAlignHorizontal(pXYAlignText), 
							TEXT_GetAlignVertical(pXYAlignText),
							OTEXT_GetColorFromSet(pThis, pDescriptorText->mpColorSetText));

	return FALSE;
}

⌨️ 快捷键说明

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