Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

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_FILE_FINISHED       (WM_APP+2)
#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
	CIncFinderView();
	DECLARE_DYNCREATE(CIncFinderView)

public:
	//{{AFX_DATA(CIncFinderView)
	enum { IDD = IDD_INCFINDER_FORM };
	CButton	c_oPreprocess;
	CStatic	c_oProcessingTime;
	CStatic	c_oFilesProcessed;
	CAnimateCtrl	c_oProcessingAnim;
	CTreeCtrl	c_oFileTree;
	CButton	c_oStartStop;
	CStatic	c_oMiddleBorder;
	CStatic	c_oTopBorder;
	//}}AFX_DATA

// Attributes
public:
	CIncFinderDoc* GetDocument();

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

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

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CIncFinderView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	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);
	//}}AFX_VIRTUAL

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

protected:
   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 );

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

// Generated message map functions
protected:
	//{{AFX_MSG(CIncFinderView)
	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
	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);
   DECLARE_MESSAGE_MAP()
};

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

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// 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.

License

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

Share

About the Author

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

| Advertise | Privacy | Mobile
Web04 | 2.8.140921.1 | Last Updated 30 Jul 2003
Article Copyright 2003 by Chris Richardson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid