root / trunk / win / Pieceprv.cpp

Revision 673, 1.6 kB (checked in by leo, 19 months ago)

Updated support for new object classes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1// PiecePrv.cpp : implementation file
2//
3
4#include "lc_global.h"
5#include "leocad.h"
6#include "PiecePrv.h"
7#include "Tools.h"
8#include "pieceinf.h"
9#include "globals.h"
10#include "project.h"
11#include "preview.h"
12#include "lc_application.h"
13
14#ifdef _DEBUG
15#define new DEBUG_NEW
16#undef THIS_FILE
17static char THIS_FILE[] = __FILE__;
18#endif
19
20/////////////////////////////////////////////////////////////////////////////
21// CPiecePreview
22
23CPiecePreview::CPiecePreview()
24{
25    m_Preview = NULL;
26}
27
28CPiecePreview::~CPiecePreview()
29{
30    delete m_Preview;
31}
32
33
34BEGIN_MESSAGE_MAP(CPiecePreview, CWnd)
35    //{{AFX_MSG_MAP(CPiecePreview)
36    ON_WM_CREATE()
37    ON_WM_DESTROY()
38    //}}AFX_MSG_MAP
39END_MESSAGE_MAP()
40
41
42/////////////////////////////////////////////////////////////////////////////
43// CPiecePreview message handlers
44
45int CPiecePreview::OnCreate(LPCREATESTRUCT lpCreateStruct)
46{
47    if (CWnd::OnCreate(lpCreateStruct) == -1)
48        return -1;
49
50    m_Preview = new PiecePreview((GLWindow*)lcGetActiveProject()->GetFirstView());
51    m_Preview->Create(m_hWnd);
52    m_Preview->MakeCurrent();
53
54    return 0;
55}
56
57void CPiecePreview::OnDestroy()
58{
59    if (m_Preview)
60    {
61        m_Preview->DestroyContext();
62        delete m_Preview;
63        m_Preview = NULL;
64    }
65
66    CWnd::OnDestroy();
67}
68
69BOOL GLWindowPreTranslateMessage (GLWindow *wnd, MSG *pMsg);
70LRESULT CPiecePreview::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
71{
72    if (m_Preview)
73    {
74        MSG msg;
75        msg.message = message;
76        msg.wParam = wParam;
77        msg.lParam = lParam;
78
79        if (GLWindowPreTranslateMessage(m_Preview, &msg))
80            return TRUE;
81    }
82
83    return CWnd::WindowProc(message, wParam, lParam);
84}
Note: See TracBrowser for help on using the browser.