Пример #1
0
// 统计各类规则数量
int CDlgAddCheckRule::GetRuleCount(HTREEITEM item)
{
	if (!m_treeCheckRule.ItemHasChildren(item))
	{
		return 1;
	}
	
	int nCount = 0;
	
	HTREEITEM itemChild;
	itemChild = m_treeCheckRule.GetChildItem(item);
	nCount += GetRuleCount(itemChild);

	while (1)
	{
		itemChild = m_treeCheckRule.GetNextSiblingItem(itemChild);
		if (!itemChild)
			break;
		nCount += GetRuleCount(itemChild);
	}

	CString strItemText = m_treeCheckRule.GetItemText(item);
	strItemText.Format(L"%s(%d)", strItemText, nCount);
	m_treeCheckRule.SetItemText(item, strItemText);
	return nCount;
}
void CTDLFindTaskExpressionListCtrl::BuildListCtrl()
{
	DeleteAllItems();

	for (int nParam = 0; nParam < GetRuleCount(); nParam++)
	{
		const SEARCHPARAM& sp = m_aSearchParams[nParam];

		// attrib
		CString sAttrib = m_cbAttributes.GetAttributeName(sp);
		int nItem = InsertItem(nParam, sAttrib);

		// operator
		CString sOp = GetOpName(sp.GetOperator());
		SetItemText(nItem, OPERATOR, sOp);

		// value
		UpdateValueColumnText(nItem);

		// and/or (but not for last row)
		if (nParam < GetRuleCount() - 1)
		{
			CEnString sAndOr(sp.GetAnd() ? IDS_FP_AND : IDS_FP_OR);
			SetItemText(nItem, ANDOR, sAndOr);
		}
	}

	ValidateListData();
	SetCurSel(0);
}
BOOL CTDLFindTaskExpressionListCtrl::DeleteSelectedCell()
{
	int nRow, nCol;
	GetCurSel(nRow, nCol);

	if (nRow < GetRuleCount())
	{
		if (nCol == ATTRIB)
		{
			CInputListCtrl::DeleteSelectedCell();
			m_aSearchParams.RemoveAt(nRow);

			ValidateListData();
			SetCurSel(nRow);

			return TRUE;
		}
		else if (nCol == VALUE) // clear text
		{
			SetItemText(nRow, nCol, _T(""));
			m_aSearchParams[nRow].ClearValue();
		}
	}
	
	// else
	return FALSE;
}
void CTDLFindTaskExpressionListCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	int nItem, nCol;
	GetCurSel(nItem, nCol);
	
	if (GetRuleCount() > 0 || nCol == ATTRIB)
	{
		// if the user typed an alphanumeric char then begin editing automatically
		// numeric keys only work for value column
		if (isalpha(nChar) || (nCol == VALUE && isdigit(nChar)))
		{
			EditCell(nItem, nCol);

			// forward key down on to edit control
			CWnd* pEdit = GetEditControl(nItem, nCol);

			if (pEdit)
			{
				pEdit->PostMessage(WM_CHAR, nChar, MAKELPARAM(nRepCnt, nFlags));
				return; // eat it
			}
		}
	}
	
	CInputListCtrl::OnChar(nChar, nRepCnt, nFlags);
}
CWnd* CTDLFindTaskExpressionListCtrl::GetEditControl(int nItem, int nCol)
{
	if (nItem < 0 || nItem > GetRuleCount() || nCol > ANDOR)
		return NULL;

	const SEARCHPARAM& sp = m_aSearchParams[nItem];

	switch (nCol)
	{
	case ATTRIB:
		return &m_cbAttributes;

	case OPERATOR:
		if (!sp.AttributeIs(TDCA_NONE))
		{
			return &m_cbOperators;
		}
		break;

	case VALUE:
		if (sp.OperatorIs(FO_SET) || sp.OperatorIs(FO_NOT_SET))
		{
			// handled by operator
		}
		else
		{
			FIND_ATTRIBTYPE nType = sp.GetAttribType();

			switch (nType)
			{
			case FT_DATE:
				return &m_dtDate;

			case FT_TIME:
				return &m_eTime;

			case FT_BOOL:
				// do nothing: it's handled by the operator
				break;

			case FT_NONE:
				// do nothing.
				break;

			case FT_STRING:
			case FT_DATE_REL:
			default:
				return CInputListCtrl::GetEditControl();
			}
		}
		break;

	case ANDOR:
		return &m_cbAndOr;
	}

	// all else
	return NULL;
}
void CTDLFindTaskExpressionListCtrl::RefreshAndOrColumnText()
{
	for (int nParam = 0; nParam < GetRuleCount(); nParam++)
	{
		const SEARCHPARAM& sp = m_aSearchParams[nParam];
		
		// and/or (but not for last row)
		if (nParam < GetRuleCount() - 1)
		{
			CEnString sAndOr(sp.GetAnd() ? IDS_FP_AND : IDS_FP_OR);
			SetItemText(nParam, ANDOR, sAndOr);
		}
		else
		{
			SetItemText(nParam, ANDOR, _T(""));
		}
	}
}
IL_COLUMNTYPE CTDLFindTaskExpressionListCtrl::GetCellType(int nRow, int nCol) const
{
	if (nRow < 0 || nRow >= GetRuleCount() || nCol > ANDOR)
	{
		return CInputListCtrl::GetCellType(nRow, nCol);
	}

	const SEARCHPARAM& sp = m_aSearchParams[nRow];

	switch (nCol)
	{
	case ATTRIB:
		return ILCT_DROPLIST;

	case OPERATOR:
		if (!sp.AttributeIs(TDCA_NONE))
		{
			return ILCT_DROPLIST;
		}
		break;

	case VALUE:
		if (sp.OperatorIs(FO_SET) || sp.OperatorIs(FO_NOT_SET))
		{
			// handled by operator
		}
		else
		{
			switch (sp.GetAttribType())
			{
			case FT_DATE:
				return ILCT_DATE;

			case FT_TIME:
				// do nothing.
				break;

			case FT_BOOL:
				// do nothing: it's handled by the operator
				break;

			case FT_NONE:
				// do nothing.
				break;
			}
		}
		break;

	case ANDOR:
		return ILCT_DROPLIST;
	}

	// all else
	return CInputListCtrl::GetCellType(nRow, nCol);
}
BOOL CTDLFindTaskExpressionListCtrl::AddRule()
{
	SEARCHPARAM sp(TDCA_TASKNAMEORCOMMENTS, FOP_INCLUDES);

	int nRow = InsertRule(GetRuleCount(), sp);

	// make sure the 'and/or' text of the preceding rule is set
	RefreshAndOrColumnText();

	SetCurSel(nRow, ATTRIB);
	EnsureVisible(nRow, FALSE);

	return TRUE;
}
void CTDLFindTaskExpressionListCtrl::EditCell(int nItem, int nCol)
{
	// handle new rules
	if (nItem == GetRuleCount() && nCol == ATTRIB)
		AddRule();

	CWnd* pEdit = GetEditControl(nItem, nCol);
	ASSERT (pEdit);

	if (!pEdit)
		return;

	const SEARCHPARAM& sp = m_aSearchParams[nItem];

	switch (nCol)
	{
	case ATTRIB:
	case OPERATOR:
	case ANDOR:
		ShowControl(*pEdit, nItem, nCol);
		break;

	case VALUE:
		if (sp.GetOperator() != FOP_SET && sp.GetOperator() != FOP_NOT_SET)
		{
			switch (sp.GetAttribType())
			{
			case FT_DATE:
			case FT_TIME:
				ShowControl(*pEdit, nItem, nCol);
				break;

			default:
				PrepareEdit(nItem, nCol);

				if (pEdit == &m_editBox)
					CInputListCtrl::EditCell(nItem, nCol);
				else
					ShowControl(*pEdit, nItem, nCol);
			}
		}
		break;
	}
}
BOOL CTDLFindTaskExpressionListCtrl::AddRule()
{
	SEARCHPARAM sp(TDCA_TASKNAMEORCOMMENTS, FO_INCLUDES);

	int nRow = InsertRule(GetRuleCount(), sp);

	// make sure the 'and/or' text of the preceding rule is set
	if (nRow > 0)
	{
		SEARCHPARAM& spPrev = m_aSearchParams[nRow - 1];
		CEnString sAndOr(spPrev.GetAnd() ? IDS_FP_AND : IDS_FP_OR);
		SetItemText(nRow - 1, ANDOR, sAndOr);
	}

	SetCurSel(nRow, ATTRIB);
	EnsureVisible(nRow, FALSE);

	return TRUE;
}
int CTDLFindTaskExpressionListCtrl::InsertRule(int nRow, const SEARCHPARAM& sp)
{
	m_aSearchParams.InsertAt(nRow, sp);

	CString sItem = m_cbAttributes.GetAttributeName(sp);
	int nNew = InsertItem(nRow, sItem);

	SetItemText(nNew, OPERATOR, GetOpName(sp.GetOperator()));

	UpdateValueColumnText(nRow);
	
	// omit and/or for last rule
	if (nRow < GetRuleCount() - 1)
	{
		CEnString sAndOr(sp.GetAnd() ? IDS_FP_AND : IDS_FP_OR);
		SetItemText(nNew, ANDOR, sAndOr);
	}

	return nNew;
}
void CTDLFindTaskExpressionListCtrl::ValidateListData() const
{
#ifdef _DEBUG
	for (int nRule = 0; nRule < GetRuleCount(); nRule++)
	{
		const SEARCHPARAM& rule = m_aSearchParams[nRule];

		// check matching attribute text 
		CString sRuleAttrib = m_cbAttributes.GetAttributeName(rule);
		CString sListAttrib = GetItemText(nRule, ATTRIB);
		ASSERT (sRuleAttrib == sListAttrib);

		// check matching operator text 
		CString sRuleOp = GetOpName(rule.GetOperator());
		CString sListOp = GetItemText(nRule, OPERATOR);
		ASSERT (sListOp.IsEmpty() || sRuleOp == sListOp);

		// check valid operator
		ASSERT(rule.HasValidOperator());
	}
#endif
}
void CTDLFindTaskExpressionListCtrl::PrepareControl(CWnd& ctrl, int nRow, int nCol)
{
	UNREFERENCED_PARAMETER(ctrl);

	if (!GetRuleCount())
		return;

	SEARCHPARAM& sp = m_aSearchParams[nRow];

	switch (nCol)
	{
	case ATTRIB:
		{
			ASSERT (&ctrl == &m_cbAttributes);
	
			m_cbAttributes.SelectAttribute(sp);
			CDialogHelper::RefreshMaxDropWidth(m_cbAttributes);
		}
		break;

	case OPERATOR:
		{
			ASSERT (&ctrl == &m_cbOperators);

			m_cbOperators.ResetContent();
			
			FIND_ATTRIBTYPE nType = sp.GetAttribType();
			
			switch (nType)
			{
			case FT_STRING:
				AddOperatorToCombo(FOP_SET);
				AddOperatorToCombo(FOP_NOT_SET);
				AddOperatorToCombo(FOP_EQUALS);
				AddOperatorToCombo(FOP_NOT_EQUALS);
				AddOperatorToCombo(FOP_INCLUDES);
				AddOperatorToCombo(FOP_NOT_INCLUDES);
				break;

			case FT_INTEGER:
			case FT_DOUBLE:
			case FT_TIME:
				AddOperatorToCombo(FOP_SET);
				AddOperatorToCombo(FOP_NOT_SET);
				AddOperatorToCombo(FOP_EQUALS);
				AddOperatorToCombo(FOP_NOT_EQUALS);
				AddOperatorToCombo(FOP_GREATER);
				AddOperatorToCombo(FOP_GREATER_OR_EQUAL);
				AddOperatorToCombo(FOP_LESS);
				AddOperatorToCombo(FOP_LESS_OR_EQUAL);
				break;

			case FT_DATE:
				AddOperatorToCombo(FOP_SET);
				AddOperatorToCombo(FOP_NOT_SET);
				// fall thru
			case FT_DATE_REL:
				AddOperatorToCombo(FOP_EQUALS);
				AddOperatorToCombo(FOP_NOT_EQUALS);
				AddOperatorToCombo(FOP_AFTER);
				AddOperatorToCombo(FOP_ON_OR_AFTER);
				AddOperatorToCombo(FOP_BEFORE);
				AddOperatorToCombo(FOP_ON_OR_BEFORE);
				break;

			case FT_BOOL:
				AddOperatorToCombo(FOP_SET);
				AddOperatorToCombo(FOP_NOT_SET);
				break;
			}
	
			CDialogHelper::SelectItemByData(m_cbOperators, (DWORD)sp.GetOperator());
		}
		break;

	case ANDOR:
		{
			ASSERT (&ctrl == &m_cbAndOr);

			if (sp.GetAnd())
				m_cbAndOr.SelectString(-1, CEnString(IDS_FP_AND));
			else
				m_cbAndOr.SelectString(-1, CEnString(IDS_FP_OR));
		}
		break;

	case VALUE:
		if (&ctrl == &m_dtcDate)
		{
			// if the rule does not yet have a date then set it now to
			// the current date because that's whats the date ctrl will default to
			if (!CDateHelper::IsDateSet(sp.ValueAsDate()))
			{
				sp.SetValue(COleDateTime::GetCurrentTime());
				SetItemText(nRow, nCol, sp.ValueAsDate().Format(VAR_DATEVALUEONLY));
			}
			else
			{
				m_dtcDate.SetTime(sp.ValueAsDouble());
			}
		}
		else if (&ctrl == &m_eTime)
		{
			m_eTime.SetTime(sp.ValueAsDouble(), (TCHAR)sp.GetFlags());
		}
		else if (&ctrl == &m_cbListValues)
		{
			m_cbListValues.ResetContent();

			TDCCUSTOMATTRIBUTEDEFINITION attribDef;

			if (CTDCCustomAttributeHelper::GetAttributeDef(sp.GetAttribute(), m_aAttribDefs, attribDef))
			{
				if (attribDef.IsList())
				{
					int nItem = attribDef.aDefaultListData.GetSize();

					while (nItem--)
						m_cbListValues.AddString(attribDef.aDefaultListData[nItem]);
					
					nItem = attribDef.aAutoListData.GetSize();

					while (nItem--)
						m_cbListValues.AddString(attribDef.aAutoListData[nItem]);
				}
			}
			else
			{
				switch (sp.GetAttribute())
				{
				case TDCA_CATEGORY: CDialogHelper::SetComboBoxItems(m_cbListValues, m_tldListContents.aCategory); break;
				case TDCA_ALLOCTO:	CDialogHelper::SetComboBoxItems(m_cbListValues, m_tldListContents.aAllocTo); break;
				case TDCA_ALLOCBY:	CDialogHelper::SetComboBoxItems(m_cbListValues, m_tldListContents.aAllocBy); break;
				case TDCA_VERSION:	CDialogHelper::SetComboBoxItems(m_cbListValues, m_tldListContents.aVersion); break;
				case TDCA_TAGS:		CDialogHelper::SetComboBoxItems(m_cbListValues, m_tldListContents.aTags); break;
				case TDCA_STATUS:	CDialogHelper::SetComboBoxItems(m_cbListValues, m_tldListContents.aStatus); break;
				}
			}

			m_cbListValues.SelectString(0, sp.ValueAsString());
		}
		else if (&ctrl == &m_cbPriority)
		{
			m_cbPriority.SetSelectedPriority(sp.ValueAsInteger());
		}
		else if (&ctrl == &m_cbRisk)
		{
			m_cbRisk.SetSelectedRisk(sp.ValueAsInteger());
		}
		break;
	}
}
BOOL CTDLFindTaskExpressionListCtrl::CanMoveSelectedRuleDown() const
{
	return (GetCurSel() < GetRuleCount() - 1);
}
BOOL CTDLFindTaskExpressionListCtrl::CanMoveSelectedRuleUp() const
{
	int nRow = GetCurSel();

	return (nRow > 0 && nRow < GetRuleCount());
}
IL_COLUMNTYPE CTDLFindTaskExpressionListCtrl::GetCellType(int nRow, int nCol) const
{
	if (nRow < 0 || nRow >= GetRuleCount() || nCol > ANDOR)
	{
		return CInputListCtrl::GetCellType(nRow, nCol);
	}

	const SEARCHPARAM& sp = m_aSearchParams[nRow];

	switch (nCol)
	{
	case ATTRIB:
		return ILCT_DROPLIST;

	case OPERATOR:
		if (!sp.AttributeIs(TDCA_NONE))
		{
			return ILCT_DROPLIST;
		}
		break;

	case VALUE:
		if (sp.OperatorIs(FOP_SET) || sp.OperatorIs(FOP_NOT_SET))
		{
			// handled by operator
		}
		else
		{
			switch (sp.GetAttribType())
			{
			case FT_DATE:
				return ILCT_DATE;

			case FT_TIME:
				// do nothing.
				break;

			case FT_BOOL:
				// do nothing: it's handled by the operator
				break;

			case FT_NONE:
				// do nothing.
				break;

			default:
				{
					TDC_ATTRIBUTE nAttrib = sp.GetAttribute();

					switch (nAttrib)
					{
					case TDCA_ALLOCTO:
					case TDCA_ALLOCBY:
					case TDCA_STATUS:
					case TDCA_CATEGORY:
					case TDCA_VERSION:
					case TDCA_TAGS: 
					case TDCA_PRIORITY:
					case TDCA_RISK:
						return ILCT_DROPLIST;

					default:
						{
							TDCCUSTOMATTRIBUTEDEFINITION attribDef;

							if (CTDCCustomAttributeHelper::GetAttributeDef(nAttrib, m_aAttribDefs, attribDef))
							{
								if (attribDef.IsList())
									return ILCT_DROPLIST;
							}
						}
						break;
					}
				}
			}
		}
		break;

	case ANDOR:
		return ILCT_DROPLIST;
	}

	// all else
	return CInputListCtrl::GetCellType(nRow, nCol);
}
CWnd* CTDLFindTaskExpressionListCtrl::GetEditControl(int nItem, int nCol)
{
	if (nItem < 0 || nItem > GetRuleCount() || nCol > ANDOR)
		return NULL;

	const SEARCHPARAM& sp = m_aSearchParams[nItem];

	switch (nCol)
	{
	case ATTRIB:
		return &m_cbAttributes;

	case OPERATOR:
		if (!sp.AttributeIs(TDCA_NONE))
		{
			return &m_cbOperators;
		}
		break;

	case VALUE:
		if (sp.OperatorIs(FOP_SET) || sp.OperatorIs(FOP_NOT_SET))
		{
			// handled by operator
		}
		else
		{
			FIND_ATTRIBTYPE nType = sp.GetAttribType();

			switch (nType)
			{
			case FT_DATE:
				return &m_dtcDate;

			case FT_TIME:
				return &m_eTime;

			case FT_BOOL:
				// do nothing: it's handled by the operator
				break;

			case FT_NONE:
				// do nothing.
				break;

			default:
				switch (sp.GetAttribute())
				{
				case TDCA_ALLOCTO:
				case TDCA_ALLOCBY:
				case TDCA_STATUS:
				case TDCA_CATEGORY:
				case TDCA_VERSION:
				case TDCA_TAGS: 
					return &m_cbListValues;

				case TDCA_PRIORITY:
					return &m_cbPriority;

				case TDCA_RISK:
					return &m_cbRisk;

				default:
					{
						TDCCUSTOMATTRIBUTEDEFINITION attribDef;

						if (CTDCCustomAttributeHelper::GetAttributeDef(sp.GetAttribute(), m_aAttribDefs, attribDef))
						{
							if (attribDef.IsList())
								return &m_cbListValues;
						}
					}
					break;
				}

				// all else
				return CInputListCtrl::GetEditControl();
			}
		}
		break;

	case ANDOR:
		return &m_cbAndOr;
	}

	// all else
	return NULL;
}
Пример #18
0
//===================================================================================================
// 初始化对话框
//===================================================================================================
BOOL CDlgAddCheckRule::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_imageRuleNode.Create(IDB_BMP_RULESNODE, 16, 5, RGB(0, 255, 0));
	m_treeCheckRule.SetImageList(&m_imageRuleNode, TVSIL_NORMAL);

	// 初始化导航树显示文本
	HTREEITEM hRoot;		// 树的根节点句柄
	HTREEITEM hFirst;		// 树的一级子节点句柄
	HTREEITEM hSecond;		// 树的二级子节点句柄
	HTREEITEM hThird;		// 树的三级子节点句柄

	hRoot = m_treeCheckRule.InsertItem(L"检查规则库", -1, -1, TVI_ROOT);

	if (CheckValidLicenseByRules_MdlAttr())
	{
		hFirst = m_treeCheckRule.InsertItem(L"模型属性检查", 0, 1, hRoot);
		hSecond = m_treeCheckRule.InsertItem(L"基本属性", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlName, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MDL_NAME);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_CommonName, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MDL_COMMON_NAME);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_Unit, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_UNIT);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_Tol, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_TOL);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlByte, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MDL_BYTE);
		}
		hSecond = m_treeCheckRule.InsertItem(L"参数属性", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ParaNotExist, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_PARA_NOTEXIST);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ParaExist, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_PARA_EXIST);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ParaNull, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_PARA_NULL);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ParaNotNull, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_PARA_NOTNULL);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ParaKeyword, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_PARA_KEYWORD);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ParaSpecifiedValue, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_PARA_SPECIFIEDVALUE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ParaValue, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_PARA_VALUE);
		}
		hSecond = m_treeCheckRule.InsertItem(L"质量属性", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_Quality, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_QUALITY);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_QualityProperty, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_QUALITY_PROPERTY);
		}
		hSecond = m_treeCheckRule.InsertItem(L"材料属性", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_Mat, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MAT);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlDensityValid, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MDL_DENSVALID);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlMatSystem, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MDL_MATSYSTEM);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlMatDens, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MDL_MATDENS);
		}
		hSecond = m_treeCheckRule.InsertItem(L"外观属性", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_Appearance, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_APPEARANCE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ColorSystem, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_MDL_COLORSYSTEM);
		}
#if !(defined(DOCTOR_PROE3) || defined(DOCTOR_PROE4))
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlTemplate, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_MDL_TEMPLATE);
#endif
		if (g_strCustomCode.CompareNoCase(L"GX") == 0)
		{
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_HomeMadePartName_GX, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_HOMEMADE_PARTNAME_GX);
		}
	}

	if (CheckValidLicenseByRules_MdlSpec())
	{
		hFirst = m_treeCheckRule.InsertItem(L"建模规范性检查", 0, 1, hRoot);
		hSecond = m_treeCheckRule.InsertItem(L"特征规范", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FeaName,  2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_FEA_NAME);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FeaSystem, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_FEA_SYSTEM);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FeaIllegalRef, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FEA_ILLEGAL_REF);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FeaForLast, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FEA_FOR_LAST);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FeaNotReferenceEdge, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FEA_NOT_REFERENCE_EDGE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_NonSolidFeaHideCheck, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_NON_SOLID_FEA_HIDE_CHECK);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_SolidFeaHideCheck, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_SOLID_FEA_HIDE_CHECK);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlCmd, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_MDL_CMD);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FeaNoExternalRef, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FEA_NO_EXTERNAL_REF);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_UnusedSketch, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_UNUSED_SKETCH);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_UnusedDatum, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_UNUSED_DATUM);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlDatum, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_MDL_DATUM);
		}
		hSecond = m_treeCheckRule.InsertItem(L"族表规范", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FamInstValid, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FAM_INSTVALID);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FamInstName, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FAM_INSTNAME);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FamInstCommonName, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FAM_INSTCOMMONNAME);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FamInstParaValid, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FAM_INSTPARAVALID);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FamInstAsm, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FAM_INSTASM);
		}
		hSecond = m_treeCheckRule.InsertItem(L"装配规范", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FamAssemble, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_FAM_ASSEMBLE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AsmConstraints, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_ASM_CONSTRAINTS);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AsmSkel, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_ASM_SKEL);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AsmHide, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_ASM_HIDE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AsmImplicit, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_ASM_IMPLICIT);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AsmRef, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_ASM_REF);
		}
		hSecond = m_treeCheckRule.InsertItem(L"视图规范", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_LayerState, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_LAYER_STATE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlSimpRep, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ASS_MDL_SIMPREP);
		}
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlRegenerate, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_ASS_MDL_REGENERATE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_MdlRelation, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_ASS_MDL_RELATION);

#if !(defined(DOCTOR_PROE3) || defined(DOCTOR_PROE4))
		if (g_strCustomCode.CompareNoCase(L"505") == 0)
		{
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AsmSystem_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_ASMSYSETM_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_PointFeature_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_POINTFEATURE_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_PubGeom_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_PUB_GEOM_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FieldView_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_FIELDVIEW_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_CsyPolar_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_CSYPOLAR_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_CubicPrism_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_CUBICPRISM_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_CableCsys_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_CABLECSYS_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_SingleEquipFeat_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_SINGLEEQUIPFEAT_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AsmRef_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_ASMREF_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_Lightweight_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_LIGHTWEIGHT_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_RsysMatch_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_RSYSMATCH_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_RsysConincide_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_RSYSCOINCIDE_505);
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_SingleEquipType_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_ASS_SINGLEEQUIPTYPE_505);
		}
#endif
	}

	if (CheckValidLicenseByRules_MdlMach())
	{
		hFirst = m_treeCheckRule.InsertItem(L"模型可制造性检查", 0, 1, hRoot);
		hSecond = m_treeCheckRule.InsertItem(L"孔加工", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_HoleDia, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_HOLE_DIA);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DeepHole, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_DEEP_HOLE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_HoleDis, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_HOLE_DIS);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_HolePartEdgeDis, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_HOLE_PART_EDGE_DIS);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_HoleAxisInMaterial, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_HOLE_AXIS_IN_MATERIAL);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_HoleCutDirPrepUp, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_HOLE_CUT_DIR_PREP_UP);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_HoleCutDirPrepDown, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_HOLE_CUT_DIR_PREP_DOWN);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FlatBottomHole, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_FLAT_BOTTOM_HOLE);
		}
		hSecond = m_treeCheckRule.InsertItem(L"钣金件加工", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_BendRadius, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_BEND_RADIUS);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_SlotWidth, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_SLOT_WIDTH);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_SheetBendRadius, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_SHEET_BEND_RADIUS);
		}
		hSecond = m_treeCheckRule.InsertItem(L"轴加工", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_LongAxis, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_LONG_AXIS);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_AxisShoulderAng, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_AXIS_SHOULDER_ANG);
		}
		hSecond = m_treeCheckRule.InsertItem(L"圆角、倒角加工", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_RoundRad, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_ROUND_RAD);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ChamferDim, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_CHAMFER_DIM);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ChamferAng, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_CHAMFER_ANG);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DeepFillet, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_DEEP_FILLET);
		}
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_ShellThickness, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_SHELL_THICKNESS);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DraftAngle, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRAFT_ANGLE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_PartMaxSize, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_PART_MAX_SIZE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_FeaMinSize, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_FEA_MIN_SIZE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_PipeContinuousBend, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hThird, CRT_PIPE_CONTINUOUS_BEND);
	}

#if !(defined(DOCTOR_PROE3) || defined(DOCTOR_PROE4))
	if (CheckValidLicenseByRules_Drawing())
	{
		hFirst = m_treeCheckRule.InsertItem(L"工程图检查", 0, 1, hRoot);
		hSecond = m_treeCheckRule.InsertItem(L"标注", 0, 1, hFirst);
		{
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwDimHandsize, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_DRW_DIM_HANDSIZE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwDimTextStyle, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_DRW_DIM_TEXT_STYLE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwNoteTextStyle, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_DRW_NOTE_TEXT_STYLE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwFakeDim, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_DRW_DIM_FAKE);
			hThird = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwDimCount, 2, 4, hSecond);
			m_treeCheckRule.SetItemData(hThird, CRT_DRW_DIMCOUNT);
		}
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwSheetSize, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_SHEET_SIZE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwSheetIsBlank, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_SHEET_ISBLANK);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwSheetAngle, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_SHEET_ANGLE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwSheetTextSize, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_SHEET_TEXT_SIZE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwSheetTextFont, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_SHEET_TEXT_FONT);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwInrelSketch, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_INRELSKETCH);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwSheetScale, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_SHEET_SCALE);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwViewBound, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_DRW_VIEW_BOUND);
		
		//hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwDimTextOrient, 2, 4, hFirst);
		//m_treeCheckRule.SetItemData(hSecond, CRT_DRW_DIM_TEXT_ORIENT);
		//hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwNoteArrowSize, 2, 4, hFirst);
		//m_treeCheckRule.SetItemData(hSecond, CRT_DRW_NOTE_ARROW_SIZE);
		//hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_DrwNoteArrowStyle, 2, 4, hFirst);
		//m_treeCheckRule.SetItemData(hSecond, CRT_DRW_NOTE_ARROW_STYLE);
		
	}
	if (CheckValidLicenseByRules_3DDrawing())
	{
		hFirst = m_treeCheckRule.InsertItem(L"三维标注检查", 0, 1, hRoot);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_3ddrwFakeDim, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_3DDRW_FAKE_DIM);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_3DDrwView, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_3DDRW_VIEW);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_3DDrwColor, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_3DDRW_COLOR);
		hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_3DDrwTextSize, 2, 4, hFirst);
		m_treeCheckRule.SetItemData(hSecond, CRT_3DDRW_TEXTSIZE);
		if (g_strCustomCode.CompareNoCase(L"505") == 0)
		{
			hSecond = m_treeCheckRule.InsertItem(g_strCheckRuleDesc_3DDrwLug_505, 2, 4, hFirst);
			m_treeCheckRule.SetItemData(hSecond, CRT_3DDRW_LUG_505);
		}
	}
#endif

	GetRuleCount(hRoot);
	m_treeCheckRule.Expand(hRoot, TVE_EXPAND);

	GetDlgItem(IDC_STATIC_SUB_DLG_POS)->GetWindowRect(m_rectPanel);
	ScreenToClient(m_rectPanel);
	GetDlgItem(IDC_STATIC_SUB_DLG_POS)->ShowWindow(SW_HIDE);

	return TRUE;
}
void CTDLFindTaskExpressionListCtrl::PrepareControl(CWnd& ctrl, int nRow, int nCol)
{
	UNREFERENCED_PARAMETER(ctrl);

	if (!GetRuleCount())
		return;

	SEARCHPARAM& sp = m_aSearchParams[nRow];

	switch (nCol)
	{
	case ATTRIB:
		{
			ASSERT (&ctrl == &m_cbAttributes);
	
			m_cbAttributes.SelectAttribute(sp);
			CDialogHelper::RefreshMaxDropWidth(m_cbAttributes);
		}
		break;

	case OPERATOR:
		{
			ASSERT (&ctrl == &m_cbOperators);

			m_cbOperators.ResetContent();
			
			FIND_ATTRIBTYPE nType = sp.GetAttribType();
			
			switch (nType)
			{
			case FT_STRING:
				AddOperatorToCombo(FO_SET);
				AddOperatorToCombo(FO_NOT_SET);
				AddOperatorToCombo(FO_EQUALS);
				AddOperatorToCombo(FO_NOT_EQUALS);
				AddOperatorToCombo(FO_INCLUDES);
				AddOperatorToCombo(FO_NOT_INCLUDES);
				break;

			case FT_INTEGER:
			case FT_DOUBLE:
			case FT_TIME:
				AddOperatorToCombo(FO_SET);
				AddOperatorToCombo(FO_NOT_SET);
				AddOperatorToCombo(FO_EQUALS);
				AddOperatorToCombo(FO_NOT_EQUALS);
				AddOperatorToCombo(FO_GREATER);
				AddOperatorToCombo(FO_GREATER_OR_EQUAL);
				AddOperatorToCombo(FO_LESS);
				AddOperatorToCombo(FO_LESS_OR_EQUAL);
				break;

			case FT_DATE:
			case FT_DATE_REL:
				AddOperatorToCombo(FO_SET);
				AddOperatorToCombo(FO_NOT_SET);
				AddOperatorToCombo(FO_EQUALS);
				AddOperatorToCombo(FO_NOT_EQUALS);
				AddOperatorToCombo(FO_AFTER);
				AddOperatorToCombo(FO_ON_OR_AFTER);
				AddOperatorToCombo(FO_BEFORE);
				AddOperatorToCombo(FO_ON_OR_BEFORE);
				break;

			case FT_BOOL:
				AddOperatorToCombo(FO_SET);
				AddOperatorToCombo(FO_NOT_SET);
				break;
			}
	
			CDialogHelper::SelectItemByData(m_cbOperators, (DWORD)sp.GetOperator());
		}
		break;

	case ANDOR:
		{
			ASSERT (&ctrl == &m_cbAndOr);

			if (sp.GetAnd())
				m_cbAndOr.SelectString(-1, CEnString(IDS_FP_AND));
			else
				m_cbAndOr.SelectString(-1, CEnString(IDS_FP_OR));
		}
		break;

	case VALUE:
		switch (sp.GetAttribType())
		{
		case FT_DATE:
			ASSERT (&ctrl == &m_dtDate);

			// if the rule does not yet have a date then set it now to
			// the current date because that's whats the date ctrl will default to
			if (sp.ValueAsDate().m_dt <= 0)
			{
				sp.SetValue(COleDateTime::GetCurrentTime());
				SetItemText(nRow, nCol, sp.ValueAsDate().Format(VAR_DATEVALUEONLY));
			}
			else
				m_dtDate.SetTime(sp.ValueAsDouble());
			break;

		case FT_TIME:
			ASSERT (&ctrl == &m_eTime);
			m_eTime.SetTime(sp.ValueAsDouble(), (TCHAR)sp.GetFlags());
			break;
		}
		break;

	}
}