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::ParseRect (const CString& strItem, CRect& value) { CBCGPTagManager tm (strItem); CString str1; CString str2; tm.ExcludeTag (s_Offset, str1); str1.TrimLeft (); str1.TrimRight (); tm.ExcludeTag (s_Size, str2); str2.TrimLeft (); str2.TrimRight (); CPoint pt (0, 0); CSize sz (0, 0); if (ParsePoint (str1, pt) && ParseSize (str2, sz)) { value = CRect (pt, sz); return TRUE; } tm.SetBuffer (strItem); tm.ExcludeTag (s_LT, str1); str1.TrimLeft (); str1.TrimRight (); tm.ExcludeTag (s_RB, str2); str2.TrimLeft (); str2.TrimRight (); CPoint pt2 (0, 0); if (ParsePoint (str1, pt) && ParsePoint (str2, pt2)) { value = CRect (pt, pt2); return TRUE; } CStringArray sa; CString strL, strT, strR, strB; tm.SetBuffer (strItem); tm.ExcludeTag (s_Left, strL); strL.TrimLeft (); strL.TrimRight (); tm.ExcludeTag (s_Top, strT); strT.TrimLeft (); strT.TrimRight (); tm.ExcludeTag (s_Right, strR); strR.TrimLeft (); strR.TrimRight (); tm.ExcludeTag (s_Bottom, strB); strB.TrimLeft (); strB.TrimRight (); if (strL.IsEmpty () || strT.IsEmpty () || strR.IsEmpty () || strB.IsEmpty ()) { if (!ParseString (tm.GetBuffer (), _T(","), sa, TRUE, FALSE)) { return FALSE; } } else { sa.Add (strL); sa.Add (strT); sa.Add (strR); sa.Add (strB); } if (sa.GetSize () == 4) { value.left = _ttol(sa[0]); value.top = _ttol(sa[1]); value.right = _ttol(sa[2]); value.bottom = _ttol(sa[3]); return TRUE; } return FALSE; }