// ValueView.cpp : implementation file // #include "stdafx.h" #include "ValueView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CValueView IMPLEMENT_DYNCREATE(CValueView, CView) CValueView::CValueView() { displayMemory = new CDC; windowActive = False; } CValueView::~CValueView() { delete displayMemory; } BEGIN_MESSAGE_MAP(CValueView, CView) //{{AFX_MSG_MAP(CValueView) ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CValueView drawing void CValueView::OnDraw(CDC* pDC) { CRect client_rect; GetClientRect(client_rect); CBitmap *old_bitmap; old_bitmap = displayMemory->SelectObject(myParent->screenBitmap); pDC->BitBlt(0,0,client_rect.right,client_rect.bottom, displayMemory, myParent->valueSize.left, myParent->valueSize.top, SRCCOPY); displayMemory->SelectObject(old_bitmap); } ///////////////////////////////////////////////////////////////////////////// // CValueView diagnostics #ifdef _DEBUG void CValueView::AssertValid() const { CView::AssertValid(); } void CValueView::Dump(CDumpContext& dc) const { CView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CValueView message handlers void CValueView::OnInitialUpdate() { CView::OnInitialUpdate(); windowActive = True; CClientDC client_dc(this); if(displayMemory->GetSafeHdc() == NULL) { displayMemory->CreateCompatibleDC(&client_dc); } myParent->SaveSize(); myParent->Draw(this); } void CValueView::OnSize(UINT nType, int cx, int cy) { //afxDump << "CValueView::OnSize" << endl; CView::OnSize(nType, cx, cy); // TODO: Add your message handler code here if (windowActive) { myParent->SaveSize(); myParent->Draw(this); } } void CValueView::Render(CRect placement) { MY_RGB color; color.red = 255; color.blue = 255; color.green = 255; myParent->DrawCRect( placement,color); if(windowActive) { int place_to_draw = myParent->borderSize + myParent->nameSize.top; //Get starting trace as defined by the vert scroll bar in Logic View int start = myParent->logicView->GetScrollPos(SB_VERT); for (int i = start; i < myParent->traceCount; ++i) { //TRACE("%d\n", place_to_draw); TraceLine *trace_line; trace_line = (TraceLine *)myParent->traceListArray->GetAt(i); trace_line->DrawCurrentValue( place_to_draw, myParent->timeView->refrenceLineTime); place_to_draw += trace_line->CalculateSize(); place_to_draw += myParent->borderSize; } } }