OSDN Git Service

Make it possible to specify the file type in the "Select Files or Folders" window.
[winmerge-jp/winmerge-jp.git] / Src / OpenView.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  OpenView.h
8  *
9  * @brief Declaration file for COpenView window
10  *
11  */
12
13 #pragma once
14
15 /////////////////////////////////////////////////////////////////////////////
16 // COpenView window
17 #include "SuperComboBox.h"
18 #include "FileTransform.h"
19 #include "PathContext.h"
20 #include "CMoveConstraint.h"
21 #include "TrDialogs.h"
22 #include <array>
23
24 class ProjectFile;
25 class COpenDoc;
26 class DropHandler;
27
28 /**
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).
36  */
37 class COpenView : public CFormView, public DlgUtils<COpenView>
38 {
39 protected: // create from serialization only
40         COpenView();
41         DECLARE_DYNCREATE(COpenView)
42
43 public:
44 // Dialog Data
45         //{{AFX_DATA(COpenView)
46         enum { IDD = IDD_OPEN };
47         CSuperComboBox  m_ctlExt;
48         CSuperComboBox  m_ctlPath[3];
49         String m_strPath[3];
50         bool m_bReadOnly[3];
51         PathContext m_files;
52         bool    m_bRecurse;
53         String  m_strExt;
54         String  m_strUnpacker;
55         //}}AFX_DATA
56
57 // other public data
58         /// unpacker info
59         std::array<DWORD, 3> m_dwFlags;
60         PackingInfo m_infoHandler;
61
62 // Attributes
63 public:
64         COpenDoc* GetDocument() const;
65
66 // Operations
67 public:
68         void UpdateButtonStates();
69         void UpdateResources();
70
71 // Implementation data
72 private:
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 */
76         CSize m_sizeOrig;
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;
83         int m_retryCount;
84 // Overrides
85         public:
86 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
87 protected:
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);
91
92 // Implementation
93 public:
94         virtual ~COpenView();
95
96 protected:
97         void SetStatus(UINT msgID);
98         void SetUnpackerStatus(UINT msgID);
99         bool LoadProjectFile(const String &path);
100         void TerminateThreadIfRunning();
101         void TrimPaths();
102         void LoadComboboxStates();
103         void SaveComboboxStates();
104         String AskProjectFileName(bool bOpen);
105         void DropDown(NMHDR *pNMHDR, LRESULT *pResult, UINT nID, UINT nPopupID);
106
107 // Generated message map functions
108 protected:
109         //{{AFX_MSG(COpenView)
110         afx_msg void OnPathButton(UINT nID);
111         afx_msg void OnOK();
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();
145         //}}AFX_MSG
146         DECLARE_MESSAGE_MAP()
147 };
148
149 #ifndef _DEBUG  // debug version in OpenView.cpp
150 inline COpenDoc* COpenView::GetDocument() const
151    { return reinterpret_cast<COpenDoc*>(m_pDocument); }
152 #endif
153