Revision: 4061
http://svn.sourceforge.net/winmerge/?rev=4061&view=rev
Author: kimmov
Date: 2007-01-16 12:13:21 -0800 (Tue, 16 Jan 2007)
Log Message:
-----------
PATCH: [ 1636314 ] Fix limiting to single file compare window
Modified Paths:
--------------
trunk/Src/Changes.txt
trunk/Src/MainFrm.cpp
Modified: trunk/Src/Changes.txt
===================================================================
--- trunk/Src/Changes.txt 2007-01-16 19:43:14 UTC (rev 4060)
+++ trunk/Src/Changes.txt 2007-01-16 20:13:21 UTC (rev 4061)
@@ -2,6 +2,10 @@
Add new items to top.
(This summarizes all changes to all files under Src, including Src\Languages.)
+2007-01-16 Kimmo
+ PATCH: [ 1636314 ] Fix limiting to single file compare window
+ Src: MainFrm.cpp
+
2007-01-15 Kimmo
PATCH: [ 1620076 ] Add Bazaar and Mercurial to SourceControl.flt
Submitted by Ren\xE9 Leonhardt
Modified: trunk/Src/MainFrm.cpp
===================================================================
--- trunk/Src/MainFrm.cpp 2007-01-16 19:43:14 UTC (rev 4060)
+++ trunk/Src/MainFrm.cpp 2007-01-16 20:13:21 UTC (rev 4061)
@@ -593,11 +593,11 @@
*
* @param cpleft, cpright : left and right codepages
* = -1 when the file must be parsed
+ * @return OPENRESULTS_TYPE for success/failure code.
*/
-int /* really an OPENRESULTS_TYPE, but MainFrm.h doesn't know that type */
-CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc, const FileLocation & ifilelocLeft, const FileLocation & ifilelocRight,
- BOOL bROLeft, BOOL bRORight,
- PackingInfo * infoUnpacker /*= NULL*/)
+int CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
+ const FileLocation & ifilelocLeft, const FileLocation & ifilelocRight,
+ BOOL bROLeft, BOOL bRORight, PackingInfo * infoUnpacker /*= NULL*/)
{
BOOL docNull;
CMergeDoc * pMergeDoc = GetMergeDocToShow(pDirDoc, &docNull);
@@ -1812,9 +1812,30 @@
}
}
-/// Obtain a merge doc to display a difference in files
+/**
+ * @brief Obtain a merge doc to display a difference in files.
+ * This function (usually) uses DirDoc to determine if new or existing
+ * MergeDoc is used. However there is exceptional case when DirDoc does
+ * not contain diffs. Then we have only file compare, and if we also have
+ * limited file compare windows, we always reuse existing MergeDoc.
+ * @param [in] pDirDoc Dir compare document.
+ * @param [out] pNew Did we create a new document?
+ * @return Pointer to merge doucument.
+ */
CMergeDoc * CMainFrame::GetMergeDocToShow(CDirDoc * pDirDoc, BOOL * pNew)
{
+ const BOOL bMultiDocs = GetOptionsMgr()->GetBool(OPT_MULTIDOC_MERGEDOCS);
+ MergeDocList docs;
+ GetAllMergeDocs(&docs);
+
+ if (!pDirDoc->HasDiffs() && !bMultiDocs && !docs.IsEmpty())
+ {
+ *pNew = FALSE;
+
+ POSITION pos = docs.GetHeadPosition();
+ CMergeDoc * pMergeDoc = docs.GetAt(pos);
+ return pMergeDoc;
+ }
CMergeDoc * pMergeDoc = pDirDoc->GetMergeDocForDiff(pNew);
return pMergeDoc;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|