diff options
| author | John Peterson <jpeterson57@gmail.com> | 2009-09-02 21:54:53 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2009-09-02 21:54:53 +0000 |
| commit | bbd56ec92c5243f8942812061b1baa29d809b82b (patch) | |
| tree | 3e1e96a2d27ffabab4533f87ea682c41429eaaae /Source/Core | |
| parent | 97af2f1126ae5c638a83a100c055c30947ed5697 (diff) | |
GUI: Added restart option to File menu
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4173 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 9 | ||||
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.h | 4 | ||||
| -rw-r--r-- | Source/Core/DebuggerWX/Src/CodeWindow.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/Frame.cpp | 25 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/Frame.h | 1 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/FrameTools.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/Globals.h | 1 |
7 files changed, 37 insertions, 10 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 7833017cef..57cfe503b7 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -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; diff --git a/Source/Core/Common/Src/StringUtil.h b/Source/Core/Common/Src/StringUtil.h index 4a2137b090..811b49bdde 100644 --- a/Source/Core/Common/Src/StringUtil.h +++ b/Source/Core/Common/Src/StringUtil.h @@ -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); diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 36635f6cd9..14db556824 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -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); } diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index bc3cbc7b21..3ac0d5f3d5 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -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); } } - +/////////////////////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index f494683f93..032a0891fe 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -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); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index c8dd02c767..d95a649274 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -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")); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 8c64134a54..41269ce0a1 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -90,6 +90,7 @@ enum IDM_CHEATS, IDM_NETPLAY, IDM_INFO, + IDM_RESTART, IDM_CHANGEDISC, IDM_PROPERTIES, IDM_LOAD_WII_MENU, |
