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

📄 o_music_mode.c

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 C
字号:
/* **************************************************************************************
*  Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: $Workfile: o_music_mode.c$
*
* Description:
* ========
* Project definition of the MSO_MUSIC_MODE
*
****************************************************************************************/
#include "Config.h"				// Global Configuration - do not remove!
#include "Include\SysDefs.h"	// Global definition - do not remove!

#ifdef D_ENABLE_MUSIC_MODE_SUPPORT
#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //DEBUG_UI_TRACE

/***************************************************************************************
* Include files
****************************************************************************************/
#include <stdio.h>
#include <string.h>
#include "Playcore\Ps\Ps.h"

//Include API Files
#include "CoreAPI\CoreAPI.h"

// Included UI MENU SYSTEM files
#include "GUI\Menu_system\ms_object.h"
#include "GUI\Menu_system\osd_rendering.h"
#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_menu.h"
#include "GUI\Menu_system\ms_component.h"
#include "GUI\Menu_system\ms_container.h"
#include "GUI\Menu_system\ms_display.h"

#include "GUI\Object_class\Text\mso_text.h"
#include "GUI\Object_class\Hscroll\mso_hscroll_text.h"
#include "GUI\Object_class\Page\mso_page.h"
#include "GUI\Object_class\Button\mso_button.h"
#include "GUI\Object_class\Vlist\mso_vlist.h"
#include "GUI\Object_class\Choice\mso_choice.h"
#include "GUI\Object_class\Hslider\mso_hslider.h"

// Included CUSTOMER files
#include "Components\Message\o_message_handler.h"
#include "Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"

#include "Menu_config\menu_config_common.h"

// Included string related files
#include "Library\String_generate.h"
#include "Library\Number.h"
#include "Strings\Strings.h"
#include "Library\Container_misc.h"


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

// Include the module header file
#include "Components\Music_mode\o_music_mode.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\Music_mode\o_music_mode_config.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Components\Custom\Music_mode\o_music_mode_custom.h"


/***************************************************************************************
* 	Utility functions
****************************************************************************************/
static BOOL _AddItemsToMusicModeKit(MSO_VLIST __NEAR* pList);
//STATIC BOOL _IsMusicModeComponentAllowed(void);

/***************************************************************************************
* 	Operation functions
****************************************************************************************/
static MS_OP _MusicModeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _MusicModeKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _MusicModekitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _MusicModeChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);

/***************************************************************************************
* 	Display functions
****************************************************************************************/
static BOOL _MusicModeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);

/***************************************************************************************
* 	Choice item action functions
****************************************************************************************/
STATIC void _MusicModeChoiceAction(MSO_OBJECT __NEAR* pThis, enMutatorType eType, UINT16 wValue);

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

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

/***************************************************************************************
* 	Utility functions
****************************************************************************************/
static BOOL _AddItemsToMusicModeKit(MSO_VLIST __NEAR* pList)
{
	if(NULL != pList)
	{
		UINT8 cIndex;
		UINT8 cNumItems;
		UINT8 cTotalItemsInToolkit = 0;
		MSO_OBJECT __NEAR* pObject;

		// Get the total number of tools in the toolkit
		while(NULL != aMusicModeKit[cTotalItemsInToolkit])
			cTotalItemsInToolkit++;

		pList->moParam.mwTotalItems = cTotalItemsInToolkit;
		
		cNumItems = MIN(pList->moParam.mcNumVisibleItems, (pList->moParam.mwTotalItems - pList->moParam.mwFirstDisplayItem));
		
		for(cIndex = 0; cIndex < cNumItems; cIndex++)
		{			
			pObject = OVLIST_CreateAndAppendItem(pList, aMusicModeKit[pList->moParam.mwFirstDisplayItem + cIndex]);
			
			MS_SendOperation(pObject, MS_OP_OPEN, 0);
			MS_SendOperation(pObject, MS_OP_INIT, 0);		
		}			
		return TRUE;
	}	
	return FALSE;
}

/***************************************************************************************
* 	Operation functions
****************************************************************************************/

/***************************************************************************************
*	Function 	: 	_MusicModeOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	MSO_MUSIC_MODE user operation function.
****************************************************************************************/
#pragma argsused
static MS_OP _MusicModeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	// Pre-processing
	switch(MsOp)
	{
	case MS_OP_INIT:
		{
			MS_ComponentInitFocus((MSO_COMPONENT __NEAR*)pThis);
		}
		break;

	case MS_OP_TICK:
		if (! CoreAPI_IsMenuAllowedMusicMode())
		{
			MS_SendOperation(pThis, MS_OP_CLOSE_PARENT, 0);
		}
		break;
		
	// These MS_OP must be returned by the component to be handled by its parents
	// Don't do MsOp = MS_OP_CLOSE_PARENT;
	//In these situation need to close Music Mode object. 
	case MS_OP_EJECT:			// Fall through !!!
	case MS_OP_SKIPF:			// Fall through !!!
	case MS_OP_SKIPB:			// Fall through !!!
	case MS_OP_LR:				// Fall through !!!
	case MS_OP_KARAOKE:		// Fall through !!!
	case MS_OP_STOP:			// Fall through !!!
	case MS_OP_PLAY_MODE:		// Fall through !!!
	case MS_OP_TITLE:		// Fall through !!!
	case MS_OP_MENU:			// Fall through !!!
	case MS_OP_PBC:
		MS_SendOperation(pThis, MS_OP_CLOSE_PARENT, 0);
		break;
		
	case MS_OP_MUSIC_MODE:
		MsOp = MS_OP_CLOSE_PARENT;
		break;

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

/***************************************************************************************
*	Function 	: 	_MusicModeKitOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Music Mode kit operation function.
****************************************************************************************/
#pragma argsused
static MS_OP _MusicModeKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	//Pre-processing
	// TODO : if any	

	MsOp = VScrollListOperation(pThis, MsOp, lParam);

	// Post-processing
	switch(MsOp)
	{		
	case MS_OP_REFRESH:
		{			
			MSO_VLIST __NEAR* pList = (MSO_VLIST __NEAR*)MS_GetObjectListPtr(pThis);				
			MS_ASSERT(NULL != pList);

			if(pList->moParam.mwTotalItems > pList->moParam.mcNumVisibleItems)
			{
				// Remove all items.
				MS_SendOperation((MSO_OBJECT __NEAR*)pList, MS_OP_EMPTY, 0);

				_AddItemsToMusicModeKit(pList);
				MS_DisplayAddObject(pThis);	

				// Set focus to the appropriate list item.
				if(MS_IsFocused(pList))
				{
					MSO_OBJECT __NEAR* pObject = MS_GetObjectListPtr(pList);
						
					if(!MS_IS_FOCUS_ON_LASTITEM(pList))	
						MS_ScreenSetFocusObject(pObject);
					else
					{						
						// Make sure we do not set focus on the Value VScroll list.					
						while(NULL != pObject->mpNext)
							pObject = pObject->mpNext;						
						MS_ScreenSetFocusObject(pObject);
					}
				}
			}			
		}
		return MS_OP_NONE;
		
	default:
		break;
	}	
	return MsOp;
}

/***************************************************************************************
*	Function 	: 	_MusicModekitVlistOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The MusicMode kit VLIST operation function.
****************************************************************************************/
#pragma argsused
static MS_OP _MusicModekitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_INIT:
		break;
		
	case MS_OP_OPEN:
		_AddItemsToMusicModeKit((MSO_VLIST __NEAR*)pThis);
		break;
		
	default:
		break;
	}	
	return VListOperation(pThis, MsOp, lParam);
}

/***************************************************************************************
*	Function 	: 	_MusicModeChoiceOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The choice operation of all the MSO_CHOICE objects in the Music Mode kit.
****************************************************************************************/
#pragma argsused
static MS_OP _MusicModeChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	MS_DESCRIPTOR_CHOICE* pDescriptorChoice = (MS_DESCRIPTOR_CHOICE*)(pThis->mpDescriptor);
	
	// Pre-processing.
	switch(MsOp)
	{		
	case MS_OP_ENTER:
		{
			UINT8 cTotalValues = pDescriptorChoice->mcTotalValues;
			
			 if(!MS_IS_CHOICE_DISABLED(pThis))
			{
				MSO_CHOICE __NEAR* pChoice = (MSO_CHOICE __NEAR*)pThis;		
				//UINT16 wValue = OCHOICE_GetValueFromIndex(pThis, pChoice->moParam.mwCurrValIndex);

				// Toggle the MUSIC MODE mode value.
				if (pChoice->moParam.mwCurrValIndex >= cTotalValues)
				{
					pChoice->moParam.mwCurrValIndex = cTotalValues-1;
				}
				else if (pChoice->moParam.mwCurrValIndex == (UINT16)(cTotalValues-1))
				{
					pChoice->moParam.mwCurrValIndex = 0;
				}
				else
				{
					pChoice->moParam.mwCurrValIndex++;
				}
				
				if(mpfMutatorNull != pDescriptorChoice->mpfMutator)
					pDescriptorChoice->mpfMutator(pThis, eMutatorSet, NULL);

				MS_DisplayAddObject(pThis);
    			}
			 else
			 	PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
		}
		return MS_OP_NONE;

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

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

/***************************************************************************************
*	Function 	: 	_MusicModeFillOSDSeg
*
*	In		:
*
*	Out		:
*
*	Desc 	:	MSO_MUSIC_MODE display function.
****************************************************************************************/
#pragma argsused
static BOOL _MusicModeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
	MS_DESCRIPTOR_MUSIC_MODE* pDescriptor = (MS_DESCRIPTOR_MUSIC_MODE*)pThis->mpDescriptor;

	OSDR_FillOsdSegBitmapFitArea(pDescriptor->mpBgBmp, pAbsArea);

   	return FALSE;
}

/***************************************************************************************
* 	Choice item action functions
****************************************************************************************/
/***************************************************************************************
*	Function	:	_MusicModeChoiceAction
*
*	In		:	pthis       =
*				eType	=	Getting or Setting the value
*				wValue	=	0 if value to get, or value to be set
*
*	Out 		:	None
*
*	Return	: 	None
*
*	Desc		: 	The Music Mode choice action function.
****************************************************************************************/ 
#pragma argsused
STATIC void _MusicModeChoiceAction(MSO_OBJECT __NEAR* pThis, enMutatorType eType, UINT16 wValue)
{
	MSO_CHOICE __NEAR* pChoice = (MSO_CHOICE __NEAR*)pThis;

	if(eMutatorGet == eType)
	{
		pChoice->moParam.mwCurrValIndex = OCHOICE_GetIndexFromValue(pThis, CoreAPI_GetHallEffect());
	}
	else
	{
		wValue = OCHOICE_GetValueFromIndex(pThis, pChoice->moParam.mwCurrValIndex);

		// Update the setting.
		CoreAPI_UpdatePlayerSetting(PS_UPDATE_MUSIC_MODE, wValue);
	}
}

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

/***************************************************************************************
*	Function	:	OMusicMode_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 Music Mode componet if opened successfully, otherwise NULL.
*
*	Desc		: 	Creates, and displays a Music Mode component.
****************************************************************************************/
extern MSO_OBJECT __NEAR* OMusicMode_OpenAtPos(MSO_CONTAINER __NEAR* pParent, UINT16 wStartX, UINT16 wStartY)
{
	if(NULL != pParent) 
	{
		MSO_OBJECT __NEAR* pMusicModeWnd = NULL;	

		pMusicModeWnd = (MSO_OBJECT __NEAR*)MS_ComponentOpen((MS_DESCRIPTOR_COMPONENT*)&oMusicModeDescriptor, pParent);

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

#endif // D_ENABLE_MUSIC_MODE_SUPPORT

⌨️ 快捷键说明

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