2 * @file WebPageDiffFrm.h
4 * @brief interface of the CWebPageDiffFrame class
9 #include "EditorFilepathBar.h"
10 #include "PathContext.h"
11 #include "DiffFileInfo.h"
12 #include "IMergeDoc.h"
13 #include "WinWebDiffLib.h"
14 #include "LocationBar.h"
15 #include "WebPageDiffBar.h"
16 #include "FileLocation.h"
17 #include "MergeFrameCommon.h"
18 #include "FileTransform.h"
20 #include "SuperComboBox.h"
26 * @brief Frame class for file compare, handles panes, statusbar etc.
28 class CWebPageDiffFrame : public CMergeFrameCommon,public IMergeDoc
33 NORMAL = 0, /**< Normal, file loaded from disk */
34 NORMAL_NAMED, /**< Normal, description given */
35 UNNAMED, /**< Empty, created buffer */
36 UNNAMED_SAVED, /**< Empty buffer saved with filename */
39 using CMDIChildWnd::Create;
41 DECLARE_DYNCREATE(CWebPageDiffFrame)
48 bool OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[], CMDIFrameWnd *pParent, std::function<void ()> callback);
49 void MoveOnLoad(int nPane = -1, int nLineIndex = -1);
50 IDirDoc* GetDirDoc() const override { return m_pDirDoc; };
51 void SetDirDoc(IDirDoc * pDirDoc) override;
52 void UpdateResources();
53 void RefreshOptions();
54 bool CloseNow() override;
55 void DirDocClosing(IDirDoc * pDirDoc) override { m_pDirDoc = nullptr; }
56 int UpdateLastCompareResult();
57 void UpdateAutoPaneResize();
58 void UpdateSplitter();
59 bool GenerateReport(const String& sFileName) const;
60 bool GenerateReport(const String& sFileName, std::function<void (bool)> callback) const;
61 const PackingInfo* GetUnpacker() const override { return &m_infoUnpacker; };
62 void SetUnpacker(const PackingInfo* infoUnpacker) override { if (infoUnpacker) m_infoUnpacker = *infoUnpacker; };
63 const PrediffingInfo* GetPrediffer() const override { return nullptr; };
64 int GetFileCount() const override { return m_filePaths.GetSize(); }
65 String GetPath(int pane) const override { return m_filePaths[pane]; }
66 bool GetReadOnly(int pane) const override { return m_bRO[pane]; }
67 CString GetTooltipString() const override;
68 IMergeDoc::FileChange IsFileChangedOnDisk(int pane) const;
69 void CheckFileChanged(void) override;
70 String GetDescription(int pane) const override { return m_strDesc[pane]; }
71 static bool IsLoadable();
72 static bool MatchURLPattern(const String& url);
76 CEditorFilePathBar m_wndFilePathBar;
77 CStatusBar m_wndStatusBar[3];
80 // ClassWizard generated virtual function overrides
81 //{{AFX_VIRTUAL(CWebPageDiffFrame)
83 virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
84 virtual BOOL DestroyWindow();
85 virtual BOOL PreTranslateMessage(MSG *);
93 bool EnsureValidDockState(CDockState& state);
97 void SaveActivePane();
98 virtual ~CWebPageDiffFrame();
99 void CreateWebWndStatusBar(CStatusBar &, CWnd *);
100 void OnWebDiffEvent(const WebDiffEvent& event);
101 bool OpenUrls(IWebDiffCallback* callback);
102 void UpdateHeaderSizes();
103 void UpdateHeaderPath(int pane);
104 void SetTitle(LPCTSTR lpszTitle);
105 bool MergeModeKeyDown(MSG* pMsg);
106 void UpdateWebPageDiffBar();
107 //static void TranslateLocationPane(int id, const wchar_t *org, size_t dstbufsize, wchar_t *dst);
110 CWebPageDiffBar m_wndWebPageDiffBar;
111 CLocationBar m_wndLocationBar;
112 IWebDiffWindow *m_pWebDiffWindow;
113 //IWebToolWindow *m_pWebToolWindow;
114 PathContext m_filePaths;
116 BUFFERTYPE m_nBufferType[3];
117 DiffFileInfo m_fileInfo[3];
122 PackingInfo m_infoUnpacker;
123 std::vector<int> m_unpackerSubcodes[3];
124 std::vector<std::shared_ptr<TempFile>> m_tempFiles;
125 std::vector<std::shared_ptr<TempFolder>> m_tempFolders;
126 std::function<void()> m_callbackOnOpenCompleted;
127 bool m_bCompareCompleted;
128 bool m_bInUpdateWebPageDiffBar;
130 // Generated message map functions
132 //{{AFX_MSG(CWebPageDiffFrame)
133 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
134 afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
135 afx_msg void OnClose();
136 afx_msg void OnDestroy();
138 afx_msg void OnFileSave();
139 afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
140 afx_msg void OnFileSaveLeft();
141 afx_msg void OnFileSaveMiddle();
142 afx_msg void OnUpdateFileSaveMiddle(CCmdUI* pCmdUI);
143 afx_msg void OnFileSaveRight();
144 afx_msg void OnFileSaveAsLeft();
145 afx_msg void OnFileSaveAsMiddle();
146 afx_msg void OnUpdateFileSaveAsMiddle(CCmdUI* pCmdUI);
147 afx_msg void OnFileSaveAsRight();
149 afx_msg void OnFileReload();
150 afx_msg void OnFileClose();
151 afx_msg void OnFileRecompareAs(UINT nID);
152 afx_msg void OnUpdateFileRecompareAs(CCmdUI* pCmdUI);
153 afx_msg void OnOpenWithUnpacker();
154 afx_msg void OnWindowChangePane(UINT nID);
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 OnEditCut();
164 afx_msg void OnEditCopy();
165 afx_msg void OnEditPaste();
166 afx_msg void OnEditSelectAll();
167 afx_msg void OnViewZoomIn();
168 afx_msg void OnViewZoomOut();
169 afx_msg void OnViewZoomNormal();
170 afx_msg void OnViewLineDiffs();
171 afx_msg void OnUpdateViewLineDiffs(CCmdUI* pCmdUI);
172 afx_msg void OnViewSplitVertically();
173 afx_msg void OnUpdateViewSplitVertically(CCmdUI* pCmdUI);
174 afx_msg void OnFirstdiff();
175 afx_msg void OnUpdateFirstdiff(CCmdUI* pCmdUI);
176 afx_msg void OnLastdiff();
177 afx_msg void OnUpdateLastdiff(CCmdUI* pCmdUI);
178 afx_msg void OnNextdiff();
179 afx_msg void OnUpdateNextdiff(CCmdUI* pCmdUI);
180 afx_msg void OnPrevdiff();
181 afx_msg void OnUpdatePrevdiff(CCmdUI* pCmdUI);
182 afx_msg void OnNextConflict();
183 afx_msg void OnUpdateNextConflict(CCmdUI* pCmdUI);
184 afx_msg void OnPrevConflict();
185 afx_msg void OnUpdatePrevConflict(CCmdUI* pCmdUI);
186 afx_msg void OnWebFitToWindow();
187 afx_msg void OnUpdateWebFitToWindow(CCmdUI* pCmdUI);
188 afx_msg void OnWebSize(UINT nID);
189 afx_msg void OnWebCompareScreenshots(UINT nID);
190 afx_msg void OnWebCompareHTMLs();
191 afx_msg void OnWebCompareTexts();
192 afx_msg void OnWebCompareResourceTrees();
193 afx_msg void OnWebClear(UINT nID);
194 afx_msg void OnToolsGenerateReport();
195 afx_msg void OnRefresh();
196 afx_msg void OnSetFocus(CWnd *pNewWnd);
197 afx_msg void OnHelp();
198 afx_msg void OnBnClickedFitToWindow();
199 afx_msg void OnBnClickedShowDifferences();
200 afx_msg void OnBnClickedCompare();
201 afx_msg void OnEnChangeWidth();
202 afx_msg void OnEnChangeHeight();
203 afx_msg void OnEnChangeZoom();
204 afx_msg void OnEnChangeUserAgent();
205 afx_msg void OnKillFocusBarControls();
206 afx_msg void OnDropDownCompare(NMHDR* pNMHDR, LRESULT* pResult);
208 DECLARE_MESSAGE_MAP()