OSDN Git Service

Fix that the Next File or Previous File button on the toolbar did not work if the...
[winmerge-jp/winmerge-jp.git] / Src / MergeEditView.h
index a67cc29..52f62f6 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  MergeEditView.h
@@ -44,6 +30,8 @@ const UINT CONTEXT_LINES_BELOW = 3;
 #include "edtlib.h"
 #include "GhostTextView.h"
 #include "OptionsDiffColors.h"
+#include <map>
+#include <vector>
 
 class IMergeEditStatus;
 class CLocationView;
@@ -109,6 +97,8 @@ private:
 
        bool m_bCurrentLineIsDiff; /**< `true` if cursor is in diff line */
 
+       bool m_bChangedSchemeManually;  /**< `true` if the syntax highlighting scheme is changed manually */
+
 // Operations
 public:
        void RefreshOptions();
@@ -119,9 +109,13 @@ public:
        bool IsLineInCurrentDiff(int nLine) const;
        void SelectNone();
        void SelectDiff(int nDiff, bool bScroll = true, bool bSelectText = true);
+       void DeselectDiffIfCursorNotInCurrentDiff();
        virtual CCrystalTextBuffer *LocateTextBuffer ();
        const CCrystalTextBuffer *LocateTextBuffer () const { return const_cast<CMergeEditView *>(this)->LocateTextBuffer(); };
        void GetFullySelectedDiffs(int & firstDiff, int & lastDiff);
+       void GetFullySelectedDiffs(int & firstDiff, int & lastDiff, int & firstWordDiff,  int & lastWordDiff, const CPoint *pptStart = nullptr, const CPoint *ppEnd = nullptr);
+       void GetSelectedDiffs(int & firstDiff, int & lastDiff);
+       std::map<int, std::vector<int>> GetColumnSelectedWordDiffIndice();
        CString GetSelectedText();
        CString GetLineText(int idx);
        CMergeDoc* GetDocument();
@@ -133,14 +127,15 @@ public:
        void SelectArea(const CPoint & ptStart, const CPoint & ptEnd) { SetSelection(ptStart, ptEnd); } // make public
        using CGhostTextView::GetSelection;
        virtual void UpdateSiblingScrollPos (bool bHorz) override;
-       virtual std::vector<TEXTBLOCK> GetAdditionalTextBlocks (int nLineIndex) override;
+    virtual std::vector<CrystalLineParser::TEXTBLOCK> GetMarkerTextBlocks(int nLineIndex) const;
+       virtual std::vector<CrystalLineParser::TEXTBLOCK> GetAdditionalTextBlocks (int nLineIndex) override;
        virtual COLORREF GetColor(int nColorIndex) override;
        virtual void GetLineColors (int nLineIndex, COLORREF & crBkgnd,
                        COLORREF & crText, bool & bDrawWhitespace) override;
        virtual void GetLineColors2 (int nLineIndex, DWORD ignoreFlags
                , COLORREF & crBkgnd, COLORREF & crText, bool & bDrawWhitespace);
        void WMGoto() { OnWMGoto(); };
-       void GotoLine(UINT nLine, bool bRealLine, int pane);
+       void GotoLine(UINT nLine, bool bRealLine, int pane, bool bMoveAnchor = true);
        int GetTopLine() const { return m_nTopLine; }
        using CCrystalTextView::GetScreenLines;
        int GetTopSubLine() const { return m_nTopSubLine; }
@@ -173,6 +168,13 @@ public:
        bool IsCursorInDiff() const;
        bool IsDiffVisible(int nDiff);
        void ZoomText(short amount);
+       virtual bool QueryEditable() override;
+       virtual void EnsureVisible(CPoint pt) override;
+       virtual void EnsureVisible(CPoint ptStart, CPoint ptEnd) override;
+       bool EnsureInDiff(CPoint& pt);
+       void SetSelection(const CPoint& ptStart, const CPoint& ptEnd, bool bUpdateView = true) override;
+       void ScrollToSubLine(int nNewTopLine, bool bNoSmoothScroll = false, bool bTrackScrollBar = true) override;
+       void SetActivePane();
 
        // Overrides
        // ClassWizard generated virtual function overrides
@@ -252,22 +254,31 @@ protected:
        afx_msg void OnUpdatePrevdiffRO(CCmdUI* pCmdUI);
        afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
        afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+       afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
        afx_msg void OnAllLeft();
        afx_msg void OnUpdateAllLeft(CCmdUI* pCmdUI);
        afx_msg void OnAllRight();
        afx_msg void OnUpdateAllRight(CCmdUI* pCmdUI);
        afx_msg void OnAutoMerge();
        afx_msg void OnUpdateAutoMerge(CCmdUI* pCmdUI);
-       afx_msg void OnX2Y(int srcPane, int dstPane);
+       afx_msg void OnX2Y(int srcPane, int dstPane, bool selectedLineOnly = false);
        afx_msg void OnUpdateX2Y(int dstPane, CCmdUI* pCmdUI);
        afx_msg void OnL2r();
        afx_msg void OnUpdateL2r(CCmdUI* pCmdUI);
+       afx_msg void OnLinesL2r();
+       afx_msg void OnUpdateLinesL2r(CCmdUI* pCmdUI);
        afx_msg void OnR2l();
        afx_msg void OnUpdateR2l(CCmdUI* pCmdUI);
+       afx_msg void OnLinesR2l();
+       afx_msg void OnUpdateLinesR2l(CCmdUI* pCmdUI);
        afx_msg void OnCopyFromLeft();
        afx_msg void OnUpdateCopyFromLeft(CCmdUI* pCmdUI);
+       afx_msg void OnCopyLinesFromLeft();
+       afx_msg void OnUpdateCopyLinesFromLeft(CCmdUI* pCmdUI);
        afx_msg void OnCopyFromRight();
        afx_msg void OnUpdateCopyFromRight(CCmdUI* pCmdUI);
+       afx_msg void OnCopyLinesFromRight();
+       afx_msg void OnUpdateCopyLinesFromRight(CCmdUI* pCmdUI);
        afx_msg void OnAddSyncPoint();
        afx_msg void OnClearSyncPoints();
        afx_msg void OnUpdateClearSyncPoints(CCmdUI* pCmdUI);
@@ -283,6 +294,8 @@ protected:
        template<bool reversed>
        afx_msg void OnSelectLineDiff();
        afx_msg void OnUpdateSelectLineDiff(CCmdUI* pCmdUI);
+       afx_msg void OnAddToSubstitutionFilters();
+       afx_msg void OnUpdateAddToSubstitutionFilters(CCmdUI* pCmdUI);
        afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
        afx_msg void OnUpdateEditReplace(CCmdUI* pCmdUI);
        afx_msg void OnLeftReadOnly();
@@ -301,6 +314,12 @@ protected:
        afx_msg void OnUpdateR2LNext(CCmdUI* pCmdUI);
        afx_msg void OnChangePane();
        afx_msg void OnWMGoto();
+       afx_msg void OnGotoMovedLineLM();
+       afx_msg void OnUpdateGotoMovedLineLM(CCmdUI* pCmdUI);
+       afx_msg void OnGotoMovedLineMR();
+       afx_msg void OnUpdateGotoMovedLineMR(CCmdUI* pCmdUI);
+       afx_msg void OnShellMenu();
+       afx_msg void OnUpdateShellMenu(CCmdUI* pCmdUI);
        afx_msg void OnScripts(UINT nID );
        afx_msg void OnUpdateNoPrediffer(CCmdUI* pCmdUI);
        afx_msg void OnUpdatePrediffer(CCmdUI* pCmdUI);
@@ -318,10 +337,14 @@ protected:
        afx_msg void OnUpdateViewWordWrap(CCmdUI* pCmdUI);
        afx_msg void OnViewWhitespace();
        afx_msg void OnUpdateViewWhitespace(CCmdUI* pCmdUI);
+       afx_msg void OnViewEOL();
+       afx_msg void OnUpdateViewEOL(CCmdUI* pCmdUI);
        afx_msg void OnOpenFile();
        afx_msg void OnOpenFileWith();
        afx_msg void OnOpenFileWithEditor();
-       afx_msg void OnViewSwapPanes();
+       afx_msg void OnViewSwapPanes12();
+       afx_msg void OnViewSwapPanes23();
+       afx_msg void OnViewSwapPanes13();
        afx_msg void OnUpdateNoEditScripts(CCmdUI* pCmdUI);
        afx_msg void OnSize(UINT nType, int cx, int cy);
        afx_msg void OnHelp();
@@ -331,11 +354,14 @@ protected:
        afx_msg void OnChangeScheme(UINT nID);
        afx_msg void OnUpdateChangeScheme(CCmdUI* pCmdUI);
        afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+       afx_msg void OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt);
        afx_msg void OnViewZoomIn();
        afx_msg void OnViewZoomOut();
        afx_msg void OnViewZoomNormal();
        afx_msg void OnWindowSplit();
        afx_msg void OnUpdateWindowSplit(CCmdUI* pCmdUI);
+       afx_msg void OnStatusBarDblClick(NMHDR* pNMHDR, LRESULT* pResult);
+
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };
@@ -344,3 +370,23 @@ protected:
 inline CMergeDoc* CMergeEditView::GetDocument()
    { return reinterpret_cast<CMergeDoc*>(m_pDocument); }
 #endif
+
+/**
+ * @brief Enable/Disable automatic rescanning
+ */
+inline bool CMergeEditView::EnableRescan(bool bEnable)
+{
+       bool bOldValue = m_bAutomaticRescan;
+       m_bAutomaticRescan = bEnable;
+       return bOldValue;
+}
+
+/**
+ * @brief Check if cursor is inside difference.
+ * @return true if cursor is inside difference.
+ */
+inline bool CMergeEditView::IsCursorInDiff() const
+{
+       return m_bCurrentLineIsDiff;
+}
+