- Games play now when double-clicked in list

Hi there!

Check Cyberstella/ReadMe.txt for my current ToDo list.
Feel free to add/edit/remove/suggest :-)
When the *urgent* stuff is done, Cyberstella is ready to be released.

Main problem at the moment is: Window does neither send me the
ItemActivate message when ENTER is pressed, nor do WM_KEYDOWN
messages come through when the ENTER key is pressed. Hm...

Any ideas appreciated... :-)

(Not really a bug, as you can start games via menu, toolbar and
direct doubleclick now, but it should do on ENTER too, I'd say...)

Greetings,
     Manuel


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@86 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
gunfight 2002-04-30 09:20:20 +00:00
parent 312d234755
commit 6fef5ab191
4 changed files with 39 additions and 36 deletions

View File

@ -53,7 +53,6 @@ CCyberstellaView::CCyberstellaView()
//{{AFX_DATA_INIT(CCyberstellaView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pGlobalData = new CGlobalData(GetModuleHandle(NULL));
m_bIsPause = false;
m_pPropertiesSet = NULL;
@ -95,17 +94,8 @@ void CCyberstellaView::OnInitialUpdate()
status.Format(IDS_STATUSTEXT, m_List.GetItemCount());
SetDlgItemText(IDC_ROMCOUNT,status);
//
// Show rom path
//
//ToDo: SetDlgItemText(IDC_ROMPATH, m_pGlobalData->romDir);
//
// Set default button
//
::SendMessage( *this, DM_SETDEFID, IDC_PLAY, 0 );
}
/////////////////////////////////////////////////////////////////////////////
@ -405,9 +395,7 @@ void CCyberstellaView::Initialize()
m_List.SetImageList (&m_imglist, LVSIL_SMALL);
// Init ListCtrl
m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT);
m_List.insertColumns();
m_List.setPropertiesSet(m_pPropertiesSet);
m_List.init(m_pPropertiesSet,this);
// Try to load the file stella.pro file
string filename( "stella.pro" );

View File

@ -18,7 +18,7 @@ static char THIS_FILE[] = __FILE__;
GameList::GameList()
: rs("GameList")
{
rs.Bind(path, "ROM Path", "");
rs.Bind(m_Path, "ROM Path", "");
}
GameList::~GameList()
@ -29,6 +29,7 @@ BEGIN_MESSAGE_MAP(GameList, CListCtrl)
//{{AFX_MSG_MAP(GameList)
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
ON_NOTIFY_REFLECT(LVN_ITEMACTIVATE, OnItemActivate)
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -111,7 +112,7 @@ void GameList::populateRomList()
deleteItemsAndProperties();
// Add new content
if(path.GetLength() > 0)
if(m_Path.GetLength() > 0)
{
displayPath();
}
@ -137,10 +138,10 @@ void GameList::displayPath()
BOOL first = true;
// Do pathname
if (path.GetAt(path.GetLength()-1) == '\\')
searchpath = path + "*.*";
if (m_Path.GetAt(m_Path.GetLength()-1) == '\\')
searchpath = m_Path + "*.*";
else
searchpath = path + "\\*.*";
searchpath = m_Path + "\\*.*";
bFind = find.FindFile(searchpath);
@ -235,7 +236,7 @@ void GameList::displayDrives()
int itemCounter;
// Clear path
path = "";
m_Path = "";
//Enumerate drive letters and add them to list
dwDrives = GetLogicalDrives();
@ -284,28 +285,34 @@ void GameList::OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult)
if(strcmpi(props->get("Cartridge.Type").c_str(), "Dots") == 0)
{
int cutPos = path.ReverseFind('\\');
path = path.Left(cutPos);
int cutPos = m_Path.ReverseFind('\\');
m_Path = m_Path.Left(cutPos);
populateRomList();
}
else if(strcmpi(props->get("Cartridge.Type").c_str(), "Directory") == 0)
{
// Do pathname
if (path.GetLength() <= 0)
if (m_Path.GetLength() <= 0)
{
path = dir;
m_Path = dir;
}
else if (path.GetAt(path.GetLength()-1) != '\\')
else if (m_Path.GetAt(m_Path.GetLength()-1) != '\\')
{
path += "\\";
path += dir;
m_Path += "\\";
m_Path += dir;
}
else
{
path += dir;
m_Path += dir;
}
populateRomList();
}
else
{
// Notify parent to play the current game by
// sending a faked 'Play Button Pressed' message.
if (m_pParent) m_pParent->PostMessage(WM_COMMAND, BN_CLICKED | IDC_PLAY);
}
}
*pResult = 0;
}
@ -357,10 +364,10 @@ CString GameList::getCurrentFile()
int curSel = GetSelectionMark();
if(curSel >= 0)
{
if (path.GetAt(path.GetLength()-1) != '\\')
path += "\\";
if (m_Path.GetAt(m_Path.GetLength()-1) != '\\')
m_Path += "\\";
filename = path + GetItemText(curSel,0);
filename = m_Path + GetItemText(curSel,0);
}
return filename;
@ -376,3 +383,11 @@ CString GameList::getCurrentName()
return "";
}
void GameList::init(PropertiesSet* newPropertiesSet, CWnd* newParent)
{
m_pParent = newParent;
m_pPropertiesSet = newPropertiesSet;
SetExtendedStyle(LVS_EX_FULLROWSELECT);
insertColumns();
}

View File

@ -17,7 +17,8 @@ class GameList : public CListCtrl
{
private:
// memebers saved in registry
CString path;
CString m_Path;
CWnd* m_pParent;
PropertiesSet* m_pPropertiesSet;
// Regbinding
@ -31,6 +32,7 @@ private:
// Construction
public:
GameList();
virtual ~GameList();
// Operations
public:
@ -42,11 +44,9 @@ public:
// Implementation
public:
virtual ~GameList();
void insertColumns();
void populateRomList();
void setPropertiesSet(PropertiesSet* newPropertiesSet)
{m_pPropertiesSet = newPropertiesSet;}
void init(PropertiesSet* newPropertiesSet, CWnd* newParent);
void deleteItemsAndProperties();
CString getCurrentFile();
CString getCurrentName();

View File

@ -1,4 +1,4 @@
Cyberstella V1.2 by Manuel Polik
Cyberstella V1.2
Currently Open Todos: