Esempio n. 1
0
void CLuaIDEInterfaceImpl::addFile(const char *filename)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    CProject *proj = theApp.GetMainFrame()->GetProject();
    if (proj->GetProjectFile(filename))
        return;

    theApp.GetMainFrame()->GetProject()->AddFile(filename);
    CDocument *doc = theApp.OpenDocumentFile(filename);
    if (doc)
    {
        POSITION p = doc->GetFirstViewPosition();
        for (;;)
        {
            CView *v = doc->GetNextView(p);
            if (!v) break;
            theApp.GetMainFrame()->MDIActivate(v);
            BOOL maximized;
            CMDIChildWnd* child = theApp.GetMainFrame()->MDIGetActive(&maximized);
            if (child && (!maximized))
            {
                child->MDIMaximize();
            }
        }
    }
}
Esempio n. 2
0
CDocument *CDocManager::OpenDocumentFile( LPCTSTR lpszFileName )
/**************************************************************/
{
    POSITION                    position = m_templateList.GetHeadPosition();
    CDocTemplate                *pSelected = NULL;
    CDocTemplate::Confidence    nSelConfidence = CDocTemplate::noAttempt;
    while( position != NULL ) {
        CDocTemplate *pTemplate = (CDocTemplate *)m_templateList.GetNext( position );
        ASSERT( pTemplate != NULL );
        
        CDocument                   *pMatch = NULL;
        CDocTemplate::Confidence    nConfidence = pTemplate->MatchDocType( lpszFileName,
                                                                           pMatch );
        if( nConfidence > nSelConfidence ) {
            nSelConfidence = nConfidence;
            pSelected = pTemplate;
            if( nConfidence == CDocTemplate::yesAlreadyOpen ) {
                ASSERT( pMatch != NULL );
                POSITION viewPos = pMatch->GetFirstViewPosition();
                if( viewPos != NULL ) {
                    CView *pView = pMatch->GetNextView( viewPos );
                    CFrameWnd *pFrame = pView->GetParentFrame();
                    ASSERT( pFrame != NULL );
                    pFrame->ActivateFrame();
                }
                return( pMatch );
            }
        }
    }
    if( pSelected == NULL ) {
        return( NULL );
    }
    return( pSelected->OpenDocumentFile( lpszFileName ) );
}
Esempio n. 3
0
// 在 Frame中发消息给View 
U32 CPluginApp_i::SendMessageToView(UINT ulMsg, WPARAM wParam, LPARAM lParam) 
{
  CWinApp* pWinApp = AfxGetApp();
  if(pWinApp)
  {
    POSITION DocTemplatePos = pWinApp->GetFirstDocTemplatePosition();
  
    //while(DocTemplatePos)
    {
	    CMultiDocTemplate* pDocTemp = (CMultiDocTemplate*)pWinApp->GetNextDocTemplate(DocTemplatePos);
    
      //  
 	    POSITION pos = pDocTemp->GetFirstDocPosition ();
  
      // Find the doc within the same doctemplate.
      while (pos)
      {
	      CDocument* pDoc     = pDocTemp->GetNextDoc (pos);
	      POSITION ViewPos    = pDoc->GetFirstViewPosition ();
	      CView* pView        = pDoc->GetNextView (ViewPos);
        if(pView)
        {
          CMDIChildWnd* pFrame = (CMDIChildWnd*)pView->GetParentFrame();
          if(pFrame == this)
          {
            //OutputDebugString("Find!\n");
            pView->SendMessage(ulMsg, wParam, lParam);
          } 
        }
      }
    }
  }
  
  return 0;
}
Esempio n. 4
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. 5
0
void CMainFrame::OnWorkOffline()
{
    CBCGPIE7DemoView::m_bWorkOffline = !CBCGPIE7DemoView::m_bWorkOffline;

    POSITION posTemplate = theApp.m_pDocManager->GetFirstDocTemplatePosition ();
    while (posTemplate != NULL)
    {
        CDocTemplate* pTemplate = theApp.m_pDocManager->GetNextDocTemplate (posTemplate);
        if (pTemplate != NULL)
        {
            POSITION posDocument = pTemplate->GetFirstDocPosition ();
            while (posDocument != NULL)
            {
                CDocument* pDocument = 	pTemplate->GetNextDoc (posDocument);
                if (pDocument != NULL)
                {
                    POSITION posView = pDocument->GetFirstViewPosition ();
                    while (posView != NULL)
                    {
                        CHtmlView* pView = DYNAMIC_DOWNCAST(CHtmlView, pDocument->GetNextView (posView));
                        if (pView != NULL)
                        {
                            pView->SetOffline (CBCGPIE7DemoView::m_bWorkOffline);
                        }
                    }
                }
            }
        }
    }
}
Esempio n. 6
0
void CMainFrame::OnViewDeletedrecords() 
{
	m_bShowDeletedRecords = !m_bShowDeletedRecords;
	
	CWinApp* pApp = AfxGetApp();
	ASSERT_VALID(pApp);

	// Iterate through the application's document templates list
	POSITION posTemplate = pApp->GetFirstDocTemplatePosition();
	while(posTemplate)
	{
		// For each document template object...
		CDocTemplate* pTemplate = pApp->GetNextDocTemplate(posTemplate);
		ASSERT_VALID(pTemplate);
		ASSERT_KINDOF(CDocTemplate, pTemplate);

		// Iterate through the template's document list
		POSITION posDocument = pTemplate->GetFirstDocPosition();
		while(posDocument)
		{
			// For each document object...
			CDocument* pDoc = pTemplate->GetNextDoc(posDocument);
			ASSERT_VALID(pDoc);
			ASSERT_KINDOF(CDocument, pDoc);

			// reload records
			POSITION pos = pDoc->GetFirstViewPosition();
			while (pos)
				((CDBFExplorerView *)pDoc->GetNextView(pos))->ShowRecords(m_bShowDeletedRecords);
		}
	}
}
Esempio n. 7
0
// @pymethod [<o PyCView>,...]|PyCDocument|GetAllViews|Returns a list of all views for the current document.
PyObject *
ui_doc_get_all_views(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetAllViews);
	PyObject *retList = PyList_New(0);
	GUI_BGN_SAVE;
	POSITION pos = pDoc->GetFirstViewPosition(); // @pyseemfc CDocument|GetFirstViewPosition
	GUI_END_SAVE;
	while (pos!=NULL) {
		GUI_BGN_SAVE;
		CView *pWnd = pDoc->GetNextView( pos );      // @pyseemfc CDocument|GetNextView
		GUI_END_SAVE;
		ASSERT(pWnd);	// shouldnt be possible.
		if (pWnd==NULL) {
			Py_DECREF(retList);
			RETURN_ERR("No view was available!");
		}
		PyObject *newObj = ui_assoc_object::make(UITypeFromCObject(pWnd), pWnd)->GetGoodRet();
		if (newObj==NULL) {
			Py_DECREF(retList);
			return NULL;
		}
		PyList_Append(retList, newObj);
		Py_DECREF(newObj);
	}
	return retList;
}
Esempio n. 8
0
HRESULT CDxtexApp::RestoreDeviceObjects(VOID)
{
    // Tell each view of each doc to restore
    POSITION pos = GetFirstDocTemplatePosition();
    CDocTemplate* pDocTemplate = GetNextDocTemplate( pos );

    pos = pDocTemplate->GetFirstDocPosition();
    for( ; ; )
    {
        CDocument* pDoc = NULL;
        if( pos == NULL )
            break;
        pDoc = pDocTemplate->GetNextDoc( pos );
        if( pDoc == NULL )
            break;
        POSITION posView;
        CDxtexView* pView = NULL;
        posView = pDoc->GetFirstViewPosition();
        for( ; ; )
        {
            if( posView == NULL )
                break;
            pView = (CDxtexView*)pDoc->GetNextView( posView );
            if( pView == NULL )
                break;
            pView->RestoreDeviceObjects();
        }
    }
    return S_OK;
}
Esempio n. 9
0
CDrawProgView* Project::OpenView(INXString depFilename) {
	CDocument* Subsystem = AfxGetApp( )->OpenDocumentFile(depFilename);		
	// Need to initialise undo for case when the view is already open
	POSITION pos = Subsystem->GetFirstViewPosition();
	CDrawProgView* pView = (CDrawProgView*) Subsystem->GetNextView(pos);
	//pView->initUndo();
	return pView;
}
Esempio n. 10
0
int OpenPocket(   const vector<CRossPocketItem>& UnitNos,
			  CString    Title) 
{

	CDocTemplate* tmpl = GetRossPocketTemplate();;

	CDocument* pDocument = tmpl->CreateNewDocument();

	if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return false;
	}

    ASSERT_VALID(pDocument);

	pDocument->m_bAutoDelete = FALSE;   // don't destroy if something goes wrong
	CFrameWnd* pFrame = tmpl->CreateNewFrame(pDocument, NULL);
	pDocument->m_bAutoDelete = TRUE;
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return FALSE;
	};

	ASSERT_VALID(pFrame);

	pDocument->SetPathName(CString("An entry subset by  ")+Title);
	

	// open an existing document
	tmpl->InitialUpdateFrame(pFrame, pDocument, TRUE);

	POSITION pos =  pDocument->GetFirstViewPosition();
	CPocketForm* V = (CPocketForm*)(pDocument->GetNextView(pos));
	V->m_PocketItems = UnitNos;
    V->m_WordList.InsertColumn(1,"Словарный вход", LVCFMT_LEFT, 200);
	V->m_WordList.InsertColumn(2,"Номер значения", LVCFMT_LEFT, 60);
	V->m_WordList.InsertColumn(2,"Название словаря", LVCFMT_LEFT, 60);
	V->m_WordList.SetItemCountEx(UnitNos.size());
	V->m_UnitsSize.Format ("Число словарных входов : %i",    V->m_WordList.GetItemCount());
    V->UpdateData(FALSE);
    V->m_WordList.UpdateData(FALSE);
    V->m_WordList.Invalidate();	
	V->m_Title = Title;

	// установка размеров
	V->GetParent()->SetWindowPos(NULL, 0,0, 535 , 500, SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOMOVE);
	return true;
};
Esempio n. 11
0
CMDIChildWnd *CMDIChildIter::GetNextChild()
{
	CDocument	*pDoc = m_DocIter.GetNextDoc();
	if (pDoc != NULL) {
		POSITION	pos = pDoc->GetFirstViewPosition();
		if (pos != NULL) {
			CView	*pView = pDoc->GetNextView(pos);
			if (pView != NULL)
				return(DYNAMIC_DOWNCAST(CMDIChildWnd, pView->GetParentFrame()));
		}
	}
	return(NULL);
}
Esempio n. 12
0
CWordPadView* CEmbeddedItem::GetView() const
{
	CDocument* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	POSITION pos = pDoc->GetFirstViewPosition();
	if (pos == NULL)
		return NULL;

	CWordPadView* pView = (CWordPadView*)pDoc->GetNextView(pos);
	ASSERT_VALID(pView);
	ASSERT(pView->IsKindOf(RUNTIME_CLASS(CWordPadView)));
	return pView;
}
Esempio n. 13
0
CWnd* WPhonePlugin::GetActiveWnd(CMultiDocTemplate* doc)
{
	CWnd* pView = NULL;
	POSITION posdoc = doc->GetFirstDocPosition();
	while(posdoc != NULL)
	{
		CDocument* pdoc = doc->GetNextDoc(posdoc);
		POSITION posview = pdoc->GetFirstViewPosition();
		pView = (pdoc->GetNextView(posview));
	}

	return pView;
}
Esempio n. 14
0
CMineView* CMainFrame::GetMineView() {
	CView* view = NULL;
	CDocument* doc = GetActiveDocument();
	if (doc)
	{
		POSITION pos = doc->GetFirstViewPosition();
		while (pos != NULL)
		{
			view = (CMineView *)doc->GetNextView(pos);
			if (view->IsKindOf(RUNTIME_CLASS(CMineView))) break;
		}
		ASSERT(view->IsKindOf(RUNTIME_CLASS(CMineView)));
	}
	return (CMineView *)view;
}
Esempio n. 15
0
void CGuiApp:: raisekids(CMultiDocTemplate *doc_temp)
{
  POSITION pos_doc_temp = doc_temp->GetFirstDocPosition();
  while (pos_doc_temp) {
    CDocument *doc = doc_temp->GetNextDoc(pos_doc_temp);
    POSITION p =  doc->GetFirstViewPosition();
    while (p)
      {
	CView *view = doc->GetNextView (p);
	//      view->GetParentFrame()->SetParent(crap);
	CFrameWnd *f = (CFrameWnd *)(view->GetParentFrame());
	f->ActivateFrame(SW_SHOWNORMAL);
      } 
  }
}
Esempio n. 16
0
/////////////////////////////////////////////////////////////////////////////
// 显示OWM(View形式)
/////////////////////////////////////////////////////////////////////////////
BOOL CPlugIn::ShowOwmView(BOOL bShow, BOOL bActive)
{
	if(m_pVciObj == NULL)
	{
		return FALSE;
	}

	IVciOwm* pIVciOwm = (IVciOwm*)m_pVciObj;
	CMultiDocTemplate* pDocTemplate = NULL;
	pIVciOwm->GetDocTemplate(&pDocTemplate);

	if(pDocTemplate == NULL)
	{
		return FALSE;
	}

	POSITION posdoc = pDocTemplate->GetFirstDocPosition();
	if(!bShow)
	{
		if(posdoc)
		{
			CloseOwmFrame();
		}
		return TRUE;
	}

	if(!posdoc)
	{
		NewOwmFrame();
	}
	if(bActive)
	{
		POSITION posdoc = pDocTemplate->GetFirstDocPosition();
		if(posdoc)
		{
			CDocument* pDoc = pDocTemplate->GetNextDoc(posdoc);
			POSITION posview = pDoc->GetFirstViewPosition();
			if(posview)	// 如果视存在
			{
				CView* pOwmView = pDoc->GetNextView(posview);	// 取到视指针
				pOwmView->GetParentFrame()->ActivateFrame(); // 激活框架
				return TRUE;
			}
		}
	}

	return FALSE;
}
Esempio n. 17
0
void CFrameWnd::OnClose()
/***********************/
{
    if( m_lpfnCloseProc != NULL ) {
        m_lpfnCloseProc( this );
    } else {
        CWinApp *pApp = AfxGetApp();
        if( pApp != NULL && pApp->m_pMainWnd == this ) {
            if( !pApp->SaveAllModified() ) {
                return;
            }
            pApp->CloseAllDocuments( FALSE );
            if( pApp->m_pMainWnd == NULL ) {
                // If the main window has been destroyed by CloseAllDocuments()
                // (e.g. in an SDI application), just return since trying to execute the
                // rest of OnClose() will cause a crash due to an invalid this pointer.
                return;
            }
        }
        
        CDocument *pDoc = GetActiveDocument();
        if( pDoc != NULL ) {
            if( !pDoc->CanCloseFrame( this ) ) {
                return;
            }
            
            BOOL        bOnlyFrame = TRUE;
            POSITION    position = pDoc->GetFirstViewPosition();
            while( position != NULL ) {
                CView *pView = pDoc->GetNextView( position );
                ASSERT( pView != NULL );
                if( pView->GetParentFrame() != this ) {
                    bOnlyFrame = FALSE;
                    break;
                }
            }
            if( bOnlyFrame ) {
                // OnCloseDocument destroys the frame, so just return after calling it.
                pDoc->OnCloseDocument();
                return;
            }
            pDoc->PreCloseFrame( this );
        }
        DestroyWindow();
    }
}
Esempio n. 18
0
void Daten::update_display()
	{
	CWinApp *a;
	CDocTemplate *t;
	CDocument *d;
	CView *v;
	POSITION p;

	a = AfxGetApp();
	p = a->GetFirstDocTemplatePosition();
	t = a->GetNextDocTemplate( p);
	p = t->GetFirstDocPosition();
	d = t->GetNextDoc( p);
	p = d->GetFirstViewPosition();
	v = d->GetNextView( p);
	v->RedrawWindow();
	}
Esempio n. 19
0
// @pymethod <o PyCView>|PyCDocument|GetFirstView|Returns the first view object attached to this document.
PyObject *
ui_doc_get_first_view(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetFirstView);
	POSITION pos = pDoc->GetFirstViewPosition(); // @pyseemfc CDocument|GetFirstViewPosition
	if (pos==NULL)
		RETURN_NONE;
	GUI_BGN_SAVE;
	CView *pWnd = pDoc->GetNextView( pos );      // @pyseemfc CDocument|GetNextView
	GUI_END_SAVE;

	// @comm For more info, see <om PyCDocument.GetAllViews>
	ASSERT(pWnd);	// shouldnt be possible.
	return ui_assoc_object::make(UITypeFromCObject(pWnd), pWnd)->GetGoodRet();
}
///	\brief	select object in the editor 
///	\param	name - hash of the object name
void CStateMachineEditor::UpdateViews(IHashString *name, void (CStateMachineEditorView:: *pViewFun)(IHashString *))
{
	// iterate all opened documents
	POSITION posDoc = m_DocTemplate->GetFirstDocPosition();
	while (posDoc != NULL)
	{
		CDocument *pDoc = m_DocTemplate->GetNextDoc(posDoc);
		// iterate each opened view for the document
		POSITION posView = pDoc->GetFirstViewPosition();
		while (posView != NULL)
		{
			CView *p = pDoc->GetNextView(posView);
			CStateMachineEditorView *pView;
			pView = static_cast<CStateMachineEditorView *>(p);
			(pView->*pViewFun)(name);
		}
	}
}
void CModelViewEditor::Update()
{
	POSITION posDoc = m_DocTemplate->GetFirstDocPosition();
	while (posDoc != NULL)
	{
		CDocument *pDoc = m_DocTemplate->GetNextDoc(posDoc);
		POSITION posView = pDoc->GetFirstViewPosition();
		if (posView != NULL)
		{
			CView *pView = pDoc->GetNextView(posView);
			CModelViewRender *pModelView = dynamic_cast<CModelViewRender *>(pView);
			if (pModelView != NULL)
			{
				pModelView->Update();
			}
		}
	}
}
Esempio n. 22
0
void CMainFrame::PrintLine(const char* pszFormat, ...)
{
    char buf[1024];
    va_list arglist;
    va_start(arglist, pszFormat);
    vsprintf(buf, pszFormat, arglist);
    va_end(arglist);

    CDocument* pDoc = GetActiveDocument();
    if (!pDoc) return;

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

    CDDEServView* pView = (CDDEServView*) pDoc->GetNextView(pos);
    if (!pView) return;
    ASSERT(pView->IsKindOf(RUNTIME_CLASS(CDDEServView)));
    pView->PrintLine(buf);
}
Esempio n. 23
0
/////////////////////////////////////////////////////////////////////////////
// 刷新所有窗口
/////////////////////////////////////////////////////////////////////////////
void COwmSciteApp::RefreshAllSciteView()
{
	if(!m_ol.pDocTemplate)
		return;

	POSITION posdoc = m_ol.pDocTemplate->GetFirstDocPosition();
	while(posdoc)
	{
		CDocument* pDoc = m_ol.pDocTemplate->GetNextDoc(posdoc);
		if(pDoc)
		{
			POSITION posview = pDoc->GetFirstViewPosition();
			if(posview)
			{
				COwmSciteView* pView = (COwmSciteView*)(pDoc->GetNextView(posview));
				pView->m_SciEdit.defineDocType(pView->getLangType());
				pView->m_SciEdit.performGlobalStyles();
			}
		}
	}
}
Esempio n. 24
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;
}
void CAddNewItem::UpdateViewData()
{
	POSITION pos = theApp.GetFirstDocTemplatePosition();
	while (pos != NULL)
	{
		 CDocTemplate *pDocTemp = theApp.GetNextDocTemplate(pos);
		 POSITION posdoc = pDocTemp->GetFirstDocPosition();
		 while (posdoc != NULL)
		 {
			  CDocument* pDoc = pDocTemp->GetNextDoc(posdoc);
			  if (pDoc != NULL)
			  {
				  POSITION posview = pDoc->GetFirstViewPosition();
				  if (posview != NULL)
				  {
					  COrderManagerView* pV = (COrderManagerView*)pDoc->GetNextView(posview);
					  pV->SendMessage(WM_USER_MSG_REFRESH);
				  }
			  }
		   }
	}	
}
Esempio n. 26
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. 27
0
STDMETHODIMP CoCormanLispClient::OpenEditWindow(char* file, HWND* wnd)
{
	bool ret = true;
	CDocument* doc = 0;
	if (m_eventLoopThreadID != GetCurrentThreadId())
	{
		*wnd = 0;
		while (theApp.waitingForDocumentToOpen());
		bool ret = theApp.SetDocumentToOpen(file);
		while (theApp.waitingForDocumentToOpen());
		doc = theApp.m_lastDocOpened;
	}
	else
		doc = theApp.OpenDocumentFile(file);
	if (doc)
	{
		POSITION pos = doc->GetFirstViewPosition();
		CView* pView = doc->GetNextView(pos);
		if (pView)
			*wnd = pView->m_hWnd;
	}
	return ret ? S_OK : E_FAIL;
}
///	\brief	validate passed data in the editor
///	\param	sop - pointer to serialization parameters
///	\return EE message code
DWORD CStateMachineEditor::ValidateObject(SERIALIZEOBJECTPARAMS *sop)
{
	// iterate all opened documents
	POSITION posDoc = m_DocTemplate->GetFirstDocPosition();
	while (posDoc != NULL)
	{
		CDocument *pDoc = m_DocTemplate->GetNextDoc(posDoc);
		// iterate each opened view for the document
		POSITION posView = pDoc->GetFirstViewPosition();
		while (posView != NULL)
		{
			CView *p = pDoc->GetNextView(posView);
			CStateMachineEditorView *pView;
			pView = static_cast<CStateMachineEditorView *>(p);
			DWORD res = pView->ValidateObject(sop);
			if (MSG_NOT_HANDLED != res)
			{
				return res;
			}
		}
	}
	return MSG_NOT_HANDLED;
}
Esempio n. 29
0
CDocument* CDocTemplateEx::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible)
{
	CAIPIApp* pApp = (CAIPIApp*)AfxGetApp();

	if (m_docList.GetCount() == 1)
	{
		CDocument* pDocument = (CDocument*)m_docList.GetHead();
		BOOL e = pDocument->GetPathName().IsEmpty();
		BOOL m = pDocument->IsModified();

		if (lpszPathName != NULL && pDocument->GetPathName().IsEmpty() && pDocument->IsModified())
		{
			
			pApp->AipiOpenDocumentFile(lpszPathName);
	
			CWaitCursor wait;
			if (!pDocument->OnOpenDocument(lpszPathName))
			{
				// user has be alerted to what failed in OnOpenDocument
				TRACE0("CDocument::OnOpenDocument returned FALSE.\n");
				return NULL;
			}
			
			pDocument->SetPathName(lpszPathName);
			POSITION pos = pDocument->GetFirstViewPosition();
			CView* pView = pDocument->GetNextView(pos);
			CFrameWnd* pFrame = pView->GetParentFrame();
			InitialUpdateFrame(pFrame, pDocument);
			return pDocument;
		}
	}

	pApp->AipiOpenDocumentFile(lpszPathName);
	

	return CMultiDocTemplate::OpenDocumentFile(lpszPathName, bMakeVisible);
}
CModelViewRender *CModelViewEditor::FindView(LPCTSTR szModelName)
{
	CHashString hszModelName = szModelName;
	DWORD dwModelNameID = hszModelName.GetUniqueID();
	POSITION posDoc = m_DocTemplate->GetFirstDocPosition();
	while (posDoc != NULL)
	{
		CDocument *pDoc = m_DocTemplate->GetNextDoc(posDoc);
		POSITION posView = pDoc->GetFirstViewPosition();
		if (posView != NULL)
		{
			CView *pView = pDoc->GetNextView(posView);
			CModelViewRender *pModelView = dynamic_cast<CModelViewRender *>(pView);
			if (pModelView != NULL)
			{
				if (pModelView->GetEntityName()->GetUniqueID() == dwModelNameID)
				{
					return pModelView;
				}
			}
		}
	}
	return NULL;
}