aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-31 10:52:55 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-31 10:52:55 +0100
commit35caa1aa4c7b1e4be7ec1191bd8eddce7b879eb4 (patch)
tree57b09affa4a2a379bf2d8bd529c6caa1b93a10bc /src
parent1618113e61cce568e1efb091a8a600345fcf84ed (diff)
Improve LiveEngineDialog
Diffstat (limited to 'src')
-rw-r--r--src/game_tab/right_panel/LiveEngineDialog.cpp9
-rw-r--r--src/game_tab/right_panel/LiveEngineDialog.hpp1
-rw-r--r--src/gui.cpp30
-rw-r--r--src/gui.h4
4 files changed, 29 insertions, 15 deletions
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 );
+
+ infos_sizer->Add( infos_sizer_row1, 0, wxEXPAND, 5 );
- main_sizer->Add( infos_sizer, 0, 0, 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();