OSDN Git Service

BrowseRefs: Fetch context menu item added.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / MainFrm.h
1 // TortoiseMerge - a Diff/Patch program\r
2 \r
3 // Copyright (C) 2006-2009 - TortoiseSVN\r
4 \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
9 \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
14 \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
18 //\r
19 #pragma once\r
20 \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
27 #include "Patch.h"\r
28 #include "FindDlg.h"\r
29 \r
30 class CLeftView;\r
31 class CRightView;\r
32 class CBottomView;\r
33 \r
34 /**\r
35  * \ingroup TortoiseMerge\r
36  * The main frame of TortoiseMerge. Handles all the menu and toolbar commands.\r
37  */\r
38 class CMainFrame : public CFrameWndEx, public CPatchFilesDlgCallBack //CFrameWndEx\r
39 {\r
40         \r
41 public:\r
42         CMainFrame();\r
43         virtual ~CMainFrame();\r
44 \r
45 #ifdef _DEBUG\r
46         virtual void    AssertValid() const;\r
47         virtual void    Dump(CDumpContext& dc) const;\r
48 #endif\r
49 protected: \r
50         DECLARE_DYNCREATE(CMainFrame)\r
51 \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
60 \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
110         afx_msg void    OnEditUseleftblock();\r
111         afx_msg void    OnUpdateEditUseleftblock(CCmdUI *pCmdUI);\r
112         afx_msg void    OnEditUseleftfile();\r
113         afx_msg void    OnUpdateEditUseleftfile(CCmdUI *pCmdUI);\r
114         afx_msg void    OnEditUseblockfromleftbeforeright();\r
115         afx_msg void    OnUpdateEditUseblockfromleftbeforeright(CCmdUI *pCmdUI);\r
116         afx_msg void    OnEditUseblockfromrightbeforeleft();\r
117         afx_msg void    OnUpdateEditUseblockfromrightbeforeleft(CCmdUI *pCmdUI);\r
118 \r
119         DECLARE_MESSAGE_MAP()\r
120 protected:\r
121         void                    UpdateLayout();\r
122         virtual BOOL    PatchFile(CString sFilePath, CString sVersion, BOOL bAutoPatch,BOOL bIsReview);\r
123         virtual BOOL    DiffFiles(CString sURL1, CString sRev1, CString sURL2, CString sRev2);\r
124         int                             CheckResolved();\r
125         BOOL                    MarkAsResolved();\r
126         int                             SaveFile(const CString& sFilePath);\r
127         void                    WriteWindowPlacement(WINDOWPLACEMENT * pwp);\r
128         BOOL                    ReadWindowPlacement(WINDOWPLACEMENT * pwp);\r
129         bool                    FileSave(bool bCheckResolved=true);\r
130         bool                    FileSaveAs(bool bCheckResolved=true);\r
131         bool                    StringFound(const CString&)const;\r
132         enum SearchDirection{SearchNext=0, SearchPrevious=1};   \r
133         void                    Search(SearchDirection);\r
134         int                             FindSearchStart(int nDefault);\r
135         /// checks if there are modifications and asks the user to save them first\r
136         /// IDCANCEL is returned if the user wants to cancel.\r
137         /// If the user wanted to save the modifications, this method does the saving\r
138         /// itself.\r
139         int                             CheckForSave();\r
140 \r
141 protected: \r
142         CMFCMenuBar     m_wndMenuBar;\r
143         CMFCStatusBar   m_wndStatusBar;\r
144         CMFCToolBar             m_wndToolBar;\r
145         CLocatorBar             m_wndLocatorBar;\r
146         CLineDiffBar    m_wndLineDiffBar;\r
147         CXSplitter              m_wndSplitter;\r
148         CXSplitter              m_wndSplitter2;\r
149         CFilePatchesDlg m_dlgFilePatches;\r
150 \r
151         CPatch                  m_Patch;\r
152         BOOL                    m_bInitSplitter;\r
153         CTempFiles              m_TempFiles;\r
154 \r
155         int                             m_nSearchIndex;\r
156         CString                 m_sFindText;\r
157         BOOL                    m_bMatchCase;\r
158         bool                    m_bLimitToDiff;\r
159         bool                    m_bWholeWord;\r
160         static const UINT m_FindDialogMessage;\r
161         CFindDlg *              m_pFindDialog;\r
162         bool                    m_bHasConflicts;\r
163 \r
164         bool                    m_bInlineWordDiff;\r
165         bool                    m_bLineDiff;\r
166         bool                    m_bLocatorBar;\r
167 \r
168 public:\r
169         CLeftView *             m_pwndLeftView;\r
170         CRightView *    m_pwndRightView;\r
171         CBottomView *   m_pwndBottomView;\r
172         BOOL                    m_bOneWay;\r
173         BOOL                    m_bReversedPatch;\r
174         CDiffData               m_Data;\r
175         bool                    m_bReadOnly;\r
176         bool                    m_bBlame;\r
177         int                             m_nMoveMovesToIgnore;\r
178 \r
179         void                    ShowDiffBar(bool bShow);\r
180 };\r
181 \r
182 \r
183 \r
184 \r
185 \r
186 \r