mirror of https://github.com/stella-emu/stella.git
Added a new VC7 solution called 'Stella_Emulator' which contains the
following two projects: Stella - the commandline Stella application StellaX - the Windows GUI frontend As of now, Stella compiles *without* the snapshot and OpenGL options and works fine. Adding these options will be as simple as finding the required libs/include files and activating the relevant DEFINE's. StellaX compiles and runs, but it doesn't do much ATM. There is still some amount of work to do in this area. Since the Linux version is completely finished, and the MacOSX version just needs some minor updates, most of my time will be spent getting the StellaX GUI up to speed. Then release 1.4 will be ready ... git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@290 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
3948112d35
commit
3cc7c5998b
|
@ -13,12 +13,11 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: SettingsWin32.cxx,v 1.5 2004-06-19 21:51:12 stephena Exp $
|
||||
// $Id: SettingsWin32.cxx,v 1.6 2004-06-28 23:13:53 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <direct.h>
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -134,5 +133,14 @@ string SettingsWin32::stateFilename(const string& md5, uInt32 state)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SettingsWin32::fileExists(const string& filename)
|
||||
{
|
||||
return false;//FIXME(access(filename.c_str(), F_OK|W_OK) == 0);
|
||||
// FIXME - Since I don't have time to figure out the correct
|
||||
// and fast 'Win32' way of doing this, I'll cheat a bit
|
||||
ifstream in(filename.c_str());
|
||||
if(in)
|
||||
{
|
||||
in.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stella", "Stella.vcproj", "{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Debug.ActiveCfg = Debug|Win32
|
||||
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Debug.Build.0 = Debug|Win32
|
||||
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Release.ActiveCfg = Release|Win32
|
||||
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
|
@ -0,0 +1,471 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="Stella"
|
||||
ProjectGUID="{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}"
|
||||
RootNamespace="Stella"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\emucore\m6502\src\bspf\src;..\..\emucore\m6502\src;..\..\emucore;..\..\common;..\..\win32"
|
||||
PreprocessorDefinitions="BSPF_WIN32;WIN32;_DEBUG;JOYSTICK_SUPPORT;DEVELOPER_SUPPORT"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="2"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="SDL.lib
|
||||
SDLmain.lib"
|
||||
AdditionalDependencies="sdl.lib sdlmain.lib"
|
||||
OutputFile="$(OutDir)/Stella.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/Stella.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\emucore\m6502\src\bspf\src;..\..\emucore\m6502\src;..\..\emucore;..\..\common;..\..\win32"
|
||||
PreprocessorDefinitions="BSPF_WIN32;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEVELOPER_SUPPORT"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="2"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="SDL.lib
|
||||
SDLmain.lib"
|
||||
AdditionalDependencies="sdl.lib sdlmain.lib"
|
||||
OutputFile="$(OutDir)/Stella.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\emucore\Booster.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart2K.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart3F.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart4K.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartAR.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartCV.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartDPC.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartE0.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartE7.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF4.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF4SC.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF6.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF6SC.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF8.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF8SC.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartFASC.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartFE.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartMB.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartMC.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartUA.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Console.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Control.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\D6502.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Deserializer.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\Device.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Driving.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Event.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\EventHandler.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\FrameBuffer.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\FrameBufferSDL.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\FrameBufferSoft.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Joystick.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Keyboard.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\M6502.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\M6502Hi.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\M6502Low.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\M6532.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\mainSDL.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\MD5.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\MediaSrc.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\NullDev.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Paddles.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Props.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\PropsSet.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Random.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Serializer.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Settings.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\win32\SettingsWin32.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Sound.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\SoundSDL.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Switches.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\System.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\TIA.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\TIASound.c">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\..\emucore\Booster.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\bspf\src\bspf.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart2K.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart3F.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Cart4K.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartAR.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartCV.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartDPC.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartE0.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartE7.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF4.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF4SC.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF6.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF6SC.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF8.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartF8SC.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartFASC.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartFE.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartMB.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartMC.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\CartUA.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Console.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Control.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\D6502.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Deserializer.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\Device.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Driving.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Event.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\EventHandler.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\FrameBuffer.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\FrameBufferSDL.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\FrameBufferSoft.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Joystick.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Keyboard.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\M6502.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\M6502Hi.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\M6502Low.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\M6532.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\MD5.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\MediaSrc.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\NullDev.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Paddles.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Props.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\PropsSet.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Random.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Serializer.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Settings.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\win32\SettingsWin32.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Sound.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\SoundSDL.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\StellaEvent.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Switches.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\m6502\src\System.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\TIA.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\TIASound.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -0,0 +1,45 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: AboutPage.cxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "AboutPage.hxx"
|
||||
#include "resource.h"
|
||||
|
||||
CHelpPage::CHelpPage()
|
||||
: CPropertyPage(IDD_ABOUT_PAGE)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CHelpPage::OnInitDialog( HWND hwnd )
|
||||
{
|
||||
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );
|
||||
m_hlMail_JSM.SetURL( _T("mailto:sa666_666@hotmail.com?Subject=StellaX") );
|
||||
|
||||
m_hlWWW_JSM.SubclassDlgItem( hwnd, IDC_WEB_MAINTAINER );
|
||||
m_hlWWW_JSM.SetURL( _T("http://minbar.org") );
|
||||
|
||||
m_hlMail_Stella.SubclassDlgItem( hwnd, IDC_EMAIL_STELLA );
|
||||
m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
|
||||
|
||||
m_hlWWW_Stella.SubclassDlgItem( hwnd, IDC_WEB_STELLA );
|
||||
m_hlWWW_Stella.SetURL( _T("http://stella.sf.net") );
|
||||
|
||||
// return FALSE if SetFocus is called
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: AboutPage.hxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef ABOUTPG_H
|
||||
#define ABOUTPG_H
|
||||
//FIXME#pragma once
|
||||
|
||||
#include "PropertySheet.hxx"
|
||||
#include "HyperLink.hxx"
|
||||
|
||||
class CHelpPage : public CPropertyPage
|
||||
{
|
||||
public:
|
||||
CHelpPage();
|
||||
|
||||
protected:
|
||||
virtual BOOL OnInitDialog( HWND hwnd );
|
||||
|
||||
private:
|
||||
CHyperLink m_hlMail_JSM;
|
||||
CHyperLink m_hlWWW_JSM;
|
||||
CHyperLink m_hlMail_Stella;
|
||||
CHyperLink m_hlWWW_Stella;
|
||||
|
||||
CHelpPage( const CHelpPage& ); // no implementation
|
||||
void operator=( const CHelpPage& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,226 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ShellBrowser.cpp: implementation of the CShellBrowser class.
|
||||
//
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "BrowseForFolder.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Construction/Destruction
|
||||
//
|
||||
|
||||
#ifdef MFC
|
||||
CBrowseForFolder::CBrowseForFolder(
|
||||
const HWND hParent /*= NULL*/,
|
||||
const LPITEMIDLIST pidl /*= NULL*/,
|
||||
const int nTitleID /*= 0*/
|
||||
)
|
||||
{
|
||||
m_hwnd = NULL;
|
||||
SetOwner(hParent);
|
||||
SetRoot(pidl);
|
||||
SetTitle(nTitleID);
|
||||
m_bi.lpfn = BrowseCallbackProc;
|
||||
m_bi.lParam = reinterpret_cast<LPARAM>( this );
|
||||
m_bi.pszDisplayName = m_szSelected;
|
||||
}
|
||||
#endif
|
||||
|
||||
CBrowseForFolder::CBrowseForFolder(
|
||||
const HWND hParent,
|
||||
const LPITEMIDLIST pidl,
|
||||
LPCTSTR strTitle)
|
||||
{
|
||||
m_hwnd = NULL;
|
||||
|
||||
SetOwner(hParent);
|
||||
|
||||
SetRoot(pidl);
|
||||
|
||||
SetTitle(strTitle);
|
||||
|
||||
m_bi.lpfn = BrowseCallbackProc;
|
||||
m_bi.lParam = reinterpret_cast<LPARAM>( this );
|
||||
m_bi.pszDisplayName = m_szSelected;
|
||||
}
|
||||
|
||||
CBrowseForFolder::~CBrowseForFolder()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
|
||||
void CBrowseForFolder::SetOwner(const HWND hwndOwner)
|
||||
{
|
||||
if (m_hwnd != NULL)
|
||||
return;
|
||||
|
||||
m_bi.hwndOwner = hwndOwner;
|
||||
}
|
||||
|
||||
void CBrowseForFolder::SetRoot(const LPITEMIDLIST pidl)
|
||||
{
|
||||
if (m_hwnd != NULL)
|
||||
return;
|
||||
|
||||
m_bi.pidlRoot = pidl;
|
||||
}
|
||||
|
||||
LPCTSTR CBrowseForFolder::GetTitle() const
|
||||
{
|
||||
return m_bi.lpszTitle;
|
||||
}
|
||||
|
||||
bool CBrowseForFolder::SetTitle(
|
||||
LPCTSTR strTitle
|
||||
)
|
||||
{
|
||||
if (m_hwnd != NULL)
|
||||
return false;
|
||||
|
||||
if ( strTitle == NULL )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! m_pchTitle.Set( strTitle ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_bi.lpszTitle = m_pchTitle.Get();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MFC
|
||||
bool CBrowseForFolder::SetTitle(const int nTitle)
|
||||
{
|
||||
if (nTitle <= 0)
|
||||
return false;
|
||||
|
||||
CString strTitle;
|
||||
if(!strTitle.LoadString(static_cast(nTitle)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SetTitle(strTitle);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CBrowseForFolder::SetFlags(const UINT ulFlags)
|
||||
{
|
||||
if (m_hwnd != NULL)
|
||||
return;
|
||||
|
||||
m_bi.ulFlags = ulFlags;
|
||||
}
|
||||
|
||||
LPCTSTR CBrowseForFolder::GetSelectedFolder(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return m_szSelected;
|
||||
}
|
||||
|
||||
bool CBrowseForFolder::SelectFolder()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
LPITEMIDLIST pidl;
|
||||
if ((pidl = ::SHBrowseForFolder(&m_bi)) != NULL)
|
||||
{
|
||||
m_strPath.Set( _T("") );
|
||||
if (SUCCEEDED(::SHGetPathFromIDList(pidl, m_szSelected)))
|
||||
{
|
||||
bRet = true;
|
||||
m_strPath.Set( m_szSelected );
|
||||
}
|
||||
|
||||
LPMALLOC pMalloc;
|
||||
//Retrieve a pointer to the shell's IMalloc interface
|
||||
if (SUCCEEDED(SHGetMalloc(&pMalloc)))
|
||||
{
|
||||
// free the PIDL that SHBrowseForFolder returned to us.
|
||||
pMalloc->Free(pidl);
|
||||
// release the shell's IMalloc interface
|
||||
(void)pMalloc->Release();
|
||||
}
|
||||
}
|
||||
m_hwnd = NULL;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void CBrowseForFolder::OnInit() const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CBrowseForFolder::OnSelChanged(const LPITEMIDLIST pidl) const
|
||||
{
|
||||
(void)pidl;
|
||||
}
|
||||
|
||||
void CBrowseForFolder::EnableOK(const bool bEnable) const
|
||||
{
|
||||
if (m_hwnd == NULL)
|
||||
return;
|
||||
|
||||
// (void)SendMessage(m_hwnd, BFFM_ENABLEOK, static_cast(bEnable), NULL);
|
||||
(void)SendMessage( m_hwnd, BFFM_ENABLEOK, NULL, static_cast<LPARAM>(bEnable) );
|
||||
}
|
||||
|
||||
void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
|
||||
{
|
||||
if (m_hwnd == NULL)
|
||||
return;
|
||||
|
||||
(void)SendMessage(m_hwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast<LPARAM>(pidl));
|
||||
}
|
||||
|
||||
void CBrowseForFolder::SetSelection(
|
||||
LPCTSTR strPath
|
||||
) const
|
||||
{
|
||||
if (m_hwnd == NULL)
|
||||
return;
|
||||
|
||||
(void)SendMessage(m_hwnd, BFFM_SETSELECTION, TRUE, reinterpret_cast<LPARAM>(strPath));
|
||||
}
|
||||
|
||||
void CBrowseForFolder::SetStatusText(
|
||||
LPCTSTR strText
|
||||
) const
|
||||
{
|
||||
if (m_hwnd == NULL)
|
||||
return;
|
||||
|
||||
(void)SendMessage(m_hwnd, BFFM_SETSTATUSTEXT, NULL, reinterpret_cast<LPARAM>(strText));
|
||||
}
|
||||
|
||||
int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||
{
|
||||
CBrowseForFolder* pbff = reinterpret_cast<CBrowseForFolder*>( lpData );
|
||||
pbff->m_hwnd = hwnd;
|
||||
if (uMsg == BFFM_INITIALIZED)
|
||||
pbff->OnInit();
|
||||
else if (uMsg == BFFM_SELCHANGED)
|
||||
pbff->OnSelChanged( reinterpret_cast<LPITEMIDLIST>( lParam ));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ShellBrowser.h: interface for the CShellBrowser class.
|
||||
//
|
||||
// Copyright 1998 Scott D. Killen
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __SHELLBROWSER_H__
|
||||
#define __SHELLBROWSER_H__
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <shlobj.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CShellBrowser
|
||||
//
|
||||
|
||||
class CBrowseForFolder
|
||||
{
|
||||
public:
|
||||
#ifdef MFC
|
||||
CBrowseForFolder(const HWND hParent = NULL,
|
||||
const LPITEMIDLIST pidl = NULL,
|
||||
const int nTitleID = 0);
|
||||
#endif
|
||||
|
||||
CBrowseForFolder(const HWND hParent = NULL,
|
||||
const LPITEMIDLIST pidl = NULL,
|
||||
LPCTSTR strTitle = NULL );
|
||||
|
||||
virtual ~CBrowseForFolder();
|
||||
|
||||
//
|
||||
// Set the handle of the owner window for the dialog box.
|
||||
//
|
||||
void SetOwner(const HWND hwndOwner);
|
||||
|
||||
//
|
||||
// Set the root of the heirarchy that will be browsed. Get pidl from
|
||||
// SHGetSpecialFolderLocation. This can be set to NULL to use the Virtual Folder
|
||||
// that represents the Windows Desktop.
|
||||
//
|
||||
void SetRoot(const LPITEMIDLIST pidl);
|
||||
|
||||
//
|
||||
// Access a string that is displayed above the tree view control in the dialog box.
|
||||
// This string can be used to specify instructions to the user. strTitle is a
|
||||
// CString containing the text to be displayed. nTitle is the index of a string
|
||||
// resource to be loaded. The return value is false if the resource could not be
|
||||
// loaded.
|
||||
//
|
||||
LPCTSTR GetTitle() const;
|
||||
bool SetTitle(LPCTSTR strTitle);
|
||||
#ifdef MFC
|
||||
bool SetTitle(const int nTitle);
|
||||
#endif
|
||||
|
||||
//
|
||||
// ulFlags = Value specifying the types of folders to be listed in the dialog box
|
||||
// as well as other options. This member can include zero or more of the following
|
||||
// values:
|
||||
//
|
||||
// BIF_BROWSEFORCOMPUTER Only returns computers. If the user selects
|
||||
// anything other than a computer, the OK button
|
||||
// is grayed.
|
||||
//
|
||||
// BIF_BROWSEFORPRINTER Only returns printers. If the user selects
|
||||
// anything other than a printer, the OK button
|
||||
// is grayed.
|
||||
//
|
||||
// BIF_DONTGOBELOWDOMAIN Does not include network folders below the
|
||||
// domain level in the tree view control.
|
||||
//
|
||||
// BIF_RETURNFSANCESTORS Only returns file system ancestors. If the user
|
||||
// selects anything other than a file system
|
||||
// ancestor, the OK button is grayed.
|
||||
//
|
||||
// BIF_RETURNONLYFSDIRS Only returns file system directories. If the
|
||||
// user selects folders that are not part of the
|
||||
// file system, the OK button is grayed.
|
||||
//
|
||||
// BIF_STATUSTEXT Includes a status area in the dialog box. The
|
||||
// callback function can set the status text by
|
||||
// sending messages to the dialog box.
|
||||
//
|
||||
UINT GetFlags() const;
|
||||
void SetFlags(const UINT ulFlags);
|
||||
|
||||
//
|
||||
// Call GetSelectedFolder to retrieve the folder selected by the user.
|
||||
//
|
||||
LPCTSTR GetSelectedFolder() const;
|
||||
|
||||
//
|
||||
// Function to retreive the image associated with the selected folder. The image is
|
||||
// specified as an index to the system image list.
|
||||
//
|
||||
int GetImage() const;
|
||||
|
||||
//
|
||||
// Call SelectFolder to display the dialog and get a selection from the user. Use
|
||||
// GetSelectedFolder and GetImage to get the results of the dialog.
|
||||
//
|
||||
bool SelectFolder();
|
||||
|
||||
protected:
|
||||
//
|
||||
// OnInit is called before the dialog is displayed on the screen.
|
||||
//
|
||||
virtual void OnInit() const;
|
||||
|
||||
//
|
||||
// OnSelChanged is called whenever the user selects a different directory. pidl is
|
||||
// the LPITEMIDLIST of the new selection. Use SHGetPathFromIDList to retrieve the
|
||||
// path of the selection.
|
||||
//
|
||||
virtual void OnSelChanged(const LPITEMIDLIST pidl) const;
|
||||
|
||||
//
|
||||
// Call EnableOK to enable the OK button on the active dialog. If bEnable is true
|
||||
// then the button is enabled, otherwise it is disabled.
|
||||
// NOTE -- This function should only be called within overrides of OnInit and
|
||||
// OnSelChanged.
|
||||
//
|
||||
void EnableOK(const bool bEnable) const;
|
||||
|
||||
//
|
||||
// Call SetSelection to set the selection in the active dialog. pidl is the
|
||||
// LPITEMIDLIST
|
||||
// of the path to be selected. strPath is a CString containing the path to be
|
||||
// selected.
|
||||
// NOTE -- This function should only be called within overrides of OnInit and
|
||||
// OnSelChanged.
|
||||
//
|
||||
void SetSelection(const LPITEMIDLIST pidl) const;
|
||||
void SetSelection(LPCTSTR strPath) const;
|
||||
|
||||
//
|
||||
// Call SetStatusText to set the text in the Status area in the active dialog.
|
||||
// strText is the text to be displayed.
|
||||
// NOTE -- This function should only be called within overrides of OnInit and
|
||||
// OnSelChanged.
|
||||
//
|
||||
void SetStatusText(LPCTSTR strText) const;
|
||||
|
||||
private:
|
||||
static int __stdcall BrowseCallbackProc(HWND hwnd,
|
||||
UINT uMsg,
|
||||
LPARAM lParam,
|
||||
LPARAM lpData);
|
||||
|
||||
CSimpleString m_pchTitle;
|
||||
|
||||
BROWSEINFO m_bi;
|
||||
char m_szSelected[MAX_PATH];
|
||||
CSimpleString m_strPath;
|
||||
HWND m_hwnd;
|
||||
};
|
||||
|
||||
inline UINT CBrowseForFolder::GetFlags() const
|
||||
{
|
||||
return m_bi.ulFlags;
|
||||
}
|
||||
|
||||
inline int CBrowseForFolder::GetImage() const
|
||||
{
|
||||
return m_bi.iImage;
|
||||
}
|
||||
|
||||
#endif // __SHELLBROWSER_H__
|
|
@ -0,0 +1,164 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: ConfigPage.cxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "ConfigPage.hxx"
|
||||
#include "resource.h"
|
||||
#include "BrowseForFolder.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
|
||||
|
||||
CConfigPage::CConfigPage( CGlobalData& rGlobalData )
|
||||
: myGlobalData( rGlobalData ),
|
||||
CPropertyPage( IDD_CONFIG_PAGE )
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CConfigPage::OnInitDialog( HWND hwnd )
|
||||
{
|
||||
// return FALSE if SetFocus is called
|
||||
m_hwnd = hwnd;
|
||||
HWND hwndCtrl;
|
||||
|
||||
// Reload settings just in case the emulation changed them
|
||||
myGlobalData.settings().loadConfig();
|
||||
|
||||
// Set up ROMPATH
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMPATH );
|
||||
::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
|
||||
::SetWindowText( hwndCtrl,
|
||||
myGlobalData.settings().getString("romdir").c_str() );
|
||||
|
||||
// Set up PADDLE
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE );
|
||||
TCHAR psz[4] = _T("0");
|
||||
TCHAR i;
|
||||
for ( i = 0; i < 4; ++i )
|
||||
{
|
||||
psz[0] = _T('0') + i;
|
||||
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
|
||||
}
|
||||
::SendMessage( hwndCtrl, CB_SETCURSEL,
|
||||
myGlobalData.settings().getInt("paddle"), 0 );
|
||||
|
||||
// Set up Video mode
|
||||
int videomode = 0;
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_VIDEO );
|
||||
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"Software" );
|
||||
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"OpenGL" );
|
||||
if(myGlobalData.settings().getString("video") == "soft")
|
||||
videomode = 0;
|
||||
else if(myGlobalData.settings().getString("video") == "gl")
|
||||
videomode = 1;
|
||||
::SendMessage( hwndCtrl, CB_SETCURSEL, videomode, 0 );
|
||||
|
||||
// Set up Aspect Ratio
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_ASPECT );
|
||||
::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
|
||||
::SetWindowText( hwndCtrl,
|
||||
myGlobalData.settings().getString("gl_aspect").c_str() );
|
||||
|
||||
// Set up SOUND
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND );
|
||||
::SendMessage( hwndCtrl, BM_SETCHECK,
|
||||
myGlobalData.settings().getBool("sound")
|
||||
? BST_UNCHECKED : BST_CHECKED, 0 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CConfigPage::OnDestroy( void )
|
||||
{
|
||||
}
|
||||
|
||||
LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
|
||||
{
|
||||
UNUSED_ALWAYS( lppsn );
|
||||
|
||||
// Apply the changes
|
||||
// HWND hwnd = lppsn->hdr.hwndFrom; <<-- points to the sheet!
|
||||
|
||||
HWND hwndCtrl;
|
||||
TCHAR buffer[ MAX_PATH ];
|
||||
string str;
|
||||
int i;
|
||||
bool b;
|
||||
|
||||
// RomPath
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ROMPATH );
|
||||
ASSERT( hwndCtrl );
|
||||
::GetWindowText( hwndCtrl, buffer, MAX_PATH );
|
||||
myGlobalData.settings().setString( "romdir", buffer );
|
||||
|
||||
// Paddle
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_PADDLE );
|
||||
ASSERT( hwndCtrl );
|
||||
myGlobalData.settings().setInt( "paddle",
|
||||
::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ) );
|
||||
|
||||
// VideoMode
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_VIDEO );
|
||||
ASSERT( hwndCtrl );
|
||||
i = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
|
||||
if( i == 0 )
|
||||
str = "soft";
|
||||
else if( i == 1 )
|
||||
str = "gl";
|
||||
else
|
||||
str = "soft";
|
||||
myGlobalData.settings().setString( "video", str );
|
||||
|
||||
// AspectRatio
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ASPECT );
|
||||
ASSERT( hwndCtrl );
|
||||
::GetWindowText( hwndCtrl, buffer, MAX_PATH );
|
||||
myGlobalData.settings().setString( "gl_aspect", buffer );
|
||||
|
||||
// Sound
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_SOUND );
|
||||
ASSERT( hwndCtrl );
|
||||
if( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
|
||||
b = false;
|
||||
else
|
||||
b = true;
|
||||
myGlobalData.settings().setBool( "sound", b );
|
||||
|
||||
// Finally, save the config file
|
||||
myGlobalData.settings().saveConfig();
|
||||
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
|
||||
{
|
||||
UNUSED_ALWAYS( wNotifyCode );
|
||||
UNUSED_ALWAYS( hwndCtl );
|
||||
|
||||
if ( wID == IDC_BROWSE )
|
||||
{
|
||||
CBrowseForFolder bff( m_hwnd );
|
||||
bff.SetFlags( BIF_RETURNONLYFSDIRS );
|
||||
if ( bff.SelectFolder() )
|
||||
::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: ConfigPage.hxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONFIGPG_H
|
||||
#define CONFIGPG_H
|
||||
|
||||
#include "PropertySheet.hxx"
|
||||
#include "GlobalData.hxx"
|
||||
|
||||
class CConfigPage : public CPropertyPage
|
||||
{
|
||||
public:
|
||||
CConfigPage( CGlobalData& rGlobalData );
|
||||
|
||||
protected:
|
||||
virtual BOOL OnInitDialog( HWND hwnd );
|
||||
virtual void OnDestroy();
|
||||
virtual LONG OnApply( LPPSHNOTIFY lppsn );
|
||||
|
||||
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ );
|
||||
|
||||
private:
|
||||
CGlobalData& myGlobalData;
|
||||
HWND m_hwnd;
|
||||
|
||||
CConfigPage( const CConfigPage& ); // no implementation
|
||||
void operator=( const CConfigPage& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,284 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "CoolCaption.hxx"
|
||||
|
||||
// MAKE SURE STYLE IS JUST "TITLE BAR" !
|
||||
|
||||
CCoolCaption::CCoolCaption(
|
||||
) : \
|
||||
m_hfont( NULL ),
|
||||
m_tszCaption( NULL ),
|
||||
m_fIsActive( FALSE ),
|
||||
m_hDlg( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
void CCoolCaption::OnInitDialog(
|
||||
HWND hDlg
|
||||
)
|
||||
{
|
||||
m_hDlg = hDlg;
|
||||
|
||||
CalculateNCArea();
|
||||
}
|
||||
|
||||
void CCoolCaption::OnDestroy(
|
||||
void
|
||||
)
|
||||
{
|
||||
if ( m_hDlg == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_hfont )
|
||||
{
|
||||
::DeleteObject( m_hfont );
|
||||
}
|
||||
|
||||
delete[] m_tszCaption;
|
||||
m_tszCaption = NULL;
|
||||
}
|
||||
|
||||
void CCoolCaption::CalculateNCArea(
|
||||
)
|
||||
{
|
||||
if ( m_hDlg == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
::GetWindowRect(m_hDlg, &m_rcWindow);
|
||||
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
|
||||
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
|
||||
|
||||
m_cxFrame = ::GetSystemMetrics(SM_CXFRAME);
|
||||
m_cyFrame = ::GetSystemMetrics(SM_CYFRAME);
|
||||
|
||||
m_cxButtonSize = ::GetSystemMetrics(SM_CXSIZE);
|
||||
|
||||
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
|
||||
|
||||
// This is the size of the caption
|
||||
|
||||
::SetRect(&m_rcCaption, 0, 0, m_cxWindow, cyCaption + m_cyFrame);
|
||||
|
||||
// calculate position of buttons
|
||||
|
||||
SetRect(&m_rcClose,
|
||||
m_cxWindow - m_cxFrame - m_cxButtonSize + 1,
|
||||
m_rcCaption.top + m_cyFrame + 1,
|
||||
m_cxWindow - m_cxFrame - 1,
|
||||
m_rcCaption.bottom - m_cyFrame
|
||||
);
|
||||
|
||||
CopyRect(&m_rcMin, &m_rcClose);
|
||||
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
|
||||
|
||||
// figure out union of all buttons
|
||||
|
||||
RECT rcButtons;
|
||||
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
|
||||
|
||||
SetRect(&m_rcTextArea, m_cxFrame, m_rcCaption.top+m_cyFrame,
|
||||
rcButtons.left-m_cxFrame, m_rcCaption.bottom-m_cyFrame);
|
||||
|
||||
// Make bold caption font
|
||||
|
||||
m_hfont = (HFONT)SendMessage(m_hDlg, WM_GETFONT, 0, 0);
|
||||
LOGFONT lf;
|
||||
GetObject(m_hfont, sizeof(lf), &lf);
|
||||
lf.lfWeight = FW_BOLD;
|
||||
m_hfont = CreateFontIndirect(&lf);
|
||||
|
||||
// Get caption text
|
||||
|
||||
int nCaptionLength = GetWindowTextLength(m_hDlg);
|
||||
m_tszCaption = new TCHAR[nCaptionLength + 2];
|
||||
GetWindowText(m_hDlg, m_tszCaption, nCaptionLength+1);
|
||||
}
|
||||
|
||||
|
||||
void CCoolCaption::OnNcPaint(
|
||||
HRGN hrgn
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( hrgn );
|
||||
|
||||
if ( m_hDlg == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HDC hdc = GetWindowDC(m_hDlg);
|
||||
|
||||
// Fill in the NC area with the proper color
|
||||
|
||||
HPEN hpen, hpenOld;
|
||||
|
||||
hpen = CreatePen(PS_SOLID, 1, m_fIsActive ?
|
||||
GetSysColor(COLOR_ACTIVECAPTION) : \
|
||||
GetSysColor(COLOR_INACTIVECAPTION));
|
||||
hpenOld = (HPEN)SelectObject(hdc, hpen);
|
||||
|
||||
for (long x = 0; x < m_cxWindow; ++x)
|
||||
{
|
||||
if (x < m_cxFrame-1 || x > m_cxWindow-m_cxFrame)
|
||||
{
|
||||
// left, right must go from top to bottom
|
||||
|
||||
MoveToEx(hdc, x, 0, NULL);
|
||||
LineTo(hdc, x, m_rcWindow.bottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise just do top and bottom
|
||||
|
||||
MoveToEx(hdc, x, 0, NULL);
|
||||
LineTo(hdc, x, m_rcCaption.bottom);
|
||||
|
||||
MoveToEx(hdc, x, m_cyWindow-m_cyFrame, NULL);
|
||||
LineTo(hdc, x, m_cyWindow);
|
||||
}
|
||||
}
|
||||
|
||||
SelectObject(hdc, hpenOld);
|
||||
DeleteObject(hpen);
|
||||
|
||||
// Draw the close button
|
||||
|
||||
DrawFrameControl(hdc, &m_rcClose, DFC_CAPTION, DFCS_CAPTIONCLOSE);
|
||||
|
||||
// draw the minimize button
|
||||
|
||||
DrawFrameControl(hdc, &m_rcMin, DFC_CAPTION, DFCS_CAPTIONMIN);
|
||||
|
||||
// Draw the caption text
|
||||
|
||||
SetTextColor(hdc, m_fIsActive ? GetSysColor(COLOR_CAPTIONTEXT) : \
|
||||
GetSysColor(COLOR_INACTIVECAPTIONTEXT));
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
|
||||
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
|
||||
|
||||
// calculate width / height of text
|
||||
|
||||
SIZE sizeText;
|
||||
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
|
||||
|
||||
DrawText(hdc, m_tszCaption, -1, &m_rcTextArea,
|
||||
DT_END_ELLIPSIS | DT_EXTERNALLEADING |
|
||||
DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
|
||||
|
||||
SelectObject(hdc, hfontOld);
|
||||
|
||||
// Draw the docking grippers
|
||||
|
||||
const int nTextRight = m_rcTextArea.left + sizeText.cx + m_cxFrame;
|
||||
|
||||
// right top
|
||||
|
||||
COLORREF cr3dHilight = GetSysColor(COLOR_3DHILIGHT);
|
||||
COLORREF cr3dShadow = GetSysColor(COLOR_3DSHADOW);
|
||||
|
||||
Draw3dRect(hdc, nTextRight+m_cxFrame, 8,
|
||||
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
|
||||
cr3dHilight, cr3dShadow);
|
||||
|
||||
// right bottom
|
||||
|
||||
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
|
||||
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
|
||||
cr3dHilight, cr3dShadow);
|
||||
|
||||
ReleaseDC(m_hDlg, hdc);
|
||||
}
|
||||
|
||||
void CCoolCaption::OnNcActivate(
|
||||
BOOL fActive
|
||||
)
|
||||
{
|
||||
if (m_hDlg == NULL)
|
||||
return;
|
||||
|
||||
m_fIsActive = fActive;
|
||||
|
||||
// This fixes a problem where alt-tab wont repaint the NC area
|
||||
|
||||
RedrawWindow(m_hDlg, NULL, NULL,
|
||||
RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
|
||||
}
|
||||
|
||||
BOOL CCoolCaption::OnNCLButtonDown(
|
||||
INT nHitTest,
|
||||
POINTS pts
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( nHitTest );
|
||||
|
||||
if ( m_hDlg == NULL )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Get the point in client units
|
||||
|
||||
RECT rcWindow;
|
||||
GetWindowRect(m_hDlg, &rcWindow);
|
||||
|
||||
POINT pt = { pts.x, pts.y };
|
||||
pt.x -= rcWindow.left;
|
||||
pt.y -= rcWindow.top;
|
||||
|
||||
if (PtInRect(&m_rcClose, pt))
|
||||
{
|
||||
// This isn't closing it!
|
||||
// SendMessage(m_hDlg, WM_CLOSE, 0, 0);
|
||||
EndDialog(m_hDlg, IDCANCEL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (PtInRect(&m_rcMin, pt))
|
||||
{
|
||||
ShowWindow(m_hDlg, SW_MINIMIZE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CCoolCaption::FillSolidRect(
|
||||
HDC hdc,
|
||||
int x,
|
||||
int y,
|
||||
int cx,
|
||||
int cy,
|
||||
COLORREF clr
|
||||
)
|
||||
{
|
||||
COLORREF cr = SetBkColor(hdc, clr);
|
||||
RECT rect = { x, y, x+cx, y+cy };
|
||||
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
|
||||
SetBkColor(hdc, cr);
|
||||
}
|
||||
|
||||
void CCoolCaption::Draw3dRect(
|
||||
HDC hdc,
|
||||
int x,
|
||||
int y,
|
||||
int cx,
|
||||
int cy,
|
||||
COLORREF clrTopLeft,
|
||||
COLORREF clrBottomRight
|
||||
)
|
||||
{
|
||||
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
|
||||
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
|
||||
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
|
||||
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
|
||||
#ifndef COOLCAP_H
|
||||
#define COOLCAP_H
|
||||
#pragma once
|
||||
|
||||
class CCoolCaption
|
||||
{
|
||||
public:
|
||||
CCoolCaption();
|
||||
|
||||
void OnInitDialog(HWND hDlg);
|
||||
void OnDestroy();
|
||||
|
||||
void OnNcPaint(HRGN);
|
||||
void OnNcActivate(BOOL);
|
||||
BOOL OnNCLButtonDown(INT, POINTS);
|
||||
|
||||
protected:
|
||||
|
||||
HWND m_hDlg;
|
||||
|
||||
private:
|
||||
|
||||
void CalculateNCArea(void);
|
||||
void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, COLORREF clr);
|
||||
void Draw3dRect(HDC hdc, int x, int y, int cx, int cy,
|
||||
COLORREF clrTopLeft, COLORREF clrBottomRight);
|
||||
|
||||
BOOL m_fIsActive;
|
||||
RECT m_rcWindow;
|
||||
int m_cxWindow;
|
||||
int m_cyWindow;
|
||||
int m_cxFrame;
|
||||
int m_cyFrame;
|
||||
int m_cxButtonSize;
|
||||
RECT m_rcClose;
|
||||
RECT m_rcMin;
|
||||
RECT m_rcCaption;
|
||||
RECT m_rcTextArea;
|
||||
HFONT m_hfont;
|
||||
LPTSTR m_tszCaption;
|
||||
|
||||
CCoolCaption( const CCoolCaption& ); // no implementation
|
||||
void operator=( const CCoolCaption& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,69 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include "FileDialog.hxx"
|
||||
|
||||
CFileDialog::CFileDialog(
|
||||
BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
|
||||
LPCTSTR lpszDefExt /* = NULL */,
|
||||
LPCTSTR lpszFileName /* = NULL */,
|
||||
DWORD dwFlags /* = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT */,
|
||||
LPCTSTR lpszFilter /* = NULL */,
|
||||
HWND hwndParent /* = NULL */
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( hwndParent );
|
||||
|
||||
memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL
|
||||
m_szFileName[0] = '\0';
|
||||
m_szFileTitle[0] = '\0';
|
||||
|
||||
m_bOpenFileDialog = bOpenFileDialog;
|
||||
|
||||
m_ofn.lStructSize = sizeof(m_ofn);
|
||||
m_ofn.lpstrFile = m_szFileName;
|
||||
m_ofn.nMaxFile = _countof(m_szFileName);
|
||||
m_ofn.lpstrDefExt = lpszDefExt;
|
||||
m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle;
|
||||
m_ofn.nMaxFileTitle = _countof(m_szFileTitle);
|
||||
m_ofn.Flags = (dwFlags | OFN_EXPLORER);
|
||||
m_ofn.hInstance = NULL;
|
||||
|
||||
// setup initial file name
|
||||
if (lpszFileName != NULL)
|
||||
lstrcpyn(m_szFileName, lpszFileName, _countof(m_szFileName));
|
||||
|
||||
// Translate filter into commdlg format (lots of \0)
|
||||
if (lpszFilter != NULL)
|
||||
{
|
||||
lstrcpy(m_szFilter, lpszFilter);
|
||||
LPTSTR pch = m_szFilter; // modify the buffer in place
|
||||
// MFC delimits with '|' not '\0'
|
||||
while ((pch = _tcschr(pch, '|')) != NULL)
|
||||
*pch++ = '\0';
|
||||
m_ofn.lpstrFilter = m_szFilter;
|
||||
// do not call ReleaseBuffer() since the string contains '\0' characters
|
||||
}
|
||||
}
|
||||
|
||||
int CFileDialog::DoModal(
|
||||
void
|
||||
)
|
||||
{
|
||||
int nResult;
|
||||
|
||||
if (m_bOpenFileDialog)
|
||||
{
|
||||
nResult = ::GetOpenFileName(&m_ofn);
|
||||
}
|
||||
else
|
||||
{
|
||||
nResult = ::GetSaveFileName(&m_ofn);
|
||||
}
|
||||
|
||||
return nResult ? nResult : IDCANCEL;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#ifndef FILEDLG_H
|
||||
#define FILEDLG_H
|
||||
#pragma once
|
||||
|
||||
class CFileDialog
|
||||
{
|
||||
public:
|
||||
|
||||
OPENFILENAME m_ofn;
|
||||
|
||||
CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
|
||||
LPCTSTR lpszDefExt = NULL,
|
||||
LPCTSTR lpszFileName = NULL,
|
||||
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
LPCTSTR lpszFilter = NULL,
|
||||
HWND hwndParent = NULL);
|
||||
|
||||
virtual int DoModal();
|
||||
|
||||
LPCTSTR GetPathName() const
|
||||
{
|
||||
return m_ofn.lpstrFile;
|
||||
}
|
||||
|
||||
LPCTSTR GetFileName() const
|
||||
{
|
||||
return m_ofn.lpstrFileTitle;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save
|
||||
|
||||
TCHAR m_szFilter[1024]; // filter string
|
||||
// separate fields with '|', terminate with '||\0'
|
||||
|
||||
TCHAR m_szFileTitle[64]; // contains file title after return
|
||||
TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return
|
||||
|
||||
private:
|
||||
|
||||
CFileDialog( const CFileDialog& ); // no implementation
|
||||
void operator=( const CFileDialog& ); // no implementation
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,39 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: GlobalData.cxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "resource.h"
|
||||
|
||||
#include "Settings.hxx"
|
||||
#include "SettingsWin32.hxx"
|
||||
#include "GlobalData.hxx"
|
||||
|
||||
|
||||
CGlobalData::CGlobalData( HINSTANCE hInstance )
|
||||
: myInstance(hInstance)
|
||||
{
|
||||
myPathName[0] = _T('\0');
|
||||
mySettings = new SettingsWin32();
|
||||
}
|
||||
|
||||
CGlobalData::~CGlobalData()
|
||||
{
|
||||
if(mySettings)
|
||||
delete mySettings;
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: GlobalData.hxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef GLOBAL_DATA_HXX
|
||||
#define GLOBAL_DATA_HXX
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class CConfigPage;
|
||||
class Settings;
|
||||
|
||||
class CGlobalData
|
||||
{
|
||||
friend CConfigPage;
|
||||
|
||||
public:
|
||||
CGlobalData( HINSTANCE hInstance );
|
||||
~CGlobalData( void );
|
||||
|
||||
LPCTSTR PathName( void ) const
|
||||
{
|
||||
if ( myPathName[0] == _T('\0') )
|
||||
return NULL;
|
||||
|
||||
return myPathName;
|
||||
}
|
||||
|
||||
HINSTANCE ModuleInstance( void ) const
|
||||
{
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
Settings& settings( void )
|
||||
{
|
||||
return *mySettings;
|
||||
}
|
||||
|
||||
private:
|
||||
Settings* mySettings;
|
||||
|
||||
string myArgumentList;
|
||||
|
||||
HINSTANCE myInstance;
|
||||
TCHAR myPathName[ MAX_PATH ];
|
||||
|
||||
CGlobalData( const CGlobalData& ); // no implementation
|
||||
void operator=( const CGlobalData& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,200 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include "HeaderCtrl.hxx"
|
||||
|
||||
CHeaderCtrl::CHeaderCtrl(
|
||||
) : \
|
||||
m_nSortCol(0),
|
||||
m_fSortAsc(TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LRESULT CHeaderCtrl::WndProc(
|
||||
HWND hWnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
BOOL& rfHandled
|
||||
)
|
||||
{
|
||||
switch ( msg )
|
||||
{
|
||||
case WM_DRAWITEM:
|
||||
rfHandled = TRUE;
|
||||
OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CHeaderCtrl::SetSortCol(
|
||||
int nCol,
|
||||
BOOL bAsc
|
||||
)
|
||||
{
|
||||
m_nSortCol = nCol;
|
||||
m_fSortAsc = bAsc;
|
||||
|
||||
// change this item to owner draw
|
||||
|
||||
HWND hwndHeader = ::GetDlgItem( *this, 0 );
|
||||
|
||||
HDITEM hdi;
|
||||
hdi.mask = HDI_FORMAT;
|
||||
Header_GetItem(hwndHeader, nCol, &hdi);
|
||||
hdi.fmt |= HDF_OWNERDRAW;
|
||||
Header_SetItem(hwndHeader, nCol, &hdi);
|
||||
|
||||
// repaint the header
|
||||
|
||||
::InvalidateRect(hwndHeader, NULL, TRUE);
|
||||
}
|
||||
|
||||
void CHeaderCtrl::OnDrawItem(
|
||||
HWND hwnd,
|
||||
UINT idCtl,
|
||||
LPDRAWITEMSTRUCT lpdis
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( idCtl );
|
||||
|
||||
HDC hdc = lpdis->hDC;
|
||||
|
||||
RECT rcLabel;
|
||||
::CopyRect( &rcLabel, &(lpdis->rcItem) );
|
||||
|
||||
/* save the DC */
|
||||
|
||||
int nSavedDC = ::SaveDC( hdc );
|
||||
|
||||
/* set clip region to column */
|
||||
|
||||
HRGN hrgn = ::CreateRectRgnIndirect( &rcLabel );
|
||||
SelectObject( hdc, hrgn );
|
||||
DeleteObject( hrgn );
|
||||
|
||||
/* draw the background */
|
||||
|
||||
::FillRect( hdc, &rcLabel, ::GetSysColorBrush(COLOR_3DFACE) );
|
||||
|
||||
/* offset the label */
|
||||
|
||||
SIZE size;
|
||||
::GetTextExtentPoint32( hdc, _T(" "), 1, &size );
|
||||
int nOffset = size.cx * 2;
|
||||
|
||||
/* get the column text and format */
|
||||
|
||||
TCHAR tszText[255 + 1];
|
||||
HDITEM hdi;
|
||||
hdi.mask = HDI_TEXT | HDI_FORMAT;
|
||||
hdi.pszText = tszText;
|
||||
hdi.cchTextMax = 255;
|
||||
Header_GetItem( GetDlgItem(hwnd, 0), lpdis->itemID, &hdi );
|
||||
|
||||
/* determine format for drawing label */
|
||||
|
||||
UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP |
|
||||
DT_VCENTER | DT_END_ELLIPSIS;
|
||||
|
||||
/* determine justification */
|
||||
|
||||
if (hdi.fmt & HDF_CENTER)
|
||||
{
|
||||
uFormat |= DT_CENTER;
|
||||
}
|
||||
else if (hdi.fmt & HDF_RIGHT)
|
||||
{
|
||||
uFormat |= DT_RIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
uFormat |= DT_LEFT;
|
||||
}
|
||||
|
||||
/* adjust the rect if selected */
|
||||
|
||||
if (lpdis->itemState & ODS_SELECTED)
|
||||
{
|
||||
rcLabel.left++;
|
||||
rcLabel.top += 2;
|
||||
rcLabel.right++;
|
||||
}
|
||||
|
||||
/* adjust rect for sort arrow */
|
||||
|
||||
if ( lpdis->itemID == m_nSortCol )
|
||||
{
|
||||
rcLabel.right -= (3 * nOffset);
|
||||
}
|
||||
|
||||
rcLabel.left += nOffset;
|
||||
rcLabel.right -= nOffset;
|
||||
|
||||
/* draw label */
|
||||
|
||||
if ( rcLabel.left < rcLabel.right )
|
||||
{
|
||||
::DrawText(hdc, tszText, -1, &rcLabel, uFormat );
|
||||
}
|
||||
|
||||
/* draw the arrow */
|
||||
|
||||
if ( lpdis->itemID == m_nSortCol )
|
||||
{
|
||||
RECT rcIcon;
|
||||
HPEN hpenLight, hpenShadow, hpenOld;
|
||||
|
||||
::CopyRect( &rcIcon, &(lpdis->rcItem) );
|
||||
|
||||
hpenLight = ::CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) );
|
||||
hpenShadow = ::CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW) );
|
||||
hpenOld = (HPEN)::SelectObject( hdc, hpenLight );
|
||||
|
||||
if (m_fSortAsc)
|
||||
{
|
||||
/* draw triangle pointing up */
|
||||
|
||||
::MoveToEx( hdc, rcIcon.right - 2 * nOffset, nOffset - 1, NULL );
|
||||
::LineTo( hdc, rcIcon.right - 3 * nOffset / 2,
|
||||
rcIcon.bottom - nOffset );
|
||||
::LineTo( hdc, rcIcon.right - 5 * nOffset / 2 - 2,
|
||||
rcIcon.bottom - nOffset );
|
||||
::MoveToEx( hdc, rcIcon.right - 5 * nOffset / 2 - 1,
|
||||
rcIcon.bottom - nOffset, NULL );
|
||||
|
||||
::SelectObject( hdc, hpenShadow );
|
||||
::LineTo( hdc, rcIcon.right - 2 * nOffset, nOffset - 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* draw triangle pointing down */
|
||||
|
||||
::MoveToEx( hdc, rcIcon.right - 3 * nOffset / 2, nOffset - 1,
|
||||
NULL );
|
||||
::LineTo( hdc, rcIcon.right - 2 * nOffset - 1,
|
||||
rcIcon.bottom - nOffset );
|
||||
::LineTo( hdc, rcIcon.right - 2 * nOffset - 1,
|
||||
rcIcon.bottom - nOffset );
|
||||
::MoveToEx( hdc, rcIcon.right - 2 * nOffset - 1,
|
||||
rcIcon.bottom - nOffset, NULL );
|
||||
|
||||
::SelectObject( hdc, hpenShadow );
|
||||
::LineTo( hdc, rcIcon.right - 5 * nOffset / 2 - 1,
|
||||
nOffset - 1 );
|
||||
::LineTo( hdc, rcIcon.right - 3 * nOffset / 2,
|
||||
nOffset - 1 );
|
||||
}
|
||||
|
||||
::SelectObject( hdc, hpenOld );
|
||||
::DeleteObject( hpenShadow );
|
||||
::DeleteObject( hpenLight );
|
||||
}
|
||||
|
||||
::RestoreDC( hdc, nSavedDC );
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#ifndef HDRCTL_H
|
||||
#define HDRCTL_H
|
||||
#pragma once
|
||||
|
||||
#include "Wnd.hxx"
|
||||
|
||||
class CHeaderCtrl : public CWnd
|
||||
{
|
||||
public:
|
||||
|
||||
CHeaderCtrl();
|
||||
|
||||
void SetSortCol(int nCol, BOOL fAscending);
|
||||
int GetSortCol(void) const;
|
||||
BOOL GetSortAsc(void) const;
|
||||
|
||||
protected:
|
||||
|
||||
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||
BOOL& rfHandled);
|
||||
|
||||
private:
|
||||
|
||||
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
|
||||
|
||||
UINT m_nSortCol;
|
||||
BOOL m_fSortAsc;
|
||||
|
||||
CHeaderCtrl( const CHeaderCtrl& ); // no implementation
|
||||
void operator=( const CHeaderCtrl& ); // no implementation
|
||||
|
||||
};
|
||||
|
||||
inline int CHeaderCtrl::GetSortCol
|
||||
(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return m_nSortCol;
|
||||
}
|
||||
|
||||
inline BOOL CHeaderCtrl::GetSortAsc
|
||||
(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return m_fSortAsc;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,352 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include "HyperLink.hxx"
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
CHyperLink::CHyperLink(
|
||||
) : \
|
||||
m_bOverControl(FALSE),
|
||||
m_bVisited(FALSE),
|
||||
m_hFont(NULL),
|
||||
m_hLinkCursor(NULL)
|
||||
{
|
||||
m_crLinkColor = RGB( 0, 0, 238); // Blue
|
||||
m_crVisitedColor = RGB( 85, 26, 139); // Purple
|
||||
m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
|
||||
|
||||
SetDefaultCursor();
|
||||
}
|
||||
|
||||
CHyperLink::~CHyperLink(
|
||||
)
|
||||
{
|
||||
if (m_hFont)
|
||||
{
|
||||
::DeleteObject( m_hFont );
|
||||
m_hFont = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CHyperLink::SetURL(
|
||||
LPCTSTR ctszURL
|
||||
)
|
||||
{
|
||||
if (ctszURL == NULL)
|
||||
return;
|
||||
|
||||
lstrcpy(m_tszURL, ctszURL);
|
||||
|
||||
}
|
||||
|
||||
void CHyperLink::PreSubclassWindow(
|
||||
HWND hwnd
|
||||
)
|
||||
{
|
||||
::GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
|
||||
|
||||
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
|
||||
}
|
||||
|
||||
LRESULT CHyperLink::WndProc(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
BOOL& rfHandled
|
||||
)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
rfHandled = TRUE;
|
||||
return OnPaint(hwnd);
|
||||
|
||||
case WM_SETCURSOR:
|
||||
rfHandled = TRUE;
|
||||
return OnSetCursor(hwnd, LOWORD(lParam), HIWORD(lParam));
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
rfHandled = TRUE;
|
||||
return OnLButtonUp(hwnd, wParam, LOWORD(lParam),
|
||||
HIWORD(lParam));
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
rfHandled = TRUE;
|
||||
return OnMouseMove(hwnd, wParam, LOWORD(lParam),
|
||||
HIWORD(lParam));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CHyperLink::OnPaint(
|
||||
HWND hwnd
|
||||
)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
SelectObject(hdc, m_hFont);
|
||||
|
||||
if (m_bOverControl)
|
||||
{
|
||||
SetTextColor(hdc, m_crHoverColor);
|
||||
}
|
||||
else if (m_bVisited)
|
||||
{
|
||||
SetTextColor(hdc, m_crVisitedColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextColor(hdc, m_crLinkColor);
|
||||
}
|
||||
|
||||
::SetBkMode( hdc, TRANSPARENT );
|
||||
|
||||
::TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
|
||||
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CHyperLink::OnSetCursor(
|
||||
HWND hwnd,
|
||||
WORD nHittest,
|
||||
WORD wMouseMsg
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( hwnd );
|
||||
UNUSED_ALWAYS( nHittest );
|
||||
UNUSED_ALWAYS( wMouseMsg );
|
||||
|
||||
if (m_hLinkCursor)
|
||||
{
|
||||
::SetCursor(m_hLinkCursor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LRESULT CHyperLink::OnLButtonUp(
|
||||
HWND hwnd,
|
||||
WPARAM fwKeys,
|
||||
WORD xPos,
|
||||
WORD yPos
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( fwKeys );
|
||||
UNUSED_ALWAYS( xPos );
|
||||
UNUSED_ALWAYS( yPos );
|
||||
|
||||
int result = (int)GotoURL(m_tszURL, SW_SHOW);
|
||||
m_bVisited = (result > HINSTANCE_ERROR);
|
||||
if (!m_bVisited)
|
||||
{
|
||||
MessageBeep(MB_ICONEXCLAMATION);
|
||||
ReportError(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bVisited = TRUE;
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CHyperLink::OnMouseMove(
|
||||
HWND hwnd,
|
||||
WPARAM fwKeys,
|
||||
WORD xPos,
|
||||
WORD yPos
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( fwKeys );
|
||||
|
||||
// call defwindowproc?
|
||||
|
||||
if (m_bOverControl)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
POINT pt = { xPos, yPos };
|
||||
if (!PtInRect(&rc, pt))
|
||||
{
|
||||
m_bOverControl = FALSE;
|
||||
ReleaseCapture();
|
||||
RedrawWindow(hwnd, NULL, NULL,
|
||||
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bOverControl = TRUE;
|
||||
RedrawWindow(hwnd, NULL, NULL,
|
||||
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
|
||||
SetCapture(hwnd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
|
||||
// It loads a "hand" cursor from the winhlp32.exe module
|
||||
|
||||
void CHyperLink::SetDefaultCursor(
|
||||
void
|
||||
)
|
||||
{
|
||||
if (m_hLinkCursor == NULL) // No cursor handle - load our own
|
||||
{
|
||||
// Get the windows directory
|
||||
|
||||
TCHAR tszWndDir[MAX_PATH + 1];
|
||||
GetWindowsDirectory(tszWndDir, MAX_PATH);
|
||||
|
||||
lstrcat(tszWndDir, _T("\\winhlp32.exe"));
|
||||
|
||||
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
|
||||
HMODULE hModule = LoadLibrary(tszWndDir);
|
||||
if (hModule) {
|
||||
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
|
||||
if (hHandCursor)
|
||||
m_hLinkCursor = CopyCursor(hHandCursor);
|
||||
}
|
||||
FreeLibrary(hModule);
|
||||
}
|
||||
}
|
||||
|
||||
LONG CHyperLink::GetRegKey(
|
||||
HKEY key,
|
||||
LPCTSTR subkey,
|
||||
LPTSTR retdata
|
||||
)
|
||||
{
|
||||
HKEY hkey;
|
||||
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
|
||||
|
||||
if (retval == ERROR_SUCCESS) {
|
||||
long datasize = MAX_PATH;
|
||||
TCHAR data[MAX_PATH];
|
||||
RegQueryValue(hkey, NULL, data, &datasize);
|
||||
lstrcpy(retdata,data);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void CHyperLink::ReportError(
|
||||
int nError
|
||||
)
|
||||
{
|
||||
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
|
||||
switch (nError)
|
||||
{
|
||||
case 0:
|
||||
lstrcpy(tsz, _T("The operating system is out\nof memory or resources."));
|
||||
break;
|
||||
|
||||
case SE_ERR_PNF:
|
||||
lstrcpy(tsz, _T("The specified path was not found."));
|
||||
break;
|
||||
|
||||
case SE_ERR_FNF:
|
||||
lstrcpy(tsz, _T("The specified file was not found."));
|
||||
break;
|
||||
|
||||
case ERROR_BAD_FORMAT:
|
||||
lstrcpy(tsz, _T("The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."));
|
||||
break;
|
||||
|
||||
case SE_ERR_ACCESSDENIED:
|
||||
lstrcpy(tsz, _T("The operating system denied\naccess to the specified file."));
|
||||
break;
|
||||
|
||||
case SE_ERR_ASSOCINCOMPLETE:
|
||||
lstrcpy(tsz,_T("The filename association is\nincomplete or invalid."));
|
||||
break;
|
||||
|
||||
case SE_ERR_DDEBUSY:
|
||||
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."));
|
||||
break;
|
||||
|
||||
case SE_ERR_DDEFAIL:
|
||||
lstrcpy(tsz, _T("The DDE transaction failed."));
|
||||
break;
|
||||
|
||||
case SE_ERR_DDETIMEOUT:
|
||||
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because the request timed out."));
|
||||
break;
|
||||
|
||||
case SE_ERR_DLLNOTFOUND:
|
||||
lstrcpy(tsz, _T("The specified dynamic-link library was not found."));
|
||||
break;
|
||||
|
||||
case SE_ERR_NOASSOC:
|
||||
lstrcpy(tsz, __T("There is no application associated\nwith the given filename extension."));
|
||||
break;
|
||||
|
||||
case SE_ERR_OOM:
|
||||
lstrcpy(tsz, _T("There was not enough memory to complete the operation."));
|
||||
break;
|
||||
|
||||
case SE_ERR_SHARE:
|
||||
lstrcpy(tsz, _T("A sharing violation occurred."));
|
||||
break;
|
||||
|
||||
default:
|
||||
wsprintf(tsz, _T("Unknown error %d occurred."), nError);
|
||||
break;
|
||||
}
|
||||
|
||||
TCHAR tszCaption[MAX_HYPERLINK_TEXT_LEN + 1];
|
||||
lstrcpy(tszCaption, _T("Unable to open hyperlink"));
|
||||
|
||||
MessageBox(NULL, tsz, tszCaption, MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
|
||||
HINSTANCE CHyperLink::GotoURL(
|
||||
LPCTSTR url,
|
||||
int showcmd
|
||||
)
|
||||
{
|
||||
TCHAR key[MAX_PATH + MAX_PATH];
|
||||
|
||||
// First try ShellExecute()
|
||||
HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL,NULL, showcmd);
|
||||
|
||||
// If it failed, get the .htm regkey and lookup the program
|
||||
if ((UINT)result <= HINSTANCE_ERROR) {
|
||||
|
||||
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS) {
|
||||
lstrcat(key, _T("\\shell\\open\\command"));
|
||||
|
||||
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) {
|
||||
TCHAR *pos;
|
||||
pos = _tcsstr(key, _T("\"%1\""));
|
||||
if (pos == NULL) { // No quotes found
|
||||
pos = strstr(key, _T("%1")); // Check for %1, without quotes
|
||||
if (pos == NULL) // No parameter at all...
|
||||
pos = key+lstrlen(key)-1;
|
||||
else
|
||||
*pos = '\0'; // Remove the parameter
|
||||
}
|
||||
else
|
||||
*pos = '\0'; // Remove the parameter
|
||||
|
||||
lstrcat(pos, _T(" "));
|
||||
lstrcat(pos, url);
|
||||
result = (HINSTANCE) WinExec(key,showcmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#ifndef HYPERLINK_H
|
||||
#define HYPERLINK_H
|
||||
#pragma once
|
||||
|
||||
#define MAX_HYPERLINK_TEXT_LEN 256
|
||||
#define MAX_HYPERLINK_URL 256
|
||||
|
||||
#include "Wnd.hxx"
|
||||
|
||||
class CHyperLink : public CWnd
|
||||
{
|
||||
public:
|
||||
CHyperLink();
|
||||
~CHyperLink();
|
||||
|
||||
void SetURL(LPCTSTR ctszURL);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void PreSubclassWindow(HWND hwnd);
|
||||
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||
BOOL& rfHandled);
|
||||
|
||||
private:
|
||||
|
||||
void SetDefaultCursor();
|
||||
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
|
||||
void ReportError(int nError);
|
||||
HINSTANCE GotoURL(LPCTSTR url, int showcmd);
|
||||
|
||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg,
|
||||
WPARAM wParam, LPARAM lParam);
|
||||
|
||||
HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdcStatic, HWND hwndStatic);
|
||||
BOOL OnSetCursor(HWND hwnd, WORD nHittest, WORD wMouseMsg);
|
||||
LRESULT OnPaint(HWND hwnd);
|
||||
LRESULT OnLButtonUp(HWND, WPARAM, WORD, WORD);
|
||||
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
|
||||
|
||||
// Stuff from the control
|
||||
|
||||
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
|
||||
HFONT m_hFont;
|
||||
|
||||
// link specific
|
||||
|
||||
COLORREF m_crLinkColor;
|
||||
COLORREF m_crVisitedColor;
|
||||
COLORREF m_crHoverColor;
|
||||
|
||||
BOOL m_bOverControl;
|
||||
BOOL m_bVisited;
|
||||
|
||||
HCURSOR m_hLinkCursor;
|
||||
|
||||
TCHAR m_tszURL[MAX_HYPERLINK_URL + 1];
|
||||
|
||||
CHyperLink( const CHyperLink& ); // no implementation
|
||||
void operator=( const CHyperLink& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,849 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: MainDlg.cxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "MainDlg.hxx"
|
||||
#include "GlobalData.hxx"
|
||||
#include "PropertySheet.hxx"
|
||||
#include "AboutPage.hxx"
|
||||
#include "ConfigPage.hxx"
|
||||
#include "resource.h"
|
||||
#include "Settings.hxx"
|
||||
|
||||
#define BKGND_BITMAP_TOP 64
|
||||
#define BKGND_BITMAP_BOTTOM 355
|
||||
|
||||
// NOTE: LVS_OWNERDATA doesn't support LVM_SORTITEMS!
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
inline LPARAM ListView_GetItemData( HWND hwndList, int iItem )
|
||||
{
|
||||
LVITEM lvi;
|
||||
lvi.mask = LVIF_PARAM;
|
||||
lvi.iItem = iItem;
|
||||
lvi.iSubItem = 0;
|
||||
|
||||
ListView_GetItem(hwndList, &lvi);
|
||||
|
||||
return lvi.lParam;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CMainDlg::CMainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance )
|
||||
: myGlobalData(rGlobalData),
|
||||
m_hInstance(hInstance)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CMainDlg::ClearList( void )
|
||||
{
|
||||
int nCount = ListView_GetItemCount( m_hwndList );
|
||||
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
delete (CListData*)ListView_GetItemData( m_hwndList, i );
|
||||
|
||||
ListView_DeleteAllItems( m_hwndList );
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int CMainDlg::DoModal( HWND hwndParent )
|
||||
{
|
||||
return DialogBoxParam( m_hInstance,
|
||||
MAKEINTRESOURCE(IDD),
|
||||
hwndParent,
|
||||
StaticDialogFunc,
|
||||
(LPARAM)this );
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CALLBACK
|
||||
CMainDlg::StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
CMainDlg* pDlg;
|
||||
|
||||
switch ( uMsg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
pDlg = reinterpret_cast<CMainDlg*>( lParam );
|
||||
pDlg->m_hwnd = hDlg;
|
||||
(void)::SetWindowLong( hDlg, DWL_USER, reinterpret_cast<LONG>( pDlg ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
pDlg = reinterpret_cast<CMainDlg*>( ::GetWindowLong( hDlg, DWL_USER ) );
|
||||
if ( pDlg == NULL )
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return pDlg->DialogFunc( uMsg, wParam, lParam );
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CALLBACK
|
||||
CMainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
BOOL b;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
return OnCommand( LOWORD(wParam), (HWND)lParam, HIWORD(wParam) );
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam );
|
||||
if (b)
|
||||
return b;
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if ( OnEraseBkgnd( (HDC)wParam ) )
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
return OnInitDialog( );
|
||||
|
||||
case WM_NOTIFY:
|
||||
return OnNotify( (int)wParam, (LPNMHDR)lParam );
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
TRACE( "WM_PALETTECHANGED from maindlg" );
|
||||
return FALSE;
|
||||
|
||||
case WM_QUERYNEWPALETTE:
|
||||
TRACE( "WM_QUERYNEWPALETTE from maindlg" );
|
||||
return FALSE;
|
||||
|
||||
// Cool caption handlers
|
||||
case WM_DESTROY:
|
||||
OnDestroy( );
|
||||
break;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
// Forward this onto the control
|
||||
::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM, wParam, lParam );
|
||||
return TRUE;
|
||||
|
||||
case WM_NCPAINT:
|
||||
// DefWindowProc(hDlg, uMsg, wParam, lParam);
|
||||
OnNcPaint( (HRGN)wParam );
|
||||
return TRUE;
|
||||
|
||||
case WM_NCACTIVATE:
|
||||
OnNcActivate( (BOOL)wParam );
|
||||
// When the fActive parameter is FALSE, an application should return
|
||||
// TRUE to indicate that the system should proceed with the default
|
||||
// processing
|
||||
SetWindowLong( m_hwnd, DWL_MSGRESULT, TRUE );
|
||||
return TRUE;
|
||||
|
||||
case WM_NCLBUTTONDOWN:
|
||||
return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) );
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
// Allow Alt-F4 to close the window
|
||||
if ( wParam == SC_CLOSE )
|
||||
::EndDialog( m_hwnd, IDCANCEL );
|
||||
break;
|
||||
}
|
||||
|
||||
// Message not handled
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnInitDialog( void )
|
||||
{
|
||||
DWORD dwRet;
|
||||
|
||||
HWND hwnd = *this;
|
||||
|
||||
dwRet = m_stella.Initialize();
|
||||
if ( dwRet != ERROR_SUCCESS )
|
||||
{
|
||||
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
|
||||
SendMessage( hwnd, WM_CLOSE, 0, 0 );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Set dialog icon
|
||||
HICON hicon = ::LoadIcon(m_hInstance, MAKEINTRESOURCE(IDI_APP));
|
||||
::SendMessage( hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon );
|
||||
::SendMessage( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon );
|
||||
|
||||
// Make the Rom note have bold text
|
||||
HWND hwndCtrl;
|
||||
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMNOTE );
|
||||
|
||||
HFONT hfont = (HFONT)::SendMessage( hwndCtrl, WM_GETFONT, 0, 0 );
|
||||
|
||||
LOGFONT lf;
|
||||
::GetObject( hfont, sizeof(LOGFONT), &lf );
|
||||
lf.lfWeight = FW_BOLD;
|
||||
|
||||
m_hfontRomNote = ::CreateFontIndirect( &lf );
|
||||
if ( m_hfontRomNote )
|
||||
::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 );
|
||||
|
||||
// Do subclassing
|
||||
m_CoolCaption.OnInitDialog( hwnd );
|
||||
m_header.SubclassDlgItem( hwnd, IDC_ROMLIST );
|
||||
m_btn3d.SubclassDlgItem( hwnd, IDC_TITLE );
|
||||
m_btnPlay.SubclassDlgItem( hwnd, IDC_PLAY );
|
||||
m_btnHelp.SubclassDlgItem( hwnd, IDC_ABOUT );
|
||||
m_btnConfig.SubclassDlgItem( hwnd, IDC_CONFIG );
|
||||
m_btnExit.SubclassDlgItem( hwnd, IDC_EXIT );
|
||||
|
||||
const int nMaxString = 256;
|
||||
TCHAR psz[nMaxString + 1];
|
||||
|
||||
// Initialize the list view
|
||||
m_hwndList = ::GetDlgItem( hwnd, IDC_ROMLIST );
|
||||
ASSERT( m_hwndList );
|
||||
|
||||
// LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32
|
||||
::SendMessage( m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE,
|
||||
0, LVS_EX_FULLROWSELECT );
|
||||
|
||||
RECT rc;
|
||||
::GetClientRect( m_hwndList, &rc );
|
||||
|
||||
LONG lTotalWidth = rc.right-rc.left - GetSystemMetrics(SM_CXVSCROLL);
|
||||
int cx = lTotalWidth / CListData::GetColumnCount();
|
||||
|
||||
for (int i = 0; i < CListData::GetColumnCount(); ++i)
|
||||
{
|
||||
::LoadString( m_hInstance, CListData::GetColumnNameIdForColumn( i ),
|
||||
psz, nMaxString );
|
||||
|
||||
LV_COLUMN lvc;
|
||||
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
lvc.cx = cx;
|
||||
lvc.pszText = psz;
|
||||
ListView_InsertColumn( m_hwndList, i, &lvc );
|
||||
}
|
||||
|
||||
DWORD dwError = PopulateRomList();
|
||||
if ( dwError != ERROR_SUCCESS )
|
||||
{
|
||||
MessageBoxFromWinError( dwError, _T("PopulateRomList") );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// if items added, select first item and enable play button
|
||||
int nCount = ListView_GetItemCount( m_hwndList );
|
||||
if (nCount != 0)
|
||||
{
|
||||
m_header.SetSortCol( 0, TRUE );
|
||||
ListView_SortItems( m_hwndList, ListViewCompareFunc, (LPARAM)this );
|
||||
ListView_SetItemState( m_hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED );
|
||||
}
|
||||
else
|
||||
{
|
||||
::EnableWindow(::GetDlgItem( hwnd, IDC_PLAY), FALSE );
|
||||
}
|
||||
|
||||
// Show status text
|
||||
TCHAR pszStatus[256 + 1];
|
||||
LoadString(m_hInstance, IDS_STATUSTEXT, pszStatus, 256);
|
||||
wsprintf( psz, pszStatus, nCount );
|
||||
SetDlgItemText( hwnd, IDC_ROMCOUNT, psz );
|
||||
|
||||
// Show rom path
|
||||
SetDlgItemText( hwnd, IDC_ROMPATH,
|
||||
myGlobalData.settings().getString("romdir").c_str() );
|
||||
|
||||
// Set default button
|
||||
::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 );
|
||||
|
||||
// return FALSE if SetFocus is called
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
|
||||
{
|
||||
UNUSED_ALWAYS( hwndCtl );
|
||||
UNUSED_ALWAYS( codeNotify );
|
||||
|
||||
HWND hwnd = *this;
|
||||
CListData* pListData;
|
||||
|
||||
int nItem;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case IDC_PLAY:
|
||||
nItem = (int)::SendMessage( m_hwndList, LVM_GETNEXTITEM,
|
||||
(WPARAM)-1, MAKELPARAM( LVNI_SELECTED, 0 ) );
|
||||
ASSERT( nItem != -1 );
|
||||
if ( nItem == -1 )
|
||||
{
|
||||
::MessageBox( m_hInstance, hwnd, IDS_NO_ITEM_SELECTED );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem );
|
||||
|
||||
TCHAR pszPathName[ MAX_PATH + 1 ];
|
||||
lstrcpy( pszPathName, myGlobalData.settings().getString("romdir").c_str() );
|
||||
lstrcat( pszPathName, _T("\\") );
|
||||
lstrcat( pszPathName,
|
||||
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
// Play the game!
|
||||
::EnableWindow( hwnd, FALSE );
|
||||
|
||||
(void)m_stella.PlayROM( hwnd, pszPathName,
|
||||
pListData->GetTextForColumn( CListData::NAME_COLUMN ),
|
||||
myGlobalData );
|
||||
|
||||
::EnableWindow( hwnd, TRUE );
|
||||
|
||||
// Set focus back to the rom list
|
||||
::SetFocus( m_hwndList );
|
||||
|
||||
return TRUE;
|
||||
break; // case IDC_PLAY
|
||||
|
||||
case IDC_EXIT:
|
||||
ClearList();
|
||||
::EndDialog( hwnd, IDCANCEL );
|
||||
return TRUE;
|
||||
break; // case IDC_EXIT
|
||||
|
||||
case IDC_CONFIG:
|
||||
{
|
||||
CPropertySheet ps( _T("Configure"), hwnd );
|
||||
|
||||
CConfigPage pgConfig( myGlobalData );
|
||||
ps.AddPage( &pgConfig );
|
||||
|
||||
(void)ps.DoModal();
|
||||
|
||||
return TRUE;
|
||||
break; // case IDC_CONFIG
|
||||
}
|
||||
|
||||
case IDC_ABOUT:
|
||||
{
|
||||
CPropertySheet ps(_T("Help"), hwnd);
|
||||
|
||||
CHelpPage pgAbout;
|
||||
ps.AddPage(&pgAbout);
|
||||
|
||||
ps.DoModal();
|
||||
return TRUE;
|
||||
break; // case IDC_ABOUT
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnNotify( int idCtrl, LPNMHDR pnmh )
|
||||
{
|
||||
UNUSED_ALWAYS( idCtrl );
|
||||
|
||||
switch ( pnmh->code )
|
||||
{
|
||||
case LVN_GETDISPINFO:
|
||||
OnGetDispInfo( (NMLVDISPINFO*)pnmh );
|
||||
return TRUE;
|
||||
|
||||
case LVN_COLUMNCLICK:
|
||||
OnColumnClick( (LPNMLISTVIEW)pnmh );
|
||||
return TRUE;
|
||||
|
||||
case LVN_ITEMCHANGED:
|
||||
OnItemChanged( (LPNMLISTVIEW)pnmh );
|
||||
return TRUE;
|
||||
|
||||
case NM_DBLCLK:
|
||||
// send out an ok click to play
|
||||
::SendDlgItemMessage( *this, IDC_PLAY, BM_CLICK, 0, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// not handled
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static void ScreenToClient( HWND hwnd, LPRECT lpRect )
|
||||
{
|
||||
::ScreenToClient(hwnd, (LPPOINT)lpRect);
|
||||
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static void FillSolidRect( HDC hdc, LPCRECT lpRect, COLORREF clr )
|
||||
{
|
||||
COLORREF crOld = ::SetBkColor(hdc, clr);
|
||||
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
|
||||
::SetBkColor(hdc, crOld);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnEraseBkgnd( HDC hdc )
|
||||
{
|
||||
// don't do this in 256 color
|
||||
|
||||
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
|
||||
return FALSE;
|
||||
|
||||
RECT rcWindow;
|
||||
::GetWindowRect( *this, &rcWindow );
|
||||
::ScreenToClient( *this, &rcWindow );
|
||||
|
||||
FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) );
|
||||
|
||||
RECT rc;
|
||||
::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP, rcWindow.right, BKGND_BITMAP_BOTTOM );
|
||||
|
||||
long lWidth = rc.right - rc.left;
|
||||
long lHeight = rc.bottom - rc.top;
|
||||
|
||||
HDC hdcMem = CreateCompatibleDC(hdc);
|
||||
|
||||
HBITMAP hbmpTile = LoadBitmap( m_hInstance, MAKEINTRESOURCE(IDB_TILE) );
|
||||
|
||||
BITMAP bm;
|
||||
GetObject(hbmpTile, sizeof(bm), &bm);
|
||||
|
||||
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpTile);
|
||||
|
||||
for (long x = 0; x < lWidth; x += bm.bmWidth)
|
||||
{
|
||||
for (long y = 0; y < lHeight; y += bm.bmHeight)
|
||||
{
|
||||
::BitBlt( hdc,
|
||||
rc.left + x, rc.top + y,
|
||||
( (rc.left + x + bm.bmWidth) > rc.right ) ? rc.right-(rc.left+x) : bm.bmWidth,
|
||||
( (rc.top + y + bm.bmHeight) > rc.bottom ) ? rc.bottom-(rc.top+y) : bm.bmHeight,
|
||||
hdcMem,
|
||||
0, 0, SRCCOPY );
|
||||
}
|
||||
}
|
||||
|
||||
SelectObject(hdcMem, hbmpOld);
|
||||
DeleteObject(hbmpTile);
|
||||
DeleteDC(hdcMem);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
HBRUSH CMainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
|
||||
{
|
||||
// don't do this in 256 color
|
||||
|
||||
if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE)
|
||||
return FALSE;
|
||||
|
||||
if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON)
|
||||
return NULL;
|
||||
|
||||
SetBkMode(hdcStatic, TRANSPARENT);
|
||||
|
||||
return (HBRUSH)GetStockObject(NULL_BRUSH);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DWORD CMainDlg::PopulateRomList( void )
|
||||
{
|
||||
TRACE("CMainDlg::PopulateRomList");
|
||||
|
||||
DWORD dwRet;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DWORD dwStartTick = ::GetTickCount();
|
||||
#endif
|
||||
|
||||
ClearList();
|
||||
|
||||
// REVIEW: Support .zip files?
|
||||
|
||||
TCHAR pszPath[ MAX_PATH ];
|
||||
|
||||
lstrcpy( pszPath, myGlobalData.settings().getString("romdir").c_str() );
|
||||
lstrcat( pszPath, _T("\\*.bin") );
|
||||
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile( pszPath, &ffd );
|
||||
|
||||
ListView_SetItemCount( m_hwndList, 100 );
|
||||
|
||||
int iItem = 0;
|
||||
|
||||
BOOL fDone = (hFind == INVALID_HANDLE_VALUE);
|
||||
while (!fDone)
|
||||
{
|
||||
//
|
||||
// File metadata will be read in ReadRomData()
|
||||
//
|
||||
|
||||
CListData* pListData = new CListData;
|
||||
if( pListData == NULL )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
dwRet = pListData->Initialize();
|
||||
if ( dwRet != ERROR_SUCCESS )
|
||||
{
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
if ( ! pListData->m_strFileName.Set( ffd.cFileName ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LV_ITEM lvi;
|
||||
|
||||
lvi.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
lvi.iItem = iItem++;
|
||||
lvi.iSubItem = 0;
|
||||
lvi.pszText = LPSTR_TEXTCALLBACK;
|
||||
lvi.lParam = (LPARAM)pListData;
|
||||
int nItem = ListView_InsertItem( m_hwndList, &lvi );
|
||||
|
||||
ASSERT( nItem != -1 );
|
||||
|
||||
ListView_SetItemText( m_hwndList, nItem,
|
||||
CListData::FILENAME_COLUMN, LPSTR_TEXTCALLBACK );
|
||||
ListView_SetItemText(m_hwndList, nItem,
|
||||
CListData::MANUFACTURER_COLUMN, LPSTR_TEXTCALLBACK);
|
||||
ListView_SetItemText( m_hwndList, nItem,
|
||||
CListData::RARITY_COLUMN, LPSTR_TEXTCALLBACK );
|
||||
|
||||
// go to the next rom file
|
||||
|
||||
fDone = !FindNextFile(hFind, &ffd);
|
||||
}
|
||||
|
||||
if ( hFind != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
VERIFY( ::FindClose( hFind ) );
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
TRACE("\tElapsed ticks for PopulateRomList = %ld", ::GetTickCount()-dwStartTick);
|
||||
#endif
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
DWORD CMainDlg::ReadRomData(
|
||||
CListData* pListData
|
||||
) const
|
||||
{
|
||||
// Add stella binary output for stella.pro info
|
||||
// There should be no parsing of stella.pro in this application
|
||||
// FIXME
|
||||
/*
|
||||
|
||||
// TODO: Move this method to ListData class (?)
|
||||
|
||||
if ( pListData == NULL )
|
||||
{
|
||||
ASSERT( FALSE );
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
// attempt to read the rom file
|
||||
|
||||
TCHAR pszPath[MAX_PATH + 1];
|
||||
|
||||
lstrcpy( pszPath, myGlobalData.RomDir() );
|
||||
lstrcat( pszPath, _T("\\") );
|
||||
lstrcat( pszPath, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
HANDLE hFile;
|
||||
|
||||
hFile = CreateFile( pszPath,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL );
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
DWORD dwFileSize = ::GetFileSize( hFile, NULL );
|
||||
|
||||
BYTE* pImage = new BYTE[dwFileSize];
|
||||
if ( pImage == NULL )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
DWORD dwRead;
|
||||
|
||||
if ( ::ReadFile( hFile, pImage, dwFileSize, &dwRead, NULL ) )
|
||||
{
|
||||
// Read the file, now check the md5
|
||||
|
||||
std::string md5 = MD5( pImage, dwFileSize );
|
||||
|
||||
// search through the properties set for this MD5
|
||||
|
||||
PropertiesSet& propertiesSet = m_stella.GetPropertiesSet();
|
||||
|
||||
uInt32 setSize = propertiesSet.size();
|
||||
|
||||
for (uInt32 i = 0; i < setSize; ++i)
|
||||
{
|
||||
if (propertiesSet.get(i).get("Cartridge.MD5") == md5)
|
||||
{
|
||||
// got it!
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != setSize)
|
||||
{
|
||||
const Properties& properties = propertiesSet.get(i);
|
||||
|
||||
if ( ! pListData->m_strManufacturer.Set(
|
||||
properties.get("Cartridge.Manufacturer").c_str() ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if ( ! pListData->m_strName.Set(
|
||||
properties.get("Cartridge.Name").c_str() ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if (! pListData->m_strRarity.Set(
|
||||
properties.get("Cartridge.Rarity").c_str() ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if ( ! pListData->m_strNote.Set(
|
||||
properties.get("Cartridge.Note").c_str() ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Any output here should be appended to the emucore\stella.pro file
|
||||
//
|
||||
|
||||
TRACE( "\"Cartridge.MD5\" \"%s\"\n\"Cartridge.Name\" \"%s\"\n\"\"\n",
|
||||
md5.c_str(),
|
||||
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
}
|
||||
}
|
||||
|
||||
delete[] pImage;
|
||||
|
||||
VERIFY( ::CloseHandle( hFile ) );
|
||||
|
||||
pListData->m_fPopulated = TRUE;
|
||||
*/
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
void CMainDlg::OnColumnClick(
|
||||
LPNMLISTVIEW pnmv
|
||||
)
|
||||
{
|
||||
HCURSOR hcur = ::SetCursor(::LoadCursor(NULL, IDC_WAIT));
|
||||
|
||||
m_header.SetSortCol(pnmv->iSubItem, TRUE);
|
||||
ListView_SortItems(pnmv->hdr.hwndFrom, ListViewCompareFunc, (LPARAM)this);
|
||||
|
||||
// ensure the selected item is visible
|
||||
|
||||
int nItem = ListView_GetNextItem( m_hwndList, -1, LVNI_SELECTED );
|
||||
if (nItem != -1)
|
||||
{
|
||||
ListView_EnsureVisible( m_hwndList, nItem, TRUE );
|
||||
}
|
||||
|
||||
::SetCursor(hcur);
|
||||
}
|
||||
|
||||
void CMainDlg::OnItemChanged(
|
||||
LPNMLISTVIEW pnmv
|
||||
)
|
||||
{
|
||||
HWND hwnd = *this;
|
||||
|
||||
HWND hwndNote = ::GetDlgItem( hwnd, IDC_ROMNOTE );
|
||||
|
||||
RECT rc;
|
||||
::GetWindowRect(hwndNote, &rc);
|
||||
::ScreenToClient( hwnd, (LPPOINT)&rc );
|
||||
::ScreenToClient( hwnd, ((LPPOINT)&rc)+1 );
|
||||
|
||||
int iItem = ListView_GetNextItem(pnmv->hdr.hwndFrom, -1, LVNI_SELECTED);
|
||||
if (iItem == -1)
|
||||
{
|
||||
::SetWindowText( hwndNote, _T("") );
|
||||
::EnableWindow( ::GetDlgItem( hwnd, IDC_PLAY ), FALSE );
|
||||
::InvalidateRect( hwnd, &rc, TRUE );
|
||||
return;
|
||||
}
|
||||
|
||||
CListData* pListData = (CListData*)ListView_GetItemData(
|
||||
pnmv->hdr.hwndFrom,
|
||||
pnmv->iItem );
|
||||
|
||||
::SetWindowText( hwndNote, pListData->GetNote() );
|
||||
::InvalidateRect( hwnd, &rc, TRUE );
|
||||
::EnableWindow( ::GetDlgItem( hwnd, IDC_PLAY ), TRUE );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// LPSTR_TEXTCALLBACK message handlers
|
||||
|
||||
void CMainDlg::OnGetDispInfo(
|
||||
NMLVDISPINFO* pnmv
|
||||
)
|
||||
{
|
||||
// Provide the item or subitem's text, if requested.
|
||||
|
||||
if ( ! (pnmv->item.mask & LVIF_TEXT ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CListData* pListData = (CListData*)ListView_GetItemData(
|
||||
pnmv->hdr.hwndFrom,
|
||||
pnmv->item.iItem );
|
||||
ASSERT( pListData );
|
||||
if ( pListData == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! pListData->IsPopulated() )
|
||||
{
|
||||
ReadRomData( pListData );
|
||||
}
|
||||
|
||||
pnmv->item.pszText = const_cast<LPTSTR>( pListData->GetTextForColumn(pnmv->item.iSubItem) );
|
||||
// ASSERT( pnmv->item.pszText );
|
||||
}
|
||||
|
||||
int CALLBACK CMainDlg::ListViewCompareFunc(
|
||||
LPARAM lParam1,
|
||||
LPARAM lParam2,
|
||||
LPARAM lParamSort
|
||||
)
|
||||
{
|
||||
CMainDlg* pThis = reinterpret_cast<CMainDlg*>( lParamSort );
|
||||
|
||||
//
|
||||
// I assume that the metadata for column 0 is always available,
|
||||
// while other column metadata requires a call to ReadRomData
|
||||
//
|
||||
|
||||
int nSortCol = pThis->m_header.GetSortCol();
|
||||
|
||||
CListData* pItem1 = reinterpret_cast<CListData*>( lParam1 );
|
||||
if ( ! pItem1->IsPopulated() && nSortCol != 0 )
|
||||
{
|
||||
pThis->ReadRomData( pItem1 );
|
||||
}
|
||||
|
||||
CListData* pItem2 = reinterpret_cast<CListData*>( lParam2 );
|
||||
if ( ! pItem2->IsPopulated() && nSortCol != 0 )
|
||||
{
|
||||
pThis->ReadRomData( pItem2 );
|
||||
}
|
||||
|
||||
LPCTSTR pszItem1 = pItem1->GetTextForColumn( nSortCol );
|
||||
LPCTSTR pszItem2 = pItem2->GetTextForColumn( nSortCol );
|
||||
|
||||
//
|
||||
// put blank items last
|
||||
//
|
||||
|
||||
if ( pszItem1 == NULL || pszItem1[0] == _T('\0') )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( pszItem2 == NULL || pszItem2[0] == _T('\0') )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// Compare the specified column.
|
||||
//
|
||||
|
||||
return lstrcmpi( pszItem1, pszItem2 );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Cool caption message handlers
|
||||
|
||||
void CMainDlg::OnDestroy(
|
||||
void
|
||||
)
|
||||
{
|
||||
m_CoolCaption.OnDestroy();
|
||||
|
||||
if ( m_hfontRomNote )
|
||||
{
|
||||
::DeleteObject( m_hfontRomNote );
|
||||
m_hfontRomNote = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainDlg::OnNcPaint(
|
||||
HRGN hrgn
|
||||
)
|
||||
{
|
||||
m_CoolCaption.OnNcPaint( hrgn );
|
||||
}
|
||||
|
||||
void CMainDlg::OnNcActivate(
|
||||
BOOL fActive
|
||||
)
|
||||
{
|
||||
m_CoolCaption.OnNcActivate( fActive );
|
||||
}
|
||||
|
||||
BOOL CMainDlg::OnNcLButtonDown(
|
||||
INT nHitTest,
|
||||
POINTS pts
|
||||
)
|
||||
{
|
||||
return m_CoolCaption.OnNCLButtonDown( nHitTest, pts );
|
||||
}
|
|
@ -0,0 +1,259 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/10/2000
|
||||
//
|
||||
#ifndef MAINDLG_H
|
||||
#define MAINDLG_H
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
class CGlobalData;
|
||||
|
||||
#include "StellaXMain.hxx"
|
||||
#include "CoolCaption.hxx"
|
||||
#include "TextButton3d.hxx"
|
||||
#include "HeaderCtrl.hxx"
|
||||
#include "RoundButton.hxx"
|
||||
|
||||
class CMainDlg;
|
||||
|
||||
class CListData
|
||||
{
|
||||
friend CMainDlg;
|
||||
|
||||
public:
|
||||
|
||||
CListData() :
|
||||
m_fPopulated( FALSE )
|
||||
{
|
||||
}
|
||||
|
||||
DWORD Initialize()
|
||||
{
|
||||
//
|
||||
// ListView control doesn't like NULLs returned, so initialize all
|
||||
//
|
||||
|
||||
if ( ! m_strName.Set( _T("") ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if ( ! m_strManufacturer.Set( _T("") ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if ( ! m_strRarity.Set( _T("") ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if ( ! m_strFileName.Set( _T("") ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if ( ! m_strNote.Set( _T("") ) )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// MetaData
|
||||
//
|
||||
|
||||
static int GetColumnCount( void )
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
enum ColumnIndex
|
||||
{
|
||||
FILENAME_COLUMN,
|
||||
NAME_COLUMN,
|
||||
MANUFACTURER_COLUMN,
|
||||
RARITY_COLUMN,
|
||||
};
|
||||
|
||||
static UINT GetColumnNameIdForColumn( int nCol )
|
||||
{
|
||||
UINT uID = 0;
|
||||
|
||||
switch ( nCol )
|
||||
{
|
||||
case NAME_COLUMN:
|
||||
uID = IDS_NAME;
|
||||
break;
|
||||
|
||||
case MANUFACTURER_COLUMN:
|
||||
uID = IDS_MANUFACTURER;
|
||||
break;
|
||||
|
||||
case RARITY_COLUMN:
|
||||
uID = IDS_RARITY;
|
||||
break;
|
||||
|
||||
case FILENAME_COLUMN:
|
||||
uID = IDS_FILENAME;
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
return uID;
|
||||
}
|
||||
|
||||
LPCTSTR GetTextForColumn( int nCol ) const
|
||||
{
|
||||
LPCTSTR pszText = NULL;
|
||||
|
||||
switch (nCol)
|
||||
{
|
||||
case NAME_COLUMN:
|
||||
pszText = m_strName.Get();
|
||||
break;
|
||||
|
||||
case MANUFACTURER_COLUMN:
|
||||
pszText = m_strManufacturer.Get();
|
||||
break;
|
||||
|
||||
case RARITY_COLUMN:
|
||||
pszText = m_strRarity.Get();
|
||||
break;
|
||||
|
||||
case FILENAME_COLUMN:
|
||||
pszText = m_strFileName.Get();
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT( FALSE );
|
||||
break;
|
||||
}
|
||||
|
||||
return pszText;
|
||||
}
|
||||
|
||||
LPCTSTR GetNote( void ) const
|
||||
{
|
||||
return m_strNote.Get();
|
||||
}
|
||||
|
||||
BOOL IsPopulated( void ) const
|
||||
{
|
||||
return m_fPopulated;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
CSimpleString m_strName;
|
||||
CSimpleString m_strManufacturer;
|
||||
CSimpleString m_strRarity;
|
||||
CSimpleString m_strFileName;
|
||||
CSimpleString m_strNote;
|
||||
BOOL m_fPopulated;
|
||||
|
||||
private:
|
||||
|
||||
CListData( const CListData& ); // no implementation
|
||||
void operator=( const CListData& ); // no implementation
|
||||
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class CMainDlg
|
||||
{
|
||||
public:
|
||||
|
||||
enum { IDD = IDD_MAIN };
|
||||
|
||||
CMainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance );
|
||||
|
||||
virtual int DoModal( HWND hwndParent );
|
||||
|
||||
operator HWND( void ) const
|
||||
{
|
||||
return m_hwnd;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
HWND m_hwnd;
|
||||
|
||||
CCoolCaption m_CoolCaption;
|
||||
CTextButton3d m_btn3d;
|
||||
CHeaderCtrl m_header;
|
||||
CRoundButton m_btnPlay;
|
||||
CRoundButton m_btnHelp;
|
||||
CRoundButton m_btnConfig;
|
||||
CRoundButton m_btnExit;
|
||||
|
||||
//
|
||||
// Message handlers
|
||||
//
|
||||
|
||||
BOOL OnInitDialog( void );
|
||||
BOOL OnCommand( int id, HWND hwndCtl, UINT codeNotify );
|
||||
BOOL OnNotify( int idCtrl, LPNMHDR pnmh );
|
||||
BOOL OnEraseBkgnd( HDC hdc );
|
||||
HBRUSH OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic );
|
||||
|
||||
//
|
||||
// wm_notify handlers
|
||||
//
|
||||
|
||||
void OnGetDispInfo( NMLVDISPINFO* pnmh );
|
||||
|
||||
void OnColumnClick( LPNMLISTVIEW pnmv );
|
||||
void OnItemChanged( LPNMLISTVIEW pnmv );
|
||||
|
||||
//
|
||||
// cool caption handlers
|
||||
//
|
||||
|
||||
void OnDestroy( void );
|
||||
void OnNcPaint( HRGN hrgn );
|
||||
void OnNcActivate( BOOL fActive );
|
||||
BOOL OnNcLButtonDown( INT nHitTest, POINTS pts );
|
||||
|
||||
//
|
||||
// callback methods
|
||||
//
|
||||
|
||||
BOOL CALLBACK DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
static BOOL CALLBACK StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
|
||||
|
||||
// internal data
|
||||
|
||||
DWORD PopulateRomList();
|
||||
DWORD ReadRomData( CListData* ) const;
|
||||
|
||||
HINSTANCE m_hInstance;
|
||||
|
||||
// stuff in list
|
||||
|
||||
HWND m_hwndList;
|
||||
void ClearList();
|
||||
|
||||
HFONT m_hfontRomNote;
|
||||
|
||||
// Stella stuff
|
||||
|
||||
CGlobalData& myGlobalData;
|
||||
CStellaXMain m_stella;
|
||||
|
||||
CMainDlg( const CMainDlg& ); // no implementation
|
||||
void operator=( const CMainDlg& ); // no implementation
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,260 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/02/2000
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include "PropertySheet.hxx"
|
||||
|
||||
#pragma comment(lib, "comctl32")
|
||||
|
||||
#include <pshpack1.h>
|
||||
typedef struct DLGTEMPLATEEX
|
||||
{
|
||||
WORD dlgVer;
|
||||
WORD signature;
|
||||
DWORD helpID;
|
||||
DWORD exStyle;
|
||||
DWORD style;
|
||||
WORD cDlgItems;
|
||||
short x;
|
||||
short y;
|
||||
short cx;
|
||||
short cy;
|
||||
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
|
||||
#include <poppack.h>
|
||||
|
||||
CPropertyPage::CPropertyPage(
|
||||
UINT nIDTemplate,
|
||||
UINT nIDCaption /* = 0 */
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( nIDCaption );
|
||||
|
||||
ZeroMemory(&m_psp, sizeof(m_psp));
|
||||
m_psp.dwSize = sizeof(m_psp);
|
||||
m_psp.dwFlags = PSP_USECALLBACK;
|
||||
// m_psp.hInstance = hInstance;
|
||||
m_psp.pszTemplate = MAKEINTRESOURCE(nIDTemplate);
|
||||
m_psp.pfnDlgProc = StaticDlgProc;
|
||||
m_psp.lParam = (LPARAM)this;
|
||||
m_psp.pfnCallback = StaticCallback;
|
||||
}
|
||||
|
||||
UINT CALLBACK CPropertyPage::StaticCallback(
|
||||
HWND hwnd,
|
||||
UINT uMsg,
|
||||
LPPROPSHEETPAGE ppsp
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( hwnd );
|
||||
UNUSED_ALWAYS( ppsp );
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case PSPCB_CREATE:
|
||||
// ppsp->lParam holds create lParam
|
||||
return TRUE;
|
||||
|
||||
case PSPCB_RELEASE:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CALLBACK CPropertyPage::StaticDlgProc(
|
||||
HWND hwnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
CPropertyPage* pPage = NULL;
|
||||
|
||||
switch ( uMsg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
pPage = reinterpret_cast<CPropertyPage*>(
|
||||
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
|
||||
(void)::SetWindowLong( hwnd,
|
||||
DWL_USER,
|
||||
reinterpret_cast<LONG>( pPage ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
pPage = reinterpret_cast<CPropertyPage*>(
|
||||
::GetWindowLong( hwnd, DWL_USER ) );
|
||||
if ( pPage == NULL )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
|
||||
}
|
||||
|
||||
BOOL CALLBACK CPropertyPage::DlgProc(
|
||||
HWND hwnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_ACTIVATE:
|
||||
OnActivate( (UINT)LOWORD(wParam), (HWND)lParam, (BOOL)HIWORD(wParam) );
|
||||
return TRUE;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
return OnInitDialog( hwnd );
|
||||
|
||||
case WM_DESTROY:
|
||||
OnDestroy( );
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
return OnCommand( HIWORD(wParam), LOWORD(wParam), (HWND)lParam );
|
||||
|
||||
case WM_NOTIFY:
|
||||
// Handle PSN_QUERYCANCEL?
|
||||
// Handle PSN_KILLACTIVE?
|
||||
|
||||
switch (((LPNMHDR)lParam)->code)
|
||||
{
|
||||
case PSN_SETACTIVE:
|
||||
::SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
|
||||
return TRUE;
|
||||
|
||||
case PSN_KILLACTIVE:
|
||||
::SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
|
||||
return TRUE;
|
||||
|
||||
case PSN_APPLY:
|
||||
::SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
|
||||
return TRUE;
|
||||
|
||||
case PSN_RESET:
|
||||
OnReset( (LPPSHNOTIFY)lParam );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return OnNotify( (int)wParam, (LPNMHDR)lParam );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// CPropertySheet
|
||||
//
|
||||
|
||||
CPropertySheet::CPropertySheet
|
||||
(
|
||||
LPCTSTR pszCaption,
|
||||
HWND hwndParent,
|
||||
UINT nStartPage /* = 0 */
|
||||
) :\
|
||||
m_strCaption( pszCaption )
|
||||
{
|
||||
ZeroMemory(&m_psh, sizeof(m_psh));
|
||||
m_psh.dwSize = sizeof(m_psh);
|
||||
m_psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
|
||||
m_psh.hwndParent = hwndParent;
|
||||
m_psh.hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE);
|
||||
m_psh.pszCaption = m_strCaption.c_str();
|
||||
m_psh.nStartPage = nStartPage;
|
||||
m_psh.pfnCallback = StaticCallback;
|
||||
}
|
||||
|
||||
CPropertySheet::~CPropertySheet(
|
||||
)
|
||||
{
|
||||
// BUGBUG: This is static!
|
||||
|
||||
/*
|
||||
if ( m_hfontLogo )
|
||||
{
|
||||
::DeleteObject( m_hfontLogo );
|
||||
m_hfontLogo = NULL;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void CPropertySheet::AddPage(
|
||||
CPropertyPage* pPage
|
||||
)
|
||||
{
|
||||
if (pPage)
|
||||
{
|
||||
m_pages.push_back(pPage);
|
||||
}
|
||||
}
|
||||
|
||||
int CPropertySheet::DoModal(
|
||||
void
|
||||
)
|
||||
{
|
||||
int nSize = m_pages.size();
|
||||
|
||||
if (nSize == 0)
|
||||
return IDCANCEL;
|
||||
|
||||
PROPSHEETPAGE* pspage = new PROPSHEETPAGE[nSize];
|
||||
for (int i = 0; i < nSize; ++i)
|
||||
{
|
||||
CopyMemory(&(pspage[i]), m_pages[i]->GetPropSheetPage(),
|
||||
sizeof(PROPSHEETPAGE));
|
||||
pspage[i].hInstance = m_psh.hInstance;
|
||||
}
|
||||
|
||||
m_psh.nPages = nSize;
|
||||
m_psh.ppsp = pspage;
|
||||
|
||||
int nRet = ::PropertySheet( &m_psh );
|
||||
|
||||
delete[] pspage;
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
int CALLBACK CPropertySheet::StaticCallback(
|
||||
HWND hwnd,
|
||||
UINT uMsg,
|
||||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( hwnd );
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case PSCB_INITIALIZED:
|
||||
// Property sheet is being initialized
|
||||
|
||||
return TRUE;
|
||||
|
||||
case PSCB_PRECREATE:
|
||||
// Property sheet is about to be created
|
||||
|
||||
|
||||
//
|
||||
// Remove the DS_CONTEXTHELP style from the dialog template
|
||||
// (This will remove the "?" in the top right corner)
|
||||
//
|
||||
|
||||
if ( ( (LPDLGTEMPLATEEX)lParam )->signature == 0xFFFF)
|
||||
{
|
||||
( (LPDLGTEMPLATEEX)lParam )->style &= ~DS_CONTEXTHELP;
|
||||
}
|
||||
else
|
||||
{
|
||||
( (LPDLGTEMPLATE)lParam )->style &= ~DS_CONTEXTHELP;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/02/2000
|
||||
//
|
||||
#ifndef PROPSHT_H
|
||||
#define PROPSHT_H
|
||||
#pragma once
|
||||
|
||||
#include <prsht.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class CPropertyPage
|
||||
{
|
||||
public:
|
||||
|
||||
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
|
||||
|
||||
const PROPSHEETPAGE* GetPropSheetPage();
|
||||
|
||||
protected:
|
||||
|
||||
//
|
||||
// Overridable callbacks
|
||||
//
|
||||
|
||||
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized )
|
||||
{
|
||||
}
|
||||
|
||||
virtual BOOL OnInitDialog( HWND /* hwnd */ )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual void OnDestroy( void )
|
||||
{
|
||||
}
|
||||
|
||||
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ )
|
||||
{
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
virtual void OnReset( LPPSHNOTIFY /* lppsn */ )
|
||||
{
|
||||
}
|
||||
|
||||
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static UINT CALLBACK StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
|
||||
|
||||
static BOOL CALLBACK StaticDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
BOOL CALLBACK DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
PROPSHEETPAGE m_psp;
|
||||
|
||||
CPropertyPage( const CPropertyPage& ); // no implementation
|
||||
void operator=( const CPropertyPage& ); // no implementation
|
||||
};
|
||||
|
||||
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage(
|
||||
void
|
||||
)
|
||||
{
|
||||
return &m_psp;
|
||||
}
|
||||
|
||||
class CPropertySheet
|
||||
{
|
||||
public:
|
||||
|
||||
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 );
|
||||
~CPropertySheet( );
|
||||
|
||||
void AddPage( CPropertyPage* pPage );
|
||||
virtual int DoModal( void );
|
||||
|
||||
private:
|
||||
|
||||
static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam );
|
||||
|
||||
PROPSHEETHEADER m_psh;
|
||||
std::vector<CPropertyPage*> m_pages;
|
||||
std::string m_strCaption;
|
||||
|
||||
CPropertySheet( const CPropertySheet& ); // no implementation
|
||||
void operator=( const CPropertySheet& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,625 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include "RoundButton.hxx"
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
// prototypes
|
||||
COLORREF GetColour(double dAngle, COLORREF crBright, COLORREF crDark);
|
||||
|
||||
void DrawCircle( HDC hdc, const POINT& p, LONG lRadius,
|
||||
COLORREF crColour, BOOL bDashed = FALSE);
|
||||
|
||||
void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius,
|
||||
COLORREF crBright, COLORREF crDark);
|
||||
|
||||
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
|
||||
COLORREF crBright, COLORREF crDark);
|
||||
|
||||
|
||||
// Calculate colour for a point at the given angle by performing a linear
|
||||
// interpolation between the colours crBright and crDark based on the cosine
|
||||
// of the angle between the light source and the point.
|
||||
//
|
||||
// Angles are measured from the +ve x-axis (i.e. (1,0) = 0 degrees, (0,1) = 90 degrees )
|
||||
// But remember: +y points down!
|
||||
|
||||
COLORREF GetColour(
|
||||
double dAngle,
|
||||
COLORREF crBright,
|
||||
COLORREF crDark
|
||||
)
|
||||
{
|
||||
#define Rad2Deg 180.0/3.1415
|
||||
|
||||
// For better light-continuity along the edge of a stretched button:
|
||||
// LIGHT_SOURCE_ANGLE == -1.88
|
||||
|
||||
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
|
||||
#define LIGHT_SOURCE_ANGLE -1.88
|
||||
|
||||
ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
|
||||
double dAngleDifference = LIGHT_SOURCE_ANGLE - dAngle;
|
||||
|
||||
if (dAngleDifference < -3.1415) dAngleDifference = 6.293 + dAngleDifference;
|
||||
else if (dAngleDifference > 3.1415) dAngleDifference = 6.293 - dAngleDifference;
|
||||
|
||||
double Weight = 0.5*(cos(dAngleDifference)+1.0);
|
||||
|
||||
BYTE Red = (BYTE) (Weight*GetRValue(crBright) + (1.0-Weight)*GetRValue(crDark));
|
||||
BYTE Green = (BYTE) (Weight*GetGValue(crBright) + (1.0-Weight)*GetGValue(crDark));
|
||||
BYTE Blue = (BYTE) (Weight*GetBValue(crBright) + (1.0-Weight)*GetBValue(crDark));
|
||||
|
||||
//TRACE("LightAngle = %0.0f, Angle = %3.0f, Diff = %3.0f, Weight = %0.2f, RGB %3d,%3d,%3d\n",
|
||||
// LIGHT_SOURCE_ANGLE*Rad2Deg, dAngle*Rad2Deg, dAngleDifference*Rad2Deg, Weight,Red,Green,Blue);
|
||||
|
||||
return RGB(Red, Green, Blue);
|
||||
}
|
||||
|
||||
void DrawCircle(
|
||||
HDC hdc,
|
||||
const POINT& p,
|
||||
LONG lRadius,
|
||||
COLORREF crColour,
|
||||
BOOL bDashed
|
||||
)
|
||||
{
|
||||
const int nDashLength = 1;
|
||||
LONG lError, lXoffset, lYoffset;
|
||||
int nDash = 0;
|
||||
BOOL bDashOn = TRUE;
|
||||
|
||||
//Check to see that the coordinates are valid
|
||||
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
||||
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
||||
|
||||
//Set starting values
|
||||
lXoffset = lRadius;
|
||||
lYoffset = 0;
|
||||
lError = -lRadius;
|
||||
|
||||
do
|
||||
{
|
||||
if (bDashOn)
|
||||
{
|
||||
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
|
||||
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
|
||||
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
|
||||
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
|
||||
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
|
||||
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
|
||||
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
|
||||
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
|
||||
}
|
||||
|
||||
//Advance the error term and the constant X axis step
|
||||
lError += lYoffset++;
|
||||
|
||||
//Check to see if error term has overflowed
|
||||
if ((lError += lYoffset) >= 0)
|
||||
lError -= --lXoffset * 2;
|
||||
|
||||
if (bDashed && (++nDash == nDashLength))
|
||||
{
|
||||
nDash = 0;
|
||||
bDashOn = !bDashOn;
|
||||
}
|
||||
|
||||
} while (lYoffset <= lXoffset); //Continue until halfway point
|
||||
}
|
||||
|
||||
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
|
||||
// to make stretched buttons
|
||||
|
||||
void DrawCircleRight(
|
||||
HDC hdc,
|
||||
const POINT& p,
|
||||
LONG lRadius,
|
||||
COLORREF crBright,
|
||||
COLORREF crDark
|
||||
)
|
||||
{
|
||||
LONG lError, lXoffset, lYoffset;
|
||||
|
||||
//Check to see that the coordinates are valid
|
||||
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
||||
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
||||
|
||||
//Set starting values
|
||||
lXoffset = lRadius;
|
||||
lYoffset = 0;
|
||||
lError = -lRadius;
|
||||
|
||||
do
|
||||
{
|
||||
const double Pi = 3.141592654,
|
||||
Pi_on_2 = Pi * 0.5;
|
||||
COLORREF crColour;
|
||||
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
|
||||
|
||||
//Draw the current pixel, reflected across all four arcs
|
||||
|
||||
crColour = GetColour(dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
|
||||
|
||||
crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
|
||||
|
||||
crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
|
||||
|
||||
crColour = GetColour(-dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
|
||||
|
||||
//Advance the error term and the constant X axis step
|
||||
lError += lYoffset++;
|
||||
|
||||
//Check to see if error term has overflowed
|
||||
if ((lError += lYoffset) >= 0)
|
||||
lError -= --lXoffset * 2;
|
||||
|
||||
} while (lYoffset <= lXoffset); //Continue until halfway point
|
||||
}
|
||||
|
||||
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
|
||||
// to make stretched buttons
|
||||
|
||||
void DrawCircleLeft(
|
||||
HDC hdc,
|
||||
const POINT& p,
|
||||
LONG lRadius,
|
||||
COLORREF crBright,
|
||||
COLORREF crDark
|
||||
)
|
||||
{
|
||||
LONG lError, lXoffset, lYoffset;
|
||||
|
||||
//Check to see that the coordinates are valid
|
||||
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
|
||||
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
|
||||
|
||||
//Set starting values
|
||||
lXoffset = lRadius;
|
||||
lYoffset = 0;
|
||||
lError = -lRadius;
|
||||
|
||||
do
|
||||
{
|
||||
const double Pi = 3.141592654,
|
||||
Pi_on_2 = Pi * 0.5;
|
||||
COLORREF crColour;
|
||||
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
|
||||
|
||||
//Draw the current pixel, reflected across all eight arcs
|
||||
|
||||
crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
|
||||
|
||||
crColour = GetColour(Pi - dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
|
||||
|
||||
crColour = GetColour(-Pi + dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
|
||||
|
||||
crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
|
||||
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
|
||||
|
||||
//Advance the error term and the constant X axis step
|
||||
lError += lYoffset++;
|
||||
|
||||
//Check to see if error term has overflowed
|
||||
if ((lError += lYoffset) >= 0)
|
||||
lError -= --lXoffset * 2;
|
||||
|
||||
} while (lYoffset <= lXoffset); //Continue until halfway point
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void ClientToScreen(
|
||||
HWND hwnd,
|
||||
LPRECT lpRect
|
||||
)
|
||||
{
|
||||
::ClientToScreen(hwnd, (LPPOINT)lpRect);
|
||||
::ClientToScreen(hwnd, ((LPPOINT)lpRect)+1);
|
||||
}
|
||||
|
||||
static void ScreenToClient(
|
||||
HWND hwnd,
|
||||
LPRECT lpRect
|
||||
)
|
||||
{
|
||||
::ScreenToClient(hwnd, (LPPOINT)lpRect);
|
||||
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
|
||||
}
|
||||
|
||||
static void FillSolidRect(
|
||||
HDC hdc,
|
||||
LPCRECT lpRect,
|
||||
COLORREF clr
|
||||
)
|
||||
{
|
||||
COLORREF crOld = ::SetBkColor(hdc, clr);
|
||||
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
|
||||
::SetBkColor(hdc, crOld);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CRoundButton::CRoundButton(
|
||||
) : \
|
||||
m_hrgn( NULL ),
|
||||
m_fDrawDashedFocusCircle( TRUE ),
|
||||
m_fStretch( FALSE )
|
||||
{
|
||||
}
|
||||
|
||||
CRoundButton::~CRoundButton(
|
||||
)
|
||||
{
|
||||
if ( m_hrgn )
|
||||
{
|
||||
::DeleteObject( m_hrgn );
|
||||
}
|
||||
}
|
||||
|
||||
void CRoundButton::PreSubclassWindow(
|
||||
HWND hwnd
|
||||
)
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect( hwnd, &rect );
|
||||
|
||||
m_fStretch = (rect.right-rect.left) > (rect.bottom-rect.top);
|
||||
|
||||
if ( ! m_fStretch )
|
||||
{
|
||||
rect.bottom = rect.right = min ( rect.bottom, rect.right );
|
||||
}
|
||||
|
||||
m_ptCenter.x = m_ptLeft.x = m_ptRight.x = ((rect.right-rect.left)/2);
|
||||
m_ptCenter.y = m_ptLeft.y = m_ptRight.y = ((rect.bottom-rect.top)/2);
|
||||
|
||||
m_nRadius = rect.bottom/2 - 1;
|
||||
|
||||
m_ptLeft.x = m_nRadius;
|
||||
m_ptRight.x = rect.right - m_nRadius - 1;
|
||||
|
||||
::SetWindowRgn( hwnd, NULL, FALSE );
|
||||
m_hrgn = ::CreateEllipticRgnIndirect( &rect );
|
||||
::SetWindowRgn( hwnd, m_hrgn, TRUE );
|
||||
|
||||
::ClientToScreen( hwnd, &rect );
|
||||
|
||||
HWND hwndParent = ::GetParent( hwnd );
|
||||
if ( hwndParent )
|
||||
{
|
||||
::ScreenToClient( hwndParent, &rect );
|
||||
}
|
||||
|
||||
if ( ! m_fStretch )
|
||||
{
|
||||
::MoveWindow( hwnd, rect.left, rect.top,
|
||||
rect.right-rect.left, rect.bottom-rect.top, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CRoundButton::WndProc(
|
||||
HWND hWnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
BOOL& rfHandled
|
||||
)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_DRAWITEM:
|
||||
rfHandled = TRUE;
|
||||
OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
|
||||
return TRUE;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
// don't do erasing
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CRoundButton::OnDrawItem(
|
||||
HWND hwnd,
|
||||
UINT idCtl,
|
||||
LPDRAWITEMSTRUCT lpdis
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( idCtl );
|
||||
|
||||
HDC hdc = lpdis->hDC;
|
||||
RECT& rect = lpdis->rcItem;
|
||||
UINT state = lpdis->itemState;
|
||||
UINT nStyle = GetWindowLong(hwnd, GWL_STYLE);
|
||||
int nRadius = m_nRadius;
|
||||
|
||||
int nSavedDC = ::SaveDC( hdc );
|
||||
|
||||
::SelectObject( hdc, ::GetStockObject( NULL_BRUSH ) );
|
||||
::FillSolidRect( hdc, &rect, ::GetSysColor(COLOR_BTNFACE) );
|
||||
|
||||
// Draw the focus circle around the button for non-stretched buttons
|
||||
|
||||
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
|
||||
{
|
||||
DrawCircle( hdc, m_ptCenter, nRadius--, RGB( 0, 0, 0) );
|
||||
}
|
||||
|
||||
// Draw the raised/sunken edges of the button (unless flat)
|
||||
|
||||
if ( nStyle & BS_FLAT )
|
||||
{
|
||||
if ( m_fStretch )
|
||||
{
|
||||
// for stretched buttons: draw left and right arcs and connect the with lines
|
||||
|
||||
HPEN hpenOld;
|
||||
|
||||
RECT rectLeftBound;
|
||||
::SetRect( &rectLeftBound, 0, 0, nRadius*2, nRadius*2 );
|
||||
|
||||
RECT rectRightBound;
|
||||
::SetRect( &rectRightBound, m_ptRight.x-nRadius, 0, m_ptRight.x+nRadius, nRadius*2 );
|
||||
|
||||
hpenOld = (HPEN)::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
|
||||
|
||||
::Arc( hdc,
|
||||
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
|
||||
m_ptLeft.x, 0,
|
||||
m_ptLeft.x, nRadius*2 );
|
||||
|
||||
::Arc( hdc,
|
||||
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
|
||||
m_ptRight.x, nRadius*2,
|
||||
m_ptRight.x, 0 );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, 0, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, 0 );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, nRadius*2-1, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, nRadius*2-1 );
|
||||
|
||||
nRadius--;
|
||||
|
||||
::InflateRect( &rectLeftBound, -1, -1 );
|
||||
::InflateRect( &rectRightBound, -1, -1 );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
|
||||
|
||||
::Arc( hdc,
|
||||
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
|
||||
m_ptLeft.x, 1,
|
||||
m_ptLeft.x, nRadius*2 );
|
||||
|
||||
::Arc( hdc,
|
||||
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
|
||||
m_ptRight.x, nRadius*2,
|
||||
m_ptRight.x, 0 );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, 1 );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, nRadius*2, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, nRadius*2 );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// for non-stretched buttons: draw two circles
|
||||
|
||||
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DDKSHADOW) );
|
||||
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state & ODS_SELECTED)
|
||||
{
|
||||
// draw the circular segments for stretched AND non-stretched buttons
|
||||
|
||||
DrawCircleLeft( hdc, m_ptLeft, nRadius,
|
||||
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
||||
DrawCircleRight( hdc, m_ptRight, nRadius,
|
||||
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
|
||||
DrawCircleLeft( hdc, m_ptLeft, nRadius-1,
|
||||
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
|
||||
DrawCircleRight( hdc, m_ptRight, nRadius-1,
|
||||
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
|
||||
|
||||
if ( m_fStretch )
|
||||
{
|
||||
// draw connecting lines for stretched buttons only
|
||||
|
||||
HPEN hpenOld;
|
||||
|
||||
hpenOld = (HPEN)::SelectObject( hdc,
|
||||
(HPEN)::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, 1 );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW) ) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, 2 );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DLIGHT ) ) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius-1, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius-1 );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw the circular segments for stretched AND non-stretched buttons
|
||||
|
||||
DrawCircleLeft( hdc, m_ptLeft, nRadius,
|
||||
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
|
||||
|
||||
DrawCircleRight( hdc, m_ptRight, nRadius,
|
||||
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
|
||||
|
||||
DrawCircleLeft( hdc, m_ptLeft, nRadius - 1,
|
||||
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
|
||||
|
||||
DrawCircleRight( hdc, m_ptRight, nRadius - 1,
|
||||
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
|
||||
|
||||
// draw connecting lines for stretch buttons
|
||||
|
||||
if ( m_fStretch )
|
||||
{
|
||||
HPEN hpenOld;
|
||||
|
||||
hpenOld = (HPEN)::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1,
|
||||
::GetPixel( hdc, m_ptLeft.x, 1 ) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
|
||||
::LineTo( hdc, m_ptRight.x , 1);
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1,
|
||||
::GetPixel( hdc, m_ptLeft.x, 2 ) ) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, 2 );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1,
|
||||
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius ) ) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc,
|
||||
::CreatePen( PS_SOLID, 1,
|
||||
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius-1 ) ) ) );
|
||||
|
||||
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius - 1, NULL );
|
||||
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius - 1 );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the text if there is any
|
||||
|
||||
TCHAR pszText[ 256 ];
|
||||
int cch = ::GetWindowText( hwnd, pszText, 255 );
|
||||
|
||||
if ( cch != 0 )
|
||||
{
|
||||
HRGN hrgn;
|
||||
|
||||
if ( m_fStretch )
|
||||
{
|
||||
hrgn = ::CreateRectRgn( m_ptLeft.x - nRadius / 2, m_ptCenter.y - nRadius,
|
||||
m_ptRight.x + nRadius / 2, m_ptCenter.y + nRadius );
|
||||
}
|
||||
else
|
||||
{
|
||||
hrgn = CreateEllipticRgn( m_ptCenter.x - nRadius, m_ptCenter.y - nRadius,
|
||||
m_ptCenter.x + nRadius, m_ptCenter.y + nRadius );
|
||||
}
|
||||
|
||||
::SelectClipRgn( hdc, hrgn );
|
||||
|
||||
SIZE size;
|
||||
::GetTextExtentPoint32( hdc, pszText, cch, &size );
|
||||
|
||||
POINT pt = { m_ptCenter.x - size.cx / 2, m_ptCenter.y - size.cy / 2 - 1 };
|
||||
POINT pt2 = { m_ptCenter.x + size.cx/2, m_ptCenter.y + size.cy/2 + 1 };
|
||||
|
||||
if ( state & ODS_SELECTED )
|
||||
{
|
||||
++( pt.x );
|
||||
++( pt.y );
|
||||
}
|
||||
|
||||
::SetBkMode( hdc, TRANSPARENT );
|
||||
|
||||
#if 0
|
||||
if ( state & ODS_DISABLED )
|
||||
{
|
||||
::DrawState( hdc, NULL, NULL, (LPARAM)pszText, (WPARAM)cch,
|
||||
pt.x, pt.y, size.cx, size.cy, DSS_DISABLED );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// give text a 3d-look
|
||||
|
||||
RECT pos;
|
||||
::SetRect( &pos, pt.x, pt.y, pt2.x, pt2.y );
|
||||
|
||||
COLORREF crOld = ::SetTextColor( hdc,
|
||||
( state & ODS_DISABLED ) ?
|
||||
::GetSysColor( COLOR_GRAYTEXT ) :
|
||||
::GetSysColor( COLOR_WINDOWTEXT ) );
|
||||
|
||||
if ( state & ODS_FOCUS )
|
||||
{
|
||||
LOGFONT lf;
|
||||
::GetObject( (HFONT)::SendMessage( hwnd, WM_GETFONT, 0, 0 ),
|
||||
sizeof(LOGFONT), &lf );
|
||||
|
||||
lf.lfWeight = FW_BOLD;
|
||||
|
||||
HFONT hfontOld = (HFONT)::SelectObject( hdc, ::CreateFontIndirect( &lf ) );
|
||||
|
||||
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
|
||||
|
||||
::DeleteObject( ::SelectObject( hdc, hfontOld) );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
|
||||
}
|
||||
|
||||
::SetTextColor( hdc, crOld );
|
||||
}
|
||||
|
||||
::SelectClipRgn( hdc, NULL );
|
||||
|
||||
DeleteObject( hrgn );
|
||||
}
|
||||
|
||||
#if 0
|
||||
// draw the focus circle on the inside
|
||||
|
||||
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
|
||||
{
|
||||
DrawCircle( hdc, m_ptCenter, nRadius-2, RGB(0, 0, 0), TRUE );
|
||||
}
|
||||
#endif
|
||||
|
||||
::RestoreDC( hdc, nSavedDC );
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#ifndef RNDBUT_H
|
||||
#define RNDBUT_H
|
||||
|
||||
#include "Wnd.hxx"
|
||||
|
||||
class CRoundButton : public CWnd
|
||||
{
|
||||
public:
|
||||
|
||||
CRoundButton();
|
||||
~CRoundButton();
|
||||
|
||||
protected:
|
||||
|
||||
LRESULT WndProc( HWND hwnd, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam, BOOL& fHandled );
|
||||
virtual void PreSubclassWindow(HWND hwnd);
|
||||
|
||||
private:
|
||||
|
||||
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
|
||||
|
||||
HRGN m_hrgn;
|
||||
POINT m_ptCenter;
|
||||
POINT m_ptLeft;
|
||||
POINT m_ptRight;
|
||||
int m_nRadius;
|
||||
BOOL m_fDrawDashedFocusCircle;
|
||||
BOOL m_fStretch;
|
||||
|
||||
CRoundButton( const CRoundButton& ); // no implementation
|
||||
void operator=( const CRoundButton& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,346 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "winresrc.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "resource.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""winresrc.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""resource.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,4,0,0
|
||||
PRODUCTVERSION 1,4,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x29L
|
||||
#else
|
||||
FILEFLAGS 0x28L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "This version of StellaX is released under the GPL."
|
||||
VALUE "CompanyName", "Stephen Anthony (stephena@users.sourceforge.net)"
|
||||
VALUE "FileDescription", "StellaX"
|
||||
VALUE "FileVersion", "1, 4, 0, 0"
|
||||
VALUE "InternalName", "StellaX"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2004 Jeff Miller, Copyright (C) 2004 Stephen Anthony"
|
||||
VALUE "LegalTrademarks", "n/a"
|
||||
VALUE "OriginalFilename", "StellaX.exe"
|
||||
VALUE "PrivateBuild", "n/a"
|
||||
VALUE "ProductName", "StellaX"
|
||||
VALUE "ProductVersion", "1, 4, 0, 0"
|
||||
VALUE "SpecialBuild", "n/a"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_MAIN DIALOGEX 0, 0, 409, 249
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
|
||||
WS_VISIBLE | WS_CAPTION
|
||||
CAPTION "StellaX"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP |
|
||||
WS_GROUP,7,45,44,8
|
||||
CONTROL "List1",IDC_ROMLIST,"SysListView32",LVS_REPORT |
|
||||
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
|
||||
WS_BORDER | WS_TABSTOP,7,57,395,143,WS_EX_STATICEDGE
|
||||
CONTROL "&Play",IDC_PLAY,"Button",BS_OWNERDRAW | WS_TABSTOP,7,
|
||||
226,200,16
|
||||
CONTROL "&Options",IDC_CONFIG,"Button",BS_OWNERDRAW | WS_TABSTOP,
|
||||
230,226,54,16
|
||||
CONTROL "&Help",IDC_ABOUT,"Button",BS_OWNERDRAW | WS_TABSTOP,289,
|
||||
226,54,16
|
||||
CONTROL "E&xit",IDC_EXIT,"Button",BS_OWNERDRAW | WS_TABSTOP,348,
|
||||
226,54,16
|
||||
CTEXT "Written by Jeff Miller (miller@zipcon.net)\nStella core by Bradford W. Mott (bwmott@acm.org)",
|
||||
IDC_STATIC,175,13,227,19,SS_NOPREFIX
|
||||
RTEXT "<status>",IDC_ROMCOUNT,322,45,80,8,SS_NOPREFIX
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,39,411,1
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,218,411,1
|
||||
CONTROL "StellaX v1.4",IDC_TITLE,"Button",BS_OWNERDRAW |
|
||||
BS_CENTER | BS_TOP | WS_DISABLED | WS_TABSTOP,7,7,145,22
|
||||
CONTROL "Static",IDC_ROMPATH,"Static",SS_LEFTNOWORDWRAP |
|
||||
SS_NOPREFIX | WS_GROUP,57,45,254,8
|
||||
CONTROL "",IDC_ROMNOTE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX |
|
||||
WS_GROUP,93,205,309,8
|
||||
LTEXT "Game notes (if available):",-1,7,205,98,8
|
||||
END
|
||||
|
||||
IDD_DOC_PAGE DIALOG 0, 0, 390, 196
|
||||
STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Documentation"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "To view the online documentation, you need to first install Adobe Acrobat Reader 4.0 software. Once you have done this, return to this page and you will be able to read the documentation.",
|
||||
IDC_INSTRUCTIONS,7,7,376,21,NOT WS_VISIBLE
|
||||
LTEXT "Click here to download the Adobe Acrobat Reader software",
|
||||
IDC_ADOBE,7,35,376,10,SS_NOTIFY | NOT WS_VISIBLE
|
||||
END
|
||||
|
||||
IDD_ABOUT_PAGE DIALOGEX 0, 0, 298, 136
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Information"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "You must own legal copies of all ROM images you are using. The Stella team can't tell you where to find ROM images so DON'T ASK. All requests will either be deleted or sent to the appropriate authorities. StellaX is GPL software.",
|
||||
-1,7,7,283,30,SS_NOPREFIX
|
||||
LTEXT "If you have a question or a problem, please try one of these contacts:",
|
||||
-1,7,44,283,8,SS_NOPREFIX
|
||||
LTEXT "Steve Anthony:",-1,7,58,53,8,SS_NOPREFIX
|
||||
LTEXT "sa666_666@hotmail.com",IDC_EMAIL_MAINTAINER,73,58,122,8,
|
||||
SS_NOPREFIX | SS_NOTIFY
|
||||
LTEXT "http://minbar.org",IDC_WEB_MAINTAINER,202,58,72,8,
|
||||
SS_NOPREFIX | SS_NOTIFY
|
||||
LTEXT "Stella dev team:",-1,7,70,52,8,SS_NOPREFIX
|
||||
LTEXT "stella-main@lists.sourceforge.net",IDC_EMAIL_STELLA,73,
|
||||
70,122,8,SS_NOPREFIX | SS_NOTIFY
|
||||
LTEXT "http://stella.sf.net",IDC_WEB_STELLA,202,70,68,8,
|
||||
SS_NOPREFIX | SS_NOTIFY
|
||||
LTEXT "God, Suzi and Noah",-1,60,94,69,8,SS_NOPREFIX
|
||||
LTEXT "Bradford Mott, Mike Balfour and Roger Onslow.",-1,60,
|
||||
107,204,8,SS_NOPREFIX
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,86,283,1
|
||||
LTEXT "Beta Tester:",-1,7,120,44,8,SS_NOPREFIX
|
||||
LTEXT "John Hardy IV",IDC_WWW_MAME,60,120,46,8,SS_NOPREFIX |
|
||||
SS_NOTIFY
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,37,283,1
|
||||
LTEXT "Thanks To:",-1,7,107,38,8
|
||||
LTEXT "Dedicated To:",-1,7,94,46,8
|
||||
END
|
||||
|
||||
IDD_CONFIG_PAGE DIALOGEX 0, 0, 306, 199
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Options"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "&ROM (.bin) file path:",-1,7,10,64,8
|
||||
EDITTEXT IDC_ROMPATH,82,7,152,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "&Browse...",IDC_BROWSE,241,7,50,14
|
||||
LTEXT "Set this to the path where your .bin rom files are located.",
|
||||
-1,7,25,292,8
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,39,292,1
|
||||
LTEXT "Mouse should emulate &paddle:",-1,7,49,111,8
|
||||
COMBOBOX IDC_PADDLE,122,47,48,82,CBS_DROPDOWNLIST | WS_VSCROLL |
|
||||
WS_TABSTOP
|
||||
LTEXT "Set this to specify which paddle the mouse should emulate. This can be any number from 0 to 3 inclusive.",
|
||||
-1,7,66,198,18
|
||||
CONTROL "Disable &Sound",IDC_SOUND,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,7,164,62,10
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,91,291,1
|
||||
LTEXT "Video Driver:",-1,7,101,67,10
|
||||
COMBOBOX IDC_VIDEO,67,99,51,35,CBS_DROPDOWN | CBS_SORT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Aspect Ratio:",-1,7,120,55,10
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,136,290,1
|
||||
EDITTEXT IDC_ASPECT,66,118,50,12,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_MAIN, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 402
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 242
|
||||
END
|
||||
|
||||
IDD_DOC_PAGE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 383
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 189
|
||||
END
|
||||
|
||||
IDD_ABOUT_PAGE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 290
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 128
|
||||
END
|
||||
|
||||
IDD_CONFIG_PAGE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 299
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 192
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_APP ICON "STELLAX.ICO"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_TILE BITMAP "tile.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_STATUSTEXT "%d files found"
|
||||
IDS_STELLA "StellaX"
|
||||
IDS_NODIRECTINPUT "DirectInput could not be initialized. Be sure you have DirectX 5.0 or later installed."
|
||||
IDS_CANTSTARTCONSOLE "Error starting console. You may have chosen an invalid ROM file."
|
||||
IDS_COINIT_FAILED "Unable to initialize COM subsystem"
|
||||
IDS_ASS_FAILED "Unable to initialize audio subsystem"
|
||||
IDS_PAS_FAILED "Unable to create audio stream"
|
||||
IDS_DD_INIT_FAILED "Unable to initialize DirectDraw object"
|
||||
IDS_DD_ENUMMODES_FAILED "Unable to enumerate display modes"
|
||||
IDS_NO_VID_MODE "No compatible video modes were found"
|
||||
IDS_DI_INIT_FAILED "Unable to initialize DirectInput object"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_ALREADYRUNNING "StellaX is already running!"
|
||||
IDS_BADARGUMENT "Unknown argument given on command line"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDSDM_FAILED "Unable to set video mode. Your video adapter might be incompatible with stella."
|
||||
IDS_DSCSBFAILED "IDirectSound::CreateSoundBuffer failed"
|
||||
IDS_DSSCLFAILED "IDirectSound::SetCooperativeLevel failed"
|
||||
IDS_FILEFILTER "Stella Files (*.bin)|*.bin|All Files (*.*)|*.*||"
|
||||
IDS_FILENAME "Filename"
|
||||
IDS_MANUFACTURER "Manufacturer"
|
||||
IDS_MIKE """I've heard some folks discussing the possibility of writing an 2600 emulator in a high level language - forget it, not possible."" -- Mike Livesay on rec.games.video.classic"
|
||||
IDS_NAME "Name"
|
||||
IDS_NODIRECTDRAW "DirectDraw does not appear to be installed on this system!"
|
||||
IDS_RARITY "Rarity"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CW_FAILED "CreateWindow failed"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDSCL_FAILED "IDirectDraw::SetCooperativeLevel failed"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDCS_FAILED "IDirectDraw::CreateSurface failed"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDCP_FAILED "IDirectDraw::CreatePalette failed"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_ROM_LOAD_FAILED "Unable to load ROM image\n\nCurrent Directory: %s\nPath: %s\nError code: %d - %s"
|
||||
IDS_NO_ITEM_SELECTED "Before pressing play you must first select a game from the list!"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
|
@ -0,0 +1,254 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="StellaX"
|
||||
ProjectGUID="{EB852944-92EA-4A83-B13F-E800ADA48A4D}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\emucore;..\..\emucore\m6502\src\bspf\src;..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BSPF_WIN32;DISPLAY_OPENGL"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="1"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/StellaX.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/StellaX.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\emucore;..\..\emucore\m6502\src\bspf\src;..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="1"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/StellaX.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\AboutPage.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BrowseForFolder.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ConfigPage.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CoolCaption.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileDialog.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GlobalData.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\HeaderCtrl.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\HyperLink.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\main.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MainDlg.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pch.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PropertySheet.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RoundButton.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Settings.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\SettingsWin32.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\StellaXMain.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TextButton3d.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Wnd.cxx">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\AboutPage.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BrowseForFolder.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ConfigPage.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CoolCaption.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileDialog.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GlobalData.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\HeaderCtrl.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\HyperLink.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MainDlg.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pch.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PropertySheet.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RoundButton.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\emucore\Settings.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\SettingsWin32.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\StellaXMain.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TextButton3d.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Wnd.hxx">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File
|
||||
RelativePath=".\StellaX.ico">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\StellaX.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\tile.bmp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -0,0 +1,183 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/13/2000
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <strstream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "resource.h"
|
||||
#include "GlobalData.hxx"
|
||||
#include "pch.hxx"
|
||||
#include "StellaXMain.hxx"
|
||||
|
||||
//
|
||||
// CStellaXMain
|
||||
//
|
||||
// equivalent to main() in the DOS version of stella
|
||||
//
|
||||
|
||||
|
||||
CStellaXMain::CStellaXMain(
|
||||
) : \
|
||||
m_pPropertiesSet( NULL )
|
||||
{
|
||||
TRACE( "CStellaXMain::CStellaXMain" );
|
||||
}
|
||||
|
||||
CStellaXMain::~CStellaXMain(
|
||||
)
|
||||
{
|
||||
TRACE( "CStellaXMain::~CStellaXMain" );
|
||||
}
|
||||
|
||||
DWORD CStellaXMain::Initialize(
|
||||
void
|
||||
)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
HRESULT CStellaXMain::PlayROM(
|
||||
HWND hwnd,
|
||||
LPCTSTR pszPathName,
|
||||
LPCTSTR pszFriendlyName,
|
||||
CGlobalData& rGlobalData
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( hwnd );
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("CStellaXMain::PlayROM");
|
||||
|
||||
//
|
||||
// show wait cursor while loading
|
||||
//
|
||||
|
||||
HCURSOR hcur = ::SetCursor( ::LoadCursor( NULL, IDC_WAIT ) );
|
||||
|
||||
//
|
||||
// setup objects used here
|
||||
//
|
||||
|
||||
BYTE* pImage = NULL;
|
||||
LPCTSTR pszFileName = NULL;
|
||||
|
||||
//
|
||||
// Load the rom file
|
||||
//
|
||||
|
||||
HANDLE hFile;
|
||||
DWORD dwImageSize;
|
||||
|
||||
hFile = ::CreateFile( pszPathName,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL );
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE );
|
||||
|
||||
DWORD dwLastError = ::GetLastError();
|
||||
|
||||
TCHAR pszCurrentDirectory[ MAX_PATH + 1 ];
|
||||
::GetCurrentDirectory( MAX_PATH, pszCurrentDirectory );
|
||||
|
||||
// ::MessageBoxFromGetLastError( pszPathName );
|
||||
TCHAR pszFormat[ 1024 ];
|
||||
LoadString( hInstance,
|
||||
IDS_ROM_LOAD_FAILED,
|
||||
pszFormat, 1023 );
|
||||
|
||||
LPTSTR pszLastError = NULL;
|
||||
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
dwLastError,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR)&pszLastError,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
TCHAR pszError[ 1024 ];
|
||||
wsprintf( pszError,
|
||||
pszFormat,
|
||||
pszCurrentDirectory,
|
||||
pszPathName,
|
||||
dwLastError,
|
||||
pszLastError );
|
||||
|
||||
::MessageBox( hwnd,
|
||||
pszError,
|
||||
_T("Error"),
|
||||
MB_OK | MB_ICONEXCLAMATION );
|
||||
|
||||
::LocalFree( pszLastError );
|
||||
|
||||
hr = HRESULT_FROM_WIN32( ::GetLastError() );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
dwImageSize = ::GetFileSize( hFile, NULL );
|
||||
|
||||
pImage = new BYTE[dwImageSize + 1];
|
||||
if ( pImage == NULL )
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
DWORD dwActualSize;
|
||||
if ( ! ::ReadFile( hFile, pImage, dwImageSize, &dwActualSize, NULL ) )
|
||||
{
|
||||
VERIFY( ::CloseHandle( hFile ) );
|
||||
|
||||
MessageBoxFromGetLastError( pszPathName );
|
||||
|
||||
hr = HRESULT_FROM_WIN32( ::GetLastError() );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
VERIFY( ::CloseHandle(hFile) );
|
||||
|
||||
//
|
||||
// get just the filename
|
||||
//
|
||||
|
||||
pszFileName = _tcsrchr( pszPathName, _T('\\') );
|
||||
if ( pszFileName )
|
||||
{
|
||||
++pszFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
pszFileName = pszPathName;
|
||||
}
|
||||
|
||||
// restore cursor
|
||||
|
||||
::SetCursor( hcur );
|
||||
hcur = NULL;
|
||||
|
||||
::ShowWindow( hwnd, SW_HIDE );
|
||||
|
||||
// launch game here
|
||||
|
||||
::ShowWindow( hwnd, SW_SHOW );
|
||||
|
||||
exit:
|
||||
|
||||
if ( hcur )
|
||||
{
|
||||
::SetCursor( hcur );
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/12/2000
|
||||
//
|
||||
#ifndef STELLAX_H
|
||||
#define STELLAX_H
|
||||
#pragma once
|
||||
|
||||
class PropertiesSet;
|
||||
class CGlobalData;
|
||||
|
||||
class CStellaXMain
|
||||
{
|
||||
public:
|
||||
|
||||
CStellaXMain();
|
||||
~CStellaXMain();
|
||||
|
||||
DWORD Initialize( void );
|
||||
|
||||
HRESULT PlayROM( HWND hwnd, LPCTSTR ctszPathName,
|
||||
LPCTSTR pszFriendlyName,
|
||||
CGlobalData& rGlobalData );
|
||||
PropertiesSet& GetPropertiesSet() const;
|
||||
|
||||
private:
|
||||
|
||||
PropertiesSet* m_pPropertiesSet;
|
||||
|
||||
CStellaXMain( const CStellaXMain& ); // no implementation
|
||||
void operator=( const CStellaXMain& ); // no implementation
|
||||
};
|
||||
|
||||
inline PropertiesSet& CStellaXMain::GetPropertiesSet(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return *m_pPropertiesSet;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,186 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 10/12/1999
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include "TextButton3d.hxx"
|
||||
|
||||
// button style should be VISIBLE / DISABLED / OWNERDRAW
|
||||
|
||||
CTextButton3d::CTextButton3d
|
||||
(
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT CTextButton3d::WndProc
|
||||
(
|
||||
HWND hWnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
BOOL& rfHandled
|
||||
)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
#if 0
|
||||
|
||||
// TODO: re do this now that I send this message here
|
||||
case WM_DRAWITEM:
|
||||
rfHandled = TRUE;
|
||||
pThis->OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
case WM_PAINT:
|
||||
rfHandled = TRUE;
|
||||
OnPaint(hWnd, (HDC)wParam);
|
||||
return TRUE;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
rfHandled = TRUE;
|
||||
return OnEraseBkgnd(hWnd, (HDC)wParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CTextButton3d::OnPaint
|
||||
(
|
||||
HWND hwnd,
|
||||
HDC hdcPaint
|
||||
)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
int cxClient, cyClient;
|
||||
|
||||
RECT rc;
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
RECT rcClient;
|
||||
CopyRect(&rcClient, &rc);
|
||||
|
||||
// lpdis->rcItem, lpdis->itemState
|
||||
|
||||
int l = GetWindowTextLength(hwnd);
|
||||
LPTSTR text = new TCHAR[l + 2];
|
||||
if (text == NULL)
|
||||
{
|
||||
EndPaint(hwnd, &ps);
|
||||
return;
|
||||
}
|
||||
GetWindowText(hwnd, text, l+1);
|
||||
|
||||
HFONT hfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
|
||||
LOGFONT lf;
|
||||
GetObject(hfont, sizeof(lf), &lf);
|
||||
if (lf.lfHeight == 0)
|
||||
lf.lfHeight = 20;
|
||||
lf.lfWidth = 0;
|
||||
lf.lfWeight = FW_BLACK;
|
||||
lf.lfEscapement = 0;
|
||||
lf.lfOrientation = 0;
|
||||
HFONT hfontTry = CreateFontIndirect(&lf);
|
||||
|
||||
HFONT hfontOld = (HFONT)SelectObject(hdc, hfontTry);
|
||||
|
||||
rcClient.left += 3;
|
||||
rcClient.top += 3;
|
||||
rcClient.right -= 3;
|
||||
rcClient.bottom -= 3;
|
||||
|
||||
cxClient = rcClient.right - rcClient.left;
|
||||
cyClient = rcClient.bottom - rcClient.top;
|
||||
|
||||
SIZE sizeTextClient;
|
||||
GetTextExtentPoint(hdc, text, lstrlen(text),
|
||||
&sizeTextClient);
|
||||
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
|
||||
{
|
||||
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
|
||||
}
|
||||
|
||||
lf.lfHeight--;
|
||||
|
||||
rcClient.left -= 3;
|
||||
rcClient.top -= 3;
|
||||
rcClient.right += 3;
|
||||
rcClient.bottom += 3;
|
||||
|
||||
cxClient = rcClient.right - rcClient.left;
|
||||
cyClient = rcClient.bottom - rcClient.top;
|
||||
|
||||
hfont = CreateFontIndirect(&lf);
|
||||
SelectObject(hdc, hfont);
|
||||
GetTextExtentPoint(hdc, text, lstrlen(text),
|
||||
&sizeTextClient);
|
||||
|
||||
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
|
||||
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
|
||||
|
||||
int iOldBkMode = SetBkMode(hdc, TRANSPARENT);
|
||||
COLORREF crText = GetSysColor(COLOR_BTNTEXT);
|
||||
COLORREF crOldText = SetTextColor(hdc, crText);
|
||||
|
||||
int cx = minx;
|
||||
int cy = miny;
|
||||
|
||||
int s = 1;
|
||||
cx += 3;
|
||||
cy += 3;
|
||||
|
||||
// draw 3D highlights
|
||||
|
||||
SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW));
|
||||
TextOut(hdc, cx-s*2, cy+s*2, text, lstrlen(text));
|
||||
TextOut(hdc, cx+s*2, cy-s*2, text, lstrlen(text));
|
||||
TextOut(hdc, cx+s*2, cy+s*2, text, lstrlen(text));
|
||||
SetTextColor(hdc, ::GetSysColor(COLOR_3DHILIGHT));
|
||||
TextOut(hdc, cx+s*1, cy-s*2, text, lstrlen(text));
|
||||
TextOut(hdc, cx-s*2, cy+s*1, text, lstrlen(text));
|
||||
TextOut(hdc, cx-s*2, cy-s*2, text, lstrlen(text));
|
||||
SetTextColor(hdc, GetSysColor(COLOR_3DSHADOW));
|
||||
TextOut(hdc, cx-s*1, cy+s*1, text, lstrlen(text));
|
||||
TextOut(hdc, cx+s*1, cy-s*1, text, lstrlen(text));
|
||||
TextOut(hdc, cx+s*1, cy+s*1, text, lstrlen(text));
|
||||
SetTextColor(hdc, GetSysColor(COLOR_3DLIGHT));
|
||||
TextOut(hdc, cx, cy-s*1, text, lstrlen(text));
|
||||
TextOut(hdc, cx-s*1, cy, text, lstrlen(text));
|
||||
TextOut(hdc, cx-s*1, cy-s*1, text, lstrlen(text));
|
||||
SetTextColor(hdc, crText);
|
||||
|
||||
// draw the text
|
||||
|
||||
TextOut(hdc, cx, cy, text, lstrlen(text));
|
||||
|
||||
// restore dc
|
||||
|
||||
SetTextColor(hdc, crOldText);
|
||||
SetBkMode(hdc, iOldBkMode);
|
||||
SelectObject(hdc, hfontOld);
|
||||
|
||||
DeleteObject(hfont);
|
||||
DeleteObject(hfontTry);
|
||||
|
||||
delete[] text;
|
||||
|
||||
EndPaint(hwnd, &ps);
|
||||
}
|
||||
|
||||
BOOL CTextButton3d::OnEraseBkgnd
|
||||
(
|
||||
HWND hwnd,
|
||||
HDC hdc
|
||||
)
|
||||
{
|
||||
// dont do any erasing
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#ifndef TXTBTN_H
|
||||
#define TXTBTN_H
|
||||
#pragma once
|
||||
|
||||
// derived from Roger Onslow's code
|
||||
|
||||
#include "Wnd.hxx"
|
||||
|
||||
class CTextButton3d : public CWnd
|
||||
{
|
||||
public:
|
||||
|
||||
CTextButton3d();
|
||||
|
||||
protected:
|
||||
|
||||
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||
BOOL& rfHandled);
|
||||
|
||||
private:
|
||||
|
||||
void OnPaint(HWND, HDC);
|
||||
BOOL OnEraseBkgnd(HWND, HDC);
|
||||
|
||||
CTextButton3d( const CTextButton3d& ); // no implementation
|
||||
void operator=( const CTextButton3d& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include "Wnd.hxx"
|
||||
|
||||
// REVIEW: Need to reset old wnd proc?
|
||||
|
||||
CWnd::CWnd(
|
||||
) : \
|
||||
m_pOldWindowProc(NULL),
|
||||
m_hwnd(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CWnd::SubclassDlgItem(
|
||||
HWND hwndParent,
|
||||
UINT nID
|
||||
)
|
||||
{
|
||||
if ( nID == 0 || hwndParent == NULL )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// can't subclass twice!
|
||||
|
||||
if ( m_pOldWindowProc != NULL )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_hwnd = GetDlgItem( hwndParent, nID );
|
||||
if (m_hwnd == NULL)
|
||||
{
|
||||
ASSERT( FALSE );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PreSubclassWindow( m_hwnd );
|
||||
|
||||
m_pOldWindowProc = (WNDPROC)GetWindowLong( m_hwnd, GWL_WNDPROC );
|
||||
SetWindowLong( m_hwnd, GWL_USERDATA, (LONG)this );
|
||||
SetWindowLong( m_hwnd, GWL_WNDPROC, (LONG)StaticWndProc );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CWnd::PreSubclassWindow(
|
||||
HWND hwnd
|
||||
)
|
||||
{
|
||||
// no default behavior
|
||||
}
|
||||
|
||||
LRESULT CALLBACK CWnd::StaticWndProc(
|
||||
HWND hWnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
|
||||
BOOL fHandled = FALSE;
|
||||
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
|
||||
|
||||
if (fHandled)
|
||||
{
|
||||
return lRes;
|
||||
}
|
||||
|
||||
return CallWindowProc( pThis->m_pOldWindowProc, hWnd, msg, wParam, lParam );
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#ifndef WND_H
|
||||
#define WND_H
|
||||
|
||||
class CWnd
|
||||
{
|
||||
public:
|
||||
|
||||
CWnd();
|
||||
|
||||
BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
|
||||
|
||||
operator HWND() const
|
||||
{
|
||||
return m_hwnd;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void PreSubclassWindow( HWND hwnd );
|
||||
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||
BOOL& rfHandled ) = 0;
|
||||
|
||||
private:
|
||||
|
||||
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg,
|
||||
WPARAM wParam, LPARAM lParam );
|
||||
|
||||
WNDPROC m_pOldWindowProc;
|
||||
HWND m_hwnd;
|
||||
|
||||
CWnd( const CWnd& ); // no implementation
|
||||
void operator=( const CWnd& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 04/27/2000
|
||||
//
|
||||
|
||||
#include "debug.hxx"
|
||||
|
||||
#ifdef _DEBUG // entire file
|
||||
|
||||
// log file name (or NULL for no log) -- must be defined by client
|
||||
|
||||
extern LPCTSTR g_ctszDebugLog;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DEBUG DEFINED
|
||||
|
||||
void AFX_CDECL AfxTrace(
|
||||
LPCTSTR lpszFormat,
|
||||
...
|
||||
)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, lpszFormat);
|
||||
|
||||
int nBuf;
|
||||
TCHAR szBuffer[512];
|
||||
|
||||
nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
|
||||
|
||||
// was there an error? was the expanded string too long?
|
||||
ASSERT(nBuf >= 0);
|
||||
|
||||
if (nBuf < 511)
|
||||
{
|
||||
lstrcat(szBuffer, _T("\r\n"));
|
||||
}
|
||||
|
||||
_RPT0(_CRT_WARN, szBuffer);
|
||||
|
||||
if (g_ctszDebugLog)
|
||||
{
|
||||
HANDLE hfile = CreateFile(g_ctszDebugLog, GENERIC_WRITE, 0, NULL,
|
||||
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hfile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
SetFilePointer(hfile, 0, NULL, FILE_END);
|
||||
|
||||
DWORD dw;
|
||||
WriteFile(hfile, szBuffer, (lstrlen(szBuffer)+1)*sizeof(TCHAR),
|
||||
&dw, NULL);
|
||||
|
||||
CloseHandle(hfile);
|
||||
}
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
BOOL AFXAPI AfxAssertFailedLine(
|
||||
LPCSTR lpszFileName,
|
||||
int nLine,
|
||||
LPCTSTR lpszCondition
|
||||
)
|
||||
{
|
||||
// we remove WM_QUIT because if it is in the queue then the message box
|
||||
// won't display
|
||||
MSG msg;
|
||||
BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
||||
BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, lpszCondition);
|
||||
if (bQuit)
|
||||
PostQuitMessage(msg.wParam);
|
||||
return bResult;
|
||||
}
|
||||
|
||||
#endif //_DEBUG
|
|
@ -0,0 +1,99 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/27/1999
|
||||
//
|
||||
|
||||
#ifndef _AFX
|
||||
#define _AFX
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// This file defines:
|
||||
// _countof
|
||||
// TRACE, TRACE0, TRACE1, TRACE2, TRACE3
|
||||
// ASSERT
|
||||
// VERIFY
|
||||
// DEBUG_ONLY
|
||||
|
||||
|
||||
|
||||
// determine number of elements in an array (not bytes)
|
||||
#define _countof(array) (sizeof(array)/sizeof(array[0]))
|
||||
|
||||
// AFXAPI is used on global public functions
|
||||
#ifndef AFXAPI
|
||||
#define AFXAPI __stdcall
|
||||
#endif
|
||||
|
||||
// AFX_CDECL is used for rare functions taking variable arguments
|
||||
#ifndef AFX_CDECL
|
||||
#define AFX_CDECL __cdecl
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DEBUG DEFINED
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <crtdbg.h>
|
||||
|
||||
#ifndef AfxDebugBreak
|
||||
#define AfxDebugBreak() _CrtDbgBreak()
|
||||
#endif
|
||||
|
||||
BOOL AFXAPI AfxAssertFailedLine(LPCSTR lpszFileName, int nLine, LPCTSTR lpszCondition);
|
||||
|
||||
void AFX_CDECL AfxTrace(LPCTSTR lpszFormat, ...);
|
||||
|
||||
#define TRACE ::AfxTrace
|
||||
#define THIS_FILE __FILE__
|
||||
#define ASSERT(f) \
|
||||
do \
|
||||
{ \
|
||||
if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__, #f)) \
|
||||
AfxDebugBreak(); \
|
||||
} while (0) \
|
||||
|
||||
#define VERIFY(f) ASSERT(f)
|
||||
#define DEBUG_ONLY(f) (f)
|
||||
|
||||
// The following trace macros are provided for backward compatiblity
|
||||
// (they also take a fixed number of parameters which provides
|
||||
// some amount of extra error checking)
|
||||
#define TRACE0(sz) ::AfxTrace(_T("%s"), _T(sz))
|
||||
#define TRACE1(sz, p1) ::AfxTrace(_T(sz), p1)
|
||||
#define TRACE2(sz, p1, p2) ::AfxTrace(_T(sz), p1, p2)
|
||||
#define TRACE3(sz, p1, p2, p3) ::AfxTrace(_T(sz), p1, p2, p3)
|
||||
|
||||
#else // _DEBUG
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DEBUG NOT DEFINED
|
||||
|
||||
#ifdef AfxDebugBreak
|
||||
#undef AfxDebugBreak
|
||||
#endif
|
||||
#define AfxDebugBreak()
|
||||
|
||||
#define ASSERT(f) ((void)0)
|
||||
#define VERIFY(f) ((void)(f))
|
||||
#define DEBUG_ONLY(f) ((void)0)
|
||||
inline void AFX_CDECL AfxTrace(LPCTSTR, ...) { }
|
||||
#define TRACE 1 ? (void)0 : ::AfxTrace
|
||||
#define TRACE0(sz)
|
||||
#define TRACE1(sz, p1)
|
||||
#define TRACE2(sz, p1, p2)
|
||||
#define TRACE3(sz, p1, p2, p3)
|
||||
|
||||
#endif // !_DEBUG
|
||||
|
||||
#endif
|
|
@ -0,0 +1,94 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2000 by Jeff Miller
|
||||
// Copyright (c) 2004 by Stephen Anthony
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: main.cxx,v 1.1 2004-06-28 23:13:54 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "resource.h"
|
||||
|
||||
#include "GlobalData.hxx"
|
||||
#include "MainDlg.hxx"
|
||||
|
||||
class CSingleInstance
|
||||
{
|
||||
public:
|
||||
CSingleInstance( LPCTSTR pszName )
|
||||
{
|
||||
::SetLastError( ERROR_SUCCESS );
|
||||
m_hMutex = ::CreateMutex( NULL, TRUE, pszName );
|
||||
m_dwError = ::GetLastError();
|
||||
}
|
||||
|
||||
~CSingleInstance()
|
||||
{
|
||||
if ( m_hMutex != INVALID_HANDLE_VALUE && m_dwError != ERROR_ALREADY_EXISTS )
|
||||
{
|
||||
VERIFY( ::ReleaseMutex( m_hMutex ) );
|
||||
VERIFY( ::CloseHandle( m_hMutex ) );
|
||||
}
|
||||
}
|
||||
|
||||
BOOL AlreadyExists( void ) const
|
||||
{
|
||||
return ( m_dwError == ERROR_ALREADY_EXISTS );
|
||||
}
|
||||
|
||||
private:
|
||||
HANDLE m_hMutex;
|
||||
DWORD m_dwError;
|
||||
|
||||
CSingleInstance( const CSingleInstance& ); // no implementation
|
||||
void operator=( const CSingleInstance& ); // no implementation
|
||||
};
|
||||
|
||||
// see debug.cpp
|
||||
|
||||
LPCTSTR g_ctszDebugLog = _T("stella.log");
|
||||
|
||||
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
UNUSED_ALWAYS( hPrevInstance );
|
||||
UNUSED_ALWAYS( lpCmdLine );
|
||||
UNUSED_ALWAYS( nCmdShow );
|
||||
|
||||
(void)::DeleteFile(g_ctszDebugLog);
|
||||
|
||||
CSingleInstance mutex( _T("StellaXMutex") );
|
||||
if ( mutex.AlreadyExists() )
|
||||
{
|
||||
MessageBox( hInstance, NULL, IDS_ALREADYRUNNING );
|
||||
return 1;
|
||||
}
|
||||
|
||||
HRESULT hrCoInit = ::CoInitialize( NULL );
|
||||
if ( FAILED(hrCoInit) )
|
||||
MessageBox( hInstance, NULL, IDS_COINIT_FAILED );
|
||||
|
||||
::InitCommonControls();
|
||||
|
||||
CGlobalData globaldata( hInstance );
|
||||
|
||||
// show the ui
|
||||
CMainDlg dlg( globaldata, hInstance );
|
||||
dlg.DoModal( NULL );
|
||||
|
||||
if ( hrCoInit == S_OK )
|
||||
::CoUninitialize();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#include "pch.hxx"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
// This will force in the DirectX library
|
||||
|
||||
#pragma comment( lib, "dxguid" )
|
||||
|
||||
// Bring in DirectInput library (for c_dfDIMouse, etc)
|
||||
|
||||
#pragma comment( lib, "dinput" )
|
||||
|
||||
// Bring in the common control library
|
||||
|
||||
#pragma comment( lib, "comctl32" )
|
||||
|
||||
// Bring in multimedia timers
|
||||
|
||||
#pragma comment( lib, "winmm" )
|
||||
|
||||
void MessageBox(
|
||||
HINSTANCE hInstance,
|
||||
HWND hwndParent,
|
||||
UINT uIDText
|
||||
)
|
||||
{
|
||||
const int nMaxStrLen = 1024;
|
||||
TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
|
||||
TCHAR tszText[nMaxStrLen + 1] = { 0 };
|
||||
|
||||
// Caption is always "StellaX"
|
||||
|
||||
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
|
||||
|
||||
LoadString(hInstance, uIDText, tszText, nMaxStrLen);
|
||||
|
||||
if (hwndParent == NULL)
|
||||
{
|
||||
hwndParent = ::GetForegroundWindow();
|
||||
}
|
||||
|
||||
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
|
||||
}
|
||||
|
||||
void MessageBoxFromWinError(
|
||||
DWORD dwError,
|
||||
LPCTSTR pszCaption /* = NULL */
|
||||
)
|
||||
{
|
||||
const int nMaxStrLen = 1024;
|
||||
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
|
||||
|
||||
if ( pszCaption == NULL )
|
||||
{
|
||||
// LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
|
||||
lstrcpy( pszCaptionStellaX, _T("StellaX") );
|
||||
}
|
||||
|
||||
LPTSTR pszText = NULL;
|
||||
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
dwError,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR)&pszText,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
::MessageBox(::GetForegroundWindow(), pszText,
|
||||
pszCaption ? pszCaption : pszCaptionStellaX, MB_ICONWARNING | MB_OK);
|
||||
|
||||
::LocalFree( pszText );
|
||||
}
|
||||
|
||||
void MessageBoxFromGetLastError(
|
||||
LPCTSTR pszCaption /* = NULL */
|
||||
)
|
||||
{
|
||||
MessageBoxFromWinError( GetLastError(), pszCaption );
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
//
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This file can only be compiled for a Win32 platform
|
||||
#endif
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define STRICT
|
||||
#define DIRECTINPUT_VERSION 5
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <tchar.h>
|
||||
|
||||
// warning C4201: nonstandard extension used : nameless struct/union
|
||||
|
||||
#pragma warning ( once: 4201 )
|
||||
|
||||
#include <mmsystem.h>
|
||||
#include <commdlg.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include <ddraw.h>
|
||||
#include <dsound.h>
|
||||
#include <dinput.h>
|
||||
|
||||
#include "debug.hxx"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Conditional defines
|
||||
|
||||
#define DOUBLE_WIDTH
|
||||
|
||||
//
|
||||
// Macros
|
||||
//
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define UNUSED(x)
|
||||
#else
|
||||
#define UNUSED(x) x
|
||||
#endif
|
||||
#define UNUSED_ALWAYS(x) x
|
||||
|
||||
//
|
||||
// Simple string class
|
||||
//
|
||||
|
||||
class CSimpleString
|
||||
{
|
||||
public:
|
||||
|
||||
CSimpleString() :
|
||||
m_psz( NULL ),
|
||||
m_cch( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
~CSimpleString()
|
||||
{
|
||||
delete[] m_psz;
|
||||
m_psz = NULL;
|
||||
|
||||
m_cch = -1;
|
||||
}
|
||||
|
||||
BOOL Set( LPCTSTR psz )
|
||||
{
|
||||
int cch = lstrlen( psz );
|
||||
if ( cch > m_cch )
|
||||
{
|
||||
delete[] m_psz;
|
||||
m_psz = NULL;
|
||||
m_cch = -1;
|
||||
|
||||
m_psz = new TCHAR[ cch + 1 ];
|
||||
if ( m_psz == NULL )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_cch = cch;
|
||||
}
|
||||
|
||||
memcpy( m_psz, psz, ( cch + 1 ) * sizeof( TCHAR ) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LPCTSTR Get( void ) const
|
||||
{
|
||||
ASSERT( m_psz != NULL );
|
||||
return m_psz;
|
||||
}
|
||||
|
||||
int Length( void ) const
|
||||
{
|
||||
return m_cch;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//
|
||||
// The string and its size (-1 means not initialized)
|
||||
//
|
||||
|
||||
LPTSTR m_psz;
|
||||
int m_cch;
|
||||
|
||||
CSimpleString( const CSimpleString& ); // no implementation
|
||||
void operator=( const CSimpleString& ); // no implementation
|
||||
};
|
||||
|
||||
//
|
||||
// Utility methods
|
||||
//
|
||||
|
||||
void MessageBox(
|
||||
HINSTANCE hInstance,
|
||||
HWND hwndParent,
|
||||
UINT uIDText
|
||||
);
|
||||
|
||||
void MessageBoxFromWinError(
|
||||
DWORD dwError,
|
||||
LPCTSTR pszCaption /* = NULL */
|
||||
);
|
||||
|
||||
void MessageBoxFromGetLastError(
|
||||
LPCTSTR pszCaption /* = NULL */
|
||||
);
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,87 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by StellaX.rc
|
||||
//
|
||||
#define IDB_TILE 101
|
||||
#define IDI_APP 102
|
||||
#define IDD_ABOUT 103
|
||||
#define IDD_MAIN 104
|
||||
#define IDD_ABOUT_PAGE 106
|
||||
#define IDD_DOC_PAGE 107
|
||||
#define IDD_CONFIG_PAGE 108
|
||||
#define IDS_ALREADYRUNNING 200
|
||||
#define IDS_BADARGUMENT 201
|
||||
#define IDS_BADFRAMERATE 202
|
||||
#define IDS_BADPADDLEMODE 203
|
||||
#define IDS_CANTOPEN 204
|
||||
#define IDS_CW_FAILED 208
|
||||
#define IDS_DDCP_FAILED 224
|
||||
#define IDS_DDCS_FAILED 240
|
||||
#define IDS_DDSCL_FAILED 256
|
||||
#define IDS_DDSDM_FAILED 272
|
||||
#define IDS_DSCSBFAILED 273
|
||||
#define IDS_DSSCLFAILED 274
|
||||
#define IDS_FATALERROR 275
|
||||
#define IDS_FILEFILTER 276
|
||||
#define IDS_FILENAME 277
|
||||
#define IDS_MANUFACTURER 278
|
||||
#define IDS_MIKE 279
|
||||
#define IDS_NAME 280
|
||||
#define IDS_NODIRECTDRAW 281
|
||||
#define IDS_NOGOODVIDEOMODE 282
|
||||
#define IDS_OUTOFMEMORY 283
|
||||
#define IDS_RARITY 284
|
||||
#define IDS_RC_FAILED 288
|
||||
#define IDS_STATUSTEXT 289
|
||||
#define IDS_STELLA 290
|
||||
#define IDS_UNKNOWNERROR 291
|
||||
#define IDS_DEBUGBUILD 292
|
||||
#define IDS_NODIRECTINPUT 293
|
||||
#define IDS_FATALSOUNDERROR 294
|
||||
#define IDS_CANTSTARTCONSOLE 295
|
||||
#define IDS_COINIT_FAILED 296
|
||||
#define IDS_ASS_FAILED 297
|
||||
#define IDS_PAS_FAILED 298
|
||||
#define IDS_DD_FAILED 299
|
||||
#define IDS_DD_INIT_FAILED 300
|
||||
#define IDS_DD_ENUMMODES_FAILED 301
|
||||
#define IDS_NO_VID_MODE 302
|
||||
#define IDS_DI_INIT_FAILED 303
|
||||
#define IDS_ROM_LOAD_FAILED 304
|
||||
#define IDS_NO_ITEM_SELECTED 305
|
||||
#define IDC_ABOUT 1001
|
||||
#define IDC_EMAIL_MAINTAINER 1002
|
||||
#define IDC_EMAIL_STELLA 1003
|
||||
#define IDC_EXIT 1004
|
||||
#define IDC_PLAY 1005
|
||||
#define IDC_ROMCOUNT 1006
|
||||
#define IDC_ROMLIST 1007
|
||||
#define IDC_STATIC 1008
|
||||
#define IDC_TITLE 1009
|
||||
#define IDC_WEB_MAINTAINER 1010
|
||||
#define IDC_WEB_STELLA 1011
|
||||
#define IDC_WWW_MAME 1012
|
||||
#define IDC_ROMPATH 1013
|
||||
#define IDC_ROMNOTE 1014
|
||||
#define IDC_CONFIG 1015
|
||||
#define IDC_PADDLE 1017
|
||||
#define IDC_SOUND 1018
|
||||
#define IDC_VOLUME 1019
|
||||
#define IDC_VIDEO 1020
|
||||
#define IDC_ASPECT 1021
|
||||
#define IDC_BROWSE 1022
|
||||
#define IDC_EDIT2 1027
|
||||
#define IDC_INSTRUCTIONS 2000
|
||||
#define IDC_ADOBE 2001
|
||||
#define ID_FILE_EXIT 32771
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 296
|
||||
#define _APS_NEXT_COMMAND_VALUE 32772
|
||||
#define _APS_NEXT_CONTROL_VALUE 1028
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
@ -0,0 +1,29 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StellaX", "StellaX\StellaX.vcproj", "{EB852944-92EA-4A83-B13F-E800ADA48A4D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stella", "Stella\Stella.vcproj", "{45875C96-4084-4C54-B570-FC92F8791A2F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Debug.ActiveCfg = Debug|Win32
|
||||
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Debug.Build.0 = Debug|Win32
|
||||
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Release.ActiveCfg = Release|Win32
|
||||
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Release.Build.0 = Release|Win32
|
||||
{45875C96-4084-4C54-B570-FC92F8791A2F}.Debug.ActiveCfg = Debug|Win32
|
||||
{45875C96-4084-4C54-B570-FC92F8791A2F}.Debug.Build.0 = Debug|Win32
|
||||
{45875C96-4084-4C54-B570-FC92F8791A2F}.Release.ActiveCfg = Release|Win32
|
||||
{45875C96-4084-4C54-B570-FC92F8791A2F}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Binary file not shown.
Loading…
Reference in New Issue