Exemplo n.º 1
0
BOOL RichEditOleBase::InitOleWindow(IRichEditObjHost* pHost)
{
    BOOL bRet = FALSE;
    if(!m_strXmlLayout.IsEmpty())
    {
        pugi::xml_document xmlDoc;
        SStringTList strLst;

        if(2 == ParseResID(m_strXmlLayout,strLst))
        {
            LOADXML(xmlDoc,strLst[1],strLst[0]);
        }else
        {
            LOADXML(xmlDoc,strLst[0],RT_LAYOUT);
        }    
        
        if (xmlDoc)
        {
            m_oleWindow.SetHostRichEdit(pHost);
            bRet = m_oleWindow.InitFromXml(xmlDoc.child(L"root"));
            SASSERT(bRet);
            m_oleWindow.Move(0, 0, m_sizeNatural.cx, m_sizeNatural.cy);
            CalculateExtentSize(m_sizeNatural);
        }
    }

    return bRet;
}
Exemplo n.º 2
0
BOOL SApplication::Init( LPCTSTR pszName ,LPCTSTR pszType)
{
    SASSERT(m_RenderFactory);

    pugi::xml_document xmlDoc;
    if(!LOADXML(xmlDoc,pszName,pszType)) return FALSE;
    pugi::xml_node root=xmlDoc.child(L"UIDEF");
    if(!root) return FALSE;

    //set default font
    pugi::xml_node xmlFont;
    xmlFont=root.child(L"font");
    if(xmlFont)
    {
        int nSize=xmlFont.attribute(L"size").as_int(12);
        BYTE byCharset=(BYTE)xmlFont.attribute(L"charset").as_int(DEFAULT_CHARSET);
        SFontPool::getSingleton().SetDefaultFont(S_CW2T(xmlFont.attribute(L"face").value()),nSize,byCharset);
    }
    
    SStringPool::getSingleton().Init(root.child(L"string"));
    SNamedID::getSingleton().Init(root.child(L"id"));

    SSkinPool *pSkinPool = new SSkinPool;
    pSkinPool->LoadSkins(root.child(L"skin"));
    SSkinPoolMgr::getSingletonPtr()->PushSkinPool(pSkinPool);
    pSkinPool->Release();
    
    SStylePool *pStylePool = new SStylePool;
    pStylePool->Init(root.child(L"style"));
    SStylePoolMgr::getSingleton().PushStylePool(pStylePool);
    pStylePool->Release();
    
    SObjDefAttr::getSingleton().Init(root.child(L"objattr"));
    return TRUE;
}
Exemplo n.º 3
0
BOOL SMenu::LoadMenu( LPCTSTR pszResName ,LPCTSTR pszType)
{
    if(::IsMenu(m_hMenu)) return FALSE;

    pugi::xml_document xmlDoc;
    if(!LOADXML(xmlDoc,pszResName,pszType)) return FALSE;

    pugi::xml_node xmlMenu=xmlDoc.child(L"menu");
    if(!xmlMenu)  return FALSE;

    return LoadMenu(xmlMenu);
}
Exemplo n.º 4
0
void CCodeLineCounterHandler::OnInit( SWindow *pRoot )
{
    m_pPageRoot = pRoot->FindChildByName(L"page_codeline");
    SASSERT(m_pPageRoot);

    CFolderHander::OnInit(m_pPageRoot->FindChildByName(L"page_dir"));

    pugi::xml_document xmlCodeSyntax;

    SStringT strSyntax = SApplication::getSingleton().GetAppDir() + _T("\\syntax.xml");
    if(!xmlCodeSyntax.load_file(strSyntax))
    {
        LOADXML(xmlCodeSyntax,_T("syntax"),_T("xml"));
    }
    
    pugi::xml_node xmlNode = xmlCodeSyntax.child(L"config").child(L"filetypes");
    if(xmlNode)
    {
        pugi::xml_node xmlType = xmlNode.child(L"filetype");
        while(xmlType)
        {
            CCodeConfig cfg;
            cfg.strType = xmlType.attribute(L"type").value();
            cfg.strExt = xmlType.attribute(L"ext").value();
            cfg.strSingleLineRemark = xmlType.attribute(L"singleLineRemark").value();
            cfg.strMultiLinesRemarkBegin = xmlType.attribute(L"multiLinesRemarkBegin").value();
            cfg.strMultiLinesRemarkEnd = xmlType.attribute(L"multiLinesRemarkEnd").value();
            m_mapCodeCfg[cfg.strExt] = cfg;
            xmlType = xmlType.next_sibling(L"filetype");
        }
    }
    xmlNode = xmlCodeSyntax.child(L"config").child(L"languages");
    if(xmlNode)
    {
        InitLang(xmlNode);
    }
}