OSDN Git Service

Fix that the Next File or Previous File button on the toolbar did not work if the...
[winmerge-jp/winmerge-jp.git] / Src / HexMergeDoc.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  HexMergeDoc.h
8  *
9  * @brief Declaration of CHexMergeDoc class
10  */
11 #pragma once
12
13 #include "PathContext.h"
14 #include "FileLocation.h"
15 #include "IMergeDoc.h"
16
17 class CDirDoc;
18 class CHexMergeFrame;
19 class CHexMergeView;
20
21 /**
22  * @brief Document class for bytewise merging two files presented as hexdumps
23  */
24 class CHexMergeDoc : public CDocument, public IMergeDoc
25 {
26 public:
27         enum class BUFFERTYPE
28         {
29                 NORMAL = 0, /**< Normal, file loaded from disk */
30                 NORMAL_NAMED, /**< Normal, description given */
31                 UNNAMED, /**< Empty, created buffer */
32                 UNNAMED_SAVED, /**< Empty buffer saved with filename */
33         };
34
35 // Attributes
36 public:
37         static int m_nBuffersTemp;
38         int m_nBuffers;
39         PathContext m_filePaths; /**< Filepaths for this document */
40
41 // Begin declaration of CHexMergeDoc
42
43 protected: // create from serialization only
44         CHexMergeDoc();
45         DECLARE_DYNCREATE(CHexMergeDoc)
46
47         
48         // Operations
49 public: 
50         void SetMergeViews(CHexMergeView * pView[]);
51         CHexMergeView *GetActiveMergeView() const;
52
53         // Overrides
54         // ClassWizard generated virtual function overrides
55         //{{AFX_VIRTUAL(CMergeDoc)
56         public:
57         virtual BOOL SaveModified();
58         virtual void SetTitle(LPCTSTR lpszTitle);
59         //}}AFX_VIRTUAL
60
61 // Implementation
62 public:
63         ~CHexMergeDoc();
64         int UpdateDiffItem(CDirDoc * pDirDoc);
65         bool PromptAndSaveIfNeeded(bool bAllowCancel);
66         CDirDoc* GetDirDoc() const override { return m_pDirDoc; };
67         void SetDirDoc(CDirDoc * pDirDoc) override;
68         void DirDocClosing(CDirDoc * pDirDoc) override;
69         bool CloseNow() override;
70         bool GenerateReport(const String& sFileName) const override { return true; }
71         CHexMergeFrame * GetParentFrame() const;
72         void UpdateHeaderPath(int pane);
73         void RefreshOptions();
74         bool OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[]);
75         void MoveOnLoad(int nPane = -1, int nLineIndex = -1);
76         void CheckFileChanged(void) override;
77         String GetDescription(int pane) const { return m_strDesc[pane]; };
78 private:
79         void DoFileSave(int nBuffer);
80         void DoFileSaveAs(int nBuffer);
81         HRESULT LoadOneFile(int index, LPCTSTR filename, bool readOnly, const String& strDesc);
82         void RecompareAs(UINT id);
83 // Implementation data
84 protected:
85         CHexMergeView * m_pView[3]; /**< Pointer to left/right view */
86         CDirDoc * m_pDirDoc;
87         String m_strDesc[3]; /**< Left/right side description text */
88         BUFFERTYPE m_nBufferType[3];
89
90 // Generated message map functions
91 protected:
92         //{{AFX_MSG(CMergeDoc)
93         afx_msg void OnFileSave();
94         afx_msg void OnFileSaveLeft();
95         afx_msg void OnFileSaveMiddle();
96         afx_msg void OnFileSaveRight();
97         afx_msg void OnFileSaveAsLeft();
98         afx_msg void OnFileSaveAsMiddle();
99         afx_msg void OnFileSaveAsRight();
100         afx_msg void OnFileReload();
101         afx_msg void OnUpdateStatusNum(CCmdUI* pCmdUI);
102         afx_msg void OnUpdateFileSaveLeft(CCmdUI* pCmdUI);
103         afx_msg void OnUpdateFileSaveMiddle(CCmdUI* pCmdUI);
104         afx_msg void OnUpdateFileSaveRight(CCmdUI* pCmdUI);
105         afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
106         afx_msg void OnL2r();
107         afx_msg void OnR2l();
108         afx_msg void OnCopyFromLeft();
109         afx_msg void OnCopyFromRight();
110         afx_msg void OnAllRight();
111         afx_msg void OnAllLeft();
112         afx_msg void OnViewZoomIn();
113         afx_msg void OnViewZoomOut();
114         afx_msg void OnViewZoomNormal();
115         afx_msg void OnRefresh();
116         afx_msg void OnFileRecompareAs(UINT nID);
117         afx_msg void OnUpdateFileRecompareAs(CCmdUI* pCmdUI);
118         //}}AFX_MSG
119         DECLARE_MESSAGE_MAP()
120 };
121