o_search.c

来自「ZORAN 962/966 SOURCE CODE,DVD chip」· C语言 代码 · 共 1,413 行 · 第 1/3 页

C
1,413
字号
				MS_DisplayAddObject(pThis);
			}
		}
		return MS_OP_NONE;

	default:
		break;
		
	}
	return MsOp;
}

/***************************************************************************************
*	Function 	: 	_TrackTimeOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Track/Title time object operation function.
****************************************************************************************/
#pragma argsused
STATIC MS_OP _TrackTimeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_ENTER:
		{
			MSO_TIME __NEAR* pTime = (MSO_TIME __NEAR*)pThis;
			MSO_OBJECT __NEAR* pSearch = MS_FindAncestor(pThis, &oSearchDescriptor);
			UINT32 dwSeconds = NUM_NumberToSeconds(pTime->moParam.mdwTime);

			// To track time can not support in full stop. but it maybe exist just track from play to stop.
			if (CoreAPI_IsFullStop())
				return MS_OP_NONE;

			switch(CoreAPI_GetCurrentMediaType())
			{
			case MEDIA_TYPE_VCD: 	// Fall Through !!!
			case MEDIA_TYPE_SVCD:	// Fall Through !!!
#if D_SUPPORT_SACD
			case MEDIA_TYPE_SACD:
#endif // D_SUPPORT_SACD
				{
					if(CoreAPI_GotoTime(dwSeconds, FALSE))
						return MS_OP_CLOSE_PARENT;
					
					MS_SendOperation(pThis, MS_OP_CLEAR, 0);
				}
				return MS_OP_NONE;

#ifdef DVD_AUDIO_SUPPORT
			case MEDIA_TYPE_DVD_AUDIO: // Fall Through !!!
#endif // DVD_AUDIO_SUPPORT
			case MEDIA_TYPE_DVD_VIDEO: // Fall Through !!!
#ifdef DVD_VR_SUPPORT
			case MEDIA_TYPE_DVDVR:
#endif // DVD_VR_SUPPORT
				{
					if(!_IsTitleTimeValid(dwSeconds))
					{
						MS_SendOperation(pThis, MS_OP_CLEAR, 0);
						return MS_OP_NONE;
					}
					else if(CoreAPI_GotoTime(dwSeconds, FALSE))
						return MS_OP_CLOSE_PARENT;
					else
					{
						PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_BY_DISC);
						return MS_OP_CLOSE_PARENT;
					}		
				}

			case MEDIA_TYPE_CLIPS:
				{
					if(INVALID_TIME != pTime->moParam.mdwTime)
					{
						if(dwSeconds > CoreAPI_GetTotalTime())
						{
							MS_SendOperation(pThis, MS_OP_CLEAR, 0);
							return MS_OP_NONE;
						}
						else
						{
							MS_SendOperation((MSO_OBJECT __NEAR*)MS_GetParentPtr(pSearch), MS_OP_JUMP_TO_TIMEINDEX, dwSeconds);
							MS_SendOperation((MSO_OBJECT __NEAR*)pSearch, MS_OP_CLOSE_PARENT, 0);
							return MS_OP_JUMP_TO_TIMEINDEX;
						}
					}
					return MS_OP_NONE;
				}

			default:
				return MS_OP_NONE;
			}	
 		} // End of case MS_OP_ENTER
		
	default:
		break;
	}
	return _BasicTimeEditOperation(pThis, MsOp, lParam);
}

/***************************************************************************************
*	Function 	: 	_DiscTimeOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Disc time object operation function.
****************************************************************************************/
#pragma argsused
STATIC MS_OP _DiscTimeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_ENTER:
		{
			MSO_TIME __NEAR* pTime = (MSO_TIME __NEAR*)pThis;
			MSO_OBJECT __NEAR* pSearch = MS_FindAncestor(pThis, &oSearchDescriptor);
			UINT32 dwSeconds = NUM_NumberToSeconds(pTime->moParam.mdwTime);

			switch(CoreAPI_GetCurrentMediaType())
			{
			case MEDIA_TYPE_VCD: 	// Fall Through !!!
			case MEDIA_TYPE_SVCD: 	// Fall Through !!!
#if D_SUPPORT_SACD
			case MEDIA_TYPE_SACD:
#endif // D_SUPPORT_SACD
				{
					if(CoreAPI_GotoTime(dwSeconds, TRUE))
						return MS_OP_CLOSE_PARENT;

					MS_SendOperation(pThis, MS_OP_CLEAR, 0);
				}
				return MS_OP_NONE;
					
			default: // Clips
				{
					// Clips disc time search is supported only for CDDA at the moment.
					if((TRUE == DeviceManager_IsDiscCDDA()) && (INVALID_TIME != pTime->moParam.mdwTime))
					{
						if(dwSeconds > CoreAPI_GetCDDADiscTotalTime())
						{
							MS_SendOperation(pThis, MS_OP_CLEAR, 0);
							return MS_OP_NONE;
						}
						else
						{
							MS_SendOperation((MSO_OBJECT __NEAR*)MS_GetParentPtr(pSearch), MS_OP_JUMP_TO_DISC_TIMEINDEX, dwSeconds);
							MS_SendOperation((MSO_OBJECT __NEAR*)pSearch, MS_OP_CLOSE_PARENT, 0);
						}
					}
					return MS_OP_NONE;
				}
			}	
 		} // End of case MS_OP_ENTER

	default:
		break;
	}
	return _BasicTimeEditOperation(pThis, MsOp, lParam);
}

#ifdef DVD_AUDIO_PAGE_SEARCH
/***************************************************************************************
*	Function 	: 	_PageOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Page operation function.
****************************************************************************************/
#pragma argsused
STATIC MS_OP _PageOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_FOCUS_CHANGE:
		MS_DisplayAddObject(pThis);
		break;
		
	case MS_OP_ENTER:
		{			
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			UINT16 wTitle =  pSearch->moParam.mwTrack;
			UINT16 wChapter =  pSearch->moParam.mwChapter;
			UINT16 wPage =  pSearch->moParam.mwPage;

			if(INVALID_TRACK == wTitle)
			{
				wTitle = CoreAPI_GetCurrentTitleGroupNum();
			}

			if(INVALID_TRACK == wChapter)
			{
				wTitle = CoreAPI_GetCurrentChapterTrackNum();
			}

			if(INVALID_TRACK == wPage)
			{
				wTitle = CoreAPI_GetDVDAudioCurrPageNum();
			}

			if(!_IsPageValid(wPage))
			{			
				pSearch->moParam.mwPage = INVALID_TRACK;
				MS_DisplayAddObject(pThis);
			}
			else
			{	
				CoreAPI_GotoPage((UINT16)pSearch->moParam.mwPage);
				return MS_OP_CLOSE_PARENT;
			}
		}
		return MS_OP_NONE;
		
	case MS_OP_0: // Fall Through
	case MS_OP_1: // Fall Through
	case MS_OP_2: // Fall Through
	case MS_OP_3: // Fall Through
	case MS_OP_4: // Fall Through
	case MS_OP_5: // Fall Through
	case MS_OP_6: // Fall Through
	case MS_OP_7: // Fall Through
	case MS_OP_8: // Fall Through
	case MS_OP_9:
		{
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			
			UINT8 cValue = MsOp - MS_OP_0;

			if(INVALID_TRACK == pSearch->moParam.mwPage)
			{
				pSearch->moParam.mwPage= cValue;
				MS_DisplayAddObject(pThis);
			}
			else
			{
				pSearch->moParam.mwPage = (pSearch->moParam.mwPage * 10) + cValue;
				pSearch->moParam.mwPage = (pSearch->moParam.mwPage) % 1000;
				MS_DisplayAddObject(pThis);
			}
		}
		return MS_OP_NONE;
		
	case MS_OP_CLEAR:
		{
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			if(INVALID_TRACK != pSearch->moParam.mwPage)
			{
				pSearch->moParam.mwPage = INVALID_TRACK;
				MS_DisplayAddObject(pThis);
			}
		}
		return MS_OP_NONE;
	}
	return MsOp;
}
#endif//DVD_AUDIO_PAGE_SEARCH

/***************************************************************************************
* 	Display functions
****************************************************************************************/

/***************************************************************************************
*	Function 	: 	_SearchFillOSDSeg
*
*	In		:
*
*	Out		:
*
*	Desc 	:	MSO_SEARCH display function.
****************************************************************************************/
STATIC BOOL _SearchFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
	MS_DESCRIPTOR_SEARCH* pDescriptor = (MS_DESCRIPTOR_SEARCH*)pThis->mpDescriptor;	

	OSDR_FillOsdSegBitmapFitArea(pDescriptor->mpBgBmp, pAbsArea);	

	return FALSE;
}

/***************************************************************************************
*	Function 	: 	_TrackOrTitleFillOSDSeg
*
*	In		:
*
*	Out		:
*
*	Desc 	:	Display function of the Title/Track/Chapter objects.
****************************************************************************************/
STATIC BOOL _TrackOrTitleFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
	FORMATED_UNICODE_STRING oFormUniStr;
	MS_DESCRIPTOR_TRACK* pDescriptor = (MS_DESCRIPTOR_TRACK*)pThis->mpDescriptor;
	MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
	UINT16 wColor = (MS_IsFocusable(pThis)) ? pDescriptor->mwTextColor : CIDX_4;
	UINT16 szBuffer[4];
	UINT16 wValue = INVALID_TRACK;
	OSD_MESSAGES tOsdLabel;

	oFormUniStr.mtFontIndex = FONT_SEARCH_TRACK;
	
	if(S_TRACK == pDescriptor->mOsdLabel)
		wValue = pSearch->moParam.mwTrack;
	#ifdef DVD_AUDIO_PAGE_SEARCH
	else if(S_PAGE == pDescriptor->mOsdLabel)
		wValue = pSearch->moParam.mwPage;
	#endif // DVD_AUDIO_PAGE_SEARCH	
	else
		wValue = pSearch->moParam.mwChapter;

	if((S_TRACK == pDescriptor->mOsdLabel) && 
      ((MEDIA_TYPE_DVD_VIDEO == CoreAPI_GetCurrentMediaType()) 
#ifdef DVD_VR_SUPPORT		 
		 ||(MEDIA_TYPE_DVDVR == CoreAPI_GetCurrentMediaType()) 
#endif
#ifdef D_DIVX6_SUPPORT
		 ||CoreAPI_IsCurrItemDivX6()
#endif
		))
		tOsdLabel = S_TITLE;
#ifdef DVD_AUDIO_SUPPORT				
		else if((S_TRACK == pDescriptor->mOsdLabel) &&  (MEDIA_TYPE_DVD_AUDIO == CoreAPI_GetCurrentMediaType()))
		tOsdLabel = S_GROUP;
		else if((S_CHAPTER== pDescriptor->mOsdLabel) && (MEDIA_TYPE_DVD_AUDIO == CoreAPI_GetCurrentMediaType()))
		tOsdLabel = S_TRACK;
#ifdef DVD_AUDIO_PAGE_SEARCH			
		else if((S_PAGE== pDescriptor->mOsdLabel) && (MEDIA_TYPE_DVD_AUDIO == CoreAPI_GetCurrentMediaType()))
		tOsdLabel = S_PAGE;	
#endif // DVD_AUDIO_PAGE_SEARCH		
#endif // DVD_AUDIO_SUPPORT

	else
		tOsdLabel = pDescriptor->mOsdLabel;


	OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, tOsdLabel);

	if(INVALID_TRACK == wValue)
		STR_GenerateRepeatChars('-', 3, szBuffer, 0, sizeof(szBuffer));
	else
		STR_GenerateNumericValue((INT32)wValue, szBuffer, 0, sizeof(szBuffer));

	// The Label
	OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
							pAbsArea,
							(OPTION_XPADDING << 1),
							(pAbsArea->mwH >> 1),
							ALIGN_H_LEFT,
							ALIGN_V_CENTER,
							wColor);

	// The Value.
	OSDR_GetFormUniStr_Ram((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)szBuffer);

	OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
							pAbsArea,
							(pAbsArea->mwW  - (OPTION_XPADDING << 1)),
							(pAbsArea->mwH >> 1),
							ALIGN_H_RIGHT,
							ALIGN_V_CENTER,
							wColor);
	
	if(MS_IsFocused(pThis))
		OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, pAbsArea);	
	
	return FALSE;
}

/***************************************************************************************
*	Function 	: 	_TimeFillOSDSeg
*
*	In		:
*
*	Out		:
*
*	Desc 	:	Display function of the Track/Title Time object.
****************************************************************************************/
STATIC BOOL _TimeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
	FORMATED_UNICODE_STRING oFormUniStr;
	MSO_TIME __NEAR* pTime = (MSO_TIME __NEAR*)pThis;
	MS_DESCRIPTOR_TIME* pTimeDescriptor = (MS_DESCRIPTOR_TIME*)pThis->mpDescriptor;
	UINT16 wColor = (MS_IsFocusable(pThis)) ? pTimeDescriptor->mwTextColor : CIDX_4;

	oFormUniStr.mtFontIndex = FONT_SEARCH_TIME;
	// The Label
	OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pTimeDescriptor->mOsdLabel);

	OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
							pAbsArea,
							(OPTION_XPADDING << 1),
							(pAbsArea->mwH >> 1),
							ALIGN_H_LEFT,
							ALIGN_V_CENTER,
							wColor);

	if(INVALID_TIME == pTime->moParam.mdwTime)
		STR_GenerateOSDMESSAGEString(S_EMPTY_TIME, oFormUniStr.mszUniStr, 0, UNISTR_LENGTH_MAX + 1);
	else
		STR_GenerateTime(pTime->moParam.mdwTime, pTime->moParam.mwNumDigits, oFormUniStr.mszUniStr, 0, UNISTR_LENGTH_MAX + 1);

	// The Value.
	OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr);

	OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
							pAbsArea,
							(pAbsArea->mwW  - (OPTION_XPADDING << 1)),
							(pAbsArea->mwH >> 1),
							ALIGN_H_RIGHT,
							ALIGN_V_CENTER,
							wColor);

	if(MS_IsFocused(pThis))
		OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, pAbsArea);
	
	return FALSE;
}

/***************************************************************************************
* 	Public functions
****************************************************************************************/

/***************************************************************************************
*	Function	:	OSEARCH_OpenAtPos
*
*	In		:	pParent		=	Pointer to the parent container.
*
*				wStartX		=	X position of the component. The default position (specified in the 
*								descriptor) is used in case this parameter is set to DEFAULT_POSITION.
*
*				wStartY		=	Y position of the component.The default position (specified in the 
*								descriptor) is used in case this parameter is set to DEFAULT_POSITION.
*
*	Out		:	None.
*
*	Return	:	Pointer to the Search component if opened successfully, otherwise NULL.
*
*	Desc		: 	Creates, and displays a Search component at a specified position.
****************************************************************************************/
MSO_OBJECT __NEAR* OSEARCH_OpenAtPos(MSO_CONTAINER __NEAR* pParent, UINT16 wStartX, UINT16 wStartY)
{
	if(NULL != pParent)
	{
		MSO_OBJECT __NEAR* pSearchWnd = NULL;	

		pSearchWnd = (MSO_OBJECT __NEAR*)MS_ComponentOpen((MS_DESCRIPTOR_COMPONENT*)&oSearchDescriptor, pParent);

		if(NULL != pSearchWnd)
		{
			if((DEFAULT_POSITION != wStartX) || (DEFAULT_POSITION != wStartY))
			{
				wStartX = (DEFAULT_POSITION == wStartX) ? pSearchWnd->mpDescriptor->moArea.msX : wStartX;
				wStartY = (DEFAULT_POSITION == wStartY) ? pSearchWnd->mpDescriptor->moArea.msY : wStartY;
				MS_ObjectMove(pSearchWnd, wStartX, wStartY);
			}
			
			MS_DisplayAddObject(pSearchWnd);
		}

		return pSearchWnd;
	}
	return NULL;
}

#endif //D_GUI_COMPONENT_SEARCH

⌨️ 快捷键说明

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