示例#1
0
文件: Project.cpp 项目: pdrezet/brix
// This method gets a set of unique widget group names in a subsystem
void Project::getWidgetGroupNames(HTREEITEM hItem, set<INXString> &sWidgetGroupSet)
{
	INXString csProjectDir, csBlockFile, csWidgetGroupName;
	BlockOperations bo;
	INXObjList* encapsulated;
	INXPOSITION pos;
	ConData* blob;
	HTREEITEM hUserDefItem;
	CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;

	pProjMData->getProjectDir(csProjectDir);
	csBlockFile = csProjectDir + DEPDIR + pFrame->m_wndProjectBar.m_cProjTree.GetDEPPath(hItem) + (INXString)pFrame->m_wndProjectBar.m_cProjTree.GetItemText(hItem) + ".prg";
	encapsulated = bo.LoadBlock(csBlockFile);
			
	pos = encapsulated->GetHeadPosition();
	while(pos) {
		blob = (ConData *) (encapsulated->GetNext(pos));
		if (blob->m_iUserDefined) {
			hUserDefItem = pFrame->m_wndProjectBar.m_cProjTree.GetUserDefChildItem(blob, hItem);
			getWidgetGroupNames(hUserDefItem, sWidgetGroupSet);
		}
		else if (blob->isGuiWidget()) {
			blob->getScreenTag(csWidgetGroupName);
			sWidgetGroupSet.insert(csWidgetGroupName);
		}
	}
	bo.DeleteBlock(encapsulated);
}
示例#2
0
文件: Project.cpp 项目: pdrezet/brix
// method that adds widgets for a pasted list
void Project::addPastedGuiWidgets(HTREEITEM hItem, INXObjList* pasteList)
{
	INXPOSITION pos;
	ConData* blob;
	HTREEITEM hUserDefItem;
	CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
	set<INXString> sWidgetGroupSet;
	vector<pair<INXString, INXString> > vWidgetGroupPairVec;
	INXString csWidgetGroupName;

	if (IsPastedGuiWidgetsInProject(pasteList, hItem)) {
		// Get a set of all the widget group names in the paste list
		pos = pasteList->GetHeadPosition();
		while(pos) {
			blob = (ConData *) (pasteList->GetNext(pos));
			if (blob->m_iUserDefined) {
				hUserDefItem = pFrame->m_wndProjectBar.m_cProjTree.GetUserDefChildItem(blob, hItem);
				getWidgetGroupNames(hUserDefItem, sWidgetGroupSet);
			}
			else if (blob->isGuiWidget()) {
				blob->getScreenTag(csWidgetGroupName);
				sWidgetGroupSet.insert(csWidgetGroupName);
			}
		}
	
		// Prompt the user to use a different group name for each group name in the set
		setWidgetGroupNames(sWidgetGroupSet, vWidgetGroupPairVec);
	}

	// Add all the Gui widgets in the paste list to the project meta-data
	pos = pasteList->GetHeadPosition();
	while(pos) {
		blob = (ConData *) (pasteList->GetNext(pos));
		if (blob->m_iUserDefined) {
			hUserDefItem = pFrame->m_wndProjectBar.m_cProjTree.GetUserDefChildItem(blob, hItem);
			updateWidgetGroupNames(hUserDefItem, vWidgetGroupPairVec);
		}
		else if (blob->isGuiWidget()) {
			updateWidgetGroup(blob, vWidgetGroupPairVec);
		}
	}
}