DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Header

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
// PickerDlg.cpp : implementation file
//

#include "stdafx.h"
#include "cbrowse.h"
#include "PickerDlg.h"

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

// CLSIDs for the Mozilla and IE browser controls

static const CLSID CLSID_Mozilla =
{ 0x1339B54C, 0x3453, 0x11D2, { 0x93, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };

// XX is a hack to avoid linker errors with some Platform SDKs defining
// a GUID with the same name
static const CLSID CLSID_XXInternetExplorer =
{ 0x8856F961, 0x340A, 0x11D0, { 0xA9, 0x6B, 0x00, 0xC0, 0x4F, 0xD7, 0x05, 0xA2 } };

static const CLSID CLSID_MSHTML = 
{ 0x2D360200, 0xFFF5, 0x11D1, { 0x8D, 0x03, 0x00, 0xA0, 0xC9, 0x59, 0xBC, 0x0A } };

struct BrowserControl
{
	TCHAR *szName;
	const CLSID *clsid;
};

BrowserControl aControls[] =
{
	{ _T("Mozilla Control"), &CLSID_Mozilla },
	{ _T("Internet Explorer Control"), &CLSID_XXInternetExplorer }
};


/////////////////////////////////////////////////////////////////////////////
// CPickerDlg dialog


CPickerDlg::CPickerDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPickerDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPickerDlg)
	m_szTestURL = _T("");
	m_szTestCGI = _T("");
	m_bDebugging = FALSE;
	m_sDebugFlags = _T("");
	m_bUseCustom = FALSE;
	//}}AFX_DATA_INIT
	m_clsid = CLSID_NULL;

	CWinApp *pApp = AfxGetApp();
	m_szTestURL = pApp->GetProfileString(SECTION_TEST, KEY_TESTURL, KEY_TESTURL_DEFAULTVALUE);
	m_szTestCGI = pApp->GetProfileString(SECTION_TEST, KEY_TESTCGI, KEY_TESTCGI_DEFAULTVALUE);
	m_sDebugFlags = _T("NSPR_LOG_MODULES=nsComponentManager:5");
}

void CPickerDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPickerDlg)
	DDX_Control(pDX, IDC_LISTBROWSER, m_lbPicker);
	DDX_Text(pDX, IDC_TESTURL, m_szTestURL);
	DDX_Text(pDX, IDC_TESTCGI, m_szTestCGI);
	DDX_Check(pDX, IDC_CHECK1, m_bDebugging);
	DDX_Text(pDX, IDC_EDIT1, m_sDebugFlags);
	DDX_Check(pDX, IDC_OVERRIDE, m_bUseCustom);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPickerDlg, CDialog)
	//{{AFX_MSG_MAP(CPickerDlg)
	ON_BN_CLICKED(IDOK, OnOk)
	ON_LBN_DBLCLK(IDC_LISTBROWSER, OnDblclkListbrowser)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPickerDlg message handlers

BOOL CPickerDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	for (int i = 0; i < sizeof(aControls) / sizeof(aControls[0]); i++)
	{
		m_lbPicker.AddString(aControls[i].szName);
	}
	m_lbPicker.SetCurSel(0);
		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


void CPickerDlg::OnOk() 
{
	UpdateData();

	int nItem = m_lbPicker.GetCurSel();
	if (nItem == LB_ERR)
	{
		AfxMessageBox(IDS_CHOOSEBROWSER);
		return;
	}

	m_clsid = *aControls[nItem].clsid;

	CWinApp *pApp = AfxGetApp();
	pApp->WriteProfileString(SECTION_TEST, KEY_TESTURL, m_szTestURL);
	pApp->WriteProfileString(SECTION_TEST, KEY_TESTCGI, m_szTestCGI);

	if (m_bDebugging)
	{
		putenv("NSPR_LOG_FILE=.\\mozilla.log");
		putenv(m_sDebugFlags);
	}

	EndDialog(IDOK);
}


void CPickerDlg::OnDblclkListbrowser() 
{
	OnOk();
}