void CBaseMatchWnd::OnSearchForSeries() 
{
	CSingleLock pLock( &m_pMatches->m_pSection, TRUE );
	CRelatedSearch pSearch( m_pMatches->GetSelectedFile( TRUE ) );
	pLock.Unlock();
	pSearch.RunSearchForSeries();
}
void CLibraryFileView::OnSearchForSeries()
{
	CSingleLock pLock( &Library.m_pSection, TRUE );

	CRelatedSearch pSearch( GetSelectedFile() );
	pLock.Unlock();
	pSearch.RunSearchForSeries();
}
void CLibraryFileView::OnUpdateSearchForSeries(CCmdUI* pCmdUI)
{
	CSingleLock pLock( &Library.m_pSection );
	if ( ! pLock.Lock( 200 ) ) return;

	CRelatedSearch pSearch( GetSelectedFile() );
	pCmdUI->Enable( pSearch.CanSearchForSeries() );
}
void CBaseMatchWnd::OnUpdateSearchForSeries(CCmdUI* pCmdUI) 
{
	CSingleLock pLock( &m_pMatches->m_pSection, TRUE );
	CRelatedSearch pSearch( m_pMatches->GetSelectedFile( TRUE ) );
	pCmdUI->Enable( pSearch.CanSearchForSeries() );
}
void CKS_Import_File_Browser::SetPath(const std::string& sPath)
{
	CAutoDelete<ge::IWaitCursor> pWaitCursor(ge::IWaitCursor::Create());

	std::string sEnum;
	mItems.clear();

	tbool bWasOldMyComputer = (strcmp(msPath.c_str(), ":") == 0);
	tbool bIsNewMyComputer = (strcmp(sPath.c_str(), ":") == 0);

	msPath = sPath;

	if (bIsNewMyComputer) {
		// List "My Computer" - a.k.a. disk volumes
		tchar pszEnumVolumes[1024];
		if (IFile::GetDriveNames(pszEnumVolumes, sizeof(pszEnumVolumes), '@', true)) {
			std::list<std::string> listVolumes;
			PszEnumString2List(pszEnumVolumes, '@', listVolumes);
			std::list<std::string>::iterator itVolumes = listVolumes.begin();
			for ( ; itVolumes != listVolumes.end(); itVolumes++) {
				SItemInfo Info;
				Info.sName = *itVolumes;
				Info.bDir = true;
				mItems.push_back(Info);
			}
			sEnum = pszEnumVolumes;
		}
	}
	else if (bWasOldMyComputer) {
#ifdef _WIN32
		// For windows we must use only the drive letter part of the path
		tint32 iPosSpace = msPath.find_first_of(' ');
		if (iPosSpace > -1) {
			msPath.erase(iPosSpace);
			msPath += ":\\";
		}
#endif // _WIN32
	}

	CAutoDelete<IFileSearch> pSearch(IFileSearch::Create());
	std::string sSearchPathName(msPath);
	sSearchPathName += "*";
	pSearch->Init2(sSearchPathName.c_str());

	tbool bFirst = true;
	tchar pszName[1024];
	tbool bDir;
	while (pSearch->GetNext(pszName, bDir)) {
		std::string sName;
		tbool bFirstOld = bFirst;
		if (bFirst == false) {
			sName = "@";
		}
		bFirst = false;

		tbool bOK = false;
		sName += std::string(pszName);
		if (bDir) {
			sName += " (dir)";
			bOK = true;
		}
		else {
			std::string sPathName(msPath);
			sPathName += std::string(pszName);
			CAutoDelete<IFile> pFile(IFile::Create());
			if (pFile->Open(sPathName.c_str(), IFile::FileRead)) {
				ac::IDecoder* pDec = ac::IDecoder::Create(pFile);
				if (pDec) {
					bOK = true;
					pDec->Destroy();
				}
			}
		}

		if (bOK) {
			sEnum += sName;

			SItemInfo Info;
			Info.sName = std::string(pszName);
			Info.bDir = bDir;
			mItems.push_back(Info);
		}
		else {
			bFirst = bFirstOld;
		}
	}

	mpListBox->SetText(sEnum.c_str(), '@');

	tint32 iTextHeight = mItems.size() * 14;

	ge::SSize SizeScroll(200 - giScrollBarSize, iTextHeight);
	ge::SScrollPos ScrollPos;
	mpScrollPane->GetScrollPos(ScrollPos);
	ScrollPos.AreaSize = SizeScroll;
	if (ScrollPos.AreaSize.iCY < ScrollPos.VisibleRect.iCY) {
		ScrollPos.AreaSize.iCY = ScrollPos.VisibleRect.iCY;
	}
	mpScrollPane->SetScrollPos(ScrollPos);

	ge::SSize SizeListBox(SizeScroll - ge::SSize(4, 0));
	mpListBox->SetSize(SizeListBox);
} // SetPath