Merge branch 'external-theme'

This commit is contained in:
Jordan Woyak
2013-01-16 19:00:19 -06:00
61 changed files with 83 additions and 16294 deletions

View File

@ -17,10 +17,12 @@
#include <string> // System
#include <vector>
#include <algorithm>
#include <wx/spinbutt.h>
#include "Common.h"
#include "CommonPaths.h"
#include "FileSearch.h"
#include "Core.h" // Core
#include "HW/EXI.h"
@ -40,6 +42,14 @@
#include "Main.h"
#include "VideoBackendBase.h"
#if defined(__APPLE__)
#include <tr1/functional>
using std::tr1::function;
#else
#include <functional>
using std::function;
#endif
#define TEXT_BOX(page, text) new wxStaticText(page, wxID_ANY, text, wxDefaultPosition, wxDefaultSize)
extern CFrame* main_frame;
@ -126,7 +136,6 @@ EVT_SLIDER(ID_VOLUME, CConfigMain::AudioSettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::DisplaySettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::DisplaySettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_ONSCREENDISPLAYMESSAGES, CConfigMain::DisplaySettingsChanged)
EVT_CHOICE(ID_INTERFACE_THEME, CConfigMain::DisplaySettingsChanged)
EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::DisplaySettingsChanged)
EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::DisplaySettingsChanged)
@ -253,14 +262,6 @@ void CConfigMain::InitializeGUILists()
arrayStringFor_DSPEngine.Add(_("DSP LLE recompiler"));
arrayStringFor_DSPEngine.Add(_("DSP LLE interpreter (slow)"));
// Display page
// Themes
arrayStringFor_Themes.Add(wxT("Boomy"));
arrayStringFor_Themes.Add(wxT("Vista"));
arrayStringFor_Themes.Add(wxT("X-Plastik"));
arrayStringFor_Themes.Add(wxT("KDE"));
// Gamecube page
// GC Language arrayStrings
arrayStringFor_GCSystemLang.Add(_("English"));
@ -339,7 +340,6 @@ void CConfigMain::InitializeGUIValues()
ConfirmStop->SetValue(startup_params.bConfirmStop);
UsePanicHandlers->SetValue(startup_params.bUsePanicHandlers);
OnScreenDisplayMessages->SetValue(startup_params.bOnScreenDisplayMessages);
Theme->SetSelection(startup_params.iTheme);
// need redesign
for (unsigned int i = 0; i < sizeof(langIds) / sizeof(wxLanguage); i++)
{
@ -500,9 +500,6 @@ void CConfigMain::InitializeGUITooltips()
UsePanicHandlers->SetToolTip(_("Show a message box when a potentially serious error has occured.\nDisabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin suddenly crashes without any explanation at all."));
OnScreenDisplayMessages->SetToolTip(_("Show messages on the emulation screen area.\nThese messages include memory card writes, video backend and CPU information, and JIT cache clearing."));
// Display - Themes: Copyright notice
Theme->SetToolTip(_("Boomy: Milosz Wlazlo [miloszwl@miloszwl.com]\nVista: VistaIcons.com\nX-Plastik: black_rider [ForumW.org]\nKDE: KDE-Look.org"));
InterfaceLang->SetToolTip(_("Change the language of the user interface.\nRequires restart."));
// Audio tooltips
@ -584,9 +581,6 @@ void CConfigMain::CreateGUIControls()
// Hotkey configuration
HotkeyConfig = new wxButton(DisplayPage, ID_HOTKEY_CONFIG, _("Hotkeys"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
// Themes
Theme = new wxChoice(DisplayPage, ID_INTERFACE_THEME, wxDefaultPosition,
wxDefaultSize, arrayStringFor_Themes, 0, wxDefaultValidator);
// Interface settings
ConfirmStop = new wxCheckBox(DisplayPage, ID_INTERFACE_CONFIRMSTOP, _("Confirm on Stop"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -600,10 +594,36 @@ void CConfigMain::CreateGUIControls()
sInterface->Add(InterfaceLang, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sInterface->AddStretchSpacer();
sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5);
wxBoxSizer* scInterface = new wxBoxSizer(wxHORIZONTAL);
// theme selection
auto const theme_selection = new wxChoice(DisplayPage, wxID_ANY);
CFileSearch cfs(CFileSearch::XStringVector(1, "*"), CFileSearch::XStringVector(1, File::GetUserPath(D_THEMES_IDX)));
auto const& sv = cfs.GetFileNames();
std::for_each(sv.begin(), sv.end(), [theme_selection](const std::string& filename)
{
std::string name, ext;
SplitPath(filename, NULL, &name, &ext);
name += ext;
theme_selection->Append(name);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name == name)
theme_selection->SetSelection(theme_selection->GetCount() - 1);
});
// std::function = avoid error on msvc
theme_selection->Bind(wxEVT_COMMAND_CHOICE_SELECTED, function<void(wxEvent&)>([this,theme_selection](wxEvent&)
{
SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name = theme_selection->GetStringSelection();
main_frame->InitBitmaps();
}));
auto const scInterface = new wxBoxSizer(wxHORIZONTAL);
scInterface->Add(TEXT_BOX(DisplayPage, _("Theme:")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
scInterface->Add(Theme, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
scInterface->Add(theme_selection, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
scInterface->AddStretchSpacer();
sbInterface = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, _("Interface Settings"));
sbInterface->Add(ConfirmStop, 0, wxALL, 5);
sbInterface->Add(UsePanicHandlers, 0, wxALL, 5);
@ -895,10 +915,6 @@ void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event)
SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages = OnScreenDisplayMessages->IsChecked();
SetEnableAlert(OnScreenDisplayMessages->IsChecked());
break;
case ID_INTERFACE_THEME:
SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection();
main_frame->InitBitmaps();
break;
case ID_INTERFACE_LANG:
if (SConfig::GetInstance().m_InterfaceLanguage != langIds[InterfaceLang->GetSelection()])
SuccessAlertT("You must restart Dolphin in order for the change to take effect.");