OSDN Git Service

Merge branch 'master' into master
[winmerge-jp/winmerge-jp.git] / Src / ImgMergeFrm.h
1 /////////////////////////////////////////////////////////////////////////////
2 //    WinMerge:  an interactive diff/merge utility
3 //    Copyright (C) 1997  Dean P. Grimm
4 //    SPDX-License-Identifier: GPL-2.0-or-later
5 /////////////////////////////////////////////////////////////////////////////
6 /** 
7  * @file  ImgMergeFrm.h
8  *
9  * @brief interface of the CImgMergeFrame class
10  *
11  */
12 #pragma once
13
14 #include "EditorFilepathBar.h"
15 #include "PathContext.h"
16 #include "DiffFileInfo.h"
17 #include "IMergeDoc.h"
18 #include "WinIMergeLib.h"
19 #include "LocationBar.h"
20 #include "FileLocation.h"
21 #include "MergeFrameCommon.h"
22
23 class CDirDoc;
24
25 /** 
26  * @brief Frame class for file compare, handles panes, statusbar etc.
27  */
28 class CImgMergeFrame : public CMergeFrameCommon,public IMergeDoc
29 {
30         private:
31         enum BUFFERTYPE
32         {
33                 BUFFER_NORMAL = 0, /**< Normal, file loaded from disk */
34                 BUFFER_NORMAL_NAMED, /**< Normal, description given */
35                 BUFFER_UNNAMED, /**< Empty, created buffer */
36                 BUFFER_UNNAMED_SAVED, /**< Empty buffer saved with filename */
37         };
38
39         using CMDIChildWnd::Create;
40
41         DECLARE_DYNCREATE(CImgMergeFrame)
42 public:
43         CImgMergeFrame();
44
45
46 // Operations
47 public:
48         bool OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[], CMDIFrameWnd *pParent);
49         void MoveOnLoad(int nPane = -1, int nLineIndex = -1);
50         void ChangeFile(int pane, const String& path);
51         void SetDirDoc(CDirDoc * pDirDoc) override;
52         void UpdateResources();
53         bool CloseNow() override;
54         void DirDocClosing(CDirDoc * pDirDoc) override { m_pDirDoc = nullptr; }
55         void UpdateLastCompareResult();
56         void UpdateAutoPaneResize();
57         void UpdateSplitter();
58         bool GenerateReport(const String& sFileName) const override;
59         void DoAutoMerge(int dstPane);
60         bool IsModified() const;
61         IMergeDoc::FileChange IsFileChangedOnDisk(int pane) const;
62         void CheckFileChanged(void) override;
63         String GetDescription(int pane) const { return m_strDesc[pane]; }
64         static bool IsLoadable();
65
66 // Attributes
67 protected:
68         CEditorFilePathBar m_wndFilePathBar;
69         CStatusBar m_wndStatusBar[3];
70 // Overrides
71 public:
72         // ClassWizard generated virtual function overrides
73         //{{AFX_VIRTUAL(CImgMergeFrame)
74         public:
75         virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
76         virtual BOOL DestroyWindow();
77         virtual BOOL PreTranslateMessage(MSG *);
78         static CMenu menu;
79
80         protected:
81         //}}AFX_VIRTUAL
82
83 // Implementation
84 private:
85         bool EnsureValidDockState(CDockState& state);
86         void LoadOptions();
87         void SaveOptions();
88         void SavePosition();
89         void SaveActivePane();
90         virtual ~CImgMergeFrame();
91         void CreateImgWndStatusBar(CStatusBar &, CWnd *);
92 // Generated message map functions
93 private:
94         int UpdateDiffItem(CDirDoc * pDirDoc);
95         void UpdateHeaderSizes();
96         void UpdateHeaderPath(int pane);
97         void SetTitle(LPCTSTR lpszTitle);
98         bool DoFileSave(int pane);
99         bool DoFileSaveAs(int pane);
100         bool PromptAndSaveIfNeeded(bool bAllowCancel);
101         bool MergeModeKeyDown(MSG* pMsg);
102         static void OnChildPaneEvent(const IImgMergeWindow::Event& evt);
103         void OnDropFiles(int pane, const std::vector<String>& files);
104         static void TranslateLocationPane(int id, const wchar_t *org, size_t dstbufsize, wchar_t *dst);
105         CLocationBar m_wndLocationBar;
106         IImgMergeWindow *m_pImgMergeWindow;
107         IImgToolWindow *m_pImgToolWindow;
108         PathContext m_filePaths;
109         String m_strDesc[3];
110         BUFFERTYPE m_nBufferType[3];
111         DiffFileInfo m_fileInfo[3];
112         bool m_bRO[3];
113         bool m_bAutoMerged;
114         CDirDoc *m_pDirDoc;
115         int m_nActivePane;
116
117         //{{AFX_MSG(CImgMergeFrame)
118         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
119         afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
120         afx_msg void OnClose();
121         afx_msg void OnDestroy();
122         afx_msg void OnFileSave();
123         afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
124         afx_msg void OnFileSaveLeft();
125         afx_msg void OnFileSaveMiddle();
126         afx_msg void OnUpdateFileSaveMiddle(CCmdUI* pCmdUI);
127         afx_msg void OnFileSaveRight();
128         afx_msg void OnFileSaveAsLeft();
129         afx_msg void OnFileSaveAsMiddle();
130         afx_msg void OnUpdateFileSaveAsMiddle(CCmdUI* pCmdUI);
131         afx_msg void OnFileSaveAsRight();
132         afx_msg void OnLeftReadOnly();
133         afx_msg void OnUpdateLeftReadOnly(CCmdUI* pCmdUI);
134         afx_msg void OnMiddleReadOnly();
135         afx_msg void OnUpdateMiddleReadOnly(CCmdUI* pCmdUI);
136         afx_msg void OnRightReadOnly();
137         afx_msg void OnUpdateRightReadOnly(CCmdUI* pCmdUI);
138         afx_msg void OnFileReload();
139         afx_msg void OnFileClose();
140         afx_msg void OnFileRecompareAs(UINT nId);
141         afx_msg void OnUpdateFileRecompareAs(CCmdUI* pCmdUI);
142         afx_msg void OnWindowChangePane();
143         afx_msg void OnSize(UINT nType, int cx, int cy);
144         afx_msg void OnIdleUpdateCmdUI();
145         afx_msg void OnUpdateStatusNum(CCmdUI* pCmdUI);
146         afx_msg LRESULT OnStorePaneSizes(WPARAM wParam, LPARAM lParam);
147         afx_msg void OnEditUndo();
148         afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
149         afx_msg void OnEditRedo();
150         afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
151         afx_msg void OnViewZoomIn();
152         afx_msg void OnViewZoomOut();
153         afx_msg void OnViewZoomNormal();
154         afx_msg void OnViewSplitVertically();
155         afx_msg void OnUpdateViewSplitVertically(CCmdUI* pCmdUI);
156         afx_msg void OnFirstdiff();
157         afx_msg void OnUpdateFirstdiff(CCmdUI* pCmdUI);
158         afx_msg void OnLastdiff();
159         afx_msg void OnUpdateLastdiff(CCmdUI* pCmdUI);
160         afx_msg void OnNextdiff();
161         afx_msg void OnUpdateNextdiff(CCmdUI* pCmdUI);
162         afx_msg void OnPrevdiff();
163         afx_msg void OnUpdatePrevdiff(CCmdUI* pCmdUI);
164         afx_msg void OnNextConflict();
165         afx_msg void OnUpdateNextConflict(CCmdUI* pCmdUI);
166         afx_msg void OnPrevConflict();
167         afx_msg void OnUpdatePrevConflict(CCmdUI* pCmdUI);
168         afx_msg void OnX2Y(int srcPane, int dstPane);
169         afx_msg void OnUpdateX2Y(CCmdUI* pCmdUI, int srcPane, int dstPane);
170         afx_msg void OnL2r();
171         afx_msg void OnUpdateL2r(CCmdUI* pCmdUI);
172         afx_msg void OnR2l();
173         afx_msg void OnUpdateR2l(CCmdUI* pCmdUI);
174         afx_msg void OnCopyFromLeft();
175         afx_msg void OnUpdateCopyFromLeft(CCmdUI* pCmdUI);
176         afx_msg void OnCopyFromRight();
177         afx_msg void OnUpdateCopyFromRight(CCmdUI* pCmdUI);
178         afx_msg void OnAllLeft();
179         afx_msg void OnUpdateAllLeft(CCmdUI* pCmdUI);
180         afx_msg void OnAllRight();
181         afx_msg void OnUpdateAllRight(CCmdUI* pCmdUI);
182         afx_msg void OnAutoMerge();
183         afx_msg void OnUpdateAutoMerge(CCmdUI* pCmdUI);
184         afx_msg void OnImgViewDifferences();
185         afx_msg void OnUpdateImgViewDifferences(CCmdUI* pCmdUI);
186         afx_msg void OnImgZoom(UINT nId);
187         afx_msg void OnUpdateImgZoom(CCmdUI* pCmdUI);
188         afx_msg void OnImgOverlayMode(UINT nId);
189         afx_msg void OnUpdateImgOverlayMode(CCmdUI* pCmdUI);
190         afx_msg void OnImgDraggingMode(UINT nId);
191         afx_msg void OnUpdateImgDraggingMode(CCmdUI* pCmdUI);
192         afx_msg void OnImgDiffBlockSize(UINT nId);
193         afx_msg void OnUpdateImgDiffBlockSize(CCmdUI* pCmdUI);
194         afx_msg void OnImgThreshold(UINT nId);
195         afx_msg void OnUpdateImgThreshold(CCmdUI* pCmdUI);
196         afx_msg void OnImgInsertionDeletionDetectionMode(UINT nId);
197         afx_msg void OnUpdateImgInsertionDeletionDetectionMode(CCmdUI* pCmdUI);
198         afx_msg void OnImgPrevPage();
199         afx_msg void OnUpdateImgPrevPage(CCmdUI* pCmdUI);
200         afx_msg void OnImgNextPage();
201         afx_msg void OnUpdateImgNextPage(CCmdUI* pCmdUI);
202         afx_msg void OnImgCurPanePrevPage();
203         afx_msg void OnUpdateImgCurPanePrevPage(CCmdUI* pCmdUI);
204         afx_msg void OnImgCurPaneNextPage();
205         afx_msg void OnUpdateImgCurPaneNextPage(CCmdUI* pCmdUI);
206         afx_msg void OnImgUseBackColor();
207         afx_msg void OnImgVectorImageScaling(UINT nId);
208         afx_msg void OnUpdateImgVectorImageScaling(CCmdUI* pCmdUI);
209         afx_msg void OnUpdateImgUseBackColor(CCmdUI* pCmdUI);
210         afx_msg void OnToolsGenerateReport();
211         afx_msg void OnRefresh();
212         afx_msg void OnSetFocus(CWnd *pNewWnd);
213         //}}AFX_MSG
214         DECLARE_MESSAGE_MAP()
215 };