OSDN Git Service

* Replace CString with String
authorsdottaka <none@none>
Sat, 6 Jul 2013 02:48:18 +0000 (11:48 +0900)
committersdottaka <none@none>
Sat, 6 Jul 2013 02:48:18 +0000 (11:48 +0900)
* Replace BOOL with bool
* Add DDXHelper.h for helping String<->CString conversion

73 files changed:
Src/AboutDlg.cpp
Src/AboutDlg.h
Src/CCPrompt.cpp
Src/CCPrompt.h
Src/Common/PreferencesDlg.cpp
Src/Common/PreferencesDlg.h
Src/ConfirmFolderCopyDlg.cpp
Src/ConfirmFolderCopyDlg.h
Src/DDXHelper.h [new file with mode: 0644]
Src/DirActions.cpp
Src/DirCmpReport.cpp
Src/DirCmpReportDlg.cpp
Src/DirCmpReportDlg.h
Src/DirColsDlg.cpp
Src/DirColsDlg.h
Src/DirDoc.cpp
Src/DirTravel.cpp
Src/DirView.cpp
Src/FileFiltersDlg.cpp
Src/FileFiltersDlg.h
Src/HexMergeDoc.cpp
Src/LineFiltersDlg.cpp
Src/LineFiltersDlg.h
Src/LoadSaveCodepageDlg.cpp
Src/LoadSaveCodepageDlg.h
Src/MainFrm.cpp
Src/Merge.vcxproj
Src/Merge.vcxproj.filters
Src/MergeDoc.cpp
Src/MergeEditView.cpp
Src/OpenView.cpp
Src/PatchDlg.cpp
Src/PatchDlg.h
Src/PatchTool.cpp
Src/PatchTool.h
Src/PluginsListDlg.cpp
Src/PluginsListDlg.h
Src/ProjectFilePathsDlg.cpp
Src/ProjectFilePathsDlg.h
Src/PropArchive.cpp
Src/PropArchive.h
Src/PropBackups.cpp
Src/PropBackups.h
Src/PropCodepage.cpp
Src/PropCodepage.h
Src/PropCompare.cpp
Src/PropCompare.h
Src/PropCompareFolder.cpp
Src/PropCompareFolder.h
Src/PropEditor.cpp
Src/PropEditor.h
Src/PropGeneral.cpp
Src/PropGeneral.h
Src/PropRegistry.cpp
Src/PropRegistry.h
Src/PropShell.cpp
Src/PropShell.h
Src/PropTextColors.cpp
Src/PropTextColors.h
Src/PropVss.cpp
Src/PropVss.h
Src/SaveClosingDlg.cpp
Src/SaveClosingDlg.h
Src/SelectUnpackerDlg.cpp
Src/SelectUnpackerDlg.h
Src/SharedFilterDlg.cpp
Src/SourceControl.cpp
Src/TestFilterDlg.cpp
Src/TestFilterDlg.h
Src/VssPrompt.cpp
Src/VssPrompt.h
Src/WMGotoDlg.cpp
Src/WMGotoDlg.h

index 096dc07..7d38a03 100644 (file)
@@ -30,7 +30,7 @@
 #include "version.h"
 #include "paths.h"
 #include "Environment.h"
-
+#include "DDXHelper.h"
 
 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
        //{{AFX_MSG_MAP(CAboutDlg)
@@ -70,11 +70,11 @@ BOOL CAboutDlg::OnInitDialog()
 
        CVersionInfo version(AfxGetResourceHandle());
        String sVersion = version.GetProductVersion();
-       m_strVersion = string_format_string1(_("Version %1"), sVersion).c_str();
+       m_strVersion = string_format_string1(_("Version %1"), sVersion);
 
 #ifdef _UNICODE
        m_strVersion += _T(" ");
-       m_strVersion += _("Unicode").c_str();
+       m_strVersion += _("Unicode");
 #endif
 
 #if defined _M_IX86
@@ -89,8 +89,7 @@ BOOL CAboutDlg::OnInitDialog()
        String sPrivateBuild = version.GetPrivateBuild();
        if (!sPrivateBuild.empty())
        {
-               m_strPrivateBuild = string_format_string1(_("Private Build: %1"),
-                       sPrivateBuild).c_str();
+               m_strPrivateBuild = string_format_string1(_("Private Build: %1"), sPrivateBuild);
        }
 
        String copyright = version.GetLegalCopyright();
index b59ea37..da09e42 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "statlink.h"
 #include "resource.h" // IDD_ABOUTBOX
+#include "UnicodeString.h"
 
 /** 
  * @brief About-dialog class.
@@ -45,8 +46,8 @@ public:
        enum { IDD = IDD_ABOUTBOX };
        CStatic m_ctlCompany;
        CStaticLink     m_ctlWWW;
-       CString m_strVersion;
-       CString m_strPrivateBuild;
+       String m_strVersion;
+       String m_strPrivateBuild;
        //}}AFX_DATA
 
        // ClassWizard generated virtual function overrides
index f6a908e..22bb5e7 100644 (file)
@@ -25,6 +25,7 @@
 #include "stdafx.h"
 #include "merge.h"
 #include "CCPrompt.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -34,8 +35,8 @@ static char THIS_FILE[] = __FILE__;
 
 CCCPrompt::CCCPrompt(CWnd* pParent /*=NULL*/)
        : CDialog(CCCPrompt::IDD, pParent)
-       , m_bMultiCheckouts(FALSE)
-       , m_bCheckin(FALSE)
+       , m_bMultiCheckouts(false)
+       , m_bCheckin(false)
 {
 }
 
index 1a18e9e..1e815ac 100644 (file)
@@ -26,6 +26,8 @@
 #if !defined(AFX_CCPROMPT_H__7ED564F2_CCB8_11D4_92BB_00B0D0221937__INCLUDED_)
 #define AFX_CCPROMPT_H__7ED564F2_CCB8_11D4_92BB_00B0D0221937__INCLUDED_
 
+#include "UnicodeString.h"
+
 /**
  * @brief A dialog for ClearCase checkout/checkin.
  */
@@ -38,7 +40,9 @@ public:
 // Dialog Data
        //{{AFX_DATA(CCCPrompt)
        enum { IDD = IDD_CLEARCASE };
-       CString m_comments;
+       String  m_comments;
+       bool m_bMultiCheckouts;
+       bool m_bCheckin;
        //}}AFX_DATA
 
 
@@ -58,10 +62,6 @@ protected:
        afx_msg void OnSaveas();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
-
-public:
-       BOOL m_bMultiCheckouts;
-       BOOL m_bCheckin;
 };
 
 //{{AFX_INSERT_LOCATION}}
index c8cd9b7..e8d8b88 100644 (file)
@@ -250,7 +250,7 @@ CString CPreferencesDlg::GetItemPath(HTREEITEM hti)
  * @brief Read options from storage to UI controls.
  * @param [in] bUpdate If TRUE UpdateData() is called
  */
-void CPreferencesDlg::ReadOptions(BOOL bUpdate)
+void CPreferencesDlg::ReadOptions(bool bUpdate)
 {
        m_pageGeneral.ReadOptions();
        m_pageMergeColors.ReadOptions();
@@ -362,7 +362,7 @@ void CPreferencesDlg::OnExportButton()
  * @param [in] pPage Propertypage to update.
  * @param bSaveAndValidate UpdateData direction parameter.
  */
-void CPreferencesDlg::SafeUpdatePage(CPropertyPage* pPage, BOOL bSaveAndValidate)
+void CPreferencesDlg::SafeUpdatePage(CPropertyPage* pPage, bool bSaveAndValidate)
 {
        if (pPage->GetSafeHwnd() != NULL)
                pPage->UpdateData(bSaveAndValidate);
index 6e41486..c149405 100644 (file)
@@ -104,9 +104,9 @@ protected:
        void AddPage(CPropertyPage* pPage, UINT nTopHeading, UINT nSubHeading);
        void SetActivePage(int nPage);
        CString GetItemPath(HTREEITEM hti);
-       void ReadOptions(BOOL bUpdate = FALSE);
+       void ReadOptions(bool bUpdate = false);
        void SaveOptions();
-       void SafeUpdatePage(CPropertyPage* pPage, BOOL bSaveAndValidate);
+       void SafeUpdatePage(CPropertyPage* pPage, bool bSaveAndValidate);
 
 private:
        COptionsMgr *m_pOptionsMgr;
index f062461..e6ad526 100644 (file)
@@ -25,6 +25,7 @@
 #include "stdafx.h"
 #include "Merge.h"
 #include "ConfirmFolderCopyDlg.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -81,8 +82,8 @@ BOOL ConfirmFolderCopyDlg::OnInitDialog()
        CStatic * pIcon = (CStatic *) GetDlgItem(IDC_FLDCONFIRM_ICON);
        pIcon->SetIcon(icon);
 
-       if (!m_caption.IsEmpty())
-               SetWindowText(m_caption);
+       if (!m_caption.empty())
+               SetWindowText(m_caption.c_str());
 
        // setup handler for resizing this dialog       
        m_constraint.InitializeCurrentSize(this);
index b5d6789..5d14b4f 100644 (file)
@@ -26,6 +26,7 @@
 #define _CONFIRM_FOLDER_COPY_DLG_H_
 
 #include "CMoveConstraint.h"
+#include "UnicodeString.h"
 
 /**
  * @brief Dialog for item copy confirmation.
@@ -48,12 +49,12 @@ protected:
        DECLARE_MESSAGE_MAP()
 public:
        
-       CString m_question;
-       CString m_fromText;
-       CString m_fromPath;
-       CString m_toText;
-       CString m_toPath;
-       CString m_caption;
+       String m_question;
+       String m_fromText;
+       String m_fromPath;
+       String m_toText;
+       String m_toPath;
+       String m_caption;
        afx_msg void OnBnClickedNo();
        afx_msg void OnBnClickedYes();
 
diff --git a/Src/DDXHelper.h b/Src/DDXHelper.h
new file mode 100644 (file)
index 0000000..53bbe84
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef _DDXHELPER_H_\r
+#define _DDXHELPER_H_\r
+\r
+#include "UnicodeString.h"\r
+\r
+// from http://stackoverflow.com/questions/6117270/mfc-stdstring-vs-cstring\r
+class PopString : public CString\r
+{\r
+public:\r
+    PopString(String & final) : CString(final.c_str()), m_final(final)\r
+    {\r
+       }\r
+\r
+    ~PopString()\r
+    {\r
+        m_final = (PCTSTR) *this;\r
+    }\r
+private:\r
+    PopString(const PopString &);  // private copy constructor to prevent copying\r
+    PopString & operator=(const PopString &);  // private copy operator\r
+\r
+    String & m_final;\r
+};\r
+\r
+inline void DDX_Check(CDataExchange* pDX, int nIDC, bool& value)\r
+{\r
+       BOOL BOOL_value = value;\r
+       DDX_Check(pDX, nIDC, BOOL_value);\r
+       value = !!BOOL_value;\r
+}\r
+\r
+inline void DDX_Radio(CDataExchange* pDX, int nIDC, bool& value)\r
+{\r
+       BOOL BOOL_value = value;\r
+       DDX_Radio(pDX, nIDC, BOOL_value);\r
+       value = !!BOOL_value;\r
+}\r
+\r
+inline void DDX_Text(CDataExchange* pDX, int nIDC, String& value)\r
+{\r
+       DDX_Text(pDX, nIDC, PopString(value));\r
+}\r
+\r
+inline void DDX_CBString(CDataExchange* pDX, int nIDC, String& value)\r
+{\r
+       DDX_CBString(pDX, nIDC, PopString(value));\r
+}\r
+\r
+inline void DDX_CBStringExact(CDataExchange* pDX, int nIDC, String& value)\r
+{\r
+       DDX_CBStringExact(pDX, nIDC, PopString(value));\r
+}\r
+\r
+#endif\r
index 15f81f9..7795dea 100644 (file)
@@ -161,11 +161,11 @@ static bool ConfirmDialog(const String &caption, const String &question,
        if (paths_DoesPathExist(dest) == IS_EXISTING_DIR)
                strDest = paths_AddTrailingSlash(dest);
 
-       dlg.m_question = question.c_str();
-       dlg.m_fromText = sOrig.c_str();
-       dlg.m_toText = sDest.c_str();
-       dlg.m_fromPath = strSrc.c_str();
-       dlg.m_toPath = strDest.c_str();
+       dlg.m_question = question;
+       dlg.m_fromText = sOrig;
+       dlg.m_toText = sDest;
+       dlg.m_fromPath = strSrc;
+       dlg.m_toPath = strDest;
 
        return (dlg.DoModal()==IDYES);
 }
@@ -1577,9 +1577,9 @@ void CDirView::FormatEncodingDialogDisplays(CLoadSaveCodepageDlg * dlg)
        String sSecondAffected = FormatFilesAffectedString(nSecondAffected, nSecond);
        String sThirdAffected = FormatFilesAffectedString(nThirdAffected, nThird);
        if (GetDocument()->m_nDirs < 3)
-               dlg->SetLeftRightAffectStrings(sFirstAffected.c_str(), _T(""), sSecondAffected.c_str());
+               dlg->SetLeftRightAffectStrings(sFirstAffected, _T(""), sSecondAffected);
        else
-               dlg->SetLeftRightAffectStrings(sFirstAffected.c_str(), sSecondAffected.c_str(), sThirdAffected.c_str());
+               dlg->SetLeftRightAffectStrings(sFirstAffected, sSecondAffected, sThirdAffected);
        int codepage = currentCodepages.FindMaxKey();
        dlg->SetCodepages(codepage);
 }
index c77782f..756f1d9 100644 (file)
@@ -170,16 +170,16 @@ bool DirCmpReport::GenerateReport(String &errStr)
                        }
                        CloseClipboard();
                }
-               if (!dlg.m_sReportFile.IsEmpty())
+               if (!dlg.m_sReportFile.empty())
                {
                        String path;
-                       paths_SplitFilename((const TCHAR *)dlg.m_sReportFile, &path, NULL, NULL);
+                       paths_SplitFilename(dlg.m_sReportFile, &path, NULL, NULL);
                        if (!paths_CreateIfNeeded(path))
                        {
                                errStr = _("Folder does not exist.");
                                return FALSE;
                        }
-                       CFile file(dlg.m_sReportFile,
+                       CFile file(dlg.m_sReportFile.c_str(),
                                CFile::modeWrite|CFile::modeCreate|CFile::shareDenyWrite);
                        m_pFile = &file;
                        m_bIncludeFileCmpReport = !!dlg.m_bIncludeFileCmpReport;
index 6ed01cf..eaf77dc 100644 (file)
@@ -16,6 +16,7 @@
 #include "FileOrFolderSelect.h"
 #include "Merge.h"
 #include "DirCmpReportDlg.h"
+#include "DDXHelper.h"
 
 IMPLEMENT_DYNAMIC(DirCmpReportDlg, CDialog)
 
@@ -24,8 +25,8 @@ IMPLEMENT_DYNAMIC(DirCmpReportDlg, CDialog)
  */
 DirCmpReportDlg::DirCmpReportDlg(CWnd* pParent /*=NULL*/)
        : CDialog(DirCmpReportDlg::IDD, pParent)
-       , m_bCopyToClipboard(FALSE)
-       , m_bIncludeFileCmpReport(FALSE)
+       , m_bCopyToClipboard(false)
+       , m_bIncludeFileCmpReport(false)
 {
 }
 
@@ -96,8 +97,8 @@ BOOL DirCmpReportDlg::OnInitDialog()
 
        m_ctlReportFile.LoadState(_T("ReportFiles"));
        m_nReportType = static_cast<REPORT_TYPE>(theApp.GetProfileInt(_T("ReportFiles"), _T("ReportType"), 0));
-       m_bCopyToClipboard = theApp.GetProfileInt(_T("ReportFiles"), _T("CopoyToClipboard"), FALSE);
-       m_bIncludeFileCmpReport = theApp.GetProfileInt(_T("ReportFiles"), _T("IncludeFileCmpReport"), FALSE);
+       m_bCopyToClipboard = !!theApp.GetProfileInt(_T("ReportFiles"), _T("CopoyToClipboard"), false);
+       m_bIncludeFileCmpReport = !!theApp.GetProfileInt(_T("ReportFiles"), _T("IncludeFileCmpReport"), false);
 
        for (int i = 0; i < sizeof(f_types) / sizeof(f_types[0]); ++i)
        {
@@ -114,7 +115,7 @@ BOOL DirCmpReportDlg::OnInitDialog()
 
        // Set selected path to variable so file selection dialog shows
        // correct filename and path.
-       m_ctlReportFile.GetWindowText(m_sReportFile);
+       m_ctlReportFile.GetWindowText(PopString(m_sReportFile));
 
        UpdateData(FALSE);
 
@@ -129,14 +130,14 @@ void DirCmpReportDlg::OnBtnClickReportBrowse()
 {
        UpdateData(TRUE);
 
-       CString folder = m_sReportFile;
+       String folder = m_sReportFile;
        String filter = tr(f_types[m_ctlStyle.GetCurSel()].browseFilter);
 
        String chosenFilepath;
-       if (SelectFile(GetSafeHwnd(), chosenFilepath, folder, _("Save As"),
+       if (SelectFile(GetSafeHwnd(), chosenFilepath, folder.c_str(), _("Save As"),
                        filter, FALSE))
        {
-               m_sReportFile = chosenFilepath.c_str();
+               m_sReportFile = chosenFilepath;
                m_ctlReportFile.SetWindowText(chosenFilepath.c_str());
        }
 }
@@ -165,16 +166,16 @@ void DirCmpReportDlg::OnOK()
        int sel = m_ctlStyle.GetCurSel();
        m_nReportType = (REPORT_TYPE)m_ctlStyle.GetItemData(sel);
 
-       if (m_sReportFile.IsEmpty() && !m_bCopyToClipboard)
+       if (m_sReportFile.empty() && !m_bCopyToClipboard)
        {
                LangMessageBox(IDS_MUST_SPECIFY_OUTPUT, MB_ICONSTOP);
                m_ctlReportFile.SetFocus();
                return;
        }
 
-       if (!m_sReportFile.IsEmpty())
+       if (!m_sReportFile.empty())
        {
-               if (paths_DoesPathExist((const TCHAR *)m_sReportFile) == IS_EXISTING_FILE)
+               if (paths_DoesPathExist(m_sReportFile) == IS_EXISTING_FILE)
                {
                        int overWrite = LangMessageBox(IDS_REPORT_FILEOVERWRITE,
                                        MB_YESNO | MB_ICONWARNING | MB_DONT_ASK_AGAIN,
index 735354c..179d112 100644 (file)
@@ -45,11 +45,11 @@ public:
 
        //{{AFX_DATA(DirCmpReportDlg)
        CSuperComboBox m_ctlReportFile; /**< Report filename control */
-       CString m_sReportFile; /**< Report filename string */
+       String m_sReportFile; /**< Report filename string */
        CComboBox m_ctlStyle; /**< Report type control */
        REPORT_TYPE m_nReportType; /**< Report type integer */
-       BOOL m_bCopyToClipboard; /**< Do we copy report to clipboard? */
-       BOOL m_bIncludeFileCmpReport; /**< Do we include file compare report in folder compare report? */
+       bool m_bCopyToClipboard; /**< Do we copy report to clipboard? */
+       bool m_bIncludeFileCmpReport; /**< Do we include file compare report in folder compare report? */
        //}}AFX_DATA
 };
 
index 4dd6f34..7e8f4ff 100644 (file)
@@ -29,7 +29,7 @@ static char THIS_FILE[] = __FILE__;
  */
 CDirColsDlg::CDirColsDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CDirColsDlg::IDD, pParent)
-       , m_bReset(FALSE)
+       , m_bReset(false)
 {
 }
 
@@ -153,7 +153,7 @@ bool CDirColsDlg::CompareColumnsByLogicalOrder( const column & el1, const column
 void CDirColsDlg::MoveItem(int index, int newIndex)
 {
        // Get current column data
-       CString text = m_listColumns.GetItemText(index, 0);
+       String text =  m_listColumns.GetItemText(index, 0);
        BOOL checked = m_listColumns.GetCheck(index);
        UINT state = m_listColumns.GetItemState(index, LVIS_SELECTED);
        DWORD_PTR data = m_listColumns.GetItemData(index);
@@ -162,7 +162,7 @@ void CDirColsDlg::MoveItem(int index, int newIndex)
        m_listColumns.DeleteItem(index);
        
        // Insert column in new index
-       m_listColumns.InsertItem(newIndex, text);
+       m_listColumns.InsertItem(newIndex, text.c_str());
        m_listColumns.SetItemState(newIndex, state, LVIS_SELECTED);
        m_listColumns.SetItemData(newIndex, data);
        if (checked)
@@ -174,7 +174,7 @@ void CDirColsDlg::MoveItem(int index, int newIndex)
  * @param [in] bUp If TRUE items are moved up,
  *  if FALSE items are moved down.
  */
-void CDirColsDlg::MoveSelectedItems(BOOL bUp)
+void CDirColsDlg::MoveSelectedItems(bool bUp)
 {
        int firstInd = -1;
        POSITION pos = m_listColumns.GetFirstSelectedItemPosition();
@@ -259,7 +259,7 @@ void CDirColsDlg::OnOK()
 void CDirColsDlg::OnDefaults()
 {
        m_listColumns.DeleteAllItems();
-       m_bReset = TRUE;
+       m_bReset = true;
        LoadDefLists();
 }
 
index 1fb6161..f95167f 100644 (file)
@@ -60,7 +60,7 @@ public:
        //{{AFX_DATA(CDirColsDlg)
        enum { IDD = IDD_DIRCOLS };
        CListCtrl m_listColumns;
-       BOOL m_bReset;
+       bool m_bReset;
        //}}AFX_DATA
 
 
@@ -79,7 +79,7 @@ protected:
        void LoadDefLists();
        void SortArrayToLogicalOrder();
        void MoveItem(int index, int newIndex);
-       void MoveSelectedItems(BOOL bUp);
+       void MoveSelectedItems(bool bUp);
        void SanitizeOrder();
 
 // Implementation data
index 2d5acc6..28b93dd 100644 (file)
@@ -188,7 +188,7 @@ void CDirDoc::InitCompare(const PathContext & paths, bool bRecursive, CTempPathC
 
        m_pCtxt.reset(new CDiffContext(paths,
                        GetOptionsMgr()->GetInt(OPT_CMP_METHOD)));
-       m_pCtxt->m_bRecursive = !!bRecursive;
+       m_pCtxt->m_bRecursive = bRecursive;
 
        if (pTempPathContext)
        {
@@ -361,7 +361,7 @@ void CDirDoc::Rescan()
        m_pCtxt->m_bWalkUniques = GetOptionsMgr()->GetBool(OPT_CMP_WALK_UNIQUE_DIRS);
        m_pCtxt->m_bIgnoreReparsePoints = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_REPARSE_POINTS);
        m_pCtxt->m_pCompareStats = m_pCompareStats.get();
-       m_pCtxt->m_bRecursive = !!m_bRecursive;
+       m_pCtxt->m_bRecursive = m_bRecursive;
 
        // Set total items count since we don't collect items
        if (m_bMarkedRescan)
index a0952e9..a350171 100644 (file)
@@ -98,7 +98,7 @@ static void LoadFiles(const String& sDir, DirItemArray * dirs, DirItemArray * fi
                                continue;
 
                        DirItem ent;
-                       ent.bIsDir = !!bIsDirectory;
+                       ent.bIsDir = bIsDirectory;
 
                        // Save filetimes as seconds since January 1, 1970
                        // Note that times can be < 0 if they are around that 1970..
index 1dc172d..fd3a97a 100644 (file)
@@ -1811,7 +1811,7 @@ void CDirView::OpenSelectionHex()
        // Open identical and different files
        bool bRO[3];
        for (int nIndex = 0; nIndex < paths.GetSize(); nIndex++)
-               bRO[nIndex] = !!pDoc->GetReadOnly(true);
+               bRO[nIndex] = pDoc->GetReadOnly(true);
 
        GetMainFrame()->ShowHexMergeDoc(pDoc, paths, bRO);
 }
@@ -3126,7 +3126,7 @@ void CDirView::OnCtxtOpenWithUnpacker()
        if (sel != -1)
        {
                // let the user choose a handler
-               CSelectUnpackerDlg dlg(GetDiffItem(sel).diffFileInfo[0].filename.c_str(), this);
+               CSelectUnpackerDlg dlg(GetDiffItem(sel).diffFileInfo[0].filename, this);
                // create now a new infoUnpacker to initialize the manual/automatic flag
                PackingInfo infoUnpacker(PLUGIN_AUTO);
                dlg.SetInitialInfoHandler(&infoUnpacker);
index 905866a..03568d2 100644 (file)
@@ -156,7 +156,7 @@ void FileFiltersDlg::InitList()
 void FileFiltersDlg::SelectFilterByIndex(int index)
 {
        m_listFilters.SetItemState(index, LVIS_SELECTED, LVIS_SELECTED);
-       BOOL bPartialOk = FALSE;
+       bool bPartialOk = false;
        m_listFilters.EnsureVisible(index, bPartialOk);
 }
 
@@ -237,7 +237,7 @@ void FileFiltersDlg::OnFiltersEditbtn()
        // Can't edit first "None"
        if (sel > 0)
        {
-               CString path = m_listFilters.GetItemText(sel, 2);
+               String path = m_listFilters.GetItemText(sel, 2);
                EditFileFilter(path);
        }
 }
@@ -246,7 +246,7 @@ void FileFiltersDlg::OnFiltersEditbtn()
  * @brief Edit file filter in external editor.
  * @param [in] path Full path to file filter to edit.
  */
-void FileFiltersDlg::EditFileFilter(LPCTSTR path)
+void FileFiltersDlg::EditFileFilter(const String& path)
 {
        CMainFrame::OpenFileToExternalEditor(path);
 }
@@ -283,9 +283,9 @@ static void EnableDlgItem(CWnd * parent, int item, bool enable)
 bool FileFiltersDlg::IsFilterItemNone(int item) const
 {
        String txtNone = _("<None>");
-       CString txt = m_listFilters.GetItemText(item, 0);
+       String txt = m_listFilters.GetItemText(item, 0);
 
-       return (txt.CompareNoCase(txtNone.c_str()) == 0);
+       return (string_compare_nocase(txt, txtNone) == 0);
 }
 
 /**
@@ -303,9 +303,9 @@ void FileFiltersDlg::OnLvnItemchangedFilterfileList(NMHDR *pNMHDR, LRESULT *pRes
        if (pNMLV->uNewState & LVIS_SELECTED)
        {
                String txtNone = _("<None>");
-               CString txt = m_listFilters.GetItemText(pNMLV->iItem, 0);
+               String txt = m_listFilters.GetItemText(pNMLV->iItem, 0);
 
-               bool isNone = txt.CompareNoCase(txtNone.c_str()) == 0;
+               bool isNone = string_compare_nocase(txt, txtNone) == 0;
 
                EnableDlgItem(this, IDC_FILTERFILE_TEST_BTN, !isNone);
                EnableDlgItem(this, IDC_FILTERFILE_EDITBTN, !isNone);
@@ -335,8 +335,8 @@ void FileFiltersDlg::OnInfoTip(NMHDR * pNMHDR, LRESULT * pResult)
                if ((lvhti.flags & LVHT_ONITEMICON) || (lvhti.flags & LVHT_ONITEMLABEL))
                {
                        // Set item text to tooltip
-                       CString strText = m_listFilters.GetItemText(lvhti.iItem, lvhti.iSubItem);
-                       _tcscpy(pInfoTip->pszText, strText);
+                       String strText = m_listFilters.GetItemText(lvhti.iItem, lvhti.iSubItem);
+                       _tcscpy(pInfoTip->pszText, strText.c_str());
                }
        }
 }
@@ -461,7 +461,7 @@ void FileFiltersDlg::OnBnClickedFilterfileNewbutton()
                        AfxMessageBox(msg.c_str(), MB_ICONERROR);
                        return;
                }
-               EditFileFilter(s.c_str());
+               EditFileFilter(s);
                FileFilterMgr *pMgr = theApp.m_globalFileFilter.GetManager();
                int retval = pMgr->AddFilter(s.c_str());
                if (retval == FILTER_OK)
@@ -482,7 +482,7 @@ void FileFiltersDlg::OnBnClickedFilterfileNewbutton()
  */
 void FileFiltersDlg::OnBnClickedFilterfileDelete()
 {
-       CString path;
+       String path;
        int sel =- 1;
 
        sel = m_listFilters.GetNextItem(sel, LVNI_SELECTED);
@@ -490,17 +490,16 @@ void FileFiltersDlg::OnBnClickedFilterfileDelete()
        // Can't delete first "None"
        if (sel > 0)
        {
-               m_listFilters.GetItemText(sel, 2, path.GetBuffer(MAX_PATH),     MAX_PATH);
-               path.ReleaseBuffer();
+               path = m_listFilters.GetItemText(sel, 2);
 
-               String sConfirm = string_format_string1(_("Are you sure you want to delete\n\n%1 ?"), (LPCTSTR)path);
+               String sConfirm = string_format_string1(_("Are you sure you want to delete\n\n%1 ?"), path);
                int res = AfxMessageBox(sConfirm.c_str(), MB_ICONWARNING | MB_YESNO);
                if (res == IDYES)
                {
-                       if (DeleteFile(path))
+                       if (DeleteFile(path.c_str()))
                        {
                                FileFilterMgr *pMgr = theApp.m_globalFileFilter.GetManager();
-                               pMgr->RemoveFilter((LPCTSTR)path);
+                               pMgr->RemoveFilter(path);
                                
                                // Remove all from filterslist and re-add so we can update UI
                                String selected;
@@ -513,7 +512,7 @@ void FileFiltersDlg::OnBnClickedFilterfileDelete()
                        {
                                String msg = string_format_string1(
                                        _("Failed to delete the filter file:\n%1\n\nMaybe the file is read-only?"),
-                                       (LPCTSTR)path);
+                                       path);
                                AfxMessageBox(msg.c_str(), MB_ICONSTOP);
                        }
                }
index 0024434..1bee54a 100644 (file)
@@ -65,7 +65,7 @@ protected:
        void AddToGrid(int filterIndex);
        bool IsFilterItemNone(int item) const;
        void UpdateFiltersList();
-       void EditFileFilter(LPCTSTR path);
+       void EditFileFilter(const String& path);
 
 // Overrides
        // ClassWizard generated virtual function overrides
index 7259a1a..13f91b3 100644 (file)
@@ -231,27 +231,27 @@ BOOL CHexMergeDoc::PromptAndSaveIfNeeded(BOOL bAllowCancel)
        const String &pathRight = m_filePaths.GetRight();
 
        BOOL result = TRUE;
-       BOOL bLSaveSuccess = FALSE, bMSaveSuccess = FALSE, bRSaveSuccess = FALSE;
+       bool bLSaveSuccess = false, bMSaveSuccess = false, bRSaveSuccess = false;
 
        SaveClosingDlg dlg;
        dlg.DoAskFor(bLModified, bMModified, bRModified);
        if (!bAllowCancel)
-               dlg.m_bDisableCancel = TRUE;
+               dlg.m_bDisableCancel = true;
        if (!pathLeft.empty())
-               dlg.m_sLeftFile = pathLeft.c_str();
+               dlg.m_sLeftFile = pathLeft;
        else
-               dlg.m_sLeftFile = m_strDesc[0].c_str();
+               dlg.m_sLeftFile = m_strDesc[0];
        if (m_nBuffers == 3)
        {
                if (!pathMiddle.empty())
-                       dlg.m_sMiddleFile = pathMiddle.c_str();
+                       dlg.m_sMiddleFile = pathMiddle;
                else
-                       dlg.m_sMiddleFile = m_strDesc[1].c_str();
+                       dlg.m_sMiddleFile = m_strDesc[1];
        }
        if (!pathRight.empty())
-               dlg.m_sRightFile = pathRight.c_str();
+               dlg.m_sRightFile = pathRight;
        else
-               dlg.m_sRightFile = m_strDesc[1].c_str();
+               dlg.m_sRightFile = m_strDesc[1];
 
        if (dlg.DoModal() == IDOK)
        {
index 64f24e9..9672f9d 100644 (file)
@@ -11,6 +11,7 @@
 #include "LineFiltersList.h"
 #include "MainFrm.h"
 #include "LineFiltersDlg.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -96,11 +97,11 @@ void LineFiltersDlg::InitList()
        String title = _("Regular expression");
        m_filtersList.InsertColumn(1, title.c_str(), LVCFMT_LEFT, 500);
 
-       int count = m_pList->GetCount();
-       for (int i = 0; i < count; i++)
+       size_t count = m_pList->GetCount();
+       for (size_t i = 0; i < count; i++)
        {
                const LineFilterItem &item = m_pList->GetAt(i);
-               AddRow(item.filterStr.c_str(), item.enabled);
+               AddRow(item.filterStr, item.enabled);
        }
        m_filtersList.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
        UpdateData(FALSE);
@@ -120,10 +121,10 @@ void LineFiltersDlg::OnHelp()
  * @param [in] enabled Is filter enabled?
  * @return Index of added row.
  */
-int LineFiltersDlg::AddRow(LPCTSTR filter /*= NULL*/, BOOL enabled /*=FALSE*/)
+int LineFiltersDlg::AddRow(const String& filter /*= NULL*/, bool enabled /*=false*/)
 {
        int items = m_filtersList.GetItemCount();
-       int ind = m_filtersList.InsertItem(items, filter);
+       int ind = m_filtersList.InsertItem(items, filter.c_str());
        m_filtersList.SetCheck(ind, enabled);
        return ind;
 }
@@ -205,7 +206,7 @@ void LineFiltersDlg::OnBnClickedLfilterRemovebtn()
        if (newSel >= -1)
        {
                m_filtersList.SetItemState(newSel, LVIS_SELECTED, LVIS_SELECTED);
-               BOOL bPartialOk = FALSE;
+               bool bPartialOk = false;
                m_filtersList.EnsureVisible(newSel, bPartialOk);
        }
 }
index 0e058f6..74301bc 100644 (file)
@@ -30,7 +30,7 @@ public:
 // Dialog Data
        //{{AFX_DATA(LineFiltersDlg)
        enum { IDD = IDD_PROPPAGE_FILTER };
-       BOOL    m_bIgnoreRegExp;
+       bool    m_bIgnoreRegExp;
        //}}AFX_DATA
 
 // Overrides
@@ -58,7 +58,7 @@ protected:
        DECLARE_MESSAGE_MAP()
 
        void InitList();
-       int AddRow(LPCTSTR filter = NULL, BOOL enabled = FALSE);
+       int AddRow(const String& filter = NULL, bool enabled = false);
        void EditSelectedFilter();
 
 private:
index 5734166..1683209 100644 (file)
@@ -13,6 +13,7 @@
 #include "LoadSaveCodepageDlg.h"
 #include "unicoder.h"
 #include "ExConverter.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -26,12 +27,12 @@ static char THIS_FILE[] = __FILE__;
 
 CLoadSaveCodepageDlg::CLoadSaveCodepageDlg(int nFiles, CWnd* pParent /*=NULL*/)
 : CDialog(CLoadSaveCodepageDlg::IDD, pParent)
-, m_bAffectsLeft(TRUE)
-, m_bAffectsMiddle(TRUE)
-, m_bAffectsRight(TRUE)
-, m_bLoadSaveSameCodepage(TRUE)
-// CString m_sAffectsLeftString
-// CString m_sAffectsRightString
+, m_bAffectsLeft(true)
+, m_bAffectsMiddle(true)
+, m_bAffectsRight(true)
+, m_bLoadSaveSameCodepage(true)
+// String m_sAffectsLeftString
+// String m_sAffectsRightString
 , m_nLoadCodepage(-1)
 , m_nSaveCodepage(-1)
 , m_bEnableSaveCodepage(false)
@@ -42,7 +43,7 @@ CLoadSaveCodepageDlg::CLoadSaveCodepageDlg(int nFiles, CWnd* pParent /*=NULL*/)
        //}}AFX_DATA_INIT
 }
 
-void CLoadSaveCodepageDlg::SetLeftRightAffectStrings(const CString & sAffectsLeft, const CString & sAffectsMiddle, const CString & sAffectsRight)
+void CLoadSaveCodepageDlg::SetLeftRightAffectStrings(const String & sAffectsLeft, const String & sAffectsMiddle, const String & sAffectsRight)
 {
        m_sAffectsLeftString = sAffectsLeft;
        m_sAffectsMiddleString = sAffectsMiddle;
@@ -132,9 +133,9 @@ BOOL CLoadSaveCodepageDlg::OnInitDialog()
 
        CMainFrame::CenterToMainFrame(this);
 
-       SetDlgItemText(IDC_LEFT_FILES_LABEL, m_sAffectsLeftString);
-       SetDlgItemText(IDC_MIDDLE_FILES_LABEL, m_sAffectsMiddleString);
-       SetDlgItemText(IDC_RIGHT_FILES_LABEL, m_sAffectsRightString);
+       SetDlgItemText(IDC_LEFT_FILES_LABEL, m_sAffectsLeftString.c_str());
+       SetDlgItemText(IDC_MIDDLE_FILES_LABEL, m_sAffectsMiddleString.c_str());
+       SetDlgItemText(IDC_RIGHT_FILES_LABEL, m_sAffectsRightString.c_str());
 
        UpdateSaveGroup();
 
index 487e364..4bdaa4b 100644 (file)
@@ -12,6 +12,7 @@
 #pragma once
 
 #include "CMoveConstraint.h"
+#include "UnicodeString.h"
 
 /////////////////////////////////////////////////////////////////////////////
 // CLoadSaveCodepageDlg dialog
@@ -21,16 +22,16 @@ class CLoadSaveCodepageDlg : public CDialog
 public:
 // Construction
        CLoadSaveCodepageDlg(int nFiles, CWnd* pParent = NULL);   // standard constructor
-       void SetLeftRightAffectStrings(const CString & sAffectsLeft, const CString & sAffectsMiddle, const CString & sAffectsRight);
+       void SetLeftRightAffectStrings(const String & sAffectsLeft, const String & sAffectsMiddle, const String & sAffectsRight);
        void EnableSaveCodepage(bool enable) { m_bEnableSaveCodepage = enable; }
        void SetCodepages(int codepage) { m_nLoadCodepage = m_nSaveCodepage = codepage; }
 
 // Reading results
        int GetLoadCodepage() const { return m_nLoadCodepage; }
        int GetSaveCodepage() const { return m_nSaveCodepage; }
-       bool DoesAffectLeft() const { return !!m_bAffectsLeft; }
-       bool DoesAffectMiddle() const { return !!m_bAffectsMiddle; }
-       bool DoesAffectRight() const { return !!m_bAffectsRight; }
+       bool DoesAffectLeft() const { return m_bAffectsLeft; }
+       bool DoesAffectMiddle() const { return m_bAffectsMiddle; }
+       bool DoesAffectRight() const { return m_bAffectsRight; }
 
 // Implementation methods
 private:
@@ -46,17 +47,17 @@ private:
 // Dialog Data
        //{{AFX_DATA(CLoadSaveCodepageDlg)
        enum { IDD = IDD_LOAD_SAVE_CODEPAGE };
-       BOOL    m_bAffectsLeft;
-       BOOL    m_bAffectsMiddle;
-       BOOL    m_bAffectsRight;
-       BOOL    m_bLoadSaveSameCodepage;
+       bool    m_bAffectsLeft;
+       bool    m_bAffectsMiddle;
+       bool    m_bAffectsRight;
+       bool    m_bLoadSaveSameCodepage;
        CButton m_AffectsLeftBtn;
        CButton m_AffectsMiddleBtn;
        CButton m_AffectsRightBtn;
        //}}AFX_DATA
-       CString m_sAffectsLeftString;
-       CString m_sAffectsMiddleString;
-       CString m_sAffectsRightString;
+       String m_sAffectsLeftString;
+       String m_sAffectsMiddleString;
+       String m_sAffectsRightString;
        int m_nLoadCodepage;
        int m_nSaveCodepage;
        bool m_bEnableSaveCodepage;
index 33f6f6f..cae8ce8 100644 (file)
@@ -2831,7 +2831,7 @@ void CMainFrame::OnSaveProject()
                CMergeDoc * pMergeDoc = (CMergeDoc *) pFrame->GetActiveDocument();
                left = pMergeDoc->m_filePaths.GetLeft();
                right = pMergeDoc->m_filePaths.GetRight();
-               pathsDlg.SetPaths(left.c_str(), right.c_str());
+               pathsDlg.SetPaths(left, right);
                pathsDlg.m_bLeftPathReadOnly = pMergeDoc->m_ptBuf[0]->GetReadOnly();
                pathsDlg.m_bRightPathReadOnly = pMergeDoc->m_ptBuf[1]->GetReadOnly();
        }
@@ -2843,14 +2843,13 @@ void CMainFrame::OnSaveProject()
                right = paths_AddTrailingSlash(pDoc->GetRightBasePath());
                
                // Set-up the dialog
-               pathsDlg.SetPaths(left.c_str(), right.c_str());
+               pathsDlg.SetPaths(left, right);
                pathsDlg.m_bIncludeSubfolders = pDoc->GetRecursive();
                pathsDlg.m_bLeftPathReadOnly = pDoc->GetReadOnly(0);
                pathsDlg.m_bRightPathReadOnly = pDoc->GetReadOnly(pDoc->m_nDirs - 1);
        }
 
-       String filterNameOrMask = theApp.m_globalFileFilter.GetFilterNameOrMask();
-       pathsDlg.m_sFilter = filterNameOrMask.c_str();
+       pathsDlg.m_sFilter = theApp.m_globalFileFilter.GetFilterNameOrMask();
        sht.DoModal();
 }
 
index cc98a37..904276f 100644 (file)
     <ClInclude Include="Common\coretypes.h" />\r
     <ClInclude Include="Common\CSubclass.h" />\r
     <ClInclude Include="CustomColors.h" />\r
+    <ClInclude Include="DDXHelper.h" />\r
     <ClInclude Include="Diff3.h" />\r
     <ClInclude Include="DiffContext.h" />\r
     <ClInclude Include="DiffFileData.h" />\r
index 63b2c00..81c6255 100644 (file)
     <ClInclude Include="SourceControl.h">\r
       <Filter>MFCGui\Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="DDXHelper.h">\r
+      <Filter>MFCGui\Dialogs</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="res\binarydiff.ico">\r
index 56d47e7..2f1e7c9 100644 (file)
@@ -500,7 +500,7 @@ int CMergeDoc::Rescan(bool &bBinary, IDENTLEVEL &identical,
        m_diffWrapper.SetCodepage(bForceUTF8 ? CP_UTF8 : (m_ptBuf[0]->m_encoding.m_unicoding ? CP_UTF8 : m_ptBuf[0]->m_encoding.m_codepage));
        m_diffWrapper.SetCodepage(m_ptBuf[0]->m_encoding.m_unicoding ?
                        CP_UTF8 : m_ptBuf[0]->m_encoding.m_codepage);
-       diffSuccess = !!m_diffWrapper.RunFileDiff();
+       diffSuccess = m_diffWrapper.RunFileDiff();
 
        // Read diff-status
        DIFFSTATUS status;
@@ -2094,33 +2094,33 @@ bool CMergeDoc::PromptAndSaveIfNeeded(bool bAllowCancel)
        if (!m_filePaths.GetLeft().empty())
        {
                if (GetMainFrame()->m_strSaveAsPath.IsEmpty())
-                       dlg.m_sLeftFile = m_filePaths.GetLeft().c_str();
+                       dlg.m_sLeftFile = m_filePaths.GetLeft();
                else
                        dlg.m_sLeftFile = GetMainFrame()->m_strSaveAsPath;
        }
        else
-               dlg.m_sLeftFile = m_strDesc[0].c_str();
+               dlg.m_sLeftFile = m_strDesc[0];
        if (m_nBuffers == 3)
        {
                if (!m_filePaths.GetMiddle().empty())
                {
                        if (GetMainFrame()->m_strSaveAsPath.IsEmpty())
-                               dlg.m_sMiddleFile = m_filePaths.GetMiddle().c_str();
+                               dlg.m_sMiddleFile = m_filePaths.GetMiddle();
                        else
                                dlg.m_sMiddleFile = GetMainFrame()->m_strSaveAsPath;
                }
                else
-                       dlg.m_sMiddleFile = m_strDesc[1].c_str();
+                       dlg.m_sMiddleFile = m_strDesc[1];
        }
        if (!m_filePaths.GetRight().empty())
        {
                if (GetMainFrame()->m_strSaveAsPath.IsEmpty())
-                       dlg.m_sRightFile = m_filePaths.GetRight().c_str();
+                       dlg.m_sRightFile = m_filePaths.GetRight();
                else
                        dlg.m_sRightFile = GetMainFrame()->m_strSaveAsPath;
        }
        else
-               dlg.m_sRightFile = m_strDesc[m_nBuffers - 1].c_str();
+               dlg.m_sRightFile = m_strDesc[m_nBuffers - 1];
 
        if (dlg.DoModal() == IDOK)
        {
@@ -3098,7 +3098,7 @@ void CMergeDoc::SwapFiles()
 bool CMergeDoc::OpenWithUnpackerDialog()
 {
        // let the user choose a handler
-       CSelectUnpackerDlg dlg(m_filePaths[0].c_str(), NULL);
+       CSelectUnpackerDlg dlg(m_filePaths[0], NULL);
        // create now a new infoUnpacker to initialize the manual/automatic flag
        PackingInfo infoUnpacker(PLUGIN_AUTO);
        dlg.SetInitialInfoHandler(&infoUnpacker);
index 69dd3bc..36cc8bf 100644 (file)
@@ -2959,7 +2959,7 @@ void CMergeEditView::OnWMGoto()
        nLastLine = pDoc->m_ptBuf[m_nThisPane]->ComputeRealLine(nLineCount - 1);
 
        // Set active file and current line selected in dialog
-       dlg.m_strParam.Format(_T("%d"), nRealLine + 1);
+       dlg.m_strParam = string_format(_T("%d"), nRealLine + 1);
        dlg.m_nFile = (pDoc->m_nBuffers < 3) ? (m_nThisPane == 1 ? 2 : 0) : m_nThisPane;
        dlg.m_nGotoWhat = 0;
 
@@ -2973,7 +2973,7 @@ void CMergeEditView::OnWMGoto()
 
                if (dlg.m_nGotoWhat == 0)
                {
-                       int nRealLine = _ttoi(dlg.m_strParam) - 1;
+                       int nRealLine = _ttoi(dlg.m_strParam.c_str()) - 1;
                        if (nRealLine < 0)
                                nRealLine = 0;
                        if (nRealLine > nLastLine)
@@ -2983,7 +2983,7 @@ void CMergeEditView::OnWMGoto()
                }
                else
                {
-                       int diff = _ttoi(dlg.m_strParam) - 1;
+                       int diff = _ttoi(dlg.m_strParam.c_str()) - 1;
                        if (diff < 0)
                                diff = 0;
                        if (diff >= pDoc->m_diffList.GetSize())
index 993e8bd..a149113 100644 (file)
@@ -702,7 +702,7 @@ void COpenView::OnSelectUnpacker()
                return;
 
        // let the user select a handler
-       CSelectUnpackerDlg dlg(m_files[0].c_str(), this);
+       CSelectUnpackerDlg dlg(m_files[0], this);
        PackingInfo infoUnpacker(PLUGIN_AUTO);
        dlg.SetInitialInfoHandler(&infoUnpacker);
 
index 74211e6..9250f50 100644 (file)
@@ -33,6 +33,7 @@
 #include "PatchHTML.h"
 #include "FileOrFolderSelect.h"
 #include "Environment.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -117,11 +118,11 @@ void CPatchDlg::OnOK()
        // multiple files.  Multiple files are selected from DirView.
        // Only if single files selected, filenames are checked here.
        // Filenames read from Dirview must be valid ones.
-       int selectCount = m_fileList.size();
+       size_t selectCount = m_fileList.size();
        if (selectCount == 1)
        {
-               BOOL file1Ok = (paths_DoesPathExist((const TCHAR *)m_file1) == IS_EXISTING_FILE);
-               BOOL file2Ok = (paths_DoesPathExist((const TCHAR *)m_file2) == IS_EXISTING_FILE);
+               bool file1Ok = (paths_DoesPathExist(m_file1) == IS_EXISTING_FILE);
+               bool file2Ok = (paths_DoesPathExist(m_file2) == IS_EXISTING_FILE);
 
                if (!file1Ok || !file2Ok)
                {
@@ -135,27 +136,27 @@ void CPatchDlg::OnOK()
        }
 
        // Check that result (patch) file is absolute path
-       if (!paths_IsPathAbsolute((LPCTSTR)m_fileResult))
+       if (!paths_IsPathAbsolute(m_fileResult))
        {
-               if (m_fileResult.GetLength() == 0)
+               if (m_fileResult.length() == 0)
                {
                        TCHAR szTempFile[MAX_PATH];
                        GetTempFileName(env_GetTempPath().c_str(), _T("pat"), 0, szTempFile);
                        m_fileResult = szTempFile;
-                       m_ctlResult.SetWindowText(m_fileResult);
-                       DeleteFile(m_fileResult);
+                       m_ctlResult.SetWindowText(m_fileResult.c_str());
+                       DeleteFile(m_fileResult.c_str());
                }
-               if (paths_IsPathAbsolute((LPCTSTR)m_fileResult) == FALSE)
+               if (paths_IsPathAbsolute(m_fileResult) == FALSE)
                {
                        String msg = string_format_string1(_("The specified output path is not an absolute path: %1"),
-                               (LPCTSTR)m_fileResult);
+                               m_fileResult);
                        AfxMessageBox(msg.c_str(), MB_ICONSTOP);
                        m_ctlResult.SetFocus();
                        return;
                }
        }
        
-       BOOL fileExists = (paths_DoesPathExist((const TCHAR *)m_fileResult) == IS_EXISTING_FILE);
+       bool fileExists = (paths_DoesPathExist(m_fileResult) == IS_EXISTING_FILE);
 
        // Result file already exists and append not selected
        if (fileExists && !m_appendFile)
@@ -180,9 +181,9 @@ void CPatchDlg::OnOK()
        int contextSel = m_comboContext.GetCurSel();
        if (contextSel != CB_ERR)
        {
-               CString contextText;
-               m_comboContext.GetLBText(contextSel, contextText);
-               m_contextLines = _ttoi(contextText);
+               String contextText;
+               m_comboContext.GetLBText(contextSel, PopString(contextText));
+               m_contextLines = _ttoi(contextText.c_str());
        }
        else
                m_contextLines = 0;
@@ -221,7 +222,7 @@ BOOL CPatchDlg::OnInitDialog()
        m_comboContext.LoadState(_T("PatchCreator\\DiffContext"));
        m_ctlResult.LoadState(_T("Files\\DiffFileResult"));
 
-       int count = m_fileList.size();
+       size_t count = m_fileList.size();
 
        // If one file added, show filenames on dialog
        if (count == 1)
@@ -277,7 +278,7 @@ void CPatchDlg::OnDiffBrowseFile1()
        folder = m_file1;
        if (SelectFile(GetSafeHwnd(), s, folder.c_str(), _("Open"), _T(""), TRUE))
        {
-               ChangeFile(s.c_str(), TRUE);
+               ChangeFile(s, true);
                m_ctlFile1.SetWindowText(s.c_str());
        }
 }
@@ -293,7 +294,7 @@ void CPatchDlg::OnDiffBrowseFile2()
        folder = m_file2;
        if (SelectFile(GetSafeHwnd(), s, folder.c_str(), _("Open"), _T(""), TRUE))
        {
-               ChangeFile(s.c_str(), FALSE);
+               ChangeFile(s, false);
                m_ctlFile2.SetWindowText(s.c_str());
        }
 }
@@ -304,10 +305,10 @@ void CPatchDlg::OnDiffBrowseFile2()
  * @param [in] sFile New file for patch creation.
  * @param [in] bLeft If true left file is changed, otherwise right file.
  */
-void CPatchDlg::ChangeFile(const CString &sFile, BOOL bLeft)
+void CPatchDlg::ChangeFile(const String &sFile, bool bLeft)
 {
        PATCHFILES pf;
-       int count = GetItemCount();
+       size_t count = GetItemCount();
 
        if (count == 1)
        {
@@ -316,9 +317,9 @@ void CPatchDlg::ChangeFile(const CString &sFile, BOOL bLeft)
        else if (count > 1)
        {
                if (bLeft)
-                       m_file1.Empty();
+                       m_file1.clear();
                else
-                       m_file2.Empty();
+                       m_file2.clear();
        }
        ClearItems();
 
@@ -360,11 +361,9 @@ void CPatchDlg::OnSelchangeFile1Combo()
        int sel = m_ctlFile1.GetCurSel();
        if (sel != CB_ERR)
        {
-               CString file;
-               m_ctlFile1.GetLBText(sel, file);
-               m_ctlFile1.SetWindowText(file);
-               ChangeFile(file, TRUE);
-               m_file1 = file;
+               m_ctlFile1.GetLBText(sel, PopString(m_file1));
+               m_ctlFile1.SetWindowText(m_file1.c_str());
+               ChangeFile(m_file1, true);
        }
 }
 
@@ -376,11 +375,9 @@ void CPatchDlg::OnSelchangeFile2Combo()
        int sel = m_ctlFile2.GetCurSel();
        if (sel != CB_ERR)
        {
-               CString file;
-               m_ctlFile2.GetLBText(sel, file);
-               m_ctlFile2.SetWindowText(file);
-               ChangeFile(file, FALSE);
-               m_file2 = file;
+               m_ctlFile2.GetLBText(sel, PopString(m_file2));
+               m_ctlFile2.SetWindowText(m_file2.c_str());
+               ChangeFile(m_file2, false);
        }
 }
 
@@ -392,8 +389,8 @@ void CPatchDlg::OnSelchangeResultCombo()
        int sel = m_ctlResult.GetCurSel();
        if (sel != CB_ERR)
        {
-               m_ctlResult.GetLBText(sel, m_fileResult);
-               m_ctlResult.SetWindowText(m_fileResult);
+               m_ctlResult.GetLBText(sel, PopString(m_fileResult));
+               m_ctlResult.SetWindowText(m_fileResult.c_str());
        }
 }
 
@@ -430,17 +427,13 @@ void CPatchDlg::OnSelchangeDiffStyle()
  */
 void CPatchDlg::OnDiffSwapFiles()
 {
-       CString file1;
-       CString file2;
        PATCHFILES files;
 
-       m_ctlFile1.GetWindowText(file1);
-       m_ctlFile2.GetWindowText(file2);
+       m_ctlFile1.GetWindowText(PopString(m_file1));
+       m_ctlFile2.GetWindowText(PopString(m_file2));
 
-       m_ctlFile1.SetWindowText(file2);
-       m_ctlFile2.SetWindowText(file1);
-       m_file1 = file2;
-       m_file2 = file1;
+       m_ctlFile1.SetWindowText(m_file2.c_str());
+       m_ctlFile2.SetWindowText(m_file1.c_str());
 
        //  swapped files
        Swap();
@@ -459,7 +452,7 @@ void CPatchDlg::AddItem(const PATCHFILES& pf)
  * @brief Returns amount of patch items in the internal list.
  * @return Count of patch items in the list.
  */
-int CPatchDlg::GetItemCount()
+size_t CPatchDlg::GetItemCount()
 {
        return m_fileList.size();
 }
@@ -505,9 +498,8 @@ void CPatchDlg::UpdateSettings()
                break;
        }
 
-       CString str;
-       str.Format(_T("%d"), m_contextLines);
-       m_comboContext.SelectString(-1, str);
+       String str = string_format(_T("%d"), m_contextLines);
+       m_comboContext.SelectString(-1, str.c_str());
 
        if (m_outputStyle == OUTPUT_CONTEXT || m_outputStyle == OUTPUT_UNIFIED || m_outputStyle == OUTPUT_HTML)
                m_comboContext.EnableWindow(TRUE);
@@ -529,9 +521,9 @@ void CPatchDlg::LoadSettings()
        if (m_contextLines < 0 || m_contextLines > 50)
                m_contextLines = 0;
 
-       m_caseSensitive = theApp.GetProfileInt(_T("PatchCreator"), _T("CaseSensitive"), TRUE);
-       m_ignoreEOLDifference = theApp.GetProfileInt(_T("PatchCreator"), _T("EOLSensitive"), TRUE);
-       m_ignoreBlanks = theApp.GetProfileInt(_T("PatchCreator"), _T("IgnoreBlankLines"), FALSE);
+       m_caseSensitive = !!theApp.GetProfileInt(_T("PatchCreator"), _T("CaseSensitive"), true);
+       m_ignoreEOLDifference = !!theApp.GetProfileInt(_T("PatchCreator"), _T("EOLSensitive"), true);
+       m_ignoreBlanks = !!theApp.GetProfileInt(_T("PatchCreator"), _T("IgnoreBlankLines"), false);
        
        m_whitespaceCompare = theApp.GetProfileInt(_T("PatchCreator"), _T("Whitespace"), WHITESPACE_COMPARE_ALL);
        if (m_whitespaceCompare < WHITESPACE_COMPARE_ALL ||
@@ -540,8 +532,8 @@ void CPatchDlg::LoadSettings()
                m_whitespaceCompare = WHITESPACE_COMPARE_ALL;
        }
        
-       m_openToEditor = theApp.GetProfileInt(_T("PatchCreator"), _T("OpenToEditor"), FALSE);
-       m_includeCmdLine = theApp.GetProfileInt(_T("PatchCreator"), _T("IncludeCmdLine"), FALSE);
+       m_openToEditor = !!theApp.GetProfileInt(_T("PatchCreator"), _T("OpenToEditor"), false);
+       m_includeCmdLine = !!theApp.GetProfileInt(_T("PatchCreator"), _T("IncludeCmdLine"), false);
 
        UpdateSettings();
 }
index 5d0f038..539dc3c 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "resource.h"
 #include "SuperComboBox.h"
+#include "UnicodeString.h"
 
 struct PATCHFILES;
 
@@ -46,7 +47,7 @@ public:
 
        // Functions to add and get selected files (as PATCHFILEs)
        void AddItem(const PATCHFILES& pf);
-       int GetItemCount();
+       size_t GetItemCount();
        const PATCHFILES& GetItemAt(int position);
        void ClearItems();
 
@@ -55,19 +56,19 @@ public:
        enum { IDD = IDD_GENERATE_PATCH };
        CComboBox m_comboStyle;
        CSuperComboBox m_comboContext;
-       BOOL m_caseSensitive;
+       bool m_caseSensitive;
        CSuperComboBox m_ctlFile1;
        CSuperComboBox m_ctlFile2;
        CSuperComboBox m_ctlResult;
-       CString m_file1;
-       CString m_file2;
-       CString m_fileResult;
-       BOOL m_ignoreBlanks;
-       BOOL m_ignoreEOLDifference;
+       String  m_file1;
+       String  m_file2;
+       String  m_fileResult;
+       bool m_ignoreBlanks;
+       bool m_ignoreEOLDifference;
        int m_whitespaceCompare;
-       BOOL m_appendFile;
-       BOOL m_openToEditor;
-       BOOL m_includeCmdLine;
+       bool m_appendFile;
+       bool m_openToEditor;
+       bool m_includeCmdLine;
        //}}AFX_DATA
 
        enum output_style m_outputStyle; /**< Patch style (context, unified etc.) */
@@ -85,7 +86,7 @@ protected:
 
        std::vector<PATCHFILES> m_fileList; /**< Source files to create patch from */
 
-       void ChangeFile(const CString &sFile, BOOL bLeft);
+       void ChangeFile(const String &sFile, bool bLeft);
        void UpdateSettings();
        void LoadSettings();
        void SaveSettings();
index 8ed9c01..72bc511 100644 (file)
@@ -39,7 +39,7 @@ static char THIS_FILE[] = __FILE__;
 /**
  * @brief Default constructor.
  */
-CPatchTool::CPatchTool() : m_bOpenToEditor(FALSE)
+CPatchTool::CPatchTool() : m_bOpenToEditor(false)
 {
 }
 
@@ -97,8 +97,8 @@ void CPatchTool::AddFiles(const String &file1, const String &altPath1,
 int CPatchTool::CreatePatch()
 {
        DIFFSTATUS status;
-       BOOL bResult = TRUE;
-       BOOL bDiffSuccess;
+       bool bResult = true;
+       bool bDiffSuccess;
        int retVal = 0;
 
        CPatchDlg dlgPatch;
@@ -112,7 +112,7 @@ int CPatchTool::CreatePatch()
        if (ShowDialog(&dlgPatch))
        {
                String path;
-               paths_SplitFilename((const TCHAR *)dlgPatch.m_fileResult, &path, NULL, NULL);
+               paths_SplitFilename(dlgPatch.m_fileResult, &path, NULL, NULL);
                if (!paths_CreateIfNeeded(path))
                {
                        LangMessageBox(IDS_FOLDER_NOTEXIST, MB_OK | MB_ICONSTOP);
@@ -120,14 +120,14 @@ int CPatchTool::CreatePatch()
                }
 
                // Select patch create -mode
-               m_diffWrapper.SetCreatePatchFile((LPCTSTR)dlgPatch.m_fileResult);
-               m_diffWrapper.SetAppendFiles(!!dlgPatch.m_appendFile);
+               m_diffWrapper.SetCreatePatchFile(dlgPatch.m_fileResult);
+               m_diffWrapper.SetAppendFiles(dlgPatch.m_appendFile);
                m_diffWrapper.SetPrediffer(NULL);
 
-               int fileCount = dlgPatch.GetItemCount();
+               size_t fileCount = dlgPatch.GetItemCount();
 
-               m_diffWrapper.WritePatchFileHeader(dlgPatch.m_outputStyle, !!dlgPatch.m_appendFile);
-               m_diffWrapper.SetAppendFiles(TRUE);
+               m_diffWrapper.WritePatchFileHeader(dlgPatch.m_outputStyle, dlgPatch.m_appendFile);
+               m_diffWrapper.SetAppendFiles(true);
 
                for (int index = 0; index < fileCount; index++)
                {
@@ -136,7 +136,7 @@ int CPatchTool::CreatePatch()
                        String filename2 = files.rfile.length() == 0 ? _T("NUL") : files.rfile;
                        
                        // Set up DiffWrapper
-                       m_diffWrapper.SetPaths(PathContext(filename1, filename2), FALSE);
+                       m_diffWrapper.SetPaths(PathContext(filename1, filename2), false);
                        m_diffWrapper.SetAlternativePaths(PathContext(files.pathLeft, files.pathRight));
                        m_diffWrapper.SetCompareFiles(PathContext(files.lfile, files.rfile));
                        bDiffSuccess = m_diffWrapper.RunFileDiff();
@@ -145,20 +145,20 @@ int CPatchTool::CreatePatch()
                        if (!bDiffSuccess)
                        {
                                LangMessageBox(IDS_FILEERROR, MB_ICONSTOP);
-                               bResult = FALSE;
+                               bResult = false;
                                break;
                        }
                        else if (status.bBinaries)
                        {
                                LangMessageBox(IDS_CANNOT_CREATE_BINARYPATCH, MB_ICONSTOP);
-                               bResult = FALSE;
+                               bResult = false;
                                break;
                        }
                        else if (status.bPatchFileFailed)
                        {
-                               String errMsg = string_format_string1(_("Could not write to file %1."), (LPCTSTR)dlgPatch.m_fileResult);
+                               String errMsg = string_format_string1(_("Could not write to file %1."), dlgPatch.m_fileResult);
                                AfxMessageBox(errMsg.c_str(), MB_ICONSTOP);
-                               bResult = FALSE;
+                               bResult = false;
                                break;
                        }
                }
@@ -170,7 +170,7 @@ int CPatchTool::CreatePatch()
                        LangMessageBox(IDS_DIFF_SUCCEEDED, MB_ICONINFORMATION|MB_DONT_DISPLAY_AGAIN,
                                            IDS_DIFF_SUCCEEDED);
                        
-                       m_sPatchFile = (LPCTSTR)dlgPatch.m_fileResult;
+                       m_sPatchFile = dlgPatch.m_fileResult;
                        m_bOpenToEditor = dlgPatch.m_openToEditor;
                        retVal = 1;
                }
@@ -183,17 +183,17 @@ int CPatchTool::CreatePatch()
  * @brief Show patch options dialog and check options selected.
  * @return TRUE if user wants to create a patch (didn't cancel dialog).
  */
-BOOL CPatchTool::ShowDialog(CPatchDlg *pDlgPatch)
+bool CPatchTool::ShowDialog(CPatchDlg *pDlgPatch)
 {
        DIFFOPTIONS diffOptions = {0};
        PATCHOPTIONS patchOptions;
-       BOOL bRetVal = TRUE;
+       bool bRetVal = true;
 
        if (pDlgPatch->DoModal() == IDOK)
        {
                // There must be one filepair
                if (pDlgPatch->GetItemCount() < 1)
-                       bRetVal = FALSE;
+                       bRetVal = false;
 
                // These two are from dropdown list - can't be wrong
                patchOptions.outputStyle = pDlgPatch->m_outputStyle;
@@ -205,18 +205,18 @@ BOOL CPatchTool::ShowDialog(CPatchDlg *pDlgPatch)
 
                // These are from checkboxes and radiobuttons - can't be wrong
                diffOptions.nIgnoreWhitespace = pDlgPatch->m_whitespaceCompare;
-               diffOptions.bIgnoreBlankLines = !!pDlgPatch->m_ignoreBlanks;
-               m_diffWrapper.SetAppendFiles(!!pDlgPatch->m_appendFile);
+               diffOptions.bIgnoreBlankLines = pDlgPatch->m_ignoreBlanks;
+               m_diffWrapper.SetAppendFiles(pDlgPatch->m_appendFile);
 
                // Use this because non-sensitive setting can't write
                // patch file EOLs correctly
-               diffOptions.bIgnoreEol = !!pDlgPatch->m_ignoreEOLDifference;
+               diffOptions.bIgnoreEol = pDlgPatch->m_ignoreEOLDifference;
                
-               diffOptions.bIgnoreCase = pDlgPatch->m_caseSensitive == FALSE;
+               diffOptions.bIgnoreCase = pDlgPatch->m_caseSensitive == false;
                m_diffWrapper.SetOptions(&diffOptions);
        }
        else
-               return FALSE;
+               return false;
 
        return bRetVal;
 }
@@ -233,7 +233,7 @@ String CPatchTool::GetPatchFile() const
  * @brief Returns TRUE if user wants to open patch file
  * to external editor (specified in WinMerge options).
  */
-BOOL CPatchTool::GetOpenToEditor() const
+bool CPatchTool::GetOpenToEditor() const
 {
        return m_bOpenToEditor;
 }
index 82d7813..49a4af8 100644 (file)
@@ -70,16 +70,16 @@ public:
                const String &file2, const String &altPath2);
        int CreatePatch();
        String GetPatchFile() const;
-       BOOL GetOpenToEditor() const;
+       bool GetOpenToEditor() const;
 
 protected:
-       BOOL ShowDialog(CPatchDlg *pDlgPatch);
+       bool ShowDialog(CPatchDlg *pDlgPatch);
 
 private:
     std::vector<PATCHFILES> m_fileList; /**< List of files to patch. */
        CDiffWrapper m_diffWrapper; /**< DiffWrapper instance we use to create patch. */
        String m_sPatchFile; /**< Patch file path and filename. */
-       BOOL m_bOpenToEditor; /**< Is patch file opened to external editor? */
+       bool m_bOpenToEditor; /**< Is patch file opened to external editor? */
 };
 
 #endif // _PATCHTOOL_H_
index 2cee8d3..e7114c1 100644 (file)
@@ -51,7 +51,7 @@ BOOL PluginsListDlg::OnInitDialog()
        InitList();
        AddPlugins();
 
-       BOOL pluginsEnabled = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED);
+       bool pluginsEnabled = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED);
        if (pluginsEnabled)
        {
                CButton *btn = (CButton *)GetDlgItem(IDC_PLUGINS_ENABLE);
@@ -85,13 +85,13 @@ void PluginsListDlg::InitList()
 void PluginsListDlg::AddPlugins()
 {
        String type = _("Unpacker");
-       AddPluginsToList(L"FILE_PACK_UNPACK", type.c_str());
-       AddPluginsToList(L"BUFFER_PACK_UNPACK", type.c_str());
+       AddPluginsToList(L"FILE_PACK_UNPACK", type);
+       AddPluginsToList(L"BUFFER_PACK_UNPACK", type);
        type = _("Prediffer");
-       AddPluginsToList(L"FILE_PREDIFF", type.c_str());
-       AddPluginsToList(L"BUFFER_PREDIFF", type.c_str());
+       AddPluginsToList(L"FILE_PREDIFF", type);
+       AddPluginsToList(L"BUFFER_PREDIFF", type);
        type = _("Editor script");
-       AddPluginsToList(L"EDITOR_SCRIPT", type.c_str());
+       AddPluginsToList(L"EDITOR_SCRIPT", type);
 }
 
 /**
@@ -99,7 +99,7 @@ void PluginsListDlg::AddPlugins()
  * @param [in] pluginEvent Event type for plugins to add.
  * @param [in] pluginType String to use as type in the list.
  */
-void PluginsListDlg::AddPluginsToList(LPCWSTR pluginEvent, LPCTSTR pluginType)
+void PluginsListDlg::AddPluginsToList(const wchar_t *pluginEvent, const String& pluginType)
 {
        PluginArray * piPluginArray = 
                CAllThreadsScripts::GetActiveSet()->GetAvailableScripts(pluginEvent);
@@ -108,7 +108,7 @@ void PluginsListDlg::AddPluginsToList(LPCWSTR pluginEvent, LPCTSTR pluginType)
        {
                const PluginInfoPtr& plugin = piPluginArray->at(iPlugin);
                int ind = m_list.InsertItem(m_list.GetItemCount(), plugin->m_name.c_str());
-               m_list.SetItemText(ind, 1, pluginType);
+               m_list.SetItemText(ind, 1, pluginType.c_str());
                m_list.SetItemText(ind, 2, plugin->m_description.c_str());
        }
 }
index 7ba17fc..81c4d8b 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef _PLUGINS_LIST_DIALOG_H_
 #define _PLUGINS_LIST_DIALOG_H_
 
+#include "UnicodeString.h"
 
 /**
  * @brief A dialog listing plugins.
@@ -30,7 +31,7 @@ public:
 protected:
        void InitList();
        void AddPlugins();
-       void AddPluginsToList(LPCWSTR pluginEvent, LPCTSTR pluginType);
+       void AddPluginsToList(const wchar_t *pluginEvent, const String& pluginType);
 
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
 
index c915eb4..83753f2 100644 (file)
@@ -15,6 +15,7 @@
 #include "ProjectFile.h"
 #include "ProjectFilePathsDlg.h"
 #include "FileOrFolderSelect.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -28,9 +29,9 @@ IMPLEMENT_DYNCREATE(ProjectFilePathsDlg, CPropertyPage)
  * @brief Standard constructor.
  */
 ProjectFilePathsDlg::ProjectFilePathsDlg() : CPropertyPage(ProjectFilePathsDlg::IDD)
-, m_bLeftPathReadOnly(FALSE)
-, m_bRightPathReadOnly(FALSE)
-, m_bIncludeSubfolders(FALSE)
+, m_bLeftPathReadOnly(false)
+, m_bRightPathReadOnly(false)
+, m_bIncludeSubfolders(false)
 {
        //{{AFX_DATA_INIT(ProjectFilePathsDlg)
        //}}AFX_DATA_INIT
@@ -80,9 +81,9 @@ void ProjectFilePathsDlg::OnBnClickedProjLfileBrowse()
 {
        UpdateData(TRUE);
        String s;
-       if (::SelectFileOrFolder(GetSafeHwnd(), s, m_sLeftFile))
+       if (::SelectFileOrFolder(GetSafeHwnd(), s, m_sLeftFile.c_str()))
        {
-               m_sLeftFile = s.c_str();
+               m_sLeftFile = s;
                UpdateData(FALSE);
        }
 }
@@ -94,9 +95,9 @@ void ProjectFilePathsDlg::OnBnClickedProjRfileBrowse()
 {
        UpdateData(TRUE);
        String s;
-       if (::SelectFileOrFolder(GetSafeHwnd(), s, m_sRightFile))
+       if (::SelectFileOrFolder(GetSafeHwnd(), s, m_sRightFile.c_str()))
        {
-               m_sRightFile = s.c_str();
+               m_sRightFile = s;
                UpdateData(FALSE);
        }
 }
@@ -137,7 +138,7 @@ void ProjectFilePathsDlg::OnBnClickedProjFilterSelect()
  */
 void ProjectFilePathsDlg::OnBnClickedProjOpen()
 {
-       String fileName = AskProjectFileName(TRUE);
+       String fileName = AskProjectFileName(true);
        if (fileName.empty())
                return;
 
@@ -146,12 +147,12 @@ void ProjectFilePathsDlg::OnBnClickedProjOpen()
                return;
 
        bool left_ro, right_ro;
-       m_sLeftFile = project.GetLeft(&left_ro).c_str();
-       m_sRightFile = project.GetRight(&right_ro).c_str();
+       m_sLeftFile = project.GetLeft(&left_ro);
+       m_sRightFile = project.GetRight(&right_ro);
        m_bLeftPathReadOnly = left_ro;
        m_bRightPathReadOnly = right_ro;
-       m_sFilter = project.GetFilter().c_str();
-       m_bIncludeSubfolders = project.GetSubfolders();
+       m_sFilter = project.GetFilter();
+       m_bIncludeSubfolders = !!project.GetSubfolders();
 
        UpdateData(FALSE);
        LangMessageBox(IDS_PROJFILE_LOAD_SUCCESS, MB_ICONINFORMATION);
@@ -164,35 +165,32 @@ void ProjectFilePathsDlg::OnBnClickedProjSave()
 {
        UpdateData(TRUE);
 
-       m_sLeftFile.TrimLeft();
-       m_sLeftFile.TrimRight();
-       m_sLeftFile.TrimLeft();
-       m_sLeftFile.TrimRight();
-       m_sFilter.TrimLeft();
-       m_sFilter.TrimRight();
+       m_sLeftFile = string_trim_ws(m_sLeftFile);
+       m_sRightFile = string_trim_ws(m_sRightFile);
+       m_sFilter = string_trim_ws(m_sFilter);
 
-       String fileName = AskProjectFileName(FALSE);
+       String fileName = AskProjectFileName(false);
        if (fileName.empty())
                return;
 
        ProjectFile project;
 
-       bool left_ro = !!m_bLeftPathReadOnly, right_ro = !!m_bRightPathReadOnly;
-       if (!m_sLeftFile.IsEmpty())
-               project.SetLeft((LPCTSTR)m_sLeftFile, &left_ro);
-       if (!m_sRightFile.IsEmpty())
-               project.SetRight((LPCTSTR)m_sRightFile, &right_ro);
-       if (!m_sFilter.IsEmpty())
+       bool left_ro = m_bLeftPathReadOnly, right_ro = m_bRightPathReadOnly;
+       if (!m_sLeftFile.empty())
+               project.SetLeft(m_sLeftFile, &left_ro);
+       if (!m_sRightFile.empty())
+               project.SetRight(m_sRightFile, &right_ro);
+       if (!m_sFilter.empty())
        {
                // Remove possbile prefix from the filter name
                String prefix = _("[F] ");
-               int ind = m_sFilter.Find(prefix.c_str(), 0);
+               size_t ind = m_sFilter.find(prefix, 0);
                if (ind == 0)
                {
-                       m_sFilter.Delete(0, prefix.length());
+                       m_sFilter.erase(0, prefix.length());
                }
-               m_sFilter.TrimLeft();
-               project.SetFilter((LPCTSTR)m_sFilter);
+               m_sFilter = string_trim_ws_begin(m_sFilter);
+               project.SetFilter(m_sFilter);
        }
        project.SetSubfolders(m_bIncludeSubfolders);
 
@@ -210,30 +208,18 @@ void ProjectFilePathsDlg::OnBnClickedProjSave()
  * @param [in] left Left path.
  * @param [in] right Right path.
  */
-void ProjectFilePathsDlg::SetPaths(LPCTSTR left, LPCTSTR right)
+void ProjectFilePathsDlg::SetPaths(const String& left, const String& right)
 {
-       if (left != NULL)
-       {
-               PATH_EXISTENCE pe = paths_DoesPathExist(left);
-               if (pe != DOES_NOT_EXIST)
-               {
-                       m_sLeftFile = left;
-               }
-       }
-       if (right != NULL)
-       {
-               PATH_EXISTENCE pe = paths_DoesPathExist(right);
-               if (pe != DOES_NOT_EXIST)
-               {
-                       m_sRightFile = right;
-               }
-       }
+       if (paths_DoesPathExist(left) != DOES_NOT_EXIST)
+               m_sLeftFile = left;
+       if (paths_DoesPathExist(right) != DOES_NOT_EXIST)
+               m_sRightFile = right;
 }
 
 /** 
  * @brief Allow user to select a file to open/save.
  */
-CString ProjectFilePathsDlg::AskProjectFileName(BOOL bOpen)
+String ProjectFilePathsDlg::AskProjectFileName(bool bOpen)
 {
        // get the default projects path
        String strProjectFileName;
@@ -260,6 +246,6 @@ CString ProjectFilePathsDlg::AskProjectFileName(BOOL bOpen)
        strProjectPath = paths_GetParentPath(strProjectFileName);
        // store this as the new project path
        GetOptionsMgr()->SaveOption(OPT_PROJECTS_PATH, strProjectPath);
-       return strProjectFileName.c_str();
+       return strProjectFileName;
 }
 
index dfb4e15..7170f1e 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef _PROJECTFILEPATHSDLG_H_
 #define _PROJECTFILEPATHSDLG_H_
 
+#include "UnicodeString.h"
+
 /**
  * @brief Dialog allowing user to load, edit and save project files.
  */
@@ -18,17 +20,17 @@ class ProjectFilePathsDlg : public CPropertyPage
 
 public:
        ProjectFilePathsDlg();   // standard constructor
-       CString GetFilePath();
+       String GetFilePath();
 
 // Dialog Data
        //{{AFX_DATA(SaveClosingDlg)
        enum { IDD = IDD_PROJFILES_PATHS };
-       CString m_sLeftFile;
-       CString m_sRightFile;
-       CString m_sFilter;
-       BOOL m_bIncludeSubfolders;
-       BOOL m_bLeftPathReadOnly;
-       BOOL m_bRightPathReadOnly;
+       String m_sLeftFile;
+       String m_sRightFile;
+       String m_sFilter;
+       bool m_bIncludeSubfolders;
+       bool m_bLeftPathReadOnly;
+       bool m_bRightPathReadOnly;
        //}}AFX_DATA
 
 protected:
@@ -40,14 +42,14 @@ protected:
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 
-       CString AskProjectFileName(BOOL bOpen);
+       String AskProjectFileName(bool bOpen);
 
 // Implementation data
 private:
-       CString m_sProjFilePath; /**< (Last/current) Path for project file */
+       String m_sProjFilePath; /**< (Last/current) Path for project file */
 
 public:
-       void SetPaths(LPCTSTR left, LPCTSTR right);
+       void SetPaths(const String& left, const String& right);
        
        afx_msg void OnBnClickedProjLfileBrowse();
        afx_msg void OnBnClickedProjRfileBrowse();
index 0ff193c..65198b8 100644 (file)
@@ -13,6 +13,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
index 1328893..c5272fc 100644 (file)
@@ -40,8 +40,8 @@ protected:
        DECLARE_MESSAGE_MAP()
 public:
        CStaticLink m_wwwLink;
-       BOOL m_bEnableSupport;
+       bool m_bEnableSupport;
        int m_nInstallType;
-       BOOL m_bProbeType;
+       bool m_bProbeType;
 };
 #endif // _PROP_ARCHIVE_H_
index c526a31..c1826d7 100644 (file)
@@ -14,6 +14,7 @@
 #include "OptionsPanel.h"
 #include "FileOrFolderSelect.h"
 #include "paths.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -27,10 +28,10 @@ static char THIS_FILE[] = __FILE__;
  */
 PropBackups::PropBackups(COptionsMgr *optionsMgr)
        : OptionsPanel(optionsMgr, PropBackups::IDD)
-       , m_bCreateForFolderCmp(FALSE)
-       , m_bCreateForFileCmp(FALSE)
-       , m_bAppendBak(FALSE)
-       , m_bAppendTime(FALSE)
+       , m_bCreateForFolderCmp(false)
+       , m_bCreateForFileCmp(false)
+       , m_bAppendBak(false)
+       , m_bAppendTime(false)
        , m_nBackupFolder(0)
 {
 }
@@ -70,13 +71,12 @@ void PropBackups::ReadOptions()
  */
 void PropBackups::WriteOptions()
 {
-       m_sGlobalFolder.TrimLeft();
-       m_sGlobalFolder.TrimRight();
-       if (m_sGlobalFolder.GetLength() > 3)
-               m_sGlobalFolder = paths_AddTrailingSlash(static_cast<const TCHAR *>(m_sGlobalFolder)).c_str();
+       string_trim_ws(m_sGlobalFolder);
+       if (m_sGlobalFolder.length() > 3)
+               m_sGlobalFolder = paths_AddTrailingSlash(m_sGlobalFolder);
 
-       GetOptionsMgr()->SaveOption(OPT_BACKUP_FOLDERCMP, m_bCreateForFolderCmp == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_BACKUP_FILECMP, m_bCreateForFileCmp == TRUE);
+       GetOptionsMgr()->SaveOption(OPT_BACKUP_FOLDERCMP, m_bCreateForFolderCmp);
+       GetOptionsMgr()->SaveOption(OPT_BACKUP_FILECMP, m_bCreateForFileCmp);
        GetOptionsMgr()->SaveOption(OPT_BACKUP_LOCATION, m_nBackupFolder);
        GetOptionsMgr()->SaveOption(OPT_BACKUP_GLOBALFOLDER, String(m_sGlobalFolder));
        GetOptionsMgr()->SaveOption(OPT_BACKUP_ADD_BAK, m_bAppendBak == TRUE);
@@ -101,7 +101,7 @@ BOOL PropBackups::OnInitDialog()
 void PropBackups::OnBnClickedBackupBrowse()
 {
        String path;
-       if (SelectFolder(path, m_sGlobalFolder, _T(""), GetSafeHwnd()))
+       if (SelectFolder(path, m_sGlobalFolder.c_str(), _T(""), GetSafeHwnd()))
        {
                SetDlgItemText(IDC_BACKUP_FOLDER, path.c_str());
        }
index dc9b677..aae34db 100644 (file)
@@ -11,6 +11,7 @@
 #define _PROPBACKUPS_H_
 
 #include "OptionsPanel.h"
+#include "UnicodeString.h"
 
 class COptionsMgr;
 
@@ -36,11 +37,11 @@ public:
                FOLDER_GLOBAL,
        };
 
-       BOOL m_bCreateForFolderCmp;
-       BOOL m_bCreateForFileCmp;
-       CString m_sGlobalFolder;
-       BOOL m_bAppendBak;
-       BOOL m_bAppendTime;
+       bool m_bCreateForFolderCmp;
+       bool m_bCreateForFileCmp;
+       String m_sGlobalFolder;
+       bool m_bAppendBak;
+       bool m_bAppendTime;
        int m_nBackupFolder;
 
 protected:
index d4998dd..01c09bb 100644 (file)
@@ -36,6 +36,7 @@
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
 #include "charsets.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -47,8 +48,8 @@ PropCodepage::PropCodepage(COptionsMgr *optionsMgr)
  : OptionsPanel(optionsMgr, PropCodepage::IDD)
 , m_nCodepageSystem(-1)
 , m_nCustomCodepageValue(0)
-, m_bDetectCodepage(FALSE)
-, m_bDetectCodepage2(FALSE)
+, m_bDetectCodepage(false)
+, m_bDetectCodepage2(false)
 , m_nAutodetectType(50001)
 {
 }
@@ -84,7 +85,7 @@ void PropCodepage::ReadOptions()
 {
        m_nCodepageSystem = GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_MODE);
        m_nCustomCodepageValue = GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_CUSTOM);
-       m_cCustomCodepageValue.Format(_T("%d"),m_nCustomCodepageValue);
+       m_cCustomCodepageValue = string_format(_T("%d"),m_nCustomCodepageValue);
        m_bDetectCodepage = GetOptionsMgr()->GetInt(OPT_CP_DETECT) & 1;
        m_bDetectCodepage2 = (GetOptionsMgr()->GetInt(OPT_CP_DETECT) & 2) != 0;
        m_nAutodetectType = ((unsigned)GetOptionsMgr()->GetInt(OPT_CP_DETECT) >> 16);
@@ -100,7 +101,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 | (m_bDetectCodepage2 << 1) | (m_nAutodetectType << 16));
+       GetOptionsMgr()->SaveOption(OPT_CP_DETECT, (m_bDetectCodepage ? 1 : 0) | (m_bDetectCodepage2 << 1) | (m_nAutodetectType << 16));
 }
 
 BOOL PropCodepage::OnInitDialog() 
@@ -121,9 +122,8 @@ BOOL PropCodepage::OnInitDialog()
        else
                m_comboAutodetectType.EnableWindow(FALSE);
 
-       CString str;
-       str.Format(_T("%d"), m_nCustomCodepageValue);
-       m_comboCustomCodepageValue.SetWindowText(str);
+       String str = string_format(_T("%d"), m_nCustomCodepageValue);
+       m_comboCustomCodepageValue.SetWindowText(str.c_str());
 
        IExconverter *pexconv = Exconverter::getInstance();
        if (pexconv != NULL)
@@ -180,7 +180,7 @@ void PropCodepage::OnDetectCodepage2()
 
 void PropCodepage::OnDetectAutodetecttype()
 {
-       m_nAutodetectType = m_comboAutodetectType.GetItemData(m_comboAutodetectType.GetCurSel());       
+       m_nAutodetectType = static_cast<int>(m_comboAutodetectType.GetItemData(m_comboAutodetectType.GetCurSel()));     
 }
 
 void PropCodepage::OnCpUi() 
@@ -190,20 +190,9 @@ void PropCodepage::OnCpUi()
 
 void PropCodepage::GetEncodingCodePageFromNameString()
 {
-       int nCustomCodepageValue = _ttol(m_cCustomCodepageValue);
+       int nCustomCodepageValue = _ttol(m_cCustomCodepageValue.c_str());
        if (nCustomCodepageValue == 0)
-       {
-               char result[80]; 
-#ifdef _UNICODE
-               long len = wcslen(m_cCustomCodepageValue); 
-               _wcstombsz(result, m_cCustomCodepageValue, len); //conversion to char * 
-#else
-               long len = m_cCustomCodepageValue.GetLength(); 
-               strncpy(result, m_cCustomCodepageValue.GetBuffer(0), len);
-#endif
-               result[len] = '\0'; //don't forget to put the caracter of terminated string 
-               nCustomCodepageValue = GetEncodingCodePageFromName(result);
-       }
+               nCustomCodepageValue = GetEncodingCodePageFromName(ucr::toSystemCP(m_cCustomCodepageValue).c_str());
        //if found a new codepage valid
        if (nCustomCodepageValue)
                m_nCustomCodepageValue = nCustomCodepageValue;
index 09a3c97..a2380f9 100644 (file)
@@ -30,9 +30,9 @@ public:
        CComboBox m_comboAutodetectType;
        int             m_nCodepageSystem;
        int             m_nCustomCodepageValue;
-       CString m_cCustomCodepageValue;
-       BOOL    m_bDetectCodepage;
-       BOOL    m_bDetectCodepage2;
+       String  m_cCustomCodepageValue;
+       bool    m_bDetectCodepage;
+       bool    m_bDetectCodepage2;
        int             m_nAutodetectType;
        //}}AFX_DATA
 
index 4705a69..7348be9 100644 (file)
@@ -12,6 +12,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -25,13 +26,13 @@ static char THIS_FILE[] = __FILE__;
  */
 PropCompare::PropCompare(COptionsMgr *optionsMgr) 
  : OptionsPanel(optionsMgr, PropCompare::IDD)
- , m_bIgnoreCase(FALSE)
- , m_bIgnoreBlankLines(FALSE)
- , m_bIgnoreEol(TRUE)
+ , m_bIgnoreCase(false)
+ , m_bIgnoreBlankLines(false)
+ , m_bIgnoreEol(true)
  , m_nIgnoreWhite(-1)
- , m_bMovedBlocks(FALSE)
- , m_bMatchSimilarLines(FALSE)
- , m_bFilterCommentsLines(FALSE)
+ , m_bMovedBlocks(false)
+ , m_bMatchSimilarLines(false)
+ , m_bFilterCommentsLines(false)
 {
 }
 
@@ -80,12 +81,12 @@ void PropCompare::ReadOptions()
 void PropCompare::WriteOptions()
 {
        GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_WHITESPACE, m_nIgnoreWhite);
-       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_BLANKLINES, m_bIgnoreBlankLines == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CMP_FILTER_COMMENTLINES, m_bFilterCommentsLines == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_EOL, m_bIgnoreEol == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_CASE, m_bIgnoreCase == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CMP_MOVED_BLOCKS, m_bMovedBlocks == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CMP_MATCH_SIMILAR_LINES, m_bMatchSimilarLines == TRUE);
+       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_BLANKLINES, m_bIgnoreBlankLines);
+       GetOptionsMgr()->SaveOption(OPT_CMP_FILTER_COMMENTLINES, m_bFilterCommentsLines);
+       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_EOL, m_bIgnoreEol);
+       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_CASE, m_bIgnoreCase);
+       GetOptionsMgr()->SaveOption(OPT_CMP_MOVED_BLOCKS, m_bMovedBlocks);
+       GetOptionsMgr()->SaveOption(OPT_CMP_MATCH_SIMILAR_LINES, m_bMatchSimilarLines);
 }
 
 /** 
@@ -108,17 +109,11 @@ void PropCompare::OnDefaults()
        unsigned tmp;
        GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_WHITESPACE, tmp);
        m_nIgnoreWhite = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_EOL, tmp);
-       m_bIgnoreEol = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_BLANKLINES, tmp);
-       m_bIgnoreBlankLines = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_FILTER_COMMENTLINES, tmp);
-       m_bFilterCommentsLines = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_CASE, tmp);
-       m_bIgnoreCase = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_MOVED_BLOCKS, tmp);
-       m_bMovedBlocks = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_MATCH_SIMILAR_LINES, tmp);
-       m_bMatchSimilarLines = tmp;
+       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_EOL, m_bIgnoreEol);
+       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_BLANKLINES, m_bIgnoreBlankLines);
+       GetOptionsMgr()->GetDefault(OPT_CMP_FILTER_COMMENTLINES, m_bFilterCommentsLines);
+       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_CASE, m_bIgnoreCase);
+       GetOptionsMgr()->GetDefault(OPT_CMP_MOVED_BLOCKS, m_bMovedBlocks);
+       GetOptionsMgr()->GetDefault(OPT_CMP_MATCH_SIMILAR_LINES, m_bMatchSimilarLines);
        UpdateData(FALSE);
 }
index db3edf9..8803917 100644 (file)
@@ -34,13 +34,13 @@ public:
 // Dialog Data
        //{{AFX_DATA(PropCompare)
        enum { IDD = IDD_PROPPAGE_COMPARE };
-       BOOL    m_bIgnoreEol;
-       BOOL    m_bIgnoreCase;
-       BOOL    m_bIgnoreBlankLines;
+       bool    m_bIgnoreEol;
+       bool    m_bIgnoreCase;
+       bool    m_bIgnoreBlankLines;
        int     m_nIgnoreWhite;
-       BOOL    m_bMovedBlocks;
-       BOOL    m_bMatchSimilarLines;
-       BOOL    m_bFilterCommentsLines;
+       bool    m_bMovedBlocks;
+       bool    m_bMatchSimilarLines;
+       bool    m_bFilterCommentsLines;
        //}}AFX_DATA
 
 
index 66ad381..8c29da2 100644 (file)
@@ -12,6 +12,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -83,11 +84,11 @@ void PropCompareFolder::ReadOptions()
 void PropCompareFolder::WriteOptions()
 {
        GetOptionsMgr()->SaveOption(OPT_CMP_METHOD, (int)m_compareMethod);
-       GetOptionsMgr()->SaveOption(OPT_CMP_STOP_AFTER_FIRST, m_bStopAfterFirst == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_IGNORE_SMALL_FILETIME, m_bIgnoreSmallTimeDiff == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CMP_WALK_UNIQUE_DIRS, m_bIncludeUniqFolders == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_DIRVIEW_EXPAND_SUBDIRS, m_bExpandSubdirs == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_REPARSE_POINTS, m_bIgnoreReparsePoints == TRUE);
+       GetOptionsMgr()->SaveOption(OPT_CMP_STOP_AFTER_FIRST, m_bStopAfterFirst);
+       GetOptionsMgr()->SaveOption(OPT_IGNORE_SMALL_FILETIME, m_bIgnoreSmallTimeDiff);
+       GetOptionsMgr()->SaveOption(OPT_CMP_WALK_UNIQUE_DIRS, m_bIncludeUniqFolders);
+       GetOptionsMgr()->SaveOption(OPT_DIRVIEW_EXPAND_SUBDIRS, m_bExpandSubdirs);
+       GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_REPARSE_POINTS, m_bIgnoreReparsePoints);
 
        if (m_nQuickCompareLimit > 2000)
                m_nQuickCompareLimit = 2000;
@@ -133,14 +134,10 @@ void PropCompareFolder::OnDefaults()
        unsigned tmp;
        GetOptionsMgr()->GetDefault(OPT_CMP_METHOD, tmp);
        m_compareMethod = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_STOP_AFTER_FIRST, tmp);
-       m_bStopAfterFirst = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_WALK_UNIQUE_DIRS, tmp);
-       m_bIncludeUniqFolders = tmp;
-       GetOptionsMgr()->GetDefault(OPT_DIRVIEW_EXPAND_SUBDIRS, tmp);
-       m_bExpandSubdirs = tmp;
-       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_REPARSE_POINTS, tmp);
-       m_bIgnoreReparsePoints = tmp;
+       GetOptionsMgr()->GetDefault(OPT_CMP_STOP_AFTER_FIRST, m_bStopAfterFirst);
+       GetOptionsMgr()->GetDefault(OPT_CMP_WALK_UNIQUE_DIRS, m_bIncludeUniqFolders);
+       GetOptionsMgr()->GetDefault(OPT_DIRVIEW_EXPAND_SUBDIRS, m_bExpandSubdirs);
+       GetOptionsMgr()->GetDefault(OPT_CMP_IGNORE_REPARSE_POINTS, m_bIgnoreReparsePoints);
        GetOptionsMgr()->GetDefault(OPT_CMP_QUICK_LIMIT, tmp);
        m_nQuickCompareLimit = tmp / Mega;
        UpdateData(FALSE);
index 6c38555..a4d7f6b 100644 (file)
@@ -40,12 +40,12 @@ public:
        //{{AFX_DATA(PropCompareFolder)
        enum { IDD = IDD_PROPPAGE_COMPARE_FOLDER };
        int     m_compareMethod;
-       BOOL    m_bStopAfterFirst;
-       BOOL    m_bIgnoreSmallTimeDiff;
-       BOOL    m_bIncludeUniqFolders;
-       BOOL    m_bExpandSubdirs;
-       BOOL    m_bIgnoreReparsePoints;
-       UINT    m_nQuickCompareLimit;
+       bool    m_bStopAfterFirst;
+       bool    m_bIgnoreSmallTimeDiff;
+       bool    m_bIncludeUniqFolders;
+       bool    m_bExpandSubdirs;
+       bool    m_bIgnoreReparsePoints;
+       unsigned m_nQuickCompareLimit;
        //}}AFX_DATA
 
 
index b58768a..cb58162 100644 (file)
@@ -12,6 +12,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -28,13 +29,13 @@ static const int MAX_TABSIZE = 64;
  */
 PropEditor::PropEditor(COptionsMgr *optionsMgr) 
 : OptionsPanel(optionsMgr, PropEditor::IDD)
-, m_bHiliteSyntax(FALSE)
+, m_bHiliteSyntax(false)
 , m_nTabType(-1)
 , m_nTabSize(0)
-, m_bAutomaticRescan(FALSE)
-, m_bAllowMixedEol(FALSE)
-, m_bViewLineDifferences(FALSE)
-, m_bBreakOnWords(FALSE)
+, m_bAutomaticRescan(false)
+, m_bAllowMixedEol(false)
+, m_bViewLineDifferences(false)
+, m_bBreakOnWords(false)
 , m_nBreakType(0)
 {
 }
@@ -96,9 +97,9 @@ void PropEditor::WriteOptions()
                m_nTabSize = MAX_TABSIZE;
        GetOptionsMgr()->SaveOption(OPT_TAB_SIZE, (int)m_nTabSize);
        GetOptionsMgr()->SaveOption(OPT_TAB_TYPE, (int)m_nTabType);
-       GetOptionsMgr()->SaveOption(OPT_AUTOMATIC_RESCAN, m_bAutomaticRescan == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_ALLOW_MIXED_EOL, m_bAllowMixedEol == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_SYNTAX_HIGHLIGHT, m_bHiliteSyntax == TRUE);
+       GetOptionsMgr()->SaveOption(OPT_AUTOMATIC_RESCAN, m_bAutomaticRescan);
+       GetOptionsMgr()->SaveOption(OPT_ALLOW_MIXED_EOL, m_bAllowMixedEol);
+       GetOptionsMgr()->SaveOption(OPT_SYNTAX_HIGHLIGHT, m_bHiliteSyntax);
        GetOptionsMgr()->SaveOption(OPT_WORDDIFF_HIGHLIGHT, !!m_bViewLineDifferences);
        GetOptionsMgr()->SaveOption(OPT_BREAK_ON_WORDS, !!m_bBreakOnWords);
        GetOptionsMgr()->SaveOption(OPT_BREAK_TYPE, m_nBreakType);
@@ -174,9 +175,9 @@ void PropEditor::UpdateLineDiffControls()
 void PropEditor::OnEnKillfocusTabEdit()
 {
        CEdit * pEdit = (CEdit *)GetDlgItem(IDC_TAB_EDIT);
-       CString valueAsText;
-       pEdit->GetWindowText(valueAsText);
-       int value = _ttoi(valueAsText);
+       String valueAsText;
+       pEdit->GetWindowText(PopString(valueAsText));
+       int value = _ttoi(valueAsText.c_str());
        
        if (value < 1 || value > MAX_TABSIZE)
        {
index 03bd530..65d24d0 100644 (file)
@@ -11,6 +11,7 @@
 #define AFX_PROPEDITOR_H__1F2D57BB_6C09_488B_834D_575A94B2BDB8__INCLUDED_
 
 #include "OptionsPanel.h"
+#include "UnicodeString.h"
 
 class COptionsMgr;
 
@@ -33,15 +34,15 @@ public:
 // Dialog Data
        //{{AFX_DATA(PropEditor)
        enum { IDD = IDD_PROPPAGE_EDITOR };
-       BOOL    m_bHiliteSyntax;
+       bool    m_bHiliteSyntax;
        int         m_nTabType;
-       UINT    m_nTabSize;
-       BOOL    m_bAutomaticRescan;
-       BOOL    m_bAllowMixedEol;
-       BOOL    m_bViewLineDifferences;
-       BOOL    m_bBreakOnWords;
+       unsigned m_nTabSize;
+       bool    m_bAutomaticRescan;
+       bool    m_bAllowMixedEol;
+       bool    m_bViewLineDifferences;
+       bool    m_bBreakOnWords;
        int     m_nBreakType;
-       CString m_breakChars;
+       String m_breakChars;
        //}}AFX_DATA
 
 private:
index df3dbef..5e6f18a 100644 (file)
@@ -33,6 +33,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -45,17 +46,17 @@ static char THIS_FILE[] = __FILE__;
  */
 PropGeneral::PropGeneral(COptionsMgr *optionsMgr) 
 : OptionsPanel(optionsMgr, PropGeneral::IDD)
-, m_bScroll(FALSE)
-, m_bDisableSplash(FALSE)
-, m_bSingleInstance(FALSE)
-, m_bVerifyPaths(FALSE)
+, m_bScroll(false)
+, m_bDisableSplash(false)
+, m_bSingleInstance(false)
+, m_bVerifyPaths(false)
 , m_bCloseWindowWithEsc(TRUE)
-, m_bAskMultiWindowClose(FALSE)
-, m_bMultipleFileCmp(FALSE)
-, m_bMultipleDirCmp(FALSE)
+, m_bAskMultiWindowClose(false)
+, m_bMultipleFileCmp(false)
+, m_bMultipleDirCmp(false)
 , m_nAutoCompleteSource(0)
-, m_bPreserveFiletime(FALSE)
-, m_bShowSelectFolderOnStartup(FALSE)
+, m_bPreserveFiletime(false)
+, m_bShowSelectFolderOnStartup(false)
 {
 }
 
@@ -128,14 +129,14 @@ void PropGeneral::ReadOptions()
  */
 void PropGeneral::WriteOptions()
 {
-       GetOptionsMgr()->SaveOption(OPT_SCROLL_TO_FIRST, m_bScroll == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_DISABLE_SPLASH, m_bDisableSplash == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_SINGLE_INSTANCE, m_bSingleInstance == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_VERIFY_OPEN_PATHS, m_bVerifyPaths == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_CLOSE_WITH_ESC, m_bCloseWindowWithEsc == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_ASK_MULTIWINDOW_CLOSE, m_bAskMultiWindowClose == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_MULTIDOC_MERGEDOCS, m_bMultipleFileCmp == TRUE);
-       GetOptionsMgr()->SaveOption(OPT_MULTIDOC_DIRDOCS, m_bMultipleDirCmp == TRUE);
+       GetOptionsMgr()->SaveOption(OPT_SCROLL_TO_FIRST, m_bScroll);
+       GetOptionsMgr()->SaveOption(OPT_DISABLE_SPLASH, m_bDisableSplash);
+       GetOptionsMgr()->SaveOption(OPT_SINGLE_INSTANCE, m_bSingleInstance);
+       GetOptionsMgr()->SaveOption(OPT_VERIFY_OPEN_PATHS, m_bVerifyPaths);
+       GetOptionsMgr()->SaveOption(OPT_CLOSE_WITH_ESC, m_bCloseWindowWithEsc);
+       GetOptionsMgr()->SaveOption(OPT_ASK_MULTIWINDOW_CLOSE, m_bAskMultiWindowClose);
+       GetOptionsMgr()->SaveOption(OPT_MULTIDOC_MERGEDOCS, m_bMultipleFileCmp);
+       GetOptionsMgr()->SaveOption(OPT_MULTIDOC_DIRDOCS, m_bMultipleDirCmp);
        GetOptionsMgr()->SaveOption(OPT_AUTO_COMPLETE_SOURCE, m_nAutoCompleteSource);
        GetOptionsMgr()->SaveOption(OPT_PRESERVE_FILETIMES, m_bPreserveFiletime);
        GetOptionsMgr()->SaveOption(OPT_SHOW_SELECT_FILES_AT_STARTUP, m_bShowSelectFolderOnStartup);
index ab550da..ee5b568 100644 (file)
@@ -30,17 +30,17 @@ public:
 // Dialog Data
        //{{AFX_DATA(PropGeneral)
        enum { IDD = IDD_PROPPAGE_GENERAL };
-       BOOL  m_bScroll;
-       BOOL  m_bDisableSplash;
-       BOOL  m_bSingleInstance;
-       BOOL  m_bVerifyPaths;
-       BOOL  m_bCloseWindowWithEsc;
-       BOOL  m_bAskMultiWindowClose;
-       BOOL    m_bMultipleFileCmp;
-       BOOL    m_bMultipleDirCmp;
-       int             m_nAutoCompleteSource;
-       BOOL    m_bPreserveFiletime;
-       BOOL    m_bShowSelectFolderOnStartup;
+       bool  m_bScroll;
+       bool  m_bDisableSplash;
+       bool  m_bSingleInstance;
+       bool  m_bVerifyPaths;
+       bool  m_bCloseWindowWithEsc;
+       bool  m_bAskMultiWindowClose;
+       bool  m_bMultipleFileCmp;
+       bool  m_bMultipleDirCmp;
+       int   m_nAutoCompleteSource;
+       bool  m_bPreserveFiletime;
+       bool  m_bShowSelectFolderOnStartup;
        //}}AFX_DATA
 
 
index 6194b21..46e8d74 100644 (file)
@@ -32,6 +32,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -95,18 +96,18 @@ void PropRegistry::WriteOptions()
 
        GetOptionsMgr()->SaveOption(OPT_USE_RECYCLE_BIN, m_bUseRecycleBin == TRUE);
 
-       String sExtEditor = string_trim_ws((LPCTSTR)m_strEditorPath);
+       String sExtEditor = string_trim_ws(m_strEditorPath);
        if (sExtEditor.empty())
                sExtEditor = sDefaultEditor;
        GetOptionsMgr()->SaveOption(OPT_EXT_EDITOR_CMD, sExtEditor);
 
-       String sFilterPath = string_trim_ws((LPCTSTR)m_strUserFilterPath);
+       String sFilterPath = string_trim_ws(m_strUserFilterPath);
        GetOptionsMgr()->SaveOption(OPT_FILTER_USERPATH, sFilterPath);
 
        bool useSysTemp = m_tempFolderType == 0;
        GetOptionsMgr()->SaveOption(OPT_USE_SYSTEM_TEMP_PATH, useSysTemp);
 
-       String tempFolder = string_trim_ws((LPCTSTR)m_tempFolder);
+       String tempFolder = string_trim_ws(m_tempFolder);
        GetOptionsMgr()->SaveOption(OPT_CUSTOM_TEMP_PATH, tempFolder);
 }
 
@@ -125,7 +126,7 @@ BOOL PropRegistry::OnInitDialog()
 void PropRegistry::OnBrowseEditor()
 {
        String path;
-       if (SelectFile(GetSafeHwnd(), path, m_strEditorPath, _("Open"), _("Programs|*.exe;*.bat;*.cmd|All Files (*.*)|*.*||"), TRUE))
+       if (SelectFile(GetSafeHwnd(), path, m_strEditorPath.c_str(), _("Open"), _("Programs|*.exe;*.bat;*.cmd|All Files (*.*)|*.*||"), TRUE))
        {
                SetDlgItemText(IDC_EXT_EDITOR_PATH, path.c_str());
        }
@@ -135,7 +136,7 @@ void PropRegistry::OnBrowseEditor()
 void PropRegistry::OnBrowseFilterPath()
 {
        String path;
-       if (SelectFolder(path, m_strUserFilterPath, _("Open"), GetSafeHwnd()))
+       if (SelectFolder(path, m_strUserFilterPath.c_str(), _("Open"), GetSafeHwnd()))
        {
                SetDlgItemText(IDC_FILTER_USER_PATH, path.c_str());
        }
@@ -145,7 +146,7 @@ void PropRegistry::OnBrowseFilterPath()
 void PropRegistry::OnBrowseTmpFolder()
 {
        String path;
-       if (SelectFolder(path, m_tempFolder, _T(""), GetSafeHwnd()))
+       if (SelectFolder(path, m_tempFolder.c_str(), _T(""), GetSafeHwnd()))
        {
                SetDlgItemText(IDC_TMPFOLDER_NAME, path.c_str());
        }
index e19c79f..40ea681 100644 (file)
@@ -26,6 +26,7 @@
 #define PropRegistry_h_included
 
 #include "OptionsPanel.h"
+#include "UnicodeString.h"
 
 class COptionsMgr;
 
@@ -49,11 +50,11 @@ public:
 // Dialog Data
        //{{AFX_DATA(PropRegistry)
        enum { IDD = IDD_PROPPAGE_SYSTEM };
-       CString m_strEditorPath;
-       BOOL    m_bUseRecycleBin;
-       CString m_strUserFilterPath;
-       int             m_tempFolderType;
-       CString m_tempFolder;
+       String  m_strEditorPath;
+       bool    m_bUseRecycleBin;
+       String  m_strUserFilterPath;
+       int     m_tempFolderType;
+       String  m_tempFolder;
        //}}AFX_DATA
 
        // Overrides
index 4ce980d..1d22fcf 100644 (file)
@@ -15,6 +15,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -37,10 +38,10 @@ static LPCTSTR f_RegValuePath = _T("Executable");
 
 PropShell::PropShell(COptionsMgr *optionsMgr) 
 : OptionsPanel(optionsMgr, PropShell::IDD)
-, m_bEnableShellContextMenu(FALSE)
-, m_bContextAdded(FALSE)
-, m_bContextAdvanced(FALSE)
-, m_bContextSubfolders(FALSE)
+, m_bEnableShellContextMenu(false)
+, m_bContextAdded(false)
+, m_bContextAdvanced(false)
+, m_bContextSubfolders(false)
 {
 }
 
@@ -111,13 +112,13 @@ void PropShell::GetContextRegValues()
        DWORD dwContextEnabled = reg.ReadDword(f_RegValueEnabled, 0);
 
        if (dwContextEnabled & CONTEXT_F_ENABLED)
-               m_bContextAdded = TRUE;
+               m_bContextAdded = true;
 
        if (dwContextEnabled & CONTEXT_F_ADVANCED)
-               m_bContextAdvanced = TRUE;
+               m_bContextAdvanced = true;
 
        if (dwContextEnabled & CONTEXT_F_SUBFOLDERS)
-               m_bContextSubfolders = TRUE;
+               m_bContextSubfolders = true;
 }
 
 /// Set registry values for ShellExtension
@@ -188,7 +189,7 @@ void PropShell::AdvancedContextMenuCheck()
        {
                GetDlgItem(IDC_EXPLORER_ADVANCED)->EnableWindow(FALSE);
                CheckDlgButton(IDC_EXPLORER_ADVANCED, FALSE);
-               m_bContextAdvanced = FALSE;
+               m_bContextAdvanced = false;
        }
 }
 
@@ -201,6 +202,6 @@ void PropShell::SubfolderOptionCheck()
        {
                GetDlgItem(IDC_EXPLORER_SUBFOLDERS)->EnableWindow(FALSE);
                CheckDlgButton(IDC_EXPLORER_SUBFOLDERS, FALSE);
-               m_bContextSubfolders = FALSE;
+               m_bContextSubfolders = false;
        }
 }
index 1545783..08364ff 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "OptionsPanel.h"
 
+
 /**
  * @brief Class for Shell options -propertypage.
  */
@@ -26,10 +27,10 @@ public:
 
 // Dialog Data
        enum { IDD = IDD_PROPPAGE_SHELL };
-       BOOL m_bContextAdded;
-       BOOL m_bContextAdvanced;
-       BOOL m_bContextSubfolders;
-       BOOL m_bEnableShellContextMenu;
+       bool m_bContextAdded;
+       bool m_bContextAdvanced;
+       bool m_bContextSubfolders;
+       bool m_bEnableShellContextMenu;
 
 // Overrides
        protected:
index 12d92d9..7261b3e 100644 (file)
@@ -15,6 +15,7 @@
 #include "OptionsDef.h"
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -30,7 +31,7 @@ static const TCHAR Section[] = _T("Custom Colors");
  */
 PropTextColors::PropTextColors(COptionsMgr *optionsMgr, SyntaxColors *pColors)
  : OptionsPanel(optionsMgr, PropTextColors::IDD)
-, m_bCustomColors(FALSE)
+, m_bCustomColors(false)
 , m_pTempColors(pColors)
 {
 }
@@ -83,7 +84,7 @@ BOOL PropTextColors::OnInitDialog()
  */
 void PropTextColors::ReadOptions()
 {
-       m_bCustomColors = GetOptionsMgr()->GetBool(OPT_CLR_DEFAULT_TEXT_COLORING) ? FALSE : TRUE;
+       m_bCustomColors = GetOptionsMgr()->GetBool(OPT_CLR_DEFAULT_TEXT_COLORING) ? false : true;
        SerializeColorsToFromScreen(LOAD_COLORS);
 }
 
@@ -93,7 +94,7 @@ void PropTextColors::ReadOptions()
  */
 void PropTextColors::WriteOptions()
 {
-       GetOptionsMgr()->SaveOption(OPT_CLR_DEFAULT_TEXT_COLORING, m_bCustomColors == FALSE);
+       GetOptionsMgr()->SaveOption(OPT_CLR_DEFAULT_TEXT_COLORING, m_bCustomColors == false);
        // User can only change colors via BrowseColorAndSave,
        // which writes to m_pTempColors
        // so user's latest choices are in m_pTempColors
index 3fa9234..8b49c58 100644 (file)
@@ -43,7 +43,7 @@ private:
        CColorButton    m_btnRegularText;
        CColorButton    m_btnSelectionBackground;
        CColorButton    m_btnSelectionText;
-       BOOL            m_bCustomColors;
+       bool            m_bCustomColors;
        //}}AFX_DATA
 
        COLORREF        m_clrWhitespaceBackground;
index ed1e675..ed1baae 100644 (file)
@@ -35,6 +35,7 @@
 #include "OptionsMgr.h"
 #include "OptionsPanel.h"
 #include "SourceControl.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
index c2905e9..5b0878a 100644 (file)
@@ -10,6 +10,7 @@
 #define AFX_PROPVSS_H__30AD07AF_E420_11D1_BBC5_00A024706EDC__INCLUDED_
 
 #include "OptionsPanel.h"
+#include "UnicodeString.h"
 
 class COptionsMgr;
 
@@ -31,7 +32,7 @@ public:
        CStatic m_ctlVssL1;
        CEdit   m_ctlPath;
        CButton m_ctlBrowse;
-       CString m_strPath;
+       String  m_strPath;
        int             m_nVerSys;
        CComboBox  m_ctlVerSys;
        //}}AFX_DATA
index eb8d4b7..ff5c1e8 100644 (file)
@@ -25,6 +25,7 @@
 #include "stdafx.h"
 #include "Merge.h"
 #include "SaveClosingDlg.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -46,10 +47,10 @@ SaveClosingDlg::SaveClosingDlg(CWnd* pParent /*=NULL*/)
  , m_leftSave(SAVECLOSING_SAVE)
  , m_middleSave(SAVECLOSING_SAVE)
  , m_rightSave(SAVECLOSING_SAVE)
- , m_bAskForLeft(FALSE)
- , m_bAskForMiddle(FALSE)
- , m_bAskForRight(FALSE)
- , m_bDisableCancel(FALSE)
+ , m_bAskForLeft(false)
+ , m_bAskForMiddle(false)
+ , m_bAskForRight(false)
+ , m_bDisableCancel(false)
 {
 }
 
@@ -154,7 +155,7 @@ BOOL SaveClosingDlg::OnInitDialog()
  * @param [in] bLeft Do we ask about left-side file?
  * @param [in] bRight Do we ask about right-side file?
  */
-void SaveClosingDlg::DoAskFor(BOOL bLeft /*= FALSE*/, BOOL bMiddle /*= FALSE*/, BOOL bRight /*= FALSE*/)
+void SaveClosingDlg::DoAskFor(bool bLeft /*= false*/, bool bMiddle /*= false*/, bool bRight /*= false*/)
 {
        m_bAskForLeft = bLeft;
        m_bAskForMiddle = bMiddle;
index fc94fc8..37aad84 100644 (file)
@@ -27,6 +27,7 @@
 #define _SAVECLOSINGDLG_H_
 
 #include "CMoveConstraint.h"
+#include "UnicodeString.h"
 
 /////////////////////////////////////////////////////////////////////////////
 // SaveClosingDlg dialog
@@ -53,18 +54,18 @@ public:
        };
 
        SaveClosingDlg(CWnd* pParent = NULL);   // standard constructor
-       void DoAskFor(BOOL bLeft = FALSE, BOOL bMiddle = FALSE, BOOL bRight = FALSE);
+       void DoAskFor(bool bLeft = false, bool bMiddle = false, bool bRight = false);
 
 // Dialog Data
        //{{AFX_DATA(SaveClosingDlg)
        enum { IDD = IDD_SAVECLOSING };
-       CString m_sLeftFile; /**< Path to left-file to save. */
-       CString m_sMiddleFile; /**< Path to middle-file to save. */
-       CString m_sRightFile; /**< Path to right-side file to save. */
+       String m_sLeftFile; /**< Path to left-file to save. */
+       String m_sMiddleFile; /**< Path to middle-file to save. */
+       String m_sRightFile; /**< Path to right-side file to save. */
        int m_leftSave; /**< User's choice for left-side save. */
        int m_middleSave; /**< User's choice for middle-side save. */
        int m_rightSave; /**< User's choice for righ-side save. */
-       BOOL m_bDisableCancel; /**< Should we disable Cancel-button? */
+       bool m_bDisableCancel; /**< Should we disable Cancel-button? */
        //}}AFX_DATA
 
 protected:
@@ -80,9 +81,9 @@ protected:
 // Implementation data
 private:
        prdlg::CMoveConstraint m_constraint; /**< Resizes dialog controls when dialog resized */
-       BOOL m_bAskForLeft; /**< Is left file modified? */
-       BOOL m_bAskForMiddle; /**< Is middle file modified? */
-       BOOL m_bAskForRight; /**< Is right file modified? */
+       bool m_bAskForLeft; /**< Is left file modified? */
+       bool m_bAskForMiddle; /**< Is middle file modified? */
+       bool m_bAskForRight; /**< Is right file modified? */
 };
 
 #endif // _SAVECLOSINGDLG_H_
index 2c0a682..72ca511 100644 (file)
@@ -32,6 +32,7 @@
 #include "SelectUnpackerDlg.h"
 #include "Plugins.h"
 #include "FileTransform.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -47,7 +48,7 @@ static char THIS_FILE[] = __FILE__;
 void CSelectUnpackerDlg::Initialize()
 {
        //{{AFX_DATA_INIT(CSelectUnpackerDlg)
-       m_bNoExtensionCheck = FALSE;
+       m_bNoExtensionCheck = false;
        m_strDescription = _T("");
        m_strExtensions = _T("");
        //}}AFX_DATA_INIT
@@ -92,18 +93,18 @@ void CSelectUnpackerDlg::Initialize()
 }
 
 
-CSelectUnpackerDlg::CSelectUnpackerDlg(LPCTSTR filename, CWnd* pParent /*=NULL*/)
+CSelectUnpackerDlg::CSelectUnpackerDlg(const String& filename, CWnd* pParent /*=NULL*/)
        : CDialog(CSelectUnpackerDlg::IDD, pParent)
 {
        m_filteredFilenames = filename;
        Initialize();
 }
 
-CSelectUnpackerDlg::CSelectUnpackerDlg(LPCTSTR filename1, LPCTSTR filename2, CWnd* pParent /*=NULL*/)
+CSelectUnpackerDlg::CSelectUnpackerDlg(const String& filename1, const String& filename2, CWnd* pParent /*=NULL*/)
        : CDialog(CSelectUnpackerDlg::IDD, pParent)
 {
        m_filteredFilenames = filename1;
-       m_filteredFilenames += "|";
+       m_filteredFilenames += _T("|");
        m_filteredFilenames += filename2;
        Initialize();
 }
@@ -197,7 +198,7 @@ BOOL CSelectUnpackerDlg::OnInitDialog()
        theApp.TranslateDialog(m_hWnd);
        CDialog::OnInitDialog();
 
-       m_bNoExtensionCheck = AfxGetApp()->GetProfileInt(_T("Plugins"), _T("UnpackDontCheckExtension"), FALSE);
+       m_bNoExtensionCheck = !!AfxGetApp()->GetProfileInt(_T("Plugins"), _T("UnpackDontCheckExtension"), false);
 
        prepareListbox();
 
@@ -214,7 +215,7 @@ void CSelectUnpackerDlg::prepareListbox()
                PluginInfo * pPlugin = static_cast<PluginInfo*> (m_UnpackerPlugins.GetAt(i));
                if (pPlugin == noPlugin.get() || pPlugin == automaticPlugin.get() 
                                || m_bNoExtensionCheck 
-                         || pPlugin->TestAgainstRegList((LPCTSTR)m_filteredFilenames))
+                         || pPlugin->TestAgainstRegList(m_filteredFilenames))
                {
                        m_cboUnpackerName.AddString(pPlugin->m_name.c_str());
                        if (pPlugin == m_pPlugin)
@@ -253,11 +254,11 @@ void CSelectUnpackerDlg::OnSelchangeUnpackerName()
                // initialize with the default unpacker
                m_pPlugin = static_cast<PluginInfo*> (m_UnpackerPlugins.GetAt(0));
                PluginInfo * pPlugin;
-               m_cboUnpackerName.GetWindowText(m_strPluginName);
+               m_cboUnpackerName.GetWindowText(PopString(m_strPluginName));
                for (int j = 0 ; j < m_UnpackerPlugins.GetSize() ; j++)
                {
                        pPlugin = static_cast<PluginInfo*> (m_UnpackerPlugins.GetAt(j));
-                       if (m_strPluginName == pPlugin->m_name.c_str())
+                       if (m_strPluginName == pPlugin->m_name)
                        {
                                m_pPlugin = pPlugin;
                                break;
@@ -265,9 +266,9 @@ void CSelectUnpackerDlg::OnSelchangeUnpackerName()
                }
        }
 
-       m_strPluginName = m_pPlugin->m_name.c_str();
-       m_strDescription = m_pPlugin->m_description.c_str();
-       m_strExtensions = m_pPlugin->m_filtersText.c_str();
+       m_strPluginName = m_pPlugin->m_name;
+       m_strDescription = m_pPlugin->m_description;
+       m_strExtensions = m_pPlugin->m_filtersText;
 
        UpdateData (FALSE);
 }
index 735591b..cc47541 100644 (file)
@@ -30,6 +30,7 @@
 #define AFX_SELECTUNPACKERDLG_H__C8FD4C3A_5ED5_43D3_ADAE_A2378369705C__INCLUDED_
 
 #include <vector>
+#include "UnicodeString.h"
 
 /////////////////////////////////////////////////////////////////////////////
 // CSelectUnpackerDlgDlg dialog
@@ -45,8 +46,8 @@ private:
 
 public:
 // Construction
-       CSelectUnpackerDlg(LPCTSTR filename, CWnd* pParent /*=NULL*/);
-       CSelectUnpackerDlg(LPCTSTR filename1, LPCTSTR filename2, CWnd* pParent /*=NULL*/);
+       CSelectUnpackerDlg(const String& filename, CWnd* pParent /*=NULL*/);
+       CSelectUnpackerDlg(const String& filename1, const String& filename2, CWnd* pParent /*=NULL*/);
        ~CSelectUnpackerDlg();
 
        void SetInitialInfoHandler(PackingInfo * infoHandler);
@@ -57,9 +58,9 @@ public:
        enum { IDD = IDD_SELECTUNPACKER };
        CButton m_btnOK;
        CComboBox       m_cboUnpackerName;
-       BOOL    m_bNoExtensionCheck;
-       CString m_strDescription;
-       CString m_strExtensions;
+       bool    m_bNoExtensionCheck;
+       String  m_strDescription;
+       String  m_strExtensions;
        //}}AFX_DATA
 
 
@@ -82,12 +83,12 @@ protected:
        boost::scoped_ptr<PluginInfo> automaticPlugin;
 
        // input value
-       CString m_filteredFilenames;
+       String m_filteredFilenames;
 
        /// current plugin choice
        PluginInfo * m_pPlugin;
        /// current plugin choice
-       CString m_strPluginName;
+       String m_strPluginName;
 
        void prepareListbox();
 
index 16fc9b3..3d3cac8 100644 (file)
@@ -71,7 +71,7 @@ BOOL CSharedFilterDlg::OnInitDialog()
  */
 void CSharedFilterDlg::OnOK()
 {
-       BOOL bShared = (m_SharedButton.GetCheck() == BST_CHECKED);
+       bool bShared = (m_SharedButton.GetCheck() == BST_CHECKED);
        GetOptionsMgr()->SaveOption(OPT_FILEFILTER_SHARED, bShared);
        if (bShared)
                m_ChosenFolder = m_SharedFolder;
index e71b5aa..e2853f7 100644 (file)
@@ -133,17 +133,17 @@ bool SourceControl::SaveToVersionControl(const String& strSavePath)
        {
                // Prompt for user choice
                CVssPrompt dlg;
-               dlg.m_strMessage = string_format_string1(_("Save changes to %1?"), strSavePath).c_str();
-               dlg.m_strProject = m_vssHelper.GetProjectBase().c_str();
-               dlg.m_strUser = m_strVssUser.c_str();          // BSP - Add VSS user name to dialog box
-               dlg.m_strPassword = m_strVssPassword.c_str();
+               dlg.m_strMessage = string_format_string1(_("Save changes to %1?"), strSavePath);
+               dlg.m_strProject = m_vssHelper.GetProjectBase();
+               dlg.m_strUser = m_strVssUser;          // BSP - Add VSS user name to dialog box
+               dlg.m_strPassword = m_strVssPassword;
 
                // Dialog not suppressed - show it and allow user to select "checkout all"
                if (!m_CheckOutMulti)
                {
                        dlg.m_bMultiCheckouts = FALSE;
                        userChoice = dlg.DoModal();
-                       m_CheckOutMulti = !!dlg.m_bMultiCheckouts;
+                       m_CheckOutMulti = dlg.m_bMultiCheckouts;
                }
                else // Dialog already shown and user selected to "checkout all"
                        userChoice = IDOK;
@@ -152,7 +152,7 @@ bool SourceControl::SaveToVersionControl(const String& strSavePath)
                if (userChoice == IDOK)
                {
                        WaitStatusCursor waitstatus(_("Checkout files from VSS..."));
-                       m_vssHelper.SetProjectBase((const TCHAR *)dlg.m_strProject);
+                       m_vssHelper.SetProjectBase(dlg.m_strProject);
                        theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_vssHelper.GetProjectBase().c_str());
                        if (!spath.empty())
                        {
@@ -191,11 +191,11 @@ bool SourceControl::SaveToVersionControl(const String& strSavePath)
                CVssPrompt dlg;
                CRegKeyEx reg;
 
-               dlg.m_strMessage = string_format_string1(_("Save changes to %1?"), strSavePath).c_str();
-               dlg.m_strProject = m_vssHelper.GetProjectBase().c_str();
-               dlg.m_strUser = m_strVssUser.c_str();          // BSP - Add VSS user name to dialog box
-               dlg.m_strPassword = m_strVssPassword.c_str();
-               dlg.m_strSelectedDatabase = m_strVssDatabase.c_str();
+               dlg.m_strMessage = string_format_string1(_("Save changes to %1?"), strSavePath);
+               dlg.m_strProject = m_vssHelper.GetProjectBase();
+               dlg.m_strUser = m_strVssUser;          // BSP - Add VSS user name to dialog box
+               dlg.m_strPassword = m_strVssPassword;
+               dlg.m_strSelectedDatabase = m_strVssDatabase;
                dlg.m_bVCProjSync = TRUE;
 
                // Dialog not suppressed - show it and allow user to select "checkout all"
@@ -203,18 +203,18 @@ bool SourceControl::SaveToVersionControl(const String& strSavePath)
                {
                        dlg.m_bMultiCheckouts = FALSE;
                        userChoice = dlg.DoModal();
-                       m_CheckOutMulti = !!dlg.m_bMultiCheckouts;
+                       m_CheckOutMulti = dlg.m_bMultiCheckouts;
                        if (userChoice != IDOK)
                                return FALSE; // User selected cancel
                }
                // process versioning system specific action
                WaitStatusCursor waitstatus(_("Checkout files from VSS..."));
                BOOL bOpened = FALSE;
-               m_vssHelper.SetProjectBase((const TCHAR *)dlg.m_strProject);
+               m_vssHelper.SetProjectBase(dlg.m_strProject);
                m_strVssUser = dlg.m_strUser;
                m_strVssPassword = dlg.m_strPassword;
                m_strVssDatabase = dlg.m_strSelectedDatabase;
-               m_bVCProjSync = !!dlg.m_bVCProjSync;                                    
+               m_bVCProjSync = dlg.m_bVCProjSync;                                      
 
                theApp.WriteProfileString(_T("Settings"), _T("VssDatabase"), m_strVssDatabase.c_str());
                theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_vssHelper.GetProjectBase().c_str());
@@ -321,13 +321,13 @@ bool SourceControl::SaveToVersionControl(const String& strSavePath)
                CCCPrompt dlg;
                if (!m_CheckOutMulti)
                {
-                       dlg.m_bMultiCheckouts = FALSE;
+                       dlg.m_bMultiCheckouts = false;
                        dlg.m_comments = _T("");
-                       dlg.m_bCheckin = FALSE;
+                       dlg.m_bCheckin = false;
                        userChoice = dlg.DoModal();
-                       m_CheckOutMulti = !!dlg.m_bMultiCheckouts;
-                       m_strCCComment = static_cast<const TCHAR *>(dlg.m_comments);
-                       m_bCheckinVCS = !!dlg.m_bCheckin;
+                       m_CheckOutMulti = dlg.m_bMultiCheckouts;
+                       m_strCCComment = dlg.m_comments;
+                       m_bCheckinVCS = dlg.m_bCheckin;
                }
                else // Dialog already shown and user selected to "checkout all"
                        userChoice = IDOK;
index e14045a..befebd1 100644 (file)
@@ -12,6 +12,7 @@
 #include "UnicodeString.h"
 #include "TestFilterDlg.h"
 #include "FileFilterMgr.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -71,12 +72,12 @@ BOOL CTestFilterDlg::OnInitDialog()
 /** @brief User pressed Text button. */
 void CTestFilterDlg::OnTestBtn() 
 {
-       CString text;
-       GetDlgItemText(IDC_TEST_TEXT, text);
+       String text;
+       GetDlgItemText(IDC_TEST_TEXT, PopString(text));
 
-       bool passed = CheckText((LPCTSTR)text);
+       bool passed = CheckText(text);
 
-       CString result = (passed ? _T("passed") : _T("failed"));
+       String result = (passed ? _T("passed") : _T("failed"));
        text += _T(": ") + result;
 
        AppendResult(text);
@@ -102,19 +103,19 @@ void CTestFilterDlg::OnOK()
  * @param [in] text Text to test.
  * @return true if text passes the filter, FALSE otherwise.
  */
-bool CTestFilterDlg::CheckText(CString text) const
+bool CTestFilterDlg::CheckText(String text) const
 {
        CButton * IsDirButton = (CButton *)GetDlgItem(IDC_IS_DIRECTORY);
        bool isDir = (IsDirButton->GetCheck() == BST_CHECKED);
        if (isDir)
        {
                // Convert any forward slashes to canonical Windows-style backslashes
-               text.Replace('/', '\\');
-               return m_pFileFilterMgr->TestDirNameAgainstFilter(m_pFileFilter, (LPCTSTR)text);
+               string_replace(text, _T("/"), _T("\\"));
+               return m_pFileFilterMgr->TestDirNameAgainstFilter(m_pFileFilter, text);
        }
        else
        {
-               return m_pFileFilterMgr->TestFileNameAgainstFilter(m_pFileFilter, (LPCTSTR)text);
+               return m_pFileFilterMgr->TestFileNameAgainstFilter(m_pFileFilter, text);
        }
 }
 
@@ -123,21 +124,21 @@ bool CTestFilterDlg::CheckText(CString text) const
  * @param [in] edit Edit contror into which the text is added.
  * @param [in] text Text to add to edit control.
  */
-void AppendToEditBox(CEdit & edit, LPCTSTR text)
+void AppendToEditBox(CEdit & edit, const String& text)
 {
        int len = edit.GetWindowTextLength();
        edit.SetSel(len, len);
-       edit.ReplaceSel(text);
+       edit.ReplaceSel(text.c_str());
 }
 
 /**
  * @brief Add new result to end of result edit box.
  * @param [in] result Result text to add.
  */
-void CTestFilterDlg::AppendResult(CString result)
+void CTestFilterDlg::AppendResult(String result)
 {
        CEdit * edit = (CEdit *)GetDlgItem(IDC_RESULTS);
        if (edit->GetWindowTextLength()>0)
-               result = (CString)_T("\r\n") + result;
+               result = _T("\r\n") + result;
        AppendToEditBox(*edit, result);
 }
index 4665bba..7faa348 100644 (file)
@@ -31,8 +31,8 @@ private:
 
 // Implementation methods
 private:
-       bool CheckText(CString text) const;
-       void AppendResult(CString result);
+       bool CheckText(String text) const;
+       void AppendResult(String result);
 
 // Dialog Data
        //{{AFX_DATA(CTestFilterDlg)
index d0bf8a0..9ee03d0 100644 (file)
@@ -30,6 +30,7 @@
 #include "Merge.h"
 #include "VssPrompt.h"
 #include "RegKey.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -48,8 +49,8 @@ static char THIS_FILE[] = __FILE__;
 CVssPrompt::CVssPrompt(CWnd* pParent /*=NULL*/)
        : CDialog(CVssPrompt::IDD, pParent)
        , m_strSelectedDatabase(_T(""))
-       , m_bMultiCheckouts(FALSE)
-       , m_bVCProjSync(FALSE)
+       , m_bMultiCheckouts(false)
+       , m_bVCProjSync(false)
 {
 }
 
@@ -135,7 +136,7 @@ BOOL CVssPrompt::OnInitDialog()
 void CVssPrompt::OnOK()
 {
        UpdateData(TRUE);
-       if (m_strProject.IsEmpty())
+       if (m_strProject.empty())
        {
                LangMessageBox(IDS_NOPROJECT,MB_ICONSTOP);
                m_ctlProject.SetFocus();
index 472152a..646b705 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "SuperComboBox.h"
 #include "afxwin.h"
+#include "UnicodeString.h"
 
 /**
  * @brief Class for VSS dialog
@@ -41,10 +42,13 @@ public:
        //{{AFX_DATA(CVssPrompt)
        enum { IDD = IDD_VSS };
        CSuperComboBox  m_ctlProject;
-       CString m_strProject;
-       CString m_strUser;
-       CString m_strPassword;
-       CString m_strMessage;
+       String  m_strProject;
+       String  m_strUser;
+       String  m_strPassword;
+       String  m_strMessage;
+       String m_strSelectedDatabase;
+       bool m_bMultiCheckouts;
+       bool m_bVCProjSync;
        //}}AFX_DATA
 
 
@@ -66,11 +70,8 @@ protected:
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 public:
-       CString m_strSelectedDatabase;
        CComboBox m_ctlDBCombo;
-       BOOL m_bMultiCheckouts;
        CButton m_ctlMultiCheckouts;
-       BOOL m_bVCProjSync;
 };
 
 //{{AFX_INSERT_LOCATION}}
index 2517103..8c021d1 100644 (file)
@@ -25,6 +25,7 @@
 #include "stdafx.h"
 #include "merge.h"
 #include "WMGotoDlg.h"
+#include "DDXHelper.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
index 29741a5..105ce08 100644 (file)
@@ -26,6 +26,7 @@
 #if !defined(AFX_WMGOTODLG_H__A9D2366D_6358_4A74_9A45_6681D22EC786__INCLUDED_)
 #define AFX_WMGOTODLG_H__A9D2366D_6358_4A74_9A45_6681D22EC786__INCLUDED_
 
+#include "UnicodeString.h"
 
 /**
  * @brief Class for Goto-dialog.
@@ -43,7 +44,7 @@ public:
 // Dialog Data
        //{{AFX_DATA(WMGotoDlg)
        enum { IDD = IDD_WMGOTO };
-       CString m_strParam;  /**< Line/difference number. */
+       String m_strParam;   /**< Line/difference number. */
        int m_nFile;         /**< Target file number. */
        int m_nGotoWhat;     /**< Goto line or difference? */
        //}}AFX_DATA