⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			// the new view is there, but invisible and not active...
			pNewView->ShowWindow(SW_SHOW);
			pNewView->OnInitialUpdate();
			pChild->SetActiveView(pNewView);
			pChild->RecalcLayout();
			
			// finally destroy the old view...
			pOldActiveView->DestroyWindow();
		}
	}
	else
	{
		CCVenusDoc*	pNewDoc	= new CCVenusDoc;
		
		CRuntimeClass* pNewViewClass;
		pNewViewClass = RUNTIME_CLASS(CSourceDataView);
		CCreateContext context;
		
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = pNewDoc;
		context.m_pCurrentFrame = NULL;
		
		CChildFrame*	pNewFrame = new CChildFrame;
		
		pNewFrame->LoadFrame(IDR_MAINFRAME,
			WS_OVERLAPPEDWINDOW ,   // default frame styles
			NULL, &context);
		pNewFrame->InitialUpdateFrame(pNewDoc, true);
	}
*/
	CCVenusDoc*	pNewDoc	= new CCVenusDoc;
	
	CRuntimeClass* pNewViewClass;
//	pNewViewClass = RUNTIME_CLASS(CSourceDataView);
	pNewViewClass = RUNTIME_CLASS(CNewSourceDataView);

	CCreateContext context;
	context.m_pNewViewClass = pNewViewClass;
	context.m_pCurrentDoc = pNewDoc;
	context.m_pCurrentFrame = NULL;
	
	CChildFrame*	pNewFrame = new CChildFrame;
	
	LockMyWindowUpdate( );
	if(GetActiveFrame() != this)
		GetActiveFrame()->SendMessage(WM_CLOSE, NULL, NULL);
	pNewFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW ,   // default frame styles
		NULL, &context);
	pNewFrame->InitialUpdateFrame(pNewDoc, true);
	MDITile();
	UnlockMyWindowUpdate();

	m_picState = PicNone;
}

void CMainFrame::OnSdSpr() 
{
	if(m_cstrProjectPath.IsEmpty())
		return;
/*	CDialogShotPara dlg;
	dlg.m_bWellState = m_structWellInfo.bWellState;
	dlg.m_structSD.fPress = m_structBDTTable.fStratumAverPress;
	dlg.m_structSD.fHole = m_structBDTTable.fStratumHolePercent;
	dlg.m_structSD.fFilter = m_structBDTTable.fStratumFilterPercent;
	dlg.m_structSD.cstrModel = m_structBDTTable.strOilResCannulaModel;

	dlg.m_bComputeState = m_structTTPResult.bState;
	int iTemp;
	m_structTTPTable.lNum = m_structBDTTable.lCount;
	if(m_structTTPTable.bState == TRUE)
	{
		for(iTemp = 0 ;iTemp < m_structBDTTable.lCount ;iTemp++)
		{
			m_structTTPShotPara[iTemp].fShotDepth = m_structSDT[iTemp].fShotDepth ;
			m_structTTPShotPara[iTemp].fDiameter = m_structSDT[iTemp].fDiameter ;
			m_structTTPShotPara[iTemp].fPortion = m_structSDT[iTemp].fPortion ;
			sprintf(m_structTTPShotPara[iTemp].strModel ,"%s" ,m_structSDT[iTemp].strModel );
			dlg.m_structDate [iTemp] = m_structTTPShotPara[iTemp];
		}
	}
	else
	{
		for(iTemp = 0 ;iTemp < m_structBDTTable.lCount ;iTemp++)
		{
			m_structTTPShotPara[iTemp].fShotDepth = m_structSDT[iTemp].fShotDepth ;
			m_structTTPShotPara[iTemp].fDiameter = m_structSDT[iTemp].fDiameter ;
			m_structTTPShotPara[iTemp].fPortion = m_structSDT[iTemp].fPortion ;
			m_structTTPShotPara[iTemp].fDate = 12;
			m_structTTPShotPara[iTemp].fLimitDate = 18;
			sprintf(m_structTTPShotPara[iTemp].strModel ,"%s" ,m_structSDT[iTemp].strModel );
			dlg.m_structDate [iTemp] = m_structTTPShotPara[iTemp];
		}
		m_structTTPTable.fGun = 0;
		m_structTTPTable.fLong = 0;
	}

	dlg.m_structTTPTable = m_structTTPTable;

	if(m_structTTPResult.bState == TRUE)
	{
		dlg.m_fPressDiff = m_structTTPResult.fPressDiff ;
		for(iTemp=0;iTemp<m_structTTPResult.lNum;iTemp++)
		{
			dlg.m_fPP[iTemp] = m_structTTPResult.fPP[iTemp];
			dlg.m_fPDepth[iTemp] = m_structTTPResult.fPDepth[iTemp];
			dlg.m_fPDiameter[iTemp] = m_structTTPResult.fPDiameter[iTemp];
		}
	}
	else
	{
		dlg.m_fPressDiff = 0;
		for(iTemp=0;iTemp<m_structTTPResult.lNum;iTemp++)
		{
			dlg.m_fPP[iTemp] = NULL;
			dlg.m_fPDepth[iTemp] = NULL;
			dlg.m_fPDiameter[iTemp] = NULL;
		}
	}
	dlg.DoModal ();
	if(dlg.m_bComputeSave == FALSE)
		return;
	m_structTTPTable.bState = dlg.m_bComputeState ;
	m_structTTPTable.fGun = dlg.m_fGun ;
	m_structTTPTable.fLong = dlg.m_fLong ;
	m_structTTPResult.bState = TRUE;
	m_structTTPResult.fPressDiff = dlg.m_fPressDiff ;
	m_structTTPResult.lNum = m_structTTPTable.lNum;
	for(iTemp=0;iTemp<m_structTTPResult.lNum;iTemp++)
	{
		m_structTTPShotPara[iTemp] = dlg.m_structDate [iTemp];
		m_structTTPResult.fPP[iTemp] = dlg.m_fPP[iTemp];
		m_structTTPResult.fPDepth[iTemp] = dlg.m_fPDepth[iTemp];
		m_structTTPResult.fPDiameter[iTemp] = dlg.m_fPDiameter[iTemp];
	}
	MessageBox("参数校正结果已经写入工程!","工程信息");
*/	
	CCVenusDoc*	pNewDoc	= new CCVenusDoc;
	
	CRuntimeClass* pNewViewClass;
	pNewViewClass = RUNTIME_CLASS(CShotParaView);
	CCreateContext context;
	
	context.m_pNewViewClass = pNewViewClass;
	context.m_pCurrentDoc = pNewDoc;
	context.m_pCurrentFrame = NULL;
	
	CChildFrame*	pNewFrame = new CChildFrame;
	
	LockMyWindowUpdate( );
	if(GetActiveFrame() != this)
		GetActiveFrame()->SendMessage(WM_CLOSE, NULL, NULL);
	pNewFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW ,   // default frame styles
		NULL, &context);
	pNewFrame->InitialUpdateFrame(pNewDoc, true);
	MDITile();
	UnlockMyWindowUpdate();
}

void CMainFrame::OnMenuitemShotparaselect() 
{
	if(m_cstrProjectPath.IsEmpty())
		return;
	
/*	if(GetActiveFrame() != this)
	{
		CChildFrame *pChild = (CChildFrame *)GetActiveFrame();
		CRuntimeClass* pNewViewClass;
		if(m_structWellInfo.bWellState == TRUE)
			pNewViewClass = RUNTIME_CLASS(COilShotParaSelectView);
		else
			pNewViewClass = RUNTIME_CLASS(CGasShotParaSelectView);
		
		CView* pOldActiveView = pChild->GetActiveView();
		CCreateContext context;
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = GetActiveDocument();
		//	context.m_pCurrentFrame = pChild;
		CView* pNewView = STATIC_DOWNCAST(CView, pChild->CreateView(&context));
		if (pNewView != NULL)
		{
			// the new view is there, but invisible and not active...
			pNewView->ShowWindow(SW_SHOW);
			pNewView->OnInitialUpdate();
			pChild->SetActiveView(pNewView);
			pChild->RecalcLayout();
			
			// finally destroy the old view...
			pOldActiveView->DestroyWindow();
		}
	}
	else
	{
		CCVenusDoc*	pNewDoc	= new CCVenusDoc;
		
		CRuntimeClass* pNewViewClass;
		if(m_structWellInfo.bWellState == TRUE)
			pNewViewClass = RUNTIME_CLASS(COilShotParaSelectView);
		else
			pNewViewClass = RUNTIME_CLASS(CGasShotParaSelectView);
		CCreateContext context;
		
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = pNewDoc;
		context.m_pCurrentFrame = NULL;
		
		CChildFrame*	pNewFrame = new CChildFrame;
		
		pNewFrame->LoadFrame(IDR_MAINFRAME,
			WS_OVERLAPPEDWINDOW ,   // default frame styles
			NULL, &context);
		pNewFrame->InitialUpdateFrame(pNewDoc, true);
	}
*/
	CCVenusDoc*	pNewDoc	= new CCVenusDoc;
	
	CRuntimeClass* pNewViewClass;
	if(m_structWellInfo.bWellState == TRUE)
		pNewViewClass = RUNTIME_CLASS(COilShotParaSelectView);
	else
		pNewViewClass = RUNTIME_CLASS(CGasShotParaSelectView);
	CCreateContext context;
	
	context.m_pNewViewClass = pNewViewClass;
	context.m_pCurrentDoc = pNewDoc;
	context.m_pCurrentFrame = NULL;
	
	CChildFrame*	pNewFrame = new CChildFrame;
	
	LockMyWindowUpdate( );
	if(GetActiveFrame() != this)
		GetActiveFrame()->SendMessage(WM_CLOSE, NULL, NULL);
	pNewFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW ,   // default frame styles
		NULL, &context);
	pNewFrame->InitialUpdateFrame(pNewDoc, true);
	MDITile();
	UnlockMyWindowUpdate();
	
	m_picState = PicNone;
	
}

void CMainFrame::OnMenuitemShotforecast() 
{
	if(m_cstrProjectPath.IsEmpty())
		return;
	
/*	if(GetActiveFrame() != this)
	{
		CChildFrame *pChild = (CChildFrame *)GetActiveFrame();
		CRuntimeClass* pNewViewClass;
		if(m_structWellInfo.bWellState == TRUE)
			pNewViewClass = RUNTIME_CLASS(COilShotForecastView);
		else
			pNewViewClass = RUNTIME_CLASS(CGasShotForecastView);
		
		CView* pOldActiveView = pChild->GetActiveView();
		CCreateContext context;
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = GetActiveDocument();
		//	context.m_pCurrentFrame = pChild;
		CView* pNewView = STATIC_DOWNCAST(CView, pChild->CreateView(&context));
		if (pNewView != NULL)
		{
			// the new view is there, but invisible and not active...
			pNewView->ShowWindow(SW_SHOW);
			pNewView->OnInitialUpdate();
			pChild->SetActiveView(pNewView);
			pChild->RecalcLayout();
			
			// finally destroy the old view...
			pOldActiveView->DestroyWindow();
		}
	}
	else
	{
		CCVenusDoc*	pNewDoc	= new CCVenusDoc;
		
		CRuntimeClass* pNewViewClass;
		if(m_structWellInfo.bWellState == TRUE)
			pNewViewClass = RUNTIME_CLASS(COilShotForecastView);
		else
			pNewViewClass = RUNTIME_CLASS(CGasShotForecastView);
		CCreateContext context;
		
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = pNewDoc;
		context.m_pCurrentFrame = NULL;
		
		CChildFrame*	pNewFrame = new CChildFrame;
		
		pNewFrame->LoadFrame(IDR_MAINFRAME,
			WS_OVERLAPPEDWINDOW ,   // default frame styles
			NULL, &context);
		pNewFrame->InitialUpdateFrame(pNewDoc, true);
	}
*/
	CCVenusDoc*	pNewDoc	= new CCVenusDoc;
	
	CRuntimeClass* pNewViewClass;
	if(m_structWellInfo.bWellState == TRUE)
		pNewViewClass = RUNTIME_CLASS(COilShotForecastView);
	else
		pNewViewClass = RUNTIME_CLASS(CGasShotForecastView);
	
	CCreateContext context;
	context.m_pNewViewClass = pNewViewClass;
	context.m_pCurrentDoc = pNewDoc;
	context.m_pCurrentFrame = NULL;
	
	CChildFrame*	pNewFrame = new CChildFrame;
	
	LockMyWindowUpdate( );
	if(GetActiveFrame() != this)
		GetActiveFrame()->SendMessage(WM_CLOSE, NULL, NULL);
	pNewFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW ,   // default frame styles
		NULL, &context);
	pNewFrame->InitialUpdateFrame(pNewDoc, true);
	MDITile();
	UnlockMyWindowUpdate();

	m_picState = PicNone;
	
}

void CMainFrame::OnMenuitemSanddesign() 
{
	if(m_cstrProjectPath.IsEmpty())
		return;
	if(m_structBDTTable.fStratumFilterPercent == 0)
	{
		MessageBox("请先输入地层渗透率 !","工程信息");
		return;
	}
	if(!m_structTTPTable.bState)
	{
		MessageBox("请先进行射孔参数的校正 !","工程信息");
		return;
	}

/*	if(GetActiveFrame() != this)
	{
		CChildFrame *pChild = (CChildFrame *)GetActiveFrame();
		CRuntimeClass* pNewViewClass;
		if(m_structWellInfo.bWellState)
			pNewViewClass = RUNTIME_CLASS(COilSandDesign);
		else
			pNewViewClass = RUNTIME_CLASS(CGasSandDesign);
		
		CView* pOldActiveView = pChild->GetActiveView();
		CCreateContext context;
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = GetActiveDocument();
		//	context.m_pCurrentFrame = pChild;
		CView* pNewView = STATIC_DOWNCAST(CView, pChild->CreateView(&context));
		if (pNewView != NULL)
		{
			// the new view is there, but invisible and not active...
			pNewView->ShowWindow(SW_SHOW);
			pNewView->OnInitialUpdate();
			pChild->SetActiveView(pNewView);
			pChild->RecalcLayout();
			
			// finally destroy the old view...
			pOldActiveView->DestroyWindow();
		}
	}
	else
	{
		CCVenusDoc*	pNewDoc	= new CCVenusDoc;
		
		CRuntimeClass* pNewViewClass;
		if(m_structWellInfo.bWellState)
			pNewViewClass = RUNTIME_CLASS(COilSandDesign);
		else
			pNewViewClass = RUNTIME_CLASS(CGasSandDesign);
		CCreateContext context;
		
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = pNewDoc;
		context.m_pCurrentFrame = NULL;
		
		CChildFrame*	pNewFrame = new CChildFrame;
		
		pNewFrame->LoadFrame(IDR_MAINFRAME,
			WS_OVERLAPPEDWINDOW ,   // default frame styles
			NULL, &context);
		pNewFrame->InitialUpdateFrame(pNewDoc, true);
	}
*/	
	CCVenusDoc*	pNewDoc	= new CCVenusDoc;
	
	CRuntimeClass* pNewViewClass;
	if(m_structWellInfo.bWellState)
		pNewViewClass = RUNTIME_CLASS(COilSandDesign);
	else
		pNewViewClass = RUNTIME_CLASS(CGasSandDesign);
	
	CCreateContext context;
	context.m_pNewViewClass = pNewViewClass;
	context.m_pCurrentDoc = pNewDoc;
	context.m_pCurrentFrame = NULL;
	
	CChildFrame*	pNewFrame = new CChildFrame;
	
	LockMyWindowUpdate( );
	if(GetActiveFrame() != this)
		GetActiveFrame()->SendMessage(WM_CLOSE, NULL, NULL);
	pNewFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW ,   // default frame styles
		NULL, &context);
	pNewFrame->InitialUpdateFrame(pNewDoc, true);
	MDITile();
	UnlockMyWindowUpdate();

}

void CMainFrame::OnMenuitem33798() 
{
	if(m_cstrProjectPath.IsEmpty())
		return;
	
/*	if(GetActiveFrame() != this)
	{
		CChildFrame *pChild = (CChildFrame *)GetActiveFrame();
		CRuntimeClass* pNewViewClass;
		if(m_structWellInfo.bWellState == TRUE)
			pNewViewClass = RUNTIME_CLASS(COilMinusPressView);
		else
			pNewViewClass = RUNTIME_CLASS(CGasMinusPressView);

		
		CView* pOldActiveView = pChild->GetActiveView();
		CCreateContext context;
		context.m_pNewViewClass = pNewViewClass;
		context.m_pCurrentDoc = GetActiveDocument();
		//	context.m_pCurrentFrame = pChild;
		CView* pNewView = STATIC_DOWNCAST(CView, pChild->CreateView(&context));
		if (pNewView != NULL)
		{
			// the new view is there, but invisible and not active...
			pNewView->ShowWindow(SW_SHOW);
			pNewView->OnInitialUpdate();
			pChild->SetActiveView(pNewView);
			pChild->RecalcLayout();
			
			// finally destroy the old view...
			pOldActiveView->DestroyWindow();
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -