Save secondary list sorting.

Allow sorting by platform ascending.

Fixes issue 5774.
This commit is contained in:
rog 2012-12-17 06:08:45 -05:00
parent 351979795c
commit 4c7b63cf0e
4 changed files with 27 additions and 10 deletions

View File

@ -212,6 +212,7 @@ void SConfig::SaveSettings()
ini.Set("GameList", "ListTaiwan", m_ListTaiwan); ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
ini.Set("GameList", "ListUnknown", m_ListUnknown); ini.Set("GameList", "ListUnknown", m_ListUnknown);
ini.Set("GameList", "ListSort", m_ListSort); ini.Set("GameList", "ListSort", m_ListSort);
ini.Set("GameList", "ListSortSecondary", m_ListSort2);
// Core // Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
@ -350,7 +351,8 @@ void SConfig::LoadSettings()
ini.Get("GameList", "ListKorea", &m_ListKorea, true); ini.Get("GameList", "ListKorea", &m_ListKorea, true);
ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true); ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
ini.Get("GameList", "ListUnknown", &m_ListUnknown, true); ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
ini.Get("GameList", "ListSort", &m_ListSort, 2); ini.Get("GameList", "ListSort", &m_ListSort, 3);
ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
// Core // Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false); ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);

View File

@ -62,7 +62,6 @@ struct SConfig : NonCopyable
bool m_InterfaceLogWindow; bool m_InterfaceLogWindow;
bool m_InterfaceLogConfigWindow; bool m_InterfaceLogConfigWindow;
bool m_InterfaceConsole; bool m_InterfaceConsole;
int m_ListSort;
bool m_ListDrives; bool m_ListDrives;
bool m_ListWad; bool m_ListWad;
@ -76,6 +75,9 @@ struct SConfig : NonCopyable
bool m_ListKorea; bool m_ListKorea;
bool m_ListTaiwan; bool m_ListTaiwan;
bool m_ListUnknown; bool m_ListUnknown;
int m_ListSort;
int m_ListSort2;
std::string m_WirelessMac; std::string m_WirelessMac;
bool m_PauseMovie; bool m_PauseMovie;
bool m_ShowLag; bool m_ShowLag;

View File

@ -51,6 +51,7 @@
size_t CGameListCtrl::m_currentItem = 0; size_t CGameListCtrl::m_currentItem = 0;
size_t CGameListCtrl::m_numberItem = 0; size_t CGameListCtrl::m_numberItem = 0;
std::string CGameListCtrl::m_currentFilename; std::string CGameListCtrl::m_currentFilename;
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 = CGameListCtrl::COLUMN_TITLE)
@ -284,6 +285,7 @@ void CGameListCtrl::Update()
InitBitmaps(); InitBitmaps();
// add columns // add columns
InsertColumn(COLUMN_DUMMY,_T(""));
InsertColumn(COLUMN_PLATFORM, _T("")); InsertColumn(COLUMN_PLATFORM, _T(""));
InsertColumn(COLUMN_BANNER, _("Banner")); InsertColumn(COLUMN_BANNER, _("Banner"));
InsertColumn(COLUMN_TITLE, _("Title")); InsertColumn(COLUMN_TITLE, _("Title"));
@ -303,6 +305,7 @@ void CGameListCtrl::Update()
#endif #endif
// set initial sizes for columns // set initial sizes for columns
SetColumnWidth(COLUMN_DUMMY,0);
SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding); SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding);
SetColumnWidth(COLUMN_BANNER, 96 + platform_padding); SetColumnWidth(COLUMN_BANNER, 96 + platform_padding);
SetColumnWidth(COLUMN_TITLE, 200 + platform_padding); SetColumnWidth(COLUMN_TITLE, 200 + platform_padding);
@ -320,9 +323,14 @@ void CGameListCtrl::Update()
// Sort items by Title // Sort items by Title
wxListEvent event; wxListEvent event;
event.m_col = SConfig::GetInstance().m_ListSort; last_column = 0; event.m_col = SConfig::GetInstance().m_ListSort2;
last_column = 1;
OnColumnClick(event); OnColumnClick(event);
event.m_col = SConfig::GetInstance().m_ListSort;
OnColumnClick(event);
sorted = true;
SetColumnWidth(COLUMN_SIZE, wxLIST_AUTOSIZE); SetColumnWidth(COLUMN_SIZE, wxLIST_AUTOSIZE);
} }
else else
@ -414,9 +422,11 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
GameListItem& rISOFile = *m_ISOFiles[_Index]; GameListItem& rISOFile = *m_ISOFiles[_Index];
m_gamePath.append(rISOFile.GetFileName() + '\n'); m_gamePath.append(rISOFile.GetFileName() + '\n');
// Insert a first row with the platform image, that will be used as the Index // Insert a first row with nothing in it, that will be used as the Index
long ItemIndex = InsertItem(_Index, wxEmptyString, long ItemIndex = InsertItem(_Index, wxEmptyString);
m_PlatformImageIndex[rISOFile.GetPlatform()]);
// Insert the platform's image in the first (visible) column
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]);
if (rISOFile.GetImage().IsOk()) if (rISOFile.GetImage().IsOk())
ImageIndex = m_imageListSmall->Add(rISOFile.GetImage()); ImageIndex = m_imageListSmall->Add(rISOFile.GetImage());
@ -708,10 +718,12 @@ void CGameListCtrl::OnColumnClick(wxListEvent& event)
} }
else else
{ {
if (sorted)
SConfig::GetInstance().m_ListSort2 = last_sort;
last_column = current_column; last_column = current_column;
last_sort = current_column; last_sort = current_column;
} }
if (sorted)
SConfig::GetInstance().m_ListSort = last_sort; SConfig::GetInstance().m_ListSort = last_sort;
caller = this; caller = this;
SortItems(wxListCompare, last_sort); SortItems(wxListCompare, last_sort);

View File

@ -57,7 +57,8 @@ public:
enum enum
{ {
COLUMN_PLATFORM = 0, COLUMN_DUMMY = 0,
COLUMN_PLATFORM,
COLUMN_BANNER, COLUMN_BANNER,
COLUMN_TITLE, COLUMN_TITLE,
COLUMN_NOTES, COLUMN_NOTES,