// DlgEditblc.cpp : implementation file // #include "stdafx.h" #include "DlgEditblc.h" #include "Resource.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif void lightblc(Entity entblc,CString strlayer,bool bchange); // 遍历图块中的实体,并亮显该实体 void UpdateBlockInserts(Entity entInsert); ///////////////////////////////////////////////////////////////////////////// // CDlgEditblc dialog CDlgEditblc::CDlgEditblc(CWnd* pParent /*=NULL*/) : GlwCAcUiDialog(CDlgEditblc::IDD, pParent) { //{{AFX_DATA_INIT(CDlgEditblc) m_blcname = _T(""); m_blcnum = 1; m_strCmblayer = _T(""); m_nCurrentSel=0; bSel=false; //}}AFX_DATA_INIT } CDlgEditblc::~CDlgEditblc() { mSyslayer.RemoveAll(); //ads_command(RTSTR,_T(".REGEN"),NULL); } void CDlgEditblc::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgEditblc) DDX_Control(pDX, IDC_LIST_LAYER, m_layerlist); DDX_Control(pDX, IDC_COMB_LAYER, m_editlayer); DDX_Text(pDX, IDC_EDIT_BLC, m_blcname); DDX_Text(pDX, IDC_EDIT_BLCNUM, m_blcnum); DDX_CBString(pDX, IDC_COMB_LAYER, m_strCmblayer); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDlgEditblc, GlwCAcUiDialog) //{{AFX_MSG_MAP(CDlgEditblc) ON_NOTIFY(NM_CLICK, IDC_LIST_LAYER, OnClickListLayer) ON_CBN_EDITCHANGE(IDC_COMB_LAYER, OnEditchangeCombLayer) ON_BN_CLICKED(IDC_Cancel, OnCancel) ON_CBN_DBLCLK(IDC_COMB_LAYER, OnDblclkCombLayer) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDlgEditblc message handlers // Zyu modify on 100721,支持64位 //int CDlgEditblc::DoModal() INT_PTR CDlgEditblc::DoModal() { // TODO: Add your specialized code here and/or call the base class return CDialog::DoModal(); } void CDlgEditblc::loadObjlayer() // 载入块中层信息,并查重 { m_layerlist.SetExtendedStyle(LVS_EX_FULLROWSELECT); m_layerlist.InsertColumn ( 0, _T("原层名"), LVCFMT_LEFT, 100 ,-1); m_layerlist.InsertColumn ( 1, _T("新层名"), LVCFMT_LEFT, 100 ,-1); //LVFINDINFO info; //info.flags = LVFI_PARTIAL|LVFI_STRING; CStringArray mlayer; // 系统层信息 for (int i=0;iShowWindow(SW_HIDE); // hide GetDlgItem(IDC_EDIT_BLCNUM)->ShowWindow(SW_HIDE); // hide } else if (m_nowblc==1) { GetDlgItem(IDC_STATIC_NUM)->ShowWindow(SW_SHOW); // hide GetDlgItem(IDC_EDIT_BLCNUM)->ShowWindow(SW_SHOW); // hide } loadObjlayer(); // 载入实体层信息 m_editlayer.Clear(); for (int j=0;j=0) m_editlayer.GetLBText(m_editlayer.GetCurSel(),m_strCmblayer); // 获得当前所选的层名 else m_editlayer.GetWindowText(m_strCmblayer); if (m_strCmblayer!=_T("")) showlayer(); else { return; CDialog::OnOK(); } AcDbObjectIdArray ArrayID; if (m_nowblc==0) // 修改当前图块 { ChangeObjlayer(ArrayID,mlayerSel,m_strCmblayer,mEntname); mArrayID=ArrayID; } else if (m_nowblc==1) // 修改所有同名图块 { if (m_strCmblayer !=_T("")) { ChangeObjlayer(ArrayID,mlayerSel,m_strCmblayer,mEntname); // 修改块中实体的层信息 mArrayID=ArrayID; } } //ads_command(RTSTR,_T(".REGEN"),NULL); UpdateBlockInserts(mEntname); m_layerlist.SetHotItem(m_nCurrentSel); // 当前所选项的索引号 mlayerSel=m_strCmblayer; UpdateData(false); // bSel=false; bSel=true; } void CDlgEditblc::OnCancel() { // TODO: Add extra cleanup here mCmdOk=false; CDialog::OnCancel(); } void CDlgEditblc::OnClickListLayer(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here UpdateData(true); NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; m_nCurrentSel = pNMListView->iItem; // 当前所选项的索引号 m_layerlist.SetHotItem(m_nCurrentSel); // 当前所选项的索引号 mlayerSel=m_layerlist.GetItemText( m_nCurrentSel, 1 ) ; // 将第一列所选层传给mlayerSel m_strCmblayer=mlayerSel; m_editlayer.SetWindowText(m_strCmblayer); // 显示在combobox bSel=true; UpdateData(false); *pResult = 0; lightblc(mEntname,mlayerSel,true); // 遍历图块中的实体,并亮显该实体 UpdateBlockInserts(mEntname); lightblc(mEntname,mlayerSel,false); // 遍历图块中的实体,并亮显该实体 } void CDlgEditblc::OnEditchangeCombLayer() { // TODO: Add your control notification handler code here m_editlayer.GetWindowText(mlayerEdit); // 显示在combobox // Delete all the items from the combo box. if ((mlayerEdit==_T("*")) || (mlayerEdit==_T(""))) { m_editlayer.ResetContent(); ASSERT(m_editlayer.GetCount() == 0); m_editlayer.SetWindowText(mlayerEdit); for (int j=0;j