diff --git a/include/applicat.cpp b/include/applicat.cpp index 8c946badd..97ce085b5 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -612,7 +612,7 @@ bool TApplication::has_module(int module, int checktype) const #endif // Testa bit di attivazione dell'utente - if (ok && checktype != CHK_DONGLE && module != EEAUT) + if (ok && checktype != CHK_DONGLE) ok = _user_aut[module]; return ok; } @@ -819,7 +819,7 @@ bool TApplication::get_next_pdf(int anno, long ditta, const char* codnum, bool TApplication::get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn, TString& subj, TString& text, TToken_string& attach, bool& ui) const { - bool ok = dongle().active(RSAUT) && dongle().active(EEAUT); + bool ok = dongle().active(RSAUT); ui = ok && to.blank(); return ok; } diff --git a/include/confapp.h b/include/confapp.h index 2c7b7407b..a937e1c42 100755 --- a/include/confapp.h +++ b/include/confapp.h @@ -104,7 +104,7 @@ public: // @cmember Setta il tipo di file di configurazione al quale e' associata l'applicazione void set_config(int which); // @cmember Costruttore - TConfig_application(int which_config = CONFIG_GENERAL) ; + TConfig_application(int which_config) ; // @cmember Distruttore virtual ~TConfig_application() ; }; diff --git a/include/config.cpp b/include/config.cpp index 02af703a1..1298e06c3 100755 --- a/include/config.cpp +++ b/include/config.cpp @@ -686,6 +686,9 @@ static void cfg2file(int which_config, TFilename& file) { switch (which_config) { + case CONFIG_GENERAL: + file = "./install.ini"; + break; case CONFIG_DITTA: file = firm2dir(prefix().get_codditta()); file.add("ditta.ini"); diff --git a/include/config.h b/include/config.h index 12d2a9ec8..889e48fe2 100755 --- a/include/config.h +++ b/include/config.h @@ -7,7 +7,7 @@ class TConfig; -// questo sara' il principale, per ora non c'e' +// file lista moduli installati (install.ini) #define CONFIG_GENERAL 0 // file campo.ini #define CONFIG_INSTALL 1 @@ -167,7 +167,7 @@ public: // @cmember Costruttore (il paragrafo iniziale e' il modulo corrente // salvo diversa indicazione) - TConfig(int which_config = CONFIG_GENERAL, const char* paragraph = NULL); + TConfig(int which_config, const char* paragraph = NULL); // @cmember Costruttore (il paragrafo iniziale e' il modulo corrente // salvo diversa indicazione) TConfig(const char* file, const char* paragraph = NULL); diff --git a/include/dongle.cpp b/include/dongle.cpp index 89af366fd..b46ff0d3d 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -140,7 +140,7 @@ inline void reset_bit(word& w, byte b) TDongle::TDongle() : _hardware(_dongle_unknown), _type(_no_dongle), _serno(0xFFFF), - _max_users(1), _year_assist(2006), _dirty(false) + _max_users(1), _year_assist(2009), _dirty(false), _OEM(-1) { memset(_eprom, 0, sizeof(_eprom)); memset(_assist, 0, sizeof(_assist)); @@ -155,49 +155,7 @@ TDongle::~TDongle() const TString& TDongle::administrator(TString* pwd) const { if (_admin.blank()) - { - TString& admin = (TString&)_admin; // Sorry - TString& admpwd = (TString&)_admpwd; // Sorry - - //nuovo metodo di rilevamento administrator (dalla 10.0 in avanti); l'admin sta nel file oem.ini sotto la cartella - //setup, sia nel CD che soprattutto nel programma installato - int oem = -1; - if (oem < 0) - { - TConfig ini(CONFIG_OEM, "MAIN"); - oem = ini.get_int("OEM", NULL, -1, -1); - if (oem >= 0) - { - TString8 para; para << "OEM_" << oem; - admin = ini.get("Administrator", para); - admpwd = ini.get("Password", para); - } - } - - //vecchio metodo di rilevamento dell'admin e della sua password: sta in install.ini - //administrator - if (oem < 0) - { - TConfig ini("install.ini", "Main"); - admin = ini.get("Administrator"); - admpwd = ini.get("Password"); - } - - if (admin.blank()) - admin = "ADMIN"; - else - admin = ::decode(_admin); - - //password - if (admpwd.blank()) - { - admpwd = admin; - admpwd.lower(); - admpwd.insert(".", 2); - } - else - admpwd = ::decode(admpwd); - } + oem(); if (pwd) *pwd = _admpwd; return _admin; @@ -511,9 +469,7 @@ int TDongle::can_try_server() const { if (xvt_sys_dongle_server_is_running()) return 3; - - TConfig ini(CONFIG_INSTALL, "Server"); - const TString& dongle = ini.get("Dongle"); + const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle"); return dongle.full(); } @@ -688,43 +644,38 @@ bool TDongle::write_words(word reg, word len, word* data) const return ok; } -// Ritorna il nome della ditta che vende il programma attuale -const TString& TDongle::reseller() const +int TDongle::oem() const { - if (_reseller.blank()) + if (_OEM < 0) { TString& firm = (TString&) _reseller; TString& campo = (TString&) _product; TString& breve = (TString&) _shortname; + TString& admin = (TString&)_admin; + TString& admpwd = (TString&)_admpwd; + int& oem = (int&)_OEM; //nuovo metodo di rilevamento producer (dalla 10.0 in avanti); il producer sta nel file oem.ini sotto la cartella //setup, sia nel CD che soprattutto nel programma installato - int oem = -1; - if (oem < 0) + TConfig ini(CONFIG_OEM, "MAIN"); + oem = ini.get_int("OEM", NULL, -1, -1); + if (oem >= 0) { - TConfig ini(CONFIG_OEM, "MAIN"); - oem = ini.get_int("OEM", NULL, -1, -1); - if (oem >= 0) - { - TString8 para; para << "OEM_" << oem; - campo = ini.get("Product", para); - firm = ini.get("Reseller", para); - breve = ini.get("Name", para); - } + TString8 para; para << "OEM_" << oem; + ini.set_paragraph(para); + campo = decode(ini.get("Product")); + firm = decode(ini.get("Reseller")); + breve = decode(ini.get("Name")); + admin = decode(ini.get("Administrator")); + admpwd = decode(ini.get("Password")); } + if (firm.blank()) //vecchio metodo di rilevamento del producer: sta in install.ini { - TConfig ini("install.ini", "Main"); - firm = ini.get("Producer"); + firm = decode(ini_get_string(CONFIG_GENERAL, "Main", "Producer")); campo = breve = " "; } //nuovo metodo: cerca produttore (Name) e prodotto (Product) - if (firm.full()) - { - firm = decode(firm); - campo = decode(campo); - breve = decode(breve); - } if (firm.blank()) { ignore_xvt_errors(true); @@ -733,41 +684,65 @@ const TString& TDongle::reseller() const ignore_xvt_errors(false); } + if (admin.blank()) + { + admin = decode(ini_get_string(CONFIG_GENERAL, "Main", "Administrator")); + if (admin.blank()) + { + admin = "ADMIN"; + admpwd = "ad.min"; + } + } + + if (admpwd.blank()) + { + admpwd = decode(ini_get_string(CONFIG_GENERAL, "Main", "Password")); + if (admpwd.blank()) + { + admpwd = admin; + admpwd.lower(); + admpwd.insert(".", 2); + } + } + if (campo.blank()) campo = "Campo Enterprise"; if (firm.blank()) firm = "AGA informatica s.r.l."; if (breve.blank()) breve = "Campo"; + + if (oem < 0) + oem = firm.starts_with("AGA ") ? 0 : 1; } - + return _OEM; +} + +// Ritorna il nome della ditta che vende il programma attuale +const TString& TDongle::reseller() const +{ + if (_reseller.empty()) + oem(); return _reseller; } const TString& TDongle::product() const { if (_product.empty()) - reseller(); + oem(); return _product; } const TString& TDongle::shortname() const { if (_shortname.empty()) - reseller(); + oem(); return _shortname; } bool TDongle::active(word module) const { - bool yes = false; - if (module == EEAUT) - { - const TString& r = reseller(); - yes = r.starts_with("AGA "); - } - else - yes = (module < ENDAUT) && _module[module] && shown(module); + const bool yes = (module < ENDAUT) && _module[module] && shown(module); return yes; } @@ -1037,25 +1012,13 @@ const TString& TDongle::module_code2name(word mod) const const TString_array& modinfo = info(); if (mod < modinfo.items()) return modinfo.row(mod).left(2); - else - { - if (mod == EEAUT) - return get_tmp_string() = "ee"; - } return EMPTY_STRING; } const TString& TDongle::module_code2desc(word mod) const { const TString_array& modinfo = info(); - if (mod < modinfo.items()) - return modinfo.row(mod).mid(3); - else - { - if (mod == EEAUT) - return get_tmp_string() = "Enterprise Edition"; - } - return EMPTY_STRING; + return mod < modinfo.items() ? modinfo.row(mod).mid(3) : EMPTY_STRING; } const TString& TDongle::module_name2desc(const char* mod) const @@ -1079,13 +1042,16 @@ bool TDongle::shown(word code) const { const TString4 mod = module_code2name(code); yes = mod.not_empty(); - if (yes && code > BAAUT) + if (yes && code > BAAUT && code < ENDAUT) { - bool do_test = true; - if (code != EEAUT) - do_test = ini_get_bool("install.ini", mod, "Ee"); - if (do_test) - yes = active(EEAUT); + TAuto_token_string ee = ini_get_string(CONFIG_GENERAL, mod, "OEM"); // Modern OEM handling + if (ee.full()) + yes = ee.get_pos(oem()) >= 0; + else + { + if (ini_get_bool(CONFIG_GENERAL, mod, "Ee")) // Legacy Enterprise Edition + yes = oem() == 0; + } } if (yes) ((TBit_array&)_shown).set(code); // Setto il flag di visibilta' per la prossima volta diff --git a/include/dongle.h b/include/dongle.h index 5d60c6176..249df9276 100755 --- a/include/dongle.h +++ b/include/dongle.h @@ -19,6 +19,7 @@ class TDongle : public TObject TDongleType _type; TString _admin, _admpwd, _reseller, _product, _shortname; + int _OEM; word _serno, _max_users, _year_assist; word _eprom[64]; @@ -87,6 +88,7 @@ public: bool pay_assist(int index, real imp, bool lire); const TString& administrator(TString* pwd = NULL) const; + int oem() const; const TString& reseller() const; const TString& product() const; const TString& shortname() const; diff --git a/include/isam.cpp b/include/isam.cpp index 571f46778..24f78de03 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -254,7 +254,7 @@ HIDDEN int find_relapp(TConfig& cfg, void* jolly) bool get_relapp(int logicnum, TString& app) { - TConfig ini("install.ini"); + TConfig ini(CONFIG_GENERAL); TCallbackFileinfo fi; fi._var.format("Edit_%d", logicnum); ini.for_each_paragraph(find_relapp, &fi); @@ -300,7 +300,7 @@ HIDDEN int find_tabapp(TConfig& cfg, void* jolly) bool get_tabapp(const char * tabname, TString& app) { - TConfig ini("install.ini"); + TConfig ini(CONFIG_GENERAL); TCallbackTableinfo fi; TTable t(tabname); fi._var1.format("Edit_%s", t.name()); diff --git a/include/modaut.h b/include/modaut.h index 7ec4f72cb..6149de83a 100755 --- a/include/modaut.h +++ b/include/modaut.h @@ -48,7 +48,4 @@ #define ESAUT 47 #define ENDAUT 48 -// Enterprise Edition :-) -#define EEAUT 99 - #endif // __MODAUT_H diff --git a/include/msksheet.cpp b/include/msksheet.cpp index ce9ffbc7b..8a99cdbee 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -2833,7 +2833,7 @@ void TSheet_field::highlight() const if (s->_check_enabled) { int rows; xi_get_list_info(s->_obj, &rows); - if (rows > 0) + if (rows > 0 && s->_cur_rec >= 0 && s->_cur_rec < rows) { if (s->notify(s->_cur_rec, K_TAB)) { diff --git a/include/reprint.cpp b/include/reprint.cpp index dcc9c2a12..cfc563120 100755 --- a/include/reprint.cpp +++ b/include/reprint.cpp @@ -1433,6 +1433,16 @@ bool TBook::print_page(TWindow& win, size_t page) else thickness = width * _phr / 72; // Converte width in 72' di pollice } + else + { + if (preview) + { + const TPrint_preview_window& pw = (const TPrint_preview_window&)win; + const double alpha = pw.log2dev(20)/100.0; + if (alpha < 1.0) + col = blend_colors(col, COLOR_WHITE, alpha); + } + } win.set_pen(col, thickness); } continue; diff --git a/include/tabmod.cpp b/include/tabmod.cpp index 8dd3e2a30..b05c46f97 100755 --- a/include/tabmod.cpp +++ b/include/tabmod.cpp @@ -263,7 +263,7 @@ bool TModule_table::get_relapp(TString& app) const if (_customer > 0L) para.format("%s%06ld", (const char*)_module, _customer); para.lower(); - TConfig ini("install.ini", para); + TConfig ini(CONFIG_GENERAL, para); TString8 var; var << "Edit_" << _tabname; diff --git a/include/tabutil.cpp b/include/tabutil.cpp index c93a28556..813db1c6c 100755 --- a/include/tabutil.cpp +++ b/include/tabutil.cpp @@ -270,7 +270,7 @@ HIDDEN int find_relapp(TConfig& cfg, void* jolly) bool TTable::get_relapp(TString& app) const { - TConfig ini("install.ini"); + TConfig ini(CONFIG_GENERAL); TCallbackTableinfo fi; fi._var1.format("Edit_%s", (const char*)_tabname); fi._var2.format("Edit_%d", num());