示例#1
0
void CALLBACK AboutTimerNotify(HWND hWnd, UINT uMsg, UINT_PTR idEvent, unsigned long dwTime)
{
    HDC AbouthDC = 0;

    switch(uMsg)
    {
        case WM_TIMER:
            AboutPosInText++;
            if((long) AboutPosInText > (long) AboutText.Len())
            {
                AboutPosInText = 1;
                AboutPosOnScreen = 0;
                AbLine1 = AbLine2;
                AbLine2 = AbLine3;
                AbLine3 = AbLine4;
                AbLine4 = AbLine5;
                AbLine5 = AbLine6;
                AbLine6 = AbLine7;
                AbLine7 = AbLine8;
                AbLine8 = "";
            }
            if(strcmp(AboutText.Mid(AboutPosInText, 1).Get_String(), "\r") == 0)
            {
                AboutPosOnScreen = 0;
                AbLine1 = AbLine2;
                AbLine2 = AbLine3;
                AbLine3 = AbLine4;
                AbLine4 = AbLine5;
                AbLine5 = AbLine6;
                AbLine6 = AbLine7;
                AbLine7 = AbLine8;
                AbLine8 = "";
                LetterWidth = 0;
            }
            else
            {
                AbLine8 = AbLine8 + (CStr) AboutText.Mid(AboutPosInText, 1).Get_String();
                LetterWidth = GDIGetTextWidth(AbouthWnd, AboutCourFont8, AboutText.Mid(AboutPosInText, 1));
            }
            AboutPosOnScreen = AboutPosOnScreen + LetterWidth;
            AbouthDC = GetDC(AbouthWnd);
            DisplayTypeWriterLine(AbouthDC, AbLine1, 0, ABOUT_LABELSCOLOR1);
            DisplayTypeWriterLine(AbouthDC, AbLine2, AboutScrollAmount, ABOUT_LABELSCOLOR2);
            DisplayTypeWriterLine(AbouthDC, AbLine3, AboutScrollAmount * 2, ABOUT_LABELSCOLOR3);
            DisplayTypeWriterLine(AbouthDC, AbLine4, AboutScrollAmount * 3, ABOUT_LABELSCOLOR4);
            DisplayTypeWriterLine(AbouthDC, AbLine5, AboutScrollAmount * 4, ABOUT_LABELSCOLOR5);
            DisplayTypeWriterLine(AbouthDC, AbLine6, AboutScrollAmount * 5, ABOUT_LABELSCOLOR6);
            DisplayTypeWriterLine(AbouthDC, AbLine7, AboutScrollAmount * 6, ABOUT_LABELSCOLOR7);
            DisplayTypeWriterLine(AbouthDC, AbLine8, AboutScrollAmount * 7, ABOUT_LABELSCOLOR8);
            GDIWriteClippedText(AbouthDC, AboutPosOnScreen, AboutScrollAmount * 7, GDIGetTextWidth(AbouthWnd, AboutCourFont8, "_"), AboutScrollAmount, "_", ABOUT_LABELSCOLOR8, AboutCourFont8, 0, ABOUT_BACKCOLOR);
            ReleaseDC(AbouthWnd, AbouthDC);
    }
}
示例#2
0
BOOL SetVariable( CStr &varName, CValue value )
{
	VarError.Empty();
	int		pos;
	CValue *val;
	if ( varName.GetLength() > 0 && varName.GetAt(0) == L'[' )
	{
		CStr expression = varName.Mid( 1 );
		CInterpreter parser;
		CValue result = parser.EvaluateExpression( expression, FALSE );

		int subPos = parser.GetErrorPosition();
		if ( parser.GetError() != 0 )
		{
			VarError = CStr( L"Error in variable reference: " ) + parser.GetErrorMessage();
			return FALSE;
		}

		if ( expression[subPos] != L']' )
		{
			VarError = L"Variable reference not closed (missing ']')";
			return FALSE;
		}

		val = GetVariable( (CStr)result, TRUE, &pos );
	}
	else{
		val = GetVariable( varName, TRUE, &pos );
	}

	val->CopyFrom( value );
	return (pos != -1);
}
示例#3
0
int
CIniFile::Split( const CStr &source, LPCTSTR sep, CStrArray &dest, BOOL trim /* = TRUE */ )
{
	int pos = source.Find( sep );
	int startPos = 0;
	CStr elem;
	int sepLen = wcslen( sep );

	dest.RemoveAll();
	while( pos != -1 )
	{
		elem = source.Mid( startPos, pos-startPos );
        if ( trim ) { elem.TrimLeft(); elem.TrimRight(); }
		dest.Add( elem );

		startPos = pos+sepLen;
		pos      = source.Find( sep, startPos );
	}
	elem = source.Mid( startPos );
    if ( trim ) { elem.TrimLeft(); elem.TrimRight(); }
	dest.Add( elem );

	return dest.GetSize();
}
示例#4
0
void
CIniFile::Parse( LPCTSTR cont )
{
	CStr content = cont;
	CStr sectionName, key, value;
    CMapStrToString *section = NULL;
	BOOL hasEmptySection = FALSE;

	Sections.RemoveAll();

	while ( content.GetLength() > 0 )
	{
		CStr line;
		int pos = content.Find( _T("\n") );
		if ( pos != -1 )
		{
			line    = content.Left( pos );
			content = content.Mid( pos+1 );
		}
		else
		{
			line = content;
			content = _T("");
		}
		line.TrimLeft(); line.TrimRight();

		if ( line.GetLength() > 0 && line.GetAt(0) != '#' && line.GetAt(0) != ';' )
		{
			if ( line.GetAt(0) == '[' && line.Right(1) == L"]" )
			{
				sectionName = line.Mid( 1, line.GetLength()-2 );
                sectionName.MakeLower();
                section = new CMapStrToString();
                Sections.SetAt( sectionName, section );
			}
			else
			{
				int eqPos = line.Find( '=' );
				if ( eqPos != -1 )
				{
					key   = line.Left( eqPos );
					key.TrimLeft(); key.TrimRight();
					value = line.Mid( eqPos+1 );
					value.TrimLeft(); value.TrimRight();
					if ( value.Left(1) == L"\"" && value.Right(1) == L"\"" )
					{
						value = value.Mid( 1, value.GetLength()-2 );
					}
					key.MakeLower();
					if ( section == NULL && hasEmptySection == FALSE )
					{
						section = new CMapStrToString();
						Sections.SetAt( L"", section );
						hasEmptySection = TRUE;
					}
					section->SetAt( key, value );
				}
			}
		}
	}
}