00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "SaveTextFileDialog.h"
00028
00029
00030
00031
00032 IMPLEMENT_DYNAMIC(CSaveTextFileDialog, CFileDialog)
00033 CSaveTextFileDialog::CSaveTextFileDialog(
00034 CTextFile::enc e,
00035 LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
00036 LPCTSTR lpszFilter, CWnd* pParentWnd) :
00037 CFileDialog(FALSE, lpszDefExt, lpszFileName,
00038 OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
00039 lpszFilter, pParentWnd, 0),
00040 m_e(e)
00041 {
00042 if(m_ofn.lStructSize == sizeof(OPENFILENAME))
00043 {
00044 SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL);
00045 }
00046 else
00047 {
00048 SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL_400);
00049 }
00050 }
00051
00052 CSaveTextFileDialog::~CSaveTextFileDialog()
00053 {
00054 }
00055
00056 void CSaveTextFileDialog::DoDataExchange(CDataExchange* pDX)
00057 {
00058 DDX_Control(pDX, IDC_COMBO1, m_encoding);
00059 CFileDialog::DoDataExchange(pDX);
00060 }
00061
00062 BOOL CSaveTextFileDialog::OnInitDialog()
00063 {
00064 CFileDialog::OnInitDialog();
00065
00066 m_encoding.AddString(_T("ANSI"));
00067 m_encoding.AddString(_T("Unicode 16-LE"));
00068 m_encoding.AddString(_T("Unicode 16-BE"));
00069 m_encoding.AddString(_T("UTF-8"));
00070
00071 switch(m_e)
00072 {
00073 default:
00074 case CTextFile::ASCII: m_encoding.SetCurSel(0); break;
00075 case CTextFile::LE16: m_encoding.SetCurSel(1); break;
00076 case CTextFile::BE16: m_encoding.SetCurSel(2); break;
00077 case CTextFile::UTF8: m_encoding.SetCurSel(3); break;
00078 }
00079
00080 return TRUE;
00081
00082 }
00083
00084 BEGIN_MESSAGE_MAP(CSaveTextFileDialog, CFileDialog)
00085 END_MESSAGE_MAP()
00086
00087
00088
00089 BOOL CSaveTextFileDialog::OnFileNameOK()
00090 {
00091 switch(m_encoding.GetCurSel())
00092 {
00093 case 0: m_e = CTextFile::ASCII; break;
00094 case 1: m_e = CTextFile::LE16; break;
00095 case 2: m_e = CTextFile::BE16; break;
00096 case 3: m_e = CTextFile::UTF8; break;
00097 default: break;
00098 }
00099
00100 return CFileDialog::OnFileNameOK();
00101 }