Beispiel #1
0
BOOL CGlobalObj::bOpenFunctioneditorfile(CString omStrNewCFileName)
{
    BOOL bFileFound = TRUE;

    CFunctionEditorDoc* pDoc = CFunctionEditorBase::pCreateNewDocument(m_eBus);
    // file-attribute information
    if (pDoc != nullptr)
    {
        CEditFrameWnd::sm_eBus = m_eBus;
        struct _tfinddata_t fileinfo;
        // Check if file exists
        if (_tfindfirst( omStrNewCFileName.GetBuffer(MAX_PATH), &fileinfo) == -1L)
        {
            bFileFound = pDoc->bCreateNewDocument(omStrNewCFileName);
        }
        if (bFileFound == TRUE)
        {
            //// Now open the selected file
            pDoc->OnOpenDocument(omStrNewCFileName);
            CMultiDocTemplate* pTemplate = m_pEditorDocTemplate;
            m_pEditFrameWnd = (CEditFrameWnd*)(pTemplate->CreateNewFrame(pDoc, nullptr));

            //If null is passed as parameter the m_pdoc->GetNextView(pos)  will
            // give null value
            if (m_pEditFrameWnd != nullptr)
            {
                ASSERT_KINDOF(CEditFrameWnd, m_pEditFrameWnd);
                pTemplate->InitialUpdateFrame(m_pEditFrameWnd, /*nullptr*/pDoc);
            }
        }
    }
    return bFileFound;
}