Files
envi-code/SourceCode/Code2026/Dimension/VerticalSectionSettingDlg.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

238 lines
6.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "stdafx.h"
#include "AcDbObjectPtr.h"
#include "globalFunc.h"
#include "DbVerticalSection.h"
#include "DbVerticalSectionFeed.h"
#include "VerticalSectionSettingDlg.h"
//***************************************************************************************************
// 设置表头
//***************************************************************************************************
void SetVerticalSectionHead()
{
TCHAR szText[256];
BOOL bIsFeedSys = FALSE;
ads_getstring(0, _T("\n设置纵断面图表头1:雨污系统 2:给水系统<雨污系统>:"), szText);
if (_tcsicmp(szText, _T("2")) == 0)
bIsFeedSys = TRUE;
CTemporaryResourceOverride vTemp;
CVerticalSectionSettingDlg dlg;
//CRegProperty regProp(GetRegLocation(), _T("TWTConfig"));
//regProp.SetTopRootKey(HKEY_CURRENT_USER);
//regProp.GetValue(_T("VerticalSectionHead"), g_csVerticalSectionHead);
//regProp.GetValue(_T("VerticalSectionHeadFeed"), g_csVerticalSectionHeadFeed);
CString csHead = g_Option::instance().g_csVerticalSectionHead;
if (bIsFeedSys)
csHead = g_Option::instance().g_csVerticalSectionHeadFeed;
int idx(1);
while (1) {
TCHAR sBuf[256] = _T("");
GlobalFunc::GetStringAtIndex(csHead, idx, sBuf);
if (_tcsicmp(sBuf, _T("")) == 0)
break;
dlg.m_lstSel.Append(tstrnew(sBuf));
idx++;
}
if (dlg.DoModal() != IDOK)
return;
if (bIsFeedSys)
g_Option::instance().g_csVerticalSectionHeadFeed = dlg.m_csRet;
else
g_Option::instance().g_csVerticalSectionHead = dlg.m_csRet;
//regProp.SetValue(_T("VerticalSectionHead"), g_csVerticalSectionHead);
//regProp.SetValue(_T("VerticalSectionHeadFeed"), g_csVerticalSectionHeadFeed);
}
//***************************************************************************************************
// 修改表头
//***************************************************************************************************
void ModifyVerticalSectionHead()
{
RBList rbMask(RTDXF0, _T("AEC_ZT_VERTICALSECTION,AEC_ZT_VERTICALSECTION_FEED"), 8, _T("*"), NULL);
Entity ent;
CTemporaryResourceOverride vTemp;
CVerticalSectionSettingDlg dlg;
if (GlobalFunc::SelectEntity(_T("\n请选择要修改表头的纵断面图<退出>:"), ent, rbMask) != RTNORM)
return;
CString csHead;
if (ent.Is(_T("AEC_ZT_VERTICALSECTION")))
{
OPENOBJ_BEGIN(ent, AcDb::kForRead, CDbVerticalSection, pVt);
if (pVt) {
csHead = pVt->GetSheetHead();
}
OPENOBJ_END();
}
else
{
OPENOBJ_BEGIN(ent, AcDb::kForRead, CDbVerticalSectionFeed, pVt);
if (pVt) {
csHead = pVt->GetSheetHead();
}
OPENOBJ_END();
}
int idx(1);
while (1) {
TCHAR sBuf[256] = _T("");
GlobalFunc::GetStringAtIndex(csHead, idx, sBuf);
if (_tcsicmp(sBuf, _T("")) == 0)
break;
dlg.m_lstSel.Append(tstrnew(sBuf));
idx++;
}
if (dlg.DoModal() != IDOK)
return;
if (ent.Is(_T("AEC_ZT_VERTICALSECTION")))
{
OPENOBJ_BEGIN(ent, AcDb::kForWrite, CDbVerticalSection, pVt);
if (pVt) {
pVt->SetSheetHead(dlg.m_csRet);
}
OPENOBJ_END();
}
else
{
OPENOBJ_BEGIN(ent, AcDb::kForWrite, CDbVerticalSectionFeed, pVt);
if (pVt) {
pVt->SetSheetHead(dlg.m_csRet);
}
OPENOBJ_END();
}
}
/////////////////////////////////////////////////////////////////////////////
// CVerticalSectionSettingDlg dialog
CVerticalSectionSettingDlg::CVerticalSectionSettingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CVerticalSectionSettingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CVerticalSectionSettingDlg)
m_iSelAll = 0;
m_iSelSel = 0;
//}}AFX_DATA_INIT
}
void CVerticalSectionSettingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVerticalSectionSettingDlg)
DDX_Control(pDX, IDC_LIST_SEL, m_listSel);
DDX_Control(pDX, IDC_LIST_ALL, m_listAll);
DDX_LBIndex(pDX, IDC_LIST_ALL, m_iSelAll);
DDX_LBIndex(pDX, IDC_LIST_SEL, m_iSelSel);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVerticalSectionSettingDlg, CDialog)
//{{AFX_MSG_MAP(CVerticalSectionSettingDlg)
ON_BN_CLICKED(IDC_BUT_ADD, OnButAdd)
ON_BN_CLICKED(IDC_BUT_REMOVE, OnButRemove)
ON_BN_CLICKED(IDC_BUTTON_UP, OnButtonUp)
ON_BN_CLICKED(IDC_BUTTON_DOWN, OnButtonDown)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVerticalSectionSettingDlg message handlers
BOOL CVerticalSectionSettingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_lstAll.Append(tstrnew(_T("井编号")));
m_lstAll.Append(tstrnew(_T("自然地面标高(m)")));
m_lstAll.Append(tstrnew(_T("设计地面标高(m)")));
m_lstAll.Append(tstrnew(_T("埋设深度(m)")));
m_lstAll.Append(tstrnew(_T("覆土厚度(m)")));
m_lstAll.Append(tstrnew(_T("管标高(m)")));
m_lstAll.Append(tstrnew(_T("管道基础")));
m_lstAll.Append(tstrnew(_T("管材和接口形式")));
m_lstAll.Append(tstrnew(_T("桩号")));
m_lstAll.Append(tstrnew(_T("管道长度(m)")));
m_lstAll.Append(tstrnew(_T("管径(mm)")));
m_lstAll.Append(tstrnew(_T("管道坡度")));
m_lstAll.Append(tstrnew(_T("管线平面")));
m_lstAll.Append(tstrnew(_T("井径(mm)")));
m_lstAll.Append(tstrnew(_T("备注")));
for (int i = 0; i < m_lstAll.Length(); i++) {
m_listAll.AddString(m_lstAll[i]);
}
ResetList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CVerticalSectionSettingDlg::ResetList()
{
m_listSel.ResetContent();
for (int i = 0; i < m_lstSel.Length(); i++) {
m_listSel.AddString(m_lstSel[i]);
}
}
void CVerticalSectionSettingDlg::OnButAdd()
{
UpdateData(TRUE);
if (m_iSelAll < 0)
return;
CString csSel = m_lstAll[m_iSelAll];
if (m_lstSel.Index((const TCHAR*)csSel) > -1)
return;
m_lstSel.Append(tstrnew(csSel));
ResetList();
}
void CVerticalSectionSettingDlg::OnButRemove()
{
UpdateData(TRUE);
if (m_iSelSel < 0)
return;
m_lstSel.Remove(m_iSelSel);
ResetList();
}
void CVerticalSectionSettingDlg::OnButtonUp()
{
UpdateData(TRUE);
if (m_iSelSel < 1)
return;
m_lstSel.Swap(m_iSelSel, m_iSelSel - 1);
int old = m_iSelSel - 1;
ResetList();
m_iSelSel = old;
UpdateData(FALSE);
}
void CVerticalSectionSettingDlg::OnButtonDown()
{
UpdateData(TRUE);
if (m_iSelSel < 0 || m_iSelSel == m_lstSel.Length() - 1)
return;
int old = m_iSelSel + 1;
m_lstSel.Swap(m_iSelSel, m_iSelSel + 1);
ResetList();
m_iSelSel = old;
UpdateData(FALSE);
}
void CVerticalSectionSettingDlg::OnOK()
{
UpdateData(TRUE);
for (int i = 0; i < m_lstSel.Length(); i++) {
m_csRet = m_csRet + _T(" ") + m_lstSel[i];
}
CDialog::OnOK();
}