#include "version.h"
#include "paths.h"
#include "Environment.h"
-
+#include "DDXHelper.h"
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
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
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();
#include "statlink.h"
#include "resource.h" // IDD_ABOUTBOX
+#include "UnicodeString.h"
/**
* @brief About-dialog class.
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
#include "stdafx.h"
#include "merge.h"
#include "CCPrompt.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
CCCPrompt::CCCPrompt(CWnd* pParent /*=NULL*/)
: CDialog(CCCPrompt::IDD, pParent)
- , m_bMultiCheckouts(FALSE)
- , m_bCheckin(FALSE)
+ , m_bMultiCheckouts(false)
+ , m_bCheckin(false)
{
}
#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.
*/
// Dialog Data
//{{AFX_DATA(CCCPrompt)
enum { IDD = IDD_CLEARCASE };
- CString m_comments;
+ String m_comments;
+ bool m_bMultiCheckouts;
+ bool m_bCheckin;
//}}AFX_DATA
afx_msg void OnSaveas();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
-
-public:
- BOOL m_bMultiCheckouts;
- BOOL m_bCheckin;
};
//{{AFX_INSERT_LOCATION}}
* @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();
* @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);
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;
#include "stdafx.h"
#include "Merge.h"
#include "ConfirmFolderCopyDlg.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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);
#define _CONFIRM_FOLDER_COPY_DLG_H_
#include "CMoveConstraint.h"
+#include "UnicodeString.h"
/**
* @brief Dialog for item copy confirmation.
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();
--- /dev/null
+#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
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);
}
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);
}
}
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;
#include "FileOrFolderSelect.h"
#include "Merge.h"
#include "DirCmpReportDlg.h"
+#include "DDXHelper.h"
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)
{
}
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)
{
// 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);
{
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());
}
}
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,
//{{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
};
*/
CDirColsDlg::CDirColsDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDirColsDlg::IDD, pParent)
- , m_bReset(FALSE)
+ , m_bReset(false)
{
}
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);
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)
* @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();
void CDirColsDlg::OnDefaults()
{
m_listColumns.DeleteAllItems();
- m_bReset = TRUE;
+ m_bReset = true;
LoadDefLists();
}
//{{AFX_DATA(CDirColsDlg)
enum { IDD = IDD_DIRCOLS };
CListCtrl m_listColumns;
- BOOL m_bReset;
+ bool m_bReset;
//}}AFX_DATA
void LoadDefLists();
void SortArrayToLogicalOrder();
void MoveItem(int index, int newIndex);
- void MoveSelectedItems(BOOL bUp);
+ void MoveSelectedItems(bool bUp);
void SanitizeOrder();
// Implementation data
m_pCtxt.reset(new CDiffContext(paths,
GetOptionsMgr()->GetInt(OPT_CMP_METHOD)));
- m_pCtxt->m_bRecursive = !!bRecursive;
+ m_pCtxt->m_bRecursive = bRecursive;
if (pTempPathContext)
{
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)
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..
// 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);
}
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);
void FileFiltersDlg::SelectFilterByIndex(int index)
{
m_listFilters.SetItemState(index, LVIS_SELECTED, LVIS_SELECTED);
- BOOL bPartialOk = FALSE;
+ bool bPartialOk = false;
m_listFilters.EnsureVisible(index, bPartialOk);
}
// Can't edit first "None"
if (sel > 0)
{
- CString path = m_listFilters.GetItemText(sel, 2);
+ String path = m_listFilters.GetItemText(sel, 2);
EditFileFilter(path);
}
}
* @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);
}
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);
}
/**
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);
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());
}
}
}
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)
*/
void FileFiltersDlg::OnBnClickedFilterfileDelete()
{
- CString path;
+ String path;
int sel =- 1;
sel = m_listFilters.GetNextItem(sel, LVNI_SELECTED);
// 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;
{
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);
}
}
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
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)
{
#include "LineFiltersList.h"
#include "MainFrm.h"
#include "LineFiltersDlg.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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);
* @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;
}
if (newSel >= -1)
{
m_filtersList.SetItemState(newSel, LVIS_SELECTED, LVIS_SELECTED);
- BOOL bPartialOk = FALSE;
+ bool bPartialOk = false;
m_filtersList.EnsureVisible(newSel, bPartialOk);
}
}
// Dialog Data
//{{AFX_DATA(LineFiltersDlg)
enum { IDD = IDD_PROPPAGE_FILTER };
- BOOL m_bIgnoreRegExp;
+ bool m_bIgnoreRegExp;
//}}AFX_DATA
// Overrides
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:
#include "LoadSaveCodepageDlg.h"
#include "unicoder.h"
#include "ExConverter.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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)
//}}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;
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();
#pragma once
#include "CMoveConstraint.h"
+#include "UnicodeString.h"
/////////////////////////////////////////////////////////////////////////////
// CLoadSaveCodepageDlg dialog
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:
// 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;
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();
}
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();
}
<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
<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
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;
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)
{
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);
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;
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)
}
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())
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);
#include "PatchHTML.h"
#include "FileOrFolderSelect.h"
#include "Environment.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// 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)
{
}
// 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)
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;
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)
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());
}
}
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());
}
}
* @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)
{
else if (count > 1)
{
if (bLeft)
- m_file1.Empty();
+ m_file1.clear();
else
- m_file2.Empty();
+ m_file2.clear();
}
ClearItems();
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);
}
}
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);
}
}
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());
}
}
*/
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();
* @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();
}
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);
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 ||
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();
}
#include "resource.h"
#include "SuperComboBox.h"
+#include "UnicodeString.h"
struct PATCHFILES;
// 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();
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.) */
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();
/**
* @brief Default constructor.
*/
-CPatchTool::CPatchTool() : m_bOpenToEditor(FALSE)
+CPatchTool::CPatchTool() : m_bOpenToEditor(false)
{
}
int CPatchTool::CreatePatch()
{
DIFFSTATUS status;
- BOOL bResult = TRUE;
- BOOL bDiffSuccess;
+ bool bResult = true;
+ bool bDiffSuccess;
int retVal = 0;
CPatchDlg dlgPatch;
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);
}
// 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++)
{
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();
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;
}
}
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;
}
* @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;
// 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;
}
* @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;
}
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_
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);
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);
}
/**
* @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);
{
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());
}
}
#ifndef _PLUGINS_LIST_DIALOG_H_
#define _PLUGINS_LIST_DIALOG_H_
+#include "UnicodeString.h"
/**
* @brief A dialog listing plugins.
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
#include "ProjectFile.h"
#include "ProjectFilePathsDlg.h"
#include "FileOrFolderSelect.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
* @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
{
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);
}
}
{
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);
}
}
*/
void ProjectFilePathsDlg::OnBnClickedProjOpen()
{
- String fileName = AskProjectFileName(TRUE);
+ String fileName = AskProjectFileName(true);
if (fileName.empty())
return;
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);
{
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);
* @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;
strProjectPath = paths_GetParentPath(strProjectFileName);
// store this as the new project path
GetOptionsMgr()->SaveOption(OPT_PROJECTS_PATH, strProjectPath);
- return strProjectFileName.c_str();
+ return strProjectFileName;
}
#ifndef _PROJECTFILEPATHSDLG_H_
#define _PROJECTFILEPATHSDLG_H_
+#include "UnicodeString.h"
+
/**
* @brief Dialog allowing user to load, edit and save project files.
*/
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:
//}}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();
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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_
#include "OptionsPanel.h"
#include "FileOrFolderSelect.h"
#include "paths.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
*/
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)
{
}
*/
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);
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());
}
#define _PROPBACKUPS_H_
#include "OptionsPanel.h"
+#include "UnicodeString.h"
class COptionsMgr;
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:
#include "OptionsMgr.h"
#include "OptionsPanel.h"
#include "charsets.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
: 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)
{
}
{
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);
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()
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)
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()
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;
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
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
*/
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)
{
}
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);
}
/**
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);
}
// 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
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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;
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);
//{{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
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
*/
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)
{
}
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);
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)
{
#define AFX_PROPEDITOR_H__1F2D57BB_6C09_488B_834D_575A94B2BDB8__INCLUDED_
#include "OptionsPanel.h"
+#include "UnicodeString.h"
class COptionsMgr;
// 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:
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
*/
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)
{
}
*/
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);
// 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
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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);
}
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());
}
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());
}
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());
}
#define PropRegistry_h_included
#include "OptionsPanel.h"
+#include "UnicodeString.h"
class COptionsMgr;
// 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
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
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)
{
}
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
{
GetDlgItem(IDC_EXPLORER_ADVANCED)->EnableWindow(FALSE);
CheckDlgButton(IDC_EXPLORER_ADVANCED, FALSE);
- m_bContextAdvanced = FALSE;
+ m_bContextAdvanced = false;
}
}
{
GetDlgItem(IDC_EXPLORER_SUBFOLDERS)->EnableWindow(FALSE);
CheckDlgButton(IDC_EXPLORER_SUBFOLDERS, FALSE);
- m_bContextSubfolders = FALSE;
+ m_bContextSubfolders = false;
}
}
#include "OptionsPanel.h"
+
/**
* @brief Class for Shell options -propertypage.
*/
// 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:
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
*/
PropTextColors::PropTextColors(COptionsMgr *optionsMgr, SyntaxColors *pColors)
: OptionsPanel(optionsMgr, PropTextColors::IDD)
-, m_bCustomColors(FALSE)
+, m_bCustomColors(false)
, m_pTempColors(pColors)
{
}
*/
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);
}
*/
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
CColorButton m_btnRegularText;
CColorButton m_btnSelectionBackground;
CColorButton m_btnSelectionText;
- BOOL m_bCustomColors;
+ bool m_bCustomColors;
//}}AFX_DATA
COLORREF m_clrWhitespaceBackground;
#include "OptionsMgr.h"
#include "OptionsPanel.h"
#include "SourceControl.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#define AFX_PROPVSS_H__30AD07AF_E420_11D1_BBC5_00A024706EDC__INCLUDED_
#include "OptionsPanel.h"
+#include "UnicodeString.h"
class COptionsMgr;
CStatic m_ctlVssL1;
CEdit m_ctlPath;
CButton m_ctlBrowse;
- CString m_strPath;
+ String m_strPath;
int m_nVerSys;
CComboBox m_ctlVerSys;
//}}AFX_DATA
#include "stdafx.h"
#include "Merge.h"
#include "SaveClosingDlg.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
, 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)
{
}
* @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;
#define _SAVECLOSINGDLG_H_
#include "CMoveConstraint.h"
+#include "UnicodeString.h"
/////////////////////////////////////////////////////////////////////////////
// SaveClosingDlg dialog
};
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:
// 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_
#include "SelectUnpackerDlg.h"
#include "Plugins.h"
#include "FileTransform.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
void CSelectUnpackerDlg::Initialize()
{
//{{AFX_DATA_INIT(CSelectUnpackerDlg)
- m_bNoExtensionCheck = FALSE;
+ m_bNoExtensionCheck = false;
m_strDescription = _T("");
m_strExtensions = _T("");
//}}AFX_DATA_INIT
}
-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();
}
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();
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)
// 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;
}
}
- 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);
}
#define AFX_SELECTUNPACKERDLG_H__C8FD4C3A_5ED5_43D3_ADAE_A2378369705C__INCLUDED_
#include <vector>
+#include "UnicodeString.h"
/////////////////////////////////////////////////////////////////////////////
// CSelectUnpackerDlgDlg dialog
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);
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
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();
*/
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;
{
// 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;
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())
{
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"
{
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());
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;
#include "UnicodeString.h"
#include "TestFilterDlg.h"
#include "FileFilterMgr.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
/** @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);
* @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);
}
}
* @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);
}
// 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)
#include "Merge.h"
#include "VssPrompt.h"
#include "RegKey.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
CVssPrompt::CVssPrompt(CWnd* pParent /*=NULL*/)
: CDialog(CVssPrompt::IDD, pParent)
, m_strSelectedDatabase(_T(""))
- , m_bMultiCheckouts(FALSE)
- , m_bVCProjSync(FALSE)
+ , m_bMultiCheckouts(false)
+ , m_bVCProjSync(false)
{
}
void CVssPrompt::OnOK()
{
UpdateData(TRUE);
- if (m_strProject.IsEmpty())
+ if (m_strProject.empty())
{
LangMessageBox(IDS_NOPROJECT,MB_ICONSTOP);
m_ctlProject.SetFocus();
#include "SuperComboBox.h"
#include "afxwin.h"
+#include "UnicodeString.h"
/**
* @brief Class for VSS dialog
//{{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
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
- CString m_strSelectedDatabase;
CComboBox m_ctlDBCombo;
- BOOL m_bMultiCheckouts;
CButton m_ctlMultiCheckouts;
- BOOL m_bVCProjSync;
};
//{{AFX_INSERT_LOCATION}}
#include "stdafx.h"
#include "merge.h"
#include "WMGotoDlg.h"
+#include "DDXHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#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.
// 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