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

📄 o_fta_selection.c

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/* **************************************************************************************
*  Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: $Workfile: o_FTA_Selection.c $
*
* Description:
* ============
*
****************************************************************************************/
#include "Config.h"		// Global Configuration - do not remove!

#ifdef FTA_SUPPORT

#include "Include\SysDefs.h"

#include "GUI\Menu_system\ms_menu.h"
#include "GUI\Object_class\Page\mso_page.h"
#include "Menu\menu_operation_def.h"
#include "GUI\Menu_system\ms_container.h"
#include "GUI\Menu_system\ms_component.h"
#include "CoreAPI\CoreAPI.h"
#include "Playcore\FTA\fta.h"
#include "Kernel\EventDef.h"
#include "GUI\Object_class\Vlist\mso_vlist.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\Resource\Bitmap\bitmap.h"

#include "Menu_config\menu_config_common.h"
#include "GUI\Object_class\Text\mso_text.h"

// Include the module header file
#include "Components\FTA_Selection\o_FTA_Selection.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Components\FTA_Selection\o_FTA_Selection_config.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\Custom\FTA_Selection\o_FTA_Selection_custom.h"

#define  FTA_MAX_CHANNEL_NAME_LEN           CHANNEL_NAME_MAX_LENGTH+1
/****************************************************************************************
* 			public functions
*****************************************************************************************/
MSO_OBJECT __NEAR* OpenFTASelection(MSO_CONTAINER __NEAR* pContainer, FTA_SELECTION_TYPE eType);

/****************************************************************************************
*	operation handlers
*****************************************************************************************/
static UINT16 _SelectChannel(MSO_OBJECT __NEAR* pThis);
static UINT16 _GetFavoriteItemIndex(MSO_OBJECT __NEAR* pThis, UINT16 wIndex, UINT16 wStartIndex);
/****************************************************************************************
*	operation functions
*****************************************************************************************/
static void _VScrollListInitOp(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
static void _VScrollListRefreshOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
static MS_OP _VScrollListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _ListItemOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _ComponentOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _TitleNameOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
/*****************************************************************************************
*	Display  functions
******************************************************************************************/
static BOOL _ListItemFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
static BOOL _ComponentFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);


/***************************************************************************************
* 	Include customization file.
****************************************************************************************/

// Include custom code file: customer specific code, over-writing common one.
#include "Components\Custom\FTA_Selection\o_FTA_Selection_custom.c"
// Include configuration file: constants.
#include "Components\FTA_Selection\o_FTA_Selection_config.c"

/***************************************************************************************
* 	Utility functions
****************************************************************************************/
/***************************************************************************************
*	Function	: 	_VScrollListRefreshOperation
*
*	In		: 	pThis	=	Pointer to the FTA channel scroll list  object.
*
*				lParam	=	Parameter associated with an MS_OP if any.
*
*	Out		: 	None.
*
*	Return	:	None
*
*	Desc 	:	This function handles MS_OP_REFRESH operation of the
*				MSO_VSCROLL_LIST object represented by the
*				oDescriptorVScrollList descriptor..
****************************************************************************************/
#ifndef D_CUSTOM__VScrollListRefreshOperation
static void _VScrollListRefreshOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam)
{
	MSO_LISTITEM __NEAR* 	    pItem;
	MSO_VLIST __NEAR* 			pList;
	MS_DESCRIPTOR_VLIST* 		pListDescriptor;

	FORMATED_UNICODE_STRING oFormUniStr;
	UINT16 wIndex, wCount, wNum;

	oFormUniStr.mtFontIndex = FONT_0;

	pListDescriptor = ((MS_DESCRIPTOR_VSCROLL_LIST*)(pThis->mpDescriptor))->mpDescriptorVList;
	pList = (MSO_VLIST __NEAR*)MS_FindObjectFromDescriptor((MSO_CONTAINER __NEAR*)pThis, (MS_DESCRIPTOR *)pListDescriptor);

	// Remove all existing items in the browser list.
	MS_SendOperation((MSO_OBJECT __NEAR*)pList, MS_OP_EMPTY, 0);
	
	if (FTA_SELECTION_FAVORITE ==  ((MSO_FTA_SELECTION __NEAR*)MS_GetParentPtr(pThis))->moParam.mtSelectionType)
		pList->moParam.mwTotalItems = CoreAPI_FtaGetCurrFavoriteChNums();
	else
		pList->moParam.mwTotalItems = CoreAPI_FtaGetNumberOfChannels();

	{
		UINT16  	wRestFiles;
		UINT16	wNumVisibleItems;
		UINT16 	wTotalFiles;

		if(REFRESH_LIST_DISPLAY_FIRST_ITEM == lParam)
			pList->moParam.mwFirstDisplayItem = 0;
		else if (REFRESH_LIST_DISPLAY_REMOVE_ITEM == lParam)
		{
			if ((pList->moParam.mwFirstDisplayItem >= CoreAPI_FtaGetCurrFavoriteChNums())
			&& (0 != CoreAPI_FtaGetCurrFavoriteChNums())) // To display first page
				pList->moParam.mwFirstDisplayItem -= pList->moParam.mcNumVisibleItems;
		}
		/*else
		{
			if( FTA_GetStatus() == FTA_STATUS_PLAYING )
			{
				pList->moParam.mwFirstDisplayItem = FTA_GetCurrChannel();
			}
		}*/
		// Set list parameters.

		wTotalFiles = pList->moParam.mwTotalItems;

		wNumVisibleItems 	= pList->moParam.mcNumVisibleItems;
		wIndex 			= pList->moParam.mwFirstDisplayItem;    //First Display Item number in folder

		// Display the channel.
		wRestFiles = wTotalFiles -wIndex;

		if(wNumVisibleItems > 0)
		{
			CHANNEL_INFO channelInfo;
			UINT16 wCurrFavoriteStartIndex;

			UINT16 wNextFileIndex = 0;
			UINT16 wszName[FTA_MAX_CHANNEL_NAME_LEN];
			memset(wszName, '\0', sizeof(UINT16) * FTA_MAX_CHANNEL_NAME_LEN);

			wNum = MIN(wNumVisibleItems, wRestFiles);
			// According 	mwFirstDisplayItem value to get obsulte item index	
			wCurrFavoriteStartIndex = _GetFavoriteItemIndex(pThis, wIndex + 1, 0);
			
			for(wCount = 0; wCount < wNum; wCount++)
			{	
				if (FTA_SELECTION_FAVORITE == ((MSO_FTA_SELECTION __NEAR*)MS_GetParentPtr(pThis))->moParam.mtSelectionType)
				{
					// According wCurrFavoriteStartIndex and wCount value to get File Index
					wNextFileIndex = _GetFavoriteItemIndex(pThis, wCount + 1, wCurrFavoriteStartIndex);
				}
				else
					wNextFileIndex = wCount + wIndex;//-1;


				pItem = (MSO_LISTITEM __NEAR*)OVLIST_CreatAndAddItem((MSO_OBJECT __NEAR*)pList,
														(MS_DESCRIPTOR *)&oDescriptorListItem,
														TRUE, FALSE);
				pItem->moParam.mwIndex = wNextFileIndex;
				if( CoreAPI_FtaGetCurrChannel() == wNextFileIndex  )
				{
					MS_SetSelected(pItem);
				}
				CoreAPI_FtaGetChannelInfo(wNextFileIndex, &channelInfo);
				memcpy((WCHAR*)wszName, channelInfo.szChannelName, FTA_MAX_CHANNEL_NAME_LEN);
				if( CoreAPI_FtaIsVideoChannel( wNextFileIndex ))
				{
					pItem->moParam.eType = FTA_SEL_CHANNEL_TYPE_VIDEO;                    
				}
				else
				{
					pItem->moParam.eType = FTA_SEL_CHANNEL_TYPE_RADIO;
				}
				// To add icon to favorite channel in list
				if (CoreAPI_FtaIsFavoriteChannel(wNextFileIndex) 
					&& (FTA_SELECTION_FAVORITE != ((MSO_FTA_SELECTION __NEAR*)MS_GetParentPtr(pThis))->moParam.mtSelectionType))
					pItem->moParam.bIsFavorite = TRUE;
				else
					pItem->moParam.bIsFavorite = FALSE;
					
					
				OSDR_GetFormUniStr_Ram((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)wszName);
				pItem->moParam.mwData = OSDR_MallocScFormUniStr();
				OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pItem->moParam.mwData);
			}
		}
	}

	MS_DisplayAddObject(pThis);

	// Set focus to the appropriate list item.
	if (!MS_IsFocused(pList))
		MS_ScreenSetFocusObject((MSO_OBJECT __NEAR*)pList);
	{
		if(!MS_IS_FOCUS_ON_LASTITEM(pList))
			MS_ScreenSetFocusObject(((MSO_CONTAINER __NEAR*)pList)->mpOlist);
		else
		{
			MSO_OBJECT __NEAR* pObject = ((MSO_CONTAINER __NEAR*)pList)->mpOlist;

			while(NULL != pObject->mpNext)
				pObject = pObject->mpNext;

			MS_ScreenSetFocusObject(pObject);
		}
	}
}
#endif //D_CUSTOM

/***************************************************************************************
*	Function	: 	_VScrollListInitOp
*
*	In		: 	pThis	=	Pointer to the subtitle scroll list (MSO_VSCROLL_LIST) object.*
*
*				lParam	=	Parameter associated with an MS_OP if any.
*
*	Out		: 	None.
*
*	Return	:	None.
*
*	Desc 	:	This function handle MS_OP_INIT  of the subtitle scroll list
*				(MSO_VSCROLL_LIST) object represented by the
*				oDescriptorVScrollList descriptor.
****************************************************************************************/
#ifndef D_CUSTOM__VScrollListInitOp
static void _VScrollListInitOp(MSO_OBJECT __NEAR* pThis, UINT32 lParam)
{
	MSO_VLIST __NEAR* pList;
	MS_DESCRIPTOR_VLIST * pListDescriptor;


	pListDescriptor = ((MS_DESCRIPTOR_VSCROLL_LIST*)(pThis->mpDescriptor))->mpDescriptorVList;
	pList = (MSO_VLIST __NEAR*)MS_FindObjectFromDescriptor((MSO_CONTAINER __NEAR*)pThis,
													(MS_DESCRIPTOR *)pListDescriptor);
	pList->moParam.mwTotalItems = CoreAPI_FtaGetNumberOfChannels();
	if( CoreAPI_FtaIsChnlPlaying() )
	{
		pList->moParam.mwFirstDisplayItem = CoreAPI_FtaGetCurrChannel();
	}
	MS_SendOperation(pThis, MS_OP_REFRESH, lParam);

}
#endif // D_CUSTOM

/***************************************************************************************
*	Function	: 	_VScrollListOperation
*
*	In		: 	pThis	=	Pointer to the subtitle scroll list (MSO_VSCROLL_LIST) 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 processes all operations/events  of the subtitle scroll list
*				(MSO_VSCROLL_LIST) object represented by the
*                                     oDescriptorVScrollList descriptor.
****************************************************************************************/
#ifndef D_CUSTOM__VScrollListOperation
static MS_OP _VScrollListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	MsOp = VScrollListOperation(pThis, MsOp, lParam);

	// Post processing
	switch(MsOp)
	{
	case MS_OP_INIT:
		_VScrollListInitOp(pThis, lParam);
		break;

	case MS_OP_REFRESH:
		_VScrollListRefreshOperation(pThis, lParam);
		return MS_OP_NONE;

	default:
		break;
	}
	return MsOp;
}
#endif // D_CUSTOM

/***************************************************************************************
*	Function	: 	_ListItemOperation
*
*	In		: 	pThis	=	Pointer to the subtitle file list item (MSO_VSCROLL_LIST) 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 processes all operations/events  of the subtitle list item
*				(MSO_LISTITEM) object represented by the
*                                     oSubtListDescriptor descriptor.
****************************************************************************************/
#ifndef D_CUSTOM__ListItemOperation
#pragma argsused
static MS_OP _ListItemOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{    
	// Pre-processing
	switch(MsOp)
	{
	case MS_OP_EMPTY:
		if(NULL_HANDLE != ((MSO_LISTITEM __NEAR*)pThis)->moParam.mwData)
		{
			OSDR_FreeScFormUniStr(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwData);
			((MSO_LISTITEM __NEAR*)pThis)->moParam.mwData = NULL_HANDLE;
		}
        	break;
		
	case MS_OP_FTA_TAB_ADD:
		{
			CHANNEL_INFO chInfo;
			MSO_FTA_SELECTION __NEAR* pSelectionObject = (MSO_FTA_SELECTION __NEAR*)MS_FindAncestor(pThis, &oDescriptorFTASelection);
			if (FTA_SELECTION_FAVORITE != pSelectionObject->moParam.mtSelectionType)
			{
				if (!CoreAPI_FtaIsFavoriteChannel(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwIndex))
				{
					CoreAPI_FtaGetChannelInfo(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwIndex, &chInfo);
					chInfo.mwAttr |= FTA_CHANNEL_FAVORITE_ATTR;
					MS_SendOp(MS_OP_MSG_ADD_CHANNEL_TO_FAVORITE, 0);
					CoreAPI_FtaUpdateChannelList(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwIndex, &chInfo);
					((MSO_LISTITEM __NEAR*)pThis)->moParam.bIsFavorite = TRUE;
					MS_DisplayAddObject(pThis); 
				}
				else 
					MS_SendOp(MS_OP_MSG_CHANNEL_ALREADY_IN_FAVORITE, 0);
			}
			else
			{
				PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
			}
		}
		return MS_OP_NONE;
		
	case MS_OP_FTA_TAB_DELETE:
		{
			if (CoreAPI_FtaIsFavoriteChannel(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwIndex))
			{
				CHANNEL_INFO chInfo;
				MSO_FTA_SELECTION __NEAR* pSelectionObject = (MSO_FTA_SELECTION __NEAR*)MS_FindAncestor(pThis, &oDescriptorFTASelection);
				CoreAPI_FtaGetChannelInfo(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwIndex, &chInfo);
				chInfo.mwAttr &= ~FTA_CHANNEL_FAVORITE_ATTR;
				MS_SendOp(MS_OP_MSG_REMOVE_CHANNEL_FROM_FAVORITE, 0);
				CoreAPI_FtaUpdateChannelList(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwIndex, &chInfo);
				if (FTA_SELECTION_FAVORITE != pSelectionObject->moParam.mtSelectionType)
				{
					((MSO_LISTITEM __NEAR*)pThis)->moParam.bIsFavorite = FALSE;
					MS_DisplayAddObject(pThis); 
				}
				else
				{
					if (0 != CoreAPI_FtaGetCurrFavoriteChNums())
						MS_SendOperation((MSO_OBJECT __NEAR*)pSelectionObject, MS_OP_REFRESH, REFRESH_LIST_DISPLAY_REMOVE_ITEM);
					else // If current favorite channels number is 0
						MS_SendOperation((MSO_OBJECT __NEAR*)pSelectionObject, MS_OP_CLOSE_PARENT, 0);
				}
			}
			else
			{
				PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
			}
		}
		return MS_OP_NONE;

	case MS_OP_FOCUS_CHANGE:
		MS_DisplayAddObject(pThis);
		break;

	case MS_OP_PLAY:
	case MS_OP_ENTER:
		_SelectChannel(pThis);
		return MS_OP_FTA_SELECTION_FINISHED;
    default:
		break;;
	}

⌨️ 快捷键说明

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