Merge pull request #435 from YourGamesBeOver/master

Options for selecting which columns are visible in the game list.
This commit is contained in:
Pierre Bourdon 2014-06-06 00:46:26 +02:00
commit b780ef950c
8 changed files with 127 additions and 13 deletions

View File

@ -226,6 +226,16 @@ void SConfig::SaveSettings()
ini.Set("GameList", "ListSort", m_ListSort); ini.Set("GameList", "ListSort", m_ListSort);
ini.Set("GameList", "ListSortSecondary", m_ListSort2); ini.Set("GameList", "ListSortSecondary", m_ListSort2);
ini.Set("GameList", "ColorCompressed", m_ColorCompressed);
ini.Set("GameList", "ColumnPlatform", m_showSystemColumn);
ini.Set("GameList", "ColumnBanner", m_showBannerColumn);
ini.Set("GameList", "ColumnNotes", m_showNotesColumn);
ini.Set("GameList", "ColumnID", m_showIDColumn);
ini.Set("GameList", "ColumnRegion", m_showRegionColumn);
ini.Set("GameList", "ColumnSize", m_showSizeColumn);
ini.Set("GameList", "ColumnState", m_showStateColumn);
// Core // Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore); ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
@ -376,6 +386,18 @@ void SConfig::LoadSettings()
ini.Get("GameList", "ListSort", &m_ListSort, 3); ini.Get("GameList", "ListSort", &m_ListSort, 3);
ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0); ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
// Determines if compressed games display in blue
ini.Get("GameList", "ColorCompressed", &m_ColorCompressed, true);
// Gamelist columns toggles
ini.Get("GameList", "ColumnPlatform", &m_showSystemColumn, true);
ini.Get("GameList", "ColumnBanner", &m_showBannerColumn, true);
ini.Get("GameList", "ColumnNotes", &m_showNotesColumn, true);
ini.Get("GameList", "ColumnID", &m_showIDColumn, false);
ini.Get("GameList", "ColumnRegion", &m_showRegionColumn, true);
ini.Get("GameList", "ColumnSize", &m_showSizeColumn, true);
ini.Get("GameList", "ColumnState", &m_showStateColumn, true);
// Core // Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false); ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
#ifdef _M_X86 #ifdef _M_X86

View File

@ -72,6 +72,18 @@ struct SConfig : NonCopyable
int m_ListSort; int m_ListSort;
int m_ListSort2; int m_ListSort2;
// Game list column toggles
bool m_showSystemColumn;
bool m_showBannerColumn;
bool m_showNotesColumn;
bool m_showIDColumn;
bool m_showRegionColumn;
bool m_showSizeColumn;
bool m_showStateColumn;
// Toggles whether compressed titles show up in blue in the game list
bool m_ColorCompressed;
std::string m_WirelessMac; std::string m_WirelessMac;
bool m_PauseMovie; bool m_PauseMovie;
bool m_ShowLag; bool m_ShowLag;

View File

@ -248,6 +248,7 @@ EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
EVT_MENU_RANGE(IDM_LOGWINDOW, IDM_VIDEOWINDOW, CFrame::OnToggleWindow) EVT_MENU_RANGE(IDM_LOGWINDOW, IDM_VIDEOWINDOW, CFrame::OnToggleWindow)
EVT_MENU_RANGE(IDM_SHOW_SYSTEM, IDM_SHOW_STATE, CFrame::OnChangeColumnsVisible)
EVT_MENU(IDM_PURGECACHE, CFrame::GameListChanged) EVT_MENU(IDM_PURGECACHE, CFrame::GameListChanged)

View File

@ -343,6 +343,7 @@ private:
void OnRenderParentResize(wxSizeEvent& event); void OnRenderParentResize(wxSizeEvent& event);
bool RendererIsFullscreen(); bool RendererIsFullscreen();
void StartGame(const std::string& filename); void StartGame(const std::string& filename);
void OnChangeColumnsVisible(wxCommandEvent& event);
// Event table // Event table
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();

View File

@ -318,6 +318,26 @@ void CFrame::CreateMenu()
viewMenu->AppendCheckItem(IDM_LISTDRIVES, _("Show Drives")); viewMenu->AppendCheckItem(IDM_LISTDRIVES, _("Show Drives"));
viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives); viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives);
viewMenu->Append(IDM_PURGECACHE, _("Purge Cache")); viewMenu->Append(IDM_PURGECACHE, _("Purge Cache"));
wxMenu *columnsMenu = new wxMenu;
viewMenu->AppendSubMenu(columnsMenu, _("Select Columns"));
columnsMenu->AppendCheckItem(IDM_SHOW_SYSTEM, _("Platform"));
columnsMenu->Check(IDM_SHOW_SYSTEM, SConfig::GetInstance().m_showSystemColumn);
columnsMenu->AppendCheckItem(IDM_SHOW_BANNER, _("Banner"));
columnsMenu->Check(IDM_SHOW_BANNER, SConfig::GetInstance().m_showBannerColumn);
columnsMenu->AppendCheckItem(IDM_SHOW_NOTES, _("Notes"));
columnsMenu->Check(IDM_SHOW_NOTES, SConfig::GetInstance().m_showNotesColumn);
columnsMenu->AppendCheckItem(IDM_SHOW_ID, _("Game ID"));
columnsMenu->Check(IDM_SHOW_ID, SConfig::GetInstance().m_showIDColumn);
columnsMenu->AppendCheckItem(IDM_SHOW_REGION, _("Region"));
columnsMenu->Check(IDM_SHOW_REGION, SConfig::GetInstance().m_showRegionColumn);
columnsMenu->AppendCheckItem(IDM_SHOW_SIZE, _("File size"));
columnsMenu->Check(IDM_SHOW_SIZE, SConfig::GetInstance().m_showSizeColumn);
columnsMenu->AppendCheckItem(IDM_SHOW_STATE, _("State"));
columnsMenu->Check(IDM_SHOW_STATE, SConfig::GetInstance().m_showStateColumn);
m_MenuBar->Append(viewMenu, _("&View")); m_MenuBar->Append(viewMenu, _("&View"));
if (g_pCodeWindow) if (g_pCodeWindow)
@ -1884,3 +1904,34 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
this->SendSizeEvent(); this->SendSizeEvent();
} }
void CFrame::OnChangeColumnsVisible(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_SHOW_SYSTEM:
SConfig::GetInstance().m_showSystemColumn = !SConfig::GetInstance().m_showSystemColumn;
break;
case IDM_SHOW_BANNER:
SConfig::GetInstance().m_showBannerColumn = !SConfig::GetInstance().m_showBannerColumn;
break;
case IDM_SHOW_NOTES:
SConfig::GetInstance().m_showNotesColumn = !SConfig::GetInstance().m_showNotesColumn;
break;
case IDM_SHOW_ID:
SConfig::GetInstance().m_showIDColumn = !SConfig::GetInstance().m_showIDColumn;
break;
case IDM_SHOW_REGION:
SConfig::GetInstance().m_showRegionColumn = !SConfig::GetInstance().m_showRegionColumn;
break;
case IDM_SHOW_SIZE:
SConfig::GetInstance().m_showSizeColumn = !SConfig::GetInstance().m_showSizeColumn;
break;
case IDM_SHOW_STATE:
SConfig::GetInstance().m_showStateColumn = !SConfig::GetInstance().m_showStateColumn;
break;
default: return;
}
m_GameListCtrl->Update();
SConfig::GetInstance().SaveSettings();
}

View File

@ -143,6 +143,8 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
iso2->GetCompany() : iso2->GetDescription(indexOther); iso2->GetCompany() : iso2->GetDescription(indexOther);
return strcasecmp(cmp1.c_str(), cmp2.c_str()) * t; return strcasecmp(cmp1.c_str(), cmp2.c_str()) * t;
} }
case CGameListCtrl::COLUMN_ID:
return strcasecmp(iso1->GetUniqueID().c_str(), iso2->GetUniqueID().c_str()) * t;
case CGameListCtrl::COLUMN_COUNTRY: case CGameListCtrl::COLUMN_COUNTRY:
if (iso1->GetCountry() > iso2->GetCountry()) if (iso1->GetCountry() > iso2->GetCountry())
return 1 * t; return 1 * t;
@ -317,6 +319,7 @@ void CGameListCtrl::Update()
// wii titles We show in the same column : company for GC games and // wii titles We show in the same column : company for GC games and
// description for wii/wad games // description for wii/wad games
InsertColumn(COLUMN_NOTES, _("Notes")); InsertColumn(COLUMN_NOTES, _("Notes"));
InsertColumn(COLUMN_ID, _("ID"));
InsertColumn(COLUMN_COUNTRY, ""); InsertColumn(COLUMN_COUNTRY, "");
InsertColumn(COLUMN_SIZE, _("Size")); InsertColumn(COLUMN_SIZE, _("Size"));
InsertColumn(COLUMN_EMULATION_STATE, _("State")); InsertColumn(COLUMN_EMULATION_STATE, _("State"));
@ -329,18 +332,19 @@ void CGameListCtrl::Update()
// set initial sizes for columns // set initial sizes for columns
SetColumnWidth(COLUMN_DUMMY,0); SetColumnWidth(COLUMN_DUMMY,0);
SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding); SetColumnWidth(COLUMN_PLATFORM, SConfig::GetInstance().m_showSystemColumn ? 35 + platform_padding : 0);
SetColumnWidth(COLUMN_BANNER, 96 + platform_padding); SetColumnWidth(COLUMN_BANNER, SConfig::GetInstance().m_showBannerColumn ? 96 + platform_padding : 0);
SetColumnWidth(COLUMN_TITLE, 200 + platform_padding); SetColumnWidth(COLUMN_TITLE, 175 + platform_padding);
SetColumnWidth(COLUMN_NOTES, 200 + platform_padding); SetColumnWidth(COLUMN_NOTES, SConfig::GetInstance().m_showNotesColumn ? 150 + platform_padding : 0);
SetColumnWidth(COLUMN_COUNTRY, 32 + platform_padding); SetColumnWidth(COLUMN_ID, SConfig::GetInstance().m_showIDColumn ? 75 + platform_padding : 0);
SetColumnWidth(COLUMN_EMULATION_STATE, 50 + platform_padding); SetColumnWidth(COLUMN_COUNTRY, SConfig::GetInstance().m_showRegionColumn ? 32 + platform_padding : 0);
SetColumnWidth(COLUMN_EMULATION_STATE, SConfig::GetInstance().m_showStateColumn ? 50 + platform_padding : 0);
// add all items // add all items
for (int i = 0; i < (int)m_ISOFiles.size(); i++) for (int i = 0; i < (int)m_ISOFiles.size(); i++)
{ {
InsertItemInReportView(i); InsertItemInReportView(i);
if (m_ISOFiles[i]->IsCompressed()) if (SConfig::GetInstance().m_ColorCompressed && m_ISOFiles[i]->IsCompressed())
SetItemTextColour(i, wxColour(0xFF0000)); SetItemTextColour(i, wxColour(0xFF0000));
} }
@ -459,6 +463,9 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// File size // File size
SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1); SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1);
// Game ID
SetItem(_Index, COLUMN_ID, rISOFile.GetUniqueID(), -1);
// Background color // Background color
SetBackgroundColor(); SetBackgroundColor();
@ -1278,20 +1285,29 @@ void CGameListCtrl::AutomaticColumnWidth()
{ {
SetColumnWidth(0, rc.GetWidth()); SetColumnWidth(0, rc.GetWidth());
} }
else if (GetColumnCount() > 4) else
{ {
int resizable = rc.GetWidth() - ( int resizable = rc.GetWidth() - (
GetColumnWidth(COLUMN_BANNER) GetColumnWidth(COLUMN_PLATFORM)
+ GetColumnWidth(COLUMN_BANNER)
+ GetColumnWidth(COLUMN_ID)
+ GetColumnWidth(COLUMN_COUNTRY) + GetColumnWidth(COLUMN_COUNTRY)
+ GetColumnWidth(COLUMN_SIZE) + GetColumnWidth(COLUMN_SIZE)
+ GetColumnWidth(COLUMN_EMULATION_STATE) + GetColumnWidth(COLUMN_EMULATION_STATE));
+ GetColumnWidth(COLUMN_PLATFORM));
// We hide the Notes column if the window is too small // We hide the Notes column if the window is too small
if (resizable > 400) if (resizable > 400)
{ {
SetColumnWidth(COLUMN_TITLE, resizable / 2); if (SConfig::GetInstance().m_showNotesColumn)
SetColumnWidth(COLUMN_NOTES, resizable / 2); {
SetColumnWidth(COLUMN_TITLE, resizable / 2);
SetColumnWidth(COLUMN_NOTES, resizable / 2);
}
else
{
SetColumnWidth(COLUMN_TITLE, resizable);
}
} }
else else
{ {

View File

@ -51,6 +51,7 @@ public:
COLUMN_BANNER, COLUMN_BANNER,
COLUMN_TITLE, COLUMN_TITLE,
COLUMN_NOTES, COLUMN_NOTES,
COLUMN_ID,
COLUMN_COUNTRY, COLUMN_COUNTRY,
COLUMN_SIZE, COLUMN_SIZE,
COLUMN_EMULATION_STATE, COLUMN_EMULATION_STATE,

View File

@ -138,6 +138,16 @@ enum
IDM_VIDEOWINDOW, IDM_VIDEOWINDOW,
IDM_CODEWINDOW, IDM_CODEWINDOW,
// List Column Title Toggles
IDM_SHOW_SYSTEM,
IDM_SHOW_BANNER,
IDM_SHOW_NOTES,
IDM_SHOW_ID,
IDM_SHOW_REGION,
IDM_SHOW_SIZE,
IDM_SHOW_STATE,
// Float Window IDs // Float Window IDs
IDM_LOGWINDOW_PARENT, IDM_LOGWINDOW_PARENT,
IDM_LOGCONFIGWINDOW_PARENT, IDM_LOGCONFIGWINDOW_PARENT,