diff --git a/stella/src/win32/StellaX/AboutPage.cxx b/stella/src/win32/StellaX/AboutPage.cxx deleted file mode 100644 index 3c6b8df6b..000000000 --- a/stella/src/win32/StellaX/AboutPage.cxx +++ /dev/null @@ -1,47 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: AboutPage.cxx,v 1.2 2004-07-15 03:03:26 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "AboutPage.hxx" -#include "resource.h" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CHelpPage::CHelpPage() - : CPropertyPage(IDD_ABOUT_PAGE) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL CHelpPage::OnInitDialog( HWND hwnd ) -{ - m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER ); - 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; -} diff --git a/stella/src/win32/StellaX/AboutPage.hxx b/stella/src/win32/StellaX/AboutPage.hxx deleted file mode 100644 index 9bd606f97..000000000 --- a/stella/src/win32/StellaX/AboutPage.hxx +++ /dev/null @@ -1,44 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: AboutPage.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef ABOUT_PAGE_HXX -#define ABOUT_PAGE_HXX - -#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 diff --git a/stella/src/win32/StellaX/BrowseForFolder.cxx b/stella/src/win32/StellaX/BrowseForFolder.cxx deleted file mode 100644 index 330d6a3a0..000000000 --- a/stella/src/win32/StellaX/BrowseForFolder.cxx +++ /dev/null @@ -1,121 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1998 Scott D. Killen -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: BrowseForFolder.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "BrowseForFolder.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CBrowseForFolder::CBrowseForFolder( - const HWND hParent, - const LPITEMIDLIST pidl, - LPCTSTR strTitle) -{ - myHwnd = NULL; - - myBrowseInfo.pidlRoot = pidl; - myBrowseInfo.hwndOwner = NULL; - myBrowseInfo.pszDisplayName = mySelected; - myBrowseInfo.lpszTitle = strTitle; - myBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS|BIF_RETURNFSANCESTORS; - myBrowseInfo.lParam = reinterpret_cast( this ); - myBrowseInfo.lpfn = BrowseCallbackProc; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CBrowseForFolder::~CBrowseForFolder() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -LPCTSTR CBrowseForFolder::GetSelectedFolder() const -{ - return mySelected; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CBrowseForFolder::SelectFolder() -{ - bool bRet = false; - - LPITEMIDLIST pidl; - if ((pidl = SHBrowseForFolder(&myBrowseInfo)) != NULL) - { - if (SUCCEEDED(SHGetPathFromIDList(pidl, mySelected))) - bRet = true; - - 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(); - } - } - myHwnd = NULL; - - return bRet; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CBrowseForFolder::OnSelChanged(const LPITEMIDLIST pidl) const -{ - (void)pidl; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CBrowseForFolder::EnableOK(const bool bEnable) const -{ - if (myHwnd == NULL) - return; - - // (void)SendMessage(myHwnd, BFFM_ENABLEOK, static_cast(bEnable), NULL); - (void)SendMessage( myHwnd, BFFM_ENABLEOK, NULL, static_cast(bEnable) ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const -{ - if (myHwnd == NULL) - return; - - (void)SendMessage(myHwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast(pidl)); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CBrowseForFolder::SetSelection(LPCTSTR strPath) const -{ - if (myHwnd == NULL) - return; - - (void)SendMessage(myHwnd, BFFM_SETSELECTION, TRUE, reinterpret_cast(strPath)); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) -{ - CBrowseForFolder* pbff = reinterpret_cast( lpData ); - pbff->myHwnd = hwnd; - - if (uMsg == BFFM_SELCHANGED) - pbff->OnSelChanged( reinterpret_cast( lParam )); - - return 0; -} diff --git a/stella/src/win32/StellaX/BrowseForFolder.hxx b/stella/src/win32/StellaX/BrowseForFolder.hxx deleted file mode 100644 index f6160ca2a..000000000 --- a/stella/src/win32/StellaX/BrowseForFolder.hxx +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: BrowseForFolder.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef BROWSE_FOR_FOLDER_HXX -#define BROWSE_FOR_FOLDER_HXX - -#include - -class CBrowseForFolder -{ - public: - CBrowseForFolder(const HWND hParent = NULL, - const LPITEMIDLIST pidl = NULL, - LPCTSTR strTitle = NULL ); - - virtual ~CBrowseForFolder(); - - public: - // Call GetSelectedFolder to retrieve the folder selected by the user. - LPCTSTR GetSelectedFolder() 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: - // 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; - - private: - static int __stdcall BrowseCallbackProc(HWND hwnd, - UINT uMsg, - LPARAM lParam, - LPARAM lpData); - - BROWSEINFO myBrowseInfo; - char mySelected[MAX_PATH]; - HWND myHwnd; -}; - -#endif diff --git a/stella/src/win32/StellaX/ConfigPage.cxx b/stella/src/win32/StellaX/ConfigPage.cxx deleted file mode 100644 index 66cb1bb9d..000000000 --- a/stella/src/win32/StellaX/ConfigPage.cxx +++ /dev/null @@ -1,283 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: ConfigPage.cxx,v 1.6 2004-09-14 19:10:29 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 ) -{ - m_hwnd = hwnd; - HWND hwndCtrl; - - // Reload settings just in case the emulation changed them - myGlobalData.settings().loadConfig(); - - // Get romdir - hwndCtrl = GetDlgItem( hwnd, IDC_ROMPATH ); - SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 ); - SetWindowText( hwndCtrl, myGlobalData.settings().getString("romdir").c_str() ); - - // Get ssname - int ssname = 0; - hwndCtrl = GetDlgItem( hwnd, IDC_SNAPSHOT_TYPE ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"ROM Name" ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"ROM MD5" ); - if(myGlobalData.settings().getString("ssname") == "romname") - ssname = 0; - else if(myGlobalData.settings().getString("ssname") == "md5sum") - ssname = 1; - SendMessage( hwndCtrl, CB_SETCURSEL, ssname, 0 ); - - // Get sssingle - hwndCtrl = GetDlgItem( hwnd, IDC_SNAPSHOT_MULTIPLE ); - SendMessage( hwndCtrl, BM_SETCHECK, - myGlobalData.settings().getBool("sssingle") - ? BST_UNCHECKED : BST_CHECKED, 0 ); - - // Get 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 ); - - // Get video renderer - 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 ); - - // Get video driver - int videodriver = 0; - hwndCtrl = GetDlgItem( hwnd, IDC_VIDEO_DRIVER ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"WinDIB" ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"DirectX" ); - if(myGlobalData.settings().getString("video_driver") == "windib") - videodriver = 0; - else if(myGlobalData.settings().getString("video_driver") == "directx") - videodriver = 1; - SendMessage( hwndCtrl, CB_SETCURSEL, videodriver, 0 ); - - // Get gl_aspect - hwndCtrl = GetDlgItem( hwnd, IDC_GL_ASPECT ); - SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 ); - SetWindowText( hwndCtrl, myGlobalData.settings().getString("gl_aspect").c_str() ); - - // Get gl_fsmax - hwndCtrl = GetDlgItem( hwnd, IDC_GL_FSMAX ); - SendMessage( hwndCtrl, BM_SETCHECK, - myGlobalData.settings().getBool("gl_fsmax") - ? BST_CHECKED : BST_UNCHECKED, 0 ); - - // Get volume -// hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_VOLUME_SPIN ); -// CSpinButtonCtrl spin = (CSpinButtonCtrl) hwndCtrl; - hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_VOLUME ); - SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 ); - SetWindowText( hwndCtrl, myGlobalData.settings().getString("volume").c_str() ); - - // Get fragsize - int fragindex = 2, fragsize = 2048; - hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_FRAGSIZE ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"512" ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"1024" ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"2048" ); - SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"4096" ); - fragsize = myGlobalData.settings().getInt("fragsize"); - if(fragsize == 512) - fragindex = 0; - else if(fragsize == 1024) - fragindex = 1; - else if(fragsize == 2048) - fragindex = 2; - else if(fragsize == 4096) - fragindex = 3; - SendMessage( hwndCtrl, CB_SETCURSEL, fragindex, 0 ); - - // Get sound - hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_ENABLE ); - 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 ); - - HWND hwndCtrl; - TCHAR buffer[ MAX_PATH ]; - string str; - int i; - bool b; - - // Set romdir - hwndCtrl = GetDlgItem( m_hwnd, IDC_ROMPATH ); - ASSERT( hwndCtrl ); - GetWindowText( hwndCtrl, buffer, MAX_PATH ); - myGlobalData.settings().setString( "romdir", buffer ); - - // Set ssname - hwndCtrl = GetDlgItem( m_hwnd, IDC_SNAPSHOT_TYPE ); - ASSERT( hwndCtrl ); - i = SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ); - if( i == 0 ) - str = "romname"; - else if( i == 1 ) - str = "md5sum"; - else - str = "romname"; - myGlobalData.settings().setString( "ssname", str ); - - // Set sssingle - hwndCtrl = GetDlgItem( m_hwnd, IDC_SNAPSHOT_MULTIPLE ); - ASSERT( hwndCtrl ); - if( SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED ) - b = false; - else - b = true; - myGlobalData.settings().setBool( "sssingle", b ); - - // Set paddle - hwndCtrl = GetDlgItem( m_hwnd, IDC_PADDLE ); - ASSERT( hwndCtrl ); - myGlobalData.settings().setInt( "paddle", - SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ) ); - - // Set video renderer - 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 ); - - // Set video driver - hwndCtrl = GetDlgItem( m_hwnd, IDC_VIDEO_DRIVER ); - ASSERT( hwndCtrl ); - i = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ); - if( i == 0 ) - str = "windib"; - else if( i == 1 ) - str = "directx"; - else - str = "windib"; - myGlobalData.settings().setString( "video_driver", str ); - - // Set gl_aspect - hwndCtrl = GetDlgItem( m_hwnd, IDC_GL_ASPECT ); - ASSERT( hwndCtrl ); - GetWindowText( hwndCtrl, buffer, MAX_PATH ); - myGlobalData.settings().setString( "gl_aspect", buffer ); - - // Set gl_fsmax - hwndCtrl = GetDlgItem( m_hwnd, IDC_GL_FSMAX ); - ASSERT( hwndCtrl ); - if( SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED ) - b = true; - else - b = false; - myGlobalData.settings().setBool( "gl_fsmax", b ); - - // Set volume - hwndCtrl = GetDlgItem( m_hwnd, IDC_SOUND_VOLUME ); - ASSERT( hwndCtrl ); - GetWindowText( hwndCtrl, buffer, MAX_PATH ); - myGlobalData.settings().setString( "volume", buffer ); - - // Set fragsize - hwndCtrl = GetDlgItem( m_hwnd, IDC_SOUND_FRAGSIZE ); - ASSERT( hwndCtrl ); - i = SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ); - if( i == 0 ) - str = "512"; - else if( i == 1 ) - str = "1024"; - else if( i == 2 ) - str = "2048"; - else if( i == 3 ) - str = "4096"; - else - str = "2048"; - myGlobalData.settings().setString( "fragsize", str ); - - // Set sound - hwndCtrl = GetDlgItem( m_hwnd, IDC_SOUND_ENABLE ); - 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, NULL, "Open ROM Folder " ); - if ( bff.SelectFolder() ) - SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() ); - } - - return FALSE; -} diff --git a/stella/src/win32/StellaX/ConfigPage.hxx b/stella/src/win32/StellaX/ConfigPage.hxx deleted file mode 100644 index ca165fc9f..000000000 --- a/stella/src/win32/StellaX/ConfigPage.hxx +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: ConfigPage.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef CONFIG_PAGE_HXX -#define CONFIG_PAGE_HXX - -#include "PropertySheet.hxx" -#include "GlobalData.hxx" - -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 diff --git a/stella/src/win32/StellaX/CoolCaption.cxx b/stella/src/win32/StellaX/CoolCaption.cxx deleted file mode 100644 index d1bf606f0..000000000 --- a/stella/src/win32/StellaX/CoolCaption.cxx +++ /dev/null @@ -1,249 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: CoolCaption.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "CoolCaption.hxx" - -// MAKE SURE STYLE IS JUST "TITLE BAR" ! - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CCoolCaption::CCoolCaption() - : m_hfont( NULL ), - m_tszCaption( NULL ), - m_fIsActive( FALSE ), - m_hDlg( NULL ) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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)) - { - SendMessage(m_hDlg, WM_CLOSE, 0, 0); - 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); -} diff --git a/stella/src/win32/StellaX/CoolCaption.hxx b/stella/src/win32/StellaX/CoolCaption.hxx deleted file mode 100644 index 9757143e5..000000000 --- a/stella/src/win32/StellaX/CoolCaption.hxx +++ /dev/null @@ -1,62 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: CoolCaption.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef COOL_CAPTION_HXX -#define COOL_CAPTION_HXX - -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 diff --git a/stella/src/win32/StellaX/FileDialog.cxx b/stella/src/win32/StellaX/FileDialog.cxx deleted file mode 100644 index 663a02804..000000000 --- a/stella/src/win32/StellaX/FileDialog.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// -// 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; -} - - diff --git a/stella/src/win32/StellaX/FileDialog.hxx b/stella/src/win32/StellaX/FileDialog.hxx deleted file mode 100644 index 65dcb4fd7..000000000 --- a/stella/src/win32/StellaX/FileDialog.hxx +++ /dev/null @@ -1,51 +0,0 @@ -// -// 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 \ No newline at end of file diff --git a/stella/src/win32/StellaX/Game.cxx b/stella/src/win32/StellaX/Game.cxx deleted file mode 100755 index 04a764bf7..000000000 --- a/stella/src/win32/StellaX/Game.cxx +++ /dev/null @@ -1,37 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: Game.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "Game.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Game::Game( void ) -{ - _available = false; - _rom = " "; - _md5 = " "; - _name = " "; - _rarity = " "; - _manufacturer = " "; - _note = " "; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Game::~Game( void ) -{ -} diff --git a/stella/src/win32/StellaX/Game.hxx b/stella/src/win32/StellaX/Game.hxx deleted file mode 100755 index 04fa4adab..000000000 --- a/stella/src/win32/StellaX/Game.hxx +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: Game.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef GAME_HXX -#define GAME_HXX - -#include "bspf.hxx" - -/** Hold game info for an Atari2600 game. */ -class Game -{ - public: - Game( void ); - ~Game( void ); - - /** sets the rom of a game */ - void setAvailable( bool available ) { _available = available; } - /** returns the rom of a game */ - bool isAvailable( void ) { return _available; } - - /** sets the rom of a game */ - void setRom( const string& rom ) { _rom = rom; }; - /** returns the rom of a game */ - string rom( void ) const { return _rom; } - - /** sets the md5 sum of a game */ - void setMd5( const string& md5 ) { _md5 = md5; }; - /** returns the md5 sum of a game */ - string md5( void ) const { return _md5; } - - /** sets the name of a game */ - void setName( const string& name ) { _name = name; } - /** returns the name of a game */ - string name( void ) const { return _name; } - - /** sets the rarity of a game */ - void setRarity( const string& rarity ) { _rarity = rarity; } - /** returns the rarity of a game */ - string rarity( void ) const { return _rarity; } - - /** sets the manufacturer of a game */ - void setManufacturer( const string& manufacturer) { _manufacturer = manufacturer; } - /** returns the manufacturer of a game */ - string manufacturer( void ) const { return _manufacturer; } - - /** sets the note of a game */ - void setNote( const string& note ) { _note = note; } - /** returns the note of a game */ - string note( void ) const { return _note; } - - protected: - bool _available; - string _rom; - string _md5; - string _name; - string _rarity; - string _manufacturer; - string _note; -}; - -#endif diff --git a/stella/src/win32/StellaX/GlobalData.cxx b/stella/src/win32/StellaX/GlobalData.cxx deleted file mode 100644 index 4141f0acf..000000000 --- a/stella/src/win32/StellaX/GlobalData.cxx +++ /dev/null @@ -1,42 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: GlobalData.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "resource.h" - -#include "bspf.hxx" -#include "Settings.hxx" -#include "SettingsWin32.hxx" -#include "GlobalData.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CGlobalData::CGlobalData( HINSTANCE hInstance ) - : mySettings(0), - myInstance(hInstance) -{ - mySettings = new SettingsWin32(); - mySettings->loadConfig(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CGlobalData::~CGlobalData() -{ - if(mySettings) - delete mySettings; -} diff --git a/stella/src/win32/StellaX/GlobalData.hxx b/stella/src/win32/StellaX/GlobalData.hxx deleted file mode 100644 index e35245fa8..000000000 --- a/stella/src/win32/StellaX/GlobalData.hxx +++ /dev/null @@ -1,56 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: GlobalData.hxx,v 1.3 2004-07-15 03:03:27 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 ); - - HINSTANCE ModuleInstance( void ) const - { - return myInstance; - } - - Settings& settings( void ) - { - return *mySettings; - } - - private: - Settings* mySettings; - - HINSTANCE myInstance; - - CGlobalData( const CGlobalData& ); // no implementation - void operator=( const CGlobalData& ); // no implementation -}; - -#endif diff --git a/stella/src/win32/StellaX/HeaderCtrl.cxx b/stella/src/win32/StellaX/HeaderCtrl.cxx deleted file mode 100644 index bf92b1b45..000000000 --- a/stella/src/win32/StellaX/HeaderCtrl.cxx +++ /dev/null @@ -1,168 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: HeaderCtrl.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "HeaderCtrl.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CHeaderCtrl::CHeaderCtrl() - : m_nSortCol(0), - m_fSortAsc(TRUE) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam, - LPARAM lParam, BOOL& rfHandled ) -{ - 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 ); -} diff --git a/stella/src/win32/StellaX/HeaderCtrl.hxx b/stella/src/win32/StellaX/HeaderCtrl.hxx deleted file mode 100644 index e356d218f..000000000 --- a/stella/src/win32/StellaX/HeaderCtrl.hxx +++ /dev/null @@ -1,57 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: HeaderCtrl.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef HEADER_CTRL_HXX -#define HEADER_CTRL_HXX - -#include "Wnd.hxx" - -class CHeaderCtrl : public CWnd -{ - public: - CHeaderCtrl(); - - void SetSortCol(int col, 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 diff --git a/stella/src/win32/StellaX/HyperLink.cxx b/stella/src/win32/StellaX/HyperLink.cxx deleted file mode 100644 index 15be531bb..000000000 --- a/stella/src/win32/StellaX/HyperLink.cxx +++ /dev/null @@ -1,334 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: HyperLink.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "HyperLink.hxx" - -#include - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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() -{ - 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; -} diff --git a/stella/src/win32/StellaX/HyperLink.hxx b/stella/src/win32/StellaX/HyperLink.hxx deleted file mode 100644 index 0a133bd73..000000000 --- a/stella/src/win32/StellaX/HyperLink.hxx +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: HyperLink.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef HYPER_LINK_HXX -#define HYPER_LINK_HXX - -#define MAX_HYPERLINK_TEXT_LEN 256 -#define MAX_HYPERLINK_URL 256 - -#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 diff --git a/stella/src/win32/StellaX/MainDlg.cxx b/stella/src/win32/StellaX/MainDlg.cxx deleted file mode 100644 index 3bb998b38..000000000 --- a/stella/src/win32/StellaX/MainDlg.cxx +++ /dev/null @@ -1,876 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: MainDlg.cxx,v 1.10 2004-09-14 19:10:29 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "MainDlg.hxx" -#include "Game.hxx" -#include "GlobalData.hxx" -#include "PropertySheet.hxx" -#include "AboutPage.hxx" -#include "ConfigPage.hxx" -#include "resource.h" -#include "Settings.hxx" -#include "PropsSet.hxx" -#include "MD5.hxx" - -#define BKGND_BITMAP_TOP 64 -#define BKGND_BITMAP_BOTTOM 355 - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MainDlg::MainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance ) - : myGlobalData(rGlobalData), - myHInstance(hInstance) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MainDlg::~MainDlg( void ) -{ - // Just to be safe, make sure we don't have a memory leak - ListView_Clear(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int MainDlg::DoModal( HWND hwndParent ) -{ - return DialogBoxParam( myHInstance, - MAKEINTRESOURCE(IDD), - hwndParent, - StaticDialogFunc, - (LPARAM)this ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL CALLBACK -MainDlg::StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) -{ - MainDlg* pDlg; - - switch ( uMsg ) - { - case WM_INITDIALOG: - pDlg = reinterpret_cast( lParam ); - pDlg->myHwnd = hDlg; - (void)::SetWindowLong( hDlg, DWL_USER, reinterpret_cast( pDlg ) ); - break; - - default: - pDlg = reinterpret_cast( ::GetWindowLong( hDlg, DWL_USER ) ); - if ( pDlg == NULL ) - return FALSE; - break; - } - - return pDlg->DialogFunc( uMsg, wParam, lParam ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL CALLBACK -MainDlg::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( myHwnd, DWL_MSGRESULT, TRUE ); - return TRUE; - - case WM_NCLBUTTONDOWN: - return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) ); - - case WM_CLOSE: - Quit(); - break; - } - - // Message not handled - return FALSE; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL MainDlg::OnInitDialog( void ) -{ - DWORD dwRet; - - HWND hwnd = *this; - - // Set dialog icon - HICON hicon = ::LoadIcon(myHInstance, 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 - myCoolCaption.OnInitDialog( hwnd ); - myHeader.SubclassDlgItem( hwnd, IDC_ROMLIST ); - myAppTitle.SubclassDlgItem( hwnd, IDC_TITLE ); - myPlayButton.SubclassDlgItem( hwnd, IDC_PLAY ); - myReloadButton.SubclassDlgItem( hwnd, IDC_RELOAD ); - myHelpButton.SubclassDlgItem( hwnd, IDC_ABOUT ); - myConfigButton.SubclassDlgItem( hwnd, IDC_CONFIG ); - myExitButton.SubclassDlgItem( hwnd, IDC_EXIT ); - - const int nMaxString = 256; - TCHAR psz[nMaxString + 1]; - - // Initialize the list view - myHwndList = ::GetDlgItem( hwnd, IDC_ROMLIST ); - ASSERT( myHwndList ); - - // LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32 - ::SendMessage( myHwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, - 0, LVS_EX_FULLROWSELECT ); - - RECT rc; - ::GetClientRect( myHwndList, &rc ); - - // Declare the column headings - int columnHeader[] = { IDS_NAME, IDS_MANUFACTURER, IDS_RARITY }; - - // Set the column widths - int columnWidth[3]; - columnWidth[0] = myGlobalData.settings().getInt("namecolwidth"); - columnWidth[1] = myGlobalData.settings().getInt("manufacturercolwidth"); - columnWidth[2] = myGlobalData.settings().getInt("raritycolwidth"); - - // Make sure there are sane values for the column widths - if (columnWidth[0] <= 0 || columnWidth[1] <= 0 || columnWidth[2] <= 0) - { - LONG lTotalWidth = rc.right-rc.left - GetSystemMetrics(SM_CXVSCROLL); - columnWidth[0] = (int) (0.58 * lTotalWidth); - columnWidth[1] = (int) (0.25 * lTotalWidth); - columnWidth[2] = lTotalWidth - columnWidth[0] - columnWidth[1]; - } - - // Set up the column headings - for (int i = 0; i < 3; ++i) - { - LoadString( myHInstance, columnHeader[i], psz, nMaxString ); - - LV_COLUMN lvc; - lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; - lvc.fmt = LVCFMT_LEFT; - lvc.cx = columnWidth[i]; - lvc.pszText = psz; - ListView_InsertColumn( myHwndList, i, &lvc ); - } - - // Update the ROM game list - UpdateRomList(); - - // Set default button - SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 ); - - // return FALSE if SetFocus is called - return TRUE; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL MainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify ) -{ - UNUSED_ALWAYS( hwndCtl ); - UNUSED_ALWAYS( codeNotify ); - - HWND hwnd = *this; - Game* g; - string romfile; - int nItem; - - switch (id) - { - case IDC_PLAY: - nItem = (int)::SendMessage( myHwndList, LVM_GETNEXTITEM, - (WPARAM)-1, MAKELPARAM( LVNI_SELECTED, 0 ) ); - ASSERT( nItem != -1 ); - if ( nItem == -1 ) - { - MessageBox( myHInstance, hwnd, IDS_NO_ITEM_SELECTED ); - return TRUE; - } - - g = (Game*) ListView_GetItemData( myHwndList, nItem ); - romfile = myGlobalData.settings().getString("romdir") + "\\" + g->rom(); - (void)m_stella.PlayROM( romfile, myGlobalData ); - - // Set focus back to the rom list - SetFocus( myHwndList ); - - return TRUE; - break; // case IDC_PLAY - - case IDC_EXIT: - Quit(); - 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 - } - - case IDC_RELOAD: - { - UpdateRomList( true ); - return TRUE; - break; // case IDC_RELOAD - } - } - - return FALSE; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL MainDlg::OnNotify( int idCtrl, LPNMHDR pnmh ) -{ - UNUSED_ALWAYS( idCtrl ); - - switch ( pnmh->code ) - { - case LVN_ITEMCHANGED: - OnItemChanged( (LPNMLISTVIEW)pnmh ); - return TRUE; - - case LVN_COLUMNCLICK: - OnColumnClick( (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; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::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; - } - - Game* g = (Game*)ListView_GetItemData( pnmv->hdr.hwndFrom, pnmv->iItem ); - SetWindowText( hwndNote, g->note().c_str() ); - InvalidateRect( hwnd, &rc, TRUE ); - EnableWindow( GetDlgItem( hwnd, IDC_PLAY ), TRUE ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::OnColumnClick( LPNMLISTVIEW pnmv ) -{ - ListView_SortByColumn( pnmv->hdr.hwndFrom, pnmv->iSubItem ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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 MainDlg::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( myHInstance, 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 MainDlg::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); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::Quit() -{ - // OK, reload the settings to make sure we have the most current ones - myGlobalData.settings().loadConfig(); - - // Save the current sort column - int sortcol = myHeader.GetSortCol(); - myGlobalData.settings().setInt("sortcol", sortcol); - - // Save the column widths - myGlobalData.settings().setInt("namecolwidth", - ListView_GetColWidth( myHwnd, 0 )); - myGlobalData.settings().setInt("manufacturercolwidth", - ListView_GetColWidth( myHwnd, 1 )); - myGlobalData.settings().setInt("raritycolwidth", - ListView_GetColWidth( myHwnd, 2 )); - - // Now, save the settings - myGlobalData.settings().saveConfig(); - - ListView_Clear(); - EndDialog( myHwnd, IDCANCEL ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::UpdateRomList( bool forceReload ) -{ - HWND hwndText; - RECT rc; - TCHAR psz[256 + 1]; - TCHAR pszStatus[256 + 1]; - - // Erase status text - LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256); - wsprintf( psz, pszStatus, 0 ); - hwndText = GetDlgItem( *this, IDC_ROMCOUNT ); - GetWindowRect(hwndText, &rc); - ScreenToClient( *this, (LPPOINT)&rc ); - ScreenToClient( *this, ((LPPOINT)&rc)+1 ); - SetWindowText( hwndText, psz ); - InvalidateRect( *this, &rc, TRUE ); - - // Erase rom path - hwndText = GetDlgItem( *this, IDC_ROMPATH ); - GetWindowRect(hwndText, &rc); - ScreenToClient( *this, (LPPOINT)&rc ); - ScreenToClient( *this, ((LPPOINT)&rc)+1 ); - SetWindowText( hwndText, "" ); - InvalidateRect( *this, &rc, TRUE ); - - // Get the ROM gamelist, either from disk or cache - PopulateRomList( forceReload ); - - // if items added, select first item and enable play button - int nCount = ListView_GetItemCount( myHwndList ); - if (nCount == 0) - EnableWindow(GetDlgItem( *this, IDC_PLAY), FALSE ); - - // Show status text - LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256); - wsprintf( psz, pszStatus, nCount ); - hwndText = GetDlgItem( *this, IDC_ROMCOUNT ); - GetWindowRect(hwndText, &rc); - ScreenToClient( *this, (LPPOINT)&rc ); - ScreenToClient( *this, ((LPPOINT)&rc)+1 ); - SetWindowText( hwndText, psz ); - InvalidateRect( *this, &rc, TRUE ); - - // Show rom path - hwndText = GetDlgItem( *this, IDC_ROMPATH ); - GetWindowRect(hwndText, &rc); - ScreenToClient( *this, (LPPOINT)&rc ); - ScreenToClient( *this, ((LPPOINT)&rc)+1 ); - SetWindowText( hwndText, myGlobalData.settings().getString("romdir").c_str() ); - InvalidateRect( *this, &rc, TRUE ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool MainDlg::PopulateRomList( bool forceReload ) -{ - bool result = false; - bool cacheFileExists = myGlobalData.settings().fileExists("stellax.cache"); - bool cacheIsStale = false; // FIXME - add romdir status checking - - if (forceReload) - result = LoadRomListFromDisk(); - else if (cacheFileExists && !cacheIsStale) - { - result = LoadRomListFromCache(); - if (!result) - { - MessageBox( myHInstance, myHwnd, IDS_CORRUPT_CACHE_FILE ); - result = LoadRomListFromDisk(); - } - } - else - { - if (!cacheFileExists) - MessageBox( myHInstance, myHwnd, IDS_NO_CACHE_FILE ); - else if (cacheIsStale) - MessageBox( myHInstance, myHwnd, IDS_ROMDIR_CHANGED ); - - result = LoadRomListFromDisk(); - } - - ListView_SortByColumn( myHwndList, myGlobalData.settings().getInt("sortcol") ); - return result; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool MainDlg::LoadRomListFromDisk() -{ - ListView_Clear(); - - // Get the location of the romfiles (*.bin) - string romdir = myGlobalData.settings().getString("romdir"); - romdir += "\\"; - string romfiles = romdir + "*"; - - WIN32_FIND_DATA ffd; - HANDLE hFind = FindFirstFile( romfiles.c_str(), &ffd ); - - ListView_SetItemCount( myHwndList, 100 ); - - int iItem = 0; - bool done = (hFind == INVALID_HANDLE_VALUE); - while(!done) - { - // Make sure we're only looking at files - if( !(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) - { - Game* g = new Game(); - if( g == NULL ) - return false; - - LV_ITEM lvi; - lvi.mask = LVIF_TEXT | LVIF_PARAM; - lvi.iItem = iItem++; - lvi.iSubItem = 0; - lvi.pszText = ""; - lvi.lParam = (LPARAM) g; - int nItem = ListView_InsertItem( myHwndList, &lvi ); - - g->setAvailable( true ); - g->setRom( ffd.cFileName ); - - // Set the name (shown onscreen) to be the rom - // It will be overwritten later if a name is found in the properties set - g->setName( ffd.cFileName ); - } - - // go to the next rom file - done = !FindNextFile(hFind, &ffd); - } - - if( hFind != INVALID_HANDLE_VALUE ) - VERIFY( ::FindClose( hFind ) ); - - // Create a propertiesset object and load the properties - // We don't create the propsSet until we need it, since it's - // a time-consuming process - PropertiesSet propsSet; - string theProperties = myGlobalData.settings().propertiesInputFilename(); - if(theProperties != "") - propsSet.load(theProperties, true); - else - propsSet.load("", false); - - // Now, rescan the items in the listview and update the onscreen - // text and game properties - // Also generate a cache file so the program will start faster next time - ofstream cache("stellax.cache"); - int count = ListView_GetItemCount( myHwndList ); - cache << count << endl; - for (int i = 0; i < count; ++i) - { - Game* g = (Game*) ListView_GetItemData(myHwndList, i); - - // Get the MD5sum for this rom - // Use it to lookup the rom in the properties set - string rom = romdir + g->rom(); - ifstream in(rom.c_str(), ios_base::binary); - if(!in) - continue; - uInt8* image = new uInt8[512 * 1024]; - in.read((char*)image, 512 * 1024); - uInt32 size = in.gcount(); - in.close(); - string md5 = MD5( image, size ); - delete[] image; - - // Get the properties for this rom - Properties props; - propsSet.getMD5( md5, props ); - - // For some braindead reason, the ListView_SetItemText won't - // allow std::string::c_str(), so we create C-strings instead - char name[256], manufacturer[256], rarity[256]; - strncpy(name, props.get("Cartridge.Name").c_str(), 255); - strncpy(manufacturer, props.get("Cartridge.Manufacturer").c_str(), 255); - strncpy(rarity, props.get("Cartridge.Rarity").c_str(), 255); - - // Make sure the onscreen 'Name' field isn't blank - if(props.get("Cartridge.Name") == "Untitled") - strncpy(name, g->name().c_str(), 255); - - // Update the current game - g->setMd5( md5 ); - g->setName( name ); - g->setRarity( rarity ); - g->setManufacturer( manufacturer ); - g->setNote( props.get("Cartridge.Note") ); - - // Update the cachefile with this game - cache << g->rom() << endl - << md5 << endl - << name << endl - << rarity << endl - << manufacturer << endl - << g->note() << endl; - - // Finally, update the listview itself - ListView_SetItemText( myHwndList, i, 0, name ); - ListView_SetItemText( myHwndList, i, 1, manufacturer ); - ListView_SetItemText( myHwndList, i, 2, rarity ); - } - cache.close(); - SetFocus( myHwndList ); - - return true; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool MainDlg::LoadRomListFromCache() -{ - ListView_Clear(); - char count[10], rom[256], md5[256], name[256], rarity[256], - manufacturer[256], note[256]; - - // We don't scan the roms at all; just load directly from the cache file - ifstream in("stellax.cache"); - if (!in) - return false; - - in.getline(count, 9); - int numRoms = atoi(count); - ListView_SetItemCount( myHwndList, 100 ); - - int iItem = 0; - for(int i = 0; i < numRoms; i++) - { - string line; - Game* g = new Game(); - if( g == NULL ) - return false; - - // Get the data from the cache file - in.getline(rom, 255); - in.getline(md5, 255); - in.getline(name, 255); - in.getline(rarity, 255); - in.getline(manufacturer, 255); - in.getline(note, 255); - - // And save it to this game object - g->setAvailable( true ); - g->setRom( rom ); - g->setMd5( md5 ); - g->setName( name ); - g->setRarity( rarity ); - g->setManufacturer( manufacturer ); - g->setNote( note ); - - LV_ITEM lvi; - lvi.mask = LVIF_TEXT | LVIF_PARAM; - lvi.iItem = iItem++; - lvi.iSubItem = 0; - lvi.pszText = ""; - lvi.lParam = (LPARAM) g; - int nItem = ListView_InsertItem( myHwndList, &lvi ); - - ASSERT( nItem != -1 ); - - ListView_SetItemText( myHwndList, nItem, 0, name ); - ListView_SetItemText( myHwndList, nItem, 1, manufacturer ); - ListView_SetItemText( myHwndList, nItem, 2, rarity ); - } - SetFocus( myHwndList ); - - return true; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Cool caption message handlers -void MainDlg::OnDestroy( void ) -{ - myCoolCaption.OnDestroy(); - - if ( m_hfontRomNote ) - { - DeleteObject( m_hfontRomNote ); - m_hfontRomNote = NULL; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::OnNcPaint( HRGN hrgn ) -{ - myCoolCaption.OnNcPaint( hrgn ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::OnNcActivate( BOOL fActive ) -{ - myCoolCaption.OnNcActivate( fActive ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL MainDlg::OnNcLButtonDown( INT nHitTest, POINTS pts ) -{ - return myCoolCaption.OnNCLButtonDown( nHitTest, pts ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -LPARAM MainDlg::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; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::ListView_SortByColumn( HWND hwndList, int col ) -{ - HCURSOR hcur = SetCursor(LoadCursor(NULL, IDC_WAIT)); - - int nCount = ListView_GetItemCount( hwndList ); - if (nCount != 0) - { - myHeader.SetSortCol( col, TRUE ); - ListView_SortItems( hwndList, ListViewCompareFunc, (LPARAM)this ); - ListView_SetItemState( hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED, - LVIS_SELECTED | LVIS_FOCUSED ); - } - - // ensure the selected item is visible - int nItem = ListView_GetNextItem( myHwndList, -1, LVNI_SELECTED ); - if (nItem != -1) - ListView_EnsureVisible( myHwndList, nItem, TRUE ); - - SetCursor(hcur); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int MainDlg::ListView_GetColWidth( HWND hwndList, int col ) -{ - // Although there seems to be a similar function in the Win32 API - // to do this, I couldn't get it to work, so it's quicker to - // write this one and use it ... - LV_COLUMN lvc; - lvc.mask = LVCF_WIDTH; - if (ListView_GetColumn( myHwndList, col, &lvc ) == TRUE) - return lvc.cx; - else - return 0; // the next time StellaX starts, it will recreate a sane value -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::ListView_Clear( void ) -{ - int nCount = ListView_GetItemCount( myHwndList ); - - for (int i = 0; i < nCount; ++i) - delete (Game*) ListView_GetItemData( myHwndList, i ); - - ListView_DeleteAllItems( myHwndList ); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int CALLBACK -MainDlg::ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort ) -{ - MainDlg* dlg = reinterpret_cast( lParamSort ); - - int sortCol = dlg->myHeader.GetSortCol(); - - Game* g1 = reinterpret_cast( lParam1 ); - Game* g2 = reinterpret_cast( lParam2 ); - - string s1 = "", s2 = ""; - switch (sortCol) - { - case 0: - s1 = g1->name(); - s2 = g2->name(); - break; - - case 1: - s1 = g1->manufacturer(); - s2 = g2->manufacturer(); - break; - - case 2: - s1 = g1->rarity(); - s2 = g2->rarity(); - break; - } - - if (s1 > s2) - return 1; - else if (s1 < s2) - return -1; - else - return 0; -} diff --git a/stella/src/win32/StellaX/MainDlg.hxx b/stella/src/win32/StellaX/MainDlg.hxx deleted file mode 100644 index 45070872b..000000000 --- a/stella/src/win32/StellaX/MainDlg.hxx +++ /dev/null @@ -1,101 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: MainDlg.hxx,v 1.6 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef MAIN_DLG_HXX -#define MAIN_DLG_HXX - -#include "resource.h" - -class CGlobalData; - -#include "StellaXMain.hxx" -#include "CoolCaption.hxx" -#include "TextButton3d.hxx" -#include "HeaderCtrl.hxx" -#include "RoundButton.hxx" - -class MainDlg -{ - public: - enum { IDD = IDD_MAIN }; - - MainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance ); - virtual ~MainDlg( void ); - - virtual int DoModal( HWND hwndParent ); - - operator HWND( void ) const { return myHwnd; } - - private: - HWND myHwnd; - - CCoolCaption myCoolCaption; - CTextButton3d myAppTitle; - CHeaderCtrl myHeader; - CRoundButton myPlayButton; - CRoundButton myHelpButton; - CRoundButton myReloadButton; - CRoundButton myConfigButton; - CRoundButton myExitButton; - - // 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 OnItemChanged( LPNMLISTVIEW pnmv ); - void OnColumnClick( LPNMLISTVIEW pnmv ); - - // cool caption handlers - void OnDestroy( void ); - void OnNcPaint( HRGN hrgn ); - void OnNcActivate( BOOL fActive ); - void Quit(); - 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 - void UpdateRomList( bool forceReload = false ); - bool PopulateRomList( bool forceReload = false ); - bool LoadRomListFromDisk(); - bool LoadRomListFromCache(); - - HINSTANCE myHInstance; - - HWND myHwndList; - LPARAM ListView_GetItemData( HWND hwndList, int iItem ); - void ListView_SortByColumn( HWND hwndList, int col ); - int ListView_GetColWidth( HWND hwndList, int col ); - void ListView_Clear(); - - HFONT m_hfontRomNote; - - // Stella stuff - CGlobalData& myGlobalData; - CStellaXMain m_stella; -}; - -#endif diff --git a/stella/src/win32/StellaX/PropertySheet.cxx b/stella/src/win32/StellaX/PropertySheet.cxx deleted file mode 100644 index 341fc1499..000000000 --- a/stella/src/win32/StellaX/PropertySheet.cxx +++ /dev/null @@ -1,233 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: PropertySheet.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "PropertySheet.hxx" - -#pragma comment(lib, "comctl32") -#include - -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 - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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( - reinterpret_cast( lParam )->lParam ); - (void)::SetWindowLong( hwnd, DWL_USER, reinterpret_cast( pPage ) ); - break; - - default: - pPage = reinterpret_cast( 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( 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() -{ - 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; -} diff --git a/stella/src/win32/StellaX/PropertySheet.hxx b/stella/src/win32/StellaX/PropertySheet.hxx deleted file mode 100644 index 7510c919c..000000000 --- a/stella/src/win32/StellaX/PropertySheet.hxx +++ /dev/null @@ -1,92 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: PropertySheet.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef PROPERTY_SHEET_HXX -#define PROPERTY_SHEET_HXX - -#include -#include -#include - -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() -{ - 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 m_pages; - std::string m_strCaption; - - CPropertySheet( const CPropertySheet& ); // no implementation - void operator=( const CPropertySheet& ); // no implementation -}; - -#endif diff --git a/stella/src/win32/StellaX/RoundButton.cxx b/stella/src/win32/StellaX/RoundButton.cxx deleted file mode 100644 index 8815c6072..000000000 --- a/stella/src/win32/StellaX/RoundButton.cxx +++ /dev/null @@ -1,553 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: RoundButton.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "RoundButton.hxx" -#include -#include - -// 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 ); -} diff --git a/stella/src/win32/StellaX/RoundButton.hxx b/stella/src/win32/StellaX/RoundButton.hxx deleted file mode 100644 index 16a51f69a..000000000 --- a/stella/src/win32/StellaX/RoundButton.hxx +++ /dev/null @@ -1,50 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: RoundButton.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef ROUND_BUTTON_HXX -#define ROUND_BUTTON_HXX - -#include "Wnd.hxx" - -class CRoundButton : public CWnd -{ - public: - 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 diff --git a/stella/src/win32/StellaX/StellaX.aps b/stella/src/win32/StellaX/StellaX.aps deleted file mode 100644 index efb432826..000000000 Binary files a/stella/src/win32/StellaX/StellaX.aps and /dev/null differ diff --git a/stella/src/win32/StellaX/StellaX.ico b/stella/src/win32/StellaX/StellaX.ico deleted file mode 100644 index f5d8e9433..000000000 Binary files a/stella/src/win32/StellaX/StellaX.ico and /dev/null differ diff --git a/stella/src/win32/StellaX/StellaX.rc b/stella/src/win32/StellaX/StellaX.rc deleted file mode 100644 index 663bd172f..000000000 --- a/stella/src/win32/StellaX/StellaX.rc +++ /dev/null @@ -1,302 +0,0 @@ -// 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,2,0 - PRODUCTVERSION 1,4,2,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 (sa666_666@hotmail.com)" - VALUE "FileDescription", "StellaX" - VALUE "FileVersion", "1, 4, 2, 0" - VALUE "InternalName", "StellaX" - VALUE "LegalCopyright", "Copyright (C) 2000 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, 2, 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,149,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)\nUpdated by Stephen Anthony (sa666_666@hotmail.com)\nStella core by Bradford W. Mott (bwmott@acm.org)", - IDC_STATIC_TEXT,175,7,227,28,SS_NOPREFIX - RTEXT "",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.2",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,105,205,297,8 - LTEXT "Game notes (if available):",-1,7,205,98,8 - CONTROL "&Reload",IDC_RELOAD,"Button",BS_OWNERDRAW | WS_TABSTOP, - 172,226,54,16 -END - -IDD_ABOUT_PAGE DIALOGEX 0, 0, 299, 86 -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,284,30,SS_NOPREFIX - LTEXT "If you have a question or a problem, please try one of these contacts:", - -1,7,44,284,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,60,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 - CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,37,284,1 -END - -IDD_CONFIG_PAGE DIALOGEX 0, 0, 267, 174 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Options" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "File Locations",IDC_STATIC,7,7,254,39 - LTEXT "ROM Directory:",IDC_STATIC,14,25,55,8 - EDITTEXT IDC_ROMPATH,67,23,171,13,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_BROWSE,241,23,13,12 - GROUPBOX "Snapshot Settings",IDC_STATIC,7,49,148,43 - LTEXT "Save Snapshot as:",IDC_STATIC,14,61,67,10 - COMBOBOX IDC_SNAPSHOT_TYPE,86,60,60,37,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Generate multiple snapshots",IDC_SNAPSHOT_MULTIPLE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,75,109,11 - GROUPBOX "Paddle Emulation",IDC_STATIC,161,49,100,43 - LTEXT "Mouse is paddle:",IDC_STATIC,167,61,65,8 - COMBOBOX IDC_PADDLE,225,60,30,82,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - GROUPBOX "Video Settings",IDC_STATIC,7,97,118,71 - LTEXT "Renderer:",IDC_STATIC,14,108,43,10 - COMBOBOX IDC_VIDEO,62,106,52,35,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - LTEXT "Aspect Ratio:",IDC_STATIC,14,136,50,10 - EDITTEXT IDC_GL_ASPECT,62,134,51,12,ES_AUTOHSCROLL - CONTROL "Maximize FS OpenGL",IDC_GL_FSMAX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,21,152,86,12 - GROUPBOX "Sound Settings",IDC_STATIC,132,97,96,57 - LTEXT "Volume:",IDC_STATIC,140,108,28,8 - EDITTEXT IDC_SOUND_VOLUME,176,106,29,12,ES_AUTOHSCROLL - CONTROL "",IDC_SOUND_VOLUME_SPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | - UDS_ARROWKEYS,205,106,11,12 - LTEXT "Frag Size:",IDC_STATIC,140,122,36,8 - COMBOBOX IDC_SOUND_FRAGSIZE,176,120,41,51,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Disable &Sound",IDC_SOUND_ENABLE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,147,135,62,10 - LTEXT "Driver:",IDC_STATIC,15,122,46,9 - COMBOBOX IDC_VIDEO_DRIVER,62,120,52,31,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 402 - TOPMARGIN, 7 - BOTTOMMARGIN, 242 - END - - IDD_ABOUT_PAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 291 - TOPMARGIN, 7 - BOTTOMMARGIN, 78 - END - - IDD_CONFIG_PAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 260 - TOPMARGIN, 7 - BOTTOMMARGIN, 168 - 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_NO_CACHE_FILE "No ROM cache file was found. Regenerating the cache will take some time." - IDS_CORRUPT_CACHE_FILE "The ROM cache file was corrupt. Regenerating the cache will take some time." - IDS_ROMDIR_CHANGED "The ROM directory has changed. The ROM cache will be regenerated." -END - -STRINGTABLE -BEGIN - IDS_ALREADYRUNNING "StellaX is already running!" -END - -STRINGTABLE -BEGIN - IDS_FILENAME "Filename" - IDS_MANUFACTURER "Manufacturer" - IDS_NAME "Name" - IDS_RARITY "Rarity" -END - -STRINGTABLE -BEGIN - 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 - diff --git a/stella/src/win32/StellaX/StellaX.vcproj b/stella/src/win32/StellaX/StellaX.vcproj deleted file mode 100644 index 7214549f6..000000000 --- a/stella/src/win32/StellaX/StellaX.vcproj +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/win32/StellaX/StellaXMain.cxx b/stella/src/win32/StellaX/StellaXMain.cxx deleted file mode 100644 index f5edc7061..000000000 --- a/stella/src/win32/StellaX/StellaXMain.cxx +++ /dev/null @@ -1,60 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: StellaXMain.cxx,v 1.5 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include -#include -#include -#include -#include - -#include "GlobalData.hxx" -#include "Settings.hxx" -#include "pch.hxx" -#include "StellaXMain.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CStellaXMain::CStellaXMain() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CStellaXMain::~CStellaXMain() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CStellaXMain::PlayROM( string& romfile, CGlobalData& globaldata ) -{ - ostringstream buf; - - // Make sure the specfied ROM exists - if(!globaldata.settings().fileExists(romfile)) - { - buf << "\"" << romfile << "\" doesn't exist"; - - MessageBox( NULL, buf.str().c_str(), "Unknown ROM", MB_ICONEXCLAMATION|MB_OK); - return; - } - - // Assume that the ROM file does exist, attempt to run external Stella - // Since all settings are saved to the stella.ini file, we don't need - // to pass any arguments here ... - buf << "\"" << romfile << "\""; - ShellExecute(NULL, "open", "stella.exe", buf.str().c_str(), NULL, 0); -} diff --git a/stella/src/win32/StellaX/StellaXMain.hxx b/stella/src/win32/StellaX/StellaXMain.hxx deleted file mode 100644 index 0bcbb5f52..000000000 --- a/stella/src/win32/StellaX/StellaXMain.hxx +++ /dev/null @@ -1,40 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: StellaXMain.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef STELLAX_MAIN_HXX -#define STELLAX_MAIN_HXX - -#include "bspf.hxx" - -class CGlobalData; - -class CStellaXMain -{ - public: - CStellaXMain(); - ~CStellaXMain(); - - void PlayROM( string& romfile, CGlobalData& globaldata ); - - private: - CStellaXMain( const CStellaXMain& ); // no implementation - void operator=( const CStellaXMain& ); // no implementation -}; - -#endif diff --git a/stella/src/win32/StellaX/TextButton3d.cxx b/stella/src/win32/StellaX/TextButton3d.cxx deleted file mode 100644 index 6a4499da8..000000000 --- a/stella/src/win32/StellaX/TextButton3d.cxx +++ /dev/null @@ -1,178 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: TextButton3d.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "TextButton3d.hxx" - -// button style should be VISIBLE / DISABLED / OWNERDRAW - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CTextButton3d::CTextButton3d() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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; -} diff --git a/stella/src/win32/StellaX/TextButton3d.hxx b/stella/src/win32/StellaX/TextButton3d.hxx deleted file mode 100644 index 2f97b0410..000000000 --- a/stella/src/win32/StellaX/TextButton3d.hxx +++ /dev/null @@ -1,43 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: TextButton3d.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef TEXT_BUTTON_HXX -#define TEXT_BUTTON_HXX - -// derived from Roger Onslow's code - -#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 diff --git a/stella/src/win32/StellaX/Wnd.cxx b/stella/src/win32/StellaX/Wnd.cxx deleted file mode 100644 index 3bbaea385..000000000 --- a/stella/src/win32/StellaX/Wnd.cxx +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: Wnd.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "Wnd.hxx" - -// REVIEW: Need to reset old wnd proc? - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CWnd::CWnd() - : m_pOldWindowProc(NULL), - m_hwnd(NULL) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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 ); -} diff --git a/stella/src/win32/StellaX/Wnd.hxx b/stella/src/win32/StellaX/Wnd.hxx deleted file mode 100644 index 131278aa6..000000000 --- a/stella/src/win32/StellaX/Wnd.hxx +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: Wnd.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef WND_HXX -#define WND_HXX - -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 diff --git a/stella/src/win32/StellaX/debug.cxx b/stella/src/win32/StellaX/debug.cxx deleted file mode 100644 index c1926606d..000000000 --- a/stella/src/win32/StellaX/debug.cxx +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: debug.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "debug.hxx" - -#ifdef _DEBUG // entire file - -// log file name (or NULL for no log) -- must be defined by client - -extern LPCTSTR g_ctszDebugLog; - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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 diff --git a/stella/src/win32/StellaX/debug.hxx b/stella/src/win32/StellaX/debug.hxx deleted file mode 100644 index 9a79ccd33..000000000 --- a/stella/src/win32/StellaX/debug.hxx +++ /dev/null @@ -1,111 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: debug.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef _AFX -#define _AFX - -#include -#include - -// --------------------------------------------------------------------------- -// 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 - -#include -#include - -#include - -#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 diff --git a/stella/src/win32/StellaX/main.cxx b/stella/src/win32/StellaX/main.cxx deleted file mode 100644 index 92e5ec5cd..000000000 --- a/stella/src/win32/StellaX/main.cxx +++ /dev/null @@ -1,94 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: main.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include "resource.h" - -#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 -}; - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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 - MainDlg dlg( globaldata, hInstance ); - dlg.DoModal( NULL ); - - if ( hrCoInit == S_OK ) - ::CoUninitialize(); - - return 0; -} diff --git a/stella/src/win32/StellaX/pch.cxx b/stella/src/win32/StellaX/pch.cxx deleted file mode 100644 index c275fa106..000000000 --- a/stella/src/win32/StellaX/pch.cxx +++ /dev/null @@ -1,75 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: pch.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#include "pch.hxx" -#include -#include - -#include "resource.h" - -// Bring in the common control library -#pragma comment( lib, "comctl32" ) - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -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 ); -} diff --git a/stella/src/win32/StellaX/pch.hxx b/stella/src/win32/StellaX/pch.hxx deleted file mode 100644 index 6f88160aa..000000000 --- a/stella/src/win32/StellaX/pch.hxx +++ /dev/null @@ -1,60 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll XX XX -// SS SS tt ll ll XX XX -// SS tttttt eeee ll ll aaaa XX XX -// SSSS tt ee ee ll ll aa XXX -// SS tt eeeeee ll ll aaaaa XX XX -// SS SS tt ee ll ll aa aa XX XX -// SSSS ttt eeeee llll llll aaaaa XX XX -// -// Copyright (c) 1995-2000 by Jeff Miller -// Copyright (c) 2004 by Stephen Anthony -// -// See the file "license" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id: pch.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $ -//============================================================================ - -#ifndef PCH_HXX -#define PCH_HXX - -#define WIN32_LEAN_AND_MEAN -#define DIRECTINPUT_VERSION 5 - -#include -#include -#include - -#include -#include -#include - -#include - -#include "debug.hxx" - -// --------------------------------------------------------------------------- -// Conditional defines - -// Macros -// - -#ifdef _DEBUG -#define UNUSED(x) -#else -#define UNUSED(x) x -#endif -#define UNUSED_ALWAYS(x) x - -// Utility methods -// - -void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText ); - -void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ ); - -void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ ); - -#endif diff --git a/stella/src/win32/StellaX/resource.h b/stella/src/win32/StellaX/resource.h deleted file mode 100644 index 9b18c26b0..000000000 --- a/stella/src/win32/StellaX/resource.h +++ /dev/null @@ -1,78 +0,0 @@ -//{{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_CONFIG_PAGE 108 -#define IDS_ALREADYRUNNING 200 -#define IDS_CANTOPEN 204 -#define IDS_CW_FAILED 208 -#define IDS_FATALERROR 275 -#define IDS_FILENAME 277 -#define IDS_MANUFACTURER 278 -#define IDS_NAME 280 -#define IDS_OUTOFMEMORY 283 -#define IDS_RARITY 284 -#define IDS_STATUSTEXT 289 -#define IDS_STELLA 290 -#define IDS_UNKNOWNERROR 291 -#define IDS_NO_CACHE_FILE 291 -#define IDS_DEBUGBUILD 292 -#define IDS_CORRUPT_CACHE_FILE 292 -#define IDS_ROMDIR_CHANGED 293 -#define IDS_COINIT_FAILED 296 -#define IDS_ASS_FAILED 297 -#define IDS_PAS_FAILED 298 -#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_TEXT 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_CONFIG2 1016 -#define IDC_PADDLE 1017 -#define IDC_VOLUME 1019 -#define IDC_BROWSE 1022 -#define IDC_EDIT2 1027 -#define IDC_RELOAD 1028 -#define IDC_SNAPSHOT_TYPE 1029 -#define IDC_SNAPSHOT_LOCATION 1030 -#define IDC_SNAPSHOT_MULTIPLE 1031 -#define IDC_SOUND_ENABLE 1032 -#define IDC_SOUND_VOLUME 1033 -#define IDC_LIST1 1033 -#define IDC_VIDEO 1034 -#define IDC_GL_ASPECT 1035 -#define IDC_GL_FSMAX 1036 -#define IDC_SOUND_VOLUME_SPIN 1044 -#define IDC_SOUND_FRAGSIZE 1045 -#define IDC_TAB1 1046 -#define IDC_VIDEO_DRIVER 1047 -#define IDC_COMBO1 1047 -#define ID_FILE_EXIT 32771 -#define IDC_STATIC -1 - -// 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 1048 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/stella/src/win32/StellaX/tile.bmp b/stella/src/win32/StellaX/tile.bmp deleted file mode 100644 index ec6faadf9..000000000 Binary files a/stella/src/win32/StellaX/tile.bmp and /dev/null differ