// TextureBrowser.cpp : implementation file // #include "stdafx.h" #include "pixelwhippro.h" #include "TextureBrowser.h" ///////////////////////////////////////////////////////////////////////////// // CTextureBrowser dialog extern CPixelWhipProApp theApp; CTextureBrowser::CTextureBrowser(CWnd* pParent /*=NULL*/) : CDialog(CTextureBrowser::IDD, pParent) { //{{AFX_DATA_INIT(CTextureBrowser) m_TextureName = _T(""); //}}AFX_DATA_INIT } void CTextureBrowser::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTextureBrowser) DDX_Control(pDX, IDC_TEXTURELIST, m_TListCtrl); DDX_LBString(pDX, IDC_TEXTURELIST, m_TextureName); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CTextureBrowser, CDialog) //{{AFX_MSG_MAP(CTextureBrowser) ON_BN_CLICKED(IDC_NOTEXT, OnNotext) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CTextureBrowser message handlers BOOL CTextureBrowser::OnInitDialog() { CDialog::OnInitDialog(); CString InitalPath(theApp.TexturePath); WIN32_FIND_DATA ffdat; HANDLE fhnd; fhnd=FindFirstFile(InitalPath+"\\*.png",&ffdat); do { CString tnme; tnme=ffdat.cFileName; tnme=tnme.Left(tnme.GetLength()-4); m_TListCtrl.AddString(tnme); } while(FindNextFile(fhnd,&ffdat)!=0); fhnd=FindFirstFile(InitalPath+"\\*.tga",&ffdat); do { CString tnme; tnme=ffdat.cFileName; tnme=tnme.Left(tnme.GetLength()-4); if(LB_ERR==m_TListCtrl.FindString(-1,tnme)) m_TListCtrl.AddString(tnme); } while(FindNextFile(fhnd,&ffdat)!=0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CTextureBrowser::OnOK() { CDialog::OnOK(); } void CTextureBrowser::OnNotext() { m_TextureName=""; CDialog::OnOK(); }