aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-13 10:52:11 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-13 10:52:11 +0100
commit79cf6b2634eaa3cf3ff67d875847b6934a48a911 (patch)
treec6280f0ee1954ecf5a6d8311062ff68b4a9121e9
parentf754a93f9f13fa7f30386caba397b91e127aab2c (diff)
Debug MainWindow pointers and casts
-rw-r--r--src/MainWindow.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index e379319..21e0a92 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -65,7 +65,7 @@ MainWindow::MainWindow()
void MainWindow::OnAuiNotebookPageCheck(wxAuiNotebookEvent& event){
int selection=event.GetSelection();
- TabInfos *t=dynamic_cast<TabInfos *>(notebook->GetPage(selection));
+ TabInfos *t=(TabInfos*)notebook->GetPage(selection)->GetClientData();
if(t->is_dirty){
wxMessageDialog *dial = new wxMessageDialog(NULL,
wxT("This tab contains data that are not saved. Are you sure you want to close it?"), wxT("Information"),
@@ -215,7 +215,7 @@ void MainWindow::OpenSettings() {
void MainWindow::ApplyPreferences() {
for (int i = 0; i < notebook->GetPageCount(); i++) {
- TabInfos *infos = dynamic_cast<TabInfos *>(notebook->GetPage(i));
+ TabInfos *infos = (TabInfos*)(notebook->GetPage(i))->GetClientData();
infos->ApplyPreferences();
}
}
@@ -245,7 +245,7 @@ void MainWindow::NewGame(bool useFen) {
}
void MainWindow::OnPageChange(wxAuiNotebookEvent &event) {
- TabInfos *infos = dynamic_cast<TabInfos *>(notebook->GetCurrentPage());
+ TabInfos *infos = (TabInfos*)(notebook->GetCurrentPage())->GetClientData();
if (infos->type != TabInfos::GAME) {
for (short i = 10; i < 20; i++) {
if (menu_game->FindChildItem(i) != NULL) {
@@ -256,7 +256,7 @@ void MainWindow::OnPageChange(wxAuiNotebookEvent &event) {
}
void MainWindow::OnRefreshTabTitle(wxCommandEvent &event) {
- GameTab *win = (GameTab*)event.GetEventObject();
+ wxWindow *win = (wxWindow*)event.GetEventObject();
int page = notebook->GetPageIndex(win);
if (page != wxNOT_FOUND) {
notebook->SetPageText(page, win->GetLabel());