Ejemplo n.º 1
0
CLibraryList* CLibraryMetaPanel::GetViewSelection() const
{
	if ( ! m_hWnd )
		return NULL;

	CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
	if ( ! pFrame )
		return NULL;

	ASSERT_KINDOF(CLibraryFrame, pFrame);
	return pFrame->GetViewSelection();
}
Ejemplo n.º 2
0
CAlbumFolder* CLibraryHeaderPanel::GetSelectedAlbum() const
{
	if (!m_hWnd) return Library.GetAlbumRoot();
	CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
	ASSERT_KINDOF(CLibraryFrame, pFrame );

	CLibraryTreeItem* pItem	= pFrame->GetFolderSelection();
	if ( pItem == NULL ) return Library.GetAlbumRoot();
	if ( pItem->m_pSelNext != NULL ) return NULL;

	return pItem->m_pVirtual;
}
Ejemplo n.º 3
0
BOOL CLibraryView::SelClear(BOOL bNotify)
{
	if ( m_pSelection->IsEmpty() ) return FALSE;
	m_pSelection->RemoveAll();

	if ( bNotify )
	{
		CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
		pFrame->OnViewSelection();
	}

	return TRUE;
}
Ejemplo n.º 4
0
BOOL CLibraryView::SelAdd(CLibraryListItem oObject, BOOL bNotify)
{
	if ( m_pSelection->Find( oObject ) ) return FALSE;
	m_pSelection->AddTail( oObject );

	if ( bNotify )
	{
		CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
		pFrame->OnViewSelection();
	}

	return TRUE;
}
Ejemplo n.º 5
0
BOOL CLibraryView::SelRemove(CLibraryListItem oObject, BOOL bNotify)
{
	POSITION pos = m_pSelection->Find( oObject );
	if ( pos == NULL ) return FALSE;
	m_pSelection->RemoveAt( pos );

	if ( bNotify )
	{
		CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
		pFrame->OnViewSelection();
	}

	return TRUE;
}
Ejemplo n.º 6
0
void CLibraryMetaPanel::OnLButtonUp(UINT nFlags, CPoint point)
{
	point.y += GetScrollPos( SB_VERT );

	if ( m_nSelected > 0 && m_rcFolder.PtInRect( point ) )
	{
		CQuickLock oLock( Library.m_pSection );

		if ( CLibraryFolder* pFolder = LibraryFolders.GetFolder( m_sFolder ) )
		{
			if ( Settings.Library.ShowVirtual )
			{
				CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
				ASSERT_KINDOF(CLibraryFrame, pFrame );
				pFrame->Display( pFolder );
			}
			else if ( LibraryFolders.CheckFolder( pFolder, TRUE ) )
			{
				ShellExecute( AfxGetMainWnd()->GetSafeHwnd(), NULL,
					m_sFolder, NULL, NULL, SW_SHOWNORMAL );
			}
		}
	}
	else if ( m_nSelected > 0 && m_rcRating.PtInRect( point ) )
	{
		CLibraryListPtr pList( GetViewSelection() );

		if ( pList && pList->GetCount() > 0 )
		{
			CFilePropertiesSheet dlg;
			dlg.Add( pList );
			dlg.DoModal( 2 );
		}
	}
	else if ( CMetaItem* pItem = m_pMetadata->HitTest( point, TRUE ) )
	{
		CQuickLock oLock( Library.m_pSection );

		if ( CAlbumFolder* pFolder = pItem->GetLinkTarget() )
		{
			CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
			ASSERT_KINDOF(CLibraryFrame, pFrame );
			pFrame->Display( pFolder );
		}
	}

	CPanelCtrl::OnLButtonUp( nFlags, point );
}
Ejemplo n.º 7
0
void CLibraryHeaderPanel::OnLButtonUp(UINT nFlags, CPoint point)
{
	if ( CMetaItem* pItem = m_pMetadata.HitTest( point, TRUE ) )
	{
		CQuickLock oLock( Library.m_pSection );

		if ( CAlbumFolder* pFolder = pItem->GetLinkTarget() )
		{
			CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
			ASSERT_KINDOF(CLibraryFrame, pFrame );
			pFrame->Display( pFolder );
		}
	}

	CWnd::OnLButtonUp( nFlags, point );
}
Ejemplo n.º 8
0
void CLibraryHeaderBar::OnLibraryView()
{
	CMenu pMenu;

	pMenu.CreatePopupMenu();

	CLibraryFrame* pFrame	= (CLibraryFrame*)GetParent();
	CList< CLibraryView* >* pViews = pFrame->GetViews();

	for ( POSITION pos = pViews->GetHeadPosition() ; pos ; )
	{
		CLibraryView* pView = (CLibraryView*)pViews->GetNext( pos );
		if ( ! pView->m_bAvailable ) continue;

		CString strName;
		Skin.LoadString( strName, pView->m_nCommandID );
		LPCTSTR pszName = _tcschr( strName, '\n' );
		pszName = ( pszName ) ? ( pszName + 1 ) : (LPCTSTR)strName;

		pMenu.AppendMenu( MF_STRING | ( pView == m_pLastView ? MF_CHECKED : 0 ),
			pView->m_nCommandID, pszName );
	}

	m_pCoolMenu = new CCoolMenu();
	m_pCoolMenu->AddMenu( &pMenu, TRUE );
	m_pCoolMenu->SetWatermark( Skin.GetWatermark( _T("CCoolMenu") ) );

	if ( UINT nCmd = ThrowMenu( ID_LIBRARY_VIEW, &pMenu, this, TRUE, TRUE ) )
	{
		for ( POSITION pos = pViews->GetHeadPosition() ; pos ; )
		{
			CLibraryView* pView = (CLibraryView*)pViews->GetNext( pos );

			if ( pView->m_nCommandID == nCmd )
			{
				pFrame->SetView( pView );
			}
		}
	}

	delete m_pCoolMenu;
	m_pCoolMenu = NULL;
}
Ejemplo n.º 9
0
// Called when the selection changes
void CLibraryFileView::CheckDynamicBar()
{
	bool bIsMusicBrainz = false;
	ClearServicePages();

	CLibraryFrame* pFrame = GetFrame();
	if ( _tcscmp( pFrame->GetDynamicBarName(), L"WebServices.MusicBrainz" ) == 0 )
		bIsMusicBrainz = true;

	if ( GetSelectedCount() != 1 )
	{
		if ( bIsMusicBrainz )
		{
			pFrame->SetDynamicBar( NULL );
			m_bRequestingService = FALSE;	// ToDo: Abort operation
		}
		return;
	}

	CSingleLock pLock( &Library.m_pSection, TRUE );

	CLibraryFile* pFile = GetSelectedFile();

	if ( pFile == NULL )	// Ghost file
	{
		pFrame->SetDynamicBar( NULL );
		m_bRequestingService = FALSE;
		return;
	}

	if ( ! pFile->IsSchemaURI( CSchema::uriAudio ) || pFile->m_pMetadata == NULL )
	{
		if ( bIsMusicBrainz )
			pFrame->SetDynamicBar( NULL );

		m_bRequestingService = FALSE;	// ToDo: Abort operation
		return;
	}

	CMetaList* pMetaList = new CMetaList();
	pMetaList->Setup( pFile->m_pSchema, FALSE );
	pMetaList->Combine( pFile->m_pMetadata );

	pLock.Unlock();

	if ( ! pMetaList->IsMusicBrainz() && bIsMusicBrainz )
		pFrame->SetDynamicBar( NULL );
	else
		pFrame->HideDynamicBar();

	m_bRequestingService = FALSE;	// ToDo: Abort operation
	delete pMetaList;
}
Ejemplo n.º 10
0
LRESULT CLibraryFileView::OnServiceDone(WPARAM wParam, LPARAM lParam)
{
	CString strStatus;
	LoadString( strStatus, IDS_TIP_STATUS );
	strStatus.TrimRight( ':' );

	LPCTSTR pszMessage = (LPCTSTR)lParam;
	CMetaList* pPanelData = (CMetaList*)wParam;

	m_bServiceFailed = FALSE;

	if ( pPanelData == NULL )
	{
		m_nCurrentPage = 0;
		m_bRequestingService = FALSE;
		ClearServicePages();
	}
	else if ( pszMessage == NULL )
	{
		pPanelData->Remove( strStatus );
	}
	else
	{
		CMetaItem* pItem = pPanelData->Find( strStatus );
		if ( pItem ) pItem->m_sValue = pszMessage;

		m_bServiceFailed = TRUE;
	}

	CLibraryFrame* pFrame = GetFrame();
	if ( pFrame->GetPanelData() != NULL )
		pFrame->SetPanelData( pPanelData );

	m_bRequestingService = FALSE;

	return 0;
}
Ejemplo n.º 11
0
void CLibraryMetaPanel::OnLButtonDown(UINT /*nFlags*/, CPoint /*point*/)
{
	SetFocus();
	CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
	pFrame->HideDynamicBar();
}
Ejemplo n.º 12
0
void CLibraryFileView::OnMusicBrainzLookup()
{
	CLibraryFrame* pFrame = GetFrame();
	pFrame->SetDynamicBar( L"WebServices.MusicBrainz" );
}