240 lines
6.4 KiB
C++
240 lines
6.4 KiB
C++
// ComposingDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "ComposingDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CComposingDlg dialog
|
|
|
|
extern double g_nHeiht;
|
|
static CString g_strOldText = "";
|
|
|
|
|
|
BOOL CComposingDlg::m_bContinue=TRUE;// Add by lcf on 2005-06-29
|
|
int CComposingDlg::m_nSide = 1; // sg add 081103
|
|
BOOL CComposingDlg::m_bHasCirPoint = FALSE;// add by xly on 100916
|
|
CString CComposingDlg::m_csPointSize = _T("0.8");// add by xly on 100916
|
|
|
|
IMPLEMENT_DYNAMIC(CComposingDlg, CBaseTextDlg)
|
|
CComposingDlg::CComposingDlg(CWnd* pParent /*=NULL*/)
|
|
: CBaseTextDlg(CComposingDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CComposingDlg)
|
|
// m_nSide = 1; // sg delete 081103
|
|
//}}AFX_DATA_INIT
|
|
// sg add 090324,做法标注支持多行文字
|
|
m_bNeedSingleLineText = FALSE;
|
|
}
|
|
|
|
|
|
void CComposingDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CBaseTextDlg::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CComposingDlg)
|
|
DDX_Control(pDX, IDC_INPUT_TEXT, m_editInputText);
|
|
DDX_Text(pDX, IDC_INPUT_TEXT, m_strInputText);
|
|
DDX_Radio(pDX, IDC_RADIO_UPLINE, m_nSide);
|
|
DDX_Check(pDX, IDC_CONTINUE, m_bContinue);
|
|
DDX_Check(pDX, IDC_CHK_CIRPOINTSIZE, m_bHasCirPoint);// add by xly on 100916
|
|
//DDX_Text(pDX, IDC_CMB_CIRPOINTSIZE, m_csPointSize);// add by xly on 100916
|
|
DDX_Text(pDX, IDC_CMB_CIRPOINTSIZE, m_csPointSizeTemp);// add by xly on 110314
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CComposingDlg, CBaseTextDlg)
|
|
//{{AFX_MSG_MAP(CComposingDlg)
|
|
ON_BN_CLICKED(IDC_CHK_CIRPOINTSIZE, OnHasPoint)// add by xly on 100916
|
|
ON_BN_CLICKED(IDC_BUT_ADDPOINT, OnButtonAddPoint)// add by xly on 100921
|
|
ON_CBN_KILLFOCUS(IDC_CMB_CIRPOINTSIZE, OnKillFocusPointSize)// add by xly on 101221
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CComposingDlg message handlers
|
|
|
|
|
|
BOOL CComposingDlg::OnInitDialog()
|
|
{
|
|
CBaseTextDlg::OnInitDialog();
|
|
m_editInputText.GetFocus();
|
|
if(m_strInputText == "")
|
|
m_strInputText = g_strOldText;
|
|
|
|
// add by xly on 100916 是否圆点标注
|
|
if (!m_bHasCirPoint)
|
|
{
|
|
GetDlgItem(IDC_CMB_CIRPOINTSIZE)->EnableWindow(FALSE);
|
|
|
|
}
|
|
|
|
// add by xly on 10921 做法标注对象编辑时,添加一个按钮和一个静态文本标签
|
|
GetDlgItem(IDC_STC_POINTSIZE)->ShowWindow(SW_HIDE);
|
|
if (!m_bModeless)
|
|
{
|
|
GetDlgItem(IDC_STC_POINTSIZE)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_CHK_CIRPOINTSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_CMB_CIRPOINTSIZE)->EnableWindow(TRUE);
|
|
|
|
// 对象编辑时没有没标注点的情况
|
|
if (!m_bHasPoint)
|
|
{
|
|
GetDlgItem(IDC_STC_POINTSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_CMB_CIRPOINTSIZE)->ShowWindow(SW_HIDE);
|
|
}
|
|
}
|
|
// add by xly on 110311 初始化圆点的大小
|
|
m_csPointSizeTemp = m_csPointSize;
|
|
|
|
// add by xly on 110328 增加对象编辑的圆点大小的设置
|
|
if (!m_bModeless)
|
|
{
|
|
|
|
double dSize = m_pComposing->GetCirPointSize();
|
|
m_csPointSizeTemp.Format(_T("%.1f"),dSize);
|
|
}
|
|
UpdateData(FALSE);
|
|
m_editInputText.SetSel(0, -1);
|
|
return FALSE; // return TRUE unless you set the focus to a control
|
|
}
|
|
|
|
CWnd* CComposingDlg::GetCurWnd()
|
|
{
|
|
CWnd *pWnd = GetDlgItem(IDC_INPUT_TEXT);// 把CWnd 回传给基类
|
|
return (pWnd);
|
|
}
|
|
|
|
|
|
extern void TrimTail(CString &str);
|
|
|
|
// add by xly on 101109 判断csStr中是否含有字母
|
|
bool IsAllDigital(CString csStr)
|
|
{
|
|
int nLen = csStr.GetLength(),
|
|
nTemp(0);
|
|
for (int i=0; i<nLen; i++)
|
|
{
|
|
nTemp = (int)csStr.GetAt(i);
|
|
if ((nTemp<='z' && nTemp>='a') || (nTemp<='Z' && nTemp>='A'))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void CComposingDlg::Dlg2Obj(TDbSymbComposing *pText)
|
|
{
|
|
CBaseTextDlg::Dlg2Obj(pText);
|
|
g_strOldText = m_strInputText;
|
|
pText->SetText(m_strInputText);
|
|
pText->SetSideText(m_nSide);
|
|
|
|
// add by xly on 101210 解决对象编辑时出现的对话框提示“视图执行不支持的操作”
|
|
pText->SetCirPointSize(_tstof(m_csPointSize));
|
|
}
|
|
|
|
void CComposingDlg::Obj2Dlg(TDbSymbComposing *pText)
|
|
{
|
|
CBaseTextDlg::Obj2Dlg(pText);
|
|
m_strInputText = pText->GetText();
|
|
m_nSide = pText->IsSideText();
|
|
|
|
// add by xly on 100926 对象编辑使用,存在标注点与不存在标注点对话框显示不同
|
|
m_bHasPoint = pText->HasOtherPoint();
|
|
|
|
// delete by xly on 1104 提到初始化中设置
|
|
//// add by xly on 110327 增加对象编辑的圆点大小的设置
|
|
//double dSize = pText->GetCirPointSize();
|
|
//m_csPointSizeTemp.Format(_T("%.1f"),dSize);
|
|
//m_csPointSize = m_csPointSizeTemp;
|
|
|
|
// add by xly on 101227 增加做法标注对象
|
|
m_pComposing = pText;
|
|
}
|
|
|
|
// add by xly on 100916 是否有圆点标注
|
|
void CComposingDlg::OnHasPoint()
|
|
{
|
|
UpdateData(TRUE);
|
|
GetDlgItem(IDC_CMB_CIRPOINTSIZE)->EnableWindow(m_bHasCirPoint);
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
// add by xly on 100916 设置对话框控件不可用
|
|
void CComposingDlg::SetLableEnable(BOOL bShow)
|
|
{
|
|
UpdateData(TRUE);
|
|
GetDlgItem(IDC_CHK_CIRPOINTSIZE)->EnableWindow(bShow);
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
// add by xly on 101227 编辑时增加其他标注点
|
|
extern void AddOtherPoint(TDbSymbComposing *pComposing);
|
|
|
|
// add by xly on 100921 做法标注对象编辑是添加“增加标注点<”按钮事件
|
|
void CComposingDlg::OnButtonAddPoint()
|
|
{
|
|
// 隐藏对话框,设置软件的环境可用
|
|
CWnd * pWnd = acedGetAcadFrame();
|
|
pWnd->EnableWindow(TRUE);
|
|
pWnd->SetFocus();
|
|
pWnd->SetActiveWindow();
|
|
this->ShowWindow(SW_HIDE);
|
|
|
|
// 修改实体的添加夹点
|
|
m_pComposing->upgradeOpen();
|
|
Dlg2Obj(m_pComposing);
|
|
m_pComposing->downgradeOpen();
|
|
|
|
// 增加标注点
|
|
AddOtherPoint(m_pComposing);
|
|
|
|
// 恢复对话框可见
|
|
pWnd->EnableWindow(FALSE);
|
|
this->ShowWindow(SW_SHOW);
|
|
this->EnableWindow(TRUE);
|
|
this->SetActiveWindow();
|
|
|
|
// sg add 101228,解决添加其他圆点标注点后,对话框的显示问题
|
|
if (m_pComposing->HasOtherPoint())
|
|
{
|
|
GetDlgItem(IDC_STC_POINTSIZE)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_CHK_CIRPOINTSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_CMB_CIRPOINTSIZE)->EnableWindow(TRUE);
|
|
GetDlgItem(IDC_CMB_CIRPOINTSIZE)->ShowWindow(SW_SHOW);
|
|
}
|
|
}
|
|
|
|
// add by xly on 101221 圆点大小的编辑框设置焦点
|
|
void CComposingDlg::OnKillFocusPointSize()
|
|
{
|
|
// 记录修改前的值
|
|
CString csSize = m_csPointSizeTemp;
|
|
|
|
UpdateData(TRUE);
|
|
int nPointPos(-1);
|
|
double dSize = _tstof(m_csPointSizeTemp);
|
|
nPointPos = m_csPointSizeTemp.Find(_T('.'));
|
|
if (m_csPointSizeTemp== _T("") || dSize<-1E-6 || !IsAllDigital(m_csPointSizeTemp))
|
|
{
|
|
// modify by xly on 110223 修改提示语
|
|
//MessageBox(_T("圆点大小请给出一个不小于0的数值。"));
|
|
AfxMessageBox(_T("请输入不小于0的数值。"));
|
|
m_csPointSizeTemp = m_csPointSize;
|
|
}
|
|
else if (nPointPos>-1)
|
|
{
|
|
m_csPointSizeTemp = m_csPointSizeTemp.Left(nPointPos+2);
|
|
}
|
|
m_csPointSize = m_csPointSizeTemp;
|
|
UpdateData(FALSE);
|
|
}
|