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

Method OnActionCreate

legacy/hogedit/HogEditView.cpp:628–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628void CHogEditView::OnActionCreate() {
629 // TODO: Add your command handler code here
630 CListCtrl &list = GetListCtrl();
631 CHogEditDoc *doc = GetDocument();
632 char **hog_filenames;
633 int ret, num_files;
634 char title[] = "Save Hog File As";
635 CString hog_name;
636 bool check_name;
637
638 num_files = doc->Library.filelist.GetCount();
639 if (num_files <= 0)
640 return;
641
642 check_name = FALSE;
643 if (!DoAutoProcess) {
644
645 if (!UseCurrentHogFilename) {
646 CString filter = "Outrage hog file (*.hog)|*.hog|All files (*.*)|*.*||";
647 CFileDialog dlg_save(FALSE, NULL, doc->Library.filename, 0, (LPCTSTR)filter, this);
648
649 dlg_save.m_ofn.lpstrTitle = title;
650
651 // Hog file name box
652 if (dlg_save.DoModal() == IDCANCEL) {
653 return;
654 }
655
656 hog_name = dlg_save.GetPathName();
657
658 // If no extension was specified, add ".hog" by default
659 if (strchr(hog_name.GetBuffer(0), '.') == NULL)
660 hog_name += ".hog";
661
662 check_name = TRUE;
663 } else {
664 hog_name = doc->m_DocumentName;
665 UseCurrentHogFilename = FALSE;
666 }
667
668 // Fill and display the Hog Info dialog
669 CHogInfo info_dlg;
670
671 info_dlg.m_NumFiles.Format("%d", num_files);
672 info_dlg.m_SizeBytes.Format("%d bytes", doc->CalcHogFileSize());
673 info_dlg.m_SizeMB.Format("(%.2f MB)", double(doc->CalcHogFileSize()) / double(1024 * 1024));
674 info_dlg.m_Location.Format("%s", hog_name);
675
676 if (info_dlg.DoModal() == IDCANCEL)
677 return;
678
679 } else {
680 hog_name = AutoHogFilename;
681 }
682
683 // Display Wait Cursor
684 CWaitCursor wc;
685

Callers

nothing calls this directly

Calls 10

UpdateTotalFilesFunction · 0.85
GetBufferMethod · 0.80
CalcHogFileSizeMethod · 0.80
CreateFilenameListMethod · 0.80
SortFilenameListMethod · 0.80
DeleteFilenameListMethod · 0.80
LoadDocumentMethod · 0.80
DoModalMethod · 0.45
OnNewDocumentMethod · 0.45

Tested by

no test coverage detected