Patch level : 4.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Eliminata caterva di roba deprecated:
praticamente sono state decimate le stringhe C a favore delle TString C++
Corretta gestione bottone "pagina precedente" in anteprima report


git-svn-id: svn://10.65.10.50/trunk@14922 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2007-02-16 13:48:27 +00:00
parent 52bf679ad7
commit a44ba2f2a7
19 changed files with 179 additions and 176 deletions

View File

@ -141,52 +141,52 @@ TApplication& main_app()
HIDDEN void paint_background(WINDOW win) HIDDEN void paint_background(WINDOW win)
{ {
xvt_dwin_clear(win, MASK_DARK_COLOR);
RCT r; xvt_vobj_get_client_rect(win, &r); RCT r; xvt_vobj_get_client_rect(win, &r);
const XVT_DISPLAY_TYPE type = (XVT_DISPLAY_TYPE)xvt_vobj_get_attr(win, ATTR_DISPLAY_TYPE); if (ADVANCED_GRAPHICS)
if (ADVANCED_GRAPHICS && type == XVT_DISPLAY_DIRECT_COLOR)
{ {
CPEN pen; memset(&pen, 0, sizeof(pen)); const int cy = r.bottom / 4;
pen.width = 7; RCT g = r; g.bottom = cy;
const int R = r.bottom; xvt_dwin_draw_gradient_linear(win, &g, MASK_LIGHT_COLOR, MASK_BACK_COLOR, 90);
for (int x = R; x >= 0; x-=pen.width) g = r; g.top = cy;
{ xvt_dwin_draw_gradient_linear(win, &g, MASK_DARK_COLOR, MASK_LIGHT_COLOR, 90);
const COLOR c = blend_colors(MASK_DARK_COLOR, MASK_LIGHT_COLOR, double(x) / double(R));
if (c != pen.color)
{
pen.color = c;
xvt_dwin_set_cpen(win, &pen);
}
const PNT p = { x, 0 };
const PNT t = { 0, x };
xvt_dwin_draw_set_pos(win, p);
xvt_dwin_draw_line(win, t);
}
} }
else
xvt_dwin_clear(win, MASK_DARK_COLOR);
const int BIGY = 3*CHARY/2; const int BIGY = 3*ROWY/2;
xvtil_set_font(win, XVT_FFN_TIMES, XVT_FS_BOLD | XVT_FS_ITALIC, BIGY); xvtil_set_font(win, XVT_FFN_TIMES, XVT_FS_BOLD | XVT_FS_ITALIC, BIGY);
const char* t = main_app().title(); const char* t = main_app().title();
int w = xvt_dwin_get_text_width(win, t, -1); int w = xvt_dwin_get_text_width(win, t, -1);
int a; xvt_dwin_get_font_metrics(win, NULL, &a, NULL); int x = (r.right-w)/2, y = r.top+BIGY;
int x = (r.right-w)>>1, y = r.top+a; if (ADVANCED_GRAPHICS)
xvt_dwin_set_fore_color(win, MASK_LIGHT_COLOR); {
xvt_dwin_draw_text(win, x+1, y+1, t, -1); const int k = max(BIGY/24, 1);
xvt_dwin_set_fore_color(win, NORMAL_COLOR); xvt_dwin_set_fore_color(win, MASK_LIGHT_COLOR);
xvt_dwin_draw_text(win, x, y, t, -1); xvt_dwin_draw_text(win, x+k, y+k, t, -1);
xvt_dwin_set_fore_color(win, MASK_DARK_COLOR);
xvt_dwin_draw_text(win, x, y, t, -1);
}
else
{
xvt_dwin_set_fore_color(win, NORMAL_COLOR);
xvt_dwin_draw_text(win, x, y, t, -1);
}
xvtil_set_font(win, NULL, XVT_FS_NONE); xvtil_set_font(win, NULL, XVT_FS_NONE);
xvt_dwin_set_fore_color(win, NORMAL_COLOR);
const TString spa(dongle().reseller()); const TString spa(dongle().reseller());
w = xvt_dwin_get_text_width(win, (const char *) spa, -1); w = xvt_dwin_get_text_width(win, spa, -1);
x = (r.right-r.left-w)>>1; y = r.bottom-CHARY; x = (r.right-r.left-w)/2; y = r.bottom-CHARY;
xvt_dwin_draw_text(win, x, y, (const char *) spa, -1); xvt_dwin_draw_text(win, x, y, spa, -1);
if (ADVANCED_GRAPHICS) if (ADVANCED_GRAPHICS)
{ {
xvt_dwin_draw_icon(win, r.right-40, r.bottom-40, ICON_RSRC); const int ix = xvt_vobj_get_attr(NULL_WIN, ATTR_ICON_WIDTH);
xvt_dwin_draw_icon(win, 8, r.bottom-40, ICON_RSRC); const int iy = xvt_vobj_get_attr(NULL_WIN, ATTR_ICON_HEIGHT);
xvt_dwin_draw_icon(win, r.right-ix-CHARY, r.bottom-iy-CHARY, ICON_RSRC);
xvt_dwin_draw_icon(win, CHARY, r.bottom-iy-CHARY, ICON_RSRC);
} }
} }
@ -635,8 +635,8 @@ void TApplication::run(
XVT_CONFIG cfg; XVT_CONFIG cfg;
cfg.menu_bar_ID = TASK_MENUBAR; cfg.menu_bar_ID = TASK_MENUBAR;
cfg.about_box_ID = 0; cfg.about_box_ID = 0;
cfg.base_appl_name = (char*)base.name(); cfg.base_appl_name = base.name();
cfg.appl_name = (char*)title; cfg.appl_name = title;
cfg.taskwin_title = "CAMPO"; cfg.taskwin_title = "CAMPO";
set_xvt_hooks(); set_xvt_hooks();
@ -845,7 +845,7 @@ bool TApplication::get_next_pdf(int anno, long ditta, const char* codnum,
{ {
TConfig ini("servers/servers.ini", "Spotlight"); TConfig ini("servers/servers.ini", "Spotlight");
pdf = ini.get("Data"); pdf = ini.get("Data");
ok = pdf.full() && pdf.exist(); ok = pdf.exist();
} }
if (ok) if (ok)
{ {
@ -862,10 +862,10 @@ bool TApplication::get_next_pdf(int anno, long ditta, const char* codnum,
{ {
if (ditta < 0) if (ditta < 0)
ditta = get_firm(); ditta = get_firm();
pdf.add(format("%05ld", ditta));
if (codnum == NULL || *codnum <= ' ') if (codnum == NULL || *codnum <= ' ')
codnum = "report"; codnum = "report";
pdf.add(format("%05ld", ditta));
pdf << '_' << _name << '_' << codnum << '_'; pdf << '_' << _name << '_' << codnum << '_';
if (numdoc <= 0) if (numdoc <= 0)

View File

@ -275,8 +275,13 @@ void customize_colors()
CAMPI_SCAVATI = colors.get_bool("Campi3D", NULL, -1, CAMPI_SCAVATI); CAMPI_SCAVATI = colors.get_bool("Campi3D", NULL, -1, CAMPI_SCAVATI);
AUTOSELECT = colors.get_bool("AutoSelect", NULL, -1, AUTOSELECT); AUTOSELECT = colors.get_bool("AutoSelect", NULL, -1, AUTOSELECT);
AUTOZOOM = colors.get_bool("AutoZoom", NULL, -1, AUTOZOOM); AUTOZOOM = colors.get_bool("AutoZoom", NULL, -1, AUTOZOOM);
ADVANCED_GRAPHICS = colors.get_bool("AdvancedGraphics", NULL, -1, ADVANCED_GRAPHICS);
SMALL_ICONS = colors.get_bool("SmallIcons", NULL, -1, SMALL_ICONS); SMALL_ICONS = colors.get_bool("SmallIcons", NULL, -1, SMALL_ICONS);
ADVANCED_GRAPHICS = colors.get_bool("AdvancedGraphics", NULL, -1, ADVANCED_GRAPHICS);
if (ADVANCED_GRAPHICS)
{
const long dt = xvt_vobj_get_attr(NULL_WIN, ATTR_DISPLAY_TYPE);
ADVANCED_GRAPHICS = dt == XVT_DISPLAY_DIRECT_COLOR;
}
const int SPEECH_MODE = colors.get_int("SpeechMode", NULL, -1, 0); const int SPEECH_MODE = colors.get_int("SpeechMode", NULL, -1, 0);
xvt_vobj_set_attr(NULL_WIN, ATTR_SPEECH_MODE, SPEECH_MODE); xvt_vobj_set_attr(NULL_WIN, ATTR_SPEECH_MODE, SPEECH_MODE);

View File

@ -1,6 +1,10 @@
#ifndef __IMAGE_H #ifndef __IMAGE_H
#define __IMAGE_H #define __IMAGE_H
#ifndef XVT_INCL_XVT
#include <xvt.h>
#endif
#ifndef __OBJECT_H #ifndef __OBJECT_H
#include <object.h> #include <object.h>
#endif #endif

View File

@ -140,7 +140,7 @@ bool __file_is_crypted(int logicnum)
return logicnum == LF_TURNI; return logicnum == LF_TURNI;
} }
void __getfieldbuff(byte l, byte t, const char * recin, char *s, bool is_crypted) void __getfieldbuff(byte l, byte t, const char * recin, TString& s, bool is_crypted)
{ {
CHECK(recin, "Can't read from a Null record"); CHECK(recin, "Can't read from a Null record");
@ -176,38 +176,27 @@ void __getfieldbuff(byte l, byte t, const char * recin, char *s, bool is_crypted
{ {
while(l > 0 && recin[l - 1] == ' ') l--; while(l > 0 && recin[l - 1] == ' ') l--;
if (l) if (l)
strncpy(s, recin, l); s.strncpy(recin, l);
} }
s[l] = '\0'; s.cut(l);
if (l) if (l)
{ {
if (t == _datefld) if (t == _datefld)
{ {
TDate dt(s); const TDate dt(s);
#ifdef _DEMO_ s = dt.string(full);
int y = dt.year();
if (y & 0x0001) y--;
y >>= 3;
y++;
y /= 10;
if (y >= 25)
{
int m = dt.month();
if (m > 3)
dt.set_month(rand() % 3 + 1);
}
#endif
strcpy(s, dt.string(full));
} }
else else
{
if (t == _boolfld) if (t == _boolfld)
{ {
const char ok = toupper(*s); const char ok = toupper(*s);
if (ok == 'T' || ok == 'Y' || ok == 'S' || ok == 'X') if (ok == 'T' || ok == 'Y' || ok == 'S' || ok == 'X')
strcpy(s,"X"); s = "X";
else else
strcpy(s," "); s.spaces(1);
} }
}
} }
} }
@ -215,28 +204,28 @@ void __putfieldbuff(byte l, byte d, byte t, const char* s, char* recout, bool i
{ {
CHECK(recout, "Can't write null record" ); CHECK(recout, "Can't write null record" );
char s2[40]; TString80 s2;
if (t == _datefld) if (t == _datefld)
{ {
if (s && *s && strlen(s) != 8) if (s && *s && strlen(s) != 8)
{ {
const TDate dt(s); const TDate dt(s);
sprintf(s2, "%ld", dt.date2ansi()); s2 << dt.date2ansi();
s = s2; s = s2.get_buffer();
} }
} }
else else
if (t == _boolfld) if (t == _boolfld)
{ {
strcpy(s2, (*s && strchr("1STXY", toupper(*s)) != NULL) ? "T" : "F"); s2 = (*s && strchr("1STXY", toupper(*s)) != NULL) ? "T" : "F";
s = s2; s = s2.get_buffer();
} }
else else
if (t == _realfld) if (t == _realfld)
{ {
real r(s); real r(s);
strcpy(s2, r.string(l, d)); s2 = r.string(l, d);
s = s2; s = s2.get_buffer();
} }
int len = strlen(s); int len = strlen(s);
@ -252,8 +241,8 @@ void __putfieldbuff(byte l, byte d, byte t, const char* s, char* recout, bool i
{ {
if (len == 0 || exceeded) if (len == 0 || exceeded)
{ {
strcpy(s2, "0"); s2 = "0";
s = s2; s = s2.get_buffer();
len = 1; len = 1;
} }
@ -2138,7 +2127,7 @@ int TSystemisamfile::update(
TRecnotype ni = 0L; TRecnotype ni = 0L;
TFilename tmpfname; tmpfname.temp("tf"); TFilename tmpfname; tmpfname.temp("tf");
err=DB_build((const char*) tmpfname, wrec.rec()); err=DB_build(tmpfname, wrec.rec());
if (err != NOERR) if (err != NOERR)
{ {
@ -2165,7 +2154,7 @@ int TSystemisamfile::update(
TString s; s << TR("Aggiornamento") << ' ' << fname; TString s; s << TR("Aggiornamento") << ' ' << fname;
const TRecnotype nitems = items(); const TRecnotype nitems = items();
TProgind p(nitems > 0 ? nitems : 1, s, FALSE, TRUE, 70); TProgind p(nitems > 0 ? nitems : 1, s, true, true);
TExtrectype nrec(wrec); TExtrectype nrec(wrec);
@ -2180,9 +2169,12 @@ int TSystemisamfile::update(
outfld.add(new TRecfield(nrec, fld_name), j); outfld.add(new TRecfield(nrec, fld_name), j);
} }
for (first(); good(); next()) for (int errore = first(); errore == NOERR; errore = next())
{ {
p.addstatus(1); if (!p.addstatus(1))
{
break;
}
ni++; ni++;
if (curr().isdeleted()) if (curr().isdeleted())
@ -2226,7 +2218,10 @@ int TSystemisamfile::update(
close(); close();
prefix().close_isamfile(ishandle); prefix().close_isamfile(ishandle);
if (err!=NOERR) err=get_error(err); if (err != NOERR)
err = get_error(err);
if (p.iscancelled())
err = _iseof;
p.setstatus(nitems); p.setstatus(nitems);
} }
@ -3625,7 +3620,7 @@ const TString& TRectype::get_str(const char* fieldname) const
if (nf != FIELDERR) if (nf != FIELDERR)
{ {
TString& tmp = get_tmp_string(fd.Len + (fd.TypeF == _datefld ? 2 : 0)); TString& tmp = get_tmp_string(fd.Len + (fd.TypeF == _datefld ? 2 : 0));
__getfieldbuff(fd.Len, fd.TypeF, _rec + fd.RecOff, tmp.get_buffer(), __file_is_crypted(num())); __getfieldbuff(fd.Len, fd.TypeF, _rec + fd.RecOff, tmp, __file_is_crypted(num()));
return tmp; return tmp;
} }
else else
@ -4081,7 +4076,7 @@ void TRecfield::set(int from, int to)
{ {
const RecDes* rd = _rec->rec_des(); const RecDes* rd = _rec->rec_des();
_subfield = strchr(_name, ':'); _subfield = strchr(_name.get_buffer(), ':');
if (_subfield != NULL) if (_subfield != NULL)
{ {
*_subfield = '\0'; *_subfield = '\0';
@ -4135,7 +4130,7 @@ void TRecfield::set(int from, int to)
TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to) TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
{ {
strcpy(_name, name); _name = name;
_rec = &rec; _rec = &rec;
set(from, to); set(from, to);
} }
@ -4172,8 +4167,7 @@ void TRecfield::put_subfield(const char* s)
int TRecfield::operator =(int i) int TRecfield::operator =(int i)
{ {
char buff[32]; TString16 buff; buff << i;
sprintf(buff, "%d", i);
if (_subfield == NULL) if (_subfield == NULL)
__putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num()));
else else
@ -4185,20 +4179,18 @@ int TRecfield::operator =(int i)
long TRecfield::operator =(long l) long TRecfield::operator =(long l)
{ {
char buff[32]; TString16 buff; buff << l;
sprintf(buff, "%ld", l);
if (_subfield == NULL) if (_subfield == NULL)
__putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num()));
else else
put_subfield(buff); put_subfield(buff);
_rec->setempty(FALSE); _rec->setempty(false);
return l; return l;
} }
const real& TRecfield::operator =(const real& r) const real& TRecfield::operator =(const real& r)
{ {
char buff[80]; const char* buff = r.string();
strcpy(buff, r.string());
if (_subfield == NULL) if (_subfield == NULL)
__putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num()));
else else
@ -4208,9 +4200,8 @@ const real& TRecfield::operator =(const real& r)
} }
const TDate& TRecfield::operator =(const TDate& d) const TDate& TRecfield::operator =(const TDate& d)
{ {
char buff[16]; const TString16 buff = d.stringa();
strcpy(buff, (const char*)d);
if (_subfield == NULL) if (_subfield == NULL)
__putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num()));
else else
@ -4251,7 +4242,7 @@ void TRecfield::setptr(TRecnotype r)
if (n) *wp += 128; if (n) *wp += 128;
} }
void TRecfield::get_subfield(char* s) const void TRecfield::get_subfield(TString& s) const
{ {
const TString& str = _rec->get(_name); const TString& str = _rec->get(_name);
int p = str.find(_subfield); int p = str.find(_subfield);
@ -4266,21 +4257,23 @@ void TRecfield::get_subfield(char* s) const
e = p + _to; e = p + _to;
p += _from; p += _from;
if (p < e) if (p < e)
strcpy(s, str.sub(p, e)); s = str.sub(p, e);
else *s = '\0'; else
s.cut(0);
} }
else *s = '\0'; else
s.cut(0);
} }
TRecfield::operator int() const TRecfield::operator int() const
{ {
char tmp[32]; TString16 tmp;
if (_subfield == NULL) if (_subfield == NULL)
{ {
if (_type == _intfld || _type == _intzerofld || _type == _longfld || _type == _longzerofld) if (_type == _intfld || _type == _intzerofld || _type == _longfld || _type == _longzerofld)
{ {
strncpy(tmp, _p, _len); tmp.strncpy(_p, _len);
tmp[_len] = '\0'; tmp.cut(_len);
} }
else else
__getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num())); __getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num()));
@ -4293,14 +4286,14 @@ TRecfield::operator int() const
TRecfield::operator long() const TRecfield::operator long() const
{ {
char tmp[32]; TString16 tmp;
if (_subfield == NULL) if (_subfield == NULL)
{ {
if (_type == _longfld || _type == _longzerofld || _type == _intfld || _type == _intzerofld) if (_type == _longfld || _type == _longzerofld || _type == _intfld || _type == _intzerofld)
{ {
strncpy(tmp, _p, _len); tmp.strncpy(_p, _len);
tmp[_len] = '\0'; tmp.cut(_len);
} }
else else
__getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num())); __getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num()));
@ -4314,14 +4307,14 @@ TRecfield::operator long() const
TRecfield::operator const real() const TRecfield::operator const real() const
{ {
char tmp[32]; TString80 tmp;
if (_subfield == NULL) if (_subfield == NULL)
{ {
if (_type == _realfld) if (_type == _realfld)
{ {
strncpy(tmp, _p, _len); tmp.strncpy(_p, _len);
tmp[_len] = '\0'; tmp.cut(_len) = '\0';
} }
else else
__getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num())); __getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num()));
@ -4336,13 +4329,13 @@ TRecfield::operator const real() const
TRecfield::operator TDate() const TRecfield::operator TDate() const
{ {
char tmp[16]; TString16 tmp;
if (_subfield == NULL) if (_subfield == NULL)
{ {
if (_type == _datefld) if (_type == _datefld)
{ {
strncpy(tmp, _p, 8); tmp.strncpy(_p, 8);
tmp[8] = '\0'; tmp[8] = '\0';
return TDate(atol(tmp)); return TDate(atol(tmp));
} }
@ -4364,10 +4357,10 @@ TRecfield::operator const char*() const
if (_type == _memofld) if (_type == _memofld)
return _rec->get(_name); return _rec->get(_name);
else else
__getfieldbuff(_len, _type, _p, tmp.get_buffer(), __file_is_crypted(_rec->num())); __getfieldbuff(_len, _type, _p, tmp, __file_is_crypted(_rec->num()));
} }
else else
get_subfield((char *) (const char *)tmp); get_subfield(tmp);
return tmp; return tmp;
} }

View File

@ -768,7 +768,7 @@ class TRecfield : public TObject
// @access:(INTERNAL) Private Member // @access:(INTERNAL) Private Member
{ {
// @cmember:(INTERNAL) Nome del campo // @cmember:(INTERNAL) Nome del campo
char _name[32]; TString80 _name;
// @cmember:(INTERNAL) Puntatore a inizio record // @cmember:(INTERNAL) Puntatore a inizio record
TRectype* _rec; TRectype* _rec;
// @cmember:(INTERNAL) Puntatore a inizio campo // @cmember:(INTERNAL) Puntatore a inizio campo
@ -780,7 +780,7 @@ class TRecfield : public TObject
// @cmember:(INTERNAL) Tipo del campo // @cmember:(INTERNAL) Tipo del campo
TFieldtypes _type; TFieldtypes _type;
// @cmember:(INTERNAL) Sottocampo (Es. G1:TOTDOC) // @cmember:(INTERNAL) Sottocampo (Es. G1:TOTDOC)
char * _subfield; char* _subfield;
// @cmember:(INTERNAL) Da per i sottocampi (Es. G1:TOTDOC[2,3]) // @cmember:(INTERNAL) Da per i sottocampi (Es. G1:TOTDOC[2,3])
byte _from; byte _from;
// @cmember:(INTERNAL) A per i sottocampi (Es. G1:TOTDOC[2,3]) // @cmember:(INTERNAL) A per i sottocampi (Es. G1:TOTDOC[2,3])
@ -788,7 +788,7 @@ class TRecfield : public TObject
// @cmember:(INTERNAL) Setta il campo <p to>-esimo con i valori di <p from>-esimo // @cmember:(INTERNAL) Setta il campo <p to>-esimo con i valori di <p from>-esimo
void set(int from, int to); void set(int from, int to);
void get_subfield(char * s) const; void get_subfield(TString& s) const;
void put_subfield(const char * s); void put_subfield(const char * s);
// @access Public Member // @access Public Member

View File

@ -8,11 +8,11 @@
#include <execp.h> #include <execp.h>
#include <expr.h> #include <expr.h>
#include <msksheet.h> #include <msksheet.h>
#include <prefix.h> //#include <prefix.h>
#include <recarray.h> #include <recarray.h>
#include <recset.h> #include <recset.h>
#include <relapp.h> #include <relapp.h>
#include <relation.h> //#include <relation.h>
#include <sheet.h> #include <sheet.h>
#include <tabutil.h> #include <tabutil.h>
#include <text.h> #include <text.h>
@ -2579,11 +2579,9 @@ KEY TBrowse::run()
do_input(TRUE); do_input(TRUE);
_cursor->read(_isgteq); _cursor->read(_isgteq);
//const TLocalisamfile& f = _cursor->file(); TString caption = _cursor->file().description();
//TString caption(prefix().description(f.name())); if (caption.blank())
TString caption(_cursor->file().description()); caption = TR("Selezione");
if (!isalnum(caption[0]))
caption = "Selezione";
KEY k = K_ESC; KEY k = K_ESC;
long selected = 0; long selected = 0;

View File

@ -202,12 +202,14 @@ bool TPostman::dispatch_transaction(const TRectype& rec,
TString16 subject; TString16 subject;
switch (rec.num()) switch (rec.num())
{ {
case LF_TAB: case LF_TAB:
case LF_TABCOM: case LF_TABCOM:
case LF_TABGEN: case LF_TABGEN:
subject << rec.get("COD"); break; subject << rec.get("COD");
default: break;
subject << rec.num(); default:
subject << rec.num();
break;
} }
msg.set_subject(subject); msg.set_subject(subject);

View File

@ -297,12 +297,11 @@ int TFile_info::open_low(bool exclusive, bool index)
{ {
if (num() < LF_EXTERNAL && (_dir == _nordir || _dir == _comdir)) if (num() < LF_EXTERNAL && (_dir == _nordir || _dir == _comdir))
{ {
TRecnotype n = DB_reccount(_handle); const TRecnotype n = DB_reccount(_handle);
TDir d; TDir d; d.get(num(),_nolock,_dir,_sysdirop);
d.get(num(),_nolock,_dir,_sysdirop);
_filedes.EOD = d.eod() = n; _filedes.EOD = d.eod() = n;
_filedes.EOX = d.eox() = n; _filedes.EOX = d.eox() = n;
d.put(num(),_dir,_sysdirop); d.put(num(), _dir, _sysdirop);
} }
if (index) if (index)
@ -428,6 +427,7 @@ const TFilename& TFile_info::load_filedes()
else else
_dir = _nordir; _dir = _nordir;
COpenFile(num(), &_filedes, _nolock, _dir); COpenFile(num(), &_filedes, _nolock, _dir);
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des));
_name = _filedes.SysName; _name = _filedes.SysName;
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)); strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des));
} }
@ -444,7 +444,7 @@ TFile_info::TFile_info(int logicnum, TFilename& name)
if (logicnum < LF_EXTERNAL) if (logicnum < LF_EXTERNAL)
{ {
load_filedes(); load_filedes();
if (name.not_empty()) if (name.full())
{ {
// File dati temporaneo // File dati temporaneo
_dir = _extdir; _dir = _extdir;
@ -813,7 +813,7 @@ bool TFirm::read(long cod)
TLocalisamfile ditte(LF_NDITTE); TLocalisamfile ditte(LF_NDITTE);
if (cod > 0L) if (cod > 0L)
{ {
ditte.put("CODDITTA", cod); ditte.put(NDT_CODDITTA, cod);
err = ditte.read(); err = ditte.read();
} }
else else
@ -1037,7 +1037,6 @@ bool TPrefix::test(long codditta) const
return test(s); return test(s);
} }
long TPrefix::get_codditta() const long TPrefix::get_codditta() const
{ {
const long codditta = atol(_prefix); const long codditta = atol(_prefix);
@ -1152,15 +1151,14 @@ const TFirm& TPrefix::firm()
return *_firm; return *_firm;
} }
// Certified 90% // Certified 90%
// @doc EXTERNAL // @doc EXTERNAL
// @func Converte il numero di una ditta nella sua directory dati // @func Converte il numero di una ditta nella sua directory dati
// //
// @rdesc Restituisce il nome di una directory dati // @rdesc Restituisce il nome di una directory dati
const char* firm2dir( // @parm Codice ditta da convertire
long codditta) // @parm Codice ditta da convertire const char* firm2dir(long codditta)
{ {
TString8 firm; TString8 firm;
switch (codditta) switch (codditta)

View File

@ -465,7 +465,7 @@ TPrint_txt_info::TPrint_txt_info(TTextfile& txt)
{ {
const word ps = printer().formlen(); const word ps = printer().formlen();
const long li = txt.lines(); const long li = txt.lines();
_lastpage = (li+ps-1) / ps; _lastpage = word((li+ps-1) / ps);
} }
// @cmember Ritorna vero se la stampante e' generica/solo testo // @cmember Ritorna vero se la stampante e' generica/solo testo

View File

@ -147,15 +147,16 @@ void TIndwin::update_bar()
const WINDOW w = win(); const WINDOW w = win();
RCT b = r; RCT b = r;
// Rettangolo scavato // Rettangolo scavato
xi_draw_3d_rect((XinWindow)w, (XinRect*)&b, TRUE, 2, const int thick = 1;
xi_draw_3d_rect((XinWindow)w, (XinRect*)&b, TRUE, thick,
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR); MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
b.left += 2; b.right -= 2; xvt_rect_inflate(&b, -thick, -thick);
b.top += 2; b.bottom -= 2;
b.right = b.left + int((b.right-b.left)*prc + 0.5); b.right = b.left + int((b.right-b.left)*prc + 0.5);
const int lasti = (b.bottom-b.top)/2; const int lasti = (b.bottom-b.top)/2;
for (int i = 0; i <= lasti; i++) for (int i = 0; i <= lasti; i++)
{ {
/*
set_pen(blend_colors(FOCUS_BACK_COLOR, MASK_BACK_COLOR, double(i) / double(lasti))); set_pen(blend_colors(FOCUS_BACK_COLOR, MASK_BACK_COLOR, double(i) / double(lasti)));
PNT pt = { b.top+i, b.left }; PNT pt = { b.top+i, b.left };
xvt_dwin_draw_set_pos(w, pt); xvt_dwin_draw_set_pos(w, pt);
@ -167,6 +168,12 @@ void TIndwin::update_bar()
xvt_dwin_draw_set_pos(w, pt); xvt_dwin_draw_set_pos(w, pt);
pt.h = b.right; pt.h = b.right;
xvt_dwin_draw_line(w, pt); xvt_dwin_draw_line(w, pt);
*/
const short cy = b.top + (b.bottom-b.top)/4;
RCT g = b; g.bottom = cy;
xvt_dwin_draw_gradient_linear(w, &g, BTN_LIGHT_COLOR, BTN_BACK_COLOR, 90);
g = b; g.top = cy;
xvt_dwin_draw_gradient_linear(w, &g, BTN_DARK_COLOR, BTN_LIGHT_COLOR, 90);
} }
if (prc > 0) if (prc > 0)

View File

@ -120,7 +120,7 @@ TRectype& TRecord_array::row(
{ {
r = (TRectype*)key().dup(); // Crea nuovo record copiando la chiave r = (TRectype*)key().dup(); // Crea nuovo record copiando la chiave
n = _data.add(r, i) + _offset; // Riassegna n se era negativo! n = _data.add(r, i) + _offset; // Riassegna n se era negativo!
char str[16]; sprintf(str, "%d", n); TString16 str; str << n;
r->renum_key(_num, str); // Aggiorna campo numero riga r->renum_key(_num, str); // Aggiorna campo numero riga
} }
CHECKD(r && n > 0, "Bad record number ", n); CHECKD(r && n > 0, "Bad record number ", n);
@ -186,13 +186,12 @@ int TRecord_array::insert_row(TRectype* r)
const bool shift = exist(nr); const bool shift = exist(nr);
_data.insert(r, nr); _data.insert(r, nr);
if (shift) if (shift)
{ {
TString16 n;
for (int f = _data.last(); f > nr; f = _data.pred(f)) for (int f = _data.last(); f > nr; f = _data.pred(f))
{ {
char n[16]; TRectype& rec = row(f, FALSE);
TRectype & rec = row(f, FALSE); n.format("%ld", (long)_offset + f);
sprintf(n, "%ld", (long)_offset + f);
rec.renum_key(_num, n); rec.renum_key(_num, n);
} }
} }
@ -725,10 +724,11 @@ const TString& TDecoder::decode(long code)
{ {
char c[16]; char c[16];
if (code > 0) if (code > 0)
sprintf(c, "%ld", code); {
else TString16 c; c << code;
c[0] = '\0'; return decode(c);
return decode(c); }
return EMPTY_STRING;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@ -16,8 +16,10 @@
struct TRecordset_column_info : public TObject struct TRecordset_column_info : public TObject
{ {
TString _name; // Table.Column TString _name; // Table.Column
int _width; int _width, _pos;
TFieldtypes _type; TFieldtypes _type;
TRecordset_column_info() : _width(0), _pos(0), _type(_alfafld) {}
}; };
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@ -952,7 +952,7 @@ FILE* TCursor::open_index(
_last_created = create; _last_created = create;
if (_indexname.empty()) if (_indexname.empty())
{ {
TString16 radix; TString8 radix;
radix.format("c%d_", file().num()); radix.format("c%d_", file().num());
_indexname.temp(radix); _indexname.temp(radix);
} }
@ -1851,7 +1851,8 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
{ {
El_To_Sort Element; El_To_Sort Element;
fill_sort_key(Element.f); TFixed_string f(Element.f, sizeof(Element.f));
fill_sort_key(f);
Element.p=recno; Element.p=recno;
sort.sort((char *) &Element); sort.sort((char *) &Element);
if (TCursor::pos() < 0 && recno == rp) if (TCursor::pos() < 0 && recno == rp)
@ -1894,11 +1895,11 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
return ap; return ap;
} }
const char* TSorted_cursor::fill_sort_key(char* k) const char* TSorted_cursor::fill_sort_key(TString& k)
{ {
TString16 fmt; TString16 fmt;
TString sf; TString sf;
*k = '\0'; k.cut(0);
for (TString80 s = _order_expr.get(0); s.not_empty(); s = _order_expr.get()) for (TString80 s = _order_expr.get(0); s.not_empty(); s = _order_expr.get())
{ {
const bool is_up = is_upper(s); const bool is_up = is_upper(s);
@ -1920,7 +1921,7 @@ const char* TSorted_cursor::fill_sort_key(char* k)
fmt.format("%%-%ds",f.len(frec)); fmt.format("%%-%ds",f.len(frec));
else else
fmt.format("%%%ds",f.len(frec)); fmt.format("%%%ds",f.len(frec));
strcat(k, format(fmt, (const char*)sf)); k << format(fmt, (const char*)sf);
} }
return k; return k;
} }
@ -1941,7 +1942,7 @@ bool TSorted_cursor::changed()
TRecnotype TSorted_cursor::read(TIsamop op, TReclock lockop) TRecnotype TSorted_cursor::read(TIsamop op, TReclock lockop)
{ {
TString256 searching; fill_sort_key(searching.get_buffer()); TString256 searching; fill_sort_key(searching);
searching.rtrim(); searching.rtrim();
const int cmplen = searching.len(); const int cmplen = searching.len();
@ -1967,7 +1968,7 @@ TRecnotype TSorted_cursor::read(TIsamop op, TReclock lockop)
{ {
const TRecnotype test = (first+last)/2; const TRecnotype test = (first+last)/2;
TCursor::operator=(test); TCursor::operator=(test);
fill_sort_key(testing.get_buffer()); fill_sort_key(testing);
const int cmp = searching.compare(testing, cmplen); const int cmp = searching.compare(testing, cmplen);
if (cmp == 0) if (cmp == 0)
{ {

View File

@ -484,7 +484,7 @@ protected:
// @cmember Controlla se la singola espressione contiene l'operatore UPPER(), ritornandone l'argomento // @cmember Controlla se la singola espressione contiene l'operatore UPPER(), ritornandone l'argomento
bool is_upper(TString& s); bool is_upper(TString& s);
// @cmember Costruisce una stringa con la chiave di sort del record corrente // @cmember Costruisce una stringa con la chiave di sort del record corrente
const char* fill_sort_key(char* k); const char* fill_sort_key(TString& k);
// @cmember Costruisce il cursore a partire dal record (vedi <c TCursor>) // @cmember Costruisce il cursore a partire dal record (vedi <c TCursor>)
virtual TRecnotype buildcursor(TRecnotype rp); virtual TRecnotype buildcursor(TRecnotype rp);

View File

@ -327,7 +327,7 @@ void TPrint_preview_window::update()
for (int i = 1; lpi > 0; i++) for (int i = 1; lpi > 0; i++)
{ {
set_pen(i%lpi ? MAKE_COLOR(232,232,255) : MAKE_COLOR(255,192,255)); set_pen(i%lpi ? MAKE_COLOR(232,232,255) : MAKE_COLOR(255,192,255));
const short y = i * res.y / lpi; const short y = short(i * res.y / lpi);
if (y > size.y) if (y > size.y)
break; break;
line(0, y, (short)size.x, y); line(0, y, (short)size.x, y);
@ -336,7 +336,7 @@ void TPrint_preview_window::update()
for (int j = 1; cpi > 0; j++) for (int j = 1; cpi > 0; j++)
{ {
set_pen(j%10 ? MAKE_COLOR(232,232,255) : MAKE_COLOR(255,192,255)); set_pen(j%10 ? MAKE_COLOR(232,232,255) : MAKE_COLOR(255,192,255));
const short x = j * res.x / cpi; const short x = short(j * res.x / cpi);
if (x > size.x) if (x > size.x)
break; break;
line(x, 0, x, (short)size.y); line(x, 0, x, (short)size.y);
@ -656,7 +656,7 @@ bool TPreview_mask::on_field_event(TOperable_field& o, TField_event e, long joll
switch (o.dlg()) switch (o.dlg())
{ {
case DLG_FIRSTREC: idm = POPUP_FIRST; break; case DLG_FIRSTREC: idm = POPUP_FIRST; break;
case DLG_PREVREC : idm = POPUP_FIRST; break; case DLG_PREVREC : idm = POPUP_PREV; break;
case DLG_FINDREC : idm = POPUP_SEARCH; break; case DLG_FINDREC : idm = POPUP_SEARCH; break;
case DLG_NEXTREC : idm = POPUP_NEXT; break; case DLG_NEXTREC : idm = POPUP_NEXT; break;
case DLG_LASTREC : idm = POPUP_LAST; break; case DLG_LASTREC : idm = POPUP_LAST; break;
@ -752,8 +752,8 @@ public:
PNT TWindow_printer::log2dev(long x, long y) const PNT TWindow_printer::log2dev(long x, long y) const
{ {
PNT ptdev; PNT ptdev;
ptdev.h = (x * _phr) / BOOKDPI; ptdev.h = short((x * _phr) / BOOKDPI);
ptdev.v = (y * _pvr) / BOOKDPI; ptdev.v = short((y * _pvr) / BOOKDPI);
return ptdev; return ptdev;
} }
@ -1302,14 +1302,10 @@ bool TBook::print_page(TWindow& win, size_t page)
{ {
xvt_dwin_set_clip(w, &rct); xvt_dwin_set_clip(w, &rct);
} else } else
if (str.starts_with("</clip")) if (str.starts_with("</clip"))
{ {
xvt_dwin_set_clip(w, NULL); xvt_dwin_set_clip(w, NULL);
} else } else
if (str == "<ellipse/>") if (str == "<ellipse/>")
{ {
xvt_dwin_draw_oval(w, &rct); xvt_dwin_draw_oval(w, &rct);

View File

@ -1,8 +1,7 @@
#define __SMARTCARD_CPP #define __SMARTCARD_CPP
#ifdef WIN32 #define XVT_INCL_NATIVE
#include <windows.h> #include <xvt.h>
#endif
#include <config.h> #include <config.h>
#include <diction.h> #include <diction.h>
@ -11,7 +10,6 @@
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#ifdef WIN32 #ifdef WIN32
#include <ase/include/ASEMemCard.h> #include <ase/include/ASEMemCard.h>

View File

@ -111,6 +111,7 @@ public:
virtual TRecnotype new_rec(const char* buf = NULL); virtual TRecnotype new_rec(const char* buf = NULL);
virtual bool set(const char* column, const TVariant& var); virtual bool set(const char* column, const TVariant& var);
virtual unsigned int columns() const;
virtual const TRecordset_column_info& column_info(const char* colunmn) const; virtual const TRecordset_column_info& column_info(const char* colunmn) const;
virtual const TVariant& get(const char* colunmn) const; virtual const TVariant& get(const char* colunmn) const;

View File

@ -351,12 +351,11 @@ bool TViswin::adjust_box (
// @flag TRUE | Se ha constatato la corrispondenza // @flag TRUE | Se ha constatato la corrispondenza
// @flag FALSE | Se non ha constatato la corrispondenza // @flag FALSE | Se non ha constatato la corrispondenza
bool TViswin::check_link ( bool TViswin::check_link (
TPoint * p) // @parm Posizione del cursore (default NULL) TPoint* p) // @parm Posizione del cursore (default NULL)
// @comm Se <p p> e' NULL indica la posizione corrente del cursore // @comm Se <p p> e' NULL indica la posizione corrente del cursore
{ {
static char descr[128], pdescr[128];
static int old_id = -1, plinkID = -1; static int old_id = -1, plinkID = -1;
static long y, x1, x2; static long y, x1, x2;
static long py, px1, px2; static long py, px1, px2;
@ -396,8 +395,7 @@ bool TViswin::check_link (
erase_link (y, x1, x2); erase_link (y, x1, x2);
TToken_string & ttt = (TToken_string &) (*_links)[id]; TToken_string & ttt = (TToken_string &) (*_links)[id];
ttt.restart (); ttt.restart ();
strcpy (descr, ttt.get ()); _descr = ttt.get ();
// strcat (descr, t.get (3));
_linktxt = t.get(3); _linktxt = t.get(3);
if (_multiple) if (_multiple)
{ {
@ -413,23 +411,22 @@ bool TViswin::check_link (
if (_txt.get_foreground() == fg && _txt.get_background() == bg) if (_txt.get_foreground() == fg && _txt.get_background() == bg)
{ {
_multiple_link.add (cp); _multiple_link.add (cp);
strcat(descr, " "); _descr << ' ' << cp;
strcat(descr, cp);
} }
} }
} }
else else
strcat(descr, _linktxt); _descr << _linktxt;
old_id = _linkID = id; old_id = _linkID = id;
y = ty; y = ty;
x1 = tx1; x1 = tx1;
x2 = tx2; x2 = tx2;
display_link (y, x1, x2, descr); display_link (y, x1, x2, _descr);
} }
if (p == &_point) if (p == &_point)
{ {
strcpy (pdescr, descr); _pdescr = _descr;
plinkID = id; plinkID = id;
px1 = x1; px1 = x1;
px2 = x2; px2 = x2;
@ -454,8 +451,8 @@ bool TViswin::check_link (
x1 = px1; x1 = px1;
x2 = px2; x2 = px2;
y = py; y = py;
strcpy (descr, pdescr); _descr = _pdescr;
display_link (y, x1, x2, descr); display_link (y, x1, x2, _descr);
return TRUE; return TRUE;
} }

View File

@ -123,6 +123,7 @@ class TViswin : public TField_window
TArray* _links; TArray* _links;
// @cmember:(INTERNAL) Array di segnalibri // @cmember:(INTERNAL) Array di segnalibri
TArray* _bookmarks; TArray* _bookmarks;
TString _descr, _pdescr;
// @cmember:(INTERNAL) Indica se occorre ridisegnare la selezione // @cmember:(INTERNAL) Indica se occorre ridisegnare la selezione
bool need_paint_sel(bool smart = TRUE); bool need_paint_sel(bool smart = TRUE);