// Includo stdio senno' dice che ridefinisco FILE
#include <stdio.h>

#ifndef __STRINGS_H
#include <strings.h>
#endif

#ifndef __FILES_H
#include <files.h>
#endif

#ifndef __MASK_H
#include <mask.h>
#endif

#ifndef __SHEET_H
#include <sheet.h>
#endif

#ifndef __URLDEFID_H
#include <urldefid.h>
#endif

#ifndef __VALIDAT_H
#include <validate.h>
#endif

#ifndef __BA1201_H
#include "ba1201.h"
#endif


/*
long TRec_sheet::items() const
{
return (_items);
}
*/

TRec_sheet::TRec_sheet(const char* title, const char* head) : TSheet(-1,-1,title,head, 0x6)
{
_dir = new TDir;
_rec = new TTrec;

//_items = _rec->num_fields();
_items = 200;
_rec->get(1, _nordir);
}

TRec_sheet::~TRec_sheet()
{
delete _dir;
delete _rec;
}


void TRec_sheet::page_build(long first, byte rows)
{
	TToken_string l;
	TString    dep(256);
  RecDes     *rdes;

_rec->get(1, _nordir);


  for (byte i = 0; i < rows; i++)
  {
	dep << (int)i+1+first; 	// Numero progressivo del file
	l = dep.right_just(3);
	dep = "";
        rdes = _rec->rec();
	l.add((const char*)rdes->Fd[i].Name);
      	l.add((const char*)rdes->Fd[i].TypeF);
        dep << rdes->Fd[i].Name;
      	l.add ( (const char*) dep);
        dep = "";
        dep << rdes->Fd[i].Dec;
        l.add( (const char*) dep);

    	set_row(l, i);
  }
}