aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MainWindow.cpp6
-rw-r--r--src/MainWindow.hpp1
-rw-r--r--src/game_tab/Game.cpp4
3 files changed, 10 insertions, 1 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 22b579f..83fda6d 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -52,6 +52,7 @@ MainWindow::MainWindow()
Bind(REFRESH_ENGINE_LIST, &MainWindow::OnRefreshEngineList, this, wxID_ANY);
Bind(CLOSE_LINKED_TAB, &MainWindow::OnCloseTabLinkedTo, this, wxID_ANY);
Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSED, &MainWindow::OnAuiNotebookPageClosed, this, wxID_ANY);
+ Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSE, &MainWindow::OnAuiNotebookPageCheck, this, wxID_ANY);
// Add new game tab by default
NewGame(std::shared_ptr<Game>(new Game()));
@@ -62,6 +63,11 @@ MainWindow::MainWindow()
this->AddPage(bt,bt);*/
}
+void MainWindow::OnAuiNotebookPageCheck(wxAuiNotebookEvent& event){
+ // TODO: Ask the user before closing
+ //event.Veto();
+}
+
void MainWindow::AddPage(wxWindow* window, TabInfos* infos){
window->SetClientData(infos);
notebook->AddPage(window, window->GetLabel());
diff --git a/src/MainWindow.hpp b/src/MainWindow.hpp
index 5c3739a..3596b66 100644
--- a/src/MainWindow.hpp
+++ b/src/MainWindow.hpp
@@ -27,6 +27,7 @@ class MainWindow : public MainFrame {
void OnRefreshEngineList(wxCommandEvent &event);
void OnMenuItemClick(wxCommandEvent &event);
void OnAuiNotebookPageClosed(wxAuiNotebookEvent& event);
+ void OnAuiNotebookPageCheck(wxAuiNotebookEvent& event);
void OnCloseTabLinkedTo(wxCommandEvent &event);
void AddPage(wxWindow* window, TabInfos* infos);
public:
diff --git a/src/game_tab/Game.cpp b/src/game_tab/Game.cpp
index 49bb4d8..b831f0f 100644
--- a/src/game_tab/Game.cpp
+++ b/src/game_tab/Game.cpp
@@ -25,11 +25,13 @@ Game::Game(HalfMove *m, std::string initial_fen) : result("*") {
Game::Game(const Game* g){
board=g->board;
initial_fen=g->initial_fen;
+ board = chessarbiter::FENParser::Parse(initial_fen).board;
result=g->result;
tags=g->tags;
+ current=nullptr;
+ moves=nullptr;
if(g->moves != NULL){
moves=new HalfMove(g->moves);
- current=nullptr;
}
}