diff --git a/src/game_tab/right_panel/LiveEngineDialog.cpp b/src/game_tab/right_panel/LiveEngineDialog.cpp index d0b1896..4e86c63 100644 --- a/src/game_tab/right_panel/LiveEngineDialog.cpp +++ b/src/game_tab/right_panel/LiveEngineDialog.cpp @@ -46,7 +46,8 @@ void LiveEngineDialog::InitEngine() { 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); + optmultipv=opt_name; + multipv->SetValue(std::stoi(default_value_wxString.ToStdString())); } else if (opt_name.Lower() == "threads") { threads->SetLabel(default_value_wxString); } @@ -55,6 +56,8 @@ void LiveEngineDialog::InitEngine() { CONFIG_CLOSE(conf); } + depth->Enable(false); + multipv->Enable(false); timer.Start(interval); timer.Bind(wxEVT_TIMER, &LiveEngineDialog::OnTimerTick, this); } @@ -84,9 +87,11 @@ void LiveEngineDialog::TogglePauseEngine(wxCommandEvent &event) { StopEngine(); engine_stop_button->SetLabel("Restart"); depth->Enable(true); + multipv->Enable(true); } else { engine_stop_button->SetLabel("Stop"); depth->Enable(false); + multipv->Enable(false); StartEngine(); } } @@ -101,6 +106,8 @@ void LiveEngineDialog::StopEngine() { void LiveEngineDialog::StartEngine() { uciadapter::Go args; args.depth = depth->GetValue(); + if(optmultipv.size()>0) + engine->setoption(optmultipv, std::to_string(multipv->GetValue())); engine->go(args); if (!timer.IsRunning()) { timer.Start(interval); diff --git a/src/game_tab/right_panel/LiveEngineDialog.hpp b/src/game_tab/right_panel/LiveEngineDialog.hpp index 2ba39c1..a74a2d6 100644 --- a/src/game_tab/right_panel/LiveEngineDialog.hpp +++ b/src/game_tab/right_panel/LiveEngineDialog.hpp @@ -16,6 +16,7 @@ class LiveEngineDialog : public DialogLiveEngine { uciadapter::UCI *engine; std::string engine_name; std::string confGroup; + std::string optmultipv; wxTimer timer; /// @brief The following time interval definitely need to be configure in the user settings (set to 1s for now) diff --git a/src/gui.cpp b/src/gui.cpp index 72c3b05..b3d564b 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -74,36 +74,41 @@ DialogLiveEngine::DialogLiveEngine( wxWindow* parent, wxWindowID id, const wxStr main_sizer->Add( current_engine_sizer, 0, wxEXPAND, 5 ); - wxGridSizer* infos_sizer; - infos_sizer = new wxGridSizer( 0, 6, 0, 0 ); + wxBoxSizer* infos_sizer; + infos_sizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* infos_sizer_row1; + infos_sizer_row1 = new wxBoxSizer( wxHORIZONTAL ); 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 ); + infos_sizer_row1->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 ); + multipv = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 1 ); + infos_sizer_row1->Add( multipv, 0, 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 ); + infos_sizer_row1->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 ); + infos_sizer_row1->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 ); + infos_sizer_row1->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 = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 10000, 1 ); depth->Enable( false ); - infos_sizer->Add( depth, 0, wxALL, 5 ); + infos_sizer_row1->Add( depth, 0, wxALL, 5 ); - main_sizer->Add( infos_sizer, 0, 0, 5 ); + infos_sizer->Add( infos_sizer_row1, 0, wxEXPAND, 5 ); + + + main_sizer->Add( infos_sizer, 0, wxEXPAND, 5 ); lines_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); main_sizer->Add( lines_list, 1, wxALL|wxEXPAND, 5 ); @@ -111,6 +116,7 @@ DialogLiveEngine::DialogLiveEngine( wxWindow* parent, wxWindowID id, const wxStr this->SetSizer( main_sizer ); this->Layout(); + main_sizer->Fit( this ); this->Centre( wxBOTH ); } diff --git a/src/gui.h b/src/gui.h index 5bf2341..0b1aef6 100644 --- a/src/gui.h +++ b/src/gui.h @@ -103,7 +103,7 @@ class DialogLiveEngine : public wxDialog wxStaticText* current_engine; wxButton* engine_stop_button; wxStaticText* multipv_label; - wxStaticText* multipv; + wxSpinCtrl* multipv; wxStaticText* threads_label; wxStaticText* threads; wxStaticText* m_staticText13; @@ -112,7 +112,7 @@ class DialogLiveEngine : public wxDialog public: - DialogLiveEngine( wxWindow* parent, wxWindowID id = ID_LIVE_ENGINE_DIALOG, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 464,468 ), long style = wxDEFAULT_DIALOG_STYLE ); + DialogLiveEngine( wxWindow* parent, wxWindowID id = ID_LIVE_ENGINE_DIALOG, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); ~DialogLiveEngine(); diff --git a/tools/wxFrameBuilder.fbp b/tools/wxFrameBuilder.fbp index a161f69..4d69b71 100644 --- a/tools/wxFrameBuilder.fbp +++ b/tools/wxFrameBuilder.fbp @@ -189,7 +189,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -207,7 +207,7 @@ DialogLiveEngine - 464,468 + -1,-1 wxDEFAULT_DIALOG_STYLE ; ; forward_declare @@ -216,7 +216,7 @@ - + main_sizer wxVERTICAL @@ -437,383 +437,392 @@ - + 5 - + wxEXPAND 0 - - 6 - 0 + infos_sizer + wxVERTICAL none - 0 - 0 - + 5 - wxALIGN_CENTER_VERTICAL|wxALL + wxEXPAND 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 - - - + infos_sizer_row1 + wxHORIZONTAL + none + + 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 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 100 + + 0 + + 1 + + 0 + + 1 + multipv + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + ; ; 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 + 1 + 10000 + + 0 + + 1 + + 0 + + 1 + depth + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + + 1 + + + + +