home *** CD-ROM | disk | FTP | other *** search
- // ftpView.cpp : implementation of the CFtpView class
- //
-
- #include "stdafx.h"
- #include "ftp.h"
-
- #include "ftpDoc.h"
- #include "ftpView.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CFtpView
-
- IMPLEMENT_DYNCREATE(CFtpView, CScrollView)
-
- BEGIN_MESSAGE_MAP(CFtpView, CScrollView)
- //{{AFX_MSG_MAP(CFtpView)
- ON_COMMAND(ID_FILE_FTP_TRANSFER, OnFileFtpTransfer)
- //}}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()
-
- /////////////////////////////////////////////////////////////////////////////
- // CFtpView construction/destruction
-
- CFtpView::CFtpView()
- {
- // TODO: add construction code here
-
- }
-
- CFtpView::~CFtpView()
- {
- m_strings.RemoveAll();
- }
-
- BOOL CFtpView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CScrollView::PreCreateWindow(cs);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CFtpView drawing
-
- void CFtpView::OnDraw(CDC* pDC)
- {
- CFtpDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
-
- CSize sizeTotal;
- sizeTotal.cx = 100;
- TEXTMETRIC tm;
- pDC->GetTextMetrics(&tm);
- sizeTotal.cy = tm.tmHeight*m_strings.GetSize();
- SetScrollSizes(MM_TEXT, sizeTotal);
-
- for (int idx=0; idx<m_strings.GetSize(); idx++) {
- CString str;
- str.Format("%s", m_strings.GetAt(idx));
- pDC->TabbedTextOut(0,idx*tm.tmHeight,str,0,NULL,0);
- }
-
- }
- void CFtpView::OnInitialUpdate()
- {
- CScrollView::OnInitialUpdate();
- CSize sizeTotal;
- // TODO: calculate the total size of this view
- sizeTotal.cx = sizeTotal.cy = 100;
- SetScrollSizes(MM_TEXT, sizeTotal);
- AddToView("Select File, then FTP Transfer to begin.");
- }
- void CFtpView::AddToView(LPCTSTR string)
- {
- m_strings.Add(string);
-
- Invalidate();
- // Force an immediate update.
- UpdateWindow();
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CFtpView printing
-
- BOOL CFtpView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
-
- void CFtpView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
-
- void CFtpView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CFtpView diagnostics
-
- #ifdef _DEBUG
- void CFtpView::AssertValid() const
- {
- CScrollView::AssertValid();
- }
-
- void CFtpView::Dump(CDumpContext& dc) const
- {
- CScrollView::Dump(dc);
- }
-
- CFtpDoc* CFtpView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFtpDoc)));
- return (CFtpDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CFtpView message handlers
- void CFtpView::OnViewClear()
- {
- // TODO: Add your command handler code here
- m_strings.RemoveAll();
-
- Invalidate();
- // Force an immediate update.
- UpdateWindow();
-
- }
-
- void CFtpView::OnFileFtpTransfer()
- {
- OnViewClear(); // Clear the screen.
-
-
- }
-
-