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

📄 o_aux_subtitleselection.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_aux_SubtitleSelection.c $
*
* Description:
* ============
*
****************************************************************************************/
#include "Config.h"		// Global Configuration - do not remove!

#ifdef USE_AUX_SUBTITLES

#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 "GUI\Object_class\Choice\mso_choice.h"

#include "CoreAPI\CoreAPI.h"
#include "ClipsAPPEngine\ActionEngine\ActionEngine.h"
#include "ClipsAPPEngine\DirBrowser\DirBrowser.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 "Menu\Clips_menu.h"

#include "GUI\Resource\Bitmap\bitmap.h"

// Include the module header file
#include "Components\Aux_subtitles_selection\o_aux_subtitleSelection.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Components\Aux_subtitles_selection\o_aux_subtitleSelection_config.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\Custom\Aux_subtitles_selection\o_aux_subtitleSelection_custom.h"

/****************************************************************************************
* 			public functions
*****************************************************************************************/
MSO_OBJECT __NEAR* OpenAuxSubtSelection(MSO_CONTAINER __NEAR* pContainer, UINT16 wClipNum, UINT16 wDirIndex);

/****************************************************************************************
*	operation handlers
*****************************************************************************************/
static UINT16 _SelectExtSubtFile(MSO_OBJECT __NEAR* pThis, BOOL bSubtitleOn);
static void _DestructSubtActionEngine(MSO_OBJECT __NEAR* pThis);

/****************************************************************************************
*	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);
/*****************************************************************************************
*	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\Aux_subtitles_selection\o_aux_subtitleSelection_custom.c"
// Include configuration file: constants.
#include "Components\Aux_subtitles_selection\o_aux_subtitleSelection_config.c"

/***************************************************************************************
* 	Utility functions
****************************************************************************************/
/***************************************************************************************
*	Function	: 	_VScrollListRefreshOperation
*
*	In		: 	pThis	=	Pointer to the subtitle 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;
	MSO_AUX_SUBT_SELECTION __NEAR* pAuxSubtSelect;
	//MSO_BROWSER_PAGE __NEAR* pPage;

	FORMATED_UNICODE_STRING oFormUniStr;
	UINT16 wIndex, wCount, wNum;

	oFormUniStr.mtFontIndex = FONT_0;

	//pPage = (MSO_BROWSER_PAGE __NEAR*)_GetActivePage();
	pAuxSubtSelect = (MSO_AUX_SUBT_SELECTION __NEAR*)MS_FindParentFromDescriptor(pThis, (MS_DESCRIPTOR *)&oDescriptorAuxSubtSelection);
	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);

	{
		UINT16  wRestFiles,  wNumVisibleItems;
		UINT16 wTotalFiles;
		//enClipType eOldType;

		PtrToDirBrowser pDirBrowser = (PtrToDirBrowser)pAuxSubtSelect->moParam.mpActionEngine;
		//PtrToDirBrowser pDirBrowser = (PtrToDirBrowser)pPage->moParam.mpSrcActionEngine;
		//DirBrowser_RefreshDir(pDirBrowser);
		if(REFRESH_LIST_DISPLAY_FIRST_ITEM == lParam)
			pList->moParam.mwFirstDisplayItem = 0;

		// Set list parameters.

		wTotalFiles = pList->moParam.mwTotalItems;//one item for subtitle off

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

		//display subtitle off
		if (0 == wIndex)
		{
			pItem = (MSO_LISTITEM __NEAR*)OVLIST_CreatAndAddItem((MSO_OBJECT __NEAR*)pList,
															(MS_DESCRIPTOR *)&oDescriptorListItem,
															TRUE, FALSE);
			pItem->moParam.mwIndex = 0xffff;
			OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, S_EXTERNAL_SUBTITLE_OFF);

			pItem->moParam.mwData = OSDR_MallocScFormUniStr();
			OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pItem->moParam.mwData);
			wIndex ++;
			wNumVisibleItems--;
		}


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

		if(wNumVisibleItems > 0)
		{
			UINT16 wNextFileIndex = 0;
// TODO: What's this +5 , Magic number ?
			UINT16 wszName[CLIPS_MAX_FILENAME_LEN + 5];

			wNum = MIN(wNumVisibleItems, wRestFiles);

			for(wCount = 0; wCount < wNum; wCount++)
			{
				wNextFileIndex = wCount + wIndex-1;

				pItem = (MSO_LISTITEM __NEAR*)OVLIST_CreatAndAddItem((MSO_OBJECT __NEAR*)pList,
																			(MS_DESCRIPTOR *)&oDescriptorListItem,
																			TRUE, FALSE);
				pItem->moParam.mwIndex = wNextFileIndex;

				if(FALSE == ActionEngine_GetFileName((PtrToActionEngineObject)pDirBrowser, pItem->moParam.mwIndex,
												(WCHAR*)wszName, CLIPS_MAX_FILENAME_LEN+5, 1))
				{
					MS_BREAK_POINT();
					wszName[0] = 0;
				}

				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;
	MSO_AUX_SUBT_SELECTION __NEAR* pAuxSubtSele;


	pListDescriptor = ((MS_DESCRIPTOR_VSCROLL_LIST*)(pThis->mpDescriptor))->mpDescriptorVList;
	pList = (MSO_VLIST __NEAR*)MS_FindObjectFromDescriptor((MSO_CONTAINER __NEAR*)pThis,
														(MS_DESCRIPTOR *)pListDescriptor);
	pAuxSubtSele = (MSO_AUX_SUBT_SELECTION __NEAR*)MS_FindParentFromDescriptor(pThis, (MS_DESCRIPTOR*)&oDescriptorAuxSubtSelection);

	//for solution1 we only count subtitle files which name is same as file name.
	//pList->moParam.mwTotalItems = ActionEngine_GetDvixTotalExternalAUXSubtitleNum(pActionEngine, wClipNum)+1;

	//for solution 2 count all subtitle file
	pList->moParam.mwTotalItems = DirBrowser_GetTotalClipsInDir((PtrToDirBrowser)pAuxSubtSele->moParam.mpActionEngine)+ 1;//one is for subtitle off item

	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)
	{

⌨️ 快捷键说明

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