diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-24 12:46:59 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-24 12:46:59 +0100 |
| commit | 2d9730e216976103daea64a8df047d5f0dffd5f7 (patch) | |
| tree | 894454165b388167c077619c0a0388338c828c05 /src/MainWindow.cpp | |
| parent | 273610cb0f848fd99f9b9769f0d60b6e2df590ed (diff) | |
Update tab management system
Diffstat (limited to 'src/MainWindow.cpp')
| -rw-r--r-- | src/MainWindow.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 2243f86..8b6e0fe 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -191,9 +191,9 @@ void MainWindow::NewGame(bool useFen) { } void MainWindow::OnNewGame(wxCommandEvent &event) { - std::shared_ptr<Game> *g = (std::shared_ptr<Game>*)event.GetClientData(); - NewGame(*g); - delete g; + TabInfos *tab = (TabInfos*)event.GetClientData(); + TabInfos *i=NewGame(tab->GetGame()); + i->Link(tab); } void MainWindow::OnPageChange(wxAuiNotebookEvent &event) { @@ -215,8 +215,9 @@ void MainWindow::OnRefreshTabTitle(wxCommandEvent &event) { } } -void MainWindow::NewGame(std::shared_ptr<Game> game) { +TabInfos* MainWindow::NewGame(std::shared_ptr<Game> game) { GameTab *gt = new GameTab((wxFrame *)notebook, game); notebook->AddPage(gt, gt->GetLabel()); notebook->SetSelection(notebook->GetPageIndex(gt)); + return(gt); } |
