Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Riportata la versione 98.01.03pl015


git-svn-id: svn://10.65.10.50/trunk@6581 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1998-04-30 15:31:34 +00:00
parent 2eb4a2460d
commit 5e6ec4d235
23 changed files with 895 additions and 435 deletions

View File

@ -16,12 +16,21 @@
#include <bagn002.h>
<<<<<<< applicat.cpp
=======
// #define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
>>>>>>> 1.90.2.4
///////////////////////////////////////////////////////////
// Metodi di accesso globali all'applicazione corrente
///////////////////////////////////////////////////////////
HIDDEN TApplication* _application = NULL;
<<<<<<< applicat.cpp
HIDDEN bool _xvt_running = FALSE;
=======
HIDDEN BOOL _xvt_running = FALSE;
>>>>>>> 1.90.2.4
// @doc EXTERNAL
@ -563,8 +572,18 @@ void TApplication::run(
_name = cmd2name(argv[0]);
}
<<<<<<< applicat.cpp
const int sn = get_serial_number();
=======
if (use_files())
init_global_vars();
else
CGetPref();
const int sn = get_serial_number();
>>>>>>> 1.90.2.4
if (sn < 0)
{
error_box("Probabilmente non e' stata inserita la chiave di protezione");
@ -618,8 +637,13 @@ bool TApplication::get_version_info(int& year, int& release, int& tag, int& patc
// About box: risposta alla opzione Informazioni del menu File
void TApplication::about() const
{
<<<<<<< applicat.cpp
const TFilename n(argv(0));
const word ser_no = dongle().number();
=======
const TFilename n(__argv[0]);
const word ser_no = dongle().number();
>>>>>>> 1.90.2.4
int year, release, tag, patch;
if (get_version_info(year, release, tag, patch))

View File

@ -68,7 +68,7 @@ bool error_box(
// @comm Se si opera in ambiente Windows crea la finestra con il bottone OK
// e l'icona punto esclamativo.
{
buildmsg();
buildmsg();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
MessageBeep(MB_ICONEXCLAMATION);
@ -151,10 +151,35 @@ bool sorry_box(
return 0;
}
// @doc EXTERNAL
// @msg yesno_box | Crea una finestra di RICHIESTA con il relativo messaggio
bool yesno_box(
int noyes_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
{
buildmsg();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
MessageBeep(MB_ICONQUESTION);
int r = MessageBox(GetFocus(), msg, "RICHIESTA",
MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2);
return r == IDYES;
#else
ASK_RESPONSE r = xvt_dm_post_ask((char*) "No", (char*) "Si", NULL, "%s", msg);
if (r == RESP_DEFAULT) r = K_NO;
else
if (r == RESP_2) r = K_YES;
return r;
#endif
}
// @doc EXTERNAL
// @msg yesno_box | Crea una finestra di RICHIESTA con il relativo messaggio
int yesno_box(
const char* fmt, // @parm Messaggio da stampare nella finestra
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>

View File

@ -8,13 +8,13 @@
#ifdef __cplusplus
extern "C" {
#endif
bool message_box(const char* fmt, ...);
bool warning_box(const char* fmt, ...);
bool sorry_box(const char* fmt, ...);
bool error_box(const char* fmt, ...);
bool fatal_box(const char* fmt, ...);
bool yesno_box(const char* fmt, ...);
bool noyes_box(const char* fmt, ...);
int message_box(const char* fmt, ...);
int warning_box(const char* fmt, ...);
int sorry_box(const char* fmt, ...);
int error_box(const char* fmt, ...);
int fatal_box(const char* fmt, ...);
int noyes_box(const char* fmt, ...);
int yesno_box(const char* fmt, ...);
int yesnocancel_box(const char* fmt, ...);
bool yesnofatal_box(const char* fmt, ...);
bool __trace(const char* fmt, ...);

View File

@ -53,6 +53,10 @@ extern char* CUpString(char *);
static CODE4 code_base;
static DATA4 *dbdata[CB4FILES];
bool handle_ok(int handle)
{
return handle >= 0 && handle < CB4FILES && dbdata[handle] !=0;
}
static char * find_slash_backslash(char * str)
{
@ -145,7 +149,7 @@ int DB_open(const char *filename,int mode,int index)
--------------------------------------------------------------------------*/
int DB_close(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
d4close(dbdata[handle]);
dbdata[handle]=(DATA4 *) 0;
code_base.errorCode=0;
@ -158,7 +162,7 @@ int DB_close(int handle)
--------------------------------------------------------------------------*/
char *DB_getrecord(int handle)
{
if(dbdata[handle]==0) return((char *) 0);
if(!handle_ok(handle)) return((char *) 0);
return(d4record(dbdata[handle]));
}
@ -167,7 +171,7 @@ char *DB_getrecord(int handle)
--------------------------------------------------------------------------*/
int DB_reclen(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return((int) d4recWidth(dbdata[handle]));
}
@ -185,7 +189,7 @@ int DB_keylen(int handle)
--------------------------------------------------------------------------*/
long int DB_recno(int handle)
{
if(dbdata[handle]==0) return(-1L);
if(!handle_ok(handle)) return(-1L);
return(d4recNo(dbdata[handle]));
}
@ -194,7 +198,7 @@ long int DB_recno(int handle)
--------------------------------------------------------------------------*/
long int DB_reccount(int handle)
{
if(dbdata[handle]==0) return(-1L);
if(!handle_ok(handle)) return(-1L);
return(d4recCount(dbdata[handle]));
}
@ -207,7 +211,7 @@ int DB_tagselect(int handle,int index_no)
TAG4 *tt;
int i;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
/* si posiziona sul primo indice */
tt=d4tagNext(dbdata[handle],NULL);
if(tt==NULL) return(-1);
@ -229,7 +233,7 @@ int DB_tagget(int handle)
TAG4 *tt,*tt1;
int i;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
/* si posiziona sul primo indice */
tt=d4tagDefault(dbdata[handle]);
if(tt==NULL) return(-1);
@ -249,7 +253,7 @@ int DB_tagget(int handle)
--------------------------------------------------------------------------*/
int DB_first(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4top(dbdata[handle]));
}
@ -260,7 +264,7 @@ int DB_first(int handle)
--------------------------------------------------------------------------*/
int DB_last(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4bottom(dbdata[handle]));
}
@ -270,7 +274,7 @@ int DB_last(int handle)
--------------------------------------------------------------------------*/
int DB_next(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4skip(dbdata[handle],1L));
}
@ -279,7 +283,7 @@ int DB_next(int handle)
--------------------------------------------------------------------------*/
int DB_prev(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4skip(dbdata[handle],-1L));
}
@ -289,7 +293,7 @@ int DB_prev(int handle)
--------------------------------------------------------------------------*/
int DB_skip(int handle,long int recno)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4skip(dbdata[handle],recno));
}
@ -298,7 +302,7 @@ int DB_skip(int handle,long int recno)
--------------------------------------------------------------------------*/
int DB_lock(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4lock(dbdata[handle],d4recNo(dbdata[handle])));
}
@ -307,7 +311,7 @@ int DB_lock(int handle)
--------------------------------------------------------------------------*/
int DB_unlock(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4unlock(dbdata[handle]));
}
@ -320,7 +324,7 @@ int DB_seek(int handle,char *key)
int rc, len;
const char * k;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
rc = d4seek(dbdata[handle],key);
if (rc)
return rc;
@ -342,7 +346,7 @@ int DB_seek(int handle,char *key)
--------------------------------------------------------------------------*/
int DB_eof(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4eof(dbdata[handle]));
}
@ -351,7 +355,7 @@ int DB_eof(int handle)
--------------------------------------------------------------------------*/
int DB_bof(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4bof(dbdata[handle]));
}
@ -360,7 +364,7 @@ int DB_bof(int handle)
--------------------------------------------------------------------------*/
int DB_go(int handle,long recno)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4go(dbdata[handle],recno));
}
@ -369,7 +373,8 @@ int DB_go(int handle,long recno)
--------------------------------------------------------------------------*/
int DB_delete(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
d4delete(dbdata[handle]);
return(0);
}
@ -380,7 +385,7 @@ int DB_delete(int handle)
int DB_recall(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
d4recall(dbdata[handle]);
return(0);
}
@ -391,7 +396,7 @@ int DB_recall(int handle)
int DB_rewrite(int handle)
{
int rt;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
while ((rt=d4write(dbdata[handle],d4recNo(dbdata[handle]))) == r4locked)
#ifdef DBG
yesnofatal_box("Sono in attesa nella DB_rewrite");
@ -488,7 +493,7 @@ int DB_lockfile(int handle)
{
int rt;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
rt = d4lockFile(dbdata[handle]);
if (rt==0) rt=d4lockIndex(dbdata[handle]);
return(rt);
@ -1061,7 +1066,7 @@ int DB_index_seek(int handle, char* from)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
if (tfile4seek(t->tagFile,from,strlen(from)) < 0) return(DB_get_error());
@ -1077,7 +1082,7 @@ long DB_index_recno(int handle)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
return(tfile4recNo(t->tagFile));
@ -1090,7 +1095,7 @@ long DB_index_next(int handle)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
return(tfile4skip(t->tagFile,1L));
@ -1108,7 +1113,7 @@ char* DB_index_getkey(int handle)
if (key == NULL)
key = malloc(MAXLEN);
if(dbdata[handle]==0)
if(!handle_ok(handle))
return(NULL);
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(NULL);
klen=a4tagKeyLen(dbdata[handle]);
@ -1126,7 +1131,7 @@ int DB_index_eof(int handle)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
return(tfile4eof(t->tagFile));
}
@ -1137,7 +1142,7 @@ int DB_index_eof(int handle)
int DB_lock_rec(int handle,long nrec)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if(d4lock(dbdata[handle],nrec)==r4locked) return(-1);
else return(0);
}
@ -1150,7 +1155,7 @@ int DB_lock_rec(int handle,long nrec)
int DB_file_locked(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return a4lockTest(dbdata[handle]);
}
@ -1161,7 +1166,7 @@ int DB_file_locked(int handle)
int DB_rec_locked(int handle,long nrec)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4lockTest(dbdata[handle],nrec));
}
@ -1236,9 +1241,10 @@ extern char* CUpString(char *);
static CODE4 code_base;
static DATA4 *dbdata[CB4FILES];
// #include <x4filter.h>
// static X4FILTER xdb[CB4FILES];
bool handle_ok(int handle)
{
return handle >=0 && handle < CB4FILES && dbdata[handle] !=0;
}
static char * find_slash_backslash(char * str)
{
@ -1338,7 +1344,7 @@ int DB_open(const char *filename,int mode, int index)
--------------------------------------------------------------------------*/
int DB_close(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
d4close(dbdata[handle]);
dbdata[handle]=(DATA4 *) 0;
code_base.error_code=0;
@ -1351,7 +1357,7 @@ int DB_close(int handle)
--------------------------------------------------------------------------*/
char *DB_getrecord(int handle)
{
if(dbdata[handle]==0) return((char *) 0);
if(!handle_ok(handle)) return((char *) 0);
return(d4record(dbdata[handle]));
}
@ -1360,7 +1366,7 @@ char *DB_getrecord(int handle)
--------------------------------------------------------------------------*/
int DB_reclen(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return((int) d4record_width(dbdata[handle]));
}
@ -1372,7 +1378,7 @@ int DB_keylen(int handle)
{
TAG4 *t;
if (dbdata[handle]==0) return(-1);
if (!handle_ok(handle)) return(-1);
if ((t=d4tag_default(dbdata[handle]))== NULL) return (-1);
return(expr4key_len(t->expr));
}
@ -1382,7 +1388,7 @@ int DB_keylen(int handle)
--------------------------------------------------------------------------*/
long int DB_recno(int handle)
{
if(dbdata[handle]==0) return(-1L);
if(!handle_ok(handle)) return(-1L);
return(d4recno(dbdata[handle]));
}
@ -1391,7 +1397,7 @@ long int DB_recno(int handle)
--------------------------------------------------------------------------*/
long int DB_reccount(int handle)
{
if(dbdata[handle]==0) return(-1L);
if(!handle_ok(handle)) return(-1L);
return(d4reccount(dbdata[handle]));
}
@ -1404,7 +1410,7 @@ int DB_tagselect(int handle,int index_no)
TAG4 *tt;
int i;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
/* si posiziona sul primo indice */
tt=d4tag_next(dbdata[handle],NULL);
if(tt==NULL) return(-1);
@ -1426,7 +1432,7 @@ int DB_tagget(int handle)
TAG4 *tt,*tt1;
int i;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
/* si posiziona sul primo indice */
tt=d4tag_selected(dbdata[handle]);
if(tt==NULL) return(-1);
@ -1446,7 +1452,7 @@ int DB_tagget(int handle)
--------------------------------------------------------------------------*/
int DB_first(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4top(dbdata[handle]));
}
@ -1457,7 +1463,7 @@ int DB_first(int handle)
--------------------------------------------------------------------------*/
int DB_last(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4bottom(dbdata[handle]));
}
@ -1467,7 +1473,7 @@ int DB_last(int handle)
--------------------------------------------------------------------------*/
int DB_next(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4skip(dbdata[handle],1L));
}
@ -1476,7 +1482,7 @@ int DB_next(int handle)
--------------------------------------------------------------------------*/
int DB_prev(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4skip(dbdata[handle],-1L));
}
@ -1486,7 +1492,7 @@ int DB_prev(int handle)
--------------------------------------------------------------------------*/
int DB_skip(int handle,long int recno)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4skip(dbdata[handle],recno));
}
@ -1495,7 +1501,7 @@ int DB_skip(int handle,long int recno)
--------------------------------------------------------------------------*/
int DB_lock(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4lock(dbdata[handle],d4recno(dbdata[handle])));
}
@ -1504,7 +1510,7 @@ int DB_lock(int handle)
--------------------------------------------------------------------------*/
int DB_unlock(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4unlock(dbdata[handle]));
}
@ -1518,7 +1524,7 @@ int DB_seek(int handle,char *key)
TAG4 * tt;
char * k;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
rc = d4seek(dbdata[handle],key);
if (rc)
return rc;
@ -1541,7 +1547,7 @@ int DB_seek(int handle,char *key)
--------------------------------------------------------------------------*/
int DB_eof(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4eof(dbdata[handle]));
}
@ -1550,7 +1556,7 @@ int DB_eof(int handle)
--------------------------------------------------------------------------*/
int DB_bof(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4bof(dbdata[handle]));
}
@ -1559,7 +1565,7 @@ int DB_bof(int handle)
--------------------------------------------------------------------------*/
int DB_go(int handle,long recno)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
// return(d4go(&xdb[handle],recno));
return(d4go(dbdata[handle],recno));
}
@ -1570,7 +1576,7 @@ int DB_go(int handle,long recno)
int DB_delete(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
d4delete(dbdata[handle]);
return(0);
}
@ -1581,7 +1587,7 @@ int DB_delete(int handle)
int DB_recall(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
d4recall(dbdata[handle]);
return(0);
}
@ -1599,7 +1605,7 @@ int DB_delkey(int handle, char* key, long recno)
/* (dati o indice) da me stesso*/
char fn[64];
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
t=d4tag_default(dbdata[handle]);
if (u4switch() & 2 || u4switch() & 8) /* Clipper & DBIII */
@ -1647,7 +1653,7 @@ int DB_flush(int handle)
int DB_rewrite(int handle)
{
int rt;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
while ((rt=d4write(dbdata[handle],d4recno(dbdata[handle]))) == r4locked)
#ifdef DBG
yesnofatal_box("Sono in attesa nella DB_rewrite");
@ -1744,7 +1750,7 @@ int DB_lockfile(int handle)
{
int rt;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
rt = d4lock_file(dbdata[handle]);
if (rt==0) rt=d4lock_index(dbdata[handle]);
return(rt);
@ -1895,7 +1901,7 @@ int DB_packfile(short vis, const char * filename, long eod)
int rt=0,handle;
/*
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
codebase.auto_open = 0 cosi' non apre gli indici
*/
code_base.auto_open = 0;
@ -2345,7 +2351,7 @@ int DB_index_seek(int handle, char* from)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
if (t4seek(t,from,strlen(from)) < 0) return(DB_get_error());
@ -2361,7 +2367,7 @@ long DB_index_recno(int handle)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
return(t4recno(t));
@ -2374,7 +2380,7 @@ long DB_index_next(int handle)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
return(t4skip(t,1L));
@ -2393,7 +2399,7 @@ char* DB_index_getkey(int handle)
if (key == NULL)
key = malloc(MAXLEN);
if(dbdata[handle]==0)
if(!handle_ok(handle))
return NULL;
if ((t=d4tag_default(dbdata[handle]))==NULL) return(NULL);
@ -2412,7 +2418,7 @@ int DB_index_eof(int handle)
{
TAG4 *t;
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
return(t4eof(t));
}
@ -2423,7 +2429,7 @@ int DB_index_eof(int handle)
int DB_lock_rec(int handle,long nrec)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if(d4lock(dbdata[handle],nrec)==r4locked) return(-1);
else return(0);
}
@ -2436,7 +2442,7 @@ int DB_lock_rec(int handle,long nrec)
int DB_file_locked(int handle)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4lock_test_file(dbdata[handle]) + d4lock_test_index(dbdata[handle]));
}
@ -2447,7 +2453,7 @@ int DB_file_locked(int handle)
int DB_rec_locked(int handle,long nrec)
{
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
return(d4lock_test(dbdata[handle],nrec));
}
@ -2469,7 +2475,7 @@ long DB_changed(int handle)
INDEX4 *i;
char fn[64];
if(dbdata[handle]==0) return(-1);
if(!handle_ok(handle)) return(-1);
if (u4switch() & 2 || u4switch() & 8) /* Clipper & DBIII */
u4name_piece(fn,64,dbdata[handle]->file.name,0,0);
else

View File

@ -83,8 +83,7 @@ void TConfig::_write_paragraph(
for (THash_object* o = _data.get_hashobj(); o; o = _data.get_hashobj())
out << o->key() << " = " << (TString&)(o->obj()) << '\n';
*/
TString_array a; list_variables(a, FALSE);
a.sort();
TString_array a; list_variables(a, FALSE,_paragraph,TRUE); // get array sorted by varname
for (int i = 0; i < a.items(); i++)
{
TToken_string& name = a.row(i);
@ -159,7 +158,8 @@ bool TConfig::set_paragraph(const char* section)
_write_file();
_paragraph = section;
_dirty = FALSE;
ok = _read_paragraph();
_ispresent = _read_paragraph();
ok = _ispresent;
}
return ok;
}
@ -583,8 +583,42 @@ int TConfig::list_paragraphs(TString_array& pl)
return pl.items();
}
<<<<<<< config.cpp
int TConfig::list_variables(TString_array& vl, bool value, const char* section)
{
=======
HIDDEN int compare_ini_variables(const TObject**o1, const TObject**o2)
{
const TString* s1 = (const TString*)*o1;
const TString* s2 = (const TString*)*o2;
const int p1 = s1->find('(');
if (p1 < 0)
return strcmp(*s1, *s2);
else
{
// variabile tipo XX(i)
int result= strncmp(*s1, *s2,p1);
if (result==0)
{
if (s2->find('(')<0)
result = 1;
else
{
CHECKS(s1->find(')')>=0,"Errore: parentesi non chiusa in ",(const char *)(*s1));
CHECKS(s2->find(')')>=0,"Errore: parentesi non chiusa in ",(const char *)(*s2));
const int i1=atoi(s1->sub(p1+1,s1->len()-1));
const int i2=atoi(s2->sub(p1+1,s2->len()-1));
result = i1-i2;
}
}
return result;
}
}
int TConfig::list_variables(TString_array& vl, bool value, const char* section, const bool sort)
{
>>>>>>> 1.54.2.5
set_paragraph(section);
vl.destroy();
_data.restart();
@ -597,6 +631,9 @@ int TConfig::list_variables(TString_array& vl, bool value, const char* section)
vl.add(t);
}
if (sort)
vl.TArray::sort(compare_ini_variables);
return vl.items();
}

View File

@ -133,8 +133,8 @@ public:
// @cmember Riempie <p vl> con la lista dei nomi delle variabili
// nella sezione corrente o in quella indicata; se
// add_value e' TRUE ci mette "variabile<pipe>valore"
// ACHTUNG: l'array e' in ordine HASH
int list_variables(TString_array& vl, bool add_value = FALSE, const char* section = NULL);
// se sort=TRUE, l'array è ordinato per nomevar(i), altrimenti è in ordine HASH
int list_variables(TString_array& vl, bool add_value = FALSE, const char* section = NULL, const bool sort=FALSE);
// @cmember Ritorna l'intero array delle variabili della sezione
// eventualmente specificata da <p section>

View File

@ -84,11 +84,19 @@ KEY TControl::xiev_to_key(const XI_EVENT* xiev)
KEY key = k;
if (key < K_INS || key > K_HELP)
{
<<<<<<< controls.cpp
if (xiev->v.chr.shift && (k < ' ' || k >= K_UP)) key += K_SHIFT;
// if (xiev->v.chr.control && k >= ' ') key += K_CTRL;
// Correzione per gestire i tasti AltGr sulle tastiere non U.S.A.
if (xiev->v.chr.control && ((k >= K_F1 && k <= K_F12) || isalnum(k) || strchr("\r+-*/", k)))
key += K_CTRL;
=======
if (xiev->v.chr.shift && (k < ' ' || k >= K_UP)) key += K_SHIFT;
//if (xiev->v.chr.control && k >= ' ') key += K_CTRL;
// Correzione per gestire i tasti AltGr sulle tastiere non U.S.A.
if (xiev->v.chr.control && (k > K_SHIFT || (k >= K_F1 && k <= K_F12) || isalnum(k) || strchr("\r+-*/",k) != NULL))
key += K_CTRL;
>>>>>>> 1.99.2.1
}
return key;
}
@ -444,9 +452,17 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
def->v.itf->tab_on_enter = TRUE;
def->v.itf->win = win;
<<<<<<< controls.cpp
def->v.itf->edit_menu = TRUE; // Update edit menu items
def->v.itf->menu_win = TASK_WIN; // Window that owns the menu
=======
#ifdef XI_R4
def->v.itf->edit_menu = TRUE; // Update edit menu items
def->v.itf->menu_win = TASK_WIN; // Window that owns the menu
#endif
>>>>>>> 1.99.2.1
XI_OBJ* itf = xi_create(NULL, def);
CHECK(itf, "Can't create an interface");

View File

@ -151,7 +151,7 @@ bool TDate::is_end_month()
return day() == last_day(month(),year());
}
bool TDate::empty()
bool TDate::empty() const
{
return _val == 0;
}

View File

@ -103,7 +103,7 @@ public:
// @cmember Setta il giorno del mese all'ultimo possibile
void set_end_month();
// @cmember Controlla se la data è nulla
bool empty();
bool empty() const ;
// @cmember Setta la il giorno
void set_day(int n);

View File

@ -802,9 +802,9 @@ void TForm_item::send_message_to_group(const char * cmd,byte id,const TPrint_sec
}
// look into sections beside ("brothers" )
for (int j = 0; j < section.subsections(); j++) {
const TPrint_section &bs=section.subsection(j)->subsection();
const TPrint_section &bs=section.subsection(j)->printsection();
if (&bs!=starting_section) {
send_message_to_group(cmd,id,section.subsection(j)->subsection(),&section);
send_message_to_group(cmd,id,section.subsection(j)->printsection(),&section);
}
}
}
@ -1004,7 +1004,8 @@ short TForm_item::x()
TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm)
: TForm_item(s), _ssec(&(s->form()), s->section_type(), s->page_type()),
_file_id(-1), _name(nm), _condexpr(NULL)
_file_id(-1), _name(nm), _condexpr(NULL),
_title_section(NULL),_qtitle_section(NULL),_title_type(type_notitle),_show_title(FALSE)
{
_ssec.set_subsection_above(this);
}
@ -1012,6 +1013,7 @@ TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm)
TForm_subsection::~TForm_subsection()
{
if (_condexpr) delete _condexpr;
// _title_section e _qtitle_section sono puntatori a subsection contenute nel corpo, quindi non vanno deallocati
}
TObject* TForm_subsection::dup() const
@ -1021,7 +1023,20 @@ TObject* TForm_subsection::dup() const
fs->_ssec = _ssec;
fs->_name = _name;
fs->_file_id = _file_id;
fs->_condexpr=new TExpression((const char *)_condexpr);
fs->_title_type = _title_type;
fs->_show_title=_show_title;
if (_condexpr)
fs->_condexpr=new TExpression((const char *)_condexpr);
else
fs->_condexpr=NULL;
if (_title_section)
fs->_title_section=(TForm_subsection* )_title_section->dup();
else
fs->_title_section=NULL;
if (_qtitle_section)
fs->_qtitle_section=(TForm_subsection* )_qtitle_section->dup();
else
fs->_qtitle_section=NULL;
return fs;
}
@ -1043,12 +1058,50 @@ void TForm_subsection::setcondition(const char * cond,TTypeexp type)
{
if (_condexpr) {
if (_file_id!=-1)
subsection().set_subs_cond(_file_id,cond,_condexpr->string());
printsection().set_subs_cond(_file_id,cond,_condexpr->string());
delete _condexpr;
}
_condexpr=new TExpression(cond,type);
}
// imposta la sottosezione titolo
void TForm_subsection::set_title_section(TForm_subsection* s)
{
if (_title_section) delete _title_section;
_title_section=s;
}
// imposta la sottosezione titolo di coda
void TForm_subsection::set_qtitle_section(TForm_subsection* s)
{
if (_qtitle_section) delete _qtitle_section;
_qtitle_section=s;
}
void TPrint_section::print_title()
{
TPrinter& pr = printer();
if (pr.current_row() > pr.headersize()+1)
if (word(height()) > pr.rows_left())
pr.formfeed();
word last_printed_row=0;
const word maxs=(word)subsections() ;
for (word s = 0; s < (word)maxs ;s++)
{
TForm_subsection &ssec=*subsection(s);
for (; last_printed_row < (word)ssec.y() -1;last_printed_row++)
pr.print(titlerow(last_printed_row));
if (ssec.shown())
ssec.printsection().print_title();
}
for (; last_printed_row < (word)height() ;last_printed_row++)
pr.print(titlerow(last_printed_row));
}
void TPrint_section::set_subs_cond(int file,const char *newcond,const char * oldcond)
{
TForm_subsection * s;
@ -1078,11 +1131,45 @@ TForm_subsection *TForm_subsection::upper_conditional() const
return NULL;
}
// Esegue una post visita dell'albero delle subsection, stampando tutte le section "Titolo"
bool TForm_subsection::print_titles()
{
if (section().subsection_above())
section().subsection_above()->print_titles();
bool ok=TRUE;
// print the title
if (_title_section != NULL && _title_section->_show_title)
{
if ( shown() && _title_section->shown() )
{
_title_section->printsection().print_title();
}
_title_section->show_title(FALSE);
}
return ok;
}
bool TForm_subsection::print_qtitle()
{
bool ok=TRUE;
// print the title
if (_qtitle_section != NULL)
{
if (shown() && _qtitle_section->shown())
{
print_titles();
_qtitle_section->printsection().print_title();
}
}
return ok;
}
bool TForm_subsection::parse(TScanner& s)
{
_section->add_subsection(this);
name(s.pop());
//_width = s.integer(); // ...unused
//_x = s.integer(); // ...unused
@ -1112,6 +1199,18 @@ bool TForm_subsection::parse(TScanner& s)
_condexpr = new TExpression(s.line(),_numexpr); //
else if (s.key() == "ST") // ST_RING CONDITION di gestione della sezione
_condexpr = new TExpression(s.line(),_strexpr); //
else if (s.key() == "HE") // sottosezione HE_ADER (titolo), stampa solo se altr sotto sez verranno stampati
{
_title_type=type_title;
if (section().subsection_above())
section().subsection_above()->set_title_section(this);
}
else if (s.key() == "FO") // sottosezione FO_OOTER (titolo di coda), stampato solo se altr sotto sez verranno stampati
{
_title_type=type_qtitle;
if (section().subsection_above())
section().subsection_above()->set_qtitle_section(this);
}
else if (s.key() != "GR") // GR_OUP section (raggruppamento puro)
s.push();
}
@ -1123,26 +1222,38 @@ bool TForm_subsection::parse(TScanner& s)
// nel caso di subsection viene chiamata la set_body anzichè la update
bool TForm_subsection::update()
{ return TRUE;}
{
return TRUE;
}
bool TForm_subsection::set_body(bool showfields)
bool TForm_subsection::print_body(sec_print_mode showfields)
{
bool ok = FALSE;
TCursor* cur = form().cursor();
TRelation* rel = (TRelation* )form().relation();
if (!enabled()) return FALSE;
if (!enabled() )
return FALSE;
if (is_title())
{
show_title(TRUE);
showfields=printmode_title ; // calcola e bufferizza ora, rimanda la stampa dopo ...
}
if (!shown())
showfields = printmode_noprint;
if (cur == NULL || (_file_id == -1 && _condexpr==NULL)) // ...unused
ok = _ssec.update_and_print(showfields && shown(),atnewpage());
ok = _ssec.update_and_print(showfields,atnewpage());
else if (_file_id == -1 && _condexpr!=NULL) // subsection condizionale
{
if ((bool)(_section->eval_expr(*_condexpr,_file_id)))
ok = _ssec.update_and_print(showfields && shown(),atnewpage());
ok = _ssec.update_and_print(showfields,atnewpage());
}
else
{
_ssec.set_repeat_count(0);
if (_condexpr) { // sottosezione di raggruppamenti su file
int i = 0;
TString group_expr((const char *)(_section->eval_expr(*_condexpr,_file_id)));
@ -1152,8 +1263,7 @@ bool TForm_subsection::set_body(bool showfields)
form().match_result(_file_id);
if (!_bigskip || i==0)
{
if (!(ok = _ssec.update_and_print(showfields && shown(),atnewpage())))
break;
ok |= _ssec.update_and_print(showfields,atnewpage());
_ssec.set_repeat_count(++i);
}
if (form().next_match_done(_file_id))
@ -1163,8 +1273,8 @@ bool TForm_subsection::set_body(bool showfields)
again=cur->next_match(_file_id) ;
form().match_result(_file_id,again); // store if a match occoured
}
}
_ssec.set_repeat_count(0);
}
// _ssec.set_repeat_count(0);
} else { // sottosezione di file
int i = 0;
if (cur->is_first_match(_file_id))
@ -1172,18 +1282,19 @@ bool TForm_subsection::set_body(bool showfields)
bool again;
do {
form().match_result(_file_id);
if (!(ok = _ssec.update_and_print(showfields && shown(),atnewpage())))
break;
ok |= _ssec.update_and_print(showfields,atnewpage());
_ssec.set_repeat_count(++i);
if (form().next_match_done(_file_id))
again=form().last_match_result(_file_id);
else
again= cur->next_match(_file_id);
} while (again);
ok |=_ssec.repeat_count()>0; // (ovvero, sempre true: se c'e' un first match)
}
_ssec.set_repeat_count(0);
// _ssec.set_repeat_count(0);
}
}
return ok;
}
@ -1517,7 +1628,7 @@ void TForm_string::apply_format(TString& s) const
}
}
if (class_name() == "DATA" && s.empty())
if (strcmp(class_name(),"DATA")==0 && s.empty())
tmp ="";
else
tmp.picture(pic, s); // riempi la stringa col valore pitturato
@ -2230,7 +2341,7 @@ word TPrint_section::height() const
}
else
{
h = items();
h = _rows.items();
if (h == 0)
h = 0xFFFF - _height + 1; // Same as abs(_height)
}
@ -2313,21 +2424,35 @@ const TPrint_section& TPrint_section::copy(const TPrint_section& ps)
{
_msk = ps._msk; _height = ps._height; _ofspc = ps._ofspc;
_ofsvr = ps._ofsvr; _nfld = ps._nfld; _dirty = ps._dirty;
_columnwise = ps._columnwise; _temp = ps._temp; _form = ps._form;
_sec_type = ps._sec_type; _page_type = ps._page_type; _upsection = ps._upsection;
_item = ps._item; _repeat_count = ps._repeat_count;
_subsections=ps._subsections;
_temp = ps._temp; _form = ps._form;
_sec_type = ps._sec_type; _page_type = ps._page_type;
_item = ps._item;
// subsections
_upsection = ps._upsection; _repeat_count = ps._repeat_count; _subsections=ps._subsections;
// columnwise
_columnwise = ps._columnwise;
for (int i = 0; i < MAXCOLUMNS; i++) _tab[i] = ps._tab[i];
return ps;
}
TPrintrow& TPrint_section::row(int num)
{
TPrintrow* pr = (TPrintrow*)objptr(num);
TPrintrow* pr = (TPrintrow*)_rows.objptr(num);
if (pr == NULL)
{
pr = new TPrintrow;
add(pr, num);
_rows.add(pr, num);
}
return *pr;
}
TPrintrow& TPrint_section::titlerow(int num)
{
TPrintrow* pr = (TPrintrow*)_titlerows.objptr(num);
if (pr == NULL)
{
pr = new TPrintrow;
_titlerows.add(pr, num);
}
return *pr;
}
@ -2409,7 +2534,7 @@ word TPrint_section::subs_height() const
{
fss=subsection(0);
h=subsection(0)->height();
h+=subsection(0)->subsection().subs_height(); // ricorsione...
h+=subsection(0)->printsection().subs_height(); // ricorsione...
}
return h;
}
@ -2499,10 +2624,10 @@ bool TPrint_section::parse(TScanner& scanner)
// Azzera tutte le righe della sezione di stampa
void TPrint_section::reset()
{
for (int i = last(); i >= 0; i--)
for (int i = _rows.last(); i >= 0; i--)
{
if (_height > 0xF000)
destroy(i);
_rows.destroy(i);
else
row(i).reset();
}
@ -3248,9 +3373,9 @@ TForm_item *TPrint_section::find_field_everywhere(short id,const TPrint_section
// look into sections beside ("brothers" )
for (int j = 0; j < subsections(); j++)
{
const TPrint_section &bs=subsection(j)->subsection();
const TPrint_section &bs=subsection(j)->printsection();
if (&bs!=starting_section) {
f=subsection(j)->subsection().find_field_everywhere(id,this);
f=bs.find_field_everywhere(id,this);
if (f)
return f;
}
@ -3278,7 +3403,7 @@ TForm_item *TPrint_section::find_field_everywhere(const char *sec_name,const TPr
}
// search down
for (j = 0; j < subsections(); j++) {
TForm_item *it=subsection(j)->subsection().find_field_everywhere(sec_name,starting_section);
TForm_item *it=subsection(j)->printsection().find_field_everywhere(sec_name,starting_section);
if (it)
return it;
}
@ -3758,7 +3883,7 @@ bool TForm::ps_change_date_format(
TForm_item& fi = s.field(i);
if (fi.is_section())
{
TPrint_section& ps = ((TForm_subsection&)fi).subsection();
TPrint_section& ps = ((TForm_subsection&)fi).printsection();
ps_change_date_format(ps, f);
}
else if (strcmp(fi.class_name(), "DATA") == 0)
@ -3790,7 +3915,7 @@ bool TForm::ps_change_number_format(
TForm_item& fi = s.field(i);
if (fi.is_section())
{
TPrint_section& ps = ((TForm_subsection&)fi).subsection();
TPrint_section& ps = ((TForm_subsection&)fi).printsection();
ps_change_number_format(ps, w, dec, p);
}
else if (strcmp(fi.class_name(), "NUMERO") == 0)
@ -3897,7 +4022,7 @@ word TForm::set_body(
{
TPrint_section& body = section('B', p);
if (u) body.update_and_print(TRUE);
if (u) body.update_and_print(printmode_normal);
else body.reset();
return body.height();
@ -3912,68 +4037,80 @@ TPrint_section * TPrint_section::section_above() const
// @doc EXTERNAL
// @mfunc Compone e stampa tutte le righe della sezione (valida in caso di BODY)
//
bool TPrint_section::update_and_print(bool show_fields, bool new_page)
// ritorna se c'e' stata una valutazione
bool TPrint_section::update_and_print(const sec_print_mode show_fields, bool new_page)
{
bool ok=TRUE;
TPrinter& pr = printer();
word last_printed_row=0;
bool ok=FALSE;
TPrinter& pr = printer();
word last_printed_row=0;
reset();
if (show_fields
&& pr.current_row() > pr.headersize()+1
&& new_page)
{
pr.formfeed();
}
for (word i = 0; i < fields(); i++)
{
if (!field(i).is_section())
{ // compose rows using "simple" fields
const bool esito = field(i).update();
if (!esito) ok = FALSE;
}
else
{
TForm_subsection & ss=(TForm_subsection & )field(i);
int last_hpos=min(word(field(i).y()-1), height());
// found a subsection:print preceeding rows
// preceeding rows are all section rows which have Y coord <= than subsection's Y
if (show_fields && pr.current_row() > pr.headersize()+1)
{
if (word(last_hpos+ss.height()) > pr.rows_left())
pr.formfeed();
}
for (word j = last_printed_row; show_fields && j < (word)last_hpos ;j++)
{
pr.print(row(j));
}
last_printed_row=j;
// process subsection
if (ss.enabled())
ss.set_body(show_fields) ;
}
}
const word hgt = height();
if (show_fields &&
last_printed_row < hgt &&
pr.current_row() > pr.headersize()+1)
{
if (hgt-last_printed_row > pr.rows_left())
pr.formfeed();
}
reset();
if (show_fields)
{
for (word j = last_printed_row; j < hgt; j++)
pr.print(row(j));
}
if (show_fields == printmode_normal
&& pr.current_row() > pr.headersize()+1
&& new_page)
{
pr.formfeed();
}
int repeat_count=0; // numero di sottosezioni stampate o numero di stampe della stessa sottosezione
int last_hpos=0;
for (word i = 0; i < fields(); i++)
{
if (!field(i).is_section())
{
// compose rows using "simple" fields
field(i).update();
}
else
{
last_hpos=min(word(field(i).y()-1), height());
// found a subsection
TForm_subsection & ss=(TForm_subsection & )field(i);
return ok;
last_printed_row=print_rows(show_fields,last_printed_row,last_hpos);
// process subsection
if (ss.enabled())
ok |= ss.print_body(show_fields) ;
}
} // ... loop for each field
const word hgt = height();
if (print_rows(show_fields,last_printed_row,hgt) > 0 && show_fields==printmode_normal)
ok = TRUE;
// print footers
if (subsection_above()!=NULL && !subsection_above()->is_title() && ok)
subsection_above()->print_qtitle();
return ok;
}
word TPrint_section::print_rows(const sec_print_mode show_fields, word from, word to)
{
TPrinter& pr = printer();
if (show_fields!=printmode_noprint && to>from)
{
// print preceeding rows:are all those rows which have Y coord <= than subsection's Y
if (subsection_above()!=NULL && !subsection_above()->is_title())
{
// find some to print: print titles.....
if (show_fields == printmode_normal)
subsection_above()->print_titles();
}
if (pr.current_row() > pr.headersize()+1)
if ((to-from+1) > pr.rows_left() && show_fields==printmode_normal )
pr.formfeed();
for (word j = from; j < to ;j++)
switch (show_fields)
{
case printmode_normal:
pr.print(row(j)); break; // print to printer
default:
_titlerows.add(row(j),j); break; // print to buffer
}
return to;
}
return from;
}
// @doc EXTERNAL
@ -5207,7 +5344,7 @@ void TForm::read(
if (forms.status() == NOERR)
{
_desc = forms.get("DESC");
if (_desc != desc && desc != "") // Controlla se la descrizione e' diversa, in questo caso l'aggiorna
if (_desc != desc && desc && *desc) // Controlla se la descrizione e' diversa, in questo caso l'aggiorna
{
forms.reread(_lock);
forms.put("DESC",desc);

View File

@ -17,7 +17,6 @@ class TMask;
#ifndef __ISAM_H
class TRectype;
#endif
#ifndef __RELATION_H
#include <relation.h>
#endif
@ -41,6 +40,19 @@ enum pagetype {
// @doc INTERNAL
// @enum titletype | Tipo di titolo per le sottosezioni
enum titletype {
type_notitle, // @emem Non è un titolo
type_title, // @emem Titolo di testa
type_qtitle}; // @emem Titolo di coda
// @enum sec_print_mode | Tipo di stampa per le sottosezioni
enum sec_print_mode {
printmode_noprint, // non stampa (hidden section)
printmode_normal, // valuta i campi e li stampa
printmode_qtitle, // valuta i campi e li tiene nel buffer titoli di coda
printmode_title // valuta i campi e li tiene nel buffer titoli di testa
};
pagetype char2page(char);
class TForm;
@ -457,8 +469,8 @@ public:
// @class TPrint_section | Classe per la gestione della stampa di una sezione di <c TForm>
//
// @base public | TArray
class TPrint_section : public TArray
// @base public | TObject
class TPrint_section : public TObject
// @author:(INTERNAL) Guido, Angelo, Villa
@ -466,7 +478,11 @@ class TPrint_section : public TArray
{
// @cmember:(INTERNAL) Maschera di edit della sezione corrente
static TMask* _msk;
// @cmember:(INTERNAL) Array delle righe
TArray _rows;
// @cmember:(INTERNAL) Array delle righe dei titoli
TArray _titlerows;
// @cmember:(INTERNAL) Altezza della sezione
word _height;
// @cmember:(INTERNAL) Offset prima colonna
@ -530,6 +546,8 @@ protected:
public:
// @cmember Ritorna la <c TPrintrow> della riga <p num>
TPrintrow& row(int num);
// @cmember Ritorna la <c TPrintrow> titoli della riga <p num>
TPrintrow& titlerow(int num);
// @cmember Ritorna il <c TForm> a cui appartiene la sezione
TForm& form() const
{ return *_form; }
@ -603,6 +621,9 @@ public:
// @cmember Setta il numero di ripetizioni eseguite
void set_repeat_count(int x)
{ _repeat_count = x; }
// @cmember Ritorna il numero di ripetizioni eseguite
int repeat_count()
{ return _repeat_count; }
// @cmember Setta l'altezza della sezione
void set_height(word h)
@ -614,10 +635,15 @@ public:
// @cmember Azzera tutte le righe della sezione di stampa
void reset();
// @cmember Stampa le righe bufferizzate dei titoli e le azzera
void print_title();
// @cmember Aggiorna tutti i campi e li inserisce nel buffer delle righe di stampa
virtual bool update();
// @cmember Stampa le righe
word print_rows(const sec_print_mode show_fields, word from, word to);
// @cmember Aggiorna tutti i campi e li stampa (usata in caso di BODY)
bool update_and_print(bool shown, bool newpage=FALSE);
bool update_and_print(const sec_print_mode shown, bool newpage=FALSE);
// @cmember Legge la testata dal file di testo (vedi <c TScanner>)
bool parse_head(TScanner& scanner);
// @cmember Legge i campi della sezione dal file di testo (vedi <c TScanner>)
@ -976,8 +1002,12 @@ public:
class TForm_subsection : public TForm_item
{
TForm_subsection * _title_section, *_qtitle_section;// sottosezioni titolo e coda
TPrint_section _ssec; // sezione di stampa contenente il "corpo" della sottosezione
TString _name;
TString _name; // nome della subsection
titletype _title_type; // indicatore di sezione di tipo titolo
bool _show_title; // indicatore titolo ancora da stampare (in caso di sezione titolo)
bool _bigskip; // indicatore di bigskip sui raggruppamenti (salta di gruppo in gruppo)
int _file_id; // ID del file su cui iterare in stampa se previsto
@ -995,8 +1025,21 @@ public:
virtual const char* class_name() const { return "SEZIONE"; }
virtual bool is_section() const { return TRUE; }
TPrint_section& subsection() { return _ssec; }
// @cmember Restituisce la sezione di stampa del "corpo"
TPrint_section& printsection() { return _ssec; }
// @cmember Setta la sezione titolo
void set_title_section(TForm_subsection * s);
// @cmember Setta la sezione titolo
void set_qtitle_section(TForm_subsection * s);
// @cmember Restituisce la sezione di stampa "titolo"
TPrint_section & title_section(TPrint_section& s) {return _title_section->printsection();}
// @cmember Restituisce se la sezione è un titolo
inline bool is_title() {return _title_type != type_notitle;}
// @cmember Restituisce se la sezione è un titolo di testa
inline bool is_htitle() {return _title_type == type_title;}
// @cmember Restituisce se la sezione è un titolo di coda
inline bool is_qtitle() {return _title_type == type_qtitle;}
// @cmember Ritorna se la sezione è da stampare a inizio di pagina nuova
bool atnewpage() {return _flag.newpage;}
@ -1008,14 +1051,21 @@ public:
// @cmember Ritorna il nome della sezione
void name(const char* s) { _name = s; _desc << "Sottosezione " << s; }
const char* name() const { return _name; }
// @cmember Aggiorna e stampa tutti i campi della sezione e delle sezioni contenute
bool set_body(bool showfields=TRUE);
// @cmember restituisce la condizione della sottosezione
const char * condition();
// @cmember restituisce il numero del file associato alla sottosezione
int fileid();
// @cmember imposta la condizione della sottosezione
void setcondition(const char * cond,TTypeexp type=_numexpr);
// @cmember Setta il flag di titolo ancora da stampare
void show_title(bool on) {_show_title=on;}
// @cmember Aggiorna e stampa tutti i campi della sezione e delle sezioni contenute
bool print_body(sec_print_mode showfields=printmode_normal);
// @cmember Aggiorna e stampa tutti i titoli delle sezioni soprastanti
bool print_titles() ;
// @cmember Aggiorna e stampa il titolo di coda
bool print_qtitle() ;
// @cmember Costruttore
TForm_subsection(TPrint_section* above_section, const char* name = "");
virtual ~TForm_subsection();

View File

@ -17,7 +17,6 @@
#include <scanner.h>
#include <utility.h>
#include <memo.h>
#include <codeb.h>
#include <varrec.h>
#define RECLOCKTYPES 0xFF00
@ -538,37 +537,6 @@ void set_autoload_new_files(
__autoload = on;
}
///////////////////////////////////////////////////////////
// TExtrectype
///////////////////////////////////////////////////////////
class TExtrectype : public TVariable_rectype
{
RecDes* _rd;
protected: // TRectype
virtual RecDes* rec_des() const { return _rd; }
virtual bool auto_virtual_fields() const { return TRUE; }
public:
TExtrectype(const TTrec& r); // Costruisce il record a partire da r
virtual ~TExtrectype() {}
};
TExtrectype::TExtrectype(const TTrec& r) : TVariable_rectype(r.num())
{
delete _rec;
_length = r.len();
_rec = new char [ _length ];
_rd = r.rec();
if( rec_has_memo(r.rec()))
init_memo(RECORD_NON_FISICO );
zero();
}
///////////////////////////////////////////////////////////
// TBaseisamfile
///////////////////////////////////////////////////////////
@ -1764,17 +1732,20 @@ int TSystemisamfile::update(
dir.eod() = ni;
}
}
dir.set_len(lenr);
dir.put(num(), _nordir, _sysdirop);
wrec.put(num());
prefix().update_recdes(num());
if (err==NOERR)
{
dir.set_len(lenr);
dir.put(num(), _nordir, _sysdirop);
wrec.put(num());
prefix().update_recdes(num());
if (toconvert)
{
if (dir.eox() > 0L)
packindex();
if (err == NOERR)
err = exec_convapp(lev, FALSE); // Post - conversion
if (toconvert)
{
if (dir.eox() > 0L)
packindex();
if (err == NOERR)
err = exec_convapp(lev, FALSE); // Post - conversion
}
}
}

View File

@ -2598,6 +2598,10 @@ bool TEdit_field::parse_item(TScanner& scanner)
TDir d; d.get(logicnum);
if (fexist(d.filename())) // Controlla l'esistenza del file
r = new TRelation(logicnum);
#ifdef DBG
else
fatal_box("Impossibile creare una USE sul file %s",d.filename());
#endif
}
else
{
@ -2653,6 +2657,12 @@ bool TEdit_field::parse_item(TScanner& scanner)
}
_check_enabled = TRUE;
}
else
{
while (scanner.popkey() == "JO")
scanner.line();
scanner.push();
}
return TRUE;
}
@ -2660,8 +2670,9 @@ bool TEdit_field::parse_item(TScanner& scanner)
if (scanner.key() == "CO") // Copyuse
{
const TString16 what(scanner.popkey());
const TBrowse* b = parse_browse(scanner);
CHECK(b,"Impossibile copiare la browse da un campo visto che quel campo non l'ha" );
if (b)
{
if (what == "US" || what == "AL")

View File

@ -2445,7 +2445,10 @@ void TSheet_field::delete_column( const int col ) const
void TSheet_field::move_column( const int fromindex, const int toindex ) const
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;
s->move_column(fromindex, toindex);
if (fromindex >= FIRST_FIELD)
s->move_column(s->cid2col(fromindex), toindex);
else
s->move_column(fromindex, toindex);
}
void TSheet_field::swap_columns(const int fromid, const int toid) const

View File

@ -691,16 +691,19 @@ void TPrint_application::set_row (
r--;
char digbuf[10];
char strbuf[120];
char fftt[120];
char *fmt = fftt;
TString bigbuf(256);
char* strbuf = bigbuf.get_buffer();
TString fftt(256);
char *fmt = fftt.get_buffer();
char fill = _fillchar;
word flags = 0;
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;
@ -849,7 +852,6 @@ void TPrint_application::set_row (
}
else
{
TString80 formato;
switch (ch)
{
case '#':
@ -868,6 +870,7 @@ void TPrint_application::set_row (
else
{
// read format
TString80 formato;
formato << ccc;
bool islong = FALSE;
while (strchr (printf_types, ch) == NULL)
@ -967,7 +970,7 @@ void TPrint_application::set_row (
// add to string
strbuf[strind++] = ch;
if (!ch)
fmt--;
fmt--;
break;
}
}

View File

@ -656,13 +656,13 @@ TPrintrow::TPrintrow()
TPrintrow::TPrintrow(const TPrintrow& pr)
{
_row = pr.row ();
memcpy (_attr, pr._attr, MAXSTR);
memcpy (_cols, pr._cols, MAXSTR);
memcpy (_attr, pr._attr, MAX_PR_WIDTH);
memcpy (_cols, pr._cols, MAX_PR_WIDTH);
_currentcolor = 'w';
_currentcolor <<= 8;
_currentcolor += 'n';
_currentstyle = pr._currentstyle;
for (int i = 0; i < MAXSTR; i++)
for (int i = 0; i < MAX_PR_WIDTH; i++)
_cols[i] = _currentcolor;
_lastpos = pr._lastpos;
}
@ -694,7 +694,7 @@ TPrintrow& TPrintrow::reset()
_currentcolor = 'w';
_currentcolor <<= 8;
_currentcolor += 'n';
for (int i = 0; i < MAXSTR; i++)
for (int i = 0; i < MAX_PR_WIDTH; i++)
_cols[i] = _currentcolor; // Azzera colori
_lastpos = 0;
@ -839,7 +839,7 @@ TPrintrow& TPrintrow::put(const char *str, int position, int len)
int pp = atoi (digbuf);
if (toupper (c) == 'G')
{
if (pp >= MAXSTR)
if (pp >= MAX_PR_WIDTH)
fatal_box ("printrow reaches position %d", pp);
if (pp > position)
for (int k = position; k < pp; k++)
@ -852,7 +852,7 @@ TPrintrow& TPrintrow::put(const char *str, int position, int len)
}
else if (toupper (c) == 'J')
{
if (pp + position >= MAXSTR)
if (pp + position >= MAX_PR_WIDTH)
fatal_box ("printrow reaches position %d", pp + position);
for (int k = 0; k < pp; k++)
{
@ -944,14 +944,24 @@ void TPrinter::init_formlen(
if (prwin != NULL_WIN)
{
const TString spc(256, 'M'); // Compute maximum number of chars per line
int w = 0;
for (_formwidth = spc.len(); _formwidth >= 80; _formwidth--)
// Compute maximum number of chars per line
int mincol = 0,maxcol=MAX_PR_WIDTH;
TString spc(maxcol,'M');
_formwidth = maxcol;
int w;
while (mincol < maxcol )
{
w = xvt_dwin_get_text_width(prwin, (char*)(const char*)spc, _formwidth);
if (w < pw) break;
w = xvt_dwin_get_text_width(prwin, (char*)(const char*)spc, _formwidth);
if (w < pw)
mincol = _formwidth+1;
else
maxcol=_formwidth-1;
_formwidth=(mincol+maxcol)/2;
}
if (isfax())
_horz_offset = 56;
else
@ -959,7 +969,7 @@ void TPrinter::init_formlen(
}
else
{
_formwidth = 256;
_formwidth = int (pw * 10L / phr);
_horz_offset = 0;
}
}
@ -1062,6 +1072,7 @@ TPrinter::TPrinter()
_curcode = 0; // first in list if no default is specified
_formlen = 66;
_formwidth = 0;
_frompage = 0;
_topage = 0xffff;
_hwformfeed = FALSE;
@ -1169,7 +1180,11 @@ void TPrinter::read_configuration(
else
break;
}
if (!xvt_print_is_valid(_print_rcd))
if (xvt_print_is_valid(_print_rcd))
{
set_win_formlen();
}
else
{
error_box("Attenzione: la stampante corrente non e' valida.\n"
"Si prega di selezionare e registrare una nuova stampante.");
@ -1992,6 +2007,7 @@ struct font_data
int _columns;
};
HIDDEN
BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
{
font_data& fd = *(font_data*)data;
@ -2025,6 +2041,44 @@ BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
return win != NULL_WIN;
}
HIDDEN
BOOLEAN XVT_CALLCONV1 calc_cols_callback(long data)
{
int &numcols=*(int *)data;
// Create print window
WINDOW win = xvt_print_create_win(printer().get_printrcd(), "Calcolo numero colonne");
if (win != NULL_WIN)
{
long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, printer().get_printrcd(), &ph, &pw, &pvr, &phr);
xvt_set_font(win, printer().fontname(), XVT_FS_NONE, printer().get_char_size());
// Compute maximum number of chars per line
int mincol = 0,maxcol=MAX_PR_WIDTH;
TString spc(maxcol,'M' );
numcols = maxcol;
int w;
while (mincol < maxcol )
{
w = xvt_dwin_get_text_width(win, (char*)(const char*)spc, numcols);
if (w < pw)
mincol = numcols+1;
else
maxcol=numcols-1;
numcols=(mincol+maxcol)/2;
}
xvt_vobj_destroy(win);
}
return win != NULL_WIN;
}
int TPrinter::calc_font_size(int columns) const
{
font_data fd;
@ -2039,6 +2093,16 @@ int TPrinter::calc_font_size(int columns) const
return fd._size;
}
int TPrinter::calc_num_cols() const
{
int numcols;
xvt_print_open();
xvt_print_start_thread(calc_cols_callback, (long)&numcols);
xvt_print_close();
return numcols;
}
///////////////////////////////////////////////////////////
// Gestione fax

View File

@ -48,6 +48,9 @@ enum TGraphic_shape
box // @emem Disgna un box
};
// 256 | Lunghezza massima della riga da stampare
#define MAX_PR_WIDTH 256
// @doc EXTERNAL
// @class TPrintrow | Classe per la definizione della stampa di una riga
@ -59,15 +62,13 @@ class TPrintrow : public TObject
// @access:(INTERNAL) Private Member
{
// @ccost:(INTERNAL) MAXSTR | 256 | Lunghezza massima della riga da stampare
enum { MAXSTR = 256 };
// @cmember:(INTERNAL) Stringa da stampare nella riga
TString256 _row;
// @cmember:(INTERNAL) Attributi carattere dei caratteri
char _attr[MAXSTR];
char _attr[MAX_PR_WIDTH];
// @cmember:(INTERNAL) Attributi colore dei caratteri
int _cols[MAXSTR];
int _cols[MAX_PR_WIDTH];
// @cmember:(INTERNAL) Inizio delle nuove posizioni di tabulazione
TBit_array _tab;
@ -692,6 +693,8 @@ public:
// @cmember Calcola la dimensione del font per le colonne desiderate
int calc_font_size(int columns) const;
// @cmember Calcola il numero di colonne per il font/size attuale
int calc_num_cols() const;
};
// @doc EXTERNAL

View File

@ -297,7 +297,7 @@ void TRelation_application::query_mode(
init_query_mode(*_mask);
}
if (_transaction.not_empty())
if (_curr_transaction.not_empty())
ini2query_mask();
}
@ -338,7 +338,7 @@ void TRelation_application::insert_mode()
init_insert_mode(*_mask);
if (_transaction == "INSERT")
if (_curr_transaction == TRANSACTION_INSERT)
ini2insert_mask();
}
@ -793,7 +793,7 @@ bool TRelation_application::relation_remove()
if (protected_record(r.curr()))
return message_box("Documento non eliminabile");
if (_transaction == "DELETE" || yesno_box("Confermare l'eliminazione"))
if (_curr_transaction == TRANSACTION_DELETE || yesno_box("Confermare l'eliminazione"))
{
r.restore_status();
const bool ok = remove();
@ -832,156 +832,176 @@ bool TRelation_application::firm_change_enabled() const
void TRelation_application::main_loop()
{
_recins = -1;
query_mode();
_mask->open_modal();
KEY k;
// Provoca l'autopremimento per il messaggio di LINK
if (_lnflag)
{
if (_transaction == "INSERT")
_mask->send_key(K_CTRL+'N', 0);
else
{
_autodelete = _transaction == "DELETE";
_mask->send_key(K_AUTO_ENTER, 0);
}
}
do
{
const bool change = firm_change_enabled();
// Dis/abilita cambio ditta
enable_menu_item(M_FILE_NEW, change);
// Dis/abilita cambio parametri
enable_menu_item(M_FILE_REVERT, change);
do {
// ciclo delle transazioni
_recins = -1;
if (_mask->edit_mode() && _autodelete)
{
const int pos = _mask->id2pos(DLG_DELREC);
if (pos >= 0 && _mask->fld(pos).active())
_mask->send_key(K_CTRL+'E', 0);
else
error_box("Documento non eliminabile.");
_autodelete = FALSE;
}
k = _mask->run();
switch (k)
query_mode();
_mask->open_modal();
// Provoca l'autopremimento per il messaggio di LINK
if (_lnflag)
{
case K_ESC:
if (save(TRUE))
query_mode();
if (_lnflag)
k = K_QUIT;
break;
case K_QUIT:
if (!save(TRUE))
k = K_ENTER;
break;
case K_ENTER:
if (_lnflag)
{
for (k = 1; k <= MAX_KEYS && !test_key(k, FALSE); k++);
if (k <= MAX_KEYS && find(k))
modify_mode();
else
k = K_QUIT;
}
else
load_transaction();
if (_curr_transaction == TRANSACTION_INSERT )
{
if (find(0)) modify_mode();
else insert_mode();
_mask->send_key(K_CTRL+'N', 0);
}
break;
case K_SAVE:
if (save(FALSE))
else
{
_autodelete = _curr_transaction == TRANSACTION_DELETE;
_mask->send_key(K_AUTO_ENTER, 0);
}
}
do
{
const bool change = firm_change_enabled();
// Dis/abilita cambio ditta
enable_menu_item(M_FILE_NEW, change);
// Dis/abilita cambio parametri
enable_menu_item(M_FILE_REVERT, change);
if (_mask->edit_mode())
{
if (_autoins_caller.not_empty() || _transaction.not_empty())
{
if (_autodelete)
{
const int pos = _mask->id2pos(DLG_DELREC);
if (pos >= 0 && _mask->fld(pos).active())
_mask->send_key(K_CTRL+'E', 0);
else
error_box("Documento non eliminabile.");
_autodelete = FALSE;
}
}
k = _mask->run();
switch (k)
{
case K_ESC:
if (save(TRUE))
query_mode();
if (_lnflag)
k = K_QUIT;
}
else
{
if (save_and_new())
{
if (_mask->insert_mode())
insert_mode();
else
query_mode();
}
else
break;
case K_QUIT:
if (!save(TRUE))
k = K_ENTER;
break;
case K_ENTER:
if (_lnflag)
{
for (k = 1; k <= MAX_KEYS && !test_key(k, FALSE); k++);
if (k <= MAX_KEYS && find(k))
modify_mode();
}
}
break;
case K_INS:
if (_mask->query_mode() || save(TRUE))
{
const bool trovato = _mask->query_mode() && test_key(1, FALSE) && find(1);
if (trovato)
{
modify_mode();
warning_box("Documento gia' presente");
else
k = K_QUIT;
}
else
insert_mode();
}
break;
case K_DEL:
if (_mask->query_mode())
{
delete_mode();
}
else
{
if (relation_remove())
{
query_mode();
if (_autoins_caller.not_empty() || _transaction.not_empty())
{
if (_lnflag) _recins = 0;
if (find(0)) modify_mode();
else insert_mode();
}
if (_curr_trans_mode == TM_AUTOMATIC)
_mask->send_key(K_CTRL+'R', 0);
break;
case K_SAVE:
if (save(FALSE))
{
if (_autoins_caller.not_empty() || _curr_transaction.not_empty())
{
k = K_QUIT;
}
else
{
if (save_and_new())
{
if (_mask->insert_mode())
insert_mode();
else
query_mode();
}
else
modify_mode();
}
}
}
break;
case K_F9:
if (_mask->query_mode() || save(TRUE))
search_mode();
break;
default:
if (save(TRUE))
{
setkey();
int err = ~NOERR;
switch (k)
break;
case K_INS:
if (_mask->query_mode() || save(TRUE))
{
case K_HOME:
err = file().readat(_first, _testandlock);
break;
case K_NEXT:
err = file().reread();
err = file().next(_testandlock);
break;
case K_PREV:
err = file().reread();
err = file().prev(_testandlock);
break;
case K_END:
err = file().readat(_last, _testandlock);
break;
default:
break;
const bool trovato = _mask->query_mode() && test_key(1, FALSE) && find(1);
if (trovato)
{
modify_mode();
warning_box("Documento gia' presente");
if (_curr_transaction.not_empty())
{
_curr_transaction=TRANSACTION_MODIFY;
_curr_trans_mode = TM_INTERACTIVE; // switch to interactive mode
}
}
else
insert_mode();
}
if (_curr_trans_mode == TM_AUTOMATIC)
_mask->send_key(K_CTRL+'R', 0);
break;
case K_DEL:
if (_mask->query_mode())
{
delete_mode();
}
if (err == NOERR || err == _islocked)
modify_mode();
else
query_mode();
else
{
if (relation_remove())
{
query_mode();
if (_autoins_caller.not_empty() || _curr_transaction.not_empty())
{
if (_lnflag) _recins = 0;
k = K_QUIT;
}
}
}
break;
case K_F9:
if (_mask->query_mode() || save(TRUE))
search_mode();
break;
default:
if (save(TRUE))
{
setkey();
int err = ~NOERR;
switch (k)
{
case K_HOME:
err = file().readat(_first, _testandlock);
break;
case K_NEXT:
err = file().reread();
err = file().next(_testandlock);
break;
case K_PREV:
err = file().reread();
err = file().prev(_testandlock);
break;
case K_END:
err = file().readat(_last, _testandlock);
break;
default:
break;
}
if (err == NOERR || err == _islocked)
modify_mode();
else
query_mode();
}
break;
}
break;
}
@ -1009,13 +1029,26 @@ void TRelation_application::main_loop()
ini.set("Error", "0");
edit_mask2ini();
}
else
{
const int err = get_relation()->status();
ini.set("Result", err == NOERR ? "CANCEL" : "ERROR");
ini.set("Error", err);
if (_curr_transaction.not_empty())
{
TConfig ini(_trans_ini.row(_trans_counter), "Transaction");
if (_recins >= 0)
{
ini.set("Result", "OK");
ini.set("Error", "0");
edit_mask2ini();
}
else
{
const int err = get_relation()->status();
ini.set("Result", err == NOERR ? "CANCEL" : "ERROR");
ini.set("Error", err);
}
}
}
_trans_counter++;
} while ( _trans_counter < _ntransactions);
return k != K_QUIT;
}
bool TRelation_application::filter()
@ -1190,7 +1223,10 @@ void TRelation_application::set_link(TMask & m, const char * keyexpr)
bool TRelation_application::parse_command_line()
{
_ini = _transaction = "";
_trans_ini.destroy();
_trans_counter=0;
_curr_transaction = "";
_curr_trans_mode = 'I';
TFilename ini;
for (int i = argc()-1; i > 0; i--)
@ -1199,17 +1235,33 @@ bool TRelation_application::parse_command_line()
ini.upper();
if (ini.left(2) == "-I" || ini.left(2) == "/I")
{
_ini = ini.mid(2);
if (ini.find('*')>=0)
{
// metachars:
list_files(ini.mid(2), _trans_ini);
}
else
_trans_ini.add(ini.mid(2));
break;
}
}
if (_ini.not_empty())
_ntransactions= _trans_ini.items();
_lnflag = _ntransactions>0;
return _lnflag;
}
bool TRelation_application::load_transaction()
{
bool retv=0;
if (_trans_counter < _ntransactions)
{
TConfig cnf(_ini, "Transaction");
_transaction = cnf.get("Action");
_transaction.upper();
TConfig cnf(_trans_ini.row(_trans_counter), "Transaction");
_curr_transaction = cnf.get("Action");
_curr_transaction.upper();
_curr_trans_mode = cnf.get("Mode")[0];
long firm = cnf.get_long("Firm");
if (firm > 0)
{
@ -1218,34 +1270,30 @@ bool TRelation_application::parse_command_line()
if (!ok)
error_box("Ditta inesistente: %ld", firm);
}
if (_transaction == "RUN")
_lnflag = 0; // Ho gia' finito qui: basta il cambio ditta
if (_curr_transaction == "RUN")
retv= 0; // Ho gia' finito qui: basta il cambio ditta
else
_lnflag = 1; // Attiva automagia
retv = 1; // Attiva automagia
}
return _lnflag != 0;
}
return retv;
}
void TRelation_application::ini2query_mask()
{
if (_transaction.not_empty())
{
TString16 parag;
parag.format("%d", get_relation()->lfile().num());
TConfig ini(_ini, parag);
if (_curr_transaction.not_empty())
{
TConfig ini(_trans_ini.row(_trans_counter), format("%d", get_relation()->lfile().num()));
ini2mask(ini, *_mask, TRUE);
}
}
void TRelation_application::ini2insert_mask()
{
if (_transaction.not_empty())
if (_curr_transaction.not_empty())
{
TString16 parag;
parag.format("%d", get_relation()->lfile().num());
TConfig ini(_ini, parag);
TConfig ini(_trans_ini.row(_trans_counter), format("%d", get_relation()->lfile().num()));
ini2mask(ini, *_mask, FALSE);
}
}
@ -1272,11 +1320,11 @@ void TRelation_application::ini2mask(TConfig& ini, TMask& m, bool query)
void TRelation_application::edit_mask2ini()
{
if (_ini.not_empty())
if (_trans_ini.row(_trans_counter).not_empty())
{
TString head;
head.format("%d", get_relation()->lfile().num());
TConfig ini(_ini, head);
TConfig ini(_trans_ini.row(_trans_counter), head);
mask2ini(*_mask, ini);
}
}

View File

@ -17,6 +17,11 @@
#include <mask.h>
#endif
#define TRANSACTION_INSERT "INSERT"
#define TRANSACTION_MODIFY "MODIFY"
#define TRANSACTION_DELETE "DELETE"
#define TM_INTERACTIVE 'I'
#define TM_AUTOMATIC 'A'
// @doc EXTERNAL
// @class TRelation_application | Classe per la gestione di una applicazione di manutenzione di uno
@ -50,12 +55,22 @@ class TRelation_application : public TSkeleton_application
// @cmember:(INTERNAL) Messaggio da passare all'utente per indicare che e' stata fatta la rinumerazione
TString _renum_message;
// @cmember:(INTERNAL) Nome del file .ini con la transazione da eseguire
TString _ini;
// @cmember:(INTERNAL) Nomi dei file .ini con la transazione da eseguire
TString_array _trans_ini;
// @cmember:(INTERNAL) Numero di file .ini di transazioni
int _ntransactions;
// @cmember:(INTERNAL) Indice del file .ini di _ini con la transazione da eseguire
int _trans_counter;
// @cmember:(INTERNAL) Azione della transazione corrente
TString _transaction;
TString _curr_transaction;
// @cmember:(INTERNAL) Modalità di esecuzione della transazione corrente (Automatica o interattiva)
char _curr_trans_mode;
// @cmember:(INTERNAL) Flag di cancellazione automatica veloce
byte _autodelete;
private:
// @cmember:(INTERNAL) Carica la transazione corrente (protocollo via .ini)
bool load_transaction() ;
// @cmember:(INTERNAL) Setta i campi fissati da <md TRelation_application::_fixed>
bool filter();

View File

@ -30,7 +30,7 @@ int get_serial_number()
}
bool test_assistance_year()
{
{
#ifndef _DEMO_
int dongle_year = TDate(TODAY).year();
@ -39,23 +39,23 @@ bool test_assistance_year()
const int new_year = dongle().year_assist();
if (new_year >= 1998 && new_year <= dongle_year)
dongle_year = new_year;
}
}
int app_year, dum1, dum2, dum3;
bool ok = TApplication::get_version_info(app_year, dum1, dum2, dum3);
if (ok)
if (ok)
ok = app_year <= dongle_year;
return ok;
#else
return TRUE;
#endif // _DEMO_
#endif // _DEMO_
}
// @doc INTERNAL
// @func Inizilizza le variabili globali
void init_global_vars()
{
{
TPrefix& pref = prefix_init();
pref.set(""); // Dati standard
@ -84,8 +84,8 @@ void* operator new(size_t size)
// in linea del C++.
// <nl>Questa funzione viene implementata se non si opera in ambiante FoxPro.
{
void* mem = (void*)malloc(size);
{
void* mem = (void*)malloc(size);
if (mem == NULL)
fatal_box("Out of memory: can't allocate %u bytes", size);

View File

@ -1,6 +1,13 @@
#include <relation.h>
#include <varrec.h>
#ifndef __RELATION_H
#include <relation.h>
#endif
extern bool rec_has_memo( const RecDes * rd );
TVariable_field::TVariable_field(
const char * name, //
const char * expr, //
@ -362,4 +369,27 @@ TRectype & TVariable_rectype::operator =(const char* rec)
return *this;
}
///////////////////////////////////////////////////////////
// TExtrectype
///////////////////////////////////////////////////////////
TExtrectype::TExtrectype(const TTrec& r) : TVariable_rectype(r.num())
{
delete _rec;
_length = r.len();
_rec = new char [ _length ];
_rd = new RecDes;
memcpy(_rd, r.rec(),sizeof(RecDes));
if( rec_has_memo(r.rec()))
init_memo(RECORD_NON_FISICO );
zero();
}
TExtrectype::~TExtrectype()
{
delete _rd;
}

View File

@ -202,4 +202,22 @@ public:
virtual ~TAuto_variable_rectype() {}
};
///////////////////////////////////////////////////////////
// TExtrectype
///////////////////////////////////////////////////////////
class TExtrectype : public TVariable_rectype
{
RecDes* _rd;
protected: // TRectype
virtual RecDes* rec_des() const { return _rd; }
virtual bool auto_virtual_fields() const { return TRUE; }
public:
TExtrectype(const TTrec& r); // Costruisce il record a partire da r
virtual ~TExtrectype() ;
};
#endif // __VARREC_

View File

@ -233,12 +233,11 @@ KEY e_char_to_key(
KEY key = ep->v.chr.ch;
if (key < K_INS || key > K_HELP)
{
if (ep->v.chr.shift && (key < ' ' || key >= K_UP))
if (ep->v.chr.shift && (key < ' ' || key >= K_UP))
key += K_SHIFT;
// if (ep->v.chr.control && key >= ' ')
if (ep->v.chr.control && (key > K_SHIFT ||
(key >= K_F1 && key <= K_F12) ||
isalnum(key) || strchr("\r+-*/", key)))
//if (ep->v.chr.control && key >= ' ') key += K_CTRL;
if (ep->v.chr.control && (key > K_SHIFT || (key >= K_F1 && key <= K_F12) ||
isalnum(key) || strchr("\r+-*/",key) != NULL))
key += K_CTRL;
}
return key;