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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,284 +1,249 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CoolCaption.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "CoolCaption.hxx"
// MAKE SURE STYLE IS JUST "TITLE BAR" !
CCoolCaption::CCoolCaption(
) : \
m_hfont( NULL ),
m_tszCaption( NULL ),
m_fIsActive( FALSE ),
m_hDlg( NULL )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCoolCaption::CCoolCaption()
: m_hfont( NULL ),
m_tszCaption( NULL ),
m_fIsActive( FALSE ),
m_hDlg( NULL )
{
}
void CCoolCaption::OnInitDialog(
HWND hDlg
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnInitDialog( HWND hDlg )
{
m_hDlg = hDlg;
CalculateNCArea();
m_hDlg = hDlg;
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);
}
if ( m_hfont )
else
{
::DeleteObject( m_hfont );
}
// otherwise just do top and bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcCaption.bottom);
delete[] m_tszCaption;
m_tszCaption = NULL;
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::CalculateNCArea(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnNcActivate( BOOL fActive )
{
if ( m_hDlg == NULL )
{
return;
}
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_fIsActive = fActive;
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);
// 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);
}
void CCoolCaption::OnNcPaint(
HRGN hrgn
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CCoolCaption::OnNCLButtonDown( INT nHitTest, POINTS pts )
{
UNUSED_ALWAYS( hrgn );
UNUSED_ALWAYS( nHitTest );
if ( m_hDlg == NULL )
{
return;
}
if ( m_hDlg == NULL )
return FALSE;
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;
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)
{
// 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_rcClose, pt))
{
SendMessage(m_hDlg, WM_CLOSE, 0, 0);
return TRUE;
}
if (PtInRect(&m_rcMin, pt))
{
ShowWindow(m_hDlg, SW_MINIMIZE);
return TRUE;
}
if (PtInRect(&m_rcMin, pt))
{
ShowWindow(m_hDlg, SW_MINIMIZE);
return TRUE;
}
return FALSE;
return FALSE;
}
void CCoolCaption::FillSolidRect(
HDC hdc,
int x,
int y,
int cx,
int cy,
COLORREF clr
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::FillSolidRect( HDC hdc, int x, int y, int cx, int cy,
COLORREF clr )
{
COLORREF cr = SetBkColor(hdc, clr);
RECT rect = { x, y, x+cx, y+cy };
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
SetBkColor(hdc, cr);
COLORREF cr = SetBkColor(hdc, clr);
RECT rect = { x, y, x+cx, y+cy };
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
SetBkColor(hdc, cr);
}
void CCoolCaption::Draw3dRect(
HDC hdc,
int x,
int y,
int cx,
int cy,
COLORREF clrTopLeft,
COLORREF clrBottomRight
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::Draw3dRect( HDC hdc, int x, int y, int cx, int cy,
COLORREF clrTopLeft, COLORREF clrBottomRight )
{
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
}

View File

@ -1,51 +1,62 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CoolCaption.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef COOLCAP_H
#define COOLCAP_H
#pragma once
#ifndef COOL_CAPTION_HXX
#define COOL_CAPTION_HXX
class CCoolCaption
{
public:
CCoolCaption();
public:
CCoolCaption();
void OnInitDialog(HWND hDlg);
void OnDestroy();
void OnInitDialog(HWND hDlg);
void OnDestroy();
void OnNcPaint(HRGN);
void OnNcActivate(BOOL);
BOOL OnNCLButtonDown(INT, POINTS);
void OnNcPaint(HRGN);
void OnNcActivate(BOOL);
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);
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);
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
CCoolCaption( const CCoolCaption& ); // no implementation
void operator=( const CCoolCaption& ); // no implementation
};
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,352 +1,334 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HyperLink.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "HyperLink.hxx"
#include <shellapi.h>
CHyperLink::CHyperLink(
) : \
m_bOverControl(FALSE),
m_bVisited(FALSE),
m_hFont(NULL),
m_hLinkCursor(NULL)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHyperLink::CHyperLink()
: m_bOverControl(FALSE),
m_bVisited(FALSE),
m_hFont(NULL),
m_hLinkCursor(NULL)
{
m_crLinkColor = RGB( 0, 0, 238); // Blue
m_crVisitedColor = RGB( 85, 26, 139); // Purple
m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
m_crLinkColor = RGB( 0, 0, 238); // Blue
m_crVisitedColor = RGB( 85, 26, 139); // Purple
m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
SetDefaultCursor();
SetDefaultCursor();
}
CHyperLink::~CHyperLink(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHyperLink::~CHyperLink()
{
if (m_hFont)
{
::DeleteObject( m_hFont );
m_hFont = NULL;
}
if (m_hFont)
{
DeleteObject( m_hFont );
m_hFont = NULL;
}
}
void CHyperLink::SetURL(
LPCTSTR ctszURL
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::SetURL( LPCTSTR ctszURL )
{
if (ctszURL == NULL)
return;
lstrcpy(m_tszURL, ctszURL);
if (ctszURL == NULL)
return;
lstrcpy(m_tszURL, ctszURL);
}
void CHyperLink::PreSubclassWindow(
HWND hwnd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::PreSubclassWindow( HWND hwnd )
{
::GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
}
LRESULT CHyperLink::WndProc(
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::WndProc( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
case WM_PAINT:
rfHandled = TRUE;
return OnPaint(hwnd);
switch (msg)
{
case WM_PAINT:
rfHandled = TRUE;
return OnPaint(hwnd);
case WM_SETCURSOR:
rfHandled = TRUE;
return OnSetCursor(hwnd, LOWORD(lParam), HIWORD(lParam));
case WM_SETCURSOR:
rfHandled = TRUE;
return OnSetCursor(hwnd, LOWORD(lParam), HIWORD(lParam));
case WM_LBUTTONUP:
rfHandled = TRUE;
return OnLButtonUp(hwnd, wParam, LOWORD(lParam),
HIWORD(lParam));
case WM_LBUTTONUP:
rfHandled = TRUE;
return OnLButtonUp(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
case WM_MOUSEMOVE:
rfHandled = TRUE;
return OnMouseMove(hwnd, wParam, LOWORD(lParam),
HIWORD(lParam));
}
case WM_MOUSEMOVE:
rfHandled = TRUE;
return OnMouseMove(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
}
return 0;
return 0;
}
LRESULT CHyperLink::OnPaint(
HWND hwnd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnPaint( HWND hwnd )
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, m_hFont);
SelectObject(hdc, m_hFont);
if (m_bOverControl)
{
SetTextColor(hdc, m_crHoverColor);
}
else if (m_bVisited)
{
SetTextColor(hdc, m_crVisitedColor);
}
else
{
SetTextColor(hdc, m_crLinkColor);
}
if (m_bOverControl)
SetTextColor(hdc, m_crHoverColor);
else if (m_bVisited)
SetTextColor(hdc, m_crVisitedColor);
else
SetTextColor(hdc, m_crLinkColor);
::SetBkMode( hdc, TRANSPARENT );
::TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
EndPaint(hwnd, &ps);
return 0;
SetBkMode( hdc, TRANSPARENT );
TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
EndPaint(hwnd, &ps);
return 0;
}
BOOL CHyperLink::OnSetCursor(
HWND hwnd,
WORD nHittest,
WORD wMouseMsg
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CHyperLink::OnSetCursor( HWND hwnd, WORD nHittest, WORD wMouseMsg )
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( nHittest );
UNUSED_ALWAYS( wMouseMsg );
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( nHittest );
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);
return TRUE;
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 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))
{
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;
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module
void CHyperLink::SetDefaultCursor(
void
)
void CHyperLink::SetDefaultCursor()
{
if (m_hLinkCursor == NULL) // No cursor handle - load our own
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
HMODULE hModule = LoadLibrary(tszWndDir);
if (hModule) {
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if (hHandCursor)
m_hLinkCursor = CopyCursor(hHandCursor);
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
}
FreeLibrary(hModule);
else
*pos = '\0'; // Remove the parameter
lstrcat(pos, _T(" "));
lstrcat(pos, url);
result = (HINSTANCE) WinExec(key,showcmd);
}
}
}
LONG CHyperLink::GetRegKey(
HKEY key,
LPCTSTR subkey,
LPTSTR retdata
)
{
HKEY hkey;
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
if (retval == ERROR_SUCCESS) {
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;
}
return result;
}

View File

@ -1,10 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef HYPERLINK_H
#define HYPERLINK_H
#pragma once
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HyperLink.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef HYPER_LINK_HXX
#define HYPER_LINK_HXX
#define MAX_HYPERLINK_TEXT_LEN 256
#define MAX_HYPERLINK_URL 256
@ -13,54 +27,50 @@
class CHyperLink : public CWnd
{
public:
CHyperLink();
~CHyperLink();
public:
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);
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
private:
void SetDefaultCursor();
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();
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
void ReportError(int nError);
HINSTANCE GotoURL(LPCTSTR url, int showcmd);
HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdcStatic, HWND hwndStatic);
BOOL OnSetCursor(HWND hwnd, WORD nHittest, WORD wMouseMsg);
LRESULT OnPaint(HWND hwnd);
LRESULT OnLButtonUp(HWND, WPARAM, WORD, WORD);
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam);
// Stuff from the control
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
HFONT m_hFont;
HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdcStatic, HWND hwndStatic);
BOOL OnSetCursor(HWND hwnd, WORD nHittest, WORD wMouseMsg);
LRESULT OnPaint(HWND hwnd);
LRESULT OnLButtonUp(HWND, WPARAM, WORD, WORD);
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
// link specific
COLORREF m_crLinkColor;
COLORREF m_crVisitedColor;
COLORREF m_crHoverColor;
// Stuff from the control
BOOL m_bOverControl;
BOOL m_bVisited;
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
HFONT m_hFont;
HCURSOR m_hLinkCursor;
// link specific
TCHAR m_tszURL[MAX_HYPERLINK_URL + 1];
COLORREF m_crLinkColor;
COLORREF m_crVisitedColor;
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
CHyperLink( const CHyperLink& ); // no implementation
void operator=( const CHyperLink& ); // no implementation
};
#endif

View File

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

View File

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

View File

@ -1,260 +1,233 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/02/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PropertySheet.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "PropertySheet.hxx"
#pragma comment(lib, "comctl32")
#include <pshpack1.h>
typedef struct DLGTEMPLATEEX
{
WORD dlgVer;
WORD signature;
DWORD helpID;
DWORD exStyle;
DWORD style;
WORD cDlgItems;
short x;
short y;
short cx;
short cy;
WORD dlgVer;
WORD signature;
DWORD helpID;
DWORD exStyle;
DWORD style;
WORD cDlgItems;
short x;
short y;
short cx;
short cy;
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
#include <poppack.h>
CPropertyPage::CPropertyPage(
UINT nIDTemplate,
UINT nIDCaption /* = 0 */
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertyPage::CPropertyPage( UINT nIDTemplate, UINT nIDCaption /* = 0 */ )
{
UNUSED_ALWAYS( nIDCaption );
UNUSED_ALWAYS( nIDCaption );
ZeroMemory(&m_psp, sizeof(m_psp));
m_psp.dwSize = sizeof(m_psp);
m_psp.dwFlags = PSP_USECALLBACK;
// m_psp.hInstance = hInstance;
m_psp.pszTemplate = MAKEINTRESOURCE(nIDTemplate);
m_psp.pfnDlgProc = StaticDlgProc;
m_psp.lParam = (LPARAM)this;
m_psp.pfnCallback = StaticCallback;
ZeroMemory(&m_psp, sizeof(m_psp));
m_psp.dwSize = sizeof(m_psp);
m_psp.dwFlags = PSP_USECALLBACK;
// m_psp.hInstance = hInstance;
m_psp.pszTemplate = MAKEINTRESOURCE(nIDTemplate);
m_psp.pfnDlgProc = StaticDlgProc;
m_psp.lParam = (LPARAM)this;
m_psp.pfnCallback = StaticCallback;
}
UINT CALLBACK CPropertyPage::StaticCallback(
HWND hwnd,
UINT uMsg,
LPPROPSHEETPAGE ppsp
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UINT CALLBACK
CPropertyPage::StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp )
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( ppsp );
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( ppsp );
switch (uMsg)
{
case PSPCB_CREATE:
// ppsp->lParam holds create lParam
return TRUE;
switch (uMsg)
{
case PSPCB_CREATE:
// ppsp->lParam holds create lParam
return TRUE;
case PSPCB_RELEASE:
break;
}
case PSPCB_RELEASE:
break;
}
return 0;
return 0;
}
BOOL CALLBACK CPropertyPage::StaticDlgProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
CPropertyPage::StaticDlgProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
CPropertyPage* pPage = NULL;
CPropertyPage* pPage = NULL;
switch ( uMsg )
{
switch ( uMsg )
{
case WM_INITDIALOG:
pPage = reinterpret_cast<CPropertyPage*>(
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
(void)::SetWindowLong( hwnd,
DWL_USER,
reinterpret_cast<LONG>( pPage ) );
break;
pPage = reinterpret_cast<CPropertyPage*>(
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
(void)::SetWindowLong( hwnd, DWL_USER, reinterpret_cast<LONG>( pPage ) );
break;
default:
pPage = reinterpret_cast<CPropertyPage*>(
::GetWindowLong( hwnd, DWL_USER ) );
if ( pPage == NULL )
{
return FALSE;
}
break;
}
pPage = reinterpret_cast<CPropertyPage*>( GetWindowLong( hwnd, DWL_USER ) );
if ( pPage == NULL )
return FALSE;
break;
}
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
}
BOOL CALLBACK CPropertyPage::DlgProc(
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
CPropertyPage::DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch (msg)
{
switch (msg)
{
case WM_ACTIVATE:
OnActivate( (UINT)LOWORD(wParam), (HWND)lParam, (BOOL)HIWORD(wParam) );
return TRUE;
OnActivate( (UINT)LOWORD(wParam), (HWND)lParam, (BOOL)HIWORD(wParam) );
return TRUE;
case WM_INITDIALOG:
return OnInitDialog( hwnd );
case WM_INITDIALOG:
return OnInitDialog( hwnd );
case WM_DESTROY:
OnDestroy( );
return TRUE;
case WM_DESTROY:
OnDestroy( );
return TRUE;
case WM_COMMAND:
return OnCommand( HIWORD(wParam), LOWORD(wParam), (HWND)lParam );
case WM_COMMAND:
return OnCommand( HIWORD(wParam), LOWORD(wParam), (HWND)lParam );
case WM_NOTIFY:
// Handle PSN_QUERYCANCEL?
// Handle PSN_KILLACTIVE?
case WM_NOTIFY:
// Handle PSN_QUERYCANCEL?
// 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_SETACTIVE:
::SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_KILLACTIVE:
SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_KILLACTIVE:
::SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_APPLY:
SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
return TRUE;
case PSN_APPLY:
::SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
return TRUE;
case PSN_RESET:
OnReset( (LPPSHNOTIFY)lParam );
return TRUE;
}
return OnNotify( (int)wParam, (LPNMHDR)lParam );
}
case PSN_RESET:
OnReset( (LPPSHNOTIFY)lParam );
return TRUE;
}
return OnNotify( (int)wParam, (LPNMHDR)lParam );
}
return FALSE;
}
//
// CPropertySheet
//
CPropertySheet::CPropertySheet
(
LPCTSTR pszCaption,
HWND hwndParent,
UINT nStartPage /* = 0 */
) :\
m_strCaption( pszCaption )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertySheet::CPropertySheet( LPCTSTR pszCaption, HWND hwndParent,
UINT nStartPage /* = 0 */ )
: m_strCaption( pszCaption )
{
ZeroMemory(&m_psh, sizeof(m_psh));
m_psh.dwSize = sizeof(m_psh);
m_psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
m_psh.hwndParent = hwndParent;
m_psh.hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE);
m_psh.pszCaption = m_strCaption.c_str();
m_psh.nStartPage = nStartPage;
m_psh.pfnCallback = StaticCallback;
ZeroMemory(&m_psh, sizeof(m_psh));
m_psh.dwSize = sizeof(m_psh);
m_psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
m_psh.hwndParent = hwndParent;
m_psh.hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE);
m_psh.pszCaption = m_strCaption.c_str();
m_psh.nStartPage = nStartPage;
m_psh.pfnCallback = StaticCallback;
}
CPropertySheet::~CPropertySheet(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertySheet::~CPropertySheet()
{
// BUGBUG: This is static!
// BUGBUG: This is static!
/*
if ( m_hfontLogo )
{
::DeleteObject( m_hfontLogo );
m_hfontLogo = NULL;
}
*/
/* if ( m_hfontLogo )
{
DeleteObject( m_hfontLogo );
m_hfontLogo = NULL;
}*/
}
void CPropertySheet::AddPage(
CPropertyPage* pPage
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPropertySheet::AddPage( CPropertyPage* pPage )
{
if (pPage)
{
m_pages.push_back(pPage);
}
if (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)
return IDCANCEL;
if (nSize == 0)
return IDCANCEL;
PROPSHEETPAGE* pspage = new PROPSHEETPAGE[nSize];
for (int i = 0; i < nSize; ++i)
{
CopyMemory(&(pspage[i]), m_pages[i]->GetPropSheetPage(),
sizeof(PROPSHEETPAGE));
pspage[i].hInstance = m_psh.hInstance;
}
PROPSHEETPAGE* pspage = new PROPSHEETPAGE[nSize];
for (int i = 0; i < nSize; ++i)
{
CopyMemory(&(pspage[i]), m_pages[i]->GetPropSheetPage(),
sizeof(PROPSHEETPAGE));
pspage[i].hInstance = m_psh.hInstance;
}
m_psh.nPages = nSize;
m_psh.ppsp = pspage;
m_psh.nPages = nSize;
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,
UINT uMsg,
LPARAM lParam
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CALLBACK
CPropertySheet::StaticCallback( HWND hwnd, UINT uMsg, LPARAM lParam )
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( hwnd );
switch (uMsg)
{
case PSCB_INITIALIZED:
// Property sheet is being initialized
switch (uMsg)
{
case PSCB_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:
// Property sheet is about to be created
//
// Remove the DS_CONTEXTHELP style from the dialog template
// (This will remove the "?" in the top right corner)
//
if ( ( (LPDLGTEMPLATEEX)lParam )->signature == 0xFFFF)
{
( (LPDLGTEMPLATEEX)lParam )->style &= ~DS_CONTEXTHELP;
}
else
{
( (LPDLGTEMPLATE)lParam )->style &= ~DS_CONTEXTHELP;
}
return TRUE;
}
return TRUE;
}
return 0;
return 0;
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@ -1,186 +1,178 @@
//============================================================================
//
// StellaX
// Jeff Miller 10/12/1999
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TextButton3d.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "TextButton3d.hxx"
// button style should be VISIBLE / DISABLED / OWNERDRAW
CTextButton3d::CTextButton3d
(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CTextButton3d::CTextButton3d()
{
}
LRESULT CTextButton3d::WndProc
(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
{
switch (msg)
{
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CTextButton3d::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
#if 0
// TODO: re do this now that I send this message here
case WM_DRAWITEM:
rfHandled = TRUE;
pThis->OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
// TODO: re do this now that I send this message here
case WM_DRAWITEM:
rfHandled = TRUE;
pThis->OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
#endif
case WM_PAINT:
rfHandled = TRUE;
OnPaint(hWnd, (HDC)wParam);
return TRUE;
case WM_PAINT:
rfHandled = TRUE;
OnPaint(hWnd, (HDC)wParam);
return TRUE;
case WM_ERASEBKGND:
rfHandled = TRUE;
return OnEraseBkgnd(hWnd, (HDC)wParam);
}
case WM_ERASEBKGND:
rfHandled = TRUE;
return OnEraseBkgnd(hWnd, (HDC)wParam);
}
return 0;
return 0;
}
void CTextButton3d::OnPaint
(
HWND hwnd,
HDC hdcPaint
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CTextButton3d::OnPaint( HWND hwnd, HDC hdcPaint )
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
int cxClient, cyClient;
int cxClient, cyClient;
RECT rc;
GetClientRect(hwnd, &rc);
RECT rc;
GetClientRect(hwnd, &rc);
RECT rcClient;
CopyRect(&rcClient, &rc);
RECT rcClient;
CopyRect(&rcClient, &rc);
// lpdis->rcItem, lpdis->itemState
// lpdis->rcItem, lpdis->itemState
int l = GetWindowTextLength(hwnd);
LPTSTR text = new TCHAR[l + 2];
if (text == NULL)
{
EndPaint(hwnd, &ps);
return;
}
GetWindowText(hwnd, text, l+1);
int l = GetWindowTextLength(hwnd);
LPTSTR text = new TCHAR[l + 2];
if (text == NULL)
{
EndPaint(hwnd, &ps);
return;
}
GetWindowText(hwnd, text, l+1);
HFONT hfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(hfont, sizeof(lf), &lf);
if (lf.lfHeight == 0)
lf.lfHeight = 20;
lf.lfWidth = 0;
lf.lfWeight = FW_BLACK;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
HFONT hfontTry = CreateFontIndirect(&lf);
HFONT hfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(hfont, sizeof(lf), &lf);
if (lf.lfHeight == 0)
lf.lfHeight = 20;
lf.lfWidth = 0;
lf.lfWeight = FW_BLACK;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
HFONT hfontTry = CreateFontIndirect(&lf);
HFONT hfontOld = (HFONT)SelectObject(hdc, hfontTry);
HFONT hfontOld = (HFONT)SelectObject(hdc, hfontTry);
rcClient.left += 3;
rcClient.top += 3;
rcClient.right -= 3;
rcClient.bottom -= 3;
rcClient.left += 3;
rcClient.top += 3;
rcClient.right -= 3;
rcClient.bottom -= 3;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
SIZE sizeTextClient;
GetTextExtentPoint(hdc, text, lstrlen(text),
&sizeTextClient);
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
{
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
}
else
{
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
}
SIZE sizeTextClient;
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
else
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
lf.lfHeight--;
lf.lfHeight--;
rcClient.left -= 3;
rcClient.top -= 3;
rcClient.right += 3;
rcClient.bottom += 3;
rcClient.left -= 3;
rcClient.top -= 3;
rcClient.right += 3;
rcClient.bottom += 3;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
hfont = CreateFontIndirect(&lf);
SelectObject(hdc, hfont);
GetTextExtentPoint(hdc, text, lstrlen(text),
&sizeTextClient);
hfont = CreateFontIndirect(&lf);
SelectObject(hdc, hfont);
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
int iOldBkMode = SetBkMode(hdc, TRANSPARENT);
COLORREF crText = GetSysColor(COLOR_BTNTEXT);
COLORREF crOldText = SetTextColor(hdc, crText);
int iOldBkMode = SetBkMode(hdc, TRANSPARENT);
COLORREF crText = GetSysColor(COLOR_BTNTEXT);
COLORREF crOldText = SetTextColor(hdc, crText);
int cx = minx;
int cy = miny;
int cx = minx;
int cy = miny;
int s = 1;
cx += 3;
cy += 3;
int s = 1;
cx += 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));
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);
// draw the text
TextOut(hdc, cx, cy, text, lstrlen(text));
// 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);
SetBkMode(hdc, iOldBkMode);
SelectObject(hdc, hfontOld);
DeleteObject(hfont);
DeleteObject(hfontTry);
delete[] text;
EndPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
}
BOOL CTextButton3d::OnEraseBkgnd
(
HWND hwnd,
HDC hdc
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CTextButton3d::OnEraseBkgnd( HWND hwnd, HDC hdc )
{
// dont do any erasing
return TRUE;
// dont do any erasing
return TRUE;
}

View File

@ -1,10 +1,24 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef TXTBTN_H
#define TXTBTN_H
#pragma once
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TextButton3d.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef TEXT_BUTTON_HXX
#define TEXT_BUTTON_HXX
// derived from Roger Onslow's code
@ -12,22 +26,18 @@
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,
BOOL& rfHandled);
private:
void OnPaint(HWND, HDC);
BOOL OnEraseBkgnd(HWND, HDC);
CTextButton3d( const CTextButton3d& ); // no implementation
void operator=( const CTextButton3d& ); // no implementation
CTextButton3d( const CTextButton3d& ); // no implementation
void operator=( const CTextButton3d& ); // no implementation
};
#endif

View File

@ -1,75 +1,77 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Wnd.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "Wnd.hxx"
// REVIEW: Need to reset old wnd proc?
CWnd::CWnd(
) : \
m_pOldWindowProc(NULL),
m_hwnd(NULL)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CWnd::CWnd()
: m_pOldWindowProc(NULL),
m_hwnd(NULL)
{
}
BOOL CWnd::SubclassDlgItem(
HWND hwndParent,
UINT nID
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CWnd::SubclassDlgItem( HWND hwndParent, UINT nID )
{
if ( nID == 0 || hwndParent == NULL )
{
return FALSE;
}
if ( nID == 0 || hwndParent == NULL )
return FALSE;
// can't subclass twice!
// can't subclass twice!
if ( m_pOldWindowProc != NULL )
return FALSE;
if ( m_pOldWindowProc != NULL )
{
return FALSE;
}
m_hwnd = GetDlgItem( hwndParent, nID );
if (m_hwnd == NULL)
{
ASSERT( FALSE );
return FALSE;
}
m_hwnd = GetDlgItem( hwndParent, nID );
if (m_hwnd == NULL)
{
ASSERT( FALSE );
return FALSE;
}
PreSubclassWindow( m_hwnd );
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 );
SetWindowLong( m_hwnd, GWL_USERDATA, (LONG)this );
SetWindowLong( m_hwnd, GWL_WNDPROC, (LONG)StaticWndProc );
return TRUE;
return TRUE;
}
void CWnd::PreSubclassWindow(
HWND hwnd
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CWnd::PreSubclassWindow( HWND hwnd )
{
// no default behavior
// no default behavior
}
LRESULT CALLBACK CWnd::StaticWndProc(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam
)
{
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CALLBACK CWnd::StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam )
{
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
BOOL fHandled = FALSE;
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
BOOL fHandled = FALSE;
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
if (fHandled)
{
return lRes;
}
if (fHandled)
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
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef WND_H
#define WND_H
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Wnd.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef WND_HXX
#define WND_HXX
class CWnd
{
public:
public:
CWnd();
CWnd();
BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
operator HWND() const { return m_hwnd; }
operator HWND() const
{
return m_hwnd;
}
protected:
virtual void PreSubclassWindow( HWND hwnd );
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled ) = 0;
protected:
private:
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
virtual void PreSubclassWindow( HWND hwnd );
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled ) = 0;
WNDPROC m_pOldWindowProc;
HWND m_hwnd;
private:
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
CWnd( const CWnd& ); // no implementation
void operator=( const CWnd& ); // no implementation
};
#endif

View File

@ -1,7 +1,21 @@
//============================================================================
//
// StellaX
// Jeff Miller 04/27/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: debug.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "debug.hxx"
@ -11,65 +25,56 @@
extern LPCTSTR g_ctszDebugLog;
// ---------------------------------------------------------------------------
// DEBUG DEFINED
void AFX_CDECL AfxTrace(
LPCTSTR lpszFormat,
...
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AFX_CDECL AfxTrace( LPCTSTR lpszFormat, ... )
{
va_list args;
va_start(args, lpszFormat);
va_list args;
va_start(args, lpszFormat);
int nBuf;
TCHAR szBuffer[512];
int nBuf;
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?
ASSERT(nBuf >= 0);
// was there an error? was the expanded string too long?
ASSERT(nBuf >= 0);
if (nBuf < 511)
{
lstrcat(szBuffer, _T("\r\n"));
}
if (nBuf < 511)
lstrcat(szBuffer, _T("\r\n"));
_RPT0(_CRT_WARN, szBuffer);
_RPT0(_CRT_WARN, szBuffer);
if (g_ctszDebugLog)
{
HANDLE hfile = CreateFile(g_ctszDebugLog, GENERIC_WRITE, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hfile != INVALID_HANDLE_VALUE)
{
SetFilePointer(hfile, 0, NULL, FILE_END);
if (g_ctszDebugLog)
{
HANDLE hfile = CreateFile(g_ctszDebugLog, GENERIC_WRITE, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hfile != INVALID_HANDLE_VALUE)
{
SetFilePointer(hfile, 0, NULL, FILE_END);
DWORD dw;
WriteFile(hfile, szBuffer, (lstrlen(szBuffer)+1)*sizeof(TCHAR),
&dw, NULL);
DWORD dw;
WriteFile(hfile, szBuffer, (lstrlen(szBuffer)+1)*sizeof(TCHAR),
&dw, NULL);
CloseHandle(hfile);
}
}
CloseHandle(hfile);
}
}
va_end(args);
va_end(args);
}
BOOL AFXAPI AfxAssertFailedLine(
LPCSTR lpszFileName,
int nLine,
LPCTSTR lpszCondition
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL AFXAPI AfxAssertFailedLine( LPCSTR lpszFileName, int nLine,
LPCTSTR lpszCondition )
{
// we remove WM_QUIT because if it is in the queue then the message box
// won't display
MSG msg;
BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, lpszCondition);
if (bQuit)
PostQuitMessage(msg.wParam);
return bResult;
// we remove WM_QUIT because if it is in the queue then the message box
// won't display
MSG msg;
BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, lpszCondition);
if (bQuit)
PostQuitMessage(msg.wParam);
return bResult;
}
#endif //_DEBUG
#endif

View File

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

View File

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

View File

@ -1,88 +1,75 @@
//============================================================================
//
// StellaX
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: pch.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include <stdio.h>
#include <stdarg.h>
#include "resource.h"
// This will force in the DirectX library
#pragma comment( lib, "dxguid" )
// Bring in DirectInput library (for c_dfDIMouse, etc)
#pragma comment( lib, "dinput" )
// Bring in the common control library
#pragma comment( lib, "comctl32" )
// Bring in multimedia timers
#pragma comment( lib, "winmm" )
void MessageBox(
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText )
{
const int nMaxStrLen = 1024;
TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
TCHAR tszText[nMaxStrLen + 1] = { 0 };
const int nMaxStrLen = 1024;
TCHAR tszCaption[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);
if (hwndParent == NULL)
{
hwndParent = ::GetForegroundWindow();
}
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
}
void MessageBoxFromWinError(
DWORD dwError,
LPCTSTR pszCaption /* = NULL */
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ )
{
const int nMaxStrLen = 1024;
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
const int nMaxStrLen = 1024;
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
if ( pszCaption == NULL )
{
// LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
lstrcpy( pszCaptionStellaX, _T("StellaX") );
}
if ( pszCaption == NULL )
{
// LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
lstrcpy( pszCaptionStellaX, _T("StellaX") );
}
LPTSTR pszText = NULL;
LPTSTR pszText = NULL;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszText,
0,
NULL);
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszText, 0, NULL);
::MessageBox(::GetForegroundWindow(), pszText,
pszCaption ? pszCaption : pszCaptionStellaX, MB_ICONWARNING | MB_OK);
::MessageBox(::GetForegroundWindow(), pszText,
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
// Jeff Miller 05/01/2000
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
#ifndef PCH_H
#define PCH_H
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: pch.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef PCH_HXX
#define PCH_HXX
#define WIN32_LEAN_AND_MEAN
#define DIRECTINPUT_VERSION 5
@ -33,90 +48,13 @@
#endif
#define UNUSED_ALWAYS(x) x
//
// Simple string class
//
class CSimpleString
{
public:
CSimpleString() :
m_psz( NULL ),
m_cch( -1 )
{
}
~CSimpleString()
{
delete[] m_psz;
m_psz = NULL;
m_cch = -1;
}
BOOL Set( LPCTSTR psz )
{
int cch = lstrlen( psz );
if ( cch > m_cch )
{
delete[] m_psz;
m_psz = NULL;
m_cch = -1;
m_psz = new TCHAR[ cch + 1 ];
if ( m_psz == NULL )
{
return FALSE;
}
m_cch = cch;
}
memcpy( m_psz, psz, ( cch + 1 ) * sizeof( TCHAR ) );
return TRUE;
}
LPCTSTR Get( void ) const
{
ASSERT( m_psz != NULL );
return m_psz;
}
int Length( void ) const
{
return m_cch;
}
private:
//
// The string and its size (-1 means not initialized)
//
LPTSTR m_psz;
int m_cch;
CSimpleString( const CSimpleString& ); // no implementation
void operator=( const CSimpleString& ); // no implementation
};
//
// Utility methods
//
void MessageBox(
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
);
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText );
void MessageBoxFromWinError(
DWORD dwError,
LPCTSTR pszCaption /* = NULL */
);
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ );
void MessageBoxFromGetLastError(
LPCTSTR pszCaption /* = NULL */
);
void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ );
#endif