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
+38 -22
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 [[email protected]]\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.");
-3
View File
@@ -87,7 +87,6 @@ private:
ID_INTERFACE_CONFIRMSTOP,
ID_INTERFACE_USEPANICHANDLERS,
ID_INTERFACE_ONSCREENDISPLAYMESSAGES,
ID_INTERFACE_THEME,
ID_INTERFACE_LANG,
ID_HOTKEY_CONFIG,
@@ -165,7 +164,6 @@ private:
wxCheckBox* ConfirmStop;
wxCheckBox* UsePanicHandlers;
wxCheckBox* OnScreenDisplayMessages;
wxChoice* Theme;
wxChoice* InterfaceLang;
wxButton* HotkeyConfig;
@@ -227,7 +225,6 @@ private:
wxArrayString arrayStringFor_CPUEngine;
wxArrayString arrayStringFor_DSPEngine;
wxArrayString arrayStringFor_FullscreenResolution;
wxArrayString arrayStringFor_Themes;
wxArrayString arrayStringFor_InterfaceLang;
wxArrayString arrayStringFor_GCSystemLang;
wxArrayString arrayStringFor_WiiSensBarPos;
@@ -52,10 +52,7 @@
extern "C" // Bitmaps
{
#include "../../resources/toolbar_play.c"
#include "../../resources/toolbar_pause.c"
#include "../../resources/toolbar_add_memorycheck.c"
#include "../../resources/toolbar_debugger_delete.c"
#include "../../resources/toolbar_add_breakpoint.c"
}
@@ -563,23 +560,21 @@ bool CCodeWindow::JITBlockLinking()
void CCodeWindow::InitBitmaps()
{
// load original size 48x48
m_Bitmaps[Toolbar_DebugGo] = wxGetBitmapFromMemory(toolbar_play_png);
m_Bitmaps[Toolbar_Step] = wxGetBitmapFromMemory(toolbar_add_breakpoint_png);
m_Bitmaps[Toolbar_StepOver] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_Skip] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_GotoPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_SetPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_DebugPause] = wxGetBitmapFromMemory(toolbar_pause_png);
// scale to 24x24 for toolbar
for (size_t n = Toolbar_DebugGo; n < ToolbarDebugBitmapMax; n++)
for (size_t n = 0; n < ToolbarDebugBitmapMax; n++)
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(24, 24));
}
void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
{
int w = m_Bitmaps[Toolbar_DebugGo].GetWidth(),
h = m_Bitmaps[Toolbar_DebugGo].GetHeight();
int w = m_Bitmaps[0].GetWidth(),
h = m_Bitmaps[0].GetHeight();
toolBar->SetToolBitmapSize(wxSize(w, h));
toolBar->AddTool(IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step]);
@@ -54,15 +54,6 @@
#include "ConfigManager.h"
extern "C" // Bitmaps
{
#include "../../resources/toolbar_play.c"
#include "../../resources/toolbar_pause.c"
#include "../../resources/toolbar_add_memorycheck.c"
#include "../../resources/toolbar_debugger_delete.c"
#include "../../resources/toolbar_add_breakpoint.c"
}
// Save and load settings
// -----------------------------
void CCodeWindow::Load()
-16
View File
@@ -52,22 +52,6 @@
extern "C" {
#include "../resources/Dolphin.c" // Dolphin icon
#include "../resources/toolbar_browse.c"
#include "../resources/toolbar_file_open.c"
#include "../resources/toolbar_fullscreen.c"
#include "../resources/toolbar_help.c"
#include "../resources/toolbar_pause.c"
#include "../resources/toolbar_play.c"
#include "../resources/toolbar_plugin_dsp.c"
#include "../resources/toolbar_plugin_gfx.c"
#include "../resources/toolbar_plugin_options.c"
#include "../resources/toolbar_plugin_pad.c"
#include "../resources/toolbar_refresh.c"
#include "../resources/toolbar_stop.c"
#include "../resources/Boomy.h" // Theme packages
#include "../resources/Vista.h"
#include "../resources/X-Plastik.h"
#include "../resources/KDE.h"
};
-9
View File
@@ -210,15 +210,6 @@ private:
EToolbar_Max
};
enum EBitmapsThemes
{
BOOMY,
VISTA,
XPLASTIK,
KDE,
THEMES_MAX
};
wxBitmap m_Bitmaps[EToolbar_Max];
wxBitmap m_BitmapsMenu[EToolbar_Max];
+17 -110
View File
@@ -78,23 +78,6 @@ Core::GetWindowHandle().
// Resources
extern "C" {
#include "../resources/Dolphin.c" // Dolphin icon
#include "../resources/toolbar_browse.c"
#include "../resources/toolbar_file_open.c"
#include "../resources/toolbar_fullscreen.c"
#include "../resources/toolbar_help.c"
#include "../resources/toolbar_pause.c"
#include "../resources/toolbar_play.c"
#include "../resources/toolbar_plugin_dsp.c"
#include "../resources/toolbar_plugin_gfx.c"
#include "../resources/toolbar_plugin_options.c"
#include "../resources/toolbar_plugin_pad.c"
#include "../resources/toolbar_plugin_wiimote.c"
#include "../resources/toolbar_refresh.c"
#include "../resources/toolbar_stop.c"
#include "../resources/Boomy.h" // Theme packages
#include "../resources/Vista.h"
#include "../resources/X-Plastik.h"
#include "../resources/KDE.h"
};
bool confirmStop = false;
@@ -512,102 +495,26 @@ void CFrame::RecreateToolbar()
void CFrame::InitBitmaps()
{
// Get selected theme
int Theme = SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme;
wxString dir(File::GetUserPath(D_THEMES_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name + "/");
// Save memory by only having one set of bitmaps loaded at any time. I mean, they are still
// in the exe, which is in memory, but at least we wont make another copy of all of them.
switch (Theme)
{
case BOOMY:
{
// These are stored as 48x48
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(toolbar_file_open_png);
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(toolbar_refresh_png);
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(toolbar_browse_png);
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(toolbar_play_png);
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(toolbar_stop_png);
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(toolbar_pause_png);
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(toolbar_plugin_options_png);
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(toolbar_plugin_gfx_png);
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(toolbar_plugin_dsp_png);
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(toolbar_plugin_pad_png);
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(toolbar_plugin_wiimote_png);
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(toolbar_fullscreen_png);
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(toolbar_fullscreen_png);
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(toolbar_help_png);
// Scale the 48x48 bitmaps to 24x24
for (size_t n = Toolbar_FileOpen; n < EToolbar_Max; n++)
{
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(24, 24));
}
}
break;
case VISTA:
{
// These are stored as 24x24 and need no scaling
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(Toolbar_Open1_png);
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(Toolbar_Refresh1_png);
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(Toolbar_Browse1_png);
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(Toolbar_Play1_png);
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(Toolbar_Stop1_png);
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(Toolbar_Pause1_png);
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(Toolbar_Options1_png);
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(Toolbar_Gfx1_png);
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(Toolbar_DSP1_png);
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(Toolbar_Pad1_png);
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(Toolbar_Wiimote1_png);
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(Toolbar_Fullscreen1_png);
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(Toolbar_Fullscreen1_png);
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(Toolbar_Help1_png);
}
break;
case XPLASTIK:
{
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(Toolbar_Open2_png);
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(Toolbar_Refresh2_png);
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(Toolbar_Browse2_png);
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(Toolbar_Play2_png);
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(Toolbar_Stop2_png);
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(Toolbar_Pause2_png);
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(Toolbar_Options2_png);
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(Toolbar_Gfx2_png);
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(Toolbar_DSP2_png);
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(Toolbar_Pad2_png);
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(Toolbar_Wiimote2_png);
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(Toolbar_Fullscreen2_png);
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(Toolbar_Fullscreen2_png);
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(Toolbar_Help2_png);
}
break;
case KDE:
{
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(Toolbar_Open3_png);
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(Toolbar_Refresh3_png);
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(Toolbar_Browse3_png);
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(Toolbar_Play3_png);
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(Toolbar_Stop3_png);
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(Toolbar_Pause3_png);
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(Toolbar_Options3_png);
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(Toolbar_Gfx3_png);
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(Toolbar_DSP3_png);
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(Toolbar_Pad3_png);
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(Toolbar_Wiimote3_png);
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(Toolbar_Fullscreen3_png);
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(Toolbar_Fullscreen3_png);
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(Toolbar_Help3_png);
}
break;
default: PanicAlertT("Theme selection went wrong");
}
m_Bitmaps[Toolbar_FileOpen].LoadFile(dir + "open.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Refresh].LoadFile(dir + "refresh.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Browse].LoadFile(dir + "browse.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Play].LoadFile(dir + "play.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Stop].LoadFile(dir + "stop.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Pause].LoadFile(dir + "pause.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_ConfigMain].LoadFile(dir + "config.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_ConfigGFX].LoadFile(dir + "graphics.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_ConfigDSP].LoadFile(dir + "dsp.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_ConfigPAD].LoadFile(dir + "gcpad.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Wiimote].LoadFile(dir + "wiimote.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Screenshot].LoadFile(dir + "screenshot.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_FullScreen].LoadFile(dir + "fullscreen.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Help].LoadFile(dir + "help.png", wxBITMAP_TYPE_PNG);
// Update in case the bitmap has been updated
if (m_ToolBar != NULL) RecreateToolbar();
if (m_ToolBar != NULL)
RecreateToolbar();
}
// Menu items
-2
View File
@@ -26,8 +26,6 @@
enum
{
Toolbar_DebugGo,
Toolbar_DebugPause,
Toolbar_Step,
Toolbar_StepOver,
Toolbar_Skip,