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: Dialog to configure a custom source viewer.
//
//====================================================================

#include "stdafx.h"
#include "incfinder.h"
#include "ConfigureSourceViewerDlg.h"

#include "Settings.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CConfigureSourceViewerDlg Implementation.
/////////////////////////////////////////////////////////////////////////////


CConfigureSourceViewerDlg::CConfigureSourceViewerDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CConfigureSourceViewerDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CConfigureSourceViewerDlg)
	c_iViewOption = -1;
	c_sCustomCommand = _T("");
	//}}AFX_DATA_INIT
}


void CConfigureSourceViewerDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CConfigureSourceViewerDlg)
	DDX_Control(pDX, IDC_BROWSE, c_oBrowse);
	DDX_Control(pDX, IDC_CUSTOM_COMMAND, c_oCustomCommand);
	DDX_Radio(pDX, IDC_VIEW_ASSOCIATED, c_iViewOption);
	DDX_Text(pDX, IDC_CUSTOM_COMMAND, c_sCustomCommand);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CConfigureSourceViewerDlg, CDialog)
	//{{AFX_MSG_MAP(CConfigureSourceViewerDlg)
	ON_BN_CLICKED(IDC_VIEW_ASSOCIATED, OnViewAssociated)
	ON_BN_CLICKED(IDC_VIEW_CUSTOM, OnViewCustom)
	ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CConfigureSourceViewerDlg message handlers
/////////////////////////////////////////////////////////////////////////////

BOOL CConfigureSourceViewerDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
   // Load the settings out of the settings object.
   CSettings & a_roSettings = CSettings::GetSettings();
   c_sCustomCommand = a_roSettings.c_sCustomSourceViewerCommand.c_str();

   c_iViewOption = (a_roSettings.c_bViewWithAssociatedViewer != TRUE);
	if( c_iViewOption == 0 )
      OnViewAssociated();
   else
      OnViewCustom();

   UpdateData( FALSE );

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
//
// ------------------------------------------------------------------
//
void CConfigureSourceViewerDlg::OnViewAssociated() 
{
   c_oCustomCommand.EnableWindow( FALSE );
   c_oBrowse.EnableWindow( FALSE );
}
//
// ------------------------------------------------------------------
//
void CConfigureSourceViewerDlg::OnViewCustom() 
{
   c_oCustomCommand.EnableWindow();
   c_oBrowse.EnableWindow();
}
//
// ------------------------------------------------------------------
//
void CConfigureSourceViewerDlg::OnOK() 
{
   if( !UpdateData() )
      return;
   
   // Save the settings into the settings object.
   CSettings & a_roSettings = CSettings::GetSettings();
   a_roSettings.c_sCustomSourceViewerCommand = c_sCustomCommand;
   a_roSettings.c_bViewWithAssociatedViewer = (c_iViewOption == 0);

	CDialog::OnOK();
}
//
// ------------------------------------------------------------------
//
void CConfigureSourceViewerDlg::OnBrowse() 
{
   // Let the user browse for a program.
   CFileDialog a_oDlg( TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Programs (*.exe)|*.exe|All Files (*.*)|*.*||") );
   if( a_oDlg.DoModal() == IDOK )
   {
      c_sCustomCommand = a_oDlg.GetPathName();
      UpdateData( FALSE );
   }
}
//
// ------------------------------------------------------------------
//

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
Web02 | 2.8.140905.1 | Last Updated 30 Jul 2003
Article Copyright 2003 by Chris Richardson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid