Fix Issue #392: refresh branch info when press "F5"
[TortoiseGit.git] / src / TortoiseMerge / MainFrm.h
blobbbf6454517a454bed020aaeee8bc5301b707fdfd
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 OnViewWhitespaces();
70 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
71 afx_msg void OnSize(UINT nType, int cx, int cy);
72 afx_msg void OnUpdateFileSave(CCmdUI *pCmdUI);
73 afx_msg void OnUpdateFileSaveAs(CCmdUI *pCmdUI);
74 afx_msg void OnViewOnewaydiff();
75 afx_msg void OnUpdateViewOnewaydiff(CCmdUI *pCmdUI);
76 afx_msg void OnUpdateViewWhitespaces(CCmdUI *pCmdUI);
77 afx_msg void OnViewOptions();
78 afx_msg void OnViewLinedown();
79 afx_msg void OnViewLineup();
80 afx_msg void OnViewLineleft();
81 afx_msg void OnViewLineright();
82 afx_msg void OnEditUseTheirs();
83 afx_msg void OnEditUseMine();
84 afx_msg void OnEditUseTheirsThenMine();
85 afx_msg void OnEditUseMineThenTheirs();
86 afx_msg void OnUpdateEditUseminethentheirblock(CCmdUI *pCmdUI);
87 afx_msg void OnUpdateEditUsemyblock(CCmdUI *pCmdUI);
88 afx_msg void OnUpdateEditUsetheirblock(CCmdUI *pCmdUI);
89 afx_msg void OnUpdateEditUsetheirthenmyblock(CCmdUI *pCmdUI);
90 afx_msg void OnUpdateMergeMarkasresolved(CCmdUI *pCmdUI);
91 afx_msg void OnMergeMarkasresolved();
92 afx_msg void OnUpdateMergeNextconflict(CCmdUI *pCmdUI);
93 afx_msg void OnUpdateMergePreviousconflict(CCmdUI *pCmdUI);
94 afx_msg void OnUpdateEditCopy(CCmdUI *pCmdUI);
95 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
96 afx_msg void OnViewSwitchleft();
97 afx_msg void OnUpdateViewSwitchleft(CCmdUI *pCmdUI);
98 afx_msg void OnUpdateViewShowfilelist(CCmdUI *pCmdUI);
99 afx_msg void OnViewShowfilelist();
100 afx_msg void OnEditUndo();
101 afx_msg void OnUpdateEditUndo(CCmdUI *pCmdUI);
102 afx_msg void OnViewInlinediffword();
103 afx_msg void OnUpdateViewInlinediffword(CCmdUI *pCmdUI);
104 afx_msg void OnUpdateEditCreateunifieddifffile(CCmdUI *pCmdUI);
105 afx_msg void OnEditCreateunifieddifffile();
106 afx_msg void OnUpdateViewLinediffbar(CCmdUI *pCmdUI);
107 afx_msg void OnViewLinediffbar();
108 afx_msg void OnUpdateViewLocatorbar(CCmdUI *pCmdUI);
109 afx_msg void OnViewLocatorbar();
110 afx_msg void OnEditUseleftblock();
111 afx_msg void OnUpdateEditUseleftblock(CCmdUI *pCmdUI);
112 afx_msg void OnEditUseleftfile();
113 afx_msg void OnUpdateEditUseleftfile(CCmdUI *pCmdUI);
114 afx_msg void OnEditUseblockfromleftbeforeright();
115 afx_msg void OnUpdateEditUseblockfromleftbeforeright(CCmdUI *pCmdUI);
116 afx_msg void OnEditUseblockfromrightbeforeleft();
117 afx_msg void OnUpdateEditUseblockfromrightbeforeleft(CCmdUI *pCmdUI);
119 DECLARE_MESSAGE_MAP()
120 protected:
121 void UpdateLayout();
122 virtual BOOL PatchFile(CString sFilePath, CString sVersion, BOOL bAutoPatch,BOOL bIsReview, CString *Path2=NULL);
123 virtual BOOL DiffFiles(CString sURL1, CString sRev1, CString sURL2, CString sRev2);
124 int CheckResolved();
125 BOOL MarkAsResolved();
126 int SaveFile(const CString& sFilePath);
127 void WriteWindowPlacement(WINDOWPLACEMENT * pwp);
128 BOOL ReadWindowPlacement(WINDOWPLACEMENT * pwp);
129 bool FileSave(bool bCheckResolved=true);
130 bool FileSaveAs(bool bCheckResolved=true);
131 bool StringFound(const CString&)const;
132 enum SearchDirection{SearchNext=0, SearchPrevious=1};
133 void Search(SearchDirection);
134 int FindSearchStart(int nDefault);
135 /// checks if there are modifications and asks the user to save them first
136 /// IDCANCEL is returned if the user wants to cancel.
137 /// If the user wanted to save the modifications, this method does the saving
138 /// itself.
139 int CheckForSave();
141 protected:
142 CMFCMenuBar m_wndMenuBar;
143 CMFCStatusBar m_wndStatusBar;
144 CMFCToolBar m_wndToolBar;
145 CLocatorBar m_wndLocatorBar;
146 CLineDiffBar m_wndLineDiffBar;
147 CXSplitter m_wndSplitter;
148 CXSplitter m_wndSplitter2;
149 CFilePatchesDlg m_dlgFilePatches;
151 CPatch m_Patch;
152 BOOL m_bInitSplitter;
153 CTempFiles m_TempFiles;
155 int m_nSearchIndex;
156 CString m_sFindText;
157 BOOL m_bMatchCase;
158 bool m_bLimitToDiff;
159 bool m_bWholeWord;
160 static const UINT m_FindDialogMessage;
161 CFindDlg * m_pFindDialog;
162 bool m_bHasConflicts;
164 bool m_bInlineWordDiff;
165 bool m_bLineDiff;
166 bool m_bLocatorBar;
168 public:
169 CLeftView * m_pwndLeftView;
170 CRightView * m_pwndRightView;
171 CBottomView * m_pwndBottomView;
172 BOOL m_bOneWay;
173 BOOL m_bReversedPatch;
174 CDiffData m_Data;
175 bool m_bReadOnly;
176 bool m_bBlame;
177 int m_nMoveMovesToIgnore;
179 void ShowDiffBar(bool bShow);