?? clips_menu.c
字號:
/***************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: clips_menu.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 files
****************************************************************************************/
#include <stdio.h>
#include "include\sysdefs.h"
#include "Kernel\eventdef.h"
#include "include\math-macro.h"
#include "Playcore\ScPad\SCMGR.h"
#include "Playcore\Playmode\Playmode.h"
#include "services\include\_heap.h"
#include "CoreAPI\CoreAPI.h"
#include "CoreAPI\DeviceManager.h"
#include "ClipsAPPEngine\ActionEngine\ActionEngine.h"
#include "ClipsAPPEngine\DirBrowser\DirBrowser.h"
#include "ClipsAPPEngine\ProgramList\ProgramList.h"
// Included UI LOW LEVEL files
#include "OSDLayou.h"
// Included UI MENU SYSTEM files
#include "GUI\menu_system\ms_display.h"
#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_menu.h"
#include "GUI\Menu_system\ms_container.h"
#include "GUI\Menu_system\ms_send_op.h"
#include "GUI\menu_system\ms_component.h"
#include "GUI\menu_system\osd_rendering.h"
#include "Font\fonts.h"
#include "Menu_config\menu_config_common.h"
// Included CUSTOMER files
#include "Menu\menu_operation_def.h"
#include "GUI\Resource\Bitmap\bitmap.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\Multiline\mso_multiline_text.h"
#ifdef D_GUI_ITEM_ACCESS
#include "GUI\Object_class\ItemAccess\mso_Item_Access.h"
#endif
#include "Components\Bookmark\o_bookmark.h"
#include "Components\Volume_control\o_volume_control.h"
#include "Components\Search\o_search.h"
#ifdef D_GUI_COMPONENT_SEARCH_DISPLAY
#include "Components\Search_display\o_search_display.h"
#endif
#include "Components\Karaoke\o_karaoke.h"
#include "Components\Prologic\o_prologic2.h"
#include "Components\Music_mode\o_music_mode.h"
#include "Components\Digest\o_digest.h"
#include "Components\Aux_subtitles_selection\o_aux_subtitleselection.h"
#include "Components\Message\o_message_handler.h"
#include "Components\Aux_subtitles\o_aux_subtitle.h"
#include "Components\Device_switch\o_device_switch.h"
#include "Components\Drm\o_drm_certification.h"
#include "Components\Display\o_display.h"
#include "Library\String_generate.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 "Clips\clips_menu.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Clips\clips_menu_config.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Custom\Clips\clips_menu_custom.h"
/***************************************************************************************
* Private Named constants
****************************************************************************************/
/***************************************************************************************
* Private typdef definitions.
****************************************************************************************/
/***************************************************************************************
* Public global variables ARE FORBIDDEN, we make an exception for Clips menu
* for the Fg and Bg action engine that are accessed all the time.
****************************************************************************************/
// TODO: Move this stucture to jpeg.c and use an API function to write it from UI.
#ifdef D_GINGER_I86
THUMBNAIL_POSITION gJpegPreviewPosition = {AREA_ABS_VIDEO_PREVIEW_X, AREA_ABS_VIDEO_PREVIEW_Y, AREA_ABS_VIDEO_PREVIEW_W, AREA_ABS_VIDEO_PREVIEW_H}; // {444, 266, 184, 122};
#endif
#ifdef D_GINGER_I96
THUMBNIAL_LOC far gJpegPreviewPosition = {AREA_ABS_VIDEO_PREVIEW_X, AREA_ABS_VIDEO_PREVIEW_Y, AREA_ABS_VIDEO_PREVIEW_W, AREA_ABS_VIDEO_PREVIEW_H}; // {444, 266, 184, 122};
#endif
/***************************************************************************************
* Private static variable declaration ARE FORBIDDEN under normal circumstances.
****************************************************************************************/
// Pointer to the "Foreground" API object. During playback, this action engine object is responsible
// for playing user selected items. During the slideshow mode, this API object plays the JPEGs.
// TODO: Set back to static when clips_runtime inside the clips_menu
PtrToActionEngineObject spFgActionEngine = NULL;
// Pointer to the "Background" API object. This action engine object is used only during the slideshow
// (i.e. MP3 + JPEG) mode, and it is responsible for playing the MP3s.
static PtrToActionEngineObject spBgActionEngine = NULL;
// Index of the "Foreground" page. Keeps track of which page is to be the source of content during playback.
static UINT16 swFgPageIndex = INVALID_PAGE_INDEX;
// Index of the "Background" page. Keeps track of which page is to be the source of the MP3s during the
// slideshow mode.
static UINT16 swBgPageIndex = INVALID_PAGE_INDEX;
// Utility macros
#define FgActionEnginePtr spFgActionEngine
#define FgPageIndex swFgPageIndex
#define BgActionEnginePtr spBgActionEngine
#define BgPageIndex swBgPageIndex
/***************************************************************************************
* Private static functions declaration
****************************************************************************************/
static BOOL _Layout(void);
/***************************************************************************************
* Utility functions
****************************************************************************************/
static BOOL _AddTools(MSO_VLIST __NEAR* pList);
static MSO_PAGE __NEAR* _GetActivePage(void);
#ifdef D_GUI_TOOLKIT_ADD_PROGRAM
static MSO_PAGE __NEAR* _GetProgramPage(void);
#endif // D_GUI_TOOLKIT_ADD_PROGRAM
MSO_CLIPS_MENU __NEAR* _GetMsoClipsMenu(void);
static BOOL _AddFilterValues(MSO_VLIST __NEAR* pList, MSO_CHOICE __NEAR* pChoice);
static BOOL _IsRuntimeRequired(UINT16 wFileType);
static BOOL _IsRuntimeActive(void);
#ifdef D_GUI_ITEM_ACCESS
static BOOL _IsBrowserActive(void);
#endif //D_GUI_ITEM_ACCESS
#ifdef D_JPEG_DIGEST_SUPPORT
static BOOL _IsDigestActive(void);
#endif
static MSO_OBJECT __NEAR* _SwitchToRuntime(void);
static MSO_OBJECT __NEAR* _SwitchToBrowser(void);
#ifdef D_JPEG_DIGEST_SUPPORT
void _SwitchToDigest(void);
#endif
#ifdef JPEG_MP3_ENABLE
//static BOOL _IsSlideShowPlaying(void);
#endif // JPEG_MP3_ENABLE
#ifdef D_GUI_TOOLKIT_ADD_INTRO
static void _RefreshIntroButton(MSO_BROWSER_PAGE __NEAR* pPage);
#endif // D_GUI_TOOLKIT_ADD_INTRO
static void _PrepareFgBeforeNewAction(void);
static BOOL _StopPlayback(void);
static BOOL _FullStopPlayback(void);
static BOOL _ResumeStopPlayback(void);
static BOOL _ResumePlayback(void);
static BOOL _CancelRepeat(void);
#ifdef D_REPEAT_CANCELS_REPEATAB
static BOOL _CancelRepeatAB(void);
#endif // D_REPEAT_CANCELS_REPEATAB
static BOOL _ResetSpeed(void);
static void _IncreaseRepeat(void);
#ifdef D_GUI_ITEM_ACCESS
static void _BrowserItemAccessGetDisplayItem(UINT16* pItem, UINT16* pTotalItems, UINT16* pItemType);
static void _MenuItemAccessOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
#endif //D_GUI_ITEM_ACCESS
static UINT16 _GetUiItemIndex(PtrToActionEngineObject pActionEngine, UINT16 wItemNum, CLIP_ITEM_TYPE tItemtype);
static void _GetUiItemNumAndType(PtrToActionEngineObject pActionEngine, UINT16 wItemIndex, UINT16* wItemNum , CLIP_ITEM_TYPE* tItemtype);
static void _CopyPlaymode(PtrToActionEngineObject pActionEngineObjectDest, PtrToActionEngineObject pActionEngineObjectSource);
static BOOL _AreWorkDirectoyDifferent(PtrToActionEngineObject pActionEngine1, PtrToActionEngineObject pActionEngine2);
static BOOL _IsFileTypeFilterDifferent(PtrToActionEngineObject pActionEngine1, PtrToActionEngineObject pActionEngine2);
#ifdef D_GUI_CLIPS_PLAY_MODE
static UINT16 _GetCurrentPlayMode(void);
static void _SetPlayMode(UINT16 wPlayMode);
STATIC void _PlayModeChoiceAction(MSO_OBJECT __NEAR* pThis, enMutatorType eType, UINT16 wValue);
#endif//D_GUI_CLIPS_PLAY_MODE
static BOOL _IsResumePlay(void);
#ifdef D_GUI_CLIPS_PLAY_MODE
static BOOL _IsAllowedIntroMode(void);
#endif // D_GUI_CLIPS_PLAY_MODE
static CONST UINT8 * _GetDeviceIcon(UINT16 wDeviceId);
/***************************************************************************************
* Operation handlers
****************************************************************************************/
static void _MenuCoreActionFinishedOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
static void _BrowserScrollListRefreshOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
static MS_OP _BrowserClipsListItemEnterOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
#ifdef D_GUI_CLIPS_MULTIPAGE
static void _BrowserBookRemoveDeviceOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
#endif // D_GUI_CLIPS_MULTIPAGE
static BOOL _MenuCacheFinishedOperation(MSO_OBJECT __NEAR* pThis, UINT32 lParam);
#ifdef D_CD_GRAPHIC_ENABLED
static void _SwitchBrowserGraphicView(MSO_OBJECT __NEAR* pThis, BOOL bGraphicViewOn);
#endif//D_CD_GRAPHIC_ENABLED
/***************************************************************************************
* Operation functions
****************************************************************************************/
static MS_OP _MenuOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _BrowserPageOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _BrowserOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _BookOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _BrowserScrollListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _PlayStateOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _PlayFileOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _PlayTimeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _BrowserListItemOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _BrowserVListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#ifdef D_JPEG_DIGEST_SUPPORT
static MS_OP _DigestOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif //#ifdef D_JPEG_DIGEST_SUPPORT
#ifdef D_GUI_CLIPS_MULTIPAGE
static MS_OP _BtnAddWindowOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif // D_GUI_CLIPS_MULTIPAGE
#ifdef D_GUI_HOME_BUTTON
static MS_OP _BtnHomeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif // D_GUI_HOME_BUTTON
static MS_OP _ToolkitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _ToolKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _FilterChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#ifdef D_GUI_TOOLKIT_ADD_SHUFFLE
static MS_OP _ShuffleChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif // D_GUI_TOOLKIT_ADD_SHUFFLE
static MS_OP _RepeatChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#ifdef D_GUI_TOOLKIT_ADD_REPEATAB
static MS_OP _RepeatABChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif // D_GUI_TOOLKIT_ADD_REPEATAB
#ifdef D_GUI_TOOLKIT_ADD_RIPPING
static MS_OP _BtnRippingOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif // D_GUI_TOOLKIT_ADD_RIPPING
#ifdef D_GUI_TOOLKIT_ADD_INTRO
static MS_OP _BtnIntroOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif // D_GUI_TOOLKIT_ADD_INTRO
#ifdef D_GUI_TOOLKIT_ADD_PROGRAM
static MS_OP _BtnProgramOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif // D_GUI_TOOLKIT_ADD_PROGRAM
static MS_OP _ToolkitValueVScrollListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _FilterListItemOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _PreviewWindowOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _PopupContainerOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _HelpTextOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _FilePathOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _SpecialMediaTypeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#ifdef D_GUI_CLIPS_EDIT_MODE
static MS_OP _EditModeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif//D_GUI_CLIPS_EDIT_MODE
#ifdef D_GUI_CLIPS_PROGRAM_VIEW
static MS_OP _AddClearProgramOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _ViewButtonOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif//D_GUI_CLIPS_PROGRAM_VIEW
#ifdef D_GUI_CLIPS_PLAY_MODE
static MS_OP _PlayModeChoiceOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif//D_GUI_CLIPS_PLAY_MODE
#if D_SUPPORT_SACD
static MS_OP _BtnSwitchSACDLayerOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif//D_SUPPORT_SACD
#ifdef D_CD_GRAPHIC_ENABLED
STATIC MS_OP _BrowserCdgOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif//D_CD_GRAPHIC_ENABLED
/***************************************************************************************
* Display functions
****************************************************************************************/
#ifdef D_GUI_CLIPS_MULTIPAGE
static BOOL _MediaInfoFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
#endif // D_GUI_CLIPS_MULTIPAGE
static BOOL _PlayTimeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
static BOOL _PlayStateFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
static BOOL _PlayFileFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
#ifdef D_GUI_TOOLKIT_ADD_INTRO
BOOL _BtnIntroFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
#endif //D_GUI_TOOLKIT_ADD_INTRO
#ifdef D_GUI_TOOLKIT_ADD_PROGRAM
static BOOL _BtnProgramFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
#endif // D_GUI_TOOLKIT_ADD_PROGRAM
static BOOL _PreviewWindowFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
static BOOL _BrowserListItemFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
static BOOL _FilePathFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
static BOOL _SpecialMediaTypeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
#include "Clips\clips_runtime.c"
// Include custom code file: customer specific code, over-writing common one.
#include "Custom\Clips\clips_menu_custom.c"
// Include configuration file: constants.
#include "Clips\clips_menu_config.c"
/***************************************************************************************
* Function : _Layout
*
* In : None
*
* Out : TRUE if successful.
*
* Desc : Sets layout for the menu.
****************************************************************************************/
static BOOL _Layout(void)
{
#ifdef D_GINGER_I86
go_CurrentLayout.m_bBigMemMap = 1;
#endif //D_GINGER_I86
#ifdef D_GINGER_I96
go_CurrentLayout.m_bBigMemMap = OSD_LAYOUT_MEM_MAP_LARGE;
#endif //D_GINGER_I96
#ifdef D_CD_GRAPHIC_ENABLED
go_CurrentLayout.m_bOSDBufferNum = OSD_BUFFER_0;
#endif//D_CD_GRAPHIC_ENABLED
OSDAdaptPixResolutionToProgressive();
OSDClearArea();
OSDAddArea(&OsdMessageLayoutArea);
OSDAddArea(&OsdLayoutAreaBrowser);
OSDSetLayout();
OSDAdaptDisplayRangeToVideoStandard();
return 1;
}
/***************************************************************************************
* Utility functions
****************************************************************************************/
/***************************************************************************************
* Function : _AddTools
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -