Click here to Skip to main content
13,095,218 members (73,521 online)
Click here to Skip to main content


150 bookmarked
Posted 6 Jan 2003

Include File Hierarchy Viewer

, 29 Jul 2003
A tool to view the include file hierarchy of your source code.
// Although great care has gone into developing this software,
// it is provided without any guarantee of reliability, accuracy
// of information, or correctness of operation.  I am not responsible
// for any damages that may occur as a result of using this software.
// Use this software entirely at your own risk.
// Copyright 2003, Chris Richardson
// Description: View class.

#if !defined(AFX_INCFINDERVIEW_H__D34F3516_251A_4E08_B1A7_D9387E5A6BA4__INCLUDED_)
#define AFX_INCFINDERVIEW_H__D34F3516_251A_4E08_B1A7_D9387E5A6BA4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Parser.h"
#include "IncludeFinder.h"
#include "ParsedFile.h"

#include "SearchTypePropertySheet.h"

// Status messages we post to the main thread.
#define INC_FINDER_WM_FILE_START          (WM_APP+1)
#define INC_FINDER_WM_FINISHED            (WM_APP+3)

// CStatusNotifier is a very simple class, it's not derived from anything,
// and it only has a couple pure virtual functions, so I don't think the multiple
// inheritance here is a big deal.
class CIncFinderView : public CFormView, public CStatusNotifier
protected: // create from serialization only

	CButton	c_oPreprocess;
	CStatic	c_oProcessingTime;
	CStatic	c_oFilesProcessed;
	CAnimateCtrl	c_oProcessingAnim;
	CTreeCtrl	c_oFileTree;
	CButton	c_oStartStop;
	CStatic	c_oMiddleBorder;
	CStatic	c_oTopBorder;

// Attributes
	CIncFinderDoc* GetDocument();

// Operations
   // CStatusNotifier interface.
   virtual void                  OnFileStart( CParsedFile * p_poFile );
   virtual void                  OnFileComplete( CParsedFile * p_poResults );
   virtual void                  OnFinished();

   HTREEITEM                     InsertFile( HTREEITEM p_hParent, CParsedFile * p_poFile, BOOL & p_rbHasMultipleIncluded );

// Overrides
	// ClassWizard generated virtual function overrides
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);

// Implementation
	virtual ~CIncFinderView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;

   bool                          c_bIsInitialized;

   bool                          c_bIsShowingOnlyUnfoundFiles;
   bool                          c_bIsShowingRelativePaths;

   void                          ClearParsedFiles();
   void                          ParseSearchOptions();
   void                          RepopulateTree();
   void                          UpdateResultsControls( unsigned long p_ulFiles, COleDateTimeSpan & p_roProcessTime );
   CTCharString                  GetDisplayFileName( CParsedFile * p_poFile, HTREEITEM p_hParentLevel );
   CSearchTypePropertySheet      c_oPropSheet;
   int                           c_iDefaultPropSheetHeight;
   CSearchPropertyPage *         c_poCurrentSearchPage;
   void                          LaunchFile( CParsedFile * p_poFile );
   CFindReplaceDialog *          c_poFindDlg;
   CTCharString                  c_sLastSearchText;
   HTREEITEM                     SearchTree( BOOL p_bStart, HTREEITEM p_hCur, const TCHAR * p_pszText );
   void                          DoSearch( const TCHAR * p_pszText );

      TREE_IMAGE_FILE                  = 0,
      TREE_IMAGE_MULTIPLE              = 1,
      TREE_IMAGE_NOT_FOUND             = 2,
      TREE_IMAGE_RECURSE               = 3,
   CImageList                    c_oTreeImages;
   // Here is the tab image list:
   CImageList                    c_oTabImages;

// Generated message map functions
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnStartStop();
	afx_msg void OnDestroy();
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnTreeOpenfile();
	afx_msg void OnUpdateTreeOpenfile(CCmdUI* pCmdUI);
	afx_msg void OnViewUnfoundFiles();
	afx_msg void OnUpdateViewUnfoundFiles(CCmdUI* pCmdUI);
	afx_msg void OnViewRelativePaths();
	afx_msg void OnUpdateViewRelativePaths(CCmdUI* pCmdUI);
	afx_msg void OnDblclkFileTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnEditFind();
	afx_msg void OnEditFindNext();
	afx_msg void OnUpdateEditFindNext(CCmdUI* pCmdUI);
	afx_msg LRESULT OnFileStart( WPARAM wParam, LPARAM lParam );
	afx_msg LRESULT OnFileFinished( WPARAM wParam, LPARAM lParam );
	afx_msg LRESULT OnFinished( WPARAM wParam, LPARAM lParam );
   afx_msg LRESULT OnFindReplace(WPARAM wParam, LPARAM lParam);

#ifndef _DEBUG  // debug version in IncFinderView.cpp
inline CIncFinderDoc* CIncFinderView::GetDocument()
   { return (CIncFinderDoc*)m_pDocument; }


// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_INCFINDERVIEW_H__D34F3516_251A_4E08_B1A7_D9387E5A6BA4__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Chris Richardson
Software Developer (Senior)
United States United States
I like to program, I like to sail.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 30 Jul 2003
Article Copyright 2003 by Chris Richardson
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid