- 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) //{{AFX_DATA_INIT(CCyberstellaView)
// NOTE: the ClassWizard will add member initialization here // NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
m_pGlobalData = new CGlobalData(GetModuleHandle(NULL)); m_pGlobalData = new CGlobalData(GetModuleHandle(NULL));
m_bIsPause = false; m_bIsPause = false;
m_pPropertiesSet = NULL; m_pPropertiesSet = NULL;
@ -95,17 +94,8 @@ void CCyberstellaView::OnInitialUpdate()
status.Format(IDS_STATUSTEXT, m_List.GetItemCount()); status.Format(IDS_STATUSTEXT, m_List.GetItemCount());
SetDlgItemText(IDC_ROMCOUNT,status); SetDlgItemText(IDC_ROMCOUNT,status);
//
// Show rom path // Show rom path
//
//ToDo: SetDlgItemText(IDC_ROMPATH, m_pGlobalData->romDir); //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); m_List.SetImageList (&m_imglist, LVSIL_SMALL);
// Init ListCtrl // Init ListCtrl
m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT); m_List.init(m_pPropertiesSet,this);
m_List.insertColumns();
m_List.setPropertiesSet(m_pPropertiesSet);
// Try to load the file stella.pro file // Try to load the file stella.pro file
string filename( "stella.pro" ); string filename( "stella.pro" );

View File

@ -15,10 +15,10 @@ static char THIS_FILE[] = __FILE__;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// GameList // GameList
GameList::GameList() GameList::GameList()
: rs("GameList") : rs("GameList")
{ {
rs.Bind(path, "ROM Path", ""); rs.Bind(m_Path, "ROM Path", "");
} }
GameList::~GameList() GameList::~GameList()
@ -29,6 +29,7 @@ BEGIN_MESSAGE_MAP(GameList, CListCtrl)
//{{AFX_MSG_MAP(GameList) //{{AFX_MSG_MAP(GameList)
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick) ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
ON_NOTIFY_REFLECT(LVN_ITEMACTIVATE, OnItemActivate) ON_NOTIFY_REFLECT(LVN_ITEMACTIVATE, OnItemActivate)
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
END_MESSAGE_MAP() END_MESSAGE_MAP()
@ -111,7 +112,7 @@ void GameList::populateRomList()
deleteItemsAndProperties(); deleteItemsAndProperties();
// Add new content // Add new content
if(path.GetLength() > 0) if(m_Path.GetLength() > 0)
{ {
displayPath(); displayPath();
} }
@ -137,10 +138,10 @@ void GameList::displayPath()
BOOL first = true; BOOL first = true;
// Do pathname // Do pathname
if (path.GetAt(path.GetLength()-1) == '\\') if (m_Path.GetAt(m_Path.GetLength()-1) == '\\')
searchpath = path + "*.*"; searchpath = m_Path + "*.*";
else else
searchpath = path + "\\*.*"; searchpath = m_Path + "\\*.*";
bFind = find.FindFile(searchpath); bFind = find.FindFile(searchpath);
@ -235,7 +236,7 @@ void GameList::displayDrives()
int itemCounter; int itemCounter;
// Clear path // Clear path
path = ""; m_Path = "";
//Enumerate drive letters and add them to list //Enumerate drive letters and add them to list
dwDrives = GetLogicalDrives(); dwDrives = GetLogicalDrives();
@ -284,28 +285,34 @@ void GameList::OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult)
if(strcmpi(props->get("Cartridge.Type").c_str(), "Dots") == 0) if(strcmpi(props->get("Cartridge.Type").c_str(), "Dots") == 0)
{ {
int cutPos = path.ReverseFind('\\'); int cutPos = m_Path.ReverseFind('\\');
path = path.Left(cutPos); m_Path = m_Path.Left(cutPos);
populateRomList(); populateRomList();
} }
else if(strcmpi(props->get("Cartridge.Type").c_str(), "Directory") == 0) else if(strcmpi(props->get("Cartridge.Type").c_str(), "Directory") == 0)
{ {
// Do pathname // 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 += "\\"; m_Path += "\\";
path += dir; m_Path += dir;
} }
else else
{ {
path += dir; m_Path += dir;
} }
populateRomList(); 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; *pResult = 0;
} }
@ -357,10 +364,10 @@ CString GameList::getCurrentFile()
int curSel = GetSelectionMark(); int curSel = GetSelectionMark();
if(curSel >= 0) if(curSel >= 0)
{ {
if (path.GetAt(path.GetLength()-1) != '\\') if (m_Path.GetAt(m_Path.GetLength()-1) != '\\')
path += "\\"; m_Path += "\\";
filename = path + GetItemText(curSel,0); filename = m_Path + GetItemText(curSel,0);
} }
return filename; return filename;
@ -375,4 +382,12 @@ CString GameList::getCurrentName()
} }
return ""; 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: private:
// memebers saved in registry // memebers saved in registry
CString path; CString m_Path;
CWnd* m_pParent;
PropertiesSet* m_pPropertiesSet; PropertiesSet* m_pPropertiesSet;
// Regbinding // Regbinding
@ -31,6 +32,7 @@ private:
// Construction // Construction
public: public:
GameList(); GameList();
virtual ~GameList();
// Operations // Operations
public: public:
@ -42,11 +44,9 @@ public:
// Implementation // Implementation
public: public:
virtual ~GameList();
void insertColumns(); void insertColumns();
void populateRomList(); void populateRomList();
void setPropertiesSet(PropertiesSet* newPropertiesSet) void init(PropertiesSet* newPropertiesSet, CWnd* newParent);
{m_pPropertiesSet = newPropertiesSet;}
void deleteItemsAndProperties(); void deleteItemsAndProperties();
CString getCurrentFile(); CString getCurrentFile();
CString getCurrentName(); CString getCurrentName();

View File

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