OSDN Git Service

crystaledit: Use GetProfile*()/WriteProfile*() to read and write the registry wheneve...
[winmerge-jp/winmerge-jp.git] / Src / DirDoc.h
index 1002e87..c4a4b85 100644 (file)
@@ -1,21 +1,7 @@
 /////////////////////////////////////////////////////////////////////////////
 //    WinMerge:  an interactive diff/merge utility
 //    Copyright (C) 1997  Dean P. Grimm
-//
-//    This program is free software; you can redistribute it and/or modify
-//    it under the terms of the GNU General Public License as published by
-//    the Free Software Foundation; either version 2 of the License, or
-//    (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU General Public License for more details.
-//
-//    You should have received a copy of the GNU General Public License
-//    along with this program; if not, write to the Free Software
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
+//    SPDX-License-Identifier: GPL-2.0-or-later
 /////////////////////////////////////////////////////////////////////////////
 /** 
  * @file  DirDoc.h
 #pragma once
 
 #include <memory>
-#include <cstdint>
 #include "DiffThread.h"
 #include "PluginManager.h"
+#include "FileFilterHelper.h"
+#include "DirCmpReport.h"
 
 class CDirView;
 struct IMergeDoc;
 typedef CTypedPtrList<CPtrList, IMergeDoc *> MergeDocPtrList;
 class DirDocFilterGlobal;
 class DirDocFilterByExtension;
-class CustomStatusCursor;
 class CTempPathContext;
 struct FileActionItem;
+struct FileLocation;
 
 /////////////////////////////////////////////////////////////////////////////
 // CDirDoc document
@@ -63,7 +50,7 @@ public:
 
 // Operations
 public:
-       BOOL CloseMergeDocs();
+       bool CloseMergeDocs();
        CDirView * GetMainView() const;
 
 // Overrides
@@ -85,36 +72,58 @@ public:
        bool GetReadOnly(int nIndex) const;
        const bool *GetReadOnly(void) const;
        void SetReadOnly(int nIndex, bool bReadOnly);
-       bool HasDirView() const { return m_pDirView != NULL; }
+       String GetReportFile() const { return m_sReportFile; }
+       void SetReportFile(const String& sReportFile) { m_sReportFile = sReportFile; }
+       bool GetGeneratingReport() const { return m_bGeneratingReport; }
+       void SetGeneratingReport(bool bGeneratingReport) { m_bGeneratingReport = bGeneratingReport; }
+       void SetReport(DirCmpReport* pReport) { m_pReport.reset(pReport);  }
+       bool HasDirView() const { return m_pDirView != nullptr; }
        void RefreshOptions();
        void CompareReady();
-       void UpdateChangedItem(PathContext & paths,
-               UINT nDiffs, UINT nTrivialDiffs, BOOL bIdentical);
+       void UpdateChangedItem(const PathContext & paths,
+               UINT nDiffs, UINT nTrivialDiffs, bool bIdentical);
        void UpdateResources();
        void InitStatusStrings();
-       void ReloadItemStatus(uintptr_t diffPos, int idx);
+       void ReloadItemStatus(DIFFITEM *diffPos, int idx);
        void Redisplay();
        virtual ~CDirDoc();
        void SetDirView( CDirView *newView ); // TODO Perry
        void AddMergeDoc(IMergeDoc * pMergeDoc);
        void MergeDocClosing(IMergeDoc * pMergeDoc);
        CDiffThread m_diffThread;
-       void UpdateHeaderPath(BOOL bLeft);
+       void UpdateHeaderPath(int nIndex);
        void AbortCurrentScan();
+       void PauseCurrentScan();
+       void ContinueCurrentScan();
        bool IsCurrentScanAbortable() const;
        void SetDescriptions(const String strDesc[]);
        void ApplyDisplayRoot(int nIndex, String &);
 
-       bool HasDiffs() const { return m_pCtxt != NULL; }
+       bool HasDiffs() const { return m_pCtxt != nullptr; }
        const CDiffContext & GetDiffContext() const { return *m_pCtxt; }
        CDiffContext& GetDiffContext() { return *m_pCtxt.get(); }
-       void SetMarkedRescan() {m_bMarkedRescan = TRUE; }
+       void SetMarkedRescan() {m_bMarkedRescan = true; }
        const CompareStats * GetCompareStats() const { return m_pCompareStats.get(); };
        bool IsArchiveFolders() const;
        PluginManager& GetPluginManager() { return m_pluginman; };
+       void Swap(int idx1, int idx2);
+       bool MoveableToNextDiff();
+       bool MoveableToPrevDiff();
+       void MoveToNextDiff(IMergeDoc *pMergeDoc);
+       void MoveToPrevDiff(IMergeDoc *pMergeDoc);
+       void MoveToFirstFile(IMergeDoc* pMergeDoc);
+       void MoveToLastFile(IMergeDoc* pMergeDoc);
+       void MoveToNextFile(IMergeDoc* pMergeDoc);
+       void MoveToPrevFile(IMergeDoc* pMergeDoc);
+       bool IsFirstFile();
+       bool IsLastFile();
+
+       bool CompareFilesIfFilesAreLarge(int nFiles, const FileLocation ifileloc[]);
 
 protected:
-       void LoadLineFilterList();
+       void InitDiffContext(CDiffContext *pCtxt);
+       void LoadLineFilterList(CDiffContext *pCtxt);
+       void LoadSubstitutionFiltersList(CDiffContext* pCtxt);
 
        // Generated message map functions
        //{{AFX_MSG(CDirDoc)
@@ -130,9 +139,35 @@ private:
        MergeDocPtrList m_MergeDocs; /**< List of file compares opened from this compare */
        bool m_bRO[3]; /**< Is left/middle/right side read-only */
        String m_strDesc[3]; /**< Left/middle/right side desription text */
+       String m_sReportFile;
        PluginManager m_pluginman;
-       bool m_bMarkedRescan; /**< If TRUE next rescan scans only marked items */
+       FileFilterHelper m_imgfileFilter;
+       bool m_bMarkedRescan; /**< If `true` next rescan scans only marked items */
+       bool m_bGeneratingReport;
+       std::unique_ptr<DirCmpReport> m_pReport;
 };
 
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+/**
+ * @brief Set left/middle/right side readonly-status
+ * @param nIndex Select side to set 
+ * @param bReadOnly New status of selected side
+ */
+inline void CDirDoc::SetReadOnly(int nIndex, bool bReadOnly)
+{
+       m_bRO[nIndex] = bReadOnly;
+}
+
+/**
+ * @brief Return left/middle/right side readonly-status
+ * @param nIndex Select side to ask
+ */
+inline bool CDirDoc::GetReadOnly(int nIndex) const
+{
+       return m_bRO[nIndex];
+}
+
+inline const bool *CDirDoc::GetReadOnly(void) const
+{
+       return m_bRO;
+}
+