void CFrameWnd::InitialUpdateFrame( CDocument *pDoc, BOOL bMakeVisible ) /**********************************************************************/ { UNUSED_ALWAYS( pDoc ); if( GetActiveView() == NULL ) { CView *pView = (CView *)GetDescendantWindow( AFX_IDW_PANE_FIRST ); if( pView != NULL ) { if( pView->IsKindOf( RUNTIME_CLASS( CView ) ) ) { SetActiveView( pView ); } else if( pView->IsKindOf( RUNTIME_CLASS( CSplitterWnd ) ) ) { pView = (CView *)pView->GetDescendantWindow( AFX_IDW_PANE_FIRST ); if( pView->IsKindOf( RUNTIME_CLASS( CView ) ) ) { SetActiveView( pView ); } } } } if( pDoc != NULL ) { pDoc->UpdateFrameCounts(); } OnUpdateFrameTitle( TRUE ); SendMessageToDescendants( WM_INITIALUPDATE ); if( bMakeVisible ) { CWinApp *pApp = AfxGetApp(); ASSERT( pApp != NULL ); if( pApp->m_pMainWnd == this ) { ActivateFrame( pApp->m_nCmdShow ); pApp->m_nCmdShow = -1; } else { ActivateFrame(); } } }
void AppState::OpenMostRecentResourceAt(ResourceType type, uint16_t number, int index) { OpenMostRecentResource(type, number); // Now it should be open... // MDI view implementation file CMDIChildWnd * pChild = ((CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd))->MDIGetActive(); if (pChild) { CView * pView = pChild->GetActiveView(); if (pView) { if (pView->IsKindOf(RUNTIME_CLASS(CVocabView))) { ((CVocabView*)pView)->SelectGroup((Vocab000::WordGroup)index); } else if (pView->IsKindOf(RUNTIME_CLASS(CListView))) { CListView *pTextView = (CListView *)pView; pTextView->GetListCtrl().SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); pTextView->GetListCtrl().EnsureVisible(index, FALSE); } } } }
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; }
void CSearchBox::OnSelendok() { // TODO: Add your control notification handler code here if( m_bDoNothing ) return; int nSel = GetCurSel(); m_hwndLastFocus = NULL; m_bSegmentEnd = TRUE; if( CB_ERR != nSel ) { SetCurSel( nSel ); if( m_bShowOnSel ) { DWORD dwData = GetItemData( nSel ); CView * pView = AfxGetStaticDoc()->GetActiveView(); if( dwData & SEARCHBOX_SIGNBIT_STT ) AfxShowStockTech( dwData & ~SEARCHBOX_SIGNBIT_STT ); else if( dwData & SEARCHBOX_SIGNBIT_ACCE ) AfxExecuteAccelerator( dwData & ~SEARCHBOX_SIGNBIT_ACCE ); else if( pView && pView->IsKindOf( RUNTIME_CLASS(CRealTimeView) ) ) AfxShowStockRealTime( dwData, FALSE ); else AfxShowStockGraph( dwData, FALSE ); return; } } SetCurrentWindowText( ); if( m_bAutoHide ) SetWindowPos( NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW ); }
void CMUSHclientDoc::NoteHr() { // wrap up previous line if necessary if (m_pCurrentLine->len > 0) StartNewLine (true, 0); // mark line as HR line m_pCurrentLine->flags = HORIZ_RULE; StartNewLine (true, 0); // now finish this line // refresh views for(POSITION pos=GetFirstViewPosition();pos!=NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView))) { CMUSHView* pmyView = (CMUSHView*)pView; pmyView->addedstuff(); } } } // end of CMUSHclientDoc::NoteHr
LRESULT CMainFrame::OnUpdatePropertyView( WPARAM wParam, LPARAM lParam ) { BOOL bRet = FALSE; CMapEditorDoc* pDoc = (CMapEditorDoc*)GetActiveDocument(); if (NULL == m_PropertyView) { CView* tView = NULL; // 寻找对应的绘图区View POSITION pos = pDoc->GetFirstViewPosition(); while (pos) { tView = pDoc->GetNextView(pos); if (tView->IsKindOf(RUNTIME_CLASS(CObjectPropertyView))) { m_PropertyView = (CObjectPropertyView*)tView; bRet = TRUE; break; } } } if (m_PropertyView) { m_PropertyView->SetPropertyHost(pDoc->m_pCurrentPropertyObj); // m_PropertyView->Invalidate(FALSE); } return bRet; }
void MainFrame::OnUpdateNumPackages (/*[in]*/ CCmdUI * pCmdUI) { try { CView * pView = GetActiveView(); pCmdUI->Enable (pView != 0); if (pView == 0) { pCmdUI->SetText (_T("")); return; } if (! pView->IsKindOf(RUNTIME_CLASS(MpmView))) { pCmdUI->SetText (_T("")); return; } MpmView * pMpmView = reinterpret_cast<MpmView*>(pView); CString str; str.Format (T_(_T("Total: %d")), pMpmView->GetNumberOfPackages()); pCmdUI->SetText (str); } catch (const MiKTeXException & e) { ErrorDialog::DoModal (this, e); } catch (const exception & e) { ErrorDialog::DoModal (this, e); } }
// warning - different in Lua BSTR CMUSHclientDoc::GetWorldWindowPositionX(short Which) { CString strResult; int i = 0; CWindowPlacement wp; for(POSITION pos=GetFirstViewPosition();pos!=NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) { CSendView* pmyView = (CSendView*)pView; i++; if (i != Which) continue; // wrong one pmyView->GetParentFrame ()->GetWindowPlacement(&wp); windowPositionHelper (strResult, wp.rcNormalPosition); break; } } return strResult.AllocSysString(); } // end of CMUSHclientDoc::GetWorldWindowPositionX
//**************************************************************************** COleClientItem* CBCGPFrameWnd::GetInPlaceActiveItem () { CFrameWnd* pActiveFrame = GetActiveFrame (); if (pActiveFrame == NULL) { return NULL; } ASSERT_VALID (pActiveFrame); CView* pView = pActiveFrame->GetActiveView (); if (pView == NULL || pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView))) { return NULL; } ASSERT_VALID (pView); COleDocument* pDoc = DYNAMIC_DOWNCAST (COleDocument, pView->GetDocument ()); if (pDoc == NULL) { return NULL; } ASSERT_VALID (pDoc); return pDoc->GetInPlaceActiveItem (pView); }
void CMUSHclientDoc::SetWorldWindowStatus(short Parameter) { CFrameWnd* pParent = NULL; for(POSITION pos=GetFirstViewPosition();pos!=NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) { CSendView* pmyView = (CSendView*)pView; pParent = pmyView->GetParentFrame (); break; } } if (pParent) { switch (Parameter) { case 1: pParent->ShowWindow(SW_SHOWMAXIMIZED); break; case 2: pParent->ShowWindow(SW_MINIMIZE); break; case 3: pParent->ShowWindow(SW_RESTORE); break; case 4: pParent->ShowWindow(SW_SHOWNORMAL); break; } // end of switch } // have parent } // end of CMUSHclientDoc::SetWorldWindowStatus
void CUndoBar::DoUndo () { CUndoButton* pUndoButton = GetParentButton (); ASSERT_VALID (pUndoButton); pUndoButton->m_nSelNum = m_wndList.GetSelCount () + 1; CMDIChildWnd* pChildFrame = ((CMDIFrameWnd*)GetTopLevelFrame())->MDIGetActive(); if (pChildFrame) { CView* pView = pChildFrame->GetActiveView(); if (pView && pView->IsKindOf(RUNTIME_CLASS(CBCGPVisualStudioGUIDemoView))) { ((CBCGPVisualStudioGUIDemoView*)pView)->DoUndo(pUndoButton); } else { ASSERT(FALSE); } } else { ASSERT(FALSE); } GetParent ()->PostMessage (WM_CLOSE); }
void CActivityView::OnPopupSwitchtoworld() { CMUSHclientDoc* pDoc = GetSelectedWorld (); if (!pDoc) return; for(POSITION pos=pDoc->GetFirstViewPosition();pos!=NULL;) { CView* pView = pDoc->GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) { CSendView* pmyView = (CSendView*)pView; if (pmyView->GetParentFrame ()->IsIconic ()) pmyView->GetParentFrame ()->ShowWindow (SW_RESTORE); pmyView->GetParentFrame ()->ActivateFrame (); pmyView->m_owner_frame->SetActiveView(pmyView); break; } } } // end of CActivityView::OnPopupSwitchtoworld
void CMUSHclientDoc::CheckTickTimers () { // timer has kicked in unexpectedly - ignore it if (m_CurrentPlugin) return; // check for selection change in command window // I know, this is a crappy way of doing it, but the CEditView does // not notify of selection changes. for(POSITION commandpos=GetFirstViewPosition();commandpos!=NULL;) { CView* pView = GetNextView(commandpos); if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) { CSendView* pmyView = (CSendView*)pView; pmyView->CheckForSelectionChange (); } // end of being a CSendView } SendToAllPluginCallbacks (ON_PLUGIN_TICK); } // end of CMUSHclientDoc::CheckTickTimers
void DviDoc::OnIdle () { try { CDocument::OnIdle (); DviFileStatus oldStatus = fileStatus; DviFileStatus newStatus = GetDviFileStatus(); if (newStatus == DVIFILE_MODIFIED) { YapLog (T_("document has been modified")); POSITION posView = GetFirstViewPosition(); while (posView != 0) { CView * pView = GetNextView(posView); if (pView->IsKindOf(RUNTIME_CLASS(DviView))) { DviView * pDviView = reinterpret_cast<DviView*>(pView); if (! pDviView->PostMessage(WM_COMMAND, ID_VIEW_REFRESH)) { // unexpected } } } } else if (pDvi != 0) { pSession->UnloadFilenameDatabase (); // <fixme/> } } catch (const exception &) { } }
void CMUSHclientDoc::MoveWorldWindowX(long Left, long Top, long Width, long Height, short Which) { int i = 0; for(POSITION pos=GetFirstViewPosition();pos!=NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) { CSendView* pmyView = (CSendView*)pView; i++; if (i != Which) continue; // wrong one pmyView->GetParentFrame ()->MoveWindow (Left, Top, Width, Height); break; } } } // end of CMUSHclientDoc::MoveWorldWindowX
BOOL CVmonitorDoc::SaveModified() { CView *pView; CMDIChildWnd *pChild; pChild = (CMDIChildWnd *)(gFrame->GetActiveFrame()); if(pChild == NULL) return true; pView = pChild->GetActiveView(); if(pView == NULL) return true; if( pView->IsKindOf(RUNTIME_CLASS(CVmonitorView)) ) return true; if( pView->IsKindOf(RUNTIME_CLASS(CEditView)) ) return CDocument::SaveModified(); return true; }
CView* CKWResearchWorkDoc::GetView(CRuntimeClass* pClass) { CView* pView; POSITION pos=GetFirstViewPosition(); while(pos!=NULL){ pView=GetNextView(pos); if(pView->IsKindOf(pClass)) break; } if(!pView->IsKindOf(pClass)){ AfxMessageBox("Connt Locate the View."); return NULL; } return pView; }
// ============================================================================ CView* CVisualMSDoc::GetFormView() { POSITION pos = GetFirstViewPosition(); while(pos != NULL) { CView* pView = GetNextView(pos); if(pView->IsKindOf(RUNTIME_CLASS(CFormEdView))) return pView; } return NULL; }
CView* CGumpEditorDoc::FindView(CRuntimeClass* pClass) { POSITION pos = GetFirstViewPosition(); while (pos != NULL) { CView* pView = GetNextView(pos); if (pView->IsKindOf(pClass)) return pView; } return NULL; }
CSolarSystemView* CSolarSystemDoc::GetMainView(void) { POSITION pos = GetFirstViewPosition(); while (pos) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CSolarSystemView))) return dynamic_cast<CSolarSystemView*>(pView); } return NULL; }
void CHLRDoc::Fit() { POSITION position = GetFirstViewPosition(); while (position != (POSITION)NULL) { CView* pCurrentView = (CView*)GetNextView(position); if(pCurrentView->IsKindOf(RUNTIME_CLASS(OCC_3dView)) ) { ((OCC_3dView *) pCurrentView)->FitAll(); } } }
// All child frame's will have exactly one CHexEditView (unless in print preview?). This returns it. CHexEditView *CChildFrame::GetHexEditView() const { CView *pv = GetActiveView(); if (pv != NULL) // May be NULL if print preview { if (pv->IsKindOf(RUNTIME_CLASS(CHexEditView))) return (CHexEditView *)pv; else if (pv->IsKindOf(RUNTIME_CLASS(CDataFormatView))) return ((CDataFormatView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CAerialView))) return ((CAerialView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CCompareView))) return ((CCompareView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CPrevwView))) return ((CPrevwView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CHexTabView))) { // Find the hex view (left-most tab) CHexTabView *ptv = (CHexTabView *)pv; ptv->SetActiveView(0); // hex view is always left-most (index 0) ASSERT_KINDOF(CHexEditView, ptv->GetActiveView()); return (CHexEditView *)ptv->GetActiveView(); } } return NULL; }
CView * CStaticDoc::GetViewIfExist( CRuntimeClass *pViewClass ) { POSITION pos = GetFirstViewPosition( ); CView * pView = NULL; while( pView = GetNextView(pos) ) { if( pView && pView->IsKindOf( pViewClass ) ) { return pView; } } return NULL; }
void CMultiSheetDoc::SelectSheetView( int i ) { POSITION pos = GetFirstViewPosition(); while (pos != NULL) { CView* pView = GetNextView(pos); if (pView->IsKindOf( RUNTIME_CLASS( CTinyCadView ))) { static_cast<CTinyCadView*>(pView)->SelectSheet( i ); pView->RedrawWindow(); } } }
CLuaView* CMainFrame::GetActiveView() { CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIChildWnd *pChild = (CMDIChildWnd *)pFrame->GetActiveFrame(); if ( !pChild ) return NULL; CView *pView = pChild->GetActiveView(); if ( pView && pView->IsKindOf(RUNTIME_CLASS(CLuaView)) ) return (CLuaView*)pView; return NULL; }
void CmdwEditorDoc::Serialize(CArchive& ar) { POSITION pos = this->GetFirstViewPosition(); CView* cv = NULL; CEditView* pEv = NULL; do { cv = this->GetNextView(pos); if( cv != NULL && cv->IsKindOf(RUNTIME_CLASS(CEditView))) { pEv = (CEditView*)cv; break; } } while(cv != NULL); if(pEv == NULL) return; //CString htmlpath; CFile *pCF = ar.GetFile(); //if(pCF != NULL) // htmlpath = pCF->GetFilePath() + _T(".html"); if (ar.IsStoring()) { // TODO: add storing code here /** unicode data 修改後儲存時轉換回 utf-8 再由sundown 轉換成 html,通知 HtmlView 顯示 */ LPCTSTR lpszText = pEv->LockBuffer(); ASSERT(lpszText != NULL); UINT nLen = pEv->GetBufferLength(); TRY { //ar.Write(lpszText, nLen*sizeof(TCHAR)); getEditText(lpszText, nLen); pCF->SeekToBegin(); pCF->Write(mib_utf8->data, mib_utf8->size); m_bHtmlExisted = convMd2Html((LPCTSTR)m_htmlPath, m_cssPath); this->UpdateAllViews(NULL, (LPARAM)(LPCTSTR)m_htmlPath, NULL); } CATCH_ALL(e) { pEv->UnlockBuffer(); THROW_LAST(); } END_CATCH_ALL pEv->UnlockBuffer(); }
// Fonction permettant d'obtenir la classe de l'interface à partir de partout... //------------------------------------------ // Fonction permettant d'obtenir la classe de l'interface à partir de partout... // Entrées: vide // Retourne: l'instance de la "view" // Auteur: Maxime Lussier //------------------------------------------ CP10View * CP10View::GetView() { CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd); CView * pView = pFrame->GetActiveView(); if ( !pView ) return NULL; if ( ! pView->IsKindOf( RUNTIME_CLASS(CP10View) ) ) return NULL; return (CP10View *) pView; }
///////////////////////////////////////////////////////////////////////////// // CdSqlQuery commands CuSqlQueryControl* CdSqlQuery::GetSqlQueryCtrl() { POSITION pos = GetFirstViewPosition(); while (pos != NULL) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CvSqlQuery))) { CvSqlQuery* pSqlView = (CvSqlQuery* )pView; return &pSqlView->m_SqlQuery; } } return NULL; }
void CHLRDoc::FitAll2DViews(Standard_Boolean UpdateViewer) { if (UpdateViewer) my2DViewer->Update(); POSITION position = GetFirstViewPosition(); while (position != (POSITION)NULL) { CView* pCurrentView = (CView*)GetNextView(position); if(pCurrentView->IsKindOf(RUNTIME_CLASS(OCC_2dView)) ) { ASSERT_VALID(pCurrentView); ((OCC_2dView*)pCurrentView)->GetV2dView()->Fitall(); } } }
// CVmonitorDoc 命令 void CVmonitorDoc::DisplayContent(char *buf, int size) { CView *pView; POSITION pos; CMDIChildWnd *pChild; if(size == 0) return; if(!gFrame) return; pChild = (CMDIChildWnd *)(gFrame->GetActiveFrame()); if (pChild == NULL) return; pView = pChild->GetActiveView(); if (pView == NULL) return; if ( pView->IsKindOf(RUNTIME_CLASS(CVmonitorView)) ) { // ((CVmonitorView *)pView)->OnUpdate(NULL, 0, 0); ((CVmonitorView *)pView)->AddContent(buf, size); return; } pos = GetFirstViewPosition(); while (pos != NULL) { pView = GetNextView(pos); if(pView == NULL) continue; if( pView->IsKindOf(RUNTIME_CLASS(CVmonitorView)) ) { // ((CVmonitorView *)pView)->OnUpdate(NULL, 0, 0); ((CVmonitorView *)pView)->AddContent(buf, size); return; } } }