diff --git a/include/applicat.cpp b/include/applicat.cpp index 678b3de0a..c7dc152ff 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -125,7 +125,6 @@ TInfo_mask::TInfo_mask() /////////////////////////////////////////////////////////// HIDDEN TApplication* _application = NULL; -HIDDEN bool _xvt_running = FALSE; // @doc EXTERNAL @@ -140,15 +139,6 @@ TApplication& main_app() // @doc INTERNAL -// @func Controlla se si sta eseguendo xvt -// -// @rdesc Ritorna i seguenti valori: -// -// @flag TRUE | Se se e' stata definita una -// @flag FALSE | Se se non e' stata definita una -bool xvt_running() -{ return _xvt_running; } - // Ritorna il nome della ditta che vende il programma attuale HIDDEN const char* producer_name(TString& firm) { @@ -534,7 +524,7 @@ bool TApplication::remove_menu(MENU_TAG id) TApplication::TApplication() - : _savefirm(0), _create_ok(FALSE), _god_vars(NULL) + : _savefirm(0), _running(FALSE), _create_ok(FALSE), _god_vars(NULL) { } @@ -773,7 +763,7 @@ void TApplication::run( set_xvt_hooks(); - _xvt_running = TRUE; + _running = TRUE; xvt_app_create(argc, argv, 0L, task_eh, &cfg); } diff --git a/include/applicat.h b/include/applicat.h index e9346e6c4..c43e3abe9 100755 --- a/include/applicat.h +++ b/include/applicat.h @@ -56,9 +56,12 @@ class TApplication TString _module_name; // @cmember:(INTERNAL) Elenco dei files TArray _used_files; - + // @cmember:(INTERNAL) Codice della ditta long _savefirm; + + // @cmember:(INTERNAL) Indica se l'applicazione e' partita + bool _running; // @cmember:(INTERNAL) Indica se l'applicazione e' stata creata con successo bool _create_ok; @@ -122,6 +125,9 @@ public: // @cmember Ritorna l'identificatore della classe virtual word class_id() const { return CLASS_APPLICATION; } + + // @cmember Controlla se il programa e' partito + bool is_running() const { return _running; } // @cmember Controlla se si tratta di una applicazione valida virtual bool ok() const { return _create_ok; } @@ -217,8 +223,6 @@ public: virtual ~TSkeleton_application() { } }; - -bool xvt_running(); TApplication& main_app(); #endif /* __APPLICATION_H */ diff --git a/include/ccustio.c b/include/ccustio.c index 8d10b64db..aa5946ba3 100755 --- a/include/ccustio.c +++ b/include/ccustio.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "modaut.h" #endif diff --git a/include/dongle.cpp b/include/dongle.cpp index 727bb6d2f..295a28843 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -449,7 +449,7 @@ bool TDongle::network_login(bool test_all_keys) const char* server = ini.get("Dongle"); const char* guest = "******"; const TString16 appname = main_app().name(); - const char* utente = (!xvt_running() && appname == "ba0100") ? guest : user(); + const char* utente = (!main_app().is_running() && appname == "ba0100") ? guest : user(); const bool ok = rpc_UserLogin(server, utente, "******", appname); if (ok) diff --git a/include/golem.cpp b/include/golem.cpp index 5b0fb02f7..7e47e7348 100755 --- a/include/golem.cpp +++ b/include/golem.cpp @@ -586,7 +586,7 @@ bool TGolem_window::on_key(KEY k) if (_last_handle) { if (IsWindow(HWND(_last_handle))) - SendMessage(HWND(_last_handle), WM_CLOSE, 0, 0); + ::SendMessage(HWND(_last_handle), WM_CLOSE, 0, 0); _last_handle = NULL; } _last_file = file; @@ -602,14 +602,14 @@ bool TGolem_window::on_key(KEY k) { if (ext == good_ext[i]) { - GetSystemDirectory(cmd.get_buffer(), cmd.size()); + ::GetSystemDirectory(cmd.get_buffer(), cmd.size()); cmd.add("viewers"); cmd.add("quikview.exe"); break; } } if (!cmd.exist()) - xvt_sys_find_editor(file, cmd.get_buffer(), cmd.size()); + xvt_sys_find_editor(file, cmd.get_buffer()); if (cmd.not_empty()) { cmd << ' ' << file; diff --git a/include/inst.cpp b/include/inst.cpp index e5415f1fd..4bde4936a 100755 --- a/include/inst.cpp +++ b/include/inst.cpp @@ -87,10 +87,11 @@ int TSystemtempfile::load( if (f.paragraph("Header")) { f.equal(); - const long level = atol(f.line()); - if (level > get_std_level()) + const unsigned int level = atoi(f.line()); + const unsigned int stdlev = prefix().get_stdlevel(); + if (level > stdlev) error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.", - from, level/100, level%100, get_std_level()/100, get_std_level()%100); + from, level/100, level%100, stdlev/100, stdlev%100); //lcf = getlcf(level); nflds = 0; TToken_string s2(f.line()); diff --git a/include/isam.cpp b/include/isam.cpp index 66f9676b3..43a7e3a7d 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -1,4 +1,6 @@ #include + +#include #include #include #include @@ -492,8 +494,7 @@ HIDDEN void browse_null(char *start, int nc) HIDDEN const char * translate_key(const char* key) // Traduce l'espressione chiave di CodeBase { // Trasforma l'espressione - static TToken_string t; - t = key; + TToken_string t = key; TToken_string k(t.get(0),'+'); TToken_string range("",','); TString ws; @@ -546,7 +547,10 @@ HIDDEN const char * translate_key(const char* key) // Traduce l'espressione chia } t.rtrim(1); // Toglie il + in piu' t.add(is_dup ? "X" : " "); - return t; + + TString& tmp = get_tmp_string(); + tmp = t; + return tmp; } HIDDEN int __build_key(const RecDes *recd, int numkey, RecType recin, char *key, bool build_x_cb) @@ -1880,7 +1884,7 @@ int TSystemisamfile::exec_convapp( TString_array paralist; conv.list_paragraphs(paralist); - for (long l = flev; err == 0 && l <= get_std_level(); l++) + for (unsigned int l = flev; err == 0 && l <= prefix().get_stdlevel(); l++) { paragraph.format("%06ld", l); if (paralist.find(paragraph) < 0) @@ -1930,7 +1934,7 @@ bool TSystemisamfile::getlcf( TString_array paralist; conv.list_paragraphs(paralist); - for (long l = flev; l <= get_std_level(); l++) + for (unsigned int l = flev; l <= prefix().get_stdlevel(); l++) { paragraph.format("%06ld", l); if (paralist.find(paragraph) < 0) @@ -2383,10 +2387,13 @@ int TSystemisamfile::load( key.trim(); if (key == "Version") { - const long level = atol(f.token().mid(equal+1)); + const unsigned int level = atoi(f.token().mid(equal+1)); if (level > prefix().filelevel()) - error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.", - from, level/100, level%100, get_std_level()/100, get_std_level()%100); + { + const unsigned int stdlevel = prefix().get_stdlevel(); + error_box(FR("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione."), + from, level/100, level%100, stdlevel/100, stdlevel%100); + } lcf = getlcf(level); } else if (key == "File") diff --git a/include/prefix.cpp b/include/prefix.cpp index 2aadd004e..c6d7adb1a 100755 --- a/include/prefix.cpp +++ b/include/prefix.cpp @@ -57,7 +57,7 @@ TPrefix& prefix() // @func Distrugge l'oggett in memoria void prefix_destroy() { - if (_prefhndl) + if (_prefhndl != NULL) { delete _prefhndl; _prefhndl = NULL; @@ -858,7 +858,7 @@ TFirm::TFirm(long code) // TPrefix /////////////////////////////////////////////////////////// -TPrefix::TPrefix() : _filelevel(0), _items(0), _firm(NULL) +TPrefix::TPrefix() : _filelevel(0), _stdlevel(0), _items(0), _firm(NULL) { _prefix = "."; CGetPref(); @@ -872,6 +872,10 @@ TPrefix::TPrefix() : _filelevel(0), _items(0), _firm(NULL) set_codditta(0L, TRUE); DB_init(); + + set(""); // Dati standard + _stdlevel = filelevel(); + set("DEF"); // Ditta corrente } TPrefix::~TPrefix() diff --git a/include/prefix.h b/include/prefix.h index f3ada9d6b..30abbb31a 100755 --- a/include/prefix.h +++ b/include/prefix.h @@ -102,7 +102,7 @@ class TPrefix : public TObject TString _prefix; // @cmember:(INTERNAL) Livello degli archivi - long _filelevel; + unsigned int _filelevel, _stdlevel; // @cmember:(INTERNAL) Numero di files esitenti int _items; @@ -142,8 +142,12 @@ public: const char* name() const { return _prefix;} // @cmember Ritorna il livello degli archivi - long filelevel() const + unsigned int filelevel() const {return _filelevel;} + + // @cmember Ritorna il livello standard degli archivi + unsigned int get_stdlevel() const { return _stdlevel; } + void set_stdlevel(unsigned int sl) { _stdlevel = sl; } // @cmember Ritorna il numero di archivi int items() const diff --git a/include/relapp.cpp b/include/relapp.cpp index 7ef77cc35..dbf5fa533 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -526,12 +526,12 @@ TEdit_field& TRelation_application::get_search_field() const { short id = _search_id; - if (id <= 0) + if (id <= 0 || !_mask->field(id).active()) { for (int i = _mask->fields()-1; i >= 0; i--) { const TMask_field& f = _mask->fld(i); - if (f.is_edit() && f.in_key(1) && f.required()) + if (f.is_edit() && f.in_key(1) && f.active()) { id = f.dlg(); break; diff --git a/include/stdtypes.cpp b/include/stdtypes.cpp index 7f35c9905..384d1c188 100755 --- a/include/stdtypes.cpp +++ b/include/stdtypes.cpp @@ -4,18 +4,6 @@ #include #include -HIDDEN long _stdlevel = 0; - -// @doc INTERNAL - -// @func Ritorna il livello degli archivi -long get_std_level() -{ return _stdlevel; } - -// @func Setta il livello degli archivi -void set_std_level(const long l) -{ _stdlevel = l; } - // @doc INTERNAL // @func Ritorna il numero di serie della chiave @@ -38,7 +26,7 @@ bool test_assistance_year() if (get_serial_number() > 0) { const int new_year = dongle().year_assist(); - if (new_year >= 1997 && new_year <= dongle_year) + if (new_year >= 2002 && new_year <= dongle_year) dongle_year = new_year; } @@ -57,11 +45,7 @@ bool test_assistance_year() // @func Inizilizza le variabili globali void init_global_vars() { - TPrefix& pref = prefix_init(); - - pref.set(""); // Dati standard - _stdlevel = pref.filelevel(); - pref.set("DEF"); // Ditta corrente + prefix_init(); } // @doc INTERNAL diff --git a/include/stdtypes.h b/include/stdtypes.h index 65232f4a2..25e906383 100755 --- a/include/stdtypes.h +++ b/include/stdtypes.h @@ -62,8 +62,6 @@ typedef unsigned short KEY; int get_serial_number(); bool test_assistance_year(); -long get_std_level(); -void set_std_level(const long l); void init_global_vars(); void free_global_vars();