Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / tools / leveldesign / master / MainFrm.h
blob72a9becaadf3cefe36ef999c09d98708659d85ed
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 // ---------------------------------------------------------------------------
18 // MainFrm.h : interface of the CMainFrame class
19 // ---------------------------------------------------------------------------
21 #if !defined(AFX_MAINFRM_H__D9ABC57D_9514_49B1_A65F_1CC64C6D6BB6__INCLUDED_)
22 #define AFX_MAINFRM_H__D9ABC57D_9514_49B1_A65F_1CC64C6D6BB6__INCLUDED_
24 #if _MSC_VER > 1000
25 #pragma once
26 #endif // _MSC_VER > 1000
28 // ---------------------------------------------------------------------------
30 #include "nel/misc/stream.h"
31 #include "nel/misc/file.h"
32 #include "MasterTree.h"
33 #include <string>
35 #include "../export/export.h"
37 #include "../../3d/ligo/worldeditor/worldeditor_interface.h" // MasterCB
39 #include "easy_cfg.h"
41 // ---------------------------------------------------------------------------
42 // Interface to the tools
43 // ---------------------------------------------------------------------------
45 class IWorldEditor;
46 class IGeorges;
47 class ILogicEditor;
48 class CMainFrame;
49 class CExportCBDlg;
50 // ---------------------------------------------------------------------------
52 // Do not parse following directories
53 #define MAX_SYS_DIR 7
54 extern char *gSysDir[MAX_SYS_DIR];
55 // Do not display files with those extensions
56 #define MAX_INVALID_EXT 1
57 extern char *gInvalidExt[MAX_INVALID_EXT];
59 // ---------------------------------------------------------------------------
61 struct SEnvironnement : public IEasyCFG
63 // Master params
64 sint32 MasterX, MasterY;
65 sint32 MasterTreeX, MasterTreeY;
66 sint32 MasterTreeCX, MasterTreeCY;
67 bool MasterTreeLocked;
68 std::string ContinentsDir;
69 std::string DefaultDFNDir;
70 std::string DefaultGameElemDir;
72 // WorldEditor params
73 bool WorldEdOpened;
74 sint32 WorldEdX, WorldEdY, WorldEdCX, WorldEdCY;
76 // Georges params
77 bool GeorgesOpened;
78 sint32 GeorgesX, GeorgesY, GeorgesCX, GeorgesCY;
80 // LogicEditor params
81 bool LogicEditorOpened;
82 sint32 LogicEditorX, LogicEditorY, LogicEditorCX, LogicEditorCY;
84 // Export params
85 SExportOptions ExportOptions;
87 SEnvironnement ();
89 bool load (const std::string &filename);
90 bool save (const std::string &filename);
94 // ---------------------------------------------------------------------------
96 class CMasterCB : public IMasterCB
98 CMainFrame *_MainFrame;
99 std::vector<std::string> _PrimZoneList;
100 std::string _Text;
101 std::vector<std::string> _GroupPrimList;
103 public:
105 CMasterCB ();
106 void setMainFrame (CMainFrame*pMF); // Link to master
108 // Accessors
109 std::vector<std::string> &getAllPrimZoneNames ();
111 // Overridables
112 // setAllPrimZoneNames : called when the list of patatoid changes
113 virtual void setAllPrimZoneNames (std::vector<std::string> &primZoneList);
114 // transfert : called when WE want to transfert text to georges
115 virtual void multiTransfert (const std::vector<std::string> &vText, bool append);
116 virtual void transfert (const std::string &sText);
117 // Selection line up and down
118 virtual void lineUp ();
119 virtual void lineDown ();
122 // ---------------------------------------------------------------------------
124 class CMainFrame : public CFrameWnd
126 SEnvironnement _Environnement;
128 IWorldEditor *_WorldEditor;
129 HMODULE _WorldEditorModule;
131 IGeorges *_Georges;
132 HMODULE _GeorgesModule;
134 ILogicEditor *_LogicEditor;
135 HMODULE _LogicEditorModule;
137 CMasterTreeDlg *_Tree;
139 std::string _ActivePath;
140 CMasterCB _MasterCB;
142 std::string _MasterExeDir;
144 CExport *_Export;
145 CExportCBDlg *_ExportCBDlg;
147 public:
149 CMainFrame ();
150 virtual ~CMainFrame ();
152 void getAllInterfaces (); // Load all dlls and get tools interfaces
153 void releaseAllInterfaces ();
155 void openFile (const std::string &fname);
156 void openDir (const std::string &fname);
157 void openDirParse (const std::string &sBaseName, const std::string &sRelativeName);
159 void openContinentCfgFile (const std::string &filename);
161 // ***********
162 // WORLDEDITOR
163 // ***********
165 void openWorldEditor ();
166 void openWorldEditorFile (const std::string &fileName);
167 void closeWorldEditor ();
169 // *******
170 // GEORGES
171 // *******
173 void openGeorges ();
174 void openGeorgesFile (const std::string &fileName);
175 void closeGeorges ();
177 void georgesSetPathesFromActive (); // Set Path from _ActiveContinent/_ActiveWorld/etc...
178 void georgesPutGroupText (const std::vector<std::string> &vText, bool append);
179 void georgesPutText (const std::string &sText);
180 void georgesLineUp ();
181 void georgesLineDown ();
182 void georgesCreatePlantName ();
184 // ***********
185 // LOGICEDITOR
186 // ***********
188 void openLogicEditor ();
189 void openLogicEditorFile (const std::string &fileName);
190 void closeLogicEditor ();
192 // *****
193 // TOOLS
194 // *****
196 // Tree and directories manipulation
198 bool createDirIfNotExist (const std::string& dirName, const std::string& errorMsg);
199 void deltree (const std::string &dirName);
200 void copytree (const std::string &srcDir, const std::string &dstDir);
201 void displayLastErrorDialog ();
202 void updateTree ();
204 // Continent methods
205 // -----------------
207 void continentNew ();
209 void continentOpen (const std::string &contName);
210 void continentProperties (const std::string &contName);
211 void continentNewRegion (const std::string &contName);
212 void continentDelete (const std::string &contName);
214 // Active path
215 void setActivePath (const std::string &contName);
216 std::string getActivePath () { return _ActivePath; }
218 // Region methods
219 // --------------
221 void regionOpen (const std::string &path);
222 void regionRename (const std::string &path);
223 void regionNewPrim (const std::string &path);
224 void regionNewGeorges (const std::string &path);
225 void regionNewSubRegion (const std::string &path);
226 void regionDelete (const std::string &path);
228 // File methods
229 // ------------
231 void fileOpen (const std::string &sFileFullName);
232 void fileRename (const std::string &sFileFullName);
233 void fileDelete (const std::string &sFileFullName);
235 void copy (const std::string &sPathSrc, const std::string &sPathDst);
237 #ifdef _DEBUG
238 virtual void AssertValid () const;
239 virtual void Dump (CDumpContext& dc) const;
240 #endif
242 virtual BOOL PreCreateWindow (CREATESTRUCT& cs);
243 virtual BOOL PreTranslateMessage (MSG*pMsg);
245 protected:
247 afx_msg void OnSize (UINT nType, int cx, int cy);
248 afx_msg void OnMove (int x, int y);
249 afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct);
250 afx_msg BOOL OnEraseBkgnd (CDC* pDC);
252 protected:
254 // Menu methods
256 afx_msg void onContinentSave ();
257 afx_msg void onContinentExport ();
259 afx_msg void OnContinentDelete ();
261 afx_msg void onOptionsTreeLock ();
262 afx_msg void onOptionsSetContinentsDir ();
263 afx_msg void onOptionsSetDefaultDFNDir ();
264 afx_msg void onOptionsSetDefaultGameElemDir ();
267 afx_msg void onWindowsWorldEditor ();
268 afx_msg void onWindowsGeorges ();
269 afx_msg void onWindowsLogicEditor ();
270 afx_msg void onWindowsReset ();
272 afx_msg void OnClose ();
273 // NOTE - the ClassWizard will add and remove member functions here.
274 // DO NOT EDIT what you see in these blocks of generated code!
275 //}}AFX_MSG
276 DECLARE_MESSAGE_MAP()
281 /////////////////////////////////////////////////////////////////////////////
283 //{{AFX_INSERT_LOCATION}}
284 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
286 #endif // !defined(AFX_MAINFRM_H__D9ABC57D_9514_49B1_A65F_1CC64C6D6BB6__INCLUDED_)