OSDN Git Service

* Remove MergeDoc.h and HexMergeDoc.h dependency from DirDoc.* and DirView.cpp
authorsdottaka <sdottaka@sourceforge.net>
Wed, 5 Nov 2014 01:22:46 +0000 (10:22 +0900)
committersdottaka <sdottaka@sourceforge.net>
Wed, 5 Nov 2014 01:22:46 +0000 (10:22 +0900)
  (Introduce IMergeDoc interface)
* Fix crash when closing a DirFrame window without closing the related ImgMergeFrame windows

--HG--
branch : stable

15 files changed:
Src/DirDoc.cpp
Src/DirDoc.h
Src/DirView.cpp
Src/HexMergeDoc.cpp
Src/HexMergeDoc.h
Src/IMergeDoc.h [new file with mode: 0644]
Src/ImgMergeFrm.cpp
Src/ImgMergeFrm.h
Src/MainFrm.cpp
Src/MainFrm.h
Src/Merge.vcproj
Src/Merge.vcxproj
Src/Merge.vcxproj.filters
Src/MergeDoc.h
Translations/WinMerge/English.pot

index c0f31b7..e9b9b51 100644 (file)
@@ -33,8 +33,8 @@
 #include <shlwapi.h>           // PathFindFileName()
 #include <Poco/StringTokenizer.h>
 #include "Merge.h"
-#include "MergeDoc.h"
-#include "HexMergeDoc.h"
+#include "IMergeDoc.h"
+#include "CompareOptions.h"
 #include "UnicodeString.h"
 #include "CompareStats.h"
 #include "FilterList.h"
@@ -99,15 +99,9 @@ CDirDoc::~CDirDoc()
        POSITION pos = m_MergeDocs.GetHeadPosition();
        while (pos)
        {
-               CMergeDoc * pMergeDoc = m_MergeDocs.GetNext(pos);
+               IMergeDoc * pMergeDoc = m_MergeDocs.GetNext(pos);
                pMergeDoc->DirDocClosing(this);
        }
-       pos = m_HexMergeDocs.GetHeadPosition();
-       while (pos)
-       {
-               CHexMergeDoc * pHexMergeDoc = m_HexMergeDocs.GetNext(pos);
-               pHexMergeDoc->DirDocClosing(this);
-       }
        // Delete all temporary folders belonging to this document
        while (m_pTempPathContext)
        {
@@ -618,31 +612,20 @@ void CDirDoc::SetDirView(CDirView * newView)
 /**
  * @brief A new MergeDoc has been opened.
  */
-void CDirDoc::AddMergeDoc(CMergeDoc * pMergeDoc)
+void CDirDoc::AddMergeDoc(IMergeDoc * pMergeDoc)
 {
        ASSERT(pMergeDoc);
        m_MergeDocs.AddTail(pMergeDoc);
 }
 
 /**
- * @brief A new HexMergeDoc has been opened.
- */
-void CDirDoc::AddHexMergeDoc(CHexMergeDoc * pHexMergeDoc)
-{
-       ASSERT(pHexMergeDoc);
-       m_HexMergeDocs.AddTail(pHexMergeDoc);
-}
-
-/**
  * @brief MergeDoc informs us it is closing.
  */
-void CDirDoc::MergeDocClosing(CDocument * pMergeDoc)
+void CDirDoc::MergeDocClosing(IMergeDoc * pMergeDoc)
 {
        ASSERT(pMergeDoc);
        if (POSITION pos = m_MergeDocs.CPtrList::Find(pMergeDoc))
                m_MergeDocs.RemoveAt(pos);
-       else if (POSITION pos = m_HexMergeDocs.CPtrList::Find(pMergeDoc))
-               m_HexMergeDocs.RemoveAt(pos);
        else
                ASSERT(FALSE);
 
@@ -653,7 +636,7 @@ void CDirDoc::MergeDocClosing(CDocument * pMergeDoc)
                if (m_pCtxt == NULL && !m_bReuseCloses)
                        m_pDirView->PostMessage(WM_COMMAND, ID_FILE_CLOSE);
        }
-       else if (m_MergeDocs.GetCount() == 0 && m_HexMergeDocs.GetCount() == 0)
+       else if (m_MergeDocs.GetCount() == 0)
        {
                delete this;
        }
@@ -671,17 +654,10 @@ BOOL CDirDoc::CloseMergeDocs()
        POSITION pos = m_MergeDocs.GetHeadPosition();
        while (pos)
        {
-               CMergeDoc * pMergeDoc = m_MergeDocs.GetNext(pos);
+               IMergeDoc * pMergeDoc = m_MergeDocs.GetNext(pos);
                if (!pMergeDoc->CloseNow())
                        return FALSE;
        }
-       pos = m_HexMergeDocs.GetHeadPosition();
-       while (pos)
-       {
-               CHexMergeDoc * pHexMergeDoc = m_HexMergeDocs.GetNext(pos);
-               if (!pHexMergeDoc->CloseNow())
-                       return FALSE;
-       }
        return TRUE;
 }
 
@@ -718,65 +694,6 @@ BOOL CDirDoc::ReusingDirDoc()
 }
 
 /**
- * @brief Obtain a merge doc to display a difference in files.
- * @param [out] pNew Set to TRUE if a new doc is created,
- * and FALSE if an existing one reused.
- * @return Pointer to CMergeDoc to use (new or existing). 
- */
-CMergeDoc * CDirDoc::GetMergeDocForDiff(int nFiles, BOOL * pNew)
-{
-       CMergeDoc * pMergeDoc = 0;
-       // policy -- use an existing merge doc if available
-       const BOOL bMultiDocs = GetOptionsMgr()->GetBool(OPT_MULTIDOC_MERGEDOCS);
-       if (!bMultiDocs && !m_MergeDocs.IsEmpty())
-       {
-               *pNew = FALSE;
-               pMergeDoc = m_MergeDocs.GetHead();
-       }
-       else
-       {
-               // Create a new merge doc
-               CMergeDoc::m_nBuffersTemp = nFiles;
-               pMergeDoc = (CMergeDoc*)theApp.m_pDiffTemplate->OpenDocumentFile(NULL);
-               AddMergeDoc(pMergeDoc);
-               pMergeDoc->SetDirDoc(this);
-               *pNew = TRUE;
-       }
-       return pMergeDoc;
-}
-
-/**
- * @brief Obtain a hex merge doc to display a difference in files.
- * @param [out] pNew Set to TRUE if a new doc is created,
- * and FALSE if an existing one reused.
- * @return Pointer to CHexMergeDoc to use (new or existing). 
- */
-CHexMergeDoc * CDirDoc::GetHexMergeDocForDiff(int nFiles, BOOL * pNew)
-{
-       CHexMergeDoc * pHexMergeDoc = 0;
-       // policy -- use an existing merge doc if available
-       const BOOL bMultiDocs = GetOptionsMgr()->GetBool(OPT_MULTIDOC_MERGEDOCS);
-       if (!bMultiDocs && !m_HexMergeDocs.IsEmpty())
-       {
-               *pNew = FALSE;
-               pHexMergeDoc = m_HexMergeDocs.GetHead();
-       }
-       else
-       {
-               // Create a new merge doc
-               CHexMergeDoc::m_nBuffersTemp = nFiles;
-               pHexMergeDoc = (CHexMergeDoc*)theApp.m_pHexMergeTemplate->OpenDocumentFile(NULL);
-               if (pHexMergeDoc)
-               {
-                       AddHexMergeDoc(pHexMergeDoc);
-                       pHexMergeDoc->SetDirDoc(this);
-               }
-               *pNew = TRUE;
-       }
-       return pHexMergeDoc;
-}
-
-/**
  * @brief Update changed item's compare status
  * @param [in] paths Paths for files we update
  * @param [in] nDiffs Total amount of differences
index 09d7d0f..019b407 100644 (file)
 #include "PluginManager.h"
 
 class CDirView;
-class CMergeDoc;
-class CHexMergeDoc;
-typedef CTypedPtrList<CPtrList, CMergeDoc *> MergeDocPtrList;
-typedef CTypedPtrList<CPtrList, CHexMergeDoc *> HexMergeDocPtrList;
+struct IMergeDoc;
+typedef CTypedPtrList<CPtrList, IMergeDoc *> MergeDocPtrList;
 class DirDocFilterGlobal;
 class DirDocFilterByExtension;
 class CustomStatusCursor;
@@ -71,8 +69,7 @@ public:
 public:
        BOOL CloseMergeDocs();
        CDirView * GetMainView() const;
-       CMergeDoc * GetMergeDocForDiff(int nFiles, BOOL * pNew);
-       CHexMergeDoc * GetHexMergeDocForDiff(int nFiles, BOOL * pNew);
+
        BOOL ReusingDirDoc();
 
 // Overrides
@@ -109,9 +106,8 @@ public:
        void Redisplay();
        virtual ~CDirDoc();
        void SetDirView( CDirView *newView ); // TODO Perry
-       void AddMergeDoc(CMergeDoc * pMergeDoc);
-       void AddHexMergeDoc(CHexMergeDoc * pHexMergeDoc);
-       void MergeDocClosing(CDocument * pMergeDoc);
+       void AddMergeDoc(IMergeDoc * pMergeDoc);
+       void MergeDocClosing(IMergeDoc * pMergeDoc);
        CDiffThread m_diffThread;
        void SetDiffStatus(UINT diffcode, UINT mask, int idx);
        void SetDiffCounts(UINT diffs, UINT ignored, int idx);
@@ -169,7 +165,6 @@ private:
        CDirView *m_pDirView; /**< Pointer to GUI */
        boost::scoped_ptr<CompareStats> m_pCompareStats; /**< Compare statistics */
        MergeDocPtrList m_MergeDocs; /**< List of file compares opened from this compare */
-       HexMergeDocPtrList m_HexMergeDocs; /**< List of hex file compares opened from this compare */
        bool m_bRO[3]; /**< Is left/middle/right side read-only */
        bool m_bRecursive; /**< Is current compare recursive? */
        boost::scoped_ptr<CustomStatusCursor> m_statusCursor;
index 83425f4..7a48619 100644 (file)
 #include "ClipBoard.h"
 #include "DirFrame.h"  // StatePane
 #include "DirDoc.h"
-#include "MergeDoc.h"
-#include "HexMergeFrm.h"
-#include "HexMergeDoc.h"
-#include "ImgMergeFrm.h"
+#include "IMergeDoc.h"
+#include "FileLocation.h"
 #include "MainFrm.h"
 #include "resource.h"
 #include "coretools.h"
@@ -3303,19 +3301,15 @@ struct FileCmpReport: public IFileCmpReport
                
                m_pDirView->OpenSelection();
                CFrameWnd * pFrame = GetMainFrame()->GetActiveFrame();
-               CMainFrame::FRAMETYPE frametype = GetMainFrame()->GetFrameType(pFrame);
-               if (frametype == CMainFrame::FRAME_FILE)
+               IMergeDoc * pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame->GetActiveDocument());
+               if (!pMergeDoc)
+                       pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
+
+               if (pMergeDoc)
                {
-                       CMergeDoc * pMergeDoc = (CMergeDoc *) pFrame->GetActiveDocument();
                        pMergeDoc->GenerateReport(paths_ConcatPath(sDestDir, sLinkPath).c_str());
                        pMergeDoc->CloseNow();
                }
-               else if (frametype == CMainFrame::FRAME_IMGFILE)
-               {
-                       CImgMergeFrame *pImgMergeFrame = static_cast<CImgMergeFrame *>(pFrame);
-                       pImgMergeFrame->GenerateReport(paths_ConcatPath(sDestDir, sLinkPath).c_str());
-                       pImgMergeFrame->CloseNow();
-               }
 
                MSG msg;
                while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))
index fbef78d..414ad8b 100644 (file)
@@ -490,14 +490,14 @@ void CHexMergeDoc::DirDocClosing(CDirDoc * pDirDoc)
 /**
  * @brief DirDoc commanding us to close
  */
-BOOL CHexMergeDoc::CloseNow()
+bool CHexMergeDoc::CloseNow()
 {
        // Allow user to cancel closing
        if (!PromptAndSaveIfNeeded(TRUE))
-               return FALSE;
+               return false;
 
        GetParentFrame()->CloseNow();
-       return TRUE;
+       return true;
 }
 
 /**
index 09ba42c..30c4990 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "PathContext.h"
 #include "DiffFileInfo.h"
+#include "IMergeDoc.h"
 
 class CDirDoc;
 class CHexMergeFrame;
@@ -35,7 +36,7 @@ class CHexMergeView;
 /**
  * @brief Document class for bytewise merging two files presented as hexdumps
  */
-class CHexMergeDoc : public CDocument
+class CHexMergeDoc : public CDocument, public IMergeDoc
 {
 public:
        enum BUFFERTYPE
@@ -79,7 +80,8 @@ public:
        BOOL PromptAndSaveIfNeeded(BOOL bAllowCancel);
        void SetDirDoc(CDirDoc * pDirDoc);
        void DirDocClosing(CDirDoc * pDirDoc);
-       BOOL CloseNow();
+       bool CloseNow();
+       bool GenerateReport(LPCTSTR szFileName) { return true; }
        CHexMergeFrame * GetParentFrame() const;
        void UpdateHeaderPath(int pane);
        HRESULT OpenDocs(const PathContext &paths, const bool bRO[]);
diff --git a/Src/IMergeDoc.h b/Src/IMergeDoc.h
new file mode 100644 (file)
index 0000000..7376548
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once\r
+\r
+#include "UnicodeString.h"\r
+\r
+class CDirDoc;\r
+\r
+struct IMergeDoc\r
+{\r
+       virtual void SetDirDoc(CDirDoc *pDirDoc) = 0;\r
+       virtual bool CloseNow(void) = 0;\r
+       virtual bool GenerateReport(const TCHAR *path) = 0;\r
+       virtual void DirDocClosing(CDirDoc * pDirDoc) = 0;\r
+       virtual void CheckFileChanged() = 0;\r
+};\r
+\r
index 1f639a0..7da2024 100644 (file)
@@ -169,6 +169,12 @@ CImgMergeFrame::CImgMergeFrame()
 
 CImgMergeFrame::~CImgMergeFrame()
 {
+       if (m_pDirDoc)
+       {
+               m_pDirDoc->MergeDocClosing(this);
+               m_pDirDoc = NULL;
+       }
+
        if (m_hIdentical != NULL)
        {
                DestroyIcon(m_hIdentical);
index bc78084..518a5ab 100644 (file)
@@ -29,6 +29,7 @@
 #include "EditorFilepathBar.h"
 #include "PathContext.h"
 #include "DiffFileInfo.h"
+#include "IMergeDoc.h"
 #include "../Externals/winimerge/src/WinIMergeLib.h"
 
 class CDirDoc;
@@ -36,7 +37,7 @@ class CDirDoc;
 /** 
  * @brief Frame class for file compare, handles panes, statusbar etc.
  */
-class CImgMergeFrame : public CMDIChildWnd
+class CImgMergeFrame : public CMDIChildWnd, public IMergeDoc
 {
        private:
        enum BUFFERTYPE
@@ -60,6 +61,7 @@ public:
        void SetDirDoc(CDirDoc * pDirDoc);
        void UpdateResources();
        bool CloseNow();
+       void DirDocClosing(CDirDoc * pDirDoc) { m_pDirDoc = NULL; }
        void SetSharedMenu(HMENU hMenu) { m_hMenuShared = hMenu; };
        void SetLastCompareResult(int nResult);
        void UpdateAutoPaneResize();
index fb74957..73ffd7e 100644 (file)
@@ -667,10 +667,9 @@ int CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
        int nFiles, const FileLocation ifileloc[],
        const DWORD dwFlags[] /*=0*/, const PackingInfo * infoUnpacker /*= NULL*/)
 {
-       BOOL docNull;
        if (!m_pMenus[MENU_MERGEVIEW])
                theApp.m_pDiffTemplate->m_hMenuShared = NewMergeViewMenu();
-       CMergeDoc * pMergeDoc = GetMergeDocToShow(nFiles, pDirDoc, &docNull);
+       CMergeDoc * pMergeDoc = GetMergeDocToShow(nFiles, pDirDoc);
 
        // Make local copies, so we can change encoding if we guess it below
        FileLocation fileloc[3];
@@ -760,13 +759,6 @@ int CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
                                }
                        }
                }
-               if (docNull)
-               {
-                       CWnd* pWnd = pMergeDoc->GetParentFrame();
-                       MDIActivate(pWnd);
-               }
-               else
-                       MDINext();
        }
        return openResults;
 }
@@ -774,10 +766,9 @@ int CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
 void CMainFrame::ShowHexMergeDoc(CDirDoc * pDirDoc, 
        const PathContext &paths, const bool bRO[])
 {
-       BOOL docNull;
        if (!m_pMenus[MENU_HEXMERGEVIEW])
                theApp.m_pHexMergeTemplate->m_hMenuShared = NewHexMergeViewMenu();
-       if (CHexMergeDoc *pHexMergeDoc = GetHexMergeDocToShow(paths.GetSize(), pDirDoc, &docNull))
+       if (CHexMergeDoc *pHexMergeDoc = GetHexMergeDocToShow(paths.GetSize(), pDirDoc))
                pHexMergeDoc->OpenDocs(paths, bRO);
 }
 
@@ -810,6 +801,7 @@ int CMainFrame::ShowImgMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocatio
        }
 
        pImgMergeFrame->SetDirDoc(pDirDoc);
+       pDirDoc->AddMergeDoc(pImgMergeFrame);
 
        if (!pImgMergeFrame->OpenImages(files, bRO, nActivePane, this))
        {
@@ -1568,6 +1560,21 @@ const HexMergeDocList &CMainFrame::GetAllHexMergeDocs()
 
 /**
  * @brief Obtain a merge doc to display a difference in files.
+ * @return Pointer to CMergeDoc to use. 
+ */
+template<class DocClass>
+DocClass * GetMergeDocForDiff(CMultiDocTemplate *pTemplate, CDirDoc *pDirDoc, int nFiles)
+{
+       // Create a new merge doc
+       DocClass::m_nBuffersTemp = nFiles;
+       DocClass *pMergeDoc = (DocClass*)pTemplate->OpenDocumentFile(NULL);
+       pDirDoc->AddMergeDoc(pMergeDoc);
+       pMergeDoc->SetDirDoc(pDirDoc);
+       return pMergeDoc;
+}
+
+/**
+ * @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
@@ -1576,7 +1583,7 @@ const HexMergeDocList &CMainFrame::GetAllHexMergeDocs()
  * @param [out] pNew Did we create a new document?
  * @return Pointer to merge doucument.
  */
-CMergeDoc * CMainFrame::GetMergeDocToShow(int nFiles, CDirDoc * pDirDoc, BOOL * pNew)
+CMergeDoc * CMainFrame::GetMergeDocToShow(int nFiles, CDirDoc * pDirDoc)
 {
        const BOOL bMultiDocs = GetOptionsMgr()->GetBool(OPT_MULTIDOC_MERGEDOCS);
        const MergeDocList &docs = GetAllMergeDocs();
@@ -1587,7 +1594,7 @@ CMergeDoc * CMainFrame::GetMergeDocToShow(int nFiles, CDirDoc * pDirDoc, BOOL *
                CMergeDoc * pMergeDoc = docs.GetAt(pos);
                pMergeDoc->CloseNow();
        }
-       CMergeDoc * pMergeDoc = pDirDoc->GetMergeDocForDiff(nFiles, pNew);
+       CMergeDoc * pMergeDoc = GetMergeDocForDiff<CMergeDoc>(theApp.m_pDiffTemplate, pDirDoc, nFiles);
        return pMergeDoc;
 }
 
@@ -1601,7 +1608,7 @@ CMergeDoc * CMainFrame::GetMergeDocToShow(int nFiles, CDirDoc * pDirDoc, BOOL *
  * @param [out] pNew Did we create a new document?
  * @return Pointer to merge doucument.
  */
-CHexMergeDoc * CMainFrame::GetHexMergeDocToShow(int nFiles, CDirDoc * pDirDoc, BOOL * pNew)
+CHexMergeDoc * CMainFrame::GetHexMergeDocToShow(int nFiles, CDirDoc * pDirDoc)
 {
        const BOOL bMultiDocs = GetOptionsMgr()->GetBool(OPT_MULTIDOC_MERGEDOCS);
        const HexMergeDocList &docs = GetAllHexMergeDocs();
@@ -1612,7 +1619,7 @@ CHexMergeDoc * CMainFrame::GetHexMergeDocToShow(int nFiles, CDirDoc * pDirDoc, B
                CHexMergeDoc * pHexMergeDoc = docs.GetAt(pos);
                pHexMergeDoc->CloseNow();
        }
-       CHexMergeDoc * pHexMergeDoc = pDirDoc->GetHexMergeDocForDiff(nFiles, pNew);
+       CHexMergeDoc * pHexMergeDoc = GetMergeDocForDiff<CHexMergeDoc>(theApp.m_pHexMergeTemplate, pDirDoc, nFiles);
        return pHexMergeDoc;
 }
 
@@ -2285,23 +2292,11 @@ LRESULT CMainFrame::OnUser1(WPARAM wParam, LPARAM lParam)
        CFrameWnd * pFrame = GetActiveFrame();
        if (pFrame)
        {
-               if (pFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)))
-               {
-                       CMergeDoc * pMergeDoc = (CMergeDoc *) pFrame->GetActiveDocument();
-                       if (pMergeDoc)
-                               pMergeDoc->CheckFileChanged();
-               }
-               else if (pFrame->IsKindOf(RUNTIME_CLASS(CHexMergeFrame)))
-               {
-                       CHexMergeDoc * pMergeDoc = (CHexMergeDoc *) pFrame->GetActiveDocument();
-                       if (pMergeDoc)
-                               pMergeDoc->CheckFileChanged();
-               }
-               else if (pFrame->IsKindOf(RUNTIME_CLASS(CImgMergeFrame)))
-               {
-                       CImgMergeFrame *pImgMergeFrame = static_cast<CImgMergeFrame *>(pFrame);
-                       pImgMergeFrame->CheckFileChanged();
-               }
+               IMergeDoc *pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame->GetActiveDocument());
+               if (!pMergeDoc)
+                       pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
+               if (pMergeDoc)
+                       pMergeDoc->CheckFileChanged();
        }
        return 0;
 }
@@ -2493,26 +2488,11 @@ void CMainFrame::OnActivateApp(BOOL bActive, HTASK hTask)
        CFrameWnd * pFrame = GetActiveFrame();
        if (pFrame)
        {
-               switch (GetFrameType(pFrame))
-               {
-               case FRAME_FILE:
-               {
-                       CMergeDoc * pMergeDoc = (CMergeDoc *) pFrame->GetActiveDocument();
-                       if (pMergeDoc)
-                               PostMessage(WM_USER+1);
-                       break;
-               }
-               case FRAME_HEXFILE:
-               {
-                       CHexMergeDoc * pMergeDoc = (CHexMergeDoc *) pFrame->GetActiveDocument();
-                       if (pMergeDoc)
-                               PostMessage(WM_USER+1);
-                       break;
-               }
-               case FRAME_IMGFILE:
+               IMergeDoc *pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame->GetActiveDocument());
+               if (!pMergeDoc)
+                       pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
+               if (pMergeDoc)
                        PostMessage(WM_USER+1);
-                       break;
-               }
        }
 }
 
index 795f6b5..3abc33b 100644 (file)
@@ -309,8 +309,8 @@ private:
        const DirDocList &GetAllDirDocs();
        const HexMergeDocList &GetAllHexMergeDocs();
        void RedisplayAllDirDocs();
-       CMergeDoc * GetMergeDocToShow(int nFiles, CDirDoc * pDirDoc, BOOL * pNew);
-       CHexMergeDoc * GetHexMergeDocToShow(int nDirs, CDirDoc * pDirDoc, BOOL * pNew);
+       CMergeDoc * GetMergeDocToShow(int nFiles, CDirDoc * pDirDoc);
+       CHexMergeDoc * GetHexMergeDocToShow(int nDirs, CDirDoc * pDirDoc);
        CDirDoc * GetDirDocToShow(int nDirs, BOOL * pNew);
        void UpdateFont(FRAMETYPE frame);
        BOOL CreateToolbar();
index 16b7b4d..3acbb45 100644 (file)
                                RelativePath=".\IListCtrl.h">\r
                        </File>\r
                        <File\r
+                               RelativePath=".\IMergeDoc.h">\r
+                       </File>\r
+                       <File\r
                                RelativePath="IntToIntMap.h">\r
                        </File>\r
                        <File\r
index b9fae80..e2050c0 100644 (file)
     <ClInclude Include="Common\coretools.h" />\r
     <ClInclude Include="Common\coretypes.h" />\r
     <ClInclude Include="Common\CSubclass.h" />\r
+    <ClInclude Include="IMergeDoc.h" />\r
     <ClInclude Include="ImgMergeFrm.h" />\r
     <ClInclude Include="Merge7zFormatShellImpl.h" />\r
     <ClInclude Include="OptionsCustomColors.h" />\r
index 224f776..314d4e2 100644 (file)
     <ClInclude Include="PropCompareImage.h">\r
       <Filter>MFCGui\Dialogs\PropertyPages</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="IMergeDoc.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="res\binarydiff.ico">\r
index c3b1aba..f3d484d 100644 (file)
@@ -37,6 +37,7 @@
 #include "TempFile.h"
 #include "PathContext.h"
 #include "DiffFileInfo.h"
+#include "IMergeDoc.h"
 
 /**
  * @brief Additional action codes for WinMerge.
@@ -159,7 +160,7 @@ class CEncodingErrorBar;
 /**
  * @brief Document class for merging two files
  */
-class CMergeDoc : public CDocument
+class CMergeDoc : public CDocument, public IMergeDoc
 {
 public:
        enum FileChange
index 492daaf..f7f1058 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WinMerge\n"
 "Report-Msgid-Bugs-To: http://bugs.winmerge.org/\n"
-"POT-Creation-Date: 2014-11-03 10:06+0000\n"
+"POT-Creation-Date: 2014-11-05 10:12+0000\n"
 "PO-Revision-Date: \n"
 "Last-Translator: \n"
 "Language-Team: English <winmerge-translate@lists.sourceforge.net>\n"