本文整理汇总了C++中CChildFrame::GetActiveView方法的典型用法代码示例。如果您正苦于以下问题:C++ CChildFrame::GetActiveView方法的具体用法?C++ CChildFrame::GetActiveView怎么用?C++ CChildFrame::GetActiveView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChildFrame
的用法示例。
在下文中一共展示了CChildFrame::GetActiveView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetActiveDocument
//---------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------
CeditorDoc * GetActiveDocument( void )
{
CChildFrame *chldFrm = (CChildFrame*)(((CMainFrame*)AfxGetMainWnd())->MDIGetActive());
if( !chldFrm )
return NULL;
return (CeditorDoc*)chldFrm->GetActiveView()->GetDocument();
}
示例2: GetActiveView
CView* CStaticDoc::GetActiveView( )
{
CMainFrame * pMainFrame = AfxGetMainFrame();
if( pMainFrame )
{
CChildFrame * pChildFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
if( pChildFrame )
{
CView * pView = pChildFrame->GetActiveView();
if( pView && this == pView->GetDocument() )
return pView;
}
}
return NULL;
}
示例3: UpdateTabs
// generates the string list of view names to be used for the tabs
void CBonfireDoc::UpdateTabs(LPCTSTR lpszPathName /*= NULL*/)
{
CStringList pTabList;
CString ext = (lpszPathName == NULL)
? GetFileExtension(GetPathName())
: GetFileExtension(lpszPathName);
// generate tabs based on the file extension
CString strViews = theApp.m_opOptions.views.vAssociations[0].strViews; // init to default views
CString strExtList = "";
size_t nExt = theApp.m_opOptions.views.vAssociations.size();
// see if the current file's extension is in the list
while (nExt-- > 0) // 0 is the default file extension
{
strExtList = (CString)theApp.m_opOptions.views.vAssociations[nExt].strExtensions;
strExtList.Remove(' ');
if (IsStringPresent(strExtList, ext))
{
strViews = theApp.m_opOptions.views.vAssociations[nExt].strViews;
break;
}
}
POSITION pos = GetFirstViewPosition();
CChildFrame* pChild = ((CChildFrame*)GetNextView(pos)->GetParentFrame());
CView* pView = pChild->GetActiveView();
BOOL bIsCurViewAvail = FALSE;
// also make sure the current view is available, if not, close it
// add the tabs to the tablist
for (int i = 0; i < theApp.m_arAllViews.GetSize(); i++)
{
if (strViews[i] != '-')
{
pTabList.AddHead( ((CBonfireView*)theApp.m_arAllViews[i])->m_strCaption );
if (pView && pView->IsKindOf(theApp.m_arAllViews[i]->m_pClass))
bIsCurViewAvail = TRUE;
}
}
// draw the tabs
pChild->DrawTabs(&pTabList);
if (!pView || !bIsCurViewAvail)
SwitchToFirstView();
}
示例4: OnSelchanged
//##ModelId=4095FA7D002E
void look::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
HTREEITEM s=m_TreeCtrl->GetSelectedItem ();
HTREEITEM s1=m_TreeCtrl->GetSelectedItem ();
fm *p=(fm*)((CMainFrame *)AfxGetMainWnd())->m_wndWorkspace.GetView (RUNTIME_CLASS(fm));
CString str;
CString str0;
CString sql;
//we willl save something before we lost it
////////////////////////////////////////////////////////////////////////////////
BOOL bMaximized = FALSE;
CChildFrame* pActiveWnd = (CChildFrame*)((CMainFrame *)AfxGetMainWnd())->MDIGetActive(&bMaximized);
CDbView *pActiveView = NULL;
if (!pActiveWnd)
{
return;
}
pActiveView = (CDbView *)pActiveWnd->GetActiveView();
//pActiveView ->SendMessage(WM_USER+100);
////////////////////////////////////////////////////////////////
int i=0;
str=m_TreeCtrl->GetItemText(s);
CStatusBar *m=(CStatusBar *)((CMainFrame *)AfxGetMainWnd())->GetDescendantWindow (AFX_IDW_STATUS_BAR);
while ((s=m_TreeCtrl->GetParentItem (s))!=NULL)
{
str0=m_TreeCtrl->GetItemText(s);
i=i+1;
//TRACE1("%d",i);
}
//TRACE1("%d",i);
if(i)
{
sql=sql="select content from help where type=\'"+str0+"\' and "+"title=\'"+str+"\'";
if(con.mysql_exec(my,sql)!=0)
{
//MessageBox("服务器可能已经关闭,请重试,如果问题仍然存在,请联系[email protected]");
//AfxGetMainWnd()->PostMessage (WM_CLOSE);
return;
}
rs_dad=con.store_result (my);
//clear the list
if (row=mysql_fetch_row(rs_dad))
pActiveView->GetEditCtrl().SetWindowText(row[0]);
con.free_result (rs_dad);
CString title_all;
title_all="db - ["+str0+">>"+str+"]";
SETTITLE(title_all.GetBuffer(title_all.GetLength ()));
//(CMainFrame *)AfxGetMainWnd())->GetActiveWindow
pActiveView->GetDocument()->SetTitle(str0+">>"+str);
p->title=str;
p->type=str0;
}
m->SetPaneText (0,str);
*pResult = 0;
}
示例5: SwitchToView
/////////////////////////////////////////////////////////////////////////////
// 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
//.........这里部分代码省略.........
示例6: Example
void CPFAOptimize::Example()
{
CMainFrame* pMainFrame = NULL;
pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
CChildFrame* pChildFrame = NULL;
pChildFrame = (CChildFrame*)pMainFrame->GetActiveFrame();
CAutoPFAView* pAutoView = NULL;
pAutoView = (CAutoPFAView*)pChildFrame->GetActiveView();
ComponentManager* pComManager = pAutoView->GetDocument()->m_scenarioManager.GetCurScenario()->GetCompManager();
JunSystemTransformCircleSystem( *pComManager, OptData );
DisplayMatrix( "F://CirPipe.txt", 100, OptData );
InitializePipeCircle( OptData );
DisplayMatrix( "F://Pipe.txt", 102, OptData );
// 从pComManager中初始化OptData的 初始实际流量,管道长度,节点流量,配水源,控制点,
// 先手动设置配水源和控制点
int iTemp = 1;
OptData.SetProperty( 0, 200, iTemp ); // 节点1为配水源
iTemp = 6;
OptData.SetProperty( 0, 201, iTemp ); // 节点10为控制点
CMinimumSquareSum MinSquSum;
//MinSquSum.InitializeFactFlux( *pComManager, OptData ); // 初始实际流量
///////////////////////////////////////
int i = 0;
int iKeyOfPipe = 0;
double Temp = 0.0;
Temp = 0.03;
OptData.SetProperty( 1, 1, Temp );
OptData.SetProperty( 3, 1, Temp );
OptData.SetProperty( 6, 1, Temp );
OptData.SetProperty( 7, 1, Temp );
Temp = 0.02;
OptData.SetProperty( 2, 1, Temp );
OptData.SetProperty( 4, 1, Temp );
OptData.SetProperty( 5, 1, Temp );
////////////////////////////////////////
double dTemp = 0.0;
Pipe* pPipe = NULL;
Component* pComponent = NULL;
map< int, double > BeforeDiameterMap; // 存储了上一次计算的直径
int iIteratorTime = 0; // 迭代次数
IteratorPtr<Component> PipeItPtr( pComManager->CreatPipeIterator() );
for( PipeItPtr->Fist(); !PipeItPtr->IsDone(); PipeItPtr->Next() )
{
pComponent = &PipeItPtr->CurrentItem();
pPipe = dynamic_cast<Pipe*>( pComponent );
dTemp = pPipe->Len();
OptData.SetProperty( pPipe->GetKey(), 2, dTemp );
dTemp = pPipe->InDia();
OptData.SetProperty( pPipe->GetKey(), 4, dTemp );
}
// 节点流量
QuantityManager& qm = QuantityManager::Instance();
CString strUnit = "";
CString strValue = "";
Jun* pJun = NULL;
IteratorPtr<Component> JunItPtr( pComManager->CreatJunIterator() );
for( JunItPtr->Fist(); !JunItPtr->IsDone(); JunItPtr->Next() )
{
pComponent = &JunItPtr->CurrentItem();
pJun = dynamic_cast<Jun*>( pComponent );
strUnit = pJun->ms_InitGuess.GetValue( 2 ); // 获得单位
strValue = pJun->ms_InitGuess.GetValue( 1 );
TCHAR* pChar = NULL;
qm.TransformToStd( dTemp, strUnit.GetBuffer( 32 ), _tcstod( strValue.GetBuffer( 32 ), &pChar ) ); // 转化成标准单位
if( IDS_STRVOLUMEFLOW != _ttoi( pJun->ms_InitGuess.GetValue( 0 ).GetBuffer( 32 ) ) ) // 质量流量,要转化为体积流量
{
double dTempDensity = 0.0;
NumFlyWeight *pDensity = &( ( pComManager->SysProperty().GetFuild() )->ms_Density );
dTemp *= pDensity->GetNum(); // GetNum返回标准单位数
}
OptData.SetProperty( pJun->GetKey(), 3, dTemp );
}
////////////
dTemp = 0.06;
OptData.SetProperty( 1, 3, dTemp );
dTemp = -0.06;
OptData.SetProperty( 6, 3, dTemp );
////////////
// 初始化经济参数
OptData.SetAModulus( 8.4 );
OptData.SetBModulus( 107 );
OptData.SetAlfaModulus( 1.6 );
OptData.SetDisinvestmentTime( 1.0e3 );
OptData.SetRepairModulus( 3.3 );
OptData.SetEletricityPrice( 0.5 );
OptData.SetAsymmetryModulus( 1.0 );
OptData.SetPumpEfficiency( 0.7 );
OptData.SetKModulus( 1.34e-10 );
OptData.SetMModulus( 5.3 );
OptData.SetNModulus( 2 );
OptData.Initialization();
//.........这里部分代码省略.........