MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnInitDialog

Method OnInitDialog

editor/FilePageAddDlg.cpp:301–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301BOOL CFilePageAddDlg::OnInitDialog() {
302 CDialog::OnInitDialog();
303
304 // TODO: Add extra initialization here
305
306 // register a personal, user-defined msg so that our boxes can post msg's for
307 // interaction
308 m_nBoxMsg = RegisterWindowMessage("FilePageDlgAdd");
309 // init the boxes
310 // the definition of:
311 // BOOL InitBox(UINT res_from_template,
312 // CWnd *parent,
313 // LPSTR lpszPath,
314 // LPSTR lpszFileMask,
315 // UINT flags,
316 // UINT msg);
317
318 if (initial_path.IsEmpty())
319 initial_path = "c:\\";
320
321 m_cflDrive.InitBox(IDC_LIST_DRIVES, this, initial_path.GetBuffer(0), "*.*", DRIVES, m_nBoxMsg);
322 m_cflDir.InitBox(IDC_LIST_FOLDERS, this, initial_path.GetBuffer(0), "*.*", DIRECTORIES, m_nBoxMsg);
323 m_cflFile.InitBox(IDC_LIST_FILES, this, initial_path.GetBuffer(0), "*.*", FILES, m_nBoxMsg);
324
325 // Add the drives to the drive list
326 CComboBox *combo = (CComboBox *)GetDlgItem(IDC_LIST_DRIVES);
327 char *root_drives[256];
328 int root_count = ddio_GetFileSysRoots(root_drives, 256);
329 int i, c_drive = 0;
330
331 char initial_d[3];
332 strncpy(initial_d, initial_path.GetBuffer(0), 2);
333 initial_d[2] = '\0';
334
335 for (i = 0; i < root_count; i++) {
336 if (!strnicmp(root_drives[i], initial_d, 2))
337 c_drive = i;
338 combo->AddString(root_drives[i]);
339 mem_free(root_drives[i]);
340 }
341 combo->SetCurSel(c_drive);
342
343 combo = (CComboBox *)GetDlgItem(IDC_DIRS);
344 for (i = 0; i < NumDirectoryNames; i++) {
345 combo->AddString(DirectoryNames[i]);
346 }
347 combo->SetCurSel(0);
348
349 return TRUE;
350}
351
352LRESULT CFilePageAddDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
353 // TODO: Add your specialized code here and/or call the base class ...

Callers

nothing calls this directly

Calls 4

InitBoxMethod · 0.80
GetBufferMethod · 0.80
AddStringMethod · 0.80
ddio_GetFileSysRootsFunction · 0.50

Tested by

no test coverage detected