DolphinWX: rename CGameListCtrl -> GameListCtrl

This commit is contained in:
Shawn Hoffman 2017-06-19 02:20:14 -07:00
parent 1bd177561b
commit 668c6b5ce9
11 changed files with 94 additions and 98 deletions

View File

@ -351,7 +351,7 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
// This panel is the parent for rendering and it holds the gamelistctrl // This panel is the parent for rendering and it holds the gamelistctrl
m_panel = new wxPanel(this, IDM_MPANEL, wxDefaultPosition, wxDefaultSize, 0); m_panel = new wxPanel(this, IDM_MPANEL, wxDefaultPosition, wxDefaultSize, 0);
m_game_list_ctrl = new CGameListCtrl(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_game_list_ctrl = new GameListCtrl(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT); wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);
m_game_list_ctrl->Bind(wxEVT_LIST_ITEM_ACTIVATED, &CFrame::OnGameListCtrlItemActivated, this); m_game_list_ctrl->Bind(wxEVT_LIST_ITEM_ACTIVATED, &CFrame::OnGameListCtrlItemActivated, this);
@ -876,7 +876,7 @@ void CFrame::OnGameListCtrlItemActivated(wxListEvent& WXUNUSED(event))
// 1. Boot the selected iso // 1. Boot the selected iso
// 2. Boot the default or last loaded iso. // 2. Boot the default or last loaded iso.
// 3. Call BrowseForDirectory if the gamelist is empty // 3. Call BrowseForDirectory if the gamelist is empty
if (!m_game_list_ctrl->GetISO(0) && CGameListCtrl::IsHidingItems()) if (!m_game_list_ctrl->GetISO(0) && GameListCtrl::IsHidingItems())
{ {
SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii = SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii =
SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListElfDol = SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListElfDol =

View File

@ -33,7 +33,7 @@
struct BootParameters; struct BootParameters;
// Class declarations // Class declarations
class CGameListCtrl; class GameListCtrl;
class CCodeWindow; class CCodeWindow;
class CConfigMain; class CConfigMain;
class CLogWindow; class CLogWindow;
@ -143,7 +143,7 @@ private:
ADD_PANE_CENTER ADD_PANE_CENTER
}; };
CGameListCtrl* m_game_list_ctrl = nullptr; GameListCtrl* m_game_list_ctrl = nullptr;
CConfigMain* m_main_config_dialog = nullptr; CConfigMain* m_main_config_dialog = nullptr;
wxPanel* m_panel = nullptr; wxPanel* m_panel = nullptr;
CRenderFrame* m_render_frame = nullptr; CRenderFrame* m_render_frame = nullptr;

View File

@ -82,7 +82,7 @@ public:
static bool sorted = false; static bool sorted = false;
static int CompareGameListItems(const GameListItem* iso1, const GameListItem* iso2, static int CompareGameListItems(const GameListItem* iso1, const GameListItem* iso2,
long sortData = CGameListCtrl::COLUMN_TITLE) long sortData = GameListCtrl::COLUMN_TITLE)
{ {
int t = 1; int t = 1;
@ -94,7 +94,7 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
switch (sortData) switch (sortData)
{ {
case CGameListCtrl::COLUMN_TITLE: case GameListCtrl::COLUMN_TITLE:
if (!strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str())) if (!strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str()))
{ {
if (iso1->GetGameID() != iso2->GetGameID()) if (iso1->GetGameID() != iso2->GetGameID())
@ -111,34 +111,34 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
return t * wxStricmp(iso1_filename, iso2_filename); return t * wxStricmp(iso1_filename, iso2_filename);
} }
return strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str()) * t; return strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str()) * t;
case CGameListCtrl::COLUMN_MAKER: case GameListCtrl::COLUMN_MAKER:
return strcasecmp(iso1->GetCompany().c_str(), iso2->GetCompany().c_str()) * t; return strcasecmp(iso1->GetCompany().c_str(), iso2->GetCompany().c_str()) * t;
case CGameListCtrl::COLUMN_FILENAME: case GameListCtrl::COLUMN_FILENAME:
return wxStricmp(wxFileNameFromPath(iso1->GetFileName()), return wxStricmp(wxFileNameFromPath(iso1->GetFileName()),
wxFileNameFromPath(iso2->GetFileName())) * wxFileNameFromPath(iso2->GetFileName())) *
t; t;
case CGameListCtrl::COLUMN_ID: case GameListCtrl::COLUMN_ID:
return strcasecmp(iso1->GetGameID().c_str(), iso2->GetGameID().c_str()) * t; return strcasecmp(iso1->GetGameID().c_str(), iso2->GetGameID().c_str()) * t;
case CGameListCtrl::COLUMN_COUNTRY: case GameListCtrl::COLUMN_COUNTRY:
if (iso1->GetCountry() > iso2->GetCountry()) if (iso1->GetCountry() > iso2->GetCountry())
return 1 * t; return 1 * t;
if (iso1->GetCountry() < iso2->GetCountry()) if (iso1->GetCountry() < iso2->GetCountry())
return -1 * t; return -1 * t;
return 0; return 0;
case CGameListCtrl::COLUMN_SIZE: case GameListCtrl::COLUMN_SIZE:
if (iso1->GetFileSize() > iso2->GetFileSize()) if (iso1->GetFileSize() > iso2->GetFileSize())
return 1 * t; return 1 * t;
if (iso1->GetFileSize() < iso2->GetFileSize()) if (iso1->GetFileSize() < iso2->GetFileSize())
return -1 * t; return -1 * t;
return 0; return 0;
case CGameListCtrl::COLUMN_PLATFORM: case GameListCtrl::COLUMN_PLATFORM:
if (iso1->GetPlatform() > iso2->GetPlatform()) if (iso1->GetPlatform() > iso2->GetPlatform())
return 1 * t; return 1 * t;
if (iso1->GetPlatform() < iso2->GetPlatform()) if (iso1->GetPlatform() < iso2->GetPlatform())
return -1 * t; return -1 * t;
return 0; return 0;
case CGameListCtrl::COLUMN_EMULATION_STATE: case GameListCtrl::COLUMN_EMULATION_STATE:
{ {
const int nState1 = iso1->GetEmuState(), nState2 = iso2->GetEmuState(); const int nState1 = iso1->GetEmuState(), nState2 = iso2->GetEmuState();
@ -242,7 +242,7 @@ static bool ShouldDisplayGameListItem(const GameListItem& item)
wxDEFINE_EVENT(DOLPHIN_EVT_RELOAD_GAMELIST, wxCommandEvent); wxDEFINE_EVENT(DOLPHIN_EVT_RELOAD_GAMELIST, wxCommandEvent);
struct CGameListCtrl::ColumnInfo struct GameListCtrl::ColumnInfo
{ {
const int id; const int id;
const int default_width; const int default_width;
@ -250,7 +250,7 @@ struct CGameListCtrl::ColumnInfo
bool& visible; bool& visible;
}; };
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, GameListCtrl::GameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos,
const wxSize& size, long style) const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style), toolTip(nullptr), : wxListCtrl(parent, id, pos, size, style), toolTip(nullptr),
m_columns({// {COLUMN, {default_width (without platform padding), resizability, visibility}} m_columns({// {COLUMN, {default_width (without platform padding), resizability, visibility}}
@ -265,34 +265,30 @@ CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoin
{COLUMN_EMULATION_STATE, 48, false, SConfig::GetInstance().m_showStateColumn}, {COLUMN_EMULATION_STATE, 48, false, SConfig::GetInstance().m_showStateColumn},
{COLUMN_SIZE, wxLIST_AUTOSIZE, false, SConfig::GetInstance().m_showSizeColumn}}) {COLUMN_SIZE, wxLIST_AUTOSIZE, false, SConfig::GetInstance().m_showSizeColumn}})
{ {
Bind(wxEVT_SIZE, &CGameListCtrl::OnSize, this); Bind(wxEVT_SIZE, &GameListCtrl::OnSize, this);
Bind(wxEVT_RIGHT_DOWN, &CGameListCtrl::OnRightClick, this); Bind(wxEVT_RIGHT_DOWN, &GameListCtrl::OnRightClick, this);
Bind(wxEVT_LEFT_DOWN, &CGameListCtrl::OnLeftClick, this); Bind(wxEVT_LEFT_DOWN, &GameListCtrl::OnLeftClick, this);
Bind(wxEVT_MOTION, &CGameListCtrl::OnMouseMotion, this); Bind(wxEVT_MOTION, &GameListCtrl::OnMouseMotion, this);
Bind(wxEVT_LIST_KEY_DOWN, &CGameListCtrl::OnKeyPress, this); Bind(wxEVT_LIST_KEY_DOWN, &GameListCtrl::OnKeyPress, this);
Bind(wxEVT_LIST_COL_BEGIN_DRAG, &CGameListCtrl::OnColBeginDrag, this); Bind(wxEVT_LIST_COL_BEGIN_DRAG, &GameListCtrl::OnColBeginDrag, this);
Bind(wxEVT_LIST_COL_CLICK, &CGameListCtrl::OnColumnClick, this); Bind(wxEVT_LIST_COL_CLICK, &GameListCtrl::OnColumnClick, this);
Bind(wxEVT_MENU, &CGameListCtrl::OnProperties, this, IDM_PROPERTIES); Bind(wxEVT_MENU, &GameListCtrl::OnProperties, this, IDM_PROPERTIES);
Bind(wxEVT_MENU, &CGameListCtrl::OnWiki, this, IDM_GAME_WIKI); Bind(wxEVT_MENU, &GameListCtrl::OnWiki, this, IDM_GAME_WIKI);
Bind(wxEVT_MENU, &CGameListCtrl::OnOpenContainingFolder, this, IDM_OPEN_CONTAINING_FOLDER); Bind(wxEVT_MENU, &GameListCtrl::OnOpenContainingFolder, this, IDM_OPEN_CONTAINING_FOLDER);
Bind(wxEVT_MENU, &CGameListCtrl::OnOpenSaveFolder, this, IDM_OPEN_SAVE_FOLDER); Bind(wxEVT_MENU, &GameListCtrl::OnOpenSaveFolder, this, IDM_OPEN_SAVE_FOLDER);
Bind(wxEVT_MENU, &CGameListCtrl::OnExportSave, this, IDM_EXPORT_SAVE); Bind(wxEVT_MENU, &GameListCtrl::OnExportSave, this, IDM_EXPORT_SAVE);
Bind(wxEVT_MENU, &CGameListCtrl::OnSetDefaultISO, this, IDM_SET_DEFAULT_ISO); Bind(wxEVT_MENU, &GameListCtrl::OnSetDefaultISO, this, IDM_SET_DEFAULT_ISO);
Bind(wxEVT_MENU, &CGameListCtrl::OnCompressISO, this, IDM_COMPRESS_ISO); Bind(wxEVT_MENU, &GameListCtrl::OnCompressISO, this, IDM_COMPRESS_ISO);
Bind(wxEVT_MENU, &CGameListCtrl::OnMultiCompressISO, this, IDM_MULTI_COMPRESS_ISO); Bind(wxEVT_MENU, &GameListCtrl::OnMultiCompressISO, this, IDM_MULTI_COMPRESS_ISO);
Bind(wxEVT_MENU, &CGameListCtrl::OnMultiDecompressISO, this, IDM_MULTI_DECOMPRESS_ISO); Bind(wxEVT_MENU, &GameListCtrl::OnMultiDecompressISO, this, IDM_MULTI_DECOMPRESS_ISO);
Bind(wxEVT_MENU, &CGameListCtrl::OnDeleteISO, this, IDM_DELETE_ISO); Bind(wxEVT_MENU, &GameListCtrl::OnDeleteISO, this, IDM_DELETE_ISO);
Bind(wxEVT_MENU, &CGameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC); Bind(wxEVT_MENU, &GameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC);
Bind(wxEVT_MENU, &CGameListCtrl::OnNetPlayHost, this, IDM_START_NETPLAY); Bind(wxEVT_MENU, &GameListCtrl::OnNetPlayHost, this, IDM_START_NETPLAY);
Bind(DOLPHIN_EVT_RELOAD_GAMELIST, &CGameListCtrl::OnReloadGameList, this); Bind(DOLPHIN_EVT_RELOAD_GAMELIST, &GameListCtrl::OnReloadGameList, this);
wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &CGameListCtrl::OnLocalIniModified, this); wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &GameListCtrl::OnLocalIniModified, this);
}
CGameListCtrl::~CGameListCtrl()
{
} }
template <typename T> template <typename T>
@ -307,7 +303,7 @@ static void InitBitmap(wxImageList* img_list, std::vector<int>* vector, wxWindow
wxTransparentColour)); wxTransparentColour));
} }
void CGameListCtrl::InitBitmaps() void GameListCtrl::InitBitmaps()
{ {
const wxSize size = FromDIP(wxSize(96, 32)); const wxSize size = FromDIP(wxSize(96, 32));
const wxSize flag_bmp_size = FromDIP(wxSize(32, 32)); const wxSize flag_bmp_size = FromDIP(wxSize(32, 32));
@ -368,7 +364,7 @@ void CGameListCtrl::InitBitmaps()
InitBitmap(img_list, &m_utility_game_banners, this, size, 0, "nobanner"); InitBitmap(img_list, &m_utility_game_banners, this, size, 0, "nobanner");
} }
void CGameListCtrl::BrowseForDirectory() void GameListCtrl::BrowseForDirectory()
{ {
wxString dirHome; wxString dirHome;
wxGetHomeDir(&dirHome); wxGetHomeDir(&dirHome);
@ -394,7 +390,7 @@ void CGameListCtrl::BrowseForDirectory()
} }
} }
void CGameListCtrl::ReloadList() void GameListCtrl::ReloadList()
{ {
int scrollPos = wxWindow::GetScrollPos(wxVERTICAL); int scrollPos = wxWindow::GetScrollPos(wxVERTICAL);
// Don't let the user refresh it while a game is running // Don't let the user refresh it while a game is running
@ -513,7 +509,7 @@ static wxString NiceSizeFormat(u64 size)
} }
// Update the column content of the item at _Index // Update the column content of the item at _Index
void CGameListCtrl::UpdateItemAtColumn(long _Index, int column) void GameListCtrl::UpdateItemAtColumn(long index, int column)
{ {
GameListItem& rISOFile = *m_ISOFiles[GetItemData(_Index)]; GameListItem& rISOFile = *m_ISOFiles[GetItemData(_Index)];
@ -577,7 +573,7 @@ void CGameListCtrl::UpdateItemAtColumn(long _Index, int column)
} }
} }
void CGameListCtrl::InsertItemInReportView(long index) void GameListCtrl::InsertItemInReportView(long index)
{ {
// When using wxListCtrl, there is no hope of per-column text colors. // When using wxListCtrl, there is no hope of per-column text colors.
// But for reference, here are the old colors that were used: (BGR) // But for reference, here are the old colors that were used: (BGR)
@ -620,7 +616,7 @@ static wxColour ContrastText(const wxColour& bgc)
return (lum > LUM_THRESHOLD) ? *wxBLACK : *wxWHITE; return (lum > LUM_THRESHOLD) ? *wxBLACK : *wxWHITE;
} }
void CGameListCtrl::SetColors() void GameListCtrl::SetColors()
{ {
for (long i = 0; i < GetItemCount(); i++) for (long i = 0; i < GetItemCount(); i++)
{ {
@ -632,7 +628,7 @@ void CGameListCtrl::SetColors()
} }
} }
void CGameListCtrl::ScanForISOs() void GameListCtrl::ScanForISOs()
{ {
m_ISOFiles.clear(); m_ISOFiles.clear();
@ -684,12 +680,12 @@ void CGameListCtrl::ScanForISOs()
std::sort(m_ISOFiles.begin(), m_ISOFiles.end()); std::sort(m_ISOFiles.begin(), m_ISOFiles.end());
} }
void CGameListCtrl::OnReloadGameList(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnReloadGameList(wxCommandEvent& WXUNUSED(event))
{ {
ReloadList(); ReloadList();
} }
void CGameListCtrl::OnLocalIniModified(wxCommandEvent& ev) void GameListCtrl::OnLocalIniModified(wxCommandEvent& ev)
{ {
ev.Skip(); ev.Skip();
std::string game_id = WxStrToStr(ev.GetString()); std::string game_id = WxStrToStr(ev.GetString());
@ -724,7 +720,7 @@ void CGameListCtrl::OnLocalIniModified(wxCommandEvent& ev)
} }
} }
void CGameListCtrl::OnColBeginDrag(wxListEvent& event) void GameListCtrl::OnColBeginDrag(wxListEvent& event)
{ {
const int column_id = event.GetColumn(); const int column_id = event.GetColumn();
@ -732,7 +728,7 @@ void CGameListCtrl::OnColBeginDrag(wxListEvent& event)
event.Veto(); event.Veto();
} }
const GameListItem* CGameListCtrl::GetISO(size_t index) const const GameListItem* GameListCtrl::GetISO(size_t index) const
{ {
if (index < m_ISOFiles.size()) if (index < m_ISOFiles.size())
return m_ISOFiles[index].get(); return m_ISOFiles[index].get();
@ -740,7 +736,7 @@ const GameListItem* CGameListCtrl::GetISO(size_t index) const
return nullptr; return nullptr;
} }
static CGameListCtrl* caller; static GameListCtrl* caller;
static int wxCALLBACK wxListCompare(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData) static int wxCALLBACK wxListCompare(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
{ {
// return 1 if item1 > item2 // return 1 if item1 > item2
@ -752,7 +748,7 @@ static int wxCALLBACK wxListCompare(wxIntPtr item1, wxIntPtr item2, wxIntPtr sor
return CompareGameListItems(iso1, iso2, sortData); return CompareGameListItems(iso1, iso2, sortData);
} }
void CGameListCtrl::OnColumnClick(wxListEvent& event) void GameListCtrl::OnColumnClick(wxListEvent& event)
{ {
if (event.GetColumn() != COLUMN_BANNER) if (event.GetColumn() != COLUMN_BANNER)
{ {
@ -786,7 +782,7 @@ void CGameListCtrl::OnColumnClick(wxListEvent& event)
} }
// This is used by keyboard gamelist search // This is used by keyboard gamelist search
void CGameListCtrl::OnKeyPress(wxListEvent& event) void GameListCtrl::OnKeyPress(wxListEvent& event)
{ {
static int lastKey = 0, sLoop = 0; static int lastKey = 0, sLoop = 0;
int Loop = 0; int Loop = 0;
@ -836,7 +832,7 @@ void CGameListCtrl::OnKeyPress(wxListEvent& event)
} }
// This shows a little tooltip with the current Game's emulation state // This shows a little tooltip with the current Game's emulation state
void CGameListCtrl::OnMouseMotion(wxMouseEvent& event) void GameListCtrl::OnMouseMotion(wxMouseEvent& event)
{ {
int flags; int flags;
long subitem = 0; long subitem = 0;
@ -913,7 +909,7 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event)
event.Skip(); event.Skip();
} }
void CGameListCtrl::OnLeftClick(wxMouseEvent& event) void GameListCtrl::OnLeftClick(wxMouseEvent& event)
{ {
// Focus the clicked item. // Focus the clicked item.
int flags; int flags;
@ -945,7 +941,7 @@ static bool IsWADInstalled(const GameListItem& wad)
[](const auto& file) { return file.virtualName != "title.tmd"; }); [](const auto& file) { return file.virtualName != "title.tmd"; });
} }
void CGameListCtrl::OnRightClick(wxMouseEvent& event) void GameListCtrl::OnRightClick(wxMouseEvent& event)
{ {
// Focus the clicked item. // Focus the clicked item.
int flags; int flags;
@ -1043,7 +1039,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
} }
} }
const GameListItem* CGameListCtrl::GetSelectedISO() const const GameListItem* GameListCtrl::GetSelectedISO() const
{ {
if (m_ISOFiles.empty()) if (m_ISOFiles.empty())
return nullptr; return nullptr;
@ -1058,7 +1054,7 @@ const GameListItem* CGameListCtrl::GetSelectedISO() const
return m_ISOFiles[GetItemData(item)].get(); return m_ISOFiles[GetItemData(item)].get();
} }
std::vector<const GameListItem*> CGameListCtrl::GetAllSelectedISOs() const std::vector<const GameListItem*> GameListCtrl::GetAllSelectedISOs() const
{ {
std::vector<const GameListItem*> result; std::vector<const GameListItem*> result;
long item = -1; long item = -1;
@ -1071,7 +1067,7 @@ std::vector<const GameListItem*> CGameListCtrl::GetAllSelectedISOs() const
} }
} }
bool CGameListCtrl::IsHidingItems() bool GameListCtrl::IsHidingItems()
{ {
return !(SConfig::GetInstance().m_ListGC && SConfig::GetInstance().m_ListWii && return !(SConfig::GetInstance().m_ListGC && SConfig::GetInstance().m_ListWii &&
SConfig::GetInstance().m_ListWad && SConfig::GetInstance().m_ListElfDol && SConfig::GetInstance().m_ListWad && SConfig::GetInstance().m_ListElfDol &&
@ -1084,7 +1080,7 @@ bool CGameListCtrl::IsHidingItems()
SConfig::GetInstance().m_ListWorld && SConfig::GetInstance().m_ListUnknown); SConfig::GetInstance().m_ListWorld && SConfig::GetInstance().m_ListUnknown);
} }
void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
@ -1095,7 +1091,7 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED(event))
WxUtils::Explore(WxStrToStr(path.GetPath())); WxUtils::Explore(WxStrToStr(path.GetPath()));
} }
void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
@ -1105,7 +1101,7 @@ void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED(event))
WxUtils::Explore(path); WxUtils::Explore(path);
} }
void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (iso) if (iso)
@ -1113,7 +1109,7 @@ void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED(event))
} }
// Save this file as the default file // Save this file as the default file
void CGameListCtrl::OnSetDefaultISO(wxCommandEvent& event) void GameListCtrl::OnSetDefaultISO(wxCommandEvent& event)
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
@ -1133,7 +1129,7 @@ void CGameListCtrl::OnSetDefaultISO(wxCommandEvent& event)
} }
} }
void CGameListCtrl::OnDeleteISO(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnDeleteISO(wxCommandEvent& WXUNUSED(event))
{ {
const wxString message = const wxString message =
GetSelectedItemCount() == 1 ? GetSelectedItemCount() == 1 ?
@ -1148,7 +1144,7 @@ void CGameListCtrl::OnDeleteISO(wxCommandEvent& WXUNUSED(event))
} }
} }
void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnProperties(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
@ -1158,7 +1154,7 @@ void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED(event))
ISOProperties->Show(); ISOProperties->Show();
} }
void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnWiki(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
@ -1169,7 +1165,7 @@ void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED(event))
WxUtils::Launch(wikiUrl); WxUtils::Launch(wikiUrl);
} }
void CGameListCtrl::OnNetPlayHost(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnNetPlayHost(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
@ -1192,7 +1188,7 @@ void CGameListCtrl::OnNetPlayHost(wxCommandEvent& WXUNUSED(event))
NetPlayLauncher::Host(config); NetPlayLauncher::Host(config);
} }
bool CGameListCtrl::MultiCompressCB(const std::string& text, float percent, void* arg) bool GameListCtrl::MultiCompressCB(const std::string& text, float percent, void* arg)
{ {
CompressionProgress* progress = static_cast<CompressionProgress*>(arg); CompressionProgress* progress = static_cast<CompressionProgress*>(arg);
@ -1204,17 +1200,17 @@ bool CGameListCtrl::MultiCompressCB(const std::string& text, float percent, void
return progress->dialog->Update(total_percent * progress->dialog->GetRange(), text_string); return progress->dialog->Update(total_percent * progress->dialog->GetRange(), text_string);
} }
void CGameListCtrl::OnMultiCompressISO(wxCommandEvent& /*event*/) void GameListCtrl::OnMultiCompressISO(wxCommandEvent& /*event*/)
{ {
CompressSelection(true); CompressSelection(true);
} }
void CGameListCtrl::OnMultiDecompressISO(wxCommandEvent& /*event*/) void GameListCtrl::OnMultiDecompressISO(wxCommandEvent& /*event*/)
{ {
CompressSelection(false); CompressSelection(false);
} }
void CGameListCtrl::CompressSelection(bool _compress) void GameListCtrl::CompressSelection(bool _compress)
{ {
std::vector<const GameListItem*> items_to_compress; std::vector<const GameListItem*> items_to_compress;
bool wii_compression_warning_accepted = false; bool wii_compression_warning_accepted = false;
@ -1319,12 +1315,12 @@ void CGameListCtrl::CompressSelection(bool _compress)
ReloadList(); ReloadList();
} }
bool CGameListCtrl::CompressCB(const std::string& text, float percent, void* arg) bool GameListCtrl::CompressCB(const std::string& text, float percent, void* arg)
{ {
return ((wxProgressDialog*)arg)->Update((int)(percent * 1000), StrToWxStr(text)); return ((wxProgressDialog*)arg)->Update((int)(percent * 1000), StrToWxStr(text));
} }
void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso) if (!iso)
@ -1392,7 +1388,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED(event))
ReloadList(); ReloadList();
} }
void CGameListCtrl::OnChangeDisc(wxCommandEvent& WXUNUSED(event)) void GameListCtrl::OnChangeDisc(wxCommandEvent& WXUNUSED(event))
{ {
const GameListItem* iso = GetSelectedISO(); const GameListItem* iso = GetSelectedISO();
if (!iso || !Core::IsRunning()) if (!iso || !Core::IsRunning())
@ -1400,7 +1396,7 @@ void CGameListCtrl::OnChangeDisc(wxCommandEvent& WXUNUSED(event))
DVDInterface::ChangeDiscAsHost(WxStrToStr(iso->GetFileName())); DVDInterface::ChangeDiscAsHost(WxStrToStr(iso->GetFileName()));
} }
void CGameListCtrl::OnSize(wxSizeEvent& event) void GameListCtrl::OnSize(wxSizeEvent& event)
{ {
event.Skip(); event.Skip();
if (lastpos == event.GetSize()) if (lastpos == event.GetSize())
@ -1410,7 +1406,7 @@ void CGameListCtrl::OnSize(wxSizeEvent& event)
AutomaticColumnWidth(); AutomaticColumnWidth();
} }
void CGameListCtrl::AutomaticColumnWidth() void GameListCtrl::AutomaticColumnWidth()
{ {
wxRect rc(GetClientRect()); wxRect rc(GetClientRect());
@ -1444,14 +1440,14 @@ void CGameListCtrl::AutomaticColumnWidth()
Thaw(); Thaw();
} }
void CGameListCtrl::UnselectAll() void GameListCtrl::UnselectAll()
{ {
for (int i = 0; i < GetItemCount(); i++) for (int i = 0; i < GetItemCount(); i++)
{ {
SetItemState(i, 0, wxLIST_STATE_SELECTED); SetItemState(i, 0, wxLIST_STATE_SELECTED);
} }
} }
bool CGameListCtrl::WiiCompressWarning() bool GameListCtrl::WiiCompressWarning()
{ {
return wxMessageBox(_("Compressing a Wii disc image will irreversibly change the compressed copy " return wxMessageBox(_("Compressing a Wii disc image will irreversibly change the compressed copy "
"by removing padding data. Your disc image will still work. Continue?"), "by removing padding data. Your disc image will still work. Continue?"),
@ -1462,7 +1458,7 @@ bool CGameListCtrl::WiiCompressWarning()
// Windows draws vertical rules between columns when using UXTheme (e.g. Aero, Win10) // Windows draws vertical rules between columns when using UXTheme (e.g. Aero, Win10)
// This function paints over those lines which removes them. // This function paints over those lines which removes them.
// [The repaint background idea is ripped off from Eclipse SWT which does the same thing] // [The repaint background idea is ripped off from Eclipse SWT which does the same thing]
bool CGameListCtrl::MSWOnNotify(int id, WXLPARAM lparam, WXLPARAM* result) bool GameListCtrl::MSWOnNotify(int id, WXLPARAM lparam, WXLPARAM* result)
{ {
NMLVCUSTOMDRAW* nmlv = reinterpret_cast<NMLVCUSTOMDRAW*>(lparam); NMLVCUSTOMDRAW* nmlv = reinterpret_cast<NMLVCUSTOMDRAW*>(lparam);
// Intercept the NM_CUSTOMDRAW[CDDS_PREPAINT] // Intercept the NM_CUSTOMDRAW[CDDS_PREPAINT]

View File

@ -33,12 +33,12 @@ public:
wxDECLARE_EVENT(DOLPHIN_EVT_RELOAD_GAMELIST, wxCommandEvent); wxDECLARE_EVENT(DOLPHIN_EVT_RELOAD_GAMELIST, wxCommandEvent);
class CGameListCtrl : public wxListCtrl class GameListCtrl : public wxListCtrl
{ {
public: public:
CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, GameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size,
long style); long style);
~CGameListCtrl(); ~GameListCtrl() = default;
void BrowseForDirectory(); void BrowseForDirectory();
const GameListItem* GetISO(size_t index) const; const GameListItem* GetISO(size_t index) const;

View File

@ -9,7 +9,7 @@
#include "DolphinWX/NetPlay/ChangeGameDialog.h" #include "DolphinWX/NetPlay/ChangeGameDialog.h"
#include "DolphinWX/NetPlay/NetWindow.h" #include "DolphinWX/NetPlay/NetWindow.h"
ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list) ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const GameListCtrl* const game_list)
: wxDialog(parent, wxID_ANY, _("Select Game")) : wxDialog(parent, wxID_ANY, _("Select Game"))
{ {
const int space5 = FromDIP(5); const int space5 = FromDIP(5);

View File

@ -6,13 +6,13 @@
#include <wx/dialog.h> #include <wx/dialog.h>
class CGameListCtrl; class GameListCtrl;
class wxListBox; class wxListBox;
class ChangeGameDialog final : public wxDialog class ChangeGameDialog final : public wxDialog
{ {
public: public:
ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list); ChangeGameDialog(wxWindow* parent, const GameListCtrl* const game_list);
wxString GetChosenGameName() const; wxString GetChosenGameName() const;

View File

@ -8,7 +8,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
class CGameListCtrl; class GameListCtrl;
class wxRect; class wxRect;
class wxWindow; class wxWindow;
@ -24,7 +24,7 @@ public:
const wxRect window_defaults{wxDefaultCoord, wxDefaultCoord, 768, 768 - 128}; const wxRect window_defaults{wxDefaultCoord, wxDefaultCoord, 768, 768 - 128};
std::string player_name; std::string player_name;
const CGameListCtrl* game_list_ctrl; const GameListCtrl* game_list_ctrl;
wxWindow* parent_window; wxWindow* parent_window;
bool use_traversal; bool use_traversal;
std::string traversal_host; std::string traversal_host;

View File

@ -36,7 +36,7 @@ wxString GetTraversalLabelText(IniFile::Section& section)
} }
} // Anonymous namespace } // Anonymous namespace
NetPlaySetupFrame::NetPlaySetupFrame(wxWindow* const parent, const CGameListCtrl* const game_list) NetPlaySetupFrame::NetPlaySetupFrame(wxWindow* const parent, const GameListCtrl* const game_list)
: wxFrame(parent, wxID_ANY, _("Dolphin NetPlay Setup")), m_game_list(game_list) : wxFrame(parent, wxID_ANY, _("Dolphin NetPlay Setup")), m_game_list(game_list)
{ {
IniFile inifile; IniFile inifile;

View File

@ -8,7 +8,7 @@
#include <string> #include <string>
#include <wx/frame.h> #include <wx/frame.h>
class CGameListCtrl; class GameListCtrl;
class wxCheckBox; class wxCheckBox;
class wxChoice; class wxChoice;
class wxListBox; class wxListBox;
@ -20,7 +20,7 @@ class wxTextCtrl;
class NetPlaySetupFrame final : public wxFrame class NetPlaySetupFrame final : public wxFrame
{ {
public: public:
NetPlaySetupFrame(wxWindow* const parent, const CGameListCtrl* const game_list); NetPlaySetupFrame(wxWindow* const parent, const GameListCtrl* const game_list);
~NetPlaySetupFrame(); ~NetPlaySetupFrame();
private: private:
@ -66,5 +66,5 @@ private:
#endif #endif
wxString m_traversal_string; wxString m_traversal_string;
const CGameListCtrl* const m_game_list; const GameListCtrl* const m_game_list;
}; };

View File

@ -58,13 +58,13 @@ NetPlayServer* NetPlayDialog::netplay_server = nullptr;
NetPlayClient* NetPlayDialog::netplay_client = nullptr; NetPlayClient* NetPlayDialog::netplay_client = nullptr;
NetPlayDialog* NetPlayDialog::npd = nullptr; NetPlayDialog* NetPlayDialog::npd = nullptr;
void NetPlayDialog::FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list) void NetPlayDialog::FillWithGameNames(wxListBox* game_lbox, const GameListCtrl& game_list)
{ {
for (u32 i = 0; auto game = game_list.GetISO(i); ++i) for (u32 i = 0; auto game = game_list.GetISO(i); ++i)
game_lbox->Append(StrToWxStr(game->GetUniqueIdentifier())); game_lbox->Append(StrToWxStr(game->GetUniqueIdentifier()));
} }
NetPlayDialog::NetPlayDialog(wxWindow* const parent, const CGameListCtrl* const game_list, NetPlayDialog::NetPlayDialog(wxWindow* const parent, const GameListCtrl* const game_list,
const std::string& game, const bool is_hosting) const std::string& game, const bool is_hosting)
: wxFrame(parent, wxID_ANY, _("Dolphin NetPlay")), m_selected_game(game), m_start_btn(nullptr), : wxFrame(parent, wxID_ANY, _("Dolphin NetPlay")), m_selected_game(game), m_start_btn(nullptr),
m_host_label(nullptr), m_host_type_choice(nullptr), m_host_copy_btn(nullptr), m_host_label(nullptr), m_host_type_choice(nullptr), m_host_copy_btn(nullptr),

View File

@ -25,7 +25,7 @@
#include <wx/msw/winundef.h> #include <wx/msw/winundef.h>
#endif #endif
class CGameListCtrl; class GameListCtrl;
class MD5Dialog; class MD5Dialog;
class wxButton; class wxButton;
class wxCheckBox; class wxCheckBox;
@ -78,7 +78,7 @@ enum class MD5Target
class NetPlayDialog : public wxFrame, public NetPlayUI class NetPlayDialog : public wxFrame, public NetPlayUI
{ {
public: public:
NetPlayDialog(wxWindow* parent, const CGameListCtrl* const game_list, const std::string& game, NetPlayDialog(wxWindow* parent, const GameListCtrl* const game_list, const std::string& game,
const bool is_hosting = false); const bool is_hosting = false);
~NetPlayDialog(); ~NetPlayDialog();
@ -107,7 +107,7 @@ public:
static NetPlayDialog*& GetInstance() { return npd; } static NetPlayDialog*& GetInstance() { return npd; }
static NetPlayClient*& GetNetPlayClient() { return netplay_client; } static NetPlayClient*& GetNetPlayClient() { return netplay_client; }
static NetPlayServer*& GetNetPlayServer() { return netplay_server; } static NetPlayServer*& GetNetPlayServer() { return netplay_server; }
static void FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list); static void FillWithGameNames(wxListBox* game_lbox, const GameListCtrl& game_list);
bool IsRecording() override; bool IsRecording() override;
@ -163,7 +163,7 @@ private:
std::vector<int> m_playerids; std::vector<int> m_playerids;
Common::FifoQueue<std::string> m_chat_msgs; Common::FifoQueue<std::string> m_chat_msgs;
const CGameListCtrl* const m_game_list; const GameListCtrl* const m_game_list;
static NetPlayDialog* npd; static NetPlayDialog* npd;
static NetPlayServer* netplay_server; static NetPlayServer* netplay_server;