pcsx2: Remove theming support

It's incomplete, and there's not much that is actually themeable
(basically only the background logo and icons can be changed).
This commit is contained in:
Jonathan Li 2018-03-18 23:29:39 +00:00
parent 6496e6db11
commit dc53278163
11 changed files with 13 additions and 160 deletions

View File

@ -358,7 +358,6 @@ set(pcsx2GuiResources
${res_bin}/AppIcon32.h
${res_bin}/AppIcon64.h
${res_bin}/BackgroundLogo.h
${res_bin}/ConfigIcon_Appearance.h
${res_bin}/ButtonIcon_Camera.h
${res_bin}/ConfigIcon_Cpu.h
${res_bin}/ConfigIcon_Gamefixes.h
@ -698,7 +697,7 @@ file(MAKE_DIRECTORY ${res_bin})
foreach(res_file IN ITEMS
AppIcon16 AppIcon32 AppIcon64 BackgroundLogo Logo ButtonIcon_Camera
ConfigIcon_Appearance ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard
ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard
ConfigIcon_Paths ConfigIcon_Plugins ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive)
add_custom_command(OUTPUT "${res_bin}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_src}/${res_file}.png" "${res_bin}/${res_file}" )
endforeach()

View File

@ -17,12 +17,11 @@
enum FoldersEnum_t
{
// FIXME : Plugins, Settings, and Themes folders are no longer part of the user-local
// FIXME : Plugins and Settings folders are no longer part of the user-local
// ini storage. They have been moved to an app-local ini storage class (which is currently
// handled lazily via global variables)
FolderId_Plugins = 0,
FolderId_Settings,
FolderId_Themes,
FolderId_Bios,
FolderId_Snapshots,
@ -54,7 +53,6 @@ namespace PathDefs
extern wxDirName GetSnapshots();
extern wxDirName GetBios();
extern wxDirName GetThemes();
extern wxDirName GetPlugins();
extern wxDirName GetSavestates();
extern wxDirName GetMemoryCards();
@ -76,7 +74,6 @@ namespace PathDefs
extern const wxDirName& MemoryCards();
extern const wxDirName& Settings();
extern const wxDirName& Plugins();
extern const wxDirName& Themes();
extern const wxDirName& Logs();
extern const wxDirName& Dumps();
extern const wxDirName& Langs();

View File

@ -192,15 +192,14 @@ struct AppImageIds
Gamefixes,
MemoryCard,
Video,
Cpu,
Appearance;
Cpu;
ConfigIds()
{
Paths = Plugins =
Speedhacks = Gamefixes =
Video = Cpu =
MemoryCard = Appearance = -1;
MemoryCard = -1;
}
} Config;

View File

@ -102,12 +102,6 @@ namespace PathDefs
static const wxDirName retval( L"dumps" );
return retval;
}
const wxDirName& Themes()
{
static const wxDirName retval( L"themes" );
return retval;
}
const wxDirName& Docs()
{
@ -120,7 +114,7 @@ namespace PathDefs
// (currently it's the CWD, but in the future I intend to move all binaries to a "bin"
// sub folder, in which case the approot will become "..") [- Air?]
//The installer installs the folders which are relative to AppRoot (that's plugins/themes/langs)
//The installer installs the folders which are relative to AppRoot (that's plugins/langs)
// relative to the exe folder, and not relative to cwd. So the exe should be default AppRoot. - avih
const wxDirName& AppRoot()
{
@ -238,11 +232,6 @@ namespace PathDefs
#endif
}
wxDirName GetThemes()
{
return GetDocuments() + Base::Themes();
}
wxDirName GetSettings()
{
return GetDocuments() + Base::Settings();
@ -264,7 +253,6 @@ namespace PathDefs
{
case FolderId_Plugins: return GetPlugins();
case FolderId_Settings: return GetSettings();
case FolderId_Themes: return GetThemes();
case FolderId_Bios: return GetBios();
case FolderId_Snapshots: return GetSnapshots();
case FolderId_Savestates: return GetSavestates();
@ -288,7 +276,6 @@ wxDirName& AppConfig::FolderOptions::operator[]( FoldersEnum_t folderidx )
{
case FolderId_Plugins: return PluginsFolder;
case FolderId_Settings: return SettingsFolder;
case FolderId_Themes: return ThemesFolder;
case FolderId_Bios: return Bios;
case FolderId_Snapshots: return Snapshots;
case FolderId_Savestates: return Savestates;
@ -316,7 +303,6 @@ bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const
{
case FolderId_Plugins: return UseDefaultPluginsFolder;
case FolderId_Settings: return UseDefaultSettingsFolder;
case FolderId_Themes: return UseDefaultThemesFolder;
case FolderId_Bios: return UseDefaultBios;
case FolderId_Snapshots: return UseDefaultSnapshots;
case FolderId_Savestates: return UseDefaultSavestates;
@ -347,11 +333,6 @@ void AppConfig::FolderOptions::Set( FoldersEnum_t folderidx, const wxString& src
UseDefaultSettingsFolder = useDefault;
break;
case FolderId_Themes:
ThemesFolder = src;
UseDefaultThemesFolder = useDefault;
break;
case FolderId_Bios:
Bios = src;
UseDefaultBios = useDefault;
@ -529,9 +510,8 @@ AppConfig::AppConfig()
, SysSettingsTabName( L"Cpu" )
, McdSettingsTabName( L"none" )
, ComponentsTabName( L"Plugins" )
, AppSettingsTabName( L"Appearance" )
, AppSettingsTabName( L"none" )
, GameDatabaseTabName( L"none" )
, DeskTheme( L"default" )
{
LanguageId = wxLANGUAGE_DEFAULT;
LanguageCode = L"default";
@ -593,13 +573,12 @@ void App_LoadSaveInstallSettings( IniInterface& ini )
ini.Entry( L"SettingsFolder", SettingsFolder, PathDefs::GetSettings() );
// "Install_Dir" conforms to the NSIS standard install directory key name.
// Attempt to load plugins and themes based on the Install Folder.
// Attempt to load plugins based on the Install Folder.
ini.Entry( L"Install_Dir", InstallFolder, (wxDirName)(wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath()) );
SetFullBaseDir( InstallFolder );
//ini.Entry( L"PluginsFolder", PluginsFolder, InstallFolder + PathDefs::Base::Plugins() );
ini.Entry( L"ThemesFolder", ThemesFolder, InstallFolder + PathDefs::Base::Themes() );
ini.Flush();
}
@ -653,7 +632,6 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
IniEntry( LanguageCode );
IniEntry( RecentIsoCount );
IniEntry( GzipIsoIndexTemplate );
IniEntry( DeskTheme );
IniEntry( Listbook_ImageSize );
IniEntry( Toolbar_ImageSize );
IniEntry( Toolbar_ShowLabels );

View File

@ -47,20 +47,17 @@ namespace PathDefs
extern wxDirName GetProgramDataDir();
extern wxDirName GetDocuments();
extern wxDirName GetDocuments( DocsModeType mode );
extern wxDirName GetThemes();
}
extern DocsModeType DocsFolderMode; //
extern bool UseDefaultSettingsFolder; // when TRUE, pcsx2 derives the settings folder from the DocsFolderMode
extern bool UseDefaultPluginsFolder;
extern bool UseDefaultThemesFolder;
extern wxDirName CustomDocumentsFolder; // allows the specification of a custom home folder for PCSX2 documents files.
extern wxDirName SettingsFolder; // dictates where the settings folder comes from, *if* UseDefaultSettingsFolder is FALSE.
extern wxDirName InstallFolder;
extern wxDirName PluginsFolder;
extern wxDirName ThemesFolder;
extern wxDirName GetSettingsFolder();
extern wxString GetVmSettingsFilename();
@ -74,7 +71,7 @@ extern wxDirName GetCheatsWsFolder();
enum InstallationModeType
{
// Use the user defined folder selections. These can be anywhere on a user's hard drive,
// though by default the binaries (plugins, themes) are located in Install_Dir (registered
// though by default the binaries (plugins) are located in Install_Dir (registered
// by the installer), and the user files (screenshots, inis) are in the user's documents
// folder. All folders are changable within the GUI.
InstallMode_Registered,
@ -281,10 +278,6 @@ public:
int RecentIsoCount; // number of files displayed in the Recent Isos list.
// String value describing the desktop theme to use for pcsk2 (icons and background images)
// The theme name is used to look up files in the themes folder (relative to the executable).
wxString DeskTheme;
// Specifies the size of icons used in Listbooks; specifically the PCSX2 Properties dialog box.
// Realistic values range from 96x96 to 24x24.
int Listbook_ImageSize;

View File

@ -35,31 +35,11 @@
#include "Resources/ConfigIcon_Paths.h"
#include "Resources/ConfigIcon_Plugins.h"
#include "Resources/ConfigIcon_MemoryCard.h"
#include "Resources/ConfigIcon_Appearance.h"
#include "Resources/AppIcon16.h"
#include "Resources/AppIcon32.h"
#include "Resources/AppIcon64.h"
const wxImage& LoadImageAny(
wxImage& dest, bool useTheme, wxFileName& base, const wxChar* filename, IEmbeddedImage& onFail )
{
if (useTheme && base.DirExists())
{
wxFileName pathname(base.GetFullPath(), filename);
const wxChar* extensions[3] = {L"png", L"jpg", L"bmp"};
for (size_t i = 0; i < sizeof(extensions)/sizeof(extensions[0]); ++i)
{
pathname.SetExt(extensions[i]);
if (pathname.FileExists() && dest.LoadFile(pathname.GetFullPath()))
return dest;
}
}
return dest = onFail.Get();
}
RecentIsoList::RecentIsoList(int firstIdForMenuItems_or_wxID_ANY)
{
Menu = std::unique_ptr<wxMenu>(new wxMenu());
@ -116,30 +96,7 @@ 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);
wxImage img = EmbeddedImage<res_BackgroundLogo>().Get();
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)));
@ -151,17 +108,7 @@ 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);
wxImage img = EmbeddedImage<res_ButtonIcon_Camera>().Get();
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)));
@ -175,29 +122,11 @@ wxImageList& Pcsx2App::GetImgList_Config()
{
int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize;
images = std::unique_ptr<wxImageList>(new wxImageList(image_size, image_size));
wxFileName themeDirectory;
bool useTheme = (g_Conf->DeskTheme != L"default");
if( useTheme )
{
themeDirectory.Assign(wxFileName(PathDefs::GetThemes().ToString()).GetFullPath(), g_Conf->DeskTheme);
}
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, themeDirectory, L"ConfigIcon_" wxT(#name), temp); \
wxImage img = EmbeddedImage<res_ConfigIcon_##name>().Get(); \
img.Rescale(image_size, image_size, wxIMAGE_QUALITY_HIGH); \
m_Resources->ImageId.Config.name = images->Add(img); \
}
@ -209,7 +138,6 @@ wxImageList& Pcsx2App::GetImgList_Config()
FancyLoadMacro( MemoryCard );
FancyLoadMacro( Video );
FancyLoadMacro( Cpu );
FancyLoadMacro( Appearance );
}
return *images;
}
@ -223,21 +151,12 @@ wxImageList& Pcsx2App::GetImgList_Toolbars()
{
const int imgSize = g_Conf->Toolbar_ImageSize ? 64 : 32;
images = std::unique_ptr<wxImageList>(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 ) ); \
wxImage img = EmbeddedImage<res_ToolbarIcon_##name>(imgSize, imgSize).Get(); \
m_Resources.ImageId.Toolbars.name = images->Add(img); \
}
}

View File

@ -28,7 +28,6 @@
DocsModeType DocsFolderMode = DocsFolder_User;
bool UseDefaultSettingsFolder = true;
bool UseDefaultPluginsFolder = true;
bool UseDefaultThemesFolder = true;
wxDirName CustomDocumentsFolder;
@ -36,7 +35,6 @@ wxDirName SettingsFolder;
wxDirName InstallFolder;
wxDirName PluginsFolder;
wxDirName ThemesFolder;
// The UserLocalData folder can be redefined depending on whether or not PCSX2 is in
// "portable install" mode or not. when PCSX2 has been configured for portable install, the

View File

@ -479,29 +479,6 @@ namespace Panels
void OnShow(wxShowEvent& evt);
};
// --------------------------------------------------------------------------------------
// ThemeSelectorPanel
// --------------------------------------------------------------------------------------
class ThemeSelectorPanel : public BaseSelectorPanel
{
typedef BaseSelectorPanel _parent;
protected:
std::unique_ptr<wxArrayString> m_ThemeList;
wxListBox* m_ComboBox;
DirPickerPanel* m_FolderPicker;
public:
virtual ~ThemeSelectorPanel();
ThemeSelectorPanel( wxWindow* parent );
protected:
virtual void Apply();
virtual void AppStatusEvent_OnSettingsApplied();
virtual void DoRefresh();
virtual bool ValidateEnumerationStatus();
};
// --------------------------------------------------------------------------------------
// BiosSelectorPanel
// --------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -105,10 +105,6 @@
<Command>cmd.exe /c %(RelativeDir)bin2cpp.cmd %(Filename)%(Extension)</Command>
<Outputs>%(RelativeDir)%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\gui\Resources\ConfigIcon_Appearance.png">
<Command>cmd.exe /c %(RelativeDir)bin2cpp.cmd %(Filename)%(Extension)</Command>
<Outputs>%(RelativeDir)%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\gui\Resources\ConfigIcon_Cpu.png">
<Command>cmd.exe /c %(RelativeDir)bin2cpp.cmd %(Filename)%(Extension)</Command>
<Outputs>%(RelativeDir)%(Filename).h</Outputs>

View File

@ -1380,9 +1380,6 @@
<CustomBuild Include="..\..\gui\Resources\ConfigIcon_Video.png">
<Filter>AppHost\Resources</Filter>
</CustomBuild>
<CustomBuild Include="..\..\gui\Resources\ConfigIcon_Appearance.png">
<Filter>AppHost\Resources</Filter>
</CustomBuild>
<CustomBuild Include="..\..\gui\Resources\Breakpoint_Inactive.png">
<Filter>AppHost\Resources</Filter>
</CustomBuild>