📄 htacballview.cpp
字号:
// HtacBallView.cpp : implementation of the CHtacBallView class
//
#include "stdafx.h"
#include "HtacBall.h"
#include "HtacBallDoc.h"
#include "CntrItem.h"
#include "HtacBallView.h"
#include "Heat.h"
#include "Gas.h"
#include "Regenator.h"
#include "Nowel.h"
#include "Heatbalance.h"
#include "Regeadjust.h"
#include "Burner.h"
#include "Conclusion.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CHtacBallView
IMPLEMENT_DYNCREATE(CHtacBallView, CScrollView)
BEGIN_MESSAGE_MAP(CHtacBallView, CScrollView)
//{{AFX_MSG_MAP(CHtacBallView)
ON_WM_DESTROY()
ON_WM_SETFOCUS()
ON_WM_SIZE()
ON_COMMAND(ID_OLE_INSERT_NEW, OnInsertObject)
ON_COMMAND(ID_CANCEL_EDIT_CNTR, OnCancelEditCntr)
//ON_COMMAND(ID_DESIGN_GAS, OnDesignGas)
//ON_COMMAND(ID_DESIGN_REGE, OnDesignRege)
//ON_COMMAND(ID_ADJUST_BURNER, OnAdjustBurner)
//ON_COMMAND(ID_ADJUST_REGE, OnAdjustRege)
//ON_COMMAND(ID_ADJUST_NOWEL, OnAdjustNowel)
//ON_COMMAND(ID_ADJUST_HEATBAL, OnAdjustHeatbal)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHtacBallView construction/destruction
CHtacBallView::CHtacBallView()
{
m_pSelection = NULL;
// TODO: add construction code here
}
CHtacBallView::~CHtacBallView()
{
}
BOOL CHtacBallView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CHtacBallView drawing
void CHtacBallView::OnDraw(CDC* pDC)
{
CHtacBallDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//CString str=pDoc->m_gas_str[0];
pDC->TextOut(0,0,pDoc->m_welcome_str[0]);
pDC->TextOut(0,20,pDoc->m_welcome_str[1]);
pDC->TextOut(0,40,pDoc->m_welcome_str[2]);
pDC->TextOut(0,60,pDoc->m_welcome_str[3]);
pDC->TextOut(0,80,pDoc->m_welcome_str[4]);
pDC->TextOut(0,100,pDoc->m_welcome_str[5]);
pDC->TextOut(0,0,pDoc->m_gas_str[0]);
pDC->TextOut(0,20,pDoc->m_gas_str[1]);
pDC->TextOut(0,40,pDoc->m_gas_str[2]);
pDC->TextOut(0,60,pDoc->m_gas_str[3]);
pDC->TextOut(0,80,pDoc->m_gas_str[4]);
pDC->TextOut(0,0,pDoc->m_burner_str[0]);
pDC->TextOut(0,20,pDoc->m_burner_str[1]);
pDC->TextOut(0,0,pDoc->m_nowel_str[0]);
pDC->TextOut(0,20,pDoc->m_nowel_str[1]);
pDC->TextOut(0,0,pDoc->m_heatbalance_str[0]);
pDC->TextOut(0,20,pDoc->m_heatbalance_str[1]);
pDC->TextOut(0,0,pDoc->m_regeadjust_str[0]);
pDC->TextOut(0,20,pDoc->m_regeadjust_str[1]);
pDC->TextOut(0,40,pDoc->m_regeadjust_str[2]);
pDC->TextOut(0,0,pDoc->m_regenator_str[0]);
pDC->TextOut(0,20,pDoc->m_regenator_str[1]);
pDC->TextOut(0,40,pDoc->m_regenator_str[2]);
pDC->TextOut(0,60,pDoc->m_regenator_str[3]);
pDC->TextOut(0,80,pDoc->m_regenator_str[4]);
pDC->TextOut(0,100,pDoc->m_regenator_str[5]);
pDC->TextOut(0,120,pDoc->m_regenator_str[6]);
pDC->TextOut(0,140,pDoc->m_regenator_str[7]);
pDC->TextOut(0,160,pDoc->m_regenator_str[8]);
// TODO: add draw code for native data here
// TODO: also draw all OLE items in the document
// Draw the selection at an arbitrary position. This code should be
// removed once your real drawing code is implemented. This position
// corresponds exactly to the rectangle returned by CHtacBallCntrItem,
// to give the effect of in-place editing.
// TODO: remove this code when final draw code is complete.
if (m_pSelection == NULL)
{
POSITION pos = pDoc->GetStartPosition();
m_pSelection = (CHtacBallCntrItem*)pDoc->GetNextClientItem(pos);
}
if (m_pSelection != NULL)
m_pSelection->Draw(pDC, CRect(10, 10, 210, 210));
}
void CHtacBallView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
// TODO: remove this code when final selection model code is written
m_pSelection = NULL; // initialize selection
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}
/////////////////////////////////////////////////////////////////////////////
// CHtacBallView printing
BOOL CHtacBallView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CHtacBallView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CHtacBallView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
void CHtacBallView::OnDestroy()
{
// Deactivate the item on destruction; this is important
// when a splitter view is being used.
CScrollView::OnDestroy();
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
{
pActiveItem->Deactivate();
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
}
/////////////////////////////////////////////////////////////////////////////
// OLE Client support and commands
BOOL CHtacBallView::IsSelected(const CObject* pDocItem) const
{
// The implementation below is adequate if your selection consists of
// only CHtacBallCntrItem objects. To handle different selection
// mechanisms, the implementation here should be replaced.
// TODO: implement this function that tests for a selected OLE client item
return pDocItem == m_pSelection;
}
void CHtacBallView::OnInsertObject()
{
// Invoke the standard Insert Object dialog box to obtain information
// for new CHtacBallCntrItem object.
COleInsertDialog dlg;
if (dlg.DoModal() != IDOK)
return;
BeginWaitCursor();
CHtacBallCntrItem* pItem = NULL;
TRY
{
// Create new item connected to this document.
CHtacBallDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pItem = new CHtacBallCntrItem(pDoc);
ASSERT_VALID(pItem);
// Initialize the item from the dialog data.
if (!dlg.CreateItem(pItem))
AfxThrowMemoryException(); // any exception will do
ASSERT_VALID(pItem);
if (dlg.GetSelectionType() == COleInsertDialog::createNewItem)
pItem->DoVerb(OLEIVERB_SHOW, this);
ASSERT_VALID(pItem);
// As an arbitrary user interface design, this sets the selection
// to the last item inserted.
// TODO: reimplement selection as appropriate for your application
m_pSelection = pItem; // set selection to last inserted item
pDoc->UpdateAllViews(NULL);
}
CATCH(CException, e)
{
if (pItem != NULL)
{
ASSERT_VALID(pItem);
pItem->Delete();
}
AfxMessageBox(IDP_FAILED_TO_CREATE);
}
END_CATCH
EndWaitCursor();
}
// The following command handler provides the standard keyboard
// user interface to cancel an in-place editing session. Here,
// the container (not the server) causes the deactivation.
void CHtacBallView::OnCancelEditCntr()
{
// Close any in-place active item on this view.
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL)
{
pActiveItem->Close();
}
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
// Special handling of OnSetFocus and OnSize are required for a container
// when an object is being edited in-place.
void CHtacBallView::OnSetFocus(CWnd* pOldWnd)
{
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL &&
pActiveItem->GetItemState() == COleClientItem::activeUIState)
{
// need to set focus to this item if it is in the same view
CWnd* pWnd = pActiveItem->GetInPlaceWindow();
if (pWnd != NULL)
{
pWnd->SetFocus(); // don't call the base class
return;
}
}
CScrollView::OnSetFocus(pOldWnd);
}
void CHtacBallView::OnSize(UINT nType, int cx, int cy)
{
CScrollView::OnSize(nType, cx, cy);
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL)
pActiveItem->SetItemRects();
}
/////////////////////////////////////////////////////////////////////////////
// CHtacBallView diagnostics
#ifdef _DEBUG
void CHtacBallView::AssertValid() const
{
CScrollView::AssertValid();
}
void CHtacBallView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CHtacBallDoc* CHtacBallView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHtacBallDoc)));
return (CHtacBallDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CHtacBallView message handlers
/*void CHtacBallView::OnDesignGas()
{
CGas m_gas;
m_gas.DoModal();
}
void CHtacBallView::OnDesignRege()
{
CRegenator m_rege;
m_rege.DoModal();
}
void CHtacBallView::OnAdjustBurner()
{
CBurner m_burner;
m_burner.DoModal();
}
void CHtacBallView::OnAdjustRege()
{//蓄热室校核
CRegeadjust m_regea;
m_regea.DoModal();
}
void CHtacBallView::OnAdjustNowel()
{
CNowel m_nowel;
m_nowel.DoModal();
}
void CHtacBallView::OnAdjustHeatbal()
{
CHeatbalance m_bal;
m_bal.DoModal();
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -