Example #1
0
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);
}
Example #2
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	//create base
	if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;

	//create child controls
	if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) return -1;
	if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) return -1;
	m_wndStatusBar.SetPaneText( m_wndStatusBar.CommandToIndex(ID_INDICATOR_LINENUMBER), "" );
	m_wndStatusBar.SetPaneText( m_wndStatusBar.CommandToIndex(ID_INDICATOR_POINTS), "" );

	//turn on tooltips
	m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle()|CBRS_TOOLTIPS );

	//find the button to replace with the combo box
    int iPlaceHolder = 0;
    while( m_wndToolBar.GetItemID(iPlaceHolder) != ID_VIEW_SHEETSTYLE ) iPlaceHolder++;

    //change it to a separator and change it's width
    m_wndToolBar.SetButtonInfo( iPlaceHolder, ID_VIEW_SHEETSTYLE, TBBS_SEPARATOR, SHEETSTYLE_WIDTH );

    //get it's position on the toolbar and expand it so there is room for it to drop down
    RECT rc;
    m_wndToolBar.GetItemRect( iPlaceHolder, &rc );
    rc.bottom += 200;

    //create, change it's font and show it
    if(!m_wndSheetType.Create( WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL|CBS_DROPDOWNLIST|CBS_HASSTRINGS, rc, &m_wndToolBar, ID_VIEW_SHEETSTYLE)) return -1;
    m_wndSheetType.SendMessage( WM_SETFONT, (WPARAM)::GetStockObject(ANSI_VAR_FONT) );
    m_wndSheetType.ShowWindow(SW_SHOW);
    m_wndSheetType.EnableWindow(FALSE);

	//make toobar flat if requested by user
    if( AfxGetApp()->GetProfileInt( "Display", "FlatToolbar", TRUE ) == TRUE )
        m_wndToolBar.GetToolBarCtrl().ModifyStyle( 0, TBSTYLE_FLAT ); //make it flat

	//Initialize dialog bar m_wndOutput
	if (!m_wndOutput.Create(this, CSize(250,75), ID_VIEW_OUTPUT, CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC))
	{
		TRACE0("Failed to create output window\n");
		return -1;		// fail to create
	}

    m_wndOutput.SetWindowText( "Output" );
	m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking( CBRS_ALIGN_ANY );
	DockControlBar(&m_wndOutput, AFX_IDW_DOCKBAR_BOTTOM);
	ShowControlBar(&m_wndOutput, FALSE, FALSE);

	//Load in the docked toolbar positions
	CDockState dockState;
	CString szToolbarPositionsKey;
	szToolbarPositionsKey.LoadString( IDS_TOOLBARKEY );
	dockState.LoadState( szToolbarPositionsKey );
	SetDockState( dockState );
	// CG: The following line was added by the Splash Screen component.
	CSplashWnd::ShowSplashScreen(this);
	return 0;
}
Example #3
0
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	CDockState dockstate;
	if (CMDIChildWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_bEnableFloatingBars = true;

	if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR1) ||
		!m_ToolBar.LoadToolBar(IDR_TOOLBAR1))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	m_ToolBar.LoadToolBar(IDR_TOOLBAR1);
	m_ToolBar.SetPaneStyle( CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_TOP | CBRS_GRIPPER );
	m_ToolBar.EnableDocking( CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM );
	m_ToolBar.EnableReflections(true);
	EnableDocking(CBRS_ALIGN_ANY);
	
	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
	m_wndStatusBar.SetPaneStyle(0,SBPS_STRETCH);

	if (!m_SaveDialog.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR5) ||
		!m_SaveDialog.LoadToolBar(IDR_TOOLBAR5))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	m_SaveDialog.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
	EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_SaveDialog);
	DockPaneLeftOf(&m_ToolBar,&m_SaveDialog);

	m_SaveDialog.ShowWindow(true);
	
	dockstate.LoadState("ChildDockbars");
	SetDockState(dockstate);

	return 0;
}
Example #4
0
LRESULT CInPlaceFrame::OnBarState(WPARAM wParam, LPARAM lParam)
{
	if (lParam == -1)
		return 0L;
	if (wParam == 0)
	{
		GetDockState(theApp.GetDockState(RD_EMBEDDED));
		ASSERT(m_pMainFrame != NULL);
		m_pMainFrame->GetDockState(theApp.GetDockState(RD_EMBEDDED, FALSE));
	}
	else
	{
		SetDockState(theApp.GetDockState(RD_EMBEDDED));
		m_pMainFrame->SetDockState(theApp.GetDockState(RD_EMBEDDED, FALSE));
	}
	return 0L;
}
Example #5
0
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);
	}
}
Example #6
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	// CG: This line was added by the Palette Support component
	CDockState dockstate;

	if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;

	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7));
	CDockingManager::SetDockingMode(DT_SMART);
#if 0
	if (!m_wndMenuBar.Create(this))
	{
		TRACE0("Failed to create menubar\n");
		return -1;      // fail to create
	}

	m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | 
                          CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY );

	m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndMenuBar);
#endif

	// prevent the menu bar from taking the focus on activation
	CMFCPopupMenu::SetForceMenuFocus(FALSE);

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_MAINFRAME_TOOLBAR1) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME_TOOLBAR1))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
	m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
	
	int nOrigSize = sizeof(indicators) / sizeof(UINT);

	UINT* pIndicators = new UINT[nOrigSize + 2];
	memcpy(pIndicators, indicators, sizeof(indicators));

	// Call the Status Bar Component's status bar creation function
	if (!InitStatusBar(pIndicators, nOrigSize, 60))
	{
		TRACE0("Failed to initialize Status Bar\n");
		return -1;
	}
	delete[] pIndicators;

	// TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);

	if (!m_wndLoadFileBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR2) ||
		!m_wndLoadFileBar.LoadToolBar(IDR_TOOLBAR2))
	{
		TRACE0("Failed to create dialog bar m_wndLoadFileBar\n");
		return -1;		// fail to create
	}
	m_wndLoadFileBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);

	if (!m_wndGPS_HTMEAS.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR3) ||
		!m_wndGPS_HTMEAS.LoadToolBar(IDR_TOOLBAR3))
	{
		TRACE0("Failed to create dialog bar m_wndGPS_HTMEAS\n");
		return -1;		// fail to create
	}
		
	m_wndGPS_HTMEAS.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);

	if (!m_wndISOLDE_PROTONS.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR4) ||
		!m_wndISOLDE_PROTONS.LoadToolBar(IDR_TOOLBAR4))
	{
		TRACE0("Failed to create dialog bar m_wndISOLDE_PROTONS\n");
		return -1;		// fail to create
	}

	m_wndISOLDE_PROTONS.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
	EnableDocking(CBRS_ALIGN_ANY);

	// dock all panes in desired right to left order
	DockPane(&m_wndLoadFileBar);
	DockPaneLeftOf(&m_wndISOLDE_PROTONS,&m_wndLoadFileBar);
	DockPaneLeftOf(&m_wndGPS_HTMEAS,&m_wndISOLDE_PROTONS);
	DockPaneLeftOf(&m_wndToolBar,&m_wndGPS_HTMEAS);

	dockstate.LoadState("Dockbars");
	SetDockState(dockstate);

	CSplashWnd::ShowSplashScreen(this);

	mytimer = SetTimer(TimerID,1000,NULL);

	return 0;
}