📄 o_smartpic_slider.c
字号:
/* **************************************************************************************
* Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: o_brightnessslider.c $
*
* Description:
* ============
* Project definition of the Brightness Slider Bar
*
****************************************************************************************/
#include "Config.h" // Global Configuration - do not remove!
#ifdef _DEBUG
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //_DEBUG
#ifdef D_SETUP_USE_SLIDE_FOR_SMART_PIC
/***************************************************************************************
* Include files
****************************************************************************************/
/***************************************************************************************
* Include files
****************************************************************************************/
#include <stdio.h>
#include <string.h>
#include "include\sysdefs.h"
#include "Playcore\Coremain\coregdef.h"
#include "Playcore\Ps\Ps.h"
//Include API Files
#include "CoreAPI\CoreAPI.h"
// Included UI LOW LEVEL files
// 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"
// Include the module header file
#include "Components\smart_picture\o_smartpic_slider.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\smart_picture\o_smartpic_slider_config.h"
// Include customer header file: named constants, macros and typedefs.
#include "Components\Custom\smart_picture\o_smartpic_slider_custom.h"
/***************************************************************************************
* Utility functions
****************************************************************************************/
/***************************************************************************************
* Operation functions
****************************************************************************************/
static MS_OP _SmartPicSliderOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _SmartPicHSliderOperationOnVList(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
/***************************************************************************************
* Display functions
****************************************************************************************/
static BOOL _SmartPicHSliderFillOSDSegOnVList(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
static BOOL _SmartPicSliderFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
/***************************************************************************************
* Choice item action functions
****************************************************************************************/
STATIC UINT16 _BrightnessSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
STATIC UINT16 _ContrastSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
STATIC UINT16 _TintSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
STATIC UINT16 _ColorSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
/***************************************************************************************
* Include customization file.
****************************************************************************************/
// Include custom code file: customer specific code, over-writing common one.
// Include custom file: constants.
#include "Components\Custom\smart_picture\o_smartpic_slider_custom.c"
// Include configuration file: constants.
#include "Components\smart_picture\o_smartpic_slider_config.c"
/**************************************************************************
* Function : _SmartPic_DisplaySliderRectangleAndTab
*
* In :
*
* Out :
*
* Desc : Displays the rectangle and tab of the slider for smart picture sliders
***************************************************************************/
static void _SmartPic_DisplaySliderRectangleAndTab(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea,
UINT16 wXoffset, UINT16 wYoffset)
{
MSO_HSLIDER __NEAR* pHSlider = (MSO_HSLIDER __NEAR*)pThis;
UINT16 wPixelJump;
MS_AREA oArea;
MS_DESCRIPTOR_HSLIDER_VLIST *pSliderDescriptor = (MS_DESCRIPTOR_HSLIDER_VLIST*)(pHSlider->moObject.mpDescriptor);
// Display the background bar, centred horizontally and vertically in the containing area:
OSDR_FillOsdSegRectangle( wXoffset,
wYoffset,
pSliderDescriptor->mcBarWidth,
pSliderDescriptor->mcBarHeight,
pAbsArea,
CIDX_HSLIDER_BG_BAR_COLOUR);
// Fill the horizontal slide bar area from the left...
// Work out how wide each value jump is ((total width / number of values) * current slider value).
// Multiply by 100 to maintain resolution (no floating point number available).
wPixelJump = (UINT16)((pSliderDescriptor->mcBarWidth * 100) / (pHSlider->moParam.mwMaxValue - pHSlider->moParam.mwMinValue));
wPixelJump *= (UINT16)(pHSlider->moParam.mwCurrentValue - pHSlider->moParam.mwMinValue);
wPixelJump /= 100;
// Ensure that we haven't (somehow) got a value wider than the bar itself:
if(wPixelJump > pHSlider->moObject.moArea.mwW)
{
wPixelJump = pHSlider->moObject.moArea.mwW;
}
if(wPixelJump > 0) // If we need to fill the area...
{
// Fill in the current value indication on the slider bar:
OSDR_FillOsdSegRectangle( wXoffset,
wYoffset,
wPixelJump,
pSliderDescriptor->mcBarHeight,
pAbsArea,
CIDX_HSLIDER_FG_BAR_COLOUR);
}
// Display the slider tab...
oArea.msX = pAbsArea->msX + wXoffset + wPixelJump -(pSliderDescriptor->mcTabWidth / 2);
oArea.msY = pAbsArea->msY + (pAbsArea->mwH / 2) - (pSliderDescriptor->mcTabHeight / 2);
oArea.mwW = pSliderDescriptor->mcTabWidth;
oArea.mwH = pSliderDescriptor->mcTabHeight;
OSDR_FillOsdSegBitmapFitArea(BMP_BG_2, (MS_AREA __NEAR*)&oArea);
}
/**************************************************************************
* Function : _SmartPic_DisplayVlistSliderValuesOnRight
*
* In :
*
* Out :
*
* Desc : Displays the current values (if any) on right of the slider
***************************************************************************/
static void _SmartPic_DisplayVlistSliderValuesOnRight(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea, UINT16 wYoffset)
{
FORMATED_UNICODE_STRING oFormUniStr;
MSO_HSLIDER __NEAR* pHSlider = (MSO_HSLIDER __NEAR*)pThis;
MS_DESCRIPTOR_HSLIDER_VLIST *pSliderDescriptor = (MS_DESCRIPTOR_HSLIDER_VLIST*)(pHSlider->moObject.mpDescriptor);
UINT16 wXoffset;
UINT16 wXTextOffset = ((pSliderDescriptor->mcTabWidth / 2) + 2);
UINT16 wValueColor = (MS_IsFocusable(pThis) ? CIDX_HSLIDER_TEXT_DEFAUT : CIDX_HSLIDER_TEXT_NOT_FOCUSABLE);
if(pSliderDescriptor->bDisplayCurrentValue)
{
STR_GenerateNumericValue((INT32)pHSlider->moParam.mwCurrentValue, oFormUniStr.mszUniStr, 0, UNISTR_LENGTH_MAX+1);
oFormUniStr.mtFontIndex = SMARTPIC_SLIDER_FONT_VALUE_CURRENT;
OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr);
wXoffset = (pThis->moArea.mwW > pSliderDescriptor->mcBarWidth)
? (pThis->moArea.mwW - (pSliderDescriptor->mcBarWidth>>2))
: (pSliderDescriptor->mcBarWidth +10 );
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
wXoffset,
((pAbsArea->mwH >> 1) ),
ALIGN_H_CENTER,
ALIGN_V_CENTER,
wValueColor);
}
else
{
if(pSliderDescriptor->bDisplayMinAndMaxValues == TRUE)
{
STR_GenerateNumericValue((INT32)pHSlider->moParam.mwMinValue, oFormUniStr.mszUniStr, 0, UNISTR_LENGTH_MAX+1);
oFormUniStr.mtFontIndex = SMARTPIC_SLIDER_FONT_VALUE_MIN;
OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr);
if (pThis->moArea.mwW > pSliderDescriptor->mcBarWidth)
wXoffset = ((pThis->moArea.mwW)>>1) - oFormUniStr.mwPixelWidth -wXTextOffset;
else
wXoffset = 0;
OSDR_FillOsdSegUniString( (FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
wXoffset,
wYoffset,
ALIGN_H_LEFT,
ALIGN_V_TOP,
wValueColor);
// Display Max.
STR_GenerateNumericValue((INT32)pHSlider->moParam.mwMaxValue, oFormUniStr.mszUniStr, 0, UNISTR_LENGTH_MAX+1);
oFormUniStr.mtFontIndex = SMARTPIC_SLIDER_FONT_VALUE_MAX;
OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr);
if (pThis->moArea.mwW > pSliderDescriptor->mcBarWidth)
wXoffset = ((pThis->moArea.mwW) / 2) + pSliderDescriptor->mcBarWidth + wXTextOffset;
else
wXoffset = pSliderDescriptor->mcBarWidth;
OSDR_FillOsdSegUniString( (FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
wXoffset,
wYoffset,
ALIGN_H_LEFT,
ALIGN_V_TOP,
wValueColor);
}
}
}
/**************************************************************************
* Function : HSliderFillOSDSegOnVList_SmartPic
*
* In :
*
* Out :
*
* Desc : MSO_HSLIDER display function Only for Smart Pic Sliders
***************************************************************************/
static BOOL _SmartPicHSliderFillOSDSegOnVList(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
MSO_HSLIDER __NEAR* pHSlider = (MSO_HSLIDER __NEAR*)pThis;
MS_DESCRIPTOR_HSLIDER_VLIST *pSliderDescriptor = (MS_DESCRIPTOR_HSLIDER_VLIST*)(pHSlider->moObject.mpDescriptor);
UINT16 wColor = ((!MS_IsFocusable(pThis) || MS_IS_HSLIDER_DISABLED(pThis)) ? CIDX_HSLIDER_TEXT_NOT_FOCUSABLE : CIDX_HSLIDER_TEXT_DEFAUT);
FORMATED_UNICODE_STRING oFormUniStr;
MS_AREA oArea;
UINT16 wXoffset;
UINT16 wYoffset;
if (pSliderDescriptor->mName != NULL)
{
/*Display name of the parameter */
OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pSliderDescriptor->mName);
oFormUniStr.mtFontIndex = SMARTPIC_SLIDER_FONT_PARAMETER_NAME;
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
12, /* Displayed as a choice */
(pAbsArea->mwH >> 1),
0,
ALIGN_V_CENTER,
wColor);
}
/* determine the x offset for the slider */
wXoffset = (pThis->moArea.mwW > pSliderDescriptor->mcBarWidth)
? (((pThis->moArea.mwW)/2))
: 0;
/* determine the y offset for the slider */
wYoffset = (pThis->moArea.mwH > pSliderDescriptor->mcBarHeight)
? ((pThis->moArea.mwH - pSliderDescriptor->mcBarHeight) / 2)
: 0;
_SmartPic_DisplaySliderRectangleAndTab((MSO_OBJECT __NEAR*) pHSlider, (MS_AREA __NEAR*) pAbsArea, wXoffset, wYoffset);
_SmartPic_DisplayVlistSliderValuesOnRight((MSO_OBJECT __NEAR*) pHSlider, (MS_AREA __NEAR*) pAbsArea, wYoffset);
// If required, display the focus highlight:
if(MS_IsFocused(pThis))
{
if(pSliderDescriptor->eHLPos == HS_HIGHLIGHT_ON_TAB)
{
OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, (MS_AREA __NEAR*)&oArea);
}
else
{
OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, pAbsArea);
}
}
return FALSE;
}
/***************************************************************************************
* Function : _SmartPicHSliderOperationOnVList
*
* In :
*
* Out :
*
* Desc : The choice operation of all the slider objects.
****************************************************************************************/
#pragma argsused
static MS_OP _SmartPicHSliderOperationOnVList(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
// Pre-processing
switch(MsOp)
{
case MS_OP_LEFT: // Fall Through !!!
case MS_OP_RIGHT:
{
// Do nothing if disabled.
if(MS_IS_CHOICE_DISABLED(pThis))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -