Esempio n. 1
0
CDocument* GetGrfDoc(int index, LPCTSTR name)
{
    bool Done=false;
    CDocument* pDoc=NULL;
    int GrfDocCnt=-1;
    CDocTemplate &Templ = ScdApp()->GraphTemplate();
    POSITION PosD = Templ.GetFirstDocPosition();
    while (!Done && PosD)
    {
        pDoc = Templ.GetNextDoc(PosD);
        POSITION pos = pDoc->GetFirstViewPosition();
        if (pos)
        {
            CView* pFirstView = pDoc->GetNextView(pos);
            CWnd* w = pFirstView->GetParent();
//      if (pDoc->IsKindOf(RUNTIME_CLASS(CGrfDoc)))
            if (dynamic_cast<CGrfDoc*>(pDoc))
            {
                //ASSERT(dynamic_cast<CGrfFrameWnd*>(w));
                GrfDocCnt++;
                if (index<0 && pDoc->GetTitle().CompareNoCase(name)==0)
                    Done = true;
                else if (GrfDocCnt==index)
                    Done = true;
            }
        }
    }
    if (!Done)
        return NULL;
    return pDoc;
}
Esempio n. 2
0
CBCGPMDIChildWnd* CMainFrame::CreateDocumentWindow (LPCTSTR lpcszDocName, CObject* /*pObj*/)
{
    if (lpcszDocName != NULL && lpcszDocName [0] != '\0')
    {
        CDocument* pDoc = AfxGetApp()->OpenDocumentFile (lpcszDocName);

        if (pDoc != NULL)
        {
            POSITION pos = pDoc->GetFirstViewPosition();

            if (pos != NULL)
            {
                CView* pView = pDoc->GetNextView (pos);
                if (pView == NULL)
                {
                    return NULL;
                }

                return DYNAMIC_DOWNCAST (CBCGPMDIChildWnd, pView->GetParent ());
            }
        }
    }

    return NULL;
}
Esempio n. 3
0
void CuDlgDBEventPane01::UpdateControl()
{
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CWnd*   pSplitter = pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame* pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT (pFrame);
    //
    // Remark:
    // InitializeDBEvent() is called on the CBN_SELCHANGE of Database ComboBox.
    CString strNone;
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
        return;
    
    // Load ...
    // Initialize the new Database.
    if (DBETraceInit (pDoc->m_hNode, (LPUCHAR)(LPCTSTR)pDoc->m_strDBName , pFrame->m_hWnd, &(pDoc->m_nHandle)) == RES_SUCCESS)
    {
        pDoc->m_bDBInit = TRUE;
        m_strCurrentDB  = pDoc->m_strDBName;
    }
    else
    {
        pDoc->m_bDBInit = FALSE;
        pDoc->m_nHandle = -1;
        BfxMessageBox (VDBA_MfcResourceString(IDS_E_INITIALIZE_DB_EVENT));//"Error while initializing the Database for DB Event Registration"
    }
    if (pDoc->m_bDBInit)
    {
        int index;
        CTypedPtrList<CObList, CuDataRegisteredDBevent*>& listDBEvent = pDoc->m_listRegisteredDBEvent;

        POSITION pos = listDBEvent.GetHeadPosition();
        while  (pos != NULL)
        {
            CuDataRegisteredDBevent* dbe = listDBEvent.GetNext (pos);

            index = m_cListDBEvent.AddString (dbe->m_strDBEvent);
            if (index != LB_ERR)
            {
                LPTSTR lpszOwner = new TCHAR [dbe->m_strOwner.GetLength() +1];
                lstrcpy (lpszOwner, (LPTSTR)(LPCTSTR)dbe->m_strOwner);
                m_cListDBEvent.SetItemData (index, (DWORD)lpszOwner);
                if (dbe->m_bRegistered)
                {
                    if (DBETraceRegister (pDoc->m_nHandle, (LPUCHAR)(LPCTSTR)dbe->m_strDBEvent, (LPUCHAR)(LPCTSTR)dbe->m_strOwner) != RES_SUCCESS)
			            BfxMessageBox (VDBA_MfcResourceString(IDS_E_REGISTERING_DB_EVENT));//"Error while Registering DB Event"
                    else
                        m_cListDBEvent.SetCheck (index, 1);
                }
            }
        }
    }
}
Esempio n. 4
0
LONG CuDlgDBEventPane02::OnDbeventTraceIncoming (WPARAM wParam, LPARAM lParam)
{
    LPRAISEDDBE lpStruct = (LPRAISEDDBE)lParam;
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CSplitterWnd* pSplitter = (CSplitterWnd*)pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame*  pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT  (pFrame);
    if (!pFrame->GetPaneRegisteredDBEvent()->Find ((LPCTSTR)lpStruct->DBEventName, (LPCTSTR)lpStruct->DBEventOwner))
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText,
            "*");
    }
    else
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText);
    }
    if (pDoc->m_bPopupOnRaise)
    {
        CString strMsg;
        strMsg.GetBuffer (520);
        TCHAR tchszAll [80];

        StringWithOwner ((LPUCHAR)lpStruct->DBEventName, (LPUCHAR)lpStruct->DBEventOwner, (LPUCHAR)tchszAll);
        //"%s: Database Event %s '%s' was raised on node %s."
            strMsg.Format (IDS_I_DB_EVENT_RAISED,
            (LPCTSTR)lpStruct->StrTimeStamp,
            (LPCTSTR)tchszAll,
            (LPCTSTR)lpStruct->DBEventText,
            (LPCTSTR)GetVirtNodeName (pDoc->m_hNode));
        BfxMessageBox (strMsg);
    }
    return RES_SUCCESS;
}
Esempio n. 5
0
// ********************************
//	CDocTemplate
// ********************************
CDocument* CHidemdiDoctmplDocstrAlone::OpenDocumentFile( LPCTSTR lpszPathName
								, BOOL bMakeVisible ) 
		//【オーバライド】
		//	lpszPathName と同じDocStr()を持つドキュメントが存在していたら、
		//	新たなドキュメントを開かずに、既存のドキュメントをアクティブに、
		//	して、そのオブジェクトポインタを返します
{
	CDocument*	pRv = NULL ;
	
	POSITION	LPosition = GetFirstDocPosition() ;
	while( LPosition != NULL && pRv == NULL ){
		CDocument*	pLDocument = GetNextDoc( LPosition ) ;
		ASSERT( pLDocument->IsKindOf( RUNTIME_CLASS( CHidemdiSubDoc ) ) ) ;
			//[Attention]
			//	このクラスが扱うドキュメントは、CHidemdiSubDocを継承して
			//	いなくてはなりません

		CHidemdiSubDoc*	pLSubDoc = (CHidemdiSubDoc*)pLDocument ;
		
		if ( lpszPathName == NULL ){
			lpszPathName = _T("" ) ;
		}
		if ( pLSubDoc->DocStr() == lpszPathName ){
			//	同じDocStr()の子フレームが見つかりました

			POSITION	LViewPosition = pLSubDoc->GetFirstViewPosition() ;
			while ( LViewPosition != NULL ){
				CView*	pLView = pLSubDoc->GetNextView( LViewPosition ) ;
				( (CMDIFrameWnd*)AfxGetMainWnd() )->MDIActivate( pLView->GetParent() ) ;
				break ;
			}
				//[Attention]
				//	同名のビュー(のMDI子フレーム)をアクティブにしています

			pRv = pLSubDoc ;
		}
	}	
		//pRv = 同名のビューがすでにあれば、そのビュー、なければNULLです
	
	if ( pRv == NULL ){
		pRv = super::OpenDocumentFile( lpszPathName , bMakeVisible ) ; 
	}
	return ( pRv ) ;	
};
Esempio n. 6
0
CMDIChildWndEx* CMainFrame::CreateDocumentWindow (LPCTSTR lpcszDocName)
{
	TRACE("CMainFrame::CreateDocumentWindow");

	if (lpcszDocName != NULL && lpcszDocName [0] != '\0')
	{
		CDocument* pDoc = AfxGetApp()->OpenDocumentFile (lpcszDocName);

		if (pDoc != NULL)
		{
			POSITION pos = pDoc->GetFirstViewPosition();

			if (pos != NULL)
			{
				CView* pView = pDoc->GetNextView (pos);
				return DYNAMIC_DOWNCAST (CMDIChildWndEx, pView->GetParent ());
			}   
		}
	}
	return NULL;
}
Esempio n. 7
0
CDocument* CWedApp::OpenDocumentFile(LPCTSTR lpszFileName)

{
	CDocument* ret = NULL;
	ret = CWinApp::OpenDocumentFile(lpszFileName);

	if(!ret)
		return ret;

	// See if window creation failed
	if( ((CWedDoc*)ret)->ssel.m_err)
		{
		//Close this one
		pDocTemplate->RemoveDocument(ret);

		//Close some more
		POSITION pos = pDocTemplate->GetFirstDocPosition();

		pDocTemplate->RemoveDocument(pDocTemplate->GetNextDoc(pos));
		pDocTemplate->RemoveDocument(pDocTemplate->GetNextDoc(pos));
		pDocTemplate->RemoveDocument(pDocTemplate->GetNextDoc(pos));

		AfxMessageBox("Windows ran out of windows", MB_ICONSTOP);
		ret = NULL;
		}

	// Maximize it
	// Open up in demonstration/full screen mode:
	POSITION pos = ret->GetFirstViewPosition();
	CView *pView = ret->GetNextView(pos);
	if (pView)
		{
		pView->GetParent()->ShowWindow(SW_SHOWMAXIMIZED);
		ret->UpdateAllViews(NULL);
		}

	return ret;
}
Esempio n. 8
0
void CuDlgDBEventPane02::UpdateControl()
{
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CWnd*   pSplitter = pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame* pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT (pFrame);

    CString strNone;
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
        return;
    
    // Load ...
    int nCount;
    CTypedPtrList<CObList, CuDataRaisedDBevent*>& listRaisedDBEvent = pDoc->m_listRaisedDBEvent;
    nCount = listRaisedDBEvent.GetCount();
    POSITION pos = listRaisedDBEvent.GetHeadPosition();
    while  (pos != NULL)
    {
        CuDataRaisedDBevent* dbe = listRaisedDBEvent.GetNext (pos);
        IncomingDBEvent (pDoc, dbe->m_strNum, dbe->m_strTime, dbe->m_strDBEvent, dbe->m_strDBEOwner, dbe->m_strDBEText);
    }
    if ((pDoc->m_nMaxLine+1) == nCount)
    {
        CTime   t = CTime::GetCurrentTime();
        CString st= t.Format ("%c");
        nCount = m_cListRaisedDBEvent.GetItemCount ();
        int index  = m_cListRaisedDBEvent.InsertItem (nCount, (LPTSTR)"", 0);
        m_cListRaisedDBEvent.SetItemText (index, 1, (LPTSTR)(LPCTSTR)st);
        m_cListRaisedDBEvent.SetItemText (index, 2, VDBA_MfcResourceString(IDS_INTERRUPTED));//"<Interrupted>"
    }     
    SetHeader (pDoc->m_strRaisedSince);
}
Esempio n. 9
0
void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
	CBCGPMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
	if (bActivate && pActivateWnd->GetSafeHwnd() && pDeactivateWnd->GetSafeHwnd())
	{
		CView *pView = ((CChildFrame*)pActivateWnd)->GetActiveView();
		if (pView == NULL)
		{
			return;
		}
		CBCGPTabWnd *pTabctrl = (CBCGPTabWnd *)pView->GetParent();
		if (pTabctrl == NULL)
		{
			return;
		}
		CCoolFormat3View *pTabView = (CCoolFormat3View *)pTabctrl->GetParent();
		CSynBCGPEditView *pSynView = pTabView->GetSynView();
		if (pSynView != NULL)
		{
			pSynView->ReSetLangLabel();
			pSynView->ReSetEncodingLabel();
		}
	}
}
Esempio n. 10
0
void CdIpmDoc::Serialize(CArchive& ar)
{
	CString caption;
	m_connectedInfo.Serialize(ar);

	if (ar.IsStoring())
	{
		ar << m_hNode;
		ar << m_hReplMonHandle;
		ar << m_nOIVers;

		// filter structure
		ar.Write(&m_sFilter, sizeof(m_sFilter));

		// splitbar
		if (m_bShowTree )
		{
			POSITION pos = GetFirstViewPosition();
			CView *pView = GetNextView(pos);
			ASSERT (pView);
			CSplitterWnd *pSplit = (CSplitterWnd *)pView->GetParent();
			ASSERT (pSplit);
			pSplit->GetColumnInfo(0, m_cxCur, m_cxMin);
		}
		ar << m_cxCur;
		ar << m_cxMin;

		ASSERT (m_pTabDialog);
		CuIpmPropertyData* pData = m_pTabDialog->GetDialogData();
		CuIpmProperty* pCurrentProperty = m_pTabDialog->GetCurrentProperty();
		if (pCurrentProperty) 
		{
			pCurrentProperty->SetPropertyData (pData);
			ar << pCurrentProperty;
		}

		ar << m_strSelectKey;
		ar << m_bShowTree;
	}
	else
	{
		m_bLoaded = TRUE;

		ar >> m_hNode; // Note : OpenNodeStruct() MUST NOT BE CALLED!
		ar >> m_hReplMonHandle;
		ar >> m_nOIVers;
		IPM_SetDbmsVersion(m_nOIVers);

		// filter structure
		ar.Read(&m_sFilter, sizeof(m_sFilter));

		// splitbar
		ar >> m_cxCur;
		ar >> m_cxMin;

		if (m_pCurrentProperty)
		{
			delete m_pCurrentProperty;
			m_pCurrentProperty = NULL;
		}
		ar >> m_pCurrentProperty;
		ar >> m_strSelectKey;
		ar >> m_bShowTree;
	}
	m_arrItemPath.Serialize(ar);
	IPM_SerializeChache(ar);

	// global data for the tree, including tree lines
	// ex - m_pTreeGD->Serialize(ar);
	if (ar.IsStoring())
	{
		ar << m_pTreeGD;
	}
	else
	{
		delete m_pTreeGD; // memory leak otherwise
		ar >> m_pTreeGD;
		m_pTreeGD->SetPSFilter(&m_sFilter);
		m_pTreeGD->SetDocument(this);
	}
}
Esempio n. 11
0
void CuDlgDBEventPane01::OnCheckChange()
{
    CDbeventFrame*  pFrame;
    CView*          pView;
    CDbeventDoc*    pDoc;
    int     nCheck, index   = LB_ERR;
    CString strItem;
    CString strTime;
    LPTSTR  lpszOwner;

    CTime time = CTime::GetCurrentTime();
    strTime = time.Format ("%c");
    index = m_cListDBEvent.GetCaretIndex();
    if (index == LB_ERR)
        return;
    pView = (CView*)GetParent();
    ASSERT (pView);
    pDoc  = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    CWnd* pSplitter = pView->GetParent();
    ASSERT (pSplitter);
    pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT (pFrame);
    if (!pDoc->m_bDBInit)
    {
        BfxMessageBox (VDBA_MfcResourceString(IDS_E_DB_EVENT_REGISTER));//"DBEvent Initialization Failure: Unable to register."
        nCheck = m_cListDBEvent.GetCheck (index);
        if (nCheck == 1)
            m_cListDBEvent.SetCheck (index, 0); // Stay unckecked
        return;
    }
    CuDlgDBEventPane02* pRaisePanel = pFrame->GetPaneRaisedDBEvent();
    ASSERT (pRaisePanel);
    m_cListDBEvent.GetText (index, strItem);
    lpszOwner = (LPTSTR)m_cListDBEvent.GetItemData (index);
    nCheck = m_cListDBEvent.GetCheck (index);
    if (nCheck == 1)
    {
        if (DBETraceRegister (pDoc->m_nHandle, (LPUCHAR)(LPCTSTR)strItem, (LPUCHAR)lpszOwner) != RES_SUCCESS)
        {
            BfxMessageBox (VDBA_MfcResourceString(IDS_E_REGISTERING_DB_EVENT));//"Error while Registering DB Event"
            m_cListDBEvent.SetCheck (index, 0); // Stay unckecked
            return;
        }
        CString st1;
        st1.Format (IDS_DBEVENT_CHECK, (LPCTSTR)strItem);//"<Check %s>"
        pRaisePanel->IncomingDBEvent (pDoc, "?", strTime, st1, "", "");
    }
    else
    if (nCheck == 0)
    {
        CString st1;
        int ans = DBETraceUnRegister (pDoc->m_nHandle, (LPUCHAR)(LPCTSTR)strItem, (LPUCHAR)lpszOwner);
        if (ans != RES_SUCCESS && ans != RES_MOREDBEVENT)
        {
            BfxMessageBox (VDBA_MfcResourceString(IDS_E_UNREGISTERING_DB_EVENT));//"Error while unregistering DB Event"
            m_cListDBEvent.SetCheck (index, 1); // Stay ckecked
            st1.Format (IDS_E_UNCHECK, (LPCTSTR)strItem);//"<ERROR in Uncheck %s>"
            pRaisePanel->IncomingDBEvent (pDoc, "?", strTime, st1, "", "");
            return;
        }
        st1.Format (IDS_I_UNCHECK, (LPCTSTR)strItem);//"<Uncheck %s>"
        pRaisePanel->IncomingDBEvent (pDoc, "?", strTime, st1, "", "");
    }
}
Esempio n. 12
0
LOCAL LPCMDLIST ProgActivateWindow(LPACTIVATEWINDOW_PARMS lpParms)
/***********************************************************************/
{
int iOffset, nDocs;
CWnd *pActiveWnd, *pNextWnd, *pChild;
CMDIFrameWnd *pMainWnd;
	
pNextWnd = NULL;

pMainWnd = (CMDIFrameWnd *)PictPubApp.m_pMainWnd;

// first look for the filename
CServerDoc *pDoc = PictPubApp.GetDocument(lpParms->szFileName);
if (pDoc)
	{
	// ignore if we are in place
	if (pDoc->IsInPlaceActive())
		return(NULL);

	POSITION ViewPos = pDoc->GetFirstViewPosition();
	if (ViewPos)
		{
	    CView* pView = pDoc->GetNextView( ViewPos );
		if (pView)
			pNextWnd = pView->GetParent();
		}
	}

// if not found, try using windows offsets
if (!pNextWnd && lpParms->iOffset)
	{
	nDocs = 0;
	pChild = pActiveWnd = pMainWnd->MDIGetActive();
	while (pChild)
		{
		++nDocs;
		pChild = pChild->GetWindow(GW_HWNDNEXT);
		}

	if (nDocs)
		{
		iOffset = lpParms->iOffset;
		pNextWnd = pActiveWnd;
		if (iOffset > 0)
			{
			if (iOffset >= nDocs)
				iOffset = nDocs - 1;
			while(pNextWnd && (--iOffset >= 0))
				pNextWnd = pNextWnd->GetWindow(GW_HWNDNEXT);
			}
		else
			{
			if (iOffset <= (-nDocs))
				iOffset = (-nDocs) + 1;
			while(pNextWnd && (++iOffset <= 0))
				pNextWnd = pNextWnd->GetWindow(GW_HWNDPREV);
			}
		}
	}

if (pNextWnd)
	{
	CPPMDIChildWnd *pMDIChild = (CPPMDIChildWnd *)pNextWnd;
	CServerView *pView = (CServerView*)pMDIChild->GetActiveView();
	if (pView)
		{
        CServerDoc *pDoc = pView->GetDocument();
       	ASSERT(pDoc && pDoc->m_lpImage);
		if (pDoc && pDoc->m_lpImage && !pDoc->IsInPlaceActive())
			{
			pMainWnd->MDIActivate(pNextWnd);
			return(pDoc->m_lpImage->lpCmdList);
			}
		}
	}
return(NULL);
}
Esempio n. 13
0
void CNetscapeSrvrItem::OnDoVerb(LONG iVerb)
{
	switch (iVerb)
	{
	// open - maps to OnOpen
	case OLEIVERB_OPEN:
	case -OLEIVERB_OPEN-1:  // allows positive OLEIVERB_OPEN-1 in registry
		OnOpen();
		break;

	// primary, show, and unknown map to OnShow
	case OLEIVERB_PRIMARY:  // OLEIVERB_PRIMARY is 0 and "Edit" in registry
	case OLEIVERB_SHOW:
	case OLEIVERB_UIACTIVATE: {
		COleServerDoc* pDoc = GetDocument();
		m_ShowUI = TRUE;
		OnShow();
		break;
	}					  

	case OLEIVERB_INPLACEACTIVATE: {
		COleServerDoc* pDoc = GetDocument();
		m_ShowUI = FALSE;
		OnShow();
		break;
   }

	// hide maps to OnHide
	case OLEIVERB_HIDE:
	case -OLEIVERB_HIDE-1:  // allows positive OLEIVERB_HIDE-1 in registry
		OnHide();
		break;


	case NO_UI_EMBEDDING:	{
		//Get InPlaceFrame ptr.
		CGenericDoc *pDoc = GetDocument();
		ASSERT(pDoc);

		POSITION pos = pDoc->GetFirstViewPosition();
		CView *pView = pDoc->GetNextView(pos);
		ASSERT(pView);

		m_ShowUI = FALSE;

		OnShow();

		CInPlaceFrame *pFrm = (CInPlaceFrame *)pView->GetParent();
		ASSERT(pFrm);

		pFrm->DestroyResizeBar();

		break;
		}
	default:
		// negative verbs not understood should return E_NOTIMPL
		if (iVerb < 0)
			AfxThrowOleException(E_NOTIMPL);

		// positive verb not processed --
		//  according to OLE spec, primary verb should be executed
		//  instead.
		OnDoVerb(OLEIVERB_PRIMARY);

		// also, OLEOBJ_S_INVALIDVERB should be returned.
		AfxThrowOleException(OLEOBJ_S_INVALIDVERB);
	}
}
Esempio n. 14
0
/////////////////////////////////////////////////////////////////////////////
// switch to the new selected view tab
/////////////////////////////////////////////////////////////////////////////
BOOL CBonfireDoc::SwitchToView(CString strTab)
{
	if (strTab == "")
		return FALSE;

	CChildFrame*	pChild		= (CChildFrame*)g_pMainFrame->MDIGetActive();
	if (!pChild || pChild->GetActiveDocument() != this)
	{
		POSITION pos = GetFirstViewPosition();
		pChild	= (CChildFrame*)GetNextView(pos)->GetParentFrame();
	}

	if (!pChild)
		return FALSE;

	CView*			pViewAdd	= NULL;
	CBonfireView*	pGlobalView	= NULL;
	CBonfireView*	pBNewView	= NULL;
	
	// get the view to "hide"
	CView*			pViewDel	= pChild->GetActiveView();
	
	// if we're already displaying this kind of view, no need to go further.
	for (int i = 0; i < theApp.m_arAllViews.GetSize(); i++)
	{
		if ( ((CBonfireView*)theApp.m_arAllViews[i])->m_strCaption.Compare(strTab) == 0 )
		{
			pGlobalView = (CBonfireView*)theApp.m_arAllViews[i];
			break;
		}
	}

	if ( pViewDel && pViewDel->IsKindOf(pGlobalView->m_pClass) )
		return TRUE;

	// check if a view of this type already exists
 	if ( !m_pViews->Lookup(pGlobalView->m_strCaption, (void*&)pBNewView) )
	{
		// doesn't exist so create a new view
		pViewAdd = (CView*)pGlobalView->m_pClass->CreateObject();
		if (pViewAdd == NULL)
		{
			TRACE1("Warning: Dynamic create of view type %Fs failed\n", pGlobalView->m_pClass->m_lpszClassName);
			return FALSE;
		}

		// draw new view
		CCreateContext context;
		context.m_pNewViewClass		= pGlobalView->m_pClass;
		context.m_pCurrentDoc		= NULL;
		context.m_pNewDocTemplate	= this->GetDocTemplate();
		context.m_pLastView			= NULL;
		context.m_pCurrentFrame		= pChild;

		// draw new view
		if (!pViewAdd->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0),
			pChild, AFX_IDW_PANE_FIRST, &context))
		{
			TRACE0("Warning: couldn't create view for frame\n");
			delete pViewAdd;
			return FALSE;
		}

		// add the view to the map
		pBNewView			= new CBonfireView(pGlobalView);
		pBNewView->m_pView	= pViewAdd;
		pBNewView->m_pClass	= pViewAdd->GetRuntimeClass();

		// add this view to the document's map
		AddViewToMap(pBNewView);

		// WM_INITIALUPDATE is defined in afxpriv.h
		pViewAdd->SendMessage(WM_INITIALUPDATE,0,0);

		// connect the view to the document
		AddView(pViewAdd);
	}
	else
	{
		pViewAdd = pBNewView->m_pView;
	}

	// save file on switching views
	if (theApp.m_opOptions.general.dwSaveOnSwitch && !m_xTextBuffer.GetReadOnly() && pViewDel)
		DoFileSave();
	
	CSplitterWnd*	pSplitter	= NULL;
	POSITION pos				= GetFirstViewPosition();
	BOOL firstOne				= true;
	while (pos)
	{
		CView* pv	= GetNextView(pos);
		if (pv == pViewAdd)	
		{
			pv->SetDlgCtrlID(AFX_IDW_PANE_FIRST);

			// show the view
			if (pBNewView->m_bAllowsSplitter)
			{
				pSplitter	= (CSplitterWnd*)pViewAdd->GetParent();
				
				// show the splitter (show the children view(s) as well)
				pSplitter->ShowWindow(SW_SHOW);
			}
			else
				// show the view
				pViewAdd->ShowWindow(SW_SHOW);
		}
		else 
		{
			// check if the view is inside a splitter
			if (pv->GetParent()->GetRuntimeClass() == (CRuntimeClass*)RUNTIME_CLASS(CSplitterWnd))
			{
				pSplitter	= (CSplitterWnd*)pv->GetParent();
				
				// hide the splitter (hide all views with the splitter)
				pSplitter->ShowWindow(SW_HIDE);
			}
			else
			{
				// hide the view
				pv->ShowWindow(SW_HIDE);
				pv->SetDlgCtrlID(AFX_IDW_PANE_FIRST + 255);
			}
		}

		TRACE("%s (%d) ", pv->GetRuntimeClass()->m_lpszClassName, (unsigned)(pv->GetDlgCtrlID() - AFX_IDW_PANE_FIRST));
		if (pv == pViewDel)		TRACE("= D ");
		if (pv == pViewAdd)		TRACE("= A ");
		if (pv->GetRuntimeClass() == pGlobalView->m_pClass)
		{
			if (firstOne)
				firstOne = false;
			else
				TRACE("removing ");
		}
	}
	TRACE("\n");

	// get rid of extra views created by the splitter
	if (pSplitter)
	{
		for (int cols = 1; cols < pSplitter->GetColumnCount(); cols++)
			pSplitter->DeleteColumn(cols);
		for (int rows = 1; rows < pSplitter->GetRowCount(); rows++)
			pSplitter->DeleteRow(rows);

		pSplitter->RecalcLayout();
	}

	pViewAdd->UpdateWindow();
	pChild->SetActiveView(pViewAdd);
	pChild->RecalcLayout();

	if (pBNewView->m_bModifiedSinceRefresh)
	{
		pBNewView->m_bModifiedSinceRefresh = FALSE;
		if (pGlobalView->m_pClass == RUNTIME_CLASS(CXMLTreeView))
		{
			((CXMLTreeView*)pViewAdd)->RefreshView();
		}
		else if (pGlobalView->m_pClass == RUNTIME_CLASS(CBrowserView))
		{
			((CBrowserView*)pViewAdd)->RefreshView();
		}
		else
		{
			pBNewView->m_bModifiedSinceRefresh = TRUE;
		}
	}

	return TRUE;
}