Exemple #1
0
void CPathItem::DrawFore(wxDC &dc, wxRect &rc)
{
	dc.SetTextForeground(*wxBLACK);

	wxString csName(_T("mixer"));
	if(NULL != m_pInput)
	{
		const char *nname = m_pInput->GetName();
		const char *dname = m_pInput->GetDisplayName();
		csName = (wxChar*)(strlen(nname) > strlen(dname) ? dname : nname);
	}

	int width = rc.GetWidth();
	if(!m_bFirst)
		width -= CORNER_LENGTH;

	wxFont oldFont = dc.GetFont();
	wxFont font(7, wxSWISS, wxNORMAL, wxNORMAL);
	font.SetWeight(IsSelected() ? wxBOLD : wxNORMAL);
	font.SetStyle(IsSelected() ? wxITALIC : wxNORMAL );
	font.SetPointSize( 7 );
	dc.SetFont( font );

	int w=0, h=0;
	dc.GetTextExtent(csName, &w, &h);
	if(h<rc.GetHeight())
	{
		if(w>width)
		{
			csName.Printf(_T("%c"),csName[0]);
			dc.GetTextExtent(csName, &w, &h);
		}
		int x = rc.GetX() + width/2 - w/2 + (m_bFirst ? 0 : CORNER_LENGTH);
		int y = rc.GetY() + rc.GetHeight()/2 - h/2;
		dc.DrawText( csName, x, y );
	}

	dc.SetFont( oldFont );
}
Exemple #2
0
void CDynControl::AddShowProperty(CPropertyBar *p,CString csModuleName,CString csVarValues)
{
	CString csIdValues="...";
	if(!csModuleName.IsEmpty())
	if(AfxGetModuleManager())
	{
		//Поиск идентификаторов контекста
		CArray<CString,CString> aVariable;
		CArray<CString,CString> aType;
		CString csVarValues2;
		csVarValues2.Format(",%s,",csVarValues);
		if(AfxGetModuleManager()->GetAttrVariable(csModuleName,aVariable,aType))
		{
			for(int i=0;i<aVariable.GetSize();i++)
			{
				CString csName(aVariable[i]);
				csIdValues=csIdValues+","+csName;

				CString csName2;
				csName2.Format(",%s,",csName);
				if(csVarValues2.Find(csName2)==-1)
					csVarValues=csVarValues+","+csName;

			}
		}
	}


	if(m_nControlType==ID_DYNBUTTONGRID)
	{
		CGridCtrl *pGrid=(CGridCtrl *)m_pWnd;
		CCellRange Selection=pGrid->GetSelectedCellRange();
		if(Selection.Count()>0)
		{
			int nCol=Selection.GetMaxCol();
			if(nCol>=0)
			{
				CGridCell* pCell = (CGridCell*)pGrid->GetCell(0, nCol);
				if (pCell)
				{
					p->AddProperty(csPropertyName,"Идентификатор",pGrid->aColumns[nCol].csName,csIdValues);
					p->AddProperty(csPropertyName,"Заголовок",pCell->TextData());
					p->AddProperty(csPropertyName,"Описание",pGrid->aColumns[nCol].csDescription);
					p->AddProperty(csPropertyName,"Формула",pGrid->aColumns[nCol].csFormule);
					p->AddProperty(csPropertyName,"Тип значения",pGrid->aColumns[nCol].csType,aChooseList[nTypeValue]);
					p->AddProperty(csPropertyName,"Длина",pGrid->aColumns[nCol].nLength);
					p->AddProperty(csPropertyName,"Точность",pGrid->aColumns[nCol].nPrec,0,10);
					p->AddProperty(csPropertyName,"Видимость",pGrid->aColumns[nCol].bVisible);
					p->AddProperty(csPropertyName,"Доступность",pGrid->aColumns[nCol].bEnable);
					p->AddProperty(csPropertyName,"Пропускать при вводе",pGrid->aColumns[nCol].bTab);
					p->AddProperty(csPropertyName,"Ширина колонки",pGrid->aColumns[nCol].nColumnWidth,0,1000);
					bWasEdit=1;
					return;
				}
			}
		}
	}


	p->AddProperty(csPropertyName,"Идентификатор",m_csName,csIdValues);
	p->AddProperty(csPropertyName,"Заголовок",m_csValue);
	p->AddProperty(csPropertyName,"Описание",m_csDescription);
	p->AddProperty(csPropertyName,"Видимость",m_bVisible);
	p->AddProperty(csPropertyName,"Доступность",m_bEnable);

	int i;
	for(i=0;i<aDataList.GetSize();i++)
	{
		if(aDataList[i].csName.IsEmpty())
			continue;
		if(aDataList[i].nType==STRING_DATA)
			p->AddProperty(csPropertyName,aDataList[i].csName,aDataList[i].sData);
		else
		if(aDataList[i].nType==INT_DATA)
			p->AddProperty(csPropertyName,aDataList[i].csName,aDataList[i].nData);
		else 
		if(aDataList[i].nType==BOOL_DATA)
			p->AddProperty(csPropertyName,aDataList[i].csName,aDataList[i].bData);
		else
		if(aDataList[i].nType==COLOR_DATA)
			p->AddProperty(csPropertyName,aDataList[i].csName,aDataList[i].Color);
		else
		if(aDataList[i].nType==LIST_DATA)
		{
			if(aDataList[i].nData==nTypeVariable)
			{
				p->AddProperty(csPropertyName,aDataList[i].csName,aDataList[i].sData,csVarValues);
			}
			else
			{
				p->AddProperty(csPropertyName,aDataList[i].csName,aDataList[i].sData,aChooseList[aDataList[i].nData]);
			}
		}
		else
		if(aDataList[i].nType==DOUBLE_DATA)
			p->AddProperty(csPropertyName,aDataList[i].csName,aDataList[i].fData);
	}
	for(i=0;i<aDataList.GetSize();i++)
	{
		if(aDataList[i].nType==FUNCTION_DATA)
			p->AddProperty("События",aDataList[i].csName,aDataList[i].sData);
	}

	

	p->AddProperty("Дополнительные","Пропускать при вводе",m_nTabOrder);
	p->AddProperty("Дополнительные","Слой",m_csLayer,aChooseList[nTypeLayers]);


//	p->AddProperty("Дополнительные","Положение верт",m_csVAllign,"Верх,Центр,Низ");
//	p->AddProperty("Дополнительные","Положение гориз",m_csHAllign,"Лево,Центр,Правл");
	p->AddProperty("Авто-изм.размера","Вниз",m_bAutoSizeDown);
	p->AddProperty("Авто-изм.размера","Вправо",m_bAutoSizeRight);


	if(m_nControlType==ID_BUTTONFORMOBJECT)
	{
		CString csPatchValues="...";
		CStringArray aList;
		CMetadataTree* pTree=AfxGetMetadataTree();
		if(pTree)
		{
			pTree->GetFormArray(aList);
			for(int i=0;i<aList.GetSize();i++)
			{
				csPatchValues=csPatchValues+","+aList[i];
			}
		}

		p->AddProperty(csPropertyName,"Путь к форме",m_csObjName,csPatchValues);
	}

}