コード例 #1
0
BOOL CBCGPTagManager::ParseTextFormat (const CString& strItem, CBCGPTextFormat& value)
{
	CBCGPTagManager tm (strItem);

	CString family;
	tm.ReadString (s_TextFormatFamily, family);
	if (family.IsEmpty ())
	{
		return FALSE;
	}

	double size = 0.0;
	tm.ReadDouble (s_TextFormatSize, size);
	if (size == 0.0)
	{
		return FALSE;
	}

	int nValue = 0;
	tm.ReadInt (s_TextFormatWeight, nValue);
	long weight = (long)bcg_clamp(nValue, FW_THIN, FW_HEAVY);

	nValue = (int)CBCGPTextFormat::BCGP_FONT_STYLE_NORMAL;
	tm.ReadInt (s_TextFormatStyle, nValue);
	CBCGPTextFormat::BCGP_FONT_STYLE style = (CBCGPTextFormat::BCGP_FONT_STYLE)
		bcg_clamp(nValue, (int)CBCGPTextFormat::BCGP_FONT_STYLE_NORMAL, (int)CBCGPTextFormat::BCGP_FONT_STYLE_ITALIC);

	CString locale;
	tm.ReadString (s_TextFormatLocale, locale);

	CBCGPTextFormat format(family, (float)size, weight, style, locale);

	nValue = (int)CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_LEADING;
	tm.ReadInt (s_TextFormatAlignHorz, nValue);
	format.SetTextAlignment ((CBCGPTextFormat::BCGP_TEXT_ALIGNMENT)
		bcg_clamp(nValue, (int)CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_LEADING, (int)CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER));

	nValue = (int)CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_LEADING;
	tm.ReadInt (s_TextFormatAlignVert, nValue);
	format.SetTextVerticalAlignment ((CBCGPTextFormat::BCGP_TEXT_ALIGNMENT)
		bcg_clamp(nValue, (int)CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_LEADING, (int)CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER));

	BOOL bValue = FALSE;
	tm.ReadBool (s_TextFormatWordWrap, bValue);
	format.SetWordWrap (bValue);

	bValue = FALSE;
	tm.ReadBool (s_TextFormatClipping, bValue);
	format.SetClipText (bValue);

	double dValue = 0.0;
	tm.ReadDouble (s_TextFormatAngle, dValue);
	format.SetDrawingAngle (dValue);

	value = format;

	return TRUE;
}
コード例 #2
0
ファイル: BCGPBaseInfo.cpp プロジェクト: iclosure/jframework
CBCGPBaseInfo::XBase* CBCGPBaseInfo::CreateBaseFromTag (const CString& tag, XCreateBaseFromNameProc lpCreateProc)
{
	if (lpCreateProc == NULL)
	{
		ASSERT(FALSE);
		return NULL;
	}

	CBCGPBaseInfo::XBase* base = NULL;

	CString strElementName;
	{
		CBCGPTagManager tm (tag);
		tm.ReadString (CBCGPBaseInfo::s_szTag_ElementName, strElementName);
	}

	if (!strElementName.IsEmpty ())
	{
		base = (lpCreateProc)(strElementName);
		if (base != NULL)
		{
			base->FromTag (tag);
		}
	}

	return base;
}
コード例 #3
0
ファイル: BCGPBaseInfo.cpp プロジェクト: iclosure/jframework
BOOL CBCGPBaseInfo::XID::FromTag (const CString& strTag)
{
	CBCGPTagManager tm (strTag);

	BOOL bResult = tm.ReadString (s_szTag_Name, m_Name);

	if (tm.ReadUInt (s_szTag_Value, m_Value))
	{
		bResult = TRUE;
	}

	return bResult;
}