wxImageList& Pcsx2App::GetImgList_Toolbars() { ScopedPtr<wxImageList>& images( GetResourceCache().ToolbarImages ); if( !images ) { const int imgSize = g_Conf->Toolbar_ImageSize ? 64 : 32; images = new wxImageList( imgSize, imgSize ); wxFileName mess; bool useTheme = (g_Conf->DeskTheme != L"default"); if( useTheme ) { wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme ); mess = theme.ToString(); } wxImage img; #undef FancyLoadMacro #define FancyLoadMacro( name ) \ { \ EmbeddedImage<res_ToolbarIcon_##name> temp( imgSize, imgSize ); \ m_Resources.ImageId.Toolbars.name = images->Add( LoadImageAny( img, useTheme, mess, L"ToolbarIcon" wxT(#name), temp ) ); \ } } return *images; }
const wxBitmap& Pcsx2App::GetLogoBitmap() { ScopedPtr<wxBitmap>& logo( GetResourceCache().Bitmap_Logo ); if( logo ) return *logo; wxFileName mess; bool useTheme = (g_Conf->DeskTheme != L"default"); if( useTheme ) { wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme ); wxFileName zipped( theme.GetFilename() ); zipped.SetExt( L"zip" ); if( zipped.FileExists() ) { // loading theme from zipfile. //wxFileInputStream stream( zipped.ToString() ) //wxZipInputStream zstream( stream ); Console.Error( "Loading themes from zipfile is not supported yet.\nFalling back on default theme." ); } // Overrides zipfile settings (fix when zipfile support added) mess = theme.ToString(); } wxImage img; EmbeddedImage<res_BackgroundLogo> temp; // because gcc can't allow non-const temporaries. LoadImageAny( img, useTheme, mess, L"BackgroundLogo", temp ); logo = new wxBitmap( img ); return *logo; }
const wxBitmap& Pcsx2App::GetLogoBitmap() { std::unique_ptr <wxBitmap>& logo(GetResourceCache().Bitmap_Logo); if( logo ) return *logo; wxFileName themeDirectory; bool useTheme = (g_Conf->DeskTheme != L"default"); if( useTheme ) { themeDirectory.Assign(wxFileName(PathDefs::GetThemes().ToString()).GetFullPath(), g_Conf->DeskTheme); #if 0 wxFileName zipped(themeDirectory); zipped.SetExt( L"zip" ); if( zipped.FileExists() ) { // loading theme from zipfile. //wxFileInputStream stream( zipped.ToString() ) //wxZipInputStream zstream( stream ); Console.Error( "Loading themes from zipfile is not supported yet.\nFalling back on default theme." ); } #endif } wxImage img; EmbeddedImage<res_BackgroundLogo> temp; // because gcc can't allow non-const temporaries. LoadImageAny(img, useTheme, themeDirectory, L"BackgroundLogo", temp); float scale = MSW_GetDPIScale(); // 1.0 for non-Windows logo = std::unique_ptr<wxBitmap>(new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH))); return *logo; }
const wxIconBundle& Pcsx2App::GetIconBundle() { ScopedPtr<wxIconBundle>& bundle( GetResourceCache().IconBundle ); if( !bundle ) { bundle = new wxIconBundle(); bundle->AddIcon( EmbeddedImage<res_AppIcon32>().GetIcon() ); bundle->AddIcon( EmbeddedImage<res_AppIcon64>().GetIcon() ); bundle->AddIcon( EmbeddedImage<res_AppIcon16>().GetIcon() ); } return *bundle; }
wxImageList& Pcsx2App::GetImgList_Config() { ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages ); if( !images ) { int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize; images = new wxImageList(image_size, image_size); wxFileName mess; bool useTheme = (g_Conf->DeskTheme != L"default"); if( useTheme ) { wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme ); mess = theme.ToString(); } wxImage img; // GCC Specific: wxT() macro is required when using string token pasting. For some // reason L generates syntax errors. >_< // TODO: This can be fixed with something like // #define L_STR(x) L_STR2(x) // #define L_STR2(x) L ## x // but it's probably best to do it everywhere at once. wxWidgets // recommends not to use it since v2.9.0. #undef FancyLoadMacro #define FancyLoadMacro( name ) \ { \ EmbeddedImage<res_ConfigIcon_##name> temp; \ LoadImageAny(img, useTheme, mess, L"ConfigIcon_" wxT(#name), temp); \ 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( Appearance ); } return *images; }
const wxBitmap& Pcsx2App::GetScreenshotBitmap() { std::unique_ptr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap); if (screenshot) return *screenshot; wxFileName themeDirectory; bool useTheme = (g_Conf->DeskTheme != L"default"); if (useTheme) { themeDirectory.Assign(wxFileName(PathDefs::GetThemes().ToString()).GetFullPath(), g_Conf->DeskTheme); } wxImage img; EmbeddedImage<res_ButtonIcon_Camera> temp; // because gcc can't allow non-const temporaries. LoadImageAny(img, useTheme, themeDirectory, L"ButtonIcon_Camera", temp); float scale = MSW_GetDPIScale(); // 1.0 for non-Windows screenshot = std::unique_ptr<wxBitmap>(new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH))); return *screenshot; }
wxImageList& Pcsx2App::GetImgList_Config() { ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages ); if( !images ) { images = new wxImageList(32, 32); wxFileName mess; bool useTheme = (g_Conf->DeskTheme != L"default"); if( useTheme ) { wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme ); mess = theme.ToString(); } wxImage img; // GCC Specific: wxT() macro is required when using string token pasting. For some // reason L generates syntax errors. >_< #undef FancyLoadMacro #define FancyLoadMacro( name ) \ { \ EmbeddedImage<res_ConfigIcon_##name> temp( g_Conf->Listbook_ImageSize, g_Conf->Listbook_ImageSize ); \ m_Resources->ImageId.Config.name = images->Add( LoadImageAny( \ img, useTheme, mess, L"ConfigIcon_" wxT(#name), temp ) \ ); \ } FancyLoadMacro( Paths ); FancyLoadMacro( Plugins ); FancyLoadMacro( Gamefixes ); FancyLoadMacro( Speedhacks ); FancyLoadMacro( MemoryCard ); FancyLoadMacro( Video ); FancyLoadMacro( Cpu ); FancyLoadMacro( Appearance ); } return *images; }
const wxBitmap& Pcsx2App::GetScreenshotBitmap() { ScopedPtr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap); if (screenshot) return *screenshot; wxFileName mess; bool useTheme = (g_Conf->DeskTheme != L"default"); if (useTheme) { wxDirName theme(PathDefs::GetThemes() + g_Conf->DeskTheme); mess = theme.ToString(); } wxImage img; EmbeddedImage<res_ButtonIcon_Camera> temp; // because gcc can't allow non-const temporaries. LoadImageAny(img, useTheme, mess, L"ButtonIcon_Camera", temp); float scale = MSW_GetDPIScale(); // 1.0 for non-Windows screenshot = new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH)); return *screenshot; }