BOOL CBCGPTagManager::ParseToolTipParams (const CString& strItem, CBCGPToolTipParams& value) { CBCGPTagManager tm (strItem); CBCGPToolTipParams params; #ifndef _BCGSUITE_ tm.ReadBool (s_TTP_BallonTooltip , params.m_bBallonTooltip); #else tm.ReadBool (s_TTP_BallonTooltip , params.m_bBalloonTooltip); #endif tm.ReadBool (s_TTP_DrawIcon , params.m_bDrawIcon); tm.ReadBool (s_TTP_DrawDescription , params.m_bDrawDescription); tm.ReadInt (s_TTP_MaxDescrWidth , params.m_nMaxDescrWidth); tm.ReadBool (s_TTP_RoundedCorners , params.m_bRoundedCorners); tm.ReadBool (s_TTP_BoldLabel , params.m_bBoldLabel); tm.ReadColor (s_ColorFill , params.m_clrFill); tm.ReadColor (s_ColorFillGradient , params.m_clrFillGradient); tm.ReadInt (s_GradientAngle , params.m_nGradientAngle); tm.ReadColor (s_ColorText , params.m_clrText); tm.ReadColor (s_ColorBorder , params.m_clrBorder); tm.ReadBool (s_TTP_DrawSeparator , params.m_bDrawSeparator); value = params; return TRUE; }
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; }
BOOL CBCGPTagManager::ParseGridColorData (const CString& strItem, BCGP_GRID_COLOR_DATA::ColorData& value) { CBCGPTagManager tm (strItem); value.InitColors (); tm.ReadColor (s_ColorFill , value.m_clrBackground); tm.ReadColor (s_ColorText , value.m_clrText); tm.ReadColor (s_ColorFillGradient, value.m_clrGradient); tm.ReadInt (s_GradientAngle , value.m_nGradientAngle); tm.ReadColor (s_ColorBorder , value.m_clrBorder); return TRUE; }
BOOL CBCGPTagManager::ParseBrush (const CString& strItem, CBCGPBrush& value) { CBCGPTagManager tm (strItem); int type = CBCGPBrush::BCGP_NO_GRADIENT; tm.ReadInt(s_BrushType, type); type = bcg_clamp(type, CBCGPBrush::BCGP_NO_GRADIENT, CBCGPBrush::BCGP_GRADIENT_RADIAL_BOTTOM_RIGHT); int opacity = 255; tm.ReadInt (s_Opacity, opacity); if (type == CBCGPBrush::BCGP_NO_GRADIENT) { CBCGPColor clr; tm.ReadColor (s_BrushColor, clr); value.SetColor (clr, bcg_clamp((double)opacity / 255.0, 0.0, 1.0)); } else { CString strColors; if (tm.ExcludeTag (s_BrushColors, strColors)) { CBCGPTagManager tmColors(strColors); CBCGPColor clr1; tmColors.ReadColor (s_BrushColor, clr1); CBCGPColor clr2; tmColors.ReadColor (s_BrushColor, clr2); value.SetColors (clr1, clr2, (CBCGPBrush::BCGP_GRADIENT_TYPE)type, bcg_clamp((double)opacity / 255.0, 0.0, 1.0)); } } return TRUE; }
void CSetPageBase::InitPropList() { CBCGPTagManager tm; CString strRes(_T("IDR_SETCONFIG_XML_") + m_strConfigName.MakeUpper()); if (!tm.LoadFromResource(strRes, _T("XML"))) { return; } CString strStyle; if (!tm.ExcludeTag(_T("SETCONFIG"), strStyle)) { return; } tm.SetBuffer(strStyle); int nVersion; tm.ReadInt(_T("VERSION"), nVersion); if (nVersion != 1) { return; } CString strPropertys; if (tm.ExcludeTag(_T("PROPERTYS"), strPropertys)) { CBCGPTagManager tmPropertys(strPropertys); CMyBCGPProp* pPropGroup = NULL; CString strProperty; while (tmPropertys.ExcludeTag(_T("PROPERTY"), strProperty)) { CBCGPTagManager tmProperty(strProperty); CString strName = _T("NO NAME"); tmProperty.ReadString(_T("NAME"), strName); BOOL bGroup = FALSE; if (tmProperty.ReadBool(_T("GROUP"), bGroup) && bGroup) { if (pPropGroup) { m_wndPropList.AddProperty(pPropGroup, FALSE, FALSE); pPropGroup = NULL; } pPropGroup = new CMyBCGPProp(strName); } else if (pPropGroup) { CString strType = _T("Combo"); tmProperty.ReadString(_T("TYPE"), strType); if (strType.CompareNoCase(_T("Combo")) == 0) { CString strValue; tmProperty.ReadString(_T("VALUE"), strValue); CMyBCGPProp* pProp = new CMyBCGPProp(strName, (_variant_t)strValue); CString strItem; while (tmProperty.ExcludeTag(_T("ITEM"), strItem)) { CBCGPTagManager tmItem(strItem); tmItem.ReadString(_T("VALUE"), strValue); CString strShort, strPreview; tmItem.ReadString(_T("SHORT"), strShort); tmItem.ReadString(_T("PREVIEW"), strPreview); Entity_Backward(strPreview, s_EntityText); EntityToSymbol(strPreview); pProp->AddComboOption(strValue, strShort, strPreview); } pPropGroup->AddSubItem(pProp); } else if (strType.CompareNoCase(_T("Number")) == 0) { int nValue; tmProperty.ReadInt(_T("VALUE"), nValue); CMyBCGPProp* pProp = new CMyBCGPProp(strName, (_variant_t)nValue); CSize range; tmProperty.ReadSize(_T("RANGE"), range); BOOL bBuddy = FALSE; tmProperty.ReadBool(_T("BUDDY"), bBuddy); CMyBCGPProp* pPropBuddy = NULL; if (bBuddy) { pPropBuddy = DYNAMIC_DOWNCAST(CMyBCGPProp, pPropGroup->GetSubItem(pPropGroup->GetSubItemsCount() - 1)); } CString strShort, strPreview; tmProperty.ReadString(_T("SHORT"), strShort); tmProperty.ReadString(_T("PREVIEW"), strPreview); Entity_Backward(strPreview, s_EntityText); EntityToSymbol(strPreview); pProp->SetNumberSpin(range.cx, range.cy, strShort, strPreview, pPropBuddy); pPropGroup->AddSubItem(pProp); } else if (strType.CompareNoCase(_T("Text")) == 0) { CString strValue; tmProperty.ReadString(_T("VALUE"), strValue); CMyBCGPProp* pProp = new CMyBCGPProp(strName, (_variant_t)strValue); CString strShort, strPreview; tmProperty.ReadString(_T("SHORT"), strShort); tmProperty.ReadString(_T("PREVIEW"), strPreview); Entity_Backward(strPreview, s_EntityText); EntityToSymbol(strPreview); pProp->SetEditText(strShort, strPreview); pPropGroup->AddSubItem(pProp); } } } if (pPropGroup) { m_wndPropList.AddProperty(pPropGroup, FALSE, FALSE); pPropGroup = NULL; } } }
BOOL CBCGPTagManager::ParseFont (const CString& strItem, LOGFONT& value) { CBCGPTagManager tm (strItem); CString strFontItem; if (tm.ExcludeTag (s_FaceName, strFontItem)) { ASSERT(!strFontItem.IsEmpty ()); if (!strFontItem.IsEmpty ()) { memcpy (value.lfFaceName, (LPCTSTR)strFontItem, min(strFontItem.GetLength (), LF_FACESIZE) * sizeof(TCHAR)); } } int val = 0; if (tm.ReadInt (s_Height, val)) { value.lfHeight = val; } if (value.lfHeight > 0) { if (tm.ReadInt (s_Width, val)) { value.lfWidth = val; } } if (tm.ExcludeTag (s_Weight, strFontItem)) { struct WEIGHT_FONT_TYPE { LPCTSTR name; LONG weight; }; const WEIGHT_FONT_TYPE WEIGHT_FONT_TYPES[] = { {_T("DONTCARE") , FW_DONTCARE }, {_T("THIN") , FW_THIN }, {_T("EXTRALIGHT"), FW_EXTRALIGHT}, {_T("LIGHT") , FW_LIGHT }, {_T("NORMAL") , FW_NORMAL }, {_T("MEDIUM") , FW_MEDIUM }, {_T("SEMIBOLD") , FW_SEMIBOLD }, {_T("BOLD") , FW_BOLD }, {_T("EXTRABOLD") , FW_EXTRABOLD }, {_T("HEAVY") , FW_HEAVY }, {_T("ULTRALIGHT"), FW_ULTRALIGHT}, {_T("REGULAR") , FW_REGULAR }, {_T("DEMIBOLD") , FW_DEMIBOLD }, {_T("ULTRABOLD") , FW_ULTRABOLD }, {_T("BLACK") , FW_BLACK } }; for(long i = 0; i < sizeof(WEIGHT_FONT_TYPES) / sizeof(WEIGHT_FONT_TYPE); i++) { if(strFontItem.CompareNoCase (WEIGHT_FONT_TYPES[i].name) == 0) { value.lfWeight = WEIGHT_FONT_TYPES[i].weight; break; } } } if(tm.ExcludeTag (s_Quality, strFontItem)) { struct QUALITY_FONT_TYPE { LPCTSTR name; BYTE quality; }; const QUALITY_FONT_TYPE QUALITY_FONT_TYPES[] = { {_T("DEFAULT") , DEFAULT_QUALITY }, {_T("DRAFT") , DRAFT_QUALITY }, {_T("PROOF") , PROOF_QUALITY }, {_T("NONANTIALIASED") , NONANTIALIASED_QUALITY }, {_T("ANTIALIASED") , ANTIALIASED_QUALITY }, {_T("CLEARTYPE") , 5},//CLEARTYPE_QUALITY {_T("CLEARTYPE_NATURAL"), 6} //CLEARTYPE_NATURAL_QUALITY }; for(long i = 0; i < sizeof(QUALITY_FONT_TYPES) / sizeof(QUALITY_FONT_TYPE); i++) { if(strFontItem.CompareNoCase (QUALITY_FONT_TYPES[i].name) == 0) { if (QUALITY_FONT_TYPES[i].quality <= ANTIALIASED_QUALITY) { value.lfQuality = QUALITY_FONT_TYPES[i].quality; } else { OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ::GetVersionEx (&osvi); if(osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5) { value.lfQuality = QUALITY_FONT_TYPES[i].quality; } } break; } } } return TRUE; }