Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / tools / leveldesign / master / ExportDlg.cpp
blob00caee362b9799fe343a7a7954829245a1bc7b3d
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 // ExportDlg.cpp : implementation file
20 #include "stdafx.h"
21 #include "master.h"
22 #include "ExportDlg.h"
24 #ifdef _DEBUG
25 # ifdef new
26 # undef new
27 # endif
28 #define new DEBUG_NEW
29 #undef THIS_FILE
30 static char THIS_FILE[] = __FILE__;
31 #endif
33 using namespace std;
35 /////////////////////////////////////////////////////////////////////////////
36 // CExportDlg dialog
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("");
47 OutIGDir = _T("");*/
48 ContinentName = _T("");
49 /*LandBankFile = _T("");
50 LandFarBankFile = _T("");*/
51 _Options = NULL;
52 _Finished = false;
53 //LandTileNoiseDir = _T("");
54 //}}AFX_DATA_INIT
57 // ---------------------------------------------------------------------------
58 void CExportDlg::setOptions (SExportOptions &options, vector<string> &regNames)
60 _Options = &options;
61 _Continents = &regNames;
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);
77 //}}AFX_DATA_MAP
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)*/
89 //}}AFX_MSG_MAP
90 END_MESSAGE_MAP()
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;
112 while (si >= 0)
114 if (_Options->PrimFloraDir[si] == '\\')
115 break;
116 --si;
118 if (si > -1)
120 ContinentName = "";
121 ++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;
146 CDialog::OnOK();
149 // ---------------------------------------------------------------------------
150 int CALLBACK expBrowseCallbackProc (HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
152 switch(uMsg)
154 case BFFM_INITIALIZED:
155 SendMessage (hwnd, BFFM_SETSELECTION, TRUE, pData);
156 break;
157 default:
158 break;
160 return 0;
163 // ---------------------------------------------------------------------------
164 void CExportDlg::OnExploreOutLandscapeDir ()
166 BROWSEINFO bi;
167 char str[MAX_PATH];
168 ITEMIDLIST* pidl;
169 char sTemp[1024];
171 bi.hwndOwner = this->m_hWnd;
172 bi.pidlRoot = NULL;
173 bi.pidlRoot = NULL;
174 bi.pszDisplayName = sTemp;;
175 bi.lpszTitle = "Choose the path";
176 bi.ulFlags = 0;
177 bi.lpfn = expBrowseCallbackProc;
178 bi.lParam = (LPARAM)(LPCSTR)OutLandscapeDir;
179 bi.iImage = 0;
180 pidl = SHBrowseForFolder (&bi);
181 if (!SHGetPathFromIDList(pidl, str))
183 return;
185 OutLandscapeDir = str;
186 UpdateData (FALSE); // Upload
189 // ---------------------------------------------------------------------------
190 void CExportDlg::OnExploreOutIGDir()
192 BROWSEINFO bi;
193 char str[MAX_PATH];
194 ITEMIDLIST* pidl;
195 char sTemp[1024];
197 bi.hwndOwner = this->m_hWnd;
198 bi.pidlRoot = NULL;
199 bi.pidlRoot = NULL;
200 bi.pszDisplayName = sTemp;;
201 bi.lpszTitle = "Choose the path";
202 bi.ulFlags = 0;
203 bi.lpfn = expBrowseCallbackProc;
204 bi.lParam = (LPARAM)(LPCSTR)OutIGDir;
205 bi.iImage = 0;
206 pidl = SHBrowseForFolder (&bi);
207 if (!SHGetPathFromIDList(pidl, str))
209 return;
211 OutIGDir = 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()
240 BROWSEINFO bi;
241 char str[MAX_PATH];
242 ITEMIDLIST* pidl;
243 char sTemp[1024];
245 bi.hwndOwner = this->m_hWnd;
246 bi.pidlRoot = NULL;
247 bi.pidlRoot = NULL;
248 bi.pszDisplayName = sTemp;;
249 bi.lpszTitle = "Choose the path";
250 bi.ulFlags = 0;
251 bi.lpfn = expBrowseCallbackProc;
252 bi.lParam = (LPARAM)(LPCSTR)LandTileNoiseDir;
253 bi.iImage = 0;
254 pidl = SHBrowseForFolder (&bi);
255 if (!SHGetPathFromIDList(pidl, str))
257 return;
259 LandTileNoiseDir = str;
260 UpdateData (FALSE); // Upload