cfiles, isam Correzioni gestione date su file

controls 	Corretta sottolineatura dell'acceleratore dei bottoni
config          Risolto conflitto sulla correzione di prassis.ini
checks          Editato per errore
default.url     Aggiunto acceleratore ALT-F


git-svn-id: svn://10.65.10.50/trunk@1547 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-07-03 16:19:39 +00:00
parent 55394b9fac
commit 2fbfb0a6b5
6 changed files with 26 additions and 255 deletions

View File

@ -820,53 +820,6 @@ Si osservi che "fout" deve essere un puntatore a una variabile di tipo coerente
#ifndef FOXPRO #ifndef FOXPRO
int CGetField(fieldname,recd,recin,fout)
char *fieldname; /* nome del campo */
RecDes *recd; /* descrittore record */
RecType recin; /* buffer contenente il record */
void *fout; /* contenuto del campo in output */
{
int r,p;
char *s, frm[30], *wp = (char *) fout;
s = malloc(256);
p = findfld(recd, fieldname);
getfrmt(recd, p, frm);
if ((r = CGetFieldBuff(fieldname, recd, recin, s)) != -1)
if (recd->Fd[p].TypeF == AlfaF) strcpy((char *) fout, s);
else
if ((recd->Fd[p].TypeF == IntF) || (recd->Fd[p].TypeF == ZeroF))
{
if (LENGTH(s)) *((int *) fout) = CCONVINT(s);
else *((int *) fout) = 0;
}
else
if ((recd->Fd[p].TypeF == Int4F) || (recd->Fd[p].TypeF == EZeroF))
{
if (LENGTH(s)) *((long *) fout) = CONVLONG(s);
else *((long *) fout) = 0L;
}
else
if (recd->Fd[p].TypeF == RealF) atod((DEC *) fout, s);
else
if (recd->Fd[p].TypeF == DateF) *((TrDate *) fout) = cpackdata(s);
else
if (recd->Fd[p].TypeF == WordF)
{
if (LENGTH(s)) *((unsigned *) fout) = (unsigned)CONVLONG(s);
else *((unsigned *) fout) = 0;
}
else
if (recd->Fd[p].TypeF == CharF)
*wp = *s;
else
if (recd->Fd[p].TypeF == BoolF)
*((BOOLEAN *) fout) = (*s == 'X');
free(s);
return(r);
}
/* /*
@(#) CPutField FILES @(#) CPutField FILES
@ -913,22 +866,20 @@ Si osservi che "fin" deve essere un puntatore a una variabile di tipo coerente c
sprintf(s, frm, *((long *) fin)) ; sprintf(s, frm, *((long *) fin)) ;
else else
if (recd->Fd[p].TypeF == RealF) dsprintf(s, frm, (DEC *) fin); if (recd->Fd[p].TypeF == RealF) dsprintf(s, frm, (DEC *) fin);
else else
if (recd->Fd[p].TypeF == DateF) ceditdata(*((TrDate *) fin), s); if (recd->Fd[p].TypeF == WordF) sprintf(s, frm, *((unsigned *) fin)) ;
else else
if (recd->Fd[p].TypeF == WordF) sprintf(s, frm, *((unsigned *) fin)) ; if (recd->Fd[p].TypeF == CharF)
else {
if (recd->Fd[p].TypeF == CharF) s[0] = *((char *) fin);
{ s[1] = '\0';
s[0] = *((char *) fin); }
s[1] = '\0'; else
} if (recd->Fd[p].TypeF == BoolF)
else {
if (recd->Fd[p].TypeF == BoolF) s[0] = *((BOOLEAN*) fin) ? 'X' : ' ';
{ s[1] = '\0';
s[0] = *((BOOLEAN*) fin) ? 'X' : ' '; }
s[1] = '\0';
}
return CPutFieldBuff(fieldname, recd, s, recout); return CPutFieldBuff(fieldname, recd, s, recout);
} }
@ -1023,12 +974,7 @@ Utilizzato per il Data Entry.
while ((len) && (s[len - 1] == ' ')) s[--len] = '\0'; while ((len) && (s[len - 1] == ' ')) s[--len] = '\0';
} }
else strcpy(s, ""); else strcpy(s, "");
if ((recd->Fd[p].TypeF == DateF))
{
if (LENGTH(s)) d = atol(s); /* sscanf(s, "%ld", &d); */
else d = 0 ;
ceditdata(d, s);
}
if ((recd->Fd[p].TypeF == RealF)) if ((recd->Fd[p].TypeF == RealF))
if ((s1 = strchr(s, ',')) != NULL) *s1 = '.'; if ((s1 = strchr(s, ',')) != NULL) *s1 = '.';
return(0); return(0);
@ -1088,11 +1034,6 @@ Utilizzato per il Data Entry
{ {
off = recd->Fd[p].RecOff; off = recd->Fd[p].RecOff;
len = recd->Fd[p].Len; len = recd->Fd[p].Len;
if (recd->Fd[p].TypeF == DateF)
{
d = cpackdata(s2);
sprintf(s2,"%06ld", d);
}
if (recd->Fd[p].TypeF == RealF) setdec(s2, recd->Fd[p].Dec); if (recd->Fd[p].TypeF == RealF) setdec(s2, recd->Fd[p].Dec);
l = LENGTH(s2); l = LENGTH(s2);
if (l > len) if (l > len)
@ -1216,172 +1157,6 @@ junk = variabile spazzatura per la chiamata di CZeroField.
recd, recout); recd, recout);
} }
/*
@($) CBuildKey FILES
@(ID)
Costruisce la chiave corrispondente al numero chiave.
@(FD)
@(ISV)
i = contatore.
nf = numero campi che compongono la chiave.
len = lunghezza del campo.
off = offest in byte all'interno del record per il campo in oggetto.
l = variabile di lavoro.
up = variabile di lavoro per rendere maiuscola la stringa.
wd = variabile per la data.
s1 = stringa di lavoro.
@(FSV)
@(IN)
NON UTILIZZARE !!.
Se si utilizza spiegarne dettagliatamente il motivo.
@(FN)
*/
int CBuildKey(recd,numkey,recin,key)
RecDes *recd; /* descrittore record */
int numkey; /* numero chiave */
RecType recin; /* buffer contenente il record */
char *key; /* valore della chiave */
{
int i, nf, l = 0, len, off;
TrDate wd ;
char s1[10];
BOOLEAN upp = FALSE;
strcpy(key, "");
if (numkey-- <= recd->NKeys)
{
for (i = 0; i < recd->Ky[numkey].NkFields; i++)
{
if ((upp = (recd->Ky[numkey].FieldSeq[i] > MaxFields)) == TRUE)
nf = recd->Ky[numkey].FieldSeq[i] - MaxFields;
else
nf = recd->Ky[numkey].FieldSeq[i];
if (recd->Ky[numkey].FromCh[i] == INVFLD)
{
off = recd->Fd[nf].RecOff;
len = recd->Fd[nf].Len;
}
else
{
if (recd->Fd[nf].TypeF == DateF)
{
off = recd->Fd[nf].RecOff;
len = recd->Fd[nf].Len;
strncpy(s1, (recin + off), len);
s1[len] = '\0';
wd = 0;
if (s1[0] <= '0')
{
for(len = 0; len < LENGTH(s1); len++)
if (isdigit(s1[len])) wd = (wd * 10) + (s1[len] - '0');
ceditdata(wd, s1);
s1[2] = s1[3];
s1[3] = s1[4];
s1[4] = s1[6];
s1[5] = s1[7];
s1[6] = '\0';
}
off = recd->Ky[numkey].FromCh[i];
len = recd->Ky[numkey].ToCh[i] -
recd->Ky[numkey].FromCh[i] + 1;
}
else
{
off = recd->Fd[nf].RecOff + recd->Ky[numkey].FromCh[i];
len = recd->Ky[numkey].ToCh[i] -
recd->Ky[numkey].FromCh[i] + 1;
}
}
if ((l + len) > 80)
{
strcpy(key, "");
return(BTrKeyLenErr);
}
if ((recd->Fd[nf].TypeF == DateF) && (recd->Ky[numkey].FromCh[i] != INVFLD))
strncpy((key + l), &s1[off], len);
else
{
strncpy((key + l), (recin + off), len);
if (recin[off] == '\0') memset(key + l, ' ', len);
else
if ((recd->Fd[nf].TypeF == IntF) ||
(recd->Fd[nf].TypeF == Int4F) ||
(recd->Fd[nf].TypeF == WordF))
{
int w = l, j = l + len;
while (w < j && key[w] == ' ') w++;
while (w < j && key[w] == '0')
key[w++] = ' ';
}
}
l += len;
}
key[l] = '\0';
crtrim(key);
if (upp) CUpString(key) ;
return(NoErr);
}
return(BTrPathErr);
}
/*
@($) CCalcLenKey FILES
@(ID)
Ritorna la lunghezza della chiave.
@(FD)
@(ISV)
nf = numero campi chiave.
i = contatore.
l = variabile di lavoro.
@(FSV)
@(IN)
NON UTILIZZARE !!.
Se si utilizza spiegarne dettagliatamente il motivo.
@(FN)
*/
int CCalcLenKey(recd,numkey)
RecDes *recd; /* descrittore record */
int numkey; /* numero della chiave */
{
register int l = 0, i, nf;
if (numkey-- <= recd->NKeys)
{
for (i = 0; i < recd->Ky[numkey].NkFields; i++)
{
if (recd->Ky[numkey].FieldSeq[i] > MaxFields)
nf = (int) recd->Ky[numkey].FieldSeq[i] - MaxFields;
else
nf = (int) recd->Ky[numkey].FieldSeq[i];
if (recd->Ky[numkey].FromCh[i] == INVFLD) l += (int) recd->Fd[nf].Len;
else l += (int) (recd->Ky[numkey].ToCh[i] - recd->Ky[numkey].FromCh[i] + 1);
}
return(l);
}
return(-1);
}
/* /*
@($) prefname FILES @($) prefname FILES

View File

@ -5,7 +5,7 @@
#ifdef XVT #ifdef XVT
#ifndef XVT_INCL_XVT #ifndef XVT_INCL_XVT
#include <xvt.h> #include <xvt.h>
#endif #endif
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#define STRICT #define STRICT

View File

@ -446,14 +446,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
case CONFIG_STUDIO: case CONFIG_STUDIO:
case CONFIG_USER: case CONFIG_USER:
case CONFIG_STAMPE: case CONFIG_STAMPE:
_file = firm2dir(0); _file = firm2dir(-1); // Directory dati
if (_file.not_empty()) _file.add("config");
{
for (int i = _file.len()-1; i >= 0; i--)
if (_file[i] == '/' || _file[i] == '\\') break;
_file.cut(i+1);
}
_file << "config";
if (!fexist(_file)) if (!fexist(_file))
make_dir(_file); make_dir(_file);

View File

@ -611,10 +611,10 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
TFixed_string c(capt); TFixed_string c(capt);
_accel = c.find('~'); _accel = c.find('~');
if (_accel > 0) if (_accel > 0)
_accel *= CHARX; _accel = xvt_dwin_get_text_width(win(), (char*)capt, _accel);
_dx = (width - xvt_dwin_get_text_width(win(), (char*)caption(), -1)) >> 1; _dx = (width - xvt_dwin_get_text_width(win(), (char*)caption(), -1)) >> 1;
_dy = (height-CHARY)/2 + BASEY - DEPTH; _dy = (height- CHARY)/2 + BASEY - DEPTH;
} }
} }

View File

@ -51,8 +51,7 @@ SEPARATOR
ITEM M_EDIT_SEARCH "Cerca...\tF7" ITEM M_EDIT_SEARCH "Cerca...\tF7"
ITEM M_EDIT_DELETE "Cerca il prossimo\tF8" DISABLED ITEM M_EDIT_DELETE "Cerca il prossimo\tF8" DISABLED
ACCEL MENU_FILE "f" alt
ACCEL MENU_FILE "f" ALT
#if XVTWS == WINWS #if XVTWS == WINWS
image BMP_OK "f:/p.due/bmp/ok.bmp" image BMP_OK "f:/p.due/bmp/ok.bmp"

View File

@ -962,8 +962,11 @@ int TBaseisamfile::_open(unsigned int mode)
filehnd()->ln = num(); filehnd()->ln = num();
openf[num() - 1] = filehnd(); openf[num() - 1] = filehnd();
_recno = -1L; _recno = -1L;
CHECKD(filehnd()->r->NKeys > 0, "File senza indici: ", num());
_lasterr = NOERR; _lasterr = NOERR;
} else }
else
{ {
_lasterr = get_error(filehnd()->fhnd); _lasterr = get_error(filehnd()->fhnd);
relisfd(_isamfile); relisfd(_isamfile);
@ -1029,7 +1032,7 @@ TLocalisamfile::TLocalisamfile(int logicnum, bool linkrecinst)
if (linkrecinst <= TRUE) if (linkrecinst <= TRUE)
{ {
open(); open();
if (_was_open) if (_was_open)
_oldkey = getkey(); _oldkey = getkey();
setkey(1); setkey(1);
} }