﻿////////////////////////////////////////////////////////////////
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// Compiles with Visual C++ 6.0 for Windows XP and probably Windows 2000 too.
//
#if !defined(_MYDLG_)
#define _MYDLG_
#include "FileDlgHelper.h"
#include <string>
//////////////////
// My open dialog -- customized to add preview, debug panes, and Select All
// button.
//
class CMyOpenDlg : public CFileDialog {
protected:
	CFileDlgHelper m_dlghelper;			 // helper for file dialogs
	CEdit	m_edit1;								 // edit control for preview
	//CEdit	m_edit2;								 // another for debug info

	// Heplers
	std::wstring GetTextPreview(LPCTSTR pszPath);
	void AddText(CEdit& wndEdit, LPCTSTR lpText, BOOL bClear=FALSE);
	void ShowFileInfo();

public:
	CMyOpenDlg(std::string sFilter);

	// Handle CDN_ notifications
	virtual void OnFileNameChange();
	virtual void OnFolderChange();
	virtual void OnTypeChange();

	// Command/message/UI handlers/overrides
	virtual INT_PTR DoModal();
	virtual BOOL OnInitDialog();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//afx_msg void OnSelectAll();
	//afx_msg void OnUpdateSelectAll(CCmdUI* pCmdUI);

	DECLARE_DYNAMIC(CMyOpenDlg)
	DECLARE_MESSAGE_MAP()
};

#endif
