From 998194246ce99dae73c372d4b821c8180ffad5a8 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 14 Aug 2013 18:14:29 -0400 Subject: [PATCH] NetPlay: Disable the "Start" button while the game is running --- Source/Core/DolphinWX/Src/NetWindow.cpp | 12 +++++++++--- Source/Core/DolphinWX/Src/NetWindow.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index 4ba99dc184..ac315025ba 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -283,6 +283,7 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game : wxFrame(parent, wxID_ANY, wxT(NETPLAY_TITLEBAR), wxDefaultPosition, wxDefaultSize) , m_selected_game(game) , m_game_list(game_list) + , m_start_btn(NULL) { wxPanel* const panel = new wxPanel(this); @@ -340,9 +341,10 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game wxBoxSizer* const bottom_szr = new wxBoxSizer(wxHORIZONTAL); if (is_hosting) { - wxButton* const start_btn = new wxButton(panel, wxID_ANY, _("Start")); - start_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlayDiag::OnStart, this); - bottom_szr->Add(start_btn); + m_start_btn = new wxButton(panel, wxID_ANY, _("Start")); + m_start_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlayDiag::OnStart, this); + bottom_szr->Add(m_start_btn); + bottom_szr->Add(new wxStaticText(panel, wxID_ANY, _("Buffer:")), 0, wxLEFT | wxCENTER, 5 ); wxSpinCtrl* const padbuf_spin = new wxSpinCtrl(panel, wxID_ANY, wxT("20") , wxDefaultPosition, wxSize(64, -1), wxSP_ARROW_KEYS, 0, 200, INITIAL_PAD_BUFFER_SIZE); @@ -463,12 +465,16 @@ void NetPlayDiag::OnMsgStartGame() { wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME); GetEventHandler()->AddPendingEvent(evt); + if (m_start_btn) + m_start_btn->Disable(); } void NetPlayDiag::OnMsgStopGame() { wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME); GetEventHandler()->AddPendingEvent(evt); + if (m_start_btn) + m_start_btn->Enable(); } void NetPlayDiag::OnAdjustBuffer(wxCommandEvent& event) diff --git a/Source/Core/DolphinWX/Src/NetWindow.h b/Source/Core/DolphinWX/Src/NetWindow.h index b63ba4d38e..75f9964e9d 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.h +++ b/Source/Core/DolphinWX/Src/NetWindow.h @@ -100,6 +100,7 @@ private: std::string m_selected_game; wxButton* m_game_btn; + wxButton* m_start_btn; std::vector m_playerids;