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 // ExportDlg.cpp : implementation file
22 #include "ExportDlg.h"
30 static char THIS_FILE
[] = __FILE__
;
35 /////////////////////////////////////////////////////////////////////////////
39 // ---------------------------------------------------------------------------
40 CExportDlg::CExportDlg(CWnd
* pParent
/*=NULL*/)
41 : CDialog(CExportDlg::IDD
, pParent
)
43 //{{AFX_DATA_INIT(CExportDlg)
44 //GenerateLandscape = FALSE;
45 //GenerateVegetable = FALSE;
46 /* OutLandscapeDir = _T("");
48 ContinentName
= _T("");
49 /*LandBankFile = _T("");
50 LandFarBankFile = _T("");*/
53 //LandTileNoiseDir = _T("");
57 // ---------------------------------------------------------------------------
58 void CExportDlg::setOptions (SExportOptions
&options
, vector
<string
> ®Names
)
61 _Continents
= ®Names
;
64 // ---------------------------------------------------------------------------
65 void CExportDlg::DoDataExchange(CDataExchange
* pDX
)
67 CDialog::DoDataExchange(pDX
);
68 //{{AFX_DATA_MAP(CExportDlg)
69 DDX_Control(pDX
, IDC_CONTINENTLIST
, ContinentList
);
70 //DDX_Check(pDX, IDC_GENERATE_VEGETABLE, GenerateVegetable);
71 //DDX_Text(pDX, IDC_OUT_LANDSCAPE_DIR, OutLandscapeDir);
72 //DDX_Text(pDX, IDC_OUT_VEGETABLE_DIR, OutIGDir);
73 DDX_CBString(pDX
, IDC_CONTINENTLIST
, ContinentName
);
74 //DDX_Text(pDX, IDC_LAND_BANK_FILE, LandBankFile);
75 //DDX_Text(pDX, IDC_LAND_FAR_BANK_FILE, LandFarBankFile);
76 //DDX_Text(pDX, IDC_LAND_TILE_NOISE_DIR, LandTileNoiseDir);
81 /////////////////////////////////////////////////////////////////////////////
82 BEGIN_MESSAGE_MAP(CExportDlg
, CDialog
)
83 //{{AFX_MSG_MAP(CExportDlg)
84 /* ON_BN_CLICKED(IDC_EXPLORE_LANDSCAPE, OnExploreOutLandscapeDir)
85 ON_BN_CLICKED(IDC_EXPLORE_VEGETABLE, OnExploreOutIGDir)
86 ON_BN_CLICKED(IDC_EXPLORE_LAND_BANK_FILE, OnExploreLandSmallBankFile)
87 ON_BN_CLICKED(IDC_EXPLORE_LAND_FAR_BANK_FILE, OnExploreLandFarBankFile)
88 ON_BN_CLICKED(IDC_EXPLORE_LAND_TILE_NOISE_DIR, OnExploreLandTileNoiseDir)*/
92 /////////////////////////////////////////////////////////////////////////////
93 // CExportDlg message handlers
95 // ---------------------------------------------------------------------------
96 BOOL
CExportDlg::OnInitDialog ()
98 CDialog::OnInitDialog ();
100 // TODO: Add extra initialization here
101 // OutLandscapeDir = _Options->InLandscapeDir.c_str();
102 // OutIGDir = _Options->OutIGDir.c_str ();
103 // LandBankFile = _Options->LandBankFile.c_str ();
104 // LandFarBankFile = _Options->LandFarBankFile.c_str ();
105 // LandTileNoiseDir = _Options->LandTileNoiseDir.c_str ();
106 for (uint32 i
=0; i
< _Continents
->size(); ++i
)
108 ContinentList
.InsertString (-1, (_Continents
->operator[](i
)).c_str());
110 ContinentName
= _Options
->PrimFloraDir
.c_str ();
111 sint32 si
= _Options
->PrimFloraDir
.size()-1;
114 if (_Options
->PrimFloraDir
[si
] == '\\')
122 for (;si
< (sint32
)_Options
->PrimFloraDir
.size(); ++si
)
123 ContinentName
+= _Options
->PrimFloraDir
[si
];
125 UpdateData (FALSE
); // Upload
127 if (ContinentName
== "")
128 ContinentList
.SetCurSel (0);
130 return TRUE
; // return TRUE unless you set the focus to a control
131 // EXCEPTION: OCX Property Pages should return FALSE
134 // ---------------------------------------------------------------------------
135 void CExportDlg::OnOK ()
137 UpdateData (TRUE
); // Download
139 _Options
->PrimFloraDir
= (LPCSTR
)ContinentName
;
140 // _Options->OutIGDir = (LPCSTR)OutIGDir;
141 // _Options->LandBankFile = (LPCSTR)LandBankFile;
142 // _Options->LandFarBankFile = (LPCSTR)LandFarBankFile;
143 // _Options->PrimFloraDir = (LPCSTR)ContinentName;
144 // _Options->LandTileNoiseDir = (LPCSTR)LandTileNoiseDir;
145 // _Options->InLandscapeDir = (LPCSTR)OutLandscapeDir;
149 // ---------------------------------------------------------------------------
150 int CALLBACK expBrowseCallbackProc (HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
154 case BFFM_INITIALIZED:
155 SendMessage (hwnd, BFFM_SETSELECTION, TRUE, pData);
163 // ---------------------------------------------------------------------------
164 void CExportDlg::OnExploreOutLandscapeDir ()
171 bi.hwndOwner = this->m_hWnd;
174 bi.pszDisplayName = sTemp;;
175 bi.lpszTitle = "Choose the path";
177 bi.lpfn = expBrowseCallbackProc;
178 bi.lParam = (LPARAM)(LPCSTR)OutLandscapeDir;
180 pidl = SHBrowseForFolder (&bi);
181 if (!SHGetPathFromIDList(pidl, str))
185 OutLandscapeDir = str;
186 UpdateData (FALSE); // Upload
189 // ---------------------------------------------------------------------------
190 void CExportDlg::OnExploreOutIGDir()
197 bi.hwndOwner = this->m_hWnd;
200 bi.pszDisplayName = sTemp;;
201 bi.lpszTitle = "Choose the path";
203 bi.lpfn = expBrowseCallbackProc;
204 bi.lParam = (LPARAM)(LPCSTR)OutIGDir;
206 pidl = SHBrowseForFolder (&bi);
207 if (!SHGetPathFromIDList(pidl, str))
212 UpdateData (FALSE); // Upload
215 // ---------------------------------------------------------------------------
216 void CExportDlg::OnExploreLandSmallBankFile()
218 CFileDialog dialog (true, "smallbank", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "SmallBank (*.smallbank)|*.smallbank", this);
219 if (dialog.DoModal() == IDOK)
221 LandBankFile = dialog.GetPathName ();
223 UpdateData (FALSE); // Upload
226 // ---------------------------------------------------------------------------
227 void CExportDlg::OnExploreLandFarBankFile()
229 CFileDialog dialog (true, "farbank", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "FarBank (*.farbank)|*.farbank", this);
230 if (dialog.DoModal() == IDOK)
232 LandFarBankFile = dialog.GetPathName();
234 UpdateData (FALSE); // Upload
237 // ---------------------------------------------------------------------------
238 void CExportDlg::OnExploreLandTileNoiseDir()
245 bi.hwndOwner = this->m_hWnd;
248 bi.pszDisplayName = sTemp;;
249 bi.lpszTitle = "Choose the path";
251 bi.lpfn = expBrowseCallbackProc;
252 bi.lParam = (LPARAM)(LPCSTR)LandTileNoiseDir;
254 pidl = SHBrowseForFolder (&bi);
255 if (!SHGetPathFromIDList(pidl, str))
259 LandTileNoiseDir = str;
260 UpdateData (FALSE); // Upload