Files
envi-code/SourceCode/Code2026/PIDLineCmd/ElevationInfoDlg.cpp
T
2026-09-28 15:28:50 +08:00

97 lines
2.2 KiB
C++

#include "stdafx.h"
#include "ElevationInfoDlg.h"
#include "uihistory.h"
namespace
{
void GetAllTextStyleNameArray(std::vector<CString> &arTextStyle)
{
AcDbTextStyleTable *pTextStyleTbl = NULL;
AcDbTextStyleTableRecord *pTextStyleTblRec = NULL;
if (acdbHostApplicationServices()->workingDatabase() \
->getTextStyleTable(pTextStyleTbl, AcDb::kForRead) == Acad::eOk)
{
// ÎÄ×ÖÑùʽ±í¼Ç¼
AcDbTextStyleTableIterator *pIterator = NULL;
if (pTextStyleTbl->newIterator(pIterator) == Acad::eOk)
{
for (pIterator->start(); !pIterator->done(); pIterator->step())
{
if (pIterator->getRecord(pTextStyleTblRec, AcDb::kForRead) == Acad::eOk)
{
LPCTSTR pszName = NULL;
pTextStyleTblRec->getName(pszName);
arTextStyle.push_back(pszName);
pTextStyleTblRec->close();
}
}
delete pIterator;
}
pTextStyleTbl->close();
}
}
}
IMPLEMENT_DYNAMIC(CElevationInfoDlg, CDialog)
CElevationInfoDlg::CElevationInfoDlg(CWnd* pParent /*=nullptr*/)
: CDialog(IDD_BIAOGAO_INFO_DLG, pParent)
, m_sTextStyle(_T(""))
, m_sTextHeight(_T("3.5"))
, m_sPrec(_T("0.00"))
, m_bPrec2(true)
, m_dTextHeight(3.5)
{
GET_CACHE(%s%s%s, &m_sTextStyle, &m_sTextHeight, &m_sPrec);
}
CElevationInfoDlg::~CElevationInfoDlg()
{
}
void CElevationInfoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_CBString(pDX, IDC_COMBO_STYLE, m_sTextStyle);
DDX_CBString(pDX, IDC_COMBO_HEIGHT, m_sTextHeight);
DDX_CBString(pDX, IDC_COMBO_PREC, m_sPrec);
DDX_Control(pDX, IDC_COMBO_STYLE, m_cmbTextStyle);
}
BOOL CElevationInfoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
std::vector<CString> arStyles;
GetAllTextStyleNameArray(arStyles);
for (size_t i(0); i < arStyles.size(); ++i)
{
m_cmbTextStyle.AddString(arStyles[i]);
}
if (arStyles.empty())
{
m_sTextStyle = _T("");
}
UpdateData(FALSE);
return TRUE;
}
BEGIN_MESSAGE_MAP(CElevationInfoDlg, CDialog)
ON_BN_CLICKED(IDOK, &CElevationInfoDlg::OnBnClickedOk)
END_MESSAGE_MAP()
void CElevationInfoDlg::OnBnClickedOk()
{
UpdateData(TRUE);
m_bPrec2 = m_sPrec == _T("0.00") ? true : false;
m_dTextHeight = _ttof(m_sTextHeight);
SET_CACHE(%s%s%s, m_sTextStyle, m_sTextHeight, m_sPrec);
CDialog::OnOK();
}