Make title column toggleable (Issue #9952)

This commit is contained in:
spycrab 2017-04-17 19:34:14 +02:00
parent e53969b6f2
commit 72e92add8a
6 changed files with 36 additions and 7 deletions

View File

@ -216,6 +216,7 @@ void SConfig::SaveGameListSettings(IniFile& ini)
gamelist->Set("ColumnPlatform", m_showSystemColumn); gamelist->Set("ColumnPlatform", m_showSystemColumn);
gamelist->Set("ColumnBanner", m_showBannerColumn); gamelist->Set("ColumnBanner", m_showBannerColumn);
gamelist->Set("ColumnTitle", m_showTitleColumn);
gamelist->Set("ColumnNotes", m_showMakerColumn); gamelist->Set("ColumnNotes", m_showMakerColumn);
gamelist->Set("ColumnFileName", m_showFileNameColumn); gamelist->Set("ColumnFileName", m_showFileNameColumn);
gamelist->Set("ColumnID", m_showIDColumn); gamelist->Set("ColumnID", m_showIDColumn);
@ -536,6 +537,7 @@ void SConfig::LoadGameListSettings(IniFile& ini)
// Gamelist columns toggles // Gamelist columns toggles
gamelist->Get("ColumnPlatform", &m_showSystemColumn, true); gamelist->Get("ColumnPlatform", &m_showSystemColumn, true);
gamelist->Get("ColumnBanner", &m_showBannerColumn, true); gamelist->Get("ColumnBanner", &m_showBannerColumn, true);
gamelist->Get("ColumnTitle", &m_showTitleColumn, true);
gamelist->Get("ColumnNotes", &m_showMakerColumn, true); gamelist->Get("ColumnNotes", &m_showMakerColumn, true);
gamelist->Get("ColumnFileName", &m_showFileNameColumn, false); gamelist->Get("ColumnFileName", &m_showFileNameColumn, false);
gamelist->Get("ColumnID", &m_showIDColumn, false); gamelist->Get("ColumnID", &m_showIDColumn, false);

View File

@ -293,6 +293,7 @@ struct SConfig : NonCopyable
// Game list column toggles // Game list column toggles
bool m_showSystemColumn; bool m_showSystemColumn;
bool m_showBannerColumn; bool m_showBannerColumn;
bool m_showTitleColumn;
bool m_showMakerColumn; bool m_showMakerColumn;
bool m_showFileNameColumn; bool m_showFileNameColumn;
bool m_showIDColumn; bool m_showIDColumn;

View File

@ -1640,6 +1640,9 @@ void CFrame::OnChangeColumnsVisible(wxCommandEvent& event)
case IDM_SHOW_BANNER: case IDM_SHOW_BANNER:
SConfig::GetInstance().m_showBannerColumn = !SConfig::GetInstance().m_showBannerColumn; SConfig::GetInstance().m_showBannerColumn = !SConfig::GetInstance().m_showBannerColumn;
break; break;
case IDM_SHOW_TITLE:
SConfig::GetInstance().m_showTitleColumn = !SConfig::GetInstance().m_showTitleColumn;
break;
case IDM_SHOW_MAKER: case IDM_SHOW_MAKER:
SConfig::GetInstance().m_showMakerColumn = !SConfig::GetInstance().m_showMakerColumn; SConfig::GetInstance().m_showMakerColumn = !SConfig::GetInstance().m_showMakerColumn;
break; break;

View File

@ -448,7 +448,8 @@ void CGameListCtrl::ReloadList()
0); 0);
SetColumnWidth(COLUMN_BANNER, SetColumnWidth(COLUMN_BANNER,
SConfig::GetInstance().m_showBannerColumn ? FromDIP(96 + platform_padding) : 0); SConfig::GetInstance().m_showBannerColumn ? FromDIP(96 + platform_padding) : 0);
SetColumnWidth(COLUMN_TITLE, FromDIP(175 + platform_padding)); SetColumnWidth(COLUMN_TITLE,
SConfig::GetInstance().m_showTitleColumn ? FromDIP(175 + platform_padding) : 0);
SetColumnWidth(COLUMN_MAKER, SetColumnWidth(COLUMN_MAKER,
SConfig::GetInstance().m_showMakerColumn ? FromDIP(150 + platform_padding) : 0); SConfig::GetInstance().m_showMakerColumn ? FromDIP(150 + platform_padding) : 0);
SetColumnWidth(COLUMN_FILENAME, SConfig::GetInstance().m_showFileNameColumn ? SetColumnWidth(COLUMN_FILENAME, SConfig::GetInstance().m_showFileNameColumn ?
@ -1433,27 +1434,46 @@ void CGameListCtrl::AutomaticColumnWidth()
rc.GetWidth() - (GetColumnWidth(COLUMN_PLATFORM) + GetColumnWidth(COLUMN_BANNER) + rc.GetWidth() - (GetColumnWidth(COLUMN_PLATFORM) + GetColumnWidth(COLUMN_BANNER) +
GetColumnWidth(COLUMN_ID) + GetColumnWidth(COLUMN_COUNTRY) + GetColumnWidth(COLUMN_ID) + GetColumnWidth(COLUMN_COUNTRY) +
GetColumnWidth(COLUMN_SIZE) + GetColumnWidth(COLUMN_EMULATION_STATE)); GetColumnWidth(COLUMN_SIZE) + GetColumnWidth(COLUMN_EMULATION_STATE));
if (SConfig::GetInstance().m_showTitleColumn && SConfig::GetInstance().m_showMakerColumn &&
if (SConfig::GetInstance().m_showMakerColumn && SConfig::GetInstance().m_showFileNameColumn) SConfig::GetInstance().m_showFileNameColumn)
{ {
SetColumnWidth(COLUMN_TITLE, resizable / 3); SetColumnWidth(COLUMN_TITLE, resizable / 3);
SetColumnWidth(COLUMN_MAKER, resizable / 3); SetColumnWidth(COLUMN_MAKER, resizable / 3);
SetColumnWidth(COLUMN_FILENAME, resizable / 3); SetColumnWidth(COLUMN_FILENAME, resizable / 3);
} }
else if (SConfig::GetInstance().m_showMakerColumn) else if (SConfig::GetInstance().m_showMakerColumn &&
SConfig::GetInstance().m_showFileNameColumn)
{ {
SetColumnWidth(COLUMN_TITLE, resizable / 2);
SetColumnWidth(COLUMN_MAKER, resizable / 2); SetColumnWidth(COLUMN_MAKER, resizable / 2);
SetColumnWidth(COLUMN_FILENAME, resizable / 2);
} }
else if (SConfig::GetInstance().m_showFileNameColumn) else if (SConfig::GetInstance().m_showMakerColumn && SConfig::GetInstance().m_showTitleColumn)
{
SetColumnWidth(COLUMN_MAKER, resizable / 2);
SetColumnWidth(COLUMN_TITLE, resizable / 2);
}
else if (SConfig::GetInstance().m_showFileNameColumn &&
SConfig::GetInstance().m_showTitleColumn)
{ {
SetColumnWidth(COLUMN_TITLE, resizable / 2); SetColumnWidth(COLUMN_TITLE, resizable / 2);
SetColumnWidth(COLUMN_FILENAME, resizable / 2); SetColumnWidth(COLUMN_FILENAME, resizable / 2);
} }
else else if (SConfig::GetInstance().m_showMakerColumn)
{
SetColumnWidth(COLUMN_MAKER, resizable);
}
else if (SConfig::GetInstance().m_showFileNameColumn)
{
SetColumnWidth(COLUMN_FILENAME, resizable);
}
else if (SConfig::GetInstance().m_showTitleColumn)
{ {
SetColumnWidth(COLUMN_TITLE, resizable); SetColumnWidth(COLUMN_TITLE, resizable);
} }
else
{
SetColumnWidth(COLUMN_DUMMY, resizable);
}
} }
Thaw(); Thaw();
} }

View File

@ -160,6 +160,7 @@ enum
// List Column Title Toggles // List Column Title Toggles
IDM_SHOW_SYSTEM = IDM_DEBUG_WINDOW_LIST_END, IDM_SHOW_SYSTEM = IDM_DEBUG_WINDOW_LIST_END,
IDM_SHOW_BANNER, IDM_SHOW_BANNER,
IDM_SHOW_TITLE,
IDM_SHOW_MAKER, IDM_SHOW_MAKER,
IDM_SHOW_FILENAME, IDM_SHOW_FILENAME,
IDM_SHOW_ID, IDM_SHOW_ID,

View File

@ -276,6 +276,8 @@ wxMenu* MainMenuBar::CreateViewMenu() const
columns_menu->Check(IDM_SHOW_SYSTEM, config_instance.m_showSystemColumn); columns_menu->Check(IDM_SHOW_SYSTEM, config_instance.m_showSystemColumn);
columns_menu->AppendCheckItem(IDM_SHOW_BANNER, _("Banner")); columns_menu->AppendCheckItem(IDM_SHOW_BANNER, _("Banner"));
columns_menu->Check(IDM_SHOW_BANNER, config_instance.m_showBannerColumn); columns_menu->Check(IDM_SHOW_BANNER, config_instance.m_showBannerColumn);
columns_menu->AppendCheckItem(IDM_SHOW_TITLE, _("Title"));
columns_menu->Check(IDM_SHOW_TITLE, config_instance.m_showTitleColumn);
columns_menu->AppendCheckItem(IDM_SHOW_MAKER, _("Maker")); columns_menu->AppendCheckItem(IDM_SHOW_MAKER, _("Maker"));
columns_menu->Check(IDM_SHOW_MAKER, config_instance.m_showMakerColumn); columns_menu->Check(IDM_SHOW_MAKER, config_instance.m_showMakerColumn);
columns_menu->AppendCheckItem(IDM_SHOW_FILENAME, _("File Name")); columns_menu->AppendCheckItem(IDM_SHOW_FILENAME, _("File Name"));