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

179 lines
3.3 KiB
C++

#include "stdafx.h"
#include "globalfunc.h"
#include "TImageDrawDC.h"
#include "PipeDownDimEditDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CPipeDownDimEditDlg::CPipeDownDimEditDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPipeDownDimEditDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPipeDownDimEditDlg)
//}}AFX_DATA_INIT
m_nLastSel = eNone;
}
void CPipeDownDimEditDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPipeDownDimEditDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPipeDownDimEditDlg, CDialog)
//{{AFX_MSG_MAP(CPipeDownDimEditDlg)
ON_BN_CLICKED(IDC_STC_TYPE0, OnStcType0)
ON_BN_CLICKED(IDC_STC_TYPE1, OnStcType1)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_STC_TYPE2, OnStcType2)
ON_BN_CLICKED(IDC_STC_TYPE3, OnStcType3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CPipeDownDimEditDlg::ShowAllPics()
{
SetShowPic(IDC_STC_TYPE0, _T("TWT(WELLDIM2)"));
SetShowPic(IDC_STC_TYPE1, _T("TWT(WELLDIM6)"));
SetShowPic(IDC_STC_TYPE2, _T("TWT(WELLDIM8)"));
SetShowPic(IDC_STC_TYPE3, _T("TWT(WELLDIM9)")); // cet 2011.6.16 add
ChangePicBK(m_nLastSel,TRUE);
}
void CPipeDownDimEditDlg::SetShowPic(int nID, const CString &strPicName)
{
if (!strPicName.IsEmpty())
{
CWnd* pWnd = NULL;
pWnd = GetDlgItem(nID);
if (pWnd != NULL)
{
GlobalFunc::DrawSlide(strPicName, pWnd);
}
}
}
void CPipeDownDimEditDlg::ChangePicBK(int nCurSel, BOOL bIsSel)
{
if (nCurSel == -1)
{
return;
}
switch(nCurSel)
{
case 1:
{
SetPicShowType(IDC_STC_TYPE0, _T("TWT(WELLDIM2)"), bIsSel);
break;
}
case 5:
{
SetPicShowType(IDC_STC_TYPE1, _T("TWT(WELLDIM6)"), bIsSel);
break;
}
case 7: // cet 2011.3.16 add
{
SetPicShowType(IDC_STC_TYPE2, _T("TWT(WELLDIM8)"), bIsSel);
break;
}
case 8: // cet 2011.6.16 add
{
SetPicShowType(IDC_STC_TYPE3, _T("TWT(WELLDIM9)"), bIsSel);
break;
}
}
}
void CPipeDownDimEditDlg::SetPicShowType(int nID, const CString &strPicName, BOOL bIsSel)
{
CWnd* pImageBox = GetDlgItem(nID);
if (pImageBox != NULL)
{
CDC* pDC = pImageBox->GetDC();
CRect rc;
pImageBox->GetClientRect(&rc);
TImageDrawDC* pImageDC = new TImageDrawDC;
if (bIsSel)
{
pImageDC->InitDC(pDC, rc, RGB(255, 255, 255));
}
else
{
pImageDC->InitDC(pDC, rc, GlobalFunc::GetAcadBackColor());
}
pImageDC->PaintSlide(strPicName);
pImageDC->SetDC(pDC);
pImageBox->ReleaseDC(pDC);
// cet 2010.5.13 add
delete pImageDC;
pImageDC = NULL;
}
}
int CPipeDownDimEditDlg::GetDimType()
{
return m_nLastSel;
}
void CPipeDownDimEditDlg::SetDimType(int nDimType)
{
m_nLastSel = nDimType;
}
void CPipeDownDimEditDlg::OnStcType0()
{
if (m_nLastSel != eType0)
{
ChangePicBK(m_nLastSel, FALSE);
m_nLastSel = eType0;
}
ChangePicBK(m_nLastSel, TRUE);
}
void CPipeDownDimEditDlg::OnStcType1()
{
if (m_nLastSel != eType1)
{
ChangePicBK(m_nLastSel, FALSE);
m_nLastSel = eType1;
}
ChangePicBK(m_nLastSel, TRUE);
}
void CPipeDownDimEditDlg::OnStcType2()
{
if (m_nLastSel != eType2)
{
ChangePicBK(m_nLastSel, FALSE);
m_nLastSel = eType2;
}
ChangePicBK(m_nLastSel, TRUE);
}
void CPipeDownDimEditDlg::OnStcType3()
{
if (m_nLastSel != eType3)
{
ChangePicBK(m_nLastSel, FALSE);
m_nLastSel = eType3;
}
ChangePicBK(m_nLastSel, TRUE);
}
void CPipeDownDimEditDlg::OnPaint()
{
CPaintDC dc(this);
ShowAllPics();
}