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) {
|
2022-02-24 12:09:21 +01:00
|
|
|
|
|
|
|
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) {
|
2022-02-24 12:09:21 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|