From dad5cc319a4215fbe69df860f31f9367bbb630d6 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 7 May 2003 13:06:50 +0000 Subject: [PATCH] Patch level : 2.0 nopatch Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunto supporto per il file c:\campo.stp contenente la lista delle installazioni. Eliminato uso delle #define DOS e FOXPRO Risolto il problema di scrollig delle anteprime di stampa git-svn-id: svn://10.65.10.50/trunk@11087 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/applicat.cpp | 6 +- include/ccommon.h | 6 +- include/ccustio.c | 61 +++++----------- include/ccustio.h | 8 +-- include/cfiles.c | 162 ++++++++++++++++++++++++------------------- include/cfiles.h | 4 +- include/codeb.c | 81 +++------------------- include/config.cpp | 2 +- include/extcdecl.h | 15 +--- include/printer.cpp | 5 +- include/viswin.cpp | 116 ++++++++----------------------- include/viswin.h | 2 - 12 files changed, 162 insertions(+), 306 deletions(-) diff --git a/include/applicat.cpp b/include/applicat.cpp index bdf351ecf..490301cfe 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -33,7 +33,7 @@ public: void TInfo_mask::add_row(const char* prompt, const char* value) { - const int MASK_WIDTH = 72; + const int MASK_WIDTH = 76; const int PROMPT_WIDTH = 12; TString val(value); @@ -107,12 +107,12 @@ TInfo_mask::TInfo_mask() add_row(TR("Protezione"), prot); add_row(TR("Programma"), arg); add_row(TR("Utente"), user()); - add_row(TR("Config"), CGetPrawinName()); + add_row(TR("Config"), CGetCampoIni()); add_row(TR("Studio"), firm2dir(-1)); add_row(TR("Ditta"), firm.codice()); add_row(TR("Valuta"), firm.codice_valuta()); add_row(TR("Stampante"), stampante); - add_row(TR("Mb su disco"), xvt_fsys_get_disk_free_space("c:/", 'M')); + add_row(TR("Mb su disco"), xvt_fsys_get_disk_free_space(firm2dir(-1), 'M')); add_button(DLG_OK, 0, "", -11, -1, 10, 2); } diff --git a/include/ccommon.h b/include/ccommon.h index 5fb493523..d96b60913 100755 --- a/include/ccommon.h +++ b/include/ccommon.h @@ -1,7 +1,7 @@ #ifndef __CCOMMON_H #define __CCOMMON_H -#ifdef DOS +#ifdef WIN32 #include #include #define _NO_STDIO @@ -43,7 +43,7 @@ #define CHR(c) (c) #define ORD(c) (c) #define ODD(c) (((c) % 2) != 0) -#ifdef DOS +#ifdef WIN32 /* @(!) 2.3.01.316 modif. #define TMPFNAME(p,n) sprintf(p, "\\tmp\\%s.tmp", (n)); */ #define TMPFNAME(p,n) tmpfname((p),(n)) /* @(:) 2.3.01.316 */ @@ -112,7 +112,7 @@ extern "C" { int CIOResult(void ); -#ifdef DOS +#ifdef WIN32 void tmpfname(char *,char *); #endif /* @(:) 2.3.01.316 */ diff --git a/include/ccustio.c b/include/ccustio.c index f6b4c63b0..8d10b64db 100755 --- a/include/ccustio.c +++ b/include/ccustio.c @@ -2,11 +2,11 @@ #include "checks.h" -#ifdef DOS +#ifdef WIN32 #include #endif #include -#ifndef DOS +#ifdef LINUX #include #include #include @@ -21,7 +21,7 @@ #define CalcPos(Rec, Len, Base) (((Rec) - 1) * ((RecNoType) (Len)) + ((RecNoType) (Base))) #define LOCK_OFF 1200000000L -#ifndef DOS +#ifdef LINUX #define LOCKSEM "locksem" /* extern long lseek(int, long, int);*/ @@ -31,38 +31,13 @@ extern int lockf(int, int, long); unsigned setlock(unsigned); int seeklk(SecDef *, long, unsigned, unsigned, long); -#ifndef DOS +#ifdef LINUX int semtran(char *); static void semcall(int, int); void PS(int); void VS(int); #endif -/* - BOOLEAN test_share() - { - #ifdef DOS - static BOOLEAN share_active = 2; - - if (share_active == 2) - { - share_active = CGetAut(MUAUT); - if (share_active) - { - int f = open("net.ini", O_RDONLY, SH_DENYNO, S_IREAD); - - share_active = f != -1; - if (f != -1) close(f); - } - } - return share_active; - #else - return TRUE; - #endif - } - */ - - /* @($) setlock CUSTIO @@ -89,7 +64,7 @@ unsigned setlock(LockMode) int lm; LockMode &= RecLockTypes ; -#ifdef DOS +#ifdef WIN32 if (LockMode == ShareLock) lm = _LK_NBRLCK ; else if (LockMode == Lock) lm = _LK_NBRLCK ; @@ -127,7 +102,7 @@ int seeklk(S, pos, lm, LockMode, rec) { if (LockMode != NoLock && S->LockMode != ExclLock) { -#ifdef DOS +#ifdef WIN32 /* if (test_share()) */ { if (_lseek(S->F, LOCK_OFF + rec, SEEK_SET) == -1L) @@ -150,7 +125,7 @@ int seeklk(S, pos, lm, LockMode, rec) if ((S->IOR = CIOResult()) != NoErr) return(-1) ; #endif } -#ifdef DOS +#ifdef WIN32 if (_lseek(S->F, pos, SEEK_SET) == -1L) #else if (lseek(S->F, pos, SEEK_SET) == -1L) @@ -200,7 +175,7 @@ void CVerify(S, Name) int junk ; S->IOR = NoErr; -#ifdef DOS +#ifdef WIN32 if ((S->F = sopen(Name, O_RDONLY | O_BINARY, SH_DENYNO, S_IREAD | S_IWRITE)) == -1) #else if ((S->F = open(Name, O_RDONLY, 0666)) == -1) @@ -237,7 +212,7 @@ void COpen(S, Name, Len, Base, LockMode) int junk; S->IOR = NoErr; -#ifdef DOS +#ifdef WIN32 if ((S->F = sopen(Name, O_RDWR|O_BINARY, /* test_share() && */ LockMode == ExclLock ? SH_DENYRW : SH_DENYNO, S_IREAD|S_IWRITE)) == -1) @@ -281,7 +256,7 @@ void CCreate(S, Name, Len, Base, MaxSec) int junk; S->IOR = NoErr; -#ifdef DOS +#ifdef WIN32 if ((S->F = sopen(Name, O_RDWR | O_CREAT, SH_DENYNO, S_IREAD | S_IWRITE)) == -1) #else if ((S->F = open(Name, O_RDWR | O_CREAT, 0666)) == -1) @@ -319,7 +294,7 @@ void CChsize(S, Name, Len, Base, MaxSec) int junk; S->IOR = NoErr; -#ifdef DOS +#ifdef WIN32 if ((S->F = sopen(Name, O_RDWR | O_BINARY, SH_DENYNO, S_IREAD | S_IWRITE)) == -1) #else if ((S->F = open(Name, O_RDWR, 0666)) == -1) @@ -348,7 +323,7 @@ void CClose(S) { S->IOR = NoErr; -#ifdef DOS +#ifdef WIN32 if (close(S->F) == -1) S->IOR = CIOResult(); #else if (S->LockMode == AutoLock) @@ -419,7 +394,7 @@ void CRead(S, RecBuf, Rec, LockMode) { S->IOR = NoErr; fpos = CalcPos(Rec, S->LenRec, S->BaseFil); -#ifndef DOS +#ifndef WIN32 if (S->LockMode == AutoLock) { if (S->lpos != -1) @@ -471,7 +446,7 @@ void CWrite(S, RecBuf, Rec, LockMode) { S->IOR = NoErr; fpos = CalcPos(Rec, S->LenRec, S->BaseFil); -#ifndef DOS +#ifndef WIN32 if (S->LockMode == AutoLock) { if (S->lpos != -1) @@ -544,7 +519,7 @@ BOOLEAN IRecIsDeleted(RecBuf) @(FD) @(ISV) - Versione DOS e XENIX. + Versione WIN32 e LINUX. @(FSV) */ @@ -556,7 +531,7 @@ BOOLEAN ITestLock(err) return(TESTLOCK(err)) ; } -#ifndef DOS +#ifdef LINUX struct lockdata { int users; @@ -768,7 +743,7 @@ int excllock(name,excl) int excl; /* se true deve fare il lock ex. altrimenti no */ { -#ifndef DOS +#ifdef LINUX char path[200], dir[200]; int fd, junk, sid; extern int errno; @@ -860,7 +835,7 @@ int exclunlock(name,excl) int excl; /* se true esegue un unlock sul file */ { -#ifndef DOS +#ifdef LINUX int fd, junk, sid; char path[200]; diff --git a/include/ccustio.h b/include/ccustio.h index 9333710e6..f1b8a6a69 100755 --- a/include/ccustio.h +++ b/include/ccustio.h @@ -1,7 +1,7 @@ #ifndef __CCUSTIO_H #define __CCUSTIO_H -#ifndef DOS +#ifdef LINUX #include #include #endif @@ -45,7 +45,7 @@ typedef struct { /* @(:) 2.3.01.325 */ } SecDef ; -#ifdef DOS +#ifdef WIN32 #define TESTLOCK(x) ((x) == 13 || (x) == 11) #define DEADLOCK(x) ((x) == EDEADLOCK) #else @@ -54,7 +54,7 @@ typedef struct { #endif #define BLOCKEXT(len,rec) (((((RecNoType) (len)) * ((RecNoType) (rec))) / BlockLenIO) + 1) -#ifdef DOS +#ifdef WIN32 #pragma pack() #endif @@ -78,7 +78,7 @@ extern "C" { /* @(!) 2.3.01.325 modificata int exclunlock(char *,BOOLEAN);*/ int excllock(char *,int); int exclunlock(char *,int); - int sleep_dos(int); + // int sleep_dos(int); // Killed by Guy /* @(:) 2.3.01.325 */ BOOLEAN test_share(void); #ifdef __cplusplus diff --git a/include/cfiles.c b/include/cfiles.c index 65bb4bcf4..ddd2c3c9d 100755 --- a/include/cfiles.c +++ b/include/cfiles.c @@ -1,16 +1,9 @@ #define __CFILES_C /* fv */ #include -#include -#include "cfiles.h" -#include "fldtypes.h" +#include "cfiles.h" -int hashfun(const char *); -void setdec(char *, int); -const char* prefname(); - -BOOLEAN dispferr = 1; int dirfl[2] = {0, 0}, recfl[2] = {0, 0} ; PathSt __ptprf = ""; // Nome della directory con lo studio corrente @@ -24,7 +17,7 @@ PathSt __ptprf = ""; // Nome della directory con lo studio corrente @(ISV) name = percorso per il file di direttorio. - Versione DOS e XENIX. + Versione WIN32 e LINUX. @(FSV) @(IN) @@ -45,7 +38,11 @@ void COpenDir(lockmode, dirflg) strcpy(name, CInsPref(directory, dirflg)) ; COpen(&fdir[dirflg], name, sizeof(FileDes), 0, lockmode) ; if (fdir[dirflg].IOR != NoErr) - fatal_box("Can't open Directory. Error number : %d (%s)", fdir[dirflg].IOR,name); + { + char msg[256]; + sprintf(msg, "Can't open Directory. Error number : %d (%s)", fdir[dirflg].IOR,name); + xvt_dm_post_fatal_exit(msg); + } } /* @@ -56,7 +53,7 @@ void COpenDir(lockmode, dirflg) @(FD) @(ISV) - Versione DOS e XENIX. + Versione WIN32 e LINUX. @(FSV) @(IN) @@ -66,11 +63,9 @@ void COpenDir(lockmode, dirflg) @(FN) */ -void CCloseDir(dirflg) - int dirflg; /* flag per file comuni */ - +void CCloseDir(int dirflg) /* flag per file comuni */ { -#ifndef DOS +#ifdef LINUX exclunlock(CInsPref(glockname, dirflg), (fdir[dirflg].LockMode == ExclLock)); #endif if (dirfl[dirflg]) dirfl[dirflg]--; @@ -91,7 +86,7 @@ void CCloseDir(dirflg) w = descrittore finestra di attesa. - Versione DOS e XENIX. + Versione WIN32 e LINUX. @(FSV) @(IN) @@ -115,7 +110,11 @@ void COpenFile(logicname,filed,lockmode,dirflg) CRead(&fdir[dirflg],(RecType) filed,(long) logicname, lockmode); if (TESTLOCK(fdir[dirflg].IOR)) - message_box("Sono in attesa della directory n.ro %d", logicname); + { + char msg[256]; + sprintf(msg, "Sono in attesa della directory n.ro %d", logicname); + xvt_dm_post_message(msg); + } } while TESTLOCK(fdir[dirflg].IOR) ; strcpy(filed->SysName, CAddPref(filed->SysName)) ; } @@ -174,7 +173,7 @@ void CCloseFile(logicname,filed,dirflg) w = descrittore finestra di attesa. - Versione DOS e XENIX. + Versione WIN32 e LINUX. @(FSV) @(IN) @@ -195,7 +194,12 @@ void CGetFile(logicname,filed,lockmode,dirflg) { CRead(&fdir[dirflg],(RecType) filed,(long) logicname, lockmode); if (TESTLOCK(fdir[dirflg].IOR)) - message_box("Sono in attesa della directory n.ro %d", logicname); + { + char msg[256]; + sprintf(msg, "Sono in attesa della directory n.ro %d", logicname); + xvt_dm_post_message(msg); + + } } while TESTLOCK(fdir[dirflg].IOR) ; } @@ -263,7 +267,7 @@ void zerofdes(d) @(ISV) name = nome dell'archivio dei Tracciati Record. - Versione DOS e XENIX. + Versione WIN32 e LINUX. @(FSV) @(IN) @@ -284,7 +288,11 @@ void COpenRecDir(lockmode,dirflg) strcpy(name, CInsPref(ntrrec, dirflg)) ; COpen(&rdir[dirflg], name, sizeof(RecDes), 0, lockmode) ; if (rdir[dirflg].IOR != NoErr) - fatal_box("Can't open record description file. Error number : %d (%s)", rdir[dirflg].IOR,name); + { + char msg[256]; + sprintf(msg, "Can't open record description file. Error number : %d (%s)", rdir[dirflg].IOR,name); + xvt_dm_post_fatal_exit(msg); + } } @@ -353,8 +361,7 @@ void CPutRec(logicname,recd,dirflg) } /* - - @($) prefname FILES + @($) CGetCampoIni FILES @(ID) Restituisce il nome del file che contiene il prefisso corrente. @@ -363,59 +370,74 @@ void CPutRec(logicname,recd,dirflg) @(ISV) s,s1 = stringhe di lavoro. - Versione DOS e XENIX. + Versione WIN32 e LINUX. @(FSV) - */ - -HIDDEN const char* prefname() -{ - static char* s = NULL; - - if (s == NULL) - { -#ifdef DOS - char *s1 = getenv("PREFPATH"); - if (s1 == NULL) - s1 = "campo.ini"; - s = strdup(s1); -#else - s = malloc(32); - sprintf(s, "campo%u.ini", getuid()); -#endif - } - - return s; -} - -#ifdef DOS - -const char* CGetPrawinName(void) +*/ +const char* CGetCampoIni(void) { static char* prawin = NULL; if (prawin == NULL) { - char drive[_MAX_DRIVE]; - char path[_MAX_PATH]; - char tmp[_MAX_PATH]; - _splitpath(prefname(), drive, path, NULL, NULL); - _makepath(tmp, drive, path, "campo", ".ini"); - if (access(tmp, 0) != 0) // se non esiste ... + char exedir[_MAX_PATH], path[_MAX_PATH]; + DIRECTORY dir; + BOOLEAN bFound = FALSE; + xvt_fsys_get_dir(&dir); + xvt_fsys_convert_dir_to_str(&dir, exedir, sizeof(exedir)); +#ifdef WIN32 + // Nelle installazioni sfigate con programmi in rete cerca di stabilire il percorso locale di Campo.ini + if (xvt_fsys_is_network_drive(exedir)) { - FILE* pw = fopen(tmp, "w"); // ... lo creo - fclose(pw); + int p; + for (p = 1; ; p++) + { + int len = 0; + char para[4]; sprintf(para, "%d", p); + len = xvt_sys_get_profile_string("c:/campo.stp", para, "Program", "", path, sizeof(path)); + if (len <= 0) + break; + if (path[len-1] == '\\' || path[len-1] == '/') + { + len--; + path[len] = '\0'; + } + if (xvt_str_compare_ignoring_case(path, exedir) == 0) + { + xvt_sys_get_profile_string("c:/campo.stp", para, "CampoIni", "", path, sizeof(path)); + bFound = TRUE; + break; + } + } + if (!bFound) + { + const char* pp = getenv("PREFPATH"); + if (pp != NULL) + { + char dri[_MAX_DRIVE], dir[_MAX_PATH]; + xvt_fsys_parse_pathname(pp, dri, dir, NULL, NULL, NULL); + xvt_fsys_build_pathname(path, dri, dir, "campo", "ini", NULL); + bFound = TRUE; + } + } } - prawin = malloc(_MAX_PATH); - if (*path) - strcpy(prawin,tmp); - else - _searchenv(tmp, NULL, prawin); +#endif + if (!bFound) + { +#ifdef LINUX + char ininame[32]; + sprintf(ininame, "campo%u", getuid()); + xvt_fsys_build_pathname(path, NULL, exedir, ininame, "ini", NULL); +#else + xvt_fsys_build_pathname(path, NULL, exedir, "campo", "ini", NULL); +#endif + } + prawin = xvt_str_duplicate(path); } return prawin; } -HIDDEN BOOLEAN CGetPrawin() +HIDDEN BOOLEAN CGetFirmDir() { - const char* prawin = CGetPrawinName(); + const char* prawin = CGetCampoIni(); BOOLEAN good = _access(prawin, 0x00) == 0; if (good) { @@ -442,16 +464,14 @@ HIDDEN BOOLEAN CGetPrawin() return good; } -BOOLEAN CPutPrawin(const char* pref) +BOOLEAN CPutFirmDir(const char* pref) { - const char* prawin = CGetPrawinName(); + const char* prawin = CGetCampoIni(); BOOLEAN good = xvt_sys_set_profile_string(prawin, "Main", "Firm", pref); xvt_sys_set_profile_string(prawin, "Main", "Study", __ptprf); return good; } -#endif - /* @(#) CGetPref FILES @@ -472,10 +492,10 @@ BOOLEAN CPutPrawin(const char* pref) const char* CGetPref() { - if (!CGetPrawin()) + if (!CGetFirmDir()) { strcpy(cprefix, "COM"); - CPutPrawin(cprefix); + CPutFirmDir(cprefix); } return cprefix; } @@ -501,7 +521,7 @@ const char* CGetPref() void CPutPref(const char* pref) /* stringa contenente il nuovo prefisso */ { - CPutPrawin(pref); + CPutFirmDir(pref); } /* diff --git a/include/cfiles.h b/include/cfiles.h index d81fccfbd..382182b22 100755 --- a/include/cfiles.h +++ b/include/cfiles.h @@ -76,7 +76,7 @@ SecDef rdir[2], fdir[2]; extern SecDef rdir[2], fdir[2]; #endif -#if XVT_OS == XVT_OS_WIN || XVT_OS_WIN32 +#ifdef WIN32 #pragma pack() #endif @@ -106,7 +106,7 @@ extern "C" { /* @(!) 2.3.01.144 */ char *CInsPref(char *, int); - const char* CGetPrawinName(void); + const char* CGetCampoIni(void); #ifdef __cplusplus }; diff --git a/include/codeb.c b/include/codeb.c index 6a1bf74ad..ab7e757c8 100755 --- a/include/codeb.c +++ b/include/codeb.c @@ -12,9 +12,7 @@ (S4FOX, S4MDX ecc.); nel caso si faccia uso della DLL non importa quale si e' definito. E' importante solo in caso di utilizzo di una static Library. - Per costruire l'aga.fll e' necessario togliere le funzioni progind* e definire S4DLL. - - */ +*/ #define XVT_INCL_NATIVE #include @@ -33,11 +31,6 @@ #define S4WIN32 #endif -#ifdef FOXPRO - #define S4DLL - #define S4WIN16 -#endif - #include #include @@ -650,9 +643,7 @@ int DB_packfile(short vis, const char * filename, long eod) { strcpy(s,"Compattamento dati file : "); strcat(s,(char*)filename); -#ifndef FOXPRO progind_create(100L,s,0,0,60); -#endif } if (eod < d4recCount(dbdata[handle])) { @@ -660,11 +651,7 @@ int DB_packfile(short vis, const char * filename, long eod) } else rt=d4pack(dbdata[handle]); if (vis) - { -#ifndef FOXPRO progind_destroy(); -#endif - } DB_close(handle); } else @@ -690,17 +677,11 @@ int DB_packmemo(short vis, const char * filename) { strcpy(s,"Compattamento memo file : "); strcat(s,(char*)filename); -#ifndef FOXPRO progind_create(100L,s,0,0,60); -#endif } rt=d4memoCompress(dbdata[handle]); if (vis) - { -#ifndef FOXPRO progind_destroy(); -#endif - } DB_close(handle); } else @@ -736,10 +717,8 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis) t = d4tagDefault(dbdata[handle]); lt = expr4len(t->tagFile->expr); l = lt - 9; -#ifndef FOXPRO - if (vis) - progind_create(items,"Ricerca record duplicati",0,1,60); -#endif + if (vis) + progind_create(items,"Ricerca record duplicati",0,1,60); rt = tfile4bottom(t->tagFile); @@ -747,10 +726,8 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis) { strncpy(s0, a4tagKey(dbdata[handle]), lt); -#ifndef FOXPRO if (vis) progind_set_status(++cnt); -#endif if (!strncmp(s, s0, l)) { @@ -764,10 +741,8 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis) } // while rt = code_base.errorCode; -#ifndef FOXPRO - if (vis) - progind_destroy(); -#endif + if (vis) + progind_destroy(); i4close(w); return rt; @@ -792,23 +767,19 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a { int i; char *ff = find_slash_backslash((char *)filename); -#ifndef FOXPRO if (vis) progind_create((long)r->NKeys,s,0,1,60); -#endif if ((ff == NULL) || *ff == '\0') ff = (char *)filename; else ff++; do_key(ff,r,tags, r->NKeys); w = i4create(dbdata[handle],NULL,tags); -#ifndef FOXPRO if (vis) { progind_set_status((long)r->NKeys); progind_destroy(); } -#endif if (w == NULL) rt = code_base.errorCode; if (rt == e4unique || rt == r4unique) { @@ -819,19 +790,15 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a tags[0].unique = r4unique_continue; if (rt == 0) { -#ifndef FOXPRO if (vis) progind_create((long)r->NKeys,s,0,1,60); -#endif w = i4create(dbdata[handle],(char*)filename,tags); if (w == NULL) rt = code_base.errorCode; -#ifndef FOXPRO if (vis) { progind_set_status((long)r->NKeys); progind_destroy(); } -#endif } } if (rt == 0) @@ -1248,11 +1215,6 @@ int DB_memowrite( const int handle, const char * fieldname, const char * data ) #endif #endif -#ifdef FOXPRO -#undef S4UNIX -#define S4DLL -#endif - #include #include @@ -1938,9 +1900,7 @@ int DB_packfile(short vis, const char * filename, long eod) { strcpy(s, "Compattamento dati file : "); strcat(s, filename); -#ifndef FOXPRO progind_create(100L,s,0,0,60); -#endif } if (eod < d4reccount(dbdata[handle])) { @@ -1948,10 +1908,7 @@ int DB_packfile(short vis, const char * filename, long eod) } else rt=d4pack(dbdata[handle]); if (vis) - { -#ifndef FOXPRO progind_destroy(); -#endif } DB_close(handle); } @@ -1978,17 +1935,11 @@ int DB_packmemo(short vis, const char * filename) { strcpy(s,"Compattamento memo file : "); strcat(s,(char*)filename); -#ifndef FOXPRO progind_create(100L,s,0,0,60); -#endif } rt=d4memo_compress(dbdata[handle]); if (vis) - { -#ifndef FOXPRO progind_destroy(); -#endif - } DB_close(handle); } else @@ -2024,10 +1975,8 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis) t = d4tag_default(dbdata[handle]); lt = expr4key_len(t->expr); l = lt - 9; -#ifndef FOXPRO - if (vis) - progind_create(items,"Ricerca record duplicati",0,1,60); -#endif + if (vis) + progind_create(items,"Ricerca record duplicati",0,1,60); rt = t4bottom(t); @@ -2035,10 +1984,8 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis) { strncpy(s0, t4key(t), lt); -#ifndef FOXPRO if (vis) progind_set_status(++cnt); -#endif if (!strncmp(s, s0, l)) { @@ -2052,10 +1999,8 @@ int DB_clean_file(int handle, char * filename, char * ff, RecDes * r, short vis) } // while rt = code_base.error_code; -#ifndef FOXPRO - if (vis) - progind_destroy(); -#endif + if (vis) + progind_destroy(); i4close(w); return rt; @@ -2081,23 +2026,19 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a { int i; char *ff = find_slash_backslash((char *)filename); -#ifndef FOXPRO if (vis) progind_create((long)r->NKeys,s,0,1,60); -#endif if ((ff == NULL) || *ff == '\0') ff = (char *)filename; else ff++; do_key(ff,r,tags, r->NKeys); w = i4create(dbdata[handle],NULL,tags); -#ifndef FOXPRO if (vis) { progind_set_status((long)r->NKeys); progind_destroy(); } -#endif if (w == NULL) rt = code_base.error_code; if (rt == e4unique || rt == r4unique) { @@ -2108,19 +2049,15 @@ int DB_packindex(short vis, const char * filename, RecDes *r, long *peod, bool a tags[0].unique = r4unique_continue; if (rt == 0) { -#ifndef FOXPRO if (vis) progind_create((long)r->NKeys,s,0,1,60); -#endif w = i4create(dbdata[handle],(char*)filename,tags); if (w == NULL) rt = code_base.error_code; -#ifndef FOXPRO if (vis) { progind_set_status((long)r->NKeys); progind_destroy(); } -#endif } } if (rt == 0) diff --git a/include/config.cpp b/include/config.cpp index 4fba25373..0ddf044fc 100755 --- a/include/config.cpp +++ b/include/config.cpp @@ -757,7 +757,7 @@ TConfig::TConfig(int which_config, const char* paragraph) _file = "fconv.ini"; break; case CONFIG_INSTALL: - _file = CGetPrawinName(); + _file = CGetCampoIni(); break; case CONFIG_GODMODE: _file = firm2dir(0); diff --git a/include/extcdecl.h b/include/extcdecl.h index 1903cd557..034570ed8 100755 --- a/include/extcdecl.h +++ b/include/extcdecl.h @@ -5,18 +5,7 @@ #include #endif -/* @(:) 2.3.01.178 */ -#define MAXCKEY 5 -#define MAXCLEN 10 -#define MAXENTRYNAME 16 -#define MAXTENTRY 48 -/* @(!) 2.3.01.temp */ -#define MAXENTRYSIZE 4096 -/* @(:) 2.3.01.temp */ -#define MAXDISPCOLS 4 -#define CONFFILE "conf.gen" - -/* @DES Funzioni C esterne. Sorgenti in /disk1/p.uno */ +/* @DES Funzioni C esterne. */ extern "C" { @@ -67,8 +56,8 @@ extern "C" { void CPutRec(int, RecDes *, int); void zerordes(RecDes *); word setrdes(RecDes *); - const char* CGetPrawinName(void); char *CAddPref(char *); + const char* CGetCampoIni(void); const char* CGetPref(void); void CPutPref(const char *); char *CInsPref(char *, int); diff --git a/include/printer.cpp b/include/printer.cpp index 723227064..ff5f25038 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -1556,9 +1556,6 @@ bool TPrinter::set() mask.set_handler(MSK_PRINTERS, set_windows_print_device); mask.set_handler(MSK_FONT, font_handler); -// if (!_multiple_copies) -// mask.hide(MSK_NPAGES); - if (_printertype == fileprinter) mask.set (MSK_TYPE, "1"); else if (_printertype == screenvis) @@ -1574,7 +1571,7 @@ bool TPrinter::set() memcpy(oldrcd.get_buffer(), rcd, old_rcd_size); KEY k; - while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS) + while ((k = mask.run()) != K_ESC && k != K_ENTER && k != K_INS) { if (k == DLG_SETPRINT) { diff --git a/include/viswin.cpp b/include/viswin.cpp index d339837b4..4728a1163 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -21,9 +21,6 @@ int PRINT_HEIGHT = 10; #define TEXTROWS (rows() - Y_OFFSET - BUTTONROW_SIZE) #define TEXTCOLUMNS (columns() - X_OFFSET) -// Colore per righelli: perche' distinguere? -// #define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY) -// #define FOREGROUND (_toplevel ? NORMAL_COLOR : COLOR_WHITE) #define BACKGROUND MASK_BACK_COLOR #define FOREGROUND NORMAL_COLOR @@ -247,7 +244,6 @@ void TViswin::exec_link() set_focus(); _inside_linkexec = TRUE; check_link(); - _need_update = TRUE; force_update(); do_events(); check_link (&_point); @@ -638,7 +634,6 @@ void TViswin::open () repos_buttons(); TScroll_window::open(); show_buttons(_showbuts); - _need_update = TRUE; force_update (); } @@ -1252,45 +1247,34 @@ void TViswin::update () erase_point(); autoscroll(FALSE); set_mode(M_COPY); -// if (_showbuts) -// { -// set_brush (BACKGROUND); -// bar ((X_OFFSET-1), rows()-BUTTONROW_SIZE, columns()+1, rows() + 1); -// } - if (_need_update) - { - if (!_toplevel) - TField_window::update(); - - check_link(); - if (_isselection) - erase_selection (); - txt_clear(COLOR_WHITE); -// set_mode (M_COPY); - set_brush (BACKGROUND); -// autoscroll (FALSE); - if (_rulers) - { - bar (0, 0, columns() + 1, 1); - bar (0, 0, 5, rows() + 1); - } -// if (_showbuts) -// bar ((X_OFFSET -1), rows()-BUTTONROW_SIZE, columns() + 1, rows() + 1); //** - if (_showbuts && _isopen) - paint_waitbar(); - else - if (_showbuts) ((TImage&)_modules[4]).draw(win()); - autoscroll (TRUE); - paint_screen(); - paint_header(); - if (_isselection) - display_selection(); + if (!_toplevel) + TField_window::update(); + + check_link(); + if (_isselection) + erase_selection (); + txt_clear(COLOR_WHITE); + set_brush (BACKGROUND); + + if (_rulers) + { + bar (0, 0, columns() + 1, 1); + bar (0, 0, 5, rows() + 1); } + if (_showbuts && _isopen) + paint_waitbar(); + else + if (_showbuts) ((TImage&)_modules[4]).draw(win()); + autoscroll (TRUE); + paint_screen(); + paint_header(); + if (_isselection) + display_selection(); + display_point(); check_link(&_point); autoscroll (TRUE); - _need_update = TRUE; _need_scroll = none; in_update = FALSE; } @@ -1333,7 +1317,6 @@ void TViswin::on_button(short dlg) case DLG_EDIT: check_link(); call_editor(); - _need_update = TRUE; update(); check_link(&_point); break; @@ -1375,10 +1358,7 @@ void TViswin::handler (WINDOW win, EVENT * ep) if (need_paint_sel (FALSE)) display_selection (); display_point (); - if (_txt.lines () > 1l) - _need_update = FALSE; - else - force_update (); + force_update (); } autoscroll (FALSE); _textrows = TEXTROWS; @@ -1690,7 +1670,6 @@ void TViswin::handler (WINDOW win, EVENT * ep) autoscroll (TRUE); repos_buttons (); display_point (); - _need_update = TRUE; force_update (); do_events (); check_link (&_point); @@ -1714,11 +1693,9 @@ void TViswin::handler (WINDOW win, EVENT * ep) _point.y = new_origin + kdiff; check_link (); update_thumb (origin ().x, new_origin); - _need_update = TRUE; update (); // ORRIIIBILE! check_link (&_point); - _need_update = FALSE; } else scroll_error(-1, 0); } @@ -1732,11 +1709,8 @@ void TViswin::handler (WINDOW win, EVENT * ep) _point.x = new_origin + kdiff; check_link (); update_thumb(new_origin, origin().y); - _need_update = TRUE; update (); // AAAARGH! - check_link (&_point); - _need_update = FALSE; } else scroll_error(0, -1); } @@ -1744,7 +1718,6 @@ void TViswin::handler (WINDOW win, EVENT * ep) case SC_LINE_UP: if (ep->type == E_VSCROLL) { - _need_update = FALSE; if (origin ().y > 0l) { _point.y--; @@ -1758,7 +1731,6 @@ void TViswin::handler (WINDOW win, EVENT * ep) } else { - _need_update = FALSE; if (origin ().x > 0l) { if (need_paint_sel (FALSE)) @@ -1783,11 +1755,9 @@ void TViswin::handler (WINDOW win, EVENT * ep) _point.y = new_origin + kdiff; check_link (); update_thumb (origin ().x, new_origin); - _need_update = TRUE; update (); // AAAARGH! check_link (&_point); - _need_update = FALSE; } else scroll_error(-1, _txt.lines()-_textrows/*-1*/); } @@ -1801,11 +1771,9 @@ void TViswin::handler (WINDOW win, EVENT * ep) _point.x = new_origin + kdiff; check_link (); update_thumb (new_origin, origin().y); - _need_update = TRUE; update (); // AAAARGH! check_link (&_point); - _need_update = FALSE; } else scroll_error(255-_textcolumns, -1); } @@ -1813,7 +1781,6 @@ void TViswin::handler (WINDOW win, EVENT * ep) case SC_LINE_DOWN: if (ep->type == E_VSCROLL) { - _need_update = FALSE; if ((origin().y + _textrows) < _txt.lines ()) { if (need_paint_sel ()) @@ -1827,7 +1794,6 @@ void TViswin::handler (WINDOW win, EVENT * ep) } else { - _need_update = FALSE; if ((origin ().x + _textcolumns) < 256) { if (need_paint_sel (FALSE)) @@ -1860,7 +1826,6 @@ void TViswin::handler (WINDOW win, EVENT * ep) origin ().x + kdiff_x; _point.y = ep->type == E_HSCROLL ? origin ().y : origin ().y + kdiff_y; - _need_update = TRUE; update (); check_link (&_point); break; @@ -1881,8 +1846,7 @@ void TViswin::handler (WINDOW win, EVENT * ep) } if (_need_scroll != none) { - _need_update = FALSE; - scroll tmp = _need_scroll; + const scroll tmp = _need_scroll; _need_scroll = none; shift_screen (tmp); if (!_selecting) @@ -1893,10 +1857,7 @@ void TViswin::handler (WINDOW win, EVENT * ep) if (_isselection) display_selection (); } - if (ep->type != E_UPDATE || _need_update) - TWindow::handler (win, ep); - else if (ep->type == E_UPDATE) - update (); + TWindow::handler (win, ep); } bool TViswin::on_key(KEY key) @@ -1930,7 +1891,6 @@ bool TViswin::on_key(KEY key) check_link (); call_editor (); set_focus (); - _need_update = TRUE; update (); check_link (&_point); } @@ -1946,7 +1906,6 @@ bool TViswin::on_key(KEY key) stop_run(CTRL_S); break; case CTRL_R: - _need_update = TRUE; check_link (); force_update (); do_events (); @@ -1974,7 +1933,6 @@ bool TViswin::on_key(KEY key) case K_TAB: if (!is_running()) { - _need_update = TRUE; update(); } else @@ -1996,20 +1954,14 @@ bool TViswin::on_key(KEY key) case K_CTRL_ENTER: if (_linkID != -1) exec_link(); -/* - else if (_toplevel) - dispatch_e_char (_button[_curbut], K_SPACE); -*/ break; case K_LHOME: - _need_update = TRUE; update_thumb (0, 0); _point.set (0, 0); check_link (&_point); force_update(); break; case K_LEND: - _need_update = TRUE; update_thumb (0, _txt.lines () - _textrows); _point.set (0, _txt.lines () - 1); check_link (&_point); @@ -2039,7 +1991,6 @@ bool TViswin::on_key(KEY key) check_link (); erase_point (); _isbar = !_isbar; - _need_update = TRUE; force_update (); do_events (); check_link (&_point); @@ -2051,7 +2002,6 @@ bool TViswin::on_key(KEY key) if (PRINT_HEIGHT <= 14) { PRINT_HEIGHT += 2; - _need_update = TRUE; force_update(); } break; @@ -2059,7 +2009,6 @@ bool TViswin::on_key(KEY key) if (PRINT_HEIGHT >= 6) { PRINT_HEIGHT -= 2; - _need_update = TRUE; force_update(); } default: @@ -2101,7 +2050,6 @@ bool TViswin::on_key(KEY key) break; case K_UP: case K_SHIFT_UP: - _need_update = FALSE; if (key == K_SHIFT_UP) { if (need_paint_sel (FALSE)) @@ -2134,7 +2082,6 @@ bool TViswin::on_key(KEY key) break; case K_LEFT: case K_SHIFT_LEFT: - _need_update = FALSE; if (_point.x > 0l) { if (key == K_SHIFT_LEFT) @@ -2149,7 +2096,6 @@ bool TViswin::on_key(KEY key) } if (_point.x == origin ().x) { - _need_update = FALSE; if (need_paint_sel (FALSE)) erase_selection(); update_thumb (--_point.x, origin ().y); @@ -2168,7 +2114,6 @@ bool TViswin::on_key(KEY key) break; case K_DOWN: case K_SHIFT_DOWN: - _need_update = FALSE; if (_point.y < (_txt.lines() - 1)) { if (key == K_SHIFT_DOWN) @@ -2202,7 +2147,6 @@ bool TViswin::on_key(KEY key) break; case K_RIGHT: case K_SHIFT_RIGHT: - _need_update = FALSE; if (_point.x < 256) { if (key == K_SHIFT_RIGHT) @@ -2239,7 +2183,6 @@ bool TViswin::on_key(KEY key) } if (_need_scroll != none) { - _need_update = FALSE; scroll tmp = _need_scroll; _need_scroll = none; shift_screen (tmp); @@ -2247,8 +2190,7 @@ bool TViswin::on_key(KEY key) if (_isselection) display_selection (); check_link (&_point); - if (_need_update) force_update(); - else update(); + update(); } break; default: @@ -2369,7 +2311,6 @@ void TViswin::close_print () _isopen = FALSE; if (_showbuts) xvt_timer_destroy (_wtimer); - _need_update = TRUE; if (_toplevel) { xvt_menu_set_item_title(win(), M_VISWIN_QUIT, "Chiudi\tESC"); @@ -2431,7 +2372,6 @@ void TViswin::goto_pos( void TViswin::refresh() { - _need_update = TRUE; force_update(); } @@ -2574,7 +2514,7 @@ TViswin::TViswin(const char *fname, _isprint (printbutton), _isbar (FALSE), _istimer (FALSE), _iscross (FALSE), _isselection (FALSE), _sel_displayed (FALSE), _cross_displayed (FALSE), _link_displayed (FALSE), _point_displayed (FALSE), _selecting (FALSE), - _scrolling (FALSE), _selflag (FALSE), _need_update (TRUE), _need_scroll (none), + _scrolling (FALSE), _selflag (FALSE), _need_scroll (none), _multiple (FALSE), _rulers(rulers), _txt_to_find(64), _frozen (FALSE), _brwfld(brwfld), _link_button(NULL), _print_button(NULL), _down_dir(TRUE), _showbuts(FALSE), _case_sensitive(FALSE), diff --git a/include/viswin.h b/include/viswin.h index 7bbc72262..52a2504d8 100755 --- a/include/viswin.h +++ b/include/viswin.h @@ -59,8 +59,6 @@ class TViswin : public TField_window bool _isbar; // @cmember:(INTERNAL) Indica se in corso lo scrolling bool _scrolling; - // @cmember:(INTERNAL) Indica se e' necessario un update completo - bool _need_update; // @cmember:(INTERNAL) Indica se il timer successivo e' attivo bool _istimer; // @cmember:(INTERNAL) Indica se possono arrivare nuove linee