clang-format: -pcsx2\gui\AppRes.cpp

This commit is contained in:
RedDevilus 2021-05-04 03:17:04 +02:00 committed by lightningterror
parent d760ad7293
commit 8760214817
1 changed files with 45 additions and 42 deletions

View File

@ -43,12 +43,12 @@
RecentIsoList::RecentIsoList(int firstIdForMenuItems_or_wxID_ANY)
{
Menu = std::unique_ptr<wxMenu>(new wxMenu());
Menu->Append( MenuId_IsoBrowse, _("Browse..."), _("Browse for an ISO that is not in your recent history."));
Menu->Append(MenuId_IsoBrowse, _("Browse..."), _("Browse for an ISO that is not in your recent history."));
Menu->AppendSeparator();
Menu->AppendCheckItem( MenuId_Ask_On_Booting, _("Always ask when booting"), _("Manually select an ISO upon boot ignoring the selection from recent ISO list.") );
Menu->Check( MenuId_Ask_On_Booting, g_Conf->AskOnBoot );
Menu->AppendCheckItem(MenuId_Ask_On_Booting, _("Always ask when booting"), _("Manually select an ISO upon boot ignoring the selection from recent ISO list."));
Menu->Check(MenuId_Ask_On_Booting, g_Conf->AskOnBoot);
Manager = std::unique_ptr<RecentIsoManager>(new RecentIsoManager( Menu.get(), firstIdForMenuItems_or_wxID_ANY ));
Manager = std::unique_ptr<RecentIsoManager>(new RecentIsoManager(Menu.get(), firstIdForMenuItems_or_wxID_ANY));
}
pxAppResources::pxAppResources()
@ -59,19 +59,21 @@ pxAppResources::~pxAppResources() = default;
wxMenu& Pcsx2App::GetRecentIsoMenu()
{
if (!m_RecentIsoList) m_RecentIsoList = std::unique_ptr<RecentIsoList>(new RecentIsoList( MenuId_RecentIsos_reservedStart ));
if (!m_RecentIsoList)
m_RecentIsoList = std::unique_ptr<RecentIsoList>(new RecentIsoList(MenuId_RecentIsos_reservedStart));
return *m_RecentIsoList->Menu;
}
RecentIsoManager& Pcsx2App::GetRecentIsoManager()
{
if (!m_RecentIsoList) m_RecentIsoList = std::unique_ptr<RecentIsoList>(new RecentIsoList( MenuId_RecentIsos_reservedStart ));
if (!m_RecentIsoList)
m_RecentIsoList = std::unique_ptr<RecentIsoList>(new RecentIsoList(MenuId_RecentIsos_reservedStart));
return *m_RecentIsoList->Manager;
}
wxMenu& Pcsx2App::GetDriveListMenu()
{
if( !m_DriveList )
if (!m_DriveList)
{
m_DriveList = std::unique_ptr<DriveList>(new DriveList());
}
@ -81,8 +83,8 @@ wxMenu& Pcsx2App::GetDriveListMenu()
pxAppResources& Pcsx2App::GetResourceCache()
{
ScopedLock lock( m_mtx_Resources );
if( !m_Resources )
ScopedLock lock(m_mtx_Resources);
if (!m_Resources)
m_Resources = std::unique_ptr<pxAppResources>(new pxAppResources());
return *m_Resources;
@ -90,13 +92,13 @@ pxAppResources& Pcsx2App::GetResourceCache()
const wxIconBundle& Pcsx2App::GetIconBundle()
{
std::unique_ptr<wxIconBundle>& bundle( GetResourceCache().IconBundle );
if( !bundle )
std::unique_ptr<wxIconBundle>& bundle(GetResourceCache().IconBundle);
if (!bundle)
{
bundle = std::unique_ptr<wxIconBundle>(new wxIconBundle());
bundle->AddIcon( EmbeddedImage<res_AppIcon32>().GetIcon() );
bundle->AddIcon( EmbeddedImage<res_AppIcon64>().GetIcon() );
bundle->AddIcon( EmbeddedImage<res_AppIcon16>().GetIcon() );
bundle->AddIcon(EmbeddedImage<res_AppIcon32>().GetIcon());
bundle->AddIcon(EmbeddedImage<res_AppIcon64>().GetIcon());
bundle->AddIcon(EmbeddedImage<res_AppIcon16>().GetIcon());
}
return *bundle;
@ -104,8 +106,9 @@ const wxIconBundle& Pcsx2App::GetIconBundle()
const wxBitmap& Pcsx2App::GetLogoBitmap()
{
std::unique_ptr <wxBitmap>& logo(GetResourceCache().Bitmap_Logo);
if( logo ) return *logo;
std::unique_ptr<wxBitmap>& logo(GetResourceCache().Bitmap_Logo);
if (logo)
return *logo;
wxImage img = EmbeddedImage<res_BackgroundLogo>().Get();
float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
@ -117,7 +120,8 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
const wxBitmap& Pcsx2App::GetScreenshotBitmap()
{
std::unique_ptr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap);
if (screenshot) return *screenshot;
if (screenshot)
return *screenshot;
wxImage img = EmbeddedImage<res_ButtonIcon_Camera>().Get();
float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
@ -128,27 +132,27 @@ const wxBitmap& Pcsx2App::GetScreenshotBitmap()
wxImageList& Pcsx2App::GetImgList_Config()
{
std::unique_ptr<wxImageList>& images( GetResourceCache().ConfigImages );
if( !images )
std::unique_ptr<wxImageList>& images(GetResourceCache().ConfigImages);
if (!images)
{
int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize;
images = std::unique_ptr<wxImageList>(new wxImageList(image_size, image_size));
#undef FancyLoadMacro
#define FancyLoadMacro( name ) \
{ \
wxImage img = EmbeddedImage<res_ConfigIcon_##name>().Get(); \
img.Rescale(image_size, image_size, wxIMAGE_QUALITY_HIGH); \
m_Resources->ImageId.Config.name = images->Add(img); \
}
#undef FancyLoadMacro
#define FancyLoadMacro(name) \
{ \
wxImage img = EmbeddedImage<res_ConfigIcon_##name>().Get(); \
img.Rescale(image_size, image_size, wxIMAGE_QUALITY_HIGH); \
m_Resources->ImageId.Config.name = images->Add(img); \
}
FancyLoadMacro( Paths );
FancyLoadMacro( Plugins );
FancyLoadMacro( Gamefixes );
FancyLoadMacro( Speedhacks );
FancyLoadMacro( MemoryCard );
FancyLoadMacro( Video );
FancyLoadMacro( Cpu );
FancyLoadMacro(Paths);
FancyLoadMacro(Plugins);
FancyLoadMacro(Gamefixes);
FancyLoadMacro(Speedhacks);
FancyLoadMacro(MemoryCard);
FancyLoadMacro(Video);
FancyLoadMacro(Cpu);
}
return *images;
}
@ -156,20 +160,19 @@ wxImageList& Pcsx2App::GetImgList_Config()
// This stuff seems unused?
wxImageList& Pcsx2App::GetImgList_Toolbars()
{
std::unique_ptr<wxImageList>& images( GetResourceCache().ToolbarImages );
std::unique_ptr<wxImageList>& images(GetResourceCache().ToolbarImages);
if( !images )
if (!images)
{
const int imgSize = g_Conf->Toolbar_ImageSize ? 64 : 32;
images = std::unique_ptr<wxImageList>(new wxImageList(imgSize, imgSize));
#undef FancyLoadMacro
#define FancyLoadMacro( name ) \
{ \
wxImage img = EmbeddedImage<res_ToolbarIcon_##name>(imgSize, imgSize).Get(); \
m_Resources.ImageId.Toolbars.name = images->Add(img); \
}
#undef FancyLoadMacro
#define FancyLoadMacro(name) \
{ \
wxImage img = EmbeddedImage<res_ToolbarIcon_##name>(imgSize, imgSize).Get(); \
m_Resources.ImageId.Toolbars.name = images->Add(img); \
}
}
return *images;
}