예제 #1
0
ALERROR CTextEffectCreator::OnEffectCreateFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc, const CString &sUNID)

//	OnEffectCreateFromXML
//
//	Loads the effect from XML

	{
	m_sDefaultText = strCEscapeCodes(pDesc->GetAttribute(TEXT_ATTRIB));

	m_pFont = g_pUniverse->GetFont(pDesc->GetAttribute(FONT_ATTRIB));
	if (m_pFont == NULL)
		{
		Ctx.sError = strPatternSubst(CONSTLIT("Unknown font: %s"), pDesc->GetAttribute(FONT_ATTRIB));
		return ERR_FAIL;
		}

	m_wPrimaryColor = ::LoadRGBColor(pDesc->GetAttribute(PRIMARY_COLOR_ATTRIB));
	m_dwAlignment = CG16bitFont::AlignCenter;
	m_byOpacity = pDesc->GetAttributeIntegerBounded(OPACITY_ATTRIB, 0, 255, 255);

	return NOERROR;
	}
예제 #2
0
bool CCodeChainCtx::RunEvalString (const CString &sString, bool bPlain, CString *retsResult)

//	RunString
//
//	If sString starts with '=' or if bPlain is TRUE, then we evaluate sString as an
//	expression. If success (no error) we return TRUE. Otherwise, we return FALSE and
//	the error is in retsResult.

	{
	char *pPos = sString.GetPointer();

	if (bPlain || *pPos == '=')
		{
		ICCItem *pExp = Link(sString, (bPlain ? 0 : 1), NULL);

		ICCItem *pResult = Run(pExp);	//	LATER:Event
		Discard(pExp);

		if (pResult->IsError())
			{
			*retsResult = pResult->GetStringValue();
			Discard(pResult);
			return false;
			}

		//	Note: We use GetStringValue instead of Unlink because we don't
		//	want to preserve CC semantics (e.g., we don't need strings to
		//	be quoted).

		*retsResult = pResult->GetStringValue();
		Discard(pResult);
		return true;
		}
	else
		{
		*retsResult = strCEscapeCodes(sString);
		return true;
		}
	}