X64 transport [Part 5] (Update plugins.cpp)
[xy_vsfilter.git] / src / apps / mplayerc / SaveTextFileDialog.cpp
blobc4c21a5603b69fe94f7e25f03e1a37e7d1075628
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 // SaveTextFileDialog.cpp : implementation file
25 #include "stdafx.h"
26 #include "mplayerc.h"
27 #include "SaveTextFileDialog.h"
30 // CSaveTextFileDialog
32 IMPLEMENT_DYNAMIC(CSaveTextFileDialog, CFileDialog)
33 CSaveTextFileDialog::CSaveTextFileDialog(
34 CTextFile::enc e,
35 LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
36 LPCTSTR lpszFilter, CWnd* pParentWnd) :
37 CFileDialog(FALSE, lpszDefExt, lpszFileName,
38 OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
39 lpszFilter, pParentWnd, 0),
40 m_e(e)
42 if(m_ofn.lStructSize == sizeof(OPENFILENAME))
44 SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL);
46 else /*if(m_ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)*/
48 SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL_400);
52 CSaveTextFileDialog::~CSaveTextFileDialog()
56 void CSaveTextFileDialog::DoDataExchange(CDataExchange* pDX)
58 DDX_Control(pDX, IDC_COMBO1, m_encoding);
59 __super::DoDataExchange(pDX);
62 BOOL CSaveTextFileDialog::OnInitDialog()
64 __super::OnInitDialog();
66 m_encoding.SetItemData(m_encoding.AddString(_T("ANSI")), CTextFile::ASCII);
67 m_encoding.SetItemData(m_encoding.AddString(_T("Unicode 16-LE")), CTextFile::LE16);
68 m_encoding.SetItemData(m_encoding.AddString(_T("Unicode 16-BE")), CTextFile::BE16);
69 m_encoding.SetItemData(m_encoding.AddString(_T("UTF-8")), CTextFile::UTF8);
71 switch(m_e)
73 default:
74 case CTextFile::ASCII: m_encoding.SetCurSel(0); break;
75 case CTextFile::LE16: m_encoding.SetCurSel(1); break;
76 case CTextFile::BE16: m_encoding.SetCurSel(2); break;
77 case CTextFile::UTF8: m_encoding.SetCurSel(3); break;
80 return TRUE; // return TRUE unless you set the focus to a control
81 // EXCEPTION: OCX Property Pages should return FALSE
84 BEGIN_MESSAGE_MAP(CSaveTextFileDialog, CFileDialog)
85 END_MESSAGE_MAP()
87 // CSaveTextFileDialog message handlers
89 BOOL CSaveTextFileDialog::OnFileNameOK()
91 m_e = (CTextFile::enc)m_encoding.GetItemData(m_encoding.GetCurSel());
92 return __super::OnFileNameOK();