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

Method OnFileOpen

legacy/hogedit/HogEditView.cpp:434–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434void CHogEditView::OnFileOpen() {
435 // TODO: Add your command handler code here
436 CHogEditDoc *doc = GetDocument();
437 CListCtrl &list = GetListCtrl();
438 CString open_filename;
439
440 // Set full row selection
441 SetFullRowSel(m_bFullRowSel);
442
443 // If current file has been modified, check with user first...
444 if (ModifiedPrompt(this) == IDNO)
445 return;
446
447 if (!DoAutoProcess) {
448 // Create Open File Box
449 CString filter = "Outrage hog template (*.rib)|*.rib|Outrage hogfiles (*.hog)|*.hog|All Files (*.*)|*.*||";
450 CFileDialog dlg_open(TRUE, NULL, NULL, OFN_FILEMUSTEXIST, (LPCTSTR)filter, this);
451 if (dlg_open.DoModal() == IDCANCEL) {
452 return;
453 }
454 open_filename = dlg_open.GetPathName();
455 } else {
456 open_filename = AutoRibFilename;
457 }
458
459 // Display Wait Cursor
460 CWaitCursor wc;
461
462 // Clear out the document's information
463 doc->OnNewDocument();
464
465 // Wipeout the CtrlList items
466 list.DeleteAllItems();
467
468 // Load the document, and fill the control list with the new entries
469 if (!doc->LoadDocument(open_filename))
470 MessageBox("The file was not opened successfully.", "File Read Error");
471
472 // Refresh the CListCtrl with the new loaded items
473 UpdateList();
474
475 // Put new doc name on title bar
476 doc->m_DocumentName = open_filename;
477 doc->m_NoNameChosen = FALSE;
478 UpdateTitle(doc->m_DocumentName, DocModified);
479 UpdateTotalFiles(list.GetItemCount());
480
481 // If we're automatically processing the rib file, go straight to the
482 // hog file creation process
483 if (DoAutoProcess)
484 OnActionCreate();
485}
486
487void CHogEditView::OnFileSave() {
488 // TODO: Add your command handler code here

Callers

nothing calls this directly

Calls 5

ModifiedPromptFunction · 0.85
UpdateTotalFilesFunction · 0.85
LoadDocumentMethod · 0.80
DoModalMethod · 0.45
OnNewDocumentMethod · 0.45

Tested by

no test coverage detected