156 lines
4.4 KiB
C++
156 lines
4.4 KiB
C++
// AscentDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "Resource.h"
|
|
#include "AscentDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAscentDlg dialog
|
|
CString CAscentDlg::m_strAscentElev = _T("0");
|
|
CString CAscentDlg::m_strAscentHeight = _T("450");
|
|
CString CAscentDlg::m_strAscentIndent = _T("300");
|
|
CString CAscentDlg::m_strAscentLen = _T("2100");
|
|
CString CAscentDlg::m_strAscentWidth = _T("3000");
|
|
BOOL CAscentDlg::m_bNeedAntiskid = TRUE;
|
|
BOOL CAscentDlg::m_bLeftAlign = FALSE;
|
|
BOOL CAscentDlg::m_bRightAlign = FALSE;
|
|
// --------------------------- [9/28/2007 nsh]
|
|
//BOOL CAscentDlg::m_bgroup2Status=TRUE;
|
|
//BOOL CAscentDlg::m_bgroup1Status=FALSE;
|
|
|
|
IMPLEMENT_DYNAMIC(CAscentDlg, CObjPreviewDlg)
|
|
CAscentDlg::CAscentDlg(CWnd* pParent /*=NULL*/)
|
|
: CObjPreviewDlg(CAscentDlg::IDD, pParent)//,m_group1(WG_ST_HORZ),m_group2(WG_ST_HORZ)
|
|
{
|
|
//{{AFX_DATA_INIT(CAscentDlg)
|
|
//}}AFX_DATA_INIT
|
|
//初始话
|
|
m_bEdit=FALSE;//处于非编辑状态
|
|
m_pBakObj=NULL;//为空状态
|
|
}
|
|
|
|
CAscentDlg::~CAscentDlg()
|
|
{
|
|
if (m_bEdit)
|
|
delete m_pBakObj;
|
|
}
|
|
void CAscentDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CObjPreviewDlg::DoDataExchange(pDX);
|
|
// -------------------------------------- [9/28/2007 nsh]
|
|
//DDX_Control(pDX,IDC_GROUP1,m_group1);
|
|
//DDX_Control(pDX,IDC_GROUP2,m_group2);
|
|
//DDX_GroupStatus(pDX,IDC_GROUP1,m_bgroup1Status);
|
|
//DDX_GroupStatus(pDX,IDC_GROUP2,m_bgroup2Status);
|
|
//{{AFX_DATA_MAP(CAscentDlg)
|
|
DDX_Text(pDX, IDC_ASCENT_ELEV, m_strAscentElev);
|
|
DDX_Text(pDX, IDC_ASCENT_HEIGHT, m_strAscentHeight);
|
|
DDX_Text(pDX, IDC_ASCENT_INDENT, m_strAscentIndent);
|
|
DDX_Text(pDX, IDC_ASCENT_LEN, m_strAscentLen);
|
|
DDX_Text(pDX, IDC_ASCENT_WIDTH, m_strAscentWidth);
|
|
DDX_Check(pDX, IDC_NEEDANTISKID, m_bNeedAntiskid);
|
|
DDX_Check(pDX, IDC_LEFT_ALIGN, m_bLeftAlign);
|
|
DDX_Check(pDX, IDC_RIGHT_ALIGN, m_bRightAlign);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CAscentDlg, CObjPreviewDlg)
|
|
//{{AFX_MSG_MAP(CAscentDlg)
|
|
ON_EN_KILLFOCUS(IDC_ASCENT_HEIGHT, UpdateImage)
|
|
ON_EN_KILLFOCUS(IDC_ASCENT_INDENT, UpdateImage)
|
|
ON_EN_KILLFOCUS(IDC_ASCENT_LEN, UpdateImage)
|
|
ON_EN_KILLFOCUS(IDC_ASCENT_WIDTH, UpdateImage)
|
|
ON_BN_CLICKED(IDC_NEEDANTISKID, UpdateImage)
|
|
ON_BN_CLICKED(IDC_LEFT_ALIGN, UpdateImage)
|
|
ON_BN_CLICKED(IDC_RIGHT_ALIGN, UpdateImage)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAscentDlg message handlers
|
|
|
|
void CAscentDlg::Dlg2Obj(AcDbEntity *pObj) // 公共部分
|
|
{
|
|
TDbAscent *pStep=TDbAscent::cast(pObj);
|
|
ASSERT(pStep);
|
|
pStep->SetWidth(_tstof(m_strAscentWidth));
|
|
pStep->SetHeight(_tstof(m_strAscentHeight));
|
|
pStep->SetLength(_tstof(m_strAscentLen));
|
|
pStep->SetIdent(_tstof(m_strAscentIndent));
|
|
pStep->SetSlant(m_bNeedAntiskid);
|
|
pStep->SetAlignment(OFFSET_LEFT, m_bLeftAlign);
|
|
pStep->SetAlignment(OFFSET_RIGHT, m_bRightAlign);
|
|
pStep->SetElevation(_tstof(m_strAscentElev));
|
|
// [8/14/2008 nsh]
|
|
//------------------------
|
|
if (m_bEdit)
|
|
{
|
|
delete m_pBakObj;
|
|
m_pBakObj=(TDbAscent*)(pObj->clone());
|
|
}
|
|
|
|
//------------------------
|
|
return;
|
|
}
|
|
|
|
|
|
void CAscentDlg::Obj2Dlg(const AcDbEntity *pObj)// 公共部分
|
|
{
|
|
TDbAscent *pStep=TDbAscent::cast(pObj);
|
|
|
|
ASSERT(pStep);
|
|
// [8/14/2008 nsh]
|
|
//--------------------------------
|
|
m_bEdit=TRUE;
|
|
m_pBakObj=(TDbAscent*)(pObj->clone());//专递值
|
|
//--------------------------------
|
|
m_strAscentWidth = (const TCHAR *)Dist2Str(pStep->GetWidth());
|
|
m_strAscentHeight = (const TCHAR *)Dist2Str(pStep->GetHeight());
|
|
m_strAscentLen = (const TCHAR *)Dist2Str(pStep->GetLength());
|
|
m_strAscentIndent = (const TCHAR *)Dist2Str(pStep->GetIdent());
|
|
m_strAscentElev = (const TCHAR *)Dist2Str(pStep->GetElevation());
|
|
m_bNeedAntiskid = pStep->HasSlant();
|
|
m_bLeftAlign = pStep->IsAligned(OFFSET_LEFT);
|
|
m_bRightAlign = pStep->IsAligned(OFFSET_RIGHT);
|
|
return;
|
|
}
|
|
|
|
AcDbEntity * CAscentDlg::NewObject()
|
|
{
|
|
TDbAscent *pEnt=new TDbAscent;
|
|
if (m_pBakObj==NULL)
|
|
{
|
|
pEnt=new TDbAscent;
|
|
pEnt->setLayer(InitLayer(LAY_STAIR));
|
|
return pEnt;
|
|
}
|
|
else
|
|
{
|
|
return (AcDbEntity*)(m_pBakObj->clone());
|
|
}
|
|
return pEnt;
|
|
}
|
|
|
|
BOOL CAscentDlg::OnInitDialog()
|
|
{
|
|
CObjPreviewDlg::OnInitDialog();
|
|
//AddTip(IDC_ASCENT_INDENT);
|
|
AddTip(IDC_ASCENT_INDENT_TEXT);
|
|
|
|
UpdateImage();
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
|
|
|