void CReplaceTexDlg::BrowseTex(int iEdit)
{
	CString strTex;
	CWnd *pWnd = GetDlgItem(iEdit);

	pWnd->GetWindowText(strTex);

	CTextureBrowser *pBrowser = new CTextureBrowser(GetMainWnd());
	pBrowser->SetUsed(iEdit == IDC_FIND);
	pBrowser->SetInitialTexture(strTex);

	if (pBrowser->DoModal() == IDOK)
	{
		IEditorTexture *pTex = g_Textures.FindActiveTexture(pBrowser->m_cTextureWindow.szCurTexture);
		char szName[MAX_PATH];
		if (pTex != NULL)
		{
			pTex->GetShortName(szName);
		}
		else
		{
			szName[0] = '\0';
		}
		pWnd->SetWindowText(szName);
	}

	delete pBrowser;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CFaceEditMaterialPage::OnBrowse( void )
{
	// Set the material tool current.
	SetMaterialPageTool( MATERIALPAGETOOL_MATERIAL );

	CTextureBrowser *pBrowser = GetMainWnd()->pTextureBrowser;

	int iSel = m_TextureList.GetCurSel();

	if (iSel != LB_ERR)
	{
		IEditorTexture *pTex = (IEditorTexture *)m_TextureList.GetItemDataPtr(iSel);
		if (pTex != NULL)
		{
			char sz[128];
	
			pTex->GetShortName(sz);
			pBrowser->SetInitialTexture(sz);
		}
	}

	if (pBrowser->DoModal() == IDOK)
	{
		IEditorTexture *pTex = g_Textures.FindActiveTexture(pBrowser->m_cTextureWindow.szCurTexture);
		if (pTex != NULL)
		{
			int iCount = m_TextureList.GetCount();
			for (int i = 0; i < iCount; i++)
			{
				if (pTex == (IEditorTexture *)m_TextureList.GetItemDataPtr(i))
				{
					m_TextureList.SetCurSel(i);
					UpdateTexture();
					m_TextureList.AddMRU(pTex);
					break;
				}
			}
		}
	}
}