// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "ROMDump.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainFrame constructor
CMainFrame::CMainFrame(HICON icon)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
	
	Create(AfxRegisterWndClass(0,0,0,icon),"ROMDump Wizard",WS_MAXIMIZE|WS_OVERLAPPEDWINDOW,rectDefault,NULL,NULL,0,NULL);
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFrameWnd::PreCreateWindow(cs);
}

void CMainFrame::DoDataExchange(CDataExchange* pDX) 
{
	CFrameWnd::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

void CMainFrame::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	RECT rect;
	DWORD dy, y;
	int i;
	
	GetClientRect(&rect);
	dy = rect.bottom<<8;
	for (i=0,y=0; i<256; i++)
	{
		CBrush brush(i<<16);
		rect.top = y>>16;
		y += dy;
		rect.bottom = y>>16;
		if (rect.top!=rect.bottom) dc.FillRect(&rect, &brush);
	}
	{
		CFont font, *o_font;
		CBrush brush(0xFFFFFF);
		font.CreateFont(72,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_DEVICE_PRECIS,CLIP_DEFAULT_PRECIS,PROOF_QUALITY,DEFAULT_PITCH|TMPF_TRUETYPE|FF_ROMAN,"Times New Roman");
		o_font = dc.SelectObject(&font);
		GetClientRect(&rect);
		dc.SetBkMode(TRANSPARENT);
		dc.BeginPath();
		dc.TextOut(10,0,"ROMDump Wizard");
		dc.EndPath();
		dc.SelectClipPath(RGN_AND); 
		dc.FillRect(&rect,&brush); 
		dc.SelectObject(o_font);
	}
}
