1 // TortoiseMerge - a Diff/Patch program
\r
3 // Copyright (C) 2006-2008 - 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
21 #include "DiffData.h"
\r
22 #include "LocatorBar.h"
\r
23 #include "LineDiffBar.h"
\r
24 #include "FilePatchesDlg.h"
\r
25 #include "TempFiles.h"
\r
26 #include "XSplitter.h"
\r
28 #include "FindDlg.h"
\r
35 * \ingroup TortoiseMerge
\r
36 * The main frame of TortoiseMerge. Handles all the menu and toolbar commands.
\r
38 class CMainFrame : public CFrameWndEx, public CPatchFilesDlgCallBack //CFrameWndEx
\r
43 virtual ~CMainFrame();
\r
46 virtual void AssertValid() const;
\r
47 virtual void Dump(CDumpContext& dc) const;
\r
50 DECLARE_DYNCREATE(CMainFrame)
\r
52 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
\r
53 virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
\r
54 virtual void ActivateFrame(int nCmdShow = -1);
\r
55 bool LoadViews(bool bRetainPosition = false);
\r
56 void ClearViewNamesAndPaths();
\r
57 afx_msg LRESULT OnFindDialogMessage(WPARAM wParam, LPARAM lParam);
\r
58 afx_msg void OnApplicationLook(UINT id);
\r
59 afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
\r
61 afx_msg void OnFileSave();
\r
62 afx_msg void OnFileSaveAs();
\r
63 afx_msg void OnFileOpen();
\r
64 afx_msg void OnFileReload();
\r
65 afx_msg void OnClose();
\r
66 afx_msg void OnEditFind();
\r
67 afx_msg void OnEditFindnext();
\r
68 afx_msg void OnEditFindprev();
\r
69 afx_msg void OnViewWhitespaces();
\r
70 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
\r
71 afx_msg void OnSize(UINT nType, int cx, int cy);
\r
72 afx_msg void OnUpdateFileSave(CCmdUI *pCmdUI);
\r
73 afx_msg void OnUpdateFileSaveAs(CCmdUI *pCmdUI);
\r
74 afx_msg void OnViewOnewaydiff();
\r
75 afx_msg void OnUpdateViewOnewaydiff(CCmdUI *pCmdUI);
\r
76 afx_msg void OnUpdateViewWhitespaces(CCmdUI *pCmdUI);
\r
77 afx_msg void OnViewOptions();
\r
78 afx_msg void OnViewLinedown();
\r
79 afx_msg void OnViewLineup();
\r
80 afx_msg void OnViewLineleft();
\r
81 afx_msg void OnViewLineright();
\r
82 afx_msg void OnEditUseTheirs();
\r
83 afx_msg void OnEditUseMine();
\r
84 afx_msg void OnEditUseTheirsThenMine();
\r
85 afx_msg void OnEditUseMineThenTheirs();
\r
86 afx_msg void OnUpdateEditUseminethentheirblock(CCmdUI *pCmdUI);
\r
87 afx_msg void OnUpdateEditUsemyblock(CCmdUI *pCmdUI);
\r
88 afx_msg void OnUpdateEditUsetheirblock(CCmdUI *pCmdUI);
\r
89 afx_msg void OnUpdateEditUsetheirthenmyblock(CCmdUI *pCmdUI);
\r
90 afx_msg void OnUpdateMergeMarkasresolved(CCmdUI *pCmdUI);
\r
91 afx_msg void OnMergeMarkasresolved();
\r
92 afx_msg void OnUpdateMergeNextconflict(CCmdUI *pCmdUI);
\r
93 afx_msg void OnUpdateMergePreviousconflict(CCmdUI *pCmdUI);
\r
94 afx_msg void OnUpdateEditCopy(CCmdUI *pCmdUI);
\r
95 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
\r
96 afx_msg void OnViewSwitchleft();
\r
97 afx_msg void OnUpdateViewSwitchleft(CCmdUI *pCmdUI);
\r
98 afx_msg void OnUpdateViewShowfilelist(CCmdUI *pCmdUI);
\r
99 afx_msg void OnViewShowfilelist();
\r
100 afx_msg void OnEditUndo();
\r
101 afx_msg void OnUpdateEditUndo(CCmdUI *pCmdUI);
\r
102 afx_msg void OnViewInlinediffword();
\r
103 afx_msg void OnUpdateViewInlinediffword(CCmdUI *pCmdUI);
\r
104 afx_msg void OnUpdateEditCreateunifieddifffile(CCmdUI *pCmdUI);
\r
105 afx_msg void OnEditCreateunifieddifffile();
\r
106 afx_msg void OnUpdateViewLinediffbar(CCmdUI *pCmdUI);
\r
107 afx_msg void OnViewLinediffbar();
\r
108 afx_msg void OnUpdateViewLocatorbar(CCmdUI *pCmdUI);
\r
109 afx_msg void OnViewLocatorbar();
\r
111 DECLARE_MESSAGE_MAP()
\r
113 void UpdateLayout();
\r
114 virtual BOOL PatchFile(CString sFilePath, CString sVersion, BOOL bAutoPatch);
\r
115 virtual BOOL DiffFiles(CString sURL1, CString sRev1, CString sURL2, CString sRev2);
\r
116 int CheckResolved();
\r
117 BOOL MarkAsResolved();
\r
118 int SaveFile(const CString& sFilePath);
\r
119 void WriteWindowPlacement(WINDOWPLACEMENT * pwp);
\r
120 BOOL ReadWindowPlacement(WINDOWPLACEMENT * pwp);
\r
121 bool FileSave(bool bCheckResolved=true);
\r
122 bool FileSaveAs(bool bCheckResolved=true);
\r
123 bool StringFound(const CString&)const;
\r
124 enum SearchDirection{SearchNext=0, SearchPrevious=1};
\r
125 void Search(SearchDirection);
\r
126 int FindSearchStart(int nDefault);
\r
127 /// checks if there are modifications and asks the user to save them first
\r
128 /// IDCANCEL is returned if the user wants to cancel.
\r
129 /// If the user wanted to save the modifications, this method does the saving
\r
131 int CheckForSave();
\r
134 CMFCMenuBar m_wndMenuBar;
\r
135 CMFCStatusBar m_wndStatusBar;
\r
136 CMFCToolBar m_wndToolBar;
\r
137 CLocatorBar m_wndLocatorBar;
\r
138 CLineDiffBar m_wndLineDiffBar;
\r
139 CXSplitter m_wndSplitter;
\r
140 CXSplitter m_wndSplitter2;
\r
141 CFilePatchesDlg m_dlgFilePatches;
\r
144 BOOL m_bInitSplitter;
\r
145 CTempFiles m_TempFiles;
\r
147 int m_nSearchIndex;
\r
148 CString m_sFindText;
\r
150 bool m_bLimitToDiff;
\r
152 static const UINT m_FindDialogMessage;
\r
153 CFindDlg * m_pFindDialog;
\r
154 bool m_bHasConflicts;
\r
156 bool m_bInlineWordDiff;
\r
158 bool m_bLocatorBar;
\r
160 CLeftView * m_pwndLeftView;
\r
161 CRightView * m_pwndRightView;
\r
162 CBottomView * m_pwndBottomView;
\r
164 BOOL m_bReversedPatch;
\r
168 afx_msg void OnEditUseleftblock();
\r
169 afx_msg void OnUpdateEditUseleftblock(CCmdUI *pCmdUI);
\r
170 afx_msg void OnEditUseleftfile();
\r
171 afx_msg void OnUpdateEditUseleftfile(CCmdUI *pCmdUI);
\r
172 afx_msg void OnEditUseblockfromleftbeforeright();
\r
173 afx_msg void OnUpdateEditUseblockfromleftbeforeright(CCmdUI *pCmdUI);
\r
174 afx_msg void OnEditUseblockfromrightbeforeleft();
\r
175 afx_msg void OnUpdateEditUseblockfromrightbeforeleft(CCmdUI *pCmdUI);
\r