⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textline.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		    {			if(pTL->getSomethingChanged())			{			    defaultTextBGColor = textBGColor;			}			textBGColor = DwToNet(textBGColor);			UCHAR* pc = (UCHAR *)&textBGColor;			if(textBGColor != TRANSPARENT_COLOR)			{			    ulSprintfLen=sprintf(pTmp, /* Flawfinder: ignore */				    "%sbgcolor=#%02X%02X%02X",				    bFontTagWasStarted?" ":pFontIntroStr,				    pc[1],pc[2],pc[3]);			}			else			{			    ulSprintfLen = sprintf(pTmp, /* Flawfinder: ignore */				    "%sbgcolor=transparent",				    bFontTagWasStarted?" ":pFontIntroStr);			}			if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)			{			    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);			    pktHdrLen += ulSprintfLen;			    bFontTagWasStarted = TRUE;			}		    }		    if(ptSize != 0L)  //(0L is invalid pt size.)		    {			if(pTL->getSomethingChanged())			{			    defaultFontPointSize = ptSize;			}			getFontPointSizeStringFromPtSize(ptSize,				pTmpFontInfoBuf, TMP_FONT_INFO_BUF_SIZE);			ulSprintfLen = sprintf(pTmp, "%ssize=%s", /* Flawfinder: ignore */				bFontTagWasStarted?" ":pFontIntroStr,				pTmpFontInfoBuf);			if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)			{			    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);			    pktHdrLen += ulSprintfLen;			    bFontTagWasStarted = TRUE;			}		    }		    if(fontCharset != INVALID_CHARSET)		    {			getFontCharsetStringFromCharsetVal(fontCharset,				pTmpFontInfoBuf, TMP_FONT_INFO_BUF_SIZE);			ulSprintfLen = sprintf(pTmp, "%scharset=\"%s\"", /* Flawfinder: ignore */				bFontTagWasStarted?" ":pFontIntroStr,				pTmpFontInfoBuf);			if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)			{			    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);			    pktHdrLen += ulSprintfLen;			    bFontTagWasStarted = TRUE;			}		    }		    if(fontFaceIndex != INVALID_FONT_INDEX)		    {			getFontFaceStringFromFaceIndex(fontFaceIndex,				pTmpFontInfoBuf, TMP_FONT_INFO_BUF_SIZE,				pTextWin->getMajorContentVersion(),				pTextWin->getMinorContentVersion());			ulSprintfLen = sprintf(pTmp, "%sface=\"%s\"", /* Flawfinder: ignore */				bFontTagWasStarted?" ":pFontIntroStr,				pTmpFontInfoBuf);			if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)			{			    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);			    pktHdrLen += ulSprintfLen;			    bFontTagWasStarted = TRUE;			}		    }		    if(bFontTagWasStarted)		    {			SafeStrCat(pPacketHeaderBuf, ">", packetHeaderBufSize);			pktHdrLen++;		    }		}	    }	    bFontTagWasStarted = FALSE;	    pFontUndoTagList->GetPrev(pos);	} //end "while(pos)".    }    bFontTagWasStarted = FALSE;        //examine all of *this's vals against default vals and    // append diffs, in text form, to pPacketHeaderBuf:    COLORTYPE c = getTextColor();    BOOL bAnchorTagShouldComeBeforeFontTag =	    (getNumLinkColorOverrides() != 0);    if(HREFbufLen  &&  bAnchorTagShouldComeBeforeFontTag)    {	ulSprintfLen = sprintf(pTmp, "<A HREF=\"%s\"%s>", getHrefBuf(), /* Flawfinder: ignore */		 //Add target=_player if that's the case:		 (getTargetOfURL()==URL_TARGET_PLAYER?		 " target=\"_player\"":"") );	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	}    }    if(c != defaultTextColor)    {	if(TRANSPARENT_COLOR != c)	{	    c = DwToNet(c);	    UCHAR* pc = (UCHAR *)&c;	    ulSprintfLen = sprintf(pTmp, "%scolor=#%02X%02X%02X", /* Flawfinder: ignore */		    bFontTagWasStarted?" ":pFontIntroStr,		    pc[1],pc[2],pc[3]);	}	else	{	    ulSprintfLen = sprintf(pTmp, "%scolor=transparent", /* Flawfinder: ignore */		    bFontTagWasStarted?" ":pFontIntroStr);	}	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bFontTagWasStarted = TRUE;	}    }    COLORTYPE bgc = getTextBackgroundColor();    if(bgc != defaultTextBGColor)    {	if(TRANSPARENT_COLOR != bgc)	{	    bgc = DwToNet(bgc);	    UCHAR* pBgc = (UCHAR *)&bgc;	    ulSprintfLen = sprintf(pTmp, "%sbgcolor=#%02X%02X%02X", /* Flawfinder: ignore */		    bFontTagWasStarted?" ":pFontIntroStr,		    pBgc[1],pBgc[2],pBgc[3]);	}	else	{	    ulSprintfLen = sprintf(pTmp, "%sbgcolor=transparent", /* Flawfinder: ignore */		    bFontTagWasStarted?" ":pFontIntroStr);	}	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bFontTagWasStarted = TRUE;	}    }    if(getFontPointSize() != defaultFontPointSize)    {	getFontPointSizeStringFromPtSize(getFontPointSize(),		pTmpFontInfoBuf, TMP_FONT_INFO_BUF_SIZE);	ulSprintfLen = sprintf(pTmp, "%ssize=%s", /* Flawfinder: ignore */		bFontTagWasStarted?" ":pFontIntroStr,		pTmpFontInfoBuf);	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bFontTagWasStarted = TRUE;	}    }    if(getFontCharset() != defaultFontCharset)    {	getFontCharsetStringFromCharsetVal(getFontCharset(),		pTmpFontInfoBuf, TMP_FONT_INFO_BUF_SIZE);	ulSprintfLen = sprintf(pTmp, "%scharset=\"%s\"", /* Flawfinder: ignore */		bFontTagWasStarted?" ":pFontIntroStr,		pTmpFontInfoBuf);	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bFontTagWasStarted = TRUE;	}    }    if(getFontFace() != defaultFontFaceIndex)    {	getFontFaceStringFromFaceIndex(getFontFace(),		pTmpFontInfoBuf, TMP_FONT_INFO_BUF_SIZE,		pTextWin->getMajorContentVersion(),		pTextWin->getMinorContentVersion());	ulSprintfLen = sprintf(pTmp, "%sface=\"%s\"", /* Flawfinder: ignore */		bFontTagWasStarted?" ":pFontIntroStr,		pTmpFontInfoBuf);	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bFontTagWasStarted = TRUE;	}    }    if(bFontTagWasStarted)    {	SafeStrCat(pPacketHeaderBuf, ">", packetHeaderBufSize);	pktHdrLen++;    }    if(isBold())    {	if(pktHdrLen+3 < packetHeaderBufSize)	{	    SafeStrCat(pPacketHeaderBuf, "<B>", packetHeaderBufSize);	    pktHdrLen+=3;	}    }    if(isItalicized())    {	if(pktHdrLen+3 < packetHeaderBufSize)	{	    SafeStrCat(pPacketHeaderBuf, "<I>", packetHeaderBufSize);	    pktHdrLen+=3;	}    }    if(isUnderlined())    {	if(pktHdrLen+3 < packetHeaderBufSize)	{	    SafeStrCat(pPacketHeaderBuf, "<U>", packetHeaderBufSize);	    pktHdrLen+=3;	}    }    if(isStruckOut())    {	if(pktHdrLen+3 < packetHeaderBufSize)	{	    SafeStrCat(pPacketHeaderBuf, "<S>", packetHeaderBufSize);	    pktHdrLen+=3;	}    }    if(isCentered())    {	if(pktHdrLen+8 < packetHeaderBufSize)	{	    SafeStrCat(pPacketHeaderBuf, "<CENTER>", packetHeaderBufSize);	    pktHdrLen+=8;	}    }    {	ulSprintfLen = sprintf(pTmp, "%sstart=%ld.%03d", /* Flawfinder: ignore */		bTimeTagWasStarted?" ":pTimeIntroStr,		getStartTime()/1000, getStartTime()%1000);	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bTimeTagWasStarted = TRUE;	}    }    //One more seek-related bug fix; don't set "time end="    // in packet header based on endtime of first Text in    // the packet because all further text will die at that    // end time, you idiot!  Added member to TextAttributes that    // keeps track of when the last <TIME ... end=t> was seen and,    // if it's not MAX_ULONG32, then we'll send it in the packet    // header:    ULONG32 ulMostRecentTimeTagEndTime = getMostRecentTimeTagEndTime();    ///By commenting out this line, resend of live packets works properly    // in cases where <TIME end=...> is in the data;    // if(ulMostRecentTimeTagEndTime < (ULONG32)ULONG_MAX)    {	ulSprintfLen = sprintf(pTmp, "%send=%ld.%03d", /* Flawfinder: ignore */		bTimeTagWasStarted?" ":pTimeIntroStr,		ulMostRecentTimeTagEndTime/1000,		ulMostRecentTimeTagEndTime%1000);	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bTimeTagWasStarted = TRUE;	}    }    if(m_ulTimeOfLastClear !=0L)    {	//this is an internal tag val that tells renderer when the	// last <CLEAR> was done so position can be calculated using	// the x and y from <POS X0=x Y0=y> where time "zero" becomes	// the time of the last <CLEAR> tag:	ulSprintfLen = sprintf(pTmp, "%slc=%ld.%03d", /* Flawfinder: ignore */		bTimeTagWasStarted?" ":pTimeIntroStr,		m_ulTimeOfLastClear/1000, m_ulTimeOfLastClear%1000);	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	    bTimeTagWasStarted = TRUE;	}    }    if(bTimeTagWasStarted)    {	SafeStrCat(pPacketHeaderBuf, ">", packetHeaderBufSize);	pktHdrLen ++;    }    //Added this to handle indenting caused by <UL>(s) &/or <OL>(s):    UINT16 uLineIndentAmt = getLineIndentAmtInPixels();    if(uLineIndentAmt)    {	//Count the number of indents (how many <UL>s &/or <OL>s we've had	// since the last </UL? or </OL>) and insert that many <UL>s:	UINT16 uNumberOfOLsOrULs =uLineIndentAmt / UNORDERED_LIST_INDENT_AMT;	for(UINT16 i=0; i<uNumberOfOLsOrULs; i++)	{	    if(pktHdrLen+4 >= packetHeaderBufSize)	    {		break;	    }	    SafeStrCat(pPacketHeaderBuf, "<UL>", packetHeaderBufSize);	    pktHdrLen += 4;	}    }        if(HREFbufLen  &&  !bAnchorTagShouldComeBeforeFontTag)    {	ulSprintfLen = sprintf(pTmp, "<A HREF=\"%s\"%s>", getHrefBuf(), /* Flawfinder: ignore */		 //add target=_player if that's the case:		 (getTargetOfURL()==URL_TARGET_PLAYER?		 " target=\"_player\"":"") );	if(pktHdrLen+ulSprintfLen < packetHeaderBufSize)	{	    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);	    pktHdrLen += ulSprintfLen;	}    }    if(ulTextWindowType == TYPE_TICKERTAPE)    {        COLORTYPE tlc = getTickerLowerColor();        COLORTYPE origTlc = tlc;	tlc = DwToNet(tlc);	UCHAR* ptlc = (UCHAR *)&tlc;        COLORTYPE tuc = getTickerUpperColor();        COLORTYPE origTuc = tuc;	tuc = DwToNet(tuc);	UCHAR* ptuc = (UCHAR *)&tuc;	if(isTickerUpperText())	//then do lower first, then upper:	{	    if(origTlc != DEFAULT_TICKER_LOWERCOLOR)	    {			ulSprintfLen = sprintf(pTmp, "<TL color=#%02X%02X%02X>", /* Flawfinder: ignore */			ptlc[1],ptlc[2],ptlc[3]);		if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)		{		    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);		    pktHdrLen += ulSprintfLen;		}	    }	    if(pktHdrLen+3 < packetHeaderBufSize-1)	    {		SafeStrCat(pPacketHeaderBuf, "<TU", packetHeaderBufSize);		pktHdrLen += 3;	    }	    if(origTuc != DEFAULT_TICKER_UPPERCOLOR)	    {			ulSprintfLen = sprintf(pTmp, " color=#%02X%02X%02X", /* Flawfinder: ignore */			ptuc[1],ptuc[2],ptuc[3]);		if(pktHdrLen+ulSprintfLen < packetHeaderBufSize-1)		{		    SafeStrCat(pPacketHeaderBuf, pTmp, packetHeaderBufSize);		    pktHdrLen += ulSprintfLen;		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -