Patch level : xx.7.054
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 1.7 patch 054 sul main trunk (II) git-svn-id: svn://10.65.10.50/trunk@9665 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
12d9315082
commit
5bf4cfa86f
@ -250,7 +250,8 @@ long XVT_CALLCONV1 TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
|
||||
// Setta la caption della task window
|
||||
TString cap;
|
||||
cap << _application->get_module_name() << " - " << prassi_spa();
|
||||
TString firm;
|
||||
cap << _application->get_module_name() << " - " << prassi_spa(firm);
|
||||
TTemp_window tw(win);
|
||||
tw.set_caption(cap);
|
||||
|
||||
|
@ -171,7 +171,7 @@ int TArchive::build_restore_list(
|
||||
int& mode,
|
||||
long firm, // @parm Ditta di cui effettuare il salvataggio
|
||||
char floppy, // @parm Floppy su cui effettuare il backup
|
||||
TString_array& fl) const // @parm Nomi dei cartella da ripristinare
|
||||
TString_array& fl) const // @parm Nomi dell cartelle da ripristinare
|
||||
{
|
||||
fl.destroy();
|
||||
|
||||
@ -942,10 +942,10 @@ bool TArchive::zip(
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TArchive::zip(long firm, char floppy, const char* desc)
|
||||
bool TArchive::zip(int mode, long firm, char floppy, const char* desc)
|
||||
{
|
||||
TString_array fl;
|
||||
const int num_ditte = build_backup_list(firm, fl);
|
||||
const int num_ditte = build_backup_list(mode, firm, fl);
|
||||
|
||||
bool ok = TRUE;
|
||||
for (int f = 0; f < num_ditte; f++)
|
||||
@ -1050,10 +1050,10 @@ bool TArchive::unzip(
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TArchive::unzip(long firm, char floppy, bool temp)
|
||||
bool TArchive::unzip(int mode, long firm, char floppy, bool temp)
|
||||
{
|
||||
TString_array fl;
|
||||
const int num_ditte = build_restore_list(firm, floppy, fl);
|
||||
const int num_ditte = build_restore_list(mode, firm, floppy, fl);
|
||||
|
||||
bool ok = TRUE;
|
||||
for (int f = 0; f < num_ditte; f++)
|
||||
@ -1071,9 +1071,9 @@ bool TArchive::backup(const char* dir, char floppy, const char* desc, bool)
|
||||
return zip(dir, floppy, desc);
|
||||
}
|
||||
|
||||
bool TArchive::backup(long firm, char floppy, const char* desc, bool)
|
||||
bool TArchive::backup(int mode, long firm, char floppy, const char* desc, bool)
|
||||
{
|
||||
return zip(firm, floppy, desc);
|
||||
return zip(mode, firm, floppy, desc);
|
||||
}
|
||||
|
||||
bool TArchive::restore(const char* dir, char floppy, bool tmp, bool)
|
||||
@ -1081,9 +1081,9 @@ bool TArchive::restore(const char* dir, char floppy, bool tmp, bool)
|
||||
return unzip(dir, floppy, tmp);
|
||||
}
|
||||
|
||||
bool TArchive::restore(long firm, char floppy, bool tmp, bool)
|
||||
bool TArchive::restore(int mode, long firm, char floppy, bool tmp, bool)
|
||||
{
|
||||
return unzip(firm, floppy, tmp);
|
||||
return unzip(mode, firm, floppy, tmp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -87,12 +87,12 @@ public:
|
||||
// @cmember Effettua il backup della directory
|
||||
bool zip(const char* dir, char floppy, const char* desc);
|
||||
// @cmember Effettua il backup della ditta
|
||||
bool zip(long firm, char floppy, const char* desc);
|
||||
bool zip(int mode, long firm, char floppy, const char* desc);
|
||||
|
||||
// @cmember Effettua il restore della directory
|
||||
bool unzip(const char* dir, char floppy, bool temp);
|
||||
// @cmember Effettua il restore della ditta
|
||||
bool unzip(long firm, char floppy, bool temp);
|
||||
bool unzip(int mode, long firm, char floppy, bool temp);
|
||||
|
||||
TArchive() { }
|
||||
virtual ~TArchive() { }
|
||||
|
@ -2267,7 +2267,8 @@ int DB_recinfo(const char * filename, FileDes *d, RecDes *r, char* keys)
|
||||
if (data_file != NULL)
|
||||
{
|
||||
field_info = d4field_info(data_file);
|
||||
index_file = d4index(data_file,(char*)filename);
|
||||
// index_file = d4index(data_file,(char*)filename);
|
||||
index_file = d4index(data_file, "");
|
||||
if (index_file == NULL)
|
||||
fatal_box("Il file %s e' senza indici.",filename);
|
||||
tag_info = i4tag_info(index_file);
|
||||
|
@ -185,8 +185,8 @@ XVT_FNTID xvt_default_font(bool bold)
|
||||
CHARY = ascent + descent + 1;
|
||||
BASEY = ascent;
|
||||
|
||||
if (CHARX > MAX_CHARX)
|
||||
CHARX = MAX_CHARX;
|
||||
if (CHARX > COLX)
|
||||
CHARX = COLX;
|
||||
|
||||
if (CHARY > ROWY-2)
|
||||
CHARY = ROWY-2;
|
||||
@ -395,7 +395,7 @@ HIDDEN void xi_event_handler(XI_OBJ *itf, XI_EVENT *xiev);
|
||||
HIDDEN void init_fu_multiple(XI_OBJ* itf)
|
||||
{
|
||||
RCT max_rct; xvt_vobj_get_client_rect(TASK_WIN, &max_rct);
|
||||
xi_pu_to_fu(itf, (PNT*)&max_rct, 2);
|
||||
xi_pu_to_fu(itf, (XinPoint *) &max_rct, 2);
|
||||
X_FU_MULTIPLE = max_rct.right / 80;
|
||||
Y_FU_MULTIPLE = max_rct.bottom / 25;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <real.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RECTYPES_H
|
||||
#ifndef TRectype
|
||||
class TRectype;
|
||||
#endif
|
||||
|
||||
|
296
include/isam.cpp
296
include/isam.cpp
@ -393,6 +393,11 @@ HIDDEN bool rec_has_memo(const RecDes* rd)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HIDDEN bool lf_has_memo(int lffile)
|
||||
{
|
||||
return rec_has_memo(&prefix().get_recdes(lffile));
|
||||
}
|
||||
|
||||
HIDDEN void browse_null(char *start, int nc)
|
||||
{
|
||||
for (int i = nc - 1; i >= 0 ; i--) // Anche il primo byte(deletion flag) deve essere cambiato. nc comprende il primo byte
|
||||
@ -459,84 +464,6 @@ HIDDEN const char * translate_key(const char* key) // Traduce l'espressione chia
|
||||
return t;
|
||||
}
|
||||
|
||||
HIDDEN void getisfd(isfdptr & isfd, int logicnum)
|
||||
{
|
||||
CHECK(logicnum < EXTERNAL_FILE, "Incorrect use of getisfd() with external file definition");
|
||||
isfd = new isdef ;
|
||||
isfd->r = new RecDes ;
|
||||
isfd->d = new FileDes ;
|
||||
CGetFile(logicnum, isfd->d, _nolock, _nordir);
|
||||
const TFixed_string name(isfd->d->SysName);
|
||||
if (name.not_empty() && name[0] != '$')
|
||||
isfd->ft = _comdir;
|
||||
else
|
||||
isfd->ft = _nordir;
|
||||
COpenFile(logicnum, isfd->d, _nolock, isfd->ft);
|
||||
CGetRec(logicnum, isfd->r, isfd->ft);
|
||||
isfd->ln = logicnum;
|
||||
}
|
||||
|
||||
HIDDEN void getisfd(isfdptr & isfd, const char* name)
|
||||
{
|
||||
// For External file definition only
|
||||
TTrec rec;
|
||||
int err;
|
||||
char* cb_keys = new char[256*MaxKeys];
|
||||
|
||||
isfd = new isdef ;
|
||||
isfd->r = new RecDes ;
|
||||
isfd->d = new FileDes ;
|
||||
isfd->ln = -1;
|
||||
|
||||
if (!fexist(name))
|
||||
fatal_box("Il file %s non esiste.",(const char*)name);
|
||||
TFilename n(name);
|
||||
n.ext(""); // Remove extension
|
||||
err = DB_recinfo(n,isfd->d,rec.rec(),cb_keys);
|
||||
if (err == NOERR)
|
||||
{
|
||||
strncpy(isfd->d->SysName, name,40);
|
||||
isfd->d->SysName[41] = '\0';
|
||||
isfd->fhnd = 0;
|
||||
isfd->RecNo = -1;
|
||||
isfd->ft = 0;
|
||||
isfd->knum = 0;
|
||||
rec.rehash();
|
||||
const int num_keys = rec.keys();
|
||||
TToken_string keys(cb_keys,'$');
|
||||
|
||||
for (int i=0; i< num_keys; i++)
|
||||
rec.update_keydef(i,translate_key(keys.get(i))); // Traduce l'espressione chiave di CodeBase
|
||||
memcpy(isfd->r,rec.rec(),sizeof(RecDes));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (err == -60) // This because existance of file is checked before
|
||||
fatal_box("File %s aperto in modo esclusivo da un'altra applicazione.",name);
|
||||
else
|
||||
fatal_box("Apertura file %s : errore n. %d ",name,err);
|
||||
}
|
||||
delete cb_keys;
|
||||
}
|
||||
|
||||
HIDDEN void relisfd(isfdptr & isfd)
|
||||
{
|
||||
if (isfd->ln > 0 && isfd->fhnd >= 0)
|
||||
{
|
||||
TDir d;
|
||||
d.get(isfd->ln, _lock, (TDirtype) isfd->ft, _sysdirop);
|
||||
d.eod() = isfd->d->EOD;
|
||||
d.eox() = isfd->d->EOX;
|
||||
d.put(isfd->ln, (TDirtype) isfd->ft, _sysdirop);
|
||||
}
|
||||
delete isfd->d;
|
||||
delete isfd->r;
|
||||
delete isfd;
|
||||
|
||||
isfd = NULL;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int __build_key(const RecDes *recd, int numkey, RecType recin, char *key, bool build_x_cb)
|
||||
/* *recd; descrittore record */
|
||||
/* numkey; numero chiave */
|
||||
@ -774,7 +701,7 @@ TBaseisamfile::TBaseisamfile(int logicnum)
|
||||
_isam_handle = 0;
|
||||
_curr_key = 0;
|
||||
_lasterr = NOERR;
|
||||
_current = new TRectype(this);
|
||||
_current = new TRectype(logicnum);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -782,27 +709,24 @@ TBaseisamfile::TBaseisamfile(int logicnum)
|
||||
// @mfunc Reperisce il tracciato dal file stesso.
|
||||
//
|
||||
TBaseisamfile::TBaseisamfile(
|
||||
const char* name, int mode, bool index) // @parm Indica il nome del file
|
||||
const char* name, // @parm Indica il nome del file
|
||||
const char* descname) // @parm Indica la descrizione del file
|
||||
// @comm Esiste la possibilita' di codificare i valori di pathpref e prefix in <p name>
|
||||
// % si riferisce ai dati comuni
|
||||
// $ si riferisce ai dati di ditta corrente
|
||||
// # si riferisce al direttorio indicato da PATHPREF.INI
|
||||
{
|
||||
if (descname && *descname)
|
||||
{
|
||||
TTrec r;
|
||||
ifstream f(descname);
|
||||
f >> r;
|
||||
const int err=DB_build(name, r.rec()) ;
|
||||
if (err != NOERR)
|
||||
fatal_box("Non posso creare il file %s : errore n.ro %d", name, err);
|
||||
}
|
||||
_lasterr = NOERR;
|
||||
TFilename filename(name);
|
||||
|
||||
// Espande il nome!
|
||||
const char c = filename[0];
|
||||
if (c == '%' || c == '$')
|
||||
filename = CAddPref(filename.get_buffer());
|
||||
else
|
||||
if (c == '#')
|
||||
{
|
||||
filename.ltrim(1);
|
||||
filename.format("%s/%s",__ptprf,(const char*)filename);
|
||||
}
|
||||
_logicnum = LF_EXTERNAL;
|
||||
_isam_handle = prefix().open_isamfile(_logicnum, filename, mode == _excllock, index);
|
||||
_logicnum = -1; // LF_EXTERNAL qui
|
||||
_current = new TRectype(this);
|
||||
}
|
||||
|
||||
@ -942,7 +866,7 @@ int TBaseisamfile::_read(TRectype& rec, word op, word lockop)
|
||||
|
||||
_lasterr = cisread(fhnd, getkey(), rec, op + lockop, _recno);
|
||||
|
||||
_recno = DB_recno(fhnd);
|
||||
_recno = DB_recno(fhnd); // qui
|
||||
if(rec.has_memo())
|
||||
rec.init_memo(_recno, _isam_handle);
|
||||
|
||||
@ -1235,15 +1159,16 @@ int TBaseisamfile::_open(
|
||||
_isam_handle = prefix().open_isamfile(_logicnum, filename, mode==_excllock, index);
|
||||
if (_isam_handle > 0)
|
||||
{
|
||||
const int dbfreclen = DB_reclen(filehnd()->fhnd);
|
||||
const int trcreclen = int(_isamfile->d->LenR);
|
||||
const TRecnotype n = DB_reccount(filehnd()->fhnd);
|
||||
TCodeb_handle cb_handle = prefix().get_handle(_isam_handle);
|
||||
const int dbfreclen = DB_reclen(cb_handle);
|
||||
const int trcreclen = prefix().get_reclen(_logicnum);
|
||||
const TRecnotype n = DB_reccount(cb_handle);
|
||||
|
||||
if (dbfreclen != trcreclen)
|
||||
{
|
||||
TString msg;
|
||||
msg.format("Lunghezza record incoerente sul file %d (%s): file=%d trc=%d",
|
||||
num(), (const char*)filename(), dbfreclen, trcreclen);
|
||||
num(), (const char*)filename, dbfreclen, trcreclen);
|
||||
if (n == 0)
|
||||
{
|
||||
msg << "\nSi consiglia di eliminare il file ed i suoi indici.";
|
||||
@ -1252,8 +1177,10 @@ int TBaseisamfile::_open(
|
||||
else
|
||||
fatal_box(msg);
|
||||
}
|
||||
if (filehnd()->r->NKeys <= 0)
|
||||
fatal_box("Il file %d (%s) e' senza indici", num(), (const char*)filename());
|
||||
if (prefix().get_recdes(_logicnum).NKeys <= 0) // qui
|
||||
fatal_box("Il file %d (%s) e' senza indici",
|
||||
num(),
|
||||
(const char*)filename);
|
||||
_recno = RECORD_NON_FISICO;
|
||||
setkey(1);
|
||||
_lasterr = NOERR;
|
||||
@ -1432,9 +1359,8 @@ TLocalisamfile::TLocalisamfile(
|
||||
// @rdesc Ritorna l'oggetto <c TLocalisamfile>
|
||||
TLocalisamfile::TLocalisamfile(
|
||||
const char* name, // @parm Nome del file esterno da aprire
|
||||
int mode,
|
||||
bool index)
|
||||
: TBaseisamfile(name, mode, index)
|
||||
const char* descname) // @parm Indica la descrizione del file
|
||||
: TBaseisamfile(name, descname)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1703,29 +1629,89 @@ int TIsamtempfile::close()
|
||||
///////////////////////////////////////////////////////////
|
||||
// TExternisamfile
|
||||
///////////////////////////////////////////////////////////
|
||||
TExternisamfile::TExternisamfile(const char* name, int mode, bool index)
|
||||
: TLocalisamfile(name, mode, index)
|
||||
TExternisamfile::TExternisamfile(const char* name, bool exclusive, bool index)
|
||||
: TLocalisamfile(name)
|
||||
{
|
||||
init(name, exclusive, index);
|
||||
}
|
||||
|
||||
TExternisamfile::TExternisamfile(const char* name, const char* descname, bool exclusive, bool index)
|
||||
: TLocalisamfile(name, descname)
|
||||
{
|
||||
init(name, exclusive, index);
|
||||
}
|
||||
|
||||
TExternisamfile::~TExternisamfile()
|
||||
{
|
||||
_close();
|
||||
close();
|
||||
}
|
||||
|
||||
void TExternisamfile::init(const char* name, bool exclusive, bool index)
|
||||
{
|
||||
_name = name; // qui
|
||||
_name.ext("dbf");
|
||||
|
||||
// Espande il nome!
|
||||
const char c = _name[0];
|
||||
if (c == '%' || c == '$')
|
||||
_name = CAddPref(_name.get_buffer());
|
||||
else
|
||||
if (c == '#')
|
||||
{
|
||||
_name.ltrim(1);
|
||||
_name.format("%s/%s",__ptprf,(const char*)_name);
|
||||
}
|
||||
open(exclusive, index);
|
||||
}
|
||||
|
||||
int TExternisamfile::open(bool exclusive, bool index)
|
||||
{
|
||||
_logicnum = -1; //qui
|
||||
_isam_handle = prefix().open_isamfile(_logicnum, _name, exclusive, index);
|
||||
if (_isam_handle > 0)
|
||||
{
|
||||
if (prefix().get_recdes(_logicnum).NKeys <= 0)
|
||||
fatal_box("Il file %d (%s) e' senza indici", num(), (const char*)filename());
|
||||
_recno = RECORD_NON_FISICO;
|
||||
setkey(1);
|
||||
_lasterr = NOERR;
|
||||
}
|
||||
else
|
||||
{
|
||||
TString e_msg;
|
||||
_lasterr = get_error(_isam_handle);
|
||||
if (_lasterr == -60)
|
||||
{
|
||||
if (!_name.exist())
|
||||
e_msg.format("Il file %d(%s) non esiste, errore %d",num(),(const char*)_name,_lasterr);
|
||||
else
|
||||
e_msg.format("Il file %d(%s) e' aperto in modo esclusivo da un'altra applicazione",
|
||||
num(), (const char*)_name);
|
||||
}
|
||||
if (e_msg.empty())
|
||||
e_msg.format("Il file %d(%s) non puo' essere aperto, errore %d",num(),(const char*)_name,_lasterr);
|
||||
fatal_box((const char*) e_msg);
|
||||
}
|
||||
return _lasterr;
|
||||
}
|
||||
|
||||
int TExternisamfile::close()
|
||||
{
|
||||
return _close();
|
||||
}
|
||||
|
||||
int TExternisamfile::zap()
|
||||
{
|
||||
int err = DB_close(filehnd()->fhnd);
|
||||
int err = prefix().close_isamfile(_isam_handle);
|
||||
if (err == NOERR)
|
||||
{
|
||||
err = DB_packfile(TRUE,_name, 0);
|
||||
err = DB_packfile(TRUE, _name, 0);
|
||||
if (err == NOERR)
|
||||
{
|
||||
TRecnotype peod;
|
||||
err = DB_packindex(TRUE, _name, curr().rec_des(), &peod, FALSE);
|
||||
}
|
||||
filehnd()->fhnd = DB_open(_name, FALSE, TRUE);
|
||||
_isam_handle = prefix().open_isamfile(_logicnum, _name);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -2659,32 +2645,20 @@ void TMemo_data::copy(const TMemo_data& m)
|
||||
void TRectype::init(int logicnum)
|
||||
{
|
||||
_logicnum = logicnum;
|
||||
CHECK(_logicnum > 0,"Impossibile costruire un record di un file esterno"); // qui
|
||||
|
||||
CHECK(_logicnum < EXTERNAL_FILE,"Impossibile costruire un record di un file esterno");
|
||||
_length = prefix().get_reclen(logicnum);
|
||||
|
||||
if (openf[_logicnum - 1] != NULL)
|
||||
{
|
||||
_length = DB_reclen(openf[logicnum - 1]->fhnd);
|
||||
has_memo_fld = rec_has_memo(rec_des());
|
||||
}
|
||||
else
|
||||
{
|
||||
TDir wdir;
|
||||
wdir.get(_logicnum, _nolock, _nordir, _sysdirop);
|
||||
if (wdir.is_com())
|
||||
wdir.get(_logicnum, _nolock, _comdir, _sysdirop);
|
||||
_length = wdir.len();
|
||||
has_memo_fld = _length > 0 && lf_has_memo(_logicnum);
|
||||
}
|
||||
_rec = new char [_length];
|
||||
*_tab = '\0';
|
||||
if (_length > 0)
|
||||
{
|
||||
zero();
|
||||
}
|
||||
else
|
||||
setempty(TRUE);
|
||||
if(has_memo_fld)
|
||||
|
||||
const bool has_memo_fld = _length > 0 && lf_has_memo(_logicnum);
|
||||
|
||||
if(has_memo_fld)
|
||||
init_memo(RECORD_NON_FISICO);
|
||||
}
|
||||
|
||||
@ -2692,74 +2666,29 @@ TRectype::TRectype(int logicnum)
|
||||
: _memo_data(NULL)
|
||||
|
||||
{
|
||||
bool has_memo_fld = FALSE;
|
||||
|
||||
_logicnum = logicnum;
|
||||
if (openf[_logicnum - 1] != NULL)
|
||||
{
|
||||
_length = DB_reclen(openf[logicnum - 1]->fhnd);
|
||||
has_memo_fld = rec_has_memo(rec_des());
|
||||
*_tab = '\0';
|
||||
if (_length > 0)
|
||||
{
|
||||
zero();
|
||||
if (rec_has_memo(rec_des()))
|
||||
init_memo(RECORD_NON_FISICO);
|
||||
}
|
||||
else
|
||||
setempty(TRUE);
|
||||
init(logicnum); //qui
|
||||
}
|
||||
|
||||
TRectype::TRectype(int logicnum)
|
||||
: _memo_data(NULL), _memo_dirty(NULL)
|
||||
|
||||
{
|
||||
_logicnum = logicnum;
|
||||
_length = prefix().get_reclen(logicnum);
|
||||
_rec = new char [_length];
|
||||
*_tab = '\0';
|
||||
if (_length > 0)
|
||||
{
|
||||
zero();
|
||||
if (rec_has_memo(rec_des()))
|
||||
init_memo(RECORD_NON_FISICO);
|
||||
}
|
||||
else
|
||||
setempty(TRUE);
|
||||
}
|
||||
|
||||
TRectype::TRectype(const TBaseisamfile* i)
|
||||
: _memo_data(NULL)
|
||||
{
|
||||
_logicnum = i->num();
|
||||
_length = prefix().get_reclen(_logicnum);
|
||||
_rec = new char [_length];
|
||||
*_tab = '\0';
|
||||
if (_length > 0)
|
||||
{
|
||||
zero();
|
||||
if (rec_has_memo(rec_des()))
|
||||
init_memo(RECORD_NON_FISICO);
|
||||
}
|
||||
else
|
||||
setempty(TRUE);
|
||||
init(i->num());
|
||||
}
|
||||
|
||||
|
||||
TRectype::TRectype(const TRectype& r)
|
||||
: _logicnum(r._logicnum),
|
||||
:
|
||||
_memo_data(NULL)
|
||||
|
||||
{
|
||||
init(r._logicnum); //qui
|
||||
if (r._memo_data)
|
||||
{
|
||||
init_memo(r._memo_data->recno(), r._memo_data->file());
|
||||
*_memo_data = *r._memo_data;
|
||||
}
|
||||
_length = r.len();
|
||||
_rec = new char [ _length ];
|
||||
memcpy(_rec, r._rec, _length);
|
||||
|
||||
strcpy(_tab, r._tab);
|
||||
setempty(r.empty());
|
||||
}
|
||||
@ -2782,11 +2711,11 @@ void TRectype::unknown_field(const char* name) const
|
||||
}
|
||||
}
|
||||
|
||||
void TRectype::write_memo(TIsam_handle file, const TRecnotype recno)
|
||||
void TRectype::write_memo(TIsam_handle file, const TRecnotype recno) //qui
|
||||
{
|
||||
const RecDes *r = rec_des( );
|
||||
TIsam_handle orig = _memo_data->file();
|
||||
if (orig && (fhnd != orig || recno != _memo_data->recno()))
|
||||
if (orig && (file != orig || recno != _memo_data->recno()))
|
||||
{
|
||||
TCodeb_handle cb_orig = prefix().get_handle(orig);
|
||||
DB_go(cb_orig, _memo_data->recno());
|
||||
@ -2805,9 +2734,9 @@ void TRectype::write_memo(TIsam_handle file, const TRecnotype recno)
|
||||
}
|
||||
}
|
||||
|
||||
CHECK( _memo_recno > 0, "Maiale! Non fare le GO con _recno < 0 " );
|
||||
CHECK( _memo_data->recno() > 0, "Maiale! Non fare le GO con _recno < 0 " );
|
||||
TCodeb_handle cb_handle = prefix().get_handle(file);
|
||||
DB_go( cb_handle, _memo_recno );
|
||||
DB_go( cb_handle, _memo_data->recno());
|
||||
for( int i = _memo_data->last( ); i > 0; i = _memo_data->pred( i ) )
|
||||
{
|
||||
if (_memo_data->is_dirty(i))
|
||||
@ -3082,10 +3011,9 @@ const TString& TRectype::get(const char* fieldname) const
|
||||
if (orig)
|
||||
{
|
||||
TCodeb_handle cb_handle = prefix().get_handle(orig);
|
||||
DB_go(orig->fhnd, _memo_data->recno());
|
||||
CHECKD(cb_handle >= 0, "Can't read memo from file ", orig); //qui
|
||||
DB_go(cb_handle, _memo_data->recno()); //qui
|
||||
_memo_data->add(DB_memoptr(orig, fieldname), index);
|
||||
CHECKD(cb_handle >= 0, "Can't read memo from file ", lnum);
|
||||
DB_go(cb_handle, _memo_recno );
|
||||
}
|
||||
else
|
||||
NFCHECK("Valid memo recno with null memo file");
|
||||
|
@ -25,6 +25,10 @@
|
||||
class TTextfile;
|
||||
#endif
|
||||
|
||||
#ifndef __PREFIX_H
|
||||
#include <prefix.h>
|
||||
#endif
|
||||
|
||||
#define FIELDERR -1
|
||||
|
||||
#define RECORD_NON_FISICO (-1L)
|
||||
@ -43,7 +47,7 @@ class TMemo_data : public TString_array
|
||||
|
||||
public:
|
||||
void destroy();
|
||||
void init(TRecnotype recno, isdef* file);
|
||||
void init(TRecnotype recno, TIsam_handle file);
|
||||
TRecnotype recno() const { return _recno; }
|
||||
TIsam_handle file() const { return _isamfile; }
|
||||
void copy(const TMemo_data& m);
|
||||
@ -331,7 +335,7 @@ protected:
|
||||
const char* filename() const;
|
||||
|
||||
// @cmember Costruttore per derivare TExternisamfile. <p Name> indica il file esterno da aprire.
|
||||
TBaseisamfile(const char* name, int mode, bool index);
|
||||
TBaseisamfile(const char* name, const char* descname = NULL);
|
||||
|
||||
int handle(int key = 0) const;
|
||||
|
||||
@ -649,7 +653,7 @@ protected:
|
||||
// @cmember Costruttore per derivare TTempIsamfile
|
||||
TLocalisamfile(int logicnum, bool tmp);
|
||||
// @cmember Costruttore per derivare TExternisamfile. <p Name> indica il file esterno da aprire (vedi <c TBaseisamfile>).
|
||||
TLocalisamfile(const char* name, int mode, bool index);
|
||||
TLocalisamfile(const char* name, const char* descname = NULL);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
@ -715,6 +719,18 @@ class TExternisamfile : public TLocalisamfile
|
||||
|
||||
// @author:(INTERNAL) Angelo
|
||||
{
|
||||
//@cmember:(INTERNAL) Indica il nome del file col quale e' stata instanziata la classe
|
||||
TFilename _name;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember inizializza il file. <p exclusive> indica se aprire il file in modo esclusivo
|
||||
void init(const char* name, bool exclusive, bool index);
|
||||
// @cmember Apre il file. <p exclusive> indica se aprire il file in modo esclusivo
|
||||
int open(bool exclusive, bool index = TRUE);
|
||||
// @cmember Chiude il file
|
||||
int close();
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Ritorna il nome del file sotto forma di stringa
|
||||
@ -725,7 +741,12 @@ public:
|
||||
|
||||
// @cmember Costruttore. <p exclusive> indica se aprire il file in modo esclusivo.
|
||||
// <p index> indica se aprire il file con indici o meno
|
||||
TExternisamfile(const char* name, int mode = _nolock, bool index = TRUE);
|
||||
TExternisamfile(const char* name, bool exclusive = FALSE, bool index = TRUE);
|
||||
// @cmember Costruttore. <p descname> é il nome del file che contiene la descrizione del file (estensione trr).
|
||||
// <p exclusive> indica se aprire il file in modo esclusivo.
|
||||
// <p index> indica se aprire il file con indici o meno
|
||||
TExternisamfile(const char* name, const char * descname, bool exclusive = FALSE,
|
||||
bool index = TRUE);
|
||||
// @cmember Distruttore
|
||||
virtual ~TExternisamfile();
|
||||
};
|
||||
|
@ -1,3 +1,6 @@
|
||||
#define XI_INTERNAL
|
||||
#include <xinclude.h>
|
||||
|
||||
#include <colors.h>
|
||||
#include <controls.h>
|
||||
#include <execp.h>
|
||||
@ -4824,7 +4827,7 @@ void TField_window::update()
|
||||
const WINDOW pa = parent();
|
||||
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
|
||||
rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2;
|
||||
xi_draw_3d_rect(pa, &rct, TRUE, 2,
|
||||
xi_draw_3d_rect(pa, (XinRect *) &rct, TRUE, 2, // qui
|
||||
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
|
||||
}
|
||||
xvt_dwin_clear(me, NORMAL_BACK_COLOR);
|
||||
|
@ -1543,9 +1543,9 @@ class TField_window : public TScroll_window
|
||||
protected:
|
||||
virtual void update();
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
virtual bool on_key(KEY k);
|
||||
|
||||
public:
|
||||
virtual bool on_key(KEY k);
|
||||
TWindowed_field& owner() const { return *_owner; }
|
||||
|
||||
TField_window(int x, int y, int dx, int dy,
|
||||
|
@ -994,7 +994,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e->class_id() == CLASS_BOOLEAN_FIELD_
|
||||
if (e->class_id() == CLASS_BOOLEAN_FIELD) //qui
|
||||
xiev->v.cell_request.icon_rid = ICO_CHECK_OFF;
|
||||
}
|
||||
|
||||
|
@ -245,12 +245,12 @@ void TMultiple_rectype::synchronize_bodies()
|
||||
TRecord_array * b = (TRecord_array *) _files.objptr(i);
|
||||
if (b == NULL)
|
||||
{
|
||||
b = new TRecord_array(_logicnums[i], (TString &) _numfields[i]);
|
||||
b = new TRecord_array(lognum(i), (TString &) _numfields[i]);
|
||||
_files.add(b, i);
|
||||
}
|
||||
_changed[i] = FALSE;
|
||||
_changed.reset(i);
|
||||
b->destroy_rows();
|
||||
TRectype * r = new_body_record(_logicnums[i]);
|
||||
TRectype * r = new_body_record(lognum(i));
|
||||
set_body_key(*r);
|
||||
b->set_key(r);
|
||||
}
|
||||
@ -323,9 +323,10 @@ int TMultiple_rectype::compare(const TSortable& s) const
|
||||
bool TMultiple_rectype::is_equal(const TMultiple_rectype& m) const
|
||||
{
|
||||
bool yes = TRectype::is_equal(m);
|
||||
for (int i = 0; yes && i < _nfiles; i++)
|
||||
const int last = _logicnums.last(); // qui
|
||||
for (int i = 0; yes && i < last; i++)
|
||||
{
|
||||
const int logicnum = _logicnums[i];
|
||||
const int logicnum = lognum(i);
|
||||
TRecord_array & r = body(logicnum);
|
||||
TRecord_array & r1 = m.body(logicnum);
|
||||
yes = r.rows() == r1.rows();
|
||||
@ -357,9 +358,10 @@ void TMultiple_rectype::fill_transaction(TConfig& cfg, int row) const
|
||||
{
|
||||
CHECK(row == 0, "You can't specify a row for multiple rectypes");
|
||||
TRectype::fill_transaction(cfg);
|
||||
for (int i = 0; i < _nfiles; i++)
|
||||
const int last = _logicnums.last(); // qui
|
||||
for (int i = 0; i < last; i++)
|
||||
{
|
||||
TRecord_array& b = body(_logicnums[i]);
|
||||
TRecord_array& b = body(lognum(i));
|
||||
for (int r = 1; b.exist(r); r++)
|
||||
b[r].fill_transaction(cfg, r);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
enum os_type { os_Unknown, os_Windows, os_Windows95, os_Windows98,
|
||||
enum os_type { os_Unknown, os_Win32s, os_Windows, os_Windows95, os_Windows98,
|
||||
os_WindowsME, os_WindowsNT, os_Windows2000 };
|
||||
os_type os_get_type();
|
||||
|
||||
|
@ -422,10 +422,20 @@ os_type os_get_type()
|
||||
{
|
||||
switch (ovi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32s : t = os_Win32s; break;
|
||||
case VER_PLATFORM_WIN32_NT : t = os_WindowsNT; break;
|
||||
case VER_PLATFORM_WIN32_WINDOWS: t = os_Windows95; break;
|
||||
default : t = os_Unknown; break;
|
||||
case VER_PLATFORM_WIN32s : t = os_Win32s; break;
|
||||
case VER_PLATFORM_WIN32_NT :
|
||||
{
|
||||
t = os_WindowsNT;
|
||||
}
|
||||
break;
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
{
|
||||
t = os_Windows95;
|
||||
if (ovi.dwMajorVersion == 4 || (ovi.dwMajorVersion > 4 && ovi.dwMinorVersion > 0))
|
||||
t = os_Windows98;
|
||||
}
|
||||
break;
|
||||
default : t = os_Unknown; break; //Windows ME / 98 qui
|
||||
}
|
||||
}
|
||||
return t;
|
||||
@ -657,3 +667,8 @@ unsigned long os_execute_in_window(const TFilename& path, WINDOW win)
|
||||
|
||||
return (unsigned long) w._hwnd;
|
||||
}
|
||||
|
||||
void os_sleep(long m)
|
||||
{
|
||||
::Sleep(m);
|
||||
}
|
||||
|
@ -12,72 +12,6 @@
|
||||
// Definita in isam.cpp
|
||||
extern int get_error(int);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFirm
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#include <nditte.h>
|
||||
|
||||
bool TFirm::read(long cod)
|
||||
{
|
||||
int err = NOERR;
|
||||
if (cod < 0L)
|
||||
cod = prefix().get_codditta();
|
||||
_rec.destroy();
|
||||
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
if (cod > 0L)
|
||||
{
|
||||
ditte.put("CODDITTA", cod);
|
||||
err = ditte.read();
|
||||
}
|
||||
else
|
||||
err = ditte.first();
|
||||
|
||||
if (err == NOERR)
|
||||
{
|
||||
const TRectype& ditta = ditte.curr();
|
||||
for (int f = ditta.items()-1; f >= 0; f--)
|
||||
{
|
||||
const char* name = ditta.fieldname(f);
|
||||
_rec.add(name, ditta.get(name));
|
||||
}
|
||||
}
|
||||
else
|
||||
NFCHECK("Can't read firm %ld: error %d", cod, err);
|
||||
|
||||
return _rec.items() > 0;
|
||||
}
|
||||
|
||||
const TString& TFirm::get(const char* attr) const
|
||||
{
|
||||
const TString* str = (const TString*)_rec.objptr(attr);
|
||||
if (str == NULL)
|
||||
str = &EMPTY_STRING;
|
||||
return *str;
|
||||
}
|
||||
|
||||
long TFirm::get_long(const char* attr) const
|
||||
{ return atol(get(attr)); }
|
||||
|
||||
long TFirm::codice() const
|
||||
{
|
||||
return get_long(NDT_CODDITTA);
|
||||
}
|
||||
|
||||
const TString& TFirm::codice_valuta() const
|
||||
{
|
||||
const TString& codval = get(NDT_VALUTA);
|
||||
if (codval.empty())
|
||||
return TCurrency::get_base_val();
|
||||
return codval;
|
||||
}
|
||||
|
||||
TFirm::TFirm(long code)
|
||||
{
|
||||
read(code);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// extern variables are NO-NO!
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -847,23 +781,26 @@ bool TFirm::read(long cod)
|
||||
if (cod < 0L)
|
||||
cod = prefix().get_codditta();
|
||||
_rec.destroy();
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
if (cod > 0L)
|
||||
{
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
ditte.put("CODDITTA", cod);
|
||||
err = ditte.read();
|
||||
if (err == NOERR)
|
||||
{
|
||||
const TRectype& ditta = ditte.curr();
|
||||
for (int f = ditta.items()-1; f >= 0; f--)
|
||||
{
|
||||
const char* name = ditta.fieldname(f);
|
||||
_rec.add(name, ditta.get(name));
|
||||
}
|
||||
}
|
||||
else
|
||||
NFCHECK("Can't read firm %ld: error %d", cod, err);
|
||||
}
|
||||
else
|
||||
err = ditte.first();
|
||||
if (err == NOERR)
|
||||
{
|
||||
const TRectype& ditta = ditte.curr();
|
||||
for (int f = ditta.items()-1; f >= 0; f--)
|
||||
{
|
||||
const char* name = ditta.fieldname(f);
|
||||
_rec.add(name, ditta.get(name));
|
||||
}
|
||||
}
|
||||
else
|
||||
NFCHECK("Can't read firm %ld: error %d", cod, err);
|
||||
|
||||
return _rec.items() > 0;
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,6 @@ class TFile_cache : public TObject
|
||||
long _last_read, _limit;
|
||||
bool _test_changes;
|
||||
|
||||
static unsigned long _hits, _miss;
|
||||
|
||||
protected:
|
||||
TAssoc_array _cache;
|
||||
|
||||
|
@ -246,7 +246,7 @@ public:
|
||||
void set_link(TMask & m, const char * keyexpr);
|
||||
// @cmember Ritorna TRUE se e' stato chiamato col messaggio di link
|
||||
bool lnflag() const
|
||||
{ return _lnflag;}
|
||||
{ return _lnflag != 0;} // qui
|
||||
// @cmember Ritorna TRUE se e' una transazione
|
||||
bool is_transaction() const { return _curr_transaction.not_empty(); }
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <sheet.h>
|
||||
#include <sort.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <codeb.h>
|
||||
// *** check if not already defined
|
||||
@ -1293,9 +1294,9 @@ void TCursor::filter(
|
||||
kf = kto = f.name();
|
||||
}
|
||||
if (from != NULL)
|
||||
matildator(*from, _nkey, tilde & 0x1, kf);
|
||||
matildator(*from, _nkey, (bool)(tilde & 0x1), kf);
|
||||
if (to != NULL)
|
||||
matildator(*to, _nkey, tilde & 0x2, kto);
|
||||
matildator(*to, _nkey, (tilde & 0x2) != 0, kto);
|
||||
|
||||
if (filterchanged || (_keyfrom != kf) || (_keyto != kto))
|
||||
{
|
||||
|
@ -2597,8 +2597,22 @@ TViswin::TViswin(const char *fname,
|
||||
else
|
||||
PRINT_HEIGHT = 10;
|
||||
|
||||
height = rows();
|
||||
// height = rows(); qui
|
||||
|
||||
const int larg = 76;
|
||||
const int alt = 20;
|
||||
|
||||
RCT r;
|
||||
|
||||
xvt_vobj_get_client_rect (parent, &r);
|
||||
int maxlarg = width == 0 ? (r.right / CHARX - 6) : width;
|
||||
int maxalt = height == 0 ? (r.bottom / CHARY - 6) : height;
|
||||
|
||||
if (_toplevel && larg > maxlarg)
|
||||
maxlarg = larg;
|
||||
if (_toplevel && alt > maxalt)
|
||||
maxalt = alt;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
_modules.add(new TImage(BMP_MODULE1 + i), i);
|
||||
_modules.add(new TImage(BMP_MODULE), i);
|
||||
|
@ -180,15 +180,16 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
||||
{
|
||||
switch(m->tag)
|
||||
{
|
||||
case M_FILE: // Leave it as is
|
||||
case M_EDIT:
|
||||
case M_FONT:
|
||||
case M_STYLE:
|
||||
case M_HELP:
|
||||
case -1: // Separator
|
||||
break;
|
||||
default:
|
||||
xvt_menu_set_item_enabled(TASK_WIN, m->tag, on);
|
||||
case M_FILE: // Leave it as is
|
||||
case M_EDIT:
|
||||
case M_FONT:
|
||||
case M_STYLE:
|
||||
case M_HELP:
|
||||
case -1: // Separator
|
||||
break;
|
||||
default:
|
||||
xvt_menu_set_item_enabled(TASK_WIN, m->tag, on);
|
||||
}
|
||||
m++;
|
||||
}
|
||||
}
|
||||
@ -704,7 +705,12 @@ KEY TWindow::run()
|
||||
else open();
|
||||
|
||||
while (_running)
|
||||
{
|
||||
do_events();
|
||||
#if XVT_OS == XVT_OS_WIN32
|
||||
os_sleep(100);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!was_open) close_modal();
|
||||
do_events();
|
||||
|
Loading…
x
Reference in New Issue
Block a user