mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 18:58:36 +12:00
Merge pull request #275 from Blaypeg/master
GUI Update, Game panel column headings now sortable
This commit is contained in:
commit
b953e06622
4 changed files with 73 additions and 6 deletions
|
@ -11,6 +11,7 @@ GameViewer::GameViewer(wxWindow* parent) : wxListView(parent)
|
||||||
m_path = "/dev_hdd0/game/";
|
m_path = "/dev_hdd0/game/";
|
||||||
|
|
||||||
Bind(wxEVT_LIST_ITEM_ACTIVATED, &GameViewer::DClick, this);
|
Bind(wxEVT_LIST_ITEM_ACTIVATED, &GameViewer::DClick, this);
|
||||||
|
Bind(wxEVT_LIST_COL_CLICK, &GameViewer::OnColClick, this);
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
@ -25,6 +26,49 @@ void GameViewer::DoResize(wxSize size)
|
||||||
SetSize(size);
|
SetSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxCALLBACK ListItemCompare(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortinfo)
|
||||||
|
{
|
||||||
|
ListSortInfo *SortInfo = (ListSortInfo *)sortinfo;
|
||||||
|
int Column = SortInfo->Column;
|
||||||
|
GameViewer *pGameViewer = SortInfo->GameViewerCtrl;
|
||||||
|
bool SortAscending = SortInfo->SortAscending;
|
||||||
|
long index1 = pGameViewer->FindItem(-1, item1);
|
||||||
|
long index2 = pGameViewer->FindItem(-1, item2);
|
||||||
|
wxString string1 = pGameViewer->GetItemText(index1, Column);
|
||||||
|
wxString string2 = pGameViewer->GetItemText(index2, Column);
|
||||||
|
|
||||||
|
if (string1.Cmp(string2) < 0)
|
||||||
|
{
|
||||||
|
return SortAscending ? -1 : 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (string1.Cmp(string2) > 0)
|
||||||
|
{
|
||||||
|
return SortAscending ? 1 : -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameViewer::OnColClick(wxListEvent& event)
|
||||||
|
{
|
||||||
|
if (event.GetColumn() == SortInfo.Column)
|
||||||
|
{
|
||||||
|
SortInfo.SortAscending = SortInfo.SortAscending ? FALSE : TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SortInfo.SortAscending = TRUE;
|
||||||
|
}
|
||||||
|
SortInfo.Column = event.GetColumn();
|
||||||
|
SortInfo.GameViewerCtrl = this;
|
||||||
|
SortItems(ListItemCompare, (long)&SortInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GameViewer::LoadGames()
|
void GameViewer::LoadGames()
|
||||||
{
|
{
|
||||||
vfsDir dir(m_path);
|
vfsDir dir(m_path);
|
||||||
|
|
|
@ -140,8 +140,13 @@ public:
|
||||||
|
|
||||||
for(u32 i=0; i<col->data.size(); ++i)
|
for(u32 i=0; i<col->data.size(); ++i)
|
||||||
{
|
{
|
||||||
if(list->GetItemCount() <= (int)i) list->InsertItem(i, wxEmptyString);
|
if (list->GetItemCount() <= (int)i)
|
||||||
|
{
|
||||||
|
list->InsertItem(i, wxEmptyString);
|
||||||
|
list->SetItemData(i, i);
|
||||||
|
}
|
||||||
list->SetItem(i, c, fmt::FromUTF8(col->data[i]));
|
list->SetItem(i, c, fmt::FromUTF8(col->data[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,6 +221,21 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ListSortInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ListSortInfo()
|
||||||
|
{
|
||||||
|
SortAscending = false;
|
||||||
|
Column = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SortAscending;
|
||||||
|
int Column;
|
||||||
|
class GameViewer *GameViewerCtrl;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class GameViewer : public wxListView
|
class GameViewer : public wxListView
|
||||||
{
|
{
|
||||||
std::string m_path;
|
std::string m_path;
|
||||||
|
@ -224,6 +244,9 @@ class GameViewer : public wxListView
|
||||||
ColumnsArr m_columns;
|
ColumnsArr m_columns;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
ListSortInfo SortInfo;
|
||||||
|
|
||||||
GameViewer(wxWindow* parent);
|
GameViewer(wxWindow* parent);
|
||||||
~GameViewer();
|
~GameViewer();
|
||||||
|
|
||||||
|
@ -237,7 +260,7 @@ public:
|
||||||
void LoadSettings();
|
void LoadSettings();
|
||||||
|
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void DClick(wxListEvent& event);
|
virtual void DClick(wxListEvent& event);
|
||||||
|
void OnColClick(wxListEvent& event);
|
||||||
};
|
};
|
||||||
|
|
|
@ -191,9 +191,9 @@ void MemoryViewerPanel::ShowMemory()
|
||||||
t_mem_addr_str += wxString::Format("%08x ", addr);
|
t_mem_addr_str += wxString::Format("%08x ", addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int row = 0; row < m_rowcount; row++)
|
for (u32 row = 0; row < m_rowcount; row++)
|
||||||
{
|
{
|
||||||
for (int col = 0; col < m_colcount; col++)
|
for (u32 col = 0; col < m_colcount; col++)
|
||||||
{
|
{
|
||||||
u32 addr = m_addr + row * m_colcount + col;
|
u32 addr = m_addr + row * m_colcount + col;
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ void VHDDManagerDialog::LoadPaths()
|
||||||
{
|
{
|
||||||
IniEntry<int> path_count;
|
IniEntry<int> path_count;
|
||||||
path_count.Init("path_count", "HDDManager");
|
path_count.Init("path_count", "HDDManager");
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
count = path_count.LoadValue(count);
|
count = path_count.LoadValue(count);
|
||||||
|
|
||||||
for(size_t i=0; i<count; ++i)
|
for(size_t i=0; i<count; ++i)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue