Beispiel #1
0
//We cannot support color within the text since HyperTextCtrl does not detect hyperlinks with color. So I will filter it.
CString CIrcWnd::StripMessageOfFontCodes( CString temp )
{
	temp = StripMessageOfColorCodes( temp );
	temp.Replace(_T("\002"),_T(""));
	temp.Replace(_T("\003"),_T(""));
	temp.Replace(_T("\017"),_T(""));
	temp.Replace(_T("\026"),_T(""));
	temp.Replace(_T("\037"),_T(""));
	return temp;
}
Beispiel #2
0
CString CIrcWnd::StripMessageOfFontCodes(CString sTemp)
{
	sTemp = StripMessageOfColorCodes(sTemp);
	sTemp.Remove(_T('\002')); // 0x02 - BOLD
	//sTemp.Remove(_T('\003')); // 0x03 - COLOUR
	sTemp.Remove(_T('\017')); // 0x0f - RESET
	sTemp.Remove(_T('\026')); // 0x16 - REVERSE/INVERSE was once italic?
	sTemp.Remove(_T('\037')); // 0x1f - UNDERLINE
	return sTemp;
}
Beispiel #3
0
CString CIrcWnd::StripMessageOfColorCodes( CString temp )
{
	if( !temp.IsEmpty() )
	{
		CString temp1, temp2;
		int test = temp.Find( 3 );
		if( test != -1 )
		{
			int testlength = temp.GetLength() - test;
			if( testlength < 2 )
				return temp;
			temp1 = temp.Left( test );
			temp2 = temp.Mid( test + 2);
			if( testlength < 4 )
				return temp1+temp2;
			if( temp2[0] == 44 && temp2.GetLength() > 2)
			{
				temp2 = temp2.Mid(2);
				for( int I = 48; I < 58; I++ )
				{
					if( temp2[0] == I )
						temp2 = temp2.Mid(1);
				}
			}
			else
			{
				for( int I = 48; I < 58; I++ )
				{
					if( temp2[0] == I )
					{
						temp2 = temp2.Mid(1);
						if( temp2[0] == 44 && temp2.GetLength() > 2)
						{
							temp2 = temp2.Mid(2);
							for( int I = 48; I < 58; I++ )
							{
								if( temp2[0] == I )
									temp2 = temp2.Mid(1);
							}
						}
					}
				}
			}
			temp = temp1 + temp2;
			temp = StripMessageOfColorCodes(temp);
		}
	}
	return temp;
}
Beispiel #4
0
CString CIrcWnd::StripMessageOfColorCodes(CString sTemp)
{
	if (!sTemp.IsEmpty())
	{
		CString sTemp1, sTemp2;
		int iTest = sTemp.Find(_T('\003'));
		if (iTest != -1)
		{
			int iTestLength = sTemp.GetLength() - iTest;
			if (iTestLength < 2)
				return sTemp;
			sTemp1 = sTemp.Left(iTest);
			sTemp2 = sTemp.Mid(iTest + 2);
			if (iTestLength < 4)
				return sTemp1 + sTemp2;
			if (sTemp2[0] == _T(',') && sTemp2.GetLength() > 2)
			{
				sTemp2 = sTemp2.Mid(2);
				for (TCHAR iIndex = _T('0'); iIndex <= _T('9'); iIndex++)
				{
					if (sTemp2[0] == iIndex)
						sTemp2 = sTemp2.Mid(1);
				}
			}
			else
			{
				for (TCHAR iIndex = _T('0'); iIndex <= _T('9'); iIndex++)
				{
					if (sTemp2[0] == iIndex)
					{
						sTemp2 = sTemp2.Mid(1);
						if (sTemp2[0] == _T(',') && sTemp2.GetLength() > 2)
						{
							sTemp2 = sTemp2.Mid(2);
							for (TCHAR iIndex = _T('0'); iIndex <= _T('9'); iIndex++)
							{
								if (sTemp2[0] == iIndex)
									sTemp2 = sTemp2.Mid(1);
							}
						}
					}
				}
			}
			sTemp = sTemp1 + sTemp2;
			sTemp = StripMessageOfColorCodes(sTemp);
		}
	}
	return sTemp;
}