diff --git a/include/filetext.cpp b/include/filetext.cpp index 26c131f17..7e7435b82 100755 --- a/include/filetext.cpp +++ b/include/filetext.cpp @@ -1,6 +1,7 @@ #include #include +#include //////////////////////////////////////// TTracciato_Campo //////////////////////////////////////// TTracciato_campo::TTracciato_campo(int position, int length, int decimal, const char align, const char filler) @@ -149,15 +150,23 @@ TTracciato_record* TFile_text::t_rec(const char* type) const return (TTracciato_record*)_tracciati_record.objptr(type); } -TTracciato_record* TFile_text::t_rec(int mainfile) const +TTracciato_record* TFile_text::t_rec(int mainfile, const char * tabname) const { + if (tabname) + mainfile=(tabname[0] != '%') ? LF_TAB: LF_TABCOM; TTracciato_record *trrd; TAssoc_array &tr= ((TFile_text *)this)->_tracciati_record; tr.restart(); while (trrd=(TTracciato_record *)tr.get()) { if (trrd->relation() && trrd->relation()->lfile().num()==mainfile) - break; + if (tabname) + { + TTable & tab=(TTable & )trrd->relation()->lfile(); + if (tabname == tab.name() ) + break; + } else + break; } return trrd; } @@ -561,6 +570,23 @@ bool TFile_text::autoload(TRecord_text& rec, int mainfile) return FALSE; } +// Carica tutti i dati del tracciato record (anche header o footer) +// nel record_text +bool TFile_text::autoload(TRecord_text& rec, const char * tabname) +{ + TTracciato_record* tr = t_rec(tabname); + if (tr) + { + // esiste il tracciato e posso fare l'autoload + TCursor cur(tr->relation()); + rec.set_type(tr->type()); + return _autoload(rec,cur,*tr); + } + //CHECK (FALSE,"Il tracciato record non esiste"); + return FALSE; +} + + //Carica tutti i dati nel tracciato record (valido anche per header e footer) nel record_text bool TFile_text::autoload(TRecord_text& rec, TCursor& cur , const TString* tipo) { diff --git a/include/filetext.h b/include/filetext.h index 4f54640d2..d1f909849 100755 --- a/include/filetext.h +++ b/include/filetext.h @@ -214,7 +214,7 @@ public: TTracciato_record* t_rec(const char* type) const ; // @cmember ritorna il tracciato record relativo alla relazione del file passato // NB: si assume che ogni tracciato sia relativo ad una relazione diversa - TTracciato_record* t_rec(int mainfile) const ; + TTracciato_record* t_rec(int mainfile, const char* tab=NULL) const ; const int items_tr() const {return _tracciati_record.items();}//ritorna il numero di tracciati record nel file TAssoc_array& tracciati() {return _tracciati_record;}//ritorna un riferimento all'assoc_array dei tracciati record // @cmember caricamento automatico del record_text dalla relazione @@ -223,6 +223,8 @@ public: bool autoload(TCursor& cur, const TString* tipo = NULL) ; // @cmember caricamento automatico del record_text passato dalla relazione di file principale mainfile definita sul tracciato bool autoload(TRecord_text& rec, int mainfile); + // @cmember caricamento automatico del record_text passato dalla relazione + bool autoload(TRecord_text& rec, const char * tabname); // @cmember caricamento automatico del record_text corrente dalla relazione di file principale mainfile definita sul tracciato void autoload(int mainfile) {autoload(*_current, mainfile);} int write(TRecord_text & rec);//scrive su file di testo il record diff --git a/include/isam.cpp b/include/isam.cpp index 32d94089f..d9d4482ae 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -2180,7 +2180,9 @@ int TSystemisamfile::update( dir.eox() = 0L; } - if (toconvert && dir.eox() > 0L) + TFilename fname(filename()); + + if (toconvert && (dir.eox() > 0L || fexist(fname))) { TRecnotype ni = 0L; isfdptr i0; @@ -2196,7 +2198,6 @@ int TSystemisamfile::update( } i0->fhnd=DB_open((const char*)tmpfname,0, TRUE); if (i0->fhnd < 0 ) err=get_error(i0->fhnd); - TFilename fname(filename()); TString s(80), fld_name, fld_val; s.format("Aggiornamento archivio %s", (const char*) fname); TProgind p(nitems ? nitems : 1, s, TRUE, TRUE, 70); diff --git a/include/printapp.cpp b/include/printapp.cpp index 6c9702705..6b4b7fb03 100755 --- a/include/printapp.cpp +++ b/include/printapp.cpp @@ -700,6 +700,7 @@ void TPrint_application::set_row ( int size = 0, dec = 0, strind = 0; char ch, align = 'l'; + CHECK (strlen(frmt) <120, "Te c'hai grossa crisi: la stringa di formato non può essere più lunga di 120 chars"); // let the poor programmer use format() at will strcpy (fmt, frmt); _print_defined = TRUE; @@ -1456,7 +1457,8 @@ bool TPrint_application::print_one ( if (!(printer().print(*pr))) break; } - if (_auto_ff && last /* _maxrox */ < printer().formlen ()) + //if (_auto_ff && last /* _maxrox */ < printer().formlen ()) + if (_auto_ff && printer().rows_left() > 0) printer().formfeed (); delete pos; diff --git a/include/sheet.cpp b/include/sheet.cpp index dbac42b1a..be9b706ab 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -197,7 +197,7 @@ TSheet_control::TSheet_control( rct.top, rct.left, rct.bottom-rct.top, XI_ATR_ENABLED | XI_ATR_VISIBLE, NORMAL_COLOR, NORMAL_BACK_COLOR, // normal - DISABLED_COLOR, DISABLED_BACK_COLOR, // disabled + NORMAL_COLOR, DISABLED_BACK_COLOR, // disabled FOCUS_COLOR, // active 0); @@ -743,7 +743,7 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev) if (_disabled[rec]) { -// xiev->v.cell_request.color = DISABLED_COLOR; // Uniforme coi TField_control + xiev->v.cell_request.color = NORMAL_COLOR; xiev->v.cell_request.back_color = DISABLED_BACK_COLOR; } else diff --git a/include/stdtypes.cpp b/include/stdtypes.cpp index cfd4e704a..1a74ba589 100755 --- a/include/stdtypes.cpp +++ b/include/stdtypes.cpp @@ -166,13 +166,15 @@ void init_global_vars() // @func Dealloca le variabili globali void free_global_vars() -{ +{ +#ifndef _DEMO_ #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 if (_login_status == 2) rpc_UserLogout(); else HL_LOGOUT(); -#endif +#endif +#endif // _DEMO_ if (openf != NULL) {