#ifndef __BA1101_H
#define __BA1101_H

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

#ifndef __MSKSHEET_H
#include <msksheet.h>
#endif

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

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

#include <urldefid.h>
#include <validate.h>

HIDDEN TString park(80);

///////////////////////////////////////////////////////////
// TDir_sheet  
///////////////////////////////////////////////////////////


class TDir_sheet : public TSheet
{
    TTrec	*_rec;
    TDir	*_dir;
    FileDes	_s_dir;
    long	_items;

protected:	set_firm();

  void page_build(long first, byte rows);

public:
  TDir_sheet(const char* title);
  ~TDir_sheet();
  TDir* dir() const { return _dir; }
  TTrec* rec() const { return _rec; }
  void set_items(long items) { _items = items; }
  void add();
  void rebuild() { _items = _dir->items();}

  long items() const { return (_items);}
};

class TRec_sheet : public TObject
{
    TTrec       *_rec;
    TTrec       *_rec_old;
    TDir        *_dir;
		bool				_comfile;
		static TMask 	*_mask;

protected:
	void update_keys(int from, int shift);
	const char* build_key_expr(int key);
	bool check_key_expr(int key, const char* key_expr);
	void update_key_expr(int key, TToken_string& s);
	const char* build_field(int nfld);
	void update_field(int nfld, TToken_string& s);
	static bool fld_notify(int r, KEY k);
	static bool key_notify(int r, KEY k);
	void save();
  virtual long items() const { return _rec->items(); }
  TDir* dir() const { return _dir; }
  TTrec* rec() const { return _rec; }

public:
  TRec_sheet(int logicnum);
  ~TRec_sheet();
	void edit();

};


#endif