diff --git a/include/applicat.cpp b/include/applicat.cpp index d87176e60..f8d49e563 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -141,52 +141,52 @@ TApplication& main_app() HIDDEN void paint_background(WINDOW win) { - xvt_dwin_clear(win, MASK_DARK_COLOR); 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 && type == XVT_DISPLAY_DIRECT_COLOR) + if (ADVANCED_GRAPHICS) { - CPEN pen; memset(&pen, 0, sizeof(pen)); - pen.width = 7; - const int R = r.bottom; - for (int x = R; x >= 0; x-=pen.width) - { - 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); - } + const int cy = r.bottom / 4; + RCT g = r; g.bottom = cy; + xvt_dwin_draw_gradient_linear(win, &g, MASK_LIGHT_COLOR, MASK_BACK_COLOR, 90); + g = r; g.top = cy; + xvt_dwin_draw_gradient_linear(win, &g, MASK_DARK_COLOR, MASK_LIGHT_COLOR, 90); } + 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); + const char* t = main_app().title(); 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)>>1, y = r.top+a; - xvt_dwin_set_fore_color(win, MASK_LIGHT_COLOR); - xvt_dwin_draw_text(win, x+1, y+1, t, -1); - xvt_dwin_set_fore_color(win, NORMAL_COLOR); - xvt_dwin_draw_text(win, x, y, t, -1); + int x = (r.right-w)/2, y = r.top+BIGY; + if (ADVANCED_GRAPHICS) + { + const int k = max(BIGY/24, 1); + xvt_dwin_set_fore_color(win, MASK_LIGHT_COLOR); + 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); + xvt_dwin_set_fore_color(win, NORMAL_COLOR); const TString spa(dongle().reseller()); - w = xvt_dwin_get_text_width(win, (const char *) spa, -1); - x = (r.right-r.left-w)>>1; y = r.bottom-CHARY; - xvt_dwin_draw_text(win, x, y, (const char *) spa, -1); + w = xvt_dwin_get_text_width(win, spa, -1); + x = (r.right-r.left-w)/2; y = r.bottom-CHARY; + xvt_dwin_draw_text(win, x, y, spa, -1); if (ADVANCED_GRAPHICS) { - xvt_dwin_draw_icon(win, r.right-40, r.bottom-40, ICON_RSRC); - xvt_dwin_draw_icon(win, 8, r.bottom-40, ICON_RSRC); + const int ix = xvt_vobj_get_attr(NULL_WIN, ATTR_ICON_WIDTH); + 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; cfg.menu_bar_ID = TASK_MENUBAR; cfg.about_box_ID = 0; - cfg.base_appl_name = (char*)base.name(); - cfg.appl_name = (char*)title; + cfg.base_appl_name = base.name(); + cfg.appl_name = title; cfg.taskwin_title = "CAMPO"; 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"); pdf = ini.get("Data"); - ok = pdf.full() && pdf.exist(); + ok = pdf.exist(); } if (ok) { @@ -862,10 +862,10 @@ bool TApplication::get_next_pdf(int anno, long ditta, const char* codnum, { if (ditta < 0) ditta = get_firm(); + pdf.add(format("%05ld", ditta)); + if (codnum == NULL || *codnum <= ' ') codnum = "report"; - - pdf.add(format("%05ld", ditta)); pdf << '_' << _name << '_' << codnum << '_'; if (numdoc <= 0) diff --git a/include/controls.cpp b/include/controls.cpp index d25f243a5..41fff8cfe 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -275,8 +275,13 @@ void customize_colors() CAMPI_SCAVATI = colors.get_bool("Campi3D", NULL, -1, CAMPI_SCAVATI); AUTOSELECT = colors.get_bool("AutoSelect", NULL, -1, AUTOSELECT); 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); + 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); xvt_vobj_set_attr(NULL_WIN, ATTR_SPEECH_MODE, SPEECH_MODE); diff --git a/include/image.h b/include/image.h index 77d8b7917..ad31a5d6e 100755 --- a/include/image.h +++ b/include/image.h @@ -1,6 +1,10 @@ #ifndef __IMAGE_H #define __IMAGE_H +#ifndef XVT_INCL_XVT +#include +#endif + #ifndef __OBJECT_H #include #endif diff --git a/include/isam.cpp b/include/isam.cpp index 0973e5baa..f7fcabf4c 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -140,7 +140,7 @@ bool __file_is_crypted(int logicnum) 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"); @@ -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--; if (l) - strncpy(s, recin, l); + s.strncpy(recin, l); } - s[l] = '\0'; + s.cut(l); if (l) { if (t == _datefld) { - TDate dt(s); -#ifdef _DEMO_ - 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)); + const TDate dt(s); + s = dt.string(full); } else + { if (t == _boolfld) { const char ok = toupper(*s); if (ok == 'T' || ok == 'Y' || ok == 'S' || ok == 'X') - strcpy(s,"X"); + s = "X"; 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" ); - char s2[40]; + TString80 s2; if (t == _datefld) { if (s && *s && strlen(s) != 8) { const TDate dt(s); - sprintf(s2, "%ld", dt.date2ansi()); - s = s2; + s2 << dt.date2ansi(); + s = s2.get_buffer(); } } else if (t == _boolfld) { - strcpy(s2, (*s && strchr("1STXY", toupper(*s)) != NULL) ? "T" : "F"); - s = s2; + s2 = (*s && strchr("1STXY", toupper(*s)) != NULL) ? "T" : "F"; + s = s2.get_buffer(); } else if (t == _realfld) { real r(s); - strcpy(s2, r.string(l, d)); - s = s2; + s2 = r.string(l, d); + s = s2.get_buffer(); } 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) { - strcpy(s2, "0"); - s = s2; + s2 = "0"; + s = s2.get_buffer(); len = 1; } @@ -2138,7 +2127,7 @@ int TSystemisamfile::update( TRecnotype ni = 0L; TFilename tmpfname; tmpfname.temp("tf"); - err=DB_build((const char*) tmpfname, wrec.rec()); + err=DB_build(tmpfname, wrec.rec()); if (err != NOERR) { @@ -2165,7 +2154,7 @@ int TSystemisamfile::update( TString s; s << TR("Aggiornamento") << ' ' << fname; 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); @@ -2180,9 +2169,12 @@ int TSystemisamfile::update( 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++; if (curr().isdeleted()) @@ -2226,7 +2218,10 @@ int TSystemisamfile::update( close(); 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); } @@ -3625,7 +3620,7 @@ const TString& TRectype::get_str(const char* fieldname) const if (nf != FIELDERR) { 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; } else @@ -4081,7 +4076,7 @@ void TRecfield::set(int from, int to) { const RecDes* rd = _rec->rec_des(); - _subfield = strchr(_name, ':'); + _subfield = strchr(_name.get_buffer(), ':'); if (_subfield != NULL) { *_subfield = '\0'; @@ -4135,7 +4130,7 @@ void TRecfield::set(int from, int to) TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to) { - strcpy(_name, name); + _name = name; _rec = &rec; set(from, to); } @@ -4172,8 +4167,7 @@ void TRecfield::put_subfield(const char* s) int TRecfield::operator =(int i) { - char buff[32]; - sprintf(buff, "%d", i); + TString16 buff; buff << i; if (_subfield == NULL) __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); else @@ -4185,20 +4179,18 @@ int TRecfield::operator =(int i) long TRecfield::operator =(long l) { - char buff[32]; - sprintf(buff, "%ld", l); + TString16 buff; buff << l; if (_subfield == NULL) __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); else put_subfield(buff); - _rec->setempty(FALSE); + _rec->setempty(false); return l; } const real& TRecfield::operator =(const real& r) { - char buff[80]; - strcpy(buff, r.string()); + const char* buff = r.string(); if (_subfield == NULL) __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); else @@ -4208,9 +4200,8 @@ const real& TRecfield::operator =(const real& r) } const TDate& TRecfield::operator =(const TDate& d) -{ - char buff[16]; - strcpy(buff, (const char*)d); +{ + const TString16 buff = d.stringa(); if (_subfield == NULL) __putfieldbuff( _len, _dec, _type, buff, _p, __file_is_crypted(_rec->num())); else @@ -4251,7 +4242,7 @@ void TRecfield::setptr(TRecnotype r) if (n) *wp += 128; } -void TRecfield::get_subfield(char* s) const +void TRecfield::get_subfield(TString& s) const { const TString& str = _rec->get(_name); int p = str.find(_subfield); @@ -4266,21 +4257,23 @@ void TRecfield::get_subfield(char* s) const e = p + _to; p += _from; if (p < e) - strcpy(s, str.sub(p, e)); - else *s = '\0'; + s = str.sub(p, e); + else + s.cut(0); } - else *s = '\0'; + else + s.cut(0); } TRecfield::operator int() const { - char tmp[32]; + TString16 tmp; if (_subfield == NULL) { if (_type == _intfld || _type == _intzerofld || _type == _longfld || _type == _longzerofld) { - strncpy(tmp, _p, _len); - tmp[_len] = '\0'; + tmp.strncpy(_p, _len); + tmp.cut(_len); } else __getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num())); @@ -4293,14 +4286,14 @@ TRecfield::operator int() const TRecfield::operator long() const { - char tmp[32]; + TString16 tmp; if (_subfield == NULL) { if (_type == _longfld || _type == _longzerofld || _type == _intfld || _type == _intzerofld) { - strncpy(tmp, _p, _len); - tmp[_len] = '\0'; + tmp.strncpy(_p, _len); + tmp.cut(_len); } else __getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num())); @@ -4314,14 +4307,14 @@ TRecfield::operator long() const TRecfield::operator const real() const { - char tmp[32]; + TString80 tmp; if (_subfield == NULL) { if (_type == _realfld) { - strncpy(tmp, _p, _len); - tmp[_len] = '\0'; + tmp.strncpy(_p, _len); + tmp.cut(_len) = '\0'; } else __getfieldbuff( _len, _type, _p, tmp, __file_is_crypted(_rec->num())); @@ -4336,13 +4329,13 @@ TRecfield::operator const real() const TRecfield::operator TDate() const { - char tmp[16]; + TString16 tmp; if (_subfield == NULL) { if (_type == _datefld) { - strncpy(tmp, _p, 8); + tmp.strncpy(_p, 8); tmp[8] = '\0'; return TDate(atol(tmp)); } @@ -4364,10 +4357,10 @@ TRecfield::operator const char*() const if (_type == _memofld) return _rec->get(_name); else - __getfieldbuff(_len, _type, _p, tmp.get_buffer(), __file_is_crypted(_rec->num())); + __getfieldbuff(_len, _type, _p, tmp, __file_is_crypted(_rec->num())); } else - get_subfield((char *) (const char *)tmp); + get_subfield(tmp); return tmp; } diff --git a/include/isam.h b/include/isam.h index b6e3fb0b7..091edcbf7 100755 --- a/include/isam.h +++ b/include/isam.h @@ -768,7 +768,7 @@ class TRecfield : public TObject // @access:(INTERNAL) Private Member { // @cmember:(INTERNAL) Nome del campo - char _name[32]; + TString80 _name; // @cmember:(INTERNAL) Puntatore a inizio record TRectype* _rec; // @cmember:(INTERNAL) Puntatore a inizio campo @@ -780,7 +780,7 @@ class TRecfield : public TObject // @cmember:(INTERNAL) Tipo del campo TFieldtypes _type; // @cmember:(INTERNAL) Sottocampo (Es. G1:TOTDOC) - char * _subfield; + char* _subfield; // @cmember:(INTERNAL) Da per i sottocampi (Es. G1:TOTDOC[2,3]) byte _from; // @cmember:(INTERNAL) A per i sottocampi (Es. G1:TOTDOC[2,3]) @@ -788,7 +788,7 @@ class TRecfield : public TObject // @cmember:(INTERNAL) Setta il campo

-esimo con i valori di

-esimo void set(int from, int to); - void get_subfield(char * s) const; + void get_subfield(TString& s) const; void put_subfield(const char * s); // @access Public Member diff --git a/include/maskfld.cpp b/include/maskfld.cpp index be381f59b..d7c0faf8d 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -8,11 +8,11 @@ #include #include #include -#include +//#include #include #include #include -#include +//#include #include #include #include @@ -2579,11 +2579,9 @@ KEY TBrowse::run() do_input(TRUE); _cursor->read(_isgteq); - //const TLocalisamfile& f = _cursor->file(); - //TString caption(prefix().description(f.name())); - TString caption(_cursor->file().description()); - if (!isalnum(caption[0])) - caption = "Selezione"; + TString caption = _cursor->file().description(); + if (caption.blank()) + caption = TR("Selezione"); KEY k = K_ESC; long selected = 0; diff --git a/include/postman.cpp b/include/postman.cpp index cd0dea091..f38779109 100755 --- a/include/postman.cpp +++ b/include/postman.cpp @@ -202,12 +202,14 @@ bool TPostman::dispatch_transaction(const TRectype& rec, TString16 subject; switch (rec.num()) { - case LF_TAB: - case LF_TABCOM: - case LF_TABGEN: - subject << rec.get("COD"); break; - default: - subject << rec.num(); + case LF_TAB: + case LF_TABCOM: + case LF_TABGEN: + subject << rec.get("COD"); + break; + default: + subject << rec.num(); + break; } msg.set_subject(subject); diff --git a/include/prefix.cpp b/include/prefix.cpp index 6164289ed..a67820543 100755 --- a/include/prefix.cpp +++ b/include/prefix.cpp @@ -297,12 +297,11 @@ int TFile_info::open_low(bool exclusive, bool index) { if (num() < LF_EXTERNAL && (_dir == _nordir || _dir == _comdir)) { - TRecnotype n = DB_reccount(_handle); - TDir d; - d.get(num(),_nolock,_dir,_sysdirop); + const TRecnotype n = DB_reccount(_handle); + TDir d; d.get(num(),_nolock,_dir,_sysdirop); _filedes.EOD = d.eod() = n; - _filedes.EOX = d.eox() = n; - d.put(num(),_dir,_sysdirop); + _filedes.EOX = d.eox() = n; + d.put(num(), _dir, _sysdirop); } if (index) @@ -428,6 +427,7 @@ const TFilename& TFile_info::load_filedes() else _dir = _nordir; COpenFile(num(), &_filedes, _nolock, _dir); + strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)); _name = _filedes.SysName; 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) { load_filedes(); - if (name.not_empty()) + if (name.full()) { // File dati temporaneo _dir = _extdir; @@ -813,7 +813,7 @@ bool TFirm::read(long cod) TLocalisamfile ditte(LF_NDITTE); if (cod > 0L) { - ditte.put("CODDITTA", cod); + ditte.put(NDT_CODDITTA, cod); err = ditte.read(); } else @@ -1037,7 +1037,6 @@ bool TPrefix::test(long codditta) const return test(s); } - long TPrefix::get_codditta() const { const long codditta = atol(_prefix); @@ -1152,15 +1151,14 @@ const TFirm& TPrefix::firm() return *_firm; } - // Certified 90% // @doc EXTERNAL // @func Converte il numero di una ditta nella sua directory dati // // @rdesc Restituisce il nome di una directory dati -const char* firm2dir( - long codditta) // @parm Codice ditta da convertire +// @parm Codice ditta da convertire +const char* firm2dir(long codditta) { TString8 firm; switch (codditta) diff --git a/include/printer.cpp b/include/printer.cpp index b4b949754..901ee0cc5 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -465,7 +465,7 @@ TPrint_txt_info::TPrint_txt_info(TTextfile& txt) { const word ps = printer().formlen(); 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 diff --git a/include/progind.cpp b/include/progind.cpp index e28ca7880..220d32a51 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -147,15 +147,16 @@ void TIndwin::update_bar() const WINDOW w = win(); RCT b = r; // 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); - b.left += 2; b.right -= 2; - b.top += 2; b.bottom -= 2; + xvt_rect_inflate(&b, -thick, -thick); b.right = b.left + int((b.right-b.left)*prc + 0.5); const int lasti = (b.bottom-b.top)/2; for (int i = 0; i <= lasti; i++) { +/* set_pen(blend_colors(FOCUS_BACK_COLOR, MASK_BACK_COLOR, double(i) / double(lasti))); PNT pt = { b.top+i, b.left }; xvt_dwin_draw_set_pos(w, pt); @@ -167,6 +168,12 @@ void TIndwin::update_bar() xvt_dwin_draw_set_pos(w, pt); pt.h = b.right; 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) diff --git a/include/recarray.cpp b/include/recarray.cpp index 45db17f24..4bbb7604b 100755 --- a/include/recarray.cpp +++ b/include/recarray.cpp @@ -120,7 +120,7 @@ TRectype& TRecord_array::row( { r = (TRectype*)key().dup(); // Crea nuovo record copiando la chiave 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 } CHECKD(r && n > 0, "Bad record number ", n); @@ -186,13 +186,12 @@ int TRecord_array::insert_row(TRectype* r) const bool shift = exist(nr); _data.insert(r, nr); if (shift) - { + { + TString16 n; for (int f = _data.last(); f > nr; f = _data.pred(f)) { - char n[16]; - TRectype & rec = row(f, FALSE); - - sprintf(n, "%ld", (long)_offset + f); + TRectype& rec = row(f, FALSE); + n.format("%ld", (long)_offset + f); rec.renum_key(_num, n); } } @@ -725,10 +724,11 @@ const TString& TDecoder::decode(long code) { char c[16]; if (code > 0) - sprintf(c, "%ld", code); - else - c[0] = '\0'; - return decode(c); + { + TString16 c; c << code; + return decode(c); + } + return EMPTY_STRING; } /////////////////////////////////////////////////////////// diff --git a/include/recset.h b/include/recset.h index d90eee38f..719acd572 100755 --- a/include/recset.h +++ b/include/recset.h @@ -16,8 +16,10 @@ struct TRecordset_column_info : public TObject { TString _name; // Table.Column - int _width; + int _width, _pos; TFieldtypes _type; + + TRecordset_column_info() : _width(0), _pos(0), _type(_alfafld) {} }; /////////////////////////////////////////////////////////// diff --git a/include/relation.cpp b/include/relation.cpp index 68dd3c379..8f64daca1 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -952,7 +952,7 @@ FILE* TCursor::open_index( _last_created = create; if (_indexname.empty()) { - TString16 radix; + TString8 radix; radix.format("c%d_", file().num()); _indexname.temp(radix); } @@ -1851,7 +1851,8 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp) { El_To_Sort Element; - fill_sort_key(Element.f); + TFixed_string f(Element.f, sizeof(Element.f)); + fill_sort_key(f); Element.p=recno; sort.sort((char *) &Element); if (TCursor::pos() < 0 && recno == rp) @@ -1894,11 +1895,11 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp) return ap; } -const char* TSorted_cursor::fill_sort_key(char* k) +const char* TSorted_cursor::fill_sort_key(TString& k) { TString16 fmt; TString sf; - *k = '\0'; + k.cut(0); for (TString80 s = _order_expr.get(0); s.not_empty(); s = _order_expr.get()) { 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)); else fmt.format("%%%ds",f.len(frec)); - strcat(k, format(fmt, (const char*)sf)); + k << format(fmt, (const char*)sf); } return k; } @@ -1941,7 +1942,7 @@ bool TSorted_cursor::changed() TRecnotype TSorted_cursor::read(TIsamop op, TReclock lockop) { - TString256 searching; fill_sort_key(searching.get_buffer()); + TString256 searching; fill_sort_key(searching); searching.rtrim(); const int cmplen = searching.len(); @@ -1967,7 +1968,7 @@ TRecnotype TSorted_cursor::read(TIsamop op, TReclock lockop) { const TRecnotype test = (first+last)/2; TCursor::operator=(test); - fill_sort_key(testing.get_buffer()); + fill_sort_key(testing); const int cmp = searching.compare(testing, cmplen); if (cmp == 0) { diff --git a/include/relation.h b/include/relation.h index 25d4d2917..40b9fce65 100755 --- a/include/relation.h +++ b/include/relation.h @@ -484,7 +484,7 @@ protected: // @cmember Controlla se la singola espressione contiene l'operatore UPPER(), ritornandone l'argomento bool is_upper(TString& s); // @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 ) virtual TRecnotype buildcursor(TRecnotype rp); diff --git a/include/reprint.cpp b/include/reprint.cpp index fed3ad375..44c115948 100755 --- a/include/reprint.cpp +++ b/include/reprint.cpp @@ -327,7 +327,7 @@ void TPrint_preview_window::update() for (int i = 1; lpi > 0; i++) { 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) break; line(0, y, (short)size.x, y); @@ -336,7 +336,7 @@ void TPrint_preview_window::update() for (int j = 1; cpi > 0; j++) { 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) break; 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()) { 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_NEXTREC : idm = POPUP_NEXT; break; case DLG_LASTREC : idm = POPUP_LAST; break; @@ -752,8 +752,8 @@ public: PNT TWindow_printer::log2dev(long x, long y) const { PNT ptdev; - ptdev.h = (x * _phr) / BOOKDPI; - ptdev.v = (y * _pvr) / BOOKDPI; + ptdev.h = short((x * _phr) / BOOKDPI); + ptdev.v = short((y * _pvr) / BOOKDPI); return ptdev; } @@ -1302,14 +1302,10 @@ bool TBook::print_page(TWindow& win, size_t page) { xvt_dwin_set_clip(w, &rct); } else - - if (str.starts_with("") { xvt_dwin_draw_oval(w, &rct); diff --git a/include/smartcard.cpp b/include/smartcard.cpp index 3e6ab151c..fd91b3f0f 100755 --- a/include/smartcard.cpp +++ b/include/smartcard.cpp @@ -1,8 +1,7 @@ #define __SMARTCARD_CPP -#ifdef WIN32 -#include -#endif +#define XVT_INCL_NATIVE +#include #include #include @@ -11,7 +10,6 @@ #include #include - #ifdef WIN32 #include diff --git a/include/textset.h b/include/textset.h index facf1da18..f6ad97512 100755 --- a/include/textset.h +++ b/include/textset.h @@ -111,6 +111,7 @@ public: virtual TRecnotype new_rec(const char* buf = NULL); 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 TVariant& get(const char* colunmn) const; diff --git a/include/viswin.cpp b/include/viswin.cpp index 1c276cc75..bbdb53e79 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -351,12 +351,11 @@ bool TViswin::adjust_box ( // @flag TRUE | Se ha constatato la corrispondenza // @flag FALSE | Se non ha constatato la corrispondenza bool TViswin::check_link ( - TPoint * p) // @parm Posizione del cursore (default NULL) + TPoint* p) // @parm Posizione del cursore (default NULL) // @comm Se

e' NULL indica la posizione corrente del cursore { - static char descr[128], pdescr[128]; static int old_id = -1, plinkID = -1; static long y, x1, x2; static long py, px1, px2; @@ -396,8 +395,7 @@ bool TViswin::check_link ( erase_link (y, x1, x2); TToken_string & ttt = (TToken_string &) (*_links)[id]; ttt.restart (); - strcpy (descr, ttt.get ()); -// strcat (descr, t.get (3)); + _descr = ttt.get (); _linktxt = t.get(3); if (_multiple) { @@ -413,23 +411,22 @@ bool TViswin::check_link ( if (_txt.get_foreground() == fg && _txt.get_background() == bg) { _multiple_link.add (cp); - strcat(descr, " "); - strcat(descr, cp); + _descr << ' ' << cp; } } } else - strcat(descr, _linktxt); + _descr << _linktxt; old_id = _linkID = id; y = ty; x1 = tx1; x2 = tx2; - display_link (y, x1, x2, descr); + display_link (y, x1, x2, _descr); } if (p == &_point) { - strcpy (pdescr, descr); + _pdescr = _descr; plinkID = id; px1 = x1; px2 = x2; @@ -454,8 +451,8 @@ bool TViswin::check_link ( x1 = px1; x2 = px2; y = py; - strcpy (descr, pdescr); - display_link (y, x1, x2, descr); + _descr = _pdescr; + display_link (y, x1, x2, _descr); return TRUE; } diff --git a/include/viswin.h b/include/viswin.h index fa24ef071..462358bcb 100755 --- a/include/viswin.h +++ b/include/viswin.h @@ -123,6 +123,7 @@ class TViswin : public TField_window TArray* _links; // @cmember:(INTERNAL) Array di segnalibri TArray* _bookmarks; + TString _descr, _pdescr; // @cmember:(INTERNAL) Indica se occorre ridisegnare la selezione bool need_paint_sel(bool smart = TRUE);