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 /////////////////////////////////////////////////////////////////////////////
9 * @brief Declaration of CHexMergeDoc class
13 #include "PathContext.h"
14 #include "FileLocation.h"
15 #include "IMergeDoc.h"
22 * @brief Document class for bytewise merging two files presented as hexdumps
24 class CHexMergeDoc : public CDocument, public IMergeDoc
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 */
37 static int m_nBuffersTemp;
39 PathContext m_filePaths; /**< Filepaths for this document */
41 // Begin declaration of CHexMergeDoc
43 protected: // create from serialization only
45 DECLARE_DYNCREATE(CHexMergeDoc)
50 void SetMergeViews(CHexMergeView * pView[]);
51 CHexMergeView *GetActiveMergeView() const;
54 // ClassWizard generated virtual function overrides
55 //{{AFX_VIRTUAL(CMergeDoc)
57 virtual BOOL SaveModified();
58 virtual void SetTitle(LPCTSTR lpszTitle);
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]; };
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
85 CHexMergeView * m_pView[3]; /**< Pointer to left/right view */
87 String m_strDesc[3]; /**< Left/right side description text */
88 BUFFERTYPE m_nBufferType[3];
90 // Generated message map functions
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);
119 DECLARE_MESSAGE_MAP()