diff --git a/src/game_tab/editor/LiveEngineDialog.cpp b/src/game_tab/editor/LiveEngineDialog.cpp index 0fc85b0..4f745b4 100644 --- a/src/game_tab/editor/LiveEngineDialog.cpp +++ b/src/game_tab/editor/LiveEngineDialog.cpp @@ -31,6 +31,11 @@ void LiveEngineDialog::InitEngine() { wxString default_value_wxString = conf->Read(optPath + "value"); std::string default_value = default_value_wxString.ToStdString(); engine->setoption(opt_name.ToStdString(), default_value); + if (opt_name.Lower() == "multipv") { + multipv->SetLabel(default_value_wxString); + } else if (opt_name.Lower() == "threads") { + threads->SetLabel(default_value_wxString); + } } while (conf->GetNextGroup(opt_name, index)); } @@ -52,20 +57,36 @@ void LiveEngineDialog::OnClose(wxCloseEvent &e) { } void LiveEngineDialog::SetFEN(std::string fen) { - timer.Stop(); + StopEngine(); engine->position(fen); - uciadapter::Go args; - engine->go(args); - timer.Start(interval); + StartEngine(); } void LiveEngineDialog::TogglePauseEngine(wxCommandEvent &event) { if (timer.IsRunning()) { - timer.Stop(); - engine_pause_button->SetLabel("Continue"); + StopEngine(); + engine_stop_button->SetLabel("Restart"); + depth->Enable(true); } else { + engine_stop_button->SetLabel("Stop"); + depth->Enable(false); + StartEngine(); + } +} + +void LiveEngineDialog::StopEngine() { + if (timer.IsRunning()) { + timer.Stop(); + } + engine->stop(); +}; + +void LiveEngineDialog::StartEngine() { + uciadapter::Go args; + args.depth = depth->GetValue(); + engine->go(args); + if (!timer.IsRunning()) { timer.Start(interval); - engine_pause_button->SetLabel("Pause"); } } diff --git a/src/game_tab/editor/LiveEngineDialog.hpp b/src/game_tab/editor/LiveEngineDialog.hpp index 703abf8..4772e59 100644 --- a/src/game_tab/editor/LiveEngineDialog.hpp +++ b/src/game_tab/editor/LiveEngineDialog.hpp @@ -15,5 +15,7 @@ public: void TogglePauseEngine(wxCommandEvent &event); void OnTimerTick(wxTimerEvent &event); void SetFEN(std::string fen); + void StopEngine(); + void StartEngine(); void OnClose(wxCloseEvent &e); }; \ No newline at end of file diff --git a/src/game_tab/editor/LiveEngineDialogFB.cpp b/src/game_tab/editor/LiveEngineDialogFB.cpp index 11234dd..52624e3 100644 --- a/src/game_tab/editor/LiveEngineDialogFB.cpp +++ b/src/game_tab/editor/LiveEngineDialogFB.cpp @@ -30,12 +30,43 @@ LiveEngineDialogFB::LiveEngineDialogFB( wxWindow* parent, wxWindowID id, const w current_engine_sizer->Add( 0, 0, 1, wxEXPAND, 5 ); - engine_pause_button = new wxButton( this, LIVE_ENGINE_PAUSE_BUTTON, wxT("Pause"), wxDefaultPosition, wxDefaultSize, 0 ); - current_engine_sizer->Add( engine_pause_button, 0, wxALL, 5 ); + engine_stop_button = new wxButton( this, LIVE_ENGINE_PAUSE_BUTTON, wxT("Stop"), wxDefaultPosition, wxDefaultSize, 0 ); + current_engine_sizer->Add( engine_stop_button, 0, wxALL, 5 ); main_sizer->Add( current_engine_sizer, 0, wxEXPAND, 5 ); + wxGridSizer* infos_sizer; + infos_sizer = new wxGridSizer( 0, 6, 0, 0 ); + + multipv_label = new wxStaticText( this, wxID_ANY, wxT("MultiPV:"), wxDefaultPosition, wxDefaultSize, 0 ); + multipv_label->Wrap( -1 ); + infos_sizer->Add( multipv_label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + multipv = new wxStaticText( this, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, 0 ); + multipv->Wrap( -1 ); + infos_sizer->Add( multipv, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + threads_label = new wxStaticText( this, wxID_ANY, wxT("Threads:"), wxDefaultPosition, wxDefaultSize, 0 ); + threads_label->Wrap( -1 ); + infos_sizer->Add( threads_label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + threads = new wxStaticText( this, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, 0 ); + threads->Wrap( -1 ); + infos_sizer->Add( threads, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText13 = new wxStaticText( this, wxID_ANY, wxT("Depth:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText13->Wrap( -1 ); + infos_sizer->Add( m_staticText13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + depth = new wxSpinCtrl( this, wxID_ANY, wxT("30"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 10000, 0 ); + depth->Enable( false ); + + infos_sizer->Add( depth, 0, wxALL, 5 ); + + + main_sizer->Add( infos_sizer, 0, 0, 5 ); + lines_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); main_sizer->Add( lines_list, 1, wxALL|wxEXPAND, 5 ); diff --git a/src/game_tab/editor/LiveEngineDialogFB.h b/src/game_tab/editor/LiveEngineDialogFB.h index 8c9c061..29f0292 100644 --- a/src/game_tab/editor/LiveEngineDialogFB.h +++ b/src/game_tab/editor/LiveEngineDialogFB.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,13 @@ class LiveEngineDialogFB : public wxDialog protected: wxStaticText* current_engine_label; wxStaticText* current_engine; - wxButton* engine_pause_button; + wxButton* engine_stop_button; + wxStaticText* multipv_label; + wxStaticText* multipv; + wxStaticText* threads_label; + wxStaticText* threads; + wxStaticText* m_staticText13; + wxSpinCtrl* depth; wxListCtrl* lines_list; public: diff --git a/tools/wxframebuilder/LiveEngineDialog.fbp b/tools/wxframebuilder/LiveEngineDialog.fbp index 13c549a..c720f11 100644 --- a/tools/wxframebuilder/LiveEngineDialog.fbp +++ b/tools/wxframebuilder/LiveEngineDialog.fbp @@ -65,16 +65,16 @@ 5 wxEXPAND 0 - + current_engine_sizer wxHORIZONTAL none - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -131,11 +131,11 @@ -1 - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -192,21 +192,21 @@ -1 - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALL 0 - + 1 1 1 @@ -240,7 +240,7 @@ 0 0 LIVE_ENGINE_PAUSE_BUTTON - Pause + Stop 0 @@ -250,7 +250,7 @@ 0 1 - engine_pause_button + engine_stop_button 1 @@ -277,6 +277,387 @@ + + 5 + + 0 + + 6 + 0 + + infos_sizer + none + 0 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + MultiPV: + 0 + + 0 + + + 0 + + 1 + multipv_label + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + ? + 0 + + 0 + + + 0 + + 1 + multipv + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Threads: + 0 + + 0 + + + 0 + + 1 + threads_label + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + ? + 0 + + 0 + + + 0 + + 1 + threads + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Depth: + 0 + + 0 + + + 0 + + 1 + m_staticText13 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + 0 + 10000 + + 0 + + 1 + + 0 + + 1 + depth + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + + 30 + + + + + + + 5 wxALL|wxEXPAND