OSDN Git Service

Add Dragging Mode menu item
[winmerge-jp/winmerge-jp.git] / Src / ImgMergeFrm.h
1 /////////////////////////////////////////////////////////////////////////////
2 //    WinMerge:  an interactive diff/merge utility
3 //    Copyright (C) 1997  Dean P. Grimm
4 //
5 //    This program is free software; you can redistribute it and/or modify
6 //    it under the terms of the GNU General Public License as published by
7 //    the Free Software Foundation; either version 2 of the License, or
8 //    (at your option) any later version.
9 //
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.
14 //
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
17 //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //
19 /////////////////////////////////////////////////////////////////////////////
20 /** 
21  * @file  ImgMergeFrm.h
22  *
23  * @brief interface of the CImgMergeFrame class
24  *
25  */
26 #pragma once
27
28 #include "EditorFilepathBar.h"
29 #include "PathContext.h"
30 #include "DiffFileInfo.h"
31 #include "IMergeDoc.h"
32 #include "WinIMergeLib.h"
33 #include "LocationBar.h"
34 #include "FileLocation.h"
35
36 class CDirDoc;
37
38 /** 
39  * @brief Frame class for file compare, handles panes, statusbar etc.
40  */
41 class CImgMergeFrame : public CMDIChildWnd, public IMergeDoc
42 {
43         private:
44         enum BUFFERTYPE
45         {
46                 BUFFER_NORMAL = 0, /**< Normal, file loaded from disk */
47                 BUFFER_NORMAL_NAMED, /**< Normal, description given */
48                 BUFFER_UNNAMED, /**< Empty, created buffer */
49                 BUFFER_UNNAMED_SAVED, /**< Empty buffer saved with filename */
50         };
51
52         using CMDIChildWnd::Create;
53
54         DECLARE_DYNCREATE(CImgMergeFrame)
55 public:
56         CImgMergeFrame();
57
58
59 // Operations
60 public:
61         bool OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[], int nPane, CMDIFrameWnd *pParent);
62         void ChangeFile(int pane, const String& path);
63         void SetDirDoc(CDirDoc * pDirDoc);
64         void UpdateResources();
65         bool CloseNow();
66         void DirDocClosing(CDirDoc * pDirDoc) { m_pDirDoc = NULL; }
67         void SetSharedMenu(HMENU hMenu) { m_hMenuShared = hMenu; };
68         void SetLastCompareResult(int nResult);
69         void UpdateLastCompareResult();
70         void UpdateAutoPaneResize();
71         void UpdateSplitter();
72         bool GenerateReport(const String& sFileName) const;
73         void DoAutoMerge(int dstPane);
74         bool IsModified() const;
75         bool IsFileChangedOnDisk(int pane) const;
76         void CheckFileChanged(void);
77
78 // Attributes
79 protected:
80         CEditorFilePathBar m_wndFilePathBar;
81         CStatusBar m_wndStatusBar[3];
82 // Overrides
83 public:
84         // ClassWizard generated virtual function overrides
85         //{{AFX_VIRTUAL(CImgMergeFrame)
86         public:
87         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
88         virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
89         virtual BOOL DestroyWindow();
90         virtual BOOL PreTranslateMessage(MSG *);
91         static CMenu menu;
92
93         protected:
94         //}}AFX_VIRTUAL
95
96 // Implementation
97 private:
98         BOOL EnsureValidDockState(CDockState& state);
99         void LoadOptions();
100         void SaveOptions();
101         void SavePosition();
102         virtual ~CImgMergeFrame();
103         void CreateImgWndStatusBar(CStatusBar &, CWnd *);
104 // Generated message map functions
105 private:
106         int UpdateDiffItem(CDirDoc * pDirDoc);
107         void UpdateHeaderSizes();
108         void UpdateHeaderPath(int pane);
109         void SetTitle(LPCTSTR lpszTitle);
110         bool DoFileSave(int pane);
111         bool DoFileSaveAs(int pane);
112         bool PromptAndSaveIfNeeded(bool bAllowCancel);
113         bool MergeModeKeyDown(MSG* pMsg);
114         static void OnChildPaneEvent(const IImgMergeWindow::Event& evt);
115         void OnDropFiles(int pane, const std::vector<String>& files);
116         int m_nLastSplitPos[2];
117         HICON m_hIdentical;
118         HICON m_hDifferent;
119         CLocationBar m_wndLocationBar;
120         IImgMergeWindow *m_pImgMergeWindow;
121         IImgToolWindow *m_pImgToolWindow;
122         PathContext m_filePaths;
123         String m_strDesc[3];
124         BUFFERTYPE m_nBufferType[3];
125         DiffFileInfo m_fileInfo[3];
126         bool m_bRO[3];
127         bool m_bAutoMerged;
128         CDirDoc *m_pDirDoc;
129
130         //{{AFX_MSG(CImgMergeFrame)
131         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
132         afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
133         afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
134         afx_msg void OnClose();
135         afx_msg void OnFileSave();
136         afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
137         afx_msg void OnFileSaveLeft();
138         afx_msg void OnFileSaveMiddle();
139         afx_msg void OnUpdateFileSaveMiddle(CCmdUI* pCmdUI);
140         afx_msg void OnFileSaveRight();
141         afx_msg void OnFileSaveAsLeft();
142         afx_msg void OnFileSaveAsMiddle();
143         afx_msg void OnUpdateFileSaveAsMiddle(CCmdUI* pCmdUI);
144         afx_msg void OnFileSaveAsRight();
145         afx_msg void OnLeftReadOnly();
146         afx_msg void OnUpdateLeftReadOnly(CCmdUI* pCmdUI);
147         afx_msg void OnMiddleReadOnly();
148         afx_msg void OnUpdateMiddleReadOnly(CCmdUI* pCmdUI);
149         afx_msg void OnRightReadOnly();
150         afx_msg void OnUpdateRightReadOnly(CCmdUI* pCmdUI);
151         afx_msg void OnFileReload();
152         afx_msg void OnFileClose();
153         afx_msg void OnFileRecompareAsBinary();
154         afx_msg void OnWindowChangePane();
155         afx_msg void OnSize(UINT nType, int cx, int cy);
156         afx_msg void OnIdleUpdateCmdUI();
157         afx_msg void OnUpdateStatusNum(CCmdUI* pCmdUI);
158         afx_msg LRESULT OnStorePaneSizes(WPARAM wParam, LPARAM lParam);
159         afx_msg void OnEditUndo();
160         afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
161         afx_msg void OnEditRedo();
162         afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
163         afx_msg void OnViewZoomIn();
164         afx_msg void OnViewZoomOut();
165         afx_msg void OnViewZoomNormal();
166         afx_msg void OnViewSplitVertically();
167         afx_msg void OnUpdateViewSplitVertically(CCmdUI* pCmdUI);
168         afx_msg void OnFirstdiff();
169         afx_msg void OnUpdateFirstdiff(CCmdUI* pCmdUI);
170         afx_msg void OnLastdiff();
171         afx_msg void OnUpdateLastdiff(CCmdUI* pCmdUI);
172         afx_msg void OnNextdiff();
173         afx_msg void OnUpdateNextdiff(CCmdUI* pCmdUI);
174         afx_msg void OnPrevdiff();
175         afx_msg void OnUpdatePrevdiff(CCmdUI* pCmdUI);
176         afx_msg void OnNextConflict();
177         afx_msg void OnUpdateNextConflict(CCmdUI* pCmdUI);
178         afx_msg void OnPrevConflict();
179         afx_msg void OnUpdatePrevConflict(CCmdUI* pCmdUI);
180         afx_msg void OnX2Y(int srcPane, int dstPane);
181         afx_msg void OnUpdateX2Y(CCmdUI* pCmdUI, int srcPane, int dstPane);
182         afx_msg void OnL2r();
183         afx_msg void OnUpdateL2r(CCmdUI* pCmdUI);
184         afx_msg void OnR2l();
185         afx_msg void OnUpdateR2l(CCmdUI* pCmdUI);
186         afx_msg void OnCopyFromLeft();
187         afx_msg void OnUpdateCopyFromLeft(CCmdUI* pCmdUI);
188         afx_msg void OnCopyFromRight();
189         afx_msg void OnUpdateCopyFromRight(CCmdUI* pCmdUI);
190         afx_msg void OnAllLeft();
191         afx_msg void OnUpdateAllLeft(CCmdUI* pCmdUI);
192         afx_msg void OnAllRight();
193         afx_msg void OnUpdateAllRight(CCmdUI* pCmdUI);
194         afx_msg void OnAutoMerge();
195         afx_msg void OnUpdateAutoMerge(CCmdUI* pCmdUI);
196         afx_msg void OnImgViewDifferences();
197         afx_msg void OnUpdateImgViewDifferences(CCmdUI* pCmdUI);
198         afx_msg void OnImgZoom(UINT nId);
199         afx_msg void OnUpdateImgZoom(CCmdUI* pCmdUI);
200         afx_msg void OnImgOverlayMode(UINT nId);
201         afx_msg void OnUpdateImgOverlayMode(CCmdUI* pCmdUI);
202         afx_msg void OnImgDraggingMode(UINT nId);
203         afx_msg void OnUpdateImgDraggingMode(CCmdUI* pCmdUI);
204         afx_msg void OnImgDiffBlockSize(UINT nId);
205         afx_msg void OnUpdateImgDiffBlockSize(CCmdUI* pCmdUI);
206         afx_msg void OnImgThreshold(UINT nId);
207         afx_msg void OnUpdateImgThreshold(CCmdUI* pCmdUI);
208         afx_msg void OnImgPrevPage();
209         afx_msg void OnUpdateImgPrevPage(CCmdUI* pCmdUI);
210         afx_msg void OnImgNextPage();
211         afx_msg void OnUpdateImgNextPage(CCmdUI* pCmdUI);
212         afx_msg void OnImgCurPanePrevPage();
213         afx_msg void OnUpdateImgCurPanePrevPage(CCmdUI* pCmdUI);
214         afx_msg void OnImgCurPaneNextPage();
215         afx_msg void OnUpdateImgCurPaneNextPage(CCmdUI* pCmdUI);
216         afx_msg void OnImgUseBackColor();
217         afx_msg void OnUpdateImgUseBackColor(CCmdUI* pCmdUI);
218         afx_msg void OnToolsGenerateReport();
219         afx_msg void OnRefresh();
220         //}}AFX_MSG
221         DECLARE_MESSAGE_MAP()
222 };
223
224 /////////////////////////////////////////////////////////////////////////////
225
226 //{{AFX_INSERT_LOCATION}}
227 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.