// MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "leadvector.h" #include "vecView.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainFrame static UINT IndicatorIDs [] = { ID_SEPARATOR, ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_ERASEBKGND() ON_WM_SETFOCUS() ON_WM_SIZE() ON_WM_CREATE() ON_WM_SYSCOLORCHANGE() ON_WM_PALETTEISCHANGING() ON_WM_PALETTECHANGED() ON_WM_QUERYNEWPALETTE() ON_WM_DROPFILES() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { // TODO: add member initialization code here } CMainFrame::~CMainFrame() { } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CFrameWnd::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers BOOL CMainFrame::OnEraseBkgnd(CDC* pDC) { return CFrameWnd::OnEraseBkgnd(pDC); } void CMainFrame::OnSetFocus(CWnd* pOldWnd) { // CFrameWnd::OnSetFocus(pOldWnd); } void CMainFrame::OnSize(UINT nType, int cx, int cy) { CFrameWnd::OnSize(nType, cx, cy); /* CView *pView=GetActiveView(); if(pView && ::IsWindow(pView->m_hWnd)) { CRect rcClient; GetClientRect(&rcClient); pView->MoveWindow(&rcClient); } */ } void CMainFrame::UpdateStatusBar(double x , double y) { static iCount = 0; char szLoc[256]; { sprintf(szLoc, "%Lf, %Lf", x, y ); m_StatusBar.SetPaneText(0, szLoc, TRUE); } } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here if (!m_StatusBar.Create (this) || !m_StatusBar.SetIndicators (IndicatorIDs, sizeof (IndicatorIDs) / sizeof (UINT))) return -1; return 0; } void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) { CFrameWnd::OnPaletteChanged(pFocusWnd); SendMessageToDescendants(WM_DOREALIZE, (WPARAM)pFocusWnd->m_hWnd, (LPARAM) TRUE); } BOOL CMainFrame::OnQueryNewPalette() { CView* pView = GetActiveView(); if( !pView ) return FALSE; return((BOOL) pView->SendMessage(WM_DOREALIZE, (WPARAM)m_hWnd, (LPARAM) FALSE)); } void CMainFrame::OnSysColorChange() { OnQueryNewPalette(); } void CMainFrame::OnPaletteIsChanging(CWnd* pRealizeWnd) { OnPaletteChanged(pRealizeWnd); } void CMainFrame::OnDropFiles(HDROP hDropInfo) { // TODO: Add your message handler code here and/or call default char szFilePath[255]; int nCount; int i; CVectorView *pView = NULL; pView = ( (CVectorView*) GetActiveView() ); nCount = DragQueryFile(hDropInfo, 0xFFFFFFFF, NULL, 0); for(i=0; i< nCount; i++) { DragQueryFile(hDropInfo, i, szFilePath, 255); pView->OpenDroppedFile (szFilePath); } CFrameWnd::OnDropFiles(hDropInfo); }