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 CDirDoc* GetDirDoc() const override { return m_pDirDoc; };
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 bool GenerateReport(const String& sFileName, bool allPages) const;
60 const PackingInfo* GetUnpacker() const override { return &m_infoUnpacker; };
61 void SetUnpacker(const PackingInfo* infoUnpacker) override { if (infoUnpacker) m_infoUnpacker = *infoUnpacker; };
62 const PrediffingInfo* GetPrediffer() const override { return nullptr; };
63 int GetFileCount() const override { return m_filePaths.GetSize(); }
64 String GetPath(int pane) const override { return m_filePaths[pane]; }
65 bool GetReadOnly(int pane) const override { return m_bRO[pane]; }
66 CString GetTooltipString() const override;
67 IMergeDoc::FileChange IsFileChangedOnDisk(int pane) const;
68 void CheckFileChanged(void) override;
69 String GetDescription(int pane) const { return m_strDesc[pane]; }
70 static bool IsLoadable();
71 static bool MatchURLPattern(const String& url);
75 CEditorFilePathBar m_wndFilePathBar;
76 CStatusBar m_wndStatusBar[3];
79 // ClassWizard generated virtual function overrides
80 //{{AFX_VIRTUAL(CWebPageDiffFrame)
82 virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
83 virtual BOOL DestroyWindow();
84 virtual BOOL PreTranslateMessage(MSG *);
92 bool EnsureValidDockState(CDockState& state);
96 void SaveActivePane();
97 virtual ~CWebPageDiffFrame();
98 void CreateWebWndStatusBar(CStatusBar &, CWnd *);
99 void OnWebDiffEvent(const WebDiffEvent& event);
100 bool OpenUrls(IWebDiffCallback* callback);
101 int UpdateDiffItem(CDirDoc * pDirDoc);
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);
109 // Generated message map functions
111 CWebPageDiffBar m_wndWebPageDiffBar;
112 CLocationBar m_wndLocationBar;
113 IWebDiffWindow *m_pWebDiffWindow;
114 //IWebToolWindow *m_pWebToolWindow;
115 PathContext m_filePaths;
117 BUFFERTYPE m_nBufferType[3];
118 DiffFileInfo m_fileInfo[3];
123 PackingInfo m_infoUnpacker;
124 std::vector<int> m_unpackerSubcodes[3];
125 std::vector<std::shared_ptr<TempFile>> m_tempFiles;
126 std::vector<std::shared_ptr<TempFolder>> m_tempFolders;
127 std::function<void()> m_callbackOnOpenCompleted;
128 bool m_bInUpdateWebPageDiffBar;
130 //{{AFX_MSG(CWebPageDiffFrame)
131 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
132 afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
133 afx_msg void OnClose();
134 afx_msg void OnDestroy();
136 afx_msg void OnFileSave();
137 afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
138 afx_msg void OnFileSaveLeft();
139 afx_msg void OnFileSaveMiddle();
140 afx_msg void OnUpdateFileSaveMiddle(CCmdUI* pCmdUI);
141 afx_msg void OnFileSaveRight();
142 afx_msg void OnFileSaveAsLeft();
143 afx_msg void OnFileSaveAsMiddle();
144 afx_msg void OnUpdateFileSaveAsMiddle(CCmdUI* pCmdUI);
145 afx_msg void OnFileSaveAsRight();
147 afx_msg void OnFileReload();
148 afx_msg void OnFileClose();
149 afx_msg void OnFileRecompareAs(UINT nID);
150 afx_msg void OnUpdateFileRecompareAs(CCmdUI* pCmdUI);
151 afx_msg void OnOpenWithUnpacker();
152 afx_msg void OnWindowChangePane(UINT nID);
153 afx_msg void OnSize(UINT nType, int cx, int cy);
154 afx_msg void OnIdleUpdateCmdUI();
155 afx_msg void OnUpdateStatusNum(CCmdUI* pCmdUI);
156 afx_msg LRESULT OnStorePaneSizes(WPARAM wParam, LPARAM lParam);
157 afx_msg void OnEditCut();
158 afx_msg void OnEditCopy();
159 afx_msg void OnEditPaste();
160 afx_msg void OnEditUndo();
161 afx_msg void OnEditRedo();
162 afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
163 afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
164 afx_msg void OnEditSelectAll();
165 afx_msg void OnViewZoomIn();
166 afx_msg void OnViewZoomOut();
167 afx_msg void OnViewZoomNormal();
168 afx_msg void OnViewSplitVertically();
169 afx_msg void OnUpdateViewSplitVertically(CCmdUI* pCmdUI);
170 afx_msg void OnFirstdiff();
171 afx_msg void OnUpdateFirstdiff(CCmdUI* pCmdUI);
172 afx_msg void OnLastdiff();
173 afx_msg void OnUpdateLastdiff(CCmdUI* pCmdUI);
174 afx_msg void OnNextdiff();
175 afx_msg void OnUpdateNextdiff(CCmdUI* pCmdUI);
176 afx_msg void OnPrevdiff();
177 afx_msg void OnUpdatePrevdiff(CCmdUI* pCmdUI);
178 afx_msg void OnNextConflict();
179 afx_msg void OnUpdateNextConflict(CCmdUI* pCmdUI);
180 afx_msg void OnPrevConflict();
181 afx_msg void OnUpdatePrevConflict(CCmdUI* pCmdUI);
182 afx_msg void OnWebFitToWindow();
183 afx_msg void OnUpdateWebFitToWindow(CCmdUI* pCmdUI);
184 afx_msg void OnWebSize(UINT nID);
185 afx_msg void OnWebCompareScreenshots(UINT nID);
186 afx_msg void OnWebCompareHTMLs();
187 afx_msg void OnWebCompareTexts();
188 afx_msg void OnWebCompareResourceTrees();
189 afx_msg void OnWebClear(UINT nID);
190 //afx_msg void OnToolsGenerateReport();
191 afx_msg void OnRefresh();
192 afx_msg void OnSetFocus(CWnd *pNewWnd);
193 afx_msg void OnHelp();
194 afx_msg void OnBnClickedFitToWindow();
195 afx_msg void OnBnClickedCompare();
196 afx_msg void OnEnChangeWidth();
197 afx_msg void OnEnChangeHeight();
198 afx_msg void OnEnChangeZoom();
199 afx_msg void OnEnChangeUserAgent();
200 afx_msg void OnKillFocusBarControls();
201 afx_msg void OnDropDownCompare(NMHDR* pNMHDR, LRESULT* pResult);
203 DECLARE_MESSAGE_MAP()