home *** CD-ROM | disk | FTP | other *** search
- // vcsamvw.cpp : implementation of the CVcsamp1View class
- //
-
- #include "stdafx.h"
- #include "vcsamp1.h"
-
- #include "schedvbx.h"
-
- #include "vcsamdoc.h"
- #include "vcsamvw.h"
-
- #include "scheddlg.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcsamp1View
-
- IMPLEMENT_DYNCREATE(CVcsamp1View, CView)
-
- BEGIN_MESSAGE_MAP(CVcsamp1View, CView)
- //{{AFX_MSG_MAP(CVcsamp1View)
- ON_COMMAND(IDM_DIALOG, OnDialog)
- ON_WM_SIZE()
- ON_COMMAND(IDM_RESOURCEVIEW, OnResourceview)
- ON_COMMAND(IDM_YEARLYVIEW, OnYearlyview)
- ON_COMMAND(IDM_MONTHLYVIEW, OnMonthlyview)
- ON_COMMAND(IDM_WEEKLYVIEW, OnWeeklyview)
- ON_COMMAND(IDM_DAILYVIEW, OnDailyview)
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcsamp1View construction/destruction
-
- CVcsamp1View::CVcsamp1View()
- {
- m_SchedVBX = NULL;
- }
-
- CVcsamp1View::~CVcsamp1View()
- {
- if (m_SchedVBX)
- delete m_SchedVBX;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcsamp1View drawing
-
- void CVcsamp1View::OnDraw(CDC* pDC)
- {
- CVcsamp1Doc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcsamp1View printing
-
- BOOL CVcsamp1View::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
-
- void CVcsamp1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
-
- void CVcsamp1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcsamp1View diagnostics
-
- #ifdef _DEBUG
- void CVcsamp1View::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CVcsamp1View::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CVcsamp1Doc* CVcsamp1View::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVcsamp1Doc)));
- return (CVcsamp1Doc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcsamp1View message handlers
-
- void CVcsamp1View::OnDialog()
- {
- SchedDlg dlg;
-
- dlg.DoModal();
-
- }
-
- void CVcsamp1View::OnInitialUpdate()
- {
- if (m_SchedVBX) return;
-
- m_SchedVBX = new CScheduleVBX();
-
- CRect rect;
-
- GetClientRect(&rect);
-
- m_SchedVBX->Create(WS_CHILD, rect, this, 100);
-
- m_SchedVBX->SetTSDateTimeBeg(0, "1/1/95");
- m_SchedVBX->SetTSDateTimeEnd(0, "1/1/96");
- m_SchedVBX->SetTSDateTimeView(0, "1/12/95 8:00AM");
-
- m_SchedVBX->SetResLoad("RESOURCE.TXT");
- m_SchedVBX->SetTBLoad("TIMEBLKS.TXT");
-
- m_SchedVBX->SetFocus();
- }
-
- void CVcsamp1View::OnSize(UINT nType, int cx, int cy)
- {
- CView::OnSize(nType, cx, cy);
-
- if (m_SchedVBX)
- m_SchedVBX->MoveWindow(0,0,cx,cy,TRUE);
- }
-
- void CVcsamp1View::OnResourceview()
- {
- if (m_SchedVBX) {
- m_SchedVBX->SetRedraw(FALSE);
- // set minor TS to days
- m_SchedVBX->SetTSMinor(0, CScheduleVBX::TS_Days);
- m_SchedVBX->SetDisplayMode(CScheduleVBX::DisplayMode_Resource);
- m_SchedVBX->SetRedraw(TRUE);
- }
- }
-
- void CVcsamp1View::OnYearlyview()
- {
- if (m_SchedVBX) {
- m_SchedVBX->SetRedraw(FALSE);
- // set minor TS to years - so its out of the way
- // we want to use defaults for this view
- m_SchedVBX->SetTSMinor(0, CScheduleVBX::TS_Years);
- m_SchedVBX->SetDisplayMode(CScheduleVBX::DisplayMode_YearlyHorz);
- m_SchedVBX->SetRedraw(TRUE);
- }
- }
-
- void CVcsamp1View::OnMonthlyview()
- {
- if (m_SchedVBX) {
- m_SchedVBX->SetRedraw(FALSE);
- // set minor TS to years - so its out of the way
- // we want to use defaults for this view
- m_SchedVBX->SetTSMinor(0, CScheduleVBX::TS_Years);
- m_SchedVBX->SetDisplayMode(CScheduleVBX::DisplayMode_MonthlyHorz);
- m_SchedVBX->SetRedraw(TRUE);
- }
- }
-
- void CVcsamp1View::OnWeeklyview()
- {
- if (m_SchedVBX) {
- m_SchedVBX->SetRedraw(FALSE);
- // set minor TS to years - so its out of the way
- // we want to use defaults for this view
- m_SchedVBX->SetTSMinor(0, CScheduleVBX::TS_Years);
- m_SchedVBX->SetDisplayMode(CScheduleVBX::DisplayMode_WeeklyVert);
- m_SchedVBX->SetRedraw(TRUE);
- }
- }
-
- void CVcsamp1View::OnDailyview()
- {
- if (m_SchedVBX) {
- m_SchedVBX->SetRedraw(FALSE);
- // set minor TS to years - so its out of the way
- // we want to use defaults for this view
- m_SchedVBX->SetTSMinor(0, CScheduleVBX::TS_Years);
- m_SchedVBX->SetDisplayMode(CScheduleVBX::DisplayMode_DailyVert);
- m_SchedVBX->SetRedraw(TRUE);
- }
- }
-