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 file for COpenView window
15 /////////////////////////////////////////////////////////////////////////////
17 #include "SuperComboBox.h"
18 #include "FileTransform.h"
19 #include "PathContext.h"
20 #include "CMoveConstraint.h"
21 #include "TrDialogs.h"
29 * @brief The Open-View class.
30 * The Open-View allows user to select paths to compare. In addition to
31 * the two paths, there are controls for selecting filter and unpacker plugin.
32 * If one of the paths is a project file, that project file is loaded,
33 * overwriting possible other values in other dialog controls.
34 * The dialog shows also a status of the selected paths (found/not found),
35 * if enabled in the options (enabled by default).
37 class COpenView : public CFormView, public DlgUtils<COpenView>
39 protected: // create from serialization only
41 DECLARE_DYNCREATE(COpenView)
45 //{{AFX_DATA(COpenView)
46 enum { IDD = IDD_OPEN };
47 CSuperComboBox m_ctlExt;
48 CSuperComboBox m_ctlPath[3];
59 std::array<DWORD, 3> m_dwFlags;
60 PackingInfo m_infoHandler;
64 COpenDoc* GetDocument() const;
68 void UpdateButtonStates();
69 void UpdateResources();
71 // Implementation data
73 String m_strBrowsePath[3]; /**< Left/middle/right path from browse dialog. */
74 CWinThread *m_pUpdateButtonStatusThread;
75 ATL::CImage m_image; /**< Image loader/viewer for logo image */
77 prdlg::CMoveConstraint m_constraint;
78 CFont m_fontSwapButton;
79 HICON const m_hIconRotate;
80 HCURSOR const m_hCursorNo;
81 std::array<bool, 3> m_bAutoCompleteReady;
82 DropHandler *m_pDropHandler;
86 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
88 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
89 virtual void OnInitialUpdate(); // called first time after construct
90 virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
97 void SetStatus(UINT msgID);
98 void SetUnpackerStatus(UINT msgID);
99 bool LoadProjectFile(const String &path);
100 void TerminateThreadIfRunning();
102 void LoadComboboxStates();
103 void SaveComboboxStates();
104 String AskProjectFileName(bool bOpen);
105 void DropDown(NMHDR *pNMHDR, LRESULT *pResult, UINT nID, UINT nPopupID);
107 // Generated message map functions
109 //{{AFX_MSG(COpenView)
110 afx_msg void OnPathButton(UINT nID);
112 afx_msg void OnCancel();
113 afx_msg void OnCompare(UINT nID);
114 afx_msg void OnUpdateCompare(CCmdUI *pCmdUI);
115 afx_msg void OnLoadProject();
116 afx_msg void OnSaveProject();
117 template<UINT id, UINT popupid>
118 afx_msg void OnDropDown(NMHDR *pNMHDR, LRESULT *pResult);
119 afx_msg void OnDropDownOptions(NMHDR *pNMHDR, LRESULT *pResult);
120 afx_msg void OnSelchangePathCombo(UINT nID);
121 afx_msg void OnSetfocusPathCombo(UINT id, NMHDR *pNMHDR, LRESULT *pResult);
122 afx_msg void OnDragBeginPathCombo(UINT id, NMHDR *pNMHDR, LRESULT *pResult);
123 afx_msg void OnSwapButton(int id1, int id2);
124 template<int id1, int id2>
125 afx_msg void OnSwapButton();
126 afx_msg void OnEditEvent(UINT nID);
127 afx_msg void OnTimer(UINT_PTR nIDEvent);
128 afx_msg void OnSelectUnpacker();
129 afx_msg void OnSelectFilter();
130 afx_msg void OnOptions();
131 afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
132 afx_msg void OnEditAction(int msg, WPARAM wParam, LPARAM LPARAM);
133 template <int MSG, int WPARAM = 0, int LPARAM = 0>
134 afx_msg void OnEditAction();
135 afx_msg void OnHelp();
136 afx_msg void OnDropFiles(const std::vector<String>& files);
137 afx_msg LRESULT OnUpdateStatus(WPARAM wParam, LPARAM lParam);
138 afx_msg void OnPaint();
139 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
140 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
141 afx_msg LRESULT OnNcHitTest(CPoint point);
142 afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
143 afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
144 afx_msg void OnDestroy();
146 DECLARE_MESSAGE_MAP()
149 #ifndef _DEBUG // debug version in OpenView.cpp
150 inline COpenDoc* COpenView::GetDocument() const
151 { return reinterpret_cast<COpenDoc*>(m_pDocument); }