// MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "offset.h" #include "MainFrm.h" #include "OfstView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_QUERYNEWPALETTE() ON_WM_PALETTECHANGED() ON_WM_SYSCOLORCHANGE() ON_WM_PALETTEISCHANGING() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { LBase::LoadLibraries ( LT_KRN | LT_DIS | LT_FIL | LT_IMG ); WRPUNLOCKSUPPORT(); } CMainFrame::~CMainFrame() { LBase::UnloadLibraries ( LT_KRN | LT_DIS | LT_FIL | LT_IMG ); } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.hMenu=NULL; cs.style = WS_OVERLAPPEDWINDOW | WS_CAPTION; cs.lpszName = _T("LEAD Class Library Sample Application Win32"); ////////////////////START-RESIZE//////////////////////////////////////// CString m_strSrcFile; LFile LeadFile; FILEINFO FileInfo; COffsetApp* CApplication = (COffsetApp*) AfxGetApp(); L_INT nPos; L_INT nLength; CString m_strFileName; RECT rcClientRect; // client rectangle m_strFileName = CApplication->m_strFileName; nPos = m_strFileName.Find(' '); nLength = m_strFileName.GetLength(); m_strSrcFile = m_strFileName.Left(nPos); LeadFile.SetFileName( m_strSrcFile.GetBuffer( CApplication->m_strFileName.GetLength() ) ); m_strSrcFile.ReleaseBuffer(); FileInfo.uStructSize = sizeof(FILEINFO); LeadFile.GetInfo( &FileInfo , sizeof(FILEINFO)); SetRect(&rcClientRect,0,0,FileInfo.Width,FileInfo.Height); AdjustWindowRect(&rcClientRect,WS_OVERLAPPEDWINDOW,FALSE); cs.x=0; cs.y=0; cs.cx=rcClientRect.right - rcClientRect.left; cs.cy=rcClientRect.bottom - rcClientRect.top ; ////////////////END-RESIZE//////////////////////////////////////// return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) { CFrameWnd::OnPaletteChanged(pFocusWnd); // TODO: Add your message handler code here COffsetView* pCView = ( COffsetView* ) GetActiveView(); if(pCView) pCView->HandlePalette(WM_PALETTECHANGED,pFocusWnd->m_hWnd); } BOOL CMainFrame::OnQueryNewPalette() { // TODO: Add your message handler code here and/or call default COffsetView* pCView = ( COffsetView* ) GetActiveView(); if(pCView) pCView->HandlePalette(WM_QUERYNEWPALETTE,pCView->m_hWnd); return CFrameWnd::OnQueryNewPalette(); } void CMainFrame::OnSysColorChange() { OnQueryNewPalette(); } void CMainFrame::OnPaletteIsChanging(CWnd* pRealizeWnd) { OnPaletteChanged (pRealizeWnd); }