summaryrefslogtreecommitdiff
path: root/win/Mfwnd.cpp
diff options
context:
space:
mode:
authorleo2001-01-29 23:56:08 +0000
committerleo2001-01-29 23:56:08 +0000
commit91aa552f967eb0645fff45fb4ef3914839d43fcc (patch)
tree57038cfeff96de2f614f77a5e785e982bbd89276 /win/Mfwnd.cpp
parent284ee630366231f6a0c893c9b3d3ce1d62b925d6 (diff)
Moved the old Minifig Wizard window to the new GLWindow and MinifigWizard classes
git-svn-id: http://svn.leocad.org/trunk@236 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/Mfwnd.cpp')
-rw-r--r--win/Mfwnd.cpp141
1 files changed, 0 insertions, 141 deletions
diff --git a/win/Mfwnd.cpp b/win/Mfwnd.cpp
deleted file mode 100644
index 83ee3b3..0000000
--- a/win/Mfwnd.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// GLWindow.cpp : implementation file
-//
-
-#include "stdafx.h"
-#include "LeoCAD.h"
-#include "MFWnd.h"
-#include "Tools.h"
-#include "minifig.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CMinifigWnd
-
-CMinifigWnd::CMinifigWnd()
-{
- m_pDC = NULL;
-}
-
-CMinifigWnd::~CMinifigWnd()
-{
-}
-
-BEGIN_MESSAGE_MAP(CMinifigWnd, CWnd)
- //{{AFX_MSG_MAP(CMinifigWnd)
- ON_WM_ERASEBKGND()
- ON_WM_PAINT()
- ON_WM_DESTROY()
- //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-
-/////////////////////////////////////////////////////////////////////////////
-// CMinifigWnd message handlers
-
-int CMinifigWnd::InitGL()
-{
- m_pDC = new CClientDC(this);
- ASSERT(m_pDC != NULL);
-
- // Fill in the Pixel Format Descriptor
- PIXELFORMATDESCRIPTOR pfd;
- memset(&pfd,0, sizeof(PIXELFORMATDESCRIPTOR));
-
- pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
- pfd.nVersion = 1;
- pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW;
- pfd.iPixelType = PFD_TYPE_RGBA;
- pfd.cColorBits = 24;
- pfd.cDepthBits = 24;
- pfd.iLayerType = PFD_MAIN_PLANE;
-
- int nPixelFormat = OpenGLChoosePixelFormat(m_pDC->m_hDC, &pfd);
- if (nPixelFormat == 0)
- return -1 ;
-
- if (!OpenGLSetPixelFormat(m_pDC->m_hDC, nPixelFormat, &pfd))
- return -1 ;
-
- m_pPal = new CPalette;
-
- if (CreateRGBPalette(m_pDC->m_hDC, &m_pPal))
- {
- m_pDC->SelectPalette(m_pPal, FALSE);
- m_pDC->RealizePalette();
- }
- else
- {
- delete m_pPal;
- m_pPal = NULL;
- }
-
- // Create a rendering context.
- m_hrc = pfnwglCreateContext(m_pDC->m_hDC);
- if (!m_hrc)
- return -1;
-
- HDC oldDC = pfnwglGetCurrentDC();
- HGLRC oldRC = pfnwglGetCurrentContext();
- pfnwglShareLists(oldRC, m_hrc);
- pfnwglMakeCurrent (m_pDC->m_hDC, m_hrc);
-
- pfnwglMakeCurrent (oldDC, oldRC);
-
- return 0;
-}
-
-BOOL CMinifigWnd::OnEraseBkgnd(CDC* /*pDC*/)
-{
- return TRUE;
-}
-
-void CMinifigWnd::OnPaint()
-{
- CPaintDC dc(this); // device context for painting
-
- DrawScene();
-}
-
-void CMinifigWnd::OnDestroy()
-{
- if (m_pPal)
- {
- CPalette palDefault;
- palDefault.CreateStockObject(DEFAULT_PALETTE);
- m_pDC->SelectPalette(&palDefault, FALSE);
- delete m_pPal;
- }
-
- if (m_hrc)
- pfnwglDeleteContext(m_hrc);
- if (m_pDC)
- delete m_pDC;
-
- CWnd::OnDestroy();
-}
-
-void CMinifigWnd::DrawScene()
-{
- if (m_pPal)
- {
- m_pDC->SelectPalette(m_pPal, FALSE);
- m_pDC->RealizePalette();
- }
-
- HDC oldDC = pfnwglGetCurrentDC();
- HGLRC oldRC = pfnwglGetCurrentContext();
- pfnwglMakeCurrent (m_pDC->m_hDC, m_hrc);
-
- RECT rc;
- GetClientRect (&rc);
- m_pFig->Resize (rc.right, rc.bottom);
- m_pFig->Redraw ();
-
- OpenGLSwapBuffers (m_pDC->m_hDC);
- pfnwglMakeCurrent (oldDC, oldRC);
-}