GUI: Added restart option to File menu

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4173 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-09-02 21:54:53 +00:00
parent 97af2f1126
commit bbd56ec92c
7 changed files with 37 additions and 10 deletions

View File

@ -370,10 +370,15 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
return true;
}
#endif
std::string PathToFilename(std::string Path)
{
std::string Name, Ending;
SplitPath(Path, 0, &Name, &Ending);
return Name + Ending;
}
void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename)
{
_CompleteFilename = _Path;

View File

@ -72,8 +72,10 @@ void SplitString(const std::string& str, const std::string& delim, std::vector<s
int ChooseStringFrom(const char* str, const char* * items);
// filehelper
// "C:\Windows\winhelp.exe" to "C:\Windows\", "winhelp", "exe"
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
// "C:\Windows\winhelp.exe" to "winhelp.exe"
std::string PathToFilename(std::string Path);
void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename);
void NormalizeDirSep(std::string* str);

View File

@ -625,13 +625,11 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
wxMenuItem* pVideo = pDebugDialogs->Append(IDM_VIDEOWINDOW, _T("&Video"), wxEmptyString, wxITEM_CHECK);
pVideo->Check(bVideoWindow);
pDebugDialogs->AppendSeparator();
// wxMenuItem* pFontPicker = pDebugDialogs->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL);
wxMenuItem* pFontPicker = pDebugDialogs->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL);
pMenuBar->Append(pDebugDialogs, _T("&Views"));
CreateSymbolsMenu();
//SetMenuBar(pMenuBar);
}

View File

@ -248,6 +248,7 @@ EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
EVT_MENU(IDM_INFO, CFrame::OnShow_InfoWindow)
EVT_MENU(IDM_RESTART, CFrame::OnRestart)
EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc)
EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu)
EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
@ -496,7 +497,25 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
Close(true);
}
void CFrame::OnRestart(wxCommandEvent& WXUNUSED (event))
{
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
wxMessageBox(wxT("Please stop the current game before restarting."), wxT("Notice"), wxOK, this);
return;
}
// Get exe name and restart
#ifdef _WIN32
char Str[MAX_PATH + 1];
DWORD Size = sizeof(Str)/sizeof(char);
DWORD n = GetModuleFileNameA(NULL, Str, Size);
ShellExecuteA(NULL, "open", PathToFilename(*new std::string(Str)).c_str(), UseDebugger ? "" : "-d", NULL, SW_SHOW);
#endif
Close(true);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Events
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -794,10 +813,10 @@ void CFrame::Update()
}
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
wxPanel* CFrame::CreateEmptyPanel()
@ -827,4 +846,4 @@ void CFrame::DoFullscreen(bool _F)
m_Mgr->LoadPerspective(AuiCurrent, true);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -283,6 +283,7 @@ class CFrame : public wxFrame
void OnShow_CheatsWindow(wxCommandEvent& event);
void OnShow_InfoWindow(wxCommandEvent& event);
void OnRestart(wxCommandEvent& event);
void OnLoadWiiMenu(wxCommandEvent& event);
void GameListChanged(wxCommandEvent& event);

View File

@ -119,7 +119,8 @@ void CFrame::CreateMenu()
fileMenu->Append(wxID_REFRESH, _T("&Refresh List"));
fileMenu->AppendSeparator();
fileMenu->Append(IDM_BROWSE, _T("&Browse for ISOs..."));
fileMenu->AppendSeparator();
fileMenu->Append(IDM_RESTART, UseDebugger ? _T("Restart in regular mode") : _T("Restart in debugging mode"));
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt+F4"));
menuBar->Append(fileMenu, _T("&File"));

View File

@ -90,6 +90,7 @@ enum
IDM_CHEATS,
IDM_NETPLAY,
IDM_INFO,
IDM_RESTART,
IDM_CHANGEDISC,
IDM_PROPERTIES,
IDM_LOAD_WII_MENU,