added a "main settings" dialog and moved most options there. Not complete yet. Also, just revert if the idea of a main settings dialog isn't to your liking.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@632 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-09-23 05:43:52 +00:00
parent 18dbfbd462
commit 467fe4f2a6
11 changed files with 609 additions and 450 deletions

View File

@ -747,6 +747,14 @@
<Filter
Name="GUI"
>
<File
RelativePath=".\src\ConfigMain.cpp"
>
</File>
<File
RelativePath=".\src\ConfigMain.h"
>
</File>
<File
RelativePath=".\Src\FilesystemViewer.cpp"
>
@ -819,14 +827,6 @@
RelativePath=".\src\MemcardManager.h"
>
</File>
<File
RelativePath=".\src\PluginOptions.cpp"
>
</File>
<File
RelativePath=".\src\PluginOptions.h"
>
</File>
</Filter>
<Filter
Name="Misc"

View File

@ -55,7 +55,7 @@ bool BootCore(const std::string& _rFilename)
else
{
// StartUp.bUseDualCore = false;
StartUp.bUseJIT = true;
// StartUp.bUseJIT = true;
}
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
StartUp.m_strFilename = _rFilename;

View File

@ -0,0 +1,422 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <string>
#include <vector>
#include "Globals.h"
#include "ConfigMain.h"
#include "PluginManager.h"
#include "Config.h"
BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
EVT_CLOSE(CConfigMain::OnClose)
EVT_BUTTON(ID_OK, CConfigMain::OKClick)
EVT_BUTTON(ID_APPLY, CConfigMain::OKClick)
EVT_BUTTON(ID_CANCEL, CConfigMain::OKClick)
EVT_CHECKBOX(ID_ALLWAYS_HLEBIOS, CConfigMain::AllwaysHLEBIOSCheck)
EVT_CHECKBOX(ID_USEDYNAREC, CConfigMain::UseDynaRecCheck)
EVT_CHECKBOX(ID_USEDUALCORE, CConfigMain::UseDualCoreCheck)
EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::LockThreadsCheck)
EVT_CHECKBOX(ID_OPTIMIZEQUANTIZERS, CConfigMain::OptimizeQuantizersCheck)
EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::SkipIdleCheck)
EVT_CHOICE(ID_CONSOLELANG, CConfigMain::ConsoleLangChanged)
EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged)
EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged)
EVT_CHOICE(ID_GRAPHIC_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_GRAPHIC_ABOUT, CConfigMain::OnAbout)
EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_DSP_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_DSP_ABOUT, CConfigMain::OnAbout)
EVT_BUTTON(ID_DSP_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_PAD_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_PAD_ABOUT, CConfigMain::OnAbout)
EVT_BUTTON(ID_PAD_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_WIIMOTE_ABOUT, CConfigMain::OnAbout)
EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
END_EVENT_TABLE()
CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
CreateGUIControls();
}
CConfigMain::~CConfigMain()
{
}
void CConfigMain::CreateGUIControls()
{
Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE, wxDefaultPosition, wxDefaultSize);
Notebook->AddPage(GeneralPage, wxT("General"));
PathsPage = new wxPanel(Notebook, ID_PATHSPAGE, wxDefaultPosition, wxDefaultSize);
Notebook->AddPage(PathsPage, wxT("Paths"));
PluginPage = new wxPanel(Notebook, ID_PLUGINPAGE, wxDefaultPosition, wxDefaultSize);
Notebook->AddPage(PluginPage, wxT("Plugins"));
OK = new wxButton(this, ID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
Apply->Disable();
wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->Add(0, 0, 1, wxEXPAND, 5);
sButtons->Add(OK, 0, wxALL, 5);
sButtons->Add(Cancel, 0, wxALL, 5);
sButtons->Add(Apply, 0, wxALL, 5);
wxBoxSizer* sMain;
sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 5);
this->SetSizer(sMain);
this->Layout();
// General page
AllwaysHLEBIOS = new wxCheckBox(GeneralPage, ID_ALLWAYS_HLEBIOS, wxT("HLE the BIOS all the time"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
AllwaysHLEBIOS->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios);
UseDynaRec = new wxCheckBox(GeneralPage, ID_USEDYNAREC, wxT("Use dynamic recompilation"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
UseDynaRec->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUseJIT);
UseDualCore = new wxCheckBox(GeneralPage, ID_USEDUALCORE, wxT("Use dual core mode"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
UseDualCore->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore);
LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, wxT("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
LockThreads->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads);
OptimizeQuantizers = new wxCheckBox(GeneralPage, ID_OPTIMIZEQUANTIZERS, wxT("Optimize quantizers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
OptimizeQuantizers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bOptimizeQuantizers);
SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, wxT("Use idle skipping"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
wxArrayString arrayStringFor_ConsoleLang;
arrayStringFor_ConsoleLang.Add(wxT("English"));
arrayStringFor_ConsoleLang.Add(wxT("German"));
arrayStringFor_ConsoleLang.Add(wxT("French"));
arrayStringFor_ConsoleLang.Add(wxT("Spanish"));
arrayStringFor_ConsoleLang.Add(wxT("Italian"));
arrayStringFor_ConsoleLang.Add(wxT("Dutch"));
ConsoleLangText = new wxStaticText(GeneralPage, ID_CONSOLELANG_TEXT, wxT("Console Language:"), wxDefaultPosition, wxDefaultSize);
ConsoleLang = new wxChoice(GeneralPage, ID_CONSOLELANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_ConsoleLang, 0, wxDefaultValidator);
sGeneral = new wxGridBagSizer(0, 0);
sGeneral->Add(AllwaysHLEBIOS, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sGeneral->Add(UseDynaRec, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sGeneral->Add(UseDualCore, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sGeneral->Add(LockThreads, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
sGeneral->Add(OptimizeQuantizers, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5);
sGeneral->Add(SkipIdle, wxGBPosition(5, 0), wxGBSpan(1, 2), wxALL, 5);
sGeneral->Add(ConsoleLangText, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sGeneral->Add(ConsoleLang, wxGBPosition(6, 1), wxGBSpan(1, 1), wxALL, 5);
GeneralPage->SetSizer(sGeneral);
sGeneral->Layout();
// Paths page
// TODO add gcm paths - the whole point of the page
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories:"));
wxArrayString arrayStringFor_ISOPaths;
ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0);
sISOPaths = new wxGridBagSizer(0, 0);
sISOPaths->Add(ISOPaths, wxGBPosition(0, 0), wxGBSpan(1, 3), wxALL|wxEXPAND, 5);
sISOPaths->Add(AddISOPath, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5);
sISOPaths->Add(RemoveISOPath, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5);
sbISOPaths->Add(sISOPaths, 1, wxEXPAND|wxALL, 5);
DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize);
DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, wxT("Choose a default ISO:"),
wxString::Format(wxT("All GC/Wii images (gcm, iso, gcz)|*.gcm;*.iso;*.gcz|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN);
DefaultISO->SetPath(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM);
DVDRootText = new wxStaticText(PathsPage, ID_DVDROOT_TEXT, wxT("DVD Root:"), wxDefaultPosition, wxDefaultSize);
DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, wxT("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL);
DVDRoot->SetPath(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot);
sPaths = new wxGridBagSizer(0, 0);
sPaths->Add(sbISOPaths, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL|wxEXPAND, 5);
sPaths->Add(DefaultISOText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sPaths->Add(DefaultISO, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL|wxEXPAND, 5);
sPaths->Add(DVDRootText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sPaths->Add(DVDRoot, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL|wxEXPAND, 5);
PathsPage->SetSizer(sPaths);
sPaths->Layout();
// Plugin page
GraphicSelection = new wxChoice(PluginPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
GraphicAbout = new wxButton(PluginPage, ID_GRAPHIC_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
GraphicConfig = new wxButton(PluginPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
GraphicText = new wxStaticText(PluginPage, ID_GRAPHIC_TEXT, wxT("GFX:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
DSPSelection = new wxChoice(PluginPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
DSPAbout = new wxButton(PluginPage, ID_DSP_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
DSPConfig = new wxButton(PluginPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
DSPText = new wxStaticText(PluginPage, ID_DSP_TEXT, wxT("DSP:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
PADSelection = new wxChoice(PluginPage, ID_PAD_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
PADAbout = new wxButton(PluginPage, ID_PAD_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
PADConfig = new wxButton(PluginPage, ID_PAD_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
PADText = new wxStaticText(PluginPage, ID_PAD_TEXT, wxT("PAD:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
WiimoteSelection = new wxChoice(PluginPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
WiimoteAbout = new wxButton(PluginPage, ID_WIIMOTE_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiimoteConfig = new wxButton(PluginPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiimoteText = new wxStaticText(PluginPage, ID_WIIMOTE_TEXT, wxT("Wiimote:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
sPlugins = new wxGridBagSizer(0, 0);
sPlugins->Add(GraphicText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
sPlugins->Add(GraphicSelection, wxGBPosition(0, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sPlugins->Add(GraphicConfig, wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
sPlugins->Add(GraphicAbout, wxGBPosition(1, 2), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
sPlugins->Add(DSPText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
sPlugins->Add(DSPSelection, wxGBPosition(2, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sPlugins->Add(DSPConfig, wxGBPosition(3, 1), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
sPlugins->Add(DSPAbout, wxGBPosition(3, 2), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
sPlugins->Add(PADText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
sPlugins->Add(PADSelection, wxGBPosition(4, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sPlugins->Add(PADConfig, wxGBPosition(5, 1), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
sPlugins->Add(PADAbout, wxGBPosition(5, 2), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
sPlugins->Add(WiimoteText, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
sPlugins->Add(WiimoteSelection, wxGBPosition(6, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sPlugins->Add(WiimoteConfig, wxGBPosition(7, 1), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
sPlugins->Add(WiimoteAbout, wxGBPosition(7, 2), wxGBSpan(1, 1), wxLEFT|wxBOTTOM, 5);
PluginPage->SetSizer(sPlugins);
sPlugins->Layout();
SetIcon(wxNullIcon);
Fit();
}
void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
{
Destroy();
}
void CConfigMain::OKClick(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_OK:
DoApply();
Destroy();
break;
case ID_APPLY:
DoApply();
break;
case ID_CANCEL:
Destroy();
break;
}
}
void CConfigMain::AllwaysHLEBIOSCheck(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios = AllwaysHLEBIOS->IsChecked();
}
void CConfigMain::UseDynaRecCheck(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bUseJIT = UseDynaRec->IsChecked();
}
void CConfigMain::UseDualCoreCheck(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore = UseDualCore->IsChecked();
}
void CConfigMain::LockThreadsCheck(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads = LockThreads->IsChecked();
}
void CConfigMain::OptimizeQuantizersCheck(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bOptimizeQuantizers = OptimizeQuantizers->IsChecked();
}
void CConfigMain::SkipIdleCheck(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = SkipIdle->IsChecked();
}
void CConfigMain::ConsoleLangChanged(wxCommandEvent& WXUNUSED (event))
{
}
void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = DefaultISO->GetPath();
}
void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath();
}
void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
{
Apply->Enable();
}
void CConfigMain::OnAbout(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_GRAPHIC_ABOUT:
CallAbout(GraphicSelection);
break;
case ID_DSP_ABOUT:
CallAbout(DSPSelection);
break;
case ID_PAD_ABOUT:
CallAbout(PADSelection);
break;
case ID_WIIMOTE_ABOUT:
CallAbout(WiimoteSelection);
break;
}
}
void CConfigMain::OnConfig(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_GRAPHIC_CONFIG:
CallConfig(GraphicSelection);
break;
case ID_DSP_CONFIG:
CallConfig(DSPSelection);
break;
case ID_PAD_CONFIG:
CallConfig(PADSelection);
break;
case ID_WIIMOTE_CONFIG:
CallConfig(WiimoteSelection);
break;
}
}
void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
{
_pChoice->Clear();
int Index = -1;
const CPluginInfos& rInfos = CPluginManager::GetInstance().GetPluginInfos();
for (size_t i = 0; i < rInfos.size(); i++)
{
const PLUGIN_INFO& rPluginInfo = rInfos[i].GetPluginInfo();
if (rPluginInfo.Type == _PluginType)
{
wxString temp;
temp = wxString::FromAscii(rInfos[i].GetPluginInfo().Name);
int NewIndex = _pChoice->Append(temp, (void*)&rInfos[i]);
if (rInfos[i].GetFileName() == _SelectFilename)
{
Index = NewIndex;
}
}
}
_pChoice->Select(Index);
}
void CConfigMain::CallConfig(wxChoice* _pChoice)
{
int Index = _pChoice->GetSelection();
if (Index >= 0)
{
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
if (pInfo != NULL)
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFileName().c_str());
}
}
void CConfigMain::CallAbout(wxChoice* _pChoice)
{
int Index = _pChoice->GetSelection();
if (Index >= 0)
{
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
if (pInfo != NULL)
CPluginManager::GetInstance().OpenAbout((HWND) this->GetHandle(), pInfo->GetFileName().c_str());
}
}
void CConfigMain::DoApply()
{
Apply->Disable();
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
SConfig::GetInstance().SaveSettings();
}
bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
{
_rFilename.clear();
int Index = _pChoice->GetSelection();
printf("%i\n", Index);
if (Index >= 0)
{
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
_rFilename = pInfo->GetFileName();
printf("%s\n", _rFilename.c_str());
return(true);
}
return(false);
}

View File

@ -0,0 +1,160 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __CONFIG_MAIN_h__
#define __CONFIG_MAIN_h__
#include <wx/gbsizer.h>
#include <wx/notebook.h>
#include <wx/filepicker.h>
//#include <wx/listbox.h>
#undef CONFIG_MAIN_STYLE
#define CONFIG_MAIN_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class CConfigMain
: public wxDialog
{
public:
CConfigMain(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Dolphin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = CONFIG_MAIN_STYLE);
virtual ~CConfigMain();
void OKClick(wxCommandEvent& event);
void OnSelectionChanged(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnConfig(wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE();
wxGridBagSizer* sGeneral;
wxGridBagSizer* sPaths;
wxStaticBoxSizer* sbISOPaths;
wxGridBagSizer* sISOPaths;
wxGridBagSizer* sPlugins;
wxNotebook *Notebook;
wxPanel *GeneralPage;
wxPanel *PathsPage;
wxPanel *PluginPage;
wxButton* OK;
wxButton* Cancel;
wxButton* Apply;
wxCheckBox* AllwaysHLEBIOS;
wxCheckBox* UseDynaRec;
wxCheckBox* UseDualCore;
wxCheckBox* LockThreads;
wxCheckBox* OptimizeQuantizers;
wxCheckBox* SkipIdle;
wxStaticText* ConsoleLangText;
wxChoice* ConsoleLang;
wxListBox* ISOPaths;
wxButton* AddISOPath;
wxButton* RemoveISOPath;
wxStaticText* DefaultISOText;
wxFilePickerCtrl* DefaultISO;
wxStaticText* DVDRootText;
wxDirPickerCtrl* DVDRoot;
wxStaticText* PADText;
wxButton* PADAbout;
wxButton* PADConfig;
wxChoice* PADSelection;
wxButton* DSPAbout;
wxButton* DSPConfig;
wxStaticText* DSPText;
wxChoice* DSPSelection;
wxButton* GraphicAbout;
wxButton* GraphicConfig;
wxStaticText* GraphicText;
wxChoice* GraphicSelection;
wxButton* WiimoteAbout;
wxButton* WiimoteConfig;
wxStaticText* WiimoteText;
wxChoice* WiimoteSelection;
enum
{
ID_NOTEBOOK = 1000,
ID_GENERALPAGE,
ID_PATHSPAGE,
ID_PLUGINPAGE,
ID_CANCEL,
ID_APPLY,
ID_OK,
ID_ALLWAYS_HLEBIOS,
ID_USEDYNAREC,
ID_USEDUALCORE,
ID_LOCKTHREADS,
ID_OPTIMIZEQUANTIZERS,
ID_IDLESKIP,
ID_CONSOLELANG_TEXT,
ID_CONSOLELANG,
ID_ISOPATHS,
ID_ADDISOPATH,
ID_REMOVEISOPATH,
ID_DEFAULTISO_TEXT,
ID_DEFAULTISO,
ID_DVDROOT_TEXT,
ID_DVDROOT,
ID_WIIMOTE_ABOUT,
ID_WIIMOTE_CONFIG,
ID_WIIMOTE_TEXT,
ID_WIIMOTE_CB,
ID_PAD_TEXT,
ID_PAD_ABOUT ,
ID_PAD_CONFIG,
ID_PAD_CB,
ID_DSP_ABOUT ,
ID_DSP_CONFIG,
ID_DSP_TEXT,
ID_DSP_CB,
ID_GRAPHIC_ABOUT ,
ID_GRAPHIC_CONFIG,
ID_GRAPHIC_TEXT,
ID_GRAPHIC_CB,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
void CreateGUIControls();
void OnClose(wxCloseEvent& event);
void AllwaysHLEBIOSCheck(wxCommandEvent& event);
void UseDynaRecCheck(wxCommandEvent& event);
void UseDualCoreCheck(wxCommandEvent& event);
void LockThreadsCheck(wxCommandEvent& event);
void OptimizeQuantizersCheck(wxCommandEvent& event);
void SkipIdleCheck(wxCommandEvent& event);
void ConsoleLangChanged(wxCommandEvent& event);
void DefaultISOChanged(wxFileDirPickerEvent& event);
void DVDRootChanged(wxFileDirPickerEvent& event);
void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename);
void CallConfig(wxChoice* _pChoice);
void CallAbout(wxChoice* _pChoice);
void DoApply();
bool GetFilename(wxChoice* _pChoice, std::string& _rFilename);
};
#endif

View File

@ -26,7 +26,7 @@
#include "Config.h"
#include "Core.h"
#include "State.h"
#include "PluginOptions.h"
#include "ConfigMain.h"
#include "PluginManager.h"
#include "MemcardManager.h"
@ -87,7 +87,7 @@ EVT_MENU(IDM_HELPABOUT, CFrame::OnHelp)
EVT_MENU(wxID_REFRESH, CFrame::OnRefresh)
EVT_MENU(IDM_PLAY, CFrame::OnPlay)
EVT_MENU(IDM_STOP, CFrame::OnStop)
EVT_MENU(IDM_PLUGIN_OPTIONS, CFrame::OnPluginOptions)
EVT_MENU(IDM_CONFIG_MAIN, CFrame::OnConfigMain)
EVT_MENU(IDM_CONFIG_GFX_PLUGIN, CFrame::OnPluginGFX)
EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP)
EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD)
@ -213,17 +213,13 @@ void CFrame::CreateMenu()
// options menu
wxMenu* pOptionsMenu = new wxMenu;
m_pPluginOptions = pOptionsMenu->Append(IDM_PLUGIN_OPTIONS, _T("&Select plugins"));
m_pPluginOptions = pOptionsMenu->Append(IDM_CONFIG_MAIN, _T("Co&nfigure..."));
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&GFX settings"));
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP settings"));
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&PAD settings"));
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
pOptionsMenu->AppendCheckItem(IDM_TOGGLE_DUALCORE, _T("Dual-&core (unstable!)"));
pOptionsMenu->Check(IDM_TOGGLE_DUALCORE, SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore);
pOptionsMenu->AppendCheckItem(IDM_TOGGLE_SKIPIDLE, _T("Idle s&kipping"));
pOptionsMenu->Check(IDM_TOGGLE_SKIPIDLE, SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
m_pMenuBar->Append(pOptionsMenu, _T("&Options"));
// misc menu
@ -267,8 +263,8 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
toolBar->SetToolDisabledBitmap(IDM_STOP, m_Bitmaps[Toolbar_Stop_Dis]);
toolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen"));
toolBar->AddSeparator();
toolBar->AddTool(IDM_PLUGIN_OPTIONS, _T("Plugins"), m_Bitmaps[Toolbar_PluginOptions], _T("Select plugins"));
toolBar->SetToolDisabledBitmap(IDM_PLUGIN_OPTIONS, m_Bitmaps[Toolbar_PluginOptions_Dis]);
toolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
toolBar->SetToolDisabledBitmap(IDM_CONFIG_MAIN, m_Bitmaps[Toolbar_PluginOptions_Dis]);
toolBar->AddTool(IDM_CONFIG_GFX_PLUGIN, _T("GFX"), m_Bitmaps[Toolbar_PluginGFX], _T("GFX settings"));
toolBar->AddTool(IDM_CONFIG_DSP_PLUGIN, _T("DSP"), m_Bitmaps[Toolbar_PluginDSP], _T("DSP settings"));
toolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _T("PAD"), m_Bitmaps[Toolbar_PluginPAD], _T("PAD settings"));
@ -451,10 +447,10 @@ void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
}
void CFrame::OnPluginOptions(wxCommandEvent& WXUNUSED (event))
void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
{
CPluginOptions PluginOptions(this);
PluginOptions.ShowModal();
CConfigMain ConfigMain(this);
ConfigMain.ShowModal();
}
@ -625,7 +621,7 @@ void CFrame::UpdateGUI()
{
if (Core::GetState() == Core::CORE_UNINITIALIZED)
{
GetToolBar()->EnableTool(IDM_PLUGIN_OPTIONS, true);
GetToolBar()->EnableTool(IDM_CONFIG_MAIN, true);
m_pPluginOptions->Enable(true);
GetToolBar()->EnableTool(IDM_STOP, false);
@ -642,7 +638,7 @@ void CFrame::UpdateGUI()
}
else
{
GetToolBar()->EnableTool(IDM_PLUGIN_OPTIONS, false);
GetToolBar()->EnableTool(IDM_CONFIG_MAIN, false);
m_pPluginOptions->Enable(false);
GetToolBar()->EnableTool(IDM_STOP, true);

View File

@ -54,7 +54,7 @@ class CFrame
void OnQuit(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnRefresh(wxCommandEvent& event);
void OnPluginOptions(wxCommandEvent& event);
void OnConfigMain(wxCommandEvent& event);
void OnPluginGFX(wxCommandEvent& event);
void OnPluginDSP(wxCommandEvent& event);
void OnPluginPAD(wxCommandEvent& event);

View File

@ -473,7 +473,10 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
popupMenu.Append(IDM_EDITPATCHFILE, wxString::FromAscii(menu_text.c_str())); //Pretty much everything in wxwidgets is a wxString, try to convert to those first!
popupMenu.Append(IDM_OPENCONTAININGFOLDER, wxString::FromAscii("Open &containing folder"));
popupMenu.Append(IDM_FILESYSTEMVIEWER, wxString::FromAscii("Open in ISO viewer/dumper"));
popupMenu.Append(IDM_SETDEFAULTGCM, wxString::FromAscii("Set as &default ISO"));
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, wxString::FromAscii("Set as &default ISO"));
if(selected_iso->GetFileName() == SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM)
popupMenu.FindItemByPosition(3)->Check();
popupMenu.AppendSeparator();
popupMenu.Append(IDM_DELETEGCM, wxString::FromAscii("&Delete ISO..."));

View File

@ -52,7 +52,7 @@ enum
IDM_DELETEGCM,
IDM_FILESYSTEMVIEWER,
IDM_COMPRESSGCM,
IDM_PLUGIN_OPTIONS,
IDM_CONFIG_MAIN,
IDM_CONFIG_GFX_PLUGIN,
IDM_CONFIG_DSP_PLUGIN,
IDM_CONFIG_PAD_PLUGIN,

View File

@ -145,13 +145,11 @@ void CMemcardManager::CreateGUIControls()
sMemcard2->Add(m_Memcard2Path, 0, wxEXPAND|wxALL, 5);
sMemcard2->Add(m_MemcardList[1], 1, wxEXPAND|wxALL, 5);
//wxBoxSizer* sMain;
sMain = new wxBoxSizer(wxHORIZONTAL);
sMain->Add(sMemcard1, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 0);
sMain->Add(sMemcard2, 1, wxEXPAND|wxALL, 5);
CenterOnParent();
this->SetSizer(sMain);
sMain->SetSizeHints(this);
}
@ -230,7 +228,7 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card)
m_MemcardList[card]->InsertColumn(COLUMN_COMMENT, _T("Comment"));
m_MemcardList[card]->InsertColumn(COLUMN_ICON, _T("Icon"));
wxImageList *list=m_MemcardList[card]->GetImageList(wxIMAGE_LIST_SMALL);
wxImageList *list = m_MemcardList[card]->GetImageList(wxIMAGE_LIST_SMALL);
list->RemoveAll();
int nFiles = memoryCard[card]->GetNumFiles();

View File

@ -1,303 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <string>
#include <vector>
#include "Globals.h"
#include "PluginOptions.h"
#include "PluginManager.h"
#include "Config.h"
BEGIN_EVENT_TABLE(CPluginOptions, wxDialog)
EVT_CLOSE(CPluginOptions::OnClose)
EVT_BUTTON(ID_OK, CPluginOptions::OKClick)
EVT_BUTTON(ID_APPLY, CPluginOptions::OKClick)
EVT_BUTTON(ID_CANCEL, CPluginOptions::OKClick)
EVT_CHOICE(ID_GRAPHIC_CB, CPluginOptions::OnSelectionChanged)
EVT_BUTTON(ID_GRAPHIC_ABOUT, CPluginOptions::OnAbout)
EVT_BUTTON(ID_GRAPHIC_CONFIG, CPluginOptions::OnConfig)
EVT_CHOICE(ID_DSP_CB, CPluginOptions::OnSelectionChanged)
EVT_BUTTON(ID_DSP_ABOUT, CPluginOptions::OnAbout)
EVT_BUTTON(ID_DSP_CONFIG, CPluginOptions::OnConfig)
EVT_CHOICE(ID_PAD_CB, CPluginOptions::OnSelectionChanged)
EVT_BUTTON(ID_PAD_ABOUT, CPluginOptions::OnAbout)
EVT_BUTTON(ID_PAD_CONFIG, CPluginOptions::OnConfig)
EVT_CHOICE(ID_WIIMOTE_CB, CPluginOptions::OnSelectionChanged)
EVT_BUTTON(ID_WIIMOTE_ABOUT, CPluginOptions::OnAbout)
EVT_BUTTON(ID_WIIMOTE_CONFIG, CPluginOptions::OnConfig)
END_EVENT_TABLE()
CPluginOptions::CPluginOptions(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
CreateGUIControls();
}
CPluginOptions::~CPluginOptions()
{}
void CPluginOptions::CreateGUIControls()
{
OK = new wxButton(this, ID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
Apply->Disable();
GraphicSelection = new wxChoice(this, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
GraphicAbout = new wxButton(this, ID_GRAPHIC_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
GraphicConfig = new wxButton(this, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
GraphicText = new wxStaticText(this, ID_GRAPHIC_TEXT, wxT("GFX:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
DSPSelection = new wxChoice(this, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
DSPAbout = new wxButton(this, ID_DSP_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
DSPConfig = new wxButton(this, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
DSPText = new wxStaticText(this, ID_DSP_TEXT, wxT("DSP:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
PADSelection = new wxChoice(this, ID_PAD_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
PADAbout = new wxButton(this, ID_PAD_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
PADConfig = new wxButton(this, ID_PAD_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
PADText = new wxStaticText(this, ID_PAD_TEXT, wxT("PAD:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
WiimoteSelection = new wxChoice(this, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
WiimoteAbout = new wxButton(this, ID_WIIMOTE_ABOUT, wxT("About..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiimoteConfig = new wxButton(this, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiimoteText = new wxStaticText(this, ID_WIIMOTE_TEXT, wxT("Wiimote:"), wxDefaultPosition, wxDefaultSize);
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
wxGridBagSizer* sConfig;
sConfig = new wxGridBagSizer(0, 0);
sConfig->SetFlexibleDirection(wxBOTH);
sConfig->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
sConfig->Add(GraphicText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sConfig->Add(GraphicSelection, wxGBPosition(0, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sConfig->Add(GraphicConfig, wxGBPosition(0, 3), wxGBSpan(1, 1), wxALL, 5);
sConfig->Add(GraphicAbout, wxGBPosition(0, 4), wxGBSpan(1, 1), wxALL, 5);
sConfig->Add(DSPText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sConfig->Add(DSPSelection, wxGBPosition(1, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sConfig->Add(DSPConfig, wxGBPosition(1, 3), wxGBSpan(1, 1), wxALL, 5);
sConfig->Add(DSPAbout, wxGBPosition(1, 4), wxGBSpan(1, 1), wxALL, 5);
sConfig->Add(PADText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sConfig->Add(PADSelection, wxGBPosition(2, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sConfig->Add(PADConfig, wxGBPosition(2, 3), wxGBSpan(1, 1), wxALL, 5);
sConfig->Add(PADAbout, wxGBPosition(2, 4), wxGBSpan(1, 1), wxALL, 5);
sConfig->Add(WiimoteText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sConfig->Add(WiimoteSelection, wxGBPosition(3, 1), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sConfig->Add(WiimoteConfig, wxGBPosition(3, 3), wxGBSpan(1, 1), wxALL, 5);
sConfig->Add(WiimoteAbout, wxGBPosition(3, 4), wxGBSpan(1, 1), wxALL, 5);
sConfig->Layout();
wxBoxSizer* sButtons;
sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->Add(0, 0, 1, wxEXPAND, 5);
sButtons->Add(OK, 0, wxALL, 5);
sButtons->Add(Cancel, 0, wxALL, 5);
sButtons->Add(Apply, 0, wxALL, 5);
wxBoxSizer* sMain;
sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(sConfig, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 5);
Center();
this->SetSizer(sMain);
sMain->SetSizeHints(this);
}
void CPluginOptions::OnClose(wxCloseEvent& WXUNUSED (event))
{
Destroy();
}
void CPluginOptions::OKClick(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_OK:
DoApply();
Destroy();
break;
case ID_APPLY:
DoApply();
break;
case ID_CANCEL:
Destroy();
break;
}
}
void CPluginOptions::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
{
Apply->Enable();
}
void CPluginOptions::OnAbout(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_GRAPHIC_ABOUT:
CallAbout(GraphicSelection);
break;
case ID_DSP_ABOUT:
CallAbout(DSPSelection);
break;
case ID_PAD_ABOUT:
CallAbout(PADSelection);
break;
case ID_WIIMOTE_ABOUT:
CallAbout(WiimoteSelection);
break;
}
}
void CPluginOptions::OnConfig(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_GRAPHIC_CONFIG:
CallConfig(GraphicSelection);
break;
case ID_DSP_CONFIG:
CallConfig(DSPSelection);
break;
case ID_PAD_CONFIG:
CallConfig(PADSelection);
break;
case ID_WIIMOTE_CONFIG:
CallConfig(WiimoteSelection);
break;
}
}
void CPluginOptions::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
{
_pChoice->Clear();
int Index = -1;
const CPluginInfos& rInfos = CPluginManager::GetInstance().GetPluginInfos();
for (size_t i = 0; i < rInfos.size(); i++)
{
const PLUGIN_INFO& rPluginInfo = rInfos[i].GetPluginInfo();
if (rPluginInfo.Type == _PluginType)
{
wxString temp;
temp = wxString::FromAscii(rInfos[i].GetPluginInfo().Name);
int NewIndex = _pChoice->Append(temp, (void*)&rInfos[i]);
if (rInfos[i].GetFileName() == _SelectFilename)
{
Index = NewIndex;
}
}
}
_pChoice->Select(Index);
}
void CPluginOptions::CallConfig(wxChoice* _pChoice)
{
int Index = _pChoice->GetSelection();
if (Index >= 0)
{
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
if (pInfo != NULL)
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFileName().c_str());
}
}
void CPluginOptions::CallAbout(wxChoice* _pChoice)
{
int Index = _pChoice->GetSelection();
if (Index >= 0)
{
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
if (pInfo != NULL)
CPluginManager::GetInstance().OpenAbout((HWND) this->GetHandle(), pInfo->GetFileName().c_str());
}
}
void CPluginOptions::DoApply()
{
Apply->Disable();
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
SConfig::GetInstance().SaveSettings();
}
bool CPluginOptions::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
{
_rFilename.clear();
int Index = _pChoice->GetSelection();
printf("%i\n", Index);
if (Index >= 0)
{
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
_rFilename = pInfo->GetFileName();
printf("%s\n", _rFilename.c_str());
return(true);
}
return(false);
}

View File

@ -1,117 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __PLUGIN_OPTIONS_h__
#define __PLUGIN_OPTIONS_h__
#include <wx/gbsizer.h>
#undef PLUGIN_OPTIONS_STYLE
#define PLUGIN_OPTIONS_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxMINIMIZE_BOX | wxCLOSE_BOX
class CPluginOptions
: public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
CPluginOptions(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Plugin Selection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = PLUGIN_OPTIONS_STYLE);
virtual ~CPluginOptions();
void OKClick(wxCommandEvent& event);
void OnSelectionChanged(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnConfig(wxCommandEvent& event);
private:
//Do not add custom control declarations between
//GUI Control Declaration Start and GUI Control Declaration End.
//wxDev-C++ will remove them. Add custom code after the block.
////GUI Control Declaration Start
wxButton* OK;
wxButton* Cancel;
wxButton* Apply;
wxStaticText* PADText;
wxButton* PADAbout;
wxButton* PADConfig;
wxChoice* PADSelection;
wxButton* DSPAbout;
wxButton* DSPConfig;
wxStaticText* DSPText;
wxChoice* DSPSelection;
wxButton* GraphicAbout;
wxButton* GraphicConfig;
wxStaticText* GraphicText;
wxChoice* GraphicSelection;
wxButton* WiimoteAbout;
wxButton* WiimoteConfig;
wxStaticText* WiimoteText;
wxChoice* WiimoteSelection;
////GUI Control Declaration End
private:
//Note: if you receive any error with these enum IDs, then you need to
//change your old form code that are based on the #define control IDs.
//#defines may replace a numeric value for the enum names.
//Try copy and pasting the below block in your old form header files.
enum
{
////GUI Enum Control ID Start
ID_WIIMOTE_ABOUT = 1038,
ID_WIIMOTE_CONFIG = 1037,
ID_WIIMOTE_TEXT = 1036,
ID_WIIMOTE_CB = 1035,
ID_CANCEL = 1034,
ID_APPLY = 1033,
ID_OK = 1032,
ID_PAD_TEXT = 1031,
ID_PAD_ABOUT = 1030,
ID_PAD_CONFIG = 1029,
ID_PAD_CB = 1028,
ID_DSP_ABOUT = 1027,
ID_DSP_CONFIG = 1026,
ID_DSP_TEXT = 1025,
ID_DSP_CB = 1024,
ID_GRAPHIC_ABOUT = 1007,
ID_GRAPHIC_CONFIG = 1006,
ID_GRAPHIC_TEXT = 1005,
ID_GRAPHIC_CB = 1003,
////GUI Enum Control ID End
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
private:
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename);
void CallConfig(wxChoice* _pChoice);
void CallAbout(wxChoice* _pChoice);
void DoApply();
bool GetFilename(wxChoice* _pChoice, std::string& _rFilename);
};
#endif