void CMergeEditFrame::ActivateFrame(int nCmdShow) { // load docking positions and sizes CDockState pDockState; pDockState.LoadState(_T("Settings")); if (EnsureValidDockState(pDockState)) // checks for valid so won't ASSERT SetDockState(pDockState); // for the dimensions of the diff and location pane, use the CSizingControlBar loader m_wndLocationBar.LoadState(_T("Settings")); m_wndDetailBar.LoadState(_T("Settings")); if (!m_bActivated) { m_bActivated = true; // get the active child frame, and a flag whether it is maximized BOOL bMaximized = FALSE; CMDIChildWnd * oldActiveFrame = GetMDIFrame()->MDIGetActive(&bMaximized); if (oldActiveFrame == nullptr) // for the first frame, get the restored/maximized state from the registry bMaximized = GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX); if (bMaximized) nCmdShow = SW_SHOWMAXIMIZED; else nCmdShow = SW_SHOWNORMAL; } CMDIChildWnd::ActivateFrame(nCmdShow); }
void CChildFrame::ActivateFrame(int nCmdShow) { BOOL bMaximized = FALSE; CMDIChildWnd * oldActiveFrame = GetMDIFrame()->MDIGetActive(&bMaximized); if (!m_bActivated) { m_bActivated = TRUE; // get the active child frame, and a flag whether it is maximized if (oldActiveFrame == NULL) // for the first frame, get the restored/maximized state from the registry bMaximized = theApp.GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), FALSE); if (bMaximized) nCmdShow = SW_SHOWMAXIMIZED; else nCmdShow = SW_SHOWNORMAL; } // load the bars layout // initialize the diff pane state with default dimension int initialDiffHeight = ((CMergeDiffDetailView*)m_wndDetailSplitter.GetPane(1,0))->ComputeInitialHeight(); UpdateDiffDockbarHeight(initialDiffHeight); // load docking positions and sizes CDockState pDockState; pDockState.LoadState(_T("Settings")); if (EnsureValidDockState(pDockState)) // checks for valid so won't ASSERT SetDockState(pDockState); // for the dimensions of the diff and location pane, use the CSizingControlBar loader m_wndLocationBar.LoadState(_T("Settings")); m_wndDetailBar.LoadState(_T("Settings")); if (bMaximized) { // If ActivateFrame() is called without tricks, Resizing panes in MergeView window could be visible. // Here, two tricks are used. // [First trick] // To complete resizing panes before displaying MergeView window, // it needs to send WM_SIZE message with SIZE_MAXIMIZED to MergeView window before calling ActivateFrame(). // [Second trick] // But it causes side effect that DirView window becomes restored window from maximized window // and the process could be visible. // To avoid it, it needs to block the redrawing DirView window. // I had tried to use LockWindowUpdate for this purpose. However, it had caused flickering desktop icons. // So instead of using LockWindowUpdate(), // I wrote My[Lock/Unlock]WindowUpdate() function that uses subclassing window. // if (oldActiveFrame) MyLockWindowUpdate(oldActiveFrame->m_hWnd); RECT rc; GetClientRect(&rc); SendMessage(WM_SIZE, SIZE_MAXIMIZED, MAKELPARAM(rc.right, rc.bottom)); CMDIChildWnd::ActivateFrame(nCmdShow); if (oldActiveFrame) MyUnlockWindowUpdate(oldActiveFrame->m_hWnd); } else { RecalcLayout(); CMDIChildWnd::ActivateFrame(nCmdShow); } }