1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2003-2012 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "SVNLineDiff.h"
22 #include "ScrollTool.h"
24 #include "LocatorBar.h"
25 #include "LineColors.h"
26 #include "TripleClick.h"
30 typedef struct inlineDiffPos
38 * \ingroup TortoiseMerge
40 * View class providing the basic functionality for
41 * showing diffs. Has three parent classes which inherit
42 * from this base class: CLeftView, CRightView and CBottomView.
44 class CBaseView
: public CView
, public CTripleClick
46 DECLARE_DYNCREATE(CBaseView
)
47 friend class CLineDiffBar
;
54 * Indicates that the underlying document has been updated. Reloads all
55 * data and redraws the view.
57 virtual void DocumentUpdated();
59 * Returns the number of lines visible on the view.
63 * Scrolls the view to the given line.
64 * \param nNewTopLine The new top line to scroll the view to
65 * \param bTrackScrollBar If TRUE, then the scrollbars are affected too.
67 void ScrollToLine(int nNewTopLine
, BOOL bTrackScrollBar
= TRUE
);
68 void ScrollAllToLine(int nNewTopLine
, BOOL bTrackScrollBar
= TRUE
);
69 void ScrollSide(int delta
);
70 void ScrollAllSide(int delta
);
71 void ScrollVertical(short delta
);
72 static void RecalcAllVertScrollBars(BOOL bPositionOnly
= FALSE
);
73 static void RecalcAllHorzScrollBars(BOOL bPositionOnly
= FALSE
);
74 void GoToLine(int nNewLine
, BOOL bAll
= TRUE
);
75 void ScrollToChar(int nNewOffsetChar
, BOOL bTrackScrollBar
= TRUE
);
76 void ScrollAllToChar(int nNewOffsetChar
, BOOL bTrackScrollBar
= TRUE
);
77 void SetReadonly(bool bReadonly
= true) {m_bReadonly
= bReadonly
;}
78 void SetWritable(bool bWritable
= true) {m_bReadonly
= !bWritable
;}
79 void SetTarget(bool bTarget
= true) {m_bTarget
= bTarget
;}
80 bool IsReadonly() const {return m_bReadonly
;}
81 bool IsWritable() const {return !m_bReadonly
&& m_pViewData
;}
82 bool IsTarget() const {return m_bTarget
;}
83 void SetCaretAndGoalPosition(const POINT
& pt
) {UpdateCaretPosition(pt
); UpdateGoalPos(); }
84 void SetCaretAndGoalViewPosition(const POINT
& pt
) {UpdateCaretViewPosition(pt
); UpdateGoalPos(); }
85 void SetCaretPosition(const POINT
& pt
) { SetCaretViewPosition(ConvertScreenPosToView(pt
)); }
86 POINT
GetCaretPosition() { return ConvertViewPosToScreen(GetCaretViewPosition()); }
87 void SetCaretViewPosition(const POINT
& pt
) { m_ptCaretViewPos
= pt
; }
88 POINT
GetCaretViewPosition() { return m_ptCaretViewPos
; }
89 void UpdateCaretPosition(const POINT
& pt
) { SetCaretPosition(pt
); UpdateCaret(); }
90 void UpdateCaretViewPosition(const POINT
& pt
) { SetCaretViewPosition(pt
); UpdateCaret(); EnsureCaretVisible(); }
91 void SetCaretToViewStart() { SetCaretToFirstViewLine(); SetCaretToViewLineStart(); }
92 void SetCaretToFirstViewLine() { m_ptCaretViewPos
.y
=0; }
93 void SetCaretToViewLineStart() { m_ptCaretViewPos
.x
=0; }
94 void SetCaretToLineStart() { SetCaretAndGoalPosition(SetupPoint(0, GetCaretPosition().y
)); }
95 void EnsureCaretVisible();
98 bool ArePointsSame(const POINT
&pt1
, const POINT
&pt2
) {return (pt1
.x
== pt2
.x
) && (pt1
.y
== pt2
.y
); };
99 POINT
SetupPoint(int x
, int y
) {POINT ptRet
={x
, y
}; return ptRet
; };
100 POINT
ConvertScreenPosToView(const POINT
& pt
);
101 POINT
ConvertViewPosToScreen(const POINT
& pt
);
104 static void BuildAllScreen2ViewVector(); ///< schedule full screen2view rebuild
105 static void BuildAllScreen2ViewVector(int ViewLine
); ///< schedule rebuild screen2view for single line
106 static void BuildAllScreen2ViewVector(int FirstViewLine
, int LastViewLine
); ///< schedule rebuild screen2view for line range (first and last inclusive)
107 void UpdateViewLineNumbers();
108 int CleanEmptyLines(); ///< remove line empty in all views
109 int GetLineCount() const;
110 static int GetViewLineForScreen(int screenLine
) { return m_Screen2View
.GetViewLineForScreen(screenLine
); }
111 int FindScreenLineForViewLine(int viewLine
);
112 // TODO: find better consistent names for Multiline(line with sublines) and Subline, Count.. or Get..Count ?
113 int CountMultiLines(int nViewLine
);
114 int GetSubLineOffset(int index
);
115 LineColors
& GetLineColors(int nViewLine
);
116 static void UpdateLocator() { if (m_pwndLocator
) m_pwndLocator
->DocumentUpdated(); }
119 void HighlightLines(int start
, int end
= -1);
120 void HighlightViewLines(int start
, int end
= -1);
121 inline BOOL
IsHidden() const {return m_bIsHidden
;}
122 inline void SetHidden(BOOL bHidden
) {m_bIsHidden
= bHidden
;}
123 inline bool IsModified() const {return m_bModified
;}
124 void SetModified(bool bModified
= true) {m_bModified
= bModified
; Invalidate();}
125 void SetInlineWordDiff(bool bWord
) {m_bInlineWordDiff
= bWord
;}
126 void SetInlineDiff(bool bDiff
) {m_bShowInlineDiff
= bDiff
;}
127 void SetMarkedWord(const CString
& word
) {m_sMarkedWord
= word
; BuildMarkedWordArray();}
128 LPCTSTR
GetMarkedWord() {return (LPCTSTR
)m_sMarkedWord
;}
129 LPCTSTR
GetFindString() {return (LPCTSTR
)m_sFindText
;}
131 // Selection methods; all public methods dealing with selection go here
132 static void ClearSelection();
133 BOOL
GetViewSelection(int& start
, int& end
) const;
134 BOOL
HasSelection() const { return (!((m_nSelViewBlockEnd
< 0)||(m_nSelViewBlockStart
< 0)||(m_nSelViewBlockStart
> m_nSelViewBlockEnd
))); }
135 BOOL
HasTextSelection() const { return ((m_ptSelectionViewPosStart
.x
!= m_ptSelectionViewPosEnd
.x
) || (m_ptSelectionViewPosStart
.y
!= m_ptSelectionViewPosEnd
.y
)); }
136 static void SetupAllViewSelection(int start
, int end
);
137 static void SetupAllSelection(int start
, int end
);
138 void SetupSelection(int start
, int end
);
139 static void SetupViewSelection(CBaseView
* view
, int start
, int end
);
140 void SetupViewSelection(int start
, int end
);
141 CString
GetSelectedText() const;
143 // state classifying methods; note: state may belong to more classes
144 static bool IsStateConflicted(DiffStates state
);
145 static bool IsStateEmpty(DiffStates state
);
146 static bool IsStateRemoved(DiffStates state
);
147 static DiffStates
ResolveState(DiffStates state
);
149 bool IsLineEmpty(int nLineIndex
);
150 bool IsViewLineEmpty(int nViewLine
);
151 bool IsLineRemoved(int nLineIndex
);
152 bool IsViewLineRemoved(int nViewLine
);
153 bool IsBlockWhitespaceOnly(int nLineIndex
, bool& bIdentical
);
154 bool IsViewLineConflicted(int nLineIndex
);
155 bool HasNextConflict();
156 bool HasPrevConflict();
159 bool GetNextInlineDiff(int & nPos
);
160 bool GetPrevInlineDiff(int & nPos
);
161 bool HasNextInlineDiff();
162 bool HasPrevInlineDiff();
164 static const viewdata
& GetEmptyLineData();
165 void InsertViewEmptyLines(int nFirstView
, int nCount
);
167 virtual void UseBothLeftFirst() {return UseBothBlocks(m_pwndLeft
, m_pwndRight
); }
168 virtual void UseBothRightFirst() {return UseBothBlocks(m_pwndRight
, m_pwndLeft
); }
169 void UseTheirAndYourBlock() {return UseBothLeftFirst(); } ///< ! for backward compatibility
170 void UseYourAndTheirBlock() {return UseBothRightFirst(); } ///< ! for backward compatibility
172 virtual void UseLeftBlock() {return UseViewBlock(m_pwndLeft
); }
173 virtual void UseLeftFile() {return UseViewFile(m_pwndLeft
); }
174 virtual void UseRightBlock() {return UseViewBlock(m_pwndRight
); }
175 virtual void UseRightFile() {return UseViewFile(m_pwndRight
); }
178 void InsertViewData(int index
, const CString
& sLine
, DiffStates state
, int linenumber
, EOL ending
, HIDESTATE hide
, int movedline
);
179 void InsertViewData(int index
, const viewdata
& data
);
180 void RemoveViewData(int index
);
182 const viewdata
& GetViewData(int index
) const {return m_pViewData
->GetData(index
); }
183 const CString
& GetViewLine(int index
) const {return m_pViewData
->GetLine(index
); }
184 DiffStates
GetViewState(int index
) const {return m_pViewData
->GetState(index
); }
185 HIDESTATE
GetViewHideState(int index
) {return m_pViewData
->GetHideState(index
); }
186 int GetViewLineNumber(int index
) {return m_pViewData
->GetLineNumber(index
); }
187 int GetViewMovedIndex(int index
) {return m_pViewData
->GetMovedIndex(index
); }
188 int FindViewLineNumber(int number
) {return m_pViewData
->FindLineNumber(number
); }
189 EOL
GetViewLineEnding(int index
) const {return m_pViewData
->GetLineEnding(index
); }
191 int GetViewCount() const {return m_pViewData
? m_pViewData
->GetCount() : -1; }
193 void SetViewData(int index
, const viewdata
& data
);
194 void SetViewState(int index
, DiffStates state
);
195 void SetViewLine(int index
, const CString
& sLine
);
196 void SetViewLineNumber(int index
, int linenumber
);
197 void SetViewLineEnding(int index
, EOL ending
);
199 static bool IsViewGood(const CBaseView
* view
) { return (view
!= 0) && view
->IsWindowVisible(); }
200 static CBaseView
* GetFirstGoodView();
203 CViewData
* m_pViewData
;
204 CViewData
* m_pOtherViewData
;
205 CBaseView
* m_pOtherView
;
207 CString m_sWindowName
; ///< The name of the view which is shown as a window title to the user
208 CString m_sFullFilePath
; ///< The full path of the file shown
209 CFileTextLines::UnicodeType texttype
; ///< the text encoding this view uses
210 EOL lineendings
; ///< the line endings the view uses
212 BOOL m_bViewWhitespace
; ///< If TRUE, then SPACE and TAB are shown as special characters
213 BOOL m_bShowInlineDiff
; ///< If TRUE, diffs in lines are marked colored
214 bool m_bShowSelection
; ///< If true, selection bars are shown and selected text darkened
215 bool m_bWhitespaceInlineDiffs
; ///< if true, inline diffs are shown for identical lines only differing in whitespace
216 int m_nTopLine
; ///< The topmost text line in the view
217 std::vector
<int> m_arMarkedWordLines
; ///< which lines contain a marked word
218 std::vector
<int> m_arFindStringLines
; ///< which lines contain a found string
220 static CLocatorBar
* m_pwndLocator
; ///< Pointer to the locator bar on the left
221 static CLineDiffBar
* m_pwndLineDiffBar
; ///< Pointer to the line diff bar at the bottom
222 static CMFCStatusBar
* m_pwndStatusBar
;///< Pointer to the status bar
223 static CMainFrame
* m_pMainFrame
; ///< Pointer to the mainframe
225 void GoToFirstDifference();
226 void GoToFirstConflict();
227 void AddEmptyViewLine(int nLineIndex
);
229 protected: // methods
235 virtual BOOL
PreCreateWindow(CREATESTRUCT
& cs
);
236 virtual void OnDraw(CDC
* pDC
);
237 virtual INT_PTR
OnToolHitTest(CPoint point
, TOOLINFO
* pTI
) const;
238 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
239 BOOL
OnToolTipNotify(UINT id
, NMHDR
*pNMHDR
, LRESULT
*pResult
);
240 afx_msg
void OnHScroll(UINT nSBCode
, UINT nPos
, CScrollBar
* pScrollBar
);
241 afx_msg
void OnVScroll(UINT nSBCode
, UINT nPos
, CScrollBar
* pScrollBar
);
242 afx_msg BOOL
OnEraseBkgnd(CDC
* pDC
);
243 afx_msg
int OnCreate(LPCREATESTRUCT lpCreateStruct
);
244 afx_msg
void OnDestroy();
245 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
246 afx_msg BOOL
OnMouseWheel(UINT nFlags
, short zDelta
, CPoint pt
);
247 afx_msg
void OnMouseHWheel(UINT nFlags
, short zDelta
, CPoint pt
);
248 afx_msg BOOL
OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
249 afx_msg
void OnKillFocus(CWnd
* pNewWnd
);
250 afx_msg
void OnSetFocus(CWnd
* pOldWnd
);
251 afx_msg
void OnContextMenu(CWnd
* pWnd
, CPoint point
);
252 afx_msg
void OnMergeNextdifference();
253 afx_msg
void OnMergePreviousdifference();
254 afx_msg
void OnMergePreviousconflict();
255 afx_msg
void OnMergeNextconflict();
256 afx_msg
void OnNavigateNextinlinediff();
257 afx_msg
void OnNavigatePrevinlinediff();
258 afx_msg
void OnKeyDown(UINT nChar
, UINT nRepCnt
, UINT nFlags
);
259 afx_msg
void OnLButtonDown(UINT nFlags
, CPoint point
);
260 afx_msg
void OnLButtonUp(UINT nFlags
, CPoint point
);
261 afx_msg
void OnLButtonDblClk(UINT nFlags
, CPoint point
);
262 virtual void OnLButtonTrippleClick(UINT nFlags
, CPoint point
) override
;
263 afx_msg
void OnEditCopy();
264 afx_msg
void OnMouseMove(UINT nFlags
, CPoint point
);
265 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
266 afx_msg
void OnChar(UINT nChar
, UINT nRepCnt
, UINT nFlags
);
267 afx_msg
void OnCaretDown();
268 afx_msg
void OnCaretLeft();
269 afx_msg
void OnCaretRight();
270 afx_msg
void OnCaretUp();
271 afx_msg
void OnCaretWordleft();
272 afx_msg
void OnCaretWordright();
273 afx_msg
void OnEditCut();
274 afx_msg
void OnEditPaste();
275 afx_msg
void OnEditSelectall();
276 afx_msg LRESULT
OnFindDialogMessage(WPARAM wParam
, LPARAM lParam
);
277 afx_msg
void OnEditFind();
278 afx_msg
void OnEditFindnext();
279 afx_msg
void OnEditFindprev();
280 afx_msg
void OnEditFindnextStart();
281 afx_msg
void OnEditFindprevStart();
282 afx_msg
void OnEditGotoline();
284 DECLARE_MESSAGE_MAP()
286 void DrawHeader(CDC
*pdc
, const CRect
&rect
);
287 void DrawMargin(CDC
*pdc
, const CRect
&rect
, int nLineIndex
);
288 void DrawSingleLine(CDC
*pDC
, const CRect
&rc
, int nLineIndex
);
290 * Draws the horizontal lines around current diff block or selection block.
292 void DrawBlockLine(CDC
*pDC
, const CRect
&rc
, int nLineIndex
);
294 * Draws the line ending 'char'.
296 void DrawLineEnding(CDC
*pDC
, const CRect
&rc
, int nLineIndex
, const CPoint
& origin
);
297 void ExpandChars(const CString
&sLine
, int nOffset
, int nCount
, CString
&line
);
298 CString
ExpandChars(const CString
&sLine
, int nOffset
= 0);
299 int CountExpandedChars(const CString
&sLine
, int nLength
);
301 void RecalcVertScrollBar(BOOL bPositionOnly
= FALSE
);
302 void RecalcHorzScrollBar(BOOL bPositionOnly
= FALSE
);
304 void OnDoMouseWheel(UINT nFlags
, short zDelta
, CPoint pt
);
305 void OnDoMouseHWheel(UINT nFlags
, short zDelta
, CPoint pt
);
306 void OnDoHScroll(UINT nSBCode
, UINT nPos
, CScrollBar
* pScrollBar
, CBaseView
* master
);
307 void OnDoVScroll(UINT nSBCode
, UINT nPos
, CScrollBar
* pScrollBar
, CBaseView
* master
);
309 void ShowDiffLines(int nLine
);
311 int GetTabSize() const {return m_nTabSize
;}
314 void CalcLineCharDim();
317 int GetMaxLineLength();
318 int GetLineLength(int index
);
319 int GetViewLineLength(int index
) const;
320 int GetScreenChars();
321 int GetAllMinScreenChars() const;
322 int GetAllMaxLineLength() const;
323 int GetAllLineCount() const;
324 int GetAllMinScreenLines() const;
325 CString
GetViewLineChars(int index
) const;
326 CString
GetLineChars(int index
);
327 int GetLineNumber(int index
) const;
328 CFont
* GetFont(BOOL bItalic
= FALSE
, BOOL bBold
= FALSE
);
329 int GetLineFromPoint(CPoint point
);
330 int GetMarginWidth();
331 COLORREF
InlineDiffColor(int nLineIndex
);
332 COLORREF
InlineViewLineDiffColor(int nLineIndex
);
333 bool GetInlineDiffPositions(int lineIndex
, std::vector
<inlineDiffPos
>& positions
);
334 void CheckOtherView();
335 static void GetWhitespaceBlock(CViewData
*viewData
, int nLineIndex
, int & nStartBlock
, int & nEndBlock
);
336 static CString
GetWhitespaceString(CViewData
*viewData
, int nStartBlock
, int nEndBlock
);
337 bool IsViewLineHidden(int nViewLine
);
338 static bool IsViewLineHidden(CViewData
* pViewData
, int nViewLine
);
340 void OnContextMenu(CPoint point
, DiffStates state
);
342 * Updates the status bar pane. Call this if the document changed.
344 void UpdateStatusBar();
346 static bool IsLeftViewGood() {return IsViewGood(m_pwndLeft
);}
347 static bool IsRightViewGood() {return IsViewGood(m_pwndRight
);}
348 static bool IsBottomViewGood() {return IsViewGood(m_pwndBottom
);}
350 int CalculateActualOffset(const POINT
& point
);
351 int CalculateCharIndex(int nLineIndex
, int nActualOffset
);
352 POINT
TextToClient(const POINT
& point
);
353 void DrawTextLine(CDC
* pDC
, const CRect
&rc
, int nLineIndex
, POINT
& coords
);
354 void ClearCurrentSelection();
355 void AdjustSelection(bool bMoveLeft
);
356 bool SelectNextBlock(int nDirection
, bool bConflict
, bool bSkipEndOfCurrentBlock
= true, bool dryrun
= false);
358 enum SearchDirection
{SearchNext
=0, SearchPrevious
=1};
359 bool StringFound(const CString
& str
, SearchDirection srchDir
, int& start
, int& end
) const;
360 void Search(SearchDirection srchDir
);
361 void BuildFindStringArray();
363 void RemoveLine(int nLineIndex
);
364 void RemoveSelectedText();
366 void AddUndoViewLine(int nViewLine
, bool bAddEmptyLine
= false);
368 bool MoveCaretLeft();
369 bool MoveCaretRight();
370 void MoveCaretWordLeft();
371 void MoveCaretWordRight();
372 void OnCaretMove(bool bMoveLeft
);
373 void OnCaretMove(bool bMoveLeft
, bool isShiftPressed
);
374 void UpdateGoalPos();
376 bool IsWordSeparator(const wchar_t ch
) const;
377 bool IsCaretAtWordBoundary();
378 void UpdateViewsCaretPosition();
379 void BuildMarkedWordArray();
381 virtual void UseBothBlocks(CBaseView
* /*pwndFirst*/, CBaseView
* /*pwndLast*/) {};
382 virtual void UseViewBlock(CBaseView
* /*pwndView*/) {}
383 virtual void UseViewFile(CBaseView
* /*pwndView*/) {}
385 virtual void AddContextItems(CIconMenu
& popup
, DiffStates state
);
386 void AddCutCopyAndPaste(CIconMenu
& popup
);
387 void CompensateForKeyboard(CPoint
& point
);
388 static HICON
LoadIcon(WORD iconId
);
389 void ReleaseBitmap();
390 static bool LinesInOneChange( int direction
, DiffStates firstLineState
, DiffStates currentLineState
);
391 static void FilterWhitespaces(CString
& first
, CString
& second
);
392 static void FilterWhitespaces(CString
& line
);
393 int GetButtonEventLineIndex(const POINT
& point
);
395 static void ResetUndoStep();
397 protected: // variables
398 COLORREF m_InlineRemovedBk
;
399 COLORREF m_InlineAddedBk
;
400 COLORREF m_ModifiedBk
;
401 COLORREF m_WhiteSpaceFg
;
402 UINT m_nStatusBarID
; ///< The ID of the status bar pane used by this view. Must be set by the parent class.
404 SVNLineDiff m_svnlinediff
;
405 DWORD m_nInlineDiffMaxLineLength
;
406 BOOL m_bOtherDiffChecked
;
409 BOOL m_bViewLinenumbers
;
414 int m_nMaxLineLength
;
417 int m_nLastScreenChars
;
421 bool m_bInlineWordDiff
;
423 // Block selection attributes
424 int m_nSelViewBlockStart
;
425 int m_nSelViewBlockEnd
;
428 bool m_mouseInMargin
;
429 HCURSOR m_margincursor
;
433 bool m_bTarget
; ///< view intended as result
434 POINT m_ptCaretViewPos
;
437 // Text selection attributes
438 POINT m_ptSelectionViewPosStart
;
439 POINT m_ptSelectionViewPosEnd
;
440 POINT m_ptSelectionViewPosOrigin
;
442 static const UINT m_FindDialogMessage
;
443 CFindDlg
* m_pFindDialog
;
451 HICON m_hRemovedIcon
;
452 HICON m_hConflictedIcon
;
453 HICON m_hConflictedIgnoredIcon
;
454 HICON m_hWhitespaceBlockIcon
;
458 HICON m_hLineEndingCR
;
459 HICON m_hLineEndingCRLF
;
460 HICON m_hLineEndingLF
;
464 LOGFONT m_lfBaseFont
;
465 static const int fontsCount
= 4;
466 CFont
* m_apFonts
[fontsCount
];
467 CString m_sConflictedText
;
469 CString m_sMarkedWord
;
470 CString m_sPreviousMarkedWord
;
472 CBitmap
* m_pCacheBitmap
;
474 CScrollTool m_ScrollTool
;
475 CString m_sWordSeparators
;
477 char m_szTip
[MAX_PATH
*2+1];
478 wchar_t m_wszTip
[MAX_PATH
*2+1];
479 // These three pointers lead to the three parent
480 // classes CLeftView, CRightView and CBottomView
481 // and are used for the communication between
482 // the views (e.g. synchronized scrolling, ...)
483 // To find out which parent class this object
484 // is made of just compare e.g. (m_pwndLeft==this).
485 static CBaseView
* m_pwndLeft
; ///< Pointer to the left view. Must be set by the CLeftView parent class.
486 static CBaseView
* m_pwndRight
; ///< Pointer to the right view. Must be set by the CRightView parent class.
487 static CBaseView
* m_pwndBottom
; ///< Pointer to the bottom view. Must be set by the CBottomView parent class.
489 struct TScreenLineInfo
494 class TScreenedViewLine
504 bSublinesSet
= false;
506 bLineColorsSet
= false;
507 bLineColorsSetWhiteSpace
= false;
511 std::vector
<CString
> SubLines
;
527 bool bLineColorsSetWhiteSpace
;
528 LineColors lineColorsWhiteSpace
;
530 LineColors lineColors
;
532 std::vector
<TScreenedViewLine
> m_ScreenedViewLine
; ///< cached data for screening
534 static allviewstate m_AllState
;
535 viewstate
* m_pState
;
539 // 2-pane view commands
540 POPUPCOMMAND_USELEFTBLOCK
= 1, // 0 means the context menu was dismissed
541 POPUPCOMMAND_USELEFTFILE
,
542 POPUPCOMMAND_USEBOTHLEFTFIRST
,
543 POPUPCOMMAND_USEBOTHRIGHTFIRST
,
544 // 3-pane view commands
545 POPUPCOMMAND_USEYOURANDTHEIRBLOCK
,
546 POPUPCOMMAND_USETHEIRANDYOURBLOCK
,
547 POPUPCOMMAND_USEYOURBLOCK
,
548 POPUPCOMMAND_USEYOURFILE
,
549 POPUPCOMMAND_USETHEIRBLOCK
,
550 POPUPCOMMAND_USETHEIRFILE
,
560 int GetViewLineForScreen(int screenLine
);
561 int GetSubLineOffset(int screenLine
);
562 TScreenLineInfo
GetScreenLineInfo(int screenLine
);
563 int FindScreenLineForViewLine(int viewLine
);
564 void ScheduleFullRebuild(CViewData
* ViewData
);
565 void ScheduleRangeRebuild(CViewData
* ViewData
, int FirstViewLine
, int LastViewLine
);
575 bool FixScreenedCacheSize(CBaseView
* View
);
576 void RebuildIfNecessary();
577 bool ResetScreenedViewLineCache(CBaseView
* View
);
578 bool ResetScreenedViewLineCache(CBaseView
* View
, const TRebuildRange
& Range
);
580 CViewData
* m_pViewData
;
582 std::vector
<TScreenLineInfo
> m_Screen2View
;
583 std::vector
<TRebuildRange
> m_RebuildRanges
;
586 static Screen2View m_Screen2View
;