Révision | 781d4ad78632e9c5e6092c0267f7dc0363170543 (tree) |
---|---|
l'heure | 2014-02-09 13:24:00 |
Auteur | sdottaka <sdottaka@sour...> |
Commiter | sdottaka |
Enable changing save codepage
--HG--
branch : stable
@@ -62,7 +62,7 @@ public : | ||
62 | 62 | ucr::UNICODESET getUnicoding() const { return m_encoding.m_unicoding; } |
63 | 63 | void setUnicoding(ucr::UNICODESET value) { m_encoding.m_unicoding = value; } |
64 | 64 | int getCodepage() const { return m_encoding.m_codepage; } |
65 | - void setCodepage(int value) { m_encoding.m_codepage = value; } | |
65 | + void setCodepage(int value) { m_encoding.SetCodepage(value); } | |
66 | 66 | bool getHasBom() const { return m_encoding.m_bom; } |
67 | 67 | void setHasBom(bool value) { m_encoding.m_bom = value; } |
68 | 68 | const FileTextEncoding & getEncoding() const { return m_encoding; } |
@@ -107,8 +107,9 @@ BOOL CLoadSaveCodepageDlg::OnInitDialog() | ||
107 | 107 | IExconverter *pexconv = Exconverter::getInstance(); |
108 | 108 | if (pexconv != NULL) |
109 | 109 | { |
110 | - CComboBox combo; | |
111 | - combo.Attach(::GetDlgItem(m_hWnd, IDC_LOAD_CODEPAGE_TEXTBOX)); | |
110 | + CComboBox combol, combos; | |
111 | + combol.Attach(::GetDlgItem(m_hWnd, IDC_LOAD_CODEPAGE_TEXTBOX)); | |
112 | + combos.Attach(::GetDlgItem(m_hWnd, IDC_SAVE_CODEPAGE_TEXTBOX)); | |
112 | 113 | CodePageInfo cpi[256]; |
113 | 114 | int count = pexconv->enumCodePages(cpi, sizeof(cpi)/sizeof(CodePageInfo)); |
114 | 115 | int i, j; |
@@ -118,13 +119,19 @@ BOOL CLoadSaveCodepageDlg::OnInitDialog() | ||
118 | 119 | continue; |
119 | 120 | TCHAR desc[256]; |
120 | 121 | wsprintf(desc, _T("%05d - %ls"), cpi[i].codepage, cpi[i].desc); |
121 | - combo.AddString(desc); | |
122 | - combo.SetItemData(j, cpi[i].codepage); | |
122 | + combol.AddString(desc); | |
123 | + combol.SetItemData(j, cpi[i].codepage); | |
124 | + combos.AddString(desc); | |
125 | + combos.SetItemData(j, cpi[i].codepage); | |
123 | 126 | if (cpi[i].codepage == m_nLoadCodepage) |
124 | - combo.SetCurSel(j); | |
127 | + { | |
128 | + combol.SetCurSel(j); | |
129 | + combos.SetCurSel(j); | |
130 | + } | |
125 | 131 | j++; |
126 | 132 | } |
127 | - combo.Detach(); | |
133 | + combol.Detach(); | |
134 | + combos.Detach(); | |
128 | 135 | } |
129 | 136 | |
130 | 137 | AfxGetMainWnd()->CenterWindow(this); |
@@ -50,6 +50,7 @@ bool CMergeDoc::DoFileEncodingDialog() | ||
50 | 50 | return false; |
51 | 51 | |
52 | 52 | CLoadSaveCodepageDlg dlg(m_nBuffers); |
53 | + dlg.EnableSaveCodepage(true); | |
53 | 54 | dlg.SetCodepages(m_ptBuf[0]->getCodepage()); |
54 | 55 | if (IDOK != dlg.DoModal()) |
55 | 56 | return false; |
@@ -79,7 +80,24 @@ bool CMergeDoc::DoFileEncodingDialog() | ||
79 | 80 | theApp.m_strDescriptions[pane] = m_strDesc[pane]; |
80 | 81 | } |
81 | 82 | OpenDocs(fileloc, bRO); |
82 | - | |
83 | + | |
84 | + if (dlg.GetSaveCodepage() != dlg.GetLoadCodepage()) | |
85 | + { | |
86 | + int nSaveCodepage = dlg.GetSaveCodepage(); | |
87 | + for (int pane = 0; pane < m_nBuffers; pane++) | |
88 | + { | |
89 | + bRO[pane] = m_ptBuf[pane]->GetReadOnly(); | |
90 | + if ((pane == 0 && doLeft) || | |
91 | + (pane == 1 && doRight && m_nBuffers < 3) || | |
92 | + (pane == 1 && doMiddle && m_nBuffers == 3) || | |
93 | + (pane == 2 && doRight && m_nBuffers == 3)) | |
94 | + { | |
95 | + m_ptBuf[pane]->setCodepage(nSaveCodepage); | |
96 | + m_ptBuf[pane]->SetModified(); | |
97 | + UpdateHeaderPath(pane); | |
98 | + } | |
99 | + } | |
100 | + } | |
83 | 101 | return true; |
84 | 102 | } |
85 | 103 |