void CLibraryFrame::OnLibraryPanel() { if ( HasPanel() ) { m_bPanelShow = FALSE; SetDynamicBar( NULL ); if ( HasView() ) m_pView->SendMessage( WM_METADATA ); SetPanel( NULL ); } else { m_bPanelShow = TRUE; Update( TRUE ); } }
BOOL CLibraryFrame::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { CRect rcClient, rc; CPoint point; GetCursorPos( &point ); GetClientRect( &rcClient ); ClientToScreen( &rcClient ); rc.SetRect( Settings.General.LanguageRTL ? rcClient.right - m_nTreeSize - Settings.Skin.Splitter : rcClient.left + m_nTreeSize, rcClient.top, Settings.General.LanguageRTL ? rcClient.right - m_nTreeSize : rcClient.left + m_nTreeSize + Settings.Skin.Splitter, rcClient.bottom ); if ( rc.PtInRect( point ) ) { SetCursor( AfxGetApp()->LoadStandardCursor( IDC_SIZEWE ) ); return TRUE; } if ( HasPanel() ) { rc.SetRect( Settings.General.LanguageRTL ? rcClient.left : rcClient.left + m_nTreeSize + Settings.Skin.Splitter, rcClient.bottom - Settings.Skin.ToolbarHeight - m_nPanelSize - Settings.Skin.Splitter, Settings.General.LanguageRTL ? rcClient.right - m_nTreeSize : rcClient.right, rcClient.bottom - Settings.Skin.ToolbarHeight - m_nPanelSize ); if ( rc.PtInRect( point ) ) { SetCursor( AfxGetApp()->LoadStandardCursor( IDC_SIZENS ) ); return TRUE; } } return CWnd::OnSetCursor( pWnd, nHitTest, message ); }
BOOL CLibraryFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { if ( m_wndTreeTop.m_hWnd ) { if ( m_wndTreeTop.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } if ( m_wndTreeBottom.m_hWnd ) { if ( m_wndTreeBottom.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } if ( m_wndViewTop.m_hWnd ) { if ( m_wndViewTop.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } if ( m_wndViewBottom.m_hWnd ) { if ( m_wndViewBottom.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } if ( m_wndTree.m_hWnd ) { if ( m_wndTree.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } if ( HasView() ) { if ( m_pView->OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } if ( HasPanel() ) { if ( m_pPanel->OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } if ( m_wndBottomDynamic.m_hWnd ) { if ( m_wndBottomDynamic.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; } return CWnd::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ); }
void CLibraryFrame::UpdatePanel(BOOL bForce) { CQuickLock oLock( Library.m_pSection ); if ( ! bForce && ! m_bViewSelection ) return; m_bViewSelection = FALSE; m_pViewSelection = HasView() ? m_pView->GetSelection() : m_pViewEmpty; if ( m_bPanelShow ) { CLibraryTreeItem* pFolders = m_wndTree.GetFirstSelected(); CLibraryListPtr pFiles( GetViewSelection() ); BOOL bMetaPanelAvailable = ( pFolders != NULL ); BOOL bHistoryPanelAvailable = ( LibraryHistory.GetCount() > 0 ); // Do not display any panel for the collection folder if ( pFolders && pFolders->m_pVirtual && pFolders->m_pVirtual->m_oCollSHA1 ) bMetaPanelAvailable = bHistoryPanelAvailable = FALSE; // Prefer history panel if no files selected for meta panel if ( bMetaPanelAvailable && bHistoryPanelAvailable && pFiles && pFiles->GetCount() <= 0 ) bMetaPanelAvailable = FALSE; CPanelCtrl* pBestPanel = bMetaPanelAvailable ? static_cast< CPanelCtrl* >( &m_pMetaPanel ) : ( bHistoryPanelAvailable ? static_cast< CPanelCtrl* >( &m_pHistoryPanel ) : NULL ); if ( ! HasPanel() || m_pPanel != pBestPanel ) SetPanel( pBestPanel ); else SetPanel( m_pPanel ); } }
void CLibraryFrame::OnUpdateLibraryPanel(CCmdUI* pCmdUI) { pCmdUI->SetCheck( HasPanel() ); }
void CLibraryFrame::OnSize(UINT nType, int cx, int cy) { if ( nType != 1982 ) CWnd::OnSize( nType, cx, cy ); HideDynamicBar(); CRect rc; GetClientRect( &rc ); if ( rc.Width() < 32 || rc.Height() < 32 ) return; if ( rc.Width() < m_nTreeSize + Settings.Skin.Splitter ) m_nTreeSize = max( 0, rc.Width() - (int)Settings.Skin.Splitter ); if ( rc.Height() - Settings.Skin.ToolbarHeight * 2 - m_nHeaderSize < m_nPanelSize + Settings.Skin.Splitter ) m_nPanelSize = max( 0, rc.Height() - (int)Settings.Skin.ToolbarHeight * 2 - m_nHeaderSize - (int)Settings.Skin.Splitter ); HDWP hDWP = BeginDeferWindowPos( 7 + ( HasView() ? 1 : 0 ) + ( HasPanel() ? 1 : 0 ) + ( m_nHeaderSize > 0 ) ); DeferWindowPos( hDWP, m_wndTreeTop.GetSafeHwnd(), NULL, rc.left, rc.top, m_nTreeSize, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndTreeBottom.GetSafeHwnd(), NULL, rc.left, rc.bottom - Settings.Skin.ToolbarHeight, m_nTreeSize, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndTreeTypes.GetSafeHwnd(), NULL, rc.left, rc.bottom - m_nTreeTypesHeight, m_nTreeSize, 256, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndViewTop.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.top, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndViewBottom.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.bottom - Settings.Skin.ToolbarHeight, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndBottomDynamic.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.bottom - Settings.Skin.ToolbarHeight * 2, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndTree.GetSafeHwnd(), NULL, rc.left, rc.top + Settings.Skin.ToolbarHeight, m_nTreeSize, rc.Height() - Settings.Skin.ToolbarHeight * 2, SWP_NOZORDER ); if ( HasView() ) { int nTop = rc.top + Settings.Skin.ToolbarHeight; if ( m_nHeaderSize > 0 ) { DeferWindowPos( hDWP, m_wndHeader.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, nTop, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, m_nHeaderSize, SWP_NOZORDER|SWP_SHOWWINDOW ); nTop += m_nHeaderSize; } int nHeight = rc.bottom - Settings.Skin.ToolbarHeight - nTop; if ( HasPanel() ) nHeight -= m_nPanelSize + Settings.Skin.Splitter; DeferWindowPos( hDWP, m_pView->GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, nTop, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, nHeight, SWP_NOZORDER|SWP_SHOWWINDOW ); } if ( HasPanel() ) { DeferWindowPos( hDWP, m_pPanel->GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.bottom - Settings.Skin.ToolbarHeight - m_nPanelSize, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, m_nPanelSize, SWP_NOZORDER|SWP_SHOWWINDOW ); } EndDeferWindowPos( hDWP ); }