290 lines
7.3 KiB
C++
290 lines
7.3 KiB
C++
#include "stdafx.h"
|
|
#include "jig.h"
|
|
#include "DimSanitaryDlg.h"
|
|
#include "DimPipeSerialDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
// zxl 2012.04.20 add
|
|
//从注册表读取数据
|
|
bool ReadRegData(const CString &sRegName, const CString &strKey, double &dVal)
|
|
{
|
|
CRegProperty regProp(GetRegLocation(), sRegName);
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
return regProp.GetValue(strKey, dVal);
|
|
}
|
|
|
|
//将数据写入注册表
|
|
bool WriteRegData(const CString &sRegName, const CString &strKey, double dVal)
|
|
{
|
|
CRegProperty regProp(GetRegLocation(), sRegName);
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
return regProp.SetValue(strKey, dVal);
|
|
}
|
|
|
|
|
|
//***************************************************************************************************
|
|
// 标注洁具
|
|
//***************************************************************************************************
|
|
void DimSanitary()
|
|
{
|
|
InitTwtTextStyle(g_csCircleTextStyle);
|
|
CDimSanitaryDlg dlg(acedGetAcadFrame());
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
dlg.Create(IDD_DIM_SANITARY, acedGetAcadFrame());
|
|
}
|
|
dlg.ShowWindow(SW_SHOW);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
InitLayer(LAY_DIM);
|
|
XPushVarStr clayer(_T("CLAYER"), LAY_DIM);
|
|
while(1){
|
|
TDbSymbDrawingIndex *pIndex = new TDbSymbDrawingIndex;
|
|
pIndex->SetTextStyleId(InitTwtTextStyle(g_csCircleTextStyle));
|
|
pIndex->SetIndexLabel(_T("脸"));
|
|
pIndex->SetOldStyle(TRUE);
|
|
pIndex->SetDrawingLabel(_T(""));
|
|
pIndex->SetRadius(10);
|
|
pIndex->SetLineWidth(0.35);
|
|
pIndex->SetTextLayerId(InitLayer(LAY_TEXT));
|
|
XPoint ptLoc;
|
|
xg_getvar(_T("VIEWCTR"), ptLoc);
|
|
pIndex->SetCenter(Ucs2Wcs(ptLoc));
|
|
TDrawingIdxEdJig jig(pIndex, &dlg);
|
|
int nKeyIndex = 0;
|
|
|
|
jig.SetPrompt(_T("\n请给出标注位置<退出>:"));
|
|
int nRetCode = jig.DoIt(&nKeyIndex);
|
|
if(nRetCode == RTNORM) {
|
|
ptLoc = jig.GetPickPoint();
|
|
if(!dlg.m_bIsOut){
|
|
pIndex->AddToCSpace(Adesk::kTrue);
|
|
continue;
|
|
}
|
|
jig.m_ptRef = ptLoc;
|
|
jig.SetPrompt(_T("\n请给出引出位置<不引出>:"));
|
|
if(jig.DoIt() == RTNORM){
|
|
XPoint ptCen, ptTmp;
|
|
ptCen = jig.GetPickPoint();
|
|
double angle = ads_angle(ptCen, ptLoc);
|
|
ads_polar(ptCen, angle, dlg.m_nRadius*DocGetPScale(), ptTmp);
|
|
XLine line(ptLoc, ptTmp, 1);
|
|
line.Make();
|
|
}
|
|
pIndex->AddToCSpace(Adesk::kTrue);
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
|
|
//标注圆半径和宽度写入注册表zxl 2012.04.20 add
|
|
WriteRegData(_T("TWTConfig"), _T("SanitaryDimRadius"), dlg.m_nRadius);
|
|
WriteRegData(_T("TWTConfig"), _T("SanitaryDimWidth"), dlg.m_nWidth);
|
|
dlg.DestroyWindow();
|
|
return;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDimSanitaryDlg dialog
|
|
CString CDimSanitaryDlg::m_csText = _T("脸");
|
|
|
|
IMPLEMENT_DYNAMIC(CDimSanitaryDlg, CModelessDialog)
|
|
CDimSanitaryDlg::CDimSanitaryDlg(CWnd* pParent /*=NULL*/)
|
|
: CModelessDialog(CDimSanitaryDlg::IDD, pParent), m_spinCir(1), m_spinWidth(0.05)
|
|
{
|
|
//{{AFX_DATA_INIT(CDimSanitaryDlg)
|
|
m_bIsOut = TRUE;
|
|
m_iStyle = 0;
|
|
m_nWidth = 0.25;
|
|
m_nRadius = 5;
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CDimSanitaryDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CModelessDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDimSanitaryDlg)
|
|
DDX_Control(pDX, IDC_COMBO_TEXTSTYLE, m_comboStyle);
|
|
DDX_Control(pDX, IDC_SPIN_CIRCLE, m_spinCir);
|
|
DDX_Control(pDX, IDC_SPIN_WIDTH, m_spinWidth);
|
|
DDX_Text(pDX, IDC_EDIT_TEXT, m_csText);
|
|
DDX_Text(pDX, IDC_EDIT_WIDTH, m_nWidth);
|
|
DDX_Text(pDX, IDC_EDIT_CIRCLE, m_nRadius);
|
|
DDX_Check(pDX, IDC_CHECK_OUT, m_bIsOut);
|
|
DDX_CBIndex(pDX, IDC_COMBO_TEXTSTYLE, m_iStyle);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDimSanitaryDlg, CModelessDialog)
|
|
//{{AFX_MSG_MAP(CDimSanitaryDlg)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE1, OnButtonType1)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE2, OnButtonType2)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE3, OnButtonType3)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE4, OnButtonType4)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE5, OnButtonType5)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE6, OnButtonType6)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE7, OnButtonType7)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE8, OnButtonType8)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE9, OnButtonType9)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE10, OnButtonType10)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE11, OnButtonType11)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE12, OnButtonType12)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE13, OnButtonType13)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE14, OnButtonType14)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE15, OnButtonType15)
|
|
ON_BN_CLICKED(IDC_BUTTON_TYPE16, OnButtonType16)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDimSanitaryDlg message handlers
|
|
|
|
BOOL CDimSanitaryDlg::OnInitDialog()
|
|
{
|
|
CModelessDialog::OnInitDialog();
|
|
// CreateWinFont();
|
|
// cet 2010.12.16 modify
|
|
// InitTwtTextStyle(g_csCircleTextStyle);
|
|
InitTwtTextStyle(g_csSanTextStyle);
|
|
m_spinCir.SetRange(1, 20);
|
|
m_spinWidth.SetRange(0, 10);
|
|
XSymbolList lstStyle(_T("STYLE"));
|
|
for (int m =0; m < lstStyle.Length(); m++) {
|
|
m_comboStyle.AddString(lstStyle[m]);
|
|
// cet 2010.12.16 modify
|
|
// if(_tcsicmp(g_csCircleTextStyle, lstStyle[m]) == 0){
|
|
// m_iStyle = m;
|
|
// }
|
|
if (_tcsicmp(g_csSanTextStyle, lstStyle[m]) == 0)
|
|
{
|
|
m_iStyle = m;
|
|
}
|
|
}
|
|
|
|
//从注册表读取 标注圆半径和宽度 zxl 2012.04.20 add
|
|
ReadRegData(_T("TWTConfig"), _T("SanitaryDimRadius"), m_nRadius);
|
|
ReadRegData(_T("TWTConfig"), _T("SanitaryDimWidth"), m_nWidth);
|
|
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType1()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("脸");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType2()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("污");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType3()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("蹲");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType4()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("化");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType5()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("坐");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType6()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("涤");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType7()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("浴");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType8()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("妇");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType9()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("小");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType10()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("雨");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType11()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("地");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType12()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("漏");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType13()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("清");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType14()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("扫");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType15()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("盥");
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CDimSanitaryDlg::OnButtonType16()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_csText = _T("拖");
|
|
UpdateData(FALSE);
|
|
}
|