?? o_bookmark.c
字號:
/* **************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: o_bookmark.c $
*
* Description:
* ============
* Project definition of the MSO_BOOKMARK
*
****************************************************************************************/
#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"
/***************************************************************************************
* Include files
****************************************************************************************/
#include <stdio.h>
#include <string.h>
#include "Playcore\coremain\coregdef.h"
#include "kernel\eventdef.h"
#include "kernel\ker_api.h"
#include "CoreAPI\CoreAPI.h"
#include "GUI\Menu_system\ms_object.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_display.h"
#include "GUI\Menu_system\ms_component.h"
#include "GUI\Object_class\Text\mso_text.h"
#include "GUI\Object_class\Vlist\mso_vlist.h"
#include "Components\Bookmark\o_bookmark.h"
#include "GUI\Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "Library\String_generate.h"
#include "Menu_config\menu_config_common.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Components\Bookmark\o_bookmark_config.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\custom\Bookmark\o_bookmark_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
/***************************************************************************************
* Utility functions
****************************************************************************************/
STATIC BOOL _AddItemsToBookmarkKit(MSO_VLIST __NEAR* pList);
STATIC BOOL _GetBookmarkTime(UINT8 uBookmark, UINT16* pwTime);
STATIC void _BookmarkGetValue(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam);
/***************************************************************************************
* Operation functions
****************************************************************************************/
STATIC MS_OP _BookmarkComponentOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _BookmarkOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _BookmarkKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _BookmarkkitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
/***************************************************************************************
* Display functions
****************************************************************************************/
STATIC BOOL _BookmarkComponentFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
/***************************************************************************************
* Include customization file.
****************************************************************************************/
// Include custom code file: customer specific code, over-writing common one.
#include "Components\Custom\Bookmark\o_bookmark_custom.c"
// Include configuration file: constants.
#include "Components\Bookmark\o_bookmark_config.c"
/***************************************************************************************
* Utility functions
****************************************************************************************/
/***************************************************************************************
* Function : _AddItemsToBookmarkKit
*
* In : pList = Pointer to the Searchkit MSO_VLIST.
*
* Out :
*
* Desc :
****************************************************************************************/
STATIC BOOL _AddItemsToBookmarkKit(MSO_VLIST __NEAR* pList)
{
if(NULL != pList)
{
UINT8 cIndex;
UINT8 cNumItems;
UINT8 cTotalItemsInToolkit = MAX_BOOKMARKS;
MSO_BOOKMARK_VALUE __NEAR* pBookmark;
// Five bookmarks supported only for DVD.
#ifdef SUPPORT_FIVE_DVD_BOOKMARKS
if(IS_DISC_TYPE_DVD)
cTotalItemsInToolkit = MAX_BOOKMARKS_FOR_DVD;
#endif // SUPPORT_FIVE_DVD_BOOKMARKS
pList->moParam.mwTotalItems = cTotalItemsInToolkit;
cNumItems = MIN(pList->moParam.mcNumVisibleItems, (pList->moParam.mwTotalItems - pList->moParam.mwFirstDisplayItem));
for(cIndex = 0; cIndex < cNumItems; cIndex++)
{
pBookmark = (MSO_BOOKMARK_VALUE __NEAR*)OVLIST_CreateAndAppendItem(pList, &oBookmarkValueDescriptor);
MS_SendOperation((MSO_OBJECT __NEAR*)pBookmark, MS_OP_OPEN, 0);
MS_SendOperation((MSO_OBJECT __NEAR*)pBookmark, MS_OP_INIT, (pList->moParam.mwFirstDisplayItem + cIndex + 1));
}
return TRUE;
}
return FALSE;
}
/***************************************************************************************
* Function : _GetBookmarkTime
*
* In :
*
* Out :
*
* Desc :
****************************************************************************************/
STATIC BOOL _GetBookmarkTime(UINT8 uBookmark, UINT16* pwTime)
{
BOOL retval = FALSE;
if(IS_BOOKMARK_VALID(uBookmark))
{
switch(CoreAPI_GetCurrentMediaType())
{
case MEDIA_TYPE_DVD_VIDEO:
case MEDIA_TYPE_DVD_AUDIO:
#ifdef DVD_VR_SUPPORT
case MEDIA_TYPE_DVDVR:
#endif // DVD_VR_SUPPORT
case MEDIA_TYPE_SVCD:
case MEDIA_TYPE_VCD:
#if D_SUPPORT_SACD
case MEDIA_TYPE_SACD:
#endif // D_SUPPORT_SACD
case MEDIA_TYPE_CLIPS:
*pwTime = BOOKMARK_TIME(uBookmark);
retval = TRUE;
break;
}
}
return retval;
}
/***************************************************************************************
* Function : _BookmarkGetValue
*
* In :
*
* Out :
*
* Desc :
****************************************************************************************/
STATIC void _BookmarkGetValue(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam)
{
UINT16 wSeconds;
UINT8 cIndex = NUM_SPACES_BETWEEN_LABEL_AND_VALUE;
MS_ASSERT(wParam <= MAX_BOOKMARKS); // Number of bookmarks supported
// Get the "bookmark" label (language dependent).
OSDR_GetFormUniStr_OsdMessage(pFormUniStr, S_BOOKMARK);
// Tag a space on the end, followed by the bookmark number.
pFormUniStr->mszUniStr[pFormUniStr->mcStrLength++] = UNICODE_SPACE;
pFormUniStr->mszUniStr[pFormUniStr->mcStrLength++] = ((UINT8)wParam + 0x30);
// Eight spaces
while(0 != cIndex--)
pFormUniStr->mszUniStr[pFormUniStr->mcStrLength++] = UNICODE_SPACE;
pFormUniStr->mszUniStr[pFormUniStr->mcStrLength] = 0x0; // Termination.
// Is the bookmark in the core valid?
if(TRUE == _GetBookmarkTime((UINT8)wParam, &wSeconds))
STR_GeneratePlaybackTime(wSeconds, &(pFormUniStr->mszUniStr[pFormUniStr->mcStrLength]),
0, (UNISTR_LENGTH_MAX + 1- pFormUniStr->mcStrLength));
else
STR_GenerateOSDMESSAGEString(S_EMPTY_TIME, &(pFormUniStr->mszUniStr[pFormUniStr->mcStrLength]),
0, (UNISTR_LENGTH_MAX + 1- pFormUniStr->mcStrLength));
// Reformat the unicode string.
OSDR_FormatUniString(pFormUniStr);
}
/***************************************************************************************
* Operation functions
****************************************************************************************/
/***************************************************************************************
* Function : _BookmarkOperation
*
* In :
*
* Out :
*
* Desc : Operation function.
****************************************************************************************/
STATIC MS_OP _BookmarkOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
MsOp = OTEXT_Operation(pThis, MsOp, lParam);
// Post-processing
switch(MsOp)
{
case MS_OP_ON_DEFROST:
case MS_OP_INIT:
{
MSO_BOOKMARK_VALUE __NEAR* pBookmark = (MSO_BOOKMARK_VALUE __NEAR*)pThis;
if (MS_OP_INIT == MsOp)
pBookmark->moParam.mwBookmarkID = (UINT16)lParam;
MS_SendOperation((MSO_OBJECT __NEAR*)pBookmark, MS_OP_BUILD_TEXT_STRING, (UINT32)pBookmark->moParam.mwBookmarkID);
}
return MS_OP_NONE;
case MS_OP_ENTER:
{
MSO_BOOKMARK_VALUE __NEAR* pBookmark = (MSO_BOOKMARK_VALUE __NEAR*)pThis;
if(IS_BOOKMARK_VALID((UINT8)pBookmark->moParam.mwBookmarkID))
{
//Prohibiting is only a temporary solution and need improving.
if(PST_SCAN == CoreAPI_GetPlayState() || PST_SLOW == CoreAPI_GetPlayState())
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -