Commit 17e7653f authored by stephena's avatar stephena
Browse files

Added some message boxes wrt the loading of the ROM cache file.

Various code cleanups.  I REALLY HATE Hungarian notation.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@317 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
parent 20408dca
......@@ -14,7 +14,7 @@
// 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.5 2004-07-11 22:04:22 stephena Exp $
// $Id: MainDlg.cxx,v 1.6 2004-07-15 00:11:06 stephena Exp $
//============================================================================
#include "pch.hxx"
......@@ -103,7 +103,7 @@ MainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
break;
case WM_INITDIALOG:
return OnInitDialog( );
return OnInitDialog();
case WM_NOTIFY:
return OnNotify( (int)wParam, (LPNMHDR)lParam );
......@@ -118,7 +118,7 @@ MainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
// Cool caption handlers
case WM_DESTROY:
OnDestroy( );
OnDestroy();
break;
case WM_DRAWITEM:
......@@ -179,7 +179,7 @@ BOOL MainDlg::OnInitDialog( void )
::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 );
// Do subclassing
m_CoolCaption.OnInitDialog( hwnd );
myCoolCaption.OnInitDialog( hwnd );
myHeader.SubclassDlgItem( hwnd, IDC_ROMLIST );
myAppTitle.SubclassDlgItem( hwnd, IDC_TITLE );
myPlayButton.SubclassDlgItem( hwnd, IDC_PLAY );
......@@ -487,8 +487,7 @@ void MainDlg::UpdateRomList( void )
HWND hwndText;
RECT rc;
if ( !PopulateRomList() )
MessageBoxFromWinError( 0, _T("PopulateRomList") );
PopulateRomList();
// if items added, select first item and enable play button
int nCount = ListView_GetItemCount( myHwndList );
......@@ -521,12 +520,26 @@ bool MainDlg::PopulateRomList( void )
{
bool result = false;
bool cacheFileExists = myGlobalData.settings().fileExists("stellax.cache");
bool cacheIsStale = false; // FIXME
bool cacheIsStale = false; // FIXME - add romdir status checking
if(cacheFileExists && !cacheIsStale)
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;
......@@ -718,42 +731,33 @@ bool MainDlg::LoadRomListFromCache()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Cool caption message handlers
void MainDlg::OnDestroy(
void
)
void MainDlg::OnDestroy( void )
{
m_CoolCaption.OnDestroy();
myCoolCaption.OnDestroy();
if ( m_hfontRomNote )
{
::DeleteObject( m_hfontRomNote );
m_hfontRomNote = NULL;
}
if ( m_hfontRomNote )
{
DeleteObject( m_hfontRomNote );
m_hfontRomNote = NULL;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::OnNcPaint(
HRGN hrgn
)
void MainDlg::OnNcPaint( HRGN hrgn )
{
m_CoolCaption.OnNcPaint( hrgn );
myCoolCaption.OnNcPaint( hrgn );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::OnNcActivate(
BOOL fActive
)
void MainDlg::OnNcActivate( BOOL fActive )
{
m_CoolCaption.OnNcActivate( fActive );
myCoolCaption.OnNcActivate( fActive );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL MainDlg::OnNcLButtonDown(
INT nHitTest,
POINTS pts
)
BOOL MainDlg::OnNcLButtonDown( INT nHitTest, POINTS pts )
{
return m_CoolCaption.OnNCLButtonDown( nHitTest, pts );
return myCoolCaption.OnNCLButtonDown( nHitTest, pts );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......
......@@ -14,7 +14,7 @@
// 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.4 2004-07-11 22:04:22 stephena Exp $
// $Id: MainDlg.hxx,v 1.5 2004-07-15 00:11:07 stephena Exp $
//============================================================================
#ifndef __MAINDLG_H_
......@@ -46,7 +46,7 @@ class MainDlg
private:
HWND myHwnd;
CCoolCaption m_CoolCaption;
CCoolCaption myCoolCaption;
CTextButton3d myAppTitle;
CHeaderCtrl myHeader;
CRoundButton myPlayButton;
......
......@@ -259,6 +259,9 @@ 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
......
......@@ -20,7 +20,10 @@
#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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment