Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

771 lines
22 KiB
C++

// TgTwtSettingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "TgTwtSettingDlg.h"
#include <PipeTools.h>
#include <PipeWireMonitor.h>
//#include <dict.h>
#include "PipeSettingDlg.h"
#include "TextSettingDlg.h"
#include "PipeSettingFrameDlg.h"
#include "TwtDef.h"
#include "OutDimSettingDlg.h"
#include "VPipeDimDnSettingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//extern AOLAPI double g_nCirDeviation; //分弧精度
extern TARCH_IMPEXP BOOL g_bEnableSelectPreview;
extern TARCH_IMPEXP BOOL g_bAutoLTScale; //是否自动设置线型比例
extern TARCH_IMPEXP BOOL g_bTgOsnap;
extern TARCH_IMPEXP int g_bDownloadT3Split; // cet 2012.8.17 add 转T3上华文字中英文打断
//extern TARCH_IMPEXP void DocStatus();
/////////////////////////////////////////////////////////////////////////////
// CTgTwtSettingDlg dialog
CTgTwtSettingDlg::CTgTwtSettingDlg(CWnd* pParent /*=NULL*/)
: CDialog(IDD, pParent), m_spinBreakPipeWidth(0.5), m_spinDnDimDist2Pipe(0.5),
m_spinDist(25), m_spinPtRadius(125), m_spinTextBreak(0.5)
{
//{{AFX_DATA_INIT(CTgTwtSettingDlg)
m_bToolbar = TRUE;
m_nDist2Wall = 100;
m_bIsPipeThick = FALSE;
m_nSprinklerRadius = 125;
m_nBreakPipeWidth = 2.0;
m_nDnDimDist2Pipe = g_nDnDimDist2Pipe;
m_nDimCirRadius = g_nDimCirDiam;
m_nWellRadius = g_nWellRadius;
m_iDimType = 0;
m_iPipeDn = 25;
m_iFeedPoint = 0;
m_nDrainPtRadius = 25;
m_iStandPipeType = 0;
m_bBlk3D = TRUE;
m_nPipeTextDist = 0.5;
m_bSelPreview = FALSE;
m_nElbowRate = 1;
m_nValveScale = 1.2;
m_iUnit = -1;
m_bShowFlowDir = FALSE;
m_iPrePiepLen = 2;
m_iPreWelldDeep = 3;
m_bAutoScale = FALSE;
m_iVPipeDimStyle = 0;
m_dEleHeight = 3;
m_bTgOsnap = TRUE;
m_nWndCmbModulus = -1;
m_nFeedCircleScale = 1;
m_bT3TextBreak = TRUE;
m_dDbPipeLineWidth = 0.35;
m_nSinataryDataType = 0;
m_bIsRelatePipeLineTypeToCurPScale = FALSE;
m_nDistDn2Label = 3.0;
// cet 2014.4.25 modify 默认不选
// m_bIsElevDimChangeByPipeElev = true;
m_bIsElevDimChangeByPipeElev = FALSE;
//}}AFX_DATA_INIT
m_iOldStandPipeType = 0;
}
void CTgTwtSettingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTgTwtSettingDlg)
DDX_Control(pDX, IDC_SPIN_PIPETEXTDIST, m_spinTextBreak);
DDX_Control(pDX, IDC_SPIN_DIM2PIPE, m_spinDnDimDist2Pipe);
DDX_Control(pDX, IDC_SPIN_BREAKWIDTH, m_spinBreakPipeWidth);
DDX_Control(pDX, IDC_SPIN_PT_RADIUS, m_spinPtRadius);
DDX_Control(pDX, IDC_SPIN_DIST2WALL, m_spinDist);
DDX_Check(pDX, IDC_CHECK_TOOLBAR, m_bToolbar);
DDX_Text(pDX, IDC_EDIT_DIST2WALL, m_nDist2Wall);
DDX_Check(pDX, IDC_CHECK_THICKPIPE, m_bIsPipeThick);
DDX_Text(pDX, IDC_EDIT_PT_RADIUS, m_nSprinklerRadius);
DDX_Text(pDX, IDC_EDIT_BREAKWIDTH, m_nBreakPipeWidth);
DDX_Text(pDX, IDC_EDIT_DIM2PIPE, m_nDnDimDist2Pipe);
DDX_Text(pDX, IDC_EDIT_DIM_RADIUS, m_nDimCirRadius);
DDX_Text(pDX, IDC_EDIT_WELL_RADIUS, m_nWellRadius);
DDX_Radio(pDX, IDC_RADIO_DIM1, m_iDimType);
DDX_Text(pDX, IDC_EDIT_PIPE_DN, m_iPipeDn);
DDX_Radio(pDX, IDC_RADIO_POINT, m_iFeedPoint);
DDX_Text(pDX, IDC_EDIT_DRAIN_RADIUS, m_nDrainPtRadius);
DDX_Radio(pDX, IDC_RADIO_STANDPIPE1, m_iStandPipeType);
DDX_Check(pDX, IDC_CHECK_BLK3D, m_bBlk3D);
DDX_Text(pDX, IDC_EDIT_PIPETEXTDIST, m_nPipeTextDist);
DDX_Check(pDX, IDC_CHECK_PREVIEW, m_bSelPreview);
DDX_Text(pDX, IDC_EDIT_PIPE_RATE, m_nElbowRate);
DDX_Text(pDX, IDC_EDIT_VALVE_SCALE, m_nValveScale);
DDX_CBIndex(pDX, IDC_COMBO_UNIT, m_iUnit);
DDX_Check(pDX, IDC_CHECK_PIPEDIR, m_bShowFlowDir);
DDX_CBIndex(pDX, IDC_COMBO_PIPELEN_PRE, m_iPrePiepLen);
DDX_CBIndex(pDX, IDC_COMBO_WELLDEEP_PRE, m_iPreWelldDeep);
DDX_Check(pDX, IDC_CHECK_AUTOSCALE, m_bAutoScale);
DDX_CBIndex(pDX, IDC_COMBO_VPIPEDIM, m_iVPipeDimStyle);
DDX_Text(pDX, IDC_EDIT_ELE_HEIGHT, m_dEleHeight);
DDX_Check(pDX, IDC_CHECK_OSNAP, m_bTgOsnap);
DDX_CBIndex(pDX, IDC_COMBO_MODULUS, m_nWndCmbModulus);
DDX_Text(pDX, IDC_EDIT_FEED_RADIUS, m_nFeedCircleScale);
DDX_Check(pDX, IDC_CHK_T3TEXT, m_bT3TextBreak);
DDX_Text(pDX, IDC_EDIT_DBPIPE_LINEWIDTH, m_dDbPipeLineWidth);
DDX_Radio(pDX, IDC_RADIO_PICFIST, m_nSinataryDataType);
DDX_Check(pDX, IDC_CHECK_PLTYPE2CURPSCALE, m_bIsRelatePipeLineTypeToCurPScale);
DDX_Text(pDX, IDC_EDIT_DISTDN, m_nDistDn2Label);
DDX_Check(pDX, IDC_CHECK_ELEVDIMWITHPIPE, m_bIsElevDimChangeByPipeElev);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTgTwtSettingDlg, CDialog)
//{{AFX_MSG_MAP(CTgTwtSettingDlg)
ON_BN_CLICKED(IDC_BUTTON_PIPE_SETTING, OnButtonPipeSetting)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_RADIO_DIM1, OnRadioDim1)
ON_BN_CLICKED(IDC_RADIO_DIM2, OnRadioDim2)
ON_BN_CLICKED(IDC_RADIO_POINT, OnRadioPoint)
ON_BN_CLICKED(IDC_RADIO_FORK, OnRadioFork)
ON_BN_CLICKED(IDC_RADIO_STANDPIPE1, OnRadioStandpipe1)
ON_BN_CLICKED(IDC_RADIO_STANDPIPE2, OnRadioStandpipe2)
ON_BN_CLICKED(IDC_BUTTON_TEXT_SETTING, OnButtonTextSetting)
ON_BN_CLICKED(IDC_RADIO_DIM3, OnRadioDim3)
ON_BN_CLICKED(IDC_RADIO_DIM4, OnRadioDim4)
ON_BN_CLICKED(IDC_BUTTON_OUTDIMSET, OnButtonOutdimset)
ON_BN_CLICKED(IDC_BUTTON_DNDIM, OnButtonDndim)
ON_BN_CLICKED(IDC_CHK_T3TEXT, OnChkT3text)
ON_BN_CLICKED(IDC_RADIO_DIM5, OnRadioDim5)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDOK, &CTgTwtSettingDlg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCLE, &CTgTwtSettingDlg::OnBnClickedCancle)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTgTwtSettingDlg message handlers
BOOL CTgTwtSettingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_spinDnDimDist2Pipe.SetRange(0, 10);
m_spinBreakPipeWidth.SetRange(0, 10);
m_spinTextBreak.SetRange(0, 10);
m_spinDist.SetRange(0, 2000);
m_spinPtRadius.SetRange(25, 2000);
UpdateDlgData(TRUE);
OpenSlide();
CWnd *pWnd = GetDlgItem(IDC_STATIC_DIM_RADIUS);
if(m_iDimType == 1)
pWnd->SetWindowText(_T("圆半径"));
else
pWnd->SetWindowText(_T("文字距离"));
// cet 2012.4.19 add
EnableBtnDimDn((m_iDimType == 3) ?TRUE : FALSE);
// ZXL 2012.12.18 ADD
m_bIsRelatePipeLineTypeToCurPScale = IsRelatePipeLineTypeToCurPScale();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CTgTwtSettingDlg::OnMainDialogOK()
{
UpdateData(TRUE);
UpdateDlgData(FALSE);
// zxl 2012.12.19 add
if (m_bIsRelatePipeLineTypeToCurPScale)
{
RelatePipeLineTypeToCurPScale(true);
}
else
{
RelatePipeLineTypeToCurPScale(false);
}
// 更新管线线型 cet 2012.12.20 add
RBList rbMaskPipe(RTDXF0, _T("ATS_PIPE"), NULL);
PickSet ss(SS_FREE);
ss.Get(_T("X"), NULL, NULL, rbMaskPipe);
UpdateGraphic(ss);
if(!SetToolbarVisible(m_bToolbar) && m_bToolbar){
CreateToolbars();
}
}
void CTgTwtSettingDlg::PostNcDestroy()
{
CDialog::PostNcDestroy();
TDbPsConfig *pConfig = GetDwgPsGlobal(AcDb::kForWrite);
if (pConfig){
pConfig->ShowPipeFlowDir(m_bShowFlowDir);
int iPrePiepLen = m_iPrePiepLen;
if(iPrePiepLen == 0)
iPrePiepLen = 99;
pConfig->SetPipeLenPrecision(iPrePiepLen);
int iPreWelldDeep = m_iPreWelldDeep;
if(iPreWelldDeep == 0)
iPreWelldDeep = 99;
pConfig->SetWellDeepPrecision(iPreWelldDeep);
pConfig->close();
}
if(g_bIsPipeThick != m_bIsPipeThick){
g_bIsPipeThick = m_bIsPipeThick;
RBList rbMaskPipe(RTDXF0, _T("ATS_PIPE,ATS_DOUBLELINEPIPE,ATS_FLANGE"), NULL);
PickSet ss(SS_FREE);
ss.Get(_T("X"), NULL, NULL, rbMaskPipe);
TDbPsConfig *pConfig = GetDwgPsGlobal(AcDb::kForWrite);
if (pConfig){
pConfig->SetLineWeight(g_bIsPipeThick);
pConfig->close();
UpdateGraphic(ss);
}
}
if(g_nBreakPipeWidth != m_nBreakPipeWidth){
g_nBreakPipeWidth = m_nBreakPipeWidth;
RBList rbMaskPipe(RTDXF0, _T("ATS_PIPE"), 8, GetLayerNames(_T("管")), NULL);
PickSet ss(SS_FREE);
ss.Get(_T("X"), NULL, NULL, rbMaskPipe);
TDbPsConfig *pConfig = GetDwgPsGlobal(AcDb::kForWrite);
if (pConfig){
pConfig->SetBreakWidth(g_nBreakPipeWidth);
pConfig->close();
UpdateGraphic(ss);
}
}
if(g_nPipeTextBreak != m_nPipeTextDist){
g_nPipeTextBreak = m_nPipeTextDist;
RBList rbMaskPipe(RTDXF0, _T("ATS_PIPE"), 8, GetLayerNames(_T("管")), NULL);
PickSet ss(SS_FREE);
ss.Get(_T("X"), NULL, NULL, rbMaskPipe);
TDbPsConfig *pConfig = GetDwgPsGlobal(AcDb::kForWrite);
if (pConfig){
pConfig->SetPipeTextDis(g_nPipeTextBreak);
pConfig->close();
UpdateGraphic(ss);
}
}
if(g_iElbowType != m_iFeedPoint){
g_iElbowType = m_iFeedPoint;
RBList rbMaskPipe(RTDXF0, _T("ATS_FLANGE"), NULL);
PickSet ss(SS_FREE);
ss.Get(_T("X"), NULL, NULL, rbMaskPipe);
TDbPsConfig *pConfig = GetDwgPsGlobal(AcDb::kForWrite);
if (pConfig){
pConfig->SetElbowType(g_iElbowType);
pConfig->close();
UpdateGraphic(ss);
}
}
int iStandPipeType(0);
if(g_bStandPipeArc == TRUE)
iStandPipeType = 0;
else
iStandPipeType = 1;
if(m_iOldStandPipeType != iStandPipeType){
RBList rbMaskPipe(RTDXF0, _T("ATS_PIPE"), 8, GetLayerNames(_T("管")), NULL);
PickSet ss(SS_FREE);
ss.Get(_T("X"), NULL, NULL, rbMaskPipe);
long len = ss.Length();
for(long i=0;i<len;i++){
Entity ent = ss[i];
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbPipe, pPipe);
if(pPipe){
if(pPipe->GetRadiusIn() < 2){
if(!g_bStandPipeArc)//传统扣弯
pPipe->SetRadiusIn(-2);
else
pPipe->SetRadiusIn(0);
}
}
OPENOBJ_END();
}
}
}
void CTgTwtSettingDlg::UpdateDlgData(BOOL bIsRead)
{
UpdateData(TRUE);
CRegProperty regProp(GetRegLocation(), _T("TWTConfig"));
regProp.SetTopRootKey(HKEY_CURRENT_USER);
if(bIsRead){
TDbPsConfig *pConfig = GetDwgPsGlobal(AcDb::kForRead);
if (pConfig){
g_bIsPipeThick = pConfig->IsLineWeight();
g_nBreakPipeWidth = pConfig->GetBreakWidth();
g_nPipeTextBreak = pConfig->GetPipeTextDis();
m_bShowFlowDir = pConfig->IsShowPipeFlowDir();
m_iFeedPoint = pConfig->GetElbowType();
m_iPrePiepLen = pConfig->GetPipeLenPrecision();
m_iPreWelldDeep = pConfig->GetWellDeepPrecision();
if(m_iPreWelldDeep == 99)
m_iPreWelldDeep = 0;
if(m_iPrePiepLen == 99)
m_iPrePiepLen = 0;
pConfig->close();
}
else{
g_bIsPipeThick = FALSE;
g_nBreakPipeWidth = 2;
g_nPipeTextBreak = 0.5;
m_iPrePiepLen = 2;
}
CString csDimStyle(_T("_TWT_DIM"));
// cet 2012.8.17 add
m_bT3TextBreak = g_bDownloadT3Split == 1 ? TRUE : FALSE;
m_bToolbar = g_bToolbar;
m_bTgOsnap = g_bTgOsnap;
m_bIsPipeThick = g_bIsPipeThick;
m_bSelPreview = g_bEnableSelectPreview;
m_nBreakPipeWidth = g_nBreakPipeWidth;
m_nPipeTextDist = g_nPipeTextBreak;
m_bAutoScale = g_bAutoLTScale;
m_dEleHeight = DocGetEleTriangleSize();
regProp.GetValue(_T("Dist2Wall"), m_nDist2Wall);
regProp.GetValue(_T("SprinklerRadius"), m_nSprinklerRadius);
regProp.GetValue(_T("DnDimDist2Pipe"), m_nDnDimDist2Pipe);
regProp.GetValue(_T("IsPipeDimCir"), m_iDimType);
regProp.GetValue(_T("WellRadius"), m_nWellRadius);
regProp.GetValue(_T("DimCirDiam"), m_nDimCirRadius);
regProp.GetValue(_T("FeedCircleScale"), m_nFeedCircleScale);//zxl 2012.04.16 add
regProp.GetValue(_T("DefaultPipeDn"), m_iPipeDn);
regProp.GetValue(_T("Blk3D"), m_bBlk3D);
regProp.GetValue(_T("DrainPtRadius"), m_nDrainPtRadius);
regProp.GetValue(_T("IsStandPipeArc"), g_bStandPipeArc);
regProp.GetValue(_T("ElbowRate"), m_nElbowRate);
regProp.GetValue(_T("ValveScale"), m_nValveScale);
// regProp.GetValue(_T("DimPipeGradientType"), m_iDimPipeGradientType);
regProp.GetValue(_T("VPipeDimStyle"), m_iVPipeDimStyle);
// regProp.GetValue(_T("DimPipeLen"), m_iDimPipeLenType); // cet 2011.5.20 add
regProp.GetValue(_T("DbPipeLineWidth"), m_dDbPipeLineWidth); // cet 2012.10.18 add
bool bRet = regProp.GetValue(_T("SanitaryDataType"), m_nSinataryDataType); // zxl 2012.12.05 add
if (!bRet)
{
m_nSinataryDataType = 0;
}
regProp.GetValue(_T("VPipeDimDn2Label"), m_nDistDn2Label);// zxl 2013.08.23 add
regProp.GetValue(_T("IsElevDimChangeByPipeElev"), m_bIsElevDimChangeByPipeElev);// zxl 2013.11.20 add
if(g_bStandPipeArc == TRUE)
m_iStandPipeType = 0;
else
m_iStandPipeType = 1;
m_iOldStandPipeType = m_iStandPipeType;
if(DocGetMeterUnitDraw())
m_iUnit=1;
else
m_iUnit=0;
// cet 2011.4.18 add 增加喷头间距模数设置
if (!regProp.GetValue(_T("SprinklerDistMod"), g_iSprinklerDistMod))
{
g_iSprinklerDistMod = 50;
}
if (g_iSprinklerDistMod == 100)
{
m_nWndCmbModulus = 1;
}
else
{
m_nWndCmbModulus = 0;
}
// // cet 2011.4.28 add
// if (m_iDimPipeGradientType == -1)
// {
// m_iDimPipeGradientType = 12; //不标注
// }
}
else{
if(m_iStandPipeType == 0)
g_bStandPipeArc = TRUE;
else
g_bStandPipeArc = FALSE;
// g_iDimPipeGradientType = m_iDimPipeGradientType;
// if(g_iDimPipeGradientType == 11) //11表示不标注 cet 2011.4.28 modify
// g_iDimPipeGradientType = -1;
// if(g_iDimPipeGradientType == 12) //14表示不标注
// g_iDimPipeGradientType = -1;
// g_iDimPipeLen = m_iDimPipeLenType; // cet 2011.5.20 add
g_iVPipeDimStyle = m_iVPipeDimStyle;
g_nDrainPtRadius = m_nDrainPtRadius;
g_iDefaultPipeDn = m_iPipeDn;
g_nDimCirDiam = m_nDimCirRadius;
g_nFeedCircleScale = m_nFeedCircleScale;//zxl 2012.04.16 add
g_nWellRadius = m_nWellRadius;
g_nDnDimDist2Pipe = m_nDnDimDist2Pipe;
g_bToolbar = m_bToolbar;
g_bTgOsnap = m_bTgOsnap;
g_bBlk3D = m_bBlk3D;
g_nStandPipe2Wall = m_nDist2Wall;
g_nSprinklerRadius = m_nSprinklerRadius;
g_bIsPipeDimCir = m_iDimType;
g_nElbowRate = m_nElbowRate;
g_nValveScale = m_nValveScale;
g_dDbPipeLineWidth = m_dDbPipeLineWidth; // cet 2012.10.18 add
g_nSinataryDataType = m_nSinataryDataType;
g_dVPipeDimDn2Label = m_nDistDn2Label;
g_bIsElevDimChangeByPipeElev = m_bIsElevDimChangeByPipeElev;// zxl 2013.11.20 add
regProp.SetValue(_T("Dist2Wall"), m_nDist2Wall);
regProp.SetValue(_T("SprinklerRadius"), g_nSprinklerRadius);
regProp.SetValue(_T("DnDimDist2Pipe"), g_nDnDimDist2Pipe);
regProp.SetValue(_T("IsPipeDimCir"), g_bIsPipeDimCir);
regProp.SetValue(_T("WellRadius"), g_nWellRadius);
regProp.SetValue(_T("DimCirDiam"), g_nDimCirDiam);
regProp.SetValue(_T("FeedCircleScale"), g_nFeedCircleScale);//zxl 2012.04.16 add
regProp.SetValue(_T("DefaultPipeDn"), g_iDefaultPipeDn);
regProp.SetValue(_T("DrainPtRadius"), g_nDrainPtRadius);
regProp.SetValue(_T("Toolbar"), g_bToolbar);
regProp.SetValue(_T("TgOsnap"), g_bTgOsnap);
regProp.SetValue(_T("DownloadT3Split"), g_bDownloadT3Split);
regProp.SetValue(_T("IsStandPipeArc"), g_bStandPipeArc);
// regProp.SetValue(_T("DimPipeGradientType"), g_iDimPipeGradientType);
regProp.SetValue(_T("VPipeDimStyle"), g_iVPipeDimStyle);
// regProp.SetValue(_T("DimPipeLen"), g_iDimPipeLen); // cet 2011.5.20 add
regProp.SetValue(_T("DbPipeLineWidth"), g_dDbPipeLineWidth); // cet 2012.10.18 add
regProp.SetValue(_T("SanitaryDataType"), g_nSinataryDataType); // zxl 2012.12.05 add
regProp.SetValue(_T("VPipeDimDn2Label"), g_dVPipeDimDn2Label);// zxl 2013.08.23 add
regProp.SetValue(_T("IsElevDimChangeByPipeElev"), g_bIsElevDimChangeByPipeElev); // zxl 2013.11.20 add
regProp.SetValue(_T("Blk3D"), g_bBlk3D);
regProp.SetValue(_T("ElbowRate"), m_nElbowRate);
regProp.SetValue(_T("ValveScale"), g_nValveScale);
// cet 2011.4.18 add 增加喷头间距模数设置
if (m_nWndCmbModulus == 0)
{
g_iSprinklerDistMod = 50;
}
else
{
g_iSprinklerDistMod = 100;
}
regProp.SetValue(_T("SprinklerDistMod"), g_iSprinklerDistMod);
g_bEnableSelectPreview = m_bSelPreview;
g_bAutoLTScale = m_bAutoScale;
if(m_iUnit == 0){
DocSetMeterUnitDraw(FALSE);
DocSetMeterUnitDim(FALSE);
}
else{
DocSetMeterUnitDraw(TRUE);
DocSetMeterUnitDim(TRUE);
if(DocGetPScale() > 50){
// g_nCirDeviation = 0.01; //SR 2009.2.11 7.x 不支持米单位下,自动算g_nCirDeviation
DocSetPScale(1);
DocStatus();
}
}
DocSetEleTriangleSize(m_dEleHeight);
g_dEleTriangleSize = m_dEleHeight;
SetConfigIni();
}
UpdateData(FALSE);
}
void CTgTwtSettingDlg::OnButtonPipeSetting()
{
CTemporaryResourceOverride vTemp;
// CPipeSettingDlg dlg;
// dlg.DoModal();
CPipeSettingFrameDlg dlg;
dlg.DoModal();
}
void CTgTwtSettingDlg::OnPaint()
{
CPaintDC dc(this);
OpenSlide();
}
void CTgTwtSettingDlg::OpenSlide()
{
CWnd *pWnd = GetDlgItem(IDC_DIM_PREVIEW);
if(m_iDimType == 0)
DrawSlide(_T("TWT(JL1)"), pWnd);
else if(m_iDimType == 1)
DrawSlide(_T("TWT(JL2)"), pWnd);
else if(m_iDimType == 2)
DrawSlide(_T("TWT(JL3)"), pWnd);
else if(m_iDimType == 3)
DrawSlide(_T("TWT(JL4)"), pWnd);
else if(m_iDimType == 4)
DrawSlide(_T("TWT(JL5)"), pWnd);
CWnd *pWnd2 = GetDlgItem(IDC_FEED_PREVIEW);
if(m_iFeedPoint == 0)
DrawSlide(_T("TWT(ELBOW0)"), pWnd2);
else
DrawSlide(_T("TWT(ELBOW1)"), pWnd2);
CWnd *pWnd3 = GetDlgItem(IDC_STANDPIPE_PREVIEW);
if(m_iStandPipeType == 0)
DrawSlide(_T("TWT(STANDPIPE2)"), pWnd3);
else
DrawSlide(_T("TWT(STANDPIPE1)"), pWnd3);
}
void CTgTwtSettingDlg::OnRadioDim1()
{
UpdateData(TRUE);
CWnd *pWnd = GetDlgItem(IDC_STATIC_DIM_RADIUS);
if(m_iDimType == 1)
{
pWnd->SetWindowText(_T("圆半径"));
m_nDimCirRadius = 4;
}
else
{
pWnd->SetWindowText(_T("文字距离"));
m_nDimCirRadius = 2;
}
EnableBtnDimDn(FALSE); // cet 2012.4.19 add
UpdateData(FALSE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioDim2()
{
UpdateData(TRUE);
CWnd *pWnd = GetDlgItem(IDC_STATIC_DIM_RADIUS);
if(m_iDimType == 1)
{
pWnd->SetWindowText(_T("圆半径"));
m_nDimCirRadius = 4;
}
else
{
pWnd->SetWindowText(_T("文字距离"));
m_nDimCirRadius = 2;
}
EnableBtnDimDn(FALSE); // cet 2012.4.19 add
UpdateData(FALSE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioDim3()
{
UpdateData(TRUE);
CWnd *pWnd = GetDlgItem(IDC_STATIC_DIM_RADIUS);
if(m_iDimType == 1)
{
pWnd->SetWindowText(_T("圆半径"));
m_nDimCirRadius = 4;
}
else
{
pWnd->SetWindowText(_T("文字距离"));
m_nDimCirRadius = 2;
}
EnableBtnDimDn(FALSE); // cet 2012.4.19 add
UpdateData(FALSE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioDim4()
{
UpdateData(TRUE);
CWnd *pWnd = GetDlgItem(IDC_STATIC_DIM_RADIUS);
if(m_iDimType == 1)
{
pWnd->SetWindowText(_T("圆半径"));
m_nDimCirRadius = 4;
}
else
{
pWnd->SetWindowText(_T("文字距离"));
m_nDimCirRadius = 2;
}
EnableBtnDimDn(TRUE); // cet 2012.4.19 add
UpdateData(FALSE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioDim5()
{
UpdateData(TRUE);
CWnd *pWnd = GetDlgItem(IDC_STATIC_DIM_RADIUS);
if(m_iDimType == 1)
{
pWnd->SetWindowText(_T("圆半径"));
m_nDimCirRadius = 4;
}
else
{
pWnd->SetWindowText(_T("文字距离"));
m_nDimCirRadius = 2;
}
EnableBtnDimDn(FALSE);
UpdateData(FALSE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioPoint()
{
UpdateData(TRUE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioFork()
{
UpdateData(TRUE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioStandpipe1()
{
UpdateData(TRUE);
OpenSlide();
}
void CTgTwtSettingDlg::OnRadioStandpipe2()
{
UpdateData(TRUE);
OpenSlide();
}
//sr add 2007-3-28 修改上华配置文件ini
void CTgTwtSettingDlg::SetConfigIni()
{
bool bEnableSelectPreview;
if(g_bEnableSelectPreview)
bEnableSelectPreview = true;
else
bEnableSelectPreview = false;
bool bAutoScale;
if(g_bAutoLTScale)
bAutoScale = true;
else
bAutoScale = false;
XString sFullFile;
if(!FindFile(_T("config.ini"), sFullFile))
return;
WDict dict;
dict.ReadFile(sFullFile);
OPEN_DICT(dict);
OPEN_SUB_DICT(_T("系统"));
SET_BOOL(_T("是否启用选择预览"), bEnableSelectPreview);
OPEN_SUB_DICT(_T("线型"));
SET_BOOL(_T("是否启用自动线型比例"), bAutoScale);
CLOSE_SUB_DICT();//线型
CLOSE_SUB_DICT();//系统
OPEN_SUB_DICT(_T("符号标注"));
OPEN_SUB_DICT(_T("标高标注"));
SET_VALUE(_T("三角高度"), g_dEleTriangleSize);
CLOSE_SUB_DICT();//线型
CLOSE_SUB_DICT();//符号标注
CLOSE_DICT();
dict.WriteFile(sFullFile);
}
void CTgTwtSettingDlg::OnButtonTextSetting()
{
CTemporaryResourceOverride vTemp;
CTextSettingDlg dlg;
dlg.DoModal();
}
void CTgTwtSettingDlg::OnButtonOutdimset()
{
COutDimSettingDlg dlg;
dlg.DoModal();
}
void CTgTwtSettingDlg::OnButtonDndim()
{
CVPipeDimDnSettingDlg dlg;
dlg.DoModal();
}
void CTgTwtSettingDlg::EnableBtnDimDn( BOOL bEnable )
{
CWnd *pWndDim = GetDlgItem(IDC_BUTTON_DNDIM);
if (pWndDim != NULL)
{
pWndDim->EnableWindow(bEnable);
}
CWnd *pWnd = GetDlgItem(IDC_EDIT_DISTDN);
if (pWndDim == NULL)
{
return;
}
if (m_iDimType == 4)
{
pWnd->EnableWindow(TRUE);
}
else
{
pWnd->EnableWindow(FALSE);
}
}
void CTgTwtSettingDlg::OnChkT3text()
{
UpdateData();
if (m_bT3TextBreak)
{
g_bDownloadT3Split = 1;
}
else
{
g_bDownloadT3Split = 0;
}
MessageBox(_T("请注意:\n上华文字包含中英文等高信息以及字宽设置。\n如果取消打断,原文字保持整体不变,但英文字宽字高\n可能会发生变化,请注意设置【文字样式】西文参数为\n1,并选择中英文等高shx文件。"), _T("警告"));
}
void CTgTwtSettingDlg::OnBnClickedOk()
{
CDialog::OnOK();
OnMainDialogOK();
}
void CTgTwtSettingDlg::OnBnClickedCancle()
{
CDialog::OnCancel();
}