// docexampView.cpp : implementation of the CDocexampView class // #include "stdafx.h" #include "docexamp.h" #include "docexampDoc.h" #include "docexampView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #include "DriverNameDlg.h" #include "DriverNumDlg.h" ///////////////////////////////////////////////////////////////////////////// // CDocexampView IMPLEMENT_DYNCREATE(CDocexampView, CView) BEGIN_MESSAGE_MAP(CDocexampView, CView) //{{AFX_MSG_MAP(CDocexampView) ON_COMMAND(ID_ENTER_DRIVER, OnEnterDriver) //}}AFX_MSG_MAP // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDocexampView construction/destruction CDocexampView::CDocexampView() { // TODO: add construction code here } CDocexampView::~CDocexampView() { } BOOL CDocexampView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CDocexampView drawing void CDocexampView::OnDraw(CDC* pDC) { CDocexampDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here } ///////////////////////////////////////////////////////////////////////////// // CDocexampView printing BOOL CDocexampView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CDocexampView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add extra initialization before printing } void CDocexampView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CDocexampView diagnostics #ifdef _DEBUG void CDocexampView::AssertValid() const { CView::AssertValid(); } void CDocexampView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CDocexampDoc* CDocexampView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDocexampDoc))); return (CDocexampDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CDocexampView message handlers void CDocexampView::OnEnterDriver() { CDriverNumDlg onenumber; onenumber.m_DriverNumber=1; if(onenumber.DoModal()==IDOK){ CDocexampDoc* pDoc; pDoc=GetDocument(); CDriverNameDlg onename; onename.m_DriverName=pDoc->Trucks[onenumber.m_DriverNumber-1].GetDriver(); if(onename.DoModal()==IDOK){ pDoc->Trucks[onenumber.m_DriverNumber-1].SetDriver(onename.m_DriverName); } } }