348 lines
9.2 KiB
C++
348 lines
9.2 KiB
C++
// ArcWindowDlg.cpp: implementation of the CArcWindowDlg class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "ArcWindowDlg.h"
|
|
#include "OpeningLabelData.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
CString CArcWindowDlg::m_csMemSubType = _T("弧窗");
|
|
|
|
// add by xly on 110223 增加门窗个数记忆功能
|
|
CString CArcWindowDlg::m_csOpeningNums = _T("1");
|
|
|
|
// IMPLEMENT_DYNAMIC(CArcWindowDlg, CInsertOpeningDlg)
|
|
|
|
CArcWindowDlg::CArcWindowDlg(CWnd *pParent)
|
|
: CInsertOpeningDlg(CArcWindowDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CArcWindowDlg)
|
|
m_bAsHigh=FALSE;
|
|
//}}AFX_DATA_INIT
|
|
|
|
m_nWidth=1500;
|
|
|
|
//modified by fxj 090323
|
|
m_nHeight=1500;
|
|
m_nSill=900;
|
|
}
|
|
|
|
CArcWindowDlg::~CArcWindowDlg()
|
|
{
|
|
|
|
}
|
|
|
|
#define KEEP_LABEL_PROP \
|
|
int __nWid = (int)m_nWidth; \
|
|
int __nHei = (int)m_nHeight; \
|
|
CString __strType = m_csWinDoorType
|
|
|
|
#define CHECK_LABEL_PROP_CHANGE \
|
|
{ \
|
|
bool bSame = (__nWid == (int)m_nWidth) && \
|
|
(__nHei == (int)m_nHeight) && \
|
|
(__strType.CompareNoCase(m_csWinDoorType) == 0) ;\
|
|
if (!bSame) InvalidateOldLabel();\
|
|
}
|
|
|
|
|
|
|
|
void CArcWindowDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
KEEP_LABEL_PROP;
|
|
CInsertOpeningDlg::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CArcWindowDlg)
|
|
DDX_Check(pDX, IDC_AS_HIGHWIN, m_bAsHigh);
|
|
|
|
DDX_CBString(pDX, IDC_CMB_TYPE, m_csWinDoorType);
|
|
DDX_CBString(pDX, IDC_CMB_WINDOORNUMS, m_csWinDoorNumms);
|
|
// sg add 110217,增加类型对应的控制变量,以便从编号设置中获得类型
|
|
DDX_Control(pDX, IDC_CMB_TYPE, m_lstTypeBox);
|
|
//}}AFX_DATA_MAP
|
|
CHECK_LABEL_PROP_CHANGE;
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CArcWindowDlg, CInsertOpeningDlg)
|
|
//{{AFX_MSG_MAP(CArcWindowDlg)
|
|
ON_CBN_KILLFOCUS(IDC_CMB_TYPE, OnKillFocusSubType)
|
|
ON_CBN_KILLFOCUS(IDC_CMB_WINDOORNUMS, OnKillFocusNums)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CRectHoleDlg message handlers
|
|
BOOL CArcWindowDlg::OnInitDialog()
|
|
{
|
|
CInsertOpeningDlg::OnInitDialog();
|
|
|
|
InitComboxes();
|
|
|
|
// sg add 110215,以便从编号设置中获得类型,初始化对话框
|
|
InitWinTypeCombox();
|
|
|
|
// add by xly on 110113 已有洞口插入灰显
|
|
m_toolbar.EnableButton(ID_HASHOLE_INSERT, FALSE);
|
|
m_csWinDoorNumms = m_csOpeningNums;
|
|
|
|
// add by xly on 110119 对话框编辑时调整控件
|
|
if (!m_bModeless)
|
|
{
|
|
GetDlgItem(IDC_STATIC_NUM)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_CMB_WINDOORNUMS)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_AS_HIGHWIN)->SetWindowText(_T("作为高窗"));
|
|
|
|
CRect rect, rect1, rect2, rect3, rect4;
|
|
GetWindowRect(rect);
|
|
SetWindowPos(NULL,rect.left,rect.top,rect.Width()*7/8,rect.Height(),SWP_FRAMECHANGED);
|
|
|
|
GetDlgItem(IDC_AS_HIGHWIN)->GetWindowRect(&rect);
|
|
//
|
|
GetDlgItem(IDC_CHSIDE)->GetWindowRect(&rect1); // for left,width,heigth..
|
|
ScreenToClient(&rect1);
|
|
GetDlgItem(IDC_WIDTH)->GetWindowRect(&rect2); // for top
|
|
ScreenToClient(&rect2);
|
|
GetDlgItem(IDC_AS_HIGHWIN)->SetWindowPos(NULL,rect1.left,rect2.top,rect1.Width(),rect1.Height(),SWP_FRAMECHANGED);
|
|
|
|
GetDlgItem(IDC_LOOKUP)->GetClientRect(&rect);
|
|
// 使用"类型"控件的left,“窗台高度”控件的top
|
|
GetDlgItem(IDC_STATIC_OPENING_KIND)->GetWindowRect(&rect1); // left;
|
|
ScreenToClient(&rect1);
|
|
GetDlgItem(IDC_SILL)->GetWindowRect(&rect2); // top;
|
|
ScreenToClient(&rect2);
|
|
GetDlgItem(IDC_CMB_TYPE)->GetWindowRect(&rect3); // for width
|
|
ScreenToClient(&rect3);
|
|
GetDlgItem(IDC_LOOKUP)->SetWindowPos(NULL,rect1.left,rect2.top,rect3.right - rect1.left,rect.Height(),SWP_FRAMECHANGED);
|
|
}
|
|
|
|
// sg add 110803,增加类型提示语
|
|
AddTip(IDC_STATIC_NUM, _T("此处为连续相邻门窗的个数,生成的多个门窗间的间距为0。"));
|
|
|
|
// sg add 110123,增加类型提示语
|
|
AddTip(IDC_STATIC_OPENING_KIND, _T("类型可通过【编号设置】命令设置。当选择隔断门或电梯门时,其门不进行自动编号,也不参与门窗检查和门窗表的统计。"));
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
|
|
// sg add 110215,以便从编号设置中获得类型,初始化对话框
|
|
void CArcWindowDlg::InitWinTypeCombox()
|
|
{
|
|
CStringArray arSubType;
|
|
TOpeningLabelData openinglabel;
|
|
openinglabel.GetSubType(_T("ArcWin"), arSubType);
|
|
|
|
int nSize = (int)arSubType.GetSize(); // 初始化控件
|
|
for (int i = 0; i < nSize; i++)
|
|
{
|
|
m_lstTypeBox.AddString(arSubType[i]);
|
|
}
|
|
|
|
// add by xly 对象编辑时增加没有的类型
|
|
if (!m_bModeless)
|
|
{
|
|
int nFind = m_lstTypeBox.FindString(0,m_csWinDoorType);
|
|
//if (nFind < 1)
|
|
if (nFind < 0) // sg add 110623,解决如果是普通门、普通窗,会多一个错误的情况
|
|
{
|
|
m_lstTypeBox.AddString(m_csWinDoorType);
|
|
}
|
|
}
|
|
|
|
if (m_bModeless)
|
|
{
|
|
int nCurSel = m_lstTypeBox.FindString(0, m_csMemSubType);
|
|
if (nCurSel == -1) // 未找到
|
|
{
|
|
nCurSel = 0;
|
|
m_lstTypeBox.GetLBText(0, m_csWinDoorType);
|
|
}
|
|
else // 找到
|
|
{
|
|
m_csWinDoorType = m_csMemSubType;
|
|
}
|
|
|
|
m_lstTypeBox.SetCurSel(nCurSel);
|
|
}
|
|
}
|
|
|
|
void CArcWindowDlg::InitComboxes()
|
|
{
|
|
// 宽度系列 2400
|
|
CString csItem;
|
|
int widthArray[]={1500, 1800, 2100, 2400, 2700, 3000, 3300, 3600};
|
|
for(int i=0; i<ELEMENTS(widthArray); i++) {
|
|
csItem.Format(_T("%d"), widthArray[i]);
|
|
m_lstWidthBox.AddString(csItem);
|
|
}
|
|
|
|
// 高度系列 1500
|
|
int heightArray[]={1200, 1400, 1500, 1800, 2100, 2400, 2700, 3000};
|
|
for(i=0; i<ELEMENTS(heightArray); i++) {
|
|
csItem.Format(_T("%d"), heightArray[i]);
|
|
m_lstHeightBox.AddString(csItem);
|
|
}
|
|
|
|
// 窗台高度系列 900
|
|
int sillArray[]={0, 300, 400, 500, 600, 700, 800, 900, 1000, 1200};
|
|
for(i=0; i<ELEMENTS(sillArray); i++) {
|
|
csItem.Format(_T("%d"), sillArray[i]);
|
|
m_lstSillBox.AddString(csItem);
|
|
}
|
|
}
|
|
|
|
|
|
int CArcWindowDlg::GetOpeningKind() const
|
|
{
|
|
return TOpeningData::OP_ARCWIN;
|
|
}
|
|
|
|
//关键注册位置, 子类需要重载本方法
|
|
BOOL CArcWindowDlg::GetRegLocation(XString &sRegLoc) const
|
|
{
|
|
sRegLoc=_T("ArcWin");
|
|
return TRUE;
|
|
}
|
|
|
|
// 用于编辑以及改选编号时
|
|
BOOL CArcWindowDlg::SetDlgParamFrom(const TDbOpening &opening)
|
|
{
|
|
if (!CInsertOpeningDlg::SetDlgParamFrom(opening))
|
|
return FALSE;
|
|
m_bAsHigh = opening.IsHigh();
|
|
m_csWinDoorType = opening.GetSubKind();
|
|
return TRUE;
|
|
}
|
|
|
|
void CArcWindowDlg::UpdateOpening(TDbOpening &op, BOOL bLoadStyle)
|
|
{
|
|
// add by xly on 110223 对象编辑时设置门窗的类型
|
|
CString csLayerNow = op.layer(),
|
|
csDefaultLayer = op.GetDefaultLayer();
|
|
|
|
// add by xly on 110224 设置门窗类型
|
|
op.SetSubKind(m_csWinDoorType);
|
|
|
|
CInsertOpeningDlg::UpdateOpening(op, bLoadStyle);
|
|
if (m_bAsHigh) op.m_nOpStyle |= OPS_ATHIGH;
|
|
else op.m_nOpStyle &= ~OPS_ATHIGH;
|
|
|
|
// add by xly on 110223 对象编辑时设置门窗的类型
|
|
if (_tcsicmp(csLayerNow, csDefaultLayer) == 0)
|
|
{
|
|
csDefaultLayer = op.GetDefaultLayer();
|
|
op.setLayer(InitLayer(csDefaultLayer));
|
|
|
|
// 修改标注图层
|
|
CString csSubType = op.GetSubKind();
|
|
if (csSubType.Find(_T("防火门"))>=0 || csSubType.Find(_T("防火卷帘"))>=0
|
|
|| csSubType.Find(_T("防火窗"))>=0)
|
|
{
|
|
op.SetLayerText(InitLayer(LAY_FILEOPENING_DIM));
|
|
}
|
|
else
|
|
{
|
|
op.SetLayerText(InitLayer(LAY_OPENING_DIM));
|
|
}
|
|
}
|
|
|
|
op.SetLabel(GetAutoLabel(&op));
|
|
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////////////////////
|
|
// 用对话框上的参数更新实体数据
|
|
// op--门/窗
|
|
BOOL CArcWindowDlg::ModifyOpeningWithDlgParam(TDbOpening &op)
|
|
{
|
|
// add by xly on 110223 对象编辑时设置门窗的类型
|
|
CString csLayerNow = op.layer(),
|
|
csDefaultLayer = op.GetDefaultLayer();
|
|
|
|
op.SetSubKind(m_csWinDoorType);
|
|
|
|
if (!CInsertOpeningDlg::ModifyOpeningWithDlgParam(op))
|
|
return FALSE;
|
|
if (m_bAsHigh) op.m_nOpStyle |= OPS_ATHIGH;
|
|
else op.m_nOpStyle &= ~OPS_ATHIGH;
|
|
|
|
if (_tcsicmp(csLayerNow, csDefaultLayer) == 0)
|
|
{
|
|
csDefaultLayer = op.GetDefaultLayer();
|
|
op.setLayer(InitLayer(csDefaultLayer));
|
|
|
|
// 修改标注图层
|
|
CString csSubType = op.GetSubKind();
|
|
if (csSubType.Find(_T("防火门"))>=0 || csSubType.Find(_T("防火卷帘"))>=0
|
|
|| csSubType.Find(_T("防火窗"))>=0)
|
|
{
|
|
op.SetLayerText(InitLayer(LAY_FILEOPENING_DIM));
|
|
}
|
|
else
|
|
{
|
|
op.SetLayerText(InitLayer(LAY_OPENING_DIM));
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
void CArcWindowDlg::OnKillFocusSubType()
|
|
{
|
|
UpdateData(TRUE);
|
|
int nCurSel = m_lstTypeBox.GetCurSel();
|
|
if (nCurSel > -1)
|
|
{
|
|
m_lstTypeBox.GetLBText(nCurSel, m_csMemSubType);
|
|
}
|
|
}
|
|
|
|
// add by xly on 112223 对输入的门窗个数判断
|
|
void CArcWindowDlg::OnKillFocusNums()
|
|
{
|
|
CString csTemp = m_csWinDoorNumms;
|
|
UpdateData(TRUE);
|
|
if (!IsDigital(m_csWinDoorNumms) || m_csWinDoorNumms==_T("0") || m_csWinDoorNumms.GetAt(0) == _T('0'))
|
|
{
|
|
MessageBox(_T("个数输入正整数!"));
|
|
m_csWinDoorNumms = csTemp;
|
|
}
|
|
else
|
|
{
|
|
m_csOpeningNums = m_csWinDoorNumms;
|
|
}
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
//add by lgy 20120119 拾取门窗数据的时候需要用到
|
|
int CArcWindowDlg::ObjToDlg(TDbOpening* pOpening)
|
|
{
|
|
CInsertOpeningDlg::ObjToDlg(pOpening);
|
|
|
|
m_csWinDoorType = pOpening->GetSubKind();
|
|
m_bAsHigh = pOpening->IsHigh();
|
|
|
|
UpdateData(FALSE);
|
|
return 1;
|
|
}
|
|
|
|
//////////////////////////////
|
|
// Command: 插弧窗
|
|
// 必须在WCS下
|
|
void InsAWin()
|
|
{
|
|
}
|