diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-13 10:42:57 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-13 10:42:57 +0100 |
| commit | f754a93f9f13fa7f30386caba397b91e127aab2c (patch) | |
| tree | 9b3cd0a464d40657a9ed252f7065403669c8b9de /src/MainWindow.cpp | |
| parent | 7009469e96505ab7c2445e7dea43d6c6d2fcbd08 (diff) | |
Debug MainWindow and add comments
Diffstat (limited to 'src/MainWindow.cpp')
| -rw-r--r-- | src/MainWindow.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 7a8c27f..e379319 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -78,7 +78,7 @@ void MainWindow::OnAuiNotebookPageCheck(wxAuiNotebookEvent& event){ } void MainWindow::AddPage(wxWindow* window, TabInfos* infos){ - window->SetClientData(infos); + window->SetClientData(infos); // Allows to have safer cast in this class notebook->AddPage(window, window->GetLabel()); notebook->SetSelection(notebook->GetPageIndex(window)); // Refresh tab that require knowledge on other tabs @@ -121,10 +121,9 @@ void MainWindow::OnMenuItemClick(wxCommandEvent &event) { for (wxMenuItem *item : items) { if (item->GetId() == id) { wxLogDebug("Selected %s", item->GetItemLabel()); - EngineTab *bt = new EngineTab((wxWindow *)notebook, + EngineTab *et = new EngineTab((wxWindow *)notebook, item->GetItemLabel().ToStdString()); - notebook->AddPage(bt, bt->GetLabel()); - notebook->SetSelection(notebook->GetPageIndex(bt)); + AddPage(et,et); } } } else if (id == 1) { // Settings @@ -185,7 +184,7 @@ void MainWindow::OnRefreshEngineList(wxCommandEvent &event) { } while (conf->GetNextGroup(engine_name, index)); } CONFIG_CLOSE(conf); - ApplyPreferences(); // Propagate motifications + ApplyPreferences(); // Propagate informations to the tabs that require it } void MainWindow::NewEngine() { @@ -257,7 +256,7 @@ void MainWindow::OnPageChange(wxAuiNotebookEvent &event) { } void MainWindow::OnRefreshTabTitle(wxCommandEvent &event) { - GameTab *win = dynamic_cast<GameTab *>(event.GetEventObject()); + GameTab *win = (GameTab*)event.GetEventObject(); int page = notebook->GetPageIndex(win); if (page != wxNOT_FOUND) { notebook->SetPageText(page, win->GetLabel()); |
