ExtControlBar.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:775k
- wrFrame.bottom;
- break;
- case AFX_IDW_DOCKBAR_LEFT:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.right +=
- nRdpExtraInnerDx;
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.left =
- wrFrame.left;
- break;
- case AFX_IDW_DOCKBAR_RIGHT:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.left -=
- nRdpExtraInnerDx;
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.right =
- wrFrame.right;
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( arrDockBarAnalyze[nDockBarIdx].m_nDockBarID )
- if( arrDockBarAnalyze[nDockBarIdx].m_nDockBarID ==
- AFX_IDW_DOCKBAR_LEFT
- ||
- arrDockBarAnalyze[nDockBarIdx].m_nDockBarID ==
- AFX_IDW_DOCKBAR_RIGHT
- )
- {
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.top =
- arrDockBarAnalyze[0].m_rcDockBarAnalyze.bottom
- - nRdpExtraInnerDy;
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.bottom =
- arrDockBarAnalyze[1].m_rcDockBarAnalyze.top
- + nRdpExtraInnerDy;
- }
- CRect rcReDockAnalyze(
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze
- );
- rcReDockAnalyze.InflateRect(
- nRdpExtraOuterDx,
- nRdpExtraOuterDy
- );
- if( !rcReDockAnalyze.PtInRect( ptTrack ) )
- arrDockBarAnalyze[nDockBarIdx].m_bForceExclude = true;
- } // for( nDockBarIdx = 0; nDockBarIdx < 4; nDockBarIdx++ )
- if( nIdxForceFirstReview >= 0 )
- {
- if( arrDockBarAnalyze[nIdxForceFirstReview].m_bForceExclude )
- arrDockBarAnalyze[nIdxForceFirstReview].m_bForceFirstReview = false;
- else
- {
- if( _DoFixed_OuterDockerAdjustment(
- ptTrack,
- arrDockBarAnalyze[nIdxForceFirstReview].m_pOuterDocker
- )
- )
- return;
- } // else from if( arrDockBarAnalyze[nDockBarIdx].m_bForceExclude )
- } // if( nIdxForceFirstReview >= 0 )
- for( nDockBarIdx = 0; nDockBarIdx < 4; nDockBarIdx++ )
- {
- ASSERT_VALID( arrDockBarAnalyze[nDockBarIdx].m_pOuterDocker );
- if( arrDockBarAnalyze[nDockBarIdx].m_bForceFirstReview
- || (! arrDockBarAnalyze[nDockBarIdx].m_bVisible )
- || arrDockBarAnalyze[nDockBarIdx].m_bForceExclude
- )
- continue;
-
- if( _DoFixed_OuterDockerAdjustment(
- ptTrack,
- arrDockBarAnalyze[nDockBarIdx].m_pOuterDocker
- )
- )
- return;
- } // for( nDockBarIdx = 0; nDockBarIdx < 4; nDockBarIdx++ )
- for( nDockBarIdx = 0; nDockBarIdx < 4; nDockBarIdx++ )
- {
- if( arrDockBarAnalyze[nDockBarIdx].m_bForceFirstReview
- || arrDockBarAnalyze[nDockBarIdx].m_bVisible
- || arrDockBarAnalyze[nDockBarIdx].m_bForceExclude
- )
- continue;
- if( _DoFixed_OuterDockerAdjustment(
- ptTrack,
- arrDockBarAnalyze[nDockBarIdx].m_pOuterDocker
- )
- )
- return;
- } // for( nDockBarIdx = 0; nDockBarIdx < 4; nDockBarIdx++ )
- _DoFixed_FloatingAdjustment( ptTrack );
- }
- void CExtControlBar::InternalDraggingState_t::CalcStateDynamic(
- CPoint ptTrack, // in screen coords
- bool bForceFloatMode
- )
- {
- ASSERT_VALID( this );
- ASSERT( !IsEmpty() );
- ASSERT_VALID( m_pExtBarSrc );
- if( m_pExtBarSrc->IsFixedDockStyle() )
- {
- ASSERT( m_pExtBarSrc->_IsShowContentWhenDragging() );
- _DoFixed_BasicAdjustment( ptTrack, bForceFloatMode );
- return;
- }
- CExtControlBar::eResizablePanelDockingType_t eResizablePanelDockingType =
- m_pExtBarSrc->OnQueryDockingType();
- bool bShowContent = m_pExtBarSrc->_IsShowContentWhenDragging();
- if( bShowContent
- && m_pExtBarSrc->IsDocked()
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- && INT(eResizablePanelDockingType) < INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- )
- {
- ASSERT_VALID( m_pExtBarSrc->m_pDockBar );
- CRect rcDockBar;
- m_pExtBarSrc->m_pDockBar->GetWindowRect( &rcDockBar );
- if( rcDockBar.PtInRect(ptTrack) )
- return;
- } // if( bShowContent ...
-
- TrackRectSetEmpty();
- eResizablePanelDockingType;
- static const DWORD _dwDockBarMap[4][2] =
- {
- { AFX_IDW_DOCKBAR_TOP, CBRS_TOP },
- { AFX_IDW_DOCKBAR_BOTTOM, CBRS_BOTTOM },
- { AFX_IDW_DOCKBAR_LEFT, CBRS_LEFT },
- { AFX_IDW_DOCKBAR_RIGHT, CBRS_RIGHT },
- };
- // reasonable dockbar parts
- static const INT nRdpOuter = 16;
- static const INT nRdpInner = nRdpOuter*2;
- static const INT nRdpMostInner = 12;
- // reasonable controlbar part
- static const INT nRcpAnyHalfMin = 8;
- m_eCDT = __ECDT_FLOATED;
- m_pExtBarDst = NULL;
- //ExtBarDstSet( NULL );
- CRect rcBarWnd;
- INT nSrcMinHW = m_pExtBarSrc->_CalcDesiredMinHW();
- INT nSrcMinVH = m_pExtBarSrc->_CalcDesiredMinVH();
- if( nSrcMinHW < nRcpAnyHalfMin )
- nSrcMinHW = nRcpAnyHalfMin;
- if( nSrcMinVH < nRcpAnyHalfMin )
- nSrcMinVH = nRcpAnyHalfMin;
- INT nDstMinHW = nRcpAnyHalfMin; // some reasonable min width when horz docked
- INT nDstMinVH = nRcpAnyHalfMin; // some reasonable min height when vert docked
- CFrameWnd * pFrame = m_pExtBarSrc->_GetDockingFrameImpl();
- ASSERT_VALID( pFrame );
- CRect rcFrameWnd;
- pFrame->GetWindowRect( &rcFrameWnd );
- bool bForceFloat = bForceFloatMode;
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- && (! bForceFloat )
- && m_pExtBarSrc->IsFloating()
- )
- {
- ASSERT( m_eCDT == __ECDT_FLOATED );
- HWND hWnd = ::WindowFromPoint( ptTrack );
- if( hWnd != NULL )
- {
- ASSERT( ::IsWindow(hWnd) );
- CWnd * pWnd = CWnd::FromHandlePermanent( hWnd );
- if( pWnd != NULL )
- {
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- DYNAMIC_DOWNCAST( CExtDynDockMarkerWnd, pWnd );
- if( pDynDockMarkerWnd != NULL
- && pDynDockMarkerWnd->IsStateApplyable()
- )
- { // if dockmarker is state applyable
- m_eCDT = pDynDockMarkerWnd->GetCDT();
- HWND hWnd = pDynDockMarkerWnd->GetMarkerTargetHWND();
- if( hWnd != NULL )
- {
- if( ::IsWindow(hWnd) )
- {
- CWnd * pWnd = CWnd::FromHandlePermanent( hWnd );
- if( pWnd != NULL )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_eCDT == __ECDT_2005_BAR_NEW_TAB )
- {
- CExtDynTabControlBar * pTabbedBar =
- DYNAMIC_DOWNCAST( CExtDynTabControlBar, pWnd );
- if( pTabbedBar != NULL )
- {
- if( m_pExtBarSrc->_CanDockToTabbedContainers( pTabbedBar ) )
- {
- CRect rcTabSwitcher;
- pTabbedBar->GetSwitcherWindowRect( rcTabSwitcher );
- CPoint ptTrackFake(
- rcTabSwitcher.left + 2, // rcTabSwitcher.right - 2,
- rcTabSwitcher.CenterPoint().y
- );
- ExtBarDstSet( pTabbedBar );
- if( pTabbedBar->IsSwitcherVisible() )
- {
- m_eCDT = __ECDT_TABBED_REINDEX_NHM;
- ReindexPosCalc( ptTrackFake );
- } // if( pTabbedBar->IsSwitcherVisible() )
- else
- {
- m_eCDT = __ECDT_2005_BAR_NEW_TAB;
- TrackRectSet( &rcBarWnd );
- } // else from if( pTabbedBar->IsSwitcherVisible() )
- } // if( m_pExtBarSrc->_CanDockToTabbedContainers( pTabbedBar ) )
- else
- {
- m_eCDT = __ECDT_FLOATED;
- bForceFloatMode = true;
- }
- } // if( pTabbedBar != NULL )
- else
- {
- CExtControlBar * pDestBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pWnd );
- if( pDestBar == NULL
- || (! m_pExtBarSrc->_CanDockToTabbedContainers( pDestBar ) )
- || (! pDestBar->_CanDockToTabbedContainers( m_pExtBarSrc ) )
- )
- {
- m_eCDT = __ECDT_FLOATED;
- bForceFloatMode = true;
- }
- else
- ExtBarDstSet( pDestBar );
- } // else from if( pTabbedBar != NULL )
- } // if( m_eCDT == __ECDT_2005_BAR_NEW_TAB )
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_eCDT == __ECDT_2005_BAR_TOP
- || m_eCDT == __ECDT_2005_BAR_BOTTOM
- || m_eCDT == __ECDT_2005_BAR_LEFT
- || m_eCDT == __ECDT_2005_BAR_RIGHT
- )
- {
- CExtControlBar * pDestBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pWnd );
- if( pDestBar == NULL
- //|| (! m_pExtBarSrc->_CanDockToTabbedContainers( pDestBar ) )
- || (! m_pExtBarSrc->_CanDockLTRB( pDestBar ) )
- || (! pDestBar->_CanDockLTRB( m_pExtBarSrc ) )
- )
- {
- m_eCDT = __ECDT_FLOATED;
- bForceFloatMode = true;
- }
- else
- ExtBarDstSet( pDestBar );
- }
- } // if( pWnd != NULL )
- } // if( ::IsWindow(hWnd) )
- else
- {
- m_eCDT = __ECDT_FLOATED;
- bForceFloatMode = true;
- } // else from if( ::IsWindow(hWnd) )
- } // if( hWnd != NULL )
- if( m_eCDT != __ECDT_FLOATED )
- return;
- } // if dockmarker is state applyable
- } // if( pWnd != NULL )
- } // if( hWnd != NULL )
- }
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if(
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- INT(eResizablePanelDockingType) < INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- &&
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- ( ! bForceFloat )
- && m_pExtBarSrc->IsFloating()
- && ( m_pExtBarSrc->IsKindOf(RUNTIME_CLASS(CExtDynControlBar))
- || (! bShowContent )
- )
- )
- {
- CFrameWnd * pFrameExcludeTest = m_pExtBarSrc->GetParentFrame();
- if( pFrameExcludeTest->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- {
- CRect rcFrameExcludeText;
- pFrameExcludeTest->GetWindowRect( &rcFrameExcludeText );
- if( rcFrameExcludeText.PtInRect(ptTrack) )
- bForceFloat = true;
- }
- }
- if( (! CExtPopupMenuWnd::IsKeyPressed(VK_CONTROL) )
- && (! bForceFloat )
- )
- {
- ASSERT( m_eCDT == __ECDT_FLOATED );
- bool bCanDockToInnerCircles =
- m_pExtBarSrc->_CanDockToInnerCircles();
- if( bCanDockToInnerCircles
- //&& (! bShowContent )
- )
- { // try to analyze docking into floating bars
- ExtControlBarVector_t vBars;
- m_pExtBarSrc->_GetFrameControlBars(
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- ( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- ? true :
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- false,
- vBars,
- (DWORD)(
- __GFECB_NONFIXED_NONMIN //|__GFECB_FIXED
- |__GFECB_FLOATED
- |__GFECB_VIS_ALL
- |__GFECB_BYPT_ONLY_WND
- ),
- ptTrack
- );
- CExtControlBar * pDesiredBar = NULL;
- INT nCountOfBars = (INT)vBars.GetSize();
- for( INT nBarIdx = 0; nBarIdx < nCountOfBars; nBarIdx++ )
- {
- CExtControlBar * pTestBar = vBars[nBarIdx];
- ASSERT_VALID( pTestBar );
- ASSERT( !pTestBar->IsFixedMode() );
- if( pTestBar == m_pExtBarSrc )
- continue;
- pDesiredBar = pTestBar;
- break;
- } // for( INT nBarIdx = 0; nBarIdx < nCountOfBars; nBarIdx++ )
- if( pDesiredBar != NULL )
- {
- ASSERT_VALID( pDesiredBar );
- //m_pExtBarDst = pDesiredBar;
- ExtBarDstSet( pDesiredBar );
- m_pExtBarDst->GetParentFrame()->GetWindowRect( &rcBarWnd );
- nDstMinHW = m_pExtBarDst->_CalcDesiredMinHW();
- nDstMinVH = m_pExtBarDst->_CalcDesiredMinVH();
- INT nWidth3 = nRdpInner; // rcBarWnd.Width();
- INT nHeight3 = nRdpInner; // rcBarWnd.Height();
- // INT nWidth2 = nWidth / 2;
- // INT nHeight2 = nHeight / 2;
- // INT nWidth3 = nWidth / 4;
- // INT nHeight3 = nHeight / 4;
- // UINT nDockBarID =
- // m_pExtBarDst->GetSafeDockBarDlgCtrlID();
- // ASSERT_DOCKBAR_DLGCTRLID( nDockBarID );
- // bool bHorz =
- // ( nDockBarID == AFX_IDW_DOCKBAR_TOP
- // || nDockBarID == AFX_IDW_DOCKBAR_BOTTOM
- // || nDockBarID == AFX_IDW_DOCKBAR_FLOAT
- // ) ? true : false;
- ASSERT( m_pExtBarDst->m_pDockBar != NULL );
- CDockBar * pDockBar =
- STATIC_DOWNCAST( CDockBar, m_pExtBarDst->m_pDockBar );
- ASSERT_VALID( pDockBar );
- bool bEnableInnerDock = true;
- // if( nDockBarID == AFX_IDW_DOCKBAR_LEFT
- // && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_LEFT) == 0
- // )
- // bEnableInnerDock = false;
- // if( nDockBarID == AFX_IDW_DOCKBAR_RIGHT
- // && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_RIGHT) == 0
- // )
- // bEnableInnerDock = false;
- // if( nDockBarID == AFX_IDW_DOCKBAR_TOP
- // && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_TOP) == 0
- // )
- // bEnableInnerDock = false;
- // if( nDockBarID == AFX_IDW_DOCKBAR_BOTTOM
- // && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_BOTTOM) == 0
- // )
- // bEnableInnerDock = false;
-
- if( bEnableInnerDock && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_ANY) != 0 )
- {
- m_bDeepHalfSplit = false;
- if( !m_pExtBarDst->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar))
- || m_pExtBarDst->IsFloating()
- )
- m_bDeepHalfSplit = true;
-
- CRect rcWndDockBar;
- pDockBar->GetWindowRect( &rcWndDockBar );
-
- CRect rcPart( rcBarWnd );
- do
- { // SINGLE LOOP
- INT nHalfHeight = rcBarWnd.Height()/2;
- if( rcBarWnd.Width() >= nSrcMinHW
- && nHalfHeight >= nSrcMinVH
- && nHalfHeight >= nDstMinVH
- )
- { // if can do half splitting
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- BOOL bTabbedDest =
- m_pExtBarDst->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar))
- && ( ((CExtDynTabControlBar*)m_pExtBarDst)->IsSwitcherVisible() )
- ;
- INT nTabbedShift = 0;
- bool bCanDockToTabbedContainers =
- ( m_pExtBarSrc->_CanDockToTabbedContainers( m_pExtBarDst )
- && m_pExtBarDst->_CanDockToTabbedContainers( m_pExtBarSrc )
- ) ? true : false;
- if( bCanDockToTabbedContainers )
- {
- rcPart = rcBarWnd;
- rcPart.bottom = rcPart.top + nHeight3;
- if( rcPart.PtInRect(ptTrack) )
- {
- if( bTabbedDest )
- m_eCDT = __ECDT_TABBED_UPDATE;
- else
- m_eCDT = __ECDT_TABBED_NEW;
- rcPart = rcBarWnd;
- break;
- }
- nTabbedShift = nHeight3;
- rcPart.OffsetRect( 0, nTabbedShift );
- }
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- rcPart = rcBarWnd;
- rcPart.bottom = rcPart.top + nHeight3;
- }
-
- bool bCanDockLTRB =
- ( m_pExtBarSrc->_CanDockLTRB( m_pExtBarDst )
- && m_pExtBarDst->_CanDockLTRB( m_pExtBarSrc )
- ) ? true : false;
- if( ! bCanDockLTRB )
- {
- m_eCDT = __ECDT_FLOATED;
- bForceFloatMode = true;
- break;
- } // if( bCanDockLTRB )
-
- if( rcPart.PtInRect(ptTrack) )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart.OffsetRect( 0, -nTabbedShift );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_TOP;
- rcPart.bottom = rcPart.top + rcBarWnd.Height()/2; // + nHeight2;
- rcPart.left = min( rcPart.left, rcWndDockBar.left );
- rcPart.right = max( rcPart.right, rcWndDockBar.right );
- break;
- } // if( rcPart.PtInRect(ptTrack) )
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart = rcBarWnd;
- INT nBottomShift = 0;
- if( bCanDockToTabbedContainers
- //&& (!bShowContent)
- && bTabbedDest
- )
- {
- CExtDynTabControlBar * pTabbedBar =
- (CExtDynTabControlBar *)m_pExtBarDst;
- CRect rcTabSwitcher;
- pTabbedBar->GetSwitcherWindowRect( rcTabSwitcher );
- if( rcTabSwitcher.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_TABBED_REINDEX;
- ReindexPosCalc( ptTrack );
- break;
- }
- nBottomShift = rcTabSwitcher.Size().cy;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart = rcBarWnd;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart.bottom -= nBottomShift;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart.top = rcPart.bottom - nHeight3;
- if( rcPart.PtInRect(ptTrack) )
- {
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_BOTTOM;
- rcPart.top = rcPart.bottom - rcBarWnd.Height()/2; // - nHeight2;
- rcPart.left = min( rcPart.left, rcWndDockBar.left );
- rcPart.right = max( rcPart.right, rcWndDockBar.right );
- break;
- } // if( rcPart.PtInRect(ptTrack) )
- } // if can do half splitting
-
- INT nHalfWidth = rcBarWnd.Width()/2;
- if( rcBarWnd.Height() >= nSrcMinVH
- && nHalfWidth >= nSrcMinHW
- && nHalfWidth >= nDstMinHW
- )
- { // if can do half splitting
- rcPart = rcBarWnd;
- rcPart.right = rcPart.left + nWidth3;
- if( rcPart.PtInRect(ptTrack) )
- {
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_LEFT;
- rcPart.right = rcPart.left + rcBarWnd.Width()/2; // + nWidth2;
- rcPart.top = min( rcPart.top, rcWndDockBar.top );
- rcPart.bottom = max( rcPart.bottom, rcWndDockBar.bottom );
- break;
- } // if( rcPart.PtInRect(ptTrack) )
- rcPart = rcBarWnd;
- rcPart.left = rcPart.right - nWidth3;
- if( rcPart.PtInRect(ptTrack) )
- {
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_RIGHT;
- rcPart.left = rcPart.right - rcBarWnd.Width()/2; // - nWidth2;
- rcPart.top = min( rcPart.top, rcWndDockBar.top );
- rcPart.bottom = max( rcPart.bottom, rcWndDockBar.bottom );
- break;
- } // if( rcPart.PtInRect(ptTrack) )
- } // if can do half splitting
- } // SINGLE LOOP
- while( false );
- // if( m_bDeepHalfSplit )
- // {
- // if( m_pExtBarDst->IsSingleOnRow() )
- // m_bDeepHalfSplit = false;
- // } // if( m_bDeepHalfSplit )
- if( m_eCDT != __ECDT_FLOATED )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_bDeepHalfSplit
- && ( m_eCDT == __ECDT_TABBED_NEW
- || m_eCDT == __ECDT_TABBED_UPDATE
- || m_eCDT == __ECDT_TABBED_REINDEX
- || m_eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- )
- m_bDeepHalfSplit = false;
- ASSERT(
- ( m_bDeepHalfSplit
- && m_eCDT != __ECDT_TABBED_NEW
- && m_eCDT != __ECDT_TABBED_UPDATE
- && m_eCDT != __ECDT_TABBED_REINDEX
- && m_eCDT != __ECDT_TABBED_REINDEX_NHM
- )
- ||
- ( (!m_bDeepHalfSplit)
- && ( m_eCDT == __ECDT_TABBED_NEW
- || m_eCDT == __ECDT_TABBED_UPDATE
- || m_eCDT == __ECDT_TABBED_REINDEX
- || m_eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- )
- );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // if( bHorz )
- // {
- if( rcPart.Width() < nSrcMinHW )
- m_eCDT = __ECDT_FLOATED;
- // } // if( bHorz )
- // else
- // {
- if( rcPart.Height() < nSrcMinVH )
- m_eCDT = __ECDT_FLOATED;
- // } // else from if( bHorz )
- if( m_eCDT != __ECDT_FLOATED )
- rcBarWnd = rcPart;
- } // if( m_eCDT != __ECDT_FLOATED )
-
- } // if( bEnableInnerDock && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_ANY) != 0 )
- } // if( pDesiredBar != NULL )
- } // try to analyze docking into floating bars
- if( bCanDockToInnerCircles && m_eCDT == __ECDT_FLOATED && (!bForceFloatMode) )
- {
- // first try calc by circle 0 inner part
- CRect rcCircle0( 0, 0, 0, 0 );
- CExtDockBar * vDockBars0[4];
- INT nDockSide = 0;
- for( nDockSide = 0; nDockSide < 4; nDockSide++ )
- {
- UINT nDockBarID =
- _dwDockBarMap[ nDockSide ] [ 0 ];
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- vDockBars0[ nDockSide ] = (CExtDockBar *)
- pFrame->GetControlBar( nDockBarID );
- ASSERT_VALID( vDockBars0[ nDockSide ] );
- ASSERT_KINDOF( CExtDockBar, vDockBars0[ nDockSide ] );
- ASSERT( vDockBars0[ nDockSide ] -> _GetCircleNo() == 0 );
- CRect rcDockBar;
- vDockBars0[ nDockSide ]->_GetPreCalcWindowRect( rcDockBar );
- switch( nDockBarID )
- {
- case AFX_IDW_DOCKBAR_TOP:
- rcCircle0.top = rcDockBar.bottom;
- break;
- case AFX_IDW_DOCKBAR_BOTTOM:
- rcCircle0.bottom = rcDockBar.top;
- break;
- case AFX_IDW_DOCKBAR_LEFT:
- rcCircle0.left = rcDockBar.right;
- break;
- case AFX_IDW_DOCKBAR_RIGHT:
- rcCircle0.right = rcDockBar.left;
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( nDockBarID )
- } // for( nDockSide = 0; nDockSide < 4; nDockSide++ )
- // ASSERT( rcFrameWnd.left <= rcCircle0.left );
- // ASSERT( rcFrameWnd.top <= rcCircle0.top );
- // ASSERT( rcFrameWnd.right >= rcCircle0.right );
- // ASSERT( rcFrameWnd.bottom >= rcCircle0.bottom );
- CRect rcTestCircle0( rcCircle0 );
- //rcTestCircle0.InflateRect( nRdpOuter, nRdpOuter );
- rcTestCircle0.InflateRect( nRdpMostInner, nRdpMostInner );
- if( rcCircle0.left < rcCircle0.right
- && rcCircle0.top < rcCircle0.bottom
- && rcTestCircle0.PtInRect( ptTrack )
- )
- { // if we have sense analyze docking into circle 0 inner part/circle 1 outer part
- for( nDockSide = 0; nDockSide < 4; nDockSide++ )
- {
- DWORD dwDockStyle =
- _dwDockBarMap[ nDockSide ] [ 1 ];
- if( (m_pExtBarSrc->m_dwDockStyle & dwDockStyle) == 0 )
- continue; // can not dock at this side
- UINT nDockBarID =
- _dwDockBarMap[ nDockSide ] [ 0 ];
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- CRect rcFrameAnalyze( rcTestCircle0 );
- switch( nDockBarID )
- {
- case AFX_IDW_DOCKBAR_TOP:
- {
- //rcFrameAnalyze.top -= nRdpMostInner;
- rcFrameAnalyze.bottom =
- rcFrameAnalyze.top + nRdpOuter;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_CIRCLE1_OUTER_TOP;
- m_nCircleNo = 1;
- rcBarWnd.top = rcCircle0.top;
- rcBarWnd.bottom =
- rcBarWnd.top +
- m_pExtBarSrc->m_sizeDockedH.cy;
- rcBarWnd.left = rcCircle0.left;
- rcBarWnd.right = rcCircle0.right;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- }
- break; // case AFX_IDW_DOCKBAR_TOP
- case AFX_IDW_DOCKBAR_BOTTOM:
- {
- //rcFrameAnalyze.bottom += nRdpMostInner;
- rcFrameAnalyze.top =
- rcFrameAnalyze.bottom - nRdpOuter;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_CIRCLE1_OUTER_BOTTOM;
- m_nCircleNo = 1;
- rcBarWnd.bottom = rcCircle0.bottom;
- rcBarWnd.top =
- rcBarWnd.bottom -
- m_pExtBarSrc->m_sizeDockedH.cy;
- rcBarWnd.left = rcCircle0.left;
- rcBarWnd.right = rcCircle0.right;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- }
- break; // case AFX_IDW_DOCKBAR_BOTTOM
- case AFX_IDW_DOCKBAR_LEFT:
- {
- //rcFrameAnalyze.left -= nRdpMostInner;
- rcFrameAnalyze.right =
- rcFrameAnalyze.left + nRdpOuter;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_CIRCLE1_OUTER_LEFT;
- m_nCircleNo = 1;
-
- rcBarWnd.left = rcCircle0.left;
- rcBarWnd.right =
- rcBarWnd.left +
- m_pExtBarSrc->m_sizeDockedV.cx;
- rcBarWnd.top = rcCircle0.top;
- rcBarWnd.bottom = rcCircle0.bottom;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- }
- break; // case AFX_IDW_DOCKBAR_LEFT
- case AFX_IDW_DOCKBAR_RIGHT:
- {
- //rcFrameAnalyze.right += nRdpMostInner;
- rcFrameAnalyze.left =
- rcFrameAnalyze.right - nRdpOuter;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_CIRCLE1_OUTER_RIGHT;
- m_nCircleNo = 1;
-
- rcBarWnd.right = rcCircle0.right;
- rcBarWnd.left =
- rcBarWnd.right -
- m_pExtBarSrc->m_sizeDockedV.cx;
- rcBarWnd.top = rcCircle0.top;
- rcBarWnd.bottom = rcCircle0.bottom;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- } // case AFX_IDW_DOCKBAR_RIGHT
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( nDockBarID )
- if( m_eCDT != __ECDT_FLOATED )
- break;
- } // for( nDockSide = 0; nDockSide < 4; nDockSide++ )
- } // if we have sense analyze docking into circle 0 inner part/circle 1 outer part
- if( m_eCDT == __ECDT_FLOATED )
- { // try calc by most inner dockbars
- CRect rcFrameTest( rcFrameWnd );
- rcFrameTest.InflateRect( nRdpInner, nRdpInner );
- if( rcFrameTest.PtInRect( ptTrack ) )
- {
-
- CRect rcFrameInner;
- pFrame->GetClientRect( &rcFrameInner );
- RepositionBarsEx(
- pFrame,
- 0,
- 0x0FFFF,
- AFX_IDW_PANE_FIRST,
- CWnd::reposQuery,
- rcFrameInner,
- rcFrameInner
- );
- // pFrame->RepositionBars(
- // 0,
- // 0x0FFFF,
- // AFX_IDW_PANE_FIRST,
- // CWnd::reposQuery,
- // rcFrameInner,
- // rcFrameInner
- // );
- pFrame->ClientToScreen( &rcFrameInner );
- if( rcFrameInner.left < rcFrameInner.right
- && rcFrameInner.top < rcFrameInner.bottom
- && rcFrameInner.PtInRect( ptTrack )
- )
- { // if we have any space to dock into inner circle
- // ASSERT( rcFrameWnd.left <= rcFrameInner.left );
- // ASSERT( rcFrameWnd.top <= rcFrameInner.top );
- // ASSERT( rcFrameWnd.right >= rcFrameInner.right );
- // ASSERT( rcFrameWnd.bottom >= rcFrameInner.bottom );
- CSize _sizeMaxInner = rcFrameInner.Size();
- _sizeMaxInner.cx = ::MulDiv( _sizeMaxInner.cx, 3, 4 );
- _sizeMaxInner.cy = ::MulDiv( _sizeMaxInner.cy, 3, 4 );
- UINT nSrcBarCircleNo =
- ((CExtDockBar *)m_pExtBarSrc->m_pDockBar)->_GetCircleNo();
- for( nDockSide = 0; nDockSide < 4; nDockSide++ )
- {
- DWORD dwDockStyle =
- _dwDockBarMap[ nDockSide ] [ 1 ];
- if( (m_pExtBarSrc->m_dwDockStyle & dwDockStyle) == 0 )
- continue; // can not dock at this side
- UINT nDockBarID =
- _dwDockBarMap[ nDockSide ] [ 0 ];
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- CExtDockBar * pDockBar = vDockBars0[ nDockSide ];
- ASSERT_VALID( pDockBar );
- ASSERT_KINDOF( CExtDockBar, pDockBar );
- ASSERT( pDockBar->_GetCircleNo() == 0 );
- if( bShowContent && m_pExtBarSrc->IsDocked() )
- {
- ASSERT( m_pExtBarSrc->m_pDockBar != NULL );
- ASSERT_VALID( m_pExtBarSrc->m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pExtBarSrc->m_pDockBar );
- if( pDockBar == m_pExtBarSrc->m_pDockBar )
- {
- CRect rcDockBar;
- pDockBar->GetWindowRect( &rcDockBar );
- if( rcDockBar.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_OWN_AREA;
- nDstMinHW = nSrcMinHW;
- nDstMinVH = nSrcMinVH;
- return;
- }
- continue;
- } // if( pDockBar == m_pExtBarSrc->m_pDockBar )
- } // if( bShowContent && m_pExtBarSrc->IsDocked() )
- pDockBar = pDockBar->_GetDockBarInnerTop();
- ASSERT_VALID( pDockBar );
- ASSERT_KINDOF( CExtDockBar, pDockBar );
-
- CRect rcFrameAnalyze( rcFrameInner );
- switch( nDockBarID )
- {
- case AFX_IDW_DOCKBAR_TOP:
- {
- rcFrameAnalyze.bottom =
- rcFrameAnalyze.top + nRdpMostInner;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_DOCKBAR_INNER_TOP;
- m_nCircleNo = pDockBar->_GetCircleNo();
- bool bDeepCircleTarget = false;
- if( m_nCircleNo <= (nSrcBarCircleNo + 2) )
- bDeepCircleTarget = true;
- if( !bDeepCircleTarget )
- {
- CExtDockBar * pBarLeft =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_LEFT );
- ASSERT_VALID( pBarLeft );
- CExtDockBar * pBarRight =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_RIGHT );
- ASSERT_VALID( pBarRight );
- if( !pBarLeft->_CanBeSafeOptimized()
- || !pBarLeft->_CanBeSafeOptimized()
- )
- bDeepCircleTarget = true;
- }
- if( bDeepCircleTarget )
- m_nCircleNo++;
- rcBarWnd.top = rcFrameInner.top;
- rcBarWnd.bottom =
- rcBarWnd.top
- +
- min(
- m_pExtBarSrc->m_sizeDockedH.cy,
- _sizeMaxInner.cy
- );
- rcBarWnd.left = rcFrameInner.left;
- rcBarWnd.right = rcFrameInner.right;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- }
- break; // case AFX_IDW_DOCKBAR_TOP
- case AFX_IDW_DOCKBAR_BOTTOM:
- {
- rcFrameAnalyze.top =
- rcFrameAnalyze.bottom - nRdpMostInner;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_DOCKBAR_INNER_BOTTOM;
- m_nCircleNo = pDockBar->_GetCircleNo();
- bool bDeepCircleTarget = false;
- if( m_nCircleNo <= (nSrcBarCircleNo + 2) )
- bDeepCircleTarget = true;
- if( !bDeepCircleTarget )
- {
- CExtDockBar * pBarLeft =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_LEFT );
- ASSERT_VALID( pBarLeft );
- CExtDockBar * pBarRight =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_RIGHT );
- ASSERT_VALID( pBarRight );
- if( !pBarLeft->_CanBeSafeOptimized()
- || !pBarLeft->_CanBeSafeOptimized()
- )
- bDeepCircleTarget = true;
- }
- if( bDeepCircleTarget )
- m_nCircleNo++;
- rcBarWnd.bottom = rcFrameInner.bottom;
- rcBarWnd.top =
- rcBarWnd.bottom
- -
- min(
- m_pExtBarSrc->m_sizeDockedH.cy,
- _sizeMaxInner.cy
- );
- rcBarWnd.left = rcFrameInner.left;
- rcBarWnd.right = rcFrameInner.right;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- }
- break; // case AFX_IDW_DOCKBAR_BOTTOM
- case AFX_IDW_DOCKBAR_LEFT:
- {
- rcFrameAnalyze.right =
- rcFrameAnalyze.left + nRdpMostInner;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_DOCKBAR_INNER_LEFT;
- m_nCircleNo = pDockBar->_GetCircleNo();
- bool bDeepCircleTarget = false;
- if( m_nCircleNo <= (nSrcBarCircleNo + 2) )
- bDeepCircleTarget = true;
- if( !bDeepCircleTarget )
- {
- CExtDockBar * pBarTop =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_TOP );
- ASSERT_VALID( pBarTop );
- CExtDockBar * pBarBottom =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_BOTTOM );
- ASSERT_VALID( pBarBottom );
- if( !pBarTop->_CanBeSafeOptimized()
- || !pBarBottom->_CanBeSafeOptimized()
- )
- bDeepCircleTarget = true;
- }
- if( bDeepCircleTarget )
- m_nCircleNo++;
-
- rcBarWnd.left = rcFrameInner.left;
- rcBarWnd.right =
- rcBarWnd.left
- +
- min(
- m_pExtBarSrc->m_sizeDockedV.cx,
- _sizeMaxInner.cx
- );
- rcBarWnd.top = rcFrameInner.top;
- rcBarWnd.bottom = rcFrameInner.bottom;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- }
- break; // case AFX_IDW_DOCKBAR_LEFT
- case AFX_IDW_DOCKBAR_RIGHT:
- {
- rcFrameAnalyze.left =
- rcFrameAnalyze.right - nRdpMostInner;
- if( rcFrameAnalyze.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_DOCKBAR_INNER_RIGHT;
- m_nCircleNo = pDockBar->_GetCircleNo();
- bool bDeepCircleTarget = false;
- if( m_nCircleNo <= (nSrcBarCircleNo + 2) )
- bDeepCircleTarget = true;
- if( !bDeepCircleTarget )
- {
- CExtDockBar * pBarTop =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_TOP );
- ASSERT_VALID( pBarTop );
- CExtDockBar * pBarBottom =
- pDockBar->_GetInCircle( AFX_IDW_DOCKBAR_BOTTOM );
- ASSERT_VALID( pBarBottom );
- if( !pBarTop->_CanBeSafeOptimized()
- || !pBarBottom->_CanBeSafeOptimized()
- )
- bDeepCircleTarget = true;
- }
- if( bDeepCircleTarget )
- m_nCircleNo++;
-
- rcBarWnd.right = rcFrameInner.right;
- rcBarWnd.left =
- rcBarWnd.right
- -
- min(
- m_pExtBarSrc->m_sizeDockedV.cx,
- _sizeMaxInner.cx
- );
- rcBarWnd.top = rcFrameInner.top;
- rcBarWnd.bottom = rcFrameInner.bottom;
- } // if( rcFrameAnalyze.PtInRect(ptTrack) )
- } // case AFX_IDW_DOCKBAR_RIGHT
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( nDockBarID )
- if( m_eCDT != __ECDT_FLOATED )
- break;
- } // for( nDockSide = 0; nDockSide < 4; nDockSide++ )
- } // if we have any space to dock into inner circle
- } // if( rcFrameTest.PtInRect( ptTrack ) )
- } // try calc by most inner dockbars
- } // if( bCanDockToInnerCircles && m_eCDT == __ECDT_FLOATED )
- if( m_eCDT == __ECDT_FLOATED && (!bForceFloatMode) )
- { // try calc by other bar
-
- ExtControlBarVector_t vBars;
- m_pExtBarSrc->_GetFrameControlBars(
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- ( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- ? true :
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- false,
- vBars,
- (DWORD)(
- __GFECB_NONFIXED_NONMIN //|__GFECB_FIXED
- |__GFECB_DOCKED
- |__GFECB_VIS_ALL
- |__GFECB_BYPT_ONLY_WND
- ),
- ptTrack
- );
- INT nCountOfBars = (INT)vBars.GetSize();
- ASSERT( nCountOfBars >= 0 && nCountOfBars <= 1 );
- if( nCountOfBars == 1 )
- {
- m_pExtBarDst = vBars[0];
- //ExtBarDstSet( vBars[0] );
- ASSERT_VALID( m_pExtBarDst );
- m_pExtBarDst->GetWindowRect( &rcBarWnd );
- if( m_pExtBarDst == m_pExtBarSrc )
- {
- m_eCDT = __ECDT_OWN_AREA;
-
- nDstMinHW = nSrcMinHW;
- nDstMinVH = nSrcMinVH;
- } // if( m_pExtBarDst == m_pExtBarSrc )
- else //if( ! bShowContent )
- {
- m_eCDT = __ECDT_FLOATED;
- bool bCanAnalyzeInnerParts = true;
- if( !bCanDockToInnerCircles )
- {
- ASSERT_VALID( m_pExtBarDst->m_pDockBar );
- CExtDockBar * pDockBarDst =
- STATIC_DOWNCAST( CExtDockBar, m_pExtBarDst->m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, pDockBarDst );
- if( pDockBarDst->_GetCircleNo() > 0 )
- bCanAnalyzeInnerParts = false;
- }
- if( bCanAnalyzeInnerParts && m_pExtBarDst != NULL )
- {
- nDstMinHW = m_pExtBarDst->_CalcDesiredMinHW();
- nDstMinVH = m_pExtBarDst->_CalcDesiredMinVH();
- INT nWidth3 = nRdpInner; // rcBarWnd.Width();
- INT nHeight3 = nRdpInner; // rcBarWnd.Height();
- // INT nWidth2 = nWidth / 2;
- // INT nHeight2 = nHeight / 2;
- // INT nWidth3 = nWidth / 4;
- // INT nHeight3 = nHeight / 4;
- ASSERT_VALID( m_pExtBarDst );
- UINT nDockBarID =
- m_pExtBarDst->GetSafeDockBarDlgCtrlID();
- if( nDockBarID == AFX_IDW_DOCKBAR_FLOAT )
- nDockBarID = AFX_IDW_DOCKBAR_TOP;
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- bool bHorz =
- ( nDockBarID == AFX_IDW_DOCKBAR_TOP
- || nDockBarID == AFX_IDW_DOCKBAR_BOTTOM
- ) ? true : false;
- ASSERT( m_pExtBarDst->m_pDockBar != NULL );
- // CExtDockBar * pDockBar =
- // STATIC_DOWNCAST( CExtDockBar, m_pExtBarDst->m_pDockBar );
- CDockBar * pDockBar = m_pExtBarDst->m_pDockBar;
- ASSERT_VALID( pDockBar );
- // if( bShowContent && m_pExtBarSrc->IsDocked() )
- // {
- // ASSERT( m_pExtBarDst->IsDocked() );
- // ASSERT_VALID( m_pExtBarSrc->m_pDockBar );
- // if( m_pExtBarSrc->m_pDockBar == pDockBar )
- // {
- // CRect rcWndTargetBar, rcWndSrcBar;
- // m_pExtBarDst->GetWindowRect( &rcWndTargetBar );
- // m_pExtBarSrc->GetWindowRect( &rcWndSrcBar );
- // rcWndTargetBar.InflateRect( 2, 2 );
- // if( bHorz )
- // {
- // if( abs(rcWndSrcBar.top-rcWndTargetBar.bottom) <= 2
- // || abs(rcWndSrcBar.bottom-rcWndTargetBar.top) <= 2
- // )
- // {
- // rcWndSrcBar.InflateRect( 2, 0 );
- // if( rcWndSrcBar.left < rcWndTargetBar.right
- // && rcWndTargetBar.right < rcWndSrcBar.right
- // ||
- // rcWndSrcBar.left < rcWndTargetBar.left
- // && rcWndTargetBar.left < rcWndSrcBar.right
- // )
- // {
- // m_eCDT = __ECDT_OWN_AREA;
- // nDstMinHW = nSrcMinHW;
- // nDstMinVH = nSrcMinVH;
- // return;
- // }
- // }
- // } // if( bHorz )
- // else
- // {
- // if( abs(rcWndSrcBar.left-rcWndTargetBar.right) <= 2
- // || abs(rcWndSrcBar.right-rcWndTargetBar.left) <= 2
- // )
- // {
- // rcWndSrcBar.InflateRect( 0, 2 );
- // if( rcWndSrcBar.top < rcWndTargetBar.bottom
- // && rcWndTargetBar.bottom < rcWndSrcBar.bottom
- // ||
- // rcWndSrcBar.top < rcWndTargetBar.top
- // && rcWndTargetBar.top < rcWndSrcBar.bottom
- // )
- // {
- // m_eCDT = __ECDT_OWN_AREA;
- // nDstMinHW = nSrcMinHW;
- // nDstMinVH = nSrcMinVH;
- // return;
- // }
- // }
- // } // else from if( bHorz )
- // } // if( m_pExtBarSrc->m_pDockBar == pDockBar )
- // } // if( bShowContent && m_pExtBarSrc->IsDocked() )
- bool bEnableInnerDock = true;
- if( nDockBarID == AFX_IDW_DOCKBAR_LEFT
- && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_LEFT) == 0
- )
- bEnableInnerDock = false;
- if( nDockBarID == AFX_IDW_DOCKBAR_RIGHT
- && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_RIGHT) == 0
- )
- bEnableInnerDock = false;
- if( nDockBarID == AFX_IDW_DOCKBAR_TOP
- && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_TOP) == 0
- )
- bEnableInnerDock = false;
- if( nDockBarID == AFX_IDW_DOCKBAR_BOTTOM
- && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_BOTTOM) == 0
- )
- bEnableInnerDock = false;
-
- if( bEnableInnerDock && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_ANY) != 0 )
- {
- m_bDeepHalfSplit = false;
- if( !m_pExtBarDst->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar))
- || m_pExtBarDst->IsFloating()
- )
- m_bDeepHalfSplit = true;
-
- CRect rcWndDockBar;
- pDockBar->GetWindowRect( &rcWndDockBar );
-
- CRect rcPart( rcBarWnd );
- do
- { // SINGLE LOOP
-
- INT nHalfHeight = nRdpInner*2; // rcBarWnd.Height()/2;
- if( rcBarWnd.Width() >= nSrcMinHW
- && nHalfHeight >= nSrcMinVH
- && nHalfHeight >= nDstMinVH
- )
- { // if can do half splitting
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- BOOL bTabbedDest =
- m_pExtBarDst->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar))
- && ( ((CExtDynTabControlBar*)m_pExtBarDst)->IsSwitcherVisible() )
- ;
- INT nTabbedShift = 0;
- bool bCanDockToTabbedContainers =
- ( m_pExtBarSrc->_CanDockToTabbedContainers( m_pExtBarDst )
- && m_pExtBarDst->_CanDockToTabbedContainers( m_pExtBarSrc )
- ) ? true : false;
- if( bCanDockToTabbedContainers )
- {
- rcPart = rcBarWnd;
- if( g_bTabsAtTop )
- rcPart.top = rcPart.bottom - nHeight3;
- else
- rcPart.bottom = rcPart.top + nHeight3;
- if( rcPart.PtInRect(ptTrack) )
- {
- if( bTabbedDest )
- m_eCDT = __ECDT_TABBED_UPDATE;
- else
- m_eCDT = __ECDT_TABBED_NEW;
- rcPart = rcBarWnd;
- break;
- }
- if( g_bTabsAtTop )
- {
- //rcPart = rcBarWnd;
- m_pExtBarDst->GetClientRect( &rcPart );
- rcPart.bottom = rcPart.top + nHeight3;
- nTabbedShift = nHeight3;
- //rcPart.OffsetRect( 0, nTabbedShift );
- }
- else
- {
- nTabbedShift = nHeight3;
- rcPart.OffsetRect( 0, nTabbedShift );
- }
- }
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- rcPart = rcBarWnd;
- rcPart.bottom = rcPart.top + nHeight3;
- }
-
- if( rcPart.PtInRect(ptTrack) )
- {
- if( !bShowContent || !bHorz )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( g_bTabsAtTop )
- rcPart.OffsetRect( 0, nTabbedShift );
- else
- rcPart.OffsetRect( 0, -nTabbedShift );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_TOP;
- rcPart.bottom = rcPart.top + rcBarWnd.Height()/2; // + nHeight2;
-
- if( bHorz && !m_bDeepHalfSplit )
- {
- rcPart.left = min( rcPart.left, rcWndDockBar.left );
- rcPart.right = max( rcPart.right, rcWndDockBar.right );
- }
- break;
- } // if( !bShowContent || !bHorz )
- } // if( rcPart.PtInRect(ptTrack) )
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart = rcBarWnd;
- INT nBottomShift = 0;
- if( bCanDockToTabbedContainers
- //&& (!bShowContent)
- && bTabbedDest
- )
- {
- CExtDynTabControlBar * pTabbedBar =
- (CExtDynTabControlBar *)m_pExtBarDst;
- CRect rcTabSwitcher;
- pTabbedBar->GetSwitcherWindowRect( rcTabSwitcher );
- if( rcTabSwitcher.PtInRect(ptTrack) )
- {
- m_eCDT = __ECDT_TABBED_REINDEX;
- ReindexPosCalc( ptTrack );
- break;
- }
- nBottomShift = rcTabSwitcher.Size().cy;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart = rcBarWnd;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart.bottom -= nBottomShift;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- rcPart.top = rcPart.bottom - nHeight3;
- if( rcPart.PtInRect(ptTrack) )
- {
- if( !bShowContent || !bHorz )
- {
- /*
- CRect rcDeep(
- rcPart.left,
- rcPart.top,
- rcPart.right,
- rcPart.bottom-rcPart.Height()/2
- );
- m_bDeepHalfSplit =
- rcDeep.PtInRect(ptTrack) ? true : false;
- */
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_BOTTOM;
- rcPart.top = rcPart.bottom - rcBarWnd.Height()/2;// - nHeight2;
-
- if( bHorz && !m_bDeepHalfSplit )
- {
- rcPart.left = min( rcPart.left, rcWndDockBar.left );
- rcPart.right = max( rcPart.right, rcWndDockBar.right );
- }
- break;
- } // if( !bShowContent || !bHorz )
- } // if( rcPart.PtInRect(ptTrack) )
- } // if can do half splitting
-
- INT nHalfWidth = nRdpInner*2; // rcBarWnd.Width()/2;
- if( rcBarWnd.Height() >= nSrcMinVH
- && nHalfWidth >= nSrcMinHW
- && nHalfWidth >= nDstMinHW
- )
- { // if can do half splitting
- rcPart = rcBarWnd;
- rcPart.right = rcPart.left + nWidth3;
- if( rcPart.PtInRect(ptTrack) )
- {
- if( !bShowContent || bHorz )
- {
- /*
- CRect rcDeep(
- rcPart.left+rcPart.Width()/2,
- rcPart.top,
- rcPart.right,
- rcPart.bottom
- );
- m_bDeepHalfSplit =
- rcDeep.PtInRect(ptTrack) ? true : false;
- */
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_LEFT;
- rcPart.right = rcPart.left + rcBarWnd.Width()/2; // + nWidth2;
-
- if( !bHorz && !m_bDeepHalfSplit )
- {
- rcPart.top = min( rcPart.top, rcWndDockBar.top );
- rcPart.bottom = max( rcPart.bottom, rcWndDockBar.bottom );
- }
- break;
- } // if( !bShowContent || bHorz )
- } // if( rcPart.PtInRect(ptTrack) )
- rcPart = rcBarWnd;
- rcPart.left = rcPart.right - nWidth3;
- if( rcPart.PtInRect(ptTrack) )
- {
- if( !bShowContent || bHorz )
- {
- /*
- CRect rcDeep(
- rcPart.left,
- rcPart.top,
- rcPart.right-rcPart.Width()/2,
- rcPart.bottom
- );
- m_bDeepHalfSplit =
- rcDeep.PtInRect(ptTrack) ? true : false;
- */
- m_bDeepHalfSplit = true;
- m_eCDT = __ECDT_INNER_RIGHT;
- rcPart.left = rcPart.right - rcBarWnd.Width()/2; // - nWidth2;
-
- if( !bHorz && !m_bDeepHalfSplit )
- {
- rcPart.top = min( rcPart.top, rcWndDockBar.top );
- rcPart.bottom = max( rcPart.bottom, rcWndDockBar.bottom );
- }
- break;
- } // if( !bShowContent || bHorz )
- } // if( rcPart.PtInRect(ptTrack) )
- } // if can do half splitting
- } // SINGLE LOOP
- while( false );
- if( m_bDeepHalfSplit )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_bDeepHalfSplit
- && ( m_eCDT == __ECDT_TABBED_NEW
- || m_eCDT == __ECDT_TABBED_UPDATE
- || m_eCDT == __ECDT_TABBED_REINDEX
- || m_eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- )
- m_bDeepHalfSplit = false;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // if( m_pExtBarDst->IsFloating()
- // || m_pExtBarDst->IsSingleOnRow()
- // )
- // m_bDeepHalfSplit = false;
- if( !m_pExtBarDst->IsFloating()
- && m_pExtBarDst->IsSingleOnRow()
- )
- m_bDeepHalfSplit = false;
- } // if( m_bDeepHalfSplit )
- if( m_eCDT != __ECDT_FLOATED )
- {
- if( bHorz )
- {
- if( rcPart.Width() < nSrcMinHW )
- m_eCDT = __ECDT_FLOATED;
- } // if( bHorz )
- else
- {
- if( rcPart.Height() < nSrcMinVH )
- m_eCDT = __ECDT_FLOATED;
- } // else from if( bHorz )
- if( m_eCDT != __ECDT_FLOATED )
- rcBarWnd = rcPart;
- } // if( m_eCDT != __ECDT_FLOATED )
-
- } // if( bEnableInnerDock && (m_pExtBarSrc->m_dwDockStyle&CBRS_ALIGN_ANY) != 0 )
- } // if( bCanAnalyzeInnerParts && m_pExtBarDst != NULL )
- } // else if( !bShowContent ) -> else from if( m_pExtBarDst == m_pExtBarSrc )
- } // if( nCountOfBars == 1 )
- } // try calc by other bar
- } // if( !CExtPopupMenuWnd::IsKeyPressed(VK_CONTROL) ....
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- && m_eCDT != __ECDT_FLOATED
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- && m_eCDT != __ECDT_TABBED_REINDEX
- && m_eCDT != __ECDT_TABBED_REINDEX_NHM
- && m_eCDT != __ECDT_TABBED_UPDATE
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- )
- m_eCDT = __ECDT_FLOATED;
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( m_eCDT == __ECDT_FLOATED )
- {
- //m_pExtBarDst = NULL;
- ExtBarDstSet( NULL );
- if( m_pExtBarSrc->IsFloating() )
- {
- CMiniDockFrameWnd * pMiniFrame =
- DYNAMIC_DOWNCAST(
- CMiniDockFrameWnd,
- m_pExtBarSrc->GetDockingFrame()
- );
- ASSERT_VALID( pMiniFrame );
- pMiniFrame->GetWindowRect( &rcBarWnd );
- rcBarWnd.OffsetRect( -rcBarWnd.TopLeft() );
- rcBarWnd.OffsetRect(
- ptTrack - m_pExtBarSrc->m_ptHelperDragOffsetFloated
- );
- CRect rcGrip = m_pExtBarSrc->_RectGripGet();
- INT nCyGripper = min( rcGrip.Width(), rcGrip.Height() );
- rcBarWnd.OffsetRect( -nCyGripper, -nCyGripper/2 );
- } // if( m_pExtBarSrc->IsFloating() )
- else
- {
- rcBarWnd.SetRect(
- ptTrack,
- ptTrack + m_pExtBarSrc->m_sizeFloated
- );
- rcBarWnd.OffsetRect(
- - m_pExtBarSrc->m_ptHelperDragOffsetFloated
- );
- } // else from if( m_pExtBarSrc->IsFloating() )
- rcBarWnd.OffsetRect( rcFrameWnd.TopLeft() );
- } // if( m_eCDT == __ECDT_FLOATED )
- TrackRectSet( &rcBarWnd );
- }
- #define __RECALC_FRAME_STEPS( __FRAME_PTR__ )
- ( (__FRAME_PTR__)->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd))
- ? (__FRAME_PTR__)->RecalcLayout()
- : (__FRAME_PTR__)->DelayRecalcLayout() )
- void CExtControlBar::_DraggingDoDeepHalfSplit(
- CExtControlBar * pExtBar,
- UINT nHalfSplitID, // one of AFX_IDW_DOCKBAR_... docked value
- int nPercentToOccupy // = 50 // greater then zero and less then one hundred
- )
- {
- ASSERT_VALID( this );
- ASSERT_KINDOF( CExtControlBar, this );
- ASSERT( !IsFixedMode() );
- ASSERT_VALID( m_pDockSite );
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CDockBar, m_pDockBar );
-
- ASSERT_VALID( pExtBar );
- ASSERT_KINDOF( CExtControlBar, pExtBar );
- ASSERT( !pExtBar->IsFixedMode() );
- ASSERT( 0 < nPercentToOccupy && nPercentToOccupy < 100 );
- #ifdef _DEBUG
- if( pExtBar->m_pDockBar != NULL )
- {
- ASSERT_VALID( pExtBar->m_pDockSite );
- ASSERT_VALID( pExtBar->m_pDockBar );
- ASSERT_KINDOF( CDockBar, pExtBar->m_pDockBar );
- ASSERT( pExtBar->m_pDockSite == m_pDockSite );
- }
- #endif // _DEBUG
-
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nHalfSplitID );
- CDockBar * pDockBarIn = m_pDockBar;
- // STATIC_DOWNCAST( CExtDockBar, m_pDockBar );
- CDockBar * pDockBarOut = pExtBar->m_pDockBar;
- // STATIC_DOWNCAST( CExtDockBar, pExtBar->m_pDockBar );
- CRect rcDyn;
- GetWindowRect( &rcDyn );
- CRect rcIn( rcDyn );
- CRect rcOut( rcDyn );
- pDockBarIn->ScreenToClient( &rcDyn );
- UINT nNewID = AFX_IDW_DOCKBAR_TOP;
- DWORD nBarStyle = CBRS_ALIGN_TOP;
- switch( nHalfSplitID )
- {
- case AFX_IDW_DOCKBAR_TOP:
- nNewID = AFX_IDW_DOCKBAR_LEFT;
- nBarStyle = CBRS_ALIGN_LEFT;
- //rcIn.top += rcIn.Height()/2;
- rcIn.top += ::MulDiv( rcIn.Height(), nPercentToOccupy, 100 );
- rcOut.bottom = rcIn.top;
- break;
- case AFX_IDW_DOCKBAR_BOTTOM:
- nNewID = AFX_IDW_DOCKBAR_LEFT;
- nBarStyle = CBRS_ALIGN_LEFT;
- //rcIn.bottom -= rcIn.Height()/2;
- rcIn.bottom -= ::MulDiv( rcIn.Height(), nPercentToOccupy, 100 );
- rcOut.top = rcIn.bottom;
- break;
- case AFX_IDW_DOCKBAR_LEFT:
- //rcIn.left += rcIn.Width()/2;
- rcIn.left += ::MulDiv( rcIn.Width(), nPercentToOccupy, 100 );
- rcOut.right = rcIn.left;
- break;
- case AFX_IDW_DOCKBAR_RIGHT:
- //rcIn.right -= rcIn.Width()/2;
- rcIn.right -= ::MulDiv( rcIn.Width(), nPercentToOccupy, 100 );
- rcOut.left = rcIn.right;
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( nHalfSplitID )
- DWORD dwDynStyle =
- GetStyle()
- | (GetBarStyle() & CBRS_ALIGN_ANY)
- ;
- dwDynStyle |= CBRS_BORDER_ANY;
- dwDynStyle &= ~( CBRS_FLOATING | CBRS_GRIPPER );
- dwDynStyle |= CBRS_TOOLTIPS;
- CExtDynControlBar * pDynBar = new CExtDynControlBar;
- pDynBar->SetInitDesiredSizeHorizontal( m_sizeDockedH );
- pDynBar->SetInitDesiredSizeVertical( m_sizeDockedV );
- if( ! pDynBar->Create(
- NULL,
- m_pDockSite,
- nNewID,
- dwDynStyle
- )
- )
- {
- ASSERT( FALSE );
- return;
- }
- ASSERT( pDynBar->m_pWndDynDocker != NULL );
- ASSERT( pDynBar->m_pWndDynDocker->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow(pDynBar->m_pWndDynDocker->GetSafeHwnd()) );
- CFrameWnd * pDockSite = m_pDockSite;
- pDynBar->m_pDockSite = m_pDockSite;
- pDynBar->m_pDockBar = m_pDockBar;
- pDynBar->EnableDocking( CBRS_ALIGN_ANY );
- ASSERT( pDynBar->m_pDockContext != NULL );
- ASSERT( pDynBar->m_pDockContext->m_pDockSite == m_pDockSite );
- #ifdef _DEBUG
- if( pDockBarOut != NULL )
- {
- INT nPosOut = pDockBarOut->FindBar( pExtBar );
- ASSERT( nPosOut > 0 && nPosOut < pDockBarOut->m_arrBars.GetSize() );
- }
- #endif // _DEBUG
- INT nPosIn = pDockBarIn->FindBar( this );
- ASSERT( nPosIn > 0 && nPosIn < pDockBarIn->m_arrBars.GetSize() );
- pDockBarIn->m_arrBars[ nPosIn ] = pDynBar;
- pDynBar->m_pDockBar->m_bFloating = m_pDockBar->m_bFloating;
- m_pDockBar = pDynBar->m_pWndDynDocker;
- pExtBar->m_pDockBar = pDynBar->m_pWndDynDocker;
- m_pDockBar->m_bFloating = FALSE;
-
- if( pDynBar->m_pDockBar->m_bFloating )
- pDynBar->m_pDockBar->SetBarStyle(
- pDynBar->m_pDockBar->GetBarStyle()|CBRS_FLOATING
- );
- m_pDockBar->SetBarStyle(
- m_pDockBar->GetBarStyle() & (~CBRS_FLOATING)
- );
- ASSERT( !m_bUpdatingChain );
- ASSERT( !((CExtControlBar *)pDynBar)->m_bUpdatingChain );
- ASSERT( !pExtBar->m_bUpdatingChain );
- m_bUpdatingChain = true;
- ((CExtControlBar *)pDynBar)->m_bUpdatingChain = true;
- pExtBar->m_bUpdatingChain = true;
- SetBarStyle( GetBarStyle() & (~CBRS_FLOATING) );
- pExtBar->SetBarStyle( pExtBar->GetBarStyle() & (~CBRS_FLOATING) );
-
- pDynBar->SetParent( pDockBarIn );
- SetParent( pDynBar->m_pWndDynDocker );
- pExtBar->SetParent( pDynBar->m_pWndDynDocker );
- if( pDockBarOut != NULL )
- {
- ASSERT( pDockBarOut->FindBar( pExtBar ) >= 0 );
- if( !pDockBarOut->m_bFloating
- && pDockBarOut->IsKindOf(RUNTIME_CLASS(CExtDockBar))
- )
- {
- VERIFY(
- ((CExtDockBar *)pDockBarOut)->
- RemoveControlBar( pExtBar, -1, 0, false )
- );
- }
- else
- {
- VERIFY( pDockBarOut->RemoveControlBar(pExtBar) );
- }
- }
- if( nHalfSplitID == AFX_IDW_DOCKBAR_TOP
- || nHalfSplitID == AFX_IDW_DOCKBAR_LEFT
- )
- {
- pDynBar->m_pWndDynDocker->m_arrBars.Add( pExtBar );
- pDynBar->m_pWndDynDocker->m_arrBars.Add( this );
- }
- else
- {
- pDynBar->m_pWndDynDocker->m_arrBars.Add( this );
- pDynBar->m_pWndDynDocker->m_arrBars.Add( pExtBar );
- }
- pDynBar->m_pWndDynDocker->m_arrBars.Add( NULL );
- SetInitDesiredSizeHorizontal( rcIn.Size() );
- SetInitDesiredSizeVertical( rcIn.Size() );
- pExtBar->SetInitDesiredSizeHorizontal( rcOut.Size() );
- pExtBar->SetInitDesiredSizeVertical( rcOut.Size() );
- // if( bOptimizeDockBarLayout
- // && ::IsWindow( hWndDockBarOut )
- // )
- // {
- // ASSERT_VALID( pDockBarOut );
- // ASSERT(
- // CWnd::FromHandlePermanent(hWndDockBarOut)
- // == pDockBarOut
- // );
- // ((CExtDockBar *)pDockBarOut)->OnDynamicLayoutOptimize();
- // }
- pDynBar->ScreenToClient( &rcIn );
- pDynBar->ScreenToClient( &rcOut );
- MoveWindow( &rcIn, FALSE );
- pExtBar->MoveWindow( &rcOut, FALSE );
- pDynBar->SetInitDesiredSizeFloating( rcDyn.Size() );
- pDynBar->MoveWindow( &rcDyn, FALSE );
- ASSERT_VALID( pDynBar );
- ASSERT_VALID( pDynBar->m_pWndDynDocker );
- m_bUpdatingChain = false;
- ((CExtControlBar *)pDynBar)->m_bUpdatingChain = false;
- pExtBar->m_bUpdatingChain = false;
- //pDynBar->m_pWndDynDocker->OnDynamicLayoutUpdate();
- CExtDockBar::_OptimizeCircles( m_pDockSite );
- CFrameWnd * pFrame = pDynBar->GetParentFrame();
- if( pFrame != NULL )
- {
- ASSERT_VALID( pFrame );
- pFrame->RecalcLayout();
- pDynBar->OnRepositionSingleChild();
- pDynBar->OnNcAreaButtonsReinitialize();
- pDynBar->OnNcAreaButtonsReposition();
- ASSERT_VALID( pDynBar->m_pWndDynDocker );
- pDynBar->m_pWndDynDocker->OnDynamicLayoutUpdate();
- }
- stat_AdjustOccCompatibilityTree( pDockSite );
- }
- bool CExtControlBar::_DraggingApplyState(
- CExtControlBar::InternalDraggingState_t & _ds,
- bool bFinalApply
- )
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- CExtDynDockMarkerWnd::UnHighlightAllMarkers();
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( _ds.IsEmpty() )
- return false;
- CExtControlBar * pExtBarSrc = _ds.ExtBarSrcGet();
- ASSERT_VALID( pExtBarSrc );
- if( pExtBarSrc->IsFixedDockStyle() )
- return false;
- CFrameWnd * pFrame =
- pExtBarSrc->_GetDockingFrameImpl();
- ASSERT_VALID( pFrame );
- CFrameWnd * pOldFrame =
- pExtBarSrc->GetParentFrame();
- ASSERT_VALID( pOldFrame );
- HWND hWndOldFrame = pOldFrame->GetSafeHwnd();
- CExtControlBar * pExtBarDst = _ds.ExtBarDstGet();
- ExtControlBarVector_t vBarsDstRow;
- INT nCountOfDstRowBars = 0;
- UINT nDstDockBarID = AFX_IDW_DOCKBAR_FLOAT;
- CDockBar * pDstDockBar = NULL;
- bool bDstHorzDockBar = true;
- bool bDstFloatBar = false;
- INT nDstBarIdx = -1;
- if( pExtBarDst != NULL )
- {
- ASSERT_VALID( pExtBarDst );
- pExtBarDst->_GetRowExtBars( vBarsDstRow );
- nCountOfDstRowBars = (INT)vBarsDstRow.GetSize();
- ASSERT( nCountOfDstRowBars >= 1 );
- nDstDockBarID = pExtBarDst->GetSafeDockBarDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID( nDstDockBarID );
- ASSERT( pExtBarDst->m_pDockBar != NULL );
- pDstDockBar = pExtBarDst->m_pDockBar;
- // STATIC_DOWNCAST(
- // CExtDockBar,
- // pExtBarDst->m_pDockBar
- // );
- ASSERT( pDstDockBar != NULL );
- ASSERT_VALID( pDstDockBar );
- if( nDstDockBarID == AFX_IDW_DOCKBAR_LEFT
- || nDstDockBarID == AFX_IDW_DOCKBAR_RIGHT
- )
- bDstHorzDockBar = false;
- if( nDstDockBarID == AFX_IDW_DOCKBAR_FLOAT )
- bDstFloatBar = true;
- nDstBarIdx = pDstDockBar->FindBar( pExtBarDst );
- ASSERT( nDstBarIdx >= 0 );
- } // if( pExtBarDst != NULL )
- bool bInitialMode = false;
- if( pExtBarSrc->m_pDockBar == NULL )
- bInitialMode = true;
- CRect rcTrack( _ds.TrackRectGet() );
- e_calc_dock_type_t eCDT = _ds.GetCDT();
- if( bFinalApply )
- {
- switch( eCDT )
- {
- case __ECDT_2005_OUTER_TOP:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_TOP,
- false,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_OUTER_BOTTOM:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_BOTTOM,
- false,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_OUTER_LEFT:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_LEFT,
- false,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_OUTER_RIGHT:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_RIGHT,
- false,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_INNER_TOP:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_TOP,
- true,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_INNER_BOTTOM:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_BOTTOM,
- true,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_INNER_LEFT:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_LEFT,
- true,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_INNER_RIGHT:
- VERIFY(
- pExtBarSrc->DockControlBarInnerOuter(
- AFX_IDW_DOCKBAR_RIGHT,
- true,
- NULL,
- true
- )
- );
- return true;
- case __ECDT_2005_BAR_TOP:
- if( pExtBarDst == NULL )
- return true;
- VERIFY(
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_TOP
- )
- );
- return true;
- case __ECDT_2005_BAR_BOTTOM:
- if( pExtBarDst == NULL )
- return true;
- VERIFY(
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_BOTTOM
- )
- );
- return true;
- case __ECDT_2005_BAR_LEFT:
- if( pExtBarDst == NULL )
- return true;
- VERIFY(
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_LEFT
- )
- );
- return true;
- case __ECDT_2005_BAR_RIGHT:
- if( pExtBarDst == NULL )
- return true;
- VERIFY(
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_RIGHT
- )
- );
- return true;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- case __ECDT_2005_BAR_NEW_TAB:
- if( pExtBarDst == NULL )
- return true;
- ASSERT_VALID( pExtBarDst );
- ASSERT_VALID( pDstDockBar );
- VERIFY(
- pExtBarDst->DockControlBarIntoTabbedContainer(
- pExtBarSrc,
- 0, //_ds.ReindexPosGet(), //-1,
- NULL,
- true
- )
- );
- return true;
- #endif // else from (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- } // switch( eCDT )
- } // if( bFinalApply )
- switch( eCDT )
- {
- case __ECDT_OWN_AREA:
- m_pDockSite->DelayRecalcLayout();
- return true;
- break;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- case __ECDT_TABBED_NEW:
- case __ECDT_TABBED_UPDATE:
- case __ECDT_TABBED_REINDEX:
- case __ECDT_TABBED_REINDEX_NHM:
- {
- if( pExtBarDst == NULL )
- return TRUE;
- ASSERT_VALID( pExtBarDst );
- ASSERT_VALID( pDstDockBar );
- VERIFY(
- pExtBarDst->DockControlBarIntoTabbedContainer(
- pExtBarSrc,
- _ds.ReindexPosGet(), //-1,
- NULL,
- true
- )
- );
- return true;
- }
- break;
- case __ECDT_2005_BAR_NEW_TAB:
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- case __ECDT_2005_OUTER_TOP:
- case __ECDT_2005_OUTER_BOTTOM:
- case __ECDT_2005_OUTER_LEFT:
- case __ECDT_2005_OUTER_RIGHT:
- case __ECDT_2005_INNER_TOP:
- case __ECDT_2005_INNER_BOTTOM:
- case __ECDT_2005_INNER_LEFT:
- case __ECDT_2005_INNER_RIGHT:
- case __ECDT_2005_BAR_TOP:
- case __ECDT_2005_BAR_BOTTOM:
- case __ECDT_2005_BAR_LEFT:
- case __ECDT_2005_BAR_RIGHT:
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- CPoint ptCursor;
- if( ::GetCursorPos( &ptCursor ) )
- {
- HWND hWnd = ::WindowFromPoint( ptCursor );
- if( hWnd != NULL )
- {
- CWnd * pWnd = CWnd::FromHandlePermanent( hWnd );
- if( pWnd != NULL )
- {
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- DYNAMIC_DOWNCAST( CExtDynDockMarkerWnd, pWnd );
- if( pDynDockMarkerWnd != NULL
- && pDynDockMarkerWnd->IsStateApplyable()
- )
- { // if dock marker is state apply-able
- eCDT = pDynDockMarkerWnd->GetCDT();
- if( _ds.GetCDT() == eCDT )
- {
- pDynDockMarkerWnd->HighlightMarkerTarget();
- return true;
- } // if( _ds.GetCDT() == eCDT )
- } // if dock marker is state apply-able
- } // if( pWnd != NULL )
- } // if( hWnd != NULL )
- } // if( ::GetCursorPos( &ptCursor ) )
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- }
- return true;
- case __ECDT_FLOATED:
- {
- bool bWasFloating = true;
- if( ! pExtBarSrc->IsFloating() )
- {
- bWasFloating = false;
- CExtControlBar * pUpSizeBar = (CExtControlBar *)
- pExtBarSrc->_GetNextControlBarInRow(
- pExtBarSrc, true, true, true
- );
- if( pUpSizeBar != NULL )
- {
- while( !pUpSizeBar->IsVisible() )
- {
- CExtControlBar * pUpSizeBar2 = (CExtControlBar *)
- _GetNextControlBarInRow(
- pUpSizeBar, true, true, true
- );
- if( pUpSizeBar2 == NULL )
- break;
- pUpSizeBar = pUpSizeBar2;
- }
- } // if( pUpSizeBar != NULL )
- if( pUpSizeBar == NULL )
- {
- pUpSizeBar = (CExtControlBar *)
- pExtBarSrc->_GetNextControlBarInRow(
- pExtBarSrc, false, true, true
- );
- if( pUpSizeBar != NULL )
- {
- while( !pUpSizeBar->IsVisible() )
- {
- CExtControlBar * pUpSizeBar2 = (CExtControlBar *)
- _GetNextControlBarInRow(
- pUpSizeBar, false, true, true
- );
- if( pUpSizeBar2 == NULL )
- break;
- pUpSizeBar = pUpSizeBar2;
- }
- } // if( pUpSizeBar != NULL )
- } // if( pUpSizeBar == NULL )
- if( pUpSizeBar != NULL )
- {
- CRect rcBarWnd;
- pExtBarSrc->GetWindowRect( &rcBarWnd );
- ASSERT( !rcBarWnd.IsRectEmpty() );
- bool bHorzUpsizing = pExtBarSrc->IsDockedHorizontally();
- LONG nUpSize = bHorzUpsizing
- ? rcBarWnd.Width()
- : rcBarWnd.Height()
- ;
- LONG & ref_nMetric = bHorzUpsizing
- ? pUpSizeBar->m_sizeDockedH.cx
- : pUpSizeBar->m_sizeDockedV.cy;
- ref_nMetric += nUpSize;
- } // if( pUpSizeBar != NULL )
- } // if( ! pExtBarSrc->IsFloating() )
- CRect rcFrame;
- pFrame->GetWindowRect( &rcFrame );
- CPoint ptFloat( -rcFrame.TopLeft() );
- ptFloat += rcTrack.TopLeft();
- pExtBarSrc->FloatControlBar( ptFloat );
- // if( !bWasFloating && !bInitialMode )
- // pFrame->RecalcLayout();
- ASSERT( m_pDockContext != NULL );
- m_pDockContext->m_ptMRUFloatPos = ptFloat;
- if( pExtBarSrc->_IsShowContentWhenDragging() )
- {
- /*pExtBarSrc->RedrawWindow(
- NULL, NULL,
- RDW_INVALIDATE | RDW_UPDATENOW
- | RDW_ERASE | RDW_ERASENOW
- | RDW_ALLCHILDREN
- );*/
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ASSERT_VALID( pExtBarSrc->m_pDockSite );
- CExtDynAutoHideArea
- * pAreaTop = NULL,
- * pAreaBottom = NULL,
- * pAreaLeft = NULL,
- * pAreaRight = NULL;
- CExtDynAutoHideArea::stat_FindAreas(
- pExtBarSrc->m_pDockSite,
- &pAreaTop,
- &pAreaBottom,
- &pAreaLeft,
- &pAreaRight
- );
- if( pAreaTop != NULL )
- pAreaTop->UpdateTabWnd();
- if( pAreaBottom != NULL )
- pAreaBottom->UpdateTabWnd();
- if( pAreaLeft != NULL )
- pAreaLeft->UpdateTabWnd();
- if( pAreaRight != NULL )
- pAreaRight->UpdateTabWnd();
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- else
- {
- ASSERT_VALID( pExtBarSrc->m_pDockSite );
- pExtBarSrc->m_pDockSite->RecalcLayout();
- }
- return true;
- } // case __ECDT_FLOATED
- case __ECDT_INNER_TOP:
- {
- if( pExtBarDst == NULL )
- return TRUE;
- ASSERT_VALID( pExtBarDst );
- /*
- ASSERT_VALID( pDstDockBar );
- ASSERT( nDstBarIdx >= 0 );
- if( bDstHorzDockBar || bDstFloatBar
- || _ds.IsDeepHalfSplit()
- )
- { // if full row or deep half split
- if( _ds.IsDeepHalfSplit() )
- {
- pExtBarDst->_DraggingDoDeepHalfSplit(
- pExtBarSrc,
- AFX_IDW_DOCKBAR_TOP
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // if( _ds.IsDeepHalfSplit() )
- else
- {
- for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- {
- CExtControlBar * pExtBar = vBarsDstRow[nBarIdx];
- ASSERT_VALID( pExtBar );
- if( pExtBar == pExtBarSrc )
- continue;
- if( pExtBar->IsFixedMode() )
- continue;
- pExtBar->m_sizeDockedH.cy = rcTrack.Height();
- } // for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- pExtBarSrc->m_sizeDockedH.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedH.cy = rcTrack.Height();
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->
- _NewRowDockControlBar(
- pExtBarDst,
- pExtBarSrc,
- true
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // else from if( _ds.IsDeepHalfSplit() )
- } // if full row or deep half split
- else
- { // if sizing bar half split
- pExtBarDst->m_sizeDockedV.cy = rcTrack.Height();
- pExtBarSrc->m_sizeDockedV.cy = rcTrack.Height();
- pExtBarSrc->m_sizeDockedV.cx = pExtBarDst->m_sizeDockedV.cx;
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->DockControlBar( pExtBarSrc, &rcTrack );
- ASSERT_VALID( pDstDockBar );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- pExtBarSrc->SetWindowPos(NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE
- |SWP_FRAMECHANGED
- );
- }
- } // if sizing bar half split
- return true;
- */
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_TOP
- );
- return true;
- } // case __ECDT_INNER_TOP
- case __ECDT_INNER_BOTTOM:
- {
- if( pExtBarDst == NULL )
- return TRUE;
- ASSERT_VALID( pExtBarDst );
- /*
- ASSERT_VALID( pDstDockBar );
- ASSERT( nDstBarIdx >= 0 );
- if( bDstHorzDockBar || bDstFloatBar
- || _ds.IsDeepHalfSplit()
- )
- { // if full row or deep half split
- if( _ds.IsDeepHalfSplit() )
- {
- pExtBarDst->_DraggingDoDeepHalfSplit(
- pExtBarSrc,
- AFX_IDW_DOCKBAR_BOTTOM
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // if( _ds.IsDeepHalfSplit() )
- else
- {
- for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- {
- CExtControlBar * pExtBar = vBarsDstRow[nBarIdx];
- ASSERT_VALID( pExtBar );
- if( pExtBar == pExtBarSrc )
- continue;
- if( pExtBar->IsFixedMode() )
- continue;
- pExtBar->m_sizeDockedH.cy = rcTrack.Height();
- } // for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- pExtBarSrc->m_sizeDockedH.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedH.cy = rcTrack.Height();
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->
- _NewRowDockControlBar(
- pExtBarDst,
- pExtBarSrc,
- false
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // else from if( _ds.IsDeepHalfSplit() )
- } // if full row or deep half split
- else
- { // if sizing bar half split
- pExtBarDst->m_sizeDockedV.cy = rcTrack.Height();
- pExtBarSrc->m_sizeDockedV.cy = rcTrack.Height();
- pExtBarSrc->m_sizeDockedV.cx = pExtBarDst->m_sizeDockedV.cx;
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->DockControlBar( pExtBarSrc, &rcTrack );
- ASSERT_VALID( pDstDockBar );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- pExtBarSrc->SetWindowPos(NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE
- |SWP_FRAMECHANGED
- );
- }
- } // if sizing bar half split
- return true;
- */
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_BOTTOM
- );
- return true;
- } // case __ECDT_INNER_BOTTOM
- case __ECDT_INNER_LEFT:
- {
- if( pExtBarDst == NULL )
- return TRUE;
- ASSERT_VALID( pExtBarDst );
- /*
- ASSERT_VALID( pDstDockBar );
- ASSERT( nDstBarIdx >= 0 );
- if( (!bDstHorzDockBar) || bDstFloatBar
- || _ds.IsDeepHalfSplit()
- )
- { // if full row or deep half split
- if( _ds.IsDeepHalfSplit() )
- {
- pExtBarDst->_DraggingDoDeepHalfSplit(
- pExtBarSrc,
- AFX_IDW_DOCKBAR_LEFT
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // if( _ds.IsDeepHalfSplit() )
- else
- {
- for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- {
- CExtControlBar * pExtBar = vBarsDstRow[nBarIdx];
- ASSERT_VALID( pExtBar );
- if( pExtBar == pExtBarSrc )
- continue;
- if( pExtBar->IsFixedMode() )
- continue;
- pExtBar->m_sizeDockedV.cx = rcTrack.Width();
- //if( pExtBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) )
- // ((CExtDockDynTabBar*)((CExtDynTabControlBar*)pExtBar)->m_pWndDynDocker)->_SyncTabbedChilds( true, false );
- } // for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- pExtBarSrc->m_sizeDockedV.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedV.cy = rcTrack.Height();
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->
- _NewRowDockControlBar(
- pExtBarDst,
- pExtBarSrc,
- true
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // else from if( _ds.IsDeepHalfSplit() )
- } // if full row or deep half split
- else
- { // if sizing bar half split
- pExtBarDst->m_sizeDockedH.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedH.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedH.cy = pExtBarDst->m_sizeDockedH.cy;
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->DockControlBar( pExtBarSrc, &rcTrack );
- ASSERT_VALID( pDstDockBar );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- pExtBarSrc->SetWindowPos(NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE
- |SWP_FRAMECHANGED
- );
- }
- } // if sizing bar half split
- return true;
- */
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_LEFT
- );
- return true;
- } // case __ECDT_INNER_LEFT
- case __ECDT_INNER_RIGHT:
- {
- if( pExtBarDst == NULL )
- return TRUE;
- ASSERT_VALID( pExtBarDst );
- /*
- ASSERT_VALID( pDstDockBar );
- ASSERT( nDstBarIdx >= 0 );
- if( (!bDstHorzDockBar) || bDstFloatBar
- || _ds.IsDeepHalfSplit()
- )
- { // if full row or deep half split
- if( _ds.IsDeepHalfSplit() )
- {
- pExtBarDst->_DraggingDoDeepHalfSplit(
- pExtBarSrc,
- AFX_IDW_DOCKBAR_RIGHT
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // if( _ds.IsDeepHalfSplit() )
- else
- {
- for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- {
- CExtControlBar * pExtBar = vBarsDstRow[nBarIdx];
- ASSERT_VALID( pExtBar );
- if( pExtBar == pExtBarSrc )
- continue;
- if( pExtBar->IsFixedMode() )
- continue;
- pExtBar->m_sizeDockedV.cx = rcTrack.Width();
- } // for( INT nBarIdx = 0; nBarIdx < nCountOfDstRowBars; nBarIdx++ )
- pExtBarSrc->m_sizeDockedV.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedV.cy = rcTrack.Height();
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->
- _NewRowDockControlBar(
- pExtBarDst,
- pExtBarSrc,
- false
- );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- } // else from if( _ds.IsDeepHalfSplit() )
- } // if full row or deep half split
- else
- { // if sizing bar half split
- pExtBarDst->m_sizeDockedH.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedH.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedH.cy = pExtBarDst->m_sizeDockedH.cy;
- ASSERT_KINDOF( CExtDockBar, pDstDockBar );
- ((CExtDockBar *)pDstDockBar)->DockControlBar( pExtBarSrc, &rcTrack );
- ASSERT_VALID( pDstDockBar );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- pExtBarSrc->SetWindowPos(NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE
- |SWP_FRAMECHANGED
- );
- }
- } // if sizing bar half split
- return true;
- */
- pExtBarSrc->DockControlBarLTRB(
- pExtBarDst,
- AFX_IDW_DOCKBAR_RIGHT
- );
- return true;
- } // case __ECDT_INNER_RIGHT
- case __ECDT_DOCKBAR_INNER_TOP:
- case __ECDT_DOCKBAR_INNER_BOTTOM:
- case __ECDT_DOCKBAR_INNER_LEFT:
- case __ECDT_DOCKBAR_INNER_RIGHT:
- {
- ASSERT_VALID( pExtBarSrc );
- // pExtBarSrc->m_sizeDockedV.cy = MAXSHORT;
- if( eCDT == __ECDT_DOCKBAR_INNER_TOP
- || eCDT == __ECDT_DOCKBAR_INNER_BOTTOM
- )
- {
- pExtBarSrc->m_sizeDockedH.cy = rcTrack.Height();
- pExtBarSrc->m_sizeDockedH.cy = rcTrack.Height();
- }
- else
- {
- pExtBarSrc->m_sizeDockedV.cx = rcTrack.Width();
- pExtBarSrc->m_sizeDockedV.cx = rcTrack.Width();
- }
- UINT nDockBarID = AFX_IDW_DOCKBAR_TOP;
- if( eCDT == __ECDT_DOCKBAR_INNER_BOTTOM )
- nDockBarID = AFX_IDW_DOCKBAR_BOTTOM;
- else if( eCDT == __ECDT_DOCKBAR_INNER_LEFT )
- nDockBarID = AFX_IDW_DOCKBAR_LEFT;
- else if( eCDT == __ECDT_DOCKBAR_INNER_RIGHT )
- nDockBarID = AFX_IDW_DOCKBAR_RIGHT;
- CExtDockBar * pDockBar = (CExtDockBar *)
- pFrame->GetControlBar( nDockBarID );
- ASSERT_VALID( pDockBar );
- ASSERT_KINDOF( CExtDockBar, pDockBar );
- ASSERT( pDockBar->_GetCircleNo() == 0 );
- UINT nCircleNoRequired = _ds.GetCircleNo();
- if( nCircleNoRequired > 0 )
- {
- pDockBar = pDockBar->_GetBarByCircleNo( nCircleNoRequired );
- ASSERT_VALID( pDockBar );
- ASSERT_KINDOF( CExtDockBar, pDockBar );
- ASSERT( pDockBar->_GetCircleNo() == nCircleNoRequired );
- ASSERT( ((UINT)pDockBar->GetDlgCtrlID()) == nDockBarID );
- }
-
- HWND hWndSrc = pExtBarSrc->GetSafeHwnd();
- pDockBar->_InnerOuterDockControlBar( pExtBarSrc, true );
- ASSERT_VALID( pDockBar );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- if( ::IsWindow( hWndSrc ) )
- {
- ASSERT_VALID( pExtBarSrc );
- ASSERT(
- CWnd::FromHandlePermanent(hWndSrc)
- == pExtBarSrc
- );
- pExtBarSrc->SetWindowPos(
- NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE
- |SWP_FRAMECHANGED
- );
- }
- return true;
- }
- case __ECDT_CIRCLE1_OUTER_TOP:
- case __ECDT_CIRCLE1_OUTER_BOTTOM:
- case __ECDT_CIRCLE1_OUTER_LEFT:
- case __ECDT_CIRCLE1_OUTER_RIGHT:
- {
- UINT nDockBarID = 0;
- bool bInjectCircle = false;
- switch( eCDT )
- {
- case __ECDT_CIRCLE1_OUTER_TOP:
- nDockBarID = AFX_IDW_DOCKBAR_TOP;
- break;
- case __ECDT_CIRCLE1_OUTER_BOTTOM:
- nDockBarID = AFX_IDW_DOCKBAR_BOTTOM;
- break;
- case __ECDT_CIRCLE1_OUTER_LEFT:
- nDockBarID = AFX_IDW_DOCKBAR_LEFT;
- bInjectCircle = true;
- break;
- case __ECDT_CIRCLE1_OUTER_RIGHT:
- nDockBarID = AFX_IDW_DOCKBAR_RIGHT;
- bInjectCircle = true;
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( eCDT )
- CExtDockBar * pDockBar = (CExtDockBar *)
- pFrame->GetControlBar( nDockBarID );
- ASSERT_VALID( pDockBar );
- ASSERT_KINDOF( CExtDockBar, pDockBar );
- ASSERT( pDockBar->_GetCircleNo() == 0 );
- if( bInjectCircle )
- pDockBar->_InjectInnerCircle();
- pDockBar = pDockBar->_GetBarByCircleNo( 1 );
- ASSERT_VALID( pDockBar );
- ASSERT_KINDOF( CExtDockBar, pDockBar );
- ASSERT( pDockBar->_GetCircleNo() == 1 );
- HWND hWndSrc = pExtBarSrc->GetSafeHwnd();
-
- pDockBar->_InnerOuterDockControlBar( pExtBarSrc, false );
- ASSERT_VALID( pDockBar );
- if( !bInitialMode )
- {
- pFrame->RecalcLayout();
- if( pOldFrame != pFrame
- && ::IsWindow( hWndOldFrame )
- )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- }
- if( ::IsWindow( hWndSrc ) )
- {
- ASSERT_VALID( pExtBarSrc );
- ASSERT(
- CWnd::FromHandlePermanent(hWndSrc)
- == pExtBarSrc
- );
- pExtBarSrc->SetWindowPos(
- NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE
- |SWP_FRAMECHANGED
- );
- }
-
- }
- return true; // case __ECDT_CIRCLE1_OUTER_....
- } // switch( eCDT )
- ASSERT( FALSE );
- return false;
- }
- UINT CExtControlBar::GetDockBarCircleNo() const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pDockBar );
-
- return ((CExtDockBar *)m_pDockBar)->_GetCircleNo();
- }
- bool CExtControlBar::_CanDockToInnerCircles() const
- {
- return true;
- }
- bool CExtControlBar::_CanDockToTabbedContainers(
- CExtControlBar * pDestBar
- ) const
- {
- ASSERT_VALID( this );
- pDestBar;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( _IsShowContentWhenDragging() )
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- eResizablePanelDockingType_t eResizablePanelDockingType =
- OnQueryDockingType();
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- return true;
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- return false;
- } // if( _IsShowContentWhenDragging() )
- return true;
- #else
- return false;
- #endif // else from (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- bool CExtControlBar::_CanDockLTRB(
- CExtControlBar * pDestBar
- ) const
- {
- ASSERT_VALID( this );
- pDestBar;
- return true;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynTabControlBar * CExtControlBar::_GetNearestTabbedContainer()
- {
- ASSERT_VALID( this );
- if( m_hWnd == NULL || (! ::IsWindow(m_hWnd) ) )
- return NULL;
- CWnd * pWndParent = GetParent();
- if( ! pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- return NULL;
- CExtDynTabControlBar * pTabbedContainer = STATIC_DOWNCAST( CExtDynTabControlBar, pWndParent->GetParent() );
- return pTabbedContainer;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynControlBar * CExtControlBar::_GetNearestDynamicContainer()
- {
- ASSERT_VALID( this );
- if( m_hWnd == NULL || (! ::IsWindow(m_hWnd) ) )
- return NULL;
- CWnd * pWndParent = GetParent();
- if( ! pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockDynBar)) )
- return NULL;
- CExtDynControlBar * pDynContainer = STATIC_DOWNCAST( CExtDynControlBar, pWndParent->GetParent() );
- return pDynContainer;
- }
- // toggle docking state
- void CExtControlBar::ToggleDocking()
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- ASSERT_VALID( m_pDockBar );
- #ifdef _DEBUG
- if( !IsFloating() )
- {
- ASSERT_KINDOF( CExtDockBar, m_pDockBar );
- }
- #endif // _DEBUG
- ASSERT( m_pDockContext != NULL );
- ASSERT( m_pDockContext != NULL );
-
- if( IsFixedDockStyle() )
- {
- m_pDockContext->ToggleDocking();
- CFrameWnd * pFrame = _GetDockingFrameImpl();
- ASSERT_VALID( pFrame );
- pFrame->DelayRecalcLayout();
- _RecalcNcArea();
- return;
- }
- ASSERT( !IsFixedMode() );
-
- // m_pDockContext->ToggleDocking();
- //
- //CFrameWnd * pFrame = _GetDockingFrameImpl();
- // ASSERT_VALID( pFrame );
- // pFrame->RecalcLayout();
- UINT nDockBarID = GetSafeDockBarDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID( nDockBarID );
- if( nDockBarID == AFX_IDW_DOCKBAR_FLOAT )
- {
- } // if( nDockBarID == AFX_IDW_DOCKBAR_FLOAT )
- else
- {
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- if( !GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- FloatControlBar();
- } // else from if( nDockBarID == AFX_IDW_DOCKBAR_FLOAT )
- }
- CExtControlBar * CExtControlBar::FindTearOffBar(
- CFrameWnd * pDockSite,
- UINT nTearOffCmdID
- )
- {
- if( pDockSite->GetSafeHwnd() == NULL || nTearOffCmdID == 0 )
- return NULL;
- ASSERT_VALID( pDockSite );
- ASSERT( CExtCmdManager::IsCommand( nTearOffCmdID ) );
- POSITION pos = pDockSite->m_listControlBars.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CControlBar * pControlBar = (CControlBar *)
- pDockSite->m_listControlBars.GetNext( pos );
- ASSERT_VALID( pControlBar );
- ASSERT_KINDOF( CControlBar, pControlBar );
- if( pControlBar->IsDockBar() )
- continue;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pControlBar );
- if( pExtBar == NULL )
- continue;
- UINT nCmdID = pExtBar->TearOffCommandGet();
- if( nCmdID == nTearOffCmdID )
- return pExtBar;
- } // for( ; pos != NULL; )
- return NULL;
- }
- UINT CExtControlBar::TearOffCommandGet() const
- {
- ASSERT_VALID( this );
- #ifdef _DEBUG
- if( m_nTearOffCmdID != 0 )
- {
- ASSERT( CExtCmdManager::IsCommand( m_nTearOffCmdID ) );
- }
- #endif // _DEBUG
- return m_nTearOffCmdID;
- }
- void CExtControlBar::TearOffCommandSet( UINT nCmdID )
- {
- ASSERT_VALID( this );
- m_nTearOffCmdID = nCmdID;
- #ifdef _DEBUG
- if( m_nTearOffCmdID != 0 )
- {
- ASSERT( CExtCmdManager::IsCommand( m_nTearOffCmdID ) );
- }
- #endif // _DEBUG
- }
- CExtMiniDockFrameWnd * CExtControlBar::OnCreateFloatingFrame(
- DWORD dwStyle
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- CExtMiniDockFrameWnd * pMiniFrame =
- new CExtMiniDockFrameWnd;
- if( ! pMiniFrame->Create(
- m_pDockSite,
- dwStyle
- )
- )
- {
- ASSERT( FALSE );
- AfxThrowResourceException();
- }
- return pMiniFrame;
- }
- // float control bar into recent floated position
- void CExtControlBar::FloatControlBar(
- DWORD dwStyle // = CBRS_ALIGN_TOP
- )
- {
- FloatControlBar( m_ptFloatHelper, dwStyle );
- }
- // float control bar
- void CExtControlBar::FloatControlBar(
- CPoint ptFloat,
- DWORD dwStyle // = CBRS_ALIGN_TOP
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- g_pBarToggleFloatingState = this;
- #ifdef _DEBUG
- bool bWasFloating = IsFloating();
- #endif // _DEBUG
- HWND hWndTopDynBar = NULL;
- CExtDynControlBar * pWndTopDynBar = NULL;
- // if the bar is already floating and the dock bar only contains this
- // bar and same orientation then move the window rather than recreating
- // the frame
- if( m_pDockBar != NULL )
- {
- CDockBar * pDockBar = m_pDockBar;
- ASSERT_KINDOF( CDockBar, pDockBar );
- CExtDynControlBar * pDynBar = DYNAMIC_DOWNCAST( CExtDynControlBar, pDockBar->GetParent() );
- for( ; pDynBar != NULL; )
- {
- hWndTopDynBar = pDynBar->m_hWnd;
- pWndTopDynBar = pDynBar;
- CWnd * pWndWalk = pDynBar->GetParent();
- if( pWndWalk == NULL )
- break;
- CDockBar * pParentDockBar = DYNAMIC_DOWNCAST( CDockBar, pWndWalk );
- if( pParentDockBar == NULL )
- break;
- pWndWalk = pWndWalk->GetParent();
- if( pWndWalk == NULL )
- break;
- pDynBar = DYNAMIC_DOWNCAST( CExtDynControlBar, pWndWalk );
- }
- if( pDockBar->m_bFloating
- && pDockBar->GetDockedCount() == 1
- // && (dwStyle & pDockBar->m_dwStyle & CBRS_ALIGN_ANY) != 0
- )
- {
- ASSERT( bWasFloating );
- CExtMiniDockFrameWnd * pDockFrame =
- (CExtMiniDockFrameWnd*) pDockBar->GetParent();
- ASSERT( pDockFrame != NULL );
- ASSERT_KINDOF( CExtMiniDockFrameWnd, pDockFrame );
- CRect rcWnd;
- GetWindowRect( &rcWnd );
- CRect rcCustomFloatPos( ptFloat, rcWnd.Size() );
- pDockFrame->SendMessage(
- CExtPopupMenuWnd::g_nMsgCustomFloatPos,
- WPARAM(pDockFrame->m_hWnd),
- LPARAM(&rcCustomFloatPos)
- );
- pDockFrame->SetWindowPos(
- NULL,
- ptFloat.x,
- ptFloat.y,
- 0,
- 0,
- SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE
- );
- // - 2.26
- //pDockFrame->RecalcLayout( TRUE );
- //pDockFrame->UpdateWindow();
- m_ptFloatHelper = ptFloat;
-
- g_pBarToggleFloatingState = NULL;
- return;
- }
- } // if( m_pDockBar != NULL )
- ASSERT(
- (!bWasFloating)
- || m_pDockBar == NULL // initial mode
- );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDockDynTabBar * pTabbedDocker =
- DYNAMIC_DOWNCAST(
- CExtDockDynTabBar,
- GetParent()
- );
- if( pTabbedDocker != NULL )
- {
- CExtDynTabControlBar * pTabbedBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- pTabbedDocker->GetParent()
- );
- // LONG nSel = pTabbedBar->GetSwitcherSelection();
- // if( nSel >= 0
- // && pTabbedBar->GetBarAt( nSel, true ) == this
- // )
- // pTabbedBar->RemoveSelFromSwitcher();
- // else
- pTabbedBar->RemoveControlBar( this );
- } // if( pTabbedDocker != NULL )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bool bShowMiniFrame =
- ( (GetStyle() & WS_VISIBLE) != 0 ) ? true : false;
- if( m_dwStyle & CBRS_SIZE_DYNAMIC )
- {
- dwStyle |= CBRS_SIZE_DYNAMIC;
- if (dwStyle & CBRS_ORIENT_VERT)
- {
- dwStyle &= ~CBRS_ALIGN_ANY;
- dwStyle |= CBRS_ALIGN_TOP;
- }
- }
- CExtDockBar * pDockBarOut = (CExtDockBar *)m_pDockBar;
- bool bOptimizeDockBarLayout = false;
- if( pDockBarOut != NULL
- && (! pDockBarOut->m_bFloating )
- && pDockBarOut->IsKindOf(RUNTIME_CLASS(CExtDockBar))
- )
- bOptimizeDockBarLayout = true;
- HWND hWndDockBarOuter =
- (pDockBarOut != NULL)
- ? pDockBarOut->GetSafeHwnd()
- : NULL
- ;
- CFrameWnd * pOldFrame = GetParentFrame();
- HWND hWndOldFrame = NULL;
- if( pOldFrame != NULL )
- {
- ASSERT_VALID( pOldFrame );
- hWndOldFrame = pOldFrame->GetSafeHwnd();
- }
- CExtMiniDockFrameWnd * pDockFrame = OnCreateFloatingFrame( dwStyle );
- ASSERT( pDockFrame != NULL );
- ASSERT_KINDOF( CExtMiniDockFrameWnd, pDockFrame );
- pDockFrame->SetWindowPos(
- NULL, ptFloat.x, ptFloat.y, 0, 0,
- SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE
- );
- if( pDockFrame->m_hWndOwner == NULL )
- pDockFrame->m_hWndOwner = m_pDockSite->m_hWnd;
- CDockBar * pDockBar = STATIC_DOWNCAST( CDockBar, pDockFrame->GetDlgItem( AFX_IDW_DOCKBAR_FLOAT ) );
- ASSERT_VALID( pDockBar );
- ASSERT( ! m_bUpdatingChain );
- m_bUpdatingChain = true;
- //pDockBar->m_bLockedOptimize = true;
- ((CExtDockBar*)pDockBar)->DockControlBar( this, NULL, false, true );
- //pDockBar->m_bLockedOptimize = false;
- m_bUpdatingChain = false;
- pDockFrame->RecalcLayout( TRUE );
- if( bShowMiniFrame )
- {
- pDockFrame->ShowWindow( SW_SHOWNA );
- pDockFrame->UpdateWindow();
- }
- m_ptFloatHelper = ptFloat;
- if( bOptimizeDockBarLayout
- && ::IsWindow( hWndDockBarOuter )
- )
- {
- ASSERT_VALID( pDockBarOut );
- CExtMiniDockFrameWnd * pOldMiniFrame = DYNAMIC_DOWNCAST( CExtMiniDockFrameWnd, pDockBarOut->GetParentFrame() );
- HWND hWndOldMiniFrame = pOldMiniFrame->GetSafeHwnd();
- if( hWndOldMiniFrame != NULL )
- pOldMiniFrame->SetRedraw( FALSE );
- ((CExtDockBar*)pDockBarOut)->OnDynamicLayoutOptimize();
- if( hWndOldMiniFrame != NULL && ::IsWindow(hWndOldMiniFrame) && LPVOID(pOldMiniFrame) == LPVOID(CWnd::FromHandlePermanent(hWndOldMiniFrame)) )
- pOldMiniFrame->SetRedraw( TRUE );
- }
- if( pOldFrame != m_pDockSite && ::IsWindow( hWndOldFrame ) )
- {
- ASSERT_VALID( pOldFrame );
- __RECALC_FRAME_STEPS( pOldFrame );
- }
- if( ! IsFixedDockStyle() )
- CExtDockBar::_RemovePlaceHolder( m_pDockSite, this );
- CExtDockBar::_OptimizeCircles( m_pDockSite );
- m_pDockSite->RecalcLayout();
- OnRepositionSingleChild();
- if( hWndTopDynBar != NULL && ::IsWindow( hWndTopDynBar ) && LPVOID(pWndTopDynBar) == LPVOID(CWnd::FromHandlePermanent(hWndTopDynBar)) )
- pWndTopDynBar->OnRepositionSingleChild();
- CExtControlBar::stat_AdjustOccCompatibilityTree( m_pDockSite );
- g_pBarToggleFloatingState = NULL;
- }
- // dock control bar to new circle (most inner or outer)
- bool CExtControlBar::DockControlBarInnerOuter(
- UINT nDockBarID,
- bool bInner,
- CFrameWnd * pDockSite, // = NULL // can be NULL only if bar already was at once docked
- bool bRecalcLayout // = true
- )
- {
- ASSERT_VALID( this );
- ASSERT_KINDOF( CExtControlBar, this );
- if( pDockSite == NULL )
- pDockSite = m_pDockSite;
- ASSERT_VALID( pDockSite );
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- CFrameWnd * pParentFrame = GetParentFrame();
- if( pParentFrame != NULL
- && pParentFrame->IsKindOf( RUNTIME_CLASS(CExtMiniDockFrameWnd) )
- )
- pParentFrame->ShowWindow( SW_HIDE );
- UINT nCircleNo = 1;
- CExtDockBar::_InjectCircle( pDockSite, nCircleNo );
- if( bInner )
- nCircleNo = CExtDockBar::_CreateInnerCircle( pDockSite );
- return
- DockControlBar(
- nDockBarID,
- nCircleNo,
- pDockSite,
- bRecalcLayout
- );
- }
- // dock control bar relatively to other control bar (extended version)
- bool CExtControlBar::DockControlBarLTRB(
- CExtControlBar * pBarTarget,
- UINT nDockBarID, // = AFX_IDW_DOCKBAR_BOTTOM
- bool bRecalcLayout // = true
- )
- {
- return
- DockControlBarLTRB(
- 50,
- pBarTarget,
- nDockBarID,
- bRecalcLayout
- );
- }
- // dock control bar relatively to other control bar using
- // space percent specification (extended version)
- bool CExtControlBar::DockControlBarLTRB(
- int nPercentToOccupy, // greater then zero and less then one hundred
- CExtControlBar * pBarTarget,
- UINT nDockBarID, // = AFX_IDW_DOCKBAR_BOTTOM
- bool bRecalcLayout // = true
- )
- {
- ASSERT_VALID( this );
- ASSERT_KINDOF( CExtControlBar, this );
- ASSERT_VALID( pBarTarget );
- ASSERT_KINDOF( CExtControlBar, pBarTarget );
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- ASSERT_VALID( pBarTarget->m_pDockBar );
- ASSERT_KINDOF( CDockBar, pBarTarget->m_pDockBar );
- ASSERT( ! IsFixedMode() );
- ASSERT( ! pBarTarget->IsFixedMode() );
- ASSERT( 0 < nPercentToOccupy && nPercentToOccupy < 100 );
- #ifdef _DEBUG
- if( m_pDockBar != NULL )
- {
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CDockBar, m_pDockBar );
- }
- #endif // _DEBUG
- CFrameWnd * pParentFrame = GetParentFrame();
- CFrameWnd * pDockSite = m_pDockSite;
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( pParentFrame != NULL
- && pParentFrame->IsKindOf( RUNTIME_CLASS(CExtMiniDockFrameWnd) )
- && _DraggingGetBar() == this
- && INT(OnQueryDockingType()) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- )
- pParentFrame->ShowWindow( SW_HIDE );
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynTabControlBar * pTargetTabBar =
- pBarTarget->_GetNearestTabbedContainer();
- if( pTargetTabBar != NULL )
- {
- ASSERT_VALID( pTargetTabBar );
- pBarTarget = pTargetTabBar;
- ASSERT_VALID( pBarTarget->m_pDockBar );
- ASSERT_KINDOF( CDockBar, pBarTarget->m_pDockBar );
- ASSERT( ! pBarTarget->IsFixedMode() );
- } // if( pTargetTabBar != NULL )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bool bRecalcDockSite = true;
- pParentFrame = pBarTarget->GetParentFrame();
- ASSERT_VALID( pParentFrame );
- if( pParentFrame != pBarTarget->m_pDockSite
- && (m_pDockSite != NULL && pParentFrame != m_pDockSite )
- )
- bRecalcDockSite = false;
- HWND hWndSrcFrame = NULL;
- if( m_pDockSite != NULL )
- {
- hWndSrcFrame = GetParentFrame()->GetSafeHwnd();
- if( hWndSrcFrame == pBarTarget->m_pDockSite->GetSafeHwnd() )
- hWndSrcFrame = NULL;
- } // if( m_pDockSite != NULL )
- HWND hWndBarTarget = pBarTarget->GetSafeHwnd();
- pBarTarget->_DraggingDoDeepHalfSplit(
- this,
- nDockBarID,
- nPercentToOccupy
- );
- bRecalcLayout = bRecalcDockSite = true;
- if( bRecalcLayout )
- {
- ASSERT_VALID( pParentFrame );
- pParentFrame->RecalcLayout();
- if( hWndSrcFrame != NULL && ::IsWindow(hWndSrcFrame) )
- {
- CWnd * pWnd = CWnd::FromHandlePermanent( hWndSrcFrame );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- CFrameWnd * pFrame =
- DYNAMIC_DOWNCAST( CFrameWnd, pWnd );
- if( pFrame != NULL )
- pFrame->RecalcLayout();
- } // if( pWnd != NULL )
- } // if( hWndSrcFrame != NULL && ::IsWindow(hWndSrcFrame) )
- if( bRecalcDockSite
- && ::IsWindow( hWndBarTarget )
- )
- pBarTarget->m_pDockSite->RecalcLayout();
- } // if( bRecalcLayout )
- CExtControlBar::stat_AdjustOccCompatibilityTree( pDockSite );
- return true;
- }
- // dock control bar to new row
- bool CExtControlBar::DockControlBar(
- UINT nDockBarID,
- UINT nCircleNo,
- CFrameWnd * pDockSite, // = NULL // can be NULL only if bar already was at once docked
- bool bRecalcLayout // = true
- )
- {
- ASSERT_VALID( this );
- ASSERT_KINDOF( CExtControlBar, this );
- if( pDockSite == NULL )
- pDockSite = m_pDockSite;
- ASSERT_VALID( pDockSite );
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- CExtDockBar * pDockBar =
- STATIC_DOWNCAST(
- CExtDockBar,
- pDockSite->GetControlBar( nDockBarID )
- );
- ASSERT_VALID( pDockBar );
- ASSERT( pDockBar->_GetCircleNo() == 0 );
- if( nCircleNo == 0 )
- {
- pDockBar->_InnerOuterDockControlBar(
- this,
- true
- );
- if( bRecalcLayout )
- pDockSite->RecalcLayout();
- CExtControlBar::stat_AdjustOccCompatibilityTree( pDockSite );
- return true;
- }
- ASSERT( !IsFixedMode() );
- pDockBar = pDockBar->_GetBarByCircleNo( nCircleNo );
- ASSERT_VALID( pDockBar );
- ASSERT( pDockBar->_GetCircleNo() == nCircleNo );
- pDockBar->_InnerOuterDockControlBar(
- this,
- true
- );
- if( bRecalcLayout )
- pDockSite->RecalcLayout();
- CExtControlBar::stat_AdjustOccCompatibilityTree( pDockSite );
- return true;
- }
- // dock control bar relatively to other control bar
- bool CExtControlBar::DockControlBar(
- CExtControlBar * pBar,
- bool bHorzBarHalfSplit,
- bool bInnerHalfSplit, // = false
- CFrameWnd * pDockSite, // = NULL // can be NULL only if bar already was at once docked
- bool bRecalcLayout // = true
- )
- {
- ASSERT_VALID( this );
- ASSERT_KINDOF( CExtControlBar, this );
- if( pDockSite == NULL )
- pDockSite = m_pDockSite;
- ASSERT_VALID( pDockSite );
- ASSERT_VALID( pBar );
- ASSERT(
- pBar->m_pDockSite == m_pDockSite
- || pBar->m_pDockSite == NULL
- );
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CDockBar, m_pDockBar );
- ASSERT( !IsFixedMode() );
- ASSERT( !pBar->IsFixedMode() );
- #ifdef _DEBUG
- if( pBar->m_pDockBar != NULL )
- {
- ASSERT_VALID( pBar->m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, pBar->m_pDockBar );
- }
- #endif // _DEBUG
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- {
- CExtControlBar * pParentBar =
- STATIC_DOWNCAST(
- CExtControlBar,
- m_pDockBar->GetParent()
- );
- ASSERT_VALID( pParentBar );
- return
- pParentBar->
- DockControlBar(
- pBar,
- bHorzBarHalfSplit,
- bInnerHalfSplit,
- pDockSite,
- bRecalcLayout
- );
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CRect rc;
- GetWindowRect( &rc );
- // rc.bottom = rc.top + rc.Height()/2;
- // rc.right = rc.left + rc.Width()/2;
- InternalDraggingState_t _ds;
- _ds.ExtBarSrcSet( pBar );
- _ds.ExtBarDstSet( this );
- _ds.SetEmpty( false );
- _ds.TrackRectSet( rc );
- // pBar->m_sizeDockedH = m_sizeDockedH;
- // pBar->m_sizeDockedV = m_sizeDockedV;
- UINT nOwnDockBarID = GetSafeDockBarDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID( nOwnDockBarID );
- switch( nOwnDockBarID )
- {
- case AFX_IDW_DOCKBAR_FLOAT:
- _ds.SetCDT(
- bHorzBarHalfSplit
- ? (bInnerHalfSplit ? __ECDT_INNER_TOP : __ECDT_INNER_BOTTOM)
- : (bInnerHalfSplit ? __ECDT_INNER_LEFT : __ECDT_INNER_RIGHT)
- );
- _ds.SetDeepHalfSplit( true );
- break;
- case AFX_IDW_DOCKBAR_LEFT:
- _ds.SetCDT(
- bHorzBarHalfSplit
- ? (bInnerHalfSplit ? __ECDT_INNER_TOP : __ECDT_INNER_BOTTOM)
- : (bInnerHalfSplit ? __ECDT_INNER_RIGHT : __ECDT_INNER_LEFT)
- );
- _ds.SetDeepHalfSplit( !bHorzBarHalfSplit );
- break;
- case AFX_IDW_DOCKBAR_RIGHT:
- _ds.SetCDT(
- bHorzBarHalfSplit
- ? (bInnerHalfSplit ? __ECDT_INNER_TOP : __ECDT_INNER_BOTTOM)
- : (bInnerHalfSplit ? __ECDT_INNER_LEFT : __ECDT_INNER_RIGHT)
- );
- _ds.SetDeepHalfSplit( !bHorzBarHalfSplit );
- break;
- case AFX_IDW_DOCKBAR_TOP:
- _ds.SetCDT(
- bHorzBarHalfSplit
- ? (bInnerHalfSplit ? __ECDT_INNER_LEFT : __ECDT_INNER_RIGHT)
- : (bInnerHalfSplit ? __ECDT_INNER_BOTTOM : __ECDT_INNER_TOP)
- );
- _ds.SetDeepHalfSplit( bHorzBarHalfSplit );
- break;
- case AFX_IDW_DOCKBAR_BOTTOM:
- _ds.SetCDT(
- bHorzBarHalfSplit
- ? (bInnerHalfSplit ? __ECDT_INNER_LEFT : __ECDT_INNER_RIGHT)
- : (bInnerHalfSplit ? __ECDT_INNER_TOP: __ECDT_INNER_BOTTOM)
- );
- _ds.SetDeepHalfSplit( bHorzBarHalfSplit );
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- return false;
- #endif // _DEBUG
- } // switch( nOwnDockBarID )
- // tmp
- //_ds.SetDeepHalfSplit( true );
- bool bRetVal = _DraggingApplyState( _ds, true );
-
- if( bRecalcLayout )
- pDockSite->RecalcLayout();
- else
- pDockSite->DelayRecalcLayout();
- CExtControlBar::stat_AdjustOccCompatibilityTree( pDockSite );
- return bRetVal;
- }
- // dock control bar into tabbed container
- bool CExtControlBar::DockControlBarIntoTabbedContainer(
- CExtControlBar * pBar,
- INT nIndex, // = -1, // append
- CFrameWnd * pDockSite, // = NULL // can be NULL only if bar already was at once docked
- bool bRecalcLayout // = true
- )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ASSERT_VALID( this );
- ASSERT_KINDOF( CExtControlBar, this );
- if( pDockSite == NULL )
- pDockSite = m_pDockSite;
- ASSERT_VALID( pDockSite );
- ASSERT_VALID( pBar );
- ASSERT(
- pBar->m_pDockSite == m_pDockSite
- || pBar->m_pDockSite == NULL
- );
- ASSERT( pBar != this );
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CDockBar, m_pDockBar );
- #ifdef _DEBUG
- if( pBar->m_pDockBar != NULL )
- {
- ASSERT( pBar->m_pDockSite == pDockSite );
- ASSERT_VALID( pBar->m_pDockBar );
- ASSERT_KINDOF( CDockBar, pBar->m_pDockBar );
- }
- #endif // _DEBUG
- if( ( ! _CanDockToTabbedContainers( pBar ) )
- || (! pBar->_CanDockToTabbedContainers( this ) )
- || IsFixedMode()
- || IsFixedDockStyle()
- || pBar->IsFixedMode()
- || pBar->IsFixedDockStyle()
- )
- return false;
- if( IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) )
- {
- ASSERT( !m_bUpdatingChain );
- ASSERT( !pBar->m_bUpdatingChain );
- CFrameWnd * pOldFrame = pBar->GetParentFrame();
- HWND hWndOldFrame = pOldFrame->GetSafeHwnd();
- m_bUpdatingChain = true;
- pBar->m_bUpdatingChain = true;
- if( pBar->m_pDockBar != NULL )
- pBar->GetParentFrame()->DelayRecalcLayout();
- BOOL bInsertingOtherTabs =
- pBar->IsKindOf(
- RUNTIME_CLASS(CExtDynTabControlBar)
- );
- //((CExtDynTabControlBar *)(this)) -> SetSwitcherRedraw( false );
- ((CExtDynTabControlBar *)(this)) ->
- InsertBar( pBar, nIndex, false );
- if( nIndex < 0 )
- nIndex =
- ((CExtDynTabControlBar *)(this)) ->
- GetSwitcherItemCount() - 1;
- ((CExtDynTabControlBar *)(this)) ->
- SetSwitcherSelection( nIndex, true, false );
- ((CExtDynTabControlBar *)(this)) ->
- OnRepositionSingleChild( -1, -1, false );
- if( bRecalcLayout )
- {
- GetParentFrame()->RecalcLayout();
- // ASSERT_VALID( m_pDockBar );
- // m_pDockBar->CalcFixedLayout( TRUE, TRUE );
- }
- else
- GetParentFrame()->DelayRecalcLayout();
-
- HWND hWndBar = pBar->GetSafeHwnd();
- if( ! bInsertingOtherTabs )
- {
- ASSERT_VALID( pBar );
- pBar->OnRepositionSingleChild( -1, -1, false );
- } // if( ! bInsertingOtherTabs )
- else
- {
- POSITION pos = m_pDockSite->m_listControlBars.Find( pBar );
- if( pos != NULL )
- m_pDockSite->m_listControlBars.RemoveAt( pos );
- pBar->m_pDockBar->RemoveControlBar( pBar );
- if( ::IsWindow( hWndBar ) )
- pBar->DestroyWindow();
- } // else from if( ! bInsertingOtherTabs )
- m_bUpdatingChain = false;
- if( ::IsWindow( hWndBar ) )
- pBar->m_bUpdatingChain = false;
- if( bRecalcLayout )
- CExtDockBar::_OptimizeCircles( m_pDockSite );
- if( bRecalcLayout && ::IsWindow( hWndOldFrame ) )
- {
- ASSERT_VALID( pOldFrame );
- ASSERT(
- CWnd::FromHandlePermanent( hWndOldFrame )
- == pOldFrame
- );
- //if( pOldFrame != pBar->GetParentFrame() )
- pOldFrame->RecalcLayout();
- }
- if( ::IsWindow( hWndBar )
- && CWnd::FromHandlePermanent( hWndBar ) == pBar
- )
- CExtControlBar::stat_AdjustOccCompatibilityTree( pBar->m_pDockSite );
- if( bRecalcLayout )
- OnRepositionSingleChild( -1, -1, bRecalcLayout );
- return true;
- } // if( IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) )
- if( m_pDockBar != NULL )
- {
- ASSERT_VALID( m_pDockBar );
- if( m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- {
- CExtDynTabControlBar * pDynTabbed =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- m_pDockBar->GetParent()
- );
- ASSERT_VALID( pDynTabbed );
- return
- pDynTabbed->DockControlBarIntoTabbedContainer(
- pBar,
- nIndex,
- pDockSite,
- bRecalcLayout
- );
- }
- }
- ASSERT_VALID( this );
- ASSERT_KINDOF( CExtControlBar, this );
- ASSERT( !IsFixedMode() );
- ASSERT_VALID( m_pDockSite );
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CDockBar, m_pDockBar );
-
- CDockBar * pDockBarIn = m_pDockBar;
- // STATIC_DOWNCAST( CExtDockBar, m_pDockBar );
- CDockBar * pDockBarOut = pBar->m_pDockBar;
- // STATIC_DOWNCAST( CExtDockBar, pBar->m_pDockBar );
- bool bOptimizeOuterDockBarLayout = false;
- HWND hWndDockBarOuter = NULL;
- if( pDockBarOut != NULL )
- {
- if( pDockBarOut->IsKindOf(RUNTIME_CLASS(CExtDockBar)) )
- bOptimizeOuterDockBarLayout = true;
- hWndDockBarOuter = pDockBarOut->GetSafeHwnd();
- }
- CFrameWnd * pOldFrame = pBar->GetParentFrame();
- HWND hWndOldFrame = pOldFrame->GetSafeHwnd();
- CRect rcDyn;
- GetWindowRect( &rcDyn );
- m_pDockBar->ScreenToClient( &rcDyn );
- DWORD dwDynStyle =
- GetStyle()
- | (GetBarStyle() & CBRS_ALIGN_ANY)
- ;
- dwDynStyle |= CBRS_BORDER_ANY | CBRS_GRIPPER;
- dwDynStyle &= ~( CBRS_FLOATING );
- dwDynStyle |= CBRS_TOOLTIPS;
- UINT nNewID = GetSafeDockBarDlgCtrlID();
- CExtDynTabControlBar * pDynBar = NULL;
- pDockSite->SendMessage(
- g_nMsgCreateTabbedBar,
- WPARAM( &pDynBar )
- );
- #ifdef _DEBUG
- if( pDynBar != NULL )
- {
- ASSERT_VALID( pDynBar );
- ASSERT_KINDOF( CExtDynTabControlBar, pDynBar );
- } // if( pDynBar != NULL )
- #endif // _DEBUG
- if( pDynBar == NULL )
- pDynBar = new CExtDynTabControlBar;
- // pDynBar->SetInitDesiredSizeHorizontal( m_sizeDockedH );
- // pDynBar->SetInitDesiredSizeVertical( m_sizeDockedV );
- if( ! pDynBar->Create(
- NULL,
- m_pDockSite,
- nNewID,
- dwDynStyle
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- ASSERT( pDynBar->m_pWndDynDocker != NULL );
- ASSERT( pDynBar->m_pWndDynDocker->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow(pDynBar->m_pWndDynDocker->GetSafeHwnd()) );
- pDynBar->m_pDockSite = m_pDockSite;
- pDynBar->m_pDockBar = m_pDockBar;
- pDynBar->EnableDocking( CBRS_ALIGN_ANY );
- ASSERT( pDynBar->m_pDockContext != NULL );
- ASSERT( pDynBar->m_pDockContext->m_pDockSite == m_pDockSite );
- //#ifdef _DEBUG
- //INT nPosOut = pDockBarOut->FindBar( pBar );
- // ASSERT( nPosOut > 0 && nPosOut < pDockBarOut->m_arrBars.GetSize() );
- //#endif // _DEBUG
- INT nPosIn = pDockBarIn->FindBar( this );
- ASSERT( nPosIn > 0 && nPosIn < pDockBarIn->m_arrBars.GetSize() );
- pDockBarIn->m_arrBars[ nPosIn ] = pDynBar;
- pDynBar->m_pDockBar->m_bFloating = m_pDockBar->m_bFloating;
- m_pDockBar = pDynBar->m_pWndDynDocker;
- // pBar->m_pDockBar = pDynBar->m_pWndDynDocker;
- m_pDockBar->m_bFloating = FALSE;
-
- if( pDynBar->m_pDockBar->m_bFloating )
- pDynBar->m_pDockBar->SetBarStyle(
- pDynBar->m_pDockBar->GetBarStyle()|CBRS_FLOATING
- );
- m_pDockBar->SetBarStyle(
- m_pDockBar->GetBarStyle() & (~CBRS_FLOATING)
- );
- SetBarStyle( GetBarStyle() & (~CBRS_FLOATING) );
- ASSERT( !m_bUpdatingChain );
- ASSERT( !((CExtControlBar *)pDynBar)->m_bUpdatingChain );
- ASSERT( !pBar->m_bUpdatingChain );
- m_bUpdatingChain = true;
- ((CExtControlBar *)pDynBar)->m_bUpdatingChain = true;
- pBar->m_bUpdatingChain = true;
-
- pDynBar->SetParent( pDockBarIn );
- SetParent( pDynBar->m_pWndDynDocker );
- pDynBar->m_pWndDynDocker->m_arrBars.Add( this );
- pDynBar->m_pWndDynDocker->m_arrBars.Add( NULL );
- // SetInitDesiredSizeHorizontal( rcDyn.Size() );
- // SetInitDesiredSizeVertical( rcDyn.Size() );
- //// pBar->SetInitDesiredSizeHorizontal( rcDyn.Size() );
- //// pBar->SetInitDesiredSizeVertical( rcDyn.Size() );
- ((CExtControlBar *)pDynBar)->m_sizeDockedH = m_sizeDockedH;
- ((CExtControlBar *)pDynBar)->m_sizeDockedV = m_sizeDockedV;
- ((CExtControlBar *)pDynBar)->m_sizeFloated = m_sizeFloated;
- CRect rcNew( rcDyn );
- rcNew.OffsetRect( -rcNew.TopLeft() );
- MoveWindow( &rcNew, FALSE );
- // pBar->MoveWindow( &rcNew, FALSE );
- // pDynBar->SetInitDesiredSizeFloating( rcDyn.Size() );
- /////// pDynBar->MoveWindow( &rcDyn, FALSE );
- ASSERT_VALID( pDynBar );
- ASSERT_VALID( pDynBar->m_pWndDynDocker );
- pDynBar->InsertControlBar( this );
- pDynBar->InsertBar( pBar, -1, false );
- m_bUpdatingChain = false;
- ((CExtControlBar *)pDynBar)->m_bUpdatingChain = false;
- pBar->m_bUpdatingChain = false;
- if( bOptimizeOuterDockBarLayout
- && ::IsWindow( hWndDockBarOuter )
- )
- {
- ASSERT_VALID( pDockBarOut );
- ((CExtDockBar*)pDockBarOut)->OnDynamicLayoutOptimize();
- }
- // temp
- CExtDockBar::_RemovePlaceHolder( m_pDockSite, this );
- CExtDockBar::_RemovePlaceHolder( m_pDockSite, pBar );
- CExtDockBar::_OptimizeCircles( m_pDockSite );
- ((CExtDockDynTabBar *)pDynBar->m_pWndDynDocker)->_RepositionTabbedChilds( true );
- pDynBar->SetSwitcherSelection( 0, true, false );
- CWnd * pWnd = pDynBar->GetParent();
- if( pWnd != NULL && pWnd->IsKindOf(RUNTIME_CLASS(CExtDockDynBar)) )
- {
- CExtDynControlBar * pParentLayoutBar = STATIC_DOWNCAST( CExtDynControlBar, pWnd->GetParent() );
- pParentLayoutBar->OnRepositionSingleChild();
- }
- CFrameWnd * pFrame = pDynBar->GetParentFrame();
- if( pFrame != NULL )
- {
- BOOL bMiniFrame =
- pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd));
- if( bMiniFrame || bRecalcLayout )
- {
- pDynBar->OnNcAreaButtonsReinitialize();
- pDynBar->OnNcAreaButtonsReposition();
- __RECALC_FRAME_STEPS( pFrame );
- if( bMiniFrame )
- {
- __RECALC_FRAME_STEPS( m_pDockSite );
- }
- } // if( bMiniFrame || bRecalcLayout )
- } // if( pFrame != NULL )
- if( bRecalcLayout && ::IsWindow( hWndOldFrame ) )
- {
- ASSERT_VALID( pOldFrame );
- ASSERT(
- CWnd::FromHandlePermanent( hWndOldFrame )
- == pOldFrame
- );
- if( pOldFrame != pFrame )
- pOldFrame->RecalcLayout();
- }
- CExtControlBar::stat_AdjustOccCompatibilityTree( m_pDockSite );
- return true;
- #else
- pBar;
- nIndex;
- pDockSite;
- bRecalcLayout;
- ASSERT( FALSE ); // no implementation
- return false;
- #endif // else from (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- bool CExtControlBar::_FloatStateChangingIsEnabled(
- const CExtControlBar * pBarQuerySrc
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pBarQuerySrc );
- pBarQuerySrc;
- return (! g_bLockAllBars );
- }
- bool CExtControlBar::_NcMenuButtonIsEnabled(
- const CExtControlBar * pBarQuerySrc
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pBarQuerySrc );
- pBarQuerySrc;
- return (! g_bLockAllBars );
- }
- bool CExtControlBar::_ClosingIsEnabled(
- const CExtControlBar * pBarQuerySrc
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pBarQuerySrc );
- pBarQuerySrc;
- return (! g_bLockAllBars );
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bool CExtControlBar::_AutoHidingIsEnabled(
- const CExtControlBar * pBarQuerySrc
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pBarQuerySrc );
- pBarQuerySrc;
- return (! g_bLockAllBars );
- }
- INT CExtControlBar::AutoHideWidthGet() const
- {
- ASSERT_VALID( this );
- return m_nAutoHideWidth;
- }
- void CExtControlBar::AutoHideWidthSet( INT nAutoHideWidth )
- {
- ASSERT_VALID( this );
- m_nAutoHideWidth = nAutoHideWidth;
- }
- INT CExtControlBar::AutoHideHeightGet() const
- {
- ASSERT_VALID( this );
- return m_nAutoHideHeight;
- }
- void CExtControlBar::AutoHideHeightSet( INT nAutoHideHeight )
- {
- ASSERT_VALID( this );
- m_nAutoHideHeight = nAutoHideHeight;
- }
- // is bar in autohide mode
- bool CExtControlBar::AutoHideModeGet() const
- {
- ASSERT_VALID( this );
- #ifdef _DEBUG
- if( m_bAutoHideMode )
- {
- ASSERT( !IsFixedMode() );
- ASSERT( !IsFixedDockStyle() );
- }
- #endif // _DEBUG
- return m_bAutoHideMode;
- }
- // switch to/restore from autohide mode
- bool CExtControlBar::AutoHideModeSet(
- bool bAutoHideMode,
- bool bAnimate,
- bool bRecalcLayout,
- bool bForceNoShow
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pDockBar );
- if( bAutoHideMode || m_bAutoHideMode )
- {
- if( IsFixedMode() || IsFixedDockStyle() )
- {
- ASSERT( FALSE );
- return false;
- }
- }
- if( IsFloating() )
- {
- ASSERT( FALSE );
- return false;
- }
- if( bAutoHideMode == m_bAutoHideMode )
- return true;
- CExtDockBar * pDockBar =
- STATIC_DOWNCAST( CExtDockBar, m_pDockBar );
- if( pDockBar->IsKindOf( RUNTIME_CLASS(CExtDockDynTabBar) ) )
- {
- CExtDynTabControlBar * pTabbedBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- m_pDockBar->GetParent()
- );
- ((CExtControlBar *)pTabbedBar)->m_nDelayedRowUpdateMetric = 0;
- bool bRetVal =
- pTabbedBar->AutoHideModeSet(
- bAutoHideMode,
- bAnimate,
- bRecalcLayout,
- bAutoHideMode ? true : bForceNoShow
- );
- ASSERT( bAutoHideMode == m_bAutoHideMode );
- return bRetVal;
- }
- CExtDynAutoHideArea * pWndAutoHideArea =
- pDockBar->_GetAutoHideArea();
- if( pWndAutoHideArea == NULL )
- {
- // FrameInjectAutoHideAreas was not called
- ASSERT( FALSE );
- return false;
- }
- ASSERT_VALID( pWndAutoHideArea );
- if( bAutoHideMode )
- {
- if( IsVisible() )
- {
- m_pDockSite->ShowControlBar( this, FALSE, TRUE );
- ASSERT( !IsVisible() );
- m_pDockSite->DelayRecalcLayout();
- } // if( IsVisible() )
- pWndAutoHideArea->AppendControlBar(
- this,
- bForceNoShow
- );
- CExtControlBar * pBar = NULL;
- CExtDynTabControlBar * pTabbedBar =
- DYNAMIC_DOWNCAST(
- CExtDynTabControlBar,
- m_pDockBar->GetParent()
- );
- if( pTabbedBar != NULL )
- {
- LONG nSel = pTabbedBar->GetSwitcherSelection();
- if( nSel >= 0 )
- pBar = pTabbedBar->GetBarAt( nSel, true );
- }
- else
- pBar = this;
- if( pBar != NULL )
- {
- CWnd * pWndParent = pBar->m_pDockBar;
- for( ; true ; )
- {
- ASSERT_VALID( pWndParent );
- if( pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockBar)) )
- {
- if( ! pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockDynBar)) )
- {
- ASSERT( pWndParent->GetParent() == m_pDockSite );
- break;
- } // if( ! pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockDynBar)) )
- } // if( pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockBar)) )
- pWndParent = pWndParent->GetParent();
- } // for( ; true ; )
- ASSERT_KINDOF( CExtDockBar, pWndParent );
- ASSERT( ((CExtDockBar*)pWndParent)->_GetCircleNo() > 0 );
- UINT nTopDockBarID = pWndParent->GetDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nTopDockBarID );
- CExtDockBar * pOuterDocker =
- STATIC_DOWNCAST(
- CExtDockBar,
- m_pDockSite->GetControlBar( nTopDockBarID )
- );
- ASSERT_VALID( pOuterDocker );
- ASSERT( UINT(pOuterDocker->GetDlgCtrlID()) == nTopDockBarID );
-
- CExtDynAutoHideArea * pAutoHideArea =
- pOuterDocker->_GetAutoHideArea();
- ASSERT_VALID( pAutoHideArea );
- ASSERT( UINT(pAutoHideArea->GetDlgCtrlID()) == nTopDockBarID );
- LONG nPos = pAutoHideArea->FindControlBar( pBar );
- if( nPos >= 0 )
- {
- CExtTabWnd::TAB_ITEM_INFO * pTII =
- pAutoHideArea->ItemGet( nPos );
- pTII->ModifyItemStyle( 0, __ETWI_IN_GROUP_ACTIVE );
- }
- }
-
- } // if( bAutoHideMode )
- else
- {
- ASSERT( !IsVisible() );
- //m_pDockSite->ShowControlBar( this, TRUE, TRUE );
- m_pDockSite->DelayRecalcLayout();
- pWndAutoHideArea->RemoveControlBar(
- this,
- bForceNoShow
- );
- if( bForceNoShow )
- {
- HWND hWnd =
- ::GetWindow(
- ::GetParent(pWndAutoHideArea->m_hWnd),
- GW_CHILD
- );
- TCHAR sClassName[ _MAX_PATH + 1 ];
- for( ; hWnd != NULL; hWnd = ::GetWindow(hWnd,GW_HWNDNEXT) )
- {
- ::memset( sClassName, 0, sizeof(sClassName) );
- ::GetClassName(
- hWnd,
- sClassName,
- _MAX_PATH
- );
- if( _tcscmp( sClassName,__AUTOHIDE_SLIDER_WNDCLASS ) == 0 )
- {
- ::SendMessage( hWnd, WM_CANCELMODE, 0L, 0L );
- break;
- }
- } // for( ; hWnd != NULL; hWnd = ::GetWindow(hWnd,GW_HWNDNEXT) )
- CExtDynTabControlBar * pTabbedBar =
- DYNAMIC_DOWNCAST( CExtDynTabControlBar, this );
- if( pTabbedBar != NULL )
- {
- LONG nPos, nCount = pTabbedBar->GetSwitcherItemCount();
- for( nPos = 0; nPos < nCount; nPos++ )
- {
- CExtControlBar * pBar =
- pTabbedBar->GetBarAt( nPos, true );
- if( pBar->IsVisible() )
- m_pDockSite->ShowControlBar( pBar, FALSE, TRUE );
- #if (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- CExtDynamicControlBar * pDynamicBar =
- DYNAMIC_DOWNCAST( CExtDynamicControlBar, pBar );
- if( pDynamicBar != NULL )
- pDynamicBar->BarStateSet(
- CExtDynamicControlBar::__EDBS_DOCKED,
- false
- );
- #endif // (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- } // for( nPos = 0; nPos < nCount; nPos++ )
- } // if( pTabbedBar != NULL )
- } // if( bForceNoShow )
- else
- {
- #if (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- CExtDynTabControlBar * pTabbedBar =
- DYNAMIC_DOWNCAST( CExtDynTabControlBar, this );
- if( pTabbedBar != NULL )
- {
- LONG nPos, nCount = pTabbedBar->GetSwitcherItemCount();
- for( nPos = 0; nPos < nCount; nPos++ )
- {
- CExtControlBar * pBar =
- pTabbedBar->GetBarAt( nPos, true );
- CExtDynamicControlBar * pDynamicBar =
- DYNAMIC_DOWNCAST( CExtDynamicControlBar, pBar );
- if( pDynamicBar != NULL )
- pDynamicBar->BarStateSet(
- CExtDynamicControlBar::__EDBS_DOCKED,
- true
- );
- } // for( nPos = 0; nPos < nCount; nPos++ )
- } // if( pTabbedBar != NULL )
- #endif // (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- } // else from if( bForceNoShow )
- } // else from if( bAutoHideMode )
- m_bAutoHideMode = bAutoHideMode;
- CExtControlBar::stat_AdjustOccCompatibilityTree( m_pDockSite );
- if( bRecalcLayout )
- {
- // tricky chain visibility updating
- bool bSaved = m_bAutoHideMode;
- m_bAutoHideMode = false;
- ((InternalFriendlyFrameWnd*)m_pDockSite)->m_bInRecalcLayout = TRUE;
- _UpdateVisibilityInChain();
- ((InternalFriendlyFrameWnd*)m_pDockSite)->m_bInRecalcLayout = FALSE;
- m_bAutoHideMode = bSaved;
- m_pDockSite->RecalcLayout();
- if( ! m_bAutoHideMode )
- {
- OnNcAreaButtonsReposition();
- PostMessage( WM_NCPAINT );
- PostMessage( WM_TIMER, __TIMER_ID_DRELAYED_REPAINT_FAKE );
- } // if( ! m_bAutoHideMode )
- CExtPaintManager::stat_PassPaintMessages();
- } // if( bRecalcLayout )
- return true;
- }
- bool CExtControlBar::OnQueryVisibilityInAutoHideTabs() const
- {
- ASSERT_VALID( this );
- return true;
- }
- bool CExtControlBar::OnQueryVisibilityInContainerTabs() const
- {
- ASSERT_VALID( this );
- return true;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- void CExtControlBar::OnShowWindow(BOOL bShow, UINT nStatus)
- {
- CControlBar::OnShowWindow(bShow, nStatus);
- CExtPopupMenuTipWnd * pATTW =
- OnAdvancedPopupMenuTipWndGet();
- if( pATTW != NULL )
- pATTW->Hide();
-
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite = NotifiedCustomizeSiteGet();
- if( pSite != NULL )
- pSite->OnBarStateChanged( this );
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( nStatus != 0 )
- return;
- _UpdateVisibilityInChain();
- }
- bool CExtControlBar::stat_FindSingleVisbleBarNested(
- CDockBar * pDockBar,
- CExtControlBar ** ppFoundBar
- )
- {
- ASSERT_VALID( pDockBar );
- ASSERT( pDockBar->GetSafeHwnd() != NULL );
- ASSERT_KINDOF( CDockBar, pDockBar );
- ASSERT( pDockBar->IsDockBar() );
- ASSERT( ppFoundBar != NULL );
- INT nIndex, nCount = INT( pDockBar->m_arrBars.GetSize() );
- for( nIndex = 0; nIndex < nCount; nIndex++ )
- {
- CControlBar * pBar = (CControlBar *)pDockBar->m_arrBars.GetAt( nIndex );
- if( pBar == NULL )
- continue;
- if( __PLACEHODLER_BAR_PTR( pBar ) )
- continue;
- ASSERT_VALID( pBar );
- ASSERT_KINDOF( CControlBar, pBar );
- ASSERT( ! pBar->IsDockBar() );
- if( ! pBar->IsVisible() )
- continue;
- CExtControlBar * pExtBar = DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar == NULL )
- continue;