-
Notifications
You must be signed in to change notification settings - Fork 1
/
FileWindow.h
255 lines (187 loc) · 7.95 KB
/
FileWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#if !defined(AFX_FILEWINDOW_H__EF837327_15B9_11D5_A6F1_0050CE184C9B__INCLUDED_)
#define AFX_FILEWINDOW_H__EF837327_15B9_11D5_A6F1_0050CE184C9B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <fstream.h>
#include "SizeCBar.h"
#define FILE_WINDOW_DIRECTORY 0x00
#define FILE_WINDOW_REMOTE 0x02
#define FILE_WINDOW_PROJECT 0x01
#define PROJECT_ITEM_PROJECT 0x00
#define PROJECT_ITEM_CATEGORY 0x01
#define PROJECT_ITEM_LOCAL_FILE 0x02
#define PROJECT_ITEM_REMOTE_FILE 0x03
typedef void (* CALLBACK_SELCHANGE)(INT);
typedef struct _PROJECTITEMINFO {
INT nItemType;
INT nFtpAccount;
CString szPathName;
LONG nFileSize;
} PROJECTITEMINFO, * LPPROJECTITEMINFO;
class CFileWindow : public CSizingControlBar
{
public: // Construction
CFileWindow();
virtual ~CFileWindow();
protected: // Resources & Controls
TBBUTTON m_tbiToolbarDirectory[10];
TBBUTTON m_tbiToolbarProject[10];
TBBUTTON m_tbiWinButtons[10];
CImageList m_imgToolbarDirectory;
CImageList m_imgToolbarProject;
CImageList m_imgWinButtons;
CToolBarCtrl m_btnToolbarDirectory;
CToolBarCtrl m_btnToolbarProject;
CToolBarCtrl m_btnWinButtons;
CImageList m_imgCategoryTab;
CImageList m_imgDirectoryTree;
CImageList m_imgProjectTree;
CFont m_fontControl;
CTabCtrl m_tabCategory;
CComboBox m_cmbLocalDrive;
CTreeCtrl m_treDirectoryTree;
CComboBox m_cmbFileFilter;
CComboBox m_cmbFtpAccount;
CTreeCtrl m_treRemoteTree;
CTreeCtrl m_treProjectTree;
BOOL m_bLabelEditing;
CString m_szPrevDriveName;
CStringArray m_arrFilterDescription, m_arrFilterExtensions;
CALLBACK_SELCHANGE m_fcnCallbackSelchangeFileFilter;
public:
INT GetActiveCategory();
void SetActiveCategory(INT nSelect);
protected:
void InitAllFileWindowControls();
void ResizeAllFileWindowControls(INT cx, INT cy);
void ShowProperFileWindowControls(INT nSelect);
void ShowOrHideCommonControls(INT nSelect);
void ShowOrHideDirectoryControls(INT nSelect);
void ShowOrHideRemoteControls(INT nSelect);
void ShowOrHideProjectControls(INT nSelect);
protected: // initialize directory image list
BOOL InitDirectoryImageList( CImageList & imglst );
public: // *** FileWindowDirectory.cpp ***
BOOL InitLocalDriveList(LPCTSTR lpszInitialDriveName);
BOOL InitFileFilterList(LPCTSTR lpszComposedFilter, INT nInitialFilter, CALLBACK_SELCHANGE fcnCallback = NULL);
BOOL GetBrowsingDirectory(CString & szDirectory);
BOOL SetBrowsingDirectory(LPCTSTR lpszDirectory);
BOOL IsSelectedDirectoryItemRoot();
CString GetSelectedDirectoryItemText();
BOOL OpenDirectoryItem();
BOOL ExecuteDirectoryItem();
BOOL ExploreDirectoryItem();
BOOL FindInDirectoryItem();
BOOL MoveDirectoryItem();
BOOL CopyDirectoryItem();
BOOL RenameDirectoryItem();
BOOL DeleteDirectoryItem();
BOOL SetWorkdirDirectoryItem();
BOOL RefreshDirectoryItem();
protected: // inner functions
BOOL SelectLocalDrive(LPCTSTR lpszDriveName);
CString GetActiveLocalDriveName();
INT GetActiveFileFilterIndex();
CString GetActiveFileFilterString();
BOOL DoesDirectoryHaveChildren(LPCTSTR lpszPath);
CString GetDirectoryItemPathName(HTREEITEM hItem);
BOOL RefreshDirectoryTree(LPCTSTR lpszPath);
BOOL AskDestinationDirectory(CString & szDirectory);
HTREEITEM GetSelectedDirectoryItem() { return m_treDirectoryTree.GetSelectedItem(); }
HTREEITEM GetClickedDirectoryItem();
HTREEITEM InsertDirectoryItem(HTREEITEM hParent, LPCTSTR lpszPath);
HTREEITEM RemoveChildDirectoryItems(HTREEITEM hParent);
HTREEITEM FindChildDirectoryItem(HTREEITEM hParent, LPCTSTR lpszText);
private:
void DisplayDirectoryDrive(LPCTSTR lpszDrive);
void DisplayDirectoryPath(HTREEITEM hParent, LPCTSTR lpszPath);
protected: // action functions
BOOL OpenDirectoryContextMenu(HTREEITEM hItem);
BOOL SetAsCurrentDirectory(HTREEITEM hItem);
BOOL SetAsWorkingDirectory(HTREEITEM hItem);
BOOL ShowDirectoryItemProperties(HTREEITEM hItem);
BOOL OpenDirectoryItem(HTREEITEM hItem);
BOOL ExecuteDirectoryItem(HTREEITEM hItem);
BOOL ExploreDirectoryItem(HTREEITEM hItem);
BOOL FindInDirectoryItem(HTREEITEM hItem);
BOOL MoveToDirectoryItem(HTREEITEM hItem, LPCTSTR lpszDestination);
BOOL CopyToDirectoryItem(HTREEITEM hItem, LPCTSTR lpszDestination);
BOOL RenameDirectoryItem(HTREEITEM hItem, LPCTSTR lpszNewName);
BOOL DeleteDirectoryItem(HTREEITEM hItem);
BOOL RefreshDirectoryItem(HTREEITEM hItem);
public: // *** FileWindowRemote.cpp ***
public: // *** FileWindowProject.cpp ***
BOOL InitProjectWorkspace();
BOOL NewProjectWorkspace(LPCTSTR lpszPathName);
BOOL SaveProjectWorkspace(LPCTSTR lpszPathName);
BOOL OpenProjectWorkspace(LPCTSTR lpszPathName);
BOOL SaveRegularWorkspace(LPCTSTR lpszPathName);
BOOL OpenRegularWorkspace(LPCTSTR lpszPathName);
BOOL AddCategoryToProject(LPCTSTR lpszCategory);
BOOL AddLocalFileToProject(LPCTSTR lpszPathName);
BOOL AddRemoteFileToProject(INT nAccount, LPCTSTR lpszPathName, DWORD dwSize);
BOOL OpenProjectItem();
BOOL ExecuteProjectItem();
BOOL RenameProjectItem();
BOOL RemoveProjectItem();
BOOL IsSelectedProjectItemRoot();
CString GetSelectedProjectItemText();
protected: // inner functions
BOOL SaveProjectItem(ostream & os, INT nLevel, HTREEITEM hItem);
BOOL LoadProjectItem(istream & is, TCHAR szText[], HTREEITEM hParent);
BOOL SaveWorkspaceItem(ostream & os, INT nLevel, CDocument * pDoc);
BOOL LoadWorkspaceItem(istream & is, TCHAR szText[], CWinApp * pApp);
BOOL ParseProjectItemAttr(LPCTSTR lpszText, CMapStringToString & mapAttr);
LPPROJECTITEMINFO GetProjectItemInfo(HTREEITEM hItem);
CString GetProjectItemPathName(HTREEITEM hItem);
HTREEITEM GetSelectedProjectItem() { return m_treProjectTree.GetSelectedItem(); }
HTREEITEM GetClickedProjectItem();
BOOL EnableAllProjectButtons(BOOL bEnable);
static INT CALLBACK CompareProjectItem(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
HTREEITEM InsertProjectItem(HTREEITEM hParent, LPCTSTR lpszText, INT nType, INT nAccount, LPCTSTR lpszPathName, LONG nSize);
HTREEITEM FindChildProjectItem(HTREEITEM hParent, LPCTSTR lpszText);
protected: // action functions
BOOL OpenProjectContextMenu(HTREEITEM hItem);
BOOL RemoveAllProjectItems();
BOOL OpenProjectItem(HTREEITEM hItem);
BOOL ExecuteProjectItem(HTREEITEM hItem);
BOOL RenameProjectItem(HTREEITEM hItem, LPCTSTR lpszNewName);
BOOL RemoveProjectItem(HTREEITEM hItem);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFileWindow)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Attributes
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFileWindow)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnSelchangeCategoryTab(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDropdownLocalDrive();
afx_msg void OnSelchangeLocalDrive();
afx_msg void OnSelchangeFileFilter();
afx_msg void OnItemexpandedDirectoryTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSelchangedDirectoryTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickDirectoryTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDblclkDirectoryTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclickDirectoryTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnBeginlabeleditDirectoryTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnEndlabeleditDirectoryTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickProjectTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDblclkProjectTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclickProjectTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnBeginlabeleditProjectTree(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnEndlabeleditProjectTree(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FILEWINDOW_H__EF837327_15B9_11D5_A6F1_0050CE184C9B__INCLUDED_)