Commit e44e59cc authored by stephena's avatar stephena
Browse files

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
parent 17e7653f
//============================================================================
//
// 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 );
......
//============================================================================
//
// 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"
......
//============================================================================
//
// 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 );
......
//============================================================================
//
// 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;
};
......
//============================================================================
//
// 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 );
......
//============================================================================
//
// 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 $
//============================================================================
#ifndef CONFIGPG_H
#define CONFIGPG_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.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef CONFIG_PAGE_HXX
#define CONFIG_PAGE_HXX
#include "PropertySheet.hxx"
#include "GlobalData.hxx"
......
//============================================================================
//
// 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 )
{
return;
}
if ( m_hDlg == NULL )
return;
if ( m_hfont )
{
::DeleteObject( m_hfont );
}
if ( m_hfont )
DeleteObject( m_hfont );
delete[] m_tszCaption;
m_tszCaption = NULL;
delete[] m_tszCaption;
m_tszCaption = NULL;
}
void CCoolCaption::CalculateNCArea(
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::CalculateNCArea()
{
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);
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_cxFrame = ::GetSystemMetrics(SM_CXFRAME);
m_cyFrame = ::GetSystemMetrics(SM_CYFRAME);
m_cxButtonSize = ::GetSystemMetrics(SM_CXSIZE);
m_cxButtonSize = ::GetSystemMetrics(SM_CXSIZE);
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
// This is the size of the caption
// This is the size of the caption
SetRect(&m_rcCaption, 0, 0, m_cxWindow, cyCaption + m_cyFrame);
::SetRect(&m_rcCaption, 0, 0, m_cxWindow, cyCaption + m_cyFrame);
// calculate position of buttons
SetRect(&m_rcClose,
m_cxWindow - m_cxFrame - m_cxButtonSize + 1,
m_rcCaption.top + m_cyFrame + 1,
m_cxWindow - m_cxFrame - 1,
m_rcCaption.bottom - m_cyFrame
);
// calculate position of buttons
CopyRect(&m_rcMin, &m_rcClose);
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
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
);
// figure out union of all buttons
RECT rcButtons;
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
CopyRect(&m_rcMin, &m_rcClose);
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
SetRect(&m_rcTextArea, m_cxFrame, m_rcCaption.top+m_cyFrame,
rcButtons.left-m_cxFrame, m_rcCaption.bottom-m_cyFrame);
// figure out union of all buttons
// 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);
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);
// Get caption text
int nCaptionLength = GetWindowTextLength(m_hDlg);
m_tszCaption = new TCHAR[nCaptionLength + 2];
GetWindowText(m_hDlg, m_tszCaption, nCaptionLength+1);
}
void CCoolCaption::OnNcPaint(
HRGN hrgn
)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnNcPaint( HRGN hrgn )
{
UNUSED_ALWAYS( hrgn );
if ( m_hDlg == NULL )
{
return;
}
UNUSED_ALWAYS( hrgn );
HDC hdc = GetWindowDC(m_hDlg);
if ( m_hDlg == NULL )
return;
// Fill in the NC area with the proper color
HDC hdc = GetWindowDC(m_hDlg);
HPEN hpen, hpenOld;
// 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);
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