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:
parent
2eb4a2460d
commit
5e6ec4d235
@ -16,12 +16,21 @@
|
|||||||
|
|
||||||
#include <bagn002.h>
|
#include <bagn002.h>
|
||||||
|
|
||||||
|
<<<<<<< applicat.cpp
|
||||||
|
=======
|
||||||
|
// #define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
|
||||||
|
|
||||||
|
>>>>>>> 1.90.2.4
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Metodi di accesso globali all'applicazione corrente
|
// Metodi di accesso globali all'applicazione corrente
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HIDDEN TApplication* _application = NULL;
|
HIDDEN TApplication* _application = NULL;
|
||||||
|
<<<<<<< applicat.cpp
|
||||||
HIDDEN bool _xvt_running = FALSE;
|
HIDDEN bool _xvt_running = FALSE;
|
||||||
|
=======
|
||||||
|
HIDDEN BOOL _xvt_running = FALSE;
|
||||||
|
>>>>>>> 1.90.2.4
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
@ -563,8 +572,18 @@ void TApplication::run(
|
|||||||
_name = cmd2name(argv[0]);
|
_name = cmd2name(argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< applicat.cpp
|
||||||
const int sn = get_serial_number();
|
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)
|
if (sn < 0)
|
||||||
{
|
{
|
||||||
error_box("Probabilmente non e' stata inserita la chiave di protezione");
|
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
|
// About box: risposta alla opzione Informazioni del menu File
|
||||||
void TApplication::about() const
|
void TApplication::about() const
|
||||||
{
|
{
|
||||||
|
<<<<<<< applicat.cpp
|
||||||
const TFilename n(argv(0));
|
const TFilename n(argv(0));
|
||||||
const word ser_no = dongle().number();
|
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;
|
int year, release, tag, patch;
|
||||||
|
|
||||||
if (get_version_info(year, release, tag, patch))
|
if (get_version_info(year, release, tag, patch))
|
||||||
|
@ -151,10 +151,35 @@ bool sorry_box(
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @msg yesno_box | Crea una finestra di RICHIESTA con il relativo messaggio
|
// @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
|
const char* fmt, // @parm Messaggio da stampare nella finestra
|
||||||
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
|
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
|
||||||
|
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
bool message_box(const char* fmt, ...);
|
int message_box(const char* fmt, ...);
|
||||||
bool warning_box(const char* fmt, ...);
|
int warning_box(const char* fmt, ...);
|
||||||
bool sorry_box(const char* fmt, ...);
|
int sorry_box(const char* fmt, ...);
|
||||||
bool error_box(const char* fmt, ...);
|
int error_box(const char* fmt, ...);
|
||||||
bool fatal_box(const char* fmt, ...);
|
int fatal_box(const char* fmt, ...);
|
||||||
bool yesno_box(const char* fmt, ...);
|
int noyes_box(const char* fmt, ...);
|
||||||
bool noyes_box(const char* fmt, ...);
|
int yesno_box(const char* fmt, ...);
|
||||||
int yesnocancel_box(const char* fmt, ...);
|
int yesnocancel_box(const char* fmt, ...);
|
||||||
bool yesnofatal_box(const char* fmt, ...);
|
bool yesnofatal_box(const char* fmt, ...);
|
||||||
bool __trace(const char* fmt, ...);
|
bool __trace(const char* fmt, ...);
|
||||||
|
140
include/codeb.c
140
include/codeb.c
@ -53,6 +53,10 @@ extern char* CUpString(char *);
|
|||||||
static CODE4 code_base;
|
static CODE4 code_base;
|
||||||
static DATA4 *dbdata[CB4FILES];
|
static DATA4 *dbdata[CB4FILES];
|
||||||
|
|
||||||
|
bool handle_ok(int handle)
|
||||||
|
{
|
||||||
|
return handle >= 0 && handle < CB4FILES && dbdata[handle] !=0;
|
||||||
|
}
|
||||||
|
|
||||||
static char * find_slash_backslash(char * str)
|
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)
|
int DB_close(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
d4close(dbdata[handle]);
|
d4close(dbdata[handle]);
|
||||||
dbdata[handle]=(DATA4 *) 0;
|
dbdata[handle]=(DATA4 *) 0;
|
||||||
code_base.errorCode=0;
|
code_base.errorCode=0;
|
||||||
@ -158,7 +162,7 @@ int DB_close(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
char *DB_getrecord(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]));
|
return(d4record(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +171,7 @@ char *DB_getrecord(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_reclen(int handle)
|
int DB_reclen(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return((int) d4recWidth(dbdata[handle]));
|
return((int) d4recWidth(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +189,7 @@ int DB_keylen(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
long int DB_recno(int handle)
|
long int DB_recno(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1L);
|
if(!handle_ok(handle)) return(-1L);
|
||||||
return(d4recNo(dbdata[handle]));
|
return(d4recNo(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +198,7 @@ long int DB_recno(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
long int DB_reccount(int handle)
|
long int DB_reccount(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1L);
|
if(!handle_ok(handle)) return(-1L);
|
||||||
return(d4recCount(dbdata[handle]));
|
return(d4recCount(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +211,7 @@ int DB_tagselect(int handle,int index_no)
|
|||||||
TAG4 *tt;
|
TAG4 *tt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
/* si posiziona sul primo indice */
|
/* si posiziona sul primo indice */
|
||||||
tt=d4tagNext(dbdata[handle],NULL);
|
tt=d4tagNext(dbdata[handle],NULL);
|
||||||
if(tt==NULL) return(-1);
|
if(tt==NULL) return(-1);
|
||||||
@ -229,7 +233,7 @@ int DB_tagget(int handle)
|
|||||||
TAG4 *tt,*tt1;
|
TAG4 *tt,*tt1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
/* si posiziona sul primo indice */
|
/* si posiziona sul primo indice */
|
||||||
tt=d4tagDefault(dbdata[handle]);
|
tt=d4tagDefault(dbdata[handle]);
|
||||||
if(tt==NULL) return(-1);
|
if(tt==NULL) return(-1);
|
||||||
@ -249,7 +253,7 @@ int DB_tagget(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_first(int handle)
|
int DB_first(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4top(dbdata[handle]));
|
return(d4top(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +264,7 @@ int DB_first(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_last(int handle)
|
int DB_last(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4bottom(dbdata[handle]));
|
return(d4bottom(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +274,7 @@ int DB_last(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_next(int handle)
|
int DB_next(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4skip(dbdata[handle],1L));
|
return(d4skip(dbdata[handle],1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +283,7 @@ int DB_next(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_prev(int handle)
|
int DB_prev(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4skip(dbdata[handle],-1L));
|
return(d4skip(dbdata[handle],-1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +293,7 @@ int DB_prev(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_skip(int handle,long int recno)
|
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));
|
return(d4skip(dbdata[handle],recno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +302,7 @@ int DB_skip(int handle,long int recno)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_lock(int handle)
|
int DB_lock(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4lock(dbdata[handle],d4recNo(dbdata[handle])));
|
return(d4lock(dbdata[handle],d4recNo(dbdata[handle])));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +311,7 @@ int DB_lock(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_unlock(int handle)
|
int DB_unlock(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4unlock(dbdata[handle]));
|
return(d4unlock(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +324,7 @@ int DB_seek(int handle,char *key)
|
|||||||
int rc, len;
|
int rc, len;
|
||||||
const char * k;
|
const char * k;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
rc = d4seek(dbdata[handle],key);
|
rc = d4seek(dbdata[handle],key);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@ -342,7 +346,7 @@ int DB_seek(int handle,char *key)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_eof(int handle)
|
int DB_eof(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4eof(dbdata[handle]));
|
return(d4eof(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +355,7 @@ int DB_eof(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_bof(int handle)
|
int DB_bof(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4bof(dbdata[handle]));
|
return(d4bof(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +364,7 @@ int DB_bof(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_go(int handle,long recno)
|
int DB_go(int handle,long recno)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4go(dbdata[handle],recno));
|
return(d4go(dbdata[handle],recno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +373,8 @@ int DB_go(int handle,long recno)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_delete(int handle)
|
int DB_delete(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
|
||||||
|
if(!handle_ok(handle)) return(-1);
|
||||||
d4delete(dbdata[handle]);
|
d4delete(dbdata[handle]);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -380,7 +385,7 @@ int DB_delete(int handle)
|
|||||||
int DB_recall(int handle)
|
int DB_recall(int handle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
d4recall(dbdata[handle]);
|
d4recall(dbdata[handle]);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -391,7 +396,7 @@ int DB_recall(int handle)
|
|||||||
int DB_rewrite(int handle)
|
int DB_rewrite(int handle)
|
||||||
{
|
{
|
||||||
int rt;
|
int rt;
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
while ((rt=d4write(dbdata[handle],d4recNo(dbdata[handle]))) == r4locked)
|
while ((rt=d4write(dbdata[handle],d4recNo(dbdata[handle]))) == r4locked)
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
yesnofatal_box("Sono in attesa nella DB_rewrite");
|
yesnofatal_box("Sono in attesa nella DB_rewrite");
|
||||||
@ -488,7 +493,7 @@ int DB_lockfile(int handle)
|
|||||||
{
|
{
|
||||||
int rt;
|
int rt;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
rt = d4lockFile(dbdata[handle]);
|
rt = d4lockFile(dbdata[handle]);
|
||||||
if (rt==0) rt=d4lockIndex(dbdata[handle]);
|
if (rt==0) rt=d4lockIndex(dbdata[handle]);
|
||||||
return(rt);
|
return(rt);
|
||||||
@ -1061,7 +1066,7 @@ int DB_index_seek(int handle, char* from)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
||||||
|
|
||||||
if (tfile4seek(t->tagFile,from,strlen(from)) < 0) return(DB_get_error());
|
if (tfile4seek(t->tagFile,from,strlen(from)) < 0) return(DB_get_error());
|
||||||
@ -1077,7 +1082,7 @@ long DB_index_recno(int handle)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
||||||
|
|
||||||
return(tfile4recNo(t->tagFile));
|
return(tfile4recNo(t->tagFile));
|
||||||
@ -1090,7 +1095,7 @@ long DB_index_next(int handle)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
||||||
|
|
||||||
return(tfile4skip(t->tagFile,1L));
|
return(tfile4skip(t->tagFile,1L));
|
||||||
@ -1108,7 +1113,7 @@ char* DB_index_getkey(int handle)
|
|||||||
|
|
||||||
if (key == NULL)
|
if (key == NULL)
|
||||||
key = malloc(MAXLEN);
|
key = malloc(MAXLEN);
|
||||||
if(dbdata[handle]==0)
|
if(!handle_ok(handle))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(NULL);
|
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(NULL);
|
||||||
klen=a4tagKeyLen(dbdata[handle]);
|
klen=a4tagKeyLen(dbdata[handle]);
|
||||||
@ -1126,7 +1131,7 @@ int DB_index_eof(int handle)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tagDefault(dbdata[handle]))==NULL) return(-1);
|
||||||
return(tfile4eof(t->tagFile));
|
return(tfile4eof(t->tagFile));
|
||||||
}
|
}
|
||||||
@ -1137,7 +1142,7 @@ int DB_index_eof(int handle)
|
|||||||
|
|
||||||
int DB_lock_rec(int handle,long nrec)
|
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);
|
if(d4lock(dbdata[handle],nrec)==r4locked) return(-1);
|
||||||
else return(0);
|
else return(0);
|
||||||
}
|
}
|
||||||
@ -1150,7 +1155,7 @@ int DB_lock_rec(int handle,long nrec)
|
|||||||
|
|
||||||
int DB_file_locked(int handle)
|
int DB_file_locked(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return a4lockTest(dbdata[handle]);
|
return a4lockTest(dbdata[handle]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,7 +1166,7 @@ int DB_file_locked(int handle)
|
|||||||
|
|
||||||
int DB_rec_locked(int handle,long nrec)
|
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));
|
return(d4lockTest(dbdata[handle],nrec));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1236,9 +1241,10 @@ extern char* CUpString(char *);
|
|||||||
static CODE4 code_base;
|
static CODE4 code_base;
|
||||||
static DATA4 *dbdata[CB4FILES];
|
static DATA4 *dbdata[CB4FILES];
|
||||||
|
|
||||||
// #include <x4filter.h>
|
bool handle_ok(int handle)
|
||||||
// static X4FILTER xdb[CB4FILES];
|
{
|
||||||
|
return handle >=0 && handle < CB4FILES && dbdata[handle] !=0;
|
||||||
|
}
|
||||||
|
|
||||||
static char * find_slash_backslash(char * str)
|
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)
|
int DB_close(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
d4close(dbdata[handle]);
|
d4close(dbdata[handle]);
|
||||||
dbdata[handle]=(DATA4 *) 0;
|
dbdata[handle]=(DATA4 *) 0;
|
||||||
code_base.error_code=0;
|
code_base.error_code=0;
|
||||||
@ -1351,7 +1357,7 @@ int DB_close(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
char *DB_getrecord(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]));
|
return(d4record(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1360,7 +1366,7 @@ char *DB_getrecord(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_reclen(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]));
|
return((int) d4record_width(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1372,7 +1378,7 @@ int DB_keylen(int handle)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if (dbdata[handle]==0) return(-1);
|
if (!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tag_default(dbdata[handle]))== NULL) return (-1);
|
if ((t=d4tag_default(dbdata[handle]))== NULL) return (-1);
|
||||||
return(expr4key_len(t->expr));
|
return(expr4key_len(t->expr));
|
||||||
}
|
}
|
||||||
@ -1382,7 +1388,7 @@ int DB_keylen(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
long int DB_recno(int handle)
|
long int DB_recno(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1L);
|
if(!handle_ok(handle)) return(-1L);
|
||||||
return(d4recno(dbdata[handle]));
|
return(d4recno(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1391,7 +1397,7 @@ long int DB_recno(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
long int DB_reccount(int handle)
|
long int DB_reccount(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1L);
|
if(!handle_ok(handle)) return(-1L);
|
||||||
return(d4reccount(dbdata[handle]));
|
return(d4reccount(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1404,7 +1410,7 @@ int DB_tagselect(int handle,int index_no)
|
|||||||
TAG4 *tt;
|
TAG4 *tt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
/* si posiziona sul primo indice */
|
/* si posiziona sul primo indice */
|
||||||
tt=d4tag_next(dbdata[handle],NULL);
|
tt=d4tag_next(dbdata[handle],NULL);
|
||||||
if(tt==NULL) return(-1);
|
if(tt==NULL) return(-1);
|
||||||
@ -1426,7 +1432,7 @@ int DB_tagget(int handle)
|
|||||||
TAG4 *tt,*tt1;
|
TAG4 *tt,*tt1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
/* si posiziona sul primo indice */
|
/* si posiziona sul primo indice */
|
||||||
tt=d4tag_selected(dbdata[handle]);
|
tt=d4tag_selected(dbdata[handle]);
|
||||||
if(tt==NULL) return(-1);
|
if(tt==NULL) return(-1);
|
||||||
@ -1446,7 +1452,7 @@ int DB_tagget(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_first(int handle)
|
int DB_first(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4top(dbdata[handle]));
|
return(d4top(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,7 +1463,7 @@ int DB_first(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_last(int handle)
|
int DB_last(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4bottom(dbdata[handle]));
|
return(d4bottom(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1467,7 +1473,7 @@ int DB_last(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_next(int handle)
|
int DB_next(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4skip(dbdata[handle],1L));
|
return(d4skip(dbdata[handle],1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1476,7 +1482,7 @@ int DB_next(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_prev(int handle)
|
int DB_prev(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4skip(dbdata[handle],-1L));
|
return(d4skip(dbdata[handle],-1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1486,7 +1492,7 @@ int DB_prev(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_skip(int handle,long int recno)
|
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));
|
return(d4skip(dbdata[handle],recno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1495,7 +1501,7 @@ int DB_skip(int handle,long int recno)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_lock(int handle)
|
int DB_lock(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4lock(dbdata[handle],d4recno(dbdata[handle])));
|
return(d4lock(dbdata[handle],d4recno(dbdata[handle])));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1504,7 +1510,7 @@ int DB_lock(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_unlock(int handle)
|
int DB_unlock(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4unlock(dbdata[handle]));
|
return(d4unlock(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1518,7 +1524,7 @@ int DB_seek(int handle,char *key)
|
|||||||
TAG4 * tt;
|
TAG4 * tt;
|
||||||
char * k;
|
char * k;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
rc = d4seek(dbdata[handle],key);
|
rc = d4seek(dbdata[handle],key);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@ -1541,7 +1547,7 @@ int DB_seek(int handle,char *key)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_eof(int handle)
|
int DB_eof(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4eof(dbdata[handle]));
|
return(d4eof(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1550,7 +1556,7 @@ int DB_eof(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_bof(int handle)
|
int DB_bof(int handle)
|
||||||
{
|
{
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
return(d4bof(dbdata[handle]));
|
return(d4bof(dbdata[handle]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1559,7 +1565,7 @@ int DB_bof(int handle)
|
|||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
int DB_go(int handle,long recno)
|
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(&xdb[handle],recno));
|
||||||
return(d4go(dbdata[handle],recno));
|
return(d4go(dbdata[handle],recno));
|
||||||
}
|
}
|
||||||
@ -1570,7 +1576,7 @@ int DB_go(int handle,long recno)
|
|||||||
int DB_delete(int handle)
|
int DB_delete(int handle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
d4delete(dbdata[handle]);
|
d4delete(dbdata[handle]);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -1581,7 +1587,7 @@ int DB_delete(int handle)
|
|||||||
int DB_recall(int handle)
|
int DB_recall(int handle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
d4recall(dbdata[handle]);
|
d4recall(dbdata[handle]);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -1599,7 +1605,7 @@ int DB_delkey(int handle, char* key, long recno)
|
|||||||
/* (dati o indice) da me stesso*/
|
/* (dati o indice) da me stesso*/
|
||||||
char fn[64];
|
char fn[64];
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
t=d4tag_default(dbdata[handle]);
|
t=d4tag_default(dbdata[handle]);
|
||||||
|
|
||||||
if (u4switch() & 2 || u4switch() & 8) /* Clipper & DBIII */
|
if (u4switch() & 2 || u4switch() & 8) /* Clipper & DBIII */
|
||||||
@ -1647,7 +1653,7 @@ int DB_flush(int handle)
|
|||||||
int DB_rewrite(int handle)
|
int DB_rewrite(int handle)
|
||||||
{
|
{
|
||||||
int rt;
|
int rt;
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
while ((rt=d4write(dbdata[handle],d4recno(dbdata[handle]))) == r4locked)
|
while ((rt=d4write(dbdata[handle],d4recno(dbdata[handle]))) == r4locked)
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
yesnofatal_box("Sono in attesa nella DB_rewrite");
|
yesnofatal_box("Sono in attesa nella DB_rewrite");
|
||||||
@ -1744,7 +1750,7 @@ int DB_lockfile(int handle)
|
|||||||
{
|
{
|
||||||
int rt;
|
int rt;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
rt = d4lock_file(dbdata[handle]);
|
rt = d4lock_file(dbdata[handle]);
|
||||||
if (rt==0) rt=d4lock_index(dbdata[handle]);
|
if (rt==0) rt=d4lock_index(dbdata[handle]);
|
||||||
return(rt);
|
return(rt);
|
||||||
@ -1895,7 +1901,7 @@ int DB_packfile(short vis, const char * filename, long eod)
|
|||||||
int rt=0,handle;
|
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
|
codebase.auto_open = 0 cosi' non apre gli indici
|
||||||
*/
|
*/
|
||||||
code_base.auto_open = 0;
|
code_base.auto_open = 0;
|
||||||
@ -2345,7 +2351,7 @@ int DB_index_seek(int handle, char* from)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
||||||
|
|
||||||
if (t4seek(t,from,strlen(from)) < 0) return(DB_get_error());
|
if (t4seek(t,from,strlen(from)) < 0) return(DB_get_error());
|
||||||
@ -2361,7 +2367,7 @@ long DB_index_recno(int handle)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
||||||
|
|
||||||
return(t4recno(t));
|
return(t4recno(t));
|
||||||
@ -2374,7 +2380,7 @@ long DB_index_next(int handle)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
||||||
|
|
||||||
return(t4skip(t,1L));
|
return(t4skip(t,1L));
|
||||||
@ -2393,7 +2399,7 @@ char* DB_index_getkey(int handle)
|
|||||||
if (key == NULL)
|
if (key == NULL)
|
||||||
key = malloc(MAXLEN);
|
key = malloc(MAXLEN);
|
||||||
|
|
||||||
if(dbdata[handle]==0)
|
if(!handle_ok(handle))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((t=d4tag_default(dbdata[handle]))==NULL) return(NULL);
|
if ((t=d4tag_default(dbdata[handle]))==NULL) return(NULL);
|
||||||
@ -2412,7 +2418,7 @@ int DB_index_eof(int handle)
|
|||||||
{
|
{
|
||||||
TAG4 *t;
|
TAG4 *t;
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
if ((t=d4tag_default(dbdata[handle]))==NULL) return(-1);
|
||||||
return(t4eof(t));
|
return(t4eof(t));
|
||||||
}
|
}
|
||||||
@ -2423,7 +2429,7 @@ int DB_index_eof(int handle)
|
|||||||
|
|
||||||
int DB_lock_rec(int handle,long nrec)
|
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);
|
if(d4lock(dbdata[handle],nrec)==r4locked) return(-1);
|
||||||
else return(0);
|
else return(0);
|
||||||
}
|
}
|
||||||
@ -2436,7 +2442,7 @@ int DB_lock_rec(int handle,long nrec)
|
|||||||
|
|
||||||
int DB_file_locked(int handle)
|
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]));
|
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)
|
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));
|
return(d4lock_test(dbdata[handle],nrec));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2469,7 +2475,7 @@ long DB_changed(int handle)
|
|||||||
INDEX4 *i;
|
INDEX4 *i;
|
||||||
char fn[64];
|
char fn[64];
|
||||||
|
|
||||||
if(dbdata[handle]==0) return(-1);
|
if(!handle_ok(handle)) return(-1);
|
||||||
if (u4switch() & 2 || u4switch() & 8) /* Clipper & DBIII */
|
if (u4switch() & 2 || u4switch() & 8) /* Clipper & DBIII */
|
||||||
u4name_piece(fn,64,dbdata[handle]->file.name,0,0);
|
u4name_piece(fn,64,dbdata[handle]->file.name,0,0);
|
||||||
else
|
else
|
||||||
|
@ -83,8 +83,7 @@ void TConfig::_write_paragraph(
|
|||||||
for (THash_object* o = _data.get_hashobj(); o; o = _data.get_hashobj())
|
for (THash_object* o = _data.get_hashobj(); o; o = _data.get_hashobj())
|
||||||
out << o->key() << " = " << (TString&)(o->obj()) << '\n';
|
out << o->key() << " = " << (TString&)(o->obj()) << '\n';
|
||||||
*/
|
*/
|
||||||
TString_array a; list_variables(a, FALSE);
|
TString_array a; list_variables(a, FALSE,_paragraph,TRUE); // get array sorted by varname
|
||||||
a.sort();
|
|
||||||
for (int i = 0; i < a.items(); i++)
|
for (int i = 0; i < a.items(); i++)
|
||||||
{
|
{
|
||||||
TToken_string& name = a.row(i);
|
TToken_string& name = a.row(i);
|
||||||
@ -159,7 +158,8 @@ bool TConfig::set_paragraph(const char* section)
|
|||||||
_write_file();
|
_write_file();
|
||||||
_paragraph = section;
|
_paragraph = section;
|
||||||
_dirty = FALSE;
|
_dirty = FALSE;
|
||||||
ok = _read_paragraph();
|
_ispresent = _read_paragraph();
|
||||||
|
ok = _ispresent;
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -583,8 +583,42 @@ int TConfig::list_paragraphs(TString_array& pl)
|
|||||||
return pl.items();
|
return pl.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< config.cpp
|
||||||
int TConfig::list_variables(TString_array& vl, bool value, const char* section)
|
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);
|
set_paragraph(section);
|
||||||
vl.destroy();
|
vl.destroy();
|
||||||
_data.restart();
|
_data.restart();
|
||||||
@ -597,6 +631,9 @@ int TConfig::list_variables(TString_array& vl, bool value, const char* section)
|
|||||||
vl.add(t);
|
vl.add(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sort)
|
||||||
|
vl.TArray::sort(compare_ini_variables);
|
||||||
|
|
||||||
return vl.items();
|
return vl.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ public:
|
|||||||
// @cmember Riempie <p vl> con la lista dei nomi delle variabili
|
// @cmember Riempie <p vl> con la lista dei nomi delle variabili
|
||||||
// nella sezione corrente o in quella indicata; se
|
// nella sezione corrente o in quella indicata; se
|
||||||
// add_value e' TRUE ci mette "variabile<pipe>valore"
|
// add_value e' TRUE ci mette "variabile<pipe>valore"
|
||||||
// ACHTUNG: l'array e' in ordine HASH
|
// 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);
|
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
|
// @cmember Ritorna l'intero array delle variabili della sezione
|
||||||
// eventualmente specificata da <p section>
|
// eventualmente specificata da <p section>
|
||||||
|
@ -84,11 +84,19 @@ KEY TControl::xiev_to_key(const XI_EVENT* xiev)
|
|||||||
KEY key = k;
|
KEY key = k;
|
||||||
if (key < K_INS || key > K_HELP)
|
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.shift && (k < ' ' || k >= K_UP)) key += K_SHIFT;
|
||||||
// if (xiev->v.chr.control && k >= ' ') key += K_CTRL;
|
// if (xiev->v.chr.control && k >= ' ') key += K_CTRL;
|
||||||
// Correzione per gestire i tasti AltGr sulle tastiere non U.S.A.
|
// 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)))
|
if (xiev->v.chr.control && ((k >= K_F1 && k <= K_F12) || isalnum(k) || strchr("\r+-*/", k)))
|
||||||
key += K_CTRL;
|
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;
|
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->tab_on_enter = TRUE;
|
||||||
def->v.itf->win = win;
|
def->v.itf->win = win;
|
||||||
|
|
||||||
|
<<<<<<< controls.cpp
|
||||||
def->v.itf->edit_menu = TRUE; // Update edit menu items
|
def->v.itf->edit_menu = TRUE; // Update edit menu items
|
||||||
def->v.itf->menu_win = TASK_WIN; // Window that owns the menu
|
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);
|
XI_OBJ* itf = xi_create(NULL, def);
|
||||||
CHECK(itf, "Can't create an interface");
|
CHECK(itf, "Can't create an interface");
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ bool TDate::is_end_month()
|
|||||||
return day() == last_day(month(),year());
|
return day() == last_day(month(),year());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TDate::empty()
|
bool TDate::empty() const
|
||||||
{
|
{
|
||||||
return _val == 0;
|
return _val == 0;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public:
|
|||||||
// @cmember Setta il giorno del mese all'ultimo possibile
|
// @cmember Setta il giorno del mese all'ultimo possibile
|
||||||
void set_end_month();
|
void set_end_month();
|
||||||
// @cmember Controlla se la data è nulla
|
// @cmember Controlla se la data è nulla
|
||||||
bool empty();
|
bool empty() const ;
|
||||||
|
|
||||||
// @cmember Setta la il giorno
|
// @cmember Setta la il giorno
|
||||||
void set_day(int n);
|
void set_day(int n);
|
||||||
|
279
include/form.cpp
279
include/form.cpp
@ -802,9 +802,9 @@ void TForm_item::send_message_to_group(const char * cmd,byte id,const TPrint_sec
|
|||||||
}
|
}
|
||||||
// look into sections beside ("brothers" )
|
// look into sections beside ("brothers" )
|
||||||
for (int j = 0; j < section.subsections(); j++) {
|
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) {
|
if (&bs!=starting_section) {
|
||||||
send_message_to_group(cmd,id,section.subsection(j)->subsection(),§ion);
|
send_message_to_group(cmd,id,section.subsection(j)->printsection(),§ion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1004,7 +1004,8 @@ short TForm_item::x()
|
|||||||
|
|
||||||
TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm)
|
TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm)
|
||||||
: TForm_item(s), _ssec(&(s->form()), s->section_type(), s->page_type()),
|
: 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);
|
_ssec.set_subsection_above(this);
|
||||||
}
|
}
|
||||||
@ -1012,6 +1013,7 @@ TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm)
|
|||||||
TForm_subsection::~TForm_subsection()
|
TForm_subsection::~TForm_subsection()
|
||||||
{
|
{
|
||||||
if (_condexpr) delete _condexpr;
|
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
|
TObject* TForm_subsection::dup() const
|
||||||
@ -1021,7 +1023,20 @@ TObject* TForm_subsection::dup() const
|
|||||||
fs->_ssec = _ssec;
|
fs->_ssec = _ssec;
|
||||||
fs->_name = _name;
|
fs->_name = _name;
|
||||||
fs->_file_id = _file_id;
|
fs->_file_id = _file_id;
|
||||||
|
fs->_title_type = _title_type;
|
||||||
|
fs->_show_title=_show_title;
|
||||||
|
if (_condexpr)
|
||||||
fs->_condexpr=new TExpression((const char *)_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;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,12 +1058,50 @@ void TForm_subsection::setcondition(const char * cond,TTypeexp type)
|
|||||||
{
|
{
|
||||||
if (_condexpr) {
|
if (_condexpr) {
|
||||||
if (_file_id!=-1)
|
if (_file_id!=-1)
|
||||||
subsection().set_subs_cond(_file_id,cond,_condexpr->string());
|
printsection().set_subs_cond(_file_id,cond,_condexpr->string());
|
||||||
delete _condexpr;
|
delete _condexpr;
|
||||||
}
|
}
|
||||||
_condexpr=new TExpression(cond,type);
|
_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)
|
void TPrint_section::set_subs_cond(int file,const char *newcond,const char * oldcond)
|
||||||
{
|
{
|
||||||
TForm_subsection * s;
|
TForm_subsection * s;
|
||||||
@ -1078,11 +1131,45 @@ TForm_subsection *TForm_subsection::upper_conditional() const
|
|||||||
return NULL;
|
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)
|
bool TForm_subsection::parse(TScanner& s)
|
||||||
{
|
{
|
||||||
_section->add_subsection(this);
|
|
||||||
|
|
||||||
|
_section->add_subsection(this);
|
||||||
name(s.pop());
|
name(s.pop());
|
||||||
//_width = s.integer(); // ...unused
|
//_width = s.integer(); // ...unused
|
||||||
//_x = s.integer(); // ...unused
|
//_x = s.integer(); // ...unused
|
||||||
@ -1112,6 +1199,18 @@ bool TForm_subsection::parse(TScanner& s)
|
|||||||
_condexpr = new TExpression(s.line(),_numexpr); //
|
_condexpr = new TExpression(s.line(),_numexpr); //
|
||||||
else if (s.key() == "ST") // ST_RING CONDITION di gestione della sezione
|
else if (s.key() == "ST") // ST_RING CONDITION di gestione della sezione
|
||||||
_condexpr = new TExpression(s.line(),_strexpr); //
|
_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)
|
else if (s.key() != "GR") // GR_OUP section (raggruppamento puro)
|
||||||
s.push();
|
s.push();
|
||||||
}
|
}
|
||||||
@ -1123,26 +1222,38 @@ bool TForm_subsection::parse(TScanner& s)
|
|||||||
|
|
||||||
// nel caso di subsection viene chiamata la set_body anzichè la update
|
// nel caso di subsection viene chiamata la set_body anzichè la update
|
||||||
bool TForm_subsection::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;
|
bool ok = FALSE;
|
||||||
TCursor* cur = form().cursor();
|
TCursor* cur = form().cursor();
|
||||||
TRelation* rel = (TRelation* )form().relation();
|
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
|
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
|
else if (_file_id == -1 && _condexpr!=NULL) // subsection condizionale
|
||||||
{
|
{
|
||||||
if ((bool)(_section->eval_expr(*_condexpr,_file_id)))
|
if ((bool)(_section->eval_expr(*_condexpr,_file_id)))
|
||||||
ok = _ssec.update_and_print(showfields && shown(),atnewpage());
|
ok = _ssec.update_and_print(showfields,atnewpage());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_ssec.set_repeat_count(0);
|
||||||
if (_condexpr) { // sottosezione di raggruppamenti su file
|
if (_condexpr) { // sottosezione di raggruppamenti su file
|
||||||
int i = 0;
|
int i = 0;
|
||||||
TString group_expr((const char *)(_section->eval_expr(*_condexpr,_file_id)));
|
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);
|
form().match_result(_file_id);
|
||||||
if (!_bigskip || i==0)
|
if (!_bigskip || i==0)
|
||||||
{
|
{
|
||||||
if (!(ok = _ssec.update_and_print(showfields && shown(),atnewpage())))
|
ok |= _ssec.update_and_print(showfields,atnewpage());
|
||||||
break;
|
|
||||||
_ssec.set_repeat_count(++i);
|
_ssec.set_repeat_count(++i);
|
||||||
}
|
}
|
||||||
if (form().next_match_done(_file_id))
|
if (form().next_match_done(_file_id))
|
||||||
@ -1164,7 +1274,7 @@ bool TForm_subsection::set_body(bool showfields)
|
|||||||
form().match_result(_file_id,again); // store if a match occoured
|
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
|
} else { // sottosezione di file
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (cur->is_first_match(_file_id))
|
if (cur->is_first_match(_file_id))
|
||||||
@ -1172,18 +1282,19 @@ bool TForm_subsection::set_body(bool showfields)
|
|||||||
bool again;
|
bool again;
|
||||||
do {
|
do {
|
||||||
form().match_result(_file_id);
|
form().match_result(_file_id);
|
||||||
if (!(ok = _ssec.update_and_print(showfields && shown(),atnewpage())))
|
ok |= _ssec.update_and_print(showfields,atnewpage());
|
||||||
break;
|
|
||||||
_ssec.set_repeat_count(++i);
|
_ssec.set_repeat_count(++i);
|
||||||
if (form().next_match_done(_file_id))
|
if (form().next_match_done(_file_id))
|
||||||
again=form().last_match_result(_file_id);
|
again=form().last_match_result(_file_id);
|
||||||
else
|
else
|
||||||
again= cur->next_match(_file_id);
|
again= cur->next_match(_file_id);
|
||||||
} while (again);
|
} 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;
|
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 ="";
|
tmp ="";
|
||||||
else
|
else
|
||||||
tmp.picture(pic, s); // riempi la stringa col valore pitturato
|
tmp.picture(pic, s); // riempi la stringa col valore pitturato
|
||||||
@ -2230,7 +2341,7 @@ word TPrint_section::height() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
h = items();
|
h = _rows.items();
|
||||||
if (h == 0)
|
if (h == 0)
|
||||||
h = 0xFFFF - _height + 1; // Same as abs(_height)
|
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;
|
_msk = ps._msk; _height = ps._height; _ofspc = ps._ofspc;
|
||||||
_ofsvr = ps._ofsvr; _nfld = ps._nfld; _dirty = ps._dirty;
|
_ofsvr = ps._ofsvr; _nfld = ps._nfld; _dirty = ps._dirty;
|
||||||
_columnwise = ps._columnwise; _temp = ps._temp; _form = ps._form;
|
_temp = ps._temp; _form = ps._form;
|
||||||
_sec_type = ps._sec_type; _page_type = ps._page_type; _upsection = ps._upsection;
|
_sec_type = ps._sec_type; _page_type = ps._page_type;
|
||||||
_item = ps._item; _repeat_count = ps._repeat_count;
|
_item = ps._item;
|
||||||
_subsections=ps._subsections;
|
// 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];
|
for (int i = 0; i < MAXCOLUMNS; i++) _tab[i] = ps._tab[i];
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPrintrow& TPrint_section::row(int num)
|
TPrintrow& TPrint_section::row(int num)
|
||||||
{
|
{
|
||||||
TPrintrow* pr = (TPrintrow*)objptr(num);
|
TPrintrow* pr = (TPrintrow*)_rows.objptr(num);
|
||||||
if (pr == NULL)
|
if (pr == NULL)
|
||||||
{
|
{
|
||||||
pr = new TPrintrow;
|
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;
|
return *pr;
|
||||||
}
|
}
|
||||||
@ -2409,7 +2534,7 @@ word TPrint_section::subs_height() const
|
|||||||
{
|
{
|
||||||
fss=subsection(0);
|
fss=subsection(0);
|
||||||
h=subsection(0)->height();
|
h=subsection(0)->height();
|
||||||
h+=subsection(0)->subsection().subs_height(); // ricorsione...
|
h+=subsection(0)->printsection().subs_height(); // ricorsione...
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
@ -2499,10 +2624,10 @@ bool TPrint_section::parse(TScanner& scanner)
|
|||||||
// Azzera tutte le righe della sezione di stampa
|
// Azzera tutte le righe della sezione di stampa
|
||||||
void TPrint_section::reset()
|
void TPrint_section::reset()
|
||||||
{
|
{
|
||||||
for (int i = last(); i >= 0; i--)
|
for (int i = _rows.last(); i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (_height > 0xF000)
|
if (_height > 0xF000)
|
||||||
destroy(i);
|
_rows.destroy(i);
|
||||||
else
|
else
|
||||||
row(i).reset();
|
row(i).reset();
|
||||||
}
|
}
|
||||||
@ -3248,9 +3373,9 @@ TForm_item *TPrint_section::find_field_everywhere(short id,const TPrint_section
|
|||||||
// look into sections beside ("brothers" )
|
// look into sections beside ("brothers" )
|
||||||
for (int j = 0; j < subsections(); j++)
|
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) {
|
if (&bs!=starting_section) {
|
||||||
f=subsection(j)->subsection().find_field_everywhere(id,this);
|
f=bs.find_field_everywhere(id,this);
|
||||||
if (f)
|
if (f)
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
@ -3278,7 +3403,7 @@ TForm_item *TPrint_section::find_field_everywhere(const char *sec_name,const TPr
|
|||||||
}
|
}
|
||||||
// search down
|
// search down
|
||||||
for (j = 0; j < subsections(); j++) {
|
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)
|
if (it)
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
@ -3758,7 +3883,7 @@ bool TForm::ps_change_date_format(
|
|||||||
TForm_item& fi = s.field(i);
|
TForm_item& fi = s.field(i);
|
||||||
if (fi.is_section())
|
if (fi.is_section())
|
||||||
{
|
{
|
||||||
TPrint_section& ps = ((TForm_subsection&)fi).subsection();
|
TPrint_section& ps = ((TForm_subsection&)fi).printsection();
|
||||||
ps_change_date_format(ps, f);
|
ps_change_date_format(ps, f);
|
||||||
}
|
}
|
||||||
else if (strcmp(fi.class_name(), "DATA") == 0)
|
else if (strcmp(fi.class_name(), "DATA") == 0)
|
||||||
@ -3790,7 +3915,7 @@ bool TForm::ps_change_number_format(
|
|||||||
TForm_item& fi = s.field(i);
|
TForm_item& fi = s.field(i);
|
||||||
if (fi.is_section())
|
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);
|
ps_change_number_format(ps, w, dec, p);
|
||||||
}
|
}
|
||||||
else if (strcmp(fi.class_name(), "NUMERO") == 0)
|
else if (strcmp(fi.class_name(), "NUMERO") == 0)
|
||||||
@ -3897,7 +4022,7 @@ word TForm::set_body(
|
|||||||
{
|
{
|
||||||
TPrint_section& body = section('B', p);
|
TPrint_section& body = section('B', p);
|
||||||
|
|
||||||
if (u) body.update_and_print(TRUE);
|
if (u) body.update_and_print(printmode_normal);
|
||||||
else body.reset();
|
else body.reset();
|
||||||
|
|
||||||
return body.height();
|
return body.height();
|
||||||
@ -3912,68 +4037,80 @@ TPrint_section * TPrint_section::section_above() const
|
|||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @mfunc Compone e stampa tutte le righe della sezione (valida in caso di BODY)
|
// @mfunc Compone e stampa tutte le righe della sezione (valida in caso di BODY)
|
||||||
//
|
// ritorna se c'e' stata una valutazione
|
||||||
bool TPrint_section::update_and_print(bool show_fields, bool new_page)
|
bool TPrint_section::update_and_print(const sec_print_mode show_fields, bool new_page)
|
||||||
{
|
{
|
||||||
bool ok=TRUE;
|
bool ok=FALSE;
|
||||||
TPrinter& pr = printer();
|
TPrinter& pr = printer();
|
||||||
word last_printed_row=0;
|
word last_printed_row=0;
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
if (show_fields
|
|
||||||
|
if (show_fields == printmode_normal
|
||||||
&& pr.current_row() > pr.headersize()+1
|
&& pr.current_row() > pr.headersize()+1
|
||||||
&& new_page)
|
&& new_page)
|
||||||
{
|
{
|
||||||
pr.formfeed();
|
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++)
|
for (word i = 0; i < fields(); i++)
|
||||||
{
|
{
|
||||||
if (!field(i).is_section())
|
if (!field(i).is_section())
|
||||||
{ // compose rows using "simple" fields
|
{
|
||||||
const bool esito = field(i).update();
|
// compose rows using "simple" fields
|
||||||
if (!esito) ok = FALSE;
|
field(i).update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
last_hpos=min(word(field(i).y()-1), height());
|
||||||
|
// found a subsection
|
||||||
TForm_subsection & ss=(TForm_subsection & )field(i);
|
TForm_subsection & ss=(TForm_subsection & )field(i);
|
||||||
int last_hpos=min(word(field(i).y()-1), height());
|
|
||||||
// found a subsection:print preceeding rows
|
last_printed_row=print_rows(show_fields,last_printed_row,last_hpos);
|
||||||
// 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
|
// process subsection
|
||||||
if (ss.enabled())
|
if (ss.enabled())
|
||||||
ss.set_body(show_fields) ;
|
ok |= ss.print_body(show_fields) ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // ... loop for each field
|
||||||
|
|
||||||
const word hgt = height();
|
const word hgt = height();
|
||||||
|
if (print_rows(show_fields,last_printed_row,hgt) > 0 && show_fields==printmode_normal)
|
||||||
if (show_fields &&
|
ok = TRUE;
|
||||||
last_printed_row < hgt &&
|
// print footers
|
||||||
pr.current_row() > pr.headersize()+1)
|
if (subsection_above()!=NULL && !subsection_above()->is_title() && ok)
|
||||||
{
|
subsection_above()->print_qtitle();
|
||||||
if (hgt-last_printed_row > pr.rows_left())
|
|
||||||
pr.formfeed();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (show_fields)
|
|
||||||
{
|
|
||||||
for (word j = last_printed_row; j < hgt; j++)
|
|
||||||
pr.print(row(j));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
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
|
// @doc EXTERNAL
|
||||||
|
|
||||||
@ -5207,7 +5344,7 @@ void TForm::read(
|
|||||||
if (forms.status() == NOERR)
|
if (forms.status() == NOERR)
|
||||||
{
|
{
|
||||||
_desc = forms.get("DESC");
|
_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.reread(_lock);
|
||||||
forms.put("DESC",desc);
|
forms.put("DESC",desc);
|
||||||
|
@ -17,7 +17,6 @@ class TMask;
|
|||||||
#ifndef __ISAM_H
|
#ifndef __ISAM_H
|
||||||
class TRectype;
|
class TRectype;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __RELATION_H
|
#ifndef __RELATION_H
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#endif
|
#endif
|
||||||
@ -41,6 +40,19 @@ enum pagetype {
|
|||||||
|
|
||||||
// @doc INTERNAL
|
// @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);
|
pagetype char2page(char);
|
||||||
|
|
||||||
class TForm;
|
class TForm;
|
||||||
@ -457,8 +469,8 @@ public:
|
|||||||
|
|
||||||
// @class TPrint_section | Classe per la gestione della stampa di una sezione di <c TForm>
|
// @class TPrint_section | Classe per la gestione della stampa di una sezione di <c TForm>
|
||||||
//
|
//
|
||||||
// @base public | TArray
|
// @base public | TObject
|
||||||
class TPrint_section : public TArray
|
class TPrint_section : public TObject
|
||||||
|
|
||||||
// @author:(INTERNAL) Guido, Angelo, Villa
|
// @author:(INTERNAL) Guido, Angelo, Villa
|
||||||
|
|
||||||
@ -467,6 +479,10 @@ class TPrint_section : public TArray
|
|||||||
// @cmember:(INTERNAL) Maschera di edit della sezione corrente
|
// @cmember:(INTERNAL) Maschera di edit della sezione corrente
|
||||||
static TMask* _msk;
|
static TMask* _msk;
|
||||||
|
|
||||||
|
// @cmember:(INTERNAL) Array delle righe
|
||||||
|
TArray _rows;
|
||||||
|
// @cmember:(INTERNAL) Array delle righe dei titoli
|
||||||
|
TArray _titlerows;
|
||||||
// @cmember:(INTERNAL) Altezza della sezione
|
// @cmember:(INTERNAL) Altezza della sezione
|
||||||
word _height;
|
word _height;
|
||||||
// @cmember:(INTERNAL) Offset prima colonna
|
// @cmember:(INTERNAL) Offset prima colonna
|
||||||
@ -530,6 +546,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// @cmember Ritorna la <c TPrintrow> della riga <p num>
|
// @cmember Ritorna la <c TPrintrow> della riga <p num>
|
||||||
TPrintrow& row(int 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
|
// @cmember Ritorna il <c TForm> a cui appartiene la sezione
|
||||||
TForm& form() const
|
TForm& form() const
|
||||||
{ return *_form; }
|
{ return *_form; }
|
||||||
@ -603,6 +621,9 @@ public:
|
|||||||
// @cmember Setta il numero di ripetizioni eseguite
|
// @cmember Setta il numero di ripetizioni eseguite
|
||||||
void set_repeat_count(int x)
|
void set_repeat_count(int x)
|
||||||
{ _repeat_count = x; }
|
{ _repeat_count = x; }
|
||||||
|
// @cmember Ritorna il numero di ripetizioni eseguite
|
||||||
|
int repeat_count()
|
||||||
|
{ return _repeat_count; }
|
||||||
|
|
||||||
// @cmember Setta l'altezza della sezione
|
// @cmember Setta l'altezza della sezione
|
||||||
void set_height(word h)
|
void set_height(word h)
|
||||||
@ -614,10 +635,15 @@ public:
|
|||||||
|
|
||||||
// @cmember Azzera tutte le righe della sezione di stampa
|
// @cmember Azzera tutte le righe della sezione di stampa
|
||||||
void reset();
|
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
|
// @cmember Aggiorna tutti i campi e li inserisce nel buffer delle righe di stampa
|
||||||
virtual bool update();
|
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)
|
// @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>)
|
// @cmember Legge la testata dal file di testo (vedi <c TScanner>)
|
||||||
bool parse_head(TScanner& scanner);
|
bool parse_head(TScanner& scanner);
|
||||||
// @cmember Legge i campi della sezione dal file di testo (vedi <c TScanner>)
|
// @cmember Legge i campi della sezione dal file di testo (vedi <c TScanner>)
|
||||||
@ -976,8 +1002,12 @@ public:
|
|||||||
|
|
||||||
class TForm_subsection : public TForm_item
|
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
|
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)
|
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
|
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 const char* class_name() const { return "SEZIONE"; }
|
||||||
virtual bool is_section() const { return TRUE; }
|
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
|
// @cmember Ritorna se la sezione è da stampare a inizio di pagina nuova
|
||||||
bool atnewpage() {return _flag.newpage;}
|
bool atnewpage() {return _flag.newpage;}
|
||||||
@ -1008,14 +1051,21 @@ public:
|
|||||||
// @cmember Ritorna il nome della sezione
|
// @cmember Ritorna il nome della sezione
|
||||||
void name(const char* s) { _name = s; _desc << "Sottosezione " << s; }
|
void name(const char* s) { _name = s; _desc << "Sottosezione " << s; }
|
||||||
const char* name() const { return _name; }
|
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
|
// @cmember restituisce la condizione della sottosezione
|
||||||
const char * condition();
|
const char * condition();
|
||||||
// @cmember restituisce il numero del file associato alla sottosezione
|
// @cmember restituisce il numero del file associato alla sottosezione
|
||||||
int fileid();
|
int fileid();
|
||||||
// @cmember imposta la condizione della sottosezione
|
// @cmember imposta la condizione della sottosezione
|
||||||
void setcondition(const char * cond,TTypeexp type=_numexpr);
|
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
|
// @cmember Costruttore
|
||||||
TForm_subsection(TPrint_section* above_section, const char* name = "");
|
TForm_subsection(TPrint_section* above_section, const char* name = "");
|
||||||
virtual ~TForm_subsection();
|
virtual ~TForm_subsection();
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <scanner.h>
|
#include <scanner.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <memo.h>
|
#include <memo.h>
|
||||||
#include <codeb.h>
|
|
||||||
#include <varrec.h>
|
#include <varrec.h>
|
||||||
|
|
||||||
#define RECLOCKTYPES 0xFF00
|
#define RECLOCKTYPES 0xFF00
|
||||||
@ -538,37 +537,6 @@ void set_autoload_new_files(
|
|||||||
__autoload = on;
|
__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
|
// TBaseisamfile
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -1764,6 +1732,8 @@ int TSystemisamfile::update(
|
|||||||
dir.eod() = ni;
|
dir.eod() = ni;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (err==NOERR)
|
||||||
|
{
|
||||||
dir.set_len(lenr);
|
dir.set_len(lenr);
|
||||||
dir.put(num(), _nordir, _sysdirop);
|
dir.put(num(), _nordir, _sysdirop);
|
||||||
wrec.put(num());
|
wrec.put(num());
|
||||||
@ -1777,6 +1747,7 @@ int TSystemisamfile::update(
|
|||||||
err = exec_convapp(lev, FALSE); // Post - conversion
|
err = exec_convapp(lev, FALSE); // Post - conversion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setstatus(err);
|
setstatus(err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -2598,6 +2598,10 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
TDir d; d.get(logicnum);
|
TDir d; d.get(logicnum);
|
||||||
if (fexist(d.filename())) // Controlla l'esistenza del file
|
if (fexist(d.filename())) // Controlla l'esistenza del file
|
||||||
r = new TRelation(logicnum);
|
r = new TRelation(logicnum);
|
||||||
|
#ifdef DBG
|
||||||
|
else
|
||||||
|
fatal_box("Impossibile creare una USE sul file %s",d.filename());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2653,6 +2657,12 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
}
|
}
|
||||||
_check_enabled = TRUE;
|
_check_enabled = TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (scanner.popkey() == "JO")
|
||||||
|
scanner.line();
|
||||||
|
scanner.push();
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2660,8 +2670,9 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
if (scanner.key() == "CO") // Copyuse
|
if (scanner.key() == "CO") // Copyuse
|
||||||
{
|
{
|
||||||
const TString16 what(scanner.popkey());
|
const TString16 what(scanner.popkey());
|
||||||
|
|
||||||
const TBrowse* b = parse_browse(scanner);
|
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 (b)
|
||||||
{
|
{
|
||||||
if (what == "US" || what == "AL")
|
if (what == "US" || what == "AL")
|
||||||
|
@ -2445,6 +2445,9 @@ void TSheet_field::delete_column( const int col ) const
|
|||||||
void TSheet_field::move_column( const int fromindex, const int toindex ) const
|
void TSheet_field::move_column( const int fromindex, const int toindex ) const
|
||||||
{
|
{
|
||||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||||
|
if (fromindex >= FIRST_FIELD)
|
||||||
|
s->move_column(s->cid2col(fromindex), toindex);
|
||||||
|
else
|
||||||
s->move_column(fromindex, toindex);
|
s->move_column(fromindex, toindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,16 +691,19 @@ void TPrint_application::set_row (
|
|||||||
r--;
|
r--;
|
||||||
|
|
||||||
char digbuf[10];
|
char digbuf[10];
|
||||||
char strbuf[120];
|
|
||||||
char fftt[120];
|
TString bigbuf(256);
|
||||||
char *fmt = fftt;
|
char* strbuf = bigbuf.get_buffer();
|
||||||
|
|
||||||
|
TString fftt(256);
|
||||||
|
char *fmt = fftt.get_buffer();
|
||||||
|
|
||||||
char fill = _fillchar;
|
char fill = _fillchar;
|
||||||
|
|
||||||
word flags = 0;
|
word flags = 0;
|
||||||
int size = 0, dec = 0, strind = 0;
|
int size = 0, dec = 0, strind = 0;
|
||||||
char ch, align = 'l';
|
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
|
// let the poor programmer use format() at will
|
||||||
strcpy (fmt, frmt);
|
strcpy (fmt, frmt);
|
||||||
_print_defined = TRUE;
|
_print_defined = TRUE;
|
||||||
@ -849,7 +852,6 @@ void TPrint_application::set_row (
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TString80 formato;
|
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case '#':
|
case '#':
|
||||||
@ -868,6 +870,7 @@ void TPrint_application::set_row (
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// read format
|
// read format
|
||||||
|
TString80 formato;
|
||||||
formato << ccc;
|
formato << ccc;
|
||||||
bool islong = FALSE;
|
bool islong = FALSE;
|
||||||
while (strchr (printf_types, ch) == NULL)
|
while (strchr (printf_types, ch) == NULL)
|
||||||
|
@ -656,13 +656,13 @@ TPrintrow::TPrintrow()
|
|||||||
TPrintrow::TPrintrow(const TPrintrow& pr)
|
TPrintrow::TPrintrow(const TPrintrow& pr)
|
||||||
{
|
{
|
||||||
_row = pr.row ();
|
_row = pr.row ();
|
||||||
memcpy (_attr, pr._attr, MAXSTR);
|
memcpy (_attr, pr._attr, MAX_PR_WIDTH);
|
||||||
memcpy (_cols, pr._cols, MAXSTR);
|
memcpy (_cols, pr._cols, MAX_PR_WIDTH);
|
||||||
_currentcolor = 'w';
|
_currentcolor = 'w';
|
||||||
_currentcolor <<= 8;
|
_currentcolor <<= 8;
|
||||||
_currentcolor += 'n';
|
_currentcolor += 'n';
|
||||||
_currentstyle = pr._currentstyle;
|
_currentstyle = pr._currentstyle;
|
||||||
for (int i = 0; i < MAXSTR; i++)
|
for (int i = 0; i < MAX_PR_WIDTH; i++)
|
||||||
_cols[i] = _currentcolor;
|
_cols[i] = _currentcolor;
|
||||||
_lastpos = pr._lastpos;
|
_lastpos = pr._lastpos;
|
||||||
}
|
}
|
||||||
@ -694,7 +694,7 @@ TPrintrow& TPrintrow::reset()
|
|||||||
_currentcolor = 'w';
|
_currentcolor = 'w';
|
||||||
_currentcolor <<= 8;
|
_currentcolor <<= 8;
|
||||||
_currentcolor += 'n';
|
_currentcolor += 'n';
|
||||||
for (int i = 0; i < MAXSTR; i++)
|
for (int i = 0; i < MAX_PR_WIDTH; i++)
|
||||||
_cols[i] = _currentcolor; // Azzera colori
|
_cols[i] = _currentcolor; // Azzera colori
|
||||||
|
|
||||||
_lastpos = 0;
|
_lastpos = 0;
|
||||||
@ -839,7 +839,7 @@ TPrintrow& TPrintrow::put(const char *str, int position, int len)
|
|||||||
int pp = atoi (digbuf);
|
int pp = atoi (digbuf);
|
||||||
if (toupper (c) == 'G')
|
if (toupper (c) == 'G')
|
||||||
{
|
{
|
||||||
if (pp >= MAXSTR)
|
if (pp >= MAX_PR_WIDTH)
|
||||||
fatal_box ("printrow reaches position %d", pp);
|
fatal_box ("printrow reaches position %d", pp);
|
||||||
if (pp > position)
|
if (pp > position)
|
||||||
for (int k = position; k < pp; k++)
|
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')
|
else if (toupper (c) == 'J')
|
||||||
{
|
{
|
||||||
if (pp + position >= MAXSTR)
|
if (pp + position >= MAX_PR_WIDTH)
|
||||||
fatal_box ("printrow reaches position %d", pp + position);
|
fatal_box ("printrow reaches position %d", pp + position);
|
||||||
for (int k = 0; k < pp; k++)
|
for (int k = 0; k < pp; k++)
|
||||||
{
|
{
|
||||||
@ -944,14 +944,24 @@ void TPrinter::init_formlen(
|
|||||||
|
|
||||||
if (prwin != NULL_WIN)
|
if (prwin != NULL_WIN)
|
||||||
{
|
{
|
||||||
const TString spc(256, 'M'); // Compute maximum number of chars per line
|
// Compute maximum number of chars per line
|
||||||
|
int mincol = 0,maxcol=MAX_PR_WIDTH;
|
||||||
|
TString spc(maxcol,'M');
|
||||||
|
|
||||||
int w = 0;
|
_formwidth = maxcol;
|
||||||
for (_formwidth = spc.len(); _formwidth >= 80; _formwidth--)
|
int w;
|
||||||
|
while (mincol < maxcol )
|
||||||
{
|
{
|
||||||
|
|
||||||
w = xvt_dwin_get_text_width(prwin, (char*)(const char*)spc, _formwidth);
|
w = xvt_dwin_get_text_width(prwin, (char*)(const char*)spc, _formwidth);
|
||||||
if (w < pw) break;
|
|
||||||
|
if (w < pw)
|
||||||
|
mincol = _formwidth+1;
|
||||||
|
else
|
||||||
|
maxcol=_formwidth-1;
|
||||||
|
_formwidth=(mincol+maxcol)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isfax())
|
if (isfax())
|
||||||
_horz_offset = 56;
|
_horz_offset = 56;
|
||||||
else
|
else
|
||||||
@ -959,7 +969,7 @@ void TPrinter::init_formlen(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_formwidth = 256;
|
_formwidth = int (pw * 10L / phr);
|
||||||
_horz_offset = 0;
|
_horz_offset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1062,6 +1072,7 @@ TPrinter::TPrinter()
|
|||||||
_curcode = 0; // first in list if no default is specified
|
_curcode = 0; // first in list if no default is specified
|
||||||
|
|
||||||
_formlen = 66;
|
_formlen = 66;
|
||||||
|
_formwidth = 0;
|
||||||
_frompage = 0;
|
_frompage = 0;
|
||||||
_topage = 0xffff;
|
_topage = 0xffff;
|
||||||
_hwformfeed = FALSE;
|
_hwformfeed = FALSE;
|
||||||
@ -1169,7 +1180,11 @@ void TPrinter::read_configuration(
|
|||||||
else
|
else
|
||||||
break;
|
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"
|
error_box("Attenzione: la stampante corrente non e' valida.\n"
|
||||||
"Si prega di selezionare e registrare una nuova stampante.");
|
"Si prega di selezionare e registrare una nuova stampante.");
|
||||||
@ -1992,6 +2007,7 @@ struct font_data
|
|||||||
int _columns;
|
int _columns;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HIDDEN
|
||||||
BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
|
BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
|
||||||
{
|
{
|
||||||
font_data& fd = *(font_data*)data;
|
font_data& fd = *(font_data*)data;
|
||||||
@ -2025,6 +2041,44 @@ BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
|
|||||||
return win != NULL_WIN;
|
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
|
int TPrinter::calc_font_size(int columns) const
|
||||||
{
|
{
|
||||||
font_data fd;
|
font_data fd;
|
||||||
@ -2040,6 +2094,16 @@ int TPrinter::calc_font_size(int columns) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
// Gestione fax
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -48,6 +48,9 @@ enum TGraphic_shape
|
|||||||
box // @emem Disgna un box
|
box // @emem Disgna un box
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 256 | Lunghezza massima della riga da stampare
|
||||||
|
#define MAX_PR_WIDTH 256
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @class TPrintrow | Classe per la definizione della stampa di una riga
|
// @class TPrintrow | Classe per la definizione della stampa di una riga
|
||||||
@ -59,15 +62,13 @@ class TPrintrow : public TObject
|
|||||||
|
|
||||||
// @access:(INTERNAL) Private Member
|
// @access:(INTERNAL) Private Member
|
||||||
{
|
{
|
||||||
// @ccost:(INTERNAL) MAXSTR | 256 | Lunghezza massima della riga da stampare
|
|
||||||
enum { MAXSTR = 256 };
|
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Stringa da stampare nella riga
|
// @cmember:(INTERNAL) Stringa da stampare nella riga
|
||||||
TString256 _row;
|
TString256 _row;
|
||||||
// @cmember:(INTERNAL) Attributi carattere dei caratteri
|
// @cmember:(INTERNAL) Attributi carattere dei caratteri
|
||||||
char _attr[MAXSTR];
|
char _attr[MAX_PR_WIDTH];
|
||||||
// @cmember:(INTERNAL) Attributi colore dei caratteri
|
// @cmember:(INTERNAL) Attributi colore dei caratteri
|
||||||
int _cols[MAXSTR];
|
int _cols[MAX_PR_WIDTH];
|
||||||
// @cmember:(INTERNAL) Inizio delle nuove posizioni di tabulazione
|
// @cmember:(INTERNAL) Inizio delle nuove posizioni di tabulazione
|
||||||
TBit_array _tab;
|
TBit_array _tab;
|
||||||
|
|
||||||
@ -692,6 +693,8 @@ public:
|
|||||||
|
|
||||||
// @cmember Calcola la dimensione del font per le colonne desiderate
|
// @cmember Calcola la dimensione del font per le colonne desiderate
|
||||||
int calc_font_size(int columns) const;
|
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
|
// @doc EXTERNAL
|
||||||
|
@ -297,7 +297,7 @@ void TRelation_application::query_mode(
|
|||||||
init_query_mode(*_mask);
|
init_query_mode(*_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_transaction.not_empty())
|
if (_curr_transaction.not_empty())
|
||||||
ini2query_mask();
|
ini2query_mask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ void TRelation_application::insert_mode()
|
|||||||
|
|
||||||
init_insert_mode(*_mask);
|
init_insert_mode(*_mask);
|
||||||
|
|
||||||
if (_transaction == "INSERT")
|
if (_curr_transaction == TRANSACTION_INSERT)
|
||||||
ini2insert_mask();
|
ini2insert_mask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -793,7 +793,7 @@ bool TRelation_application::relation_remove()
|
|||||||
if (protected_record(r.curr()))
|
if (protected_record(r.curr()))
|
||||||
return message_box("Documento non eliminabile");
|
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();
|
r.restore_status();
|
||||||
const bool ok = remove();
|
const bool ok = remove();
|
||||||
@ -832,21 +832,27 @@ bool TRelation_application::firm_change_enabled() const
|
|||||||
|
|
||||||
void TRelation_application::main_loop()
|
void TRelation_application::main_loop()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
KEY k;
|
||||||
|
do {
|
||||||
|
// ciclo delle transazioni
|
||||||
_recins = -1;
|
_recins = -1;
|
||||||
|
|
||||||
query_mode();
|
query_mode();
|
||||||
_mask->open_modal();
|
_mask->open_modal();
|
||||||
|
|
||||||
KEY k;
|
|
||||||
|
|
||||||
// Provoca l'autopremimento per il messaggio di LINK
|
// Provoca l'autopremimento per il messaggio di LINK
|
||||||
if (_lnflag)
|
if (_lnflag)
|
||||||
{
|
{
|
||||||
if (_transaction == "INSERT")
|
load_transaction();
|
||||||
|
|
||||||
|
if (_curr_transaction == TRANSACTION_INSERT )
|
||||||
|
{
|
||||||
_mask->send_key(K_CTRL+'N', 0);
|
_mask->send_key(K_CTRL+'N', 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_autodelete = _transaction == "DELETE";
|
_autodelete = _curr_transaction == TRANSACTION_DELETE;
|
||||||
_mask->send_key(K_AUTO_ENTER, 0);
|
_mask->send_key(K_AUTO_ENTER, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -859,7 +865,9 @@ void TRelation_application::main_loop()
|
|||||||
// Dis/abilita cambio parametri
|
// Dis/abilita cambio parametri
|
||||||
enable_menu_item(M_FILE_REVERT, change);
|
enable_menu_item(M_FILE_REVERT, change);
|
||||||
|
|
||||||
if (_mask->edit_mode() && _autodelete)
|
if (_mask->edit_mode())
|
||||||
|
{
|
||||||
|
if (_autodelete)
|
||||||
{
|
{
|
||||||
const int pos = _mask->id2pos(DLG_DELREC);
|
const int pos = _mask->id2pos(DLG_DELREC);
|
||||||
if (pos >= 0 && _mask->fld(pos).active())
|
if (pos >= 0 && _mask->fld(pos).active())
|
||||||
@ -868,6 +876,7 @@ void TRelation_application::main_loop()
|
|||||||
error_box("Documento non eliminabile.");
|
error_box("Documento non eliminabile.");
|
||||||
_autodelete = FALSE;
|
_autodelete = FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
k = _mask->run();
|
k = _mask->run();
|
||||||
|
|
||||||
@ -897,11 +906,13 @@ void TRelation_application::main_loop()
|
|||||||
if (find(0)) modify_mode();
|
if (find(0)) modify_mode();
|
||||||
else insert_mode();
|
else insert_mode();
|
||||||
}
|
}
|
||||||
|
if (_curr_trans_mode == TM_AUTOMATIC)
|
||||||
|
_mask->send_key(K_CTRL+'R', 0);
|
||||||
break;
|
break;
|
||||||
case K_SAVE:
|
case K_SAVE:
|
||||||
if (save(FALSE))
|
if (save(FALSE))
|
||||||
{
|
{
|
||||||
if (_autoins_caller.not_empty() || _transaction.not_empty())
|
if (_autoins_caller.not_empty() || _curr_transaction.not_empty())
|
||||||
{
|
{
|
||||||
k = K_QUIT;
|
k = K_QUIT;
|
||||||
}
|
}
|
||||||
@ -927,10 +938,17 @@ void TRelation_application::main_loop()
|
|||||||
{
|
{
|
||||||
modify_mode();
|
modify_mode();
|
||||||
warning_box("Documento gia' presente");
|
warning_box("Documento gia' presente");
|
||||||
|
if (_curr_transaction.not_empty())
|
||||||
|
{
|
||||||
|
_curr_transaction=TRANSACTION_MODIFY;
|
||||||
|
_curr_trans_mode = TM_INTERACTIVE; // switch to interactive mode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
insert_mode();
|
insert_mode();
|
||||||
}
|
}
|
||||||
|
if (_curr_trans_mode == TM_AUTOMATIC)
|
||||||
|
_mask->send_key(K_CTRL+'R', 0);
|
||||||
break;
|
break;
|
||||||
case K_DEL:
|
case K_DEL:
|
||||||
if (_mask->query_mode())
|
if (_mask->query_mode())
|
||||||
@ -942,7 +960,7 @@ void TRelation_application::main_loop()
|
|||||||
if (relation_remove())
|
if (relation_remove())
|
||||||
{
|
{
|
||||||
query_mode();
|
query_mode();
|
||||||
if (_autoins_caller.not_empty() || _transaction.not_empty())
|
if (_autoins_caller.not_empty() || _curr_transaction.not_empty())
|
||||||
{
|
{
|
||||||
if (_lnflag) _recins = 0;
|
if (_lnflag) _recins = 0;
|
||||||
k = K_QUIT;
|
k = K_QUIT;
|
||||||
@ -985,6 +1003,8 @@ void TRelation_application::main_loop()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (k != K_QUIT);
|
} while (k != K_QUIT);
|
||||||
|
|
||||||
if (_mask->is_open())
|
if (_mask->is_open())
|
||||||
@ -1009,6 +1029,16 @@ void TRelation_application::main_loop()
|
|||||||
ini.set("Error", "0");
|
ini.set("Error", "0");
|
||||||
edit_mask2ini();
|
edit_mask2ini();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
const int err = get_relation()->status();
|
const int err = get_relation()->status();
|
||||||
@ -1016,6 +1046,9 @@ void TRelation_application::main_loop()
|
|||||||
ini.set("Error", err);
|
ini.set("Error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_trans_counter++;
|
||||||
|
} while ( _trans_counter < _ntransactions);
|
||||||
|
return k != K_QUIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TRelation_application::filter()
|
bool TRelation_application::filter()
|
||||||
@ -1190,7 +1223,10 @@ void TRelation_application::set_link(TMask & m, const char * keyexpr)
|
|||||||
|
|
||||||
bool TRelation_application::parse_command_line()
|
bool TRelation_application::parse_command_line()
|
||||||
{
|
{
|
||||||
_ini = _transaction = "";
|
_trans_ini.destroy();
|
||||||
|
_trans_counter=0;
|
||||||
|
_curr_transaction = "";
|
||||||
|
_curr_trans_mode = 'I';
|
||||||
|
|
||||||
TFilename ini;
|
TFilename ini;
|
||||||
for (int i = argc()-1; i > 0; i--)
|
for (int i = argc()-1; i > 0; i--)
|
||||||
@ -1199,16 +1235,32 @@ bool TRelation_application::parse_command_line()
|
|||||||
ini.upper();
|
ini.upper();
|
||||||
if (ini.left(2) == "-I" || ini.left(2) == "/I")
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ini.not_empty())
|
_ntransactions= _trans_ini.items();
|
||||||
|
|
||||||
|
_lnflag = _ntransactions>0;
|
||||||
|
return _lnflag;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TRelation_application::load_transaction()
|
||||||
{
|
{
|
||||||
TConfig cnf(_ini, "Transaction");
|
bool retv=0;
|
||||||
_transaction = cnf.get("Action");
|
if (_trans_counter < _ntransactions)
|
||||||
_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");
|
long firm = cnf.get_long("Firm");
|
||||||
if (firm > 0)
|
if (firm > 0)
|
||||||
@ -1219,33 +1271,29 @@ bool TRelation_application::parse_command_line()
|
|||||||
error_box("Ditta inesistente: %ld", firm);
|
error_box("Ditta inesistente: %ld", firm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_transaction == "RUN")
|
if (_curr_transaction == "RUN")
|
||||||
_lnflag = 0; // Ho gia' finito qui: basta il cambio ditta
|
retv= 0; // Ho gia' finito qui: basta il cambio ditta
|
||||||
else
|
else
|
||||||
_lnflag = 1; // Attiva automagia
|
retv = 1; // Attiva automagia
|
||||||
|
}
|
||||||
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _lnflag != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TRelation_application::ini2query_mask()
|
void TRelation_application::ini2query_mask()
|
||||||
{
|
{
|
||||||
if (_transaction.not_empty())
|
if (_curr_transaction.not_empty())
|
||||||
{
|
{
|
||||||
TString16 parag;
|
TConfig ini(_trans_ini.row(_trans_counter), format("%d", get_relation()->lfile().num()));
|
||||||
parag.format("%d", get_relation()->lfile().num());
|
|
||||||
TConfig ini(_ini, parag);
|
|
||||||
ini2mask(ini, *_mask, TRUE);
|
ini2mask(ini, *_mask, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRelation_application::ini2insert_mask()
|
void TRelation_application::ini2insert_mask()
|
||||||
{
|
{
|
||||||
if (_transaction.not_empty())
|
if (_curr_transaction.not_empty())
|
||||||
{
|
{
|
||||||
TString16 parag;
|
TConfig ini(_trans_ini.row(_trans_counter), format("%d", get_relation()->lfile().num()));
|
||||||
parag.format("%d", get_relation()->lfile().num());
|
|
||||||
TConfig ini(_ini, parag);
|
|
||||||
ini2mask(ini, *_mask, FALSE);
|
ini2mask(ini, *_mask, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1272,11 +1320,11 @@ void TRelation_application::ini2mask(TConfig& ini, TMask& m, bool query)
|
|||||||
|
|
||||||
void TRelation_application::edit_mask2ini()
|
void TRelation_application::edit_mask2ini()
|
||||||
{
|
{
|
||||||
if (_ini.not_empty())
|
if (_trans_ini.row(_trans_counter).not_empty())
|
||||||
{
|
{
|
||||||
TString head;
|
TString head;
|
||||||
head.format("%d", get_relation()->lfile().num());
|
head.format("%d", get_relation()->lfile().num());
|
||||||
TConfig ini(_ini, head);
|
TConfig ini(_trans_ini.row(_trans_counter), head);
|
||||||
mask2ini(*_mask, ini);
|
mask2ini(*_mask, ini);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TRANSACTION_INSERT "INSERT"
|
||||||
|
#define TRANSACTION_MODIFY "MODIFY"
|
||||||
|
#define TRANSACTION_DELETE "DELETE"
|
||||||
|
#define TM_INTERACTIVE 'I'
|
||||||
|
#define TM_AUTOMATIC 'A'
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @class TRelation_application | Classe per la gestione di una applicazione di manutenzione di uno
|
// @class TRelation_application | Classe per la gestione di una applicazione di manutenzione di uno
|
||||||
@ -50,13 +55,23 @@ class TRelation_application : public TSkeleton_application
|
|||||||
// @cmember:(INTERNAL) Messaggio da passare all'utente per indicare che e' stata fatta la rinumerazione
|
// @cmember:(INTERNAL) Messaggio da passare all'utente per indicare che e' stata fatta la rinumerazione
|
||||||
TString _renum_message;
|
TString _renum_message;
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Nome del file .ini con la transazione da eseguire
|
// @cmember:(INTERNAL) Nomi dei file .ini con la transazione da eseguire
|
||||||
TString _ini;
|
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
|
// @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
|
// @cmember:(INTERNAL) Flag di cancellazione automatica veloce
|
||||||
byte _autodelete;
|
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>
|
// @cmember:(INTERNAL) Setta i campi fissati da <md TRelation_application::_fixed>
|
||||||
bool filter();
|
bool filter();
|
||||||
// @cmember:(INTERNAL) Controlla se una chiave e' completa ed esiste su file
|
// @cmember:(INTERNAL) Controlla se una chiave e' completa ed esiste su file
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <varrec.h>
|
#include <varrec.h>
|
||||||
|
|
||||||
|
#ifndef __RELATION_H
|
||||||
|
#include <relation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern bool rec_has_memo( const RecDes * rd );
|
||||||
|
|
||||||
|
|
||||||
TVariable_field::TVariable_field(
|
TVariable_field::TVariable_field(
|
||||||
const char * name, //
|
const char * name, //
|
||||||
const char * expr, //
|
const char * expr, //
|
||||||
@ -363,3 +370,26 @@ TRectype & TVariable_rectype::operator =(const char* rec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -202,4 +202,22 @@ public:
|
|||||||
virtual ~TAuto_variable_rectype() {}
|
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_
|
#endif // __VARREC_
|
||||||
|
@ -235,10 +235,9 @@ KEY e_char_to_key(
|
|||||||
{
|
{
|
||||||
if (ep->v.chr.shift && (key < ' ' || key >= K_UP))
|
if (ep->v.chr.shift && (key < ' ' || key >= K_UP))
|
||||||
key += K_SHIFT;
|
key += K_SHIFT;
|
||||||
// if (ep->v.chr.control && key >= ' ')
|
//if (ep->v.chr.control && key >= ' ') key += K_CTRL;
|
||||||
if (ep->v.chr.control && (key > K_SHIFT ||
|
if (ep->v.chr.control && (key > K_SHIFT || (key >= K_F1 && key <= K_F12) ||
|
||||||
(key >= K_F1 && key <= K_F12) ||
|
isalnum(key) || strchr("\r+-*/",key) != NULL))
|
||||||
isalnum(key) || strchr("\r+-*/", key)))
|
|
||||||
key += K_CTRL;
|
key += K_CTRL;
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user