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,31 +1,33 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 "pch.hxx"
#include "AboutPage.hxx" #include "AboutPage.hxx"
#include "resource.h" #include "resource.h"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHelpPage::CHelpPage() CHelpPage::CHelpPage()
: CPropertyPage(IDD_ABOUT_PAGE) : CPropertyPage(IDD_ABOUT_PAGE)
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CHelpPage::OnInitDialog( HWND hwnd ) BOOL CHelpPage::OnInitDialog( HWND hwnd )
{ {
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER ); m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );

View File

@ -1,24 +1,24 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef ABOUT_PAGE_HXX
#define ABOUTPG_H #define ABOUT_PAGE_HXX
#include "PropertySheet.hxx" #include "PropertySheet.hxx"
#include "HyperLink.hxx" #include "HyperLink.hxx"

View File

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

View File

@ -1,28 +1,27 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // 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 // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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_ #ifndef BROWSE_FOR_FOLDER_HXX
#define __BROWSE_FOR_FOLDER_ #define BROWSE_FOR_FOLDER_HXX
#include <shlobj.h> #include <shlobj.h>
class CBrowseForFolder class CBrowseForFolder
{ {
public: public:
@ -69,7 +68,6 @@ class CBrowseForFolder
BROWSEINFO myBrowseInfo; BROWSEINFO myBrowseInfo;
char mySelected[MAX_PATH]; char mySelected[MAX_PATH];
CSimpleString myPath;
HWND myHwnd; HWND myHwnd;
}; };

View File

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

View File

@ -1,24 +1,24 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef CONFIG_PAGE_HXX
#define CONFIGPG_H #define CONFIG_PAGE_HXX
#include "PropertySheet.hxx" #include "PropertySheet.hxx"
#include "GlobalData.hxx" #include "GlobalData.hxx"

View File

@ -1,284 +1,249 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 "pch.hxx"
#include "CoolCaption.hxx" #include "CoolCaption.hxx"
// MAKE SURE STYLE IS JUST "TITLE BAR" ! // MAKE SURE STYLE IS JUST "TITLE BAR" !
CCoolCaption::CCoolCaption( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
) : \ CCoolCaption::CCoolCaption()
m_hfont( NULL ), : m_hfont( NULL ),
m_tszCaption( NULL ), m_tszCaption( NULL ),
m_fIsActive( FALSE ), m_fIsActive( FALSE ),
m_hDlg( NULL ) m_hDlg( NULL )
{ {
} }
void CCoolCaption::OnInitDialog( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hDlg void CCoolCaption::OnInitDialog( HWND hDlg )
)
{ {
m_hDlg = hDlg; m_hDlg = hDlg;
CalculateNCArea();
CalculateNCArea();
} }
void CCoolCaption::OnDestroy( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void void CCoolCaption::OnDestroy( void )
)
{ {
if ( m_hDlg == NULL ) if ( m_hDlg == NULL )
return;
if ( m_hfont )
DeleteObject( m_hfont );
delete[] m_tszCaption;
m_tszCaption = NULL;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::CalculateNCArea()
{
if ( m_hDlg == NULL )
return;
GetWindowRect(m_hDlg, &m_rcWindow);
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
m_cxFrame = ::GetSystemMetrics(SM_CXFRAME);
m_cyFrame = ::GetSystemMetrics(SM_CYFRAME);
m_cxButtonSize = ::GetSystemMetrics(SM_CXSIZE);
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
// This is the size of the caption
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,
m_cxWindow - m_cxFrame - 1,
m_rcCaption.bottom - m_cyFrame
);
CopyRect(&m_rcMin, &m_rcClose);
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
// figure out union of all buttons
RECT rcButtons;
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
SetRect(&m_rcTextArea, m_cxFrame, m_rcCaption.top+m_cyFrame,
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);
lf.lfWeight = FW_BOLD;
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 )
{
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 ?
GetSysColor(COLOR_ACTIVECAPTION) : \
GetSysColor(COLOR_INACTIVECAPTION));
hpenOld = (HPEN)SelectObject(hdc, hpen);
for (long x = 0; x < m_cxWindow; ++x)
{
if (x < m_cxFrame-1 || x > m_cxWindow-m_cxFrame)
{ {
return; // left, right must go from top to bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcWindow.bottom);
} }
else
if ( m_hfont )
{ {
::DeleteObject( m_hfont ); // otherwise just do top and bottom
} MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcCaption.bottom);
delete[] m_tszCaption; MoveToEx(hdc, x, m_cyWindow-m_cyFrame, NULL);
m_tszCaption = NULL; LineTo(hdc, x, m_cyWindow);
}
}
SelectObject(hdc, hpenOld);
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);
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
// calculate width / height of text
SIZE sizeText;
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
DrawText(hdc, m_tszCaption, -1, &m_rcTextArea,
DT_END_ELLIPSIS | DT_EXTERNALLEADING |
DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
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);
Draw3dRect(hdc, nTextRight+m_cxFrame, 8,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
// right bottom
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
ReleaseDC(m_hDlg, hdc);
} }
void CCoolCaption::CalculateNCArea( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
) void CCoolCaption::OnNcActivate( BOOL fActive )
{ {
if ( m_hDlg == NULL ) if (m_hDlg == NULL)
{ return;
return;
}
::GetWindowRect(m_hDlg, &m_rcWindow); m_fIsActive = fActive;
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
m_cxFrame = ::GetSystemMetrics(SM_CXFRAME); // This fixes a problem where alt-tab wont repaint the NC area
m_cyFrame = ::GetSystemMetrics(SM_CYFRAME); RedrawWindow(m_hDlg, NULL, NULL,
RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
m_cxButtonSize = ::GetSystemMetrics(SM_CXSIZE);
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
// This is the size of the caption
::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,
m_cxWindow - m_cxFrame - 1,
m_rcCaption.bottom - m_cyFrame
);
CopyRect(&m_rcMin, &m_rcClose);
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
// figure out union of all buttons
RECT rcButtons;
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
SetRect(&m_rcTextArea, m_cxFrame, m_rcCaption.top+m_cyFrame,
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);
lf.lfWeight = FW_BOLD;
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( BOOL CCoolCaption::OnNCLButtonDown( INT nHitTest, POINTS pts )
HRGN hrgn
)
{ {
UNUSED_ALWAYS( hrgn ); UNUSED_ALWAYS( nHitTest );
if ( m_hDlg == NULL ) if ( m_hDlg == NULL )
{ return FALSE;
return;
}
HDC hdc = GetWindowDC(m_hDlg); // Get the point in client units
RECT rcWindow;
GetWindowRect(m_hDlg, &rcWindow);
// Fill in the NC area with the proper color POINT pt = { pts.x, pts.y };
pt.x -= rcWindow.left;
pt.y -= rcWindow.top;
HPEN hpen, hpenOld; if (PtInRect(&m_rcClose, pt))
{
hpen = CreatePen(PS_SOLID, 1, m_fIsActive ? SendMessage(m_hDlg, WM_CLOSE, 0, 0);
GetSysColor(COLOR_ACTIVECAPTION) : \ return TRUE;
GetSysColor(COLOR_INACTIVECAPTION)); }
hpenOld = (HPEN)SelectObject(hdc, hpen);
for (long x = 0; x < m_cxWindow; ++x)
{
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);
MoveToEx(hdc, x, m_cyWindow-m_cyFrame, NULL);
LineTo(hdc, x, m_cyWindow);
}
}
SelectObject(hdc, hpenOld);
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);
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
// calculate width / height of text
SIZE sizeText;
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
DrawText(hdc, m_tszCaption, -1, &m_rcTextArea,
DT_END_ELLIPSIS | DT_EXTERNALLEADING |
DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
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);
Draw3dRect(hdc, nTextRight+m_cxFrame, 8,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
// right bottom
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
ReleaseDC(m_hDlg, hdc);
}
void CCoolCaption::OnNcActivate(
BOOL fActive
)
{
if (m_hDlg == NULL)
return;
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
)
{
UNUSED_ALWAYS( nHitTest );
if ( m_hDlg == NULL )
{
return FALSE;
}
// Get the point in client units
RECT rcWindow;
GetWindowRect(m_hDlg, &rcWindow);
POINT pt = { pts.x, pts.y };
pt.x -= rcWindow.left;
pt.y -= rcWindow.top;
if (PtInRect(&m_rcClose, pt))
{
// This isn't closing it!
// SendMessage(m_hDlg, WM_CLOSE, 0, 0);
EndDialog(m_hDlg, IDCANCEL);
return TRUE;
}
if (PtInRect(&m_rcMin, pt)) if (PtInRect(&m_rcMin, pt))
{ {
ShowWindow(m_hDlg, SW_MINIMIZE); ShowWindow(m_hDlg, SW_MINIMIZE);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
void CCoolCaption::FillSolidRect( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HDC hdc, void CCoolCaption::FillSolidRect( HDC hdc, int x, int y, int cx, int cy,
int x, COLORREF clr )
int y,
int cx,
int cy,
COLORREF clr
)
{ {
COLORREF cr = SetBkColor(hdc, clr); COLORREF cr = SetBkColor(hdc, clr);
RECT rect = { x, y, x+cx, y+cy }; RECT rect = { x, y, x+cx, y+cy };
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
SetBkColor(hdc, cr); SetBkColor(hdc, cr);
} }
void CCoolCaption::Draw3dRect( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HDC hdc, void CCoolCaption::Draw3dRect( HDC hdc, int x, int y, int cx, int cy,
int x, COLORREF clrTopLeft, COLORREF clrBottomRight )
int y,
int cx,
int cy,
COLORREF clrTopLeft,
COLORREF clrBottomRight
)
{ {
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft); FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft); FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight); FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight); FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
} }

View File

@ -1,51 +1,62 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 #ifndef COOL_CAPTION_HXX
#define COOLCAP_H #define COOL_CAPTION_HXX
#pragma once
class CCoolCaption class CCoolCaption
{ {
public: public:
CCoolCaption(); CCoolCaption();
void OnInitDialog(HWND hDlg); void OnInitDialog(HWND hDlg);
void OnDestroy(); void OnDestroy();
void OnNcPaint(HRGN); void OnNcPaint(HRGN);
void OnNcActivate(BOOL); void OnNcActivate(BOOL);
BOOL OnNCLButtonDown(INT, POINTS); BOOL OnNCLButtonDown(INT, POINTS);
protected: protected:
HWND m_hDlg;
HWND m_hDlg; 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,
COLORREF clrTopLeft, COLORREF clrBottomRight);
private: BOOL m_fIsActive;
RECT m_rcWindow;
int m_cxWindow;
int m_cyWindow;
int m_cxFrame;
int m_cyFrame;
int m_cxButtonSize;
RECT m_rcClose;
RECT m_rcMin;
RECT m_rcCaption;
RECT m_rcTextArea;
HFONT m_hfont;
LPTSTR m_tszCaption;
void CalculateNCArea(void); CCoolCaption( const CCoolCaption& ); // no implementation
void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, COLORREF clr); void operator=( const CCoolCaption& ); // no implementation
void Draw3dRect(HDC hdc, int x, int y, int cx, int cy,
COLORREF clrTopLeft, COLORREF clrBottomRight);
BOOL m_fIsActive;
RECT m_rcWindow;
int m_cxWindow;
int m_cyWindow;
int m_cxFrame;
int m_cyFrame;
int m_cxButtonSize;
RECT m_rcClose;
RECT m_rcMin;
RECT m_rcCaption;
RECT m_rcTextArea;
HFONT m_hfont;
LPTSTR m_tszCaption;
CCoolCaption( const CCoolCaption& ); // no implementation
void operator=( const CCoolCaption& ); // no implementation
}; };
#endif #endif

View File

@ -1,23 +1,25 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 2004 by Stephen Anthony // 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. // 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" #include "Game.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Game::Game( void ) Game::Game( void )
{ {
_available = false; _available = false;
@ -29,7 +31,7 @@ Game::Game( void )
_note = " "; _note = " ";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Game::~Game( void ) Game::~Game( void )
{ {
} }

View File

@ -1,23 +1,24 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 2004 by Stephen Anthony // 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. // 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 #ifndef GAME_HXX
#define GAME_H #define GAME_HXX
#include "bspf.hxx" #include "bspf.hxx"

View File

@ -1,21 +1,21 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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" #include "pch.hxx"
#include "resource.h" #include "resource.h"
@ -25,7 +25,7 @@
#include "SettingsWin32.hxx" #include "SettingsWin32.hxx"
#include "GlobalData.hxx" #include "GlobalData.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CGlobalData::CGlobalData( HINSTANCE hInstance ) CGlobalData::CGlobalData( HINSTANCE hInstance )
: mySettings(0), : mySettings(0),
myInstance(hInstance) myInstance(hInstance)
@ -34,6 +34,7 @@ CGlobalData::CGlobalData( HINSTANCE hInstance )
mySettings->loadConfig(); mySettings->loadConfig();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CGlobalData::~CGlobalData() CGlobalData::~CGlobalData()
{ {
if(mySettings) if(mySettings)

View File

@ -1,12 +1,12 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
@ -14,8 +14,8 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef GLOBAL_DATA_HXX
#define GLOBAL_DATA_HXX #define GLOBAL_DATA_HXX

View File

@ -1,18 +1,35 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 "pch.hxx"
#include "HeaderCtrl.hxx" #include "HeaderCtrl.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHeaderCtrl::CHeaderCtrl() CHeaderCtrl::CHeaderCtrl()
: m_nSortCol(0), : m_nSortCol(0),
m_fSortAsc(TRUE) 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 ) switch ( msg )
{ {
@ -25,6 +42,7 @@ LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam,
return 0; return 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc ) void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
{ {
m_nSortCol = nCol; m_nSortCol = nCol;
@ -42,6 +60,7 @@ void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
InvalidateRect(hwndHeader, NULL, TRUE); InvalidateRect(hwndHeader, NULL, TRUE);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHeaderCtrl::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis ) void CHeaderCtrl::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
{ {
UNUSED_ALWAYS( idCtl ); UNUSED_ALWAYS( idCtl );

View File

@ -1,9 +1,24 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 // Copyright (c) 1995-2000 by Jeff Miller
#define HDRCTL_H // 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" #include "Wnd.hxx"

View File

@ -1,352 +1,334 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 "pch.hxx"
#include "HyperLink.hxx" #include "HyperLink.hxx"
#include <shellapi.h> #include <shellapi.h>
CHyperLink::CHyperLink( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
) : \ CHyperLink::CHyperLink()
m_bOverControl(FALSE), : m_bOverControl(FALSE),
m_bVisited(FALSE), m_bVisited(FALSE),
m_hFont(NULL), m_hFont(NULL),
m_hLinkCursor(NULL) m_hLinkCursor(NULL)
{ {
m_crLinkColor = RGB( 0, 0, 238); // Blue m_crLinkColor = RGB( 0, 0, 238); // Blue
m_crVisitedColor = RGB( 85, 26, 139); // Purple m_crVisitedColor = RGB( 85, 26, 139); // Purple
m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT); m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
SetDefaultCursor(); SetDefaultCursor();
} }
CHyperLink::~CHyperLink( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
) CHyperLink::~CHyperLink()
{ {
if (m_hFont) if (m_hFont)
{ {
::DeleteObject( m_hFont ); DeleteObject( m_hFont );
m_hFont = NULL; m_hFont = NULL;
} }
} }
void CHyperLink::SetURL( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPCTSTR ctszURL void CHyperLink::SetURL( LPCTSTR ctszURL )
)
{ {
if (ctszURL == NULL) if (ctszURL == NULL)
return; return;
lstrcpy(m_tszURL, ctszURL);
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);
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
} }
LRESULT CHyperLink::WndProc( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd, LRESULT CHyperLink::WndProc( HWND hwnd, UINT msg, WPARAM wParam,
UINT msg, LPARAM lParam, BOOL& rfHandled )
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
{ {
switch (msg) switch (msg)
{ {
case WM_PAINT: case WM_PAINT:
rfHandled = TRUE; rfHandled = TRUE;
return OnPaint(hwnd); return OnPaint(hwnd);
case WM_SETCURSOR: case WM_SETCURSOR:
rfHandled = TRUE; rfHandled = TRUE;
return OnSetCursor(hwnd, LOWORD(lParam), HIWORD(lParam)); return OnSetCursor(hwnd, LOWORD(lParam), HIWORD(lParam));
case WM_LBUTTONUP: case WM_LBUTTONUP:
rfHandled = TRUE; rfHandled = TRUE;
return OnLButtonUp(hwnd, wParam, LOWORD(lParam), return OnLButtonUp(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
HIWORD(lParam));
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
rfHandled = TRUE; rfHandled = TRUE;
return OnMouseMove(hwnd, wParam, LOWORD(lParam), return OnMouseMove(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
HIWORD(lParam)); }
}
return 0; return 0;
} }
LRESULT CHyperLink::OnPaint( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd LRESULT CHyperLink::OnPaint( HWND hwnd )
)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps); HDC hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, m_hFont); SelectObject(hdc, m_hFont);
if (m_bOverControl) if (m_bOverControl)
{ SetTextColor(hdc, m_crHoverColor);
SetTextColor(hdc, m_crHoverColor); else if (m_bVisited)
} SetTextColor(hdc, m_crVisitedColor);
else if (m_bVisited) else
{ SetTextColor(hdc, m_crLinkColor);
SetTextColor(hdc, m_crVisitedColor);
}
else
{
SetTextColor(hdc, m_crLinkColor);
}
::SetBkMode( hdc, TRANSPARENT ); SetBkMode( hdc, TRANSPARENT );
TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
::TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) ); EndPaint(hwnd, &ps);
EndPaint(hwnd, &ps); return 0;
return 0;
} }
BOOL CHyperLink::OnSetCursor( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd, BOOL CHyperLink::OnSetCursor( HWND hwnd, WORD nHittest, WORD wMouseMsg )
WORD nHittest,
WORD wMouseMsg
)
{ {
UNUSED_ALWAYS( hwnd ); UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( nHittest ); UNUSED_ALWAYS( nHittest );
UNUSED_ALWAYS( wMouseMsg ); UNUSED_ALWAYS( wMouseMsg );
if (m_hLinkCursor) if (m_hLinkCursor)
{
SetCursor(m_hLinkCursor);
return TRUE;
}
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnLButtonUp( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
{
UNUSED_ALWAYS( fwKeys );
UNUSED_ALWAYS( xPos );
UNUSED_ALWAYS( yPos );
int result = (int)GotoURL(m_tszURL, SW_SHOW);
m_bVisited = (result > HINSTANCE_ERROR);
if (!m_bVisited)
{
MessageBeep(MB_ICONEXCLAMATION);
ReportError(result);
}
else
{
m_bVisited = TRUE;
InvalidateRect(hwnd, NULL, FALSE);
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnMouseMove( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
{
UNUSED_ALWAYS( fwKeys );
// call defwindowproc?
if (m_bOverControl)
{
RECT rc;
GetClientRect(hwnd, &rc);
POINT pt = { xPos, yPos };
if (!PtInRect(&rc, pt))
{ {
::SetCursor(m_hLinkCursor); m_bOverControl = FALSE;
return TRUE; ReleaseCapture();
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
} }
}
else
{
m_bOverControl = TRUE;
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
SetCapture(hwnd);
}
return FALSE; return 0;
}
LRESULT CHyperLink::OnLButtonUp(
HWND hwnd,
WPARAM fwKeys,
WORD xPos,
WORD yPos
)
{
UNUSED_ALWAYS( fwKeys );
UNUSED_ALWAYS( xPos );
UNUSED_ALWAYS( yPos );
int result = (int)GotoURL(m_tszURL, SW_SHOW);
m_bVisited = (result > HINSTANCE_ERROR);
if (!m_bVisited)
{
MessageBeep(MB_ICONEXCLAMATION);
ReportError(result);
}
else
{
m_bVisited = TRUE;
InvalidateRect(hwnd, NULL, FALSE);
}
return 0;
}
LRESULT CHyperLink::OnMouseMove(
HWND hwnd,
WPARAM fwKeys,
WORD xPos,
WORD yPos
)
{
UNUSED_ALWAYS( fwKeys );
// call defwindowproc?
if (m_bOverControl)
{
RECT rc;
GetClientRect(hwnd, &rc);
POINT pt = { xPos, yPos };
if (!PtInRect(&rc, pt))
{
m_bOverControl = FALSE;
ReleaseCapture();
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
}
}
else
{
m_bOverControl = TRUE;
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
SetCapture(hwnd);
}
return 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles. // The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module // It loads a "hand" cursor from the winhlp32.exe module
void CHyperLink::SetDefaultCursor()
void CHyperLink::SetDefaultCursor(
void
)
{ {
if (m_hLinkCursor == NULL) // No cursor handle - load our own if (m_hLinkCursor == NULL) // No cursor handle - load our own
{
// Get the windows directory
TCHAR tszWndDir[MAX_PATH + 1];
GetWindowsDirectory(tszWndDir, MAX_PATH);
lstrcat(tszWndDir, _T("\\winhlp32.exe"));
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
HMODULE hModule = LoadLibrary(tszWndDir);
if (hModule)
{ {
// Get the windows directory HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if (hHandCursor)
m_hLinkCursor = CopyCursor(hHandCursor);
}
FreeLibrary(hModule);
}
}
TCHAR tszWndDir[MAX_PATH + 1]; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GetWindowsDirectory(tszWndDir, MAX_PATH); LONG CHyperLink::GetRegKey( HKEY key, LPCTSTR subkey, LPTSTR retdata )
{
HKEY hkey;
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
lstrcat(tszWndDir, _T("\\winhlp32.exe")); if (retval == ERROR_SUCCESS)
{
long datasize = MAX_PATH;
TCHAR data[MAX_PATH];
RegQueryValue(hkey, NULL, data, &datasize);
lstrcpy(retdata,data);
RegCloseKey(hkey);
}
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer return retval;
HMODULE hModule = LoadLibrary(tszWndDir); }
if (hModule) {
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106)); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (hHandCursor) void CHyperLink::ReportError( int nError )
m_hLinkCursor = CopyCursor(hHandCursor); {
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
switch (nError)
{
case 0:
lstrcpy(tsz, _T("The operating system is out\nof memory or resources."));
break;
case SE_ERR_PNF:
lstrcpy(tsz, _T("The specified path was not found."));
break;
case SE_ERR_FNF:
lstrcpy(tsz, _T("The specified file was not found."));
break;
case ERROR_BAD_FORMAT:
lstrcpy(tsz, _T("The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."));
break;
case SE_ERR_ACCESSDENIED:
lstrcpy(tsz, _T("The operating system denied\naccess to the specified file."));
break;
case SE_ERR_ASSOCINCOMPLETE:
lstrcpy(tsz,_T("The filename association is\nincomplete or invalid."));
break;
case SE_ERR_DDEBUSY:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."));
break;
case SE_ERR_DDEFAIL:
lstrcpy(tsz, _T("The DDE transaction failed."));
break;
case SE_ERR_DDETIMEOUT:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because the request timed out."));
break;
case SE_ERR_DLLNOTFOUND:
lstrcpy(tsz, _T("The specified dynamic-link library was not found."));
break;
case SE_ERR_NOASSOC:
lstrcpy(tsz, __T("There is no application associated\nwith the given filename extension."));
break;
case SE_ERR_OOM:
lstrcpy(tsz, _T("There was not enough memory to complete the operation."));
break;
case SE_ERR_SHARE:
lstrcpy(tsz, _T("A sharing violation occurred."));
break;
default:
wsprintf(tsz, _T("Unknown error %d occurred."), nError);
break;
}
TCHAR tszCaption[MAX_HYPERLINK_TEXT_LEN + 1];
lstrcpy(tszCaption, _T("Unable to open hyperlink"));
MessageBox(NULL, tsz, tszCaption, MB_ICONEXCLAMATION | MB_OK);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HINSTANCE CHyperLink::GotoURL( LPCTSTR url, int showcmd )
{
TCHAR key[MAX_PATH + MAX_PATH];
// First try ShellExecute()
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)
{
lstrcat(key, _T("\\shell\\open\\command"));
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
{
TCHAR *pos;
pos = _tcsstr(key, _T("\"%1\""));
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;
else
*pos = '\0'; // Remove the parameter
} }
FreeLibrary(hModule); else
*pos = '\0'; // Remove the parameter
lstrcat(pos, _T(" "));
lstrcat(pos, url);
result = (HINSTANCE) WinExec(key,showcmd);
}
} }
} }
LONG CHyperLink::GetRegKey( return result;
HKEY key,
LPCTSTR subkey,
LPTSTR retdata
)
{
HKEY hkey;
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
if (retval == ERROR_SUCCESS) {
long datasize = MAX_PATH;
TCHAR data[MAX_PATH];
RegQueryValue(hkey, NULL, data, &datasize);
lstrcpy(retdata,data);
RegCloseKey(hkey);
}
return retval;
}
void CHyperLink::ReportError(
int nError
)
{
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
switch (nError)
{
case 0:
lstrcpy(tsz, _T("The operating system is out\nof memory or resources."));
break;
case SE_ERR_PNF:
lstrcpy(tsz, _T("The specified path was not found."));
break;
case SE_ERR_FNF:
lstrcpy(tsz, _T("The specified file was not found."));
break;
case ERROR_BAD_FORMAT:
lstrcpy(tsz, _T("The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."));
break;
case SE_ERR_ACCESSDENIED:
lstrcpy(tsz, _T("The operating system denied\naccess to the specified file."));
break;
case SE_ERR_ASSOCINCOMPLETE:
lstrcpy(tsz,_T("The filename association is\nincomplete or invalid."));
break;
case SE_ERR_DDEBUSY:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."));
break;
case SE_ERR_DDEFAIL:
lstrcpy(tsz, _T("The DDE transaction failed."));
break;
case SE_ERR_DDETIMEOUT:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because the request timed out."));
break;
case SE_ERR_DLLNOTFOUND:
lstrcpy(tsz, _T("The specified dynamic-link library was not found."));
break;
case SE_ERR_NOASSOC:
lstrcpy(tsz, __T("There is no application associated\nwith the given filename extension."));
break;
case SE_ERR_OOM:
lstrcpy(tsz, _T("There was not enough memory to complete the operation."));
break;
case SE_ERR_SHARE:
lstrcpy(tsz, _T("A sharing violation occurred."));
break;
default:
wsprintf(tsz, _T("Unknown error %d occurred."), nError);
break;
}
TCHAR tszCaption[MAX_HYPERLINK_TEXT_LEN + 1];
lstrcpy(tszCaption, _T("Unable to open hyperlink"));
MessageBox(NULL, tsz, tszCaption, MB_ICONEXCLAMATION | MB_OK);
}
HINSTANCE CHyperLink::GotoURL(
LPCTSTR url,
int showcmd
)
{
TCHAR key[MAX_PATH + MAX_PATH];
// First try ShellExecute()
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) {
lstrcat(key, _T("\\shell\\open\\command"));
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) {
TCHAR *pos;
pos = _tcsstr(key, _T("\"%1\""));
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;
else
*pos = '\0'; // Remove the parameter
}
else
*pos = '\0'; // Remove the parameter
lstrcat(pos, _T(" "));
lstrcat(pos, url);
result = (HINSTANCE) WinExec(key,showcmd);
}
}
}
return result;
} }

View File

@ -1,10 +1,24 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 // Copyright (c) 1995-2000 by Jeff Miller
#define HYPERLINK_H // Copyright (c) 2004 by Stephen Anthony
#pragma once //
// 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_TEXT_LEN 256
#define MAX_HYPERLINK_URL 256 #define MAX_HYPERLINK_URL 256
@ -13,54 +27,50 @@
class CHyperLink : public CWnd class CHyperLink : public CWnd
{ {
public: public:
CHyperLink(); CHyperLink();
~CHyperLink(); ~CHyperLink();
void SetURL(LPCTSTR ctszURL); void SetURL(LPCTSTR ctszURL);
protected: protected:
virtual void PreSubclassWindow(HWND hwnd);
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
virtual void PreSubclassWindow(HWND hwnd); private:
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, void SetDefaultCursor();
BOOL& rfHandled); LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
void ReportError(int nError);
HINSTANCE GotoURL(LPCTSTR url, int showcmd);
private: static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam);
void SetDefaultCursor(); HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdcStatic, HWND hwndStatic);
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata); BOOL OnSetCursor(HWND hwnd, WORD nHittest, WORD wMouseMsg);
void ReportError(int nError); LRESULT OnPaint(HWND hwnd);
HINSTANCE GotoURL(LPCTSTR url, int showcmd); LRESULT OnLButtonUp(HWND, WPARAM, WORD, WORD);
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, // Stuff from the control
WPARAM wParam, LPARAM lParam); TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
HFONT m_hFont;
HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdcStatic, HWND hwndStatic); // link specific
BOOL OnSetCursor(HWND hwnd, WORD nHittest, WORD wMouseMsg); COLORREF m_crLinkColor;
LRESULT OnPaint(HWND hwnd); COLORREF m_crVisitedColor;
LRESULT OnLButtonUp(HWND, WPARAM, WORD, WORD); COLORREF m_crHoverColor;
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
// Stuff from the control BOOL m_bOverControl;
BOOL m_bVisited;
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1]; HCURSOR m_hLinkCursor;
HFONT m_hFont;
// link specific TCHAR m_tszURL[MAX_HYPERLINK_URL + 1];
COLORREF m_crLinkColor; CHyperLink( const CHyperLink& ); // no implementation
COLORREF m_crVisitedColor; void operator=( const CHyperLink& ); // no implementation
COLORREF m_crHoverColor;
BOOL m_bOverControl;
BOOL m_bVisited;
HCURSOR m_hLinkCursor;
TCHAR m_tszURL[MAX_HYPERLINK_URL + 1];
CHyperLink( const CHyperLink& ); // no implementation
void operator=( const CHyperLink& ); // no implementation
}; };
#endif #endif

View File

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

View File

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

View File

@ -1,260 +1,233 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/02/2000 // 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 "pch.hxx"
#include "PropertySheet.hxx" #include "PropertySheet.hxx"
#pragma comment(lib, "comctl32") #pragma comment(lib, "comctl32")
#include <pshpack1.h> #include <pshpack1.h>
typedef struct DLGTEMPLATEEX typedef struct DLGTEMPLATEEX
{ {
WORD dlgVer; WORD dlgVer;
WORD signature; WORD signature;
DWORD helpID; DWORD helpID;
DWORD exStyle; DWORD exStyle;
DWORD style; DWORD style;
WORD cDlgItems; WORD cDlgItems;
short x; short x;
short y; short y;
short cx; short cx;
short cy; short cy;
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX; } DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
#include <poppack.h> #include <poppack.h>
CPropertyPage::CPropertyPage( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UINT nIDTemplate, CPropertyPage::CPropertyPage( UINT nIDTemplate, UINT nIDCaption /* = 0 */ )
UINT nIDCaption /* = 0 */
)
{ {
UNUSED_ALWAYS( nIDCaption ); UNUSED_ALWAYS( nIDCaption );
ZeroMemory(&m_psp, sizeof(m_psp)); ZeroMemory(&m_psp, sizeof(m_psp));
m_psp.dwSize = sizeof(m_psp); m_psp.dwSize = sizeof(m_psp);
m_psp.dwFlags = PSP_USECALLBACK; m_psp.dwFlags = PSP_USECALLBACK;
// m_psp.hInstance = hInstance; // m_psp.hInstance = hInstance;
m_psp.pszTemplate = MAKEINTRESOURCE(nIDTemplate); m_psp.pszTemplate = MAKEINTRESOURCE(nIDTemplate);
m_psp.pfnDlgProc = StaticDlgProc; m_psp.pfnDlgProc = StaticDlgProc;
m_psp.lParam = (LPARAM)this; m_psp.lParam = (LPARAM)this;
m_psp.pfnCallback = StaticCallback; m_psp.pfnCallback = StaticCallback;
} }
UINT CALLBACK CPropertyPage::StaticCallback( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd, UINT CALLBACK
UINT uMsg, CPropertyPage::StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp )
LPPROPSHEETPAGE ppsp
)
{ {
UNUSED_ALWAYS( hwnd ); UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( ppsp ); UNUSED_ALWAYS( ppsp );
switch (uMsg) switch (uMsg)
{ {
case PSPCB_CREATE: case PSPCB_CREATE:
// ppsp->lParam holds create lParam // ppsp->lParam holds create lParam
return TRUE; return TRUE;
case PSPCB_RELEASE: case PSPCB_RELEASE:
break; break;
} }
return 0; return 0;
} }
BOOL CALLBACK CPropertyPage::StaticDlgProc( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd, BOOL CALLBACK
UINT uMsg, CPropertyPage::StaticDlgProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
WPARAM wParam,
LPARAM lParam
)
{ {
CPropertyPage* pPage = NULL; CPropertyPage* pPage = NULL;
switch ( uMsg ) switch ( uMsg )
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
pPage = reinterpret_cast<CPropertyPage*>( pPage = reinterpret_cast<CPropertyPage*>(
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam ); reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
(void)::SetWindowLong( hwnd, (void)::SetWindowLong( hwnd, DWL_USER, reinterpret_cast<LONG>( pPage ) );
DWL_USER, break;
reinterpret_cast<LONG>( pPage ) );
break;
default: default:
pPage = reinterpret_cast<CPropertyPage*>( pPage = reinterpret_cast<CPropertyPage*>( GetWindowLong( hwnd, DWL_USER ) );
::GetWindowLong( hwnd, DWL_USER ) ); if ( pPage == NULL )
if ( pPage == NULL ) return FALSE;
{ break;
return FALSE; }
}
break;
}
return pPage->DlgProc( hwnd, uMsg, wParam, lParam ); return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
} }
BOOL CALLBACK CPropertyPage::DlgProc( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd, BOOL CALLBACK
UINT msg, CPropertyPage::DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
WPARAM wParam,
LPARAM lParam
)
{ {
switch (msg) switch (msg)
{ {
case WM_ACTIVATE: case WM_ACTIVATE:
OnActivate( (UINT)LOWORD(wParam), (HWND)lParam, (BOOL)HIWORD(wParam) ); OnActivate( (UINT)LOWORD(wParam), (HWND)lParam, (BOOL)HIWORD(wParam) );
return TRUE; return TRUE;
case WM_INITDIALOG: case WM_INITDIALOG:
return OnInitDialog( hwnd ); return OnInitDialog( hwnd );
case WM_DESTROY: case WM_DESTROY:
OnDestroy( ); OnDestroy( );
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:
return OnCommand( HIWORD(wParam), LOWORD(wParam), (HWND)lParam ); return OnCommand( HIWORD(wParam), LOWORD(wParam), (HWND)lParam );
case WM_NOTIFY: case WM_NOTIFY:
// Handle PSN_QUERYCANCEL? // Handle PSN_QUERYCANCEL?
// Handle PSN_KILLACTIVE? // Handle PSN_KILLACTIVE?
switch (((LPNMHDR)lParam)->code)
{
case PSN_SETACTIVE:
SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
switch (((LPNMHDR)lParam)->code) case PSN_KILLACTIVE:
{ SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
case PSN_SETACTIVE: return TRUE;
::SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_KILLACTIVE: case PSN_APPLY:
::SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) ); SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
return TRUE; return TRUE;
case PSN_APPLY: case PSN_RESET:
::SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) ); OnReset( (LPPSHNOTIFY)lParam );
return TRUE; return TRUE;
}
case PSN_RESET: return OnNotify( (int)wParam, (LPNMHDR)lParam );
OnReset( (LPPSHNOTIFY)lParam ); }
return TRUE;
}
return OnNotify( (int)wParam, (LPNMHDR)lParam );
}
return FALSE; return FALSE;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// CPropertySheet::CPropertySheet( LPCTSTR pszCaption, HWND hwndParent,
// CPropertySheet UINT nStartPage /* = 0 */ )
// : m_strCaption( pszCaption )
CPropertySheet::CPropertySheet
(
LPCTSTR pszCaption,
HWND hwndParent,
UINT nStartPage /* = 0 */
) :\
m_strCaption( pszCaption )
{ {
ZeroMemory(&m_psh, sizeof(m_psh)); ZeroMemory(&m_psh, sizeof(m_psh));
m_psh.dwSize = sizeof(m_psh); m_psh.dwSize = sizeof(m_psh);
m_psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK; m_psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
m_psh.hwndParent = hwndParent; m_psh.hwndParent = hwndParent;
m_psh.hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE); m_psh.hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE);
m_psh.pszCaption = m_strCaption.c_str(); m_psh.pszCaption = m_strCaption.c_str();
m_psh.nStartPage = nStartPage; m_psh.nStartPage = nStartPage;
m_psh.pfnCallback = StaticCallback; m_psh.pfnCallback = StaticCallback;
} }
CPropertySheet::~CPropertySheet( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
) CPropertySheet::~CPropertySheet()
{ {
// BUGBUG: This is static! // BUGBUG: This is static!
/* /* if ( m_hfontLogo )
if ( m_hfontLogo ) {
{ DeleteObject( m_hfontLogo );
::DeleteObject( m_hfontLogo ); m_hfontLogo = NULL;
m_hfontLogo = NULL; }*/
}
*/
} }
void CPropertySheet::AddPage( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertyPage* pPage void CPropertySheet::AddPage( CPropertyPage* pPage )
)
{ {
if (pPage) if (pPage)
{ m_pages.push_back(pPage);
m_pages.push_back(pPage);
}
} }
int CPropertySheet::DoModal( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void int CPropertySheet::DoModal()
)
{ {
int nSize = m_pages.size(); int nSize = m_pages.size();
if (nSize == 0) if (nSize == 0)
return IDCANCEL; return IDCANCEL;
PROPSHEETPAGE* pspage = new PROPSHEETPAGE[nSize]; PROPSHEETPAGE* pspage = new PROPSHEETPAGE[nSize];
for (int i = 0; i < nSize; ++i) for (int i = 0; i < nSize; ++i)
{ {
CopyMemory(&(pspage[i]), m_pages[i]->GetPropSheetPage(), CopyMemory(&(pspage[i]), m_pages[i]->GetPropSheetPage(),
sizeof(PROPSHEETPAGE)); sizeof(PROPSHEETPAGE));
pspage[i].hInstance = m_psh.hInstance; pspage[i].hInstance = m_psh.hInstance;
} }
m_psh.nPages = nSize; m_psh.nPages = nSize;
m_psh.ppsp = pspage; m_psh.ppsp = pspage;
int nRet = ::PropertySheet( &m_psh ); int nRet = ::PropertySheet( &m_psh );
delete[] pspage; delete[] pspage;
return nRet; return nRet;
} }
int CALLBACK CPropertySheet::StaticCallback( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd, int CALLBACK
UINT uMsg, CPropertySheet::StaticCallback( HWND hwnd, UINT uMsg, LPARAM lParam )
LPARAM lParam
)
{ {
UNUSED_ALWAYS( hwnd ); UNUSED_ALWAYS( hwnd );
switch (uMsg) switch (uMsg)
{ {
case PSCB_INITIALIZED: case PSCB_INITIALIZED:
// Property sheet is being initialized // Property sheet is being initialized
return TRUE;
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;
case PSCB_PRECREATE: return TRUE;
// 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 0; return 0;
} }

View File

@ -1,10 +1,24 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/02/2000 // 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 // Copyright (c) 1995-2000 by Jeff Miller
#define PROPSHT_H // Copyright (c) 2004 by Stephen Anthony
#pragma once //
// 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 <prsht.h>
#include <vector> #include <vector>
@ -12,100 +26,67 @@
class CPropertyPage class CPropertyPage
{ {
public: public:
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 ); const PROPSHEETPAGE* GetPropSheetPage();
const PROPSHEETPAGE* GetPropSheetPage(); protected:
protected:
//
// Overridable callbacks // 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 */ ) virtual void OnDestroy( void ) {}
{
return FALSE;
}
virtual void OnDestroy( void ) virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ ) { return 0; }
{
}
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ ) virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ ) { return FALSE; }
{
return 0;
}
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ ) virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ ) { return PSNRET_NOERROR; }
{
return FALSE;
}
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ ) virtual void OnReset( LPPSHNOTIFY /* lppsn */ ) {}
{
return PSNRET_NOERROR;
}
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 */ ) virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ ) { return FALSE; }
{
return FALSE;
}
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ ) private:
{ static UINT CALLBACK StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
return FALSE;
}
private: static BOOL CALLBACK StaticDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
static UINT CALLBACK StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
static BOOL CALLBACK StaticDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
BOOL CALLBACK DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); BOOL CALLBACK DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
PROPSHEETPAGE m_psp; PROPSHEETPAGE m_psp;
CPropertyPage( const CPropertyPage& ); // no implementation CPropertyPage( const CPropertyPage& ); // no implementation
void operator=( const CPropertyPage& ); // no implementation void operator=( const CPropertyPage& ); // no implementation
}; };
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage( inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage()
void
)
{ {
return &m_psp; return &m_psp;
} }
class CPropertySheet class CPropertySheet
{ {
public: public:
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 );
~CPropertySheet( );
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 ); void AddPage( CPropertyPage* pPage );
~CPropertySheet( ); virtual int DoModal( void );
void AddPage( CPropertyPage* pPage ); private:
virtual int DoModal( void ); static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam );
private: PROPSHEETHEADER m_psh;
std::vector<CPropertyPage*> m_pages;
std::string m_strCaption;
static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam ); CPropertySheet( const CPropertySheet& ); // no implementation
void operator=( const CPropertySheet& ); // no implementation
PROPSHEETHEADER m_psh;
std::vector<CPropertyPage*> m_pages;
std::string m_strCaption;
CPropertySheet( const CPropertySheet& ); // no implementation
void operator=( const CPropertySheet& ); // no implementation
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,38 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 // Copyright (c) 1995-2000 by Jeff Miller
#define RNDBUT_H // 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" #include "Wnd.hxx"
class CRoundButton : public CWnd class CRoundButton : public CWnd
{ {
public: public:
CRoundButton(); CRoundButton();
~CRoundButton(); ~CRoundButton();
protected: protected:
LRESULT WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled );
LRESULT WndProc( HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam, BOOL& fHandled );
virtual void PreSubclassWindow(HWND hwnd); virtual void PreSubclassWindow(HWND hwnd);
private: private:
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis); void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
HRGN m_hrgn; HRGN m_hrgn;
@ -32,8 +43,8 @@ private:
BOOL m_fDrawDashedFocusCircle; BOOL m_fDrawDashedFocusCircle;
BOOL m_fStretch; BOOL m_fStretch;
CRoundButton( const CRoundButton& ); // no implementation CRoundButton( const CRoundButton& ); // no implementation
void operator=( const CRoundButton& ); // no implementation void operator=( const CRoundButton& ); // no implementation
}; };
#endif #endif

View File

@ -1,21 +1,21 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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> #include <iostream>
#include <sstream> #include <sstream>
@ -28,15 +28,17 @@
#include "pch.hxx" #include "pch.hxx"
#include "StellaXMain.hxx" #include "StellaXMain.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CStellaXMain::CStellaXMain() CStellaXMain::CStellaXMain()
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CStellaXMain::~CStellaXMain() CStellaXMain::~CStellaXMain()
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CStellaXMain::PlayROM( string& romfile, CGlobalData& globaldata ) void CStellaXMain::PlayROM( string& romfile, CGlobalData& globaldata )
{ {
ostringstream buf; ostringstream buf;

View File

@ -1,24 +1,24 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef STELLAX_MAIN_HXX
#define STELLAX_H #define STELLAX_MAIN_HXX
#include "bspf.hxx" #include "bspf.hxx"

View File

@ -1,186 +1,178 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 10/12/1999 // 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 "pch.hxx"
#include "TextButton3d.hxx" #include "TextButton3d.hxx"
// button style should be VISIBLE / DISABLED / OWNERDRAW // button style should be VISIBLE / DISABLED / OWNERDRAW
CTextButton3d::CTextButton3d // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
( CTextButton3d::CTextButton3d()
)
{ {
} }
LRESULT CTextButton3d::WndProc // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
( LRESULT CTextButton3d::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
HWND hWnd, LPARAM lParam, BOOL& rfHandled )
UINT msg, {
WPARAM wParam, switch (msg)
LPARAM lParam, {
BOOL& rfHandled
)
{
switch (msg)
{
#if 0 #if 0
// TODO: re do this now that I send this message here
// TODO: re do this now that I send this message here case WM_DRAWITEM:
case WM_DRAWITEM: rfHandled = TRUE;
rfHandled = TRUE; pThis->OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
pThis->OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam); return TRUE;
return TRUE;
#endif #endif
case WM_PAINT: case WM_PAINT:
rfHandled = TRUE; rfHandled = TRUE;
OnPaint(hWnd, (HDC)wParam); OnPaint(hWnd, (HDC)wParam);
return TRUE; return TRUE;
case WM_ERASEBKGND: case WM_ERASEBKGND:
rfHandled = TRUE; rfHandled = TRUE;
return OnEraseBkgnd(hWnd, (HDC)wParam); return OnEraseBkgnd(hWnd, (HDC)wParam);
} }
return 0; return 0;
} }
void CTextButton3d::OnPaint // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
( void CTextButton3d::OnPaint( HWND hwnd, HDC hdcPaint )
HWND hwnd,
HDC hdcPaint
)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps); HDC hdc = BeginPaint(hwnd, &ps);
int cxClient, cyClient; int cxClient, cyClient;
RECT rc; RECT rc;
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
RECT rcClient; RECT rcClient;
CopyRect(&rcClient, &rc); CopyRect(&rcClient, &rc);
// lpdis->rcItem, lpdis->itemState // lpdis->rcItem, lpdis->itemState
int l = GetWindowTextLength(hwnd); int l = GetWindowTextLength(hwnd);
LPTSTR text = new TCHAR[l + 2]; LPTSTR text = new TCHAR[l + 2];
if (text == NULL) if (text == NULL)
{ {
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
return; return;
} }
GetWindowText(hwnd, text, l+1); GetWindowText(hwnd, text, l+1);
HFONT hfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); HFONT hfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
LOGFONT lf; LOGFONT lf;
GetObject(hfont, sizeof(lf), &lf); GetObject(hfont, sizeof(lf), &lf);
if (lf.lfHeight == 0) if (lf.lfHeight == 0)
lf.lfHeight = 20; lf.lfHeight = 20;
lf.lfWidth = 0; lf.lfWidth = 0;
lf.lfWeight = FW_BLACK; lf.lfWeight = FW_BLACK;
lf.lfEscapement = 0; lf.lfEscapement = 0;
lf.lfOrientation = 0; lf.lfOrientation = 0;
HFONT hfontTry = CreateFontIndirect(&lf); HFONT hfontTry = CreateFontIndirect(&lf);
HFONT hfontOld = (HFONT)SelectObject(hdc, hfontTry); HFONT hfontOld = (HFONT)SelectObject(hdc, hfontTry);
rcClient.left += 3; rcClient.left += 3;
rcClient.top += 3; rcClient.top += 3;
rcClient.right -= 3; rcClient.right -= 3;
rcClient.bottom -= 3; rcClient.bottom -= 3;
cxClient = rcClient.right - rcClient.left; cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top; cyClient = rcClient.bottom - rcClient.top;
SIZE sizeTextClient; SIZE sizeTextClient;
GetTextExtentPoint(hdc, text, lstrlen(text), GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
&sizeTextClient); if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx) lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
{ else
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy); lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
}
else
{
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
}
lf.lfHeight--; lf.lfHeight--;
rcClient.left -= 3; rcClient.left -= 3;
rcClient.top -= 3; rcClient.top -= 3;
rcClient.right += 3; rcClient.right += 3;
rcClient.bottom += 3; rcClient.bottom += 3;
cxClient = rcClient.right - rcClient.left; cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top; cyClient = rcClient.bottom - rcClient.top;
hfont = CreateFontIndirect(&lf); hfont = CreateFontIndirect(&lf);
SelectObject(hdc, hfont); SelectObject(hdc, hfont);
GetTextExtentPoint(hdc, text, lstrlen(text), GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
&sizeTextClient);
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2; int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2; int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
int iOldBkMode = SetBkMode(hdc, TRANSPARENT); int iOldBkMode = SetBkMode(hdc, TRANSPARENT);
COLORREF crText = GetSysColor(COLOR_BTNTEXT); COLORREF crText = GetSysColor(COLOR_BTNTEXT);
COLORREF crOldText = SetTextColor(hdc, crText); COLORREF crOldText = SetTextColor(hdc, crText);
int cx = minx; int cx = minx;
int cy = miny; int cy = miny;
int s = 1; int s = 1;
cx += 3; cx += 3;
cy += 3; cy += 3;
// draw 3D highlights // 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));
TextOut(hdc, cx+s*2, cy+s*2, text, lstrlen(text));
SetTextColor(hdc, ::GetSysColor(COLOR_3DHILIGHT));
TextOut(hdc, cx+s*1, cy-s*2, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy-s*2, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DSHADOW));
TextOut(hdc, cx-s*1, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy+s*1, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DLIGHT));
TextOut(hdc, cx, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy-s*1, text, lstrlen(text));
SetTextColor(hdc, crText);
SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW)); // draw the text
TextOut(hdc, cx-s*2, cy+s*2, text, lstrlen(text)); TextOut(hdc, cx, cy, text, lstrlen(text));
TextOut(hdc, cx+s*2, cy-s*2, text, lstrlen(text));
TextOut(hdc, cx+s*2, cy+s*2, text, lstrlen(text));
SetTextColor(hdc, ::GetSysColor(COLOR_3DHILIGHT));
TextOut(hdc, cx+s*1, cy-s*2, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy-s*2, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DSHADOW));
TextOut(hdc, cx-s*1, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy+s*1, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DLIGHT));
TextOut(hdc, cx, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy-s*1, text, lstrlen(text));
SetTextColor(hdc, crText);
// draw the text // restore dc
SetTextColor(hdc, crOldText);
SetBkMode(hdc, iOldBkMode);
SelectObject(hdc, hfontOld);
TextOut(hdc, cx, cy, text, lstrlen(text)); DeleteObject(hfont);
DeleteObject(hfontTry);
// restore dc delete[] text;
SetTextColor(hdc, crOldText); EndPaint(hwnd, &ps);
SetBkMode(hdc, iOldBkMode);
SelectObject(hdc, hfontOld);
DeleteObject(hfont);
DeleteObject(hfontTry);
delete[] text;
EndPaint(hwnd, &ps);
} }
BOOL CTextButton3d::OnEraseBkgnd // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
( BOOL CTextButton3d::OnEraseBkgnd( HWND hwnd, HDC hdc )
HWND hwnd,
HDC hdc
)
{ {
// dont do any erasing // dont do any erasing
return TRUE;
return TRUE;
} }

View File

@ -1,10 +1,24 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 // Copyright (c) 1995-2000 by Jeff Miller
#define TXTBTN_H // Copyright (c) 2004 by Stephen Anthony
#pragma once //
// 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 // derived from Roger Onslow's code
@ -12,22 +26,18 @@
class CTextButton3d : public CWnd class CTextButton3d : public CWnd
{ {
public: public:
CTextButton3d();
CTextButton3d(); protected:
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled);
protected: private:
void OnPaint(HWND, HDC);
BOOL OnEraseBkgnd(HWND, HDC);
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, CTextButton3d( const CTextButton3d& ); // no implementation
BOOL& rfHandled); void operator=( const CTextButton3d& ); // no implementation
private:
void OnPaint(HWND, HDC);
BOOL OnEraseBkgnd(HWND, HDC);
CTextButton3d( const CTextButton3d& ); // no implementation
void operator=( const CTextButton3d& ); // no implementation
}; };
#endif #endif

View File

@ -1,75 +1,77 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 "pch.hxx"
#include "Wnd.hxx" #include "Wnd.hxx"
// REVIEW: Need to reset old wnd proc? // REVIEW: Need to reset old wnd proc?
CWnd::CWnd( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
) : \ CWnd::CWnd()
m_pOldWindowProc(NULL), : m_pOldWindowProc(NULL),
m_hwnd(NULL) m_hwnd(NULL)
{ {
} }
BOOL CWnd::SubclassDlgItem( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwndParent, BOOL CWnd::SubclassDlgItem( HWND hwndParent, UINT nID )
UINT nID
)
{ {
if ( nID == 0 || hwndParent == NULL ) if ( nID == 0 || hwndParent == NULL )
{ return FALSE;
return FALSE;
}
// can't subclass twice! // can't subclass twice!
if ( m_pOldWindowProc != NULL )
return FALSE;
if ( m_pOldWindowProc != NULL ) m_hwnd = GetDlgItem( hwndParent, nID );
{ if (m_hwnd == NULL)
return FALSE; {
} ASSERT( FALSE );
return FALSE;
}
m_hwnd = GetDlgItem( hwndParent, nID ); PreSubclassWindow( m_hwnd );
if (m_hwnd == NULL)
{
ASSERT( FALSE );
return FALSE;
}
PreSubclassWindow( m_hwnd ); m_pOldWindowProc = (WNDPROC)GetWindowLong( m_hwnd, GWL_WNDPROC );
SetWindowLong( m_hwnd, GWL_USERDATA, (LONG)this );
SetWindowLong( m_hwnd, GWL_WNDPROC, (LONG)StaticWndProc );
m_pOldWindowProc = (WNDPROC)GetWindowLong( m_hwnd, GWL_WNDPROC ); return TRUE;
SetWindowLong( m_hwnd, GWL_USERDATA, (LONG)this );
SetWindowLong( m_hwnd, GWL_WNDPROC, (LONG)StaticWndProc );
return TRUE;
} }
void CWnd::PreSubclassWindow( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd void CWnd::PreSubclassWindow( HWND hwnd )
)
{ {
// no default behavior // no default behavior
} }
LRESULT CALLBACK CWnd::StaticWndProc( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hWnd, LRESULT CALLBACK CWnd::StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam,
UINT msg, LPARAM lParam )
WPARAM wParam, {
LPARAM lParam CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
)
{
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
BOOL fHandled = FALSE; BOOL fHandled = FALSE;
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled ); LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
if (fHandled) if (fHandled)
{ return lRes;
return lRes;
}
return CallWindowProc( pThis->m_pOldWindowProc, hWnd, msg, wParam, lParam ); return CallWindowProc( pThis->m_pOldWindowProc, hWnd, msg, wParam, lParam );
} }

View File

@ -1,39 +1,46 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 // Copyright (c) 1995-2000 by Jeff Miller
#define WND_H // 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 class CWnd
{ {
public: public:
CWnd();
CWnd(); BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
BOOL SubclassDlgItem( HWND hwndParent, UINT nID ); operator HWND() const { return m_hwnd; }
operator HWND() const protected:
{ virtual void PreSubclassWindow( HWND hwnd );
return m_hwnd; virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled ) = 0;
}
protected: private:
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
virtual void PreSubclassWindow( HWND hwnd ); WNDPROC m_pOldWindowProc;
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, HWND m_hwnd;
BOOL& rfHandled ) = 0;
private: CWnd( const CWnd& ); // no implementation
void operator=( const CWnd& ); // no implementation
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam );
WNDPROC m_pOldWindowProc;
HWND m_hwnd;
CWnd( const CWnd& ); // no implementation
void operator=( const CWnd& ); // no implementation
}; };
#endif #endif

View File

@ -1,7 +1,21 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 04/27/2000 // 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" #include "debug.hxx"
@ -11,65 +25,56 @@
extern LPCTSTR g_ctszDebugLog; extern LPCTSTR g_ctszDebugLog;
// --------------------------------------------------------------------------- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// DEBUG DEFINED void AFX_CDECL AfxTrace( LPCTSTR lpszFormat, ... )
void AFX_CDECL AfxTrace(
LPCTSTR lpszFormat,
...
)
{ {
va_list args; va_list args;
va_start(args, lpszFormat); va_start(args, lpszFormat);
int nBuf; int nBuf;
TCHAR szBuffer[512]; TCHAR szBuffer[512];
nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args); nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
// was there an error? was the expanded string too long? // was there an error? was the expanded string too long?
ASSERT(nBuf >= 0); ASSERT(nBuf >= 0);
if (nBuf < 511) if (nBuf < 511)
{ lstrcat(szBuffer, _T("\r\n"));
lstrcat(szBuffer, _T("\r\n"));
}
_RPT0(_CRT_WARN, szBuffer); _RPT0(_CRT_WARN, szBuffer);
if (g_ctszDebugLog) if (g_ctszDebugLog)
{ {
HANDLE hfile = CreateFile(g_ctszDebugLog, GENERIC_WRITE, 0, NULL, HANDLE hfile = CreateFile(g_ctszDebugLog, GENERIC_WRITE, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hfile != INVALID_HANDLE_VALUE) if (hfile != INVALID_HANDLE_VALUE)
{ {
SetFilePointer(hfile, 0, NULL, FILE_END); SetFilePointer(hfile, 0, NULL, FILE_END);
DWORD dw; DWORD dw;
WriteFile(hfile, szBuffer, (lstrlen(szBuffer)+1)*sizeof(TCHAR), WriteFile(hfile, szBuffer, (lstrlen(szBuffer)+1)*sizeof(TCHAR),
&dw, NULL); &dw, NULL);
CloseHandle(hfile); CloseHandle(hfile);
} }
} }
va_end(args); va_end(args);
} }
BOOL AFXAPI AfxAssertFailedLine( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPCSTR lpszFileName, BOOL AFXAPI AfxAssertFailedLine( LPCSTR lpszFileName, int nLine,
int nLine, LPCTSTR lpszCondition )
LPCTSTR lpszCondition
)
{ {
// we remove WM_QUIT because if it is in the queue then the message box // we remove WM_QUIT because if it is in the queue then the message box
// won't display // won't display
MSG msg; MSG msg;
BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE); BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, lpszCondition); BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, lpszCondition);
if (bQuit) if (bQuit)
PostQuitMessage(msg.wParam); PostQuitMessage(msg.wParam);
return bResult; return bResult;
} }
#endif //_DEBUG #endif

View File

@ -1,11 +1,24 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/27/1999 // 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 #ifndef _AFX
#define _AFX #define _AFX
#pragma once
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
@ -19,7 +32,6 @@
// DEBUG_ONLY // DEBUG_ONLY
// determine number of elements in an array (not bytes) // determine number of elements in an array (not bytes)
#define _countof(array) (sizeof(array)/sizeof(array[0])) #define _countof(array) (sizeof(array)/sizeof(array[0]))

View File

@ -1,21 +1,21 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll XX XX
// SS SS tt ll ll // SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa XX XX
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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" #include "pch.hxx"
#include "resource.h" #include "resource.h"
@ -55,10 +55,10 @@ class CSingleInstance
void operator=( const CSingleInstance& ); // no implementation void operator=( const CSingleInstance& ); // no implementation
}; };
// see debug.cpp // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPCTSTR g_ctszDebugLog = _T("stella.log"); LPCTSTR g_ctszDebugLog = _T("stella.log");
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow ) LPTSTR lpCmdLine, int nCmdShow )
{ {

View File

@ -1,88 +1,75 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 "pch.hxx"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "resource.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 // Bring in the common control library
#pragma comment( lib, "comctl32" ) #pragma comment( lib, "comctl32" )
// Bring in multimedia timers // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText )
#pragma comment( lib, "winmm" )
void MessageBox(
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
)
{ {
const int nMaxStrLen = 1024; const int nMaxStrLen = 1024;
TCHAR tszCaption[nMaxStrLen + 1] = { 0 }; TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
TCHAR tszText[nMaxStrLen + 1] = { 0 }; TCHAR tszText[nMaxStrLen + 1] = { 0 };
// Caption is always "StellaX" // Caption is always "StellaX"
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen); LoadString(hInstance, uIDText, tszText, nMaxStrLen);
if (hwndParent == NULL)
hwndParent = ::GetForegroundWindow();
LoadString(hInstance, uIDText, tszText, nMaxStrLen); ::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
if (hwndParent == NULL)
{
hwndParent = ::GetForegroundWindow();
}
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
} }
void MessageBoxFromWinError( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DWORD dwError, void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ )
LPCTSTR pszCaption /* = NULL */
)
{ {
const int nMaxStrLen = 1024; const int nMaxStrLen = 1024;
TCHAR pszCaptionStellaX[nMaxStrLen + 1]; TCHAR pszCaptionStellaX[nMaxStrLen + 1];
if ( pszCaption == NULL ) if ( pszCaption == NULL )
{ {
// LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen); // LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
lstrcpy( pszCaptionStellaX, _T("StellaX") ); lstrcpy( pszCaptionStellaX, _T("StellaX") );
} }
LPTSTR pszText = NULL; LPTSTR pszText = NULL;
FormatMessage( FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
NULL, (LPTSTR)&pszText, 0, NULL);
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszText,
0,
NULL);
::MessageBox(::GetForegroundWindow(), pszText, ::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 ); MessageBoxFromWinError( GetLastError(), pszCaption );
} }

View File

@ -1,9 +1,24 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll XX XX
// Jeff Miller 05/01/2000 // 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 // Copyright (c) 1995-2000 by Jeff Miller
#define PCH_H // 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 WIN32_LEAN_AND_MEAN
#define DIRECTINPUT_VERSION 5 #define DIRECTINPUT_VERSION 5
@ -33,90 +48,13 @@
#endif #endif
#define UNUSED_ALWAYS(x) x #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 // Utility methods
// //
void MessageBox( void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText );
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
);
void MessageBoxFromWinError( void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ );
DWORD dwError,
LPCTSTR pszCaption /* = NULL */
);
void MessageBoxFromGetLastError( void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ );
LPCTSTR pszCaption /* = NULL */
);
#endif #endif