Added new headers to all the .cxx and .hxx files with updated

copyright information.

Fixed the bug in StellaX where pressing the close button in the title
bar would not call the MainDlg::Quit() method (and hence not save
certain settings and free some memory).

Cleaned up the formatting of most of the source code, which was honestly
in such a sorry state that parts of it were difficult to read.

Got rid of CSimpleString class and references that were no longer used.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@318 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2004-07-15 03:03:27 +00:00
parent 17e7653f34
commit e44e59cc13
33 changed files with 2009 additions and 2134 deletions

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,18 +14,20 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutPage.cxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
// $Id: AboutPage.cxx,v 1.2 2004-07-15 03:03:26 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "AboutPage.hxx"
#include "resource.h"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHelpPage::CHelpPage()
: CPropertyPage(IDD_ABOUT_PAGE)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CHelpPage::OnInitDialog( HWND hwnd )
{
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,11 +14,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutPage.hxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
// $Id: AboutPage.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef ABOUTPG_H
#define ABOUTPG_H
#ifndef ABOUT_PAGE_HXX
#define ABOUT_PAGE_HXX
#include "PropertySheet.hxx"
#include "HyperLink.hxx"

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1998 Scott D. Killen
// Copyright (c) 2004 by Stephen Anthony
@ -14,13 +14,13 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: BrowseForFolder.cxx,v 1.3 2004-07-06 22:51:58 stephena Exp $
// $Id: BrowseForFolder.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "BrowseForFolder.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CBrowseForFolder::CBrowseForFolder(
const HWND hParent,
const LPITEMIDLIST pidl,
@ -37,15 +37,18 @@ CBrowseForFolder::CBrowseForFolder(
myBrowseInfo.lpfn = BrowseCallbackProc;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CBrowseForFolder::~CBrowseForFolder()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPCTSTR CBrowseForFolder::GetSelectedFolder() const
{
return mySelected;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CBrowseForFolder::SelectFolder()
{
bool bRet = false;
@ -53,12 +56,8 @@ bool CBrowseForFolder::SelectFolder()
LPITEMIDLIST pidl;
if ((pidl = SHBrowseForFolder(&myBrowseInfo)) != NULL)
{
myPath.Set( _T("") );
if (SUCCEEDED(SHGetPathFromIDList(pidl, mySelected)))
{
bRet = true;
myPath.Set( mySelected );
}
LPMALLOC pMalloc;
//Retrieve a pointer to the shell's IMalloc interface
@ -75,11 +74,13 @@ bool CBrowseForFolder::SelectFolder()
return bRet;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::OnSelChanged(const LPITEMIDLIST pidl) const
{
(void)pidl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::EnableOK(const bool bEnable) const
{
if (myHwnd == NULL)
@ -89,6 +90,7 @@ void CBrowseForFolder::EnableOK(const bool bEnable) const
(void)SendMessage( myHwnd, BFFM_ENABLEOK, NULL, static_cast<LPARAM>(bEnable) );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
{
if (myHwnd == NULL)
@ -97,6 +99,7 @@ void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
(void)SendMessage(myHwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast<LPARAM>(pidl));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::SetSelection(LPCTSTR strPath) const
{
if (myHwnd == NULL)
@ -105,6 +108,7 @@ void CBrowseForFolder::SetSelection(LPCTSTR strPath) const
(void)SendMessage(myHwnd, BFFM_SETSELECTION, TRUE, reinterpret_cast<LPARAM>(strPath));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
CBrowseForFolder* pbff = reinterpret_cast<CBrowseForFolder*>( lpData );

View File

@ -1,28 +1,27 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1998 Scott D. Killen
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: BrowseForFolder.hxx,v 1.3 2004-07-06 22:51:58 stephena Exp $
// $Id: BrowseForFolder.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef __BROWSE_FOR_FOLDER_
#define __BROWSE_FOR_FOLDER_
#ifndef BROWSE_FOR_FOLDER_HXX
#define BROWSE_FOR_FOLDER_HXX
#include <shlobj.h>
class CBrowseForFolder
{
public:
@ -69,7 +68,6 @@ class CBrowseForFolder
BROWSEINFO myBrowseInfo;
char mySelected[MAX_PATH];
CSimpleString myPath;
HWND myHwnd;
};

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,12 +14,9 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ConfigPage.cxx,v 1.4 2004-07-11 03:13:24 stephena Exp $
// $Id: ConfigPage.cxx,v 1.5 2004-07-15 03:03:27 stephena Exp $
//============================================================================
//#define WINVER 0x0501
//#include <afxcmn.h>
#include "pch.hxx"
#include "ConfigPage.hxx"
#include "resource.h"
@ -28,13 +25,14 @@
#include "bspf.hxx"
#include "Settings.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CConfigPage::CConfigPage( CGlobalData& rGlobalData )
: myGlobalData( rGlobalData ),
CPropertyPage( IDD_CONFIG_PAGE )
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CConfigPage::OnInitDialog( HWND hwnd )
{
m_hwnd = hwnd;
@ -132,10 +130,12 @@ BOOL CConfigPage::OnInitDialog( HWND hwnd )
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CConfigPage::OnDestroy( void )
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
{
UNUSED_ALWAYS( lppsn );
@ -243,6 +243,7 @@ LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
return PSNRET_NOERROR;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
{
UNUSED_ALWAYS( wNotifyCode );

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,11 +14,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ConfigPage.hxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
// $Id: ConfigPage.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef CONFIGPG_H
#define CONFIGPG_H
#ifndef CONFIG_PAGE_HXX
#define CONFIG_PAGE_HXX
#include "PropertySheet.hxx"
#include "GlobalData.hxx"

View File

@ -1,58 +1,63 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CoolCaption.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "CoolCaption.hxx"
// MAKE SURE STYLE IS JUST "TITLE BAR" !
CCoolCaption::CCoolCaption(
) : \
m_hfont( NULL ),
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCoolCaption::CCoolCaption()
: m_hfont( NULL ),
m_tszCaption( NULL ),
m_fIsActive( FALSE ),
m_hDlg( NULL )
{
}
void CCoolCaption::OnInitDialog(
HWND hDlg
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnInitDialog( HWND hDlg )
{
m_hDlg = hDlg;
CalculateNCArea();
}
void CCoolCaption::OnDestroy(
void
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnDestroy( void )
{
if ( m_hDlg == NULL )
{
return;
}
if ( m_hfont )
{
::DeleteObject( m_hfont );
}
DeleteObject( m_hfont );
delete[] m_tszCaption;
m_tszCaption = NULL;
}
void CCoolCaption::CalculateNCArea(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::CalculateNCArea()
{
if ( m_hDlg == NULL )
{
return;
}
::GetWindowRect(m_hDlg, &m_rcWindow);
GetWindowRect(m_hDlg, &m_rcWindow);
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
@ -64,11 +69,9 @@ void CCoolCaption::CalculateNCArea(
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
// This is the size of the caption
::SetRect(&m_rcCaption, 0, 0, m_cxWindow, cyCaption + m_cyFrame);
SetRect(&m_rcCaption, 0, 0, m_cxWindow, cyCaption + m_cyFrame);
// calculate position of buttons
SetRect(&m_rcClose,
m_cxWindow - m_cxFrame - m_cxButtonSize + 1,
m_rcCaption.top + m_cyFrame + 1,
@ -80,7 +83,6 @@ void CCoolCaption::CalculateNCArea(
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
// figure out union of all buttons
RECT rcButtons;
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
@ -88,7 +90,6 @@ void CCoolCaption::CalculateNCArea(
rcButtons.left-m_cxFrame, m_rcCaption.bottom-m_cyFrame);
// Make bold caption font
m_hfont = (HFONT)SendMessage(m_hDlg, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(m_hfont, sizeof(lf), &lf);
@ -96,28 +97,22 @@ void CCoolCaption::CalculateNCArea(
m_hfont = CreateFontIndirect(&lf);
// Get caption text
int nCaptionLength = GetWindowTextLength(m_hDlg);
m_tszCaption = new TCHAR[nCaptionLength + 2];
GetWindowText(m_hDlg, m_tszCaption, nCaptionLength+1);
}
void CCoolCaption::OnNcPaint(
HRGN hrgn
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnNcPaint( HRGN hrgn )
{
UNUSED_ALWAYS( hrgn );
if ( m_hDlg == NULL )
{
return;
}
HDC hdc = GetWindowDC(m_hDlg);
// Fill in the NC area with the proper color
HPEN hpen, hpenOld;
hpen = CreatePen(PS_SOLID, 1, m_fIsActive ?
@ -130,14 +125,12 @@ void CCoolCaption::OnNcPaint(
if (x < m_cxFrame-1 || x > m_cxWindow-m_cxFrame)
{
// left, right must go from top to bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcWindow.bottom);
}
else
{
// otherwise just do top and bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcCaption.bottom);
@ -150,15 +143,12 @@ void CCoolCaption::OnNcPaint(
DeleteObject(hpen);
// Draw the close button
DrawFrameControl(hdc, &m_rcClose, DFC_CAPTION, DFCS_CAPTIONCLOSE);
// draw the minimize button
DrawFrameControl(hdc, &m_rcMin, DFC_CAPTION, DFCS_CAPTIONMIN);
// Draw the caption text
SetTextColor(hdc, m_fIsActive ? GetSysColor(COLOR_CAPTIONTEXT) : \
GetSysColor(COLOR_INACTIVECAPTIONTEXT));
SetBkMode(hdc, TRANSPARENT);
@ -166,7 +156,6 @@ void CCoolCaption::OnNcPaint(
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
// calculate width / height of text
SIZE sizeText;
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
@ -177,11 +166,9 @@ void CCoolCaption::OnNcPaint(
SelectObject(hdc, hfontOld);
// Draw the docking grippers
const int nTextRight = m_rcTextArea.left + sizeText.cx + m_cxFrame;
// right top
COLORREF cr3dHilight = GetSysColor(COLOR_3DHILIGHT);
COLORREF cr3dShadow = GetSysColor(COLOR_3DSHADOW);
@ -190,7 +177,6 @@ void CCoolCaption::OnNcPaint(
cr3dHilight, cr3dShadow);
// right bottom
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
@ -198,9 +184,8 @@ void CCoolCaption::OnNcPaint(
ReleaseDC(m_hDlg, hdc);
}
void CCoolCaption::OnNcActivate(
BOOL fActive
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnNcActivate( BOOL fActive )
{
if (m_hDlg == NULL)
return;
@ -208,25 +193,19 @@ void CCoolCaption::OnNcActivate(
m_fIsActive = fActive;
// This fixes a problem where alt-tab wont repaint the NC area
RedrawWindow(m_hDlg, NULL, NULL,
RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
}
BOOL CCoolCaption::OnNCLButtonDown(
INT nHitTest,
POINTS pts
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CCoolCaption::OnNCLButtonDown( INT nHitTest, POINTS pts )
{
UNUSED_ALWAYS( nHitTest );
if ( m_hDlg == NULL )
{
return FALSE;
}
// Get the point in client units
RECT rcWindow;
GetWindowRect(m_hDlg, &rcWindow);
@ -236,9 +215,7 @@ BOOL CCoolCaption::OnNCLButtonDown(
if (PtInRect(&m_rcClose, pt))
{
// This isn't closing it!
// SendMessage(m_hDlg, WM_CLOSE, 0, 0);
EndDialog(m_hDlg, IDCANCEL);
SendMessage(m_hDlg, WM_CLOSE, 0, 0);
return TRUE;
}
@ -251,14 +228,9 @@ BOOL CCoolCaption::OnNCLButtonDown(
return FALSE;
}
void CCoolCaption::FillSolidRect(
HDC hdc,
int x,
int y,
int cx,
int cy,
COLORREF clr
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::FillSolidRect( HDC hdc, int x, int y, int cx, int cy,
COLORREF clr )
{
COLORREF cr = SetBkColor(hdc, clr);
RECT rect = { x, y, x+cx, y+cy };
@ -266,19 +238,12 @@ void CCoolCaption::FillSolidRect(
SetBkColor(hdc, cr);
}
void CCoolCaption::Draw3dRect(
HDC hdc,
int x,
int y,
int cx,
int cy,
COLORREF clrTopLeft,
COLORREF clrBottomRight
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::Draw3dRect( HDC hdc, int x, int y, int cx, int cy,
COLORREF clrTopLeft, COLORREF clrBottomRight )
{
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
}

View File

@ -1,15 +1,28 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CoolCaption.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef COOLCAP_H
#define COOLCAP_H
#pragma once
#ifndef COOL_CAPTION_HXX
#define COOL_CAPTION_HXX
class CCoolCaption
{
public:
public:
CCoolCaption();
void OnInitDialog(HWND hDlg);
@ -19,12 +32,10 @@ public:
void OnNcActivate(BOOL);
BOOL OnNCLButtonDown(INT, POINTS);
protected:
protected:
HWND m_hDlg;
private:
private:
void CalculateNCArea(void);
void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, COLORREF clr);
void Draw3dRect(HDC hdc, int x, int y, int cx, int cy,

View File

@ -1,23 +1,25 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Game.cxx,v 1.1 2004-07-10 22:25:58 stephena Exp $
// $Id: Game.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "Game.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Game::Game( void )
{
_available = false;
@ -29,7 +31,7 @@ Game::Game( void )
_note = " ";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Game::~Game( void )
{
}

View File

@ -1,23 +1,24 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Game.hxx,v 1.1 2004-07-10 22:25:58 stephena Exp $
// $Id: Game.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef GAME_H
#define GAME_H
#ifndef GAME_HXX
#define GAME_HXX
#include "bspf.hxx"

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,7 +14,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalData.cxx,v 1.3 2004-07-10 22:25:58 stephena Exp $
// $Id: GlobalData.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
@ -25,7 +25,7 @@
#include "SettingsWin32.hxx"
#include "GlobalData.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CGlobalData::CGlobalData( HINSTANCE hInstance )
: mySettings(0),
myInstance(hInstance)
@ -34,6 +34,7 @@ CGlobalData::CGlobalData( HINSTANCE hInstance )
mySettings->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CGlobalData::~CGlobalData()
{
if(mySettings)

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,7 +14,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalData.hxx,v 1.2 2004-07-10 22:25:58 stephena Exp $
// $Id: GlobalData.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef GLOBAL_DATA_HXX

View File

@ -1,18 +1,35 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HeaderCtrl.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "HeaderCtrl.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHeaderCtrl::CHeaderCtrl()
: m_nSortCol(0),
m_fSortAsc(TRUE)
{
}
LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch ( msg )
{
@ -25,6 +42,7 @@ LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam,
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
{
m_nSortCol = nCol;
@ -42,6 +60,7 @@ void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
InvalidateRect(hwndHeader, NULL, TRUE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHeaderCtrl::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
{
UNUSED_ALWAYS( idCtl );

View File

@ -1,9 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef HDRCTL_H
#define HDRCTL_H
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HeaderCtrl.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef HEADER_CTRL_HXX
#define HEADER_CTRL_HXX
#include "Wnd.hxx"

View File

@ -1,15 +1,30 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HyperLink.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "HyperLink.hxx"
#include <shellapi.h>
CHyperLink::CHyperLink(
) : \
m_bOverControl(FALSE),
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHyperLink::CHyperLink()
: m_bOverControl(FALSE),
m_bVisited(FALSE),
m_hFont(NULL),
m_hLinkCursor(NULL)
@ -21,43 +36,35 @@ CHyperLink::CHyperLink(
SetDefaultCursor();
}
CHyperLink::~CHyperLink(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHyperLink::~CHyperLink()
{
if (m_hFont)
{
::DeleteObject( m_hFont );
DeleteObject( m_hFont );
m_hFont = NULL;
}
}
void CHyperLink::SetURL(
LPCTSTR ctszURL
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::SetURL( LPCTSTR ctszURL )
{
if (ctszURL == NULL)
return;
lstrcpy(m_tszURL, ctszURL);
}
void CHyperLink::PreSubclassWindow(
HWND hwnd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::PreSubclassWindow( HWND hwnd )
{
::GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
}
LRESULT CHyperLink::WndProc(
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::WndProc( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
@ -71,21 +78,18 @@ LRESULT CHyperLink::WndProc(
case WM_LBUTTONUP:
rfHandled = TRUE;
return OnLButtonUp(hwnd, wParam, LOWORD(lParam),
HIWORD(lParam));
return OnLButtonUp(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
case WM_MOUSEMOVE:
rfHandled = TRUE;
return OnMouseMove(hwnd, wParam, LOWORD(lParam),
HIWORD(lParam));
return OnMouseMove(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
}
return 0;
}
LRESULT CHyperLink::OnPaint(
HWND hwnd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnPaint( HWND hwnd )
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
@ -93,31 +97,21 @@ LRESULT CHyperLink::OnPaint(
SelectObject(hdc, m_hFont);
if (m_bOverControl)
{
SetTextColor(hdc, m_crHoverColor);
}
else if (m_bVisited)
{
SetTextColor(hdc, m_crVisitedColor);
}
else
{
SetTextColor(hdc, m_crLinkColor);
}
::SetBkMode( hdc, TRANSPARENT );
::TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
SetBkMode( hdc, TRANSPARENT );
TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
EndPaint(hwnd, &ps);
return 0;
}
BOOL CHyperLink::OnSetCursor(
HWND hwnd,
WORD nHittest,
WORD wMouseMsg
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CHyperLink::OnSetCursor( HWND hwnd, WORD nHittest, WORD wMouseMsg )
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( nHittest );
@ -125,19 +119,15 @@ BOOL CHyperLink::OnSetCursor(
if (m_hLinkCursor)
{
::SetCursor(m_hLinkCursor);
SetCursor(m_hLinkCursor);
return TRUE;
}
return FALSE;
}
LRESULT CHyperLink::OnLButtonUp(
HWND hwnd,
WPARAM fwKeys,
WORD xPos,
WORD yPos
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnLButtonUp( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
{
UNUSED_ALWAYS( fwKeys );
UNUSED_ALWAYS( xPos );
@ -159,17 +149,12 @@ LRESULT CHyperLink::OnLButtonUp(
return 0;
}
LRESULT CHyperLink::OnMouseMove(
HWND hwnd,
WPARAM fwKeys,
WORD xPos,
WORD yPos
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnMouseMove( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
{
UNUSED_ALWAYS( fwKeys );
// call defwindowproc?
if (m_bOverControl)
{
RECT rc;
@ -195,17 +180,14 @@ LRESULT CHyperLink::OnMouseMove(
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module
void CHyperLink::SetDefaultCursor(
void
)
void CHyperLink::SetDefaultCursor()
{
if (m_hLinkCursor == NULL) // No cursor handle - load our own
{
// Get the windows directory
TCHAR tszWndDir[MAX_PATH + 1];
GetWindowsDirectory(tszWndDir, MAX_PATH);
@ -213,7 +195,8 @@ void CHyperLink::SetDefaultCursor(
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
HMODULE hModule = LoadLibrary(tszWndDir);
if (hModule) {
if (hModule)
{
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if (hHandCursor)
m_hLinkCursor = CopyCursor(hHandCursor);
@ -222,16 +205,14 @@ void CHyperLink::SetDefaultCursor(
}
}
LONG CHyperLink::GetRegKey(
HKEY key,
LPCTSTR subkey,
LPTSTR retdata
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LONG CHyperLink::GetRegKey( HKEY key, LPCTSTR subkey, LPTSTR retdata )
{
HKEY hkey;
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
if (retval == ERROR_SUCCESS) {
if (retval == ERROR_SUCCESS)
{
long datasize = MAX_PATH;
TCHAR data[MAX_PATH];
RegQueryValue(hkey, NULL, data, &datasize);
@ -242,11 +223,11 @@ LONG CHyperLink::GetRegKey(
return retval;
}
void CHyperLink::ReportError(
int nError
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::ReportError( int nError )
{
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
switch (nError)
{
case 0:
@ -312,10 +293,8 @@ void CHyperLink::ReportError(
MessageBox(NULL, tsz, tszCaption, MB_ICONEXCLAMATION | MB_OK);
}
HINSTANCE CHyperLink::GotoURL(
LPCTSTR url,
int showcmd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HINSTANCE CHyperLink::GotoURL( LPCTSTR url, int showcmd )
{
TCHAR key[MAX_PATH + MAX_PATH];
@ -323,15 +302,18 @@ HINSTANCE CHyperLink::GotoURL(
HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL,NULL, showcmd);
// If it failed, get the .htm regkey and lookup the program
if ((UINT)result <= HINSTANCE_ERROR) {
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS) {
if ((UINT)result <= HINSTANCE_ERROR)
{
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS)
{
lstrcat(key, _T("\\shell\\open\\command"));
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) {
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
{
TCHAR *pos;
pos = _tcsstr(key, _T("\"%1\""));
if (pos == NULL) { // No quotes found
if (pos == NULL)
{ // No quotes found
pos = strstr(key, _T("%1")); // Check for %1, without quotes
if (pos == NULL) // No parameter at all...
pos = key+lstrlen(key)-1;

View File

@ -1,10 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef HYPERLINK_H
#define HYPERLINK_H
#pragma once
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HyperLink.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef HYPER_LINK_HXX
#define HYPER_LINK_HXX
#define MAX_HYPERLINK_TEXT_LEN 256
#define MAX_HYPERLINK_URL 256
@ -13,20 +27,18 @@
class CHyperLink : public CWnd
{
public:
public:
CHyperLink();
~CHyperLink();
void SetURL(LPCTSTR ctszURL);
protected:
protected:
virtual void PreSubclassWindow(HWND hwnd);
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
private:
private:
void SetDefaultCursor();
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
void ReportError(int nError);
@ -42,12 +54,10 @@ private:
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
// Stuff from the control
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
HFONT m_hFont;
// link specific
COLORREF m_crLinkColor;
COLORREF m_crVisitedColor;
COLORREF m_crHoverColor;

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,7 +14,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MainDlg.cxx,v 1.6 2004-07-15 00:11:06 stephena Exp $
// $Id: MainDlg.cxx,v 1.7 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
@ -142,10 +142,8 @@ MainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
case WM_NCLBUTTONDOWN:
return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) );
case WM_SYSCOMMAND:
// Allow Alt-F4 to close the window
if ( wParam == SC_CLOSE )
Quit(myHwnd);
case WM_CLOSE:
Quit();
break;
}
@ -277,7 +275,7 @@ BOOL MainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
break; // case IDC_PLAY
case IDC_EXIT:
Quit(hwnd);
Quit();
return TRUE;
break; // case IDC_EXIT
@ -308,8 +306,7 @@ BOOL MainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
case IDC_RELOAD:
{
LoadRomListFromDisk();
ListView_SortByColumn( myHwndList, myGlobalData.settings().getInt("sortcol") );
UpdateRomList( true );
return TRUE;
break; // case IDC_RELOAD
}
@ -457,7 +454,7 @@ HBRUSH MainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::Quit( HWND hwnd )
void MainDlg::Quit()
{
// OK, reload the settings to make sure we have the most current ones
myGlobalData.settings().loadConfig();
@ -468,26 +465,47 @@ void MainDlg::Quit( HWND hwnd )
// Save the column widths
myGlobalData.settings().setInt("namecolwidth",
ListView_GetColWidth( hwnd, 0 ));
ListView_GetColWidth( myHwnd, 0 ));
myGlobalData.settings().setInt("manufacturercolwidth",
ListView_GetColWidth( hwnd, 1 ));
ListView_GetColWidth( myHwnd, 1 ));
myGlobalData.settings().setInt("raritycolwidth",
ListView_GetColWidth( hwnd, 2 ));
ListView_GetColWidth( myHwnd, 2 ));
// Now, save the settings
myGlobalData.settings().saveConfig();
ListView_Clear();
EndDialog( hwnd, IDCANCEL );
EndDialog( myHwnd, IDCANCEL );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::UpdateRomList( void )
void MainDlg::UpdateRomList( bool forceReload )
{
HWND hwndText;
RECT rc;
TCHAR psz[256 + 1];
TCHAR pszStatus[256 + 1];
PopulateRomList();
// Erase status text
LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256);
wsprintf( psz, pszStatus, 0 );
hwndText = GetDlgItem( *this, IDC_ROMCOUNT );
GetWindowRect(hwndText, &rc);
ScreenToClient( *this, (LPPOINT)&rc );
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
SetWindowText( hwndText, psz );
InvalidateRect( *this, &rc, TRUE );
// Erase rom path
hwndText = GetDlgItem( *this, IDC_ROMPATH );
GetWindowRect(hwndText, &rc);
ScreenToClient( *this, (LPPOINT)&rc );
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
SetWindowText( hwndText, "" );
InvalidateRect( *this, &rc, TRUE );
// Get the ROM gamelist, either from disk or cache
PopulateRomList( forceReload );
// if items added, select first item and enable play button
int nCount = ListView_GetItemCount( myHwndList );
@ -495,8 +513,6 @@ void MainDlg::UpdateRomList( void )
EnableWindow(GetDlgItem( *this, IDC_PLAY), FALSE );
// Show status text
TCHAR psz[256 + 1];
TCHAR pszStatus[256 + 1];
LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256);
wsprintf( psz, pszStatus, nCount );
hwndText = GetDlgItem( *this, IDC_ROMCOUNT );
@ -516,13 +532,15 @@ void MainDlg::UpdateRomList( void )
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool MainDlg::PopulateRomList( void )
bool MainDlg::PopulateRomList( bool forceReload )
{
bool result = false;
bool cacheFileExists = myGlobalData.settings().fileExists("stellax.cache");
bool cacheIsStale = false; // FIXME - add romdir status checking
if (cacheFileExists && !cacheIsStale)
if (forceReload)
result = LoadRomListFromDisk();
else if (cacheFileExists && !cacheIsStale)
{
result = LoadRomListFromCache();
if (!result)

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,11 +14,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MainDlg.hxx,v 1.5 2004-07-15 00:11:07 stephena Exp $
// $Id: MainDlg.hxx,v 1.6 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef __MAINDLG_H_
#define __MAINDLG_H_
#ifndef MAIN_DLG_HXX
#define MAIN_DLG_HXX
#include "resource.h"
@ -30,7 +30,6 @@ class CGlobalData;
#include "HeaderCtrl.hxx"
#include "RoundButton.hxx"
class MainDlg
{
public:
@ -70,6 +69,7 @@ class MainDlg
void OnDestroy( void );
void OnNcPaint( HRGN hrgn );
void OnNcActivate( BOOL fActive );
void Quit();
BOOL OnNcLButtonDown( INT nHitTest, POINTS pts );
// callback methods
@ -78,13 +78,11 @@ class MainDlg
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
// internal data
void UpdateRomList();
bool PopulateRomList();
void UpdateRomList( bool forceReload = false );
bool PopulateRomList( bool forceReload = false );
bool LoadRomListFromDisk();
bool LoadRomListFromCache();
void Quit( HWND hwnd );
HINSTANCE myHInstance;
HWND myHwndList;

View File

@ -1,13 +1,28 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/02/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PropertySheet.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "PropertySheet.hxx"
#pragma comment(lib, "comctl32")
#include <pshpack1.h>
typedef struct DLGTEMPLATEEX
{
WORD dlgVer;
@ -21,12 +36,11 @@ typedef struct DLGTEMPLATEEX
short cx;
short cy;
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
#include <poppack.h>
CPropertyPage::CPropertyPage(
UINT nIDTemplate,
UINT nIDCaption /* = 0 */
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertyPage::CPropertyPage( UINT nIDTemplate, UINT nIDCaption /* = 0 */ )
{
UNUSED_ALWAYS( nIDCaption );
@ -40,11 +54,9 @@ CPropertyPage::CPropertyPage(
m_psp.pfnCallback = StaticCallback;
}
UINT CALLBACK CPropertyPage::StaticCallback(
HWND hwnd,
UINT uMsg,
LPPROPSHEETPAGE ppsp
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UINT CALLBACK
CPropertyPage::StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp )
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( ppsp );
@ -62,12 +74,9 @@ UINT CALLBACK CPropertyPage::StaticCallback(
return 0;
}
BOOL CALLBACK CPropertyPage::StaticDlgProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
CPropertyPage::StaticDlgProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
CPropertyPage* pPage = NULL;
@ -76,30 +85,22 @@ BOOL CALLBACK CPropertyPage::StaticDlgProc(
case WM_INITDIALOG:
pPage = reinterpret_cast<CPropertyPage*>(
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
(void)::SetWindowLong( hwnd,
DWL_USER,
reinterpret_cast<LONG>( pPage ) );
(void)::SetWindowLong( hwnd, DWL_USER, reinterpret_cast<LONG>( pPage ) );
break;
default:
pPage = reinterpret_cast<CPropertyPage*>(
::GetWindowLong( hwnd, DWL_USER ) );
pPage = reinterpret_cast<CPropertyPage*>( GetWindowLong( hwnd, DWL_USER ) );
if ( pPage == NULL )
{
return FALSE;
}
break;
}
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
}
BOOL CALLBACK CPropertyPage::DlgProc(
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
CPropertyPage::DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch (msg)
{
@ -120,44 +121,34 @@ BOOL CALLBACK CPropertyPage::DlgProc(
case WM_NOTIFY:
// Handle PSN_QUERYCANCEL?
// Handle PSN_KILLACTIVE?
switch (((LPNMHDR)lParam)->code)
{
case PSN_SETACTIVE:
::SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_KILLACTIVE:
::SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_APPLY:
::SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
return TRUE;
case PSN_RESET:
OnReset( (LPPSHNOTIFY)lParam );
return TRUE;
}
return OnNotify( (int)wParam, (LPNMHDR)lParam );
}
return FALSE;
}
//
// CPropertySheet
//
CPropertySheet::CPropertySheet
(
LPCTSTR pszCaption,
HWND hwndParent,
UINT nStartPage /* = 0 */
) :\
m_strCaption( pszCaption )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertySheet::CPropertySheet( LPCTSTR pszCaption, HWND hwndParent,
UINT nStartPage /* = 0 */ )
: m_strCaption( pszCaption )
{
ZeroMemory(&m_psh, sizeof(m_psh));
m_psh.dwSize = sizeof(m_psh);
@ -169,33 +160,27 @@ CPropertySheet::CPropertySheet
m_psh.pfnCallback = StaticCallback;
}
CPropertySheet::~CPropertySheet(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertySheet::~CPropertySheet()
{
// BUGBUG: This is static!
/*
if ( m_hfontLogo )
/* if ( m_hfontLogo )
{
::DeleteObject( m_hfontLogo );
DeleteObject( m_hfontLogo );
m_hfontLogo = NULL;
}
*/
}*/
}
void CPropertySheet::AddPage(
CPropertyPage* pPage
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPropertySheet::AddPage( CPropertyPage* pPage )
{
if (pPage)
{
m_pages.push_back(pPage);
}
}
int CPropertySheet::DoModal(
void
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CPropertySheet::DoModal()
{
int nSize = m_pages.size();
@ -220,11 +205,9 @@ int CPropertySheet::DoModal(
return nRet;
}
int CALLBACK CPropertySheet::StaticCallback(
HWND hwnd,
UINT uMsg,
LPARAM lParam
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CALLBACK
CPropertySheet::StaticCallback( HWND hwnd, UINT uMsg, LPARAM lParam )
{
UNUSED_ALWAYS( hwnd );
@ -232,28 +215,18 @@ int CALLBACK CPropertySheet::StaticCallback(
{
case PSCB_INITIALIZED:
// Property sheet is being initialized
return TRUE;
case PSCB_PRECREATE:
// Property sheet is about to be created
//
// Remove the DS_CONTEXTHELP style from the dialog template
// (This will remove the "?" in the top right corner)
//
if ( ( (LPDLGTEMPLATEEX)lParam )->signature == 0xFFFF)
{
( (LPDLGTEMPLATEEX)lParam )->style &= ~DS_CONTEXTHELP;
}
else
{
( (LPDLGTEMPLATE)lParam )->style &= ~DS_CONTEXTHELP;
}
return TRUE;
return TRUE;
}
return 0;

View File

@ -1,10 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/02/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef PROPSHT_H
#define PROPSHT_H
#pragma once
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PropertySheet.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef PROPERTY_SHEET_HXX
#define PROPERTY_SHEET_HXX
#include <prsht.h>
#include <vector>
@ -12,62 +26,33 @@
class CPropertyPage
{
public:
public:
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
const PROPSHEETPAGE* GetPropSheetPage();
protected:
//
protected:
// Overridable callbacks
//
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized ) {}
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized )
{
}
virtual BOOL OnInitDialog( HWND /* hwnd */ ) { return FALSE; }
virtual BOOL OnInitDialog( HWND /* hwnd */ )
{
return FALSE;
}
virtual void OnDestroy( void ) {}
virtual void OnDestroy( void )
{
}
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ ) { return 0; }
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ )
{
return 0;
}
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ ) { return FALSE; }
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ )
{
return FALSE;
}
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ ) { return PSNRET_NOERROR; }
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ )
{
return PSNRET_NOERROR;
}
virtual void OnReset( LPPSHNOTIFY /* lppsn */ ) {}
virtual void OnReset( LPPSHNOTIFY /* lppsn */ )
{
}
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */,
HWND /* hwndCtl */ ) { return FALSE; }
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ )
{
return FALSE;
}
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ )
{
return FALSE;
}
private:
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ ) { return FALSE; }
private:
static UINT CALLBACK StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
static BOOL CALLBACK StaticDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
@ -79,25 +64,21 @@ private:
void operator=( const CPropertyPage& ); // no implementation
};
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage(
void
)
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage()
{
return &m_psp;
}
class CPropertySheet
{
public:
public:
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 );
~CPropertySheet( );
void AddPage( CPropertyPage* pPage );
virtual int DoModal( void );
private:
private:
static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam );
PROPSHEETHEADER m_psh;

View File

@ -1,7 +1,22 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RoundButton.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "RoundButton.hxx"
#include <math.h>
@ -19,7 +34,6 @@ void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius,
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
COLORREF crBright, COLORREF crDark);
// Calculate colour for a point at the given angle by performing a linear
// interpolation between the colours crBright and crDark based on the cosine
// of the angle between the light source and the point.
@ -27,25 +41,24 @@ void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
// Angles are measured from the +ve x-axis (i.e. (1,0) = 0 degrees, (0,1) = 90 degrees )
// But remember: +y points down!
COLORREF GetColour(
double dAngle,
COLORREF crBright,
COLORREF crDark
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
COLORREF GetColour( double dAngle, COLORREF crBright, COLORREF crDark )
{
#define Rad2Deg 180.0/3.1415
#define Rad2Deg 180.0/3.1415
// For better light-continuity along the edge of a stretched button:
// LIGHT_SOURCE_ANGLE == -1.88
// For better light-continuity along the edge of a stretched button:
// LIGHT_SOURCE_ANGLE == -1.88
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
#define LIGHT_SOURCE_ANGLE -1.88
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
#define LIGHT_SOURCE_ANGLE -1.88
ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
double dAngleDifference = LIGHT_SOURCE_ANGLE - dAngle;
if (dAngleDifference < -3.1415) dAngleDifference = 6.293 + dAngleDifference;
else if (dAngleDifference > 3.1415) dAngleDifference = 6.293 - dAngleDifference;
if (dAngleDifference < -3.1415)
dAngleDifference = 6.293 + dAngleDifference;
else if (dAngleDifference > 3.1415)
dAngleDifference = 6.293 - dAngleDifference;
double Weight = 0.5*(cos(dAngleDifference)+1.0);
@ -59,24 +72,20 @@ COLORREF GetColour(
return RGB(Red, Green, Blue);
}
void DrawCircle(
HDC hdc,
const POINT& p,
LONG lRadius,
COLORREF crColour,
BOOL bDashed
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DrawCircle( HDC hdc, const POINT& p, LONG lRadius, COLORREF crColour,
BOOL bDashed )
{
const int nDashLength = 1;
LONG lError, lXoffset, lYoffset;
int nDash = 0;
BOOL bDashOn = TRUE;
//Check to see that the coordinates are valid
// Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
// Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
@ -85,20 +94,20 @@ void DrawCircle(
{
if (bDashOn)
{
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
}
//Advance the error term and the constant X axis step
// Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
// Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
@ -107,179 +116,147 @@ void DrawCircle(
nDash = 0;
bDashOn = !bDashOn;
}
} while (lYoffset <= lXoffset); //Continue until halfway point
} while (lYoffset <= lXoffset); // Continue until halfway point
}
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
// to make stretched buttons
void DrawCircleRight(
HDC hdc,
const POINT& p,
LONG lRadius,
COLORREF crBright,
COLORREF crDark
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The original Drawcircle function is split up into DrawCircleRight and
// DrawCircleLeft to make stretched buttons
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius, COLORREF crBright,
COLORREF crDark )
{
LONG lError, lXoffset, lYoffset;
//Check to see that the coordinates are valid
// Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
// Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
const double Pi = 3.141592654,
Pi_on_2 = Pi * 0.5;
const double Pi = 3.141592654, Pi_on_2 = Pi * 0.5;
COLORREF crColour;
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
//Draw the current pixel, reflected across all four arcs
// Draw the current pixel, reflected across all four arcs
crColour = GetColour(dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
crColour = GetColour(-dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
//Advance the error term and the constant X axis step
// Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
// Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); //Continue until halfway point
} while (lYoffset <= lXoffset); // Continue until halfway point
}
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
// to make stretched buttons
void DrawCircleLeft(
HDC hdc,
const POINT& p,
LONG lRadius,
COLORREF crBright,
COLORREF crDark
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The original Drawcircle function is split up into DrawCircleRight and
// DrawCircleLeft to make stretched buttons
void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius, COLORREF crBright,
COLORREF crDark )
{
LONG lError, lXoffset, lYoffset;
//Check to see that the coordinates are valid
// Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
// Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
const double Pi = 3.141592654,
Pi_on_2 = Pi * 0.5;
const double Pi = 3.141592654, Pi_on_2 = Pi * 0.5;
COLORREF crColour;
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
//Draw the current pixel, reflected across all eight arcs
// Draw the current pixel, reflected across all eight arcs
crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(Pi - dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(-Pi + dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
//Advance the error term and the constant X axis step
// Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
// Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); //Continue until halfway point
} while (lYoffset <= lXoffset); // Continue until halfway point
}
/////////////////////////////////////////////////////////////////////////////
static void ClientToScreen(
HWND hwnd,
LPRECT lpRect
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void ClientToScreen( HWND hwnd, LPRECT lpRect )
{
::ClientToScreen(hwnd, (LPPOINT)lpRect);
::ClientToScreen(hwnd, ((LPPOINT)lpRect)+1);
ClientToScreen(hwnd, (LPPOINT)lpRect);
ClientToScreen(hwnd, ((LPPOINT)lpRect)+1);
}
static void ScreenToClient(
HWND hwnd,
LPRECT lpRect
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void ScreenToClient( HWND hwnd, LPRECT lpRect )
{
::ScreenToClient(hwnd, (LPPOINT)lpRect);
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
ScreenToClient(hwnd, (LPPOINT)lpRect);
ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
}
static void FillSolidRect(
HDC hdc,
LPCRECT lpRect,
COLORREF clr
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void FillSolidRect( HDC hdc, LPCRECT lpRect, COLORREF clr )
{
COLORREF crOld = ::SetBkColor(hdc, clr);
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
::SetBkColor(hdc, crOld);
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
SetBkColor(hdc, crOld);
}
//////////////////////////////////////////////////////////////////////////////
CRoundButton::CRoundButton(
) : \
m_hrgn( NULL ),
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CRoundButton::CRoundButton()
: m_hrgn( NULL ),
m_fDrawDashedFocusCircle( TRUE ),
m_fStretch( FALSE )
{
}
CRoundButton::~CRoundButton(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CRoundButton::~CRoundButton()
{
if ( m_hrgn )
{
::DeleteObject( m_hrgn );
}
DeleteObject( m_hrgn );
}
void CRoundButton::PreSubclassWindow(
HWND hwnd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CRoundButton::PreSubclassWindow( HWND hwnd )
{
RECT rect;
::GetClientRect( hwnd, &rect );
GetClientRect( hwnd, &rect );
m_fStretch = (rect.right-rect.left) > (rect.bottom-rect.top);
if ( ! m_fStretch )
{
rect.bottom = rect.right = min ( rect.bottom, rect.right );
}
m_ptCenter.x = m_ptLeft.x = m_ptRight.x = ((rect.right-rect.left)/2);
m_ptCenter.y = m_ptLeft.y = m_ptRight.y = ((rect.bottom-rect.top)/2);
@ -289,32 +266,24 @@ void CRoundButton::PreSubclassWindow(
m_ptLeft.x = m_nRadius;
m_ptRight.x = rect.right - m_nRadius - 1;
::SetWindowRgn( hwnd, NULL, FALSE );
SetWindowRgn( hwnd, NULL, FALSE );
m_hrgn = ::CreateEllipticRgnIndirect( &rect );
::SetWindowRgn( hwnd, m_hrgn, TRUE );
SetWindowRgn( hwnd, m_hrgn, TRUE );
::ClientToScreen( hwnd, &rect );
ClientToScreen( hwnd, &rect );
HWND hwndParent = ::GetParent( hwnd );
if ( hwndParent )
{
::ScreenToClient( hwndParent, &rect );
}
ScreenToClient( hwndParent, &rect );
if ( ! m_fStretch )
{
::MoveWindow( hwnd, rect.left, rect.top,
MoveWindow( hwnd, rect.left, rect.top,
rect.right-rect.left, rect.bottom-rect.top, TRUE );
}
}
LRESULT CRoundButton::WndProc(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CRoundButton::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
@ -331,11 +300,8 @@ LRESULT CRoundButton::WndProc(
return 0;
}
void CRoundButton::OnDrawItem(
HWND hwnd,
UINT idCtl,
LPDRAWITEMSTRUCT lpdis
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CRoundButton::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
{
UNUSED_ALWAYS( idCtl );
@ -347,81 +313,67 @@ void CRoundButton::OnDrawItem(
int nSavedDC = ::SaveDC( hdc );
::SelectObject( hdc, ::GetStockObject( NULL_BRUSH ) );
::FillSolidRect( hdc, &rect, ::GetSysColor(COLOR_BTNFACE) );
SelectObject( hdc, ::GetStockObject( NULL_BRUSH ) );
FillSolidRect( hdc, &rect, ::GetSysColor(COLOR_BTNFACE) );
// Draw the focus circle around the button for non-stretched buttons
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
{
DrawCircle( hdc, m_ptCenter, nRadius--, RGB( 0, 0, 0) );
}
// Draw the raised/sunken edges of the button (unless flat)
if ( nStyle & BS_FLAT )
{
if ( m_fStretch )
{
// for stretched buttons: draw left and right arcs and connect the with lines
HPEN hpenOld;
RECT rectLeftBound;
::SetRect( &rectLeftBound, 0, 0, nRadius*2, nRadius*2 );
SetRect( &rectLeftBound, 0, 0, nRadius*2, nRadius*2 );
RECT rectRightBound;
::SetRect( &rectRightBound, m_ptRight.x-nRadius, 0, m_ptRight.x+nRadius, nRadius*2 );
SetRect( &rectRightBound, m_ptRight.x-nRadius, 0, m_ptRight.x+nRadius, nRadius*2 );
hpenOld = (HPEN)::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
::Arc( hdc,
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
m_ptLeft.x, 0,
m_ptLeft.x, nRadius*2 );
Arc( hdc, rectLeftBound.left, rectLeftBound.top, rectLeftBound.right,
rectLeftBound.bottom, m_ptLeft.x, 0, m_ptLeft.x, nRadius*2 );
::Arc( hdc,
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
m_ptRight.x, nRadius*2,
m_ptRight.x, 0 );
Arc( hdc, rectRightBound.left, rectRightBound.top, rectRightBound.right,
rectRightBound.bottom, m_ptRight.x, nRadius*2, m_ptRight.x, 0 );
::MoveToEx( hdc, m_ptLeft.x, 0, NULL );
::LineTo( hdc, m_ptRight.x, 0 );
MoveToEx( hdc, m_ptLeft.x, 0, NULL );
LineTo( hdc, m_ptRight.x, 0 );
::MoveToEx( hdc, m_ptLeft.x, nRadius*2-1, NULL );
::LineTo( hdc, m_ptRight.x, nRadius*2-1 );
MoveToEx( hdc, m_ptLeft.x, nRadius*2-1, NULL );
LineTo( hdc, m_ptRight.x, nRadius*2-1 );
nRadius--;
::InflateRect( &rectLeftBound, -1, -1 );
::InflateRect( &rectRightBound, -1, -1 );
InflateRect( &rectLeftBound, -1, -1 );
InflateRect( &rectRightBound, -1, -1 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
::Arc( hdc,
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
m_ptLeft.x, 1,
m_ptLeft.x, nRadius*2 );
Arc( hdc, rectLeftBound.left, rectLeftBound.top, rectLeftBound.right,
rectLeftBound.bottom, m_ptLeft.x, 1, m_ptLeft.x, nRadius*2 );
::Arc( hdc,
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
m_ptRight.x, nRadius*2,
m_ptRight.x, 0 );
Arc( hdc, rectRightBound.left, rectRightBound.top, rectRightBound.right,
rectRightBound.bottom, m_ptRight.x, nRadius*2, m_ptRight.x, 0 );
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
::LineTo( hdc, m_ptRight.x, 1 );
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
LineTo( hdc, m_ptRight.x, 1 );
::MoveToEx( hdc, m_ptLeft.x, nRadius*2, NULL );
::LineTo( hdc, m_ptRight.x, nRadius*2 );
MoveToEx( hdc, m_ptLeft.x, nRadius*2, NULL );
LineTo( hdc, m_ptRight.x, nRadius*2 );
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
else
{
// for non-stretched buttons: draw two circles
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DHIGHLIGHT) );
}
@ -431,128 +383,116 @@ void CRoundButton::OnDrawItem(
if (state & ODS_SELECTED)
{
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft( hdc, m_ptLeft, nRadius,
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
DrawCircleRight( hdc, m_ptRight, nRadius,
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
DrawCircleLeft( hdc, m_ptLeft, nRadius-1,
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
DrawCircleRight( hdc, m_ptRight, nRadius-1,
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
if ( m_fStretch )
{
// draw connecting lines for stretched buttons only
HPEN hpenOld;
hpenOld = (HPEN)::SelectObject( hdc,
(HPEN)::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
::LineTo( hdc, m_ptRight.x, 1 );
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
LineTo( hdc, m_ptRight.x, 1 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW) ) ) );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW) ) ) );
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
::LineTo( hdc, m_ptRight.x, 2 );
MoveToEx( hdc, m_ptLeft.x, 2, NULL );
LineTo( hdc, m_ptRight.x, 2 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DLIGHT ) ) ) );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DLIGHT ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius-1, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius-1 );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius-1, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius-1 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
}
else
{
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft( hdc, m_ptLeft, nRadius,
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircleRight( hdc, m_ptRight, nRadius,
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircleLeft( hdc, m_ptLeft, nRadius - 1,
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
DrawCircleRight( hdc, m_ptRight, nRadius - 1,
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
// draw connecting lines for stretch buttons
if ( m_fStretch )
{
HPEN hpenOld;
hpenOld = (HPEN)::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, 1 ) ) );
CreatePen( PS_SOLID, 1,
GetPixel( hdc, m_ptLeft.x, 1 ) ) );
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
::LineTo( hdc, m_ptRight.x , 1);
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
LineTo( hdc, m_ptRight.x , 1);
::DeleteObject( ::SelectObject( hdc,
DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, 2 ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
::LineTo( hdc, m_ptRight.x, 2 );
MoveToEx( hdc, m_ptLeft.x, 2, NULL );
LineTo( hdc, m_ptRight.x, 2 );
::DeleteObject( ::SelectObject( hdc,
DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
::DeleteObject( ::SelectObject( hdc,
DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius-1 ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius - 1, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius - 1 );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius - 1, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius - 1 );
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
}
}
// Draw the text if there is any
TCHAR pszText[ 256 ];
int cch = ::GetWindowText( hwnd, pszText, 255 );
if ( cch != 0 )
{
HRGN hrgn;
if ( m_fStretch )
{
hrgn = ::CreateRectRgn( m_ptLeft.x - nRadius / 2, m_ptCenter.y - nRadius,
hrgn = CreateRectRgn( m_ptLeft.x - nRadius / 2, m_ptCenter.y - nRadius,
m_ptRight.x + nRadius / 2, m_ptCenter.y + nRadius );
}
else
{
hrgn = CreateEllipticRgn( m_ptCenter.x - nRadius, m_ptCenter.y - nRadius,
m_ptCenter.x + nRadius, m_ptCenter.y + nRadius );
}
::SelectClipRgn( hdc, hrgn );
SelectClipRgn( hdc, hrgn );
SIZE size;
::GetTextExtentPoint32( hdc, pszText, cch, &size );
GetTextExtentPoint32( hdc, pszText, cch, &size );
POINT pt = { m_ptCenter.x - size.cx / 2, m_ptCenter.y - size.cy / 2 - 1 };
POINT pt2 = { m_ptCenter.x + size.cx/2, m_ptCenter.y + size.cy/2 + 1 };
@ -563,63 +503,51 @@ void CRoundButton::OnDrawItem(
++( pt.y );
}
::SetBkMode( hdc, TRANSPARENT );
SetBkMode( hdc, TRANSPARENT );
#if 0
if ( state & ODS_DISABLED )
{
::DrawState( hdc, NULL, NULL, (LPARAM)pszText, (WPARAM)cch,
DrawState( hdc, NULL, NULL, (LPARAM)pszText, (WPARAM)cch,
pt.x, pt.y, size.cx, size.cy, DSS_DISABLED );
}
else
#endif
{
// give text a 3d-look
RECT pos;
::SetRect( &pos, pt.x, pt.y, pt2.x, pt2.y );
SetRect( &pos, pt.x, pt.y, pt2.x, pt2.y );
COLORREF crOld = ::SetTextColor( hdc,
COLORREF crOld = SetTextColor( hdc,
( state & ODS_DISABLED ) ?
::GetSysColor( COLOR_GRAYTEXT ) :
::GetSysColor( COLOR_WINDOWTEXT ) );
GetSysColor( COLOR_GRAYTEXT ) :
GetSysColor( COLOR_WINDOWTEXT ) );
if ( state & ODS_FOCUS )
{
LOGFONT lf;
::GetObject( (HFONT)::SendMessage( hwnd, WM_GETFONT, 0, 0 ),
sizeof(LOGFONT), &lf );
GetObject( (HFONT)::SendMessage( hwnd, WM_GETFONT, 0, 0 ), sizeof(LOGFONT), &lf );
lf.lfWeight = FW_BOLD;
HFONT hfontOld = (HFONT)::SelectObject( hdc, ::CreateFontIndirect( &lf ) );
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
::DeleteObject( ::SelectObject( hdc, hfontOld) );
DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
DeleteObject( ::SelectObject( hdc, hfontOld) );
}
else
{
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
SetTextColor( hdc, crOld );
}
::SetTextColor( hdc, crOld );
}
::SelectClipRgn( hdc, NULL );
SelectClipRgn( hdc, NULL );
DeleteObject( hrgn );
}
#if 0
// draw the focus circle on the inside
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
{
DrawCircle( hdc, m_ptCenter, nRadius-2, RGB(0, 0, 0), TRUE );
}
#endif
::RestoreDC( hdc, nSavedDC );
RestoreDC( hdc, nSavedDC );
}

View File

@ -1,27 +1,38 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef RNDBUT_H
#define RNDBUT_H
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RoundButton.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef ROUND_BUTTON_HXX
#define ROUND_BUTTON_HXX
#include "Wnd.hxx"
class CRoundButton : public CWnd
{
public:
public:
CRoundButton();
~CRoundButton();
protected:
LRESULT WndProc( HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam, BOOL& fHandled );
protected:
LRESULT WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled );
virtual void PreSubclassWindow(HWND hwnd);
private:
private:
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
HRGN m_hrgn;

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,7 +14,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: StellaXMain.cxx,v 1.4 2004-07-10 22:25:58 stephena Exp $
// $Id: StellaXMain.cxx,v 1.5 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include <iostream>
@ -28,15 +28,17 @@
#include "pch.hxx"
#include "StellaXMain.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CStellaXMain::CStellaXMain()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CStellaXMain::~CStellaXMain()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CStellaXMain::PlayROM( string& romfile, CGlobalData& globaldata )
{
ostringstream buf;

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,11 +14,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: StellaXMain.hxx,v 1.3 2004-07-10 22:25:58 stephena Exp $
// $Id: StellaXMain.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef STELLAX_H
#define STELLAX_H
#ifndef STELLAX_MAIN_HXX
#define STELLAX_MAIN_HXX
#include "bspf.hxx"

View File

@ -1,31 +1,39 @@
//============================================================================
//
// StellaX
// Jeff Miller 10/12/1999
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TextButton3d.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "TextButton3d.hxx"
// button style should be VISIBLE / DISABLED / OWNERDRAW
CTextButton3d::CTextButton3d
(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CTextButton3d::CTextButton3d()
{
}
LRESULT CTextButton3d::WndProc
(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CTextButton3d::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
#if 0
// TODO: re do this now that I send this message here
case WM_DRAWITEM:
rfHandled = TRUE;
@ -46,11 +54,8 @@ LRESULT CTextButton3d::WndProc
return 0;
}
void CTextButton3d::OnPaint
(
HWND hwnd,
HDC hdcPaint
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CTextButton3d::OnPaint( HWND hwnd, HDC hdcPaint )
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
@ -96,16 +101,11 @@ void CTextButton3d::OnPaint
cyClient = rcClient.bottom - rcClient.top;
SIZE sizeTextClient;
GetTextExtentPoint(hdc, text, lstrlen(text),
&sizeTextClient);
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
{
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
}
else
{
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
}
lf.lfHeight--;
@ -119,8 +119,7 @@ void CTextButton3d::OnPaint
hfont = CreateFontIndirect(&lf);
SelectObject(hdc, hfont);
GetTextExtentPoint(hdc, text, lstrlen(text),
&sizeTextClient);
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
@ -137,7 +136,6 @@ void CTextButton3d::OnPaint
cy += 3;
// draw 3D highlights
SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW));
TextOut(hdc, cx-s*2, cy+s*2, text, lstrlen(text));
TextOut(hdc, cx+s*2, cy-s*2, text, lstrlen(text));
@ -157,11 +155,9 @@ void CTextButton3d::OnPaint
SetTextColor(hdc, crText);
// draw the text
TextOut(hdc, cx, cy, text, lstrlen(text));
// restore dc
SetTextColor(hdc, crOldText);
SetBkMode(hdc, iOldBkMode);
SelectObject(hdc, hfontOld);
@ -174,13 +170,9 @@ void CTextButton3d::OnPaint
EndPaint(hwnd, &ps);
}
BOOL CTextButton3d::OnEraseBkgnd
(
HWND hwnd,
HDC hdc
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CTextButton3d::OnEraseBkgnd( HWND hwnd, HDC hdc )
{
// dont do any erasing
return TRUE;
}

View File

@ -1,10 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef TXTBTN_H
#define TXTBTN_H
#pragma once
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TextButton3d.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef TEXT_BUTTON_HXX
#define TEXT_BUTTON_HXX
// derived from Roger Onslow's code
@ -12,17 +26,13 @@
class CTextButton3d : public CWnd
{
public:
public:
CTextButton3d();
protected:
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
private:
protected:
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled);
private:
void OnPaint(HWND, HDC);
BOOL OnEraseBkgnd(HWND, HDC);

View File

@ -1,35 +1,43 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Wnd.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "Wnd.hxx"
// REVIEW: Need to reset old wnd proc?
CWnd::CWnd(
) : \
m_pOldWindowProc(NULL),
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CWnd::CWnd()
: m_pOldWindowProc(NULL),
m_hwnd(NULL)
{
}
BOOL CWnd::SubclassDlgItem(
HWND hwndParent,
UINT nID
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CWnd::SubclassDlgItem( HWND hwndParent, UINT nID )
{
if ( nID == 0 || hwndParent == NULL )
{
return FALSE;
}
// can't subclass twice!
if ( m_pOldWindowProc != NULL )
{
return FALSE;
}
m_hwnd = GetDlgItem( hwndParent, nID );
if (m_hwnd == NULL)
@ -47,19 +55,15 @@ BOOL CWnd::SubclassDlgItem(
return TRUE;
}
void CWnd::PreSubclassWindow(
HWND hwnd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CWnd::PreSubclassWindow( HWND hwnd )
{
// no default behavior
}
LRESULT CALLBACK CWnd::StaticWndProc(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CALLBACK CWnd::StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam )
{
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
@ -67,9 +71,7 @@ LRESULT CALLBACK CWnd::StaticWndProc(
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
if (fHandled)
{
return lRes;
}
return CallWindowProc( pThis->m_pOldWindowProc, hWnd, msg, wParam, lParam );
}

View File

@ -1,33 +1,40 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef WND_H
#define WND_H
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Wnd.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef WND_HXX
#define WND_HXX
class CWnd
{
public:
public:
CWnd();
BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
operator HWND() const
{
return m_hwnd;
}
protected:
operator HWND() const { return m_hwnd; }
protected:
virtual void PreSubclassWindow( HWND hwnd );
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled ) = 0;
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled ) = 0;
private:
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam );
private:
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
WNDPROC m_pOldWindowProc;
HWND m_hwnd;

View File

@ -1,7 +1,21 @@
//============================================================================
//
// StellaX
// Jeff Miller 04/27/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: debug.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "debug.hxx"
@ -11,13 +25,8 @@
extern LPCTSTR g_ctszDebugLog;
// ---------------------------------------------------------------------------
// DEBUG DEFINED
void AFX_CDECL AfxTrace(
LPCTSTR lpszFormat,
...
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AFX_CDECL AfxTrace( LPCTSTR lpszFormat, ... )
{
va_list args;
va_start(args, lpszFormat);
@ -31,9 +40,7 @@ void AFX_CDECL AfxTrace(
ASSERT(nBuf >= 0);
if (nBuf < 511)
{
lstrcat(szBuffer, _T("\r\n"));
}
_RPT0(_CRT_WARN, szBuffer);
@ -56,11 +63,9 @@ void AFX_CDECL AfxTrace(
va_end(args);
}
BOOL AFXAPI AfxAssertFailedLine(
LPCSTR lpszFileName,
int nLine,
LPCTSTR lpszCondition
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL AFXAPI AfxAssertFailedLine( LPCSTR lpszFileName, int nLine,
LPCTSTR lpszCondition )
{
// we remove WM_QUIT because if it is in the queue then the message box
// won't display
@ -72,4 +77,4 @@ BOOL AFXAPI AfxAssertFailedLine(
return bResult;
}
#endif //_DEBUG
#endif

View File

@ -1,11 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/27/1999
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: debug.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef _AFX
#define _AFX
#pragma once
#include <windows.h>
#include <tchar.h>
@ -19,7 +32,6 @@
// DEBUG_ONLY
// determine number of elements in an array (not bytes)
#define _countof(array) (sizeof(array)/sizeof(array[0]))

View File

@ -1,12 +1,12 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
@ -14,7 +14,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: main.cxx,v 1.2 2004-07-10 22:25:58 stephena Exp $
// $Id: main.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
@ -55,10 +55,10 @@ class CSingleInstance
void operator=( const CSingleInstance& ); // no implementation
};
// see debug.cpp
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPCTSTR g_ctszDebugLog = _T("stella.log");
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow )
{

View File

@ -1,57 +1,50 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: pch.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include <stdio.h>
#include <stdarg.h>
#include "resource.h"
// This will force in the DirectX library
#pragma comment( lib, "dxguid" )
// Bring in DirectInput library (for c_dfDIMouse, etc)
#pragma comment( lib, "dinput" )
// Bring in the common control library
#pragma comment( lib, "comctl32" )
// Bring in multimedia timers
#pragma comment( lib, "winmm" )
void MessageBox(
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText )
{
const int nMaxStrLen = 1024;
TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
TCHAR tszText[nMaxStrLen + 1] = { 0 };
// Caption is always "StellaX"
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
LoadString(hInstance, uIDText, tszText, nMaxStrLen);
if (hwndParent == NULL)
{
hwndParent = ::GetForegroundWindow();
}
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
}
void MessageBoxFromWinError(
DWORD dwError,
LPCTSTR pszCaption /* = NULL */
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ )
{
const int nMaxStrLen = 1024;
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
@ -64,25 +57,19 @@ void MessageBoxFromWinError(
LPTSTR pszText = NULL;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszText,
0,
NULL);
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszText, 0, NULL);
::MessageBox(::GetForegroundWindow(), pszText,
pszCaption ? pszCaption : pszCaptionStellaX, MB_ICONWARNING | MB_OK);
pszCaption ? pszCaption : pszCaptionStellaX,
MB_ICONWARNING | MB_OK);
::LocalFree( pszText );
LocalFree( pszText );
}
void MessageBoxFromGetLastError(
LPCTSTR pszCaption /* = NULL */
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ )
{
MessageBoxFromWinError( GetLastError(), pszCaption );
}

View File

@ -1,9 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef PCH_H
#define PCH_H
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: pch.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef PCH_HXX
#define PCH_HXX
#define WIN32_LEAN_AND_MEAN
#define DIRECTINPUT_VERSION 5
@ -33,90 +48,13 @@
#endif
#define UNUSED_ALWAYS(x) x
//
// Simple string class
//
class CSimpleString
{
public:
CSimpleString() :
m_psz( NULL ),
m_cch( -1 )
{
}
~CSimpleString()
{
delete[] m_psz;
m_psz = NULL;
m_cch = -1;
}
BOOL Set( LPCTSTR psz )
{
int cch = lstrlen( psz );
if ( cch > m_cch )
{
delete[] m_psz;
m_psz = NULL;
m_cch = -1;
m_psz = new TCHAR[ cch + 1 ];
if ( m_psz == NULL )
{
return FALSE;
}
m_cch = cch;
}
memcpy( m_psz, psz, ( cch + 1 ) * sizeof( TCHAR ) );
return TRUE;
}
LPCTSTR Get( void ) const
{
ASSERT( m_psz != NULL );
return m_psz;
}
int Length( void ) const
{
return m_cch;
}
private:
//
// The string and its size (-1 means not initialized)
//
LPTSTR m_psz;
int m_cch;
CSimpleString( const CSimpleString& ); // no implementation
void operator=( const CSimpleString& ); // no implementation
};
//
// Utility methods
//
void MessageBox(
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
);
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText );
void MessageBoxFromWinError(
DWORD dwError,
LPCTSTR pszCaption /* = NULL */
);
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ );
void MessageBoxFromGetLastError(
LPCTSTR pszCaption /* = NULL */
);
void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ );
#endif