149 lines
3.4 KiB
C++
149 lines
3.4 KiB
C++
|
|
// PreviewPaneView.cpp : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#include "stdafx.h"
|
|||
|
|
#include "EtEffect2Tool.h"
|
|||
|
|
#include "PreviewPaneView.h"
|
|||
|
|
|
|||
|
|
|
|||
|
|
// CPreviewPaneView
|
|||
|
|
|
|||
|
|
IMPLEMENT_DYNCREATE(CPreviewPaneView, CFormView)
|
|||
|
|
|
|||
|
|
CPreviewPaneView::CPreviewPaneView()
|
|||
|
|
: CFormView(CPreviewPaneView::IDD)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CPreviewPaneView::~CPreviewPaneView()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPreviewPaneView::DoDataExchange(CDataExchange* pDX)
|
|||
|
|
{
|
|||
|
|
CFormView::DoDataExchange(pDX);
|
|||
|
|
DDX_Control(pDX, IDC_LIST1, m_ctrlListBox);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BEGIN_MESSAGE_MAP(CPreviewPaneView, CFormView)
|
|||
|
|
ON_WM_SIZE()
|
|||
|
|
ON_WM_DROPFILES()
|
|||
|
|
ON_BN_CLICKED(IDC_BUTTON1, &CPreviewPaneView::OnBnClickedButton1)
|
|||
|
|
ON_LBN_SELCHANGE(IDC_LIST1, &CPreviewPaneView::OnLbnSelchangeList1)
|
|||
|
|
END_MESSAGE_MAP()
|
|||
|
|
|
|||
|
|
|
|||
|
|
// CPreviewPaneView <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
|
|||
|
|
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
void CPreviewPaneView::AssertValid() const
|
|||
|
|
{
|
|||
|
|
CFormView::AssertValid();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#ifndef _WIN32_WCE
|
|||
|
|
void CPreviewPaneView::Dump(CDumpContext& dc) const
|
|||
|
|
{
|
|||
|
|
CFormView::Dump(dc);
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
#endif //_DEBUG
|
|||
|
|
|
|||
|
|
|
|||
|
|
// CPreviewPaneView <20><EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
|
|||
|
|
|
|||
|
|
void CPreviewPaneView::OnSize(UINT nType, int cx, int cy)
|
|||
|
|
{
|
|||
|
|
CFormView::OnSize(nType, cx, cy);
|
|||
|
|
|
|||
|
|
// TODO: <20><><EFBFBD> <20><EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
|
|||
|
|
|
|||
|
|
if( m_ctrlListBox )
|
|||
|
|
{
|
|||
|
|
CRect rcRect;
|
|||
|
|
GetClientRect( &rcRect );
|
|||
|
|
rcRect.left += 10;
|
|||
|
|
rcRect.right -= 10;
|
|||
|
|
rcRect.top += 30;
|
|||
|
|
rcRect.bottom -= 10;
|
|||
|
|
m_ctrlListBox.MoveWindow( &rcRect );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPreviewPaneView::OnDropFiles(HDROP hDropInfo)
|
|||
|
|
{
|
|||
|
|
// TODO: <20><><EFBFBD> <20><EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD> <20><>/<2F>Ǵ<EFBFBD> <20>⺻<EFBFBD><E2BABB><EFBFBD><EFBFBD> ȣ<><C8A3><EFBFBD>մϴ<D5B4>.
|
|||
|
|
|
|||
|
|
SetActiveWindow(); // activate us first !
|
|||
|
|
UINT nFiles = DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
|
|||
|
|
|
|||
|
|
CWinApp* pApp = AfxGetApp();
|
|||
|
|
ASSERT(pApp != NULL);
|
|||
|
|
TCHAR szFileName[_MAX_PATH];
|
|||
|
|
char szFullFileName[256];
|
|||
|
|
for (UINT iFile = 0; iFile < nFiles; iFile++)
|
|||
|
|
{
|
|||
|
|
DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
|
|||
|
|
|
|||
|
|
CString strFileName = szFileName;
|
|||
|
|
int nLength = strFileName.GetLength();
|
|||
|
|
|
|||
|
|
if( nLength > 3 )
|
|||
|
|
{
|
|||
|
|
bool bEffFile = false;
|
|||
|
|
if( strFileName[nLength-3] == 'e' && strFileName[nLength-2] == 'f' && strFileName[nLength-1] == 'f' ) bEffFile = true;
|
|||
|
|
|
|||
|
|
if( bEffFile )
|
|||
|
|
{
|
|||
|
|
_GetFullFileName( szFullFileName, _countof(szFullFileName), szFileName );
|
|||
|
|
|
|||
|
|
int nEffectDataIndex = -1;
|
|||
|
|
std::map< std::string, int >::iterator iter;
|
|||
|
|
iter = m_mapEffectData.find( szFullFileName );
|
|||
|
|
if( iter == m_mapEffectData.end() )
|
|||
|
|
{
|
|||
|
|
nEffectDataIndex = EternityEngine::LoadEffectData( szFileName );
|
|||
|
|
m_mapEffectData.insert( std::make_pair( szFullFileName, nEffectDataIndex ) );
|
|||
|
|
m_ctrlListBox.AddString( szFullFileName );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox( "eff<EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20>ε<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_OK );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
DragFinish(hDropInfo);
|
|||
|
|
|
|||
|
|
CFormView::OnDropFiles(hDropInfo);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPreviewPaneView::OnBnClickedButton1()
|
|||
|
|
{
|
|||
|
|
// TODO: <20><><EFBFBD> <20><>Ʈ<EFBFBD><C6AE> <20>˸<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
|
|||
|
|
m_ctrlListBox.ResetContent();
|
|||
|
|
std::map< std::string, int >::iterator iter = m_mapEffectData.begin();
|
|||
|
|
for( ; iter != m_mapEffectData.end(); ++iter )
|
|||
|
|
{
|
|||
|
|
EternityEngine::DeleteEffectData( iter->second );
|
|||
|
|
}
|
|||
|
|
m_mapEffectData.clear();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPreviewPaneView::OnLbnSelchangeList1()
|
|||
|
|
{
|
|||
|
|
// TODO: <20><><EFBFBD> <20><>Ʈ<EFBFBD><C6AE> <20>˸<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
|
|||
|
|
CString strName;
|
|||
|
|
m_ctrlListBox.GetText( m_ctrlListBox.GetCurSel(), strName );
|
|||
|
|
std::string szKey = strName;
|
|||
|
|
|
|||
|
|
std::map< std::string, int >::iterator iter;
|
|||
|
|
iter = m_mapEffectData.find( szKey );
|
|||
|
|
if( iter != m_mapEffectData.end() )
|
|||
|
|
{
|
|||
|
|
MatrixEx Cross;
|
|||
|
|
EtEffectObjectHandle hHandle = EternityEngine::CreateEffectObject( iter->second, Cross );
|
|||
|
|
}
|
|||
|
|
}
|