[Winmerge-svn] SF.net SVN: winmerge:[7502] branches/R2_14
Windows visual diff and merge for files and directories
Brought to you by:
christianlist,
grimmdp
From: <ge...@us...> - 2011-01-03 13:46:25
|
Revision: 7502 http://winmerge.svn.sourceforge.net/winmerge/?rev=7502&view=rev Author: gerundt Date: 2011-01-03 13:46:19 +0000 (Mon, 03 Jan 2011) Log Message: ----------- PATCH: #3010934 custom code as String or integer Fixes bug item #2813825 Patch submitted by Matthias Mayer Modified Paths: -------------- branches/R2_14/Docs/Users/ChangeLog.txt branches/R2_14/Src/PropCodepage.cpp branches/R2_14/Src/PropCodepage.h Modified: branches/R2_14/Docs/Users/ChangeLog.txt =================================================================== --- branches/R2_14/Docs/Users/ChangeLog.txt 2011-01-03 13:29:00 UTC (rev 7501) +++ branches/R2_14/Docs/Users/ChangeLog.txt 2011-01-03 13:46:19 UTC (rev 7502) @@ -15,6 +15,7 @@ Add /xq command line switch for closing WinMerge after identical files and not showing message (#2827836) Allow setting codepage from command line (#2725549) + Allow giving encoding name as custom codepage (#2813825, #3010934) Bugfix: Untranslated string ("Merge.rc:nnnn") was displayed in status bar (#3025855) Bugfix: Pane headers not updated after language change (#2923684) Modified: branches/R2_14/Src/PropCodepage.cpp =================================================================== --- branches/R2_14/Src/PropCodepage.cpp 2011-01-03 13:29:00 UTC (rev 7501) +++ branches/R2_14/Src/PropCodepage.cpp 2011-01-03 13:46:19 UTC (rev 7502) @@ -33,6 +33,7 @@ #include "OptionsDef.h" #include "OptionsMgr.h" #include "OptionsPanel.h" +#include "charsets.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -53,7 +54,7 @@ CPropertyPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(PropCodepage) DDX_Radio(pDX, IDC_CP_SYSTEM, m_nCodepageSystem); - DDX_Text(pDX, IDC_CUSTOM_CP_NUMBER, m_nCustomCodepageValue); + DDX_Text(pDX, IDC_CUSTOM_CP_NUMBER, m_cCustomCodepageValue); DDX_Check(pDX, IDC_DETECT_CODEPAGE, m_bDetectCodepage); //}}AFX_DATA_MAP } @@ -74,6 +75,7 @@ { m_nCodepageSystem = GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_MODE); m_nCustomCodepageValue = GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_CUSTOM); + m_cCustomCodepageValue.Format(_T("%d"),m_nCustomCodepageValue); m_bDetectCodepage = GetOptionsMgr()->GetBool(OPT_CP_DETECT); } @@ -83,6 +85,7 @@ void PropCodepage::WriteOptions() { GetOptionsMgr()->SaveOption(OPT_CP_DEFAULT_MODE, (int)m_nCodepageSystem); + GetEncodingCodePageFromNameString(); GetOptionsMgr()->SaveOption(OPT_CP_DEFAULT_CUSTOM, (int)m_nCustomCodepageValue); GetOptionsMgr()->SaveOption(OPT_CP_DETECT, m_bDetectCodepage == TRUE); } @@ -118,3 +121,20 @@ { GetDlgItem(IDC_CUSTOM_CP_NUMBER)->EnableWindow(FALSE); } + +void PropCodepage::GetEncodingCodePageFromNameString() +{ + int nCustomCodepageValue = _ttol(m_cCustomCodepageValue); + if (nCustomCodepageValue == 0) + { + char *result= new char[80]; + long len = wcslen(m_cCustomCodepageValue); + _wcstombsz(result, m_cCustomCodepageValue, len); //conversion to char * + result[len] = '\0'; //don't forget to put the caracter of terminated string + nCustomCodepageValue = GetEncodingCodePageFromName(result); + delete [] result; + } + //if found a new codepage valid + if (nCustomCodepageValue) + m_nCustomCodepageValue = nCustomCodepageValue; +} Modified: branches/R2_14/Src/PropCodepage.h =================================================================== --- branches/R2_14/Src/PropCodepage.h 2011-01-03 13:29:00 UTC (rev 7501) +++ branches/R2_14/Src/PropCodepage.h 2011-01-03 13:46:19 UTC (rev 7502) @@ -45,6 +45,7 @@ // Generated message map functions //{{AFX_MSG(PropCodepage) virtual BOOL OnInitDialog(); + void GetEncodingCodePageFromNameString(); afx_msg void OnCpSystem(); afx_msg void OnCpCustom(); afx_msg void OnCpUi(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |