// UnusedFilesView.cpp : implementation file // #include "stdafx.h" #include "ContentTrack.h" #include "UnusedFilesView.h" #include "NodeDataValueFileDoc.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CUnusedFilesView IMPLEMENT_DYNCREATE(CUnusedFilesView, CListView) CUnusedFilesView::CUnusedFilesView() { } CUnusedFilesView::~CUnusedFilesView() { } BEGIN_MESSAGE_MAP(CUnusedFilesView, CListView) //{{AFX_MSG_MAP(CUnusedFilesView) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CUnusedFilesView drawing void CUnusedFilesView::OnDraw(CDC* pDC) { // CDocument* pDoc = GetDocument(); // TODO: add draw code here } ///////////////////////////////////////////////////////////////////////////// // CUnusedFilesView diagnostics #ifdef _DEBUG void CUnusedFilesView::AssertValid() const { CListView::AssertValid(); } void CUnusedFilesView::Dump(CDumpContext& dc) const { CListView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CUnusedFilesView message handlers void CUnusedFilesView::OnInitialUpdate() { CListCtrl *pCtrl = &GetListCtrl(); pCtrl->InsertColumn(0,"Unused Files",LVCFMT_LEFT,500); CListView::OnInitialUpdate(); if (GetDocument()->IsKindOf(RUNTIME_CLASS(CNodeDataValueFileDoc))) { CNodeDataValueFileDoc *pDoc = (CNodeDataValueFileDoc *)GetDocument(); CNodeDisk *pNode = pDoc->GetRootNode(); InsertNode(pNode); } } int CUnusedFilesView::InsertNode(CNodeDisk *pNode) { if (CLASS_CNODEDISKFILE == pNode->GetClassID()) { int i = pNode->GetRefCount(); if (i == 1) { CListCtrl *pCtrl = &GetListCtrl(); CString name1; pNode->GetName(name1); name1.MakeUpper(); CString name2 = "VSSVER.SCC"; if (name1 != name2) { pCtrl->InsertItem(pCtrl->GetItemCount(),pNode->GetPath()); return 1; } } return 0; } else if (CLASS_CNODEDISKDIRECTORY == pNode->GetClassID()) { int x=0; POSITION pos = pNode->GetFirstChild(); while (pos) { CNodeDisk *pChild = (CNodeDisk *)pNode->GetNextChild(pos); x+= InsertNode(pChild); } return x; } return 0; } BOOL CUnusedFilesView::PreCreateWindow(CREATESTRUCT& cs) { cs.style |= LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS; return CListView::PreCreateWindow(cs); }