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) RecentIsoList::RecentIsoList(int firstIdForMenuItems_or_wxID_ANY)
{ {
Menu = std::unique_ptr<wxMenu>(new wxMenu()); 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->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->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->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() pxAppResources::pxAppResources()
@ -59,19 +59,21 @@ pxAppResources::~pxAppResources() = default;
wxMenu& Pcsx2App::GetRecentIsoMenu() 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; return *m_RecentIsoList->Menu;
} }
RecentIsoManager& Pcsx2App::GetRecentIsoManager() 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; return *m_RecentIsoList->Manager;
} }
wxMenu& Pcsx2App::GetDriveListMenu() wxMenu& Pcsx2App::GetDriveListMenu()
{ {
if( !m_DriveList ) if (!m_DriveList)
{ {
m_DriveList = std::unique_ptr<DriveList>(new DriveList()); m_DriveList = std::unique_ptr<DriveList>(new DriveList());
} }
@ -81,8 +83,8 @@ wxMenu& Pcsx2App::GetDriveListMenu()
pxAppResources& Pcsx2App::GetResourceCache() pxAppResources& Pcsx2App::GetResourceCache()
{ {
ScopedLock lock( m_mtx_Resources ); ScopedLock lock(m_mtx_Resources);
if( !m_Resources ) if (!m_Resources)
m_Resources = std::unique_ptr<pxAppResources>(new pxAppResources()); m_Resources = std::unique_ptr<pxAppResources>(new pxAppResources());
return *m_Resources; return *m_Resources;
@ -90,13 +92,13 @@ pxAppResources& Pcsx2App::GetResourceCache()
const wxIconBundle& Pcsx2App::GetIconBundle() const wxIconBundle& Pcsx2App::GetIconBundle()
{ {
std::unique_ptr<wxIconBundle>& bundle( GetResourceCache().IconBundle ); std::unique_ptr<wxIconBundle>& bundle(GetResourceCache().IconBundle);
if( !bundle ) if (!bundle)
{ {
bundle = std::unique_ptr<wxIconBundle>(new wxIconBundle()); bundle = std::unique_ptr<wxIconBundle>(new wxIconBundle());
bundle->AddIcon( EmbeddedImage<res_AppIcon32>().GetIcon() ); bundle->AddIcon(EmbeddedImage<res_AppIcon32>().GetIcon());
bundle->AddIcon( EmbeddedImage<res_AppIcon64>().GetIcon() ); bundle->AddIcon(EmbeddedImage<res_AppIcon64>().GetIcon());
bundle->AddIcon( EmbeddedImage<res_AppIcon16>().GetIcon() ); bundle->AddIcon(EmbeddedImage<res_AppIcon16>().GetIcon());
} }
return *bundle; return *bundle;
@ -104,8 +106,9 @@ const wxIconBundle& Pcsx2App::GetIconBundle()
const wxBitmap& Pcsx2App::GetLogoBitmap() const wxBitmap& Pcsx2App::GetLogoBitmap()
{ {
std::unique_ptr <wxBitmap>& logo(GetResourceCache().Bitmap_Logo); std::unique_ptr<wxBitmap>& logo(GetResourceCache().Bitmap_Logo);
if( logo ) return *logo; if (logo)
return *logo;
wxImage img = EmbeddedImage<res_BackgroundLogo>().Get(); wxImage img = EmbeddedImage<res_BackgroundLogo>().Get();
float scale = MSW_GetDPIScale(); // 1.0 for non-Windows float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
@ -117,7 +120,8 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
const wxBitmap& Pcsx2App::GetScreenshotBitmap() const wxBitmap& Pcsx2App::GetScreenshotBitmap()
{ {
std::unique_ptr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap); std::unique_ptr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap);
if (screenshot) return *screenshot; if (screenshot)
return *screenshot;
wxImage img = EmbeddedImage<res_ButtonIcon_Camera>().Get(); wxImage img = EmbeddedImage<res_ButtonIcon_Camera>().Get();
float scale = MSW_GetDPIScale(); // 1.0 for non-Windows float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
@ -128,27 +132,27 @@ const wxBitmap& Pcsx2App::GetScreenshotBitmap()
wxImageList& Pcsx2App::GetImgList_Config() wxImageList& Pcsx2App::GetImgList_Config()
{ {
std::unique_ptr<wxImageList>& images( GetResourceCache().ConfigImages ); std::unique_ptr<wxImageList>& images(GetResourceCache().ConfigImages);
if( !images ) if (!images)
{ {
int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize; int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize;
images = std::unique_ptr<wxImageList>(new wxImageList(image_size, image_size)); images = std::unique_ptr<wxImageList>(new wxImageList(image_size, image_size));
#undef FancyLoadMacro #undef FancyLoadMacro
#define FancyLoadMacro( name ) \ #define FancyLoadMacro(name) \
{ \ { \
wxImage img = EmbeddedImage<res_ConfigIcon_##name>().Get(); \ wxImage img = EmbeddedImage<res_ConfigIcon_##name>().Get(); \
img.Rescale(image_size, image_size, wxIMAGE_QUALITY_HIGH); \ img.Rescale(image_size, image_size, wxIMAGE_QUALITY_HIGH); \
m_Resources->ImageId.Config.name = images->Add(img); \ m_Resources->ImageId.Config.name = images->Add(img); \
} }
FancyLoadMacro( Paths ); FancyLoadMacro(Paths);
FancyLoadMacro( Plugins ); FancyLoadMacro(Plugins);
FancyLoadMacro( Gamefixes ); FancyLoadMacro(Gamefixes);
FancyLoadMacro( Speedhacks ); FancyLoadMacro(Speedhacks);
FancyLoadMacro( MemoryCard ); FancyLoadMacro(MemoryCard);
FancyLoadMacro( Video ); FancyLoadMacro(Video);
FancyLoadMacro( Cpu ); FancyLoadMacro(Cpu);
} }
return *images; return *images;
} }
@ -156,20 +160,19 @@ wxImageList& Pcsx2App::GetImgList_Config()
// This stuff seems unused? // This stuff seems unused?
wxImageList& Pcsx2App::GetImgList_Toolbars() 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; const int imgSize = g_Conf->Toolbar_ImageSize ? 64 : 32;
images = std::unique_ptr<wxImageList>(new wxImageList(imgSize, imgSize)); images = std::unique_ptr<wxImageList>(new wxImageList(imgSize, imgSize));
#undef FancyLoadMacro #undef FancyLoadMacro
#define FancyLoadMacro( name ) \ #define FancyLoadMacro(name) \
{ \ { \
wxImage img = EmbeddedImage<res_ToolbarIcon_##name>(imgSize, imgSize).Get(); \ wxImage img = EmbeddedImage<res_ToolbarIcon_##name>(imgSize, imgSize).Get(); \
m_Resources.ImageId.Toolbars.name = images->Add(img); \ m_Resources.ImageId.Toolbars.name = images->Add(img); \
} }
} }
return *images; return *images;
} }