Integrate helper functions from VideoSoftware's VideoConfigDialog

into the shared VideoConfigDiag.

Clean up the list of hotkey defaults a little.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7148 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-02-12 09:10:11 +00:00
parent 94d02a23de
commit 7753937e31
5 changed files with 79 additions and 126 deletions

View File

@ -31,86 +31,68 @@ static const struct {
const int DefaultModifier; const int DefaultModifier;
} g_HKData[] = { } g_HKData[] = {
#ifdef __APPLE__ #ifdef __APPLE__
{ "Open", 0x4F /* WXK_O */, 0x02 /* wxMOD_CONTROL*/ }, { "Open", 79 /* 'O' */, 8 /* wxMOD_CMD */ },
{ "ChangeDisc", 0, 0x00 /* wxMOD_NONE*/ }, { "ChangeDisc", 0, 0 /* wxMOD_NONE */ },
{ "RefreshList", 0, 0x00 /* wxMOD_NONE*/ }, { "RefreshList", 0, 0 /* wxMOD_NONE */ },
{ "PlayPause", 80 /* 'P' */, 0x08 /* wxMOD_CMD */ }, { "PlayPause", 80 /* 'P' */, 8 /* wxMOD_CMD */ },
{ "Stop", 87 /* 'W' */, 0x08 /* wxMOD_CMD */ }, { "Stop", 87 /* 'W' */, 8 /* wxMOD_CMD */ },
{ "Reset", 0, 0x00 /* wxMOD_NONE*/ }, { "Reset", 0, 0 /* wxMOD_NONE */ },
{ "FrameAdvance", 0, 0x00 /* wxMOD_NONE*/ }, { "FrameAdvance", 0, 0 /* wxMOD_NONE */ },
{ "StartRecording", 0, 0x00 /* wxMOD_NONE*/ }, { "StartRecording", 0, 0 /* wxMOD_NONE */ },
{ "PlayRecording", 0, 0x00 /* wxMOD_NONE*/ }, { "PlayRecording", 0, 0 /* wxMOD_NONE */ },
{ "ExportRecording", 0, 0x00 /* wxMOD_NONE*/ }, { "ExportRecording", 0, 0 /* wxMOD_NONE */ },
{ "Readonlymode", 0, 0x00 /* wxMOD_NONE*/ }, { "Readonlymode", 0, 0 /* wxMOD_NONE */ },
{ "ToggleFullscreen", 70 /* 'F' */, 0x08 /* wxMOD_CMD */ }, { "ToggleFullscreen", 70 /* 'F' */, 8 /* wxMOD_CMD */ },
{ "Screenshot", 83 /* 'S' */, 0x08 /* wxMOD_CMD */ }, { "Screenshot", 83 /* 'S' */, 8 /* wxMOD_CMD */ },
{ "Wiimote1Connect", 49 /* '1' */, 0x08 /* wxMOD_CMD */ }, { "Wiimote1Connect", 49 /* '1' */, 8 /* wxMOD_CMD */ },
{ "Wiimote2Connect", 50 /* '2' */, 0x08 /* wxMOD_CMD */ }, { "Wiimote2Connect", 50 /* '2' */, 8 /* wxMOD_CMD */ },
{ "Wiimote3Connect", 51 /* '3' */, 0x08 /* wxMOD_CMD */ }, { "Wiimote3Connect", 51 /* '3' */, 8 /* wxMOD_CMD */ },
{ "Wiimote4Connect", 52 /* '4' */, 0x08 /* wxMOD_CMD */ }, { "Wiimote4Connect", 52 /* '4' */, 8 /* wxMOD_CMD */ },
{ "LoadStateSlot1", 340 /* WXK_F1 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot2", 341 /* WXK_F2 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot3", 342 /* WXK_F3 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot4", 343 /* WXK_F4 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot5", 344 /* WXK_F5 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot6", 345 /* WXK_F6 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot7", 346 /* WXK_F7 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot8", 347 /* WXK_F8 */, 0x00 /* wxMOD_NONE*/ },
{ "SaveStateSlot1", 340 /* WXK_F1 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot2", 341 /* WXK_F2 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot3", 342 /* WXK_F3 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot4", 343 /* WXK_F4 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot5", 344 /* WXK_F5 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot6", 345 /* WXK_F6 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot7", 346 /* WXK_F7 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot8", 347 /* WXK_F8 */, 0x04 /* wxMOD_SHIFT*/ },
#else #else
{ "Open", 0x4F /* WXK_O */, 0x02 /* wxMOD_CONTROL*/ }, { "Open", 79 /* 'O' */, 2 /* wxMOD_CONTROL */},
{ "ChangeDisc", 0, 0x00 /* wxMOD_NONE*/ }, { "ChangeDisc", 0, 0 /* wxMOD_NONE */ },
{ "RefreshList", 00, 0x00 /* wxMOD_NONE*/ }, { "RefreshList", 0, 0 /* wxMOD_NONE */ },
{ "PlayPause", 349 /* WXK_F10 */, 0x00 /* wxMOD_NONE*/ }, { "PlayPause", 349 /* WXK_F10 */, 0 /* wxMOD_NONE */ },
{ "Stop", 27 /* WXK_ESCAPE */, 0x00 /* wxMOD_NONE*/ }, { "Stop", 27 /* WXK_ESCAPE */, 0 /* wxMOD_NONE */ },
{ "Reset", 0, 0x00 /* wxMOD_NONE*/ }, { "Reset", 0, 0 /* wxMOD_NONE */ },
{ "FrameAdvance", 0, 0x00 /* wxMOD_NONE*/ }, { "FrameAdvance", 0, 0 /* wxMOD_NONE */ },
{ "StartRecording", 0, 0x00 /* wxMOD_NONE*/ }, { "StartRecording", 0, 0 /* wxMOD_NONE */ },
{ "PlayRecording", 0, 0x00 /* wxMOD_NONE*/ }, { "PlayRecording", 0, 0 /* wxMOD_NONE */ },
{ "ExportRecording", 0, 0x00 /* wxMOD_NONE*/ }, { "ExportRecording", 0, 0 /* wxMOD_NONE */ },
{ "Readonlymode", 0, 0x00 /* wxMOD_NONE*/ }, { "Readonlymode", 0, 0 /* wxMOD_NONE */ },
{ "ToggleFullscreen", 13 /* WXK_RETURN */, 0x01 /* wxMOD_ALT */ }, { "ToggleFullscreen", 13 /* WXK_RETURN */, 1 /* wxMOD_ALT */ },
{ "Screenshot", 348 /* WXK_F9 */, 0x00 /* wxMOD_NONE*/ }, { "Screenshot", 348 /* WXK_F9 */, 0 /* wxMOD_NONE */ },
{ "Wiimote1Connect", 344 /* WXK_F5 */, 0x01 /* wxMOD_ALT */ }, { "Wiimote1Connect", 344 /* WXK_F5 */, 1 /* wxMOD_ALT */ },
{ "Wiimote2Connect", 345 /* WXK_F6 */, 0x01 /* wxMOD_ALT */ }, { "Wiimote2Connect", 345 /* WXK_F6 */, 1 /* wxMOD_ALT */ },
{ "Wiimote3Connect", 346 /* WXK_F7 */, 0x01 /* wxMOD_ALT */ }, { "Wiimote3Connect", 346 /* WXK_F7 */, 1 /* wxMOD_ALT */ },
{ "Wiimote4Connect", 347 /* WXK_F8 */, 0x01 /* wxMOD_ALT */ }, { "Wiimote4Connect", 347 /* WXK_F8 */, 1 /* wxMOD_ALT */ },
{ "LoadStateSlot1", 340 /* WXK_F1 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot2", 341 /* WXK_F2 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot3", 342 /* WXK_F3 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot4", 343 /* WXK_F4 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot5", 344 /* WXK_F5 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot6", 345 /* WXK_F6 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot7", 346 /* WXK_F7 */, 0x00 /* wxMOD_NONE*/ },
{ "LoadStateSlot8", 347 /* WXK_F8 */, 0x00 /* wxMOD_NONE*/ },
{ "SaveStateSlot1", 340 /* WXK_F1 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot2", 341 /* WXK_F2 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot3", 342 /* WXK_F3 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot4", 343 /* WXK_F4 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot5", 344 /* WXK_F5 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot6", 345 /* WXK_F6 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot7", 346 /* WXK_F7 */, 0x04 /* wxMOD_SHIFT*/ },
{ "SaveStateSlot8", 347 /* WXK_F8 */, 0x04 /* wxMOD_SHIFT*/ },
#endif #endif
{ "LoadStateSlot1", 340 /* WXK_F1 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot2", 341 /* WXK_F2 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot3", 342 /* WXK_F3 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot4", 343 /* WXK_F4 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot5", 344 /* WXK_F5 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot6", 345 /* WXK_F6 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot7", 346 /* WXK_F7 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot8", 347 /* WXK_F8 */, 0 /* wxMOD_NONE */ },
{ "SaveStateSlot1", 340 /* WXK_F1 */, 4 /* wxMOD_SHIFT */ },
{ "SaveStateSlot2", 341 /* WXK_F2 */, 4 /* wxMOD_SHIFT */ },
{ "SaveStateSlot3", 342 /* WXK_F3 */, 4 /* wxMOD_SHIFT */ },
{ "SaveStateSlot4", 343 /* WXK_F4 */, 4 /* wxMOD_SHIFT */ },
{ "SaveStateSlot5", 344 /* WXK_F5 */, 4 /* wxMOD_SHIFT */ },
{ "SaveStateSlot6", 345 /* WXK_F6 */, 4 /* wxMOD_SHIFT */ },
{ "SaveStateSlot7", 346 /* WXK_F7 */, 4 /* wxMOD_SHIFT */ },
{ "SaveStateSlot8", 347 /* WXK_F8 */, 4 /* wxMOD_SHIFT */ },
}; };
SConfig::SConfig() SConfig::SConfig()

View File

@ -33,7 +33,7 @@ SettingRadioButton::BoolSetting(wxWindow* parent, const wxString& label, const w
_connect_macro_(this, SettingRadioButton::UpdateValue, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); _connect_macro_(this, SettingRadioButton::UpdateValue, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
} }
SettingChoice::SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num, const wxString choices[]) SettingChoice::SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num, const wxString choices[], long style)
: wxChoice(parent, -1, wxDefaultPosition, wxDefaultSize, num, choices) : wxChoice(parent, -1, wxDefaultPosition, wxDefaultSize, num, choices)
, m_setting(setting) , m_setting(setting)
{ {

View File

@ -36,10 +36,27 @@ private:
typedef BoolSetting<wxCheckBox> SettingCheckBox; typedef BoolSetting<wxCheckBox> SettingCheckBox;
typedef BoolSetting<wxRadioButton> SettingRadioButton; typedef BoolSetting<wxRadioButton> SettingRadioButton;
template <typename T>
class IntegerSetting : public wxSpinCtrl
{
public:
IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, long style = 0);
void UpdateValue(wxCommandEvent& ev)
{
m_setting = ev.GetInt();
ev.Skip();
}
private:
T& m_setting;
};
typedef IntegerSetting<u32> U32Setting;
class SettingChoice : public wxChoice class SettingChoice : public wxChoice
{ {
public: public:
SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num = 0, const wxString choices[] = NULL); SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num = 0, const wxString choices[] = NULL, long style = 0);
void UpdateValue(wxCommandEvent& ev); void UpdateValue(wxCommandEvent& ev);
private: private:
int &m_setting; int &m_setting;

View File

@ -15,25 +15,13 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "VideoConfigDiag.h"
#include "VideoConfigDialog.h" #include "VideoConfigDialog.h"
#include "FileUtil.h" #include "FileUtil.h"
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s) #define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
// template instantiation
template class _BoolSetting<wxCheckBox>;
template <>
SettingCheckBox::_BoolSetting(wxWindow* parent, const wxString& label, bool &setting, bool reverse, long style) :
wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize, style),
m_setting(setting),
m_reverse(reverse)
{
SetValue(m_setting ^ m_reverse);
_connect_macro_(this, SettingCheckBox::UpdateValue, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
}
template <typename T> template <typename T>
IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, long style) : IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, long style) :
wxSpinCtrl(parent, -1, label, wxDefaultPosition, wxDefaultSize, style), wxSpinCtrl(parent, -1, label, wxDefaultPosition, wxDefaultSize, style),
@ -69,7 +57,7 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title,
wxGridSizer* const szr_rendering = new wxGridSizer(2, 5, 5); wxGridSizer* const szr_rendering = new wxGridSizer(2, 5, 5);
group_rendering->Add(szr_rendering, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); group_rendering->Add(szr_rendering, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
szr_rendering->Add(new SettingCheckBox(page_general, wxT("Hardware rasterization"), vconfig.bHwRasterizer)); szr_rendering->Add(new SettingCheckBox(page_general, wxT("Hardware rasterization"), wxT(""), vconfig.bHwRasterizer));
} }
// - info // - info
@ -79,7 +67,7 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title,
wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5); wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5);
group_info->Add(szr_info, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); group_info->Add(szr_info, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
szr_info->Add(new SettingCheckBox(page_general, wxT("Various Statistics"), vconfig.bShowStats)); szr_info->Add(new SettingCheckBox(page_general, wxT("Various Statistics"), wxT(""), vconfig.bShowStats));
} }
// - utility // - utility
@ -89,9 +77,9 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title,
wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5); wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5);
group_utility->Add(szr_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); group_utility->Add(szr_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
szr_utility->Add(new SettingCheckBox(page_general, wxT("Dump Textures"), vconfig.bDumpTextures)); szr_utility->Add(new SettingCheckBox(page_general, wxT("Dump Textures"), wxT(""), vconfig.bDumpTextures));
szr_utility->Add(new SettingCheckBox(page_general, wxT("Dump Objects"), vconfig.bDumpObjects)); szr_utility->Add(new SettingCheckBox(page_general, wxT("Dump Objects"), wxT(""), vconfig.bDumpObjects));
szr_utility->Add(new SettingCheckBox(page_general, wxT("Dump Frames"), vconfig.bDumpFrames)); szr_utility->Add(new SettingCheckBox(page_general, wxT("Dump Frames"), wxT(""), vconfig.bDumpFrames));
// - debug only // - debug only
wxStaticBoxSizer* const group_debug_only_utility = new wxStaticBoxSizer(wxHORIZONTAL, page_general, wxT("Debug Only")); wxStaticBoxSizer* const group_debug_only_utility = new wxStaticBoxSizer(wxHORIZONTAL, page_general, wxT("Debug Only"));
@ -99,8 +87,8 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title,
wxGridSizer* const szr_debug_only_utility = new wxGridSizer(2, 5, 5); wxGridSizer* const szr_debug_only_utility = new wxGridSizer(2, 5, 5);
group_debug_only_utility->Add(szr_debug_only_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); group_debug_only_utility->Add(szr_debug_only_utility, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
szr_debug_only_utility->Add(new SettingCheckBox(page_general, wxT("Dump TEV Stages"), vconfig.bDumpTevStages)); szr_debug_only_utility->Add(new SettingCheckBox(page_general, wxT("Dump TEV Stages"), wxT(""), vconfig.bDumpTevStages));
szr_debug_only_utility->Add(new SettingCheckBox(page_general, wxT("Dump Texture Fetches"), vconfig.bDumpTevTextureFetches)); szr_debug_only_utility->Add(new SettingCheckBox(page_general, wxT("Dump Texture Fetches"), wxT(""), vconfig.bDumpTevTextureFetches));
} }
// - misc // - misc

View File

@ -33,40 +33,6 @@
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
template <typename W>
class _BoolSetting : public W
{
public:
_BoolSetting(wxWindow* parent, const wxString& label, bool &setting, bool reverse = false, long style = 0);
void UpdateValue(wxCommandEvent& ev)
{
m_setting = (ev.GetInt() != 0) ^ m_reverse;
ev.Skip();
}
private:
bool& m_setting;
const bool m_reverse;
};
template <typename T>
class IntegerSetting : public wxSpinCtrl
{
public:
IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, long style = 0);
void UpdateValue(wxCommandEvent& ev)
{
m_setting = ev.GetInt();
ev.Skip();
}
private:
T& m_setting;
};
typedef _BoolSetting<wxCheckBox> SettingCheckBox;
typedef IntegerSetting<u32> U32Setting;
class VideoConfigDialog : public wxDialog class VideoConfigDialog : public wxDialog
{ {
public: public: