1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2013 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
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 this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "EncodingDlg.h"
23 const CFileTextLines::UnicodeType uctArray
[] =
25 CFileTextLines::ASCII
,
26 CFileTextLines::UTF16_LE
,
27 CFileTextLines::UTF16_BE
,
28 CFileTextLines::UTF16_LEBOM
,
29 CFileTextLines::UTF16_BEBOM
,
30 CFileTextLines::UTF32_LE
,
31 CFileTextLines::UTF32_BE
,
33 CFileTextLines::UTF8BOM
36 const EOL eolArray
[] =
52 IMPLEMENT_DYNAMIC(CEncodingDlg
, CDialog
)
54 CEncodingDlg::CEncodingDlg(CWnd
* pParent
)
55 : CDialog(CEncodingDlg::IDD
, pParent
)
56 , texttype(CFileTextLines::ASCII
)
57 , lineendings(EOL_AUTOLINE
)
61 CEncodingDlg::~CEncodingDlg()
65 void CEncodingDlg::DoDataExchange(CDataExchange
* pDX
)
67 CDialog::DoDataExchange(pDX
);
68 DDX_Control(pDX
, IDC_COMBO_ENCODING
, m_Encoding
);
69 DDX_Control(pDX
, IDC_COMBO_EOL
, m_EOL
);
73 BEGIN_MESSAGE_MAP(CEncodingDlg
, CDialog
)
79 void CEncodingDlg::OnCancel()
84 void CEncodingDlg::OnOK()
87 texttype
= uctArray
[m_Encoding
.GetCurSel()];
88 lineendings
= eolArray
[m_EOL
.GetCurSel()];
92 BOOL
CEncodingDlg::OnInitDialog()
94 CDialog::OnInitDialog();
97 GetWindowText(sTitle
);
98 sTitle
= view
+ sTitle
;
99 SetWindowText(sTitle
);
100 SetDlgItemText(IDC_VIEW
, view
);
102 for (int i
= 0; i
< _countof(uctArray
); i
++)
104 m_Encoding
.AddString(CFileTextLines::GetEncodingName(uctArray
[i
]));
105 if (texttype
== uctArray
[i
])
107 m_Encoding
.SetCurSel(i
);
111 for (int i
= 0; i
< _countof(eolArray
); i
++)
113 m_EOL
.AddString(GetEolName(eolArray
[i
]));
114 if (lineendings
== eolArray
[i
])