Modificato TApplication* MainApp() in TApplication& main_app()

Modificato TLocalisamfile* TRelation::lfile() in TLocalisamfile& lfile()


git-svn-id: svn://10.65.10.50/trunk@272 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-09-21 11:16:39 +00:00
parent 437810f41a
commit c71c0a1884
13 changed files with 10709 additions and 10708 deletions

View File

@ -90,7 +90,7 @@ public:
TBanner::TBanner()
{
create(-1, -1, 78, 6, "BANNER", WSF_NONE, W_PLAIN);
create(-1, 2, 68, 7, "BANNER", WSF_NONE, W_PLAIN);
hide_brush();
open_modal();
do_events();
@ -240,17 +240,10 @@ long TApplication::handler(WINDOW, EVENT* ep)
if (!ok)
stop_run();
}
break;
case E_CHAR:
{
#ifdef DBG
KEY k = e_char_to_key(ep);
#endif
}
break;
case E_COMMAND:
{
MENU_TAG mt = ep->v.cmd.tag;
const MENU_TAG mt = ep->v.cmd.tag;
switch(mt)
{
case M_FILE_QUIT:
@ -432,7 +425,7 @@ void TApplication::about() const
{
#include <prassi.ver>
const TFilename n(__argv[0]);
message_box("PRASSI Versione Beta 1.%g\nProgramma %s\nLibreria del %s",
message_box("PRASSI Versione SMAU 1.%g\nProgramma %s\nLibreria del %s",
VERSION, (const char*)n.name(), __DATE__);
}

View File

@ -69,7 +69,7 @@ int TExternal_app::run(bool async)
_exitcode = 0;
}
else
error_box("Impossibile eseguire %s: errore %d", (const char*)_path, _exitcode);
error_box("Impossibile eseguire '%s':\nErrore %d", (const char*)_path, _exitcode);
set_cursor(TASK_WIN, CURSOR_ARROW);
#else

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.20 1994-09-20 12:24:49 guy Exp $
// $Id: maskfld.cpp,v 1.21 1994-09-21 11:16:20 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -1276,7 +1276,7 @@ bool TBrowse::do_insert()
app = format("ba3 -0 %s", (const char*)nm.mid(4));
// Obbligatorio usare la format globale
else // Programma generico di browse/edit
app = format("ba3 -3 %s %d", (const char*)nm, _cursor->file()->num());
app = format("ba3 -3 %s %d", (const char*)nm, _cursor->file().num());
// Obbligatorio usare la format globale
}
else
@ -1302,7 +1302,7 @@ bool TBrowse::do_insert()
if (rcv != NULL) _rec = atoi(rcv->body());
if (_rec > 0)
{
_cursor->file()->readat(_rec);
_cursor->file().readat(_rec);
ok = _cursor->ok();
if (ok) do_output();
#ifdef DBG
@ -1340,7 +1340,7 @@ TToken_string& TBrowse::create_siblings(TToken_string& siblings)
const TCursor* c = b->cursor();
// Considera ricerche sullo stesso file ma con chiave diversa
if (c && c->file()->num() == _cursor->file()->num() &&
if (c && c->file().num() == _cursor->file().num() &&
key[c->key()] == FALSE)
{
const TString16 fn(_out_fn.get(n)); // Legge nome del campo su file
@ -1425,7 +1425,7 @@ bool TBrowse::check(CheckTime t)
if (ne || chk == CHECK_REQUIRED)
{
_cursor->setkey();
_cursor->file()->read(_isequal);
_cursor->file().read(_isequal);
passed = _cursor->ok();
if (t != FINAL_CHECK)

View File

@ -1 +1 @@
#define VERSION 1.3
#define VERSION 1.4

View File

@ -1,4 +1,4 @@
// $Id: printapp.cpp,v 1.10 1994-09-16 09:36:17 alex Exp $
// $Id: printapp.cpp,v 1.11 1994-09-21 11:16:25 guy Exp $
#include <ctype.h>
#include <stdarg.h>
@ -213,18 +213,35 @@ void TPrint_application::add_file (int file, int from)
static char tb[120];
int TPrint_application::find_link(const char* descr) const
{
const TArray& arr = main_app().printer().links();
for (int i = 0; i < arr.items(); i++)
{
TToken_string& tt = (TToken_string&)arr[i];
const TFixed_string d(tt.get(0));
if (d == descr)
return i;
}
return -1;
}
int TPrint_application::enable_link(const char *descr, char fg, char bg)
{
int lnk = find_link(descr);
if (lnk < 0)
{
TToken_string *tt = new TToken_string(30);
char b[2];
b[1] = '\0';
char b[2] = { '\0', '\0' };
tt->add(descr);
b[0] = fg;
tt->add(b);
b[0] = bg;
tt->add(b);
printer().links ().add (tt);
return printer().links ().items () - 1;
lnk = printer().links().add(tt);
}
return lnk;
}
void TPrint_application::disable_link (char fg, char bg)
@ -232,12 +249,11 @@ void TPrint_application::disable_link (char fg, char bg)
for (int i = 0; i < printer().links().items (); i++)
{
TToken_string & t = (TToken_string&)printer().links()[i];
char f = *(t.get (1));
char b = *(t.get (2));
const char f = *(t.get(1));
const char b = *(t.get());
if (f == fg && b == bg)
{
printer().links ().add (NULL, i);
printer().links ().pack ();
printer().links().remove(i, TRUE);
break;
}
}
@ -250,36 +266,33 @@ void TPrint_application::set_multiple_link (bool on)
void TPrint_application::_pp_link (int id, const char *text)
{
TPrint_application *prapp = (TPrint_application *) MainApp ();
prapp->process_link (id, text);
TPrint_application& prapp = (TPrint_application&)main_app();
prapp.process_link(id, text);
}
void TPrint_application::_pp_header (TPrinter &)
{
TPrint_application *prapp = (TPrint_application *) MainApp ();
prapp->preprocess_header ();
prapp->printer().resetheader ();
int ii = (prapp->_header).last ();
TPrint_application& prapp = (TPrint_application&)main_app();
prapp.preprocess_header();
prapp.printer().resetheader();
const int ii = prapp._header.last();
// reset and add header/footer lines
for (int i = 0; i <= ii; i++)
if ((prapp->_header).objptr (i) != NULL)
prapp->printer().setheaderline (i,
new TPrintrow ((TPrintrow &) (prapp->_header)[i]));
if (prapp._header.objptr(i) != NULL)
prapp.printer().setheaderline (i, new TPrintrow((TPrintrow &)prapp._header[i]));
}
void TPrint_application::_pp_footer (TPrinter &)
{
TPrint_application *prapp = (TPrint_application *) MainApp ();
TPrint_application& prapp = (TPrint_application&)main_app();
prapp->preprocess_footer ();
prapp->printer().resetfooter ();
int ii = (prapp->_footer).last ();
prapp.preprocess_footer ();
prapp.printer().resetfooter ();
int ii = prapp._footer.last();
for (int i = 0; i <= ii; i++)
if ((prapp->_footer).objptr (i) != NULL)
prapp->printer().setfooterline (i,
new TPrintrow ((TPrintrow &) (prapp->_footer)[i]));
if (prapp._footer.objptr(i) != NULL)
prapp.printer().setfooterline (i,
new TPrintrow ((TPrintrow &) (prapp._footer)[i]));
}
void TPrint_application::set_background (const char *bgdesc)
@ -978,7 +991,7 @@ bool TPrint_application::print_one (int file)
to = atoi ((const char *) ttt.get ());
}
// get field val
TLocalisamfile *f = _cur->file (ln);
TLocalisamfile &f = _cur->file(ln);
if (ft->_flags & TRANS_FLAG)
{
_Transfield *tr = NULL;
@ -989,7 +1002,7 @@ bool TPrint_application::print_one (int file)
if (tr->_fn == fn && tr->_lognum == ln)
{
// check value
if (tr->_from == f->get (fn))
if (tr->_from == f.get (fn))
break;
}
}
@ -1000,7 +1013,7 @@ bool TPrint_application::print_one (int file)
}
else if (ft->_flags & DATE_FLAG)
{
TDate d = (f->curr ()).get_date (fn);
const TDate d(f.get(fn));
toprint = d.string (ft->_flags & LONG_FLAG ? 4 : 2);
if (toprint.empty ())
{
@ -1011,14 +1024,14 @@ bool TPrint_application::print_one (int file)
}
else if (ft->_flags & BOOLEAN_FLAG)
{
toprint = (f->curr ()).get (fn) == "X" ? "Si" : "No";
toprint = f.get(fn) == "X" ? "Si" : "No";
}
else if (ft->_flags & NUMBER_FLAG)
{
TString pict (0);
real r = f->curr ().get (fn);
real r(f.get (fn));
bool isreal = f->curr ().type (fn) == _realfld;
bool isreal = f.curr ().type (fn) == _realfld;
if (ft->_flags & PICTURE_FLAG)
pict = pic;
@ -1038,7 +1051,7 @@ bool TPrint_application::print_one (int file)
}
else if (ft->_flags & STRING_FLAG)
{
toprint = f->curr ().get (fn);
toprint = f.curr().get (fn);
// perform string extraction
if (from != -1)
toprint = toprint.sub (from, to);

View File

@ -337,15 +337,15 @@ public:
// indicatori di legame ipertestuale, si faccia enable_link
// nella create. L' ID ritornato viene passato a process_link
// assieme al testo selezionato
int find_link(const char* descr) const;
int enable_link (const char* descr, char fg, char bg = 'w');
void disable_link(char fg, char bg = 'w');
void disable_links() { printer().links().destroy(); }
// se si setta multiple a TRUE anziche' la descrizione del testo selezionato
// viene passata a enable_link una tokenstring con tutte i 'bottoni' dello
// viene passata a enable_link una tokenstring con tutti i 'bottoni' dello
// stesso colore presenti sulla riga
void set_multiple_link(bool on);
// BACKGROUND PAINTING! Chefigata! poi vi spiego....
void set_background(const char* bgdesc = NULL);

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.9 1994-09-15 16:45:33 guy Exp $
// $Id: relapp.cpp,v 1.10 1994-09-21 11:16:28 guy Exp $
#include <mailbox.h>
#include <sheet.h>
#include <urldefid.h>
@ -121,12 +121,12 @@ void TRelation_application::set_limits(byte what)
if (what & 0x1)
{
*cur = 0;
_first = cur->file()->recno();
_first = cur->file().recno();
}
if (what & 0x2)
{
*cur = cur->items() - 1;
_last = cur->file()->recno();
_last = cur->file().recno();
}
}
return;
@ -246,10 +246,10 @@ void TRelation_application::set_toolbar(bool all)
if (enabdel)
{
TRelation& r = *get_relation();
const TRecnotype oldpos = r.lfile()->recno();
const TRecnotype oldpos = r.lfile().recno();
enabdel = !protected_record(r.curr());
if (r.lfile()->recno() != oldpos)
r.lfile()->readat(oldpos);
if (r.lfile().recno() != oldpos)
r.lfile().readat(oldpos);
}
_mask->fld(pos).enable(enabdel);
}
@ -547,7 +547,7 @@ bool TRelation_application::save(bool check_dirty)
if (mode == MODE_MOD)
{
get_relation()->restore_status();
get_relation()->lfile()->reread(_unlock); // Unlock main file
get_relation()->lfile().reread(_unlock); // Unlock main file
}
return TRUE;
}
@ -562,7 +562,7 @@ bool TRelation_application::save(bool check_dirty)
if (k == K_NO)
{
get_relation()->restore_status();
get_relation()->lfile()->reread(_unlock); // Unlock main file
get_relation()->lfile().reread(_unlock); // Unlock main file
was_dirty = FALSE;
return TRUE;
}

View File

@ -44,7 +44,7 @@ class TRelation_application : public TApplication
TMask_field* get_search_field() const;
protected:
TLocalisamfile& file() const { return *get_relation()->lfile(); }
TLocalisamfile& file() const { return get_relation()->lfile(); }
void set_fixed(); // Fissa i campi non modificabili
bool search_mode(); // Attiva la maschera di ricerca
void query_mode(bool pre_ins = FALSE); // Entra in modo ricerca

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.8 1994-09-20 12:24:54 guy Exp $
// $Id: relation.cpp,v 1.9 1994-09-21 11:16:30 guy Exp $
// relation.cpp
// fv 12/8/93
// relation class for isam files
@ -6,14 +6,13 @@
#include <ctype.h>
#include <stdlib.h>
#include <config.h>
#include <expr.h>
#include <extcdecl.h>
#include <relation.h>
#include <tabutil.h>
#include <utility.h>
#include <xvtility.h>
#include <config.h>
#include <lffiles.h>
// *** check if not already defined
#define NOTFOUND (-1)
@ -39,8 +38,8 @@ class TRelationdef : public TObject
TArray _fields; // Campi di join
TArray _exprs; // Condizioni di uguaglianza
TBit_array _forced;
bool _first_match; // primo match (ed esiste)
bool _allow_lock; // ?????
bool _first_match : 1; // primo match (ed esiste)
bool _allow_lock : 1; // ?????
bool _write_enable;
protected:
@ -52,7 +51,7 @@ public:
int link() const { return _numto; }
byte alias() const { return _alias; }
bool& write_enable() { return _write_enable; }
TRectype& load_rec(TRectype& r, const TBaseisamfile* from) const;
TRectype& load_rec(TRectype& r, const TBaseisamfile& from) const;
TRelationdef(const TRelation* rel, int file, byte key,
int linkto, const char* relexprs, byte alias,
@ -62,13 +61,13 @@ public:
// @END
HIDDEN ostream& print_name(ostream& out, const TLocalisamfile* f)
HIDDEN ostream& print_name(ostream& out, const TLocalisamfile& f)
{
const int logicnum = f->num();
const int logicnum = f.num();
if (logicnum == LF_TABCOM || logicnum == LF_TAB)
{
if (logicnum == LF_TABCOM) out << '%';
out << ((TTable*)f)->name();
out << ((TTable&)f).name();
}
else
out << logicnum;
@ -101,10 +100,10 @@ TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
TString80 n(s);
const int p = n.find('[');
if (p > 0) n.cut(p);
if (rel->file(_num)->curr().exist(n) == FALSE)
if (rel->file(_num).curr().exist(n) == FALSE)
{
error_box("'%s' non e' un campo del file %d",
(const char*)n, rel->file(_num)->num());
(const char*)n, rel->file(_num).num());
continue;
}
#endif
@ -130,7 +129,7 @@ void TRelationdef::print_on(ostream& out) const
if (_numto > 0)
{
out << " TO ";
const int alias = _rel->reldef(_numto-1)->alias();
const int alias = _rel->reldef(_numto-1).alias();
if (alias > 0) out << alias << '@';
else print_name(out, _rel->file(_numto));
}
@ -171,11 +170,11 @@ TRelation::~TRelation()
void TRelation::print_on(ostream& out) const
{
const TLocalisamfile* f = file();
const TLocalisamfile& f = file();
out << "USE "; print_name(out, f);
const int k = f->getkey();
const int k = f.getkey();
if (k > 1) out << " KEY " << k;
out << endl;
@ -190,14 +189,14 @@ void TRelation::restore_status()
{
int err = _status.get_int();
int recno = _status.get_int();
if (recno >= 0l) file(i)->readat(recno);
else file(i)->curr().zero();
file(i)->setstatus(err);
if (recno >= 0l) file(i).readat(recno);
else file(i).curr().zero();
file(i).setstatus(err);
}
for (i = 0; i < _reldefs.items(); i++)
{
bool first_match = _status.get_int ();
reldef(i)->_first_match = first_match;
reldef(i)._first_match = first_match;
}
}
@ -206,14 +205,14 @@ void TRelation::save_status()
_status.cut(0);
for (int i = 0; i < _files.items(); i++)
{
int err = file(i)->status();
TRecnotype recno = file(i)->eof() ? -1l : file(i)->recno();
_status.add (format ("%d",err));
_status.add (format ("%d",recno));
const int err = file(i).status();
const TRecnotype recno = file(i).eof() ? -1l : file(i).recno();
_status.add (err);
_status.add (recno);
}
for (i = 0; i < _reldefs.items(); i++)
{
bool first_match = reldef(i)->_first_match;
const bool first_match = reldef(i)._first_match;
_status.add(format("%d",first_match));
}
}
@ -230,7 +229,7 @@ int TRelation::log2ind(int log) const
if (log > 0)
{
for (int i = 0; i < num; i++)
if (file(i)->num() == log) return i;
if (file(i).num() == log) return i;
}
return num ? 0 : NOTFOUND;
}
@ -255,18 +254,18 @@ int TRelation::name2ind(const char* name) const
return ind;
}
TLocalisamfile* TRelation::lfile(int logicnum) const
TLocalisamfile& TRelation::lfile(int logicnum) const
{
const int idx = log2ind(logicnum);
CHECKD(idx != NOTFOUND, "File not found n. ", logicnum);
return (TLocalisamfile*)_files.objptr(idx);
return (TLocalisamfile&)_files[idx];
}
TLocalisamfile* TRelation::lfile(const char* name) const
TLocalisamfile& TRelation::lfile(const char* name) const
{
const int idx = name2ind(name);
CHECKS(idx != NOTFOUND, "File or Table not found:", name);
return (TLocalisamfile*)_files.objptr(idx);
return (TLocalisamfile&)_files[idx];
}
void TRelation::write_enable(int logicnum, const bool on)
@ -275,13 +274,13 @@ void TRelation::write_enable(int logicnum, const bool on)
if (logicnum == - 1)
{
for (int i = 0; i < _reldefs.items(); i++)
reldef(i)->write_enable() = on;
reldef(i).write_enable() = on;
}
else
{
const int idx = log2ind(logicnum);
CHECKD(idx != NOTFOUND, "File not found n. ", logicnum);
reldef(idx)->write_enable() = on;
reldef(idx).write_enable() = on;
}
}
@ -290,7 +289,7 @@ void TRelation::write_enable(const char* name, const bool on)
{
const int idx = name2ind(name);
CHECKS(idx != NOTFOUND, "File or Table not found:", name);
reldef(idx)->write_enable() = on;
reldef(idx).write_enable() = on;
}
bool TRelation::add(int logicnum, const char* relexprs, int key,
@ -336,17 +335,17 @@ bool TRelation::add(const char* tabname, const char* relexprs, int key,
return _errors;
}
TRectype& TRelationdef::load_rec(TRectype& r, const TBaseisamfile* from) const
TRectype& TRelationdef::load_rec(TRectype& r, const TBaseisamfile& from) const
{
r.zero();
for (int j = 0 ; j < _fields.items(); j++) // for each field
{
// TString& s = (TString&) _fields[j];
// r.put(s, from->get(s));
// r.put(s, from.get(s));
TFieldref& s = (TFieldref&) _fields[j];
s.write(s.read(from->curr()),r);
// r.put(s.name(), s.read(from->curr()));
s.write(s.read(from.curr()),r);
// r.put(s.name(), s.read(from.curr()));
}
return r;
@ -356,7 +355,7 @@ TRectype& TRelationdef::load_rec(TRectype& r, const TBaseisamfile* from) const
void TRelation::zero()
{
for (int i = 0; i < _files.items(); i++)
file(i)->zero();
file(i).zero();
}
int TRelation::position_rels(TIsamop op, TReclock lockop,
@ -367,16 +366,16 @@ int TRelation::position_rels(TIsamop op, TReclock lockop,
// workhorse: position files for each active relation
for (int i = first; i < _reldefs.items(); i++)
{
TRelationdef& rd = *reldef(i);
TLocalisamfile* from = file(rd.num());
TLocalisamfile* to = file(rd.link());
TRelationdef& rd = reldef(i);
TLocalisamfile& from = file(rd.num());
TLocalisamfile& to = file(rd.link());
TReclock lck = rd._allow_lock ? lockop : _nolock;
if (to->curr().empty())
{ from->zero(); continue; }
if (to.curr().empty())
{ from.zero(); continue; }
from->setkey(rd._key);
from->curr().zero();
from.setkey(rd._key);
from.curr().zero();
// build record
if (rd._fields.items() && rd._exprs.items())
@ -387,23 +386,23 @@ int TRelation::position_rels(TIsamop op, TReclock lockop,
// setvar for every variable
for (int k = 0; k < expr.numvar(); k++)
expr.setvar(k, to->get(expr.varname(k)));
expr.setvar(k, to.get(expr.varname(k)));
// eval expression and put result in field
TFieldref& s = (TFieldref&) rd._fields[j];
s.write(expr, from->curr());
s.write(expr, from.curr());
// TString& s = (TString&) rd._fields[j];
// from->put(s, (const char*)expr);
// from.put(s, (const char*)expr);
} // for each field
}
// read record: if not found, empty current record
TRectype rec(from->curr());
from->read(op, lck, atdate);
if (from->bad())
TRectype rec(from.curr());
from.read(op, lck, atdate);
if (from.bad())
{
rd._first_match = (from->curr() == rec);
rd._first_match = (from.curr() == rec);
if (rd._first_match)
{
bool eq = TRUE;
@ -413,23 +412,23 @@ int TRelation::position_rels(TIsamop op, TReclock lockop,
if (rd._forced[kk])
{
// TString& fl = (TString&)rd._fields[kk];
// const TString f_fr(from->curr().get(fl));
// const TString f_fr(from.curr().get(fl));
TFieldref& fl = (TFieldref&)rd._fields[kk];
const TString f_fr(fl.read(from->curr()));
const TString f_fr(fl.read(from.curr()));
// const TFixed_string f_to(to->curr().get(fl));
// const TFixed_string f_to(to.curr().get(fl));
// eq = (f_fr == f_to);
TExpression& expr = (TExpression&)rd._exprs[kk];
for (int k = 0; k < expr.numvar(); k++)
expr.setvar(k, to->get(expr.varname(k)));
expr.setvar(k, to.get(expr.varname(k)));
eq = (f_fr == (const char*)expr);
}
}
if (eq) from->setstatus(NOERR);
else { rd._first_match = FALSE; from->curr().zero(); }
if (eq) from.setstatus(NOERR);
else { rd._first_match = FALSE; from.curr().zero(); }
}
else from->curr().zero();
else from.curr().zero();
}
else rd._first_match = TRUE;
} // for each relation
@ -438,71 +437,71 @@ int TRelation::position_rels(TIsamop op, TReclock lockop,
bool TRelation::next_match(int logicnum, const char* fieldlist, int nkey)
{
if (logicnum == file()->num())
if (logicnum == file().num())
{
next();
return file()->good();
return file().good();
}
const int i = log2ind(logicnum);
CHECKD(i != NOTFOUND,"Nonexistent file referenced in relation ",logicnum);
for (int j = 0; j < _reldefs.items(); j++)
if (reldef(j)->num() == i) break;
if (reldef(j).num() == i) break;
TLocalisamfile* from = file(i);
TLocalisamfile* to = file(reldef(j)->link());
TLocalisamfile& from = file(i);
TLocalisamfile& to = file(reldef(j).link());
reldef(j)->_first_match = FALSE;
reldef(j)._first_match = FALSE;
if (from->bad())
if (from.bad())
return FALSE; // && vaffanculo()
const TRecnotype last = from->recno();
const TRecnotype last = from.recno();
bool ok = TRUE; // Corrispondenza trovata ?
if (fieldlist == NULL)
{
TRectype rec(from->curr());
reldef(j)->load_rec(rec, from);
from->setkey(reldef(j)->_key);
from->next();
TRectype rec(from.curr());
reldef(j).load_rec(rec, from);
from.setkey(reldef(j)._key);
from.next();
ok = (from->good() && from->curr() == rec);
for (int kk = 0; ok && kk < reldef(j)->_fields.items(); kk++)
ok = (from.good() && from.curr() == rec);
for (int kk = 0; ok && kk < reldef(j)._fields.items(); kk++)
{
if (reldef(j)->_forced[kk])
if (reldef(j)._forced[kk])
{
// TString& fl = (TString&)reldef(j)->_fields[kk];
// const TFixed_string f_fr(from->curr().get(fl));
// const TFixed_string f_to(to->curr().get(fl));
TFieldref& fl = (TFieldref&)reldef(j)->_fields[kk];
const TFixed_string f_fr(fl.read(from->curr()));
const TFixed_string f_to(fl.read(to->curr()));
// TString& fl = (TString&)reldef(j)._fields[kk];
// const TFixed_string f_fr(from.curr().get(fl));
// const TFixed_string f_to(to.curr().get(fl));
TFieldref& fl = (TFieldref&)reldef(j)._fields[kk];
const TFixed_string f_fr(fl.read(from.curr()));
const TFixed_string f_to(fl.read(to.curr()));
ok = (f_fr == f_to);
}
}
if (ok) from->setstatus(NOERR);
if (ok) from.setstatus(NOERR);
}
else
{
if (nkey > 0)
from->setkey(nkey);
from.setkey(nkey);
TToken_string fields(fieldlist);
TToken_string old(80);
for (const char* f = fields.get(0); f; f = fields.get())
old.add(from->curr().get(f));
old.add(from.curr().get(f));
from->next();
from.next();
old.restart();
for (f = fields.get(0); f && ok; f = fields.get())
{
const TFixed_string v(from->curr().get(f));
const TFixed_string v(from.curr().get(f));
const char* o = old.get();
if (v != o)
ok = FALSE;
@ -511,13 +510,13 @@ bool TRelation::next_match(int logicnum, const char* fieldlist, int nkey)
if (!ok)
{
from->readat(last);
from.readat(last);
return FALSE;
}
// Riposiziona gli eventuali files successivi
position_rels(_isequal, _nolock, (TDate&)botime, j+1);
reldef(j)->_first_match = FALSE;
reldef(j)._first_match = FALSE;
return ok;
}
@ -530,8 +529,8 @@ bool TRelation::is_first_match(int logicnum)
CHECKD(i != NOTFOUND,"Nonexistent file referenced in relation ",logicnum);
for (int j = 0; j < _reldefs.items(); j++)
if (reldef(j)->num() == i) return reldef(j)->_first_match;
const int err = file()->status();
if (reldef(j).num() == i) return reldef(j)._first_match;
const int err = file().status();
return err == NOERR;
}
@ -547,8 +546,8 @@ bool TRelation::isconsistent(bool reset)
for (int i = 0; i < _files.items() && i < MAXREL; i++)
{
// must be file OK, non-empty record
bad |= file(i)->good() || file(i)->curr().empty();
recnos[i] = file(i)->recno();
bad |= file(i).good() || file(i).curr().empty();
recnos[i] = file(i).recno();
}
// if the above hold, check consistency
@ -557,7 +556,7 @@ bool TRelation::isconsistent(bool reset)
position_rels(_isequal, _nolock, (TDate&)botime);
for (i = 0; i < _files.items(); i++)
if (file(i)->recno() != recnos[i])
if (file(i).recno() != recnos[i])
{
bad = -1;
break;
@ -566,9 +565,9 @@ bool TRelation::isconsistent(bool reset)
if (reset == FALSE)
// leave as before
for(i = 0; i < _files.items(); i++)
file(i)->readat(recnos[i]);
file(i).readat(recnos[i]);
return this->_errors = bad;
return _errors = bad;
}
#endif
@ -578,25 +577,25 @@ int TRelation::write(bool force, TDate& atdate)
{
_errors = NOERR;
if (file(0)->curr().empty())
if (file(0).curr().empty())
return _errors; // *** no error returned **
// programmer must be aware
if ((_errors = file(0)->write(atdate)) != NOERR)
if ((_errors = file(0).write(atdate)) != NOERR)
return _errors;
for (int i = 0; i < _reldefs.items(); i++)
{
TRelationdef& rd = *reldef(i);
TRelationdef& rd = reldef(i);
const int log = rd.num();
if (!rd.write_enable() ||
(file(log)->curr()).empty()) continue;
(file(log).curr()).empty()) continue;
int res = file(log)->write(atdate);
int res = file(log).write(atdate);
if (force && res == _isreinsert)
res = file(log)->rewrite(atdate);
res = file(log).rewrite(atdate);
if (_errors == NOERR) _errors = res;
}
return _errors;
@ -604,21 +603,21 @@ int TRelation::write(bool force, TDate& atdate)
int TRelation::rewrite(bool force, TDate& atdate)
{
_errors = file(0)->rewrite(atdate); // Riscrive testata
_errors = file(0).rewrite(atdate); // Riscrive testata
if (force && _errors == _iskeynotfound) // Se non la trova ...
_errors = file(0)->write(atdate); // ... forza la scrittura
_errors = file(0).write(atdate); // ... forza la scrittura
for (int i = 0; i < _reldefs.items(); i++)
{
TRelationdef& rd = *reldef(i);
TRelationdef& rd = reldef(i);
const int log = rd.num();
if (!rd.write_enable() ||
(file(log)->curr()).empty()) continue;
(file(log).curr()).empty()) continue;
int res = file(log)->rewrite(atdate);
int res = file(log).rewrite(atdate);
if (force && res == _iskeynotfound)
res = file(log)->write(atdate);
res = file(log).write(atdate);
if (_errors == NOERR) _errors = res;
}
@ -627,17 +626,17 @@ int TRelation::rewrite(bool force, TDate& atdate)
int TRelation::remove(TDate& atdate)
{
const int res = file(0)->remove(atdate);
const int res = file(0).remove(atdate);
if (_errors == NOERR && res != _iskeynotfound) _errors = res;
for (int i = 0; i < _reldefs.items(); i++)
{
TRelationdef& rd = *reldef(i);
TRelationdef& rd = reldef(i);
const int log = rd.num();
if (!rd.write_enable() ||
(file(log)->curr()).empty()) continue;
(file(log).curr()).empty()) continue;
const int res = file(log)->remove(atdate);
const int res = file(log).remove(atdate);
if (_errors == NOERR && res != _iskeynotfound) _errors = res;
}
return _errors;
@ -678,7 +677,7 @@ FILE* TCursor::open_index(bool create) const
FILE* f = fopen(_indexname, create ? w : r);
if (f == NULL)
fatal_box("Can't use cursor index for file %d\n", file()->filehnd()->ln);
fatal_box("Can't use cursor index for file %d\n", file().filehnd()->ln);
return f;
}
@ -690,34 +689,34 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
int junk, l, pagecnt = 0;
Page p;
int pos;
const int kl = file()->filehnd()->i.Base[file()->filehnd()->i.PN].KeyLen;
const int kl = file().filehnd()->i.Base[file().filehnd()->i.PN].KeyLen;
const bool filtered = has_filter();
if (file()->filehnd()->i.Base[file()->filehnd()->i.PN].PEOD == 0)
if (file().filehnd()->i.Base[file().filehnd()->i.PN].PEOD == 0)
return 0;
FILE* _f = open_index(TRUE);
fseek(_f, 0L, SEEK_SET);
l = strlen(to());
BTrRead(&file()->filehnd()->i, (char*)(const char*) from(), s, &junkl, &junk);
BTrRead(&file().filehnd()->i, (char*)(const char*) from(), s, &junkl, &junk);
if (junk == _iseof) return 0;
TRecnotype* page = new TRecnotype [CMAXELPAGE];
if (GetAPage(&file()->filehnd()->i, &p, file()->filehnd()->i.CurPag, &junk) != NOERR)
fatal_box("Can't read index n. %d - file n. %d", file()->filehnd()->i.PN + 1, file()->filehnd()->ln);
if (GetAPage(&file().filehnd()->i, &p, file().filehnd()->i.CurPag, &junk) != NOERR)
fatal_box("Can't read index n. %d - file n. %d", file().filehnd()->i.PN + 1, file().filehnd()->ln);
pos = file()->filehnd()->i.Pos - 1;
pos = file().filehnd()->i.Pos - 1;
_pos = -1;
while (TRUE)
{
if (pos >= p.PA.PageHeader.NKey)
{
if (p.PA.PageHeader.Next == -1L) break;
file()->filehnd()->i.CurPag = p.PA.PageHeader.Next;
if (GetAPage(&file()->filehnd()->i, &p, file()->filehnd()->i.CurPag, &junk) != NOERR)
fatal_box("Can't read index n. %d - file n. %d", file()->filehnd()->i.PN + 1, file()->filehnd()->ln);
file().filehnd()->i.CurPag = p.PA.PageHeader.Next;
if (GetAPage(&file().filehnd()->i, &p, file().filehnd()->i.CurPag, &junk) != NOERR)
fatal_box("Can't read index n. %d - file n. %d", file().filehnd()->i.PN + 1, file().filehnd()->ln);
pos = 0;
}
const char* s0 = p.PA.AreaForKey + pos++ * (kl + 4);
@ -764,17 +763,17 @@ int TCursor::filtercursor(int pagecnt, TRecnotype* page)
{
int np = 0;
TRectype& rec = file()->curr();
const bool tab = file()->tab();
TRectype& rec = file().curr();
const bool tab = file().tab();
if (tab)
{
file()->filehnd()->r->Fd[0].RecOff += 3;
file()->filehnd()->r->Fd[0].Len -= 3;
file().filehnd()->r->Fd[0].RecOff += 3;
file().filehnd()->r->Fd[0].Len -= 3;
}
// TRecfield* codtab = tab ? new TRecfield(rec, "CODTAB") : NULL;
for (int i = 0; i < pagecnt; i++)
{
CRead(&file()->filehnd()->f, rec.string(), page[i], _nolock);
CRead(&file().filehnd()->f, rec.string(), page[i], _nolock);
// if (tab) *codtab = (const char*)(*codtab) + 3;
if ((_filterfunction ? _filterfunction(_if) : TRUE ) &&
(_fexpr ? __evalcondition(rec, _fexpr) : TRUE))
@ -785,8 +784,8 @@ int TCursor::filtercursor(int pagecnt, TRecnotype* page)
}
if (tab)
{
file()->filehnd()->r->Fd[0].RecOff -= 3;
file()->filehnd()->r->Fd[0].Len += 3;
file().filehnd()->r->Fd[0].RecOff -= 3;
file().filehnd()->r->Fd[0].Len += 3;
}
// if (tab) delete codtab;
return np;
@ -796,11 +795,11 @@ int TCursor::filtercursor(int pagecnt, TRecnotype* page)
bool TCursor::ok() const
{
if (file()->bad()) return FALSE;
if (file().bad()) return FALSE;
const TRectype& rec = file()->curr();
const TRectype& rec = file().curr();
TString key(rec.key(_nkey)), kf(from()), kt(to());
if (file()->tab())
if (file().tab())
{
kf.ltrim(3);
kt.ltrim(3);
@ -817,12 +816,12 @@ bool TCursor::ok() const
bool TCursor::changed()
{
isdef* fh = file()->filehnd();
isdef* fh = file().filehnd();
if (_frozen && _lastrec != 0L) return _filename != fh->f.name;
#if XVT_OS==XVT_OS_SCOUNIX
const TRecnotype eod = file()->eod();
const TRecnotype eod = file().eod();
#else
int junk = 0;
const TRecnotype eod = cisgeteod(fh, &junk);
@ -844,13 +843,13 @@ bool TCursor::changed()
TRecnotype TCursor::update()
{
file()->setkey(_nkey);
file()->read(_isgteq);
file().setkey(_nkey);
file().read(_isgteq);
const CURSOR old = get_cursor(TASK_WIN);
set_cursor(TASK_WIN, CURSOR_WAIT);
TRecnotype totrec = buildcursor(file()->recno());
TRecnotype totrec = buildcursor(file().recno());
// if (has_filter()) totrec = filtercursor();
set_cursor(TASK_WIN, old);
@ -872,9 +871,9 @@ void TCursor::filter(const char* filter, const TRectype *from,
bool filterchanged = (filter != NULL) && (_filter != kfilter);
if (file()->tab())
if (file().tab())
{
TTable& f = (TTable&) *file();
TTable& f = (TTable&)file();
tbpref = f.name();
}
if (from != NULL)
@ -906,7 +905,7 @@ void TCursor::filter(const char* filter, const TRectype *from,
_fexpr = new TExpression(_filter, type);
if (_fexpr->type() == _numexpr)
for (int i = 0 ; i < _fexpr->numvar(); i++)
if (file()->curr().type(_fexpr->varname(i)) == _alfafld)
if (file().curr().type(_fexpr->varname(i)) == _alfafld)
{
_fexpr->set_type(_strexpr);
break;
@ -914,7 +913,7 @@ void TCursor::filter(const char* filter, const TRectype *from,
}
else _fexpr = NULL;
}
file()->setkey(_nkey);
file().setkey(_nkey);
_keyfrom = kf;
_keyto = kto;
}
@ -927,7 +926,7 @@ void TCursor::setkey(int nkey)
{
_lastrec = 0L;
_nkey = nkey;
file()->setkey(_nkey);
file().setkey(_nkey);
filter(NULL);
}
}
@ -938,9 +937,9 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop, TDate& atdate)
TRecnotype *page;
int pagecnt;
file()->setkey(_nkey);
_if->file()->read(op, lockop, atdate);
const TRecnotype curpos = file()->recno();
file().setkey(_nkey);
_if->file().read(op, lockop, atdate);
const TRecnotype curpos = file().recno();
if (changed())
_totrec = update();
@ -948,7 +947,7 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop, TDate& atdate)
FILE* _f = open_index();
if (fseek(_f, 0L, SEEK_SET) != 0)
fatal_box("Can't repos cursor : File %d\n", file()->filehnd()->ln);
fatal_box("Can't repos cursor : File %d\n", file().filehnd()->ln);
page = new TRecnotype [CMAXELPAGE];
_pos = -1;
@ -979,7 +978,7 @@ TCursor::TCursor(TRelation* r, const char* filter, int nkey, TRectype *from, TRe
{
_if = r;
_nkey = nkey;
CHECKD(_nkey > 0 && _nkey <= file()->filehnd()->r->NKeys, "Bad key number : ", _nkey);
CHECKD(_nkey > 0 && _nkey <= file().filehnd()->r->NKeys, "Bad key number : ", _nkey);
_indexname.temp("ci");
/*
@ -990,7 +989,7 @@ TCursor::TCursor(TRelation* r, const char* filter, int nkey, TRectype *from, TRe
#endif
if (_f == NULL)
fatal_box("Can't create cursor index on file %d: %s",
file()->num(), strerror(errno));
file().num(), strerror(errno));
*/
FILE* _f = open_index(TRUE);
fclose(_f);
@ -1006,17 +1005,17 @@ TCursor::TCursor(TRelation* r, const char* filter, int nkey, TRectype *from, TRe
_fexpr = new TExpression(_filter, type);
if (_fexpr->type() == _numexpr)
for (int i = 0 ; i < _fexpr->numvar(); i++)
if (file()->curr().type(_fexpr->varname(i)) == _alfafld)
if (file().curr().type(_fexpr->varname(i)) == _alfafld)
{
_fexpr->set_type(_strexpr);
break;
}
}
else _fexpr = NULL;
file()->setkey(_nkey);
if (file()->tab())
file().setkey(_nkey);
if (file().tab())
{
TTable& f = (TTable&) *file();
TTable& f = (TTable&)file();
_keyfrom = _keyto = f.name();
}
if (from != NULL)
@ -1046,27 +1045,27 @@ TCursor::~TCursor()
TRecnotype TCursor::readrec()
{
TRecnotype& nrec = file()->filehnd()->RecNo;
TRecnotype& nrec = file().filehnd()->RecNo;
if (_pos == items())
{
file()->setstatus(_iseof);
file().setstatus(_iseof);
curr().zero();
return nrec = 0L;
}
file()->setstatus(NOERR);
file().setstatus(NOERR);
FILE* _f = open_index();
if ((fseek(_f, _pos * sizeof(TRecnotype), SEEK_SET) != 0) ||
(fread(&nrec, sizeof(TRecnotype), 1, _f) != 1))
fatal_box("Can't read record in file n. %d\n", file()->filehnd()->ln);
fatal_box("Can't read record in file n. %d\n", file().filehnd()->ln);
fclose(_f);
curr().setdirty();
CRead(&file()->filehnd()->f, curr().string(), nrec, _nolock);
if (file()->tab())
CRead(&file().filehnd()->f, curr().string(), nrec, _nolock);
if (file().tab())
{
TRecfield codtab(curr(), "CODTAB");
codtab = (const char*)codtab + 3;
@ -1146,15 +1145,15 @@ TRecnotype TCursor::items()
bool TCursor::next_match(int lognum, const char* fl, int nk)
{
if (lognum == 0 || lognum == file()->num())
{++(*this); return file()->good(); }
if (lognum == 0 || lognum == file().num())
{++(*this); return file().good(); }
else return _if->next_match(lognum, fl, nk);
}
bool TCursor::is_first_match(int ln)
{
return (ln == 0 || ln == file()->num()) ?
(_pos == 0 && file()->good()) : (_if->is_first_match(ln));
return (ln == 0 || ln == file().num()) ?
(_pos == 0 && file().good()) : (_if->is_first_match(ln));
}
///////////////////////////////////////////////////////////
@ -1275,7 +1274,7 @@ const char* TFieldref::read(const TRelation* c) const
s = read(f.curr());
}
else
s = read(c->lfile(_id)->curr());
s = read(c->lfile(_id).curr());
return s;
}
@ -1291,7 +1290,7 @@ void TFieldref::write(const char* val, TRelation* c) const
curr = &f->curr();
}
else
curr = &c->lfile(_id)->curr();
curr = &c->lfile(_id).curr();
write(val, *curr);

View File

@ -1,4 +1,4 @@
/* $Id: relation.h,v 1.3 1994-09-07 17:00:18 guy Exp $ */
/* $Id: relation.h,v 1.4 1994-09-21 11:16:32 guy Exp $ */
// join.h
// fv 12/8/93
// join class for isam files
@ -6,14 +6,13 @@
#ifndef __RELATION_H
#define __RELATION_H
#ifndef __ISAM_H
#include <isam.h>
#endif
#ifndef __ARRAY_H
#include <array.h>
#endif
#ifndef __ISAM_H
#include <isam.h>
#endif
// @C
@ -39,8 +38,8 @@ protected:
int alias2ind(byte alias) const;
int name2ind(const char* name) const;
TRelationdef* reldef(int i) const { return (TRelationdef*)&_reldefs[i]; }
TLocalisamfile* file(int i = 0) const { return (TLocalisamfile*)&_files[i]; }
TRelationdef& reldef(int i) const { return (TRelationdef&)_reldefs[i]; }
TLocalisamfile& file(int i = 0) const { return (TLocalisamfile&)_files[i]; }
// @LONGDES
// position_rels fa tutto il lavoro: se non trova un record
@ -55,23 +54,23 @@ public:
// @FPUB
int update() { return position_rels(_isequal, _nolock);}
void zero();
virtual int next(TReclock lockop = _nolock) { return file()->next(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int prev(TReclock lockop = _nolock) { return file()->prev(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int next(TDate& atdate) { return file()->next(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file()->status(); }
virtual int prev(TDate& atdate) { return file()->prev(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file()->status(); }
virtual int first(TReclock lockop = _nolock) { return file()->first(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int last(TReclock lockop = _nolock) { return file()->last(lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int skip(TRecnotype nrec, TReclock lockop = _nolock) { return file()->skip(nrec, lockop) == NOERR ? position_rels(_isequal, lockop) : file()->status(); }
virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime) { return file()->read(op, lockop, atdate) == NOERR ? position_rels(_isequal, lockop, atdate) : file()->status();}
virtual int next(TReclock lockop = _nolock) { return file().next(lockop) == NOERR ? position_rels(_isequal, lockop) : file().status(); }
virtual int prev(TReclock lockop = _nolock) { return file().prev(lockop) == NOERR ? position_rels(_isequal, lockop) : file().status(); }
virtual int next(TDate& atdate) { return file().next(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file().status(); }
virtual int prev(TDate& atdate) { return file().prev(atdate) == NOERR ? position_rels(_isequal, _nolock, atdate) : file().status(); }
virtual int first(TReclock lockop = _nolock) { return file().first(lockop) == NOERR ? position_rels(_isequal, lockop) : file().status(); }
virtual int last(TReclock lockop = _nolock) { return file().last(lockop) == NOERR ? position_rels(_isequal, lockop) : file().status(); }
virtual int skip(TRecnotype nrec, TReclock lockop = _nolock) { return file().skip(nrec, lockop) == NOERR ? position_rels(_isequal, lockop) : file().status(); }
virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime) { return file().read(op, lockop, atdate) == NOERR ? position_rels(_isequal, lockop, atdate) : file().status();}
TLocalisamfile* lfile(int logicnum = 0) const;
TLocalisamfile* lfile(const char* name) const;
TLocalisamfile& lfile(int logicnum = 0) const;
TLocalisamfile& lfile(const char* name) const;
void write_enable(int logicnum = -1, const bool on = TRUE) ;
void write_enable(const char* name, const bool on = TRUE) ;
void write_disable(int logicnum = -1) { write_enable(logicnum, FALSE); }
void write_disable(const char* name) { write_enable(name, FALSE); }
TRectype& curr(int logicnum = 0) const { return lfile(logicnum)->curr(); }
TRectype& curr(int logicnum = 0) const { return lfile(logicnum).curr(); }
// next_match for 0ne-to-many relations; positions logicnum (!= main)
// on next matching record; returns TRUE or FALSE if no more matches; in
// any case relation is kept consistent except when inconsistent in
@ -94,8 +93,8 @@ public:
// @DES checking methods
// @FPUB
bool eof( int logicnum = 0) { return lfile(logicnum)->eof(); }
bool bof( int logicnum = 0) { return lfile(logicnum)->bof(); }
bool eof( int logicnum = 0) { return lfile(logicnum).eof(); }
bool bof( int logicnum = 0) { return lfile(logicnum).bof(); }
// @N
// status(), good() and bad() return the status of the relation when called
@ -103,10 +102,10 @@ public:
// a logical number
// @END
bool status(int logicnum = 0) { return lfile(logicnum)->status(); }
bool good( int logicnum = 0) { return lfile(logicnum)->good(); }
bool bad( int logicnum = 0) { return lfile(logicnum)->bad(); }
bool empty( int logicnum = 0) { return lfile(logicnum)->empty(); }
bool status(int logicnum = 0) { return lfile(logicnum).status(); }
bool good( int logicnum = 0) { return lfile(logicnum).good(); }
bool bad( int logicnum = 0) { return lfile(logicnum).bad(); }
bool empty( int logicnum = 0) { return lfile(logicnum).empty(); }
// @END
// @LONGDES
@ -190,13 +189,13 @@ public:
TCursor& operator --(); // Indietro di un record
TRecnotype pos() const { return _pos; }
TRecnotype items();
TRecnotype size() const { return file()->eod(); }
TRecnotype size() const { return file().eod(); }
const TString& from() const { return _keyfrom; }
const TString& to() const { return _keyto; }
TRectype& curr(int log = 0) const { return _if->curr(log); }
TRectype& curr(const char * tab) const
{ return _if->lfile(tab)->curr(); }
{ return _if->lfile(tab).curr(); }
TRecnotype read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime);
virtual bool ok() const;
@ -208,11 +207,11 @@ public:
{ filter(NULL,&from, &to); }
TRelation* relation() const { return _if; }
TLocalisamfile* file(int lnum = 0) const { return _if->lfile(lnum); }
TLocalisamfile* file(const char* name) const { return _if->lfile(name); }
TLocalisamfile& file(int lnum = 0) const { return _if->lfile(lnum); }
TLocalisamfile& file(const char* name) const { return _if->lfile(name); }
int repos() { return _if->position_rels(); }
void setkey() { file()->setkey(_nkey); }
void setkey() { file().setkey(_nkey); }
void setkey(int nkey);
int key() const { return _nkey; }

View File

@ -699,7 +699,7 @@ bool TBrowse_sheet::on_key(KEY k)
((TBrowse*)field().browse())->do_input(FALSE);
_cursor->read();
if (_cursor->file()->bad())
if (_cursor->file().bad())
{
beep();
field().set(val = old);

View File

@ -1,14 +1,13 @@
#include <xvtility.h>
#include <defmask.h>
#include <checks.h>
#include <viswin.h>
#include <utility.h>
#include <colors.h>
#include <config.h>
#include <defmask.h>
#include <execp.h>
#include <urldefid.h>
#include <printapp.h>
#include <mailbox.h>
#include <utility.h>
#include <printapp.h>
#include <urldefid.h>
#include <viswin.h>
#ifndef __PRINTER_H
typedef void (*LINKHANDLER) (int, const char *);
@ -30,9 +29,9 @@ extern "C"
#define TEXTCOLUMNS (columns() - 6)
#define DLG_QUIT_TITLE "Fine"
#define DLG_EDIT_TITLE "Edit"
#define DLG_LINK_TITLE "Collega"
#define DLG_PRINT_TITLE "Stampa"
#define DLG_EDIT_TITLE "~Edit"
#define DLG_LINK_TITLE "~Collega"
#define DLG_PRINT_TITLE "~Stampa"
#if XVT_OS == XVT_OS_WIN
#define BACKGROUND MASK_BACK_COLOR
@ -64,10 +63,9 @@ void TViswin::exec_link()
{
if (_linkID != -1)
{
LINKHANDLER pl = MainApp ()->printer ().getlinkhandler ();
LINKHANDLER pl = main_app().printer().getlinkhandler();
if (pl)
(*pl) (_linkID, _multiple ? (const char *) _multiple_link :
_linktxt);
pl(_linkID, _multiple ? (const char*)_multiple_link : (const char*)_linktxt);
// dai opzione per rifare la stampa se e' arrivato un messaggio
// dall'applicazione chiamata
@ -153,7 +151,6 @@ bool TViswin::check_link (TPoint * p)
static long py, px1, px2;
if (p == NULL) // erase and go
{
if (old_id != -1)
{
@ -188,7 +185,7 @@ bool TViswin::check_link (TPoint * p)
ttt.restart ();
strcpy (descr, ttt.get ());
strcat (descr, t.get (3));
strcpy (_linktxt, t.get (3));
_linktxt = t.get(3);
if (_multiple)
{
// get all parts of the same color
@ -1865,11 +1862,11 @@ TViswin ::TViswin (const char *fname,
_textcolumns = TEXTCOLUMNS;
autoscroll (TRUE);
_links = &(MainApp ()->printer ().links ());
_multiple = MainApp ()->printer ().ismultiplelink ();
_bg = MainApp ()->printer ().getbgdesc ();
_links = &(main_app().printer ().links ());
_multiple = main_app().printer ().ismultiplelink ();
_bg = main_app().printer ().getbgdesc ();
_isbackground = _bg->items () > 0;
_formlen = MainApp ()->printer ().formlen ();
_formlen = main_app().printer ().formlen ();
for (i = 0; i < _links->items (); i++)
{

View File

@ -70,7 +70,7 @@ class TViswin : public TScroll_window
PICTURE _picture[MAXPIC]; // pictures
PICTURE _modpic;
bool _multiple;
char _linktxt[80];
TString80 _linktxt;
int _linkID;
TToken_string _multiple_link;