?? mso_multiline_text.c
字號:
wPixelWidth = (INT16)(pDescriptorMultilineText->moDescriptorText.moDescriptor.moArea.mwW -
((pDescriptorMultilineText->mnPixelLeftRightBorder*2) +
((pDescriptorMultilineText->moDescriptorText.mpXYAlignText->mcHorizontal & ALIGN_TO_CONTAINER) ?
ABS(pDescriptorMultilineText->moDescriptorText.mpXYAlignText->mnX) :
pDescriptorMultilineText->moDescriptorText.mpXYAlignText->mnX)));
((MULTILINE_TEXT_TABLE*)lParam)->mcTableEntryCount = 0;
// Copy the help text into the message table:
cLineIndex = 0;
while(cLineIndex < pDescriptorMultilineText->mcMaxTableLines)
{
if(!bDone)
{
FORMATED_UNICODE_STRING oFormUniStr;
oFormUniStr.mtFontIndex = pDescriptorText->mtFontIndex;
// pass byte offset on 16 MSBs of lParam
// lwTextandOffset = (pDescriptorMultilineText->moDescriptorText.mText->mParam | ((UINT32)wScByteOffset << 16));
lwTextandOffset = OMULTILINETEXT_GetStrParamMake(pDescriptorMultilineText->moDescriptorText.mText->mParam ,(UINT32)(wScByteOffset) );
// get text
pDescriptorMultilineText->moDescriptorText.mText->mGetStr((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, lwTextandOffset);
bDone = _PrepareTextTableItem( pThis,
((MULTILINE_TEXT_TABLE*)lParam),
cLineIndex,
&oFormUniStr,
&wScByteOffset,
wPixelWidth
#ifdef D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
,bRemoveAllNewLines
#endif //D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
) ;
#ifdef D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
if(MS_MULTI_PREPARE_STR_FIT_1 == pDescriptorMultilineText->mMsMultiDisplayConfig
&& cLineIndex == pDescriptorMultilineText->mcMaxTableLines -1
&& !bDone
&& !bRemoveAllNewLines)
{
bRemoveAllNewLines= TRUE;
cLineIndex = 0;
((MULTILINE_TEXT_TABLE*)lParam)->mcTableEntryCount = 0;
wScByteOffset = 0;
}
else
#endif//D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
cLineIndex ++;
}
else
break;
}
MsOp = MS_OP_NONE;
}
break;
case MS_OP_ON_DEFROST:
case MS_OP_INIT:
pObjectMultilineText->moParam.moEntryTable.mwEntries = NULL;
pObjectMultilineText->moParam.moEntryTable.mcTableEntryCount =0;
return MsOp;
case MS_OP_BUILD_TEXT_TABLE:
{
MULTILINE_TEXT_TABLE oMultilineTextTable;
// Initialise the message table that we're going to send to it:
OMULTILINETEXT_InitialiseTextTable(&oMultilineTextTable, pDescriptorMultilineText->mcMaxTableLines);
// Allocate memory to hold the help text:
OMULTILINETEXT_MallocStrings(&oMultilineTextTable);
MS_SendOperation(pThis, MS_OP_POPULATE_TEXT_TABLE, (UINT32)&oMultilineTextTable);
// free unused SCPAD
OMULTILINETEXT_ResizeStrings(&oMultilineTextTable, pDescriptorMultilineText->mcMaxTableLines);
if(oMultilineTextTable.mcTableEntryCount != 0)
{
// Send the message table to the help text object:
MS_SendOperation(pThis, MS_OP_ALLOCATE_TEXT_TABLE, (UINT32)&oMultilineTextTable);
}
// Clean up...
OMULTILINETEXT_DeleteTextTable(&oMultilineTextTable);
MsOp = MS_OP_NONE;
}
break;
case MS_OP_ALLOCATE_TEXT_TABLE:
{
MULTILINE_TEXT_TABLE *pMultilineTextTable;
size_t uTableSize;
pMultilineTextTable = (MULTILINE_TEXT_TABLE*)lParam;
// Is this the first time that this command has been sent?
if(pObjectMultilineText->moParam.moEntryTable.mcTableEntryCount != 0)
{
// Free the memory allocated previously:
OMULTILINETEXT_ReleaseStrings(
&(pObjectMultilineText->moParam.moEntryTable));
OMULTILINETEXT_DeleteTextTable(
&(pObjectMultilineText->moParam.moEntryTable));
}
// Allocate memory to hold the look-up table:
uTableSize =(pMultilineTextTable->mcTableEntryCount * sizeof(SC_PTR));
OMULTILINETEXT_InitialiseTextTable(
&(pObjectMultilineText->moParam.moEntryTable),
pMultilineTextTable->mcTableEntryCount);
memcpy(pObjectMultilineText->moParam.moEntryTable.mwEntries,
pMultilineTextTable->mwEntries, uTableSize);
pObjectMultilineText->moParam.mcCurrentEntry = 0;
MsOp = MS_OP_NONE;
}
break;
case MS_OP_PREPARE_FOR_FREEZE:
case MS_OP_EMPTY:
{
if(pObjectMultilineText->moParam.moEntryTable.mcTableEntryCount != 0)
{
// Free the memory allocated previously:
OMULTILINETEXT_ReleaseStrings(&(pObjectMultilineText->moParam.moEntryTable));
OMULTILINETEXT_DeleteTextTable(&(pObjectMultilineText->moParam.moEntryTable));
}
MsOp = MS_OP_NONE;
}
break;
default:
break;
}
return(OTEXT_Operation((MSO_OBJECT __NEAR*)&pObjectMultilineText->moObject, MsOp, lParam));
}
/**************************************************************************
* Function : TextFillOSDSeg
*
* In :
*
* Out :
*
* Desc :
***************************************************************************/
BOOL OMULTILINETEXT_FillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
UINT8 cLineIndex;
UINT16 wStartY;
UINT8 cNumDisplayLines;
FORMATED_UNICODE_STRING oFormUniStr;
MS_AREA oAbsAreaText;
UINT16 wObjectHeight;
CONST FONT *pCurrentFont;
INT16 sX;
INT16 sY;
UINT8 cAlignH;
UINT8 cAlignV;
MS_X_Y_ALIGN *pXYAlignText ;
INT8 cPixelGapBetweenLines ;
#ifdef D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
INT16 sBitmapX ;
INT16 sBitmapY;
INT16 wXExpansion;
INT16 wYExpansion;
#endif//D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
CONST UINT8* pcBmpData ;
pcBmpData = OTEXT_GetBitmapFromSet(pThis, pDescriptorText->mpBmpSetBg);
memcpy(&oAbsAreaText, pAbsArea, sizeof(MS_AREA));
// all strings in multiline text are the same font - no need to update this
pCurrentFont = pFonts[pDescriptorText->mtFontIndex];
// display bitmap if required
#ifdef D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
if(MS_MULTI_BG_FIT_H_AREA == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitH
&& MS_MULTI_BG_FIT_V_AREA == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitV )
#endif//D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
{
OSDR_FillOsdSegBitmapFitArea(pcBmpData, pAbsArea);
pcBmpData = NULL;
}
// Let the bg being displayed but don't display the string of none are built
if (0 == pObjectMultilineText->moParam.moEntryTable.mcTableEntryCount)
return FALSE;
oAbsAreaText.msX += pDescriptorMultilineText->mnPixelLeftRightBorder;
oAbsAreaText.mwW -= (pDescriptorMultilineText->mnPixelLeftRightBorder * 2);
oAbsAreaText.msY += pDescriptorMultilineText->mnPixelTopBottomBorder;
oAbsAreaText.mwH -= (pDescriptorMultilineText->mnPixelTopBottomBorder * 2);
cNumDisplayLines = MIN((pObjectMultilineText->moParam.moEntryTable.mcTableEntryCount - pObjectMultilineText->moParam.mcCurrentEntry),
(((oAbsAreaText.mwH + pDescriptorMultilineText->mcPixelGapBetweenLines) - ABS(pDescriptorText->mpXYAlignText->mnY)) / (pCurrentFont->m_cMaxPixelHeight + pDescriptorMultilineText->mcPixelGapBetweenLines)));
wObjectHeight = ((pCurrentFont->m_cMaxPixelHeight * cNumDisplayLines) + (pDescriptorMultilineText->mcPixelGapBetweenLines * (cNumDisplayLines-1)));
// Search for the index of the subtitle line to display
for (cLineIndex = 0;
cLineIndex < cNumDisplayLines;
cLineIndex++)
{
wStartY = (oAbsAreaText.msY +
((pDescriptorText->mpXYAlignText->mcVertical & ALIGN_TO_CONTAINER) ?
MAX(0,OSDR_AlignmentGetOffsetInObject((pDescriptorText->mpXYAlignText->mcVertical & ALIGN_MASK),
wObjectHeight,
(oAbsAreaText.mwH- ABS(pDescriptorText->mpXYAlignText->mnY))))
+ MAX(0,pDescriptorText->mpXYAlignText->mnY)
+ (cLineIndex * (pCurrentFont->m_cMaxPixelHeight + pDescriptorMultilineText->mcPixelGapBetweenLines)):
(pDescriptorText->mpXYAlignText->mnY + ((pCurrentFont->m_cMaxPixelHeight + pDescriptorMultilineText->mcPixelGapBetweenLines) * cLineIndex)) ));
if ((goOsdSeg.msAbsY >= wStartY) && (goOsdSeg.msAbsY < (wStartY + (pCurrentFont->m_cMaxPixelHeight))))
// only attempt to display whole lines
if(((cLineIndex * (pCurrentFont->m_cMaxPixelHeight + pDescriptorMultilineText->mcPixelGapBetweenLines)) + pCurrentFont->m_cMaxPixelHeight) <= wObjectHeight)
break;
}
pXYAlignText = ((MS_DESCRIPTOR_TEXT *)&(((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->moDescriptorText))->mpXYAlignText;
#ifdef D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
if((pcBmpData) && (MS_MULTI_BG_FIT_H_STR == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitH )
&&(MS_MULTI_BG_FIT_V_AREA == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitV))
{
UINT16 cLine;
UINT16 wStrWidthMax = 0;
UINT16 wStrWidthCur;
for(cLine = 0; cLine < cNumDisplayLines ;cLine ++)
{
wStrWidthCur = OSDR_GetScFormattedWidth((UINT32)(pObjectMultilineText->moParam.moEntryTable.mwEntries[pObjectMultilineText->moParam.mcCurrentEntry + cLine]));
if(wStrWidthCur > wStrWidthMax)
wStrWidthMax = wStrWidthCur;
}
wXExpansion = MIN(wStrWidthMax + (((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mPixelMarginBgH*2), pAbsArea->mwW);
sBitmapX = MAX(MULTILINETEXT_GetAlignTextXPosition(pXYAlignText, wXExpansion, oAbsAreaText.mwW) ,0);
sBitmapY = 0;
wYExpansion = pAbsArea->mwH;
OSDR_FillOsdSegBitmap(pcBmpData,pAbsArea, sBitmapX, sBitmapY ,0, 0, wXExpansion,wYExpansion);
pcBmpData = NULL;
}
#endif//D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
cPixelGapBetweenLines = ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mcPixelGapBetweenLines;
if ( (cLineIndex < cNumDisplayLines)
&& (NULL_HANDLE != pObjectMultilineText->moParam.moEntryTable.mwEntries[cLineIndex]))
{
// Build the subtitle line segment
OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
(UINT32)(pObjectMultilineText->moParam.moEntryTable.mwEntries[pObjectMultilineText->moParam.mcCurrentEntry + cLineIndex]));
// x offset
sX = MULTILINETEXT_GetAlignTextXPosition(pXYAlignText, oFormUniStr.mwPixelWidth , oAbsAreaText.mwW);
// Y offset
sY = MULTILINETEXT_GetAlignTextYPosition(pXYAlignText, pCurrentFont->m_cMaxPixelHeight,oAbsAreaText.mwH,cNumDisplayLines , cLineIndex,cPixelGapBetweenLines);
// Horizontal alignment
cAlignH = TEXT_GetAlignHorizontal(pXYAlignText);
// Vertical alignment
cAlignV = TEXT_GetAlignVertical(pXYAlignText);
#ifdef D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
if(pcBmpData)
{
if((MS_MULTI_BG_FIT_H_AREA == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitH )
&&(MS_MULTI_BG_FIT_V_STR == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitV))
{
sBitmapX =0;
wXExpansion = pAbsArea->mwW;
sBitmapY = MAX(sY - ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mPixelMarginBgV,0);
wYExpansion = MIN(((cLineIndex < cNumDisplayLines-1) ?
pCurrentFont->m_cMaxPixelHeight + cPixelGapBetweenLines: pCurrentFont->m_cMaxPixelHeight)
+ (((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mPixelMarginBgV*2) ,
pAbsArea->mwH);
}
else if((MS_MULTI_BG_FIT_H_STR == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitH )
&&(MS_MULTI_BG_FIT_V_STR == ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mMsMultiBgFitV))
{
sBitmapX = MAX(sX -((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mPixelMarginBgH,0) ;
wXExpansion = MIN(oFormUniStr.mwPixelWidth + (((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mPixelMarginBgH*2), pAbsArea->mwW);
sBitmapY = MAX(sY - ((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mPixelMarginBgV,0);
wYExpansion = MIN(((cLineIndex < cNumDisplayLines-1) ?
pCurrentFont->m_cMaxPixelHeight + cPixelGapBetweenLines: pCurrentFont->m_cMaxPixelHeight)
+ (((MS_DESCRIPTOR_MULTILINE_TEXT *)(pThis->mpDescriptor))->mPixelMarginBgV*2) ,
pAbsArea->mwH);
}
OSDR_FillOsdSegBitmap(pcBmpData,pAbsArea, sBitmapX, sBitmapY , cAlignH, cAlignV, wXExpansion,wYExpansion);
}
#endif//D_GUI_DESCRIPTOR_MULTILINETEXT_EXT1
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
(MS_AREA __NEAR*)&oAbsAreaText, sX, sY, cAlignH, cAlignV,
OTEXT_GetColorFromSet(pThis, pDescriptorText->mpColorSetText));
}
return FALSE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -