Patch level : 12.0 998
Files correlati : xvaga.dll Commento : Aggiunte funzioni per verificare e scaricare un URL Aggiunto supporto per finestre principali non a pieno schermo. bisogna specificare nel paragrafo main di campo.ini MaxDim= "dimX"x"dimY esempio MaxDim=1024x768
This commit is contained in:
parent
5512c4a9eb
commit
7a4c330211
@ -2,6 +2,7 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
|
||||
#include <config.h>
|
||||
#include <dblog.h>
|
||||
#include <execp.h>
|
||||
#include <expr.h>
|
||||
#include <extcdecl.h>
|
||||
@ -454,7 +455,8 @@ HIDDEN int __build_key(const RecDes& recd, int numkey, const RecType recin, cha
|
||||
key[0] = '\0';
|
||||
if (numkey-- <= recd.NKeys)
|
||||
{
|
||||
int l = 0;
|
||||
int l = 0;
|
||||
|
||||
for (int i = 0; i < recd.Ky[numkey].NkFields; i++)
|
||||
{
|
||||
const KeyDes& kd = recd.Ky[numkey];
|
||||
@ -985,7 +987,6 @@ int TBaseisamfile::_rewrite(const TRectype& rec)
|
||||
|
||||
TRectype save_rec(rec);
|
||||
|
||||
// Forza l'uso della chiave principale (per chiavi duplicate?)
|
||||
const int fhnd = handle(1);
|
||||
_lasterr = cisread(fhnd, 1, save_rec, _isequal + _nolock, _recno); // Si Posiziona per sicurezza...
|
||||
|
||||
@ -2472,7 +2473,9 @@ int TSystemisamfile::load(
|
||||
s1.rtrim(1);
|
||||
s1.ltrim(1);
|
||||
}
|
||||
if (curr().type((const TString&) fld[j]) == _memofld)
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
@ -2670,6 +2673,15 @@ int TSystemisamfile::overwrite(
|
||||
|
||||
s1 = s.mid(pos,len[j]);
|
||||
s1.rtrim();
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
s1 = esc(s2);
|
||||
}
|
||||
vals.add(fldname, s1);
|
||||
pos += len[j];
|
||||
}
|
||||
@ -2687,9 +2699,13 @@ int TSystemisamfile::overwrite(
|
||||
s1.rtrim(1);
|
||||
s1.ltrim(1);
|
||||
}
|
||||
if (curr().type(fldname) == _memofld)
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
s1 = esc(s2);
|
||||
}
|
||||
vals.add(fldname, s1);
|
||||
@ -2834,6 +2850,15 @@ int TSystemisamfile::dump(
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get(fname);
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
s1 = unesc(s2);
|
||||
}
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
@ -2853,20 +2878,15 @@ int TSystemisamfile::dump(
|
||||
if (real::is_null(sfld))
|
||||
sfld.cut(0);
|
||||
break;
|
||||
|
||||
case _memofld:
|
||||
if (sfld.full())
|
||||
case _alfafld:
|
||||
{
|
||||
int p = 0;
|
||||
while ((p = sfld.find('\n', 0)) >= 0)
|
||||
{
|
||||
sfld.overwrite("\\", p);
|
||||
sfld.insert("n", p+1);
|
||||
TString s2 = sfld;
|
||||
|
||||
sfld = unesc(s2);
|
||||
}
|
||||
}
|
||||
else
|
||||
sfld.cut(0);
|
||||
break;
|
||||
default: // strfld, charfld, boolfld
|
||||
default: // charfld, boolfld
|
||||
if (sfld.blank())
|
||||
sfld.cut(0);
|
||||
break;
|
||||
@ -2916,6 +2936,15 @@ int TSystemisamfile::dump(
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get((const TString&)fld[j]);
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
s1 = unesc(s2);
|
||||
}
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
@ -2925,14 +2954,14 @@ int TSystemisamfile::dump(
|
||||
if (j && fs) s1 << fs;
|
||||
if (fd) s1 << fd;
|
||||
sfld = get((const TString&)fld[j]);
|
||||
if (curr().type((const TString&) fld[j]) == _memofld)
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
int p = 0;
|
||||
while ((p = sfld.find('\n', 0)) >= 0)
|
||||
{
|
||||
sfld.overwrite("\\", p);
|
||||
sfld.insert("n", p+1);
|
||||
}
|
||||
TString s2 = sfld;
|
||||
|
||||
sfld = unesc(s2);
|
||||
}
|
||||
s1 << sfld;
|
||||
if (fd) s1 << fd;
|
||||
@ -3047,6 +3076,15 @@ int TSystemisamfile::dump(
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get(fldname);
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
s1 = unesc(s2);
|
||||
}
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
@ -3056,14 +3094,14 @@ int TSystemisamfile::dump(
|
||||
if (j && fs) s1 << fs;
|
||||
if (fd) s1 << fd;
|
||||
sfld = get(fldname);
|
||||
if (curr().type(fldname) == _memofld)
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
int p = 0;
|
||||
while ((p = sfld.find('\n', 0)) >= 0)
|
||||
{
|
||||
sfld.overwrite("\\", p);
|
||||
sfld.insert("n", p+1);
|
||||
}
|
||||
TString s2 = sfld;
|
||||
|
||||
sfld = unesc(s2);
|
||||
}
|
||||
s1 << sfld;
|
||||
if (fd) s1 << fd;
|
||||
@ -3106,6 +3144,15 @@ int TSystemisamfile::dump(
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get(fldname);
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
s1 = unesc(s2);
|
||||
}
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
@ -3115,14 +3162,14 @@ int TSystemisamfile::dump(
|
||||
if (j && fs) s1 << fs;
|
||||
if (fd) s1 << fd;
|
||||
sfld = get(fldname);
|
||||
if (curr().type(fldname) == _memofld)
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
int p = 0;
|
||||
while ((p = sfld.find('\n', 0)) >= 0)
|
||||
{
|
||||
sfld.overwrite("\\", p);
|
||||
sfld.insert("n", p+1);
|
||||
}
|
||||
TString s2 = sfld;
|
||||
|
||||
sfld = unesc(s2);
|
||||
}
|
||||
s1 << sfld;
|
||||
if (fd) s1 << fd;
|
||||
@ -3194,6 +3241,8 @@ void TRectype::init(int logicnum)
|
||||
|
||||
if (_length > 0 && lf_has_memo(logicnum))
|
||||
init_memo(RECORD_NON_FISICO);
|
||||
clear_modified_fields();
|
||||
set_preserve_values();
|
||||
}
|
||||
|
||||
TRectype::TRectype(int logicnum)
|
||||
@ -3218,6 +3267,7 @@ TRectype::TRectype(const TRectype& r)
|
||||
init_memo(r._memo_data->recno(), r._memo_data->file());
|
||||
*_memo_data = *r._memo_data;
|
||||
}
|
||||
_modified_fields = r._modified_fields;
|
||||
memcpy(_rec, r._rec, _length);
|
||||
memcpy(_tab, r._tab, sizeof(_tab));
|
||||
setempty(r.empty());
|
||||
@ -3519,6 +3569,11 @@ bool TRectype::exist(const char* fieldname) const
|
||||
return findfld(&rec_des(), fieldname) != FIELDERR;
|
||||
}
|
||||
|
||||
int TRectype::find(const char* fieldname) const
|
||||
{
|
||||
return findfld(&rec_des(), fieldname);
|
||||
}
|
||||
|
||||
const char* TRectype::fieldname(int i) const
|
||||
{
|
||||
const RecDes& recd = rec_des();
|
||||
@ -3658,7 +3713,6 @@ void TRectype::put(const char* fieldname, bool val)
|
||||
put(fieldname, val ? 'X' : ' ');
|
||||
}
|
||||
|
||||
|
||||
void TRectype::put_str(const char* fieldname, const char* val)
|
||||
{
|
||||
const RecDes& recd = rec_des();
|
||||
@ -3677,6 +3731,7 @@ void TRectype::put_str(const char* fieldname, const char* val)
|
||||
if (ft == _boolfld)
|
||||
val = (*val && strchr("1STXY", toupper(*val)) != NULL) ? "T" : "F";
|
||||
|
||||
set_modified_field(nf, val);
|
||||
if (*val == '\0')
|
||||
{
|
||||
TRecfield f(*this, fieldname);
|
||||
@ -3722,6 +3777,8 @@ void TRectype::zero(const char* fieldname)
|
||||
const byte len = recd.Fd[nf].Len;
|
||||
const byte dec = recd.Fd[nf].Dec;
|
||||
const TFieldtypes type = (TFieldtypes) recd.Fd[nf].TypeF;
|
||||
|
||||
set_modified_field(nf, "");
|
||||
switch (type)
|
||||
{
|
||||
case _datefld:
|
||||
@ -4041,6 +4098,7 @@ bool TRectype::set_edit_info(const char* ut, const char* dt, const char* or)
|
||||
if (dt && *dt && type(dt) == _datefld)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
|
||||
put(dt, oggi); // Scrivi data odierna
|
||||
|
||||
// Se esisnte un campo long OR*
|
||||
@ -4080,6 +4138,11 @@ TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
||||
|
||||
const TFixed_string fname(name);
|
||||
const int colon = fname.find(':');
|
||||
|
||||
if (from == 0 && to == 255)
|
||||
to = -1;
|
||||
_from = from;
|
||||
_to = to;
|
||||
if (colon > 0)
|
||||
{
|
||||
_name.strncpy(name, colon);
|
||||
@ -4090,7 +4153,6 @@ TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
||||
_name = name;
|
||||
|
||||
const RecDes& rd = _rec->rec_des();
|
||||
|
||||
const int nf = findfld(&rd, _name);
|
||||
|
||||
if (nf == FIELDERR)
|
||||
@ -4100,6 +4162,9 @@ TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
||||
_len = 0;
|
||||
_dec = 0;
|
||||
_type = _alfafld;
|
||||
_nf = 0;
|
||||
_from = 0;
|
||||
_to = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4108,6 +4173,7 @@ TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
||||
NFCHECK("Invalid Start %d", from);
|
||||
from = 0;
|
||||
}
|
||||
_nf = nf;
|
||||
_p = _rec->string() + rd.Fd[nf].RecOff;
|
||||
_dec = rd.Fd[nf].Dec;
|
||||
_type = (TFieldtypes)rd.Fd[nf].TypeF;
|
||||
@ -4125,8 +4191,8 @@ TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
||||
else
|
||||
{
|
||||
CHECK(_type == _memofld, "You can use Subfields only with Memo");
|
||||
_from = from;
|
||||
_to = to;
|
||||
// _from = from;
|
||||
// _to = to;
|
||||
if (_type == _memofld)
|
||||
_len = 0;
|
||||
else
|
||||
@ -4162,7 +4228,9 @@ void TRecfield::put_subfield(const char* s)
|
||||
val.left(e - p + 1);
|
||||
val.rpad(e - p + 1);
|
||||
}
|
||||
|
||||
TString out = str.left(p);
|
||||
|
||||
out << val << str.mid(e); // ? e + 1
|
||||
_rec->put(_name, out);
|
||||
}
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
#ifndef __PREFIX_H
|
||||
#include <prefix.h>
|
||||
#endif
|
||||
|
||||
#ifndef __UTILITY_H
|
||||
#include <utility.h>
|
||||
#endif
|
||||
|
||||
#define FIELDERR -1
|
||||
@ -164,7 +168,7 @@ public:
|
||||
// @cmember Ritorna il nome del campo <p i>-esimo
|
||||
const char* fieldname(int i) const;
|
||||
|
||||
// @cmember Setta la chiave <p key>-esima di ordinamento sul file
|
||||
// @cmember Ritorna il valaore della chiave <p key>-esima di ordinamento sul file
|
||||
const char* build_key(int key = 1) const;
|
||||
// @cmember Confronta le chiavi di due record
|
||||
int compare_key(const TRectype& rec, int key = 1, int skip_last = 0) const;
|
||||
@ -251,7 +255,7 @@ public:
|
||||
// @cmember Ritorna se il record non e'cancellato
|
||||
bool valid() const
|
||||
{return _rec[0] == ' ';}
|
||||
// @cmember Ritorna l'espressione della chiave numero <p numkey>
|
||||
// @cmember Ritorna il valore della chiave numero <p numkey>
|
||||
const char* key(int numkey = 1) const;
|
||||
// @cmember Ritorna se si tratta di un record valido
|
||||
virtual bool ok() const
|
||||
@ -798,6 +802,7 @@ class TRecfield : public TObject
|
||||
TString16 _name, _sub_field;
|
||||
// @cmember:(INTERNAL) Puntatore a inizio record
|
||||
TRectype* _rec;
|
||||
int _nf;
|
||||
// @cmember:(INTERNAL) Puntatore a inizio campo
|
||||
char* _p;
|
||||
// @cmember:(INTERNAL) Lunghezza del campo
|
||||
@ -848,6 +853,9 @@ public:
|
||||
const char* pos() const { return (const char*) _p;}
|
||||
// @cmember Ritorna il nome del campo
|
||||
const char* name() const { return _name; }
|
||||
// @cmember Ritornano i limiti del campo
|
||||
byte from() const { return _from; }
|
||||
byte to() const { return _to; }
|
||||
// @cmember Ritorna la lunghezza del campo
|
||||
int len() const { return (int) _len;}
|
||||
// @cmember Ritorna il numero di decimali del campo
|
||||
|
Loading…
x
Reference in New Issue
Block a user