OSDN Git Service

Fix issue #784: Error on try to show differences between two different gif
[winmerge-jp/winmerge-jp.git] / Src / DiffContext.h
index a13d733..4f9af4a 100644 (file)
@@ -3,25 +3,22 @@
  *
  *  @brief Declarations of CDiffContext and diff structures
  */
-// ID line follows -- this is updated by SVN
-// $Id: DiffContext.h 6910 2009-07-12 09:06:54Z kimmov $
-
-#if !defined(AFX_DIFFCONTEXT_H__D3CC86BE_F11E_11D2_826C_00A024706EDC__INCLUDED_)
-#define AFX_DIFFCONTEXT_H__D3CC86BE_F11E_11D2_826C_00A024706EDC__INCLUDED_
 #pragma once
 
+#define POCO_NO_UNWINDOWS 1
+#include <Poco/Mutex.h>
+#include <memory>
 #include "PathContext.h"
-#include "DiffFileInfo.h"
 #include "DiffItemList.h"
+#include "FilterList.h"
+#include "SubstitutionList.h"
 
 class PackingInfo;
 class PrediffingInfo;
 class IDiffFilter;
-struct DIFFITEM;
 class CompareStats;
 class IAbortable;
 class CDiffWrapper;
-class FilterList;
 class CompareOptions;
 struct DIFFOPTIONS;
 
@@ -29,7 +26,7 @@ struct DIFFOPTIONS;
 class IPluginInfos
 {
 public:
-       virtual void FetchPluginInfos(LPCTSTR filteredFilenames, 
+       virtual void FetchPluginInfos(const String& filteredFilenames, 
                                       PackingInfo ** infoUnpacker, 
                                       PrediffingInfo ** infoPrediffer) = 0;
 };
@@ -57,7 +54,7 @@ public:
        CDiffContext(const PathContext & paths, int compareMethod);
        ~CDiffContext();
 
-       void UpdateVersion(DIFFITEM & di, BOOL bLeft) const;
+       void UpdateVersion(DIFFITEM &di, int nIndex) const;
 
        /**
         * Get the main compare method used in this compare.
@@ -78,14 +75,14 @@ public:
         * Get left-side compare path.
         * @return full path in left-side.
         */
-       String GetLeftPath() const { return m_paths.GetLeft(FALSE); }
-       String GetMiddlePath() const { return m_paths.GetMiddle(FALSE); }
+       String GetLeftPath() const { return m_paths.GetLeft(false); }
+       String GetMiddlePath() const { return m_paths.GetMiddle(false); }
        /**
         * Get right-side compare path.
         * @return full path in right-side.
         */
-       String GetRightPath() const { return m_paths.GetRight(FALSE); }
-       String GetPath(int nIndex) const { return m_paths.GetPath(nIndex, FALSE); }
+       String GetRightPath() const { return m_paths.GetRight(false); }
+       String GetPath(int nIndex) const { return m_paths.GetPath(nIndex, false); }
        /**
         * Get left-side compare path in normalized form.
         * @return full path in left-side.
@@ -97,26 +94,25 @@ public:
         * @return full path in left-side.
         */
        String GetNormalizedRight() const { return m_paths.GetRight(); }
-       String GetNormalizedPath(int nIndex) const { return m_paths.GetPath(nIndex, TRUE); }
+       String GetNormalizedPath(int nIndex) const { return m_paths.GetPath(nIndex, true); }
        PathContext GetNormalizedPaths() const
        {
                PathContext paths;
                for (int nIndex = 0; nIndex < m_paths.GetSize(); nIndex++)
-                       paths.SetPath(nIndex, m_paths.GetPath(nIndex, TRUE).c_str());
+                       paths.SetPath(nIndex, m_paths.GetPath(nIndex, true));
                return paths;
        }
        //@}
 
        // change an existing difference
-       BOOL UpdateInfoFromDiskHalf(DIFFITEM & di, int nIndex);
-       void UpdateStatusFromDisk(UINT_PTR diffpos, BOOL bLeft, BOOL bRight);
-       void UpdateStatusFromDisk(POSITION diffpos, BOOL bLeft, BOOL bMiddle, BOOL bRight);
+       bool UpdateInfoFromDiskHalf(DIFFITEM &di, int nIndex);
+       void UpdateStatusFromDisk(DIFFITEM *diffpos, int nIndex);
 
-       BOOL CreateCompareOptions(int compareMethod, const DIFFOPTIONS & options);
+       bool CreateCompareOptions(int compareMethod, const DIFFOPTIONS & options);
        CompareOptions * GetCompareOptions(int compareMethod);
 
        // retrieve or manufacture plugin info for specified file comparison
-       void FetchPluginInfos(LPCTSTR filteredFilenames,
+       void FetchPluginInfos(const String& filteredFilenames,
                PackingInfo ** infoUnpacker, PrediffingInfo ** infoPrediffer);
 
        //@{
@@ -144,19 +140,23 @@ public:
 
        int GetCompareDirs() const { return m_paths.GetSize(); }
 
+       void Swap(int idx1, int idx2)
+       {
+               String tmp;
+               tmp = m_paths.GetPath(idx1);
+               m_paths.SetPath(idx1, m_paths.GetPath(idx2));
+               m_paths.SetPath(idx2, tmp);
+               DiffItemList::Swap(idx1, idx2);
+       }
+
+       const DIFFOPTIONS *GetOptions() const { return m_pOptions.get(); }
+
        IDiffFilter * m_piFilterGlobal; /**< Interface for file filtering. */
+       IDiffFilter * m_pImgfileFilter; /**< Interface for image file filtering */
        IPluginInfos * m_piPluginInfos;
        int m_iGuessEncodingType;
 
-       /**
-        * The current and effective compare method.
-        * During the compare we may change compare method per file. This may
-        * happen for various reasons. But the change is always temporarily and
-        * we must return to the main method indicated by m_nCompMethod.
-        */
-       int m_nCurrentCompMethod;
-
-       BOOL m_bIgnoreSmallTimeDiff; /**< Ignore small timedifferences when comparing by date */
+       bool m_bIgnoreSmallTimeDiff; /**< Ignore small timedifferences when comparing by date */
        CompareStats *m_pCompareStats; /**< Pointer to compare statistics */
 
        /**
@@ -175,6 +175,8 @@ public:
         */
        int m_nQuickCompareLimit;
 
+       int m_nBinaryCompareLimit;
+
        /**
         * Walk into unique folders and add contents.
         * This enables/disables walking into unique folders. If we don't walk into
@@ -185,12 +187,15 @@ public:
         * This value is true by default.
         */
        bool m_bWalkUniques;
+       bool m_bIgnoreReparsePoints;
+       bool m_bIgnoreCodepage;
+       bool m_bEnableImageCompare;
+       double m_dColorDistanceThreshold;
 
        bool m_bRecursive; /**< Do we include subfolders to compare? */
        bool m_bPluginsEnabled; /**< Are plugins enabled? */
-       FilterList * m_pFilterList; /**< Filter list for line filters */
-       BOOL m_bScanUnpairedDir; /** Scan into unpaired directories **/
-       CDiffWrapper *m_pDiffWrapper;
+       std::unique_ptr<FilterList> m_pFilterList; /**< Filter list for line filters */
+       std::shared_ptr<SubstitutionList> m_pSubstitutionList; /// list for Substitution Filters
 
 private:
        /**
@@ -201,10 +206,10 @@ private:
         */
        int m_nCompMethod;
 
-       DIFFOPTIONS *m_pOptions; /**< Generalized compare options. */
-       CompareOptions *m_pCompareOptions; /**< Per compare method compare options. */
+       std::unique_ptr<DIFFOPTIONS> m_pOptions; /**< Generalized compare options. */
+       std::unique_ptr<CompareOptions> m_pContentCompareOptions; /**< Per compare method compare options. */
+       std::unique_ptr<CompareOptions> m_pQuickCompareOptions;   /**< Per compare method compare options. */
        PathContext m_paths; /**< (root) paths for this context */
        IAbortable *m_piAbortable; /**< Interface for aborting the compare. */
+       Poco::FastMutex m_mutex;
 };
-
-#endif // !defined(AFX_DIFFCONTEXT_H__D3CC86BE_F11E_11D2_826C_00A024706EDC__INCLUDED_)