Merge pull request #5285 from spycrab/fr_9952

Make title column toggleable (Issue #9952)
This commit is contained in:
Léo Lam 2017-04-24 23:12:39 +02:00 committed by GitHub
commit dd31a403db
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("ColumnBanner", m_showBannerColumn);
gamelist->Set("ColumnTitle", m_showTitleColumn);
gamelist->Set("ColumnNotes", m_showMakerColumn);
gamelist->Set("ColumnFileName", m_showFileNameColumn);
gamelist->Set("ColumnID", m_showIDColumn);
@ -536,6 +537,7 @@ void SConfig::LoadGameListSettings(IniFile& ini)
// Gamelist columns toggles
gamelist->Get("ColumnPlatform", &m_showSystemColumn, true);
gamelist->Get("ColumnBanner", &m_showBannerColumn, true);
gamelist->Get("ColumnTitle", &m_showTitleColumn, true);
gamelist->Get("ColumnNotes", &m_showMakerColumn, true);
gamelist->Get("ColumnFileName", &m_showFileNameColumn, false);
gamelist->Get("ColumnID", &m_showIDColumn, false);

View File

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

View File

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

View File

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

View File

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

View File

@ -280,6 +280,8 @@ wxMenu* MainMenuBar::CreateViewMenu() const
columns_menu->Check(IDM_SHOW_SYSTEM, config_instance.m_showSystemColumn);
columns_menu->AppendCheckItem(IDM_SHOW_BANNER, _("Banner"));
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->Check(IDM_SHOW_MAKER, config_instance.m_showMakerColumn);
columns_menu->AppendCheckItem(IDM_SHOW_FILENAME, _("File Name"));