Improve engine managemen

This commit is contained in:
Loic Guegan 2022-02-26 20:34:42 +01:00
parent ca6c1b1e75
commit e601902dd5
11 changed files with 146 additions and 16 deletions

View file

@ -7,6 +7,7 @@
wxDEFINE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent);
wxDEFINE_EVENT(NEW_GAME_EVENT, wxCommandEvent);
wxDEFINE_EVENT(CLOSE_TAB_EVENT, wxCommandEvent);
/// ---------- MainWindow ----------
@ -64,16 +65,24 @@ MainWindow::MainWindow()
Bind(REFRESH_TAB_TITLE, &MainWindow::OnRefreshTabTitle, this, wxID_ANY);
Bind(NEW_GAME_EVENT, &MainWindow::OnNewGame, this, wxID_ANY);
Bind(wxEVT_CLOSE_WINDOW, &MainWindow::OnClose, this);
Bind(CLOSE_TAB_EVENT, &MainWindow::OnCloseTabEvent, this, wxID_ANY);
/*BaseTab *bt = new BaseTab((wxFrame *)notebook,
"/home/loic/hartwig_tests.pgn"); notebook->AddPage(bt, bt->GetLabel());
notebook->SetSelection(notebook->GetPageIndex(bt));*/
/*EngineTab *bt = new EngineTab((wxWindow *)notebook,
"/home/loic/.local/bin/stockfish"); notebook->AddPage(bt, bt->GetLabel());
/*
EngineTab *bt =
new EngineTab((wxWindow *)notebook,
new uciadapter::UCI("/home/loic/.local/bin/stockfish"),
"/home/loic/.local/bin/stockfish");
notebook->AddPage(bt, bt->GetLabel());
notebook->SetSelection(notebook->GetPageIndex(bt));*/
}
void MainWindow::OnCloseTabEvent(wxCommandEvent &event) {
notebook->DeletePage(notebook->GetSelection());
}
void MainWindow::OnNewEngine(wxCommandEvent &event) {
wxFileDialog openFileDialog(this, _("Use engine"), "", "", "Executable|*",
wxFD_OPEN | wxFD_FILE_MUST_EXIST);