mirror of https://github.com/AbePralle/FGB.git
[Tools] GBConv2
This commit is contained in:
parent
d039858a8d
commit
8203414e20
Binary file not shown.
|
@ -0,0 +1,54 @@
|
|||
// BGSaveDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
#include "BGSaveDialog.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBGSaveDialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(CBGSaveDialog, CFileDialog)
|
||||
|
||||
CBGSaveDialog::CBGSaveDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
|
||||
DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
|
||||
CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CBGSaveDialog, CFileDialog)
|
||||
//{{AFX_MSG_MAP(CBGSaveDialog)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
void CBGSaveDialog::OnTypeChange()
|
||||
{
|
||||
int index = this->m_ofn.nFilterIndex;
|
||||
char *filter = (char*) this->m_ofn.lpstrFilter;
|
||||
int i;
|
||||
for(i=1; i<index; i++){
|
||||
while(*(filter++));
|
||||
while(*(filter++));
|
||||
}
|
||||
while(*(filter++));
|
||||
|
||||
|
||||
/*
|
||||
int curExtPos = m_ofn.nFileExtension;
|
||||
char *filename = m_ofn.lpstrFile;
|
||||
if(curExtPos==0){
|
||||
strcat(filename,filter);
|
||||
}else{
|
||||
strcpy(filename+curExtPos, filter+1);
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#if !defined(AFX_BGSAVEDIALOG_H__F9E2F187_1EE9_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_BGSAVEDIALOG_H__F9E2F187_1EE9_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// BGSaveDialog.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBGSaveDialog dialog
|
||||
|
||||
class CBGSaveDialog : public CFileDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CBGSaveDialog)
|
||||
|
||||
public:
|
||||
virtual void OnTypeChange();
|
||||
CBGSaveDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
|
||||
LPCTSTR lpszDefExt = NULL,
|
||||
LPCTSTR lpszFileName = NULL,
|
||||
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
LPCTSTR lpszFilter = NULL,
|
||||
CWnd* pParentWnd = NULL);
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(CBGSaveDialog)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_BGSAVEDIALOG_H__F9E2F187_1EE9_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,121 @@
|
|||
// ChildFrm.cpp : implementation of the CChildFrame class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
|
||||
#include "ChildFrm.h"
|
||||
#include "gb_pic.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#include "Controls.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame
|
||||
|
||||
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
|
||||
//{{AFX_MSG_MAP(CChildFrame)
|
||||
ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
|
||||
ON_WM_SETFOCUS()
|
||||
ON_WM_CREATE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame construction/destruction
|
||||
|
||||
CChildFrame::CChildFrame()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CChildFrame::~CChildFrame()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
if( !CMDIChildWnd::PreCreateWindow(cs) )
|
||||
return FALSE;
|
||||
|
||||
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
|
||||
cs.style &= ~WS_THICKFRAME;
|
||||
cs.lpszClass = AfxRegisterWndClass(0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CChildFrame::AssertValid() const
|
||||
{
|
||||
CMDIChildWnd::AssertValid();
|
||||
}
|
||||
|
||||
void CChildFrame::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CMDIChildWnd::Dump(dc);
|
||||
}
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame message handlers
|
||||
void CChildFrame::OnFileClose()
|
||||
{
|
||||
|
||||
SendMessage(WM_CLOSE);
|
||||
}
|
||||
|
||||
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
// create a view to occupy the client area of the frame
|
||||
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
|
||||
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
|
||||
{
|
||||
TRACE0("Failed to create view window\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//if(!OnLoadBMP()) OnFileClose();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CChildFrame::OnSetFocus(CWnd* pOldWnd)
|
||||
{
|
||||
CMDIChildWnd::OnSetFocus(pOldWnd);
|
||||
|
||||
m_wndView.SetFocus();
|
||||
}
|
||||
|
||||
BOOL CChildFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
|
||||
{
|
||||
// let the view have first crack at the command
|
||||
if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
|
||||
return TRUE;
|
||||
|
||||
// otherwise, do default handling
|
||||
return CMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
||||
}
|
||||
|
||||
|
||||
int CChildFrame::OnLoadBMP()
|
||||
{
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
// ChildFrm.h : interface of the CChildFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_CHILDFRM_H__2F0A9B4A_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_CHILDFRM_H__2F0A9B4A_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "ChildView.h"
|
||||
#include "gb_pic.h" // Added by ClassView
|
||||
|
||||
class CChildFrame : public CMDIChildWnd
|
||||
{
|
||||
DECLARE_DYNCREATE(CChildFrame)
|
||||
public:
|
||||
CChildFrame();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CChildFrame)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
int OnLoadBMP();
|
||||
// view for the client area of the frame.
|
||||
CChildView m_wndView;
|
||||
virtual ~CChildFrame();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CChildFrame)
|
||||
afx_msg void OnFileClose();
|
||||
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CHILDFRM_H__2F0A9B4A_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,184 @@
|
|||
// ChildView.cpp : implementation of the CChildView class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
#include "ChildView.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#include "Controls.h"
|
||||
#include "EditArea.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildView
|
||||
|
||||
CString CChildView::preferredSourcePath = "d:\\aprogs\\fgbpix\\*.bmp";
|
||||
|
||||
CChildView::CChildView()
|
||||
{
|
||||
sourceFile = destFile = 0;
|
||||
sourceFileName = destFileName = "";
|
||||
}
|
||||
|
||||
CChildView::~CChildView()
|
||||
{
|
||||
if(sourceFile){
|
||||
delete sourceFile;
|
||||
sourceFile = 0;
|
||||
}
|
||||
|
||||
if(destFile){
|
||||
delete destFile;
|
||||
destFile = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CChildView,CWnd )
|
||||
//{{AFX_MSG_MAP(CChildView)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_CREATE()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_KEYDOWN()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildView message handlers
|
||||
|
||||
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
if (!CWnd::PreCreateWindow(cs))
|
||||
return FALSE;
|
||||
|
||||
cs.dwExStyle |= WS_EX_CLIENTEDGE;
|
||||
cs.style &= ~WS_BORDER;
|
||||
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
|
||||
::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CChildView::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
}
|
||||
|
||||
|
||||
int CChildView::OnLoadBMP()
|
||||
{
|
||||
if(!sourceFile){
|
||||
sourceFile = new CFileDialog(TRUE,"*.bmp", preferredSourcePath,
|
||||
0, "Bitmap Files (.bmp)|*.bmp|Backgrounds (*.bg)|*.bg|Sprites (*.sp)|*.sp|Bitmap, BG, & Sprite Files (.bmp;.bg;.sp)|*.bmp;*.bg;*.sp||");
|
||||
}
|
||||
|
||||
|
||||
if(sourceFile->DoModal()==IDOK){
|
||||
sourceFileName = sourceFile->GetPathName();
|
||||
|
||||
//set dest
|
||||
destFileName = sourceFileName.Left(sourceFileName.GetLength()
|
||||
- (sourceFile->GetFileName()).GetLength());
|
||||
|
||||
preferredSourcePath = destFileName;
|
||||
preferredSourcePath += "*.bmp";
|
||||
|
||||
destFileName += sourceFile->GetFileTitle();
|
||||
|
||||
if(sourceFileName.Right(3).CompareNoCase("bmp")==0){
|
||||
// BMP
|
||||
pic.LoadBMP((char*) (LPCTSTR) sourceFileName);
|
||||
}else if(sourceFileName.Right(2).CompareNoCase("bg")==0){
|
||||
// gameboy BG file
|
||||
pic.LoadGBPic(sourceFileName);
|
||||
}else{
|
||||
//hopefully a .sp file
|
||||
pic.LoadGBSprite(sourceFileName);
|
||||
}
|
||||
|
||||
CFrameWnd *frame = this->GetParentFrame();
|
||||
int innerHeight = pic.GetDisplayHeight();
|
||||
if(innerHeight < CTRLHEIGHT) innerHeight = CTRLHEIGHT;
|
||||
CRect frameRect(0,0,pic.GetDisplayWidth()+CTRLWIDTH,innerHeight);
|
||||
AdjustWindowRectEx(&frameRect, frame->GetStyle() | GetStyle(), 0,
|
||||
frame->GetExStyle()|GetExStyle());
|
||||
|
||||
int width = frameRect.Width();
|
||||
int height = frameRect.Height();
|
||||
//if(height < CTRLHEIGHT) height = CTRLHEIGHT;
|
||||
|
||||
frame->SetWindowPos(&wndTop, 0, 0, width, height, SWP_NOMOVE);
|
||||
|
||||
width = pic.GetDisplayWidth();
|
||||
height = pic.GetDisplayHeight();
|
||||
if(height < CTRLHEIGHT) height = CTRLHEIGHT;
|
||||
|
||||
controls.SetWindowPos(&wndTop, 0, 0, CTRLWIDTH, height, SWP_SHOWWINDOW);
|
||||
editArea.SetWindowPos(&wndTop, CTRLWIDTH, 0, width, height, SWP_SHOWWINDOW);
|
||||
|
||||
return 1;
|
||||
/*
|
||||
switch(m_listType.GetCurSel()){
|
||||
case 0:
|
||||
destFileName += ".bg";
|
||||
break;
|
||||
case 1:
|
||||
destFileName += ".tx";
|
||||
break;
|
||||
case 2:
|
||||
destFileName += ".sp";
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
|
||||
if (CWnd ::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
controls.Create(0,0,WS_CHILD,CRect(0,0,0,0),this,0,0);
|
||||
editArea.Create(0,0,WS_CHILD,CRect(0,0,0,0),this,0,0);
|
||||
|
||||
if(!OnLoadBMP()) this->GetParent()->PostMessage(WM_CLOSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CChildView::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
//return true;
|
||||
return CWnd ::OnEraseBkgnd(pDC);
|
||||
}
|
||||
|
||||
void CChildView::DebugMesg(char *title, int num)
|
||||
{
|
||||
char st[80];
|
||||
ostrstream stout(st,80);
|
||||
stout << num << ends;
|
||||
this->MessageBox(st,title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CChildView::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
|
||||
CWnd ::OnMouseMove(nFlags, point);
|
||||
}
|
||||
|
||||
void CChildView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||
{
|
||||
CWnd ::OnKeyDown(nChar, nRepCnt, nFlags);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
// ChildView.h : interface of the CChildView class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_CHILDVIEW_H__2F0A9B4C_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_CHILDVIEW_H__2F0A9B4C_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#include "EditArea.h" // Added by ClassView
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "gb_pic.h"
|
||||
#include "EditArea.h"
|
||||
#include "Controls.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildView window
|
||||
|
||||
class CChildView : public CWnd
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CChildView();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CChildView)
|
||||
protected:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
CEditArea editArea;
|
||||
CControls controls;
|
||||
void DebugMesg(char *title, int num);
|
||||
int OnLoadBMP();
|
||||
virtual ~CChildView();
|
||||
|
||||
static CString preferredSourcePath;
|
||||
gbPic pic;
|
||||
CString sourceFileName, destFileName;
|
||||
CFileDialog* sourceFile, *destFile;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CChildView)
|
||||
afx_msg void OnPaint();
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CHILDVIEW_H__2F0A9B4C_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,437 @@
|
|||
// Controls.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
#include "Controls.h"
|
||||
#include "ChildView.h"
|
||||
#include "wingk.h"
|
||||
#include "EditPaletteDialog.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CControls
|
||||
|
||||
//statics
|
||||
CString CControls::preferredDestPath = "d:\\aprogs\\fgbpix\\*.sp";
|
||||
|
||||
CControls::CControls()
|
||||
{
|
||||
showSprites = 1;
|
||||
showMapping = 1;
|
||||
destFileDialog = 0;
|
||||
bgFileDialog = 0;
|
||||
}
|
||||
|
||||
CControls::~CControls()
|
||||
{
|
||||
if(destFileDialog){
|
||||
delete destFileDialog;
|
||||
destFileDialog = 0;
|
||||
}
|
||||
if(bgFileDialog){
|
||||
delete bgFileDialog;
|
||||
bgFileDialog = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CControls, CWnd)
|
||||
//{{AFX_MSG_MAP(CControls)
|
||||
ON_WM_CREATE()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_ERASEBKGND()
|
||||
//}}AFX_MSG_MAP
|
||||
ON_BN_CLICKED(IDB_PALETTEFROMSEL,OnPaletteFromSel)
|
||||
ON_BN_CLICKED(IDB_SETTOBGCOLOR,OnB_SetToBGColor)
|
||||
ON_BN_CLICKED(IDB_SWAPWITHBGCOLOR,OnB_SwapWithBGColor)
|
||||
ON_BN_CLICKED(IDB_AUTOMAPTOPALETTE,OnB_AutoMapToPalette)
|
||||
ON_BN_CLICKED(IDB_MAPTOPALETTE,OnB_MapToPalette)
|
||||
ON_BN_CLICKED(IDB_UNMAP,OnB_Unmap)
|
||||
ON_BN_CLICKED(IDB_SELECTNONEMPTY,OnB_SelectNonEmpty)
|
||||
ON_BN_CLICKED(IDB_MAKESPRITES,OnB_MakeSprites)
|
||||
ON_BN_CLICKED(IDB_SHOWSPRITES,OnB_CheckShowSprites)
|
||||
ON_BN_CLICKED(IDB_SHOWMAPPING,OnB_ShowMapping)
|
||||
ON_BN_CLICKED(IDB_SELECTUNMAPPED,OnB_SelectUnmapped)
|
||||
ON_BN_CLICKED(IDB_SAVEGBSPRITE,OnB_SaveGBSprite)
|
||||
ON_BN_CLICKED(IDB_EDITPALETTE,OnB_EditPalette)
|
||||
|
||||
ON_BN_CLICKED(IDB_AUTOMAPALL,OnB_AutoMapAll)
|
||||
ON_BN_CLICKED(IDB_SAVEGBPIC,OnB_SaveGBPic)
|
||||
|
||||
ON_LBN_SELCHANGE(IDLIST_PALETTES,OnSelChangePalettes)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CControls message handlers
|
||||
|
||||
int CControls::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
view = (CChildView*) this->GetParent();
|
||||
|
||||
palettes.Create(
|
||||
WS_CHILD|WS_VISIBLE|LBS_MULTIPLESEL|LBS_EXTENDEDSEL|LBS_OWNERDRAWFIXED,
|
||||
CRect(CTRLWIDTH-64,0,CTRLWIDTH,272),this,IDLIST_PALETTES);
|
||||
|
||||
CChildView *view = (CChildView*) this->GetParent();
|
||||
|
||||
palettes.pic = &(view->pic);
|
||||
|
||||
int i;
|
||||
for(i=0; i<8; i++){
|
||||
int index = palettes.AddString("");
|
||||
palettes.SetItemData(index, i);
|
||||
}
|
||||
/*
|
||||
palettes.AddString((char*) -1);
|
||||
for(i=0; i<8; i++){
|
||||
int index = palettes.AddString("");
|
||||
palettes.SetItemData(index, i+8);
|
||||
}
|
||||
*/
|
||||
|
||||
CRect rect(0,0,144,24);
|
||||
createPaletteFromSel.Create("Colors->Palette",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_PALETTEFROMSEL);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_setToBGColor.Create("Colors To BG Color",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SETTOBGCOLOR);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_swapWithBGColor.Create("Swap Colors w/BG",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SWAPWITHBGCOLOR);
|
||||
|
||||
rect.OffsetRect(0,32);
|
||||
b_autoMapToPalette.Create("AutoMap To Palette",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_AUTOMAPTOPALETTE);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_mapToPalette.Create("Map To Palette",WS_CHILD|WS_VISIBLE,rect,this,
|
||||
IDB_MAPTOPALETTE);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_unmap.Create("Unmap",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_UNMAP);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_selectUnmapped.Create("Select Unmapped",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SELECTUNMAPPED);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_autoMapAll.Create("AutoMap All",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_AUTOMAPALL);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_saveGBPic.Create("Save GB Pic",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SAVEGBPIC);
|
||||
|
||||
rect.OffsetRect(0,32);
|
||||
b_selectNonEmpty.Create("Select Non-Empty",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SELECTNONEMPTY);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_makeSprites.Create("Make 8x16 Sprites",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_MAKESPRITES);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_saveGBSprite.Create("Save GB Sprite",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SAVEGBSPRITE);
|
||||
|
||||
rect.OffsetRect(0,32);
|
||||
b_editPalette.Create("Edit Palette",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_EDITPALETTE);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_showSprites.Create("Show Sprites",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SHOWSPRITES);
|
||||
|
||||
rect.OffsetRect(0,24);
|
||||
b_showMapping.Create("Show Mapping",WS_CHILD|WS_VISIBLE,
|
||||
rect,this,IDB_SHOWMAPPING);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CControls::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
CChildView *view = (CChildView*) this->GetParent();
|
||||
|
||||
//------------------------draw magnified area-------------------------------
|
||||
CPoint point;
|
||||
GetCursorPos(&point);
|
||||
view->editArea.ScreenToClient(&point);
|
||||
|
||||
//view->pic.GetMagnifiedArea(point.x,point.y)->BlitToDC(&dc, CTRLWIDTH-80,288);
|
||||
view->pic.GetMagnifiedArea(point.x,point.y)->BlitToHDC(dc, CTRLWIDTH-80,288);
|
||||
|
||||
//-----------------------draw bg color & selected colors--------------------
|
||||
//clear the color area
|
||||
dc.FillSolidRect(0,CTRLHEIGHT-16,CTRLWIDTH,CTRLHEIGHT,0x303030);
|
||||
CBrush blackBrush;
|
||||
blackBrush.CreateSolidBrush(0);
|
||||
|
||||
//draw the bg color
|
||||
CRect rect(0,CTRLHEIGHT-16,16,CTRLHEIGHT);
|
||||
dc.FillSolidRect(&rect, view->pic.GetBGColor());
|
||||
dc.FrameRect(&rect,&blackBrush);
|
||||
|
||||
int count = view->pic.GetNumSelectedColors();
|
||||
if(count > 0){
|
||||
int pixelsPer = (CTRLWIDTH-32) / count;
|
||||
int totalWidth = count * pixelsPer;
|
||||
CRect curRect(32,CTRLHEIGHT-16,32+pixelsPer,CTRLHEIGHT);
|
||||
gkRGB *colors = view->pic.GetSelectedColors();
|
||||
|
||||
int i;
|
||||
for(i=0; i<count; i++){
|
||||
dc.FillSolidRect(&curRect, colors[i]);
|
||||
curRect += CSize(pixelsPer,0);
|
||||
}
|
||||
|
||||
//black border around it all
|
||||
curRect = CRect(32,CTRLHEIGHT-16,32+pixelsPer*count,CTRLHEIGHT);
|
||||
dc.FrameRect(&curRect,&blackBrush);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CControls::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
InvalidateMagnifiedArea();
|
||||
|
||||
CWnd::OnMouseMove(nFlags, point);
|
||||
}
|
||||
|
||||
void CControls::InvalidateMagnifiedArea()
|
||||
{
|
||||
CRect magView(CTRLWIDTH-80,288,CTRLWIDTH,368);
|
||||
InvalidateRect(magView, 0);
|
||||
}
|
||||
|
||||
|
||||
void CControls::InvalidateColors()
|
||||
{
|
||||
CRect colors(0,CTRLHEIGHT-16,CTRLWIDTH,CTRLHEIGHT);
|
||||
InvalidateRect(colors, 0);
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::InvalidateEditArea()
|
||||
{
|
||||
view->pic.SetNeedsRedraw();
|
||||
view->editArea.InvalidateRect(0);
|
||||
}
|
||||
|
||||
void CControls::OnPaletteFromSel()
|
||||
{
|
||||
int curPal = palettes.GetCurSel();
|
||||
if(curPal==-1) return;
|
||||
if(curPal>=8) curPal--; //blank divider item
|
||||
|
||||
int n = view->pic.GetNumSelectedColors();
|
||||
if(n>4) n = 4;
|
||||
|
||||
gkRGB *colors = view->pic.GetSelectedColors();
|
||||
|
||||
int i;
|
||||
for(i=0; i<n; i++){
|
||||
view->pic.SetColor(curPal, i, colors[i]);
|
||||
}
|
||||
|
||||
palettes.InvalidateRect(0);
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_SetToBGColor()
|
||||
{
|
||||
//set selected colors to be the background color
|
||||
view->pic.RemapSelectedToBGColor();
|
||||
InvalidateMagnifiedArea();
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_SwapWithBGColor()
|
||||
{
|
||||
view->pic.SwapSelectedWithBGColor();
|
||||
InvalidateMagnifiedArea();
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_AutoMapToPalette()
|
||||
{
|
||||
int pal = 0;
|
||||
int numSel = palettes.GetSelItems(17,palettesSelected);
|
||||
int i;
|
||||
for(i=0; i<numSel; i++){
|
||||
pal |= (1 << palettesSelected[i]);
|
||||
}
|
||||
view->pic.AutoMapToPalette(pal);
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_SelectNonEmpty()
|
||||
{
|
||||
view->pic.SelectNonEmpty();
|
||||
InvalidateEditArea();
|
||||
InvalidateMagnifiedArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_Unmap()
|
||||
{
|
||||
view->pic.Unmap();
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_MakeSprites()
|
||||
{
|
||||
view->pic.SetCurPalette(palettes.GetCurSel());
|
||||
view->pic.MakeSprites();
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnSelChangePalettes()
|
||||
{
|
||||
//See same in CPaletteListBox
|
||||
this->MessageBox("Super!");
|
||||
}
|
||||
|
||||
void CControls::OnB_CheckShowSprites()
|
||||
{
|
||||
showSprites ^= 1;
|
||||
view->pic.SetNeedsRedraw();
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_SelectUnmapped()
|
||||
{
|
||||
view->pic.SelectUnmapped();
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_SaveGBSprite()
|
||||
{
|
||||
if(!destFileDialog){
|
||||
CString initialDestFilename = view->destFileName;
|
||||
if(initialDestFilename.Right(3).CompareNoCase(".sp")!=0) initialDestFilename += ".sp";
|
||||
destFileDialog = new CFileDialog(FALSE,".sp", initialDestFilename,
|
||||
0, "Sprite Files (.sp)|*.sp||");
|
||||
}
|
||||
|
||||
|
||||
if(destFileDialog->DoModal()==IDOK){
|
||||
destFilename = destFileDialog->GetPathName();
|
||||
view->pic.SaveGBSprite((char*) (const char*) destFilename);
|
||||
|
||||
char st[80];
|
||||
ostrstream stout(st,80);
|
||||
stout << view->pic.GetFileSize() << " Bytes" << ends;
|
||||
this->MessageBox(st);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CControls::OnB_EditPalette()
|
||||
{
|
||||
gbPic &pic = view->pic;
|
||||
|
||||
int pal = pic.GetCurPalette();
|
||||
if(pal<0 || pal>7) return;
|
||||
|
||||
CEditPaletteDialog dialog;
|
||||
|
||||
int i;
|
||||
for(i=0; i<4; i++){
|
||||
dialog.initColors[i] = pic.GetColor(pal,i);
|
||||
}
|
||||
|
||||
if(dialog.DoModal()==IDOK){
|
||||
for(i=0; i<4; i++){
|
||||
pic.SetColor(pal,i,dialog.initColors[i]);
|
||||
}
|
||||
view->controls.InvalidateEditArea();
|
||||
}
|
||||
}
|
||||
|
||||
void CControls::OnB_AutoMapAll()
|
||||
{
|
||||
view->pic.AutoMap(255);
|
||||
InvalidateEditArea();
|
||||
palettes.Invalidate(0);
|
||||
}
|
||||
|
||||
void CControls::OnB_SaveGBPic()
|
||||
{
|
||||
if(!bgFileDialog){
|
||||
CString initialDestFilename = view->destFileName;
|
||||
if(initialDestFilename.Right(3).CompareNoCase(".bg")!=0) initialDestFilename += ".bg";
|
||||
bgFileDialog = new CBGSaveDialog(FALSE,".bg", initialDestFilename,
|
||||
0, "Background (.bg)|*.bg||");
|
||||
}
|
||||
|
||||
//CString path = bgFileDialog->GetPathName();
|
||||
//CString ext = bgFileDialog->GetFileExt();
|
||||
//if(ext.GetLength()>0) path = path.Left(path.GetLength() - ext.GetLength() - 1);
|
||||
//strcpy(bgFileDialog->m_ofn.lpstrFile,path);
|
||||
if(bgFileDialog->DoModal()==IDOK){
|
||||
bgFilename = bgFileDialog->GetPathName();
|
||||
//if(bgFileDialog->GetFileExt().CompareNoCase("bg")){
|
||||
view->pic.SaveGBPic(bgFilename);
|
||||
//}else{
|
||||
//view->pic.SaveGBText(bgFilename);
|
||||
//}
|
||||
|
||||
char st[80];
|
||||
ostrstream stout(st,80);
|
||||
stout << view->pic.GetNumUniqueTiles() << " Unique Tiles" << endl;
|
||||
stout << view->pic.GetFileSize() << " Bytes" << ends;
|
||||
this->MessageBox(st);
|
||||
}
|
||||
|
||||
InvalidateEditArea();
|
||||
palettes.Invalidate(0);
|
||||
}
|
||||
|
||||
BOOL CControls::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
|
||||
pDC->FillSolidRect(&rect,0x303030);
|
||||
return 1;
|
||||
|
||||
//return CWnd::OnEraseBkgnd(pDC);
|
||||
}
|
||||
|
||||
void CControls::OnB_ShowMapping()
|
||||
{
|
||||
showMapping ^= 1;
|
||||
view->pic.SetNeedsRedraw();
|
||||
InvalidateEditArea();
|
||||
}
|
||||
|
||||
void CControls::OnB_MapToPalette()
|
||||
{
|
||||
int pal = 0;
|
||||
int numSel = palettes.GetSelItems(17,palettesSelected);
|
||||
int i;
|
||||
for(i=0; i<numSel; i++){
|
||||
pal |= (1 << palettesSelected[i]);
|
||||
}
|
||||
view->pic.MapToPalette(pal);
|
||||
InvalidateEditArea();
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
#if !defined(AFX_CONTROLS_H__74CE4C48_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_CONTROLS_H__74CE4C48_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#include "PaletteListBox.h" // Added by ClassView
|
||||
#include "BGSaveDialog.h"
|
||||
|
||||
class CChildView;
|
||||
class CPaletteListBox;
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// Controls.h : header file
|
||||
//
|
||||
|
||||
|
||||
#define CTRLWIDTH 224
|
||||
#define CTRLHEIGHT 416
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CControls window
|
||||
|
||||
class CControls : public CWnd
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CControls();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CControls)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
void OnB_MapToPalette();
|
||||
void OnB_ShowMapping();
|
||||
void OnB_SaveGBPic();
|
||||
void OnB_AutoMapAll();
|
||||
void OnB_EditPalette();
|
||||
void OnB_SaveGBSprite();
|
||||
void OnB_SelectUnmapped();
|
||||
void OnB_CheckShowSprites();
|
||||
void OnSelChangePalettes();
|
||||
void OnB_MakeSprites();
|
||||
void OnB_Unmap();
|
||||
void OnB_SelectNonEmpty();
|
||||
void OnB_AutoMapToPalette();
|
||||
void OnB_SwapWithBGColor();
|
||||
void OnB_SetToBGColor();
|
||||
void OnPaletteFromSel();
|
||||
void InvalidateEditArea();
|
||||
void InvalidateColors();
|
||||
void InvalidateMagnifiedArea();
|
||||
CPaletteListBox palettes;
|
||||
virtual ~CControls();
|
||||
|
||||
int showSprites, showMapping;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
int palettesSelected[17];
|
||||
CChildView *view;
|
||||
CButton createPaletteFromSel;
|
||||
CButton b_setToBGColor;
|
||||
CButton b_swapWithBGColor;
|
||||
CButton b_selectNonEmpty;
|
||||
CButton b_unmap;
|
||||
CButton b_makeSprites;
|
||||
CButton b_autoMapToPalette;
|
||||
CButton b_mapToPalette;
|
||||
CButton b_showSprites;
|
||||
CButton b_showMapping;
|
||||
CButton b_selectUnmapped;
|
||||
CButton b_saveGBSprite;
|
||||
CButton b_editPalette;
|
||||
|
||||
CButton b_autoMapAll;
|
||||
CButton b_saveGBPic;
|
||||
|
||||
static CString preferredDestPath;
|
||||
CString destFilename;
|
||||
CFileDialog *destFileDialog;
|
||||
CString bgFilename;
|
||||
CBGSaveDialog *bgFileDialog;
|
||||
|
||||
//{{AFX_MSG(CControls)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CONTROLS_H__74CE4C48_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,223 @@
|
|||
// EditArea.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
#include "EditArea.h"
|
||||
#include "ChildView.h"
|
||||
#include "MainFrm.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditArea
|
||||
|
||||
CEditArea::CEditArea()
|
||||
{
|
||||
view = 0;
|
||||
downLMB = downRMB = 0;
|
||||
pickingColors = 0;
|
||||
}
|
||||
|
||||
CEditArea::~CEditArea()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CEditArea, CWnd)
|
||||
//{{AFX_MSG_MAP(CEditArea)
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_CREATE()
|
||||
ON_WM_KEYDOWN()
|
||||
ON_WM_RBUTTONDOWN()
|
||||
ON_WM_RBUTTONUP()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditArea message handlers
|
||||
|
||||
BOOL CEditArea::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
|
||||
//fill to the right of the picture
|
||||
int width = rect.Width() - view->pic.GetDisplayWidth();
|
||||
if(width > 0){
|
||||
pDC->FillSolidRect(view->pic.GetDisplayWidth(), 0, width, rect.Height(), 0x303030);
|
||||
}
|
||||
|
||||
int height = rect.Height() - view->pic.GetDisplayHeight();
|
||||
if(height > 0){
|
||||
pDC->FillSolidRect(0,view->pic.GetDisplayHeight(),
|
||||
view->pic.GetDisplayWidth(), height, 0x303030);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
//return CWnd::OnEraseBkgnd(pDC);
|
||||
}
|
||||
|
||||
void CEditArea::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
//view->pic.GetDisplayBuffer()->BlitToDC(&dc, 0, 0);
|
||||
int flags = (view->controls.showMapping << 1) | view->controls.showSprites;
|
||||
view->pic.GetDisplayBuffer(flags)->BlitToHDC(dc, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
void CEditArea::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
this->SetFocus();
|
||||
|
||||
view->controls.InvalidateMagnifiedArea();
|
||||
|
||||
if(downLMB){
|
||||
if(!pickingColors){
|
||||
view->pic.OnMouseLDrag(point.x, point.y);
|
||||
view->controls.InvalidateColors();
|
||||
if(view->pic.GetNeedsRedraw()) this->InvalidateRect(0);
|
||||
}else{
|
||||
if(GetAsyncKeyState(VK_CONTROL) & 0x8000){
|
||||
if(GetAsyncKeyState(VK_SHIFT) & 0x8000){
|
||||
view->pic.AddNextColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}else{
|
||||
view->pic.SetFirstColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}
|
||||
view->controls.InvalidateColors();
|
||||
}else{
|
||||
pickingColors = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(downRMB){
|
||||
if(GetAsyncKeyState(VK_CONTROL) & 0x8000){
|
||||
if(GetAsyncKeyState(VK_SHIFT) & 0x8000){
|
||||
//remove a color
|
||||
view->pic.RemoveColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}else{
|
||||
//set the bg color
|
||||
view->pic.SetBGColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}
|
||||
view->controls.InvalidateColors();
|
||||
}
|
||||
}
|
||||
|
||||
CMainFrame *frame = (CMainFrame*) view->GetTopLevelFrame();
|
||||
char st[80];
|
||||
ostrstream stout(st,80);
|
||||
stout << "Selected: " << view->pic.GetNumSelTiles()
|
||||
<< " Sprites: " << view->pic.GetNumSprites() << " ";
|
||||
stout << "Mapping: ";
|
||||
int mapping = view->pic.GetMappingAtPoint(point.x,point.y);
|
||||
if(mapping==-1) stout << "(None) ";
|
||||
else stout << mapping << " ";
|
||||
stout << ends;
|
||||
CString str(st);
|
||||
frame->ShowStatus(&str);
|
||||
|
||||
CWnd::OnMouseMove(nFlags, point);
|
||||
}
|
||||
|
||||
void CEditArea::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
if(view->controls.showSprites){
|
||||
if(view->pic.UnmakeSprite(point.x, point.y)){
|
||||
this->InvalidateRect(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
downLMB = 1;
|
||||
if(GetAsyncKeyState(VK_CONTROL) & 0x8000){
|
||||
if(GetAsyncKeyState(VK_SHIFT) & 0x8000){
|
||||
view->pic.AddNextColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}else{
|
||||
//pick a color
|
||||
view->pic.SetFirstColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}
|
||||
view->controls.InvalidateColors();
|
||||
pickingColors = 1;
|
||||
}else{
|
||||
//select tiles
|
||||
view->pic.OnMouseLMB(point.x, point.y);
|
||||
view->controls.InvalidateColors();
|
||||
pickingColors = 0;
|
||||
}
|
||||
if(view->pic.GetNeedsRedraw()) this->InvalidateRect(0);
|
||||
this->SetCapture();
|
||||
CWnd::OnLButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
void CEditArea::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
if(downLMB){
|
||||
downLMB = 0;
|
||||
if(!pickingColors){
|
||||
view->pic.OnMouseLRelease(point.x, point.y);
|
||||
view->controls.InvalidateColors();
|
||||
CWnd::OnLButtonUp(nFlags, point);
|
||||
if(view->pic.GetNeedsRedraw()) this->InvalidateRect(0);
|
||||
}
|
||||
ReleaseCapture();
|
||||
pickingColors = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int CEditArea::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
view = (CChildView*) this->GetParent();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CEditArea::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||
{
|
||||
if(nChar==VK_CONTROL){
|
||||
//this->MessageBox("CTRL pressed!");
|
||||
}
|
||||
CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
|
||||
}
|
||||
|
||||
void CEditArea::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
if(GetAsyncKeyState(VK_CONTROL) & 0x8000){
|
||||
if(GetAsyncKeyState(VK_SHIFT) & 0x8000){
|
||||
//remove a color
|
||||
view->pic.RemoveColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}else{
|
||||
//set the bg color
|
||||
view->pic.SetBGColor(view->pic.GetColorAtPoint(point.x,point.y));
|
||||
}
|
||||
view->controls.InvalidateColors();
|
||||
}else{
|
||||
//not picking colors; clear all selected pixels
|
||||
view->pic.ClearSelection();
|
||||
this->InvalidateRect(0);
|
||||
view->controls.InvalidateMagnifiedArea();
|
||||
view->controls.InvalidateColors();
|
||||
}
|
||||
downRMB = 1;
|
||||
CWnd::OnRButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
void CEditArea::OnRButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
downRMB = 0;
|
||||
CWnd::OnRButtonUp(nFlags, point);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#if !defined(AFX_EDITAREA_H__74CE4C4A_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_EDITAREA_H__74CE4C4A_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// EditArea.h : header file
|
||||
//
|
||||
|
||||
class CChildView;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditArea window
|
||||
|
||||
class CEditArea : public CWnd
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CEditArea();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CEditArea)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CEditArea();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
int downRMB;
|
||||
short int pickingColors;
|
||||
CChildView *view;
|
||||
int downLMB;
|
||||
//{{AFX_MSG(CEditArea)
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_EDITAREA_H__74CE4C4A_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,109 @@
|
|||
// EditPaletteDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
#include "EditPaletteDialog.h"
|
||||
#include <strstrea.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditPaletteDialog dialog
|
||||
|
||||
|
||||
CEditPaletteDialog::CEditPaletteDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CEditPaletteDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CEditPaletteDialog)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CEditPaletteDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CEditPaletteDialog)
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_RED3, m_editRed3);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_RED2, m_editRed2);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_RED1, m_editRed1);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_RED0, m_editRed0);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_GREEN3, m_editGreen3);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_GREEN2, m_editGreen2);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_GREEN1, m_editGreen1);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_GREEN0, m_editGreen0);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_BLUE3, m_editBlue3);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_BLUE2, m_editBlue2);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_BLUE1, m_editBlue1);
|
||||
DDX_Control(pDX, IDC_EDIT_PAL_BLUE0, m_editBlue0);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CEditPaletteDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CEditPaletteDialog)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditPaletteDialog message handlers
|
||||
|
||||
void CEditPaletteDialog::OnOK()
|
||||
{
|
||||
//copy working colors to initColors
|
||||
initColors[0] = gkRGB(GetNum(m_editRed0),GetNum(m_editGreen0),GetNum(m_editBlue0));
|
||||
initColors[1] = gkRGB(GetNum(m_editRed1),GetNum(m_editGreen1),GetNum(m_editBlue1));
|
||||
initColors[2] = gkRGB(GetNum(m_editRed2),GetNum(m_editGreen2),GetNum(m_editBlue2));
|
||||
initColors[3] = gkRGB(GetNum(m_editRed3),GetNum(m_editGreen3),GetNum(m_editBlue3));
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
int CEditPaletteDialog::GetNum(CEdit &edit)
|
||||
{
|
||||
char st[80];
|
||||
edit.GetWindowText(st,80);
|
||||
istrstream stin(st,80);
|
||||
|
||||
int num;
|
||||
stin >> num;
|
||||
|
||||
if(num<0) num = 0;
|
||||
if(num>255) num = 255;
|
||||
num &= 0xf8;
|
||||
return num;
|
||||
}
|
||||
|
||||
BOOL CEditPaletteDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
SetNum(m_editRed0,initColors[0].GetR());
|
||||
SetNum(m_editRed1,initColors[1].GetR());
|
||||
SetNum(m_editRed2,initColors[2].GetR());
|
||||
SetNum(m_editRed3,initColors[3].GetR());
|
||||
SetNum(m_editGreen0,initColors[0].GetG());
|
||||
SetNum(m_editGreen1,initColors[1].GetG());
|
||||
SetNum(m_editGreen2,initColors[2].GetG());
|
||||
SetNum(m_editGreen3,initColors[3].GetG());
|
||||
SetNum(m_editBlue0,initColors[0].GetB());
|
||||
SetNum(m_editBlue1,initColors[1].GetB());
|
||||
SetNum(m_editBlue2,initColors[2].GetB());
|
||||
SetNum(m_editBlue3,initColors[3].GetB());
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CEditPaletteDialog::SetNum(CEdit &edit, int n)
|
||||
{
|
||||
char st[80];
|
||||
ostrstream stout(st,80);
|
||||
n &= 0xff;
|
||||
stout << n << ends;
|
||||
edit.SetWindowText(st);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
#if !defined(AFX_EDITPALETTEDIALOG_H__E83CE848_1BC5_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_EDITPALETTEDIALOG_H__E83CE848_1BC5_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#include "wingk.h" // Added by ClassView
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// EditPaletteDialog.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditPaletteDialog dialog
|
||||
|
||||
class CEditPaletteDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void SetNum(CEdit &edit, int n);
|
||||
int GetNum(CEdit &edit);
|
||||
gkRGB colors[4];
|
||||
gkRGB initColors[4];
|
||||
CEditPaletteDialog(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CEditPaletteDialog)
|
||||
enum { IDD = IDD_EDIT_PALETTE };
|
||||
CEdit m_editRed3;
|
||||
CEdit m_editRed2;
|
||||
CEdit m_editRed1;
|
||||
CEdit m_editRed0;
|
||||
CEdit m_editGreen3;
|
||||
CEdit m_editGreen2;
|
||||
CEdit m_editGreen1;
|
||||
CEdit m_editGreen0;
|
||||
CEdit m_editBlue3;
|
||||
CEdit m_editBlue2;
|
||||
CEdit m_editBlue1;
|
||||
CEdit m_editBlue0;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CEditPaletteDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CEditPaletteDialog)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_EDITPALETTEDIALOG_H__E83CE848_1BC5_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,157 @@
|
|||
// GBConv2.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
|
||||
#include "MainFrm.h"
|
||||
#include "ChildFrm.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGBConv2App
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGBConv2App, CWinApp)
|
||||
//{{AFX_MSG_MAP(CGBConv2App)
|
||||
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||
ON_COMMAND(ID_FILE_NEW, OnFileNew)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGBConv2App construction
|
||||
|
||||
CGBConv2App::CGBConv2App()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// The one and only CGBConv2App object
|
||||
|
||||
CGBConv2App theApp;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGBConv2App initialization
|
||||
|
||||
BOOL CGBConv2App::InitInstance()
|
||||
{
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// Standard initialization
|
||||
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
#else
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
#endif
|
||||
|
||||
// Change the registry key under which our settings are stored.
|
||||
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||
|
||||
|
||||
|
||||
CMDIFrameWnd* pFrame = new CMainFrame;
|
||||
m_pMainWnd = pFrame;
|
||||
|
||||
// create main MDI frame window
|
||||
if (!pFrame->LoadFrame(IDR_MAINFRAME))
|
||||
return FALSE;
|
||||
|
||||
// try to load shared MDI menus and accelerator table
|
||||
|
||||
HINSTANCE hInst = AfxGetResourceHandle();
|
||||
m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_GBCONVTYPE));
|
||||
m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_GBCONVTYPE));
|
||||
|
||||
|
||||
pFrame->ShowWindow(SW_SHOWMAXIMIZED);
|
||||
pFrame->UpdateWindow();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGBConv2App message handlers
|
||||
|
||||
int CGBConv2App::ExitInstance()
|
||||
{
|
||||
if (m_hMDIMenu != NULL)
|
||||
FreeResource(m_hMDIMenu);
|
||||
if (m_hMDIAccel != NULL)
|
||||
FreeResource(m_hMDIAccel);
|
||||
|
||||
return CWinApp::ExitInstance();
|
||||
}
|
||||
|
||||
void CGBConv2App::OnFileNew()
|
||||
{
|
||||
CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
|
||||
|
||||
// create a new MDI child window
|
||||
pFrame->CreateNewChild(
|
||||
RUNTIME_CLASS(CChildFrame), IDR_GBCONVTYPE, m_hMDIMenu, m_hMDIAccel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAboutDlg dialog used for App About
|
||||
|
||||
class CAboutDlg : public CDialog
|
||||
{
|
||||
public:
|
||||
CAboutDlg();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAboutDlg)
|
||||
enum { IDD = IDD_ABOUTBOX };
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAboutDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
//{{AFX_MSG(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CAboutDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CAboutDlg)
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
// App command to run the dialog
|
||||
void CGBConv2App::OnAppAbout()
|
||||
{
|
||||
CAboutDlg aboutDlg;
|
||||
aboutDlg.DoModal();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGBConv2App message handlers
|
||||
|
|
@ -0,0 +1,253 @@
|
|||
# Microsoft Developer Studio Project File - Name="GBConv2" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=GBConv2 - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "GBConv2.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "GBConv2.mak" CFG="GBConv2 - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "GBConv2 - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "GBConv2 - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "GBConv2 - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 5
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 5
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 /nologo /subsystem:windows /machine:I386
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=copy exe from Release directory
|
||||
PostBuild_Cmds=copy /y Release\*.exe .
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "GBConv2 - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 5
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 5
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "GBConv2 - Win32 Release"
|
||||
# Name "GBConv2 - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BGSaveDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChildFrm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChildView.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Controls.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EditArea.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EditPaletteDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gb_pic.cpp
|
||||
|
||||
!IF "$(CFG)" == "GBConv2 - Win32 Release"
|
||||
|
||||
# ADD CPP /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "GBConv2 - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GBConv2.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GBConv2.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PaletteButton.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PaletteListBox.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wingk.cpp
|
||||
|
||||
!IF "$(CFG)" == "GBConv2 - Win32 Release"
|
||||
|
||||
# ADD CPP /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "GBConv2 - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BGSaveDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChildFrm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChildView.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Controls.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EditArea.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EditPaletteDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gb_pic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GBConv2.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PaletteButton.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PaletteListBox.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wingk.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\GBConv2.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\GBConv2.rc2
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\Toolbar.bmp
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -0,0 +1,29 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "GBConv2"=.\GBConv2.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
// GBConv2.h : main header file for the GBCONV2 application
|
||||
//
|
||||
|
||||
#if !defined(AFX_GBCONV2_H__2F0A9B44_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_GBCONV2_H__2F0A9B44_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGBConv2App:
|
||||
// See GBConv2.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CGBConv2App : public CWinApp
|
||||
{
|
||||
public:
|
||||
CGBConv2App();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CGBConv2App)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
virtual int ExitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
HMENU m_hMDIMenu;
|
||||
HACCEL m_hMDIAccel;
|
||||
|
||||
public:
|
||||
//{{AFX_MSG(CGBConv2App)
|
||||
afx_msg void OnAppAbout();
|
||||
afx_msg void OnFileNew();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_GBCONV2_H__2F0A9B44_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,87 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: GBConv2 - Win32 Release--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating command line "rc.exe /l 0x409 /fo"Release/GBConv2.res" /d "NDEBUG" "D:\Aprogs\GBConv2\GBConv2.rc""
|
||||
Creating temporary file "C:\WINDOWS\TEMP\RSP1245.TMP" with contents
|
||||
[
|
||||
/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Release/GBConv2.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c
|
||||
"D:\Aprogs\GBConv2\BGSaveDialog.cpp"
|
||||
"D:\Aprogs\GBConv2\ChildFrm.cpp"
|
||||
"D:\Aprogs\GBConv2\ChildView.cpp"
|
||||
"D:\Aprogs\GBConv2\Controls.cpp"
|
||||
"D:\Aprogs\GBConv2\EditArea.cpp"
|
||||
"D:\Aprogs\GBConv2\EditPaletteDialog.cpp"
|
||||
"D:\Aprogs\GBConv2\gb_pic.cpp"
|
||||
"D:\Aprogs\GBConv2\GBConv2.cpp"
|
||||
"D:\Aprogs\GBConv2\MainFrm.cpp"
|
||||
"D:\Aprogs\GBConv2\PaletteButton.cpp"
|
||||
"D:\Aprogs\GBConv2\PaletteListBox.cpp"
|
||||
"D:\Aprogs\GBConv2\wingk.cpp"
|
||||
]
|
||||
Creating command line "cl.exe @C:\WINDOWS\TEMP\RSP1245.TMP"
|
||||
Creating temporary file "C:\WINDOWS\TEMP\RSP1246.TMP" with contents
|
||||
[
|
||||
/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Release/GBConv2.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c
|
||||
"D:\Aprogs\GBConv2\StdAfx.cpp"
|
||||
]
|
||||
Creating command line "cl.exe @C:\WINDOWS\TEMP\RSP1246.TMP"
|
||||
Creating temporary file "C:\WINDOWS\TEMP\RSP1247.TMP" with contents
|
||||
[
|
||||
/nologo /subsystem:windows /incremental:no /pdb:"Release/GBConv2.pdb" /machine:I386 /out:"Release/GBConv2.exe"
|
||||
.\Release\BGSaveDialog.obj
|
||||
.\Release\ChildFrm.obj
|
||||
.\Release\ChildView.obj
|
||||
.\Release\Controls.obj
|
||||
.\Release\EditArea.obj
|
||||
.\Release\EditPaletteDialog.obj
|
||||
.\Release\gb_pic.obj
|
||||
.\Release\GBConv2.obj
|
||||
.\Release\MainFrm.obj
|
||||
.\Release\PaletteButton.obj
|
||||
.\Release\PaletteListBox.obj
|
||||
.\Release\StdAfx.obj
|
||||
.\Release\wingk.obj
|
||||
.\Release\GBConv2.res
|
||||
]
|
||||
Creating command line "link.exe @C:\WINDOWS\TEMP\RSP1247.TMP"
|
||||
<h3>Output Window</h3>
|
||||
Compiling resources...
|
||||
Compiling...
|
||||
StdAfx.cpp
|
||||
Compiling...
|
||||
BGSaveDialog.cpp
|
||||
ChildFrm.cpp
|
||||
ChildView.cpp
|
||||
Controls.cpp
|
||||
EditArea.cpp
|
||||
EditPaletteDialog.cpp
|
||||
gb_pic.cpp
|
||||
GBConv2.cpp
|
||||
MainFrm.cpp
|
||||
PaletteButton.cpp
|
||||
PaletteListBox.cpp
|
||||
wingk.cpp
|
||||
Generating Code...
|
||||
Linking...
|
||||
Creating temporary file "C:\WINDOWS\TEMP\RSP1370.BAT" with contents
|
||||
[
|
||||
@echo off
|
||||
copy /y Release\*.exe .
|
||||
]
|
||||
Creating command line "C:\WINDOWS\TEMP\RSP1370.BAT"
|
||||
copy exe from Release directory
|
||||
Release\GBConv2.exe
|
||||
1 file(s) copied
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
GBConv2.exe - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,411 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||
"#ifdef _WIN32\r\n"
|
||||
"LANGUAGE 9, 1\r\n"
|
||||
"#pragma code_page(1252)\r\n"
|
||||
"#endif //_WIN32\r\n"
|
||||
"#include ""res\\GBConv2.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||
"#include ""afxres.rc"" // Standard components\r\n"
|
||||
"#endif\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON DISCARDABLE "res\\GBConv2.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Toolbar
|
||||
//
|
||||
|
||||
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
|
||||
BEGIN
|
||||
BUTTON ID_FILE_NEW
|
||||
SEPARATOR
|
||||
BUTTON ID_APP_ABOUT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_APP_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About GBConv2...", ID_APP_ABOUT
|
||||
MENUITEM "Instructions", ID_APP_INSTRUCTIONS
|
||||
END
|
||||
END
|
||||
|
||||
IDR_GBCONVTYPE MENU PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
|
||||
MENUITEM "&Close", ID_FILE_CLOSE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_APP_EXIT
|
||||
END
|
||||
POPUP "&Edit"
|
||||
BEGIN
|
||||
MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
|
||||
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
|
||||
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
|
||||
END
|
||||
POPUP "&View"
|
||||
BEGIN
|
||||
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
|
||||
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
|
||||
END
|
||||
POPUP "&Window"
|
||||
BEGIN
|
||||
MENUITEM "&Cascade", ID_WINDOW_CASCADE
|
||||
MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
|
||||
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About GBConv2...", ID_APP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
|
||||
BEGIN
|
||||
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
|
||||
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
|
||||
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
|
||||
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
|
||||
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
|
||||
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
|
||||
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 236, 55
|
||||
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About GBConv2"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
|
||||
LTEXT "GBConv2 Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
|
||||
LTEXT "Copyright (C) 2000 by Abe Pralle",IDC_STATIC,40,25,119,
|
||||
8
|
||||
DEFPUSHBUTTON "OK",IDOK,179,7,50,14,WS_GROUP
|
||||
END
|
||||
|
||||
IDD_EDIT_PALETTE DIALOG DISCARDABLE 0, 0, 231, 103
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Edit Palette"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_PAL_RED0,37,23,38,15,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_GREEN0,81,23,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_BLUE0,125,23,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_RED1,37,41,38,15,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_GREEN1,81,41,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_BLUE1,125,41,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_RED2,37,58,38,15,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_GREEN2,81,58,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_BLUE2,125,58,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_RED3,37,76,38,15,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_GREEN3,81,76,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
EDITTEXT IDC_EDIT_PAL_BLUE3,125,76,38,15,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
DEFPUSHBUTTON "OK",IDOK,174,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,174,24,50,14
|
||||
LTEXT "Color 0",IDC_STATIC,7,26,29,13
|
||||
CTEXT "Red",IDC_STATIC,41,7,28,12
|
||||
CTEXT "Green",IDC_STATIC,83,7,32,11
|
||||
CTEXT "Blue",IDC_STATIC,126,7,34,10
|
||||
LTEXT "Color 1",IDC_STATIC,7,44,29,13
|
||||
LTEXT "Color 2",IDC_STATIC,7,61,29,13
|
||||
LTEXT "Color 3",IDC_STATIC,7,79,29,13
|
||||
END
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "GBConv2 MFC Application\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||
VALUE "InternalName", "GBConv2\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2000\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "GBConv2.EXE\0"
|
||||
VALUE "ProductName", "GBConv2 Application\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 229
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 48
|
||||
END
|
||||
|
||||
IDD_EDIT_PALETTE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 224
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 96
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "GBConv2"
|
||||
IDR_GBCONVTYPE "\nGBConv\nGBConv"
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "GBConv2"
|
||||
AFX_IDS_IDLEMESSAGE "Ready"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_INDICATOR_EXT "EXT"
|
||||
ID_INDICATOR_CAPS "CAP"
|
||||
ID_INDICATOR_NUM "NUM"
|
||||
ID_INDICATOR_SCRL "SCRL"
|
||||
ID_INDICATOR_OVR "OVR"
|
||||
ID_INDICATOR_REC "REC"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_FILE_NEW "Create a new document\nNew"
|
||||
ID_FILE_CLOSE "Close the active document\nClose"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
||||
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
||||
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
|
||||
ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
|
||||
ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
|
||||
ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
|
||||
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_EDIT_CLEAR "Erase the selection\nErase"
|
||||
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
||||
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
|
||||
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
|
||||
ID_EDIT_FIND "Find the specified text\nFind"
|
||||
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
|
||||
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
|
||||
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
|
||||
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
|
||||
ID_EDIT_UNDO "Undo the last action\nUndo"
|
||||
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
||||
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCSIZE "Change the window size"
|
||||
AFX_IDS_SCMOVE "Change the window position"
|
||||
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
|
||||
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
|
||||
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
|
||||
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
|
||||
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCRESTORE "Restore the window to normal size"
|
||||
AFX_IDS_SCTASKLIST "Activate Task List"
|
||||
AFX_IDS_MDICHILD "Activate this window"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE 9, 1
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
#include "res\GBConv2.rc2" // non-Microsoft Visual C++ edited resources
|
||||
#include "afxres.rc" // Standard components
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
// MainFrm.cpp : implementation of the CMainFrame class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
|
||||
#include "MainFrm.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame
|
||||
|
||||
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
|
||||
//{{AFX_MSG_MAP(CMainFrame)
|
||||
ON_WM_CREATE()
|
||||
//}}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()
|
||||
{
|
||||
}
|
||||
|
||||
CMainFrame::~CMainFrame()
|
||||
{
|
||||
}
|
||||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
|
||||
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
||||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
||||
{
|
||||
TRACE0("Failed to create toolbar\n");
|
||||
return -1; // fail to create
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
||||
EnableDocking(CBRS_ALIGN_ANY);
|
||||
DockControlBar(&m_wndToolBar);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
if( !CMDIFrameWnd::PreCreateWindow(cs) )
|
||||
return FALSE;
|
||||
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
|
||||
| WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMainFrame::AssertValid() const
|
||||
{
|
||||
CMDIFrameWnd::AssertValid();
|
||||
}
|
||||
|
||||
void CMainFrame::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CMDIFrameWnd::Dump(dc);
|
||||
}
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame message handlers
|
||||
|
||||
|
||||
void CMainFrame::ShowStatus(CString *st)
|
||||
{
|
||||
if(IsWindow(m_wndStatusBar.m_hWnd)){
|
||||
m_wndStatusBar.SetWindowText(*st);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
// MainFrm.h : interface of the CMainFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MAINFRM_H__2F0A9B48_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_MAINFRM_H__2F0A9B48_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class CMainFrame : public CMDIFrameWnd
|
||||
{
|
||||
DECLARE_DYNAMIC(CMainFrame)
|
||||
public:
|
||||
CMainFrame();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainFrame)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
void ShowStatus(CString *st);
|
||||
virtual ~CMainFrame();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
CToolBar m_wndToolBar;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MAINFRM_H__2F0A9B48_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,33 @@
|
|||
// PaletteButton.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
#include "PaletteButton.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPaletteButton
|
||||
|
||||
CPaletteButton::CPaletteButton()
|
||||
{
|
||||
}
|
||||
|
||||
CPaletteButton::~CPaletteButton()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPaletteButton, CButton)
|
||||
//{{AFX_MSG_MAP(CPaletteButton)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPaletteButton message handlers
|
|
@ -0,0 +1,48 @@
|
|||
#if !defined(AFX_PALETTEBUTTON_H__74CE4C52_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_PALETTEBUTTON_H__74CE4C52_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// PaletteButton.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPaletteButton window
|
||||
|
||||
class CPaletteButton : public CButton
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CPaletteButton();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPaletteButton)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CPaletteButton();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CPaletteButton)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PALETTEBUTTON_H__74CE4C52_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,126 @@
|
|||
// PaletteListBox.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBConv2.h"
|
||||
#include "PaletteListBox.h"
|
||||
#include "gb_pic.h"
|
||||
#include "ChildView.h"
|
||||
#include "Controls.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPaletteListBox
|
||||
|
||||
CPaletteListBox::CPaletteListBox()
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<17; i++) itemSelected[i] = 0;
|
||||
pic = 0;
|
||||
}
|
||||
|
||||
CPaletteListBox::~CPaletteListBox()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPaletteListBox, CListBox)
|
||||
//{{AFX_MSG_MAP(CPaletteListBox)
|
||||
ON_WM_CREATE()
|
||||
ON_CONTROL_REFLECT(LBN_SELCHANGE, OnSelchange)
|
||||
ON_WM_ERASEBKGND()
|
||||
//}}AFX_MSG_MAP
|
||||
ON_LBN_SELCHANGE(IDLIST_PALETTES, OnSelchange)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPaletteListBox message handlers
|
||||
|
||||
void CPaletteListBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
|
||||
{
|
||||
lpMeasureItemStruct->itemWidth = 64;
|
||||
lpMeasureItemStruct->itemHeight = 16;
|
||||
}
|
||||
|
||||
void CPaletteListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
{
|
||||
CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||
|
||||
int index = this->GetItemData(lpDrawItemStruct->itemID);
|
||||
if(index < 0 || index>15) return;
|
||||
|
||||
if(lpDrawItemStruct->itemState & ODS_SELECTED){
|
||||
pic->SetCurPalette(index);
|
||||
}
|
||||
|
||||
CRect rect = lpDrawItemStruct->rcItem;
|
||||
int x = rect.left;
|
||||
int y = rect.top;
|
||||
|
||||
CBrush black((int) 0);
|
||||
CBrush white(0xffffff);
|
||||
//CBrush bgColor(pDC->GetBkColor());
|
||||
CBrush bgColor(0x303030);
|
||||
|
||||
gkRGB *pal = view->pic.GetPalette(index);
|
||||
|
||||
int i;
|
||||
for(i=0; i<4; i++){
|
||||
gkRGB color = pal[i];
|
||||
if(color.GetA()==0){
|
||||
//blit the "no color" image
|
||||
//pic->nonColorBG.BlitToDC(pDC, x+3, y+3);
|
||||
pic->nonColorBG.BlitToHDC(*pDC, x+3, y+3);
|
||||
}else{
|
||||
pDC->FillSolidRect(x+3,y+3,10,10,color);
|
||||
}
|
||||
pDC->FrameRect(CRect(x+2,y+2,x+14,y+14), &black);
|
||||
x += 16;
|
||||
}
|
||||
|
||||
//clear the frame to the bg color
|
||||
//pDC->FrameRect(rect, &bgColor);
|
||||
|
||||
if(lpDrawItemStruct->itemState & ODS_SELECTED){
|
||||
itemSelected[index] = 1;
|
||||
pDC->FrameRect(rect, &white);
|
||||
}else{
|
||||
itemSelected[index] = 0;
|
||||
pDC->FrameRect(rect, &bgColor);
|
||||
}
|
||||
}
|
||||
|
||||
int CPaletteListBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CListBox::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
controls = (CControls*) this->GetParent();
|
||||
view = (CChildView*) controls->GetParent();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CPaletteListBox::OnSelchange()
|
||||
{
|
||||
this->MessageBox("Super Duper!");
|
||||
}
|
||||
|
||||
|
||||
BOOL CPaletteListBox::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
|
||||
pDC->FillSolidRect(&rect, 0x303030);
|
||||
return 1;
|
||||
|
||||
//return CListBox::OnEraseBkgnd(pDC);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#if !defined(AFX_PALETTELISTBOX_H__74CE4C4B_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_PALETTELISTBOX_H__74CE4C4B_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// PaletteListBox.h : header file
|
||||
//
|
||||
|
||||
#include "gb_pic.h"
|
||||
|
||||
class CChildView;
|
||||
class CControls;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPaletteListBox window
|
||||
|
||||
class CPaletteListBox : public CListBox
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CPaletteListBox();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPaletteListBox)
|
||||
public:
|
||||
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
|
||||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
CChildView *view;
|
||||
CControls *controls;
|
||||
gbPic * pic;
|
||||
virtual ~CPaletteListBox();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
int itemSelected[17];
|
||||
//{{AFX_MSG(CPaletteListBox)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnSelchange();
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PALETTELISTBOX_H__74CE4C4B_0DAC_11D4_B6CE_525400E2D57B__INCLUDED_)
|
|
@ -0,0 +1,8 @@
|
|||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// GBConv2.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__2F0A9B46_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
||||
#define AFX_STDAFX_H__2F0A9B46_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__2F0A9B46_0CC2_11D4_B6CE_525400E2D57B__INCLUDED_)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,196 @@
|
|||
#ifndef GB_PIC_H
|
||||
#define GB_PIC_H
|
||||
|
||||
#include "wingk.h"
|
||||
|
||||
#define TILE_PAL0 0
|
||||
#define TILE_X 16
|
||||
#define TILE_BORDER 17
|
||||
|
||||
struct HashEntry{
|
||||
short int hash;
|
||||
short int index;
|
||||
|
||||
HashEntry(){ hash = index = -1; }
|
||||
};
|
||||
|
||||
class Open8BitHashTable{
|
||||
protected:
|
||||
HashEntry *table;
|
||||
int size;
|
||||
int entryPoint[256];
|
||||
|
||||
public:
|
||||
Open8BitHashTable();
|
||||
~Open8BitHashTable();
|
||||
void Reset();
|
||||
void Create(int maxElements);
|
||||
int SetFirstIndex(int code);
|
||||
int GetNextIndex(int &position);
|
||||
void Add(int code, int index);
|
||||
};
|
||||
|
||||
class gbPic;
|
||||
|
||||
class gbTile : public gkWinShape{
|
||||
protected:
|
||||
int paletteUsed;
|
||||
int colorsUsed;
|
||||
gkRGB *colors, *palettePtr;
|
||||
gkBYTE rawData[16];
|
||||
int dataHash;
|
||||
int tileIndex;
|
||||
|
||||
public:
|
||||
gbTile();
|
||||
~gbTile();
|
||||
void Reset();
|
||||
|
||||
inline int GetColorsUsed(){ return colorsUsed; }
|
||||
inline int GetPaletteUsed(){ return paletteUsed; }
|
||||
inline gkRGB *GetColors(){ return colors; }
|
||||
inline int GetDataHash(){ return dataHash; }
|
||||
inline void SetTileIndex(int i){ tileIndex = i; }
|
||||
inline int GetTileIndex(){ return tileIndex; }
|
||||
|
||||
void OnColorChange();
|
||||
int OnPaletteChange(int palettes);
|
||||
|
||||
int TestMatch(gkRGB *palette);
|
||||
void UsePalette(int palNum, gkRGB *palette);
|
||||
int HasColor(gkRGB color);
|
||||
|
||||
int GetShape(gkWinShape *srcShape, int x, int y, int w, int h);
|
||||
void RemapColor(gkRGB oldColor, gkRGB newColor);
|
||||
void ExchangeColors(gkRGB c1, gkRGB c2);
|
||||
|
||||
void MakeRawData(gbPic *pic);
|
||||
void SetRawData(gkBYTE *data);
|
||||
inline gkBYTE *GetRawData(){ return rawData; }
|
||||
void CreateFromRawData(gbPic *pic);
|
||||
int CompareRawData(gkBYTE *data2);
|
||||
void SetPaletteUsed(gbPic *pic, int n);
|
||||
void CopyRawDataTo(gkBYTE *dest);
|
||||
void WriteRawData(ostream &out);
|
||||
};
|
||||
|
||||
class gbSprite : public gkWinShape{
|
||||
protected:
|
||||
gkRGB *palette;
|
||||
int xp, yp, paletteNum;
|
||||
gkBYTE rawData[32];
|
||||
|
||||
public:
|
||||
gbSprite();
|
||||
~gbSprite();
|
||||
void Reset();
|
||||
void Create8x16FromSelection(int x1, int y1, gbTile *tile1, gbTile *tile2,
|
||||
gkWinShape *selection, gbPic *pic);
|
||||
void Blit(gkWinShape *dest);
|
||||
void DrawFrame(gkWinShape *dest, int magnification);
|
||||
int ExistsAtIndex(int i, int j);
|
||||
int Unmake(gbPic *pic);
|
||||
void WriteTileDefinitions(ostream &out);
|
||||
void ReadTileDefinitions(istream &in);
|
||||
void WriteAttributes(ostream &out, int index);
|
||||
void ReadAttributes(istream &in, gbPic *pic);
|
||||
void CreateFromRawData();
|
||||
void MakeRawData();
|
||||
};
|
||||
|
||||
|
||||
class gbPic{
|
||||
friend class gbSprite;
|
||||
protected:
|
||||
int tileWidth, tileHeight, totalTiles;
|
||||
int displayWidth, displayHeight;
|
||||
int magnification; //24:8, $100=100%, $80=50%, $200=200%
|
||||
int showGrid;
|
||||
|
||||
gbTile *tiles;
|
||||
int *selected;
|
||||
int dragSetOrClear, dragStart_i, dragStart_j;
|
||||
|
||||
gkWinShape displayBuffer, backbuffer, magnifiedArea;
|
||||
gkWinShape pixelBuffer, selectionBuffer;
|
||||
static gkWinShape nonPictureBG, gfxTiles[20];
|
||||
|
||||
int needsRedraw;
|
||||
gkRGB palettes[16*4];
|
||||
|
||||
gkRGB selectedColors[56], bgColor;
|
||||
int numSelColors;
|
||||
int numSelTiles;
|
||||
int curPalette;
|
||||
|
||||
int numSprites;
|
||||
gbSprite *sprites[40];
|
||||
|
||||
int numUniqueTiles, fileSize;
|
||||
|
||||
public:
|
||||
static gkWinShape nonColorBG;
|
||||
|
||||
gbPic();
|
||||
~gbPic();
|
||||
void Reset();
|
||||
|
||||
int LoadBMP(char *filename);
|
||||
void Redraw(int flags);
|
||||
gkWinShape *GetDisplayBuffer(int showSprites);
|
||||
gkWinShape *GetMagnifiedArea(int x, int y);
|
||||
void SetMagnification(int n);
|
||||
gkRGB GetColor(int pal, int n);
|
||||
void SetColor(int pal, int n, gkRGB c);
|
||||
int GetSelected(int i, int j);
|
||||
void GetIndicesAtPoint(int x, int y, int &i, int &j);
|
||||
gkRGB GetColorAtPoint(int x, int y);
|
||||
int GetMappingAtPoint(int x, int y);
|
||||
void OnMouseLMB(int x, int y);
|
||||
void OnMouseLDrag(int x, int y);
|
||||
void OnMouseLRelease(int x, int y);
|
||||
void SetFirstColor(gkRGB c);
|
||||
void AddNextColor(gkRGB c);
|
||||
void RemoveColor(gkRGB c);
|
||||
void ClearSelection();
|
||||
|
||||
void RemapSelectedToBGColor();
|
||||
void SwapSelectedWithBGColor();
|
||||
void AutoMapToPalette(int palettes);
|
||||
void MapToPalette(int palettes);
|
||||
void Unmap();
|
||||
void SelectNonEmpty();
|
||||
void SelectUnmapped();
|
||||
void MakeSprites();
|
||||
int FindBestSpritePalette(gkRGB *pal, int numColors);
|
||||
int UnmakeSprite(int x, int y);
|
||||
void SavePaletteInfo(ostream &out);
|
||||
void SaveGBSprite(const char *filename);
|
||||
int LoadGBSprite(const char *filename);
|
||||
void SaveGBPic(const char *filename);
|
||||
int LoadGBPic(const char *filename);
|
||||
void AutoMap(int usePalettes);
|
||||
|
||||
inline int GetTileWidth(){ return tileWidth; }
|
||||
inline int GetTileHeight(){ return tileHeight; }
|
||||
inline int GetDisplayWidth(){ return displayWidth; }
|
||||
inline int GetDisplayHeight(){ return displayHeight; }
|
||||
inline void SetNeedsRedraw(){ needsRedraw = 1; }
|
||||
inline int GetNeedsRedraw(){ return needsRedraw; }
|
||||
inline int GetMagnification(){ return magnification; }
|
||||
inline gkRGB *GetPalettes(){ return palettes; }
|
||||
inline gkRGB *GetPalette(int pal){ return &palettes[pal*4]; }
|
||||
inline gkRGB *GetSelectedColors(){ return selectedColors; }
|
||||
inline int GetNumSelectedColors(){ return numSelColors; }
|
||||
inline void SetBGColor(gkRGB c){ bgColor = c; }
|
||||
inline gkRGB GetBGColor(){ return bgColor; }
|
||||
inline void SetCurPalette(int n){ curPalette = n; }
|
||||
inline int GetCurPalette(){ return curPalette; }
|
||||
inline int GetNumSprites(){ return numSprites; }
|
||||
inline int GetNumSelTiles(){ return numSelTiles; }
|
||||
inline int GetNumUniqueTiles(){ return numUniqueTiles; }
|
||||
inline int GetFileSize(){ return fileSize; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// GBCONV2.RC2 - resources Microsoft Visual C++ does not edit directly
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error this file is not editable by Microsoft Visual C++
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Add manually edited resources here...
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
Binary file not shown.
After Width: | Height: | Size: 358 B |
|
@ -0,0 +1,49 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by GBConv2.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDB_PALETTEFROMSEL 101
|
||||
#define IDB_SETTOBGCOLOR 102
|
||||
#define IDB_SWAPWITHBGCOLOR 103
|
||||
#define IDB_AUTOMAPTOPALETTE 104
|
||||
#define IDB_SELECTNONEMPTY 105
|
||||
#define IDB_UNMAP 106
|
||||
#define IDB_MAKESPRITES 107
|
||||
#define IDLIST_PALETTES 108
|
||||
#define IDB_SHOWSPRITES 109
|
||||
#define IDB_SELECTUNMAPPED 110
|
||||
#define IDB_SAVEGBSPRITE 111
|
||||
#define IDB_EDITPALETTE 112
|
||||
#define IDB_AUTOMAPALL 113
|
||||
#define IDB_SAVEGBPIC 114
|
||||
#define IDB_SHOWMAPPING 115
|
||||
#define IDB_MAPTOPALETTE 116
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_GBCONVTYPE 129
|
||||
#define IDD_EDIT_PALETTE 130
|
||||
#define IDC_EDIT_PAL_RED0 1001
|
||||
#define IDC_EDIT_PAL_GREEN0 1002
|
||||
#define IDC_EDIT_PAL_BLUE0 1003
|
||||
#define IDC_EDIT_PAL_RED1 1004
|
||||
#define IDC_EDIT_PAL_GREEN1 1005
|
||||
#define IDC_EDIT_PAL_BLUE1 1006
|
||||
#define IDC_EDIT_PAL_RED2 1007
|
||||
#define IDC_EDIT_PAL_GREEN2 1008
|
||||
#define IDC_EDIT_PAL_BLUE2 1009
|
||||
#define IDC_EDIT_PAL_RED3 1010
|
||||
#define IDC_EDIT_PAL_GREEN3 1011
|
||||
#define IDC_EDIT_PAL_BLUE3 1012
|
||||
#define ID_APP_INSTRUCTIONS 32771
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 32772
|
||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||
#define _APS_NEXT_SYMED_VALUE 117
|
||||
#endif
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,187 @@
|
|||
#ifndef WINGK_H
|
||||
#define WINGK_H
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <iostream.h>
|
||||
#include <fstream.h>
|
||||
#include <strstrea.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef unsigned char gkBYTE;
|
||||
typedef short int gkWORD;
|
||||
typedef int gkLONG;
|
||||
|
||||
#define GKHANDLE_TL 0
|
||||
#define GKHANDLE_TC 1
|
||||
#define GKHANDLE_TR 2
|
||||
#define GKHANDLE_CR 3
|
||||
#define GKHANDLE_BR 4
|
||||
#define GKHANDLE_BC 5
|
||||
#define GKHANDLE_BL 6
|
||||
#define GKHANDLE_CL 7
|
||||
#define GKHANDLE_CENTER 8
|
||||
|
||||
#define GKBLT_TRANSPARENT 1
|
||||
|
||||
class gkIO{
|
||||
public:
|
||||
inline static int ReadByte(istream &in){ return in.get(); }
|
||||
static int ReadWord(istream &in);
|
||||
static int ReadLong(istream &in);
|
||||
static char *ReadString(istream &in);
|
||||
static char *ReadNewString(istream &in);
|
||||
inline static void WriteByte(ostream &out, int n){ out << (char) n; }
|
||||
static void WriteLong(ostream &out, int n);
|
||||
static void WriteWord(ostream &out, int n);
|
||||
static void WriteString(ostream &out, char *st);
|
||||
};
|
||||
|
||||
struct gkRGB_4bytes{
|
||||
unsigned char b, g, r, a;
|
||||
};
|
||||
|
||||
union gkRGB_ColorUnion{
|
||||
gkRGB_4bytes bytes;
|
||||
gkLONG argb;
|
||||
};
|
||||
|
||||
class gkRGB{
|
||||
public:
|
||||
gkRGB_ColorUnion color;
|
||||
|
||||
inline gkRGB(){ color.argb = 0xff000000; }
|
||||
inline gkRGB(int _r, int _g, int _b, int _a=255){
|
||||
color.bytes.r=_r; color.bytes.g=_g; color.bytes.b=_b; color.bytes.a=_a;}
|
||||
inline void SetR(gkBYTE n){ color.bytes.r = n; }
|
||||
inline void SetG(gkBYTE n){ color.bytes.g = n; }
|
||||
inline void SetB(gkBYTE n){ color.bytes.b = n; }
|
||||
inline void SetA(gkBYTE n){ color.bytes.a = n; }
|
||||
inline void SetARGB(gkLONG n){ color.argb = n; }
|
||||
inline gkBYTE GetR(){ return color.bytes.r; }
|
||||
inline gkBYTE GetG(){ return color.bytes.g; }
|
||||
inline gkBYTE GetB(){ return color.bytes.b; }
|
||||
inline gkBYTE GetA(){ return color.bytes.a; }
|
||||
inline gkLONG GetARGB(){ return color.argb; }
|
||||
inline int operator==(gkRGB &c2){
|
||||
return ((color.argb & 0xffffff) == (c2.color.argb & 0xffffff)); }
|
||||
inline int Equals(int _r, int _g, int _b);
|
||||
void Combine(gkRGB c2, int alpha);
|
||||
operator COLORREF();
|
||||
};
|
||||
|
||||
class gkPalGenItem{
|
||||
protected:
|
||||
gkRGB color;
|
||||
int occurrences;
|
||||
gkPalGenItem *nextItem;
|
||||
|
||||
public:
|
||||
gkPalGenItem(gkRGB _color);
|
||||
~gkPalGenItem();
|
||||
inline gkRGB GetColor();
|
||||
inline void AddOccurrence();
|
||||
inline int GetOccurrences();
|
||||
inline void SetOccurrences(int n);
|
||||
inline void SetNextItem(gkPalGenItem *item);
|
||||
inline gkPalGenItem *GetNextItem();
|
||||
int GetCount();
|
||||
static int SortCallback(const void *e1, const void *e2);
|
||||
};
|
||||
|
||||
class gkPaletteGenerator{
|
||||
protected:
|
||||
gkPalGenItem *colorCube[13*4];
|
||||
|
||||
public:
|
||||
gkPaletteGenerator();
|
||||
~gkPaletteGenerator();
|
||||
void Reset();
|
||||
void AddColor(gkRGB color);
|
||||
int GetNumColors();
|
||||
void CreatePalette(gkRGB *palette, int numEntries);
|
||||
int GetHash(gkRGB color);
|
||||
int ColorExists(gkRGB color);
|
||||
gkRGB MatchColor(gkRGB color);
|
||||
};
|
||||
|
||||
class gkTransparencyTable{
|
||||
protected:
|
||||
gkBYTE *lookup;
|
||||
|
||||
public:
|
||||
gkTransparencyTable();
|
||||
~gkTransparencyTable();
|
||||
inline int LookupTransparencyOffset(int baseOffset, int alpha);
|
||||
};
|
||||
|
||||
class gkWinShape{
|
||||
friend class gkRGB;
|
||||
|
||||
protected:
|
||||
gkBYTE *data;
|
||||
int width, height;
|
||||
char bpp, fontSpacing, fontKerning;
|
||||
short int x_handle, y_handle;
|
||||
static gkTransparencyTable tranTable;
|
||||
|
||||
public:
|
||||
gkWinShape();
|
||||
~gkWinShape();
|
||||
|
||||
inline gkBYTE* GetData(){ return data; }
|
||||
|
||||
void FreeData();
|
||||
inline void Reset(){ FreeData(); }
|
||||
void Create(int _width, int _height);
|
||||
HBITMAP GetDIB(HDC hdc);
|
||||
void Cls();
|
||||
void Cls(gkRGB color);
|
||||
void Plot(int x, int y, gkRGB color, int testBoundaries=1);
|
||||
gkRGB Point(int x, int y, int testBoundaries=1);
|
||||
void Line(int x1, int y1, int x2, int y2, gkRGB color);
|
||||
void LineAlpha(int x1, int y1, int x2, int y2, gkRGB color, int alpha);
|
||||
void RectFrame(int x, int y, int w, int h, gkRGB color);
|
||||
void RectFill(int x, int y, int w, int h, gkRGB color);
|
||||
void RectFillAlpha(int x, int y, int w, int h, gkRGB color, int alpha);
|
||||
void RectFillChannel(int x, int y, int w, int h, gkRGB color, int mask);
|
||||
void FloodFill(int x, int y, gkRGB color);
|
||||
void RemapColor(gkRGB oldColor, gkRGB newColor);
|
||||
int GetNumColors();
|
||||
int GetPalette(gkRGB *palette, int maxColors);
|
||||
void RemapToPalette(gkRGB *palette, int numColors);
|
||||
void ReduceColors(int numColors);
|
||||
void ExchangeColors(gkRGB c1, gkRGB c2);
|
||||
void SetAlpha(int alpha);
|
||||
void SetColorAlpha(gkRGB color, int alpha);
|
||||
|
||||
int GetShape(gkWinShape *srcShape, int x, int y, int w, int h);
|
||||
int GetShape(gkWinShape *srcShape);
|
||||
int GetShape(HDC hdc);
|
||||
int GetShape(HBITMAP bitmap);
|
||||
int SaveShape(char *filename);
|
||||
int SaveShape(ostream &outfile);
|
||||
int LoadShape(char *filename);
|
||||
int LoadShape(istream &infile);
|
||||
int LoadBMP(char *filename);
|
||||
int LoadBMP(istream &infile);
|
||||
void Blit(gkWinShape *destShape, int x, int y,
|
||||
int flags=GKBLT_TRANSPARENT);
|
||||
void BlitScale(gkWinShape *destShape, int x, int y, int scale,
|
||||
int flags=GKBLT_TRANSPARENT);
|
||||
void BlitScale(gkWinShape *destShape, int x, int y, float scale,
|
||||
int flags=GKBLT_TRANSPARENT);
|
||||
void BlitChannel(gkWinShape *destShape, int x, int y, int mask);
|
||||
void BlitToHDC(HDC hDC, int x, int y);
|
||||
|
||||
int GetWidth(){ return width; }
|
||||
int GetHeight(){ return height; }
|
||||
|
||||
//internal support routines
|
||||
static void MemCpyTrans(gkBYTE *dest, gkBYTE *src, int nBytes);
|
||||
static void BlitLineScale(gkBYTE *dest, gkBYTE *src, int pixels,int ratio);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
#ifndef WINGK_H
|
||||
#define WINGK_H
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <iostream.h>
|
||||
#include <fstream.h>
|
||||
#include <strstrea.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef unsigned char gkBYTE;
|
||||
typedef short int gkWORD;
|
||||
typedef int gkLONG;
|
||||
|
||||
#define GKHANDLE_TL 0
|
||||
#define GKHANDLE_TC 1
|
||||
#define GKHANDLE_TR 2
|
||||
#define GKHANDLE_CR 3
|
||||
#define GKHANDLE_BR 4
|
||||
#define GKHANDLE_BC 5
|
||||
#define GKHANDLE_BL 6
|
||||
#define GKHANDLE_CL 7
|
||||
#define GKHANDLE_CENTER 8
|
||||
|
||||
#define GKBLT_TRANSPARENT 1
|
||||
|
||||
class gkIO{
|
||||
public:
|
||||
inline static int ReadByte(istream &in){ return in.get(); }
|
||||
static int ReadWord(istream &in);
|
||||
static int ReadLong(istream &in);
|
||||
static char *ReadString(istream &in);
|
||||
static char *ReadNewString(istream &in);
|
||||
inline static void WriteByte(ostream &out, int n){ out << (char) n; }
|
||||
static void WriteLong(ostream &out, int n);
|
||||
static void WriteWord(ostream &out, int n);
|
||||
static void WriteString(ostream &out, char *st);
|
||||
};
|
||||
|
||||
struct gkRGB_4bytes{
|
||||
unsigned char b, g, r, a;
|
||||
};
|
||||
|
||||
union gkRGB_ColorUnion{
|
||||
gkRGB_4bytes bytes;
|
||||
gkLONG argb;
|
||||
};
|
||||
|
||||
class gkRGB{
|
||||
public:
|
||||
gkRGB_ColorUnion color;
|
||||
|
||||
inline gkRGB(){ color.argb = 0xff000000; }
|
||||
inline gkRGB(int _r, int _g, int _b, int _a=255){
|
||||
color.bytes.r=_r; color.bytes.g=_g; color.bytes.b=_b; color.bytes.a=_a;}
|
||||
inline void SetR(gkBYTE n){ color.bytes.r = n; }
|
||||
inline void SetG(gkBYTE n){ color.bytes.g = n; }
|
||||
inline void SetB(gkBYTE n){ color.bytes.b = n; }
|
||||
inline void SetA(gkBYTE n){ color.bytes.a = n; }
|
||||
inline void SetARGB(gkLONG n){ color.argb = n; }
|
||||
inline gkBYTE GetR(){ return color.bytes.r; }
|
||||
inline gkBYTE GetG(){ return color.bytes.g; }
|
||||
inline gkBYTE GetB(){ return color.bytes.b; }
|
||||
inline gkBYTE GetA(){ return color.bytes.a; }
|
||||
inline gkLONG GetARGB(){ return color.argb; }
|
||||
inline int operator==(gkRGB &c2);
|
||||
inline int Equals(int _r, int _g, int _b);
|
||||
void Combine(gkRGB c2, int alpha);
|
||||
operator COLORREF();
|
||||
};
|
||||
|
||||
class gkPalGenItem{
|
||||
protected:
|
||||
gkRGB color;
|
||||
int occurrences;
|
||||
gkPalGenItem *nextItem;
|
||||
|
||||
public:
|
||||
gkPalGenItem(gkRGB _color);
|
||||
~gkPalGenItem();
|
||||
inline gkRGB GetColor();
|
||||
inline void AddOccurrence();
|
||||
inline int GetOccurrences();
|
||||
inline void SetOccurrences(int n);
|
||||
inline void SetNextItem(gkPalGenItem *item);
|
||||
inline gkPalGenItem *GetNextItem();
|
||||
int GetCount();
|
||||
static int SortCallback(const void *e1, const void *e2);
|
||||
};
|
||||
|
||||
class gkPaletteGenerator{
|
||||
protected:
|
||||
gkPalGenItem *colorCube[13*4];
|
||||
|
||||
public:
|
||||
gkPaletteGenerator();
|
||||
~gkPaletteGenerator();
|
||||
void Reset();
|
||||
void AddColor(gkRGB color);
|
||||
int GetNumColors();
|
||||
void CreatePalette(gkRGB *palette, int numEntries);
|
||||
int GetHash(gkRGB color);
|
||||
int ColorExists(gkRGB color);
|
||||
gkRGB MatchColor(gkRGB color);
|
||||
};
|
||||
|
||||
class gkTransparencyTable{
|
||||
protected:
|
||||
gkBYTE *lookup;
|
||||
|
||||
public:
|
||||
gkTransparencyTable();
|
||||
~gkTransparencyTable();
|
||||
inline int LookupTransparencyOffset(int baseOffset, int alpha);
|
||||
};
|
||||
|
||||
class gkWinShape{
|
||||
friend class gkRGB;
|
||||
|
||||
protected:
|
||||
gkBYTE *data;
|
||||
int width, height;
|
||||
char bpp, fontSpacing, fontKerning;
|
||||
short int x_handle, y_handle;
|
||||
static gkTransparencyTable tranTable;
|
||||
|
||||
HBITMAP GetDIB(CDC *pDC);
|
||||
|
||||
public:
|
||||
gkWinShape();
|
||||
~gkWinShape();
|
||||
|
||||
inline gkBYTE* GetData(){ return data; }
|
||||
|
||||
void FreeData();
|
||||
inline void Reset(){ FreeData(); }
|
||||
void Create(int _width, int _height);
|
||||
void Cls();
|
||||
void Cls(gkRGB color);
|
||||
void Plot(int x, int y, gkRGB color, int testBoundaries=1);
|
||||
gkRGB Point(int x, int y, int testBoundaries=1);
|
||||
void Line(int x1, int y1, int x2, int y2, gkRGB color);
|
||||
void LineAlpha(int x1, int y1, int x2, int y2, gkRGB color, int alpha);
|
||||
void RectFrame(int x, int y, int w, int h, gkRGB color);
|
||||
void RectFill(int x, int y, int w, int h, gkRGB color);
|
||||
void RectFillAlpha(int x, int y, int w, int h, gkRGB color, int alpha);
|
||||
void RectFillChannel(int x, int y, int w, int h, gkRGB color, int mask);
|
||||
void RemapColor(gkRGB oldColor, gkRGB newColor);
|
||||
int GetNumColors();
|
||||
int GetPalette(gkRGB *palette, int maxColors);
|
||||
void RemapToPalette(gkRGB *palette, int numColors);
|
||||
void ReduceColors(int numColors);
|
||||
void ExchangeColors(gkRGB c1, gkRGB c2);
|
||||
void SetAlpha(int alpha);
|
||||
void SetColorAlpha(gkRGB color, int alpha);
|
||||
|
||||
int GetShape(gkWinShape *srcShape, int x, int y, int w, int h);
|
||||
int GetShape(gkWinShape *srcShape);
|
||||
int SaveShape(char *filename);
|
||||
int SaveShape(ostream &outfile);
|
||||
int LoadShape(char *filename);
|
||||
int LoadShape(istream &infile);
|
||||
int LoadBMP(char *filename);
|
||||
int LoadBMP(istream &infile);
|
||||
void Blit(gkWinShape *destShape, int x, int y,
|
||||
int flags=GKBLT_TRANSPARENT);
|
||||
void BlitScale(gkWinShape *destShape, int x, int y, int scale,
|
||||
int flags=GKBLT_TRANSPARENT);
|
||||
void BlitScale(gkWinShape *destShape, int x, int y, float scale,
|
||||
int flags=GKBLT_TRANSPARENT);
|
||||
void BlitChannel(gkWinShape *destShape, int x, int y, int mask);
|
||||
void BlitToDC(CDC *pDC, int x, int y);
|
||||
|
||||
int GetWidth(){ return width; }
|
||||
int GetHeight(){ return height; }
|
||||
|
||||
//internal support routines
|
||||
static void MemCpyTrans(gkBYTE *dest, gkBYTE *src, int nBytes);
|
||||
static void BlitLineScale(gkBYTE *dest, gkBYTE *src, int pixels,int ratio);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue