aboutsummaryrefslogtreecommitdiff
path: root/src/base_tab/BaseTab.cpp
blob: 9be927437204d04183f2b23b892fd2d752bd3095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#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");
}

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
    }
  }
}