1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef __MASTERTREE_H__
18 #define __MASTERTREE_H__
22 #endif // _MSC_VER > 1000
23 // MasterTree.h : header file
29 /////////////////////////////////////////////////////////////////////////////
31 #define MT_SORT_BY_NAME_INC 0
32 #define MT_SORT_BY_NAME_DEC 1
33 #define MT_SORT_BY_DATE_INC 2
34 #define MT_SORT_BY_DATE_DEC 3
36 /////////////////////////////////////////////////////////////////////////////
37 // CMasterTree Control
38 /////////////////////////////////////////////////////////////////////////////
40 class CMasterTree
: public CTreeCtrl
46 HTREEITEM _LastItemSelected
;
47 HTREEITEM _LastActiveContinent
;
56 afx_msg
void OnTimer(UINT nIDEvent
);
57 afx_msg
void OnLBeginDrag (NMHDR
* pNMHDR
, LRESULT
* pResult
);
59 afx_msg
void OnMouseMove (UINT nFlags
, CPoint point
);
60 afx_msg
void OnLButtonDown (UINT nFlags
, CPoint point
);
61 afx_msg
void OnLButtonUp (UINT nFlags
, CPoint point
);
62 afx_msg
void OnLButtonDblClk (UINT nFlags
, CPoint point
);
64 afx_msg
void OnRButtonDown (UINT nFlags
, CPoint point
);
67 // Continent menus (a level under the root)
69 afx_msg
void OnMenuNewContinent ();
71 afx_msg
void OnMenuContinentOpen ();
72 afx_msg
void OnMenuContinentProperties ();
73 afx_msg
void OnMenuContinentNewRegion ();
74 afx_msg
void OnMenuContinentDelete ();
76 // Regions menus (a level under the continent)
78 afx_msg
void OnMenuRegionOpen ();
79 afx_msg
void OnMenuRegionRename ();
80 afx_msg
void OnMenuRegionNewSubRegion ();
81 afx_msg
void OnMenuRegionNewPrim ();
82 afx_msg
void OnMenuRegionNewGeorges ();
83 afx_msg
void OnMenuRegionDelete ();
85 // File menus (a level under the Region)
87 afx_msg
void OnMenuFileOpen ();
88 afx_msg
void OnMenuFileRename ();
89 afx_msg
void OnMenuFileDelete ();
91 std::string
getCurrentPath ();
98 std::string
getPath (HTREEITEM ht
);
99 HTREEITEM
getContinent (HTREEITEM ht
);
100 HTREEITEM
getRegion (HTREEITEM ht
);
101 bool isFile (HTREEITEM ht
);
105 /////////////////////////////////////////////////////////////////////////////
106 // CMasterTreeDlg Dialog
107 /////////////////////////////////////////////////////////////////////////////
109 class CMasterTreeDlg
: public CDialog
112 std::map
<HTREEITEM
,std::string
> _Files
;
114 char ContinentSortBy
; // 0/1 - Sort by name increasing(z-a)/decreasing(a-z)
115 char TrashSortBy
; // 2/3 - Sort by date increasing(new-old)/decreasing(old-new)
120 void parseAdd (HTREEITEM itRoot
, const std::string
&path
, char nSortType
, int DirDepth
= 0);
124 CMasterTreeDlg(); // standard constructor
126 HTREEITEM
activate (const std::string
& EltName
, HTREEITEM parent
);
127 void update (const std::string
& ContinentsPath
);
129 void openFile (const std::string
&fname
);
130 void openDir (const std::string
&fname
);
132 void continentNew ();
133 void sortContinentBy (int mt_sort_type
);
137 void continentDelete (const std::string
&Continent
);
138 void continentProperties (const std::string
&Continent
);
139 void continentNewRegion (const std::string
&Continent
);
140 void continentOpen (const std::string
&Continent
);
144 void regionOpen (const std::string
&path
);
145 void regionRename (const std::string
&path
);
146 void regionNewPrim (const std::string
&path
);
147 void regionNewGeorges (const std::string
&path
);
148 void regionNewSubRegion (const std::string
&path
);
149 void regionDelete (const std::string
&path
);
153 void fileOpen (const std::string
&sFileFullName
);
154 void fileRename (const std::string
&sFileFullName
);
155 void fileDelete (const std::string
&sFileFullName
);
157 void copy (const std::string
&pathSrc
, const std::string
&pathDst
);
159 enum { IDD
= IDD_MASTERTREE
};
162 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
168 BOOL
OnInitDialog ();
172 afx_msg
void OnSize (UINT nType
, int cx
, int cy
);
173 afx_msg
void OnExpanding (LPNMHDR pnmhdr
, LRESULT
*pLResult
);
174 afx_msg
void OnLDblClkTree(NMHDR
* pNMHDR
, LRESULT
* pResult
);
175 DECLARE_MESSAGE_MAP()
179 friend class CMasterTree
;
182 #endif // __MASTERTREE_H__