1219 lines
29 KiB
C++
1219 lines
29 KiB
C++
// MultiStairCreateDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "MultiStairCreateDlg.h"
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CMultiStairCreateDlg dialog
|
|
CString CMultiStairCreateDlg::m_strRailHeight = _T("900");
|
|
CString CMultiStairCreateDlg::m_strRailWidth = _T("60");
|
|
CString CMultiStairCreateDlg::m_strRailDistToSide = _T("0");
|
|
BOOL CMultiStairCreateDlg::m_bAutoRail=FALSE;
|
|
BOOL CMultiStairCreateDlg::m_bLeftHand=FALSE;
|
|
BOOL CMultiStairCreateDlg::m_bRightHand=FALSE;
|
|
int CMultiStairCreateDlg::m_nBaseType=0;
|
|
int CMultiStairCreateDlg::m_nMakeMode = 0;
|
|
int CMultiStairCreateDlg::m_nStairFlag = 1;
|
|
|
|
int CMultiStairCreateDlg::m_nStepNum1 = 20;
|
|
CString CMultiStairCreateDlg::m_strStepHeight1;
|
|
CString CMultiStairCreateDlg::m_strStairHeight1;
|
|
BOOL CMultiStairCreateDlg::m_bgroup6Status =FALSE;
|
|
BOOL CMultiStairCreateDlg::m_bWndStatus=TRUE;
|
|
//对错误判断的初始化
|
|
BOOL CMultiStairCreateDlg::m_bError=FALSE;
|
|
BOOL CMultiStairCreateDlg::m_bUpdateEdit=FALSE;
|
|
BOOL CMultiStairCreateDlg::m_bGetStair =FALSE;
|
|
BOOL CMultiStairCreateDlg::m_bCheckSW =FALSE;
|
|
BOOL CMultiStairCreateDlg::m_bRCButton=FALSE;
|
|
CMultiStairCreateDlg * CMultiStairCreateDlg::m_pWnd=NULL;
|
|
//新增成员初始化
|
|
CString CMultiStairCreateDlg::m_strFirstStairRailDist=_T("60");
|
|
CString CMultiStairCreateDlg::m_strEndStairRailDist=_T("60");
|
|
BOOL CMultiStairCreateDlg::m_bUpDir=TRUE;
|
|
CString CMultiStairCreateDlg::m_strSectHeight=_T("750");
|
|
int CMultiStairCreateDlg::m_iSectNum=5;//剖切步数
|
|
//-------------------------------------------------
|
|
CMultiStairCreateDlg::CMultiStairCreateDlg(CWnd* pParent /*=NULL*/)
|
|
: CLineStairDlg(CMultiStairCreateDlg::IDD, pParent),m_group6(0)
|
|
{
|
|
|
|
|
|
//{{AFX_DATA_INIT(CMultiStairCreateDlg)
|
|
m_bLeftWall=FALSE;
|
|
m_bRightWall=FALSE;
|
|
//}}AFX_DATA_INIT
|
|
|
|
Exchange(m_strStairHeight,m_strStairHeight1);
|
|
Exchange(m_strStepHeight,m_strStepHeight1);
|
|
Exchange(m_nStepNum,m_nStepNum1);
|
|
|
|
m_strStairHeight=Dist2Str(DocGetLHeight());
|
|
m_strStepHeight.Format(_T("%.2f"),DocGetLHeight()/m_nStepNum);//modified on 03/07/15 by whl
|
|
|
|
m_bNeed2D0=m_bNeed2D;
|
|
m_bNeed3D0=m_bNeed3D;
|
|
m_bNeed2D=m_bNeed3D=TRUE;
|
|
m_bClickClose=FALSE;
|
|
m_bModify=TRUE;
|
|
m_bChangeMode=TRUE;
|
|
m_bEdit=FALSE;//处于非编辑状态
|
|
m_pBakObj=NULL;//为空状态
|
|
}
|
|
|
|
CMultiStairCreateDlg::~CMultiStairCreateDlg()
|
|
{
|
|
//多跑楼梯对这两个静态项不影响
|
|
m_bNeed2D=m_bNeed2D0;
|
|
m_bNeed3D=m_bNeed3D0;
|
|
|
|
Exchange(m_strStairHeight,m_strStairHeight1);
|
|
Exchange(m_strStepHeight,m_strStepHeight1);
|
|
Exchange(m_nStepNum,m_nStepNum1);
|
|
}
|
|
|
|
void CMultiStairCreateDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CLineStairDlg::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CMultiStairCreateDlg)
|
|
DDX_Radio(pDX, IDC_DRAG_MAKE, m_nMakeMode);
|
|
DDX_Check(pDX, IDC_LEFT_WALL, m_bLeftWall);
|
|
DDX_Check(pDX, IDC_RIGHT_WALL, m_bRightWall);
|
|
//}}AFX_DATA_MAP
|
|
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_LHAND, m_bLeftHand);
|
|
DDX_Check(pDX, IDC_HAS_RHAND, m_bRightHand);
|
|
DDX_Radio(pDX, IDC_LEFT_BASE, m_nBaseType);
|
|
DDX_Radio(pDX, IDC_RADIO_FIRST, m_nStairFlag);
|
|
DDX_Control(pDX,IDC_GROUP6,m_group6);
|
|
DDX_Control(pDX,IDC_SPIN1,m_ctrSpinButton);
|
|
DDX_GroupStatus(pDX,IDC_GROUP6,m_bgroup6Status);
|
|
// DDX_Control(pDX,IDC_COMBO_STAIRHEIGHT1,m_ctrlStairHeight);
|
|
//新增内容的映射
|
|
// [7/23/2008 nsh]
|
|
DDX_Check(pDX,IDC_CHECK_UPDIR,m_bUpDir);//标注上楼方向
|
|
DDX_Text(pDX,IDC_EDIT_FIRSTDIST,m_strFirstStairRailDist);//首段扶手伸出
|
|
DDX_Text(pDX,IDC_EDIT_ENDDIST,m_strEndStairRailDist);//尾端扶手伸出
|
|
DDX_Text(pDX,IDC_EDIT_SECTHEIGHT,m_strSectHeight);//剖切高度
|
|
DDX_Text(pDX,IDC_EDIT1,m_iSectNum);//剖切步数
|
|
//-----------------------------------------
|
|
|
|
}
|
|
BEGIN_MESSAGE_MAP(CMultiStairCreateDlg, CLineStairDlg)
|
|
//{{AFX_MSG_MAP(CMultiStairCreateDlg)
|
|
// NOTE: the ClassWizard will add message map macros here
|
|
ON_BN_CLICKED(IDC_MATCH_PATH,OnDragClick)
|
|
ON_BN_CLICKED(IDC_DRAG_MAKE,OnDragMake)
|
|
ON_BN_CLICKED(IDC_RADIO_FIRST,OnFirstClick)
|
|
ON_BN_CLICKED(IDC_RADIO_MID,OnMidClick)
|
|
ON_BN_CLICKED(IDC_RADIO_TOP,OnTopClick)
|
|
ON_BN_CLICKED(IDC_LEFT_BASE,OnLeftBase)
|
|
ON_BN_CLICKED(IDC_RIGHT_BASE,OnRightBase)
|
|
ON_BN_CLICKED(IDC_LEFT_WALL,OnLeftWall)
|
|
ON_BN_CLICKED(IDC_RIGHT_WALL,OnRightWall)
|
|
//对边梁的处理过程
|
|
ON_BN_CLICKED(IDC_LEFT_BEAM,OnLeftBeamClk)
|
|
ON_BN_CLICKED(IDC_RIGHT_BEAM,OnRightBeamClk)
|
|
//对坡道的处理过程
|
|
ON_BN_CLICKED(IDC_AS_ASCENT,OnAsAscentClk)
|
|
ON_BN_CLICKED(IDC_HAS_SLANT,OnHSlentClk)
|
|
ON_BN_CLICKED(IDC_ON_GROUND,OnOGroupClk)
|
|
//扶手栏杆的处理
|
|
ON_BN_CLICKED(IDC_HAS_LHAND,OnLeftHandClk)
|
|
ON_BN_CLICKED(IDC_HAS_RHAND,OnRightHandClk)
|
|
ON_BN_CLICKED(IDC_AUTORAIL,OnAutoRailClk)
|
|
//扶手的编辑框的change and killfoucs event
|
|
ON_EN_CHANGE(IDC_RAIL_HEIGHT,OnRailHeightChange)
|
|
ON_EN_CHANGE(IDC_RAIL_WIDTH,OnRailWidthChange)
|
|
ON_EN_CHANGE(IDC_RAIL_DISTTOSIDE,OnRailDisttoSideChange)
|
|
|
|
ON_EN_KILLFOCUS(IDC_RAIL_HEIGHT,OnRailHeightKF)
|
|
ON_EN_KILLFOCUS(IDC_RAIL_WIDTH,OnRailWidthKF)
|
|
ON_EN_KILLFOCUS(IDC_RAIL_DISTTOSIDE,OnRailDisttoSideKF)
|
|
ON_EN_KILLFOCUS(IDC_STAIR_WIDTH,OnKFStairWidth)
|
|
ON_EN_KILLFOCUS(IDC_STEP_WIDTH,OnKFStepWidth)
|
|
ON_EN_KILLFOCUS(IDC_STEP_HEIGHT,OnKFStepHeight)
|
|
ON_EN_KILLFOCUS(IDC_STEP_NUM,OnKFStepNum)
|
|
ON_EN_KILLFOCUS(IDC_EDIT_FIRSTDIST,OnKFFirstRailDist)
|
|
ON_EN_KILLFOCUS(IDC_EDIT_ENDDIST,OnKFEndRailDist)
|
|
ON_EN_KILLFOCUS(IDC_EDIT_SECTHEIGHT,OnKFSectHeight)
|
|
ON_EN_KILLFOCUS(IDC_EDIT1,OnKFSectNum)
|
|
//楼梯宽度按钮
|
|
ON_BN_CLICKED(IDC_STAIR_CHECK_HEIGHT,OnStairCheckClk)
|
|
ON_WM_CLOSE()
|
|
ON_WM_NCDESTROY()
|
|
//新增事件的操作
|
|
ON_BN_CLICKED(IDC_CHECK_UPDIR,OnClickUpDir)
|
|
ON_EN_CHANGE(IDC_EDIT_FIRSTDIST,OnChangeFirstRailDist)
|
|
ON_EN_CHANGE(IDC_EDIT_ENDDIST,OnChangeEndRailDist)
|
|
ON_EN_CHANGE(IDC_EDIT_SECTHEIGHT,OnChangeSectHeight)
|
|
ON_EN_CHANGE(IDC_EDIT1,OnChangeSectNum)
|
|
ON_CBN_KILLFOCUS(IDC_COMBO_STAIRHEIGHT1,OnKFStairHeight)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_STAIRHEIGHT1,OnSelChangeStairHeight)
|
|
|
|
ON_EN_CHANGE(IDC_STAIR_WIDTH,OnChangeStairWidth)
|
|
ON_EN_CHANGE(IDC_STEP_HEIGHT,OnChangeStepHeight)
|
|
ON_EN_CHANGE(IDC_STEP_WIDTH,OnChangeStepWidth)
|
|
ON_EN_CHANGE(IDC_STEP_NUM,OnChangeStepNum)
|
|
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
BOOL CMultiStairCreateDlg::OnInitDialog()
|
|
{
|
|
BOOL res=CLineStairDlg::OnInitDialog();
|
|
AddTip(IDC_DRAG_MAKE,_T("通过鼠标拖动、点击方式来动态控制楼梯平面路径的输入"));
|
|
AddTip(IDC_MATCH_PATH,_T("通过选择已有的楼梯平面路径来自动生成楼梯模型,路径的节点数需为偶数"));
|
|
if (this->m_bAsAscent ==TRUE)
|
|
{
|
|
((CButton*)(this->GetDlgItem(IDC_HAS_SLANT)))->EnableWindow(TRUE);
|
|
((CButton*)(this->GetDlgItem(IDC_ON_GROUND)))->EnableWindow(TRUE);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_HIDE);
|
|
this->GetDlgItem(IDC_EDIT1)->ShowWindow(SW_HIDE);
|
|
this->GetDlgItem(IDC_SPIN1)->ShowWindow(SW_HIDE);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECTHEIGHT)->ShowWindow(SW_SHOW);
|
|
this->GetDlgItem(IDC_EDIT_SECTHEIGHT)->ShowWindow(SW_SHOW);
|
|
}
|
|
else
|
|
{
|
|
((CButton*)(this->GetDlgItem(IDC_HAS_SLANT)))->EnableWindow(FALSE);
|
|
((CButton*)(this->GetDlgItem(IDC_ON_GROUND)))->EnableWindow(FALSE);
|
|
|
|
//((CButton*)(this->GetDlgItem(IDC_HAS_SLANT)))->EnableWindow(TRUE);
|
|
//((CButton*)(this->GetDlgItem(IDC_ON_GROUND)))->EnableWindow(TRUE);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_SHOW);
|
|
this->GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);
|
|
this->GetDlgItem(IDC_SPIN1)->ShowWindow(SW_SHOW);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECTHEIGHT)->ShowWindow(SW_HIDE);
|
|
this->GetDlgItem(IDC_EDIT_SECTHEIGHT)->ShowWindow(SW_HIDE);
|
|
}
|
|
|
|
CDataExchange dxOut(this,false);
|
|
if (m_bAsAscent)
|
|
{
|
|
m_strSectHeight=Dist2Str((m_iSectNum-0.5)*::_tstof(m_strStepHeight));
|
|
DDX_Text(&dxOut,IDC_EDIT_SECTHEIGHT,m_strSectHeight);
|
|
}
|
|
else
|
|
{
|
|
m_iSectNum=(int)(::_tstof(m_strSectHeight)/::_tstof(m_strStepHeight)+0.5);
|
|
DDX_Text(&dxOut,IDC_EDIT1,m_iSectNum);
|
|
}
|
|
m_ctrSpinButton.SetRange(1,m_nStepNum);
|
|
|
|
if (!(m_bLeftHand||m_bRightHand))
|
|
{
|
|
GetDlgItem(IDC_AUTORAIL)->EnableWindow(FALSE);
|
|
}
|
|
|
|
if (m_bEdit)
|
|
{
|
|
CRect rect,rect1,rect2;
|
|
GetDlgItem(IDC_DRAG_MAKE)->GetWindowRect(rect);
|
|
ScreenToClient(rect);
|
|
GetDlgItem(IDC_LEFT_BASE)->MoveWindow(rect);
|
|
GetDlgItem(IDC_MATCH_PATH)->GetWindowRect(rect1);
|
|
ScreenToClient(rect1);
|
|
GetDlgItem(IDC_RIGHT_BASE)->MoveWindow(rect1);
|
|
GetDlgItem(IDC_GROUP4)->GetWindowRect(rect2);
|
|
ScreenToClient(rect2);
|
|
rect2.bottom = rect1.bottom+5;
|
|
GetDlgItem(IDC_GROUP4)->MoveWindow(rect2);
|
|
|
|
GetDlgItem(IDC_DRAG_MAKE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_MATCH_PATH)->ShowWindow(SW_HIDE);
|
|
}
|
|
else
|
|
{
|
|
GetDlgItem(IDOK)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
|
|
}
|
|
return res;
|
|
}
|
|
AcDbEntity*CMultiStairCreateDlg::NewObject()
|
|
{
|
|
TDbEntity*pObj=new TDbMultiStair;
|
|
return pObj;
|
|
}
|
|
|
|
void CMultiStairCreateDlg::Dlg2Obj(AcDbEntity*pObj)
|
|
{
|
|
TDbMultiStair *pStep=TDbMultiStair::cast(pObj);
|
|
ASSERT(pStep);
|
|
|
|
pStep->SetAscent(m_bAsAscent);
|
|
if (m_bAsAscent)//modified by whl on 03/08/15
|
|
{
|
|
pStep->SetSlant(m_bHasSlant);
|
|
pStep->SetOnGround(m_bOnGround);
|
|
}
|
|
|
|
pStep->SetElevation(_tstof(m_strElev));
|
|
pStep->SetStairHeight(_tstof(m_strStairHeight));
|
|
pStep->SetStairWidth(_tstof(m_strStairWidth));
|
|
pStep->SetStepWidth(_tstof(m_strStepWidth));
|
|
pStep->SetStepHeight(_tstof(m_strStepHeight));
|
|
pStep->SetRailHeight(_tstof(m_strRailHeight));
|
|
pStep->SetRailWidth(_tstof(m_strRailWidth));
|
|
pStep->SetRailDistToSide(_tstof(m_strRailDistToSide));
|
|
pStep->SetAutoRail(m_bAutoRail);
|
|
pStep->SetPathSide(m_nBaseType);
|
|
pStep->SetHandRail(OFFSET_LEFT, m_bLeftHand);
|
|
pStep->SetHandRail(OFFSET_RIGHT, m_bRightHand);
|
|
pStep->SetSideBeam(OFFSET_LEFT, m_bNeedLeft);
|
|
pStep->SetSideBeam(OFFSET_RIGHT, m_bNeedRight);
|
|
pStep->SetStairFlag(m_nStairFlag);
|
|
pStep->SetAlongWall(0, m_bLeftWall);
|
|
pStep->SetAlongWall(1, m_bRightWall);
|
|
//新增
|
|
pStep->SetRailDist(::_tstof(m_strFirstStairRailDist));
|
|
pStep->SetRailDistEnd(::_tstof(m_strEndStairRailDist));
|
|
if (m_bAsAscent)
|
|
pStep->SetSectElev(::_tstof(m_strSectHeight));
|
|
else
|
|
pStep->SetSectStepNum(m_iSectNum);
|
|
pStep->SetArrow(m_bUpDir);
|
|
|
|
}
|
|
void CMultiStairCreateDlg::Obj2Dlg(AcDbEntity *pObj)//modified by whl on 03/08/15
|
|
{
|
|
TDbMultiStair *pStep=TDbMultiStair::cast(pObj);
|
|
ASSERT(pStep);
|
|
|
|
m_bAsAscent=pStep->IsAscent();
|
|
if (m_bAsAscent)
|
|
{
|
|
m_bHasSlant=pStep->HasSlant();
|
|
m_bOnGround=pStep->IsOnGround();
|
|
}
|
|
|
|
m_strElev=Dist2Str(pStep->GetElevation());
|
|
m_strStairHeight=Dist2Str(pStep->GetStairHeight());
|
|
m_strStairWidth=Dist2Str(pStep->GetStairWidth());
|
|
m_strRailHeight=Dist2Str(pStep->GetRailHeight());
|
|
m_strRailWidth=Dist2Str(pStep->GetRailWidth());
|
|
m_strStepWidth=Dist2Str(pStep->GetStepWidth());
|
|
m_strStepHeight=Dist2Str(pStep->GetStepHeight());
|
|
m_strRailDistToSide=Dist2Str(pStep->GetRailDistToSide());
|
|
m_bAutoRail=pStep->IsAutoRail();
|
|
m_nBaseType=pStep->GetPathSide();
|
|
m_bLeftHand=pStep->HasHandRail(OFFSET_LEFT);
|
|
m_bRightHand=pStep->HasHandRail(OFFSET_RIGHT);
|
|
m_bNeedLeft=pStep->HasSideBeam(OFFSET_LEFT);
|
|
m_bNeedRight=pStep->HasSideBeam(OFFSET_RIGHT);
|
|
m_nStairFlag=pStep->GetStairFlag();
|
|
m_nStepNum=pStep->GetTotalStepNum();
|
|
m_bLeftWall=pStep->IsAlongWall(0);
|
|
m_bRightWall=pStep->IsAlongWall(1);
|
|
//新增
|
|
m_strFirstStairRailDist=Dist2Str(pStep->GetRailDist());
|
|
m_strEndStairRailDist=Dist2Str(pStep->GetRailDistEnd());
|
|
m_strSectHeight=Dist2Str(pStep->GetSectElev());
|
|
|
|
//add by xlc on 090525 初始化剖切步数
|
|
if (::_tstof(m_strStepHeight)>_DIST_SNAP)
|
|
m_iSectNum=(int)(_tstof(m_strSectHeight)/::_tstof(m_strStepHeight)+0.5);
|
|
|
|
m_bUpDir=pStep->IsArrow();
|
|
|
|
}
|
|
//对EditBox的处理一般都在UpdateEdit的过程中
|
|
bool CMultiStairCreateDlg::UpdateEdit(UINT ctrlID,bool bReportError)
|
|
{
|
|
if (!bValidWnd)
|
|
return false;
|
|
CEdit *pEdit=(CEdit*)GetDlgItem(ctrlID);
|
|
if (pEdit==NULL)
|
|
return false;
|
|
|
|
static bool bUpdating=false;
|
|
if (bUpdating)
|
|
return false;
|
|
bUpdating=true;
|
|
|
|
bool result=true;
|
|
CDataExchange dxOut(this,false);
|
|
CString temp;
|
|
pEdit->GetWindowText(temp);
|
|
if (ctrlID==IDC_STAIR_LENGTH||ctrlID==IDC_STEP_WIDTH||ctrlID==IDC_STAIR_WIDTH||ctrlID==IDC_RAIL_HEIGHT||ctrlID==IDC_RAIL_WIDTH||ctrlID==IDC_RAIL_DISTTOSIDE)
|
|
{
|
|
if (ctrlID==IDC_STAIR_LENGTH)
|
|
{
|
|
|
|
}
|
|
else if (ctrlID==IDC_STEP_WIDTH)
|
|
{
|
|
if (_tstof(temp)>_DIST_SNAP)
|
|
{
|
|
m_strStepWidth=temp;
|
|
//m_strStairLength=Dist2Str(_tstof(temp)*(m_bAsAscent? m_nStepNum : m_nStepNum-1));
|
|
//DDX_Text(&dxOut,IDC_STAIR_LENGTH,m_strStairLength);
|
|
//UpdateImage();
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
AfxMessageBox(_T("踏步宽度太小!"));
|
|
DDX_Text(&dxOut,IDC_STEP_WIDTH,m_strStepWidth);
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
else if (ctrlID==IDC_RAIL_HEIGHT)
|
|
{//扶手高度的处理过程
|
|
if (_tstof(temp)>_DIST_SNAP)
|
|
{
|
|
m_strRailHeight =temp;
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
this->MessageBox(_T("输入的扶手高度不正确,请正确填写!"),_T("AutoCAD"),MB_OK);
|
|
DDX_Text(&dxOut,IDC_RAIL_HEIGHT,m_strRailHeight);
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
else if (ctrlID==IDC_RAIL_WIDTH)
|
|
{//扶手宽度的处理过程
|
|
if (_tstof(temp)>_DIST_SNAP)
|
|
{
|
|
m_strRailWidth=temp;
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
this->MessageBox(_T("输入的扶手宽度不正确,请正确填写!"),_T("AutoCAD"),MB_OK);
|
|
DDX_Text(&dxOut,IDC_RAIL_WIDTH,m_strRailWidth);
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
else if (ctrlID==IDC_RAIL_DISTTOSIDE)
|
|
{//扶手距边的处理过程
|
|
|
|
if (temp!="" && _tstof(temp)>=0 && _tstof(temp)<_tstof(m_strStairWidth)*0.5)
|
|
{
|
|
m_strRailDistToSide =temp;
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
this->MessageBox(_T("输入的扶手距边不正确,请正确填写!"),_T("AutoCAD"),MB_OK);
|
|
m_bError=TRUE;
|
|
DDX_Text(&dxOut,IDC_RAIL_DISTTOSIDE,m_strRailDistToSide);
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
else if (ctrlID==IDC_STAIR_WIDTH)
|
|
{
|
|
if (_tstof(temp)>0)
|
|
{
|
|
m_strStairWidth=temp;
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
AfxMessageBox(_T("梯段宽度太小!"));
|
|
pEdit->SetFocus();
|
|
DDX_Text(&dxOut,IDC_STAIR_WIDTH,m_strStairWidth);//还原
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
|
|
}
|
|
//新增
|
|
else if (ctrlID==IDC_CHECK_UPDIR)
|
|
{
|
|
CDataExchange dxIn(this,TRUE);
|
|
DDX_Check(&dxIn,IDC_CHECK_UPDIR,m_bUpDir);
|
|
DDX_Check(&dxOut,IDC_CHECK_UPDIR,m_bUpDir);
|
|
}
|
|
else if (ctrlID==IDC_EDIT_FIRSTDIST)
|
|
{
|
|
m_strFirstStairRailDist=temp;
|
|
DDX_Text(&dxOut,IDC_EDIT_FIRSTDIST,m_strFirstStairRailDist);
|
|
}
|
|
else if (ctrlID==IDC_EDIT_ENDDIST)
|
|
{
|
|
m_strEndStairRailDist=temp;
|
|
DDX_Text(&dxOut,IDC_EDIT_ENDDIST,m_strEndStairRailDist);
|
|
}
|
|
else if (ctrlID==IDC_EDIT_SECTHEIGHT)
|
|
{
|
|
if (_tstof(temp)>_DIST_SNAP&&_tstof(temp)<_tstof(m_strStairHeight))
|
|
{
|
|
m_strSectHeight=temp;
|
|
m_iSectNum=(int)(_tstof(m_strSectHeight)/::_tstof(m_strStepHeight)+0.5);
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
this->MessageBox(_T("剖切高度不正确!"),_T("AutoCAD"),MB_OK);
|
|
DDX_Text(&dxOut,IDC_EDIT_SECTHEIGHT,m_strSectHeight);
|
|
}
|
|
}
|
|
else if (ctrlID==IDC_EDIT1)
|
|
{
|
|
if (_ttoi(temp)>0&&_ttoi(temp)<m_nStepNum)
|
|
{
|
|
m_iSectNum=::_ttoi(temp);
|
|
m_strSectHeight.Format(_T("%d"),(m_iSectNum-0.5)*::_tstof(m_strStepHeight));
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
this->MessageBox(_T("剖切步数不正确!"),_T("AutoCAD"),MB_OK);
|
|
DDX_Text(&dxOut,IDC_EDIT1,m_iSectNum);
|
|
}
|
|
}
|
|
//-----------------------------------------------
|
|
else if (ctrlID==IDC_STEP_NUM)
|
|
{
|
|
if (_ttoi(temp)>1)
|
|
{
|
|
CString strStairHeight=m_strStairHeight;
|
|
if (strStairHeight == _T("当前层高"))
|
|
{
|
|
strStairHeight = Dist2Str(DocGetLHeight());
|
|
}
|
|
|
|
m_nStepNum=_ttoi(temp);
|
|
m_strStepHeight.Format(_T("%.2f"),_tstof(strStairHeight)/m_nStepNum);
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
this->MessageBox(_T("总踏步数至少为2!"),_T("AutoCAD"),MB_OK);
|
|
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
if (m_bEdit)
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
else if (ctrlID==IDC_STEP_HEIGHT)
|
|
{
|
|
CString strStairHeight=m_strStairHeight;
|
|
if (strStairHeight == _T("当前层高"))
|
|
{
|
|
strStairHeight = Dist2Str(DocGetLHeight());
|
|
}
|
|
int num(1);
|
|
if (fabs(_tstof(temp))>_DIST_SNAP)
|
|
{
|
|
num=(int)(_tstof(strStairHeight)/_tstof(temp)+0.5);
|
|
}
|
|
if (num>1)
|
|
{
|
|
m_nStepNum=num;
|
|
m_strStepHeight.Format(_T("%.2f"),_tstof(strStairHeight)/m_nStepNum);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);//自动调整
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
this->MessageBox(_T("新踏步高度将造成踏步数小于2,请重新输入或先增大梯段高度!"),_T("AutoCAD"),MB_OK);
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
if (m_bEdit)
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
else if (ctrlID==IDC_COMBO_STAIRHEIGHT1)
|
|
{
|
|
if (_tstof(temp)>=2*_tstof(m_strStepHeight)-_DIST_SNAP) {//最少当前二踏步高
|
|
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);
|
|
}
|
|
else if (bReportError)
|
|
{
|
|
m_bError=TRUE;
|
|
this->MessageBox(_T("梯段高度太小!"),_T("AutoCAD"),MB_OK);
|
|
DDX_Text(&dxOut,IDC_COMBO_STAIRHEIGHT1,m_strStairHeight);//还原
|
|
if (m_bEdit)
|
|
pEdit->SetFocus();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
result=false;
|
|
}
|
|
//对错误情况的处理
|
|
m_bUpdateEdit=TRUE;
|
|
if (!m_bEdit&&!m_bError)
|
|
{
|
|
// acedPostCommand(_T("\33"));
|
|
}
|
|
else
|
|
{
|
|
m_bError=FALSE;
|
|
}
|
|
bUpdating=false;
|
|
return result;
|
|
}
|
|
|
|
void CMultiStairCreateDlg::OnOK()
|
|
{
|
|
CModelessDialog::OnOK();
|
|
}
|
|
void CMultiStairCreateDlg::OnDragClick()
|
|
{
|
|
if (!m_bChangeMode)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
m_nMakeMode=1;
|
|
m_bRCButton =TRUE;
|
|
if (!m_bEdit)
|
|
acedPostCommand(_T("\33"));
|
|
}
|
|
void CMultiStairCreateDlg::OnDragMake()
|
|
{
|
|
if (!m_bChangeMode)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
m_nMakeMode =0;
|
|
m_bRCButton =TRUE;
|
|
if (!m_bEdit)
|
|
acedPostCommand(_T("\33"));
|
|
}
|
|
void CMultiStairCreateDlg::OnFirstClick()
|
|
{//处理首层选择的过程
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
m_nStairFlag=0;
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnMidClick()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
m_nStairFlag=1;
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnTopClick()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
m_nStairFlag=2;
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnCancel()
|
|
{
|
|
if (m_bEdit)
|
|
{
|
|
CLineStairDlg::OnCancel();
|
|
}
|
|
else
|
|
m_pWnd=NULL;
|
|
}
|
|
void CMultiStairCreateDlg::OnLeftWall()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnRightWall()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
//m_bRightWall=1;
|
|
this->UpdateData();
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnLeftBase()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
m_nBaseType=0;
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnRightBase()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
m_nBaseType=1;
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
//对边梁单击的处理过程
|
|
void CMultiStairCreateDlg::OnLeftBeamClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
//m_bNeedLeft=
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnRightBeamClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
//对坡道的处理过程
|
|
void CMultiStairCreateDlg::OnAsAscentClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
// m_bRCButton =TRUE;
|
|
if (this->m_bAsAscent ==TRUE)
|
|
{
|
|
((CButton*)(this->GetDlgItem(IDC_HAS_SLANT)))->EnableWindow(TRUE);
|
|
((CButton*)(this->GetDlgItem(IDC_ON_GROUND)))->EnableWindow(TRUE);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_HIDE);
|
|
this->GetDlgItem(IDC_EDIT1)->ShowWindow(SW_HIDE);
|
|
this->GetDlgItem(IDC_SPIN1)->ShowWindow(SW_HIDE);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECTHEIGHT)->ShowWindow(SW_SHOW);
|
|
this->GetDlgItem(IDC_EDIT_SECTHEIGHT)->ShowWindow(SW_SHOW);
|
|
}
|
|
else
|
|
{
|
|
((CButton*)(this->GetDlgItem(IDC_HAS_SLANT)))->EnableWindow(FALSE);
|
|
((CButton*)(this->GetDlgItem(IDC_ON_GROUND)))->EnableWindow(FALSE);
|
|
|
|
//((CButton*)(this->GetDlgItem(IDC_HAS_SLANT)))->EnableWindow(TRUE);
|
|
//((CButton*)(this->GetDlgItem(IDC_ON_GROUND)))->EnableWindow(TRUE);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECT)->ShowWindow(SW_SHOW);
|
|
this->GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);
|
|
this->GetDlgItem(IDC_SPIN1)->ShowWindow(SW_SHOW);
|
|
|
|
this->GetDlgItem(IDC_STATIC_SECTHEIGHT)->ShowWindow(SW_HIDE);
|
|
this->GetDlgItem(IDC_EDIT_SECTHEIGHT)->ShowWindow(SW_HIDE);
|
|
}
|
|
CDataExchange dxOut(this,false);
|
|
if (m_bAsAscent)
|
|
{
|
|
m_strSectHeight=Dist2Str((m_iSectNum-0.5)*::_tstof(m_strStepHeight));
|
|
DDX_Text(&dxOut,IDC_EDIT_SECTHEIGHT,m_strSectHeight);
|
|
}
|
|
else
|
|
{
|
|
m_iSectNum=(int)(::_tstof(m_strSectHeight)/::_tstof(m_strStepHeight)+0.5);
|
|
DDX_Text(&dxOut,IDC_EDIT1,m_iSectNum);
|
|
}
|
|
UpdateImage();
|
|
UpdateEdit(IDC_AS_ASCENT,true);
|
|
}
|
|
void CMultiStairCreateDlg::OnHSlentClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnOGroupClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnLeftHandClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
if (m_bLeftHand||m_bRightHand)
|
|
{
|
|
GetDlgItem(IDC_AUTORAIL)->EnableWindow(TRUE);
|
|
}
|
|
else
|
|
{
|
|
GetDlgItem(IDC_AUTORAIL)->EnableWindow(FALSE);
|
|
}
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnRightHandClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
if (m_bLeftHand||m_bRightHand)
|
|
{
|
|
GetDlgItem(IDC_AUTORAIL)->EnableWindow(TRUE);
|
|
}
|
|
else
|
|
{
|
|
GetDlgItem(IDC_AUTORAIL)->EnableWindow(FALSE);
|
|
}
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnAutoRailClk()
|
|
{
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
this->UpdateData();
|
|
// m_bRCButton =TRUE;
|
|
}
|
|
//扶手的编辑框的change和killfocus事件
|
|
void CMultiStairCreateDlg::OnRailHeightChange()
|
|
{
|
|
//nothing to do
|
|
return;
|
|
}
|
|
void CMultiStairCreateDlg::OnRailWidthChange()
|
|
{
|
|
//nothing to do
|
|
return;
|
|
}
|
|
void CMultiStairCreateDlg::OnRailDisttoSideChange()
|
|
{
|
|
//nothing to do
|
|
return;
|
|
}
|
|
void CMultiStairCreateDlg::OnRailHeightKF()
|
|
{
|
|
// if (this->CheckENChange(IDC_RAIL_HEIGHT,m_strStairHeight))
|
|
// {
|
|
// this->UpdateEdit(IDC_RAIL_HEIGHT,true);
|
|
// }
|
|
if (m_bClickClose)
|
|
return;
|
|
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_RAIL_HEIGHT)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailHeight))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_RAIL_HEIGHT,true);
|
|
}
|
|
return;
|
|
}
|
|
void CMultiStairCreateDlg::OnRailWidthKF()
|
|
{
|
|
// if (this->CheckENChange(IDC_RAIL_WIDTH,m_strRailWidth))
|
|
// {
|
|
// this->UpdateEdit(IDC_RAIL_WIDTH,true);
|
|
// }
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_RAIL_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_RAIL_WIDTH,true);
|
|
}
|
|
return;
|
|
}
|
|
void CMultiStairCreateDlg::OnRailDisttoSideKF()
|
|
{
|
|
// if (this->CheckENChange(IDC_RAIL_DISTTOSIDE,m_strRailDistToSide))
|
|
// {
|
|
// this->UpdateEdit(IDC_RAIL_DISTTOSIDE,true);
|
|
// }
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetFocus()!=GetDlgItem(IDCANCEL))
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_RAIL_DISTTOSIDE)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strRailDistToSide))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_RAIL_DISTTOSIDE,true);
|
|
}
|
|
return;
|
|
}
|
|
void CMultiStairCreateDlg::OnStairCheckClk()
|
|
{//拾取梯段宽度的操作
|
|
if (m_bEdit)
|
|
{
|
|
ads_real xDist;
|
|
static CString temp;
|
|
temp=m_strStairWidth;
|
|
BeginEditorCommand();
|
|
int i=ads_getdist(NULL,_T("请输入楼梯的宽度:"),&xDist);
|
|
CompleteEditorCommand();
|
|
|
|
if (i==RTNORM)
|
|
{
|
|
if (xDist>0)
|
|
{
|
|
this->UpdateData();
|
|
m_strStairWidth.Format(_T("%f"),xDist);
|
|
this->UpdateData(FALSE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (i==RTNONE)
|
|
{
|
|
m_strStairWidth =temp;
|
|
this->UpdateData(FALSE);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!m_bChangeMode)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
CMultiStairCreateDlg::m_bGetStair=TRUE;
|
|
acedGetAcadDwgView()->SetFocus();
|
|
this->ShowWindow(SW_HIDE);
|
|
CMultiStairCreateDlg::m_bCheckSW=TRUE;
|
|
acedPostCommand(_T("\33"));
|
|
}
|
|
}
|
|
//检查EditBox是否发生数值上的改变
|
|
BOOL CMultiStairCreateDlg::CheckENChange(UINT ctrlID,const CString pStr)
|
|
{
|
|
CString temp;
|
|
this->GetDlgItemText(ctrlID,temp);
|
|
if (temp==pStr)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
void CMultiStairCreateDlg::OnClose()
|
|
{
|
|
if (m_bEdit)
|
|
{
|
|
GetDlgItem(IDCANCEL)->SetFocus();
|
|
CLineStairDlg::OnClose();
|
|
}
|
|
else
|
|
{
|
|
m_bClickClose=TRUE;
|
|
m_bUpdateEdit=FALSE;
|
|
m_bCheckSW=FALSE;
|
|
m_bRCButton =FALSE;
|
|
CLineStairDlg::OnClose();
|
|
acedPostCommand(_T("\33"));
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnNcDestroy()
|
|
{
|
|
if (!m_bEdit)
|
|
{
|
|
CMultiStairCreateDlg::m_pWnd =NULL;
|
|
delete this;
|
|
}
|
|
}
|
|
//新增操作
|
|
void CMultiStairCreateDlg::OnClickUpDir()
|
|
{//标注上楼方向
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
UpdateEdit(IDC_CHECK_UPDIR,false);
|
|
return;
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeFirstRailDist()
|
|
{//首层扶手伸出
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeEndRailDist()
|
|
{//尾层扶手伸出
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeSectHeight()
|
|
{//剖切高度
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeSectNum()
|
|
{
|
|
}
|
|
//----------------------------------
|
|
void CMultiStairCreateDlg::OnKFStairWidth()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_STAIR_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStairWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STAIR_WIDTH,true);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnKFStepWidth()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_WIDTH)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStepWidth))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_WIDTH,true);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnKFStepHeight()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_HEIGHT)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStepHeight))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_HEIGHT,true);
|
|
}
|
|
}
|
|
|
|
void CMultiStairCreateDlg::OnKFStepNum()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_STEP_NUM)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-m_nStepNum)<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_STEP_NUM,true);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnKFFirstRailDist()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_EDIT_FIRSTDIST)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strFirstStairRailDist))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_EDIT_FIRSTDIST,true);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnKFEndRailDist()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_EDIT_ENDDIST)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strEndStairRailDist))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_EDIT_ENDDIST,true);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnKFSectHeight()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_EDIT_SECTHEIGHT)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strSectHeight))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_EDIT_SECTHEIGHT,true);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnKFSectNum()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetDlgItem(IDCANCEL)!=GetFocus())
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_EDIT1)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-m_iSectNum)<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_EDIT1,true);
|
|
}
|
|
}
|
|
|
|
void CMultiStairCreateDlg::OnSelChangeStairHeight()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
CString strTemp;
|
|
CDataExchange dxIn(this,TRUE);
|
|
DDX_CBString(&dxIn,IDC_COMBO_STAIRHEIGHT1,m_strStairHeight);
|
|
m_ctrlStairHeight.GetLBText(m_ctrlStairHeight.GetCurSel(),strTemp);
|
|
if (_tstof(strTemp)>=2*_tstof(m_strStepHeight)-_DIST_SNAP)
|
|
{//最少当前两踏步高
|
|
m_strStairHeight=strTemp;
|
|
m_nStepNum=(int)(_tstof(m_strStairHeight)/_tstof(m_strStepHeight)+0.5);
|
|
m_strStepHeight.Format(_T("%.2f"),(_tstof(m_strStairHeight)/m_nStepNum));
|
|
CDataExchange dxOut(this,false);
|
|
DDX_Text(&dxOut,IDC_STEP_HEIGHT,m_strStepHeight);
|
|
DDX_Text(&dxOut,IDC_STEP_NUM,m_nStepNum);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnKFStairHeight()
|
|
{
|
|
if (m_bClickClose)
|
|
return;
|
|
if (!m_bModify)
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
if (GetFocus() != GetDlgItem(IDCANCEL))
|
|
{
|
|
CString strText;
|
|
GetDlgItem(IDC_COMBO_STAIRHEIGHT1)->GetWindowText(strText);
|
|
if (fabs(_tstof(strText)-_tstof(m_strStairHeight))<_DIST_SNAP)
|
|
return;
|
|
|
|
UpdateEdit(IDC_COMBO_STAIRHEIGHT1,true);
|
|
}
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeStairWidth()
|
|
{
|
|
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeStepHeight()
|
|
{
|
|
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeStepWidth()
|
|
{
|
|
|
|
}
|
|
void CMultiStairCreateDlg::OnChangeStepNum()
|
|
{
|
|
|
|
} |