00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "CoolInterface.h"
00026 #include "Library.h"
00027 #include "AlbumFolder.h"
00028 #include "ShellIcons.h"
00029 #include "SchemaCache.h"
00030 #include "Schema.h"
00031 #include "Skin.h"
00032
00033 #include "CtrlLibraryFrame.h"
00034 #include "CtrlLibraryHomeView.h"
00035
00036 #ifdef _DEBUG
00037 #define new DEBUG_NEW
00038 #undef THIS_FILE
00039 static char THIS_FILE[] = __FILE__;
00040 #endif
00041
00042 IMPLEMENT_DYNCREATE(CLibraryHomeView, CLibraryView)
00043
00044 BEGIN_MESSAGE_MAP(CLibraryHomeView, CLibraryView)
00045
00046 ON_WM_CREATE()
00047 ON_WM_SIZE()
00048 ON_WM_DESTROY()
00049 ON_WM_SETFOCUS()
00050
00051 END_MESSAGE_MAP()
00052
00053
00055
00056
00057 CLibraryHomeView::CLibraryHomeView()
00058 {
00059 m_nCommandID = ID_LIBRARY_VIEW_HOME;
00060 m_pszToolBar = _T("CLibraryHomeView");
00061 }
00062
00063 CLibraryHomeView::~CLibraryHomeView()
00064 {
00065 }
00066
00068
00069
00070 BOOL CLibraryHomeView::CheckAvailable(CLibraryTreeItem* pSel)
00071 {
00072 m_bAvailable = ( pSel == NULL );
00073 return m_bAvailable;
00074 }
00075
00076 int CLibraryHomeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
00077 {
00078 if ( CLibraryView::OnCreate( lpCreateStruct ) == -1 ) return -1;
00079
00080 m_wndTile.Create( this );
00081 m_wndTile.SetOwner( GetOwner() );
00082 m_wndTile.ShowWindow( SW_SHOW );
00083
00084 return 0;
00085 }
00086
00087 void CLibraryHomeView::OnDestroy()
00088 {
00089 CLibraryView::OnDestroy();
00090 }
00091
00092 void CLibraryHomeView::OnSize(UINT nType, int cx, int cy)
00093 {
00094 if ( nType != 1982 ) CLibraryView::OnSize( nType, cx, cy );
00095
00096 CRect rc;
00097 GetClientRect( &rc );
00098 m_wndTile.MoveWindow( &rc );
00099 }
00100
00101 void CLibraryHomeView::GetHeaderContent(int& nImage, CString& str)
00102 {
00103 if ( CSchema* pSchema = SchemaCache.Get( CSchema::uriLibrary ) )
00104 {
00105 nImage = pSchema->m_nIcon16;
00106 LoadString( str, IDS_LIBHEAD_EXPLORE_FOLDER );
00107 LPCTSTR psz = _tcschr( pSchema->m_sTitle, ':' );
00108 if ( theApp.m_bRTL )
00109 {
00110 CString strCaption( psz ? psz + 1 : pSchema->m_sTitle );
00111 str = _T("\x202A") + strCaption + _T(" \x200E") + str;
00112 }
00113 else
00114 str += psz ? psz + 1 : pSchema->m_sTitle;
00115 }
00116 else
00117 {
00118 nImage = SHI_COMPUTER;
00119 LoadString( str, IDS_LIBHEAD_HOME );
00120 }
00121 }
00122
00123 void CLibraryHomeView::Update()
00124 {
00125 CSingleLock pLock( &Library.m_pSection );
00126 if ( ! pLock.Lock( 100 ) ) return;
00127
00128 m_wndTile.Update();
00129 }
00130
00131 BOOL CLibraryHomeView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
00132 {
00133 if ( m_wndTile.m_hWnd != NULL )
00134 {
00135 if ( m_wndTile.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE;
00136 }
00137
00138 return CLibraryView::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
00139 }
00140
00141 void CLibraryHomeView::OnSetFocus(CWnd* pOldWnd)
00142 {
00143 CLibraryView::OnSetFocus( pOldWnd );
00144 if ( m_wndTile.m_hWnd ) m_wndTile.SetFocus();
00145 }