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