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

📄 menu_manager.c

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 C
字号:
/****************************************************************************************************
*  Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: menu_manager.c
*
* Description:
* =========
*
****************************************************************************************************/

#include "Config.h" 			// Global Configuration - do not remove!

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

#include "include\sysdefs.h"
// Included CORE API files
#include "CoreAPI\CoreAPI.h"

// Included UI MENU SYSTEM files
#include "GUI\Menu_system\ms_menu.h"
#include "GUI\Menu_system\ms_screen.h"

// Included CUSTOMER files
#include "Runtime\run_time_menu.h"
#include "Clips\clips_menu.h"
#include "Setup\setup_menu.h"
#include "Menu\menu_operation_def.h"

#include "Screen\menu_manager.h"

#include "CoreAPI\CoreAPI.h"
#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef	dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif

/****************************************************************************************************
*	DEFINITION: Private named constants 
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private macros
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private typedefs
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Public (global) variables
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private (static) variables
****************************************************************************************************/
/****************************************************************************************************
*	DECLARATION: Private (static) functions
****************************************************************************************************/
static MENU_ID _GetMenuIdDefault(void);

/****************************************************************************************************
*	DEFINITION: Public functions
****************************************************************************************************/
/****************************************************************************************************
* Function	: MENU_MANAGER_Operation
*
* Input		: pThis
*	 		  MsOp
			  lParam
*
* Output		: None
*
* Return		: MS_OP
*
* Description	: Handles the menu switching, launches the screen saver.
*  	
****************************************************************************************************/
#pragma argsused
MS_OP MENU_MANAGER_Operation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	MENU_ID MenuIdActive;
	MENU_ID MenuIdRequest;
	MENU_ID MenuIdDefault;
	STATIC PLAY_STATE __NEAR sPlaystateBeforeOpenSetup;
	// Ignore menu system operations for menu management
	if (MS_IS_SYSTEM_OP(MsOp))
		return MsOp;
		
	// Screen frozen during menu switvhing
	if (MS_IsContentFrozen(pThis))
		return MsOp;
		
	MenuIdActive = MS_MenuGetActiveMenuId();
	MenuIdRequest = NULL;
	MenuIdDefault = _GetMenuIdDefault();

///////////////////////////////////////
// 1st step
// Get the ID of requested menu
///////////////////////////////////////
	switch(MsOp)
	{		
	case MS_OP_OPEN_MENU: 
		MenuIdRequest = (MENU_ID)lParam;
		MsOp = MS_OP_NONE;
		break;
		
	case MS_OP_CLOSE_MENU: 
		MenuIdRequest = MenuIdDefault;
		MsOp = MS_OP_NONE;
		break;

	case MS_OP_SETUP: 
		if (MENU_ID_SETUP == MenuIdActive)
		{
			MenuIdRequest =  MenuIdDefault;
		}
		else
			MenuIdRequest = MENU_ID_SETUP;
		MsOp = MS_OP_NONE;
		break;
		
	case MS_OP_EJECT: 
		// TODO: This is for mono device, for multidevice, should keep the clips menu
		MS_MenuClose((MS_DESCRIPTOR_MENU *)MENU_ID_CLIPS);
		MenuIdRequest = MENU_ID_RUNTIME;
		break;
		
#ifdef D_UI_PLAY_CLOSES_SETUP		
	case MS_OP_PLAY: 
	case MS_OP_PLAY_PAUSE: 
		if ((MENU_ID_CLIPS != MenuIdActive) && (MENU_ID_RUNTIME != MenuIdActive))
		{
			if (NULL != MS_MenuGetFromMenuId(MENU_ID_CLIPS))
				MenuIdRequest = MENU_ID_CLIPS;
			else		
				MenuIdRequest = MENU_ID_RUNTIME;
		}
		break;
#endif
	}


///////////////////////////////////////
// 2nd step
// If no menu switching to perform, then exit
///////////////////////////////////////
	if ((NULL == MenuIdRequest) || (MenuIdRequest == MenuIdActive))
			return MsOp;
		
	if(FALSE == CoreAPI_WaitForUICoreActionDone())
			return MsOp;
                        
	dbg_printf(("\nMenuIdRequest = %x\n", MenuIdRequest));	
	dbg_printf(("\MenuIdActive = %x\n", MenuIdActive));	

	
///////////////////////////////////////
// 3nd step
// Verify that the menu can open
///////////////////////////////////////
	if (MENU_ID_SETUP == MenuIdRequest)
	{	
		// Check whether the Setup menu can be displayed.
		// NOTE: This step has to be done before the clips menu looses focus, because 
		// if this is done after the clips menu looses focus and if we are not allowed to 
		// display the Setup menu, then we cannot restore the previous state.
		if (!CoreAPI_IsMenuAllowedSetup())
		{
			PROHIBIT(MSG_PROHIBIT_MENU_CANNOT_OPEN);
			return MsOp;
		}
		
		sPlaystateBeforeOpenSetup = CoreAPI_GetPlayState();
		// TODO: Remove CoreAPI_IsSimultaneousMode() After ListNav modificaiton
		// For simultaneous mode in last jpeg for a while , play state is PST_STOP
		if ((PST_STOP != CoreAPI_GetPlayState()  || (CoreAPI_IsSimultaneousMode()))
			&& ((MENU_ID_CLIPS == MenuIdActive) || (MENU_ID_RUNTIME == MenuIdActive)))
		{
			// The CLIPS menu is not anymore focus, need to addess it with its address.
			if (MS_OP_NONE != MS_SEND_OP_OBJECT(MS_MenuGetFromMenuId(MenuIdActive), MS_OP_MENU_SWITCH_RESUME_STOP, 0))
			{
				PROHIBIT(MSG_PROHIBIT_MENU_CANNOT_OPEN);
				return MsOp;
			}
		}		
	}


///////////////////////////////////////
// 4th
// Freeze or close  the active menu when required
///////////////////////////////////////
	if (MENU_ID_SETUP == MenuIdActive)
	{
		//if (MENU_ID_FIRMWARE_UPGRADE != MenuIdRequest)
        //simon.huang 20050616 the firmware upgrade menu was removed
#ifdef D_GUI_SETUP_MENU_FREEZE
			MS_MenuFreeze();
#else
			MS_MenuClose((MS_DESCRIPTOR_MENU*)MenuIdActive);
#endif //D_GUI_SETUP_MENU_FREEZE
	}
	else if (	(MENU_ID_RUNTIME == MenuIdActive) 
			|| (MENU_ID_CLIPS == MenuIdActive))
	{
		if (MENU_ID_SETUP == MenuIdRequest)
			MS_MenuFreeze();	
	}


///////////////////////////////////////
// 5th step
// Open the requested menu
///////////////////////////////////////
	// Reset the runtime menu in case we are about to resume to it on eject request
	// We want to close all pop-up components and avoid transition where they could be displayed
	// before being removed. So we close the runtime, this will defrost and then remove it.
	if ((MENU_ID_RUNTIME == MenuIdRequest) && (MS_OP_EJECT == MsOp))
	{
		MS_MenuClose((MS_DESCRIPTOR_MENU*)MenuIdRequest);
	}

	MS_SEND_OP(MS_OP_OPEN, (UINT32)MenuIdRequest);

	if (MENU_ID_SETUP == MenuIdActive)
	{
		// TODO: Remove CoreAPI_IsSimultaneousMode() After ListNav modificaiton
		// For simultaneous mode in last jpeg for a while , play state is PST_STOP
		if ((PST_STOP != sPlaystateBeforeOpenSetup || (CoreAPI_IsSimultaneousMode())) 
			&& (MenuIdDefault== MenuIdRequest)&&(MS_OP_EJECT != MsOp) )
		{
			MsOp = MS_SEND_OP_OBJECT(MS_MenuGetFromMenuId(MenuIdRequest), MS_OP_MENU_SWITCH_RESUME_PLAY, 0);
		}
		
#ifdef D_UI_PLAY_CLOSES_SETUP
		else if ((MS_OP_PLAY == MsOp) || (MS_OP_PLAY_PAUSE == MsOp))
			MsOp = MS_SEND_OP_OBJECT(MS_MenuGetFromMenuId(MenuIdRequest), MS_OP_PLAY, 0);
#endif
	}	
	return MsOp;
}


/****************************************************************************************************
*	DEFINITION: Private functions
****************************************************************************************************/


/****************************************************************************************************
* Function	: _GetMenuIdDefault
*
* Input		: None
*
* Output		: None
*
* Return		: MenuID of the default menu.
*
* Description	: Handles the menu switching, launches the screen saver.
*  	
****************************************************************************************************/
static MENU_ID _GetMenuIdDefault(void)
{
	MENU_ID MenuIdDefault;
	MenuIdDefault = (MENU_ID )MS_MenuGetNext();
	if (NULL == MenuIdDefault)
		MenuIdDefault = MENU_ID_RUNTIME;
		
	return MenuIdDefault;
}

⌨️ 快捷键说明

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