Beispiel #1
0
LRESULT CMainFrame::OnProgressUpdate(WPARAM wParam, LPARAM lParam)
{

    CMFCRibbonProgressBar * elem = reinterpret_cast<CMFCRibbonProgressBar * >(m_wndStatusBar.GetExElement(1));
    if (lParam == 0)
    {
        elem->SetRange(1, 1);
        elem->SetPos(0);
    }
    else
    {
        int max = elem->GetRangeMax();
        if (max < lParam)
        {
            elem->SetRange(1, lParam);
        }
        elem->SetPos(max-lParam);
    }
    return 0;
}
Beispiel #2
0
void CMainFrame::SetProgressPos (int nPos, UINT nID)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> ar;
	m_wndRibbonBar.GetElementsByID (nID, ar);

	for (int i = 0; i < ar.GetSize (); i++)
	{
		CMFCRibbonProgressBar* pProgress = DYNAMIC_DOWNCAST (CMFCRibbonProgressBar, ar[i]);
		if (pProgress != NULL)
		{
			if (pProgress->GetPos () != nPos)
			{
				pProgress->SetPos (nPos);
			}
		}
	}
}
Beispiel #3
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
        return -1;

    m_wndClientArea.ModifyStyleEx(WS_EX_CLIENTEDGE, 0);

    // create a view to occupy the client area of the frame
    //if (!m_wndView.Create(IDD_ABOUTBOX, this))
    //m_wndView.Create(GetSafeHwnd(), CRect(10,300,100,330), _T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, NULL, 2);
    //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    //{
    //	TRACE0("Failed to create view window\n");
    //	return -1;
    //}
    // set the visual manager and style based on persisted value
    OnApplicationLook(theApp.m_nAppLook);

    //// create a view to occupy the client area of the frame
    //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    //{
    //	TRACE0("Failed to create view window\n");
    //	return -1;
    //}

    boost::filesystem::path iniPath;
    GetIniPath(iniPath);
    CComPtr<IConfig> ini = CreateIConfig(AMT_INI, iniPath);
    CString config1( ini->Get(g_szConfigSection, RepLabel1, _T("0")) );
    CString config2( ini->Get(g_szConfigSection, RepLabel2, _T("1")) );

    m_splitter.Create(m_hWndMDIClient, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

    m_repositoryDlg.Create(m_splitter);

    //m_detailSheetView.SetReflectNotifications(true);
    m_detailSheetView.SetTabStyles(CTCS_BOTTOM | CTCS_TOOLTIPS);
    m_detailSheetView.Create(m_splitter, ATL::CWindow::rcDefault);
    //m_detailView.SetFont(WTL::AtlGetDefaultGuiFont());

    m_sourceEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault);
    m_sourceEclView.DoInit();
    m_sourceEclView.SetReadOnly(true);
    //TODO:  InitEclCommandMixin(this, this, &m_sourceEclView, this);
    m_detailSheetView.AddTab(m_sourceEclView, _T("Source ECL"));

    m_diffView.Create(m_detailSheetView, ATL::CWindow::rcDefault, _T(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE);
    m_detailSheetView.AddTab(m_diffView, _T("Differences"));

    m_targetEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault);
    m_targetEclView.DoInit();
    m_targetEclView.SetReadOnly(true);
    //TODO:  InitEclCommandMixin(this, this, &m_targetEclView, this);
    m_detailSheetView.AddTab(m_targetEclView, _T("Target ECL"));

    m_dependees.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE);
    m_dependees.SetFont(WTL::AtlGetDefaultGuiFont());
    m_detailSheetView.AddTab(m_dependees, _T("Dependee Check"));

    m_logView.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | LBS_NOINTEGRALHEIGHT, WS_EX_CLIENTEDGE);
    m_logView.SetFont(WTL::AtlGetDefaultGuiFont());
    m_detailSheetView.AddTab(m_logView, _T("Log"));

    WTL::CEdit edit;
    edit.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE);

    CString face = _T("MS Shell Dlg");
    int nPointSize = 8;

    WTL::CFont font;
    WTL::CLogFont logFont;
    logFont.lfCharSet = DEFAULT_CHARSET;
    logFont.lfHeight = nPointSize*10;
    ::_tcsncpy(logFont.lfFaceName, face, LF_FACESIZE);
    logFont.lfWeight = FW_LIGHT;
    logFont.lfQuality = PROOF_QUALITY;
    logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
    logFont.lfOutPrecision = OUT_TT_PRECIS;
    if ( font.CreatePointFontIndirect(&logFont,0) )
    {
        edit.SetFont(font.Detach(),false);
    }
    m_warnView.SetEditCtrl(edit.Detach());

    m_detailSheetView.AddTab(m_warnView, _T("Warnings"));
    m_detailSheetView.GetTabCtrl().SetCurSel(1);

    m_splitter.SetSplitterPanes(m_repositoryDlg, m_detailSheetView);
    m_splitter.SetSplitterPosPct(50);

    m_wndRibbonBar.Create(this);
    InitializeRibbon();

    if (!m_wndStatusBar.Create(this))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }

    m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, _T(""), TRUE), _T(""));
    m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, _T(""), TRUE), _T(""));
    CMFCRibbonProgressBar * elem = new CMFCRibbonProgressBar(ID_STATUSBAR_PANE3);
    m_wndStatusBar.AddExtendedElement(elem, _T("Progress"));
    elem->SetRange(1, 1);
    elem->SetPos(0);

    // enable Visual Studio 2005 style docking window behavior
    CDockingManager::SetDockingMode(DT_SMART);
    // enable Visual Studio 2005 style docking window auto-hide behavior
    EnableAutoHidePanes(CBRS_ALIGN_ANY);

    // Enable enhanced windows management dialog
    //EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);

    HICON newIcon = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME_AMT));
    HICON oldIcon = SetIcon(newIcon, false);
    HICON oldIcon2 = SetIcon(newIcon, true);

    RecalcLayout();
    if ( !m_bStreamInit )
    {
        m_pOldBuf = std::cerr.rdbuf(&m_EditStrBuf);
        m_pOldBufW = std::wcerr.rdbuf(&m_EditStrBufW);
        m_bStreamInit = true;
    }

    PostMessage(UM_INITIALIZE);
    return 0;
}