1925 lines
51 KiB
C++
1925 lines
51 KiB
C++
// SetWall.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "SetWall.h"
|
|
//#include "DbCompStyle.h"
|
|
#include "TgAs.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDrawWallDlg dialog
|
|
|
|
//extern int g_nOsnapOnAxis, g_nOsnapOnWall;
|
|
|
|
IMPLEMENT_DYNAMIC(CDrawWallDlg, CModelessDialog)
|
|
|
|
BOOL CDrawWallDlg::g_nWallShape=0; //0--直墙,1--弧墙,2--矩形
|
|
BOOL CDrawWallDlg::g_bAutoSnap=TRUE;
|
|
//int CDrawWallDlg::g_nSelStyle = 5;//砖墙
|
|
//int CDrawWallDlg::g_nSelUsage =0;
|
|
// delete by xly on 101223,当前实体材料保存到dbf文件中
|
|
//CString CDrawWallDlg::m_csWallElev=_T("0");
|
|
|
|
|
|
CDrawWallDlg::CDrawWallDlg(CWnd* pParent /*=NULL*/)
|
|
: CModelessDialog(CDrawWallDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDrawWallDlg)
|
|
m_nLeftWidth = 120;
|
|
m_nRightWidth = 120;
|
|
//}}AFX_DATA_INIT
|
|
|
|
tbButtm[0].tbID = ID_BUTTON_LINEWALL;
|
|
tbButtm[0].BitmapID = 0;
|
|
tbButtm[0].Style = TBSTYLE_CHECKGROUP;
|
|
|
|
|
|
tbButtm[1].tbID = ID_BUTTON_ARCWALL;
|
|
tbButtm[1].BitmapID = 1;
|
|
tbButtm[1].Style = TBSTYLE_CHECKGROUP;
|
|
|
|
tbButtm[2].tbID = ID_BUTTON_RECTWALL;
|
|
tbButtm[2].BitmapID = 2;
|
|
tbButtm[2].Style = TBSTYLE_CHECKGROUP;
|
|
|
|
tbButtm[3].tbID = 0;
|
|
tbButtm[3].BitmapID = 0;
|
|
tbButtm[3].Style = TBSTYLE_SEP;
|
|
|
|
// Zyu modify on 100621
|
|
// 插入一个查询按钮
|
|
// Begin
|
|
/*
|
|
tbButtm[4].tbID = ID_BUTTON_SNAP;
|
|
tbButtm[4].BitmapID = 3;
|
|
tbButtm[4].Style = TBSTYLE_CHECK;
|
|
|
|
//add by xlc on 070511
|
|
tbButtm[5].tbID = ID_BUTTON_MODULE;
|
|
tbButtm[5].BitmapID = 4;
|
|
tbButtm[5].Style = TBSTYLE_CHECK;
|
|
m_bSendChar=FALSE;
|
|
*/
|
|
tbButtm[4].tbID = ID_BUTTON_INQUIRE;
|
|
tbButtm[4].BitmapID = 3;
|
|
tbButtm[4].Style = TBSTYLE_BUTTON;
|
|
|
|
tbButtm[5].tbID = 0;
|
|
tbButtm[5].BitmapID = 0;
|
|
tbButtm[5].Style = TBSTYLE_SEP;
|
|
|
|
tbButtm[6].tbID = ID_BUTTON_SNAP;
|
|
tbButtm[6].BitmapID = 4;
|
|
tbButtm[6].Style = TBSTYLE_CHECK;
|
|
|
|
//add by xlc on 070511
|
|
tbButtm[7].tbID = ID_BUTTON_MODULE;
|
|
tbButtm[7].BitmapID = 5;
|
|
tbButtm[7].Style = TBSTYLE_CHECK;
|
|
m_bSendChar=FALSE;
|
|
// End
|
|
|
|
CRegProperty regProp(GetRegLocation(), _T("Settings"));
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
regProp.GetValue(_T("WallLeftWidth"), m_nLeftWidth);
|
|
regProp.GetValue(_T("WallRightWidth"), m_nRightWidth);
|
|
|
|
m_csWallHeight=_T("当前层高");
|
|
regProp.GetValue(_T("WallHeight"), m_csWallHeight);
|
|
|
|
// Zyu add on 100625
|
|
m_iOldOsMode = 0;
|
|
m_nSelStyle = 5;
|
|
|
|
m_csWallElev = _T("0"); // add by xly on 101223 墙体底高
|
|
m_nSelUsage = 0; // add by xly on 101223 墙体用途
|
|
}
|
|
|
|
|
|
void CDrawWallDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CModelessDialog::DoDataExchange(pDX);
|
|
|
|
//add by whl on 060308
|
|
if (pDX->m_bSaveAndValidate)
|
|
{
|
|
CString sText;
|
|
CWnd *pWnd=NULL;
|
|
|
|
pWnd=GetDlgItem(IDC_EDIT_LEFT);
|
|
if (pWnd!=NULL)
|
|
{
|
|
pWnd->GetWindowText(sText);
|
|
if (fabs(_tstof(sText))<1E-5)
|
|
pWnd->SetWindowText(_T("0"));
|
|
}
|
|
|
|
pWnd=GetDlgItem(IDC_EDIT_RIGHT);
|
|
if (pWnd!=NULL)
|
|
{
|
|
pWnd->GetWindowText(sText);
|
|
if (fabs(_tstof(sText))<1E-5)
|
|
pWnd->SetWindowText(_T("0"));
|
|
}
|
|
}
|
|
//{{AFX_DATA_MAP(CDrawWallDlg)
|
|
DDX_Control(pDX, IDC_HEIGHT, m_comHeight);
|
|
DDX_Control(pDX, IDC_LIST_DATA, m_listCtrl);
|
|
DDX_Control(pDX, IDC_MATERIAL, m_material);
|
|
DDX_Text(pDX, IDC_EDIT_LEFT, m_nLeftWidth);
|
|
DDX_Text(pDX, IDC_EDIT_RIGHT, m_nRightWidth);
|
|
DDX_CBString(pDX, IDC_HEIGHT, m_csWallHeight);
|
|
DDX_CBString(pDX, IDC_ELEV, m_csWallElev);
|
|
//}}AFX_DATA_MAP
|
|
DDX_CBIndex(pDX, IDC_MATERIAL, m_nSelStyle);
|
|
DDX_CBIndex(pDX, IDC_USAGE, m_nSelUsage);
|
|
if (!pDX->m_bSaveAndValidate)
|
|
{
|
|
// sg add 110309,解决提取300高的墙后,对话框显示为3000的问题
|
|
m_comHeight.SetWindowText(m_csWallHeight);
|
|
|
|
m_toolbar.CheckButton(ID_BUTTON_LINEWALL, g_nWallShape==0);
|
|
m_toolbar.CheckButton(ID_BUTTON_ARCWALL, g_nWallShape==1);
|
|
m_toolbar.CheckButton(ID_BUTTON_RECTWALL, g_nWallShape==2);
|
|
m_toolbar.CheckButton(ID_BUTTON_SNAP, g_bAutoSnap==TRUE);
|
|
//add by xlc on 070511
|
|
m_toolbar.CheckButton(ID_BUTTON_MODULE, g_bModelNumber);
|
|
if (g_nWallShape==2)
|
|
{
|
|
GetDlgItem(IDC_LEFT_TEXT)->SetWindowText(_T("内宽"));
|
|
GetDlgItem(IDC_RIGHT_TEXT)->SetWindowText(_T("外宽"));
|
|
}
|
|
else
|
|
{
|
|
GetDlgItem(IDC_LEFT_TEXT)->SetWindowText(_T("左宽"));
|
|
GetDlgItem(IDC_RIGHT_TEXT)->SetWindowText(_T("右宽"));
|
|
}
|
|
}
|
|
|
|
// [2010-3-25 wubo] C004-08 当墙体用途设为虚墙时,除用途外,所有控件都变灰。
|
|
bool bEnable = m_nSelUsage != 3;
|
|
GetDlgItem(IDC_HEIGHT)->EnableWindow(bEnable); // 墙高
|
|
GetDlgItem(IDC_ELEV)->EnableWindow(bEnable); // 底高
|
|
GetDlgItem(IDC_EDIT_LEFT)->EnableWindow(bEnable); // 左宽
|
|
GetDlgItem(IDC_EDIT_RIGHT)->EnableWindow(bEnable); // 右宽
|
|
GetDlgItem(IDC_LIST_DATA)->EnableWindow(bEnable); // 宽度列表
|
|
GetDlgItem(IDC_BUTTON_LEFT)->EnableWindow(bEnable); // 【左】按钮
|
|
GetDlgItem(IDC_BUTTON_MID)->EnableWindow(bEnable); // 【中】按钮
|
|
GetDlgItem(IDC_BUTTON_RIGHT)->EnableWindow(bEnable); // 【右】按钮
|
|
GetDlgItem(IDC_BUTTON_CHANGE)->EnableWindow(bEnable); // 【交换】按钮
|
|
|
|
// sg add 100511,当墙体用途为矮墙时,“材料”一项变灰
|
|
bEnable = m_nSelUsage!= 3 && m_nSelUsage!=4;
|
|
GetDlgItem(IDC_MATERIAL)->EnableWindow(bEnable); // 材料
|
|
|
|
// add by xly on 101223 关联墙体用途
|
|
DDX_Control(pDX, IDC_USAGE, m_wndUsage);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDrawWallDlg, CModelessDialog)
|
|
//{{AFX_MSG_MAP(CDrawWallDlg)
|
|
ON_CBN_SELCHANGE(IDC_MATERIAL, OnSelchangeMaterial)
|
|
ON_CBN_SELCHANGE(IDC_USAGE, OnSelchangeUsage)
|
|
ON_COMMAND(ID_BUTTON_LINEWALL, OnButtonLinewall)
|
|
ON_COMMAND(ID_BUTTON_ARCWALL, OnButtonArcwall)
|
|
ON_COMMAND(ID_BUTTON_RECTWALL, OnButtonRectwall)
|
|
ON_COMMAND(ID_BUTTON_SNAP, OnButtonSnap)
|
|
//add by xlc on 070511
|
|
ON_COMMAND(ID_BUTTON_MODULE, OnButtonModule)
|
|
// Zyu add on 100621
|
|
ON_COMMAND(ID_BUTTON_INQUIRE, OnButtonInquire)
|
|
ON_WM_CLOSE()
|
|
ON_WM_KILLFOCUS()
|
|
ON_LBN_SELCHANGE(IDC_LIST_DATA, OnSelchangeListData)
|
|
ON_BN_CLICKED(IDC_BUTTON_LEFT, OnButtonLeft)
|
|
ON_BN_CLICKED(IDC_BUTTON_MID, OnButtonMid)
|
|
ON_BN_CLICKED(IDC_BUTTON_RIGHT, OnButtonRight)
|
|
ON_BN_CLICKED(IDC_BUTTON_CHANGE, OnButtonChange)
|
|
ON_WM_CTLCOLOR()
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
|
|
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDrawWallDlg message handlers
|
|
BOOL CDrawWallDlg::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
ASSERT(pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW);
|
|
|
|
// if there is a top level routing frame then let it handle the message
|
|
if (GetRoutingFrame() != NULL) return FALSE;
|
|
|
|
// to be thorough we will need to handle UNICODE versions of the message also !!
|
|
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
|
|
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
|
|
//TCHAR szFullText[512];
|
|
CString strTipText;
|
|
// Zyu modify on 100723,消除64位编译警告
|
|
//UINT nID = pNMHDR->idFrom;
|
|
UINT_PTR nID = pNMHDR->idFrom;
|
|
|
|
if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
|
|
pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
|
|
{
|
|
// idFrom is actually the HWND of the tool
|
|
nID = ::GetDlgCtrlID((HWND)nID);
|
|
|
|
//Add by whl on 060308
|
|
if (nID!=IDC_LIST_DATA)
|
|
return FALSE;
|
|
}
|
|
|
|
if (nID != 0) // will be zero on a separator
|
|
{
|
|
{
|
|
CAcModuleResourceOverride vTmp;
|
|
// Zyu modify on 100723,消除64位编译警告
|
|
//strTipText.LoadString(nID); //=szFullText;
|
|
strTipText.LoadString((UINT)nID); //=szFullText;
|
|
}
|
|
|
|
#ifndef _UNICODE
|
|
if (pNMHDR->code == TTN_NEEDTEXTA)
|
|
{
|
|
lstrcpyn(pTTTA->szText, strTipText, sizeof(pTTTA->szText));
|
|
}
|
|
else
|
|
{
|
|
_mbstowcsz(pTTTW->szText, strTipText, sizeof(pTTTW->szText));
|
|
}
|
|
#else
|
|
if (pNMHDR->code == TTN_NEEDTEXTA)
|
|
{
|
|
_wcstombsz(pTTTA->szText, strTipText,sizeof(pTTTA->szText));
|
|
}
|
|
else
|
|
{
|
|
lstrcpyn(pTTTW->szText, strTipText, sizeof(pTTTW->szText));
|
|
}
|
|
#endif
|
|
|
|
*pResult = 0;
|
|
|
|
// bring the tooltip window above other popup windows
|
|
::SetWindowPos(pNMHDR->hwndFrom, HWND_TOP, 0, 0, 0, 0,SWP_NOACTIVATE|
|
|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER); return TRUE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
|
|
BOOL CDrawWallDlg::OnInitDialog()
|
|
{
|
|
CModelessDialog::OnInitDialog();
|
|
//ChangeDlgItemState();
|
|
{
|
|
CAcModuleResourceOverride vTmp;
|
|
m_toolbar.Create( /* WS_BORDER | */WS_VISIBLE | WS_CHILD | CCS_BOTTOM | TBSTYLE_TOOLTIPS
|
|
| CCS_ADJUSTABLE ,CRect(0,0,0,0),this, IDR_DRAWWALL_TOOLBAR);
|
|
// Zyu modify on 100621
|
|
//TBBUTTON *pIndex, *pRTF_Button = new TBBUTTON[6];
|
|
TBBUTTON *pIndex, *pRTF_Button = new TBBUTTON[8];
|
|
pIndex = pRTF_Button;
|
|
// Zyu modify on 100621
|
|
//for(long lIndex = 0; lIndex < 6; lIndex++) {
|
|
for(long lIndex = 0; lIndex < 8; lIndex++) {
|
|
memset(pIndex ,NULL, sizeof(TBBUTTON));
|
|
pIndex->iBitmap= tbButtm[lIndex].BitmapID;
|
|
pIndex->idCommand = tbButtm[lIndex].tbID;
|
|
pIndex->fsStyle = tbButtm[lIndex].Style;
|
|
pIndex->fsState = TBSTATE_ENABLED;
|
|
pIndex++;
|
|
}
|
|
|
|
CSize size(16, 15);
|
|
m_toolbar.SetButtonSize(size);
|
|
// Zyu modify on 100621
|
|
//m_toolbar.AddButtons(6, pRTF_Button);
|
|
m_toolbar.AddButtons(8, pRTF_Button);
|
|
|
|
delete pRTF_Button;
|
|
|
|
m_toolbar.ModifyStyle(0,TBSTYLE_FLAT);
|
|
m_toolbar.SetBitmapSize(size);
|
|
// Zyu modify on 100621
|
|
//m_toolbar.AddBitmap(5, IDR_DRAWWALL_TOOLBAR);
|
|
m_toolbar.AddBitmap(7, IDR_DRAWWALL_TOOLBAR);
|
|
m_toolbar.AutoSize();
|
|
}
|
|
|
|
m_wndToolTip.Create(this);
|
|
m_wndToolTip.Activate(true);
|
|
m_wndToolTip.SetDelayTime(TTDT_INITIAL, 500);
|
|
CWnd *pWnd = GetDlgItem(IDC_LIST_DATA);
|
|
m_wndToolTip.AddTool(pWnd, _T("按Delete键删除墙厚数据"));
|
|
|
|
m_material.ResetContent();
|
|
m_material.AddString(WALLMATE_Concrete);
|
|
m_material.AddString(WALLMATE_Concrete1);
|
|
m_material.AddString(WALLMATE_Brick);
|
|
m_material.AddString(WALLMATE_Brick1);
|
|
m_material.AddString(WALLMATE_Rocket);
|
|
m_material.AddString(WALLMATE_Rocket1);
|
|
m_material.AddString(WALLMATE_Fill);
|
|
m_material.AddString(WALLMATE_Fill1);
|
|
m_material.AddString(WALLMATE_Fill2);
|
|
m_material.AddString(WALLMATE_Divider);
|
|
m_material.AddString(WALLMATE_Curtain);
|
|
|
|
CComboBox *pBox1 = (CComboBox*)GetDlgItem(IDC_USAGE);
|
|
pBox1->ResetContent();
|
|
pBox1->AddString(_T("外墙"));
|
|
pBox1->AddString(_T("内墙"));
|
|
pBox1->AddString(_T("分户墙"));
|
|
pBox1->AddString(_T("虚墙"));
|
|
pBox1->AddString(_T("矮墙"));
|
|
pBox1->AddString(_T("卫生隔断"));
|
|
// ResetWidthList();
|
|
LoadCurWallMaterial();
|
|
OnSelchangeMaterial();
|
|
|
|
LoadCurWallElev();// add by xly on 101223
|
|
LoadCurWallUsage();
|
|
|
|
UpdateData(FALSE);
|
|
|
|
// Zyu add on 100625
|
|
TGGetVar(_T("OSMODE"), &m_iOldOsMode); // 获得系统的对象捕捉设置
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CDrawWallDlg::OnSelchangeListData()
|
|
{
|
|
UpdateData(TRUE);
|
|
int sel = m_listCtrl.GetCurSel();
|
|
// [12/18/2007 nsh]
|
|
if (sel==-1)
|
|
return;
|
|
m_nLeftWidth = m_lstMat[sel]->LeftWidth;
|
|
m_nRightWidth = m_lstMat[sel]->RightWidth;
|
|
UpdateData(FALSE);
|
|
}
|
|
void CDrawWallDlg::OnSelchangeUsage()
|
|
{
|
|
UpdateData(TRUE);
|
|
|
|
// add by xly on 101223
|
|
m_nSelUsage = m_wndUsage.GetCurSel();
|
|
UpdateData(FALSE);
|
|
}
|
|
// [12/17/2007 nsh]
|
|
//------------------------begin---------------------
|
|
int CompareDouble(const selMaterial *s1,const selMaterial *s2)
|
|
{
|
|
if (s1->LeftWidth>s2->LeftWidth)
|
|
return 1;
|
|
else if (s1->LeftWidth == s2->LeftWidth)
|
|
{
|
|
if (s1->RightWidth > s2->RightWidth)
|
|
return 1;
|
|
else
|
|
return -1;
|
|
}
|
|
else
|
|
return -1;
|
|
}
|
|
//-------------------------end----------------------
|
|
|
|
// 选择了另外一种材料
|
|
void CDrawWallDlg::OnSelchangeMaterial()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_lstMat.Reset();
|
|
CString csStyle;
|
|
m_nSelStyle = m_material.GetCurSel();
|
|
// CWnd *pWnd = GetDlgItem(IDC_MATERIAL);
|
|
// pWnd->GetWindowText(csStyle);
|
|
// if (csStyle.Find(_T("填充墙"))!=-1)
|
|
// csStyle=_T("填充墙");
|
|
|
|
//wlw t20一致 下面的材质要和DataStore.dbf文件一致 14.08.25
|
|
/*
|
|
switch(m_nSelStyle)
|
|
{
|
|
case 0:
|
|
case 1:
|
|
csStyle = _T("钢筋混凝土");
|
|
break;
|
|
case 2:
|
|
case 3:
|
|
csStyle = _T("砖墙");
|
|
break;
|
|
case 4:
|
|
case 5:
|
|
csStyle = _T("石材");
|
|
break;
|
|
case 6:
|
|
case 7:
|
|
case 8:
|
|
csStyle = _T("填充墙");
|
|
break;
|
|
case 9:
|
|
csStyle = _T("轻质隔墙");
|
|
break;
|
|
case 10:
|
|
csStyle = _T("玻璃幕墙");
|
|
break;
|
|
}
|
|
*/
|
|
//modify tyj 20160914:修正因材料列表中与下面名字不一样,造成不支持记录墙宽
|
|
switch(m_nSelStyle)
|
|
{
|
|
case 0:
|
|
csStyle = _T("钢筋砼");
|
|
break;
|
|
case 1:
|
|
csStyle = _T("混凝土");
|
|
break;
|
|
case 2:
|
|
csStyle = _T("砖");
|
|
break;
|
|
case 3:
|
|
csStyle = _T("耐火砖");
|
|
break;
|
|
case 4:
|
|
csStyle = _T("石材");
|
|
break;
|
|
case 5:
|
|
csStyle = _T("毛石");
|
|
break;
|
|
case 6:
|
|
csStyle = _T("填充墙");
|
|
break;
|
|
case 7:
|
|
csStyle = _T("加气块");
|
|
break;
|
|
case 8:
|
|
csStyle = _T("空心砖");
|
|
break;
|
|
case 9:
|
|
csStyle = _T("石膏板");
|
|
break;
|
|
case 10:
|
|
csStyle = _T("玻璃幕");
|
|
break;
|
|
}
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
int Number;
|
|
CString csType;
|
|
double nLeft, nRight;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
|
|
if (pTable==NULL)//add by fxj 081231
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF()) {
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
GET_FIELD(pTable, _T("TypeValue"), nLeft);
|
|
GET_FIELD(pTable, _T("REMARK"), nRight);
|
|
//modify tyj 20160921:修正获取数据时如果其他材料包含该材料名时,会一并获取的问题(例如:获取"砖"会将"砖"、"耐火砖"的数据都获取)
|
|
CString csSaveStyle(csStyle);
|
|
csSaveStyle += _T("*");
|
|
//if (csType.Find(csStyle) > -1 && Number == 11){
|
|
if ((csType == csStyle || csType == csSaveStyle) && Number == 11){
|
|
selMaterial *pNew = new selMaterial();
|
|
pNew->LeftWidth = nLeft;
|
|
pNew->RightWidth = nRight;
|
|
m_lstMat.Append(pNew);
|
|
if (csType.Find(_T("*")) > -1){
|
|
m_nLeftWidth = nLeft;
|
|
m_nRightWidth = nRight;
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
int len = m_lstMat.Length();
|
|
m_lstMat.QuickSort(CompareDouble);// [12/17/2007 nsh]
|
|
m_listCtrl.ResetContent();
|
|
for(int i=0;i<len;i++){
|
|
CString csRight, csLeft;
|
|
XString xsTmp;
|
|
csLeft.Format(_T("%.0f"), m_lstMat[i]->LeftWidth);
|
|
csRight.Format(_T("%.0f"), m_lstMat[i]->RightWidth);
|
|
int n = csLeft.GetLength();
|
|
xsTmp << (const TCHAR*)csLeft;
|
|
for(int j=0;j<12-n;j++){
|
|
xsTmp << _T(" ");
|
|
}
|
|
xsTmp << (const TCHAR*)csRight;
|
|
m_listCtrl.AddString((const TCHAR*)xsTmp);
|
|
}
|
|
|
|
|
|
UpdateData(FALSE);
|
|
}
|
|
// 取左宽度
|
|
double CDrawWallDlg::GetLeftWidth()
|
|
{
|
|
UpdateData(TRUE);
|
|
return m_nLeftWidth;
|
|
}
|
|
// 取右宽度
|
|
double CDrawWallDlg::GetRightWidth()
|
|
{
|
|
UpdateData(TRUE);
|
|
return m_nRightWidth;
|
|
}
|
|
double CDrawWallDlg::GetHeight()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (m_csWallHeight==_T("当前层高"))
|
|
return DocGetLHeight();
|
|
else
|
|
return _tstof(m_csWallHeight);
|
|
}
|
|
double CDrawWallDlg::GetElev()
|
|
{
|
|
UpdateData(TRUE);
|
|
return _tstof(m_csWallElev);
|
|
}
|
|
void CDrawWallDlg::OnButtonSnap()
|
|
{
|
|
g_bAutoSnap = !g_bAutoSnap;
|
|
|
|
// 修改描述:绘制墙体命令默认采用自动捕捉,此时命令会关闭平台系统的对象捕捉功能。
|
|
// 当用户关闭自动捕捉后,平台系统的对象捕捉却不能自动恢复。
|
|
// 修改方法:用户关闭自动捕捉后,恢复平台系统原来对象捕捉的设置。
|
|
// 修改人,修改时间:Zyu modfiy on 100625
|
|
int iNewOsMode = g_bAutoSnap ? (m_iOldOsMode | 0x4000) : m_iOldOsMode;
|
|
TGSetVar(_T("OSMODE"), iNewOsMode);
|
|
}
|
|
|
|
//add by xlc on 070511
|
|
void CDrawWallDlg::OnButtonModule()
|
|
{
|
|
g_bModelNumber = !g_bModelNumber;
|
|
}
|
|
|
|
// Zyu add on 100621
|
|
// 查询图中已有墙体对象并将其参数拾取到绘制墙体对话框中
|
|
void CDrawWallDlg::OnButtonInquire()
|
|
{
|
|
// 向命令行发送一个关键字
|
|
PostCommand(_T("` "));
|
|
}
|
|
|
|
void CDrawWallDlg::OnButtonLinewall()
|
|
{
|
|
if (g_nWallShape==0)
|
|
return;
|
|
UpdateData(TRUE);
|
|
g_nWallShape=0;
|
|
UpdateData(FALSE);
|
|
if (m_bSendChar)
|
|
acedPostCommand(_T("L "));
|
|
}
|
|
void CDrawWallDlg::OnButtonArcwall()
|
|
{
|
|
if (g_nWallShape==1)
|
|
return;
|
|
UpdateData(TRUE);
|
|
g_nWallShape=1;
|
|
UpdateData(FALSE);
|
|
if (m_bSendChar)
|
|
acedPostCommand(_T("A "));
|
|
}
|
|
void CDrawWallDlg::OnButtonRectwall()
|
|
{
|
|
if (g_nWallShape==2)
|
|
return;
|
|
UpdateData(TRUE);
|
|
g_nWallShape=2;
|
|
UpdateData(FALSE);
|
|
|
|
if (m_bSendChar)
|
|
acedPostCommand(_T("R "));
|
|
}
|
|
void CDrawWallDlg::OnClose()
|
|
{
|
|
if (m_bModeless)
|
|
acedPostCommand(_T("\33\33"));
|
|
else
|
|
CModelessDialog::OnClose();
|
|
}
|
|
void CDrawWallDlg::OnKillFocus(CWnd* pNewWnd)
|
|
{
|
|
CModelessDialog::OnKillFocus(pNewWnd);
|
|
UpdateData(TRUE);
|
|
}
|
|
TWallData::TWallStyle CDrawWallDlg::GetStyle(CString &sT20Mat)
|
|
{
|
|
UpdateData(TRUE);
|
|
TWallData::TWallStyle st = TWallData::kBrick; // 砖墙
|
|
sT20Mat = WALLMATE_Brick;
|
|
m_nSelStyle = m_material.GetCurSel();
|
|
switch(m_nSelStyle)
|
|
{
|
|
case 0:
|
|
sT20Mat = WALLMATE_Concrete;
|
|
st = TWallData::kConcrete;
|
|
break;
|
|
case 1:
|
|
sT20Mat = WALLMATE_Concrete1;
|
|
st = TWallData::kConcrete;
|
|
break;
|
|
case 2:
|
|
sT20Mat = WALLMATE_Brick;
|
|
st = TWallData::kBrick;
|
|
break;
|
|
case 3:
|
|
sT20Mat = WALLMATE_Brick1;
|
|
st = TWallData::kBrick;
|
|
break;
|
|
case 4:
|
|
sT20Mat = WALLMATE_Rocket;
|
|
st = TWallData::kRocket;
|
|
break;
|
|
case 5:
|
|
sT20Mat = WALLMATE_Rocket1;
|
|
st = TWallData::kRocket;
|
|
break;
|
|
case 6:
|
|
sT20Mat = WALLMATE_Fill;
|
|
st = TWallData::kFill;
|
|
break;
|
|
case 7:
|
|
sT20Mat = WALLMATE_Fill1;
|
|
st = TWallData::kFill1;
|
|
break;
|
|
case 8:
|
|
sT20Mat = WALLMATE_Fill2;
|
|
st = TWallData::kFill2;
|
|
break;
|
|
case 9:
|
|
sT20Mat = WALLMATE_Divider;
|
|
st = TWallData::kDivider;
|
|
break;
|
|
case 10:
|
|
sT20Mat = WALLMATE_Curtain;
|
|
st = TWallData::kCurtain;
|
|
break;
|
|
}
|
|
return st;
|
|
}
|
|
TWallData::UsageFlag CDrawWallDlg::GetUsage(TDbWall::Catalog &nCatalog)
|
|
{
|
|
TWallData::UsageFlag us=TWallData::kNormal;
|
|
switch(m_nSelUsage)
|
|
{
|
|
case 0:
|
|
us=TWallData::kNormal;
|
|
nCatalog = TDbWall::kExternal;
|
|
break;
|
|
case 1:
|
|
us=TWallData::kNormal;
|
|
nCatalog = TDbWall::kInternal;
|
|
|
|
break;
|
|
case 2:
|
|
us=TWallData::kNormal;
|
|
nCatalog = TDbWall::kDispartOwner;
|
|
break;
|
|
case 3:
|
|
us=TWallData::kVirtual;
|
|
nCatalog = TDbWall::kVirtDispart;
|
|
break;
|
|
case 4:
|
|
us=TWallData::kParapet;
|
|
break;
|
|
case 5:
|
|
us=TWallData::kApartment;
|
|
nCatalog = TDbWall::kToiletSlab;
|
|
break;
|
|
}
|
|
return us;
|
|
}
|
|
|
|
// Zyu add on 101115,读取当前墙体材料
|
|
bool CDrawWallDlg::LoadCurWallMaterial()
|
|
{
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
|
|
if (pTable==NULL)
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF())
|
|
{
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
if (Number == 11
|
|
&& csType == _T("当前墙体材料"))
|
|
{
|
|
CString sValue;
|
|
GET_FIELD(pTable, _T("TypeValue"), sValue);
|
|
int iIndex = m_material.FindString(-1, sValue);
|
|
if (iIndex > -1)
|
|
{
|
|
m_material.SetCurSel(iIndex);
|
|
m_nSelStyle = iIndex;
|
|
return true;
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Zyu add on 101115,保存当前墙体材料
|
|
bool CDrawWallDlg::SaveCurWallMaterial()
|
|
{
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile))
|
|
{
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
|
|
if (pTable==NULL)
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
CString sTypeValue;
|
|
int iIndex = m_material.GetCurSel();
|
|
CString sIndex;
|
|
sIndex.Format(_T("%d"), iIndex);
|
|
m_material.GetWindowText(sTypeValue);
|
|
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF())
|
|
{
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
if (Number == 11
|
|
&& csType == _T("当前墙体材料"))
|
|
{
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)sTypeValue);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)sIndex);
|
|
return true;
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
|
|
pTable->AppendBegin();
|
|
SET_FIELD(pTable, _T("TypeNumber"), 11);
|
|
SET_FIELD(pTable, _T("TypeName"), _T("当前墙体材料"));
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)sTypeValue);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)sIndex);
|
|
pTable->AppendEnd();
|
|
|
|
return true;
|
|
}
|
|
|
|
// add by xly on 101223,读取当前墙体底高
|
|
bool CDrawWallDlg::LoadCurWallElev()
|
|
{
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
|
|
if (pTable==NULL)
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF())
|
|
{
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
if (Number==11 && csType==_T("墙体底高"))
|
|
{
|
|
CString sValue;
|
|
GET_FIELD(pTable, _T("TypeValue"), sValue);
|
|
m_csWallElev = sValue;
|
|
return true;
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// add by xly on 101223,保存当前墙体底高
|
|
bool CDrawWallDlg::SaveCurWallElev()
|
|
{
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile))
|
|
{
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
|
|
if (pTable==NULL)
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
// 表格的内容设置为“11,墙体底高,0,0(此值不需要,固定写0)”
|
|
CString sTypeValue;
|
|
sTypeValue = m_csWallElev;
|
|
CString sIndex = _T("0");
|
|
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF())
|
|
{
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
if (Number==11 && csType==_T("墙体底高"))
|
|
{
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)sTypeValue);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)sIndex);
|
|
return true;
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
|
|
pTable->AppendBegin();
|
|
SET_FIELD(pTable, _T("TypeNumber"), 11);
|
|
SET_FIELD(pTable, _T("TypeName"), _T("墙体底高"));
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)sTypeValue);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)sIndex);
|
|
pTable->AppendEnd();
|
|
|
|
return true;
|
|
}
|
|
|
|
// add by xly on 101223,读取当前墙体用途
|
|
bool CDrawWallDlg::LoadCurWallUsage()
|
|
{
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
|
|
if (pTable==NULL)
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF())
|
|
{
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
if (Number==11 && csType==_T("当前墙体用途"))
|
|
{
|
|
CString sValue;
|
|
GET_FIELD(pTable, _T("TypeValue"), sValue);
|
|
int iIndex = m_wndUsage.FindString(-1, sValue);
|
|
if (iIndex > -1)
|
|
{
|
|
m_wndUsage.SetCurSel(iIndex);
|
|
m_nSelUsage = iIndex;
|
|
return true;
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// add by xly on 101223,保存当前墙体用途
|
|
bool CDrawWallDlg::SaveCurWallUsage()
|
|
{
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile))
|
|
{
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
|
|
if (pTable==NULL)
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return false;
|
|
}
|
|
|
|
// 获得用户选择的数据
|
|
CString sTypeValue;
|
|
m_wndUsage.GetWindowText(sTypeValue);
|
|
|
|
// 获得数据所在下拉列表的索引
|
|
int iIndex = m_wndUsage.GetCurSel();
|
|
CString sIndex;
|
|
sIndex.Format(_T("%d"), iIndex);
|
|
|
|
// 查找是否有数据
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF())
|
|
{
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
if (Number==11 && csType==_T("当前墙体用途"))
|
|
{
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)sTypeValue);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)sIndex);
|
|
return true;
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
|
|
// 保存数据
|
|
pTable->AppendBegin();
|
|
SET_FIELD(pTable, _T("TypeNumber"), 11);
|
|
SET_FIELD(pTable, _T("TypeName"), _T("当前墙体用途"));
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)sTypeValue);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)sIndex);
|
|
pTable->AppendEnd();
|
|
|
|
return true;
|
|
}
|
|
|
|
void CDrawWallDlg::SaveSettings()
|
|
{
|
|
UpdateData(TRUE);
|
|
CRegProperty regProp(GetRegLocation(), _T("Settings"));
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
regProp.SetValue(_T("WallLeftWidth"), m_nLeftWidth);
|
|
regProp.SetValue(_T("WallRightWidth"), m_nRightWidth);
|
|
regProp.SetValue(_T("WallHeight"), m_csWallHeight);
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
if (pTable==NULL)//add by fxj 081231
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
int len = m_lstMat.Length();
|
|
BOOL flag = FALSE;
|
|
for(int i=0;i<len;i++){
|
|
double nLeft = m_lstMat[i]->LeftWidth;
|
|
double nRight = m_lstMat[i]->RightWidth;
|
|
if (fabs(m_nLeftWidth - nLeft) < 0.01 && fabs(m_nRightWidth - nRight) < 0.01){
|
|
flag = TRUE;
|
|
break;
|
|
}
|
|
if (fabs(m_nLeftWidth - nRight) < 0.01 && fabs(m_nRightWidth - nLeft) < 0.01){
|
|
flag = TRUE;
|
|
break;
|
|
}
|
|
}
|
|
double nLeft, nRight;
|
|
int Number;
|
|
CString csType;
|
|
|
|
CString csStyle;
|
|
CWnd *pWnd = GetDlgItem(IDC_MATERIAL);
|
|
pWnd->GetWindowText(csStyle);
|
|
if (!flag){
|
|
selMaterial *pNew = new selMaterial();
|
|
pNew->LeftWidth = m_nLeftWidth;
|
|
pNew->RightWidth = m_nRightWidth;
|
|
m_lstMat.Append(pNew);
|
|
CString csRight, csLeft;
|
|
XString xsTmp;
|
|
csLeft.Format(_T("%.0f"), m_nLeftWidth);
|
|
csRight.Format(_T("%.0f"), m_nRightWidth);
|
|
int n = csLeft.GetLength();
|
|
xsTmp << (const TCHAR*)csLeft;
|
|
for(int j=0;j<12-n;j++){
|
|
xsTmp << _T(" ");
|
|
}
|
|
xsTmp << (const TCHAR*)csRight;
|
|
m_listCtrl.AddString((const TCHAR*)xsTmp);
|
|
csStyle += _T("*");
|
|
if (pTable) {
|
|
pTable->AppendBegin();
|
|
SET_FIELD(pTable, _T("TypeNumber"), 11);
|
|
SET_FIELD(pTable, _T("TypeName"), (const TCHAR*)csStyle);
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)csLeft);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)csRight);
|
|
pTable->AppendEnd();
|
|
}
|
|
}
|
|
else{
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF()) {
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
GET_FIELD(pTable, _T("TypeValue"), nLeft);
|
|
GET_FIELD(pTable, _T("REMARK"), nRight);
|
|
if (Number == 11){
|
|
if (csType.Find(csStyle) > -1){
|
|
if (fabs(m_nLeftWidth - nLeft) < 0.01 && fabs(m_nRightWidth - nRight) < 0.01){
|
|
if (csType.Find(_T("*")) > -1)
|
|
return;
|
|
SET_FIELD(pTable, _T("TypeName"), (const TCHAR*)(csStyle + _T("*")));
|
|
}
|
|
else{
|
|
if (csType.Find(_T("*")) > -1){
|
|
csType = csType.Left(csType.GetLength() - 1);
|
|
SET_FIELD(pTable, _T("TypeName"), (const TCHAR*)csType);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
}
|
|
}
|
|
BOOL CDrawWallDlg::PreTranslateMessage(MSG* pMsg)
|
|
{
|
|
if (pMsg->message==WM_KEYDOWN && (int)pMsg->wParam==VK_DELETE)
|
|
{
|
|
// [12/17/2007 nsh]
|
|
//--------------------------begin-------------------------------
|
|
int cursel =-1;
|
|
cursel=((CListBox*)(this->GetDlgItem(IDC_LIST_DATA)))->GetCurSel();
|
|
CString selString;
|
|
if (cursel!=-1)
|
|
{
|
|
((CListBox*)(this->GetDlgItem(IDC_LIST_DATA)))->GetText(cursel,selString);
|
|
}
|
|
if (cursel==-1 || selString=="")
|
|
{
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
//---------------------------end---------------------------------
|
|
CWnd *pWnd = GetDlgItem(IDC_LIST_DATA);
|
|
CWnd *pWnd2 = this->GetFocus();
|
|
if (this->GetFocus() == pWnd){
|
|
int sel = m_listCtrl.GetCurSel();
|
|
double nLeft, nRight, nLeftWidth, nRightWidth;
|
|
nLeftWidth = m_lstMat[sel]->LeftWidth;
|
|
nRightWidth = m_lstMat[sel]->RightWidth;
|
|
CString csStyle;
|
|
CWnd *pWnd = GetDlgItem(IDC_MATERIAL);
|
|
pWnd->GetWindowText(csStyle);
|
|
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
if (pTable==NULL)//add by fxj 081231
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF()) {
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
GET_FIELD(pTable, _T("TypeValue"), nLeft);
|
|
GET_FIELD(pTable, _T("REMARK"), nRight);
|
|
//modify tyj 20160920:修正 删除不了DataStore.dbf文件当前所选墙厚的问题
|
|
CString csSaveStyle(csStyle);
|
|
csSaveStyle += _T("*");
|
|
if ((csType == csStyle || csType == csSaveStyle) && Number == 11){
|
|
if (fabs(nLeftWidth - nLeft) < 0.01 && fabs(nRightWidth - nRight) < 0.01){
|
|
pTable->Delete();
|
|
break;
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
m_lstMat.Remove(sel);
|
|
m_listCtrl.DeleteString(sel);
|
|
// [12/18/2007 nsh]
|
|
//-----------------begin---------------------
|
|
/* if (sel == m_lstMat.Length())
|
|
sel--; */
|
|
/*m_nLeftWidth = m_lstMat[sel]->LeftWidth;
|
|
m_nRightWidth = m_lstMat[sel]->RightWidth;*/
|
|
|
|
//UpdateData(FALSE);
|
|
//-----------------end-----------------------
|
|
}
|
|
}
|
|
else if (pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST)
|
|
{
|
|
MSG msg;
|
|
::CopyMemory(&msg, pMsg, sizeof(MSG));
|
|
HWND hWndParent = ::GetParent(msg.hwnd);
|
|
if (msg.hwnd)
|
|
{
|
|
m_wndToolTip.RelayEvent(&msg);
|
|
}
|
|
}
|
|
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
void CDrawWallDlg::OnButtonLeft()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth + m_nRightWidth;
|
|
m_nLeftWidth = nTmp;
|
|
m_nRightWidth = 0;
|
|
UpdateData(FALSE);
|
|
|
|
}
|
|
void CDrawWallDlg::OnButtonMid()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth + m_nRightWidth;
|
|
m_nLeftWidth = nTmp/2;
|
|
m_nRightWidth = nTmp/2;
|
|
UpdateData(FALSE);
|
|
|
|
}
|
|
void CDrawWallDlg::OnButtonRight()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth + m_nRightWidth;
|
|
m_nLeftWidth = 0;
|
|
m_nRightWidth = nTmp;
|
|
UpdateData(FALSE);
|
|
|
|
}
|
|
void CDrawWallDlg::OnButtonChange()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth;
|
|
m_nLeftWidth = m_nRightWidth;
|
|
m_nRightWidth = nTmp;
|
|
UpdateData(FALSE);
|
|
}
|
|
HBRUSH CDrawWallDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
|
{
|
|
HBRUSH hbr = CModelessDialog::OnCtlColor(pDC, pWnd, nCtlColor);
|
|
|
|
int nID=pWnd->GetDlgCtrlID();
|
|
if (nID==IDC_LEFT_TEXT)
|
|
pDC->SetTextColor(acdbGetRGB(3));
|
|
else if (nID==IDC_RIGHT_TEXT)
|
|
pDC->SetTextColor(acdbGetRGB(6));
|
|
return hbr;
|
|
}
|
|
void CDrawWallDlg::OnDestroy()
|
|
{
|
|
// Zyu add on 101115,保存当前墙体材料
|
|
SaveCurWallMaterial();
|
|
|
|
// add by xly on 101223 保存墙体底高
|
|
SaveCurWallElev();
|
|
|
|
// add by xly on 101223 保存墙体用途
|
|
SaveCurWallUsage();
|
|
CModelessDialog::OnDestroy();
|
|
m_wndToolTip.DestroyWindow();
|
|
}
|
|
|
|
// Zyu add on 100621
|
|
// 通过选择墙实体,更新对话框的参数
|
|
void CDrawWallDlg::PickToUpdate()
|
|
{
|
|
// 隐藏对话框
|
|
ShowWindow(SW_HIDE);
|
|
|
|
// 选择墙体
|
|
TEntitySet ent;
|
|
TRBList mask(RTDXF0, _T("TCH_WALL,TCH_CURTAIN_WALL"), NULL);
|
|
if (RTNORM == SelectEntity(_T("\n请拾取参考墙体<返回对话框>:"), ent, mask))
|
|
{
|
|
// 读方式打开实体
|
|
TAcDbObjectPtr obj(ent, AcDb::kForRead);
|
|
TDbWall *pWall = TDbWall::cast(obj.m_pObject);
|
|
if (pWall)
|
|
{
|
|
// 设置对话框里的高度值
|
|
double dWallHeight = pWall->GetHeight();
|
|
if (fabs(dWallHeight - DocGetLHeight()) < _DIST_SNAP)
|
|
{
|
|
m_csWallHeight = _T("当前层高");
|
|
}
|
|
else
|
|
{
|
|
m_csWallHeight.Format(_T("%.0f"), dWallHeight);
|
|
}
|
|
// 设置对话框里的底高
|
|
double dWallElev = pWall->GetElevation();
|
|
m_csWallElev.Format(_T("%.0f"), dWallElev);
|
|
// 设置对话框里的材料选项
|
|
switch (pWall->GetStyle())
|
|
{
|
|
case TWallData::kConcrete:
|
|
{
|
|
m_nSelStyle = 0;
|
|
if (pWall->GetT20WallMat() == WALLMATE_Concrete1)
|
|
{
|
|
m_nSelStyle +=1;
|
|
}
|
|
break;
|
|
}
|
|
|
|
case TWallData::kBrick:
|
|
{
|
|
m_nSelStyle = 2;
|
|
if (pWall->GetT20WallMat() == WALLMATE_Brick1)
|
|
{
|
|
m_nSelStyle += 1;
|
|
}
|
|
break;
|
|
}
|
|
case TWallData::kRocket:
|
|
{
|
|
m_nSelStyle = 4;
|
|
if (pWall->GetT20WallMat() == WALLMATE_Rocket1)
|
|
{
|
|
m_nSelStyle += 1;
|
|
}
|
|
break;
|
|
}
|
|
case TWallData::kFill:
|
|
{
|
|
m_nSelStyle = 6;
|
|
break;
|
|
}
|
|
case TWallData::kFill1:
|
|
{
|
|
m_nSelStyle = 7;
|
|
break;
|
|
}
|
|
case TWallData::kFill2:
|
|
{
|
|
m_nSelStyle = 8;
|
|
break;
|
|
}
|
|
case TWallData::kDivider:
|
|
{
|
|
m_nSelStyle = 9;
|
|
break;
|
|
}
|
|
case TWallData::kCurtain:
|
|
{
|
|
m_nSelStyle = 10;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// 设置对话框里的用途选项
|
|
switch (pWall->GetUsageFlag())
|
|
{
|
|
case TWallData::kNormal:
|
|
{
|
|
if (pWall->GetCatalog() == TDbWall::kDispartOwner)
|
|
{
|
|
m_nSelUsage = 2;
|
|
}
|
|
else if (pWall->GetCatalog() == TDbWall::kExternal)
|
|
{
|
|
m_nSelUsage = 0;
|
|
}
|
|
else
|
|
{
|
|
m_nSelUsage = 1;
|
|
|
|
}
|
|
break;
|
|
}
|
|
case TWallData::kVirtual: m_nSelUsage = 3; break;
|
|
case TWallData::kParapet: m_nSelUsage = 4; break;
|
|
case TWallData::kApartment: m_nSelUsage = 5; break;
|
|
}
|
|
// 设置左宽
|
|
m_nLeftWidth = pWall->GetWidth(0);
|
|
// 设置右宽
|
|
m_nRightWidth = pWall->GetWidth(1);
|
|
|
|
UpdateData(FALSE);
|
|
pWall->close();
|
|
}
|
|
}
|
|
|
|
// 显示对话框
|
|
ShowWindow(SW_SHOW);
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////
|
|
//add by fxj
|
|
IMPLEMENT_DYNAMIC(CPartWallDlg, CModelessDialog)
|
|
|
|
|
|
int CPartWallDlg::m_nStyle = 5;//砖墙
|
|
int CPartWallDlg::m_nUse =0;
|
|
CString CPartWallDlg::m_csWallElev=_T("0");
|
|
|
|
CPartWallDlg::CPartWallDlg(CWnd* pParent /*=NULL*/)
|
|
: CModelessDialog(CPartWallDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDrawWallDlg)
|
|
m_nLeftWidth = 120;
|
|
m_nRightWidth = 120;
|
|
//}}AFX_DATA_INIT
|
|
|
|
m_bSendChar=FALSE;
|
|
|
|
CRegProperty regProp(GetRegLocation(), _T("Settings"));
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
regProp.GetValue(_T("WallLeftWidth"), m_nLeftWidth);
|
|
regProp.GetValue(_T("WallRightWidth"), m_nRightWidth);
|
|
|
|
m_csWallHeight=_T("当前层高");
|
|
regProp.GetValue(_T("WallHeight"), m_csWallHeight);
|
|
}
|
|
|
|
|
|
void CPartWallDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CModelessDialog::DoDataExchange(pDX);
|
|
|
|
//add by whl on 060308
|
|
if (pDX->m_bSaveAndValidate)
|
|
{
|
|
CString sText;
|
|
CWnd *pWnd=NULL;
|
|
|
|
pWnd=GetDlgItem(IDC_EDIT_LEFT);
|
|
if (pWnd!=NULL)
|
|
{
|
|
pWnd->GetWindowText(sText);
|
|
if (fabs(_tstof(sText))<1E-5)
|
|
pWnd->SetWindowText(_T("0"));
|
|
}
|
|
|
|
pWnd=GetDlgItem(IDC_EDIT_RIGHT);
|
|
if (pWnd!=NULL)
|
|
{
|
|
pWnd->GetWindowText(sText);
|
|
if (fabs(_tstof(sText))<1E-5)
|
|
pWnd->SetWindowText(_T("0"));
|
|
}
|
|
}
|
|
//{{AFX_DATA_MAP(CPartWallDlg)
|
|
DDX_Control(pDX, IDC_HEIGHT, m_comHeight);
|
|
DDX_Control(pDX, IDC_LIST_DATA, m_listCtrl);
|
|
DDX_Control(pDX, IDC_MATERIAL, m_material);
|
|
DDX_Text(pDX, IDC_EDIT_LEFT, m_nLeftWidth);
|
|
DDX_Text(pDX, IDC_EDIT_RIGHT, m_nRightWidth);
|
|
DDX_CBString(pDX, IDC_HEIGHT, m_csWallHeight);
|
|
DDX_CBString(pDX, IDC_ELEV, m_csWallElev);
|
|
//}}AFX_DATA_MAP
|
|
DDX_CBIndex(pDX, IDC_MATERIAL, m_nStyle);
|
|
DDX_CBIndex(pDX, IDC_USAGE,m_nUse);
|
|
if (!pDX->m_bSaveAndValidate)
|
|
{
|
|
|
|
|
|
GetDlgItem(IDC_LEFT_TEXT)->SetWindowText(_T("左宽"));
|
|
GetDlgItem(IDC_RIGHT_TEXT)->SetWindowText(_T("右宽"));
|
|
|
|
}
|
|
GetDlgItem(IDC_HEIGHT)->EnableWindow(m_nUse!=2);
|
|
GetDlgItem(IDC_MATERIAL)->EnableWindow(m_nUse!=2);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CPartWallDlg, CModelessDialog)
|
|
//{{AFX_MSG_MAP(CPartWallDlg)
|
|
ON_CBN_SELCHANGE(IDC_MATERIAL, OnSelchangeMaterial)
|
|
ON_CBN_SELCHANGE(IDC_USAGE, OnSelchangeUsage)
|
|
|
|
ON_WM_CLOSE()
|
|
ON_WM_KILLFOCUS()
|
|
ON_LBN_SELCHANGE(IDC_LIST_DATA, OnSelchangeListData)
|
|
ON_BN_CLICKED(IDC_BUTTON_LEFT, OnButtonLeft)
|
|
ON_BN_CLICKED(IDC_BUTTON_MID, OnButtonMid)
|
|
ON_BN_CLICKED(IDC_BUTTON_RIGHT, OnButtonRight)
|
|
ON_BN_CLICKED(IDC_BUTTON_CHANGE, OnButtonChange)
|
|
ON_WM_CTLCOLOR()
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CPartWallDlg message handlers
|
|
|
|
BOOL CPartWallDlg::OnInitDialog()
|
|
{
|
|
CModelessDialog::OnInitDialog();
|
|
//ChangeDlgItemState();
|
|
|
|
CWnd *pWnd = GetDlgItem(IDC_LIST_DATA);
|
|
|
|
|
|
// ResetWidthList();
|
|
OnSelchangeMaterial();
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CPartWallDlg::OnSelchangeListData()
|
|
{
|
|
UpdateData(TRUE);
|
|
int sel = m_listCtrl.GetCurSel();
|
|
// [12/18/2007 nsh]
|
|
if (sel==-1)
|
|
return;
|
|
m_nLeftWidth = m_lstMat[sel]->LeftWidth;
|
|
m_nRightWidth = m_lstMat[sel]->RightWidth;
|
|
UpdateData(FALSE);
|
|
}
|
|
void CPartWallDlg::OnSelchangeUsage()
|
|
{
|
|
UpdateData(TRUE);
|
|
}
|
|
|
|
void CPartWallDlg::OnSelchangeMaterial()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_lstMat.Reset();
|
|
CString csStyle;
|
|
m_nStyle = m_material.GetCurSel();
|
|
CWnd *pWnd = GetDlgItem(IDC_MATERIAL);
|
|
pWnd->GetWindowText(csStyle);
|
|
if (csStyle.Find(_T("填充墙"))!=-1)
|
|
csStyle=_T("填充墙");
|
|
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
int Number;
|
|
CString csType;
|
|
double nLeft, nRight;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
if (pTable==NULL)//add by fxj 081231
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF()) {
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
GET_FIELD(pTable, _T("TypeValue"), nLeft);
|
|
GET_FIELD(pTable, _T("REMARK"), nRight);
|
|
if (csType.Find(csStyle) > -1 && Number == 11){
|
|
selMaterial *pNew = new selMaterial();
|
|
pNew->LeftWidth = nLeft;
|
|
pNew->RightWidth = nRight;
|
|
m_lstMat.Append(pNew);
|
|
if (csType.Find(_T("*")) > -1){
|
|
m_nLeftWidth = nLeft;
|
|
m_nRightWidth = nRight;
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
int len = m_lstMat.Length();
|
|
m_lstMat.QuickSort(CompareDouble);// [12/17/2007 nsh]
|
|
m_listCtrl.ResetContent();
|
|
for(int i=0;i<len;i++){
|
|
CString csRight, csLeft;
|
|
XString xsTmp;
|
|
csLeft.Format(_T("%.0f"), m_lstMat[i]->LeftWidth);
|
|
csRight.Format(_T("%.0f"), m_lstMat[i]->RightWidth);
|
|
int n = csLeft.GetLength();
|
|
xsTmp << (const TCHAR*)csLeft;
|
|
for(int j=0;j<12-n;j++){
|
|
xsTmp << _T(" ");
|
|
}
|
|
xsTmp << (const TCHAR*)csRight;
|
|
m_listCtrl.AddString((const TCHAR*)xsTmp);
|
|
}
|
|
|
|
|
|
UpdateData(FALSE);
|
|
}
|
|
// 取左宽度
|
|
double CPartWallDlg::GetLeftWidth()
|
|
{
|
|
UpdateData(TRUE);
|
|
return m_nLeftWidth;
|
|
}
|
|
// 取右宽度
|
|
double CPartWallDlg::GetRightWidth()
|
|
{
|
|
UpdateData(TRUE);
|
|
return m_nRightWidth;
|
|
}
|
|
double CPartWallDlg::GetHeight()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (m_csWallHeight==_T("当前层高"))
|
|
return DocGetLHeight();
|
|
else
|
|
return _tstof(m_csWallHeight);
|
|
}
|
|
double CPartWallDlg::GetElev()
|
|
{
|
|
UpdateData(TRUE);
|
|
return _tstof(m_csWallElev);
|
|
}
|
|
|
|
|
|
void CPartWallDlg::OnClose()
|
|
{
|
|
if (m_bModeless)
|
|
acedPostCommand(_T("\33\33"));
|
|
else
|
|
CModelessDialog::OnClose();
|
|
}
|
|
void CPartWallDlg::OnKillFocus(CWnd* pNewWnd)
|
|
{
|
|
CModelessDialog::OnKillFocus(pNewWnd);
|
|
UpdateData(TRUE);
|
|
}
|
|
TWallData::TWallStyle CPartWallDlg::GetStyle()
|
|
{
|
|
TWallData::TWallStyle st=TWallData::kBrick;
|
|
switch(m_nStyle) {
|
|
case 0: st=TWallData::kDivider; break;
|
|
case 1: st=TWallData::kCurtain; break;//add by whl
|
|
case 2: st=TWallData::kFill; break;
|
|
case 3: st=TWallData::kFill1; break;
|
|
case 4: st=TWallData::kFill2; break;
|
|
case 5: st=TWallData::kBrick; break;
|
|
case 6: st=TWallData::kRocket; break;
|
|
case 7: st=TWallData::kConcrete; break;
|
|
}
|
|
return st;
|
|
}
|
|
TWallData::UsageFlag CPartWallDlg::GetUsage()
|
|
{
|
|
TWallData::UsageFlag us=TWallData::kNormal;
|
|
switch(m_nUse)
|
|
{
|
|
case 0: us=TWallData::kNormal;break;
|
|
case 1: us=TWallData::kApartment;break;
|
|
case 2: us=TWallData::kVirtual;break;
|
|
case 3: us=TWallData::kParapet;break;
|
|
}
|
|
return us;
|
|
}
|
|
void CPartWallDlg::SaveSettings()
|
|
{
|
|
UpdateData(TRUE);
|
|
CRegProperty regProp(GetRegLocation(), _T("Settings"));
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
regProp.SetValue(_T("WallLeftWidth"), m_nLeftWidth);
|
|
regProp.SetValue(_T("WallRightWidth"), m_nRightWidth);
|
|
regProp.SetValue(_T("WallHeight"), m_csWallHeight);
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
if (pTable==NULL)//add by fxj 081231
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return;
|
|
}
|
|
int len = m_lstMat.Length();
|
|
BOOL flag = FALSE;
|
|
for(int i=0;i<len;i++){
|
|
double nLeft = m_lstMat[i]->LeftWidth;
|
|
double nRight = m_lstMat[i]->RightWidth;
|
|
if (fabs(m_nLeftWidth - nLeft) < 0.01 && fabs(m_nRightWidth - nRight) < 0.01){
|
|
flag = TRUE;
|
|
break;
|
|
}
|
|
if (fabs(m_nLeftWidth - nRight) < 0.01 && fabs(m_nRightWidth - nLeft) < 0.01){
|
|
flag = TRUE;
|
|
break;
|
|
}
|
|
}
|
|
double nLeft, nRight;
|
|
int Number;
|
|
CString csType;
|
|
|
|
CString csStyle;
|
|
CWnd *pWnd = GetDlgItem(IDC_MATERIAL);
|
|
pWnd->GetWindowText(csStyle);
|
|
if (!flag){
|
|
selMaterial *pNew = new selMaterial();
|
|
pNew->LeftWidth = m_nLeftWidth;
|
|
pNew->RightWidth = m_nRightWidth;
|
|
m_lstMat.Append(pNew);
|
|
CString csRight, csLeft;
|
|
XString xsTmp;
|
|
csLeft.Format(_T("%.0f"), m_nLeftWidth);
|
|
csRight.Format(_T("%.0f"), m_nRightWidth);
|
|
int n = csLeft.GetLength();
|
|
xsTmp << (const TCHAR*)csLeft;
|
|
for(int j=0;j<12-n;j++){
|
|
xsTmp << _T(" ");
|
|
}
|
|
xsTmp << (const TCHAR*)csRight;
|
|
m_listCtrl.AddString((const TCHAR*)xsTmp);
|
|
csStyle += _T("*");
|
|
if (pTable) {
|
|
pTable->AppendBegin();
|
|
SET_FIELD(pTable, _T("TypeNumber"), 11);
|
|
SET_FIELD(pTable, _T("TypeName"), (const TCHAR*)csStyle);
|
|
SET_FIELD(pTable, _T("TypeValue"), (const TCHAR*)csLeft);
|
|
SET_FIELD(pTable, _T("REMARK"), (const TCHAR*)csRight);
|
|
pTable->AppendEnd();
|
|
}
|
|
}
|
|
else{
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF()) {
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
GET_FIELD(pTable, _T("TypeValue"), nLeft);
|
|
GET_FIELD(pTable, _T("REMARK"), nRight);
|
|
if (Number == 11){
|
|
if (csType.Find(csStyle) > -1){
|
|
if (fabs(m_nLeftWidth - nLeft) < 0.01 && fabs(m_nRightWidth - nRight) < 0.01){
|
|
if (csType.Find(_T("*")) > -1)
|
|
return;
|
|
SET_FIELD(pTable, _T("TypeName"), (const TCHAR*)(csStyle + _T("*")));
|
|
}
|
|
else{
|
|
if (csType.Find(_T("*")) > -1){
|
|
csType = csType.Left(csType.GetLength() - 1);
|
|
SET_FIELD(pTable, _T("TypeName"), (const TCHAR*)csType);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
}
|
|
}
|
|
BOOL CPartWallDlg::PreTranslateMessage(MSG* pMsg)
|
|
{
|
|
if (pMsg->message==WM_KEYDOWN && (int)pMsg->wParam==VK_DELETE)
|
|
{
|
|
// [12/17/2007 nsh]
|
|
//--------------------------begin-------------------------------
|
|
int cursel =-1;
|
|
cursel=((CListBox*)(this->GetDlgItem(IDC_LIST_DATA)))->GetCurSel();
|
|
CString selString;
|
|
if (cursel!=-1)
|
|
{
|
|
((CListBox*)(this->GetDlgItem(IDC_LIST_DATA)))->GetText(cursel,selString);
|
|
}
|
|
if (cursel==-1 || selString=="")
|
|
{
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
//---------------------------end---------------------------------
|
|
CWnd *pWnd = GetDlgItem(IDC_LIST_DATA);
|
|
CWnd *pWnd2 = this->GetFocus();
|
|
if (this->GetFocus() == pWnd){
|
|
int sel = m_listCtrl.GetCurSel();
|
|
double nLeft, nRight, nLeftWidth, nRightWidth;
|
|
nLeftWidth = m_lstMat[sel]->LeftWidth;
|
|
nRightWidth = m_lstMat[sel]->RightWidth;
|
|
CString csStyle;
|
|
CWnd *pWnd = GetDlgItem(IDC_MATERIAL);
|
|
pWnd->GetWindowText(csStyle);
|
|
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if (!FindFile(_T("DataStore.dbf"), fullFile)) {
|
|
MessageBox(_T("对不起,没有发现DataStore.dbf文件!"));
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
int Number;
|
|
CString csType;
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
if (pTable==NULL)//add by fxj 081231
|
|
{
|
|
MessageBox(_T("对不起,打不开DataStore.dbf文件!"));
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
pTable->MoveFirst();
|
|
while(!pTable->IsEOF()) {
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
GET_FIELD(pTable, _T("TypeValue"), nLeft);
|
|
GET_FIELD(pTable, _T("REMARK"), nRight);
|
|
if (csType == csStyle && Number == 11){
|
|
if (fabs(nLeftWidth - nLeft) < 0.01 && fabs(nRightWidth - nRight) < 0.01){
|
|
pTable->Delete();
|
|
break;
|
|
}
|
|
}
|
|
pTable->MoveNext();
|
|
}
|
|
m_lstMat.Remove(sel);
|
|
m_listCtrl.DeleteString(sel);
|
|
// [12/18/2007 nsh]
|
|
//-----------------begin---------------------
|
|
/* if (sel == m_lstMat.Length())
|
|
sel--; */
|
|
/*m_nLeftWidth = m_lstMat[sel]->LeftWidth;
|
|
m_nRightWidth = m_lstMat[sel]->RightWidth;*/
|
|
|
|
//UpdateData(FALSE);
|
|
//-----------------end-----------------------
|
|
}
|
|
}
|
|
else if (pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST)
|
|
{
|
|
MSG msg;
|
|
::CopyMemory(&msg, pMsg, sizeof(MSG));
|
|
HWND hWndParent = ::GetParent(msg.hwnd);
|
|
if (msg.hwnd)
|
|
{
|
|
m_wndToolTip.RelayEvent(&msg);
|
|
}
|
|
}
|
|
|
|
return CModelessDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
void CPartWallDlg::OnButtonLeft()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth + m_nRightWidth;
|
|
m_nLeftWidth = nTmp;
|
|
m_nRightWidth = 0;
|
|
UpdateData(FALSE);
|
|
|
|
}
|
|
void CPartWallDlg::OnButtonMid()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth + m_nRightWidth;
|
|
m_nLeftWidth = nTmp/2;
|
|
m_nRightWidth = nTmp/2;
|
|
UpdateData(FALSE);
|
|
|
|
}
|
|
void CPartWallDlg::OnButtonRight()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth + m_nRightWidth;
|
|
m_nLeftWidth = 0;
|
|
m_nRightWidth = nTmp;
|
|
UpdateData(FALSE);
|
|
|
|
}
|
|
void CPartWallDlg::OnButtonChange()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nTmp = m_nLeftWidth;
|
|
m_nLeftWidth = m_nRightWidth;
|
|
m_nRightWidth = nTmp;
|
|
UpdateData(FALSE);
|
|
}
|
|
HBRUSH CPartWallDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
|
{
|
|
HBRUSH hbr = CModelessDialog::OnCtlColor(pDC, pWnd, nCtlColor);
|
|
|
|
int nID=pWnd->GetDlgCtrlID();
|
|
if (nID==IDC_LEFT_TEXT)
|
|
pDC->SetTextColor(acdbGetRGB(3));
|
|
else if (nID==IDC_RIGHT_TEXT)
|
|
pDC->SetTextColor(acdbGetRGB(6));
|
|
return hbr;
|
|
}
|
|
void CPartWallDlg::OnDestroy()
|
|
{
|
|
CModelessDialog::OnDestroy();
|
|
|
|
}
|
|
void CPartWallDlg::SetData(TDbWall*pWall)
|
|
{
|
|
m_csWallElev = (const TCHAR *)Dist2Str(pWall->GetElevation());
|
|
m_nLeftWidth = pWall->GetWidth(0);
|
|
|
|
TWallData::TWallStyle style=pWall->GetStyle();
|
|
switch(style) {
|
|
case TWallData::kDivider: m_nStyle=0; break;
|
|
case TWallData::kCurtain: m_nStyle=1; break;
|
|
case TWallData::kFill: m_nStyle=2; break;
|
|
case TWallData::kFill1: m_nStyle=3; break;
|
|
case TWallData::kFill2: m_nStyle=4; break;
|
|
case TWallData::kBrick: m_nStyle=5; break;
|
|
case TWallData::kRocket: m_nStyle=6; break;
|
|
case TWallData::kConcrete: m_nStyle=7; break;
|
|
default: m_nStyle=-1;
|
|
}
|
|
m_nRightWidth = pWall->GetWidth(1);
|
|
m_csWallHeight = (const TCHAR *)Dist2Str(pWall->GetHeight());
|
|
|
|
if (pWall->Is(CURVE_ARC))
|
|
m_csRadius = (const TCHAR *)Dist2Str(pWall->GetArc().GetRadius());
|
|
|
|
switch(pWall->GetUsageFlag())
|
|
{
|
|
case TWallData::kNormal:m_nUse=0;break;
|
|
case TWallData::kApartment:m_nUse=1;break;
|
|
case TWallData::kVirtual:m_nUse=2;break;
|
|
default:m_nUse=3;break;
|
|
}
|
|
UpdateData(FALSE);
|
|
}
|
|
void CPartWallDlg::GetData(CString &sWallHeight,CString &sWallElev)
|
|
{
|
|
UpdateData(TRUE);
|
|
sWallHeight=m_csWallHeight;
|
|
sWallElev=m_csWallElev;
|
|
//if (pWall->Is(CURVE_ARC)) { //改变半径
|
|
// double nChordLen=pWall->XLine::Length();
|
|
// if (nChordLen<2.0*_tstof(m_csRadius)-1.0E-6) {
|
|
// BOOL bOverPi=(pWall->bulge>PI);
|
|
// double nAng=2.0*asin(nChordLen/2.0/_tstof(m_csRadius));
|
|
// if (!bOverPi) pWall->bulge=nAng;
|
|
// else pWall->bulge=2*PI-nAng;
|
|
// }
|
|
//}
|
|
|
|
//pWall->ChangeElevation(_tstof(m_csWallElev), FALSE);
|
|
//pWall->SetHeight(_tstof(m_csWallHeight));
|
|
//
|
|
//pWall->SetWidth(0, m_nLeftWidth);
|
|
//pWall->SetWidth(1, m_nRightWidth);
|
|
|
|
//TWallData::TWallStyle st=pWall->GetStyle();
|
|
//switch(m_nStyle) {
|
|
//case 0: st=TWallData::kDivider; break;
|
|
//case 1: st=TWallData::kCurtain; break;
|
|
//case 2: st=TWallData::kFill; break;
|
|
//case 3: st=TWallData::kFill1; break;
|
|
//case 4: st=TWallData::kFill2; break;
|
|
//case 5: st=TWallData::kBrick; break;
|
|
//case 6: st=TWallData::kRocket; break;
|
|
//case 7: st=TWallData::kConcrete; break;
|
|
//}
|
|
//pWall->SetStyle(st);
|
|
|
|
//TWallData::UsageFlag use;
|
|
//switch(m_nUse) {
|
|
//case 0: use=TWallData::kNormal; break;
|
|
//case 1: use=TWallData::kApartment; break;
|
|
//case 2: use=TWallData::kVirtual; break;
|
|
//case 3: use=TWallData::kParapet; break;
|
|
//}
|
|
//pWall->SetUsageFlag(use);
|
|
|
|
} |