102 lines
2.8 KiB
C++
102 lines
2.8 KiB
C++
// GJKReplaceOption.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "GJKReplaceOption.h"
|
|
#include "GJKWorkspace.h"
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGJKReplaceOption dialog
|
|
|
|
|
|
CGJKReplaceOption::CGJKReplaceOption(CWnd* pParent /*=NULL*/)
|
|
: CModelessDialog(CGJKReplaceOption::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CGJKReplaceOption)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_bModify = FALSE;
|
|
}
|
|
|
|
|
|
void CGJKReplaceOption::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CGJKReplaceOption)
|
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CGJKReplaceOption, CModelessDialog)
|
|
//{{AFX_MSG_MAP(CGJKReplaceOption)
|
|
ON_BN_CLICKED(IDC_PIC_GJK_SLIDE, OnSlide)
|
|
ON_WM_PAINT()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGJKReplaceOption message handlers
|
|
void CGJKReplaceOption::DrawSld()
|
|
{
|
|
CWnd *pImageBox=GetDlgItem(IDC_PIC_GJK_SLIDE);
|
|
if(pImageBox)
|
|
{
|
|
CDC *pDC=pImageBox->GetDC();
|
|
COLORREF dwBackImage=GetAcadBackColor();
|
|
CRect rc;
|
|
pImageBox->GetClientRect(&rc);
|
|
m_slideDc.InitDC(pDC, rc, dwBackImage);
|
|
m_slideDc.PaintSlide(m_sSldFile);
|
|
m_slideDc.SetDC(NULL);
|
|
pImageBox->ReleaseDC(pDC);
|
|
}
|
|
}
|
|
void CGJKReplaceOption::OnSlide()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
XString xsRoot, xsKey;
|
|
CString csSysPath;
|
|
xsKey = _T("GJKMAN");
|
|
_tcscat(xsRoot, GetRegLocation());
|
|
CRegProperty regProp(xsRoot, xsKey);
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
regProp.GetValue(_T("GJKName"), csSysPath);
|
|
CTemporaryResourceOverride vTemp;
|
|
XString xsTKFile, xsDefaultItem;
|
|
SplitSlbName(m_sSldFile, xsTKFile, xsDefaultItem);
|
|
xsTKFile = XString(_T("%s.tk"), (const TCHAR *)xsTKFile);
|
|
|
|
CGJKWorkspace dlg((const TCHAR *)csSysPath, (const TCHAR *)xsTKFile, (const TCHAR *)xsDefaultItem, 1);
|
|
if(dlg.DoModal()==IDOK)
|
|
{
|
|
m_bModify = TRUE;
|
|
TCHAR szDrive[_MAX_DRIVE]=_T(""), szDir[_MAX_DIR]=_T(""), szFile[_MAX_FNAME]=_T(""), szExt[_MAX_EXT]=_T("");
|
|
_tsplitpath(dlg.m_csLastTKName, szDrive, szDir, szFile, szExt);
|
|
m_sSldFile = XString(_T("%s%s%s"), szDrive, szDir, (const TCHAR *)dlg.m_csRet);
|
|
SplitSlbName(m_sSldFile, xsTKFile, xsDefaultItem);
|
|
AcDbDatabase *dwg = acdbCurDwg();
|
|
AcAxDocLock docLock(dwg);
|
|
VERIFY(docLock.lockStatus() == Acad::eOk);
|
|
DrawSld();
|
|
m_sTKName = xsTKFile;
|
|
m_sDrawing = xsDefaultItem;
|
|
return;
|
|
}
|
|
}
|
|
|
|
void CGJKReplaceOption::OnPaint()
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
|
|
// TODO: Add your message handler code here
|
|
DrawSld();
|
|
// Do not call CDialog::OnPaint() for painting messages
|
|
}
|