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

📄 clips_menu.c

📁 ZORAN 962/966 SOURCE CODE,DVD chip
💻 C
📖 第 1 页 / 共 5 页
字号:

			// Check if the JPEGs have already finished playing.
			if(TRUE == _JPEGFinished(pClipsMenu))
			{
				_SwitchToBrowser();
				_JPEGFinished(pClipsMenu) = FALSE;
			}
			else
				ActionEngine_GotoEntry(FgActionEnginePtr, wActiveItemFg, eActionPlay);
		}

		return;
	}

#endif // JPEG_MP3_ENABLE

	if((PtrToActionEngineObject)lParam == FgActionEnginePtr)
	{
		if (FALSE == ActionEngine_CoreActionFinished(FgActionEnginePtr))
		{

#ifdef JPEG_MP3_ENABLE
			if (CoreAPI_IsSimultaneousMode())
			{
				_JPEGFinished(pClipsMenu) = TRUE;
				return ;
			}
#endif // JPEG_MP3_ENABLE

#ifdef D_MULTI_CDDA_SHUFFLE_PLAY
			if (CoreAPI_IsMultiCDDAShufflePlay())
			{
				// request mounting next disc
				CoreAPI_MountDisc();
				dbg_printf(("Clips Menu, finished play, request mount next disc\n"));
			}
#endif
			_SwitchToBrowser();
			{
			MSO_OBJECT __NEAR* pList = MS_FindDescendant(pThis, &oBrowserVListDescriptor);
			if(MS_IsFocused(pList))
				MS_SET_BROWSERVLIST_FOCUS_ON_ACTIVE(pList);
			}
		}
		else
		{
			if (ActionEngine_IsMPEG4Loading(FgActionEnginePtr) 
#ifndef D_DISABLE_MESSAGE_PLAYSTATE_LOADING_JPEG 
				|| ActionEngine_CurrItemIsJpegDecoding(FgActionEnginePtr)
#endif//D_DISABLE_MESSAGE_PLAYSTATE_LOADING_JPEG 
				)
				MS_SendOp(MS_OP_MSG_PLAYSTATE_LOADING_FILE, 0);
		}
	}

}
/***************************************************************************************
*	Function	:	_BrowserScrollListRefreshOperation
*
*	In		:	pThis	= Pointer to the MSO_VSCROLL_LIST object.
*				lParam	= Parameter if any.
*
*	Out 		:	None.
*
*	Desc		:	This function handles MS_OP_REFRESH operation of the
*				MSO_VSCROLL_LIST object represented by the
*				oBrowserVScrollListDescriptor descriptor.
****************************************************************************************/
static void _BrowserScrollListRefreshOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam)
{
	MSO_OBJECT __NEAR* 	pPage;
	MSO_OBJECT __NEAR* 	pItem;
	MSO_VLIST __NEAR*	pList;
	MS_DESCRIPTOR_VSCROLL_LIST* 	pScrollListDescriptor;

	FORMATED_UNICODE_STRING oFormUniStr;
	UINT16 wIndex, wCount, wNum;

	pPage = MS_FindAncestor(pThis, &oBrowserPageDescriptor);
	pScrollListDescriptor = (MS_DESCRIPTOR_VSCROLL_LIST*)MS_GetDescriptorPtr(pThis);

	pList = (MSO_VLIST __NEAR*)MS_FindDescendant(pThis, pScrollListDescriptor->mpDescriptorVList);

	// Remove all existing items in the browser list.
	MS_SendOperation((MSO_OBJECT __NEAR*)pList, MS_OP_EMPTY, 0);

	oFormUniStr.mtFontIndex = FONT_0;

#ifdef D_GUI_CLIPS_PROGRAM_VIEW
	// Display the program list.
	if(MsIsProgramView(_GetActivePage()))
	//if(INVALID_DEVICEID == _GetPageDeviceId(pPage))
	{
		UINT16 wszName[CLIPS_MAX_FILENAME_LEN + 1];
		PtrToProgramList pProgramList = (PtrToProgramList)_GetSrcActionEnginePtr(pPage);

		// Set list parameters.
		if(REFRESH_LIST_DISPLAY_FIRST_ITEM == lParam)
				pList->moParam.mwFirstDisplayItem = 0;
		pList->moParam.mwTotalItems = ProgramList_GetListSize(pProgramList);
		
		if(pList->moParam.mwFirstDisplayItem >= pList->moParam.mwTotalItems)
			pList->moParam.mwFirstDisplayItem = 0;
		
		wIndex = pList->moParam.mwFirstDisplayItem;
		wNum = pList->moParam.mwTotalItems;
		//calculate numbers of left item
		if(wNum >= wIndex)
			wNum -= wIndex;

		wNum = MIN(pList->moParam.mcNumVisibleItems, wNum);

		for(wCount = 0; wCount < wNum; wCount++)
		{
			pItem = OVLIST_CreateAndAppendItem(pList, &oListItemDescriptor);

			_GetClipsItemIndex(pItem) = wCount + wIndex;

			if(TRUE == ActionEngine_AmISelected((PtrToActionEngineObject)pProgramList, _GetClipsItemIndex(pItem)))
				MS_SetSelected(pItem);
			else
				MS_ClearSlected(pItem);

			_GetClipsFileType(pItem) = ActionEngine_GetFileType((PtrToActionEngineObject)pProgramList, _GetClipsItemIndex(pItem));
			_GetClipsItemType(pItem) = CLIP_ITEM_TYPE_FILE;
			if(FALSE == ActionEngine_GetFileName((PtrToActionEngineObject)pProgramList, _GetClipsItemIndex(pItem), (WCHAR*)wszName, CLIPS_MAX_FILENAME_LEN + 1, 0))
			{
				MS_BREAK_POINT();
				wszName[0] = 0;
			}

			OSDR_GetFormUniStr_Ram((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)wszName);
			_GetClipsItemData(pItem) = OSDR_MallocScFormUniStr();
			OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, _GetClipsItemData(pItem));
		}
	}
	else
#endif//def D_GUI_CLIPS_PROGRAM_VIEW
	{
		BOOL bIsRoot;
		UINT16 wNumDirs, wNumFiles, wItemIndex, wNumVisibleDirs, wNumVisibleItems;
		PtrToDirBrowser pDirBrowser = (PtrToDirBrowser)_GetSrcActionEnginePtr(pPage);
		DirBrowser_RefreshDir(pDirBrowser);

		{
			if(REFRESH_LIST_DISPLAY_FIRST_ITEM == lParam)
				pList->moParam.mwFirstDisplayItem = 0;

			// Set list parameters.
			pList->moParam.mwTotalItems = DirBrowser_GetTotalNumEntitiesInDir(pDirBrowser);

			wNumDirs 		= DirBrowser_GetTotalNumSubDirInDir(pDirBrowser);
			wNumVisibleItems 	= pList->moParam.mcNumVisibleItems;
			wIndex 			= pList->moParam.mwFirstDisplayItem;
			bIsRoot 			= DirBrowser_AmIRoot(pDirBrowser);
			wItemIndex 		= pList->moParam.mwFirstDisplayItem + 1;

			// Display the "Go up..."(to browse to the parent directory) item incase we are within a sub-directory.
			if(FALSE == bIsRoot)
			{
				wNumDirs += 1; // 1 for the Go-up button.
				pList->moParam.mwTotalItems += 1;
			}

			if(wItemIndex > wNumVisibleItems)
				wItemIndex -= wNumDirs;

			if(wNumDirs > wIndex)
			{
				WORD wszName[CLIPS_MAX_DIRNAME_LEN + 1];

				wNumVisibleDirs = MIN((wNumDirs - wIndex), pList->moParam.mcNumVisibleItems);

				// Add the Go-up/Devices item.
				if(FALSE == bIsRoot /*|| (1 < DeviceManager_GetNumberDevices())*/)
				{
					 // Take into account the Go-up item.
					if(wIndex >= pList->moParam.mcNumVisibleItems)
						wIndex -=  1;

					// Show the Go Up item only once i.e. just before the first item in the directory.
					if(0 == pList->moParam.mwFirstDisplayItem)
					{
						pItem = OVLIST_CreateAndAppendItem(pList, &oListItemDescriptor);
						MS_ClearSlected(pItem);

						_GetClipsItemIndex(pItem) = NULL_INDEX;
						_GetClipsItemType(pItem) = /*(TRUE == bIsRoot) ? CLIP_ITEM_TYPE_DEVICELIST :*/ CLIP_ITEM_TYPE_DIR;
						_GetClipsFileType(pItem) = eClipType_None;


						//if(TRUE == bIsRoot)
						//	OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, S_DEVICES);
						//else
							OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, S_GO_UP);

						_GetClipsItemData(pItem) = OSDR_MallocScFormUniStr();
						OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, _GetClipsItemData(pItem));

						wNumVisibleItems--;
						wNumVisibleDirs--;
					}
				}

				// Display the sub-directories.
				for(wCount = 0; wCount < wNumVisibleDirs; wCount++)
				{
					pItem = OVLIST_CreateAndAppendItem(pList, &oListItemDescriptor);
					MS_ClearSlected(pItem);
					_GetClipsItemIndex(pItem)	= wCount + wIndex;
					_GetClipsItemType(pItem)	= CLIP_ITEM_TYPE_DIR;

					_GetClipsFileType(pItem) 	= eClipType_None;


					if (FALSE == DirBrowser_GetDirName(pDirBrowser, _GetClipsItemIndex(pItem), (WCHAR*)wszName, CLIPS_MAX_DIRNAME_LEN + 1))
					{
						MS_BREAK_POINT();
						wszName[0] = 0;
					}

					OSDR_GetFormUniStr_Ram((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)wszName);

					_GetClipsItemData(pItem) = OSDR_MallocScFormUniStr();
					OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, _GetClipsItemData(pItem));

					wNumVisibleItems--;
				}
			}

			// Display the files.
			wNumFiles = DirBrowser_GetTotalClipsInDir(pDirBrowser);
			wIndex = (pList->moParam.mwFirstDisplayItem > wNumDirs) ? pList->moParam.mwFirstDisplayItem - wNumDirs : 0;
			if(wNumFiles > wIndex)
				wNumFiles -= wIndex;

			if(wNumVisibleItems > 0)
			{
				UINT16 wFileType = eClipType_None;
				UINT16 wNextFileIndex = 0;
				UINT16 wszName[CLIPS_MAX_FILENAME_LEN + 1];

				wNum = MIN(wNumVisibleItems, wNumFiles);

				for(wCount = 0; wCount < wNum; wCount++)
				{
					wNextFileIndex = wCount + wIndex;
					wFileType = ActionEngine_GetFileType((PtrToActionEngineObject)pDirBrowser, wNextFileIndex);

					// Ignore files that cannot be played.
					if((eClipType_None == wFileType) || (eClipType_SUBTITLE == wFileType))
					{
						MS_BREAK_POINT();
						continue;
					}

					pItem = OVLIST_CreateAndAppendItem(pList, &oListItemDescriptor);
					_GetClipsItemIndex(pItem) = wNextFileIndex;

					if(TRUE == ActionEngine_AmISelected((PtrToActionEngineObject)pDirBrowser, _GetClipsItemIndex(pItem)))
						MS_SetSelected(pItem);
					else
						MS_ClearSlected(pItem);

					// Check if this item is already playing.
#ifdef D_GINGER_I86
					if(!_AreWorkDirectoyDifferent(FgActionEnginePtr, (PtrToActionEngineObject)pDirBrowser))
					{
						if(TRUE == ActionEngine_AmIPlaying(FgActionEnginePtr, _GetClipsItemIndex(pItem)))
							MS_SET_CLIPSLISTITEM_PLAYING(pItem);
					}
#endif //D_GINGER_I86
					_GetClipsItemType(pItem) = CLIP_ITEM_TYPE_FILE;
					_GetClipsFileType(pItem) = wFileType;

					if(FALSE == ActionEngine_GetFileName((PtrToActionEngineObject)pDirBrowser, _GetClipsItemIndex(pItem),
														(WCHAR*)wszName, CLIPS_MAX_FILENAME_LEN + 1, 0))
					{
						MS_BREAK_POINT();
						wszName[0] = 0;
					}

					OSDR_GetFormUniStr_Ram((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)wszName);
					_GetClipsItemData(pItem) = OSDR_MallocScFormUniStr();
					OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, _GetClipsItemData(pItem));

					wItemIndex++;
				}
			}
		}
	}

	MS_DisplayAddObject(pThis);

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

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

			MS_ScreenSetFocusObject(pObject);
		}
	}
}



/***************************************************************************************
*	Function	:	_MenuCacheFinishedOperation
*
*	In		:	pThis	= Pointer to the clips menu object.
*				lParam	= Parameter if any.
*
*	Out 		:	None.
*
*	Desc		:	This function handles MS_OP_CORE_CACHE_FINISHED operation of the
*				MSO_CLIPS_MENU object .
*	return    :     TRUE  cache finished success
*			     FALSE cache finish error
*				
****************************************************************************************/
static BOOL _MenuCacheFinishedOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam)
{
	MSO_OBJECT __NEAR* 	 pObjectBook = MS_FindDescendant(pThis, &oBrowserBookDescriptor);
	MSO_OBJECT __NEAR* 	 pPage;
	PtrToActionEngineObject pActionEngineBrowser;
#ifdef D_GUI_CLIPS_PROGRAM_VIEW
	PtrToActionEngineObject pActionEngineProgram;
#endif//D_GUI_CLIPS_PROGRAM_VIEW
	UINT16 wPageIndex;
	BOOL bIsResume = 0;
	BOOL bCacheFishishSuccess = TRUE;

	MS_ASSERT(NULL != pObjectBook);
	
#ifdef D_CACHE_CLIPSDB_ONLY_ONCE
	if (DeviceManager_IsNoAvailableClips())
	{
		MS_SendOp(MS_OP_MSG_ERROR_DISC_NO_SUPPORTED_FILE, 0);
	}
	else if (DeviceManager_IsDiscPartiallyCached())
	{
		MS_SendOp(MS_OP_MSG_ERROR_DISC_PARTIALLY_CACHED, CLIPS_MAX_FILE_NUM);
	}
#endif // D_CACHE_CLIPSDB_ONLY_ONCE

	//create dir browser engine
	pActionEngineBrowser = ActionEngine_Construct_Ex(eObjectDirectoryBrowser, (UiIdentifier)pThis, TRUE);
	MS_ASSERT(NULL != pActionEngineBrowser);
	DirBrowser_SetFileTypes((PtrToDirBrowser)pActionEngineBrowser, CLIPTYPE_FILTER_DEFAULT);
#ifdef D_GUI_CLIPS_PROGRAM_VIEW
	//create program list  engine
	pActionEngineProgram = ActionEngine_Construct_Ex(eObjectProgramList, (UiIdentifier)pThis, TRUE);
	MS_ASSERT(NULL != pActionEngineProgram);
	//ProgramList_SetFileTypes((PtrToProgramList)pActionEngine, _GetPageFileFilterTypes(pThis));
#endif//D_GUI_CLIPS_PROGRAM_VIEW
	
	if (INVALID_DEVICEID != (UINT16)lParam)
	{
		// Start/Resume playing if it's a Clips disc.
		if 	(	CoreAPI_IsResumeAllowed(DeviceManager_GetDeviceType((DEVICE_TYPE)lParam))
#ifdef D_GUI_CLIPS_MEDIA_RESUME_CDDA_ONLY
			&&	(DeviceManager_IsDiscCDDA() && (DEVICE_TYPE_DISC == DeviceManager_GetDeviceType((DEVICE_TYPE)lParam)))
#endif //D_GUI_CLIPS_MEDIA_RESUME_CDDA_ONLY
			)
		{
			// Open the directory containing the file on which to resume
			if (FALSE == DirBrowser_OpenDirectoryByIndex((PtrToDirBrowser)pActionEngineBrowser, ActionEngine_BMKResumeGetResumeDirIndex(pActionEngineBrowser, NULL,TRUE)))
			{
				if (FALSE == DirBrowser_OpenRootDirectory((PtrToDirBrowser)pActionEngineBrowser, DeviceManager_GetDeviceRootDir((UINT16)lParam)))
				{
					ActionEngine_Destruct(pActionEngineBrowser);
					pActionEngineBrowser = NULL;
#ifdef D_GUI_CLIPS_PROGRAM_VIEW	
					ActionEngine_Destruct(pActionEngineProgram);
					pActionEngineProgram = NULL;
#endif//#ifdef D_GUI_CLIPS_PROGRAM_VIE

⌨️ 快捷键说明

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