isam.h Aggiunta macro megaf..a FOR_EACH_FILE_RECORD

Tolta classe fantasma TTransaction
mask.cpp    Aggiunto riconoscimento ufficiale dei TTree_field
maskfld.cpp Implementazione dei nuovi, nonche' ovviamente
            fichissimi TWindowed_field
maskfld.h   Aggiunti i TWindowed_field e i TTree_field da essi derivati


git-svn-id: svn://10.65.10.50/trunk@6145 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-02-06 16:10:34 +00:00
parent cf5fee43d1
commit 2848710c89
4 changed files with 106 additions and 22 deletions

View File

@ -839,18 +839,11 @@ public:
TRecfield(TRectype& rec, const char* name, int from = 0, int to = -1);
};
/*
#define FOR_EACH_FILE_RECORD(isamfile) \
for (int _e##isamfile = isamfile.first(); \
_e##isamfile == NOERR; \
_e##isamfile = isamfile.next())
class TTransaction
{
public:
// @FPUB
void begin();
void end(bool success = TRUE);
void abort() { end(FALSE);}
};
*/
#ifdef __ISAM_CPP
#define extern

View File

@ -469,7 +469,7 @@ bool TMask::check_fields()
for (int i = 0; i < max; i++)
{
TMask_field& f = fld(i);
const bool on = f.active() || (f.shown() && f.is_kind_of(CLASS_SHEET_FIELD));
const bool on = f.active() || (f.shown() && f.is_sheet());
if (on) // Don't test inactive fields
{
if (f.parent() != curpage)
@ -847,6 +847,7 @@ TMask_field* TMask::parse_field(TScanner& scanner)
if (k == "GO") return new TGolem_field(this);
if (k == "BR") return new TBrowsefile_field(this);
if (k == "SP") return new TSheet_field(this);
if (k == "TR") return new TTree_field(this);
return NULL;
}
@ -926,28 +927,26 @@ WINDOW TMask::read_page(
while (scanner.popkey() != "EN")
{
TMask_field* f = parse_field(scanner);
#ifdef DBG
if (f == NULL)
{
#ifdef DBG
const int f = fields();
TString e("Unknown control at position "); e << f;
if (f > 0) e << ".\nLast good one was " << fld(f-1).dlg() << ": " << fld(f-1).prompt();
yesnofatal_box(e);
TString e;
e << "Campo non riconosciuto alla posizione " << f;
if (f > 0)
e << ".\nL'ultimo riconosciuto e' " << fld(f-1).dlg() << ": " << fld(f-1).prompt();
error_box(e);
#endif
while (scanner.popkey() != "EN");
}
#endif
if (f != NULL)
else
{
const long start = clock();
f->construct(scanner, w);
add_field(f);
_build_time += clock()-start;
}
}
return w;
}

View File

@ -4216,5 +4216,54 @@ const char* TZoom_field::win2raw(const char* data) const
const char* TZoom_field::get_first_line() const
{ return raw2win(_str); }
///////////////////////////////////////////////////////////
// TWindowed field
///////////////////////////////////////////////////////////
void TWindowed_field::enable(bool on)
{
TOperable_field::enable(on);
if (_win)
_win->activate(on);
}
void TWindowed_field::show(bool on)
{
TOperable_field::show(on);
if (_win && _win->is_open() != on)
{
if (on)
_win->open();
else
_win->close();
}
}
void TWindowed_field::parse_head(TScanner& scanner)
{
_ctl_data._width = scanner.integer();
_ctl_data._size = scanner.integer();
}
void TWindowed_field::set_win(TWindow* w)
{
if (_win)
delete _win;
_win = w;
}
void TWindowed_field::create(WINDOW parent)
{
_dlg = _ctl_data._dlg;
_parent = parent;
// Example of what should be done in derived classes
// set_win(new TSpecial_window(_ctl_data._x, _ctl_data._y,
// _ctl_data._width, _ctl_data._size,
// parent, this));
}
TWindowed_field::~TWindowed_field()
{
if (_win)
delete _win;
}

View File

@ -1412,6 +1412,49 @@ public:
virtual ~TGolem_field();
};
class TWindowed_field : public TOperable_field
{
WINDOW _parent;
short _dlg;
TWindow* _win;
protected: // TMask_field
virtual void parse_head(TScanner& scanner);
virtual void create(WINDOW parent);
virtual void enable(bool on = TRUE);
virtual void show(bool on = TRUE);
public: // TMask_field
virtual short dlg() const { return _dlg; }
virtual WINDOW parent() const { return _parent; }
public:
TWindow& win() const { CHECK(_win, "NULL Window in field"); return *_win; }
void set_win(TWindow* w);
TWindowed_field(TMask* m) : TOperable_field(m), _win(NULL) { }
virtual ~TWindowed_field();
};
// Implemented in tree.cpp
class TTree;
class TTree_field : public TWindowed_field
{
protected: // TObject
word class_id() const;
bool is_kind_of(word cid) const;
protected: // TMask_field
virtual void create(WINDOW parent);
public:
TTree* tree() const;
void set_tree(TTree* t);
TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { }
};
#endif // __MASKFLD_H