1 // TortoiseMerge - a Diff/Patch program
\r
3 // Copyright (C) 2006-2007 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "ViewData.h"
\r
27 * \ingroup TortoiseMerge
\r
28 * this struct holds all the information of a single change in TortoiseMerge.
\r
30 typedef struct viewstate
\r
32 std::map<int, CString> difflines;
\r
33 std::map<int, DWORD> linestates;
\r
34 std::map<int, DWORD> linelines;
\r
35 std::list<int> addedlines;
\r
37 std::map<int, viewdata> removedlines;
\r
39 void AddLineFormView(CBaseView *pView, int nLine, bool bAddEmptyLine);
\r
43 * \ingroup TortoiseMerge
\r
44 * Holds all the information of previous changes made to a view content.
\r
45 * Of course, can undo those changes.
\r
50 static CUndo& GetInstance();
\r
52 bool Undo(CBaseView * pLeft, CBaseView * pRight, CBaseView * pBottom);
\r
53 void AddState(const viewstate& leftstate, const viewstate& rightstate, const viewstate& bottomstate, POINT pt);
\r
54 bool CanUndo() {return (m_viewstates.size() > 0);}
\r
56 bool IsGrouping() { return m_groups.size() % 2 == 1; }
\r
57 void BeginGrouping() { ASSERT(!IsGrouping()); m_groups.push_back(m_caretpoints.size()); }
\r
58 void EndGrouping(){ ASSERT(IsGrouping()); m_groups.push_back(m_caretpoints.size()); }
\r
60 void MarkAsOriginalState() { m_originalstate = m_viewstates.size(); }
\r
62 void Undo(const viewstate& state, CBaseView * pView);
\r
63 void UndoOne(CBaseView * pLeft, CBaseView * pRight, CBaseView * pBottom);
\r
64 std::list<viewstate> m_viewstates;
\r
65 std::list<POINT> m_caretpoints;
\r
66 std::list< std::list<int>::size_type > m_groups;
\r
67 unsigned int m_originalstate;
\r