Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / tools / leveldesign / master / ContinentPropertiesDlg.cpp
blobb77cc0313ed95df9db4deaf38cb419b4bfdd718c
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 // ContinentPropertiesDlg.cpp : implementation file
34 #include "stdafx.h"
35 #include "master.h"
36 #include "ContinentPropertiesDlg.h"
38 #ifdef _DEBUG
39 #define new DEBUG_NEW
40 #undef THIS_FILE
41 static char THIS_FILE[] = __FILE__;
42 #endif
44 /////////////////////////////////////////////////////////////////////////////
46 CContinentPropertiesDlg::CContinentPropertiesDlg (CWnd* pParent /*=NULL*/)
47 : CDialog(CContinentPropertiesDlg::IDD, pParent)
49 ContinentName = _T("");
50 LandFile = _T("");
51 LandDir = _T("");
52 LandBankFile = _T("");
53 LandFarBankFile = _T("");
54 LandTileNoiseDir = _T("");
55 LandZoneWDir = _T("");
56 OutIGDir = _T("");
57 DfnDir = _T("");
58 GameElemDir = _T("");
62 void CContinentPropertiesDlg::DoDataExchange(CDataExchange* pDX)
64 CDialog::DoDataExchange(pDX);
66 DDX_Text(pDX, IDC_EDIT_CONTINENT_NAME, ContinentName);
67 DDX_Text(pDX, IDC_EDIT_LANDFILE, LandFile);
68 DDX_Text(pDX, IDC_EDIT_LANDDIR, LandDir);
70 DDX_Text(pDX, IDC_LAND_BANK_FILE, LandBankFile);
71 DDX_Text(pDX, IDC_LAND_FAR_BANK_FILE, LandFarBankFile);
72 DDX_Text(pDX, IDC_LAND_TILE_NOISE_DIR, LandTileNoiseDir);
73 DDX_Text(pDX, IDC_OUT_LANDSCAPE_DIR, LandZoneWDir);
74 DDX_Text(pDX, IDC_OUT_VEGETABLE_DIR, OutIGDir);
76 DDX_Text(pDX, IDC_EDIT_DFNDIR, DfnDir);
77 DDX_Text(pDX, IDC_EDIT_GAMEELEMDIR, GameElemDir);
81 BEGIN_MESSAGE_MAP(CContinentPropertiesDlg, CDialog)
82 ON_COMMAND(IDC_BUTTON_LANDFILE, OnButtonLandFile)
83 ON_COMMAND(IDC_BUTTON_LANDDIR, OnButtonLandDir)
85 ON_COMMAND(IDC_EXPLORE_LAND_BANK_FILE, OnButtonLandBankFile)
86 ON_COMMAND(IDC_EXPLORE_LAND_FAR_BANK_FILE, OnButtonLandFarBankFile)
87 ON_COMMAND(IDC_EXPLORE_LAND_TILE_NOISE_DIR, OnButtonLandTileNoiseDir)
88 ON_COMMAND(IDC_EXPLORE_LANDSCAPE, OnButtonLandZoneW)
89 ON_COMMAND(IDC_EXPLORE_VEGETABLE, OnButtonOutIGDir)
91 ON_COMMAND(IDC_BUTTON_DFNDIR, OnButtonDfnDir)
92 ON_COMMAND(IDC_BUTTON_GAMEELEMDIR, OnButtonGameElemDir)
93 END_MESSAGE_MAP()
95 /////////////////////////////////////////////////////////////////////////////
97 BOOL CContinentPropertiesDlg::OnInitDialog()
99 CDialog::OnInitDialog();
101 // TODO: Add extra initialization here
102 GetDlgItem(IDC_EDIT_CONTINENT_NAME)->SetFocus();
104 UpdateData (FALSE); // Upload
106 return TRUE; // return TRUE unless you set the focus to a control
107 // EXCEPTION: OCX Property Pages should return FALSE
110 // ---------------------------------------------------------------------------
111 // This function serve to initiate the browsing dialog box to the good position in the tree
112 int CALLBACK cpdBrowseCallbackProc (HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
114 switch(uMsg)
116 case BFFM_INITIALIZED:
117 SendMessage (hwnd, BFFM_SETSELECTION, TRUE, pData);
118 break;
119 default:
120 break;
122 return 0;
125 // ---------------------------------------------------------------------------
126 void CContinentPropertiesDlg::OnButtonLandFile ()
128 CFileDialog dialog (true, "land", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Land (*.land)|*.land", this);
129 CString iniDir;
130 int k = LandFile.GetLength()-1;
131 while (k > 0)
133 if (LandFile[k] == '\\')
134 break;
135 --k;
137 for (int i = 0; i < k; ++i)
138 iniDir += LandFile[i];
139 dialog.m_ofn.lpstrInitialDir = iniDir;
140 if (dialog.DoModal() == IDOK)
142 LandFile = dialog.GetPathName ();
143 UpdateData (FALSE); // Upload
147 // ---------------------------------------------------------------------------
148 void CContinentPropertiesDlg::OnButtonLandDir ()
150 BROWSEINFO bi;
151 char str[MAX_PATH];
152 ITEMIDLIST* pidl;
153 char sTemp[1024];
155 bi.hwndOwner = this->m_hWnd;
156 bi.pidlRoot = NULL;
157 bi.pidlRoot = NULL;
158 bi.pszDisplayName = sTemp;;
159 bi.lpszTitle = "Choose the path for land stuff";
160 bi.ulFlags = 0;
161 bi.lpfn = cpdBrowseCallbackProc;
163 char sDir[512];
164 strcpy(sDir, (LPCSTR)LandDir);
165 bi.lParam = (LPARAM)sDir;
167 bi.iImage = 0;
168 pidl = SHBrowseForFolder (&bi);
169 if (!SHGetPathFromIDList(pidl, str))
171 return;
173 LandDir= str;
174 UpdateData (FALSE); // Upload
177 // ---------------------------------------------------------------------------
178 void CContinentPropertiesDlg::OnButtonDfnDir ()
180 BROWSEINFO bi;
181 char str[MAX_PATH];
182 ITEMIDLIST* pidl;
183 char sTemp[1024];
185 bi.hwndOwner = this->m_hWnd;
186 bi.pidlRoot = NULL;
187 bi.pidlRoot = NULL;
188 bi.pszDisplayName = sTemp;;
189 bi.lpszTitle = "Choose the path for DFN";
190 bi.ulFlags = 0;
191 bi.lpfn = cpdBrowseCallbackProc;
193 char sDir[512];
194 strcpy(sDir, (LPCSTR)DfnDir);
195 bi.lParam = (LPARAM)sDir;
197 bi.iImage = 0;
198 pidl = SHBrowseForFolder (&bi);
199 if (!SHGetPathFromIDList(pidl, str))
201 return;
203 DfnDir= str;
204 UpdateData (FALSE); // Upload
207 // ---------------------------------------------------------------------------
208 void CContinentPropertiesDlg::OnButtonGameElemDir()
210 BROWSEINFO bi;
211 char str[MAX_PATH];
212 ITEMIDLIST* pidl;
213 char sTemp[1024];
215 bi.hwndOwner = this->m_hWnd;
216 bi.pidlRoot = NULL;
217 bi.pidlRoot = NULL;
218 bi.pszDisplayName = sTemp;;
219 bi.lpszTitle = "Choose the path for GameElem";
220 bi.ulFlags = 0;
221 bi.lpfn = cpdBrowseCallbackProc;
223 char sDir[512];
224 strcpy(sDir, (LPCSTR)GameElemDir);
225 bi.lParam = (LPARAM)sDir;
227 bi.iImage = 0;
228 pidl = SHBrowseForFolder (&bi);
229 if (!SHGetPathFromIDList(pidl, str))
231 return;
233 GameElemDir = str;
234 UpdateData (FALSE); // Upload
238 void CContinentPropertiesDlg::OnButtonLandBankFile ()
240 CFileDialog dialog (true, "smallbank", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "smallbank (*.smallbank)|*.smallbank", this);
241 CString iniDir;
242 int k = LandBankFile.GetLength()-1;
243 while (k > 0)
245 if (LandBankFile[k] == '\\')
246 break;
247 --k;
249 for (int i = 0; i < k; ++i)
250 iniDir += LandBankFile[i];
251 dialog.m_ofn.lpstrInitialDir = iniDir;
252 if (dialog.DoModal() == IDOK)
254 LandBankFile = dialog.GetPathName ();
255 UpdateData (FALSE); // Upload
259 void CContinentPropertiesDlg::OnButtonLandFarBankFile ()
261 CFileDialog dialog (true, "farbank", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "farbank (*.farbank)|*.farbank", this);
262 CString iniDir;
263 int k = LandFarBankFile.GetLength()-1;
264 while (k > 0)
266 if (LandFarBankFile[k] == '\\')
267 break;
268 --k;
270 for (int i = 0; i < k; ++i)
271 iniDir += LandFarBankFile[i];
272 dialog.m_ofn.lpstrInitialDir = iniDir;
273 if (dialog.DoModal() == IDOK)
275 LandFarBankFile = dialog.GetPathName ();
276 UpdateData (FALSE); // Upload
280 void CContinentPropertiesDlg::OnButtonLandTileNoiseDir ()
282 BROWSEINFO bi;
283 char str[MAX_PATH];
284 ITEMIDLIST* pidl;
285 char sTemp[1024];
287 bi.hwndOwner = this->m_hWnd;
288 bi.pidlRoot = NULL;
289 bi.pidlRoot = NULL;
290 bi.pszDisplayName = sTemp;;
291 bi.lpszTitle = "Choose the path for Tile Noise";
292 bi.ulFlags = 0;
293 bi.lpfn = cpdBrowseCallbackProc;
295 char sDir[512];
296 strcpy(sDir, (LPCSTR)LandTileNoiseDir);
297 bi.lParam = (LPARAM)sDir;
299 bi.iImage = 0;
300 pidl = SHBrowseForFolder (&bi);
301 if (!SHGetPathFromIDList(pidl, str))
303 return;
305 LandTileNoiseDir = str;
306 UpdateData (FALSE); // Upload
309 void CContinentPropertiesDlg::OnButtonLandZoneW ()
311 BROWSEINFO bi;
312 char str[MAX_PATH];
313 ITEMIDLIST* pidl;
314 char sTemp[1024];
316 bi.hwndOwner = this->m_hWnd;
317 bi.pidlRoot = NULL;
318 bi.pidlRoot = NULL;
319 bi.pszDisplayName = sTemp;;
320 bi.lpszTitle = "Choose the path for ZoneW";
321 bi.ulFlags = 0;
322 bi.lpfn = cpdBrowseCallbackProc;
324 char sDir[512];
325 strcpy(sDir, (LPCSTR)LandZoneWDir);
326 bi.lParam = (LPARAM)sDir;
328 bi.iImage = 0;
329 pidl = SHBrowseForFolder (&bi);
330 if (!SHGetPathFromIDList(pidl, str))
332 return;
334 LandZoneWDir = str;
335 UpdateData (FALSE); // Upload
338 void CContinentPropertiesDlg::OnButtonOutIGDir ()
340 BROWSEINFO bi;
341 char str[MAX_PATH];
342 ITEMIDLIST* pidl;
343 char sTemp[1024];
345 bi.hwndOwner = this->m_hWnd;
346 bi.pidlRoot = NULL;
347 bi.pidlRoot = NULL;
348 bi.pszDisplayName = sTemp;;
349 bi.lpszTitle = "Choose the path for IG output";
350 bi.ulFlags = 0;
351 bi.lpfn = cpdBrowseCallbackProc;
353 char sDir[512];
354 strcpy(sDir, (LPCSTR)OutIGDir);
355 bi.lParam = (LPARAM)sDir;
357 bi.iImage = 0;
358 pidl = SHBrowseForFolder (&bi);
359 if (!SHGetPathFromIDList(pidl, str))
361 return;
363 OutIGDir = str;
364 UpdateData (FALSE); // Upload