Пример #1
0
void CPropertiesWnd::ChangeSelection(CMFCPropertyGridProperty* pNewSel, CMFCPropertyGridProperty* /*pOldSel*/)
{
	if (pNewSel == NULL)
	{
		((CMainFrame*)AfxGetMainWnd())->GetClassView()->SetPreviewProp(NULL);
		return;
	}

	CString strPreview;
	if (IsComboType())
	{
		if (pNewSel->IsGroup())
		{
			CString strName(pNewSel->GetName());
			if (strName.CompareNoCase(_T("ITEM")) == 0)
			{
				CMFCPropertyGridProperty* pPreviewProp = pNewSel->GetSubItem(pNewSel->GetSubItemsCount() - 1);
				((CMainFrame*)AfxGetMainWnd())->GetClassView()->SetPreviewProp(pPreviewProp);
				return;
			}
		}
		else
		{
			CMFCPropertyGridProperty* pGroupProp = pNewSel->GetParent();
			CString strName(pGroupProp->GetName());
			if (strName.CompareNoCase(_T("ITEM")) == 0)
			{
				CMFCPropertyGridProperty* pPreviewProp = pGroupProp->GetSubItem(pGroupProp->GetSubItemsCount() - 1);
				((CMainFrame*)AfxGetMainWnd())->GetClassView()->SetPreviewProp(pPreviewProp);
				return;
			}
		}
		((CMainFrame*)AfxGetMainWnd())->GetClassView()->SetPreviewProp(NULL);
	}
	else
	{
		// the last is preview
		CMFCPropertyGridProperty* pGroupProp = pNewSel;
		if (!pNewSel->IsGroup())
		{
			pGroupProp = pNewSel->GetParent();
		}

		if (pGroupProp->GetSubItemsCount() > 2)
		{
			CMFCPropertyGridProperty* pPreviewProp = pGroupProp->GetSubItem(pGroupProp->GetSubItemsCount() - 1);
			((CMainFrame*)AfxGetMainWnd())->GetClassView()->SetPreviewProp(pPreviewProp);
		}
	}
}
Пример #2
0
void CPropertiesWnd::OnPropDownitem()
{
	if (!IsComboType())
	{
		return;
	}

	CMFCPropertyGridProperty *pProp = m_wndPropList.GetCurSel();
	if (pProp && pProp->IsGroup())
	{
		CString strName(pProp->GetName());
		if (strName.CompareNoCase(_T("ITEM")) == 0)
		{
			CMFCPropertyGridProperty *pParentProp = pProp->GetParent();
			if (pProp == pParentProp->GetSubItem(pParentProp->GetSubItemsCount() - 1))
			{
				return;
			}

			int nEnd = 0;
			CList<CMFCPropertyGridProperty*, CMFCPropertyGridProperty*> lstSubItems;
			for (int i = pParentProp->GetSubItemsCount() - 1; i >= nEnd; i--)
			{
				CMFCPropertyGridProperty *pChildProp = pParentProp->GetSubItem(i);
				if (pChildProp)
				{
					if (pChildProp == pProp)
					{
						nEnd = i;
						lstSubItems.InsertAfter(lstSubItems.GetHeadPosition(), pChildProp);
					}
					else
					{
						lstSubItems.AddHead(pChildProp);
					}
					pParentProp->RemoveSubItem(pChildProp, FALSE);
				}
			}

			for (POSITION pos = lstSubItems.GetHeadPosition(); pos != NULL;)
			{
				CMFCPropertyGridProperty* pProp = lstSubItems.GetNext(pos);
				ASSERT_VALID(pProp);

				pParentProp->AddSubItem(pProp);
			}
			m_wndPropList.AdjustLayout();
		}
	}
}
Пример #3
0
void CFileView::RefreshPropName(CMFCPropertyGridProperty* pProp)
{
	CMFCPropertyGridProperty* pGroupProp = GetSelectItemProp();
	if (pGroupProp && pGroupProp->GetSubItemsCount() > 0 && pGroupProp->GetSubItem(0) == pProp)
	{
		HTREEITEM hItem = m_wndFileView.GetSelectedItem();
		m_wndFileView.SetItemText(hItem, (CString)pProp->GetValue());
	}
}
Пример #4
0
void COptimizeWallWnd::OutputToLines(vector<sOpWall>& sOpWalls)
{
	//外墙
	CMFCPropertyGridProperty* outWallPos = getCoodOutWallGroup();
	sOpWall w;
	for (int i = 0; i < outWallPos->GetSubItemsCount(); i++)
	{
		w.line.s.x = outWallPos->GetSubItem(i)->GetSubItem(0)->GetSubItem(0)->GetValue().dblVal;
		w.line.s.y = outWallPos->GetSubItem(i)->GetSubItem(0)->GetSubItem(1)->GetValue().dblVal;
		w.line.e.x = outWallPos->GetSubItem(i)->GetSubItem(1)->GetSubItem(0)->GetValue().dblVal;
		w.line.e.y = outWallPos->GetSubItem(i)->GetSubItem(1)->GetSubItem(1)->GetValue().dblVal;
		w.line.type = sLine::OUT_WALL;
		CString mat = outWallPos->GetSubItem(i)->GetSubItem(2)->GetValue().bstrVal;
		_tcscpy_s(w.mat, mat);

		sOpWalls.push_back(w);
	}

	//内墙
	CMFCPropertyGridProperty* inWallPos = getCoodInWallGroup();
	for (int i = 0; i < inWallPos->GetSubItemsCount(); i++)
	{
		w.line.s.x = inWallPos->GetSubItem(i)->GetSubItem(0)->GetSubItem(0)->GetValue().dblVal;
		w.line.s.y = inWallPos->GetSubItem(i)->GetSubItem(0)->GetSubItem(1)->GetValue().dblVal;
		w.line.e.x = inWallPos->GetSubItem(i)->GetSubItem(1)->GetSubItem(0)->GetValue().dblVal;
		w.line.e.y = inWallPos->GetSubItem(i)->GetSubItem(1)->GetSubItem(1)->GetValue().dblVal;
		w.line.type = sLine::IN_WALL;
		CString mat = inWallPos->GetSubItem(i)->GetSubItem(2)->GetValue().bstrVal;
		_tcscpy_s(w.mat, mat);

		sOpWalls.push_back(w);
	}
}
Пример #5
0
void CDlgDoasmOption::GetOption()
{
	if(m_wndPropertyGrid.GetSafeHwnd())
	{
		CMFCPropertyGridProperty* pPropertyOasm = m_wndPropertyGrid.GetProperty(0);
		CMFCPropertyGridFileProperty* pPropertyOasmFile = (CMFCPropertyGridFileProperty*)pPropertyOasm->GetSubItem(0);
		m_strDoasmPath = (CString)pPropertyOasmFile->GetValue();

		CMFCPropertyGridProperty* pPropertyLanguage = m_wndPropertyGrid.GetProperty(1);
		CMFCPropertyGridFileProperty* pPropertyLanguageFile = (CMFCPropertyGridFileProperty*)pPropertyLanguage->GetSubItem(0);
		m_strOasmLanguagePath = (CString)pPropertyLanguageFile->GetValue();		
	}	
}
Пример #6
0
void CPropertiesWnd::PropertyChanged(CMFCPropertyGridProperty* pProp)
{
	CString strName(pProp->GetName());
	if (strName.CompareNoCase(_T("TYPE")) == 0)
	{
		CMFCPropertyGridProperty* pPropGroup = pProp->GetParent();
		for (int i = pPropGroup->GetSubItemsCount() - 1; i >= 0; i--)
		{
			CMFCPropertyGridProperty* pChildProp = pPropGroup->GetSubItem(i);
			if (pChildProp == pProp)
			{
				break;
			}
			pPropGroup->RemoveSubItem(pChildProp);
		}

		CString strType(pProp->GetValue());
		if (strType.CompareNoCase(_T("Combo")) == 0)
		{
			CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("ITEMS"), PROP_DATA_ITEMS, TRUE);
			pPropGroup->AddSubItem(pNewProp);
		}
		else if (strType.CompareNoCase(_T("Number")) == 0)
		{ 
			CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (_variant_t)0, _T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("RANGE MIN"), (_variant_t)0, _T(""));
			pNewProp->EnableSpinControl(TRUE, -9999, 9999);
			pPropGroup->AddSubItem(pNewProp);
			pNewProp = new CMFCPropertyGridProperty(_T("RANGE MAX"), (_variant_t)100, _T(""));
			pNewProp->EnableSpinControl(TRUE, -9999, 9999);
			pPropGroup->AddSubItem(pNewProp);

			BOOL bBuddy = FALSE;
			pNewProp = new CMFCPropertyGridProperty(_T("BUDDY"), (_variant_t)(bBuddy == TRUE), _T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("SHORT"), (_variant_t)_T(""), _T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("PREVIEW"), (_variant_t)_T(""), _T(""));
			pPropGroup->AddSubItem(pNewProp);
		}
		else if (strType.CompareNoCase(_T("Text")) == 0)
		{
			CMFCPropertyGridProperty* pNewProp = new CMFCPropertyGridProperty(_T("VALUE"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("SHORT"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);

			pNewProp = new CMFCPropertyGridProperty(_T("PREVIEW"), (COleVariant)_T(""));
			pPropGroup->AddSubItem(pNewProp);
		}

		m_wndPropList.AdjustLayout();
	}
	else if (strName.CompareNoCase(_T("PREVIEW")) == 0)
	{
		((CMainFrame*)AfxGetMainWnd())->GetClassView()->RefreshPreview();
	}
	else if (strName.CompareNoCase(_T("NAME")) == 0)
	{
		((CMainFrame*)AfxGetMainWnd())->GetFileView()->RefreshPropName(pProp);
	}
	((CMainFrame*)AfxGetMainWnd())->GetFileView()->SetFileModifiedFlag(TRUE);
}
void CDlgOMLEditOption::GetOption()
{
	if(m_wndPropertyGrid.GetSafeHwnd())
	{
		CMFCPropertyGridProperty* pPropertyHintFile = m_wndPropertyGrid.GetProperty(0);
		m_strOMLSyntaxWordFileName = (CString)pPropertyHintFile->GetSubItem(0)->GetValue();
		m_strOMLSelectionListFileName = (CString)pPropertyHintFile->GetSubItem(1)->GetValue();
		m_strOMLTempletDir = (CString)pPropertyHintFile->GetSubItem(2)->GetValue();		
		m_strOMLAutoCompleteFileName = (CString)pPropertyHintFile->GetSubItem(3)->GetValue();
		m_strOMLTipFileName = (CString)pPropertyHintFile->GetSubItem(4)->GetValue();

		CMFCPropertyGridProperty* pPropertySyntaxHighLight = m_wndPropertyGrid.GetProperty(1);
		CMFCPropertyGridColorProperty* pPropColor = 0;
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(0);
		m_colorBackGround = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(1);
		m_colorText = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(2);
		m_colorCommentLine = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(3);
		m_colorCommentBlock = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(4);
		m_colorDigital = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(5);
		m_colorChar = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(6);
		m_colorString = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(7);
		m_colorKeyWord = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(8);
		m_colorMacro = pPropColor->GetColor();
		pPropColor = (CMFCPropertyGridColorProperty*)pPropertySyntaxHighLight->GetSubItem(9);
		m_colorOperator = pPropColor->GetColor();

		//字体
		CMFCPropertyGridProperty* pPropertyFont = m_wndPropertyGrid.GetProperty(2);
		CMFCPropertyGridFontProperty* pPropertyFontTtem = (CMFCPropertyGridFontProperty*)pPropertyFont->GetSubItem(0);
		m_lfTextFont = *pPropertyFontTtem->GetLogFont();

		//左边附加栏
		CMFCPropertyGridProperty* pPropertyExtraColumn = m_wndPropertyGrid.GetProperty(3);
		m_bShowLineNumber = (_variant_t)pPropertyExtraColumn->GetSubItem(0)->GetValue();
		m_bShowBookMarker = (_variant_t)pPropertyExtraColumn->GetSubItem(1)->GetValue();
		m_bShowFold = (_variant_t)pPropertyExtraColumn->GetSubItem(2)->GetValue();

		//左边附加栏
		CMFCPropertyGridProperty* pPropertySave = m_wndPropertyGrid.GetProperty(4);
		m_bAutoSave = (_variant_t)pPropertySave->GetSubItem(0)->GetValue();
	}
}