Some code cleanup in DolphinWx.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1818 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
5d961c03ef
commit
9a126190ec
|
@ -241,6 +241,7 @@ EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState)
|
|||
EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT10, CFrame::OnSaveState)
|
||||
|
||||
EVT_SIZE(CFrame::OnResize)
|
||||
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnEvent_ListCtrl_ItemActivated)
|
||||
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
|
||||
#if wxUSE_TIMER
|
||||
EVT_TIMER(wxID_ANY, CFrame::OnTimer)
|
||||
|
@ -412,6 +413,10 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
|
||||
void CFrame::OnEvent_ListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
|
||||
{
|
||||
BootGame();
|
||||
}
|
||||
void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
// Toggle fullscreen from Alt + Enter or Esc
|
||||
|
@ -589,6 +594,27 @@ void CFrame::Update()
|
|||
}
|
||||
}
|
||||
#endif
|
||||
void CFrame::BootGame()
|
||||
{
|
||||
// Start the selected ISO
|
||||
if (m_GameListCtrl->GetSelectedISO() != 0)
|
||||
{
|
||||
BootManager::BootCore(m_GameListCtrl->GetSelectedISO()->GetFileName());
|
||||
}
|
||||
|
||||
// Start the default ISO, or if we don't have a default ISO, start the last started ISO
|
||||
else if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty() &&
|
||||
wxFileExists(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str(), wxConvUTF8)))
|
||||
{
|
||||
BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
}
|
||||
|
||||
else if (!SConfig::GetInstance().m_LastFilename.empty() &&
|
||||
wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
|
||||
{
|
||||
BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
|
@ -202,6 +202,8 @@ class CFrame : public wxFrame
|
|||
void OnMemcard(wxCommandEvent& event); // Misc
|
||||
void OnShow_CheatsWindow(wxCommandEvent& event);
|
||||
|
||||
void OnEvent_ListCtrl_ItemActivated(wxListEvent& event);
|
||||
|
||||
// Menu items
|
||||
wxMenuBar* m_pMenuBar;
|
||||
|
||||
|
@ -217,6 +219,8 @@ class CFrame : public wxFrame
|
|||
|
||||
void UpdateGUI();
|
||||
|
||||
void BootGame();
|
||||
|
||||
// Double click and mouse move options
|
||||
double m_fLastClickTime, m_iLastMotionTime; int LastMouseX, LastMouseY;
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "FileSearch.h"
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "BootManager.h"
|
||||
#include "Config.h"
|
||||
#include "GameListCtrl.h"
|
||||
#include "Blob.h"
|
||||
|
@ -62,7 +61,6 @@ BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl)
|
|||
EVT_SIZE(CGameListCtrl::OnSize)
|
||||
EVT_RIGHT_DOWN(CGameListCtrl::OnRightClick)
|
||||
EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, CGameListCtrl::OnColBeginDrag)
|
||||
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CGameListCtrl::OnActivated)
|
||||
EVT_LIST_COL_CLICK(LIST_CTRL, CGameListCtrl::OnColumnClick)
|
||||
EVT_MENU(IDM_PROPERTIES, CGameListCtrl::OnProperties)
|
||||
EVT_MENU(IDM_OPENCONTAININGFOLDER, CGameListCtrl::OnOpenContainingFolder)
|
||||
|
@ -525,23 +523,6 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void CGameListCtrl::OnActivated(wxListEvent& event)
|
||||
{
|
||||
if (m_ISOFiles.size() == 0)
|
||||
{
|
||||
BrowseForDirectory();
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t Index = event.GetData();
|
||||
if (Index < m_ISOFiles.size())
|
||||
{
|
||||
const GameListItem& rISOFile = m_ISOFiles[Index];
|
||||
BootManager::BootCore(rISOFile.GetFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const GameListItem * CGameListCtrl::GetSelectedISO()
|
||||
{
|
||||
long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
|
|
|
@ -67,7 +67,6 @@ private:
|
|||
void OnRightClick(wxMouseEvent& event);
|
||||
void OnColumnClick(wxListEvent& event);
|
||||
void OnColBeginDrag(wxListEvent& event);
|
||||
void OnActivated(wxListEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnProperties(wxCommandEvent& event);
|
||||
void OnOpenContainingFolder(wxCommandEvent& event);
|
||||
|
|
Loading…
Reference in New Issue