// Construction/Destruction
//////////////////////////////////////////////////////////////////////
+/**
+ * @brief Construct CDiffContext.
+ *
+ * @param [in] pszLeft Initial left-side path.
+ * @param [in] pszRight Initial right-side path.
+ */
CDiffContext::CDiffContext(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*/)
{
m_bRecurse=FALSE;
m_piPluginInfos = 0;
m_msgUpdateStatus = 0;
m_hDirFrame = NULL;
+
+ m_strNormalizedLeft = pszLeft;
+ paths_normalize(m_strNormalizedLeft);
+ m_strNormalizedRight = pszRight;
+ paths_normalize(m_strNormalizedRight);
}
+/**
+ * @brief Construct copy of existing CDiffContext.
+ *
+ * @param [in] pszLeft Initial left-side path.
+ * @param [in] pszRight Initial right-side path.
+ * @param [in] src Existing CDiffContext whose data is copied.
+ */
CDiffContext::CDiffContext(LPCTSTR pszLeft, LPCTSTR pszRight, CDiffContext& src)
{
// This is used somehow in recursive comparisons
pNamesLeft = NULL;
pNamesRight = NULL;
+
+ m_strNormalizedLeft = pszLeft;
+ paths_normalize(m_strNormalizedLeft);
+ m_strNormalizedRight = pszRight;
+ paths_normalize(m_strNormalizedRight);
}
CDiffContext::~CDiffContext()
return ver.GetFixedFileVersion();
}
-
/**
* @brief Add new diffitem to CDiffContext array
*/
CString sPath;
if (!isSideRight())
{
- sPath = pCtxt->m_strNormalizedLeft;
+ sPath = pCtxt->GetNormalizedLeft();
if (sSubdir.GetLength())
{
sPath = paths_ConcatPath(sPath, sSubdir);
CString sPath;
if (!isSideLeft())
{
- sPath = pCtxt->m_strNormalizedRight;
+ sPath = pCtxt->GetNormalizedRight();
if (sSubdir.GetLength())
{
sPath = paths_ConcatPath(sPath, sSubdir);
void RemoveAll();
void UpdateVersion(DIFFITEM & di, DiffFileInfo & dfi) const;
+ //@{
+ /**
+ * @name Path accessor functions.
+ *
+ * These functions return left/right path associated to DiffContext.
+ * There is no setter fuctions and path can be set only via constructor.
+ * Normalized paths are preferred to use - short paths are expanded
+ * and trailing slashes removed (except from root path).
+ */
+ const CString & GetLeftPath() const { return m_strLeft; }
+ const CString & GetRightPath() const { return m_strRight; }
+ const CString & GetNormalizedLeft() const { return m_strNormalizedLeft; }
+ const CString & GetNormalizedRight() const { return m_strNormalizedRight; }
+ //@}
+
// to iterate over all differences on list
POSITION GetFirstDiffPosition();
DIFFITEM GetNextDiffPosition(POSITION & diffpos);
void FetchPluginInfos(const CString& filteredFilenames, PackingInfo ** infoUnpacker, PrediffingInfo ** infoPrediffer);
BOOL m_bRecurse;
- CString m_strLeft;
- CString m_strRight;
- CString m_strNormalizedLeft;
- CString m_strNormalizedRight;
IDiffFilter * m_piFilterGlobal;
IPluginInfos * m_piPluginInfos;
UINT m_msgUpdateStatus;
private:
CList<DIFFITEM,DIFFITEM> m_dirlist, *m_pList; // master list of differences
+
+ CString m_strLeft;
+ CString m_strRight;
+ CString m_strNormalizedLeft;
+ CString m_strNormalizedRight;
};
#endif // !defined(AFX_DIFFCONTEXT_H__D3CC86BE_F11E_11D2_826C_00A024706EDC__INCLUDED_)
{
const CDiffContext * ctxt = GetDiffContext();
const DIFFITEM & di = ctxt->GetDiffAt(diffpos);
- CString relpath = paths_ConcatPath(di.sSubdir, di.sfilename);
- strLeft = paths_ConcatPath(ctxt->m_strLeft, relpath);
- strRight = paths_ConcatPath(ctxt->m_strRight, relpath);
+ const CString relpath = paths_ConcatPath(di.sSubdir, di.sfilename);
+ const CString & leftpath = ctxt->GetLeftPath();
+ const CString & rightpath = ctxt->GetRightPath();
+ strLeft = paths_ConcatPath(leftpath, relpath);
+ strRight = paths_ConcatPath(rightpath, relpath);
}
}
m_statusCursor = new CustomStatusCursor(0, IDC_APPSTARTING, LoadResString(IDS_STATUS_RESCANNING));
gLog.Write(LOGLEVEL::LNOTICE, _T("Starting directory scan:\n\tLeft: %s\n\tRight: %s\n"),
- m_pCtxt->m_strLeft, m_pCtxt->m_strRight);
+ m_pCtxt->GetLeftPath(), m_pCtxt->GetRightPath());
pf->clearStatus();
pf->ShowProcessingBar(TRUE);
m_pCtxt->RemoveAll();
- // fix up for diff code (remove trailing slashes etc)
- m_pCtxt->m_strNormalizedLeft = m_pCtxt->m_strLeft;
- m_pCtxt->m_strNormalizedRight = m_pCtxt->m_strRight;
m_pCtxt->m_hDirFrame = pf->GetSafeHwnd();
m_pCtxt->m_msgUpdateStatus = MSG_STAT_UPDATE;
m_pCtxt->m_bGuessEncoding = mf->m_options.GetBool(OPT_CP_DETECT);
- paths_normalize(m_pCtxt->m_strNormalizedLeft);
- paths_normalize(m_pCtxt->m_strNormalizedRight);
UpdateHeaderPath(TRUE);
UpdateHeaderPath(FALSE);
// draw the headers as active ones
m_diffThread.SetContext(m_pCtxt);
m_diffThread.SetHwnd(m_pDirView->GetSafeHwnd());
m_diffThread.SetMessageIDs(MSG_UI_UPDATE, MSG_STAT_UPDATE);
- m_diffThread.CompareDirectories(m_pCtxt->m_strNormalizedLeft,
- m_pCtxt->m_strNormalizedRight, m_bRecursive);
+ m_diffThread.CompareDirectories(m_pCtxt->GetNormalizedLeft(),
+ m_pCtxt->GetNormalizedRight(), m_bRecursive);
}
/**
CString s,s2;
UINT cnt=0;
- int llen = m_pCtxt->m_strNormalizedLeft.GetLength();
- int rlen = m_pCtxt->m_strNormalizedRight.GetLength();
+ int llen = m_pCtxt->GetNormalizedLeft().GetLength();
+ int rlen = m_pCtxt->GetNormalizedRight().GetLength();
m_pDirView->DeleteAllDisplayItems();
if (!m_strLeftDesc.IsEmpty())
sText = m_strLeftDesc;
else
- sText = m_pCtxt->m_strLeft;
+ sText = m_pCtxt->GetLeftPath();
nPane = 0;
}
else
if (!m_strRightDesc.IsEmpty())
sText = m_strRightDesc;
else
- sText = m_pCtxt->m_strRight;
+ sText = m_pCtxt->GetRightPath();
nPane = 1;
}
if (lpszTitle)
CDocument::SetTitle(lpszTitle);
- else if (!m_pCtxt || m_pCtxt->m_strLeft.IsEmpty() ||
- m_pCtxt->m_strRight.IsEmpty())
+ else if (!m_pCtxt || m_pCtxt->GetLeftPath().IsEmpty() ||
+ m_pCtxt->GetRightPath().IsEmpty())
{
CString title;
VERIFY(title.LoadString(IDS_DIRECTORY_WINDOW_TITLE));
m_pDirView->GetClientRect(&rcClient);
const DWORD width = rcClient.right / 3;
- sLeftFile = m_pCtxt->m_strLeft;
+ sLeftFile = m_pCtxt->GetLeftPath();
pszLeftFile = sLeftFile.GetBuffer(MAX_PATH);
if (PathCompactPath(lDC.GetSafeHdc(), pszLeftFile, width))
strTitle = pszLeftFile;
else
- strTitle = m_pCtxt->m_strLeft;
+ strTitle = m_pCtxt->GetLeftPath();
sLeftFile.ReleaseBuffer();
strTitle += strSeparator;
- sRightFile = m_pCtxt->m_strRight;
+ sRightFile = m_pCtxt->GetRightPath();
pszRightFile = sRightFile.GetBuffer(MAX_PATH);
if (PathCompactPath(lDC.GetSafeHdc(), pszRightFile, width))
strTitle += pszRightFile;
else
- strTitle += m_pCtxt->m_strRight;
+ strTitle += m_pCtxt->GetRightPath();
sRightFile.ReleaseBuffer();
CDocument::SetTitle(strTitle);
{
//int (WINAPI *collstr)(LPCTSTR, LPCTSTR) = casesensitive ? lstrcmp : lstrcmpi;
static const TCHAR backslash[] = _T("\\");
- CString sLeftDir = pCtxt->m_strNormalizedLeft;
- CString sRightDir = pCtxt->m_strNormalizedRight;
+ CString sLeftDir = pCtxt->GetNormalizedLeft();
+ CString sRightDir = pCtxt->GetNormalizedRight();
CString subprefix;
if (!subdir.IsEmpty())
{
*/
void CDirView::OpenParentDirectory()
{
- CString left = GetDocument()->m_pCtxt->m_strNormalizedLeft;
- CString right = GetDocument()->m_pCtxt->m_strNormalizedRight;
+ const CString & left = GetDocument()->m_pCtxt->GetNormalizedLeft();
+ const CString & right = GetDocument()->m_pCtxt->GetNormalizedRight();
CString leftParent = paths_GetParentPath(left);
CString rightParent = paths_GetParentPath(right);
*/
void CDirView::OnEditCopy()
{
- PutToClipboard(GenerateReport(), this->m_hWnd);
+ PutToClipboard(GenerateReport(), GetSafeHwnd());
}
/**
// Report:Title
if (GetDiffContext() != NULL)
- AfxFormatString2(report, IDS_DIRECTORY_REPORT_TITLE, GetDiffContext()->m_strLeft, GetDiffContext()->m_strRight);
+ {
+ AfxFormatString2(report, IDS_DIRECTORY_REPORT_TITLE,
+ GetDiffContext()->GetLeftPath(), GetDiffContext()->GetRightPath());
+ }
report += _T("\r\n"); // Use DOS-EOL style for reports
// Report:Header
{
CDirDoc *pDoc = GetDocument();
int retVal = 0;
- CString leftPath = pDoc->m_pCtxt->m_strNormalizedLeft;
- CString rightPath = pDoc->m_pCtxt->m_strNormalizedRight;
+ const CString & leftPath = pDoc->m_pCtxt->GetNormalizedLeft();
+ const CString & rightPath = pDoc->m_pCtxt->GetNormalizedRight();
CString leftParent = paths_GetParentPath(leftPath);
CString rightParent = paths_GetParentPath(rightPath);
PATCH: [ 1155319 ] Select font for dir compare view
Src: DirView.cpp DirView.h MainFrm.cpp MainFrm.h Merge.rc OptionsDef.h
Languages: *.rc
+ PATCH: [ 1154667 ] Make CDiffContext paths private members
+ Src: DiffContext.cpp DiffContext.h DirActions.cpp DirDoc.cpp DirScan.cpp DirView.cpp
2005-03-02 Perry
PATCH: [ 1154259 ] Non blurred 'error.bmp'