Пример #1
0
static int teletext_header_update(unsigned int dwPageCode)
{
	char szOldClock[8];
    	if (context_tele.status != TELETEXT_STARTED)
    	{
        	return AM_TT_ERR_NOT_START;
    	}

    	if (LOWWORD(dwPageCode) == context_tele.wPageIndex)
    	{

        	GetDisplayHeader(&context_tele.sCurrPage, FALSE);
		if (context_tele.auto_page_status == TRUE)
		{
		    teletext_set_codepage(VTCODEPAGE_NONE);
		    if (context_tele.TtxCodepage >= VTCODEPAGE_ENGLISH && context_tele.TtxCodepage < VTCODEPAGE_LASTONE)
		    {
		        SetCodepage(context_tele.TtxCodepage);
		    }
		}
		TELETEXT_DRAW(&context_tele, ({
        	DrawPage(&context_tele.sCurrPage, 0/*VTDF_HEADERONLY*/, VTDoubleProfile);
		}));
Пример #2
0
HRESULT ASSISTANT::Document::Load(CProgressDialogA *pProgress) {
    HRESULT hr = S_OK;

    CString csProgressText;
    csProgressText.Format(IDS_LOADING_DOCUMENT, m_csDocumentName);
    if (pProgress != NULL) {
        pProgress->SetRange(0, 100);
        pProgress->SetLabel(csProgressText);
    }

    CString csFilename = m_csDocumentPath;
    csFilename += _T("\\");
    csFilename += m_csDocumentName;

    int iPageCount = 0;
    ASSISTANT::SGMLTree *pSgmlTree = new ASSISTANT::SGMLTree(csFilename);
    if (pSgmlTree == NULL || pSgmlTree->Buildtree(iPageCount, pProgress) < 0)
        return E_FAIL;

    containerName.Empty();

    ASSISTANT::SGMLElement *pRoot = pSgmlTree->root;
    if (pRoot == NULL || ((pRoot->Name != _T("ASSISTANT")) && (pRoot->Name != _T("MLB")))) {
        delete pSgmlTree;
        return E_FAIL;
    }

    SetName(pRoot->GetAttribute("name"));

    LPTSTR tszAttribute;
    tszAttribute = pRoot->GetAttribute("author");
    if (tszAttribute != NULL) 
        scorm.SetAuthor(tszAttribute);
    else     
        scorm.SetAuthor(_T(""));   

    tszAttribute = pRoot->GetAttribute("creator");
    if (tszAttribute != NULL) 
        scorm.SetCreator(tszAttribute);
    else     
        scorm.SetCreator(_T(""));   

    tszAttribute = pRoot->GetAttribute("keywords");
    if (tszAttribute) 
        scorm.SetKeywords(tszAttribute);
    else     
        scorm.SetKeywords(_T(""));   

    tszAttribute = pRoot->GetAttribute("codepage");
    if (tszAttribute) {
        unsigned int iCodePage = _ttoi(tszAttribute);
        SetCodepage(iCodePage);
        unsigned int iActualCodepage = GetACP();
        if (iActualCodepage != iCodePage) {
            CString csMessage;
            csMessage.Format(IDS_WARNING_CODEPAGE, iCodePage, iActualCodepage);
            CString csCaption;
            csCaption.LoadString(IDS_WARNING);
            MessageBox(NULL, csMessage, csCaption, MB_OK | MB_ICONWARNING | MB_TOPMOST);
        }
    }

    float fProgressTab = (float)50 / iPageCount;

    int iCount = 0;
    int iContainerNumber = 0;
    // If the document is selected the loaded objects are inserted at the begin
    // -> wrong order, this flag is only necessary for draeg&drop
    m_bSelected = false;
    ASSISTANT::SGMLElement *pTag = pRoot->son;
    while (pTag != NULL) {
        // 50% for Buildtree, 50% for page creation
        int iActualProgressValue = (int)(50 + iCount * fProgressTab);

        if (pProgress)
            pProgress->SetPos(iActualProgressValue);

        if (pTag->Name == _T("FOLDER")) {
            ++iContainerNumber;
            _TCHAR tszTmpFolderNumber[256];
            _stprintf(tszTmpFolderNumber, _T("%d") ,iContainerNumber);
            ASSISTANT::Folder *pFolder = new ASSISTANT::Folder(Project::active->GetObjectID(), tszTmpFolderNumber, this, pTag);
            InsertContainerCurrent(pFolder);
            pFolder->SetCodepage(GetCodepage());
        } else if (pTag->Name == _T("PAGE")) { 
            ++iContainerNumber;
            _TCHAR tszTmpPageNumber[256];
            _stprintf(tszTmpPageNumber, _T("%d"), iContainerNumber);
            ASSISTANT::Page *pPage = new ASSISTANT::Page(Project::active->GetObjectID(), tszTmpPageNumber, this, pTag);
            InsertContainerCurrent(pPage);
            pPage->SetCodepage(GetCodepage());
            ++iCount;
        } else {
            CString csError;
            csError.Format(IDS_SGML_TYPE_ERROR, pTag->Name);
            MessageBox(NULL, csError, NULL, MB_OK | MB_TOPMOST);
        }

        pTag = pTag->next;
    }  

    current = subContainer.GetSize() > 0 ? 0 : -1;

    delete pSgmlTree;

      
   CString metadataName = csFilename;
   GetPrefix(metadataName);
   metadataName += _T(".lmd");
   
   MetadataMerger metadataMerger;
   metadataMerger.DoMerge(this, metadataName);

    //if ((50 - lastValue) > 0)
    //   GUI::Progress::IncreaseProgress(50-lastValue);

    m_bIsLoaded = true;

    return hr;
}