?? mso_hscroll_text.c
字號:
/* **************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: o_hscroll_text.c $
*
* Description:
* ============
* Project definition of the MSO_HSCROLL_TEXT functions
*
****************************************************************************************/
#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 <stdio.h>
#include <string.h>
#include "Include\math-macro.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\Object_class\Hscroll\mso_hscroll_text.h"
#include "GUI\Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "GUI\Object_class\Text\mso_text.h"
#include "Library\Container_misc.h"
#include "GUI\Object_class\Multiline\mso_multiline_text.h"
#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif
#define pObjectHscrollText ((MSO_HSCROLL_TEXT __NEAR*)pThis)
#define pObjectMultilineText ((MSO_MULTILINE_TEXT __NEAR*)&(pObjectHscrollText->moObject))
#define pObjectText ((MSO_TEXT __NEAR*)&(pObjectMultilineText->moObject))
#define pDescriptorHscrollText ((MS_DESCRIPTOR_HSCROLL_TEXT*)(pThis->mpDescriptor))
#define pDescriptorMultilineText ((MS_DESCRIPTOR_MULTILINE_TEXT*)&(pDescriptorHscrollText->moDescriptorMultilineText))
#define pDescriptorText ((MS_DESCRIPTOR_TEXT*)&(pDescriptorMultilineText->moDescriptorText))
static void HscrollReset(MSO_OBJECT __NEAR* pThis)
{
if(pDescriptorHscrollText->meStartPos == HSCROLL_START_RIGHT)
{
pObjectHscrollText->moParam.iStartPixel = (pObjectText->moObject.moArea.mwW - pDescriptorMultilineText->mnPixelLeftRightBorder);
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_SCROLLING_IN;
}
else
{
pObjectHscrollText->moParam.iStartPixel = 0;
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_HOLDING;
pObjectHscrollText->moParam.mcHoldTimeRemaining = pDescriptorHscrollText->mcHoldTime;
}
// End
}
#pragma argsused
MS_OP OHSCROLLTEXT_Operation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
switch (MsOp)
{
case MS_OP_INIT:
case MS_OP_ON_DEFROST:
case MS_OP_BUILD_TEXT_TABLE:
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_RESETTING;
break;
case MS_OP_TICK:
if(pObjectMultilineText->moParam.moEntryTable.mcTableEntryCount != 0)
{
FORMATED_UNICODE_STRING oFormUniStr;
switch(pObjectHscrollText->moParam.cCurrentState)
{
case HSCROLL_STATE_RESETTING:
HscrollReset(pThis);
pObjectMultilineText->moParam.mcCurrentEntry = 0;
OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)(pObjectHscrollText->moObject.moParam.moEntryTable.mwEntries[pObjectMultilineText->moParam.mcCurrentEntry]));
pObjectHscrollText->moParam.miBlockPixelLength = (oFormUniStr.mwPixelWidth + ((pFonts[pDescriptorText->mtFontIndex])->m_cCharPixelSpace));
break;
case HSCROLL_STATE_SCROLLING_IN:
pObjectHscrollText->moParam.iStartPixel -= pDescriptorHscrollText->mcPixelCount;
if(pObjectHscrollText->moParam.iStartPixel <= 0)
{
pObjectHscrollText->moParam.iStartPixel = 0;
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_HOLDING;
pObjectHscrollText->moParam.mcHoldTimeRemaining = pDescriptorHscrollText->mcHoldTime;
}
else
{
break;
}
case HSCROLL_STATE_HOLDING:
if(pObjectHscrollText->moParam.mcHoldTimeRemaining-- == 0)
{
if((pDescriptorHscrollText->meScrollType & HSCROLL_REMOVE_MASK) == HSCROLL_REMOVE_IMMEDIATE)
{
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_SCROLL_DONE;
break;
}
else
{
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_SCROLLING_OUT;
}
}
else
{
break;
}
case HSCROLL_STATE_SCROLLING_OUT:
pObjectHscrollText->moParam.iStartPixel -= pDescriptorHscrollText->mcPixelCount;
if((pObjectHscrollText->moParam.miBlockPixelLength + pObjectHscrollText->moParam.iStartPixel) <= 0)
{
pObjectHscrollText->moParam.iStartPixel = (0 - pObjectHscrollText->moParam.miBlockPixelLength);
// try to do something here to change state when finished
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_SCROLL_DONE;
}
else
{
break;
}
case HSCROLL_STATE_SCROLL_DONE:
// increment to next item
if(++pObjectMultilineText->moParam.mcCurrentEntry >= pObjectMultilineText->moParam.moEntryTable.mcTableEntryCount)
{
pObjectMultilineText->moParam.mcCurrentEntry = 0;
}
switch(pDescriptorHscrollText->meScrollType & HSCROLL_SCROLL_MASK)
{
case HSCROLL_SCROLL_FINISH_BEFORE_RESCROLL:
if(pObjectMultilineText->moParam.mcCurrentEntry == 0)
{
HscrollReset(pThis);
break;
}
// else fall through
case HSCROLL_SCROLL_CONTINUOUS:
switch(pDescriptorHscrollText->meScrollType & HSCROLL_REMOVE_MASK)
{
case HSCROLL_REMOVE_SCROLL:
// Set the pixel count to the left-most position (more or less):
pObjectHscrollText->moParam.iStartPixel = 0;
// Set the state correctly:
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_HOLDING;
pObjectHscrollText->moParam.mcHoldTimeRemaining = pDescriptorHscrollText->mcHoldTime;
break;
case HSCROLL_REMOVE_IMMEDIATE:
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_SCROLLING_IN;
pObjectHscrollText->moParam.iStartPixel = pObjectHscrollText->moParam.miBlockPixelLength;
break;
}
break;
case HSCROLL_SCROLL_INDIVIDUAL_TEXTS:
// ... then take the start position into account
// (equivalent to a full reset of the HSCROLL_TEXT object part):
HscrollReset(pThis);
break;
}
OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)(pObjectHscrollText->moObject.moParam.moEntryTable.mwEntries[pObjectMultilineText->moParam.mcCurrentEntry]));
pObjectHscrollText->moParam.miBlockPixelLength = (oFormUniStr.mwPixelWidth + ((pFonts[pDescriptorText->mtFontIndex])->m_cCharPixelSpace));
break;
}
MS_DisplayAddObject(pThis);
}
break;
case MS_OP_EMPTY: // FALL THRU
case MS_OP_PREPARE_FOR_FREEZE:
pObjectHscrollText->moParam.cCurrentState = HSCROLL_STATE_RESETTING;
break;
}
return OMULTILINETEXT_Operation((MSO_OBJECT __NEAR *)pObjectMultilineText, MsOp, lParam);
}
BOOL OHSCROLLTEXT_FillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
BOOL bStop = FALSE;
INT16 iPixelCount = pObjectHscrollText->moParam.iStartPixel;
FORMATED_UNICODE_STRING oFormUniStr;
UINT8 cCount;
MS_AREA oAbsAreaCopy;
memcpy(&oAbsAreaCopy, pAbsArea, sizeof(MS_AREA));
// display bitmap if required
OSDR_FillOsdSegBitmapFitArea(OTEXT_GetBitmapFromSet(pThis, pDescriptorText->mpBmpSetBg), pAbsArea);
if(pObjectHscrollText->moParam.cCurrentState != HSCROLL_STATE_RESETTING)
{
oAbsAreaCopy.msX += pDescriptorMultilineText->mnPixelLeftRightBorder;
oAbsAreaCopy.mwW -= (pDescriptorMultilineText->mnPixelLeftRightBorder * 2);
oAbsAreaCopy.msY += pDescriptorMultilineText->mnPixelTopBottomBorder;
oAbsAreaCopy.mwH -= (pDescriptorMultilineText->mnPixelTopBottomBorder * 2);
for((cCount = pObjectHscrollText->moObject.moParam.mcCurrentEntry);
(iPixelCount < (INT16)oAbsAreaCopy.mwW) && (bStop == FALSE);
(iPixelCount += ((INT16)oFormUniStr.mwPixelWidth + ((pFonts[pDescriptorText->mtFontIndex])->m_cCharPixelSpace) +1)))
{
// Get the text:
OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)(pObjectHscrollText->moObject.moParam.moEntryTable.mwEntries[cCount]));
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
(const MS_AREA __NEAR*) &oAbsAreaCopy,
iPixelCount, //INT16 sAbsX,
TEXT_GetAlignYPosition(pDescriptorText->mpXYAlignText, oFormUniStr.mcPixelHeight, oAbsAreaCopy.mwH) ,//INT16 sAbsY,
ALIGN_H_LEFT, //UINT8 cAlignH,
TEXT_GetAlignVertical(pDescriptorText->mpXYAlignText),
OTEXT_GetColorFromSet(pThis, pDescriptorText->mpColorSetText));
// Update the local block count, depending on parameters.
switch(pDescriptorHscrollText->meScrollType & HSCROLL_SCROLL_MASK)
{
case HSCROLL_SCROLL_INDIVIDUAL_TEXTS:
bStop = TRUE;
break;
case HSCROLL_SCROLL_CONTINUOUS:
if(++cCount >= pObjectHscrollText->moObject.moParam.moEntryTable.mcTableEntryCount)
cCount = 0;
break;
case HSCROLL_SCROLL_FINISH_BEFORE_RESCROLL:
if(++cCount >= pObjectHscrollText->moObject.moParam.moEntryTable.mcTableEntryCount)
bStop = TRUE;
break;
}
}
}
return FALSE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -