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 // ContinentPropertiesDlg.cpp : implementation file
36 #include "ContinentPropertiesDlg.h"
41 static char THIS_FILE
[] = __FILE__
;
44 /////////////////////////////////////////////////////////////////////////////
46 CContinentPropertiesDlg::CContinentPropertiesDlg (CWnd
* pParent
/*=NULL*/)
47 : CDialog(CContinentPropertiesDlg::IDD
, pParent
)
49 ContinentName
= _T("");
52 LandBankFile
= _T("");
53 LandFarBankFile
= _T("");
54 LandTileNoiseDir
= _T("");
55 LandZoneWDir
= _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
)
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
)
116 case BFFM_INITIALIZED
:
117 SendMessage (hwnd
, BFFM_SETSELECTION
, TRUE
, pData
);
125 // ---------------------------------------------------------------------------
126 void CContinentPropertiesDlg::OnButtonLandFile ()
128 CFileDialog
dialog (true, "land", NULL
, OFN_HIDEREADONLY
|OFN_OVERWRITEPROMPT
, "Land (*.land)|*.land", this);
130 int k
= LandFile
.GetLength()-1;
133 if (LandFile
[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 ()
155 bi
.hwndOwner
= this->m_hWnd
;
158 bi
.pszDisplayName
= sTemp
;;
159 bi
.lpszTitle
= "Choose the path for land stuff";
161 bi
.lpfn
= cpdBrowseCallbackProc
;
164 strcpy(sDir
, (LPCSTR
)LandDir
);
165 bi
.lParam
= (LPARAM
)sDir
;
168 pidl
= SHBrowseForFolder (&bi
);
169 if (!SHGetPathFromIDList(pidl
, str
))
174 UpdateData (FALSE
); // Upload
177 // ---------------------------------------------------------------------------
178 void CContinentPropertiesDlg::OnButtonDfnDir ()
185 bi
.hwndOwner
= this->m_hWnd
;
188 bi
.pszDisplayName
= sTemp
;;
189 bi
.lpszTitle
= "Choose the path for DFN";
191 bi
.lpfn
= cpdBrowseCallbackProc
;
194 strcpy(sDir
, (LPCSTR
)DfnDir
);
195 bi
.lParam
= (LPARAM
)sDir
;
198 pidl
= SHBrowseForFolder (&bi
);
199 if (!SHGetPathFromIDList(pidl
, str
))
204 UpdateData (FALSE
); // Upload
207 // ---------------------------------------------------------------------------
208 void CContinentPropertiesDlg::OnButtonGameElemDir()
215 bi
.hwndOwner
= this->m_hWnd
;
218 bi
.pszDisplayName
= sTemp
;;
219 bi
.lpszTitle
= "Choose the path for GameElem";
221 bi
.lpfn
= cpdBrowseCallbackProc
;
224 strcpy(sDir
, (LPCSTR
)GameElemDir
);
225 bi
.lParam
= (LPARAM
)sDir
;
228 pidl
= SHBrowseForFolder (&bi
);
229 if (!SHGetPathFromIDList(pidl
, str
))
234 UpdateData (FALSE
); // Upload
238 void CContinentPropertiesDlg::OnButtonLandBankFile ()
240 CFileDialog
dialog (true, "smallbank", NULL
, OFN_HIDEREADONLY
|OFN_OVERWRITEPROMPT
, "smallbank (*.smallbank)|*.smallbank", this);
242 int k
= LandBankFile
.GetLength()-1;
245 if (LandBankFile
[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);
263 int k
= LandFarBankFile
.GetLength()-1;
266 if (LandFarBankFile
[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 ()
287 bi
.hwndOwner
= this->m_hWnd
;
290 bi
.pszDisplayName
= sTemp
;;
291 bi
.lpszTitle
= "Choose the path for Tile Noise";
293 bi
.lpfn
= cpdBrowseCallbackProc
;
296 strcpy(sDir
, (LPCSTR
)LandTileNoiseDir
);
297 bi
.lParam
= (LPARAM
)sDir
;
300 pidl
= SHBrowseForFolder (&bi
);
301 if (!SHGetPathFromIDList(pidl
, str
))
305 LandTileNoiseDir
= str
;
306 UpdateData (FALSE
); // Upload
309 void CContinentPropertiesDlg::OnButtonLandZoneW ()
316 bi
.hwndOwner
= this->m_hWnd
;
319 bi
.pszDisplayName
= sTemp
;;
320 bi
.lpszTitle
= "Choose the path for ZoneW";
322 bi
.lpfn
= cpdBrowseCallbackProc
;
325 strcpy(sDir
, (LPCSTR
)LandZoneWDir
);
326 bi
.lParam
= (LPARAM
)sDir
;
329 pidl
= SHBrowseForFolder (&bi
);
330 if (!SHGetPathFromIDList(pidl
, str
))
335 UpdateData (FALSE
); // Upload
338 void CContinentPropertiesDlg::OnButtonOutIGDir ()
345 bi
.hwndOwner
= this->m_hWnd
;
348 bi
.pszDisplayName
= sTemp
;;
349 bi
.lpszTitle
= "Choose the path for IG output";
351 bi
.lpfn
= cpdBrowseCallbackProc
;
354 strcpy(sDir
, (LPCSTR
)OutIGDir
);
355 bi
.lParam
= (LPARAM
)sDir
;
358 pidl
= SHBrowseForFolder (&bi
);
359 if (!SHGetPathFromIDList(pidl
, str
))
364 UpdateData (FALSE
); // Upload