ochess/src/base_tab/BaseTab.cpp

37 lines
839 B
C++
Raw Normal View History

2022-02-24 11:50:16 +01:00
#include "BaseTab.hpp"
#include <wx/filename.h>
BaseTab::BaseTab(wxFrame *parent)
: BasePanelBF(parent), TabInfos(TabInfos::BASE), base(NULL) {
wxListItem col0;
col0.SetId(0);
col0.SetText(_("White"));
col0.SetWidth(200);
game_list->InsertColumn(0, col0);
wxListItem col1;
col1.SetId(1);
col1.SetText(_("Black"));
col1.SetWidth(200);
game_list->InsertColumn(1, col1);
//LoadFile("/home/loic/test.pgn");
2022-02-24 11:50:16 +01:00
}
void BaseTab::ApplyPreferences() {}
void BaseTab::LoadFile(std::string path) {
wxFileName file(path);
wxString ext = file.GetExt().Lower();
if (ext == "pgn") {
base = new PGNGameBase(path);
}
if (base != NULL) {
while (base->HasNextGame()) {
Game *g = base->GetNextGame();
long itemIndex = game_list->InsertItem(0, g->GetTag("White")); // want this for col. 1
}
2022-02-24 11:50:16 +01:00
}
}