Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / tools / leveldesign / master / MasterTree.h
blobadfbedeb0e473b3e2acfaa18d1dfa61a41374a02
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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__
20 #if _MSC_VER > 1000
21 #pragma once
22 #endif // _MSC_VER > 1000
23 // MasterTree.h : header file
26 #include <string>
27 #include <map>
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
43 bool _LDrag;
44 CImageList *_DragImg;
45 HTREEITEM _DragItem;
46 HTREEITEM _LastItemSelected;
47 HTREEITEM _LastActiveContinent;
49 UINT m_nTimerID;
50 UINT m_timerticks;
52 public:
54 CMasterTree ();
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 ();
93 DECLARE_MESSAGE_MAP()
95 private:
97 // TOOLS
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
111 CMasterTree *_Tree;
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)
116 char BackupSortBy;
118 private:
120 void parseAdd (HTREEITEM itRoot, const std::string &path, char nSortType, int DirDepth = 0);
122 public:
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);
135 // Continent byPass
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);
142 // Region byPass
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);
151 // File byPass
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 };
161 protected:
162 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
165 // Implementation
166 protected:
168 BOOL OnInitDialog ();
169 void OnCancel ();
170 void OnOK ();
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()
177 // Friends
179 friend class CMasterTree;
182 #endif // __MASTERTREE_H__