Interface settings: Added confirm on stop option

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1635 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2008-12-23 11:11:02 +00:00
parent 8cc09ef74d
commit ed156f3eeb
4 changed files with 95 additions and 27 deletions

View File

@ -65,6 +65,8 @@ struct SCoreStartupParameter
int SelectedLanguage;
bool bWii; bool bWiiLeds; bool bWiiSpeakers; // Wii settings
bool bConfirmStop; // Interface settings
enum EBootBios
{

View File

@ -38,6 +38,7 @@ EVT_CHECKBOX(ID_OPTIMIZEQUANTIZERS, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_BT_LEDS, CConfigMain::WiiSettingsChanged)
@ -126,7 +127,14 @@ void CConfigMain::CreateGUIControls()
this->SetSizer(sMain);
this->Layout();
// Core page
//////////////////////////////////
// Core page (sGeneral)
// -----------
sGeneral = new wxBoxSizer(wxVERTICAL);
// Basic Settings
sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Basic Settings"));
UseDualCore = new wxCheckBox(GeneralPage, ID_USEDUALCORE, wxT("Enable Dual Core"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
UseDualCore->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore);
@ -135,6 +143,11 @@ void CConfigMain::CreateGUIControls()
EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
EnableCheats->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats);
sbBasic->Add(UseDualCore, 0, wxALL, 5);
sbBasic->Add(SkipIdle, 0, wxALL, 5);
sbBasic->Add(EnableCheats, 0, wxALL, 5);
// Advanced Settings
sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
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);
@ -145,22 +158,30 @@ void CConfigMain::CreateGUIControls()
OptimizeQuantizers = new wxCheckBox(GeneralPage, ID_OPTIMIZEQUANTIZERS, wxT("Optimize Quantizers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
OptimizeQuantizers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bOptimizeQuantizers);
sGeneral = new wxBoxSizer(wxVERTICAL);
sbBasic->Add(UseDualCore, 0, wxALL, 5);
sbBasic->Add(SkipIdle, 0, wxALL, 5);
sbBasic->Add(EnableCheats, 0, wxALL, 5);
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
sGeneral->AddStretchSpacer();
sbAdvanced->Add(AllwaysHLEBIOS, 0, wxALL, 5);
sbAdvanced->Add(UseDynaRec, 0, wxALL, 5);
sbAdvanced->Add(LockThreads, 0, wxALL, 5);
sbAdvanced->Add(OptimizeQuantizers, 0, wxALL, 5);
// Interface Settings
sbInterface = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Interface Settings"));
ConfirmStop = new wxCheckBox(GeneralPage, ID_INTERFACE_CONFIRMSTOP, wxT("Show confirmation box before Stopping"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
sbInterface->Add(ConfirmStop, 0, wxALL, 5);
// Populate sGeneral
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
//sGeneral->AddStretchSpacer();
sGeneral->Add(sbAdvanced, 0, wxEXPAND|wxALL, 5);
sGeneral->Add(sbInterface, 0, wxEXPAND|wxALL, 5);
GeneralPage->SetSizer(sGeneral);
sGeneral->Layout();
//////////////////////////////////
// Gamecube page
// --------
sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings"));
arrayStringFor_GCSystemLang.Add(wxT("English"));
arrayStringFor_GCSystemLang.Add(wxT("German"));
@ -348,6 +369,11 @@ void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
Close();
}
// ====================================================================
// Core settings
// -------------
void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
{
switch (event.GetId())
@ -373,6 +399,9 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
case ID_ENABLECHEATS:
SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked();
break;
case ID_INTERFACE_CONFIRMSTOP:
SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop = ConfirmStop->IsChecked();
break;
}
}
@ -385,7 +414,13 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
break;
}
}
// ==========================
// ====================================================================
// Wii settings
// -------------
void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
{
switch (event.GetId())
@ -417,7 +452,13 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
break;
}
}
// ==========================
// ====================================================================
// Paths settings
// -------------
void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
{
if (!ISOPaths->GetStringSelection().empty())
@ -504,7 +545,13 @@ void CConfigMain::OnConfig(wxCommandEvent& event)
break;
}
}
// ==========================
// =======================================================
// Plugins settings
// -------------
void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
{
_pChoice->Clear();
@ -562,4 +609,4 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
return(false);
}
// ==========================

View File

@ -46,13 +46,25 @@ class CConfigMain
DECLARE_EVENT_TABLE();
wxBoxSizer* sGeneral;
wxStaticBoxSizer* sbBasic;
wxStaticBoxSizer* sbAdvanced;
wxBoxSizer* sGamecube;
wxBoxSizer* sGeneral; // Core settings
wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface;
wxCheckBox* AllwaysHLEBIOS;
wxCheckBox* UseDynaRec;
wxCheckBox* UseDualCore;
wxCheckBox* LockThreads;
wxCheckBox* OptimizeQuantizers;
wxCheckBox* SkipIdle;
wxCheckBox* EnableCheats;
wxCheckBox* ConfirmStop;
wxBoxSizer* sGamecube; // GC settings
wxStaticBoxSizer* sbGamecubeIPLSettings;
wxGridBagSizer* sGamecubeIPLSettings;
wxBoxSizer* sWii;
wxArrayString arrayStringFor_GCSystemLang;
wxStaticText* GCSystemLangText;
wxChoice* GCSystemLang;
wxBoxSizer* sWii; // Wii settings
wxStaticBoxSizer* sbWiimoteSettings;
wxGridBagSizer* sWiimoteSettings;
wxStaticBoxSizer* sbWiiIPLSettings;
@ -76,16 +88,6 @@ class CConfigMain
wxButton* m_Close;
wxCheckBox* AllwaysHLEBIOS;
wxCheckBox* UseDynaRec;
wxCheckBox* UseDualCore;
wxCheckBox* LockThreads;
wxCheckBox* OptimizeQuantizers;
wxCheckBox* SkipIdle;
wxCheckBox* EnableCheats;
wxArrayString arrayStringFor_GCSystemLang;
wxStaticText* GCSystemLangText;
wxChoice* GCSystemLang;
FILE* pStream;
u8 m_SYSCONF[0x4000];
@ -206,6 +208,8 @@ class CConfigMain
ID_GC_SRAM_LNG_TEXT,
ID_GC_SRAM_LNG,
ID_INTERFACE_CONFIRMSTOP, // Interface settings
ID_WII_BT_BAR_TEXT,
ID_WII_BT_BAR,
ID_WII_BT_LEDS, ID_WII_BT_SPEAKERS,

View File

@ -342,7 +342,7 @@ void CFrame::InitBitmaps()
// =======================================================
// Open file
// Open file to boot or for changing disc
// -------------
void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event))
{
@ -505,8 +505,23 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
{
Core::Stop();
UpdateGUI();
// Ask for confirmation in case the user accidently clicked Stop
int answer;
if(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{
answer = wxMessageBox("Are you sure you want to stop the current emulation?",
"Confirm", wxYES_NO);
}
else
{
answer = wxYES;
}
if (answer == wxYES && Core::GetState() != Core::CORE_UNINITIALIZED)
{
Core::Stop();
UpdateGUI();
}
}