예제 #1
0
파일: MainFrm.cpp 프로젝트: cw2018/xtpui
BOOL CMainFrame::BeforeLoadFrame(CFrameWnd* pMainWnd)
{
    m_mainwnd = pMainWnd;
    m_frameNode = g_factoryRoot.GetSection(L"mainframe");
    m_appid = g_factoryRoot->GetString(L"_appid");
    m_appname = g_factoryRoot->GetString(L"appname");
    m_id = GetNodeID(m_frameNode, L"id");
    ASSERT(!m_appname.empty());

    m_barsfile = getConfigPath() + g_factoryRoot->GetString(L"cmdbarsFile", L"cmdbars.xml");

    return TRUE;
}
예제 #2
0
파일: MainFrm.cpp 프로젝트: cw2018/xtpui
BOOL CMainFrame::CreateRibbonBar()
{
    std::wstring xcbfile(getConfigPath() + g_factoryRoot->GetString(L"xcbfile"));
    CFile file(xcbfile.c_str(), CFile::modeRead);
    CArchive ar(&file, CArchive::load);
    
    m_cmdbars->LoadDesignerBars(ar);

    CXTPRibbonBar* pRibbonBar = DYNAMIC_DOWNCAST(
        CXTPRibbonBar, m_cmdbars->GetMenuBar());
    if (NULL == pRibbonBar)
        return FALSE;

    SetRibbonFont();

    std::wstring themeName(getUIOptions()->GetString(L"themeName"));
    if (themeName.find(L"WINDOWS7") != std::wstring::npos
        || themeName.find(L"OFFICE201") != std::wstring::npos)
    {
        pRibbonBar->GetSystemButton()->SetStyle(xtpButtonCaption);
    }
    pRibbonBar->EnableFrameTheme();

    return TRUE;
}
예제 #3
0
void CFrameWndFactory::RegisterDocTemplate(bool mdi, const ConfigSection& frame, 
                                           const ConfigSection& views)
{
    UINT id = frame->GetUInt32(L"id");
    ASSERT(id != 0);
    ViewItem item;

    if (mdi)
    {
        for (int i = 0; i < 20; i++)
        {
            ConfigSection view(views.GetSectionByIndex(L"view", i));

            if (!view->IsValid())
                break;
            
            item.frameID = view->GetUInt32(L"id", id);
            item.layout = view->GetString(L"layout");
            item.caption = view->GetString(L"caption");
            item.clsid = view->GetString(L"clsid");

            item.pTemplate = new CMultiDocTemplate(
                item.frameID,
                RUNTIME_CLASS(CDummyDoc),
                RUNTIME_CLASS(CChildFrame),
                RUNTIME_CLASS(CEmbedView));
            AfxGetApp()->AddDocTemplate(item.pTemplate);
            s_views.push_back(item);
        }
    }
    else
    {
        item.pTemplate = new CSingleDocTemplate(id,
            RUNTIME_CLASS(CDummyDoc),
            RUNTIME_CLASS(CMainSDIFrame),
            RUNTIME_CLASS(CEmbedView));
        AfxGetApp()->AddDocTemplate(item.pTemplate);

        item.clsid = frame->GetString(L"viewClsid");
        if (!item.clsid.empty())
            s_views.push_back(item);
    }
}
예제 #4
0
파일: MainFrm.cpp 프로젝트: cw2018/xtpui
UINT CMainFrame::GetNodeID(const ConfigSection& node, LPCWSTR name)
{
    UINT id = node->GetUInt32(name);
    std::wstring strname(node->GetString(name));
    size_t pos = strname.find(L' ');

    if (id != 0 && pos != strname.npos)
    {
        strname = strname.substr(pos + 1);

        TRACE2("String ID: %d, %s\n", id, strname.c_str());
        ASSERT(strname.find(L' ') == strname.npos && !strname.empty());

        std::map<std::wstring, UINT>::iterator it = m_idnames.find(strname);
        ASSERT_MESSAGE(it == m_idnames.end() || it->second == id,
            "A string name must has only one ID value in the factory xml.");

        m_idnames[strname] = id;
    }

    return id;
}