1298 lines
29 KiB
C++
1298 lines
29 KiB
C++
#include "stdafx.h"
|
|
#include "LeaderTextDlg.h"
|
|
#include "aduiBaseDialog.h"
|
|
#include "TLeaderAddOtherPtJig.h"
|
|
#include "CharDlg.h"
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
// 获得备注 cet 2011.11.30 add
|
|
BOOL GetLayerReMark(const TCHAR *szLayer, CString &sRemark)
|
|
{
|
|
sRemark.Empty();
|
|
XString fullFile;
|
|
if(FindFile(_T("LAYERDEF.DAT"), fullFile))
|
|
{
|
|
FILE *fp=fopen(_AS(fullFile), "r");
|
|
if(!fp)
|
|
return FALSE;
|
|
while(!feof(fp))
|
|
{
|
|
char sBuf[256]="";
|
|
TCHAR eName[256]=_T(""),sTemp[256]=_T("");
|
|
fgets(sBuf, 255, fp);
|
|
if(sBuf[0])
|
|
{
|
|
CT_strnth(TString(sBuf), 2, eName);
|
|
}
|
|
|
|
if (_tcscmp(eName, szLayer) == 0)
|
|
{
|
|
CT_strnth(TString(sBuf), 5, sTemp);
|
|
sRemark = sTemp;
|
|
break;
|
|
}
|
|
}
|
|
fclose(fp);
|
|
}
|
|
else
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
const int maxHisList = 10;
|
|
CString CLeaderTextDlg::m_sUpText = _T("");
|
|
CString CLeaderTextDlg::m_sDownText = _T("");
|
|
|
|
static TDbSymbMultiLeader::TArrowStyle
|
|
g_ArrowStyle[] = {TDbSymbMultiLeader::kArrow,
|
|
TDbSymbMultiLeader::kDote, TDbSymbMultiLeader::kCrossing, TDbSymbMultiLeader::kNone};
|
|
|
|
double CLeaderTextDlg::g_dFontHeight=3.5;
|
|
int CLeaderTextDlg::g_nArrowStyle = 3;
|
|
CString CLeaderTextDlg::g_sArrowSize = _T("3.0");
|
|
int CLeaderTextDlg::g_nTextAlign = 2;
|
|
CString CLeaderTextDlg::g_sFontStyle = _T("");
|
|
extern CString g_strFontStyle = _T("");
|
|
BOOL CLeaderTextDlg::g_bLeadLine = 0;
|
|
int CLeaderTextDlg::g_nSysStyle = 0;
|
|
|
|
CLeaderTextDlg::CLeaderTextDlg(CWnd* pParent /*=NULL*/)
|
|
: CModelessDialog(CLeaderTextDlg::IDD, pParent)
|
|
{
|
|
if(fabs(g_dFontHeight) < 1.0E-3)
|
|
g_dFontHeight = 3.5;
|
|
//{{AFX_DATA_INIT(CLeaderTextDlg)
|
|
//}}AFX_DATA_INIT
|
|
m_strInputText = _T("");
|
|
m_bPost = FALSE;
|
|
m_bGetText = FALSE;
|
|
m_sFontHight.Format(_T("%.1f"), g_dFontHeight);
|
|
m_sLayer = _T("");
|
|
m_sDimLayer = _T("");
|
|
m_dDist2Line = 0.2;
|
|
m_nDlgStyle = 1;
|
|
m_id = NULL;
|
|
}
|
|
|
|
double CLeaderTextDlg::GetDist2Line()
|
|
{
|
|
return m_dDist2Line;
|
|
}
|
|
|
|
void CLeaderTextDlg::SetDist2Line(const double dDist)
|
|
{
|
|
m_dDist2Line = dDist;
|
|
}
|
|
|
|
|
|
void CLeaderTextDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CModelessDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CLeaderTextDlg)
|
|
DDX_Control(pDX, IDC_COMBO_INPUTUPTEXT, m_wndCmbUpText);
|
|
DDX_Control(pDX, IDC_COMBO_INPUTDOWNTEXT, m_wndCmbDownText);
|
|
DDX_Control(pDX, IDC_COMBO_FONTSTYLE, m_wndCmbFontStyle);
|
|
DDX_Control(pDX, IDC_COMBO_SYS_STYLE, m_wndCmbSysStyle);
|
|
DDX_CBString(pDX, IDC_COMBO_FONT_HIGHT, m_sFontHight);
|
|
DDX_CBIndex(pDX, IDC_COMBO_TEXTALIGN, g_nTextAlign);
|
|
DDX_CBString(pDX, IDC_COMBO_ARROW_SIZE, g_sArrowSize);
|
|
DDX_CBIndex(pDX, IDC_COMBO_ARROW_STYLE, g_nArrowStyle);
|
|
DDX_Check(pDX, IDC_CHECK_LEADLINE, g_bLeadLine);
|
|
DDX_CBIndex(pDX, IDC_COMBO_SYS_STYLE, g_nSysStyle);
|
|
DDX_Text(pDX, IDC_EDIT_DIST, m_dDist2Line);
|
|
//}}AFX_DATA_MAP
|
|
//仿照图名标注,试着解决“对象编辑中,有时候文字显示有问题”的BUG
|
|
if (pDX->m_bSaveAndValidate)
|
|
{
|
|
DDX_CBString(pDX, IDC_COMBO_INPUTUPTEXT, m_sUpText);
|
|
DDX_CBString(pDX, IDC_COMBO_INPUTDOWNTEXT, m_sDownText);
|
|
}
|
|
else
|
|
{
|
|
GetDlgItem(IDC_COMBO_INPUTUPTEXT)->SetWindowText(m_sUpText);
|
|
GetDlgItem(IDC_COMBO_INPUTDOWNTEXT)->SetWindowText(m_sDownText);
|
|
}
|
|
|
|
if(pDX->m_bSaveAndValidate && _tstof(m_sFontHight)<1.0E-3)
|
|
pDX->Fail();
|
|
if(pDX->m_bSaveAndValidate)
|
|
DDX_CBString(pDX, IDC_COMBO_FONTSTYLE, g_sFontStyle);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CLeaderTextDlg, CModelessDialog)
|
|
//{{AFX_MSG_MAP(CLeaderTextDlg)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_FONTSTYLE, OnSelchangeComboFongstyle)
|
|
ON_COMMAND_RANGE(ID_SPECIAL_CHAR1, ID_PICKTEXT, OnChar)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_ARROW_STYLE, OnArrorStyleSet)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_SYS_STYLE, OnSysStyleSet)
|
|
ON_BN_CLICKED(IDC_BTN_LEADER, OnLeading)
|
|
ON_WM_ACTIVATE()
|
|
ON_WM_CLOSE()
|
|
//}}AFX_MSG_MAP
|
|
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
|
|
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
|
|
END_MESSAGE_MAP()
|
|
|
|
void CLeaderTextDlg::OnLeading()
|
|
{
|
|
EndDialog(1000);
|
|
}
|
|
|
|
void CLeaderTextDlg::SetTextStyle(const CString &stl)
|
|
{
|
|
g_sFontStyle = stl;
|
|
int nIndex = m_wndCmbFontStyle.FindString(0, g_sFontStyle);
|
|
m_wndCmbFontStyle.SetCurSel(nIndex);
|
|
}
|
|
|
|
BOOL CLeaderTextDlg::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;
|
|
CString strTipText;
|
|
// 支持64位
|
|
UINT nID = (UINT)pNMHDR->idFrom;
|
|
|
|
if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
|
|
pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
|
|
{
|
|
return FALSE; // 对话框控件不显示
|
|
}
|
|
|
|
if (nID != 0)
|
|
{
|
|
{
|
|
CTemporaryResourceOverride vTmp;
|
|
strTipText.LoadString(nID);
|
|
}
|
|
|
|
#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;
|
|
|
|
::SetWindowPos(pNMHDR->hwndFrom, HWND_TOP, 0, 0, 0, 0,SWP_NOACTIVATE|
|
|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER); return TRUE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
// zxl 2012.08.23 add
|
|
extern bool ReadRegData(const CString &sRegName, const CString &strKey, double &dVal);
|
|
extern bool WriteRegData(const CString &sRegName, const CString &strKey, double dVal);
|
|
//从注册表读取数据
|
|
bool ReadRegData(const CString &sRegName, const CString &strKey, CString &sVal)
|
|
{
|
|
CRegProperty regProp(GetRegLocation(), sRegName);
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
return regProp.GetValue(strKey, sVal);
|
|
}
|
|
|
|
//将数据写入注册表
|
|
bool WriteRegData(const CString &sRegName, const CString &strKey, CString sVal)
|
|
{
|
|
CRegProperty regProp(GetRegLocation(), sRegName);
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
return regProp.SetValue(strKey, sVal);
|
|
}
|
|
|
|
void CLeaderTextDlg::Dlg2Obj(TDbSymbMultiLeader *pText)
|
|
{
|
|
AcDbObjectId idTextStyle = GetTextStyleId(g_sFontStyle);
|
|
if(!idTextStyle)
|
|
return;
|
|
pText->SetTextStyleId(idTextStyle);
|
|
g_dFontHeight = _tstof(m_sFontHight);
|
|
pText->SetTextHeight(g_dFontHeight);
|
|
pText->SetText1(m_sUpText);
|
|
pText->SetText2(m_sDownText);
|
|
pText->SetArrow(g_ArrowStyle[g_nArrowStyle]);
|
|
double nSize = _tstof(g_sArrowSize);
|
|
if (nSize>1.0E-3)
|
|
pText->SetArrowSize(nSize);
|
|
|
|
SetSystemStyle();
|
|
pText->setLayer(InitLayer(m_sDimLayer));
|
|
pText->SetText2BaseRatio(m_dDist2Line);
|
|
|
|
TDbSymbMultiLeader::TSymbMLTextAlign nAlign = (TDbSymbMultiLeader::TSymbMLTextAlign)(g_nTextAlign + 1);
|
|
pText->SetTextAlign(nAlign);
|
|
}
|
|
|
|
BOOL CLeaderTextDlg::OnInitDialog()
|
|
{
|
|
CModelessDialog::OnInitDialog();
|
|
LoadHisText();
|
|
LoadTextStyle();
|
|
|
|
if (m_nDlgStyle == 1)
|
|
{
|
|
ReadRegData(_T("TWTConfig"), _T("LeaderTextStyle"), g_strFontStyle);
|
|
ReadRegData(_T("TWTConfig"), _T("LeaderTextDist2Line"), m_dDist2Line);
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
m_toolBar.Create(this);
|
|
m_toolBar.LoadToolBar(IDR_TOOLBAR_TEXT);
|
|
m_toolBar.ShowWindow(SW_SHOW);
|
|
m_toolBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY );
|
|
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
|
|
|
|
if (g_strFontStyle.IsEmpty() || m_nDlgStyle == 0)
|
|
{
|
|
m_wndCmbFontStyle.SetCurSel(m_wndCmbFontStyle.FindString(0,g_sFontStyle));
|
|
}
|
|
else //显示记忆的字型
|
|
{
|
|
int nIndex = m_wndCmbFontStyle.FindString(0,g_strFontStyle);
|
|
if (nIndex >= 0)
|
|
m_wndCmbFontStyle.SetCurSel(nIndex);
|
|
else
|
|
{
|
|
AcDbObjectId idTextStyle = GetTextStyleId(g_strFontStyle);
|
|
if(!idTextStyle)
|
|
{
|
|
idTextStyle = InitTwtTextStyle(g_strFontStyle);
|
|
|
|
g_sFontStyle = g_strFontStyle;
|
|
m_wndCmbFontStyle.AddString(g_strFontStyle);
|
|
m_wndCmbFontStyle.SetCurSel(m_wndCmbFontStyle.FindString(0,g_strFontStyle));
|
|
}
|
|
}
|
|
}
|
|
|
|
InitDlgStyle();
|
|
if (g_nArrowStyle == 3)
|
|
{
|
|
GetDlgItem(IDC_COMBO_ARROW_SIZE)->EnableWindow(FALSE);
|
|
}
|
|
|
|
OnInitSysType();
|
|
OnSysStyleSet();//获取系统类型图层
|
|
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CLeaderTextDlg::SetDlgStyle(int nStyle)
|
|
{
|
|
m_nDlgStyle = nStyle;
|
|
}
|
|
|
|
void CLeaderTextDlg::InitDlgStyle()
|
|
{
|
|
CWnd *pWnd1 = GetDlgItem(IDC_BTN_LEADER);
|
|
CWnd *pWnd2 = GetDlgItem(IDOK);
|
|
CWnd *pWnd3 = GetDlgItem(IDCANCEL);
|
|
CWnd *pWnd4 = GetDlgItem(IDC_CHECK_LEADLINE);
|
|
if (m_nDlgStyle == 0)
|
|
{
|
|
pWnd4->ShowWindow(SW_HIDE);
|
|
}
|
|
else
|
|
{
|
|
pWnd1->ShowWindow(SW_HIDE);
|
|
pWnd2->ShowWindow(SW_HIDE);
|
|
pWnd3->ShowWindow(SW_HIDE);
|
|
CRect rect;
|
|
this->GetWindowRect(&rect);
|
|
rect.bottom -= 25;
|
|
this->MoveWindow(&rect);
|
|
}
|
|
}
|
|
|
|
void CLeaderTextDlg::OnInitSysType()
|
|
{
|
|
m_wndCmbSysStyle.Clear();
|
|
|
|
m_wndCmbSysStyle.InsertString(0, _T("公共标注"));
|
|
m_wndCmbSysStyle.InsertString(1, _T("给水"));
|
|
m_wndCmbSysStyle.InsertString(2, _T("热给水"));
|
|
m_wndCmbSysStyle.InsertString(3, _T("热回水"));
|
|
m_wndCmbSysStyle.InsertString(4, _T("污水"));
|
|
m_wndCmbSysStyle.InsertString(5, _T("废水"));
|
|
m_wndCmbSysStyle.InsertString(6, _T("雨水"));
|
|
m_wndCmbSysStyle.InsertString(7, _T("中水"));
|
|
m_wndCmbSysStyle.InsertString(8, _T("消防"));
|
|
m_wndCmbSysStyle.InsertString(9, _T("喷淋"));
|
|
CString sName;
|
|
GetLayerReMark(LAY_PIPE_COAGULATE, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("凝结");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(10, sName);
|
|
GetLayerReMark(LAY_PIPE_DRINK, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("直饮");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(11, sName);
|
|
GetLayerReMark(LAY_PIPE_PRESSDIRT, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("压力污");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(12, sName);
|
|
GetLayerReMark(LAY_PIPE_PRESSUSELESS, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("压力废");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(13, sName);
|
|
GetLayerReMark(LAY_PIPE_PRESSRAIN, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("压力雨");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(14, sName);
|
|
GetLayerReMark(LAY_PIPE_USER1, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户1管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(15, sName);
|
|
GetLayerReMark(LAY_PIPE_USER2, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户2管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(16, sName);
|
|
GetLayerReMark(LAY_PIPE_USER3, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户3管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(17, sName);
|
|
GetLayerReMark(LAY_PIPE_USER4, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户4管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(18, sName);
|
|
GetLayerReMark(LAY_PIPE_USER5, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户5管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(19, sName);
|
|
GetLayerReMark(LAY_PIPE_USER6, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户6管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(20, sName);
|
|
GetLayerReMark(LAY_PIPE_USER7, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户7管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(21, sName);
|
|
GetLayerReMark(LAY_PIPE_USER8, sName);
|
|
if (sName.IsEmpty())
|
|
{
|
|
sName = _T("用户8管线");
|
|
}
|
|
m_wndCmbSysStyle.InsertString(22, sName);
|
|
m_wndCmbSysStyle.InsertString(23, _T("其他"));
|
|
|
|
m_wndCmbSysStyle.SetCurSel(g_nSysStyle);
|
|
}
|
|
|
|
void CLeaderTextDlg::SetDimLayer()
|
|
{
|
|
if (m_sDimLayer == LAY_LEADER_DIM)
|
|
{
|
|
g_nSysStyle = 0;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_FEED)
|
|
{
|
|
g_nSysStyle = 1;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_HEADFEED)
|
|
{
|
|
g_nSysStyle = 2;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_HEADBACK )
|
|
{
|
|
g_nSysStyle = 3;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_DIRT)
|
|
{
|
|
g_nSysStyle = 4;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_USELESS)
|
|
{
|
|
g_nSysStyle = 5;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_RAIN)
|
|
{
|
|
g_nSysStyle = 6;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_USED)
|
|
{
|
|
g_nSysStyle = 7;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_FIRE)
|
|
{
|
|
g_nSysStyle = 8;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_SPRINKLE)
|
|
{
|
|
g_nSysStyle = 9;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_COAGULATE)
|
|
{
|
|
g_nSysStyle = 10;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_DRINK)
|
|
{
|
|
g_nSysStyle = 11;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_PRESSDIRT)
|
|
{
|
|
g_nSysStyle = 12;
|
|
}
|
|
else if(m_sLayer == LAY_DIM_PRESSUSELESS)
|
|
{
|
|
g_nSysStyle = 13;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_PRESSRAIN)
|
|
{
|
|
g_nSysStyle = 14;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_USER1)
|
|
{
|
|
g_nSysStyle = 15;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_USER2)
|
|
{
|
|
g_nSysStyle = 16;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_USER3)
|
|
{
|
|
g_nSysStyle = 17;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_USER4)
|
|
{
|
|
g_nSysStyle = 18;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_USER5)
|
|
{
|
|
g_nSysStyle = 19;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_USER6)
|
|
{
|
|
g_nSysStyle = 20;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_USER7)
|
|
{
|
|
g_nSysStyle = 21;
|
|
}
|
|
else if (m_sDimLayer == LAY_DIM_USER8)
|
|
{
|
|
g_nSysStyle = 22;
|
|
}
|
|
else if(m_sDimLayer == LAY_DIM_OTHER)
|
|
{
|
|
g_nSysStyle = 23;
|
|
}
|
|
}
|
|
|
|
void CLeaderTextDlg::SetCmbSysStyle()
|
|
{
|
|
if (m_sLayer == LAY_LEADER_DIM)
|
|
{
|
|
g_nSysStyle = 0;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_FEED || m_sLayer == LAY_PIPE_FEED2 || m_sLayer == LAY_PIPE_FEED3)
|
|
{
|
|
g_nSysStyle = 1;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_HEADFEED || m_sLayer == LAY_PIPE_HEADFEED2 || m_sLayer == LAY_PIPE_HEADFEED3)
|
|
{
|
|
g_nSysStyle = 2;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_HEADBACK || m_sLayer == LAY_PIPE_HEADBACK2 || m_sLayer == LAY_PIPE_HEADBACK3)
|
|
{
|
|
g_nSysStyle = 3;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_DIRT)
|
|
{
|
|
g_nSysStyle = 4;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_USELESS)
|
|
{
|
|
g_nSysStyle = 5;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_RAIN)
|
|
{
|
|
g_nSysStyle = 6;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_USED || m_sLayer == LAY_PIPE_USED2 || m_sLayer == LAY_PIPE_USED3)
|
|
{
|
|
g_nSysStyle = 7;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_FIRE || m_sLayer == LAY_PIPE_FIRE2 || m_sLayer == LAY_PIPE_FIRE3)
|
|
{
|
|
g_nSysStyle = 8;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_SPRINKLE || m_sLayer == LAY_PIPE_SPRINKLE2 || m_sLayer == LAY_PIPE_SPRINKLE3)
|
|
{
|
|
g_nSysStyle = 9;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_COAGULATE)
|
|
{
|
|
g_nSysStyle = 10;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_DRINK)
|
|
{
|
|
g_nSysStyle = 11;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_PRESSDIRT)
|
|
{
|
|
g_nSysStyle = 12;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_PRESSUSELESS)
|
|
{
|
|
g_nSysStyle = 13;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_PRESSRAIN)
|
|
{
|
|
g_nSysStyle = 14;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_USER1)
|
|
{
|
|
g_nSysStyle = 15;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_USER2)
|
|
{
|
|
g_nSysStyle = 16;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_USER3)
|
|
{
|
|
g_nSysStyle = 17;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_USER4)
|
|
{
|
|
g_nSysStyle = 18;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_USER5)
|
|
{
|
|
g_nSysStyle = 19;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_USER6)
|
|
{
|
|
g_nSysStyle = 20;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_USER7)
|
|
{
|
|
g_nSysStyle = 21;
|
|
}
|
|
else if (m_sLayer == LAY_PIPE_USER8)
|
|
{
|
|
g_nSysStyle = 22;
|
|
}
|
|
else if(m_sLayer == LAY_PIPE_OTHER)
|
|
{
|
|
g_nSysStyle = 23;
|
|
}
|
|
}
|
|
|
|
void CLeaderTextDlg::SetSystemStyle()
|
|
{
|
|
if (g_nSysStyle == 0)
|
|
{
|
|
m_sDimLayer = LAY_LEADER_DIM;
|
|
}
|
|
else if (g_nSysStyle == 1)
|
|
{
|
|
m_sDimLayer = LAY_DIM_FEED;
|
|
}
|
|
else if (g_nSysStyle == 2)
|
|
{
|
|
m_sDimLayer = LAY_DIM_HEADFEED;
|
|
}
|
|
else if(g_nSysStyle == 3)
|
|
{
|
|
m_sDimLayer = LAY_DIM_HEADBACK;
|
|
}
|
|
else if(g_nSysStyle == 4)
|
|
{
|
|
m_sDimLayer = LAY_DIM_DIRT;
|
|
}
|
|
else if(g_nSysStyle == 5)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USELESS;
|
|
}
|
|
else if(g_nSysStyle == 6)
|
|
{
|
|
m_sDimLayer = LAY_DIM_RAIN;
|
|
}
|
|
else if(g_nSysStyle == 7)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USED;
|
|
}
|
|
else if(g_nSysStyle == 8)
|
|
{
|
|
m_sDimLayer = LAY_DIM_HYDRANT;
|
|
}
|
|
else if(g_nSysStyle == 9)
|
|
{
|
|
m_sDimLayer = LAY_DIM_SPRINKLE;
|
|
}
|
|
else if(g_nSysStyle == 10)
|
|
{
|
|
m_sDimLayer = LAY_DIM_COAGULATE;
|
|
}
|
|
else if(g_nSysStyle == 11)
|
|
{
|
|
m_sDimLayer = LAY_DIM_DRINK;
|
|
}
|
|
else if(g_nSysStyle == 12)
|
|
{
|
|
m_sDimLayer = LAY_DIM_PRESSDIRT;
|
|
}
|
|
else if(g_nSysStyle == 13)
|
|
{
|
|
m_sDimLayer = LAY_DIM_PRESSUSELESS;
|
|
}
|
|
else if(g_nSysStyle == 14)
|
|
{
|
|
m_sDimLayer = LAY_DIM_PRESSRAIN;
|
|
}
|
|
else if(g_nSysStyle == 15)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER1;
|
|
}
|
|
else if(g_nSysStyle == 16)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER2;
|
|
}
|
|
else if (g_nSysStyle == 17)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER3;
|
|
}
|
|
else if (g_nSysStyle == 18)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER4;
|
|
}
|
|
else if (g_nSysStyle == 19)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER5;
|
|
}
|
|
else if (g_nSysStyle == 20)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER6;
|
|
}
|
|
else if (g_nSysStyle == 21)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER7;
|
|
}
|
|
else if (g_nSysStyle == 22)
|
|
{
|
|
m_sDimLayer = LAY_DIM_USER8;
|
|
}
|
|
else if(g_nSysStyle == 23)
|
|
{
|
|
m_sDimLayer = LAY_DIM_OTHER;
|
|
}
|
|
}
|
|
|
|
void CLeaderTextDlg::OnSysStyleSet()
|
|
{
|
|
UpdateData(TRUE);
|
|
SetSystemStyle();
|
|
}
|
|
|
|
void CLeaderTextDlg::OnSelchangeComboFongstyle()
|
|
{
|
|
UpdateData(TRUE);
|
|
|
|
if(m_wndCmbFontStyle.GetCurSel() >= 0)
|
|
m_wndCmbFontStyle.GetLBText(m_wndCmbFontStyle.GetCurSel(),g_sFontStyle);
|
|
AcDbObjectId idTextStyle = GetTextStyleId(g_sFontStyle);
|
|
if(!idTextStyle)
|
|
return;
|
|
|
|
OPENOBJ_BEGIN(idTextStyle, AcDb::kForRead, AcDbTextStyleTableRecord, pStyle);
|
|
ASSERT(pStyle);
|
|
|
|
CString strTemp;
|
|
strTemp.Format(_T("%.1f"), pStyle->textSize()); //读文字风格的字高:double->string
|
|
if(_tstof(strTemp)>1.0E-3)
|
|
m_sFontHight = strTemp;
|
|
else
|
|
m_sFontHight.Format(_T("%.1f"), g_dFontHeight);
|
|
|
|
OPENOBJ_END();
|
|
|
|
UpdateData(FALSE);
|
|
|
|
m_wndCmbFontStyle.SetCurSel(m_wndCmbFontStyle.FindStringExact(0, g_sFontStyle));
|
|
|
|
g_strFontStyle = g_sFontStyle;//记忆字型
|
|
}
|
|
|
|
void CLeaderTextDlg::LoadTextStyle()
|
|
{
|
|
XSymbolList lstStyle(_T("STYLE"));
|
|
|
|
for (int m = 0; m < lstStyle.Length(); m++)
|
|
m_wndCmbFontStyle.AddString(lstStyle[m]);
|
|
}
|
|
|
|
CWnd* CLeaderTextDlg::GetCurWnd()
|
|
{
|
|
UpdateData(TRUE);
|
|
CWnd *pWnd = this->GetFocus();
|
|
CWnd *pWnd2 = NULL;
|
|
|
|
if (m_wndCmbUpText.m_hWnd == pWnd->GetParent()->m_hWnd)
|
|
{
|
|
pWnd2 = GetDlgItem(IDC_COMBO_INPUTUPTEXT);
|
|
m_strInputText = m_sUpText;
|
|
|
|
}
|
|
else if(m_wndCmbDownText.m_hWnd == pWnd->GetParent()->m_hWnd)
|
|
{
|
|
pWnd2 = GetDlgItem(IDC_COMBO_INPUTDOWNTEXT);
|
|
m_strInputText = m_sDownText;
|
|
}
|
|
else
|
|
{
|
|
int nSel = m_wndCmbUpText.GetWindowTextLength();
|
|
m_wndCmbUpText.SetEditSel(nSel, nSel);
|
|
pWnd2 = GetDlgItem(IDC_COMBO_INPUTUPTEXT);
|
|
}
|
|
return(pWnd2);
|
|
}
|
|
|
|
BOOL CLeaderTextDlg::GetPosition(int& h, int& l)
|
|
{
|
|
DWORD n;
|
|
CComboBox *pComboBox = NULL;
|
|
CEdit *pEdit = NULL;
|
|
CWnd *pWnd1 = this->GetFocus();
|
|
if(m_pCurWnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
|
|
{
|
|
pComboBox = (CComboBox*)m_pCurWnd;
|
|
if(pComboBox->m_hWnd != pWnd1->GetParent()->m_hWnd)
|
|
{
|
|
int nSel = pComboBox->GetWindowTextLength();
|
|
pComboBox->SetEditSel(nSel, nSel);
|
|
}
|
|
n = pComboBox->GetEditSel();
|
|
}
|
|
else if(m_pCurWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
|
|
{
|
|
pEdit = (CEdit*)m_pCurWnd;
|
|
if(pEdit->m_hWnd != pWnd1->m_hWnd)
|
|
{
|
|
int nBegin = pEdit->LineIndex( pEdit->GetLineCount()-1 );
|
|
int nEnd = nBegin + pEdit->LineLength(nBegin);
|
|
pEdit->SetSel(nEnd, nEnd);
|
|
}
|
|
n = pEdit->GetSel();
|
|
}
|
|
else
|
|
return FALSE;
|
|
|
|
l = (int)LOWORD(n);
|
|
h = (int)HIWORD(n);
|
|
|
|
#if (ADS>15)
|
|
if(!FindRT_MANIFEST())
|
|
return TRUE;
|
|
|
|
OSVERSIONINFO osVer;
|
|
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
|
VERIFY(GetVersionEx(&osVer) == TRUE);
|
|
if(osVer.dwPlatformId == VER_PLATFORM_WIN32_NT && osVer.dwMajorVersion >= 5 && osVer.dwMinorVersion >= 1)
|
|
{
|
|
CString csText;
|
|
m_pCurWnd->GetWindowText(csText);
|
|
XString xsText;
|
|
xsText = csText;
|
|
|
|
int nCount = (int)_tcslen(xsText);
|
|
int iLow = l, iUp = h;
|
|
for(int idx = 0; idx < nCount; idx++) {
|
|
if(idx >= iUp)
|
|
break;
|
|
TCHAR c = xsText[idx];
|
|
if(c < 0) { //汉字
|
|
if(idx < iLow)
|
|
iLow++;
|
|
if(idx < iUp)
|
|
iUp++;
|
|
idx++;
|
|
}
|
|
}
|
|
l = iLow;
|
|
h = iUp;
|
|
}
|
|
#endif
|
|
return TRUE;
|
|
}
|
|
|
|
void CLeaderTextDlg::UpdateInputText()
|
|
{
|
|
CWnd *pWnd = this->GetFocus();
|
|
if (m_wndCmbUpText.m_hWnd == pWnd->GetParent()->m_hWnd)
|
|
{
|
|
m_sUpText = m_strInputText;
|
|
}
|
|
if (m_wndCmbDownText.m_hWnd == pWnd->GetParent()->m_hWnd)
|
|
{
|
|
m_sDownText = m_strInputText;
|
|
}
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CLeaderTextDlg::OnChar(UINT nID)
|
|
{
|
|
UpdateData(TRUE);
|
|
|
|
m_pCurWnd = GetCurWnd();
|
|
|
|
if(!m_pCurWnd)
|
|
{
|
|
AfxMessageBox(_T("只能在指定控件中输入特殊字符!"));
|
|
return;
|
|
}
|
|
|
|
int h, l;
|
|
if(!GetPosition(h, l))
|
|
return;
|
|
|
|
int i = 0;
|
|
switch (nID)
|
|
{
|
|
case ID_DOWN_MARK:
|
|
if(h == l)
|
|
{
|
|
AfxMessageBox(_T("请先在文字框中选择字符!"));
|
|
return;
|
|
}
|
|
m_strInputText.Insert(l, _T("^L"));
|
|
m_strInputText.Insert(h + 2, _T("^L"));
|
|
i = h + 4;
|
|
break;
|
|
case ID_UP_MARK:
|
|
if(h == l)
|
|
{
|
|
AfxMessageBox(_T("请先在文字框中选择字符!"));
|
|
return;
|
|
}
|
|
m_strInputText.Insert(l,_T("^U"));
|
|
m_strInputText.Insert(h + 2, _T("^U"));
|
|
i = h + 4;
|
|
break;
|
|
case ID_CIRCLE:
|
|
if(h == l)
|
|
{
|
|
AfxMessageBox(_T("请先在文字框中选择字符!"));
|
|
return;
|
|
}
|
|
m_strInputText.Insert(l,_T("^C"));
|
|
m_strInputText.Insert(h + 2, _T("^C"));
|
|
i = h + 4;
|
|
break;
|
|
case ID_ANGLE_CHAR:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l, _T("%%d"));
|
|
i = l + 3;
|
|
break;
|
|
case ID_DIA_CHAR:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l, _T("%%c"));
|
|
i = l + 3;
|
|
break;
|
|
case ID_TOLERANCE_CHAR:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l, _T("%%p"));
|
|
i = l + 3;
|
|
break;
|
|
case ID_PERCENT_CHAR:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l,_T("%%%"));
|
|
i = l + 3;
|
|
break;
|
|
case ID_ONE_STEEL:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l,_T("^1"));
|
|
i = l + 2;
|
|
break;
|
|
case ID_TWO_STEEL:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l, _T("^2"));
|
|
i = l + 2;
|
|
break;
|
|
case ID_THREE_STEEL:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l, _T("^3"));
|
|
i = l + 2;
|
|
break;
|
|
case ID_FOUR_STEEL:
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l, _T("^4"));
|
|
i = l + 2;
|
|
break;
|
|
case ID_SPECIAL_CHAR1:
|
|
{
|
|
XPushAutoHide nAutoHide(this);
|
|
|
|
CCharDlg dlg(this);
|
|
CString str;
|
|
CTemporaryResourceOverride vTemp;
|
|
if(dlg.DoModal() != IDOK || dlg.m_character == _T(""))
|
|
return;
|
|
str = dlg.m_character;
|
|
m_strInputText.Delete(l, h - l);
|
|
m_strInputText.Insert(l, str);
|
|
i=l+str.GetLength();
|
|
}
|
|
break;
|
|
case ID_WORD1://词库
|
|
{
|
|
XPushAutoHide nAutoHide(this);
|
|
|
|
CInsTextDlg dlg(this);
|
|
dlg.SetPreText(m_strInputText);
|
|
dlg.SetSingleText(TRUE);
|
|
if(dlg.DoModal()!=IDOK||dlg.GetEditText()==_T(""))
|
|
return;
|
|
m_strInputText.Delete(l,h-l);
|
|
m_strInputText.Insert(l,dlg.GetEditText());
|
|
i=l+dlg.GetEditText().GetLength();
|
|
}
|
|
break;
|
|
case ID_PICKTEXT:
|
|
{
|
|
m_bGetText = TRUE;
|
|
if(m_bPost)
|
|
{
|
|
PostCommand(_T("` "),false);
|
|
}
|
|
else
|
|
{
|
|
GetPickText();
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
}
|
|
return;
|
|
}
|
|
|
|
UpdateInputText();
|
|
|
|
CComboBox *pComboBox = NULL;
|
|
CEdit *pEdit = NULL;
|
|
|
|
if(m_pCurWnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
|
|
{
|
|
pComboBox = (CComboBox*)m_pCurWnd;
|
|
int index = pComboBox->FindStringExact(0, m_strInputText);
|
|
if(index < 0)
|
|
pComboBox->InsertString(0, m_strInputText);
|
|
pComboBox->SelectString(0, m_strInputText);
|
|
pComboBox->SetEditSel(i, i);
|
|
}// 以上四行目的为了防止COMBOBOX在已有列表选择一个最匹配的,所加m_strInputText只是临时的。
|
|
if(m_pCurWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
|
|
{
|
|
pEdit = (CEdit*)m_pCurWnd;
|
|
pEdit->SetSel(i, i);
|
|
}
|
|
UpdateData(FALSE);
|
|
if(pEdit)
|
|
pEdit->SetSel(i, i);
|
|
else
|
|
pComboBox->SetEditSel(i, i);
|
|
}
|
|
|
|
BOOL CLeaderTextDlg::GetPickText()
|
|
{
|
|
XPushAutoHide noAutoHide(this);
|
|
|
|
int h, l;
|
|
if(!GetPosition(h, l))
|
|
return FALSE;
|
|
int i = 0;
|
|
|
|
BeginEditorCommand();
|
|
Entity ent;
|
|
RBList mask(RTDXF0,_T("TCH_*,TEXT"),NULL);
|
|
XPoint pt;
|
|
if(SelectEntity(_T("\n屏幕拾取文字内容:"),ent,pt,mask) != RTNORM)
|
|
{
|
|
CompleteEditorCommand();
|
|
return FALSE;
|
|
}
|
|
PickSet ss(SS_FREE);
|
|
ss += ent;
|
|
TSubText* pSubText = HitTestOnText(ss,Ucs2Wcs(pt));
|
|
if(pSubText != NULL)
|
|
{
|
|
CString sText=pSubText->GetText();
|
|
delete pSubText;
|
|
m_strInputText.Delete(l,h - l);
|
|
m_strInputText.Insert(l,sText);
|
|
i = l + sText.GetLength();
|
|
}
|
|
CompleteEditorCommand();
|
|
|
|
UpdateInputText();
|
|
|
|
CComboBox *pComboBox = NULL;
|
|
CEdit *pEdit = NULL;
|
|
|
|
if(m_pCurWnd->IsKindOf(RUNTIME_CLASS(CComboBox))) {
|
|
pComboBox = (CComboBox*)m_pCurWnd;
|
|
int index = pComboBox->FindStringExact(0, m_strInputText);
|
|
if(index < 0)
|
|
pComboBox->InsertString(0, m_strInputText);
|
|
pComboBox->SelectString(0, m_strInputText);
|
|
pComboBox->SetEditSel(i, i);
|
|
}// 以上四行目的为了防止COMBOBOX在已有列表选择一个最匹配的,所加m_strInputText只是临时的。
|
|
if(m_pCurWnd->IsKindOf(RUNTIME_CLASS(CEdit))) {
|
|
pEdit = (CEdit*)m_pCurWnd;
|
|
pEdit->SetSel(i, i);
|
|
}
|
|
UpdateData(FALSE);
|
|
if(pEdit)
|
|
pEdit->SetSel(i, i);
|
|
else
|
|
pComboBox->SetEditSel(i, i);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLeaderTextDlg::DestroyWindow()
|
|
{
|
|
return CModelessDialog::DestroyWindow();
|
|
}
|
|
|
|
void CLeaderTextDlg::DlgToObj(TDbSymbMultiLeader *pText)
|
|
{
|
|
AcDbObjectId idTextStyle = GetTextStyleId(g_sFontStyle);
|
|
if(!idTextStyle)
|
|
return;
|
|
pText->SetTextStyleId(idTextStyle);
|
|
g_dFontHeight = _tstof(m_sFontHight);
|
|
pText->SetTextHeight(g_dFontHeight);
|
|
pText->SetText1(m_sUpText);
|
|
pText->SetText2(m_sDownText);
|
|
pText->SetArrow(g_ArrowStyle[g_nArrowStyle]);
|
|
double nSize = _tstof(g_sArrowSize);
|
|
if (nSize>1.0E-3)
|
|
pText->SetArrowSize(nSize);
|
|
|
|
//增加文字相对于基线的对齐方式
|
|
TDbSymbMultiLeader::TSymbMLTextAlign nAlign = (TDbSymbMultiLeader::TSymbMLTextAlign)(g_nTextAlign + 1);
|
|
pText->SetTextAlign(nAlign);
|
|
}
|
|
|
|
void CLeaderTextDlg::SetTextAlign(TDbSymbMultiLeader::TSymbMLTextAlign ag)
|
|
{
|
|
if (ag == TDbSymbMultiLeader::TSymbMLTextAlign::kAtStart)
|
|
{
|
|
g_nTextAlign = 0;
|
|
}
|
|
else if (ag == TDbSymbMultiLeader::TSymbMLTextAlign::kAtMiddle)
|
|
{
|
|
g_nTextAlign = 1;
|
|
}
|
|
else if (ag == TDbSymbMultiLeader::TSymbMLTextAlign::kAtEnd)
|
|
{
|
|
g_nTextAlign = 2;
|
|
}
|
|
}
|
|
|
|
void CLeaderTextDlg::SetArrowStyle(TDbSymbMultiLeader::TArrowStyle stl)
|
|
{
|
|
if (stl == TDbSymbMultiLeader::TArrowStyle::kArrow)
|
|
{
|
|
g_nArrowStyle = 0;
|
|
}
|
|
else if (stl == TDbSymbMultiLeader::TArrowStyle::kDote)
|
|
{
|
|
g_nArrowStyle = 1;
|
|
}
|
|
else if (stl == TDbSymbMultiLeader::TArrowStyle::kCrossing)
|
|
{
|
|
g_nArrowStyle = 2;
|
|
}
|
|
else if (stl == TDbSymbMultiLeader::TArrowStyle::kNone)
|
|
{
|
|
g_nArrowStyle = 3;
|
|
}
|
|
}
|
|
|
|
void CLeaderTextDlg::OnArrorStyleSet()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (g_nArrowStyle == 3)
|
|
{
|
|
GetDlgItem(IDC_COMBO_ARROW_SIZE)->EnableWindow(FALSE);
|
|
}
|
|
else
|
|
{
|
|
GetDlgItem(IDC_COMBO_ARROW_SIZE)->EnableWindow(TRUE);
|
|
}
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
|
|
void CLeaderTextDlg::AddToRecent()
|
|
{
|
|
UpdateData(TRUE);
|
|
int len = m_lstHistory.Length();
|
|
TCHAR strTmpPath[256] = _T("");
|
|
GetTempPath(255, strTmpPath);
|
|
_tcscat(strTmpPath, _T("leader.his"));
|
|
|
|
std::ofstream out(strTmpPath);
|
|
|
|
if (m_sUpText != _T(""))
|
|
{
|
|
out << (const char *)_AS(m_sUpText) <<"\n";
|
|
int index = m_lstHistory.Index(m_sUpText);
|
|
if (index >= 0)
|
|
{
|
|
m_lstHistory.Remove(index);
|
|
len --;
|
|
}
|
|
if (len > maxHisList-1)
|
|
len = maxHisList - 1;
|
|
}
|
|
for (int i=0; i < len; i++)
|
|
out << _AS(m_lstHistory[i]) << "\n";
|
|
|
|
len = m_lstHistory1.Length();
|
|
TCHAR strTmpPath1[256] = _T("");
|
|
GetTempPath(255, strTmpPath1);
|
|
_tcscat(strTmpPath1, _T("leader1.his"));
|
|
|
|
std::ofstream out1(strTmpPath1);
|
|
|
|
if (m_sDownText != _T(""))
|
|
{
|
|
out1 << (const char *)_AS(m_sDownText) << "\n";
|
|
int index = m_lstHistory1.Index(m_sDownText);
|
|
if (index >= 0)
|
|
{
|
|
m_lstHistory1.Remove(index);
|
|
len --;
|
|
}
|
|
if (len > maxHisList-1)
|
|
len = maxHisList - 1;
|
|
}
|
|
|
|
for (i=0; i < len; i++)
|
|
out1 << _AS(m_lstHistory1[i]) << "\n";
|
|
|
|
m_lstHistory.Reset();
|
|
m_lstHistory1.Reset();
|
|
m_wndCmbUpText.ResetContent();
|
|
m_wndCmbDownText.ResetContent();
|
|
LoadHisText();
|
|
}
|
|
|
|
void CLeaderTextDlg::LoadHisText()
|
|
{
|
|
TCHAR strTmpPath[256] = _T("");
|
|
GetTempPath(255, strTmpPath);
|
|
_tcscat(strTmpPath, _T("leader.his"));
|
|
|
|
std::ifstream in(strTmpPath);
|
|
|
|
while(!(!in))
|
|
{
|
|
char line[256];
|
|
in.getline(line, 255);
|
|
if (!in)
|
|
break;
|
|
m_lstHistory.Append(tstrnew(TString(line)));
|
|
}
|
|
|
|
for (int m =0; m < m_lstHistory.Length(); m++)
|
|
m_wndCmbUpText.AddString(m_lstHistory[m]);
|
|
|
|
TCHAR strTmpPath1[256] = _T("");
|
|
GetTempPath(255, strTmpPath1);
|
|
_tcscat(strTmpPath1, _T("leader1.his"));
|
|
|
|
std::ifstream in1(strTmpPath1);
|
|
|
|
while(!(!in1))
|
|
{
|
|
char line[256];
|
|
in1.getline(line, 255);
|
|
if(!in1)
|
|
break;
|
|
m_lstHistory1.Append(tstrnew(TString(line)));
|
|
}
|
|
|
|
for (m =0; m < m_lstHistory1.Length(); m++)
|
|
m_wndCmbDownText.AddString(m_lstHistory1[m]);
|
|
UpdateData(false);
|
|
}
|
|
|
|
void CLeaderTextDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
|
|
{
|
|
CModelessDialog::OnActivate(nState, pWndOther, bMinimized);
|
|
|
|
if(nState == WA_INACTIVE)
|
|
{
|
|
UpdateData(TRUE);
|
|
if (m_bPost)
|
|
{
|
|
PostCommand(_T("` "),false);
|
|
}
|
|
}
|
|
}
|
|
|
|
void CLeaderTextDlg::OnClose()
|
|
{
|
|
if(m_bModeless)
|
|
{
|
|
m_bPost = FALSE;
|
|
PostCommand(_T(" "), false);
|
|
}
|
|
CModelessDialog::OnClose();
|
|
}
|