📄 o_device_switch.c
字号:
/***************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: clips_runtime.c$
*
* Description:
* ========
*
*
****************************************************************************************/
#include "Config.h" // Global Configuration - do not remove!
#ifdef D_GUI_COMPONENT_DEVICE_SWITCH
#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //_DEBUG
#include "Include\SysDefs.h"
/***************************************************************************************
* Include files
****************************************************************************************/
#include <stdio.h>
#include <string.h>
#include "CoreAPI\DeviceManager.h"
#include "CoreAPI\CoreAPI.h"
#include "Playcore\Coremain\coregdef.h"
#include "Include\math-macro.h"
// Included UI MENU SYSTEM files
#include "GUI\Menu_system\ms_menu.h"
#include "GUI\Menu_system\osd_rendering.h"
#include "GUI\Menu_system\ms_display.h"
#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_component.h"
#include "GUI\Menu_system\ms_container.h"
#include "GUI\Menu_system\ms_object.h"
#include "GUI\Object_class\Vlist\mso_vlist.h"
#include "Menu\menu_operation_def.h"
#include "Menu_config\menu_config_common.h"
#include "GUI\Object_class\Button\mso_button.h"
//#include "Font\fonts.h"
//#include "Font\Unicode.h"
#include "GUI\Resource\Bitmap\bitmap.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Components\Device_switch\o_device_switch_config.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\Custom\Device_switch\o_device_switch_custom.h"
#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif
/***************************************************************************************
* Private static functions declaration
****************************************************************************************/
/***************************************************************************************
* Utility functions
****************************************************************************************/
static UINT16 _GetDeviceIndex(MSO_OBJECT __NEAR* pThis, UINT16 wBtnNum);
static UINT16 _ComputeVScrollListHigh(void);
/***************************************************************************************
* Operation functions
****************************************************************************************/
static MS_OP _VListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _VScrollListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _ComponentOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _ButtonOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
BOOL _ButtonFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
/***************************************************************************************
* Display functions
****************************************************************************************/
/***************************************************************************************
* Include customization file.
****************************************************************************************/
// Include custom code file: customer specific code, over-writing common one.
#include "Components\Custom\Device_switch\o_device_switch_custom.c"
// Include configuration file: constants.
#include "Components\Device_switch\o_device_switch_config.c"
/***************************************************************************************
* Function : _ComponentOperation
*
* 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 :
****************************************************************************************/
MSO_OBJECT __NEAR* ODEVICESWITCH_OpenAtPos(MSO_CONTAINER __NEAR* pParent, UINT16 wStartX, UINT16 wStartY)
{
MSO_OBJECT __NEAR* pObject = NULL;
if(NULL != pParent)
{
if (CoreAPI_IsMenuAllowedDeviceSwitch())
{
pObject = (MSO_OBJECT __NEAR*)MS_ComponentOpen((MS_DESCRIPTOR_COMPONENT*)&oDescriptorDeviceSwitch, pParent);
if (NULL != pObject)
{
if ((DEFAULT_POSITION != wStartX) || (DEFAULT_POSITION != wStartY))
{
wStartX = (DEFAULT_POSITION == wStartX) ? pObject->mpDescriptor->moArea.msX : wStartX;
wStartY = (DEFAULT_POSITION == wStartY) ? pObject->mpDescriptor->moArea.msY : wStartY;
MS_ObjectMove(pObject, wStartX, wStartY);
}
MS_DisplayAddObject(pObject);
}
}
else
{
PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
}
}
return pObject;
}
/***************************************************************************************
* Operation functions
****************************************************************************************/
/***************************************************************************************
* Function : _ComponentOperation
*
* 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 :
****************************************************************************************/
static MS_OP _ComponentOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
// Close the component whenever it is not allowed to be open
// If this happens during opening, also close, but display prohibit message
if (!CoreAPI_IsMenuAllowedDeviceSwitch())
{
MsOp = MS_OP_CLOSE_PARENT;
}
switch (MsOp)
{
case MS_OP_OPEN:
{
MSO_OBJECT __NEAR* pObject = MS_CreateObject(pThis, &oDescriptorDeviceScrollList);
if(NULL != pObject)
MS_ObjectResize(pObject, AREA_VSCROLL_LIST_W, _ComputeVScrollListHigh());
else
BREAK_POINT();
}
break;
case MS_OP_INIT:
MS_ComponentInitFocus((MSO_COMPONENT __NEAR*)pThis);
break;
case MS_OP_CORE_REFRESH_DEVICE_LIST:
lParam = REFRESH_LIST_DISPLAY_FIRST_ITEM;
MsOp = MS_OP_REFRESH;
MS_ObjectResize(MS_FindDescendant(pThis,&oDescriptorDeviceScrollList), AREA_VSCROLL_LIST_W, _ComputeVScrollListHigh());
MS_ObjectResize(MS_FindDescendant(pThis,&oDescriptorDeviceList),
AREA_VSCROLL_LIST_W-(VSCROLL_LIST_XPADDING<<1), _ComputeVScrollListHigh()-(VSCROLL_LIST_XPADDING<<1));
MS_DisplayAddObject(pThis);
break;
default:
break;
}
MsOp = MS_ComponentBasicOperation(pThis, MsOp, lParam);
switch(MsOp)
{
// Close the component when switch menu
// TODO: update this code or the SRS to match
case MS_OP_CLOSE:
case MS_OP_MENU_SELECT_DEVICE:
case MS_OP_PREPARE_FOR_FREEZE:
case MS_OP_DEVICE_SWITCH:
MS_SEND_OP_OBJECT(pThis, MS_OP_CLOSE_PARENT, 0);
return MS_OP_NONE;
case MS_OP_EJECT:
MS_SEND_OP_OBJECT(pThis, MS_OP_CLOSE_PARENT, 0);
break;
default:
break;
}
// Block user class MsOp others than listed below
switch(MsOp)
{
case MS_OP_POWER:
case MS_OP_EJECT:
case MS_OP_DEVICE_SWITCH:
case MS_OP_UP:
case MS_OP_DOWN:
case MS_OP_LEFT:
case MS_OP_RIGHT:
case MS_OP_ENTER:
break;
default:
if (MS_IS_USER_OP(MsOp))
{
PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
return MS_OP_NONE;
}
break;
}
return MsOp;
}
/***************************************************************************************
* 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.
****************************************************************************************/
// TODO: Use function to get it when device manager moved out from ScreenProcessing.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -