From 2dea5d3711f9cac02833b44803c46a0716c70125 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 7 Oct 2008 09:02:41 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : tutti Ricompilazione Demo : [ ] Commento : Allungata lunghezza massima percorso dati. git-svn-id: svn://10.65.10.50/trunk@17358 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/about.cpp | 155 +++++++++++++++++++++++++++++++++++++++++++ include/about.h | 6 ++ include/applicat.cpp | 142 +-------------------------------------- include/applicat.h | 2 - include/ccommon.h | 2 +- include/cfiles.c | 1 + include/codeb.c | 13 ++-- include/extcdecl.h | 2 +- include/extctype.h | 9 ++- include/files.h | 2 +- include/isam.cpp | 8 +-- include/prefix.cpp | 17 ++--- include/progind.cpp | 31 +++++---- include/progind.h | 2 + include/recset.cpp | 12 +++- include/recset.h | 2 + include/sqlset.cpp | 8 ++- include/sqlset.h | 3 +- 18 files changed, 230 insertions(+), 187 deletions(-) create mode 100755 include/about.cpp create mode 100755 include/about.h diff --git a/include/about.cpp b/include/about.cpp new file mode 100755 index 000000000..8aa238724 --- /dev/null +++ b/include/about.cpp @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////// +// Finestra informazioni +/////////////////////////////////////////////////////////// + +class TInfo_mask : public TArray_sheet +{ +protected: + virtual bool get_cell_colors(int row, int col, COLOR& fore, COLOR& back) const; + +public: + void add_row(const char* prompt, const char* value, int err = 0); + void add_row(const char* prompt, unsigned long value, int err = 0); + TInfo_mask(); +}; + +bool TInfo_mask::get_cell_colors(int r, int c, COLOR& fore, COLOR& back) const +{ + const int err = ((TArray_sheet*)this)->row(r).get_int(2); + if (err > 0) + { + fore = err == 1 ? NORMAL_COLOR : FOCUS_COLOR; + back = err == 1 ? REQUIRED_BACK_COLOR : FOCUS_BACK_COLOR; + } + return TArray_sheet::get_cell_colors(r, c, fore, back); +} + +void TInfo_mask::add_row(const char* prompt, const char* value, int err) +{ + TToken_string* r = new TToken_string; + r->add(prompt); + r->add(value); + r->add(err); + add(r); +} + +void TInfo_mask::add_row(const char* prompt, unsigned long value, int err) +{ + TString16 str; str.format("%lu", value); + add_row(prompt, str); +} + +TInfo_mask::TInfo_mask() + : TArray_sheet(-1, -1, 78, 20, TR("Informazioni"), "@16|@60") +{ + const word ser_no = dongle().number(); + + int year = 2008, release = 10, tag = 0, patch = 1; + TString80 versione = "2008.10.00 Patch 0001"; + if (main_app().get_version_info(year, release, tag, patch)) + versione.format("%d.%02d.%02d Patch %04d", year, release, tag, patch); + + TString80 stros, strwx; + xvt_sys_get_version(stros.get_buffer(), strwx.get_buffer(), stros.size()); + + TString arg; + for (int a = 0; a < main_app().argc(); a++) + arg << main_app().argv(a) << ' '; + arg.trim(); arg.lower(); + + TConfig campoini(CONFIG_INSTALL, "Main"); + TConfig userini(CONFIG_GUI, "Printer"); + + TString prot; + const TDongleHardware dhw = dongle().hardware(); + switch (dhw) + { + case _dongle_hardlock: prot = "Hardlock"; break; + case _dongle_eutron : prot = "Eutron"; break; + case _dongle_network : prot = campoini.get("Dongle", "Server"); break; + default : prot = TR("Nessuna"); break; + } + + const int type = campoini.get_int("Type"); + const char* tipo = NULL; + switch (type) + { + case 1: tipo = TR("Postazione singola"); break; + case 2: tipo = TR("Server"); break; + case 3: tipo = TR("Client"); break; + default: + if (campoini.get_bool("TestDatabase")) + { + if (dhw == _dongle_network) + tipo = TR("Server"); + else + tipo = TR("Server o Postazione singola"); + } + else + tipo = TR("Client"); + break; + } + + TFilename temp; temp.tempdir(); + TString strdb, strsql; + { + TISAM_recordset rs(""); + strdb = rs.driver_version(); + } + { + TSQL_recordset rs(""); + strsql = rs.driver_version(); + } + + add_row(TR("Versione"), versione); + add_row(TR("Protezione"), prot); + add_row(TR("N. di serie"), ser_no, ser_no < 0); + add_row(TR("Assistenza"), dongle().year_assist()); + add_row(TR("Installazione"), tipo); + add_row(TR("Sistema"), stros); + add_row(TR("Utente"), user()); + add_row(TR("Studio"), firm2dir(-1)); + add_row(TR("Ditta"), campoini.get("Firm", "Main")); + if (prefix_valid()) + { + const TFirm& f = prefix().firm(); + add_row(TR("Ragione Sociale"), f.ragione_sociale()); + add_row(TR("Valuta"), f.codice_valuta()); + } + + add_row(TR("Programma"), arg); + add_row(TR("Config locale"), campoini.name(), campoini.name().find(' ') >= 0); + add_row(TR("Config utente"), userini.name(), userini.name().find(' ') >= 0); + add_row(TR("File temporanei"), temp, temp.find(' ') >= 0); + + const long mbfree = xvt_fsys_get_disk_free_space(firm2dir(-1), 'M'); + add_row(TR("Spazio su disco"), mbfree, mbfree < 512); + + TString printer(userini.get("Name", "Printer")); + if (printer.blank()) + printer = "Nessuna"; + add_row(TR("Stampante"), printer, printer.len() >= 32); + + xvt_print_pdf_version(printer.get_buffer(32), printer.size()); + add_row(TR("Libreria PDF"), printer); + add_row(TR("Libreria GUI"), strwx); + add_row(TR("Libreria DB"), strdb); + add_row(TR("Libreria SQL"), strsql); +} + +// About box: risposta alla opzione Informazioni del menu File +void about() +{ + TInfo_mask info; + info.run(); +} + diff --git a/include/about.h b/include/about.h new file mode 100755 index 000000000..1f24f5289 --- /dev/null +++ b/include/about.h @@ -0,0 +1,6 @@ +#ifndef __ABOUT_H +#define __ABOUT_H + +void about(); + +#endif diff --git a/include/applicat.cpp b/include/applicat.cpp index 25d924203..6aef2175e 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -1,13 +1,13 @@ +#include #include #include -#include #include #include #include +#include #include #include #include -#include #include #include @@ -16,137 +16,6 @@ #include -/////////////////////////////////////////////////////////// -// Finestra informazioni -/////////////////////////////////////////////////////////// - -class TInfo_mask : public TArray_sheet -{ -protected: - virtual bool get_cell_colors(int row, int col, COLOR& fore, COLOR& back) const; - -public: - void add_row(const char* prompt, const char* value, int err = 0); - void add_row(const char* prompt, unsigned long value, int err = 0); - TInfo_mask(); -}; - -bool TInfo_mask::get_cell_colors(int r, int c, COLOR& fore, COLOR& back) const -{ - const int err = ((TArray_sheet*)this)->row(r).get_int(2); - if (err > 0) - { - fore = NORMAL_COLOR; - back = err == 1 ? REQUIRED_BACK_COLOR : FOCUS_BACK_COLOR; - } - return TArray_sheet::get_cell_colors(r, c, fore, back); -} - -void TInfo_mask::add_row(const char* prompt, const char* value, int err) -{ - TToken_string* r = new TToken_string; - r->add(prompt); - r->add(value); - r->add(err); - add(r); -} - -void TInfo_mask::add_row(const char* prompt, unsigned long value, int err) -{ - TString16 str; str.format("%lu", value); - add_row(prompt, str); -} - -TInfo_mask::TInfo_mask() - : TArray_sheet(-1, -1, 78, 20, "Informazioni", "@16|@60") -{ - const word ser_no = dongle().number(); - - int year = 2008, release = 10, tag = 0, patch = 1; - TString80 versione = "2008.10.00 Patch 0001"; - if (main_app().get_version_info(year, release, tag, patch)) - versione.format("%d.%02d.%02d Patch %04d", year, release, tag, patch); - - TString80 stros, strwx; - xvt_sys_get_version(stros.get_buffer(), strwx.get_buffer(), stros.size()); - - TString arg; - for (int a = 0; a < main_app().argc(); a++) - arg << main_app().argv(a) << ' '; - arg.trim(); arg.lower(); - - TConfig campoini(CONFIG_INSTALL, "Main"); - TConfig userini(CONFIG_GUI, "Printer"); - - TString prot; - const TDongleHardware dhw = dongle().hardware(); - switch (dhw) - { - case _dongle_hardlock: prot = "Hardlock"; break; - case _dongle_eutron : prot = "Eutron"; break; - case _dongle_network : prot = campoini.get("Dongle", "Server"); break; - default : prot = TR("Nessuna"); break; - } - - const int type = campoini.get_int("Type"); - const char* tipo = NULL; - switch (type) - { - case 1: tipo = TR("Postazione singola"); break; - case 2: tipo = TR("Server"); break; - case 3: tipo = TR("Client"); break; - default: - if (campoini.get_bool("TestDatabase")) - { - if (dhw == _dongle_network) - tipo = TR("Server"); - else - tipo = TR("Server o Postazione singola"); - } - else - tipo = TR("Client"); - break; - } - - TFilename temp; - temp.tempdir(); - - TString strdb; - DB_version(strdb.get_buffer(), strdb.size()); - - add_row(TR("Versione"), versione); - add_row(TR("Protezione"), prot); - add_row(TR("N. di serie"), ser_no, ser_no < 0); - add_row(TR("Assistenza"), dongle().year_assist()); - add_row(TR("Installazione"), tipo); - add_row(TR("Sistema"), stros); - add_row(TR("Libreria GUI"), strwx); - add_row(TR("Libreria DB"), strdb); - add_row(TR("Utente"), user()); - add_row(TR("Studio"), firm2dir(-1)); - add_row(TR("Ditta"), campoini.get("Firm", "Main")); - if (prefix_valid()) - { - const TFirm& f = prefix().firm(); - add_row(TR("Ragione Sociale"), f.ragione_sociale()); - add_row(TR("Valuta"), f.codice_valuta()); - } - - add_row(TR("Programma"), arg); - add_row(TR("Config locale"), campoini.name(), campoini.name().find(' ') >= 0); - add_row(TR("Config utente"), userini.name(), userini.name().find(' ') >= 0); - add_row(TR("File temporanei"), temp, temp.find(' ') >= 0); - - const long mbfree = xvt_fsys_get_disk_free_space(firm2dir(-1), 'M'); - add_row(TR("Spazio su disco"), mbfree, mbfree < 512); - - TString printer(userini.get("Name", "Printer")); - if (printer.blank()) - printer = "Nessuna"; - add_row(TR("Stampante"), printer, printer.len() < 32); - -} - /////////////////////////////////////////////////////////// // Metodi di accesso globali all'applicazione corrente /////////////////////////////////////////////////////////// @@ -684,13 +553,6 @@ bool TApplication::get_version_info(int& year, int& release, int& tag, int& patc return valid; } -// About box: risposta alla opzione Informazioni del menu File -void TApplication::about() const -{ - TInfo_mask info; - info.run(); -} - // Risposta alla selezione Stampa del menu File void TApplication::print() { diff --git a/include/applicat.h b/include/applicat.h index fb735de15..e6d7609c3 100755 --- a/include/applicat.h +++ b/include/applicat.h @@ -61,8 +61,6 @@ class TApplication // @cmember:(INTERNAL) Termine dell'applicazione void terminate(); - // @cmember:(INTERNAL) About box: risposta alla opzione Informazioni del menu File - void about() const; // @access Protected Member protected: diff --git a/include/ccommon.h b/include/ccommon.h index bcc8f4ce0..40c75f234 100755 --- a/include/ccommon.h +++ b/include/ccommon.h @@ -96,7 +96,7 @@ typedef long TrDate; typedef char PathSt[82]; -extern Str80 cprefix; +extern PathSt cprefix; #ifdef __cplusplus extern "C" { diff --git a/include/cfiles.c b/include/cfiles.c index 788d40d82..2785c2a41 100755 --- a/include/cfiles.c +++ b/include/cfiles.c @@ -5,6 +5,7 @@ int dirfl[2] = {0, 0}, recfl[2] = {0, 0} ; PathSt __ptprf = ""; // Nome della directory con lo studio corrente +PathSt cprefix= ""; /* @(#) COpenDir FILES diff --git a/include/codeb.c b/include/codeb.c index 8888e5430..35c0e3cb1 100755 --- a/include/codeb.c +++ b/include/codeb.c @@ -38,7 +38,7 @@ static CODE4 code_base; static DATA4 *dbdata[CB4FILES]; -bool handle_ok(int handle) +static bool handle_ok(int handle) { return handle >= 0 && handle < CB4FILES && dbdata[handle] != NULL && dbdata[handle]->clientId >= 0; @@ -123,7 +123,7 @@ int DB_open(const char *filename,int mode,int index) code_base.errorCode=0; if (index == 0) /* Se e' stata richiesta l'apertura senza indici, setta il flag */ code_base.autoOpen = 0; - dbdata[found]=d4open(&code_base,(char*)filename); + dbdata[found]=d4open(&code_base, filename); if (index == 0) /* Restore the configuration of opening indexes*/ code_base.autoOpen = 1; if(dbdata[found]==0) @@ -628,12 +628,11 @@ int DB_packmemo(short vis, const char * filename) handle=DB_open(filename,1,0); /* Exclusive mode open! */ if (handle > -1) { - char s[81]; - if (vis) { - strcpy(s,"Compattamento memo file : "); - strcat(s,(char*)filename); + char s[256]; + strcpy(s, "Compattamento memo file : "); + strcat(s, filename); progind_create(100L,s,0,0,60); } rt=d4memoCompress(dbdata[handle]); @@ -1151,7 +1150,7 @@ long DB_changed(int handle) char* DB_memoptr( const int handle, const char * fieldname ) { - FIELD4* f = d4field( dbdata[ handle ], ( char *)fieldname ); + FIELD4* f = d4field( dbdata[ handle ], fieldname ); return f4memoPtr( f ); } diff --git a/include/extcdecl.h b/include/extcdecl.h index 034570ed8..b8fc17757 100755 --- a/include/extcdecl.h +++ b/include/extcdecl.h @@ -19,7 +19,7 @@ extern "C" { extern PathSt __ptprf; // Guy moved these outside extern - extern Str80 cprefix; + extern PathSt cprefix; /* @END */ diff --git a/include/extctype.h b/include/extctype.h index ceb38185d..03bef931d 100755 --- a/include/extctype.h +++ b/include/extctype.h @@ -1,8 +1,8 @@ #ifndef __EXTCTYPE_H #define __EXTCTYPE_H -#if !defined(__STDIO_H) && !defined(_INC_STDIO) -#include +#ifndef __CCOMMON_H +#include #endif #ifndef __STDTTYPES_H @@ -14,8 +14,9 @@ #define __PACKED__ __attribute__ ((packed)) #define __ALIGNED__ __attribute__ ((aligned(2))) #define __PACK_1__ +#endif -#else +#ifdef WIN32 #define __PACKED__ #define __ALIGNED__ #pragma pack(2) @@ -46,8 +47,6 @@ /* @T */ typedef long TrDate; -typedef char PathSt[42]; -typedef char Str80[82]; typedef long RecNoType; typedef char *RecType; typedef char FieldName[12] ; diff --git a/include/files.h b/include/files.h index e567cd2d9..573e54035 100755 --- a/include/files.h +++ b/include/files.h @@ -25,7 +25,7 @@ // @base public | TObject class TFile : public TObject -// @author:(INTERNAL) Sandro +// @author:(INTERNAL) Alex // @access:(INTERNAL) Private Member { diff --git a/include/isam.cpp b/include/isam.cpp index 618908f2e..f8ca7855d 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -82,7 +82,6 @@ void write_journal(TJournalHeader& jh, void* data, int len) #define READTYPES 0x00FF #define INVFLD 255 -Str80 cprefix; bool __field_changed = FALSE; #define NOALLOC (char **) -1 @@ -1072,7 +1071,7 @@ int TBaseisamfile::_write(const TRectype& rec) _recno = DB_recno(fhnd); if (_lasterr == NOERR && rec.has_memo()) - ((TRectype &)rec).write_memo(_isam_handle, _recno ); + ((TRectype&)rec).write_memo(_isam_handle, _recno ); return _lasterr; } @@ -1082,7 +1081,6 @@ int TBaseisamfile::write(const TRectype& rec) return rec.write(*this); } - int TBaseisamfile::write() { return TBaseisamfile::write(curr()); @@ -1151,8 +1149,8 @@ int TBaseisamfile::_rewrite(const TRectype& rec) if (_lasterr == NOERR) { - if (curr().has_memo( )) - ((TRectype &)rec).write_memo(_isam_handle, _recno ); + if (curr().has_memo()) + ((TRectype&)rec).write_memo(_isam_handle, _recno); } } diff --git a/include/prefix.cpp b/include/prefix.cpp index 0fc4d269a..d67d9df42 100755 --- a/include/prefix.cpp +++ b/include/prefix.cpp @@ -952,12 +952,12 @@ TFirm::TFirm(long code) TPrefix::TPrefix() : _filelevel(0), _stdlevel(0), _items(0), _firm(NULL) { _prefix = "."; - CGetPref(); + const char* prfx = CGetPref(); if (!fexist(__ptprf) || strchr(__ptprf, ' ') != NULL) fatal_box(FR("Percorso dati non valido: '%s'"), __ptprf); - const TFilename dir(cprefix); + const TFilename dir(prfx); const long primaditta = atol(dir.name()); if (primaditta > 0L && !exist(primaditta)) set_codditta(0L, TRUE); @@ -985,8 +985,9 @@ void TPrefix::reopen() const { if (_prefix != ".") { - ((TPrefix*)this)->_manager.close_all(); - ((TPrefix*)this)->_manager.open_all(); + TFile_manager& mgr = ((TPrefix*)this)->_manager; // Safe non const cast + mgr.close_all(); + mgr.open_all(); } } @@ -1029,18 +1030,18 @@ void TPrefix::set( CCloseRecDir(COMDIR); } + char* prfx = (char*)CGetPref(); // Safe non-const cast for PathSt cprefix if (strcmp(name, "DEF") == 0) { - CGetPref(); - xvt_fsys_parse_pathname(cprefix, NULL, NULL, _prefix.get_buffer(), NULL, NULL); + xvt_fsys_parse_pathname(prfx, NULL, NULL, _prefix.get_buffer(), NULL, NULL); } else { _prefix = name; if (*name) - xvt_fsys_build_pathname(cprefix, NULL, __ptprf, name, NULL, NULL); + xvt_fsys_build_pathname(prfx, NULL, __ptprf, name, NULL, NULL); else - strcpy(cprefix, ""); + *prfx = '\0'; } if (!test(_prefix)) diff --git a/include/progind.cpp b/include/progind.cpp index 026129c2c..f80da4f64 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -179,6 +179,22 @@ void TIndwin::update_bar() check_stop(); } +void TIndwin::update_txt() +{ + RCT r; get_txt_rct(r); + + WINDOW w = win(); + CBRUSH brush; brush.pat = PAT_SOLID; brush.color = MASK_BACK_COLOR; + xvt_dwin_set_cbrush(w, &brush); + xvt_dwin_set_std_cpen(w, TL_PEN_HOLLOW); + xvt_dwin_draw_rect(w, &r); + xvt_dwin_set_clip(w, NULL); + set_color(NORMAL_COLOR, MASK_BACK_COLOR); + set_opaque_text(TRUE); + set_font(); + advanced_draw_paragraph(*this, _text, r, 'L', 'C', CHARY); +} + void TIndwin::update() { clear(MASK_BACK_COLOR); @@ -187,20 +203,7 @@ void TIndwin::update() update_bar(); if (!_text.empty()) - { - RCT r; get_txt_rct(r); - - WINDOW w = win(); - CBRUSH brush; brush.pat = PAT_SOLID; brush.color = MASK_BACK_COLOR; - xvt_dwin_set_cbrush(w, &brush); - xvt_dwin_set_std_cpen(w, TL_PEN_HOLLOW); - xvt_dwin_draw_rect(w, &r); - xvt_dwin_set_clip(w, NULL); - set_color(NORMAL_COLOR, MASK_BACK_COLOR); - set_opaque_text(TRUE); - set_font(); - advanced_draw_paragraph(*this, _text, r, 'L', 'C', CHARY); - } + update_txt(); } bool TIndwin::setstatus(long l) diff --git a/include/progind.h b/include/progind.h index e39be7f51..55a3141ad 100755 --- a/include/progind.h +++ b/include/progind.h @@ -68,6 +68,8 @@ protected: // @cmember Aggiorna la barra di attesa virtual void update_bar(); + virtual void update_txt(); + // @cmember Controlla se ha terminato la barra di attesa KEY check_stop(); diff --git a/include/recset.cpp b/include/recset.cpp index 229a3d79b..31dd824ff 100755 --- a/include/recset.cpp +++ b/include/recset.cpp @@ -1,7 +1,7 @@ #include "../xvaga/incstr.h" #include -#include +#include #include #include #include @@ -692,6 +692,9 @@ bool TRecordset::ask_variables(bool all) return ok; } +const TString& TRecordset::driver_version() const +{ return EMPTY_STRING; } + TRecordset::TRecordset() : _parentset(NULL) { } @@ -1533,6 +1536,13 @@ void TISAM_recordset::set(const char* use) find_and_reset_vars(); } +const TString& TISAM_recordset::driver_version() const +{ + TString& tmp = get_tmp_string(20); + DB_version(tmp.get_buffer(), tmp.size()); + return tmp; +} + TISAM_recordset::TISAM_recordset(const char* use) : _relation(NULL), _cursor(NULL) { diff --git a/include/recset.h b/include/recset.h index 3d04f1015..37bff9b65 100755 --- a/include/recset.h +++ b/include/recset.h @@ -53,6 +53,7 @@ public: // Absolutely needed methods virtual void requery() pure; bool empty() const { return items() == 0; } virtual const TString& query_text() const pure; + virtual const TString& driver_version() const; virtual bool move_first() { return move_to(0); } virtual bool move_prev() { return move_to(current_row()-1); } @@ -114,6 +115,7 @@ public: virtual const TRecordset_column_info& column_info(unsigned int c) const; virtual const TVariant& get(unsigned int column) const; virtual const TVariant& get(const char* column_name) const; + virtual const TString& driver_version() const; virtual const TString& query_text() const { return _use; } TISAM_recordset(const char* use); diff --git a/include/sqlset.cpp b/include/sqlset.cpp index 387955805..fc43b057d 100755 --- a/include/sqlset.cpp +++ b/include/sqlset.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -571,6 +570,13 @@ void TSQL_recordset::set(const char* sql) } } +const TString& TSQL_recordset::driver_version() const +{ + TString& tmp = get_tmp_string(); + tmp << "SQLITE " << SQLITE_VERSION; + return tmp; +} + TSQL_recordset::TSQL_recordset(const char* sql) { set(sql); diff --git a/include/sqlset.h b/include/sqlset.h index 1ab176600..542d2d991 100755 --- a/include/sqlset.h +++ b/include/sqlset.h @@ -29,7 +29,8 @@ public: // TRecordset virtual unsigned int columns() const; virtual const TRecordset_column_info& column_info(unsigned int c) const; virtual const TVariant& get(unsigned int column) const; - const TString& query_text() const { return _sql; } + virtual const TString& query_text() const { return _sql; } + virtual const TString& driver_version() const; public: void set(const char* sql);