55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
![]() |
#include "stdafx.h"
|
||
|
|
||
|
#include "xtr/dialog/ExportCstGraphDlg.h"
|
||
|
|
||
|
#include "resource.h"
|
||
|
|
||
|
namespace xtr::dialog {
|
||
|
|
||
|
#pragma warning( push )
|
||
|
#pragma warning( disable : 26440 26436 26454 )
|
||
|
|
||
|
BEGIN_MESSAGE_MAP(ExportCstGraphDlg, CDialog) // NOLINT
|
||
|
|
||
|
END_MESSAGE_MAP()
|
||
|
|
||
|
#pragma warning( pop )
|
||
|
|
||
|
ExportCstGraphDlg::ExportCstGraphDlg(CWnd* pParent)
|
||
|
: CDialog(IXTRD_EXPORT_CSTGRAPH, pParent) {}
|
||
|
|
||
|
void ExportCstGraphDlg::DoDataExchange(CDataExchange* pDX) {
|
||
|
CDialog::DoDataExchange(pDX);
|
||
|
|
||
|
int32_t linkType{};
|
||
|
if (!pDX->m_bSaveAndValidate) {
|
||
|
linkType = GetLinkType();
|
||
|
}
|
||
|
|
||
|
::DDX_Radio(pDX, IXTRC_FORMULA, linkType);
|
||
|
::DDX_Check(pDX, IXTRC_TRIPLET_CB, options.triplets);
|
||
|
::DDX_Check(pDX, IXTRC_EXPORT_CSV_CB, exportCSV);
|
||
|
|
||
|
if (pDX->m_bSaveAndValidate) {
|
||
|
SetLinkType(linkType);
|
||
|
exportType = exportCSV ? FileType::csv : FileType::txt;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int32_t ExportCstGraphDlg::GetLinkType() const noexcept { // NOLINT(bugprone-exception-escape)
|
||
|
if (!options.linkage.has_value()) {
|
||
|
return static_cast<int32_t>(io::LinkType::lexTerm) + 1;
|
||
|
} else {
|
||
|
return static_cast<int32_t>(options.linkage.value());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ExportCstGraphDlg::SetLinkType(const int32_t type) noexcept {
|
||
|
if (type > static_cast<int32_t>(io::LinkType::lexTerm)) {
|
||
|
options.linkage = std::nullopt;
|
||
|
} else {
|
||
|
options.linkage = static_cast<io::LinkType>(type);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
} // namespace xtr::dialog
|