#include "StdAfx.h" #include "parallelstairdlg.h" //初始话静态变量 CString CParallelStairDlg::m_strStairWidth=_T("5000"); CString CParallelStairDlg::m_strSideStairWidth=_T("1200"); CString CParallelStairDlg::m_strMidStairWidth=_T("2400"); CString CParallelStairDlg::m_strRailDistToSide=_T("0"); CString CParallelStairDlg::m_strRailOutDis=_T("60"); CString CParallelStairDlg::m_strRailOutDisMid=_T("60"); CString CParallelStairDlg::m_strRailHeight=_T("900"); CString CParallelStairDlg::m_strRailWidth=_T("60"); CString CParallelStairDlg::m_strStepWidth=_T("270"); int CParallelStairDlg::m_iStepNum1=10; int CParallelStairDlg::m_iStepNum2=10; int CParallelStairDlg::m_iSectStepNum=5; int CParallelStairDlg::m_iSelectFloor=1;//选择楼层 int CParallelStairDlg::m_iStepAlign=0;//踏步取齐 BOOL CParallelStairDlg::m_bLeftBeam=FALSE; BOOL CParallelStairDlg::m_bRightBeam=FALSE; BOOL CParallelStairDlg::m_bUpPostion=FALSE;//上楼方法 int CParallelStairDlg::m_iSlab=0;//休息平台 CString CParallelStairDlg::m_strSlabWidth=_T("1200");//平台宽度; BOOL CParallelStairDlg::m_bAutoRail=FALSE; BOOL CParallelStairDlg::m_bHasOutRail=FALSE; BOOL CParallelStairDlg::m_bInsideRail=TRUE;//内侧栏杆 BOOL CParallelStairDlg::m_bHasInsideHandRail=TRUE;//内测扶手 int CParallelStairDlg::m_isaveStepNum=20; CString CParallelStairDlg::m_strsaveStepHeight=_T("150"); CString CParallelStairDlg::m_strsaveStairHeight=_T("3000"); IMPLEMENT_DYNAMIC(CParallelStairDlg,CBaseStairDlg) CParallelStairDlg::CParallelStairDlg(CWnd*pParent/* =NULL */):CBaseStairDlg(CParallelStairDlg::IDD,pParent),m_group1(0) { //m_strStairHeight=_T("3000"); m_nStepNum=m_iStepNum1+m_iStepNum2; //m_strStepHeight=_T("150"); m_bHasArrow=TRUE;//标注 m_bGroupStatus=FALSE;//组合窗的状态 Exchange(m_nStepNum,m_isaveStepNum); Exchange(m_strStepHeight,m_strsaveStepHeight); Exchange(m_strStairHeight,m_strsaveStairHeight); //初始话 m_bEdit=FALSE;//处于非编辑状态 m_pBakObj=NULL;//为空状态 } CParallelStairDlg::CParallelStairDlg(UINT idd,CWnd*pParent/*=NULL*/):CBaseStairDlg(idd,pParent),m_group1(0) { //m_strStairHeight=_T("3000"); m_nStepNum=m_iStepNum1+m_iStepNum2; //m_strStepHeight=_T("150"); m_bHasArrow=TRUE;//标注 m_bGroupStatus=FALSE;//组合窗的状态 Exchange(m_nStepNum,m_isaveStepNum); Exchange(m_strStepHeight,m_strsaveStepHeight); Exchange(m_strStairHeight,m_strsaveStairHeight); //初始话 m_bEdit=FALSE;//处于非编辑状态 m_pBakObj=NULL;//为空状态 } CParallelStairDlg::~CParallelStairDlg() { Exchange(m_nStepNum,m_isaveStepNum); Exchange(m_strStepHeight,m_strsaveStepHeight); Exchange(m_strStairHeight,m_strsaveStairHeight); if (m_bEdit) delete m_pBakObj; } BOOL CParallelStairDlg::OnInitDialog() { CBaseStairDlg::OnInitDialog(); stepNum1.SetRange(2,10000); stepNum2.SetRange(2,10000); stepNumSpin.SetRange(4,10000); m_ctrlSectStepSpin.SetRange(2,10000);//剖切步数 AddTip(IDC_NEED3D); AddTip(IDC_NEED2D); AddTip(IDC_STAIR_HEIGHT_STATIC,_T("楼梯高度始终等于所有踏步的高度总和,改变楼梯高度将使踏步数变化,同时可能微调踏步高度")); AddTip(IDC_STEP_NUM_STATIC,_T("改变踏步数将使踏步高度反向变化")); AddTip(IDC_STEP_HEIGHT_STATIC,_T("输入一个大概的近似踏步高度,系统将自动设置正确值;改变踏步高度将引起踏步数反向变化")); UpdateSel(); UpdateImage(); return TRUE; } BEGIN_MESSAGE_MAP(CParallelStairDlg,CBaseStairDlg) //消息映射过程 ON_EN_CHANGE(IDC_STAIR_WIDTH,OnChangeStairWidth) ON_EN_CHANGE(IDC_RAIL_HEIGHT,OnChangeRailHeight) ON_EN_CHANGE(IDC_RAIL_WIDTH,OnChangeRailWidth) ON_EN_CHANGE(IDC_SIDESTAIR_WIDTH,OnChangeSideStairWidth) ON_EN_CHANGE(IDC_MIDSTAIR_WIDTH,OnChangeMidStairWidth) ON_EN_CHANGE(IDC_STEP_HEIGHT,OnChangeStepHeight) ON_EN_CHANGE(IDC_STEP_WIDTH,OnChangeStepWidth) ON_EN_CHANGE(IDC_STEP_NUM1,OnChangeStepNum1) ON_EN_CHANGE(IDC_STEP_NUM2,OnChangeStepNum2) ON_EN_CHANGE(IDC_RAIL_DISTTOSIDE,OnChangeRailDistToSide) ON_EN_CHANGE(IDC_FLATFORM_WIDTH,OnChangeSlabWidth) ON_EN_CHANGE(IDC_STEP_NUM,OnChangeStepNum) ON_EN_CHANGE(IDC_POU_NUM,OnChangeSectStepNum) ON_EN_CHANGE(IDC_OUTRAIL_DIST,OnChangeRailOutDist)//扶手伸出距离 ON_CBN_SELCHANGE(IDC_STAIR_HEIGHTCOMBOX,OnSelChange) ON_CBN_EDITCHANGE(IDC_STAIR_HEIGHTCOMBOX,OnChangeStairHeight) ON_EN_CHANGE(IDC_EDIT_RAILDIST2,OnChangeRailOutDisMid)//转角伸出距离 ON_BN_CLICKED(IDC_INSIDERAIL,UpdateSel)//内侧栏杆 //失去焦点事件的重写 ON_EN_KILLFOCUS(IDC_STEP_HEIGHT,OnStepHeightKillFocus) //modify by xlc on 090318 ON_EN_KILLFOCUS(IDC_STAIR_WIDTH,OnKFStairWidth) ON_EN_KILLFOCUS(IDC_RAIL_HEIGHT,OnKFRailHeight) ON_EN_KILLFOCUS(IDC_RAIL_WIDTH,OnKFRailWidth) ON_EN_KILLFOCUS(IDC_SIDESTAIR_WIDTH,OnKFSideStairWidth) ON_EN_KILLFOCUS(IDC_MIDSTAIR_WIDTH,OnKFMidStairWidth) ON_EN_KILLFOCUS(IDC_STEP_WIDTH,OnKFStepWidth) ON_EN_KILLFOCUS(IDC_STEP_NUM1,OnKFStepNum1) ON_EN_KILLFOCUS(IDC_STEP_NUM2,OnKFStepNum2) ON_EN_KILLFOCUS(IDC_RAIL_DISTTOSIDE,OnKFRailDistToSide) ON_EN_KILLFOCUS(IDC_FLATFORM_WIDTH,OnKFSlabWidth) ON_EN_KILLFOCUS(IDC_STEP_NUM,OnKFStepNum) ON_EN_KILLFOCUS(IDC_POU_NUM,OnKFSectStepNum) ON_EN_KILLFOCUS(IDC_OUTRAIL_DIST,OnKFRailOutDist)//扶手伸出距离 ON_EN_KILLFOCUS(IDC_EDIT_RAILDIST2,OnKFRailOutDisMid)//转角伸出距离 ON_EN_KILLFOCUS(IDC_STAIR_HEIGHTCOMBOX,OnKFStairHeight) ON_WM_CLOSE() //休息平台 ON_BN_CLICKED(IDC_RECT_PLATFORM,UpdateSel) ON_BN_CLICKED(IDC_ARC_PLATFORM,UpdateSel) ON_BN_CLICKED(IDC_NO_PLATFORM,UpdateSel) //左右边梁 ON_BN_CLICKED(IDC_LEFT_BEAM,UpdateSel) ON_BN_CLICKED(IDC_RIGHT_BEAM,UpdateSel) //楼层设置 ON_BN_CLICKED(IDC_RADIO_FIRST,UpdateSel) ON_BN_CLICKED(IDC_RADIO_MID,UpdateSel) ON_BN_CLICKED(IDC_RADIO_TOP,UpdateSel) //踏步取齐 ON_BN_CLICKED(IDC_ALIGN_SLAB,UpdateSel) ON_BN_CLICKED(IDC_ALIGN_FLOOR,UpdateSel) ON_BN_CLICKED(IDC_ALIGN_MID,UpdateSel) ON_BN_CLICKED(IDC_RADIO_FREE,UpdateSel) //上楼位置 ON_BN_CLICKED(IDC_SIDE_UP,UpdateSel) ON_BN_CLICKED(IDC_MID_UP,UpdateSel) ON_BN_CLICKED(IDC_SET_ARROW,UpdateSel) //梯段宽按钮的处理 ON_BN_CLICKED(IDC_BN_STAIRWIDTH,OnClickStairWidth) ON_BN_CLICKED(IDC_BN_SIDESTAIRWIDTH,OnClickSideStairWidth) ON_BN_CLICKED(IDC_BN_MIDSTAIRWIDTH,OnClickMidStairWidth) //作为坡道 ON_BN_CLICKED(IDC_AS_ASCENT,UpdateSel) ON_BN_CLICKED(IDC_HAS_SLANT,UpdateSel) ON_BN_CLICKED(IDC_ON_GROUND,UpdateSel) //扶手处理 ON_BN_CLICKED(IDC_AUTORAIL,UpdateSel) ON_BN_CLICKED(IDC_HAS_OUTRAIL,UpdateSel) ON_BN_CLICKED(IDC_CHECK_HASINSIDERAIL,UpdateSel)//内侧扶手 END_MESSAGE_MAP() void CParallelStairDlg::DoDataExchange(CDataExchange* pDX) { //变量映射 CBaseStairDlg::DoDataExchange(pDX); DDX_Text(pDX,IDC_SIDESTAIR_WIDTH,m_strSideStairWidth); DDX_Text(pDX,IDC_MIDSTAIR_WIDTH,m_strMidStairWidth); DDX_Text(pDX,IDC_STAIR_WIDTH,m_strStairWidth); DDX_Text(pDX,IDC_STEP_NUM1,m_iStepNum1); DDX_Text(pDX,IDC_STEP_NUM2,m_iStepNum2); DDX_Text(pDX,IDC_STEP_WIDTH,m_strStepWidth); DDX_Text(pDX,IDC_POU_NUM,m_iSectStepNum);//剖切步数 DDX_CBString(pDX,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight); //扶手处理 DDX_Text(pDX,IDC_RAIL_HEIGHT,m_strRailHeight); DDX_Text(pDX,IDC_RAIL_WIDTH,m_strRailWidth); DDX_Text(pDX,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide); DDX_Check(pDX,IDC_AUTORAIL,m_bAutoRail); DDX_Check(pDX,IDC_HAS_OUTRAIL,m_bHasOutRail); DDX_Text(pDX,IDC_OUTRAIL_DIST,m_strRailOutDis);//扶手伸出距离 DDX_Check(pDX,IDC_INSIDERAIL,m_bInsideRail);//内侧栏杆 DDX_Text(pDX,IDC_EDIT_RAILDIST2,m_strRailOutDisMid);//转角伸出距离 DDX_Check(pDX,IDC_CHECK_HASINSIDERAIL,m_bHasInsideHandRail);//内侧扶手 //踏步取齐 DDX_Radio(pDX,IDC_ALIGN_SLAB,m_iStepAlign); //楼层映射 DDX_Radio(pDX,IDC_RADIO_FIRST,m_iSelectFloor); //左右边梁 DDX_Check(pDX,IDC_LEFT_BEAM,m_bLeftBeam); DDX_Check(pDX,IDC_RIGHT_BEAM,m_bRightBeam); //上楼位置 DDX_Radio(pDX,IDC_MID_UP,m_bUpPostion); DDX_Check(pDX,IDC_SET_ARROW,m_bHasArrow); //组合窗 DDX_Control(pDX,IDC_GROUP1,m_group1); DDX_GroupStatus(pDX,IDC_GROUP1,m_bGroupStatus); //休息平台 DDX_Radio(pDX,IDC_RECT_PLATFORM,m_iSlab); DDX_Text(pDX,IDC_FLATFORM_WIDTH,m_strSlabWidth); //梯井宽 DDX_Text(pDX,IDC_STATIC_WELLWID,m_strStairWell); DDX_Control(pDX,IDC_STEP_NUM1_SPIN,stepNum1); DDX_Control(pDX,IDC_STEP_NUM2_SPIN,stepNum2); DDX_Control(pDX,IDC_SECTSTEP_SPIN,m_ctrlSectStepSpin); DDX_Control(pDX,IDC_STAIR_HEIGHTCOMBOX,m_ctrlStairHeight); } AcDbEntity* CParallelStairDlg::NewObject() { TDbParallelStair *pEnt; if (m_pBakObj==NULL) { pEnt=new TDbParallelStair; pEnt->setLayer(InitLayer(LAY_STAIR)); pEnt->SetLayerHand3d(InitLayer(LAY_HANDRAIL)); pEnt->SetLayerRail3d(InitLayer(LAY_RAIL)); pEnt->SetLayerText(InitLayer(LAY_TEXT)); pEnt->SetTextStyle(InitTextStyle(TS_DIM)); pEnt->SetLayerArrow(InitLayer(LAY_OTHER_DIM)); //add by xlc on 090205 解决用户坐标系下预览文字倾斜的问题 pEnt->SetLayoutRotation(0); return pEnt; } else { return (AcDbEntity*)(m_pBakObj->clone()); } } void CParallelStairDlg::UpdateSel() { CBaseStairDlg::UpdateSel(); UpdateData(TRUE); if (((CButton*)this->GetDlgItem(IDC_RECT_PLATFORM))->GetCheck()) { m_iSlab=0; this->GetDlgItem(IDC_FLATFORM_WIDTH)->EnableWindow(TRUE); } else if (((CButton*)this->GetDlgItem(IDC_ARC_PLATFORM))->GetCheck()) { m_iSlab=1; this->GetDlgItem(IDC_FLATFORM_WIDTH)->EnableWindow(TRUE); } else { this->GetDlgItem(IDC_FLATFORM_WIDTH)->EnableWindow(FALSE); } //楼层设置 if (((CButton*)this->GetDlgItem(IDC_RADIO_FIRST))->GetCheck()) m_iSelectFloor=0; else if (((CButton*)this->GetDlgItem(IDC_RADIO_MID))->GetCheck()) m_iSelectFloor=1; else m_iSelectFloor=2; //踏步取齐 if (((CButton*)this->GetDlgItem(IDC_ALIGN_SLAB))->GetCheck()) m_iStepAlign=0; else if (((CButton*)this->GetDlgItem(IDC_ALIGN_MID))->GetCheck()) m_iStepAlign=1; else if (((CButton*)this->GetDlgItem(IDC_ALIGN_FLOOR))->GetCheck()) m_iStepAlign=2; else m_iStepAlign=3; //以下对2D or 3D的显示 if (m_bNeed2D && m_bNeed3D) m_iViewCtrl=0; else if (!m_bNeed2D && m_bNeed3D) m_iViewCtrl=2; else if (m_bNeed2D && !m_bNeed3D) m_iViewCtrl=1; else m_iViewCtrl=0; // 修改描述:各种楼梯对话框中的“标注上楼方向”一项 // 应在“需要2D”一项勾选后才变成可选择状态。(2097) // 修改人,修改时间:Zyu modify on 100325 GetDlgItem(IDC_SET_ARROW)->EnableWindow(m_bNeed2D); //扶手栏杆关系 this->GetDlgItem(IDC_AUTORAIL)->EnableWindow(m_bHasOutRail); m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); UpdateData(FALSE); UpdateImage(); return; } bool CParallelStairDlg::UpdateEdit(UINT ctrlID,bool bReportError/* =false */) {//这个函数有些问题 CWnd *pImageBox=GetDlgItem(IDC_PREVIEW); if (!pImageBox) return false; if (GetSafeHwnd()==NULL) return false; CEdit *pEdit=(CEdit*)GetDlgItem(ctrlID); if (pEdit==NULL) return false; static bool bUpdating=false; if (bUpdating) return false; bUpdating=true; CDataExchange dxOut(this,false); CString temp; pEdit->GetWindowText(temp); switch(ctrlID) { case IDC_STAIR_HEIGHTCOMBOX: { if (_tstof(temp)>=4*_tstof(m_strStepHeight)-_DIST_SNAP && ::_tstof(temp)<=10000) {//最少当前四踏步高 m_strStairHeight=temp; m_nStepNum=(int)(_tstof(m_strStairHeight)/_tstof(m_strStepHeight)+0.5); m_strStepHeight.Format(_T("%.2f"),(_tstof(m_strStairHeight)/m_nStepNum)); DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight); DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum); stepNum1.SetRange(2,m_nStepNum-2); stepNum2.SetRange(2,m_nStepNum-2); DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1); UpdateImage(); } else { if (bReportError) { ::AfxMessageBox(_T("楼梯高度不正确")); m_strStairHeight.Format(_T("%.2f"),_tstof(m_strStepHeight)*m_nStepNum); DDX_CBString(&dxOut,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight); pEdit->SetFocus(); } bUpdating=false; return false; } } break; case IDC_STAIR_WIDTH: {//梯段总宽 if (_tstof(temp)<3.0*_MIN_STAIRWIDTH) { if (bReportError) { ::AfxMessageBox(_T("梯间宽不正确")); m_strStairWidth.Format(_T("%.2f"),_tstof(m_strSideStairWidth)*2+_tstof(m_strMidStairWidth)); DDX_Text(&dxOut,IDC_STAIR_WIDTH,m_strStairWidth); pEdit->SetFocus(); } bUpdating=false; return false; } m_strStairWidth=temp; DDX_Text(&dxOut,IDC_STAIR_WIDTH,m_strStairWidth); if (_tstof(temp)<_tstof(m_strSideStairWidth)*2+_tstof(m_strMidStairWidth)) { m_strSideStairWidth.Format(_T("%.2f"),_tstof(temp)/4); DDX_Text(&dxOut,IDC_SIDESTAIR_WIDTH,m_strSideStairWidth); m_strMidStairWidth.Format(_T("%.2f"),_tstof(temp)-_tstof(m_strSideStairWidth)*2); DDX_Text(&dxOut,IDC_MIDSTAIR_WIDTH,m_strMidStairWidth); } //add by xlc on 090713 增加梯井宽 m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); DDX_Text(&dxOut,IDC_STATIC_WELLWID,m_strStairWell); } break; case IDC_MIDSTAIR_WIDTH: {//中间梯段宽 if (::_tstof(temp)<_DIST_SNAP ||::_tstof(temp)>::_tstof(m_strStairWidth) ) { if (bReportError) { AfxMessageBox(_T("中梯宽度不正确!")); DDX_Text(&dxOut,IDC_MIDSTAIR_WIDTH,m_strMidStairWidth); pEdit->SetFocus(); } bUpdating=false; return false; } m_strMidStairWidth=temp; DDX_Text(&dxOut,IDC_MIDSTAIR_WIDTH,m_strMidStairWidth); if (_tstof(temp)>_tstof(m_strStairWidth)-_tstof(m_strSideStairWidth)*2) { m_strSideStairWidth.Format(_T("%.2f"),(_tstof(m_strStairWidth)-_tstof(temp))/2); DDX_Text(&dxOut,IDC_SIDESTAIR_WIDTH,m_strSideStairWidth); } //add by xlc on 090713 增加梯井宽 m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); DDX_Text(&dxOut,IDC_STATIC_WELLWID,m_strStairWell); } break; case IDC_SIDESTAIR_WIDTH: {//边梯宽 if (::_tstof(temp)<_DIST_SNAP ||::_tstof(temp)>(::_tstof(m_strStairWidth))/2) { if (bReportError) { AfxMessageBox(_T("边梯宽度不正确!")); DDX_Text(&dxOut,IDC_SIDESTAIR_WIDTH,m_strSideStairWidth); pEdit->SetFocus(); } bUpdating=false; return false; } m_strSideStairWidth=temp; DDX_Text(&dxOut,IDC_SIDESTAIR_WIDTH,m_strSideStairWidth); if (_tstof(temp)>(_tstof(m_strStairWidth)-_tstof(m_strMidStairWidth))/2) { m_strMidStairWidth.Format(_T("%.2f"),(_tstof(m_strStairWidth)-_tstof(temp)*2)); DDX_Text(&dxOut,IDC_MIDSTAIR_WIDTH,m_strMidStairWidth); } //add by xlc on 090713 增加梯井宽 m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); DDX_Text(&dxOut,IDC_STATIC_WELLWID,m_strStairWell); } break; case IDC_STEP_NUM: { if (_ttoi(temp)>3) { m_nStepNum=_ttoi(temp); stepNum1.SetRange(2,m_nStepNum-2); stepNum2.SetRange(2,m_nStepNum-2); m_strStepHeight.Format(_T("%.2f"),_tstof(m_strStairHeight)/m_nStepNum); if (m_iSectStepNum>m_nStepNum) { m_iSectStepNum=m_nStepNum/2 +1; DDX_Text(&dxOut,IDC_POU_NUM,m_iSectStepNum); } DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight); DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1); DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum); UpdateImage(); } else { if (bReportError) { AfxMessageBox(_T("总踏步数至少为4!")); DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum); pEdit->SetFocus(); pEdit->SetSel(0,-1); } bUpdating=false; return false; } } break; case IDC_STEP_NUM1: { stepNum1.SetRange(2,m_nStepNum-2); if (_ttoi(temp)>1&&_ttoi(temp)SetFocus(); pEdit->SetSel(0,-1); } bUpdating=false; return false; } } break; case IDC_STEP_NUM2: { stepNum2.SetRange(2,m_nStepNum-2); if (_ttoi(temp)>1&&_ttoi(temp)SetFocus(); pEdit->SetSel(0,-1); } bUpdating=false; return false; } } break; case IDC_POU_NUM: {//剖切步数 if (::_ttoi(temp)<1) { if (bReportError) { AfxMessageBox(_T("剖切步数不正确!")); DDX_Text(&dxOut,IDC_POU_NUM,m_iSectStepNum); pEdit->SetFocus(); } bUpdating=false; return false; } m_ctrlSectStepSpin.SetRange(2,m_nStepNum); m_iSectStepNum=::_ttoi(temp); DDX_Text(&dxOut,IDC_POU_NUM,m_iSectStepNum); } break; case IDC_STEP_WIDTH: { if (::_tstof(temp)<_DIST_SNAP) { if (bReportError) { AfxMessageBox(_T("踏步宽不正确!")); DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth); pEdit->SetFocus(); } bUpdating=FALSE; return false; } m_strStepWidth=temp; DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth); } break; case IDC_STEP_HEIGHT: { int num(1); if (fabs(_tstof(temp))>_DIST_SNAP) { num=(int)(_tstof(m_strStairHeight)/_tstof(temp)+0.5); } if (num>3) { m_nStepNum=num; m_strStepHeight.Format(_T("%.2f"),_tstof(m_strStairHeight)/m_nStepNum); DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum); DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight); stepNum1.SetRange(2,m_nStepNum-2); stepNum2.SetRange(2,m_nStepNum-2); DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1); UpdateImage(); } else { if (bReportError) { AfxMessageBox(_T("新踏步高度将造成踏步数小于4,请重新输入或先增大梯段高度!")); DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight); pEdit->SetFocus(); } bUpdating=FALSE; return false; } } break; case IDC_RAIL_DISTTOSIDE: { if (_tstof(temp)<-(_tstof(m_strStairWidth)-_tstof(m_strSideStairWidth)-_tstof(m_strMidStairWidth))/4 ||_tstof(temp)>_tstof(m_strSideStairWidth)/2 ||_tstof(temp)>_tstof(m_strMidStairWidth)/2) { if (bReportError) { AfxMessageBox(_T("扶手距边距离不正确!")); DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide); pEdit->SetFocus(); } bUpdating=FALSE; return false; } m_strRailDistToSide=temp; DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide); } break; case IDC_OUTRAIL_DIST: { if (::_tstof(temp)<-(_tstof(m_strStepWidth)*(m_iStepNum1>m_iStepNum2?m_iStepNum1:m_iStepNum2-1)*0.5)) { if (bReportError) { AfxMessageBox(_T("层间扶手伸出距离不正确!")); DDX_Text(&dxOut,IDC_OUTRAIL_DIST,m_strRailOutDis); pEdit->SetFocus(); } bUpdating=false; return false; } m_strRailOutDis=temp; DDX_Text(&dxOut,IDC_OUTRAIL_DIST,m_strRailOutDis); } break; case IDC_EDIT_RAILDIST2: { if (::_tstof(temp)<-(_tstof(m_strStepWidth)*(m_iStepNum1>m_iStepNum2?m_iStepNum1:m_iStepNum2-1)*0.5)) { if (bReportError) { AfxMessageBox(_T("转角扶手伸出距离不正确!")); DDX_Text(&dxOut,IDC_EDIT_RAILDIST2,m_strRailOutDisMid); pEdit->SetFocus(); } bUpdating=false; return false; } m_strRailOutDisMid=temp; DDX_Text(&dxOut,IDC_EDIT_RAILDIST2,m_strRailOutDisMid); } break; case IDC_RAIL_WIDTH: { if (::_tstof(temp)<_DIST_SNAP) { if (bReportError) { AfxMessageBox(_T("扶手宽度不正确!")); DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth); pEdit->SetFocus(); } bUpdating=false; return false; } m_strRailWidth=temp; DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth); } break; case IDC_RAIL_HEIGHT: { if (::_tstof(temp)<_DIST_SNAP) { if (bReportError) { AfxMessageBox(_T("扶手高度不正确!")); DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight); pEdit->SetFocus(); } bUpdating=false; return false; } m_strRailHeight=temp; DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight); } break; case IDC_FLATFORM_WIDTH: { if (::_tstof(temp)<0.0) { if (bReportError) { AfxMessageBox(_T("平台宽度不正确!")); DDX_Text(&dxOut,IDC_FLATFORM_WIDTH,m_strSlabWidth); pEdit->SetFocus(); } bUpdating=false; return false; } m_strSlabWidth=temp; DDX_Text(&dxOut,IDC_FLATFORM_WIDTH,m_strSlabWidth); } break; default: break; } bUpdating=false; UpdateImage(); return false; } void CParallelStairDlg::Obj2Dlg(const AcDbEntity *pStep) { TDbParallelStair *pStair=TDbParallelStair::cast(pStep); // [8/14/2008 nsh] //-------------------------------- m_bEdit=TRUE; m_pBakObj=(TDbParallelStair*)(pStair->clone());//专递值 //-------------------------------- VERIFY(pStair); //m_strStairHeight=Dist2Str(cs->GetStairHeight()); m_strStairHeight=Dist2Str(pStair->GetStepHeight()*(pStair->GetStepNum1()+pStair->GetStepNum2())); m_strSideStairWidth=Dist2Str(pStair->GetStairWidth()); m_strMidStairWidth=Dist2Str(pStair->GetMStairWidth()); m_strStairWidth=Dist2Str(pStair->GetSpaceWidth()); //add by xlc on 090713 增加梯井宽 m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); m_strStepHeight.Format(_T("%.2f"),pStair->GetStepHeight()); m_strStepWidth=Dist2Str(pStair->GetStepWidth()); m_iStepNum1=pStair->GetStepNum1(); m_iStepNum2=pStair->GetStepNum2(); m_nStepNum=m_iStepNum2+m_iStepNum1; m_strRailHeight=Dist2Str(pStair->GetRailHeight()); m_strRailWidth=Dist2Str(pStair->GetRailWidth()); m_strRailDistToSide=Dist2Str(pStair->GetRailDistToSide()); m_iStepAlign=pStair->GetAlignment(); m_iSelectFloor=pStair->GetStairFlag(); m_bAsAscent=pStair->IsAscent(); m_bHasSlant=pStair->HasSlant(); m_iViewCtrl=pStair->GetViewCtrl(); m_bOnGround=pStair->IsOnGround(); m_bUpPostion=pStair->GetStartSide(); if (pStair->IsShowSlab()) { if (pStair->IsArcPlatform()) m_iSlab=1; else if (!pStair->IsArcPlatform()) m_iSlab=0; } else m_iSlab=2; m_bAutoRail=pStair->IsAutoOutRail(); m_bHasOutRail=pStair->IsOutRail(); /*m_bLeftBeam=pStair->HasSideBeam(0); m_bRightBeam=pStair->HasSideBeam(1);*/ m_bLeftBeam=pStair->IsInSideBeam(); m_bRightBeam=pStair->IsOutSideBeam(); m_bHasArrow=pStair->IsArrow(); m_iSectStepNum=pStair->GetSectStepNum(); m_strRailOutDis=Dist2Str(pStair->GetRailDist()); m_bInsideRail=pStair->IsAutoRail(); m_strRailOutDisMid=Dist2Str(pStair->GetRailDistMid()); m_bInsideRail=pStair->IsAutoRail(); m_strSlabSize1=Dist2Str(pStair->GetSlabSizeSide());//得到边平台的宽度 m_strSlabSize2=Dist2Str(pStair->GetSlabSizeMid());//得到中平台的宽度 m_strSlabWidth=Dist2Str(pStair->GetSlabSize()); return; } void CParallelStairDlg::Dlg2Obj(AcDbEntity *pStep) { TDbParallelStair *pStair=TDbParallelStair::cast(pStep); //VERIFY(cs); pStair->SetStairWidth(::_tstof(m_strSideStairWidth)); pStair->SetMStairWidth(::_tstof(m_strMidStairWidth)); pStair->SetStepNum1(m_iStepNum1); pStair->SetStepNum2(m_iStepNum2); pStair->SetSectStepNum(m_iSectStepNum); pStair->SetArrow(m_bHasArrow); pStair->SetStepWidth(::_tstof(m_strStepWidth)); pStair->SetStepHeight(::_tstof(m_strStepHeight)); pStair->SetRailHeight(::_tstof(m_strRailHeight)); pStair->SetRailWidth(::_tstof(m_strRailWidth)); pStair->SetRailDistToSide(::_tstof(m_strRailDistToSide)); pStair->SetRailDistMid(::_tstof(m_strRailOutDisMid)); pStair->SetRailDist(::_tstof(m_strRailOutDis)); pStair->SetSpaceWidth(::_tstof(m_strStairWidth)); pStair->SetSectStepNum(m_iSectStepNum); pStair->SetAlignment(m_iStepAlign); pStair->SetStairFlag(m_iSelectFloor); /*pStair->SetSideBeam(0,m_bLeftBeam); pStair->SetSideBeam(1,m_bRightBeam);*/ pStair->SetInSideBeam(m_bLeftBeam); pStair->SetOutSideBeam(m_bRightBeam); pStair->SetStartSide(m_bUpPostion); pStair->SetAscent(m_bAsAscent);//作为坡道 pStair->SetSlant(m_bHasSlant); pStair->SetOnGround(m_bOnGround); pStair->SetViewCtrl(m_iViewCtrl); //pStair->SetSlabSize((m_iSlab==0 || m_iSlab==1)? _tstof(m_strSlabWidth) : 0.0); //处理关于自由与其他情况 if (m_iStepAlign!=3) { //pStair->SetSlabSize((m_iSlab==0 || m_iSlab==1)? _tstof(m_strSlabWidth) : 0.0); pStair->SetSlabSize(_tstof(m_strSlabWidth)); } else { double temp1=::_tstof(m_strSlabSize1); double temp2=::_tstof(m_strSlabSize2); double temp3=::_tstof(m_strSlabWidth); if (temp1==temp2) { pStair->SetSlabSizeSide(temp3); pStair->SetSlabSizeMid(temp3); pStair->SetSlabSize(temp3); //保留值 m_strSlabSize1=Dist2Str(temp3); m_strSlabSize2=Dist2Str(temp3); m_strSlabWidth=Dist2Str(temp3); } else if (temp1SetSlabSizeSide(temp3); pStair->SetSlabSize(temp3); pStair->SetSlabSizeMid(temp2); //保留值 m_strSlabSize1=Dist2Str(temp3); m_strSlabWidth=Dist2Str(temp3); m_strSlabSize2=Dist2Str(temp2); } else if (temp3>=temp2) { pStair->SetSlabSizeSide(temp3); pStair->SetSlabSizeMid(temp3); pStair->SetSlabSize(temp3); //保留值 m_strSlabSize1=Dist2Str(temp3); m_strSlabSize2=Dist2Str(temp3); m_strSlabWidth=Dist2Str(temp3); } } else if (temp1> temp2) { if (temp3SetSlabSizeMid(temp3); pStair->SetSlabSize(temp3); pStair->SetSlabSizeSide(temp1); //保留值 m_strSlabSize2=Dist2Str(temp3); m_strSlabWidth=Dist2Str(temp3); m_strSlabSize1=Dist2Str(temp1); } else if (temp3>=temp1) { pStair->SetSlabSizeSide(temp3); pStair->SetSlabSizeMid(temp3); pStair->SetSlabSize(temp3); //保留值 m_strSlabSize1=Dist2Str(temp3); m_strSlabSize2=Dist2Str(temp3); m_strSlabWidth=Dist2Str(temp3); } } } //-------------------------------------- //-------------------------------------- if (m_iSlab==1) pStair->SetArcPlatform(TRUE); else pStair->SetArcPlatform(FALSE); if (m_iSlab!=1 && m_iSlab!=0) pStair->SetShowSlab(FALSE); else pStair->SetShowSlab(TRUE); pStair->SetAutoOutRail(m_bHasOutRail?m_bAutoRail:FALSE);//自动生成栏杆 pStair->SetOutRail(m_bHasOutRail); pStair->SetAutoRail(m_bInsideRail);//测试,内测栏杆 // [8/14/2008 nsh] //------------------------ if (m_bEdit) { delete m_pBakObj; m_pBakObj=(TDbParallelStair*)(pStair->clone()); } //------------------------ return; } //以下为事件处理 void CParallelStairDlg::OnChangeStepNum() { CString temp; this->GetDlgItem(IDC_STEP_NUM)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_NUM);//踏步总数 } } void CParallelStairDlg::OnChangeStepNum1() { CString temp; this->GetDlgItem(IDC_STEP_NUM1)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_NUM1); } } void CParallelStairDlg::OnChangeStepNum2() { CString temp; this->GetDlgItem(IDC_STEP_NUM2)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_NUM2); } } void CParallelStairDlg::OnChangeStepHeight() { // UpdateEdit(IDC_STEP_HEIGHT); } void CParallelStairDlg::OnChangeStepWidth() { CString temp; this->GetDlgItem(IDC_STEP_WIDTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STEP_WIDTH,false); } } void CParallelStairDlg::OnChangeRailDistToSide() { CString temp; this->GetDlgItem(IDC_RAIL_DISTTOSIDE)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_RAIL_DISTTOSIDE,false); } } void CParallelStairDlg::OnChangeRailHeight() { CString temp; this->GetDlgItem(IDC_RAIL_HEIGHT)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_RAIL_HEIGHT,false); } } void CParallelStairDlg::OnChangeRailWidth() { CString temp; this->GetDlgItem(IDC_RAIL_WIDTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_RAIL_WIDTH,false); } } void CParallelStairDlg::OnChangeRailOutDisMid() { CString temp; this->GetDlgItem(IDC_EDIT_RAILDIST2)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_EDIT_RAILDIST2,false); } } void CParallelStairDlg::OnChangeSideStairWidth() { CString temp; this->GetDlgItem(IDC_SIDESTAIR_WIDTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_SIDESTAIR_WIDTH,false); } } void CParallelStairDlg::OnChangeMidStairWidth() { CString temp; this->GetDlgItem(IDC_MIDSTAIR_WIDTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_MIDSTAIR_WIDTH,false); } } void CParallelStairDlg::OnChangeStairHeight() { CString temp; this->GetDlgItem(IDC_STAIR_HEIGHTCOMBOX)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STAIR_HEIGHTCOMBOX,false); } } void CParallelStairDlg::OnChangeStairWidth() { CString temp; this->GetDlgItem(IDC_STAIR_WIDTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_STAIR_WIDTH,false); } } void CParallelStairDlg::OnChangeSlabWidth() { CString temp; this->GetDlgItem(IDC_FLATFORM_WIDTH)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_FLATFORM_WIDTH); } } void CParallelStairDlg::OnChangeSectStepNum() { CString temp; this->GetDlgItem(IDC_POU_NUM)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_POU_NUM); } } void CParallelStairDlg::OnChangeRailOutDist() {//扶手伸出距离 CString temp; this->GetDlgItem(IDC_OUTRAIL_DIST)->GetWindowText(temp); if (temp!=_T("")) { UpdateEdit(IDC_OUTRAIL_DIST); } } void CParallelStairDlg::OnStepHeightKillFocus() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_STEP_HEIGHT)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStepHeight))<_DIST_SNAP) return; UpdateEdit(IDC_STEP_HEIGHT,true); } } void CParallelStairDlg::OnClickMidStairWidth() { double dDist=::_tstof(m_strMidStairWidth); BeginEditorCommand(); int nRet=GetDist(_T("\n中梯宽度"), dDist, RSG_NOZERO|RSG_NONEG); CompleteEditorCommand(); if (nRet==RTNORM) { if (dDist>=(::_tstof(m_strStairWidth))) { ::AfxMessageBox(_T("输入的中梯宽度过大,请重新输入")); return; } // m_strMidStairWidth.Format(_T("%.2f"),dDist); // if (dDist>(::_tstof(m_strStairWidth)-::_tstof(m_strSideStairWidth)*2)) // { // m_strSideStairWidth.Format(_T("%.2f"),(::_tstof(m_strStairWidth)-dDist)/2); // } m_strMidStairWidth=Dist2Str(dDist); if (dDist>(::_tstof(m_strStairWidth)-::_tstof(m_strSideStairWidth)*2)) { m_strSideStairWidth=Dist2Str((::_tstof(m_strStairWidth)-dDist)/2); } //add by xlc on 090713 增加梯井宽 m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); UpdateData(FALSE); UpdateImage(); } return; } void CParallelStairDlg::OnClickSideStairWidth() { double dDist=::_tstof(m_strSideStairWidth); BeginEditorCommand(); int nRet=GetDist(_T("\n边梯宽度"), dDist, RSG_NOZERO|RSG_NONEG); CompleteEditorCommand(); if (nRet==RTNORM) { if (dDist>=(::_tstof(m_strStairWidth))/2) { ::AfxMessageBox(_T("输入的边梯宽度过大,请重新输入")); return; } // m_strSideStairWidth.Format(_T("%.2f"),dDist); // if (dDist>(::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth))/2) // { // m_strMidStairWidth.Format(_T("%.2f"),::_tstof(m_strStairWidth)-dDist*2); // } m_strSideStairWidth=Dist2Str(dDist); if (dDist>(::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth))/2) { m_strMidStairWidth=Dist2Str(::_tstof(m_strStairWidth)-dDist*2); } //add by xlc on 090713 增加梯井宽 m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); UpdateData(FALSE); UpdateImage(); } return; } void CParallelStairDlg::OnClickStairWidth() { double dDist=::_tstof(m_strStairWidth); BeginEditorCommand(); int nRet=GetDist(_T("\n梯间宽度"), dDist, RSG_NOZERO|RSG_NONEG); CompleteEditorCommand(); if (nRet==RTNORM) { //if (dDist<(::_tstof(m_strSideStairWidth)*2 + ::_tstof(m_strMidStairWidth))) if (dDist<3.0*_MIN_STAIRWIDTH) { ::AfxMessageBox(_T("楼梯间宽太小,请重新输入")); return; } //m_strStairWidth.Format(_T("%.2f"),dDist); //if (dDist<(::_tstof(m_strSideStairWidth)*2 + ::_tstof(m_strMidStairWidth))) //{ // m_strSideStairWidth.Format(_T("%.2f"),dDist/4); // m_strMidStairWidth.Format(_T("%.2f"),dDist-dDist/4*2); //} m_strStairWidth=Dist2Str(dDist); if (dDist<(::_tstof(m_strSideStairWidth)*2 + ::_tstof(m_strMidStairWidth))) { m_strSideStairWidth=Dist2Str(dDist/4); m_strMidStairWidth=Dist2Str(dDist-dDist/4*2); } //add by xlc on 090713 增加梯井宽 m_strStairWell=Dist2Str((::_tstof(m_strStairWidth)-::_tstof(m_strMidStairWidth)-::_tstof(m_strSideStairWidth)*2)/2); UpdateData(FALSE); UpdateImage(); } return; } void CParallelStairDlg::OnSelChange() { CString temp; CDataExchange dxIn(this,TRUE); DDX_CBString(&dxIn,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight); m_ctrlStairHeight.GetLBText(m_ctrlStairHeight.GetCurSel(),temp); if (_tstof(temp)>=4*_tstof(m_strStepHeight)-_DIST_SNAP) {//最少当前四踏步高 CDataExchange dxOut(this,false); m_strStairHeight=temp; DDX_Text(&dxOut,IDC_STAIR_HEIGHTCOMBOX,m_strStairHeight); m_nStepNum=(int)(_tstof(m_strStairHeight)/_tstof(m_strStepHeight)+0.5); m_strStepHeight.Format(_T("%.2f"),(_tstof(m_strStairHeight)/m_nStepNum)); DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight); DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum); stepNum1.SetRange(2,m_nStepNum-2); stepNum2.SetRange(2,m_nStepNum-2); DDX_Text(&dxOut,IDC_STEP_NUM1,m_iStepNum1=m_nStepNum/2); DDX_Text(&dxOut,IDC_STEP_NUM2,m_iStepNum2=m_nStepNum-m_iStepNum1); UpdateImage(); } return; } void CParallelStairDlg::OnClose() { GetDlgItem(IDCANCEL)->SetFocus(); CBaseStairDlg::OnClose(); } void CParallelStairDlg::OnKFStepNum() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_STEP_NUM)->GetWindowText(strText); if (fabs(_tstof(strText)-m_nStepNum)<_DIST_SNAP) return; UpdateEdit(IDC_STEP_NUM,true);//踏步总数 } } void CParallelStairDlg::OnKFStepNum1() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_STEP_NUM1)->GetWindowText(strText); if (fabs(_tstof(strText)-m_iStepNum1)<_DIST_SNAP) return; UpdateEdit(IDC_STEP_NUM1,true); } } void CParallelStairDlg::OnKFStepNum2() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_STEP_NUM2)->GetWindowText(strText); if (fabs(_tstof(strText)-m_iStepNum2)<_DIST_SNAP) return; UpdateEdit(IDC_STEP_NUM2,true); } } void CParallelStairDlg::OnKFStepWidth() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_STEP_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStepWidth))<_DIST_SNAP) return; UpdateEdit(IDC_STEP_WIDTH,true); } } void CParallelStairDlg::OnKFRailDistToSide() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_RAIL_DISTTOSIDE)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailDistToSide))<_DIST_SNAP) return; UpdateEdit(IDC_RAIL_DISTTOSIDE,true); } } void CParallelStairDlg::OnKFRailHeight() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_RAIL_HEIGHT)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailHeight))<_DIST_SNAP) return; UpdateEdit(IDC_RAIL_HEIGHT,true); } } void CParallelStairDlg::OnKFRailWidth() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_RAIL_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailWidth))<_DIST_SNAP) return; UpdateEdit(IDC_RAIL_WIDTH,true); } } void CParallelStairDlg::OnKFRailOutDisMid() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_EDIT_RAILDIST2)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailOutDisMid))<_DIST_SNAP) return; UpdateEdit(IDC_EDIT_RAILDIST2,true); } } void CParallelStairDlg::OnKFSideStairWidth() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_SIDESTAIR_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strSideStairWidth))<_DIST_SNAP) return; UpdateEdit(IDC_SIDESTAIR_WIDTH,true); } } void CParallelStairDlg::OnKFMidStairWidth() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_MIDSTAIR_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strMidStairWidth))<_DIST_SNAP) return; UpdateEdit(IDC_MIDSTAIR_WIDTH,true); } } void CParallelStairDlg::OnKFStairHeight() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_STAIR_HEIGHTCOMBOX)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStairHeight))<_DIST_SNAP) return; UpdateEdit(IDC_STAIR_HEIGHTCOMBOX,true); } } void CParallelStairDlg::OnKFStairWidth() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_STAIR_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strStairWidth))<_DIST_SNAP) return; UpdateEdit(IDC_STAIR_WIDTH,true); } } void CParallelStairDlg::OnKFSlabWidth() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_FLATFORM_WIDTH)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strSlabWidth))<_DIST_SNAP) return; UpdateEdit(IDC_FLATFORM_WIDTH,true); } } void CParallelStairDlg::OnKFSectStepNum() { if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_POU_NUM)->GetWindowText(strText); if (fabs(_tstof(strText)-m_iSectStepNum)<_DIST_SNAP) return; UpdateEdit(IDC_POU_NUM,true); } } void CParallelStairDlg::OnKFRailOutDist() {//扶手伸出距离 if (GetFocus()!=GetDlgItem(IDCANCEL)) { //modiby by xlc on 090317 CString strText; GetDlgItem(IDC_OUTRAIL_DIST)->GetWindowText(strText); if (fabs(_tstof(strText)-_tstof(m_strRailOutDis))<_DIST_SNAP) return; UpdateEdit(IDC_OUTRAIL_DIST,true); } }