// MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "PEffect.h" #include "MainFrm.h" #include "PEffDoc.h" #include "PEView.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_CREATE() ON_WM_QUERYNEWPALETTE() ON_WM_PALETTECHANGED() ON_WM_SYSCOLORCHANGE() ON_WM_PALETTEISCHANGING() //}}AFX_MSG_MAP END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { LBase::SetErrorListDepth(20); LBase::LoadLibraries(LT_ALL_LEADLIB); LDialogBase::Initialize(0); WRPUNLOCKSUPPORT(); LBase::SetErrorListDepth(25); } CMainFrame::~CMainFrame() { LDialogBase::Free(); LBase::UnloadLibraries(LT_ALL_LEADLIB); } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // be dockable return 0; } 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.style = WS_OVERLAPPEDWINDOW | WS_CAPTION; cs.lpszName = _T("LEAD Class Library Sample Application Win32"); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) { CPEView * pCView; CFrameWnd::OnPaletteChanged(pFocusWnd); pCView = ( CPEView* ) GetActiveView(); if(pCView) pCView->m_LBitmapWnd.HandlePalette(WM_PALETTECHANGED,(WPARAM)pFocusWnd->m_hWnd, 0); return; } BOOL CMainFrame::OnQueryNewPalette() { // TODO: Add your message handler code here and/or call default CPEView * pCView; pCView = ( CPEView* ) GetActiveView(); if(pCView) pCView->m_LBitmapWnd.HandlePalette(WM_QUERYNEWPALETTE, 0, 0); return CFrameWnd::OnQueryNewPalette(); } void CMainFrame::OnSysColorChange() { OnQueryNewPalette(); } void CMainFrame::OnPaletteIsChanging(CWnd* pRealizeWnd) { OnPaletteChanged (GetActiveView()); }