mirror of https://github.com/stella-emu/stella.git
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:
parent
17e7653f34
commit
e44e59cc13
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,18 +14,20 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: AboutPage.cxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
// $Id: AboutPage.cxx,v 1.2 2004-07-15 03:03:26 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "AboutPage.hxx"
|
#include "AboutPage.hxx"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CHelpPage::CHelpPage()
|
CHelpPage::CHelpPage()
|
||||||
: CPropertyPage(IDD_ABOUT_PAGE)
|
: CPropertyPage(IDD_ABOUT_PAGE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BOOL CHelpPage::OnInitDialog( HWND hwnd )
|
BOOL CHelpPage::OnInitDialog( HWND hwnd )
|
||||||
{
|
{
|
||||||
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );
|
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: AboutPage.hxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
|
// $Id: AboutPage.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef ABOUTPG_H
|
#ifndef ABOUT_PAGE_HXX
|
||||||
#define ABOUTPG_H
|
#define ABOUT_PAGE_HXX
|
||||||
|
|
||||||
#include "PropertySheet.hxx"
|
#include "PropertySheet.hxx"
|
||||||
#include "HyperLink.hxx"
|
#include "HyperLink.hxx"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1998 Scott D. Killen
|
// Copyright (c) 1998 Scott D. Killen
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,13 +14,13 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: BrowseForFolder.cxx,v 1.3 2004-07-06 22:51:58 stephena Exp $
|
// $Id: BrowseForFolder.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "BrowseForFolder.hxx"
|
#include "BrowseForFolder.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CBrowseForFolder::CBrowseForFolder(
|
CBrowseForFolder::CBrowseForFolder(
|
||||||
const HWND hParent,
|
const HWND hParent,
|
||||||
const LPITEMIDLIST pidl,
|
const LPITEMIDLIST pidl,
|
||||||
|
@ -37,15 +37,18 @@ CBrowseForFolder::CBrowseForFolder(
|
||||||
myBrowseInfo.lpfn = BrowseCallbackProc;
|
myBrowseInfo.lpfn = BrowseCallbackProc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CBrowseForFolder::~CBrowseForFolder()
|
CBrowseForFolder::~CBrowseForFolder()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
LPCTSTR CBrowseForFolder::GetSelectedFolder() const
|
LPCTSTR CBrowseForFolder::GetSelectedFolder() const
|
||||||
{
|
{
|
||||||
return mySelected;
|
return mySelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool CBrowseForFolder::SelectFolder()
|
bool CBrowseForFolder::SelectFolder()
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
|
@ -53,12 +56,8 @@ bool CBrowseForFolder::SelectFolder()
|
||||||
LPITEMIDLIST pidl;
|
LPITEMIDLIST pidl;
|
||||||
if ((pidl = SHBrowseForFolder(&myBrowseInfo)) != NULL)
|
if ((pidl = SHBrowseForFolder(&myBrowseInfo)) != NULL)
|
||||||
{
|
{
|
||||||
myPath.Set( _T("") );
|
|
||||||
if (SUCCEEDED(SHGetPathFromIDList(pidl, mySelected)))
|
if (SUCCEEDED(SHGetPathFromIDList(pidl, mySelected)))
|
||||||
{
|
|
||||||
bRet = true;
|
bRet = true;
|
||||||
myPath.Set( mySelected );
|
|
||||||
}
|
|
||||||
|
|
||||||
LPMALLOC pMalloc;
|
LPMALLOC pMalloc;
|
||||||
//Retrieve a pointer to the shell's IMalloc interface
|
//Retrieve a pointer to the shell's IMalloc interface
|
||||||
|
@ -75,11 +74,13 @@ bool CBrowseForFolder::SelectFolder()
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CBrowseForFolder::OnSelChanged(const LPITEMIDLIST pidl) const
|
void CBrowseForFolder::OnSelChanged(const LPITEMIDLIST pidl) const
|
||||||
{
|
{
|
||||||
(void)pidl;
|
(void)pidl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CBrowseForFolder::EnableOK(const bool bEnable) const
|
void CBrowseForFolder::EnableOK(const bool bEnable) const
|
||||||
{
|
{
|
||||||
if (myHwnd == NULL)
|
if (myHwnd == NULL)
|
||||||
|
@ -89,6 +90,7 @@ void CBrowseForFolder::EnableOK(const bool bEnable) const
|
||||||
(void)SendMessage( myHwnd, BFFM_ENABLEOK, NULL, static_cast<LPARAM>(bEnable) );
|
(void)SendMessage( myHwnd, BFFM_ENABLEOK, NULL, static_cast<LPARAM>(bEnable) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
|
void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
|
||||||
{
|
{
|
||||||
if (myHwnd == NULL)
|
if (myHwnd == NULL)
|
||||||
|
@ -97,6 +99,7 @@ void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
|
||||||
(void)SendMessage(myHwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast<LPARAM>(pidl));
|
(void)SendMessage(myHwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast<LPARAM>(pidl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CBrowseForFolder::SetSelection(LPCTSTR strPath) const
|
void CBrowseForFolder::SetSelection(LPCTSTR strPath) const
|
||||||
{
|
{
|
||||||
if (myHwnd == NULL)
|
if (myHwnd == NULL)
|
||||||
|
@ -105,6 +108,7 @@ void CBrowseForFolder::SetSelection(LPCTSTR strPath) const
|
||||||
(void)SendMessage(myHwnd, BFFM_SETSELECTION, TRUE, reinterpret_cast<LPARAM>(strPath));
|
(void)SendMessage(myHwnd, BFFM_SETSELECTION, TRUE, reinterpret_cast<LPARAM>(strPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||||
{
|
{
|
||||||
CBrowseForFolder* pbff = reinterpret_cast<CBrowseForFolder*>( lpData );
|
CBrowseForFolder* pbff = reinterpret_cast<CBrowseForFolder*>( lpData );
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1998 Scott D. Killen
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
//
|
//
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: BrowseForFolder.hxx,v 1.3 2004-07-06 22:51:58 stephena Exp $
|
// $Id: BrowseForFolder.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef __BROWSE_FOR_FOLDER_
|
#ifndef BROWSE_FOR_FOLDER_HXX
|
||||||
#define __BROWSE_FOR_FOLDER_
|
#define BROWSE_FOR_FOLDER_HXX
|
||||||
|
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
|
||||||
|
|
||||||
class CBrowseForFolder
|
class CBrowseForFolder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -69,7 +68,6 @@ class CBrowseForFolder
|
||||||
|
|
||||||
BROWSEINFO myBrowseInfo;
|
BROWSEINFO myBrowseInfo;
|
||||||
char mySelected[MAX_PATH];
|
char mySelected[MAX_PATH];
|
||||||
CSimpleString myPath;
|
|
||||||
HWND myHwnd;
|
HWND myHwnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,12 +14,9 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ConfigPage.cxx,v 1.4 2004-07-11 03:13:24 stephena Exp $
|
// $Id: ConfigPage.cxx,v 1.5 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
//#define WINVER 0x0501
|
|
||||||
//#include <afxcmn.h>
|
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "ConfigPage.hxx"
|
#include "ConfigPage.hxx"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -28,13 +25,14 @@
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "Settings.hxx"
|
#include "Settings.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CConfigPage::CConfigPage( CGlobalData& rGlobalData )
|
CConfigPage::CConfigPage( CGlobalData& rGlobalData )
|
||||||
: myGlobalData( rGlobalData ),
|
: myGlobalData( rGlobalData ),
|
||||||
CPropertyPage( IDD_CONFIG_PAGE )
|
CPropertyPage( IDD_CONFIG_PAGE )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BOOL CConfigPage::OnInitDialog( HWND hwnd )
|
BOOL CConfigPage::OnInitDialog( HWND hwnd )
|
||||||
{
|
{
|
||||||
m_hwnd = hwnd;
|
m_hwnd = hwnd;
|
||||||
|
@ -132,10 +130,12 @@ BOOL CConfigPage::OnInitDialog( HWND hwnd )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CConfigPage::OnDestroy( void )
|
void CConfigPage::OnDestroy( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
|
LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( lppsn );
|
UNUSED_ALWAYS( lppsn );
|
||||||
|
@ -243,6 +243,7 @@ LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
|
||||||
return PSNRET_NOERROR;
|
return PSNRET_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
|
BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( wNotifyCode );
|
UNUSED_ALWAYS( wNotifyCode );
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ConfigPage.hxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
// $Id: ConfigPage.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CONFIGPG_H
|
#ifndef CONFIG_PAGE_HXX
|
||||||
#define CONFIGPG_H
|
#define CONFIG_PAGE_HXX
|
||||||
|
|
||||||
#include "PropertySheet.hxx"
|
#include "PropertySheet.hxx"
|
||||||
#include "GlobalData.hxx"
|
#include "GlobalData.hxx"
|
||||||
|
|
|
@ -1,58 +1,63 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: CoolCaption.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "CoolCaption.hxx"
|
#include "CoolCaption.hxx"
|
||||||
|
|
||||||
// MAKE SURE STYLE IS JUST "TITLE BAR" !
|
// MAKE SURE STYLE IS JUST "TITLE BAR" !
|
||||||
|
|
||||||
CCoolCaption::CCoolCaption(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
) : \
|
CCoolCaption::CCoolCaption()
|
||||||
m_hfont( NULL ),
|
: m_hfont( NULL ),
|
||||||
m_tszCaption( NULL ),
|
m_tszCaption( NULL ),
|
||||||
m_fIsActive( FALSE ),
|
m_fIsActive( FALSE ),
|
||||||
m_hDlg( NULL )
|
m_hDlg( NULL )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoolCaption::OnInitDialog(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hDlg
|
void CCoolCaption::OnInitDialog( HWND hDlg )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
m_hDlg = hDlg;
|
m_hDlg = hDlg;
|
||||||
|
|
||||||
CalculateNCArea();
|
CalculateNCArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoolCaption::OnDestroy(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void
|
void CCoolCaption::OnDestroy( void )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if ( m_hDlg == NULL )
|
if ( m_hDlg == NULL )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_hfont )
|
if ( m_hfont )
|
||||||
{
|
DeleteObject( m_hfont );
|
||||||
::DeleteObject( m_hfont );
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] m_tszCaption;
|
delete[] m_tszCaption;
|
||||||
m_tszCaption = NULL;
|
m_tszCaption = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoolCaption::CalculateNCArea(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
)
|
void CCoolCaption::CalculateNCArea()
|
||||||
{
|
{
|
||||||
if ( m_hDlg == NULL )
|
if ( m_hDlg == NULL )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
::GetWindowRect(m_hDlg, &m_rcWindow);
|
GetWindowRect(m_hDlg, &m_rcWindow);
|
||||||
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
|
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
|
||||||
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
|
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
|
||||||
|
|
||||||
|
@ -64,11 +69,9 @@ void CCoolCaption::CalculateNCArea(
|
||||||
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
|
// calculate position of buttons
|
||||||
|
|
||||||
SetRect(&m_rcClose,
|
SetRect(&m_rcClose,
|
||||||
m_cxWindow - m_cxFrame - m_cxButtonSize + 1,
|
m_cxWindow - m_cxFrame - m_cxButtonSize + 1,
|
||||||
m_rcCaption.top + m_cyFrame + 1,
|
m_rcCaption.top + m_cyFrame + 1,
|
||||||
|
@ -80,7 +83,6 @@ void CCoolCaption::CalculateNCArea(
|
||||||
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
|
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
|
||||||
|
|
||||||
// figure out union of all buttons
|
// figure out union of all buttons
|
||||||
|
|
||||||
RECT rcButtons;
|
RECT rcButtons;
|
||||||
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
|
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
|
||||||
|
|
||||||
|
@ -88,7 +90,6 @@ void CCoolCaption::CalculateNCArea(
|
||||||
rcButtons.left-m_cxFrame, m_rcCaption.bottom-m_cyFrame);
|
rcButtons.left-m_cxFrame, m_rcCaption.bottom-m_cyFrame);
|
||||||
|
|
||||||
// Make bold caption font
|
// Make bold caption font
|
||||||
|
|
||||||
m_hfont = (HFONT)SendMessage(m_hDlg, WM_GETFONT, 0, 0);
|
m_hfont = (HFONT)SendMessage(m_hDlg, WM_GETFONT, 0, 0);
|
||||||
LOGFONT lf;
|
LOGFONT lf;
|
||||||
GetObject(m_hfont, sizeof(lf), &lf);
|
GetObject(m_hfont, sizeof(lf), &lf);
|
||||||
|
@ -96,28 +97,22 @@ void CCoolCaption::CalculateNCArea(
|
||||||
m_hfont = CreateFontIndirect(&lf);
|
m_hfont = CreateFontIndirect(&lf);
|
||||||
|
|
||||||
// Get caption text
|
// Get caption text
|
||||||
|
|
||||||
int nCaptionLength = GetWindowTextLength(m_hDlg);
|
int nCaptionLength = GetWindowTextLength(m_hDlg);
|
||||||
m_tszCaption = new TCHAR[nCaptionLength + 2];
|
m_tszCaption = new TCHAR[nCaptionLength + 2];
|
||||||
GetWindowText(m_hDlg, m_tszCaption, nCaptionLength+1);
|
GetWindowText(m_hDlg, m_tszCaption, nCaptionLength+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CCoolCaption::OnNcPaint(
|
void CCoolCaption::OnNcPaint( HRGN hrgn )
|
||||||
HRGN hrgn
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( hrgn );
|
UNUSED_ALWAYS( hrgn );
|
||||||
|
|
||||||
if ( m_hDlg == NULL )
|
if ( m_hDlg == NULL )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
HDC hdc = GetWindowDC(m_hDlg);
|
HDC hdc = GetWindowDC(m_hDlg);
|
||||||
|
|
||||||
// Fill in the NC area with the proper color
|
// Fill in the NC area with the proper color
|
||||||
|
|
||||||
HPEN hpen, hpenOld;
|
HPEN hpen, hpenOld;
|
||||||
|
|
||||||
hpen = CreatePen(PS_SOLID, 1, m_fIsActive ?
|
hpen = CreatePen(PS_SOLID, 1, m_fIsActive ?
|
||||||
|
@ -130,14 +125,12 @@ void CCoolCaption::OnNcPaint(
|
||||||
if (x < m_cxFrame-1 || x > m_cxWindow-m_cxFrame)
|
if (x < m_cxFrame-1 || x > m_cxWindow-m_cxFrame)
|
||||||
{
|
{
|
||||||
// left, right must go from top to bottom
|
// left, right must go from top to bottom
|
||||||
|
|
||||||
MoveToEx(hdc, x, 0, NULL);
|
MoveToEx(hdc, x, 0, NULL);
|
||||||
LineTo(hdc, x, m_rcWindow.bottom);
|
LineTo(hdc, x, m_rcWindow.bottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// otherwise just do top and bottom
|
// otherwise just do top and bottom
|
||||||
|
|
||||||
MoveToEx(hdc, x, 0, NULL);
|
MoveToEx(hdc, x, 0, NULL);
|
||||||
LineTo(hdc, x, m_rcCaption.bottom);
|
LineTo(hdc, x, m_rcCaption.bottom);
|
||||||
|
|
||||||
|
@ -150,15 +143,12 @@ void CCoolCaption::OnNcPaint(
|
||||||
DeleteObject(hpen);
|
DeleteObject(hpen);
|
||||||
|
|
||||||
// Draw the close button
|
// Draw the close button
|
||||||
|
|
||||||
DrawFrameControl(hdc, &m_rcClose, DFC_CAPTION, DFCS_CAPTIONCLOSE);
|
DrawFrameControl(hdc, &m_rcClose, DFC_CAPTION, DFCS_CAPTIONCLOSE);
|
||||||
|
|
||||||
// draw the minimize button
|
// draw the minimize button
|
||||||
|
|
||||||
DrawFrameControl(hdc, &m_rcMin, DFC_CAPTION, DFCS_CAPTIONMIN);
|
DrawFrameControl(hdc, &m_rcMin, DFC_CAPTION, DFCS_CAPTIONMIN);
|
||||||
|
|
||||||
// Draw the caption text
|
// Draw the caption text
|
||||||
|
|
||||||
SetTextColor(hdc, m_fIsActive ? GetSysColor(COLOR_CAPTIONTEXT) : \
|
SetTextColor(hdc, m_fIsActive ? GetSysColor(COLOR_CAPTIONTEXT) : \
|
||||||
GetSysColor(COLOR_INACTIVECAPTIONTEXT));
|
GetSysColor(COLOR_INACTIVECAPTIONTEXT));
|
||||||
SetBkMode(hdc, TRANSPARENT);
|
SetBkMode(hdc, TRANSPARENT);
|
||||||
|
@ -166,7 +156,6 @@ void CCoolCaption::OnNcPaint(
|
||||||
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
|
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
|
||||||
|
|
||||||
// calculate width / height of text
|
// calculate width / height of text
|
||||||
|
|
||||||
SIZE sizeText;
|
SIZE sizeText;
|
||||||
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
|
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
|
||||||
|
|
||||||
|
@ -177,11 +166,9 @@ void CCoolCaption::OnNcPaint(
|
||||||
SelectObject(hdc, hfontOld);
|
SelectObject(hdc, hfontOld);
|
||||||
|
|
||||||
// Draw the docking grippers
|
// Draw the docking grippers
|
||||||
|
|
||||||
const int nTextRight = m_rcTextArea.left + sizeText.cx + m_cxFrame;
|
const int nTextRight = m_rcTextArea.left + sizeText.cx + m_cxFrame;
|
||||||
|
|
||||||
// right top
|
// right top
|
||||||
|
|
||||||
COLORREF cr3dHilight = GetSysColor(COLOR_3DHILIGHT);
|
COLORREF cr3dHilight = GetSysColor(COLOR_3DHILIGHT);
|
||||||
COLORREF cr3dShadow = GetSysColor(COLOR_3DSHADOW);
|
COLORREF cr3dShadow = GetSysColor(COLOR_3DSHADOW);
|
||||||
|
|
||||||
|
@ -190,7 +177,6 @@ void CCoolCaption::OnNcPaint(
|
||||||
cr3dHilight, cr3dShadow);
|
cr3dHilight, cr3dShadow);
|
||||||
|
|
||||||
// right bottom
|
// right bottom
|
||||||
|
|
||||||
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
|
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
|
||||||
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
|
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
|
||||||
cr3dHilight, cr3dShadow);
|
cr3dHilight, cr3dShadow);
|
||||||
|
@ -198,9 +184,8 @@ void CCoolCaption::OnNcPaint(
|
||||||
ReleaseDC(m_hDlg, hdc);
|
ReleaseDC(m_hDlg, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoolCaption::OnNcActivate(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BOOL fActive
|
void CCoolCaption::OnNcActivate( BOOL fActive )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (m_hDlg == NULL)
|
if (m_hDlg == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -208,25 +193,19 @@ void CCoolCaption::OnNcActivate(
|
||||||
m_fIsActive = fActive;
|
m_fIsActive = fActive;
|
||||||
|
|
||||||
// This fixes a problem where alt-tab wont repaint the NC area
|
// This fixes a problem where alt-tab wont repaint the NC area
|
||||||
|
|
||||||
RedrawWindow(m_hDlg, NULL, NULL,
|
RedrawWindow(m_hDlg, NULL, NULL,
|
||||||
RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
|
RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CCoolCaption::OnNCLButtonDown(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
INT nHitTest,
|
BOOL CCoolCaption::OnNCLButtonDown( INT nHitTest, POINTS pts )
|
||||||
POINTS pts
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( nHitTest );
|
UNUSED_ALWAYS( nHitTest );
|
||||||
|
|
||||||
if ( m_hDlg == NULL )
|
if ( m_hDlg == NULL )
|
||||||
{
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
// Get the point in client units
|
// Get the point in client units
|
||||||
|
|
||||||
RECT rcWindow;
|
RECT rcWindow;
|
||||||
GetWindowRect(m_hDlg, &rcWindow);
|
GetWindowRect(m_hDlg, &rcWindow);
|
||||||
|
|
||||||
|
@ -236,9 +215,7 @@ BOOL CCoolCaption::OnNCLButtonDown(
|
||||||
|
|
||||||
if (PtInRect(&m_rcClose, pt))
|
if (PtInRect(&m_rcClose, pt))
|
||||||
{
|
{
|
||||||
// This isn't closing it!
|
SendMessage(m_hDlg, WM_CLOSE, 0, 0);
|
||||||
// SendMessage(m_hDlg, WM_CLOSE, 0, 0);
|
|
||||||
EndDialog(m_hDlg, IDCANCEL);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,14 +228,9 @@ BOOL CCoolCaption::OnNCLButtonDown(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoolCaption::FillSolidRect(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HDC hdc,
|
void CCoolCaption::FillSolidRect( HDC hdc, int x, int y, int cx, int cy,
|
||||||
int x,
|
COLORREF clr )
|
||||||
int y,
|
|
||||||
int cx,
|
|
||||||
int cy,
|
|
||||||
COLORREF clr
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
COLORREF cr = SetBkColor(hdc, clr);
|
COLORREF cr = SetBkColor(hdc, clr);
|
||||||
RECT rect = { x, y, x+cx, y+cy };
|
RECT rect = { x, y, x+cx, y+cy };
|
||||||
|
@ -266,19 +238,12 @@ void CCoolCaption::FillSolidRect(
|
||||||
SetBkColor(hdc, cr);
|
SetBkColor(hdc, cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoolCaption::Draw3dRect(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HDC hdc,
|
void CCoolCaption::Draw3dRect( HDC hdc, int x, int y, int cx, int cy,
|
||||||
int x,
|
COLORREF clrTopLeft, COLORREF clrBottomRight )
|
||||||
int y,
|
|
||||||
int cx,
|
|
||||||
int cy,
|
|
||||||
COLORREF clrTopLeft,
|
|
||||||
COLORREF clrBottomRight
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
|
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
|
||||||
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
|
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
|
||||||
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
|
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
|
||||||
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
|
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,28 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: CoolCaption.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#ifndef COOLCAP_H
|
#ifndef COOL_CAPTION_HXX
|
||||||
#define COOLCAP_H
|
#define COOL_CAPTION_HXX
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class CCoolCaption
|
class CCoolCaption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCoolCaption();
|
CCoolCaption();
|
||||||
|
|
||||||
void OnInitDialog(HWND hDlg);
|
void OnInitDialog(HWND hDlg);
|
||||||
|
@ -19,12 +32,10 @@ public:
|
||||||
void OnNcActivate(BOOL);
|
void OnNcActivate(BOOL);
|
||||||
BOOL OnNCLButtonDown(INT, POINTS);
|
BOOL OnNCLButtonDown(INT, POINTS);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
HWND m_hDlg;
|
HWND m_hDlg;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void CalculateNCArea(void);
|
void CalculateNCArea(void);
|
||||||
void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, COLORREF clr);
|
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,
|
void Draw3dRect(HDC hdc, int x, int y, int cx, int cy,
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
//
|
//
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Game.cxx,v 1.1 2004-07-10 22:25:58 stephena Exp $
|
// $Id: Game.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "Game.hxx"
|
#include "Game.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Game::Game( void )
|
Game::Game( void )
|
||||||
{
|
{
|
||||||
_available = false;
|
_available = false;
|
||||||
|
@ -29,7 +31,7 @@ Game::Game( void )
|
||||||
_note = " ";
|
_note = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Game::~Game( void )
|
Game::~Game( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
//
|
//
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Game.hxx,v 1.1 2004-07-10 22:25:58 stephena Exp $
|
// $Id: Game.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef GAME_H
|
#ifndef GAME_HXX
|
||||||
#define GAME_H
|
#define GAME_HXX
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: GlobalData.cxx,v 1.3 2004-07-10 22:25:58 stephena Exp $
|
// $Id: GlobalData.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
#include "SettingsWin32.hxx"
|
#include "SettingsWin32.hxx"
|
||||||
#include "GlobalData.hxx"
|
#include "GlobalData.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CGlobalData::CGlobalData( HINSTANCE hInstance )
|
CGlobalData::CGlobalData( HINSTANCE hInstance )
|
||||||
: mySettings(0),
|
: mySettings(0),
|
||||||
myInstance(hInstance)
|
myInstance(hInstance)
|
||||||
|
@ -34,6 +34,7 @@ CGlobalData::CGlobalData( HINSTANCE hInstance )
|
||||||
mySettings->loadConfig();
|
mySettings->loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CGlobalData::~CGlobalData()
|
CGlobalData::~CGlobalData()
|
||||||
{
|
{
|
||||||
if(mySettings)
|
if(mySettings)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: GlobalData.hxx,v 1.2 2004-07-10 22:25:58 stephena Exp $
|
// $Id: GlobalData.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef GLOBAL_DATA_HXX
|
#ifndef GLOBAL_DATA_HXX
|
||||||
|
|
|
@ -1,18 +1,35 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: HeaderCtrl.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "HeaderCtrl.hxx"
|
#include "HeaderCtrl.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CHeaderCtrl::CHeaderCtrl()
|
CHeaderCtrl::CHeaderCtrl()
|
||||||
: m_nSortCol(0),
|
: m_nSortCol(0),
|
||||||
m_fSortAsc(TRUE)
|
m_fSortAsc(TRUE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled )
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
|
LPARAM lParam, BOOL& rfHandled )
|
||||||
{
|
{
|
||||||
switch ( msg )
|
switch ( msg )
|
||||||
{
|
{
|
||||||
|
@ -25,6 +42,7 @@ LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
|
void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
|
||||||
{
|
{
|
||||||
m_nSortCol = nCol;
|
m_nSortCol = nCol;
|
||||||
|
@ -42,6 +60,7 @@ void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
|
||||||
InvalidateRect(hwndHeader, NULL, TRUE);
|
InvalidateRect(hwndHeader, NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CHeaderCtrl::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
|
void CHeaderCtrl::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( idCtl );
|
UNUSED_ALWAYS( idCtl );
|
||||||
|
|
|
@ -1,9 +1,24 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
#ifndef HDRCTL_H
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
#define HDRCTL_H
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: HeaderCtrl.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef HEADER_CTRL_HXX
|
||||||
|
#define HEADER_CTRL_HXX
|
||||||
|
|
||||||
#include "Wnd.hxx"
|
#include "Wnd.hxx"
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,30 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: HyperLink.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "HyperLink.hxx"
|
#include "HyperLink.hxx"
|
||||||
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
CHyperLink::CHyperLink(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
) : \
|
CHyperLink::CHyperLink()
|
||||||
m_bOverControl(FALSE),
|
: m_bOverControl(FALSE),
|
||||||
m_bVisited(FALSE),
|
m_bVisited(FALSE),
|
||||||
m_hFont(NULL),
|
m_hFont(NULL),
|
||||||
m_hLinkCursor(NULL)
|
m_hLinkCursor(NULL)
|
||||||
|
@ -21,43 +36,35 @@ CHyperLink::CHyperLink(
|
||||||
SetDefaultCursor();
|
SetDefaultCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
CHyperLink::~CHyperLink(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
)
|
CHyperLink::~CHyperLink()
|
||||||
{
|
{
|
||||||
if (m_hFont)
|
if (m_hFont)
|
||||||
{
|
{
|
||||||
::DeleteObject( m_hFont );
|
DeleteObject( m_hFont );
|
||||||
m_hFont = NULL;
|
m_hFont = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyperLink::SetURL(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
LPCTSTR ctszURL
|
void CHyperLink::SetURL( LPCTSTR ctszURL )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (ctszURL == NULL)
|
if (ctszURL == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lstrcpy(m_tszURL, ctszURL);
|
lstrcpy(m_tszURL, ctszURL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyperLink::PreSubclassWindow(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd
|
void CHyperLink::PreSubclassWindow( HWND hwnd )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
::GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
|
GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
|
||||||
|
|
||||||
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
|
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CHyperLink::WndProc(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
LRESULT CHyperLink::WndProc( HWND hwnd, UINT msg, WPARAM wParam,
|
||||||
UINT msg,
|
LPARAM lParam, BOOL& rfHandled )
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam,
|
|
||||||
BOOL& rfHandled
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
|
@ -71,21 +78,18 @@ LRESULT CHyperLink::WndProc(
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
rfHandled = TRUE;
|
rfHandled = TRUE;
|
||||||
return OnLButtonUp(hwnd, wParam, LOWORD(lParam),
|
return OnLButtonUp(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
|
||||||
HIWORD(lParam));
|
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
rfHandled = TRUE;
|
rfHandled = TRUE;
|
||||||
return OnMouseMove(hwnd, wParam, LOWORD(lParam),
|
return OnMouseMove(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
|
||||||
HIWORD(lParam));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CHyperLink::OnPaint(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd
|
LRESULT CHyperLink::OnPaint( HWND hwnd )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
HDC hdc = BeginPaint(hwnd, &ps);
|
HDC hdc = BeginPaint(hwnd, &ps);
|
||||||
|
@ -93,31 +97,21 @@ LRESULT CHyperLink::OnPaint(
|
||||||
SelectObject(hdc, m_hFont);
|
SelectObject(hdc, m_hFont);
|
||||||
|
|
||||||
if (m_bOverControl)
|
if (m_bOverControl)
|
||||||
{
|
|
||||||
SetTextColor(hdc, m_crHoverColor);
|
SetTextColor(hdc, m_crHoverColor);
|
||||||
}
|
|
||||||
else if (m_bVisited)
|
else if (m_bVisited)
|
||||||
{
|
|
||||||
SetTextColor(hdc, m_crVisitedColor);
|
SetTextColor(hdc, m_crVisitedColor);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
SetTextColor(hdc, m_crLinkColor);
|
SetTextColor(hdc, m_crLinkColor);
|
||||||
}
|
|
||||||
|
|
||||||
::SetBkMode( hdc, TRANSPARENT );
|
|
||||||
|
|
||||||
::TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
|
|
||||||
|
|
||||||
|
SetBkMode( hdc, TRANSPARENT );
|
||||||
|
TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CHyperLink::OnSetCursor(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
BOOL CHyperLink::OnSetCursor( HWND hwnd, WORD nHittest, WORD wMouseMsg )
|
||||||
WORD nHittest,
|
|
||||||
WORD wMouseMsg
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( hwnd );
|
UNUSED_ALWAYS( hwnd );
|
||||||
UNUSED_ALWAYS( nHittest );
|
UNUSED_ALWAYS( nHittest );
|
||||||
|
@ -125,19 +119,15 @@ BOOL CHyperLink::OnSetCursor(
|
||||||
|
|
||||||
if (m_hLinkCursor)
|
if (m_hLinkCursor)
|
||||||
{
|
{
|
||||||
::SetCursor(m_hLinkCursor);
|
SetCursor(m_hLinkCursor);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CHyperLink::OnLButtonUp(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
LRESULT CHyperLink::OnLButtonUp( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
|
||||||
WPARAM fwKeys,
|
|
||||||
WORD xPos,
|
|
||||||
WORD yPos
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( fwKeys );
|
UNUSED_ALWAYS( fwKeys );
|
||||||
UNUSED_ALWAYS( xPos );
|
UNUSED_ALWAYS( xPos );
|
||||||
|
@ -159,17 +149,12 @@ LRESULT CHyperLink::OnLButtonUp(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CHyperLink::OnMouseMove(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
LRESULT CHyperLink::OnMouseMove( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
|
||||||
WPARAM fwKeys,
|
|
||||||
WORD xPos,
|
|
||||||
WORD yPos
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( fwKeys );
|
UNUSED_ALWAYS( fwKeys );
|
||||||
|
|
||||||
// call defwindowproc?
|
// call defwindowproc?
|
||||||
|
|
||||||
if (m_bOverControl)
|
if (m_bOverControl)
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
@ -195,17 +180,14 @@ LRESULT CHyperLink::OnMouseMove(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
|
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
|
||||||
// It loads a "hand" cursor from the winhlp32.exe module
|
// It loads a "hand" cursor from the winhlp32.exe module
|
||||||
|
void CHyperLink::SetDefaultCursor()
|
||||||
void CHyperLink::SetDefaultCursor(
|
|
||||||
void
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (m_hLinkCursor == NULL) // No cursor handle - load our own
|
if (m_hLinkCursor == NULL) // No cursor handle - load our own
|
||||||
{
|
{
|
||||||
// Get the windows directory
|
// Get the windows directory
|
||||||
|
|
||||||
TCHAR tszWndDir[MAX_PATH + 1];
|
TCHAR tszWndDir[MAX_PATH + 1];
|
||||||
GetWindowsDirectory(tszWndDir, MAX_PATH);
|
GetWindowsDirectory(tszWndDir, MAX_PATH);
|
||||||
|
|
||||||
|
@ -213,7 +195,8 @@ void CHyperLink::SetDefaultCursor(
|
||||||
|
|
||||||
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
|
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
|
||||||
HMODULE hModule = LoadLibrary(tszWndDir);
|
HMODULE hModule = LoadLibrary(tszWndDir);
|
||||||
if (hModule) {
|
if (hModule)
|
||||||
|
{
|
||||||
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
|
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
|
||||||
if (hHandCursor)
|
if (hHandCursor)
|
||||||
m_hLinkCursor = CopyCursor(hHandCursor);
|
m_hLinkCursor = CopyCursor(hHandCursor);
|
||||||
|
@ -222,16 +205,14 @@ void CHyperLink::SetDefaultCursor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG CHyperLink::GetRegKey(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HKEY key,
|
LONG CHyperLink::GetRegKey( HKEY key, LPCTSTR subkey, LPTSTR retdata )
|
||||||
LPCTSTR subkey,
|
|
||||||
LPTSTR retdata
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
|
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
|
||||||
|
|
||||||
if (retval == ERROR_SUCCESS) {
|
if (retval == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
long datasize = MAX_PATH;
|
long datasize = MAX_PATH;
|
||||||
TCHAR data[MAX_PATH];
|
TCHAR data[MAX_PATH];
|
||||||
RegQueryValue(hkey, NULL, data, &datasize);
|
RegQueryValue(hkey, NULL, data, &datasize);
|
||||||
|
@ -242,11 +223,11 @@ LONG CHyperLink::GetRegKey(
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyperLink::ReportError(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int nError
|
void CHyperLink::ReportError( int nError )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
|
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
|
||||||
|
|
||||||
switch (nError)
|
switch (nError)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -312,10 +293,8 @@ void CHyperLink::ReportError(
|
||||||
MessageBox(NULL, tsz, tszCaption, MB_ICONEXCLAMATION | MB_OK);
|
MessageBox(NULL, tsz, tszCaption, MB_ICONEXCLAMATION | MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
HINSTANCE CHyperLink::GotoURL(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
LPCTSTR url,
|
HINSTANCE CHyperLink::GotoURL( LPCTSTR url, int showcmd )
|
||||||
int showcmd
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
TCHAR key[MAX_PATH + MAX_PATH];
|
TCHAR key[MAX_PATH + MAX_PATH];
|
||||||
|
|
||||||
|
@ -323,15 +302,18 @@ HINSTANCE CHyperLink::GotoURL(
|
||||||
HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL,NULL, showcmd);
|
HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL,NULL, showcmd);
|
||||||
|
|
||||||
// If it failed, get the .htm regkey and lookup the program
|
// If it failed, get the .htm regkey and lookup the program
|
||||||
if ((UINT)result <= HINSTANCE_ERROR) {
|
if ((UINT)result <= HINSTANCE_ERROR)
|
||||||
|
{
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS) {
|
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
lstrcat(key, _T("\\shell\\open\\command"));
|
lstrcat(key, _T("\\shell\\open\\command"));
|
||||||
|
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) {
|
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
TCHAR *pos;
|
TCHAR *pos;
|
||||||
pos = _tcsstr(key, _T("\"%1\""));
|
pos = _tcsstr(key, _T("\"%1\""));
|
||||||
if (pos == NULL) { // No quotes found
|
if (pos == NULL)
|
||||||
|
{ // No quotes found
|
||||||
pos = strstr(key, _T("%1")); // Check for %1, without quotes
|
pos = strstr(key, _T("%1")); // Check for %1, without quotes
|
||||||
if (pos == NULL) // No parameter at all...
|
if (pos == NULL) // No parameter at all...
|
||||||
pos = key+lstrlen(key)-1;
|
pos = key+lstrlen(key)-1;
|
||||||
|
|
|
@ -1,10 +1,24 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
#ifndef HYPERLINK_H
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
#define HYPERLINK_H
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
#pragma once
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: HyperLink.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef HYPER_LINK_HXX
|
||||||
|
#define HYPER_LINK_HXX
|
||||||
|
|
||||||
#define MAX_HYPERLINK_TEXT_LEN 256
|
#define MAX_HYPERLINK_TEXT_LEN 256
|
||||||
#define MAX_HYPERLINK_URL 256
|
#define MAX_HYPERLINK_URL 256
|
||||||
|
@ -13,20 +27,18 @@
|
||||||
|
|
||||||
class CHyperLink : public CWnd
|
class CHyperLink : public CWnd
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CHyperLink();
|
CHyperLink();
|
||||||
~CHyperLink();
|
~CHyperLink();
|
||||||
|
|
||||||
void SetURL(LPCTSTR ctszURL);
|
void SetURL(LPCTSTR ctszURL);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void PreSubclassWindow(HWND hwnd);
|
virtual void PreSubclassWindow(HWND hwnd);
|
||||||
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||||
BOOL& rfHandled);
|
BOOL& rfHandled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void SetDefaultCursor();
|
void SetDefaultCursor();
|
||||||
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
|
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
|
||||||
void ReportError(int nError);
|
void ReportError(int nError);
|
||||||
|
@ -42,12 +54,10 @@ private:
|
||||||
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
|
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
|
||||||
|
|
||||||
// Stuff from the control
|
// Stuff from the control
|
||||||
|
|
||||||
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
|
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
|
||||||
HFONT m_hFont;
|
HFONT m_hFont;
|
||||||
|
|
||||||
// link specific
|
// link specific
|
||||||
|
|
||||||
COLORREF m_crLinkColor;
|
COLORREF m_crLinkColor;
|
||||||
COLORREF m_crVisitedColor;
|
COLORREF m_crVisitedColor;
|
||||||
COLORREF m_crHoverColor;
|
COLORREF m_crHoverColor;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: MainDlg.cxx,v 1.6 2004-07-15 00:11:06 stephena Exp $
|
// $Id: MainDlg.cxx,v 1.7 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
|
@ -142,10 +142,8 @@ MainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||||
case WM_NCLBUTTONDOWN:
|
case WM_NCLBUTTONDOWN:
|
||||||
return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) );
|
return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) );
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_CLOSE:
|
||||||
// Allow Alt-F4 to close the window
|
Quit();
|
||||||
if ( wParam == SC_CLOSE )
|
|
||||||
Quit(myHwnd);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +275,7 @@ BOOL MainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
|
||||||
break; // case IDC_PLAY
|
break; // case IDC_PLAY
|
||||||
|
|
||||||
case IDC_EXIT:
|
case IDC_EXIT:
|
||||||
Quit(hwnd);
|
Quit();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break; // case IDC_EXIT
|
break; // case IDC_EXIT
|
||||||
|
|
||||||
|
@ -308,8 +306,7 @@ BOOL MainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
|
||||||
|
|
||||||
case IDC_RELOAD:
|
case IDC_RELOAD:
|
||||||
{
|
{
|
||||||
LoadRomListFromDisk();
|
UpdateRomList( true );
|
||||||
ListView_SortByColumn( myHwndList, myGlobalData.settings().getInt("sortcol") );
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break; // case IDC_RELOAD
|
break; // case IDC_RELOAD
|
||||||
}
|
}
|
||||||
|
@ -457,7 +454,7 @@ HBRUSH MainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void MainDlg::Quit( HWND hwnd )
|
void MainDlg::Quit()
|
||||||
{
|
{
|
||||||
// OK, reload the settings to make sure we have the most current ones
|
// OK, reload the settings to make sure we have the most current ones
|
||||||
myGlobalData.settings().loadConfig();
|
myGlobalData.settings().loadConfig();
|
||||||
|
@ -468,26 +465,47 @@ void MainDlg::Quit( HWND hwnd )
|
||||||
|
|
||||||
// Save the column widths
|
// Save the column widths
|
||||||
myGlobalData.settings().setInt("namecolwidth",
|
myGlobalData.settings().setInt("namecolwidth",
|
||||||
ListView_GetColWidth( hwnd, 0 ));
|
ListView_GetColWidth( myHwnd, 0 ));
|
||||||
myGlobalData.settings().setInt("manufacturercolwidth",
|
myGlobalData.settings().setInt("manufacturercolwidth",
|
||||||
ListView_GetColWidth( hwnd, 1 ));
|
ListView_GetColWidth( myHwnd, 1 ));
|
||||||
myGlobalData.settings().setInt("raritycolwidth",
|
myGlobalData.settings().setInt("raritycolwidth",
|
||||||
ListView_GetColWidth( hwnd, 2 ));
|
ListView_GetColWidth( myHwnd, 2 ));
|
||||||
|
|
||||||
// Now, save the settings
|
// Now, save the settings
|
||||||
myGlobalData.settings().saveConfig();
|
myGlobalData.settings().saveConfig();
|
||||||
|
|
||||||
ListView_Clear();
|
ListView_Clear();
|
||||||
EndDialog( hwnd, IDCANCEL );
|
EndDialog( myHwnd, IDCANCEL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void MainDlg::UpdateRomList( void )
|
void MainDlg::UpdateRomList( bool forceReload )
|
||||||
{
|
{
|
||||||
HWND hwndText;
|
HWND hwndText;
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
TCHAR psz[256 + 1];
|
||||||
|
TCHAR pszStatus[256 + 1];
|
||||||
|
|
||||||
PopulateRomList();
|
// Erase status text
|
||||||
|
LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256);
|
||||||
|
wsprintf( psz, pszStatus, 0 );
|
||||||
|
hwndText = GetDlgItem( *this, IDC_ROMCOUNT );
|
||||||
|
GetWindowRect(hwndText, &rc);
|
||||||
|
ScreenToClient( *this, (LPPOINT)&rc );
|
||||||
|
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
|
||||||
|
SetWindowText( hwndText, psz );
|
||||||
|
InvalidateRect( *this, &rc, TRUE );
|
||||||
|
|
||||||
|
// Erase rom path
|
||||||
|
hwndText = GetDlgItem( *this, IDC_ROMPATH );
|
||||||
|
GetWindowRect(hwndText, &rc);
|
||||||
|
ScreenToClient( *this, (LPPOINT)&rc );
|
||||||
|
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
|
||||||
|
SetWindowText( hwndText, "" );
|
||||||
|
InvalidateRect( *this, &rc, TRUE );
|
||||||
|
|
||||||
|
// Get the ROM gamelist, either from disk or cache
|
||||||
|
PopulateRomList( forceReload );
|
||||||
|
|
||||||
// if items added, select first item and enable play button
|
// if items added, select first item and enable play button
|
||||||
int nCount = ListView_GetItemCount( myHwndList );
|
int nCount = ListView_GetItemCount( myHwndList );
|
||||||
|
@ -495,8 +513,6 @@ void MainDlg::UpdateRomList( void )
|
||||||
EnableWindow(GetDlgItem( *this, IDC_PLAY), FALSE );
|
EnableWindow(GetDlgItem( *this, IDC_PLAY), FALSE );
|
||||||
|
|
||||||
// Show status text
|
// Show status text
|
||||||
TCHAR psz[256 + 1];
|
|
||||||
TCHAR pszStatus[256 + 1];
|
|
||||||
LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256);
|
LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256);
|
||||||
wsprintf( psz, pszStatus, nCount );
|
wsprintf( psz, pszStatus, nCount );
|
||||||
hwndText = GetDlgItem( *this, IDC_ROMCOUNT );
|
hwndText = GetDlgItem( *this, IDC_ROMCOUNT );
|
||||||
|
@ -516,13 +532,15 @@ void MainDlg::UpdateRomList( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool MainDlg::PopulateRomList( void )
|
bool MainDlg::PopulateRomList( bool forceReload )
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
bool cacheFileExists = myGlobalData.settings().fileExists("stellax.cache");
|
bool cacheFileExists = myGlobalData.settings().fileExists("stellax.cache");
|
||||||
bool cacheIsStale = false; // FIXME - add romdir status checking
|
bool cacheIsStale = false; // FIXME - add romdir status checking
|
||||||
|
|
||||||
if (cacheFileExists && !cacheIsStale)
|
if (forceReload)
|
||||||
|
result = LoadRomListFromDisk();
|
||||||
|
else if (cacheFileExists && !cacheIsStale)
|
||||||
{
|
{
|
||||||
result = LoadRomListFromCache();
|
result = LoadRomListFromCache();
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: MainDlg.hxx,v 1.5 2004-07-15 00:11:07 stephena Exp $
|
// $Id: MainDlg.hxx,v 1.6 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef __MAINDLG_H_
|
#ifndef MAIN_DLG_HXX
|
||||||
#define __MAINDLG_H_
|
#define MAIN_DLG_HXX
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ class CGlobalData;
|
||||||
#include "HeaderCtrl.hxx"
|
#include "HeaderCtrl.hxx"
|
||||||
#include "RoundButton.hxx"
|
#include "RoundButton.hxx"
|
||||||
|
|
||||||
|
|
||||||
class MainDlg
|
class MainDlg
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -70,6 +69,7 @@ class MainDlg
|
||||||
void OnDestroy( void );
|
void OnDestroy( void );
|
||||||
void OnNcPaint( HRGN hrgn );
|
void OnNcPaint( HRGN hrgn );
|
||||||
void OnNcActivate( BOOL fActive );
|
void OnNcActivate( BOOL fActive );
|
||||||
|
void Quit();
|
||||||
BOOL OnNcLButtonDown( INT nHitTest, POINTS pts );
|
BOOL OnNcLButtonDown( INT nHitTest, POINTS pts );
|
||||||
|
|
||||||
// callback methods
|
// callback methods
|
||||||
|
@ -78,13 +78,11 @@ class MainDlg
|
||||||
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
|
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
|
||||||
|
|
||||||
// internal data
|
// internal data
|
||||||
void UpdateRomList();
|
void UpdateRomList( bool forceReload = false );
|
||||||
bool PopulateRomList();
|
bool PopulateRomList( bool forceReload = false );
|
||||||
bool LoadRomListFromDisk();
|
bool LoadRomListFromDisk();
|
||||||
bool LoadRomListFromCache();
|
bool LoadRomListFromCache();
|
||||||
|
|
||||||
void Quit( HWND hwnd );
|
|
||||||
|
|
||||||
HINSTANCE myHInstance;
|
HINSTANCE myHInstance;
|
||||||
|
|
||||||
HWND myHwndList;
|
HWND myHwndList;
|
||||||
|
|
|
@ -1,13 +1,28 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/02/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: PropertySheet.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "PropertySheet.hxx"
|
#include "PropertySheet.hxx"
|
||||||
|
|
||||||
#pragma comment(lib, "comctl32")
|
#pragma comment(lib, "comctl32")
|
||||||
|
|
||||||
#include <pshpack1.h>
|
#include <pshpack1.h>
|
||||||
|
|
||||||
typedef struct DLGTEMPLATEEX
|
typedef struct DLGTEMPLATEEX
|
||||||
{
|
{
|
||||||
WORD dlgVer;
|
WORD dlgVer;
|
||||||
|
@ -21,12 +36,11 @@ typedef struct DLGTEMPLATEEX
|
||||||
short cx;
|
short cx;
|
||||||
short cy;
|
short cy;
|
||||||
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
|
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
|
||||||
|
|
||||||
#include <poppack.h>
|
#include <poppack.h>
|
||||||
|
|
||||||
CPropertyPage::CPropertyPage(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
UINT nIDTemplate,
|
CPropertyPage::CPropertyPage( UINT nIDTemplate, UINT nIDCaption /* = 0 */ )
|
||||||
UINT nIDCaption /* = 0 */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( nIDCaption );
|
UNUSED_ALWAYS( nIDCaption );
|
||||||
|
|
||||||
|
@ -40,11 +54,9 @@ CPropertyPage::CPropertyPage(
|
||||||
m_psp.pfnCallback = StaticCallback;
|
m_psp.pfnCallback = StaticCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT CALLBACK CPropertyPage::StaticCallback(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
UINT CALLBACK
|
||||||
UINT uMsg,
|
CPropertyPage::StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp )
|
||||||
LPPROPSHEETPAGE ppsp
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( hwnd );
|
UNUSED_ALWAYS( hwnd );
|
||||||
UNUSED_ALWAYS( ppsp );
|
UNUSED_ALWAYS( ppsp );
|
||||||
|
@ -62,12 +74,9 @@ UINT CALLBACK CPropertyPage::StaticCallback(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK CPropertyPage::StaticDlgProc(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
BOOL CALLBACK
|
||||||
UINT uMsg,
|
CPropertyPage::StaticDlgProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
CPropertyPage* pPage = NULL;
|
CPropertyPage* pPage = NULL;
|
||||||
|
|
||||||
|
@ -76,30 +85,22 @@ BOOL CALLBACK CPropertyPage::StaticDlgProc(
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
pPage = reinterpret_cast<CPropertyPage*>(
|
pPage = reinterpret_cast<CPropertyPage*>(
|
||||||
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
|
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
|
||||||
(void)::SetWindowLong( hwnd,
|
(void)::SetWindowLong( hwnd, DWL_USER, reinterpret_cast<LONG>( pPage ) );
|
||||||
DWL_USER,
|
|
||||||
reinterpret_cast<LONG>( pPage ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pPage = reinterpret_cast<CPropertyPage*>(
|
pPage = reinterpret_cast<CPropertyPage*>( GetWindowLong( hwnd, DWL_USER ) );
|
||||||
::GetWindowLong( hwnd, DWL_USER ) );
|
|
||||||
if ( pPage == NULL )
|
if ( pPage == NULL )
|
||||||
{
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
|
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK CPropertyPage::DlgProc(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
BOOL CALLBACK
|
||||||
UINT msg,
|
CPropertyPage::DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
|
@ -120,44 +121,34 @@ BOOL CALLBACK CPropertyPage::DlgProc(
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
// Handle PSN_QUERYCANCEL?
|
// Handle PSN_QUERYCANCEL?
|
||||||
// Handle PSN_KILLACTIVE?
|
// Handle PSN_KILLACTIVE?
|
||||||
|
|
||||||
switch (((LPNMHDR)lParam)->code)
|
switch (((LPNMHDR)lParam)->code)
|
||||||
{
|
{
|
||||||
case PSN_SETACTIVE:
|
case PSN_SETACTIVE:
|
||||||
::SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
|
SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case PSN_KILLACTIVE:
|
case PSN_KILLACTIVE:
|
||||||
::SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
|
SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case PSN_APPLY:
|
case PSN_APPLY:
|
||||||
::SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
|
SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case PSN_RESET:
|
case PSN_RESET:
|
||||||
OnReset( (LPPSHNOTIFY)lParam );
|
OnReset( (LPPSHNOTIFY)lParam );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OnNotify( (int)wParam, (LPNMHDR)lParam );
|
return OnNotify( (int)wParam, (LPNMHDR)lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
//
|
CPropertySheet::CPropertySheet( LPCTSTR pszCaption, HWND hwndParent,
|
||||||
// CPropertySheet
|
UINT nStartPage /* = 0 */ )
|
||||||
//
|
: m_strCaption( pszCaption )
|
||||||
|
|
||||||
CPropertySheet::CPropertySheet
|
|
||||||
(
|
|
||||||
LPCTSTR pszCaption,
|
|
||||||
HWND hwndParent,
|
|
||||||
UINT nStartPage /* = 0 */
|
|
||||||
) :\
|
|
||||||
m_strCaption( pszCaption )
|
|
||||||
{
|
{
|
||||||
ZeroMemory(&m_psh, sizeof(m_psh));
|
ZeroMemory(&m_psh, sizeof(m_psh));
|
||||||
m_psh.dwSize = sizeof(m_psh);
|
m_psh.dwSize = sizeof(m_psh);
|
||||||
|
@ -169,33 +160,27 @@ CPropertySheet::CPropertySheet
|
||||||
m_psh.pfnCallback = StaticCallback;
|
m_psh.pfnCallback = StaticCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPropertySheet::~CPropertySheet(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
)
|
CPropertySheet::~CPropertySheet()
|
||||||
{
|
{
|
||||||
// BUGBUG: This is static!
|
// BUGBUG: This is static!
|
||||||
|
|
||||||
/*
|
/* if ( m_hfontLogo )
|
||||||
if ( m_hfontLogo )
|
|
||||||
{
|
{
|
||||||
::DeleteObject( m_hfontLogo );
|
DeleteObject( m_hfontLogo );
|
||||||
m_hfontLogo = NULL;
|
m_hfontLogo = NULL;
|
||||||
}
|
}*/
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropertySheet::AddPage(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CPropertyPage* pPage
|
void CPropertySheet::AddPage( CPropertyPage* pPage )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (pPage)
|
if (pPage)
|
||||||
{
|
|
||||||
m_pages.push_back(pPage);
|
m_pages.push_back(pPage);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPropertySheet::DoModal(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void
|
int CPropertySheet::DoModal()
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int nSize = m_pages.size();
|
int nSize = m_pages.size();
|
||||||
|
|
||||||
|
@ -220,11 +205,9 @@ int CPropertySheet::DoModal(
|
||||||
return nRet;
|
return nRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CALLBACK CPropertySheet::StaticCallback(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
int CALLBACK
|
||||||
UINT uMsg,
|
CPropertySheet::StaticCallback( HWND hwnd, UINT uMsg, LPARAM lParam )
|
||||||
LPARAM lParam
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( hwnd );
|
UNUSED_ALWAYS( hwnd );
|
||||||
|
|
||||||
|
@ -232,28 +215,18 @@ int CALLBACK CPropertySheet::StaticCallback(
|
||||||
{
|
{
|
||||||
case PSCB_INITIALIZED:
|
case PSCB_INITIALIZED:
|
||||||
// Property sheet is being initialized
|
// Property sheet is being initialized
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case PSCB_PRECREATE:
|
case PSCB_PRECREATE:
|
||||||
// Property sheet is about to be created
|
// Property sheet is about to be created
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Remove the DS_CONTEXTHELP style from the dialog template
|
// Remove the DS_CONTEXTHELP style from the dialog template
|
||||||
// (This will remove the "?" in the top right corner)
|
// (This will remove the "?" in the top right corner)
|
||||||
//
|
|
||||||
|
|
||||||
if ( ( (LPDLGTEMPLATEEX)lParam )->signature == 0xFFFF)
|
if ( ( (LPDLGTEMPLATEEX)lParam )->signature == 0xFFFF)
|
||||||
{
|
|
||||||
( (LPDLGTEMPLATEEX)lParam )->style &= ~DS_CONTEXTHELP;
|
( (LPDLGTEMPLATEEX)lParam )->style &= ~DS_CONTEXTHELP;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
( (LPDLGTEMPLATE)lParam )->style &= ~DS_CONTEXTHELP;
|
( (LPDLGTEMPLATE)lParam )->style &= ~DS_CONTEXTHELP;
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,10 +1,24 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/02/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
#ifndef PROPSHT_H
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
#define PROPSHT_H
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
#pragma once
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: PropertySheet.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef PROPERTY_SHEET_HXX
|
||||||
|
#define PROPERTY_SHEET_HXX
|
||||||
|
|
||||||
#include <prsht.h>
|
#include <prsht.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -12,62 +26,33 @@
|
||||||
|
|
||||||
class CPropertyPage
|
class CPropertyPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
|
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
|
||||||
|
|
||||||
const PROPSHEETPAGE* GetPropSheetPage();
|
const PROPSHEETPAGE* GetPropSheetPage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//
|
|
||||||
// Overridable callbacks
|
// Overridable callbacks
|
||||||
//
|
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized ) {}
|
||||||
|
|
||||||
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized )
|
virtual BOOL OnInitDialog( HWND /* hwnd */ ) { return FALSE; }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual BOOL OnInitDialog( HWND /* hwnd */ )
|
virtual void OnDestroy( void ) {}
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnDestroy( void )
|
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ ) { return 0; }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ )
|
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ ) { return FALSE; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ )
|
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ ) { return PSNRET_NOERROR; }
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ )
|
virtual void OnReset( LPPSHNOTIFY /* lppsn */ ) {}
|
||||||
{
|
|
||||||
return PSNRET_NOERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnReset( LPPSHNOTIFY /* lppsn */ )
|
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */,
|
||||||
{
|
HWND /* hwndCtl */ ) { return FALSE; }
|
||||||
}
|
|
||||||
|
|
||||||
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ )
|
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ ) { return FALSE; }
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ )
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
static UINT CALLBACK StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
|
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 );
|
||||||
|
@ -79,25 +64,21 @@ private:
|
||||||
void operator=( const CPropertyPage& ); // no implementation
|
void operator=( const CPropertyPage& ); // no implementation
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage(
|
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage()
|
||||||
void
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return &m_psp;
|
return &m_psp;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CPropertySheet
|
class CPropertySheet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 );
|
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 );
|
||||||
~CPropertySheet( );
|
~CPropertySheet( );
|
||||||
|
|
||||||
void AddPage( CPropertyPage* pPage );
|
void AddPage( CPropertyPage* pPage );
|
||||||
virtual int DoModal( void );
|
virtual int DoModal( void );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam );
|
static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam );
|
||||||
|
|
||||||
PROPSHEETHEADER m_psh;
|
PROPSHEETHEADER m_psh;
|
||||||
|
|
|
@ -1,7 +1,22 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: RoundButton.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "RoundButton.hxx"
|
#include "RoundButton.hxx"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -19,7 +34,6 @@ void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius,
|
||||||
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
|
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
|
||||||
COLORREF crBright, COLORREF crDark);
|
COLORREF crBright, COLORREF crDark);
|
||||||
|
|
||||||
|
|
||||||
// Calculate colour for a point at the given angle by performing a linear
|
// Calculate colour for a point at the given angle by performing a linear
|
||||||
// interpolation between the colours crBright and crDark based on the cosine
|
// interpolation between the colours crBright and crDark based on the cosine
|
||||||
// of the angle between the light source and the point.
|
// of the angle between the light source and the point.
|
||||||
|
@ -27,25 +41,24 @@ void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
|
||||||
// Angles are measured from the +ve x-axis (i.e. (1,0) = 0 degrees, (0,1) = 90 degrees )
|
// Angles are measured from the +ve x-axis (i.e. (1,0) = 0 degrees, (0,1) = 90 degrees )
|
||||||
// But remember: +y points down!
|
// But remember: +y points down!
|
||||||
|
|
||||||
COLORREF GetColour(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
double dAngle,
|
COLORREF GetColour( double dAngle, COLORREF crBright, COLORREF crDark )
|
||||||
COLORREF crBright,
|
|
||||||
COLORREF crDark
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#define Rad2Deg 180.0/3.1415
|
#define Rad2Deg 180.0/3.1415
|
||||||
|
|
||||||
// For better light-continuity along the edge of a stretched button:
|
// For better light-continuity along the edge of a stretched button:
|
||||||
// LIGHT_SOURCE_ANGLE == -1.88
|
// LIGHT_SOURCE_ANGLE == -1.88
|
||||||
|
|
||||||
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
|
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
|
||||||
#define LIGHT_SOURCE_ANGLE -1.88
|
#define LIGHT_SOURCE_ANGLE -1.88
|
||||||
|
|
||||||
ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
|
ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
|
||||||
double dAngleDifference = LIGHT_SOURCE_ANGLE - dAngle;
|
double dAngleDifference = LIGHT_SOURCE_ANGLE - dAngle;
|
||||||
|
|
||||||
if (dAngleDifference < -3.1415) dAngleDifference = 6.293 + dAngleDifference;
|
if (dAngleDifference < -3.1415)
|
||||||
else if (dAngleDifference > 3.1415) dAngleDifference = 6.293 - dAngleDifference;
|
dAngleDifference = 6.293 + dAngleDifference;
|
||||||
|
else if (dAngleDifference > 3.1415)
|
||||||
|
dAngleDifference = 6.293 - dAngleDifference;
|
||||||
|
|
||||||
double Weight = 0.5*(cos(dAngleDifference)+1.0);
|
double Weight = 0.5*(cos(dAngleDifference)+1.0);
|
||||||
|
|
||||||
|
@ -59,24 +72,20 @@ COLORREF GetColour(
|
||||||
return RGB(Red, Green, Blue);
|
return RGB(Red, Green, Blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawCircle(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HDC hdc,
|
void DrawCircle( HDC hdc, const POINT& p, LONG lRadius, COLORREF crColour,
|
||||||
const POINT& p,
|
BOOL bDashed )
|
||||||
LONG lRadius,
|
|
||||||
COLORREF crColour,
|
|
||||||
BOOL bDashed
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const int nDashLength = 1;
|
const int nDashLength = 1;
|
||||||
LONG lError, lXoffset, lYoffset;
|
LONG lError, lXoffset, lYoffset;
|
||||||
int nDash = 0;
|
int nDash = 0;
|
||||||
BOOL bDashOn = TRUE;
|
BOOL bDashOn = TRUE;
|
||||||
|
|
||||||
//Check to see that the coordinates are valid
|
// Check to see that the coordinates are valid
|
||||||
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
||||||
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
||||||
|
|
||||||
//Set starting values
|
// Set starting values
|
||||||
lXoffset = lRadius;
|
lXoffset = lRadius;
|
||||||
lYoffset = 0;
|
lYoffset = 0;
|
||||||
lError = -lRadius;
|
lError = -lRadius;
|
||||||
|
@ -85,20 +94,20 @@ void DrawCircle(
|
||||||
{
|
{
|
||||||
if (bDashOn)
|
if (bDashOn)
|
||||||
{
|
{
|
||||||
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
|
SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
|
||||||
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
|
SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
|
||||||
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
|
SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
|
||||||
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
|
SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
|
||||||
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
|
SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
|
||||||
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
|
SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
|
||||||
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
|
SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
|
||||||
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
|
SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Advance the error term and the constant X axis step
|
// Advance the error term and the constant X axis step
|
||||||
lError += lYoffset++;
|
lError += lYoffset++;
|
||||||
|
|
||||||
//Check to see if error term has overflowed
|
// Check to see if error term has overflowed
|
||||||
if ((lError += lYoffset) >= 0)
|
if ((lError += lYoffset) >= 0)
|
||||||
lError -= --lXoffset * 2;
|
lError -= --lXoffset * 2;
|
||||||
|
|
||||||
|
@ -107,179 +116,147 @@ void DrawCircle(
|
||||||
nDash = 0;
|
nDash = 0;
|
||||||
bDashOn = !bDashOn;
|
bDashOn = !bDashOn;
|
||||||
}
|
}
|
||||||
|
} while (lYoffset <= lXoffset); // Continue until halfway point
|
||||||
} while (lYoffset <= lXoffset); //Continue until halfway point
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// to make stretched buttons
|
// The original Drawcircle function is split up into DrawCircleRight and
|
||||||
|
// DrawCircleLeft to make stretched buttons
|
||||||
void DrawCircleRight(
|
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius, COLORREF crBright,
|
||||||
HDC hdc,
|
COLORREF crDark )
|
||||||
const POINT& p,
|
|
||||||
LONG lRadius,
|
|
||||||
COLORREF crBright,
|
|
||||||
COLORREF crDark
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
LONG lError, lXoffset, lYoffset;
|
LONG lError, lXoffset, lYoffset;
|
||||||
|
|
||||||
//Check to see that the coordinates are valid
|
// Check to see that the coordinates are valid
|
||||||
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
||||||
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
||||||
|
|
||||||
//Set starting values
|
// Set starting values
|
||||||
lXoffset = lRadius;
|
lXoffset = lRadius;
|
||||||
lYoffset = 0;
|
lYoffset = 0;
|
||||||
lError = -lRadius;
|
lError = -lRadius;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const double Pi = 3.141592654,
|
const double Pi = 3.141592654, Pi_on_2 = Pi * 0.5;
|
||||||
Pi_on_2 = Pi * 0.5;
|
|
||||||
COLORREF crColour;
|
COLORREF crColour;
|
||||||
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
|
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
|
||||||
|
|
||||||
//Draw the current pixel, reflected across all four arcs
|
// Draw the current pixel, reflected across all four arcs
|
||||||
|
|
||||||
crColour = GetColour(dAngle, crBright, crDark);
|
crColour = GetColour(dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
|
SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
|
||||||
|
|
||||||
crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
|
crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
|
SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
|
||||||
|
|
||||||
crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
|
crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
|
SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
|
||||||
|
|
||||||
crColour = GetColour(-dAngle, crBright, crDark);
|
crColour = GetColour(-dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
|
SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
|
||||||
|
|
||||||
//Advance the error term and the constant X axis step
|
// Advance the error term and the constant X axis step
|
||||||
lError += lYoffset++;
|
lError += lYoffset++;
|
||||||
|
|
||||||
//Check to see if error term has overflowed
|
// Check to see if error term has overflowed
|
||||||
if ((lError += lYoffset) >= 0)
|
if ((lError += lYoffset) >= 0)
|
||||||
lError -= --lXoffset * 2;
|
lError -= --lXoffset * 2;
|
||||||
|
|
||||||
} while (lYoffset <= lXoffset); //Continue until halfway point
|
} while (lYoffset <= lXoffset); // Continue until halfway point
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// to make stretched buttons
|
// The original Drawcircle function is split up into DrawCircleRight and
|
||||||
|
// DrawCircleLeft to make stretched buttons
|
||||||
void DrawCircleLeft(
|
void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius, COLORREF crBright,
|
||||||
HDC hdc,
|
COLORREF crDark )
|
||||||
const POINT& p,
|
|
||||||
LONG lRadius,
|
|
||||||
COLORREF crBright,
|
|
||||||
COLORREF crDark
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
LONG lError, lXoffset, lYoffset;
|
LONG lError, lXoffset, lYoffset;
|
||||||
|
|
||||||
//Check to see that the coordinates are valid
|
// Check to see that the coordinates are valid
|
||||||
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
||||||
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
||||||
|
|
||||||
//Set starting values
|
// Set starting values
|
||||||
lXoffset = lRadius;
|
lXoffset = lRadius;
|
||||||
lYoffset = 0;
|
lYoffset = 0;
|
||||||
lError = -lRadius;
|
lError = -lRadius;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const double Pi = 3.141592654,
|
const double Pi = 3.141592654, Pi_on_2 = Pi * 0.5;
|
||||||
Pi_on_2 = Pi * 0.5;
|
|
||||||
COLORREF crColour;
|
COLORREF crColour;
|
||||||
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
|
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
|
||||||
|
|
||||||
//Draw the current pixel, reflected across all eight arcs
|
// Draw the current pixel, reflected across all eight arcs
|
||||||
|
|
||||||
crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
|
crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
|
SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
|
||||||
|
|
||||||
crColour = GetColour(Pi - dAngle, crBright, crDark);
|
crColour = GetColour(Pi - dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
|
SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
|
||||||
|
|
||||||
crColour = GetColour(-Pi + dAngle, crBright, crDark);
|
crColour = GetColour(-Pi + dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
|
SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
|
||||||
|
|
||||||
crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
|
crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
|
||||||
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
|
SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
|
||||||
|
|
||||||
//Advance the error term and the constant X axis step
|
// Advance the error term and the constant X axis step
|
||||||
lError += lYoffset++;
|
lError += lYoffset++;
|
||||||
|
|
||||||
//Check to see if error term has overflowed
|
// Check to see if error term has overflowed
|
||||||
if ((lError += lYoffset) >= 0)
|
if ((lError += lYoffset) >= 0)
|
||||||
lError -= --lXoffset * 2;
|
lError -= --lXoffset * 2;
|
||||||
|
|
||||||
} while (lYoffset <= lXoffset); //Continue until halfway point
|
} while (lYoffset <= lXoffset); // Continue until halfway point
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
static void ClientToScreen( HWND hwnd, LPRECT lpRect )
|
||||||
static void ClientToScreen(
|
|
||||||
HWND hwnd,
|
|
||||||
LPRECT lpRect
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
::ClientToScreen(hwnd, (LPPOINT)lpRect);
|
ClientToScreen(hwnd, (LPPOINT)lpRect);
|
||||||
::ClientToScreen(hwnd, ((LPPOINT)lpRect)+1);
|
ClientToScreen(hwnd, ((LPPOINT)lpRect)+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ScreenToClient(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
static void ScreenToClient( HWND hwnd, LPRECT lpRect )
|
||||||
LPRECT lpRect
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
::ScreenToClient(hwnd, (LPPOINT)lpRect);
|
ScreenToClient(hwnd, (LPPOINT)lpRect);
|
||||||
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
|
ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FillSolidRect(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HDC hdc,
|
static void FillSolidRect( HDC hdc, LPCRECT lpRect, COLORREF clr )
|
||||||
LPCRECT lpRect,
|
|
||||||
COLORREF clr
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
COLORREF crOld = ::SetBkColor(hdc, clr);
|
COLORREF crOld = ::SetBkColor(hdc, clr);
|
||||||
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
|
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
|
||||||
::SetBkColor(hdc, crOld);
|
SetBkColor(hdc, crOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
CRoundButton::CRoundButton()
|
||||||
CRoundButton::CRoundButton(
|
: m_hrgn( NULL ),
|
||||||
) : \
|
|
||||||
m_hrgn( NULL ),
|
|
||||||
m_fDrawDashedFocusCircle( TRUE ),
|
m_fDrawDashedFocusCircle( TRUE ),
|
||||||
m_fStretch( FALSE )
|
m_fStretch( FALSE )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CRoundButton::~CRoundButton(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
)
|
CRoundButton::~CRoundButton()
|
||||||
{
|
{
|
||||||
if ( m_hrgn )
|
if ( m_hrgn )
|
||||||
{
|
DeleteObject( m_hrgn );
|
||||||
::DeleteObject( m_hrgn );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRoundButton::PreSubclassWindow(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd
|
void CRoundButton::PreSubclassWindow( HWND hwnd )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
::GetClientRect( hwnd, &rect );
|
GetClientRect( hwnd, &rect );
|
||||||
|
|
||||||
m_fStretch = (rect.right-rect.left) > (rect.bottom-rect.top);
|
m_fStretch = (rect.right-rect.left) > (rect.bottom-rect.top);
|
||||||
|
|
||||||
if ( ! m_fStretch )
|
if ( ! m_fStretch )
|
||||||
{
|
|
||||||
rect.bottom = rect.right = min ( rect.bottom, rect.right );
|
rect.bottom = rect.right = min ( rect.bottom, rect.right );
|
||||||
}
|
|
||||||
|
|
||||||
m_ptCenter.x = m_ptLeft.x = m_ptRight.x = ((rect.right-rect.left)/2);
|
m_ptCenter.x = m_ptLeft.x = m_ptRight.x = ((rect.right-rect.left)/2);
|
||||||
m_ptCenter.y = m_ptLeft.y = m_ptRight.y = ((rect.bottom-rect.top)/2);
|
m_ptCenter.y = m_ptLeft.y = m_ptRight.y = ((rect.bottom-rect.top)/2);
|
||||||
|
@ -289,32 +266,24 @@ void CRoundButton::PreSubclassWindow(
|
||||||
m_ptLeft.x = m_nRadius;
|
m_ptLeft.x = m_nRadius;
|
||||||
m_ptRight.x = rect.right - m_nRadius - 1;
|
m_ptRight.x = rect.right - m_nRadius - 1;
|
||||||
|
|
||||||
::SetWindowRgn( hwnd, NULL, FALSE );
|
SetWindowRgn( hwnd, NULL, FALSE );
|
||||||
m_hrgn = ::CreateEllipticRgnIndirect( &rect );
|
m_hrgn = ::CreateEllipticRgnIndirect( &rect );
|
||||||
::SetWindowRgn( hwnd, m_hrgn, TRUE );
|
SetWindowRgn( hwnd, m_hrgn, TRUE );
|
||||||
|
|
||||||
::ClientToScreen( hwnd, &rect );
|
ClientToScreen( hwnd, &rect );
|
||||||
|
|
||||||
HWND hwndParent = ::GetParent( hwnd );
|
HWND hwndParent = ::GetParent( hwnd );
|
||||||
if ( hwndParent )
|
if ( hwndParent )
|
||||||
{
|
ScreenToClient( hwndParent, &rect );
|
||||||
::ScreenToClient( hwndParent, &rect );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! m_fStretch )
|
if ( ! m_fStretch )
|
||||||
{
|
MoveWindow( hwnd, rect.left, rect.top,
|
||||||
::MoveWindow( hwnd, rect.left, rect.top,
|
|
||||||
rect.right-rect.left, rect.bottom-rect.top, TRUE );
|
rect.right-rect.left, rect.bottom-rect.top, TRUE );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CRoundButton::WndProc(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hWnd,
|
LRESULT CRoundButton::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
UINT msg,
|
LPARAM lParam, BOOL& rfHandled )
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam,
|
|
||||||
BOOL& rfHandled
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
|
@ -331,11 +300,8 @@ LRESULT CRoundButton::WndProc(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRoundButton::OnDrawItem(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwnd,
|
void CRoundButton::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
|
||||||
UINT idCtl,
|
|
||||||
LPDRAWITEMSTRUCT lpdis
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNUSED_ALWAYS( idCtl );
|
UNUSED_ALWAYS( idCtl );
|
||||||
|
|
||||||
|
@ -347,81 +313,67 @@ void CRoundButton::OnDrawItem(
|
||||||
|
|
||||||
int nSavedDC = ::SaveDC( hdc );
|
int nSavedDC = ::SaveDC( hdc );
|
||||||
|
|
||||||
::SelectObject( hdc, ::GetStockObject( NULL_BRUSH ) );
|
SelectObject( hdc, ::GetStockObject( NULL_BRUSH ) );
|
||||||
::FillSolidRect( hdc, &rect, ::GetSysColor(COLOR_BTNFACE) );
|
FillSolidRect( hdc, &rect, ::GetSysColor(COLOR_BTNFACE) );
|
||||||
|
|
||||||
// Draw the focus circle around the button for non-stretched buttons
|
// Draw the focus circle around the button for non-stretched buttons
|
||||||
|
|
||||||
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
|
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
|
||||||
{
|
|
||||||
DrawCircle( hdc, m_ptCenter, nRadius--, RGB( 0, 0, 0) );
|
DrawCircle( hdc, m_ptCenter, nRadius--, RGB( 0, 0, 0) );
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the raised/sunken edges of the button (unless flat)
|
// Draw the raised/sunken edges of the button (unless flat)
|
||||||
|
|
||||||
if ( nStyle & BS_FLAT )
|
if ( nStyle & BS_FLAT )
|
||||||
{
|
{
|
||||||
if ( m_fStretch )
|
if ( m_fStretch )
|
||||||
{
|
{
|
||||||
// for stretched buttons: draw left and right arcs and connect the with lines
|
// for stretched buttons: draw left and right arcs and connect the with lines
|
||||||
|
|
||||||
HPEN hpenOld;
|
HPEN hpenOld;
|
||||||
|
|
||||||
RECT rectLeftBound;
|
RECT rectLeftBound;
|
||||||
::SetRect( &rectLeftBound, 0, 0, nRadius*2, nRadius*2 );
|
SetRect( &rectLeftBound, 0, 0, nRadius*2, nRadius*2 );
|
||||||
|
|
||||||
RECT rectRightBound;
|
RECT rectRightBound;
|
||||||
::SetRect( &rectRightBound, m_ptRight.x-nRadius, 0, m_ptRight.x+nRadius, nRadius*2 );
|
SetRect( &rectRightBound, m_ptRight.x-nRadius, 0, m_ptRight.x+nRadius, nRadius*2 );
|
||||||
|
|
||||||
hpenOld = (HPEN)::SelectObject( hdc,
|
hpenOld = (HPEN)::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
|
CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
|
||||||
|
|
||||||
::Arc( hdc,
|
Arc( hdc, rectLeftBound.left, rectLeftBound.top, rectLeftBound.right,
|
||||||
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
|
rectLeftBound.bottom, m_ptLeft.x, 0, m_ptLeft.x, nRadius*2 );
|
||||||
m_ptLeft.x, 0,
|
|
||||||
m_ptLeft.x, nRadius*2 );
|
|
||||||
|
|
||||||
::Arc( hdc,
|
Arc( hdc, rectRightBound.left, rectRightBound.top, rectRightBound.right,
|
||||||
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
|
rectRightBound.bottom, m_ptRight.x, nRadius*2, m_ptRight.x, 0 );
|
||||||
m_ptRight.x, nRadius*2,
|
|
||||||
m_ptRight.x, 0 );
|
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, 0, NULL );
|
MoveToEx( hdc, m_ptLeft.x, 0, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, 0 );
|
LineTo( hdc, m_ptRight.x, 0 );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, nRadius*2-1, NULL );
|
MoveToEx( hdc, m_ptLeft.x, nRadius*2-1, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, nRadius*2-1 );
|
LineTo( hdc, m_ptRight.x, nRadius*2-1 );
|
||||||
|
|
||||||
nRadius--;
|
nRadius--;
|
||||||
|
|
||||||
::InflateRect( &rectLeftBound, -1, -1 );
|
InflateRect( &rectLeftBound, -1, -1 );
|
||||||
::InflateRect( &rectRightBound, -1, -1 );
|
InflateRect( &rectRightBound, -1, -1 );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc,
|
DeleteObject( ::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
|
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
|
||||||
|
|
||||||
::Arc( hdc,
|
Arc( hdc, rectLeftBound.left, rectLeftBound.top, rectLeftBound.right,
|
||||||
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
|
rectLeftBound.bottom, m_ptLeft.x, 1, m_ptLeft.x, nRadius*2 );
|
||||||
m_ptLeft.x, 1,
|
|
||||||
m_ptLeft.x, nRadius*2 );
|
|
||||||
|
|
||||||
::Arc( hdc,
|
Arc( hdc, rectRightBound.left, rectRightBound.top, rectRightBound.right,
|
||||||
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
|
rectRightBound.bottom, m_ptRight.x, nRadius*2, m_ptRight.x, 0 );
|
||||||
m_ptRight.x, nRadius*2,
|
|
||||||
m_ptRight.x, 0 );
|
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, 1 );
|
LineTo( hdc, m_ptRight.x, 1 );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, nRadius*2, NULL );
|
MoveToEx( hdc, m_ptLeft.x, nRadius*2, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, nRadius*2 );
|
LineTo( hdc, m_ptRight.x, nRadius*2 );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// for non-stretched buttons: draw two circles
|
// for non-stretched buttons: draw two circles
|
||||||
|
|
||||||
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DDKSHADOW) );
|
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DDKSHADOW) );
|
||||||
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
||||||
}
|
}
|
||||||
|
@ -431,128 +383,116 @@ void CRoundButton::OnDrawItem(
|
||||||
if (state & ODS_SELECTED)
|
if (state & ODS_SELECTED)
|
||||||
{
|
{
|
||||||
// draw the circular segments for stretched AND non-stretched buttons
|
// draw the circular segments for stretched AND non-stretched buttons
|
||||||
|
|
||||||
DrawCircleLeft( hdc, m_ptLeft, nRadius,
|
DrawCircleLeft( hdc, m_ptLeft, nRadius,
|
||||||
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
||||||
DrawCircleRight( hdc, m_ptRight, nRadius,
|
DrawCircleRight( hdc, m_ptRight, nRadius,
|
||||||
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
||||||
DrawCircleLeft( hdc, m_ptLeft, nRadius-1,
|
DrawCircleLeft( hdc, m_ptLeft, nRadius-1,
|
||||||
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
|
GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
|
||||||
DrawCircleRight( hdc, m_ptRight, nRadius-1,
|
DrawCircleRight( hdc, m_ptRight, nRadius-1,
|
||||||
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
|
GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
|
||||||
|
|
||||||
if ( m_fStretch )
|
if ( m_fStretch )
|
||||||
{
|
{
|
||||||
// draw connecting lines for stretched buttons only
|
// draw connecting lines for stretched buttons only
|
||||||
|
|
||||||
HPEN hpenOld;
|
HPEN hpenOld;
|
||||||
|
|
||||||
hpenOld = (HPEN)::SelectObject( hdc,
|
hpenOld = (HPEN)::SelectObject( hdc,
|
||||||
(HPEN)::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
|
(HPEN)::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, 1 );
|
LineTo( hdc, m_ptRight.x, 1 );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc,
|
DeleteObject( ::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW) ) ) );
|
CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW) ) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
|
MoveToEx( hdc, m_ptLeft.x, 2, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, 2 );
|
LineTo( hdc, m_ptRight.x, 2 );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc,
|
DeleteObject( ::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DLIGHT ) ) ) );
|
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DLIGHT ) ) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius-1, NULL );
|
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius-1, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius-1 );
|
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius-1 );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc,
|
DeleteObject( ::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
|
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
|
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
|
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// draw the circular segments for stretched AND non-stretched buttons
|
// draw the circular segments for stretched AND non-stretched buttons
|
||||||
|
|
||||||
DrawCircleLeft( hdc, m_ptLeft, nRadius,
|
DrawCircleLeft( hdc, m_ptLeft, nRadius,
|
||||||
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
|
GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
|
||||||
|
|
||||||
DrawCircleRight( hdc, m_ptRight, nRadius,
|
DrawCircleRight( hdc, m_ptRight, nRadius,
|
||||||
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
|
GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
|
||||||
|
|
||||||
DrawCircleLeft( hdc, m_ptLeft, nRadius - 1,
|
DrawCircleLeft( hdc, m_ptLeft, nRadius - 1,
|
||||||
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
|
GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
|
||||||
|
|
||||||
DrawCircleRight( hdc, m_ptRight, nRadius - 1,
|
DrawCircleRight( hdc, m_ptRight, nRadius - 1,
|
||||||
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
|
GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
|
||||||
|
|
||||||
// draw connecting lines for stretch buttons
|
// draw connecting lines for stretch buttons
|
||||||
|
|
||||||
if ( m_fStretch )
|
if ( m_fStretch )
|
||||||
{
|
{
|
||||||
HPEN hpenOld;
|
HPEN hpenOld;
|
||||||
|
|
||||||
hpenOld = (HPEN)::SelectObject( hdc,
|
hpenOld = (HPEN)::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1,
|
CreatePen( PS_SOLID, 1,
|
||||||
::GetPixel( hdc, m_ptLeft.x, 1 ) ) );
|
GetPixel( hdc, m_ptLeft.x, 1 ) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x , 1);
|
LineTo( hdc, m_ptRight.x , 1);
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc,
|
DeleteObject( ::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1,
|
::CreatePen( PS_SOLID, 1,
|
||||||
::GetPixel( hdc, m_ptLeft.x, 2 ) ) ) );
|
::GetPixel( hdc, m_ptLeft.x, 2 ) ) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
|
MoveToEx( hdc, m_ptLeft.x, 2, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, 2 );
|
LineTo( hdc, m_ptRight.x, 2 );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc,
|
DeleteObject( ::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1,
|
::CreatePen( PS_SOLID, 1,
|
||||||
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius ) ) ) );
|
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius ) ) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
|
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
|
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc,
|
DeleteObject( ::SelectObject( hdc,
|
||||||
::CreatePen( PS_SOLID, 1,
|
::CreatePen( PS_SOLID, 1,
|
||||||
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius-1 ) ) ) );
|
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius-1 ) ) ) );
|
||||||
|
|
||||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius - 1, NULL );
|
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius - 1, NULL );
|
||||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius - 1 );
|
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius - 1 );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the text if there is any
|
// Draw the text if there is any
|
||||||
|
|
||||||
TCHAR pszText[ 256 ];
|
TCHAR pszText[ 256 ];
|
||||||
int cch = ::GetWindowText( hwnd, pszText, 255 );
|
int cch = ::GetWindowText( hwnd, pszText, 255 );
|
||||||
|
|
||||||
if ( cch != 0 )
|
if ( cch != 0 )
|
||||||
{
|
{
|
||||||
HRGN hrgn;
|
HRGN hrgn;
|
||||||
|
|
||||||
if ( m_fStretch )
|
if ( m_fStretch )
|
||||||
{
|
hrgn = CreateRectRgn( m_ptLeft.x - nRadius / 2, m_ptCenter.y - nRadius,
|
||||||
hrgn = ::CreateRectRgn( m_ptLeft.x - nRadius / 2, m_ptCenter.y - nRadius,
|
|
||||||
m_ptRight.x + nRadius / 2, m_ptCenter.y + nRadius );
|
m_ptRight.x + nRadius / 2, m_ptCenter.y + nRadius );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
hrgn = CreateEllipticRgn( m_ptCenter.x - nRadius, m_ptCenter.y - nRadius,
|
hrgn = CreateEllipticRgn( m_ptCenter.x - nRadius, m_ptCenter.y - nRadius,
|
||||||
m_ptCenter.x + nRadius, m_ptCenter.y + nRadius );
|
m_ptCenter.x + nRadius, m_ptCenter.y + nRadius );
|
||||||
}
|
|
||||||
|
|
||||||
::SelectClipRgn( hdc, hrgn );
|
SelectClipRgn( hdc, hrgn );
|
||||||
|
|
||||||
SIZE size;
|
SIZE size;
|
||||||
::GetTextExtentPoint32( hdc, pszText, cch, &size );
|
GetTextExtentPoint32( hdc, pszText, cch, &size );
|
||||||
|
|
||||||
POINT pt = { m_ptCenter.x - size.cx / 2, m_ptCenter.y - size.cy / 2 - 1 };
|
POINT pt = { m_ptCenter.x - size.cx / 2, m_ptCenter.y - size.cy / 2 - 1 };
|
||||||
POINT pt2 = { m_ptCenter.x + size.cx/2, m_ptCenter.y + size.cy/2 + 1 };
|
POINT pt2 = { m_ptCenter.x + size.cx/2, m_ptCenter.y + size.cy/2 + 1 };
|
||||||
|
@ -563,63 +503,51 @@ void CRoundButton::OnDrawItem(
|
||||||
++( pt.y );
|
++( pt.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
::SetBkMode( hdc, TRANSPARENT );
|
SetBkMode( hdc, TRANSPARENT );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if ( state & ODS_DISABLED )
|
if ( state & ODS_DISABLED )
|
||||||
{
|
DrawState( hdc, NULL, NULL, (LPARAM)pszText, (WPARAM)cch,
|
||||||
::DrawState( hdc, NULL, NULL, (LPARAM)pszText, (WPARAM)cch,
|
|
||||||
pt.x, pt.y, size.cx, size.cy, DSS_DISABLED );
|
pt.x, pt.y, size.cx, size.cy, DSS_DISABLED );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// give text a 3d-look
|
// give text a 3d-look
|
||||||
|
|
||||||
RECT pos;
|
RECT pos;
|
||||||
::SetRect( &pos, pt.x, pt.y, pt2.x, pt2.y );
|
SetRect( &pos, pt.x, pt.y, pt2.x, pt2.y );
|
||||||
|
|
||||||
COLORREF crOld = ::SetTextColor( hdc,
|
COLORREF crOld = SetTextColor( hdc,
|
||||||
( state & ODS_DISABLED ) ?
|
( state & ODS_DISABLED ) ?
|
||||||
::GetSysColor( COLOR_GRAYTEXT ) :
|
GetSysColor( COLOR_GRAYTEXT ) :
|
||||||
::GetSysColor( COLOR_WINDOWTEXT ) );
|
GetSysColor( COLOR_WINDOWTEXT ) );
|
||||||
|
|
||||||
if ( state & ODS_FOCUS )
|
if ( state & ODS_FOCUS )
|
||||||
{
|
{
|
||||||
LOGFONT lf;
|
LOGFONT lf;
|
||||||
::GetObject( (HFONT)::SendMessage( hwnd, WM_GETFONT, 0, 0 ),
|
GetObject( (HFONT)::SendMessage( hwnd, WM_GETFONT, 0, 0 ), sizeof(LOGFONT), &lf );
|
||||||
sizeof(LOGFONT), &lf );
|
|
||||||
|
|
||||||
lf.lfWeight = FW_BOLD;
|
lf.lfWeight = FW_BOLD;
|
||||||
|
|
||||||
HFONT hfontOld = (HFONT)::SelectObject( hdc, ::CreateFontIndirect( &lf ) );
|
HFONT hfontOld = (HFONT)::SelectObject( hdc, ::CreateFontIndirect( &lf ) );
|
||||||
|
|
||||||
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
|
DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
|
||||||
|
|
||||||
::DeleteObject( ::SelectObject( hdc, hfontOld) );
|
|
||||||
|
|
||||||
|
DeleteObject( ::SelectObject( hdc, hfontOld) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
|
||||||
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
|
|
||||||
|
SetTextColor( hdc, crOld );
|
||||||
}
|
}
|
||||||
|
|
||||||
::SetTextColor( hdc, crOld );
|
SelectClipRgn( hdc, NULL );
|
||||||
}
|
|
||||||
|
|
||||||
::SelectClipRgn( hdc, NULL );
|
|
||||||
|
|
||||||
DeleteObject( hrgn );
|
DeleteObject( hrgn );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// draw the focus circle on the inside
|
// draw the focus circle on the inside
|
||||||
|
|
||||||
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
|
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
|
||||||
{
|
|
||||||
DrawCircle( hdc, m_ptCenter, nRadius-2, RGB(0, 0, 0), TRUE );
|
DrawCircle( hdc, m_ptCenter, nRadius-2, RGB(0, 0, 0), TRUE );
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
::RestoreDC( hdc, nSavedDC );
|
RestoreDC( hdc, nSavedDC );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,38 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
#ifndef RNDBUT_H
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
#define RNDBUT_H
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: RoundButton.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef ROUND_BUTTON_HXX
|
||||||
|
#define ROUND_BUTTON_HXX
|
||||||
|
|
||||||
#include "Wnd.hxx"
|
#include "Wnd.hxx"
|
||||||
|
|
||||||
class CRoundButton : public CWnd
|
class CRoundButton : public CWnd
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CRoundButton();
|
CRoundButton();
|
||||||
~CRoundButton();
|
~CRoundButton();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
LRESULT WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled );
|
||||||
LRESULT WndProc( HWND hwnd, UINT uMsg,
|
|
||||||
WPARAM wParam, LPARAM lParam, BOOL& fHandled );
|
|
||||||
virtual void PreSubclassWindow(HWND hwnd);
|
virtual void PreSubclassWindow(HWND hwnd);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
|
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
|
||||||
|
|
||||||
HRGN m_hrgn;
|
HRGN m_hrgn;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: StellaXMain.cxx,v 1.4 2004-07-10 22:25:58 stephena Exp $
|
// $Id: StellaXMain.cxx,v 1.5 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -28,15 +28,17 @@
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "StellaXMain.hxx"
|
#include "StellaXMain.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CStellaXMain::CStellaXMain()
|
CStellaXMain::CStellaXMain()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CStellaXMain::~CStellaXMain()
|
CStellaXMain::~CStellaXMain()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CStellaXMain::PlayROM( string& romfile, CGlobalData& globaldata )
|
void CStellaXMain::PlayROM( string& romfile, CGlobalData& globaldata )
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: StellaXMain.hxx,v 1.3 2004-07-10 22:25:58 stephena Exp $
|
// $Id: StellaXMain.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef STELLAX_H
|
#ifndef STELLAX_MAIN_HXX
|
||||||
#define STELLAX_H
|
#define STELLAX_MAIN_HXX
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,39 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 10/12/1999
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: TextButton3d.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "TextButton3d.hxx"
|
#include "TextButton3d.hxx"
|
||||||
|
|
||||||
// button style should be VISIBLE / DISABLED / OWNERDRAW
|
// button style should be VISIBLE / DISABLED / OWNERDRAW
|
||||||
|
|
||||||
CTextButton3d::CTextButton3d
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
(
|
CTextButton3d::CTextButton3d()
|
||||||
)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CTextButton3d::WndProc
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
(
|
LRESULT CTextButton3d::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
HWND hWnd,
|
LPARAM lParam, BOOL& rfHandled )
|
||||||
UINT msg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam,
|
|
||||||
BOOL& rfHandled
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
// TODO: re do this now that I send this message here
|
// TODO: re do this now that I send this message here
|
||||||
case WM_DRAWITEM:
|
case WM_DRAWITEM:
|
||||||
rfHandled = TRUE;
|
rfHandled = TRUE;
|
||||||
|
@ -46,11 +54,8 @@ LRESULT CTextButton3d::WndProc
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTextButton3d::OnPaint
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
(
|
void CTextButton3d::OnPaint( HWND hwnd, HDC hdcPaint )
|
||||||
HWND hwnd,
|
|
||||||
HDC hdcPaint
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
HDC hdc = BeginPaint(hwnd, &ps);
|
HDC hdc = BeginPaint(hwnd, &ps);
|
||||||
|
@ -96,16 +101,11 @@ void CTextButton3d::OnPaint
|
||||||
cyClient = rcClient.bottom - rcClient.top;
|
cyClient = rcClient.bottom - rcClient.top;
|
||||||
|
|
||||||
SIZE sizeTextClient;
|
SIZE sizeTextClient;
|
||||||
GetTextExtentPoint(hdc, text, lstrlen(text),
|
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
|
||||||
&sizeTextClient);
|
|
||||||
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
|
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
|
||||||
{
|
|
||||||
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
|
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
|
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
|
||||||
}
|
|
||||||
|
|
||||||
lf.lfHeight--;
|
lf.lfHeight--;
|
||||||
|
|
||||||
|
@ -119,8 +119,7 @@ void CTextButton3d::OnPaint
|
||||||
|
|
||||||
hfont = CreateFontIndirect(&lf);
|
hfont = CreateFontIndirect(&lf);
|
||||||
SelectObject(hdc, hfont);
|
SelectObject(hdc, hfont);
|
||||||
GetTextExtentPoint(hdc, text, lstrlen(text),
|
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
|
||||||
&sizeTextClient);
|
|
||||||
|
|
||||||
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
|
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
|
||||||
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
|
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
|
||||||
|
@ -137,7 +136,6 @@ void CTextButton3d::OnPaint
|
||||||
cy += 3;
|
cy += 3;
|
||||||
|
|
||||||
// draw 3D highlights
|
// draw 3D highlights
|
||||||
|
|
||||||
SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW));
|
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));
|
TextOut(hdc, cx+s*2, cy-s*2, text, lstrlen(text));
|
||||||
|
@ -157,11 +155,9 @@ void CTextButton3d::OnPaint
|
||||||
SetTextColor(hdc, crText);
|
SetTextColor(hdc, crText);
|
||||||
|
|
||||||
// draw the text
|
// draw the text
|
||||||
|
|
||||||
TextOut(hdc, cx, cy, text, lstrlen(text));
|
TextOut(hdc, cx, cy, text, lstrlen(text));
|
||||||
|
|
||||||
// restore dc
|
// restore dc
|
||||||
|
|
||||||
SetTextColor(hdc, crOldText);
|
SetTextColor(hdc, crOldText);
|
||||||
SetBkMode(hdc, iOldBkMode);
|
SetBkMode(hdc, iOldBkMode);
|
||||||
SelectObject(hdc, hfontOld);
|
SelectObject(hdc, hfontOld);
|
||||||
|
@ -174,13 +170,9 @@ void CTextButton3d::OnPaint
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CTextButton3d::OnEraseBkgnd
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
(
|
BOOL CTextButton3d::OnEraseBkgnd( HWND hwnd, HDC hdc )
|
||||||
HWND hwnd,
|
|
||||||
HDC hdc
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// dont do any erasing
|
// dont do any erasing
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,24 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
#ifndef TXTBTN_H
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
#define TXTBTN_H
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
#pragma once
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: TextButton3d.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef TEXT_BUTTON_HXX
|
||||||
|
#define TEXT_BUTTON_HXX
|
||||||
|
|
||||||
// derived from Roger Onslow's code
|
// derived from Roger Onslow's code
|
||||||
|
|
||||||
|
@ -12,17 +26,13 @@
|
||||||
|
|
||||||
class CTextButton3d : public CWnd
|
class CTextButton3d : public CWnd
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CTextButton3d();
|
CTextButton3d();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled);
|
||||||
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
|
||||||
BOOL& rfHandled);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
void OnPaint(HWND, HDC);
|
void OnPaint(HWND, HDC);
|
||||||
BOOL OnEraseBkgnd(HWND, HDC);
|
BOOL OnEraseBkgnd(HWND, HDC);
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,43 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: Wnd.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "Wnd.hxx"
|
#include "Wnd.hxx"
|
||||||
|
|
||||||
// REVIEW: Need to reset old wnd proc?
|
// REVIEW: Need to reset old wnd proc?
|
||||||
|
|
||||||
CWnd::CWnd(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
) : \
|
CWnd::CWnd()
|
||||||
m_pOldWindowProc(NULL),
|
: m_pOldWindowProc(NULL),
|
||||||
m_hwnd(NULL)
|
m_hwnd(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CWnd::SubclassDlgItem(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HWND hwndParent,
|
BOOL CWnd::SubclassDlgItem( HWND hwndParent, UINT nID )
|
||||||
UINT nID
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if ( nID == 0 || hwndParent == NULL )
|
if ( nID == 0 || hwndParent == NULL )
|
||||||
{
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
// can't subclass twice!
|
// can't subclass twice!
|
||||||
|
|
||||||
if ( m_pOldWindowProc != NULL )
|
if ( m_pOldWindowProc != NULL )
|
||||||
{
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
m_hwnd = GetDlgItem( hwndParent, nID );
|
m_hwnd = GetDlgItem( hwndParent, nID );
|
||||||
if (m_hwnd == NULL)
|
if (m_hwnd == NULL)
|
||||||
|
@ -47,19 +55,15 @@ BOOL CWnd::SubclassDlgItem(
|
||||||
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,
|
LRESULT CALLBACK CWnd::StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
UINT msg,
|
LPARAM lParam )
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
|
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||||
|
|
||||||
|
@ -67,9 +71,7 @@ LRESULT CALLBACK CWnd::StaticWndProc(
|
||||||
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
|
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
|
||||||
|
|
||||||
if (fHandled)
|
if (fHandled)
|
||||||
{
|
|
||||||
return lRes;
|
return lRes;
|
||||||
}
|
|
||||||
|
|
||||||
return CallWindowProc( pThis->m_pOldWindowProc, hWnd, msg, wParam, lParam );
|
return CallWindowProc( pThis->m_pOldWindowProc, hWnd, msg, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,40 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
#ifndef WND_H
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
#define WND_H
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: Wnd.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef WND_HXX
|
||||||
|
#define WND_HXX
|
||||||
|
|
||||||
class CWnd
|
class CWnd
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CWnd();
|
CWnd();
|
||||||
|
|
||||||
BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
|
BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
|
||||||
|
|
||||||
operator HWND() const
|
operator HWND() const { return m_hwnd; }
|
||||||
{
|
|
||||||
return m_hwnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual void PreSubclassWindow( HWND hwnd );
|
virtual void PreSubclassWindow( HWND hwnd );
|
||||||
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled ) = 0;
|
||||||
BOOL& rfHandled ) = 0;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||||
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg,
|
|
||||||
WPARAM wParam, LPARAM lParam );
|
|
||||||
|
|
||||||
WNDPROC m_pOldWindowProc;
|
WNDPROC m_pOldWindowProc;
|
||||||
HWND m_hwnd;
|
HWND m_hwnd;
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 04/27/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: debug.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "debug.hxx"
|
#include "debug.hxx"
|
||||||
|
|
||||||
|
@ -11,13 +25,8 @@
|
||||||
|
|
||||||
extern LPCTSTR g_ctszDebugLog;
|
extern LPCTSTR g_ctszDebugLog;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// DEBUG DEFINED
|
void AFX_CDECL AfxTrace( LPCTSTR lpszFormat, ... )
|
||||||
|
|
||||||
void AFX_CDECL AfxTrace(
|
|
||||||
LPCTSTR lpszFormat,
|
|
||||||
...
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, lpszFormat);
|
va_start(args, lpszFormat);
|
||||||
|
@ -31,9 +40,7 @@ void AFX_CDECL AfxTrace(
|
||||||
ASSERT(nBuf >= 0);
|
ASSERT(nBuf >= 0);
|
||||||
|
|
||||||
if (nBuf < 511)
|
if (nBuf < 511)
|
||||||
{
|
|
||||||
lstrcat(szBuffer, _T("\r\n"));
|
lstrcat(szBuffer, _T("\r\n"));
|
||||||
}
|
|
||||||
|
|
||||||
_RPT0(_CRT_WARN, szBuffer);
|
_RPT0(_CRT_WARN, szBuffer);
|
||||||
|
|
||||||
|
@ -56,11 +63,9 @@ void AFX_CDECL AfxTrace(
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL AFXAPI AfxAssertFailedLine(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
LPCSTR lpszFileName,
|
BOOL AFXAPI AfxAssertFailedLine( LPCSTR lpszFileName, int nLine,
|
||||||
int nLine,
|
LPCTSTR lpszCondition )
|
||||||
LPCTSTR lpszCondition
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// we remove WM_QUIT because if it is in the queue then the message box
|
// we remove WM_QUIT because if it is in the queue then the message box
|
||||||
// won't display
|
// won't display
|
||||||
|
@ -72,4 +77,4 @@ BOOL AFXAPI AfxAssertFailedLine(
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_DEBUG
|
#endif
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/27/1999
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: debug.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#ifndef _AFX
|
#ifndef _AFX
|
||||||
#define _AFX
|
#define _AFX
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
@ -19,7 +32,6 @@
|
||||||
// DEBUG_ONLY
|
// DEBUG_ONLY
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// determine number of elements in an array (not bytes)
|
// determine number of elements in an array (not bytes)
|
||||||
#define _countof(array) (sizeof(array)/sizeof(array[0]))
|
#define _countof(array) (sizeof(array)/sizeof(array[0]))
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll XX XX
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll XX XX
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2000 by Jeff Miller
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
// Copyright (c) 2004 by Stephen Anthony
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: main.cxx,v 1.2 2004-07-10 22:25:58 stephena Exp $
|
// $Id: main.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
|
@ -55,10 +55,10 @@ class CSingleInstance
|
||||||
void operator=( const CSingleInstance& ); // no implementation
|
void operator=( const CSingleInstance& ); // no implementation
|
||||||
};
|
};
|
||||||
|
|
||||||
// see debug.cpp
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
LPCTSTR g_ctszDebugLog = _T("stella.log");
|
LPCTSTR g_ctszDebugLog = _T("stella.log");
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
LPTSTR lpCmdLine, int nCmdShow )
|
LPTSTR lpCmdLine, int nCmdShow )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,57 +1,50 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: pch.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
// This will force in the DirectX library
|
|
||||||
|
|
||||||
#pragma comment( lib, "dxguid" )
|
|
||||||
|
|
||||||
// Bring in DirectInput library (for c_dfDIMouse, etc)
|
|
||||||
|
|
||||||
#pragma comment( lib, "dinput" )
|
|
||||||
|
|
||||||
// Bring in the common control library
|
// Bring in the common control library
|
||||||
|
|
||||||
#pragma comment( lib, "comctl32" )
|
#pragma comment( lib, "comctl32" )
|
||||||
|
|
||||||
// Bring in multimedia timers
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText )
|
||||||
#pragma comment( lib, "winmm" )
|
|
||||||
|
|
||||||
void MessageBox(
|
|
||||||
HINSTANCE hInstance,
|
|
||||||
HWND hwndParent,
|
|
||||||
UINT uIDText
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const int nMaxStrLen = 1024;
|
const int nMaxStrLen = 1024;
|
||||||
TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
|
TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
|
||||||
TCHAR tszText[nMaxStrLen + 1] = { 0 };
|
TCHAR tszText[nMaxStrLen + 1] = { 0 };
|
||||||
|
|
||||||
// Caption is always "StellaX"
|
// Caption is always "StellaX"
|
||||||
|
|
||||||
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
|
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
|
||||||
|
|
||||||
LoadString(hInstance, uIDText, tszText, nMaxStrLen);
|
LoadString(hInstance, uIDText, tszText, nMaxStrLen);
|
||||||
|
|
||||||
if (hwndParent == NULL)
|
if (hwndParent == NULL)
|
||||||
{
|
|
||||||
hwndParent = ::GetForegroundWindow();
|
hwndParent = ::GetForegroundWindow();
|
||||||
}
|
|
||||||
|
|
||||||
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
|
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageBoxFromWinError(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
DWORD dwError,
|
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ )
|
||||||
LPCTSTR pszCaption /* = NULL */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const int nMaxStrLen = 1024;
|
const int nMaxStrLen = 1024;
|
||||||
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
|
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
|
||||||
|
@ -64,25 +57,19 @@ void MessageBoxFromWinError(
|
||||||
|
|
||||||
LPTSTR pszText = NULL;
|
LPTSTR pszText = NULL;
|
||||||
|
|
||||||
FormatMessage(
|
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
NULL,
|
(LPTSTR)&pszText, 0, NULL);
|
||||||
dwError,
|
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
(LPTSTR)&pszText,
|
|
||||||
0,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
::MessageBox(::GetForegroundWindow(), pszText,
|
::MessageBox(::GetForegroundWindow(), pszText,
|
||||||
pszCaption ? pszCaption : pszCaptionStellaX, MB_ICONWARNING | MB_OK);
|
pszCaption ? pszCaption : pszCaptionStellaX,
|
||||||
|
MB_ICONWARNING | MB_OK);
|
||||||
|
|
||||||
::LocalFree( pszText );
|
LocalFree( pszText );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageBoxFromGetLastError(
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
LPCTSTR pszCaption /* = NULL */
|
void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
MessageBoxFromWinError( GetLastError(), pszCaption );
|
MessageBoxFromWinError( GetLastError(), pszCaption );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,24 @@
|
||||||
|
//============================================================================
|
||||||
//
|
//
|
||||||
// StellaX
|
// SSSS tt lll lll XX XX
|
||||||
// Jeff Miller 05/01/2000
|
// SS SS tt ll ll XX XX
|
||||||
|
// SS tttttt eeee ll ll aaaa XX XX
|
||||||
|
// SSSS tt ee ee ll ll aa XXX
|
||||||
|
// SS tt eeeeee ll ll aaaaa XX XX
|
||||||
|
// SS SS tt ee ll ll aa aa XX XX
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa XX XX
|
||||||
//
|
//
|
||||||
#ifndef PCH_H
|
// Copyright (c) 1995-2000 by Jeff Miller
|
||||||
#define PCH_H
|
// Copyright (c) 2004 by Stephen Anthony
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: pch.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef PCH_HXX
|
||||||
|
#define PCH_HXX
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define DIRECTINPUT_VERSION 5
|
#define DIRECTINPUT_VERSION 5
|
||||||
|
@ -33,90 +48,13 @@
|
||||||
#endif
|
#endif
|
||||||
#define UNUSED_ALWAYS(x) x
|
#define UNUSED_ALWAYS(x) x
|
||||||
|
|
||||||
//
|
|
||||||
// Simple string class
|
|
||||||
//
|
|
||||||
|
|
||||||
class CSimpleString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CSimpleString() :
|
|
||||||
m_psz( NULL ),
|
|
||||||
m_cch( -1 )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~CSimpleString()
|
|
||||||
{
|
|
||||||
delete[] m_psz;
|
|
||||||
m_psz = NULL;
|
|
||||||
m_cch = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL Set( LPCTSTR psz )
|
|
||||||
{
|
|
||||||
int cch = lstrlen( psz );
|
|
||||||
if ( cch > m_cch )
|
|
||||||
{
|
|
||||||
delete[] m_psz;
|
|
||||||
m_psz = NULL;
|
|
||||||
m_cch = -1;
|
|
||||||
|
|
||||||
m_psz = new TCHAR[ cch + 1 ];
|
|
||||||
if ( m_psz == NULL )
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_cch = cch;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy( m_psz, psz, ( cch + 1 ) * sizeof( TCHAR ) );
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LPCTSTR Get( void ) const
|
|
||||||
{
|
|
||||||
ASSERT( m_psz != NULL );
|
|
||||||
return m_psz;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Length( void ) const
|
|
||||||
{
|
|
||||||
return m_cch;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//
|
|
||||||
// The string and its size (-1 means not initialized)
|
|
||||||
//
|
|
||||||
|
|
||||||
LPTSTR m_psz;
|
|
||||||
int m_cch;
|
|
||||||
|
|
||||||
CSimpleString( const CSimpleString& ); // no implementation
|
|
||||||
void operator=( const CSimpleString& ); // no implementation
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Utility methods
|
// Utility methods
|
||||||
//
|
//
|
||||||
|
|
||||||
void MessageBox(
|
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText );
|
||||||
HINSTANCE hInstance,
|
|
||||||
HWND hwndParent,
|
|
||||||
UINT uIDText
|
|
||||||
);
|
|
||||||
|
|
||||||
void MessageBoxFromWinError(
|
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ );
|
||||||
DWORD dwError,
|
|
||||||
LPCTSTR pszCaption /* = NULL */
|
|
||||||
);
|
|
||||||
|
|
||||||
void MessageBoxFromGetLastError(
|
void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ );
|
||||||
LPCTSTR pszCaption /* = NULL */
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue