Exemplo n.º 1
0
CTreeItem CNBTreeListView::SetDevice(CTreeItem tiParent, CNBDevice *pDevice)
{
	CTreeItem tiDevice;

	if(!pDevice)
	{
		// set empty device
		CString strText;
		strText.LoadString(IDS_UNIDEV_TYPE_DISK_EMPTY);
		tiDevice = GetTreeControl().InsertItem(
			strText,
			0, // IDI_FAIL
			0, // IDI_FAIL
			tiParent,
			TVI_LAST);

		tiDevice.SetData((DWORD_PTR)NULL);

		return tiDevice;
	}

	// CString strName = pDevice->GetName() + _T("\0") + pDevice->GetIDString(m_chHidden);

	tiDevice = GetTreeControl().InsertItem(
		pDevice->GetName(),
		pDevice->GetIconIndex((UINT *) ImageListIcons, RTL_NUMBER_OF(ImageListIcons)),
		pDevice->GetSelectIconIndex((UINT *)ImageListIcons, RTL_NUMBER_OF(ImageListIcons)),
		tiParent,
		TVI_LAST);

	tiDevice.SetData((DWORD_PTR)pDevice);

	// ID
	int col = 1;
//	SetSubItemText(tiDevice, col, pDevice->GetIDString(m_chHidden));

	// Capacity
//	col++;
	SetSubItemText(tiDevice, col, pDevice->GetCapacityString());

	// Status
	col++;
	SetSubItemText(tiDevice, col, pDevice->GetStatusString());

	// Type
	col++;
	SetSubItemText(tiDevice, col, pDevice->GetTypeString());

	// Fault Tolerance
	col++;
	SetSubItemText(tiDevice, col, pDevice->GetFaultToleranceString());

	return tiDevice;
}
Exemplo n.º 2
0
CTreeItem CNBTreeListView::SetDevice(CTreeItem tiParent, CNBDevice *pDevice)
{
	CTreeItem tiDevice;

	if(!pDevice)
	{
		// set empty device
		WTL::CString strText;
		strText.LoadString(IDS_UNIDEV_TYPE_DISK_EMPTY);
		tiDevice = GetTreeControl().InsertItem(
			strText,
			0, // IDI_FAIL
			0, // IDI_FAIL
			tiParent,
			TVI_LAST);

		tiDevice.SetData((DWORD_PTR)NULL);

		return tiDevice;
	}

	tiDevice = GetTreeControl().InsertItem(
		pDevice->GetName(),
		pDevice->GetIconIndex((UINT *)anIconIDs, sizeof(anIconIDs)/sizeof(anIconIDs[0])),
		pDevice->GetSelectIconIndex((UINT *)anIconIDs, sizeof(anIconIDs)/sizeof(anIconIDs[0])),
		tiParent,
		TVI_LAST);

	tiDevice.SetData((DWORD_PTR)pDevice);

	// ID
	int col = 1;

	SetSubItemText(tiDevice, col, pDevice->GetIDString());

	// Capacity
	col++;
	SetSubItemText(tiDevice, col, pDevice->GetCapacityString());

	// Status
	col++;
	SetSubItemText(tiDevice, col, pDevice->GetStatusString());

	// Type
	col++;
	SetSubItemText(tiDevice, col, pDevice->GetTypeString());

	// Fault Tolerance
	col++;
	SetSubItemText(tiDevice, col, pDevice->GetFaultToleranceString());

	return tiDevice;
}
Exemplo n.º 3
0
void CMainDlg::FillTree()
{
	m_Tree.DeleteAllItems();
	lvis.clear();
	string old = "";
	lvis[old] = TVI_ROOT;
	for(dword i = 0; i < sc.index.size(); i++)
	{
		CString f = sc.index[i].filename.c_str();
		//f.Replace('\\', '/');
		int u = 0;
		while((u = f.Find('/', u+1)) != -1)
		{
			CString n = f.Left(u);
			if(!lvis[(string)n])
			{
				CTreeItem a = m_Tree.InsertItem(n.Right(n.GetLength()- (old.length()==0?-1:old.length())-1),  1, 1, lvis[old] , TVI_SORT);
				a.SetData(0);
				lvis[(string)n] = a;
			}	
			old = n;
		}
	}
	for(dword i = 0; i < sc.index.size(); i++)
	{
		CString f = sc.index[i].filename.c_str();
		//f.Replace('\\', '/');
		int u = 0;
		while((u = f.Find('/', u+1)) != -1)
		{
			CString n = f.Left(u);
			if(!lvis[(string)n])
			{
				CTreeItem a = m_Tree.InsertItem(n.Right(n.GetLength()- (old.length()==0?-1:old.length())-1),  1, 1, lvis[old] , TVI_SORT);
				a.SetData(0);
				lvis[(string)n] = a;
			}	
			old = n;
		}
		CString fil;
		fil.Format("%s - %1.2fKB", f.Right(f.GetLength()-f.ReverseFind('/')-1), sc.index[i].fileSize/1024.0);
		CTreeItem fe;
		HTREEITEM order = TVI_LAST; //TVI_SORT
		if(!f.Right(4).Compare(".dds"))
			fe = m_Tree.InsertItem(fil, 2,2, lvis[old] , order);
		else if (!f.Right(4).Compare(".tri"))
			fe = m_Tree.InsertItem(fil, lvis[old] , order);
		else if (!f.Right(5).Compare(".blue"))
			fe = m_Tree.InsertItem(fil, 3,3, lvis[old] , order);
		else if (!f.Right(4).Compare(".ogg") || !f.Right(4).Compare(".wav") || !f.Right(4).Compare(".m3u") || !f.Right(4).Compare(".mp3"))
			fe = m_Tree.InsertItem(fil, 4,4, lvis[old] , order);
		else if (!f.Right(4).Compare(".jpg"))
			fe = m_Tree.InsertItem(fil, 5,5, lvis[old] , order);
		else if (!f.Right(4).Compare(".png"))
			fe = m_Tree.InsertItem(fil, 6,6, lvis[old] , order);
		else if (!f.Right(3).Compare(".py"))
			fe = m_Tree.InsertItem(fil, 7,7, lvis[old] , order);
		else if (!f.Right(4).Compare(".txt"))
			fe = m_Tree.InsertItem(fil, 8,8, lvis[old] , order);
		else if (!f.Right(4).Compare(".tga"))
			fe = m_Tree.InsertItem(fil, 9,9, lvis[old] , order);
		else if (!f.Right(3).Compare(".mb"))
			fe = m_Tree.InsertItem(fil, 9,9, lvis[old] , order);
		else if (!f.Right(4).Compare(".gr2"))
			fe = m_Tree.InsertItem(fil, 11,11, lvis[old] , order);
		else
			fe = m_Tree.InsertItem(fil, 10,10, lvis[old] , order);
		fe.SetData(i+1);
	}
}