From 4adb5ff056d4a5a35cd7f76a9785c5cab57fdc03 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 25 Feb 2022 09:21:26 +0100 Subject: Improve game base panel --- src/base_tab/BaseTab.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/base_tab/BaseTab.cpp') diff --git a/src/base_tab/BaseTab.cpp b/src/base_tab/BaseTab.cpp index 95a1a8d..82a0db0 100644 --- a/src/base_tab/BaseTab.cpp +++ b/src/base_tab/BaseTab.cpp @@ -1,7 +1,7 @@ #include "BaseTab.hpp" #include -BaseTab::BaseTab(wxFrame *parent) +BaseTab::BaseTab(wxFrame *parent, std::string base_file) : BasePanelBF(parent), TabInfos(TabInfos::BASE), base(NULL) { game_list->InsertColumn(0, L"id", wxLIST_FORMAT_LEFT, 50); @@ -14,11 +14,11 @@ BaseTab::BaseTab(wxFrame *parent) this->Bind(wxEVT_BUTTON, &BaseTab::OnBim, this, wxID_ANY); this->Bind(wxEVT_LIST_ITEM_ACTIVATED, &BaseTab::OnOpenGame, this, wxID_ANY); + current_base->SetLabel(base_file); + LoadFile(base_file); } -void BaseTab::OnBim(wxCommandEvent &event) { - LoadFile("/home/loic/hartwig.pgn"); -} +void BaseTab::OnBim(wxCommandEvent &event) {} void BaseTab::OnOpenGame(wxListEvent &event) { wxLogDebug("Open!"); @@ -39,6 +39,7 @@ void BaseTab::LoadFile(std::string path) { wxString ext = file.GetExt().Lower(); if (ext == "pgn") { base = new PGNGameBase(path); + SetLabel(file.GetName()+ "(PGN)"); } if (base != NULL) { @@ -51,8 +52,12 @@ void BaseTab::LoadFile(std::string path) { game_list->SetItem(index, 3, base->GetTag("Event")); game_list->SetItem(index, 4, base->GetTag("Round")); game_list->SetItem(index, 5, base->GetTag("Result")); - game_list->SetItem(index, 5, base->GetTag("ECO")); + game_list->SetItem(index, 6, base->GetTag("ECO")); id++; } } + + wxCommandEvent event(REFRESH_TAB_TITLE, GetId()); + event.SetEventObject(this); + ProcessEvent(event); } \ No newline at end of file -- cgit v1.2.3