Patch level : 2.0 470

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Eliminate variabili statiche:
_xvt_running -> TApplication::is_running()
_stdlevel -> TPrefix::get_stdlevel()


git-svn-id: svn://10.65.10.50/trunk@11147 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-05-16 13:13:39 +00:00
parent b83897e2fd
commit ab1a9de76b
12 changed files with 48 additions and 57 deletions

View File

@ -125,7 +125,6 @@ TInfo_mask::TInfo_mask()
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
HIDDEN TApplication* _application = NULL; HIDDEN TApplication* _application = NULL;
HIDDEN bool _xvt_running = FALSE;
// @doc EXTERNAL // @doc EXTERNAL
@ -140,15 +139,6 @@ TApplication& main_app()
// @doc INTERNAL // @doc INTERNAL
// @func Controlla se si sta eseguendo xvt
//
// @rdesc Ritorna i seguenti valori:
//
// @flag TRUE | Se se e' stata definita una <c TApplication>
// @flag FALSE | Se se non e' stata definita una <c TApplication>
bool xvt_running()
{ return _xvt_running; }
// Ritorna il nome della ditta che vende il programma attuale // Ritorna il nome della ditta che vende il programma attuale
HIDDEN const char* producer_name(TString& firm) HIDDEN const char* producer_name(TString& firm)
{ {
@ -534,7 +524,7 @@ bool TApplication::remove_menu(MENU_TAG id)
TApplication::TApplication() 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(); set_xvt_hooks();
_xvt_running = TRUE; _running = TRUE;
xvt_app_create(argc, argv, 0L, task_eh, &cfg); xvt_app_create(argc, argv, 0L, task_eh, &cfg);
} }

View File

@ -56,9 +56,12 @@ class TApplication
TString _module_name; TString _module_name;
// @cmember:(INTERNAL) Elenco dei files // @cmember:(INTERNAL) Elenco dei files
TArray _used_files; TArray _used_files;
// @cmember:(INTERNAL) Codice della ditta // @cmember:(INTERNAL) Codice della ditta
long _savefirm; long _savefirm;
// @cmember:(INTERNAL) Indica se l'applicazione e' partita
bool _running;
// @cmember:(INTERNAL) Indica se l'applicazione e' stata creata con successo // @cmember:(INTERNAL) Indica se l'applicazione e' stata creata con successo
bool _create_ok; bool _create_ok;
@ -122,6 +125,9 @@ public:
// @cmember Ritorna l'identificatore della classe // @cmember Ritorna l'identificatore della classe
virtual word class_id() const virtual word class_id() const
{ return CLASS_APPLICATION; } { 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 // @cmember Controlla se si tratta di una applicazione valida
virtual bool ok() const virtual bool ok() const
{ return _create_ok; } { return _create_ok; }
@ -217,8 +223,6 @@ public:
virtual ~TSkeleton_application() { } virtual ~TSkeleton_application() { }
}; };
bool xvt_running();
TApplication& main_app(); TApplication& main_app();
#endif /* __APPLICATION_H */ #endif /* __APPLICATION_H */

View File

@ -14,7 +14,6 @@
#include <io.h> #include <io.h>
#include <share.h> #include <share.h>
#include <sys/locking.h> #include <sys/locking.h>
#include <dos.h>
#include "modaut.h" #include "modaut.h"
#endif #endif

View File

@ -449,7 +449,7 @@ bool TDongle::network_login(bool test_all_keys)
const char* server = ini.get("Dongle"); const char* server = ini.get("Dongle");
const char* guest = "******"; const char* guest = "******";
const TString16 appname = main_app().name(); 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); const bool ok = rpc_UserLogin(server, utente, "******", appname);
if (ok) if (ok)

View File

@ -586,7 +586,7 @@ bool TGolem_window::on_key(KEY k)
if (_last_handle) if (_last_handle)
{ {
if (IsWindow(HWND(_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_handle = NULL;
} }
_last_file = file; _last_file = file;
@ -602,14 +602,14 @@ bool TGolem_window::on_key(KEY k)
{ {
if (ext == good_ext[i]) if (ext == good_ext[i])
{ {
GetSystemDirectory(cmd.get_buffer(), cmd.size()); ::GetSystemDirectory(cmd.get_buffer(), cmd.size());
cmd.add("viewers"); cmd.add("viewers");
cmd.add("quikview.exe"); cmd.add("quikview.exe");
break; break;
} }
} }
if (!cmd.exist()) 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()) if (cmd.not_empty())
{ {
cmd << ' ' << file; cmd << ' ' << file;

View File

@ -87,10 +87,11 @@ int TSystemtempfile::load(
if (f.paragraph("Header")) if (f.paragraph("Header"))
{ {
f.equal(); f.equal();
const long level = atol(f.line()); const unsigned int level = atoi(f.line());
if (level > get_std_level()) 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.", 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); //lcf = getlcf(level);
nflds = 0; nflds = 0;
TToken_string s2(f.line()); TToken_string s2(f.line());

View File

@ -1,4 +1,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <diction.h>
#include <share.h> #include <share.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -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 HIDDEN const char * translate_key(const char* key) // Traduce l'espressione chiave di CodeBase
{ {
// Trasforma l'espressione // Trasforma l'espressione
static TToken_string t; TToken_string t = key;
t = key;
TToken_string k(t.get(0),'+'); TToken_string k(t.get(0),'+');
TToken_string range("",','); TToken_string range("",',');
TString ws; 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.rtrim(1); // Toglie il + in piu'
t.add(is_dup ? "X" : " "); 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) 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; TString_array paralist;
conv.list_paragraphs(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); paragraph.format("%06ld", l);
if (paralist.find(paragraph) < 0) if (paralist.find(paragraph) < 0)
@ -1930,7 +1934,7 @@ bool TSystemisamfile::getlcf(
TString_array paralist; TString_array paralist;
conv.list_paragraphs(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); paragraph.format("%06ld", l);
if (paralist.find(paragraph) < 0) if (paralist.find(paragraph) < 0)
@ -2383,10 +2387,13 @@ int TSystemisamfile::load(
key.trim(); key.trim();
if (key == "Version") 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()) 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); lcf = getlcf(level);
} else } else
if (key == "File") if (key == "File")

View File

@ -57,7 +57,7 @@ TPrefix& prefix()
// @func Distrugge l'oggett <c TPrefix> in memoria // @func Distrugge l'oggett <c TPrefix> in memoria
void prefix_destroy() void prefix_destroy()
{ {
if (_prefhndl) if (_prefhndl != NULL)
{ {
delete _prefhndl; delete _prefhndl;
_prefhndl = NULL; _prefhndl = NULL;
@ -858,7 +858,7 @@ TFirm::TFirm(long code)
// TPrefix // TPrefix
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TPrefix::TPrefix() : _filelevel(0), _items(0), _firm(NULL) TPrefix::TPrefix() : _filelevel(0), _stdlevel(0), _items(0), _firm(NULL)
{ {
_prefix = "."; _prefix = ".";
CGetPref(); CGetPref();
@ -872,6 +872,10 @@ TPrefix::TPrefix() : _filelevel(0), _items(0), _firm(NULL)
set_codditta(0L, TRUE); set_codditta(0L, TRUE);
DB_init(); DB_init();
set(""); // Dati standard
_stdlevel = filelevel();
set("DEF"); // Ditta corrente
} }
TPrefix::~TPrefix() TPrefix::~TPrefix()

View File

@ -102,7 +102,7 @@ class TPrefix : public TObject
TString _prefix; TString _prefix;
// @cmember:(INTERNAL) Livello degli archivi // @cmember:(INTERNAL) Livello degli archivi
long _filelevel; unsigned int _filelevel, _stdlevel;
// @cmember:(INTERNAL) Numero di files esitenti // @cmember:(INTERNAL) Numero di files esitenti
int _items; int _items;
@ -142,8 +142,12 @@ public:
const char* name() const const char* name() const
{ return _prefix;} { return _prefix;}
// @cmember Ritorna il livello degli archivi // @cmember Ritorna il livello degli archivi
long filelevel() const unsigned int filelevel() const
{return _filelevel;} {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 // @cmember Ritorna il numero di archivi
int items() const int items() const

View File

@ -526,12 +526,12 @@ TEdit_field& TRelation_application::get_search_field() const
{ {
short id = _search_id; short id = _search_id;
if (id <= 0) if (id <= 0 || !_mask->field(id).active())
{ {
for (int i = _mask->fields()-1; i >= 0; i--) for (int i = _mask->fields()-1; i >= 0; i--)
{ {
const TMask_field& f = _mask->fld(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(); id = f.dlg();
break; break;

View File

@ -4,18 +4,6 @@
#include <dongle.h> #include <dongle.h>
#include <prefix.h> #include <prefix.h>
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 // @doc INTERNAL
// @func Ritorna il numero di serie della chiave // @func Ritorna il numero di serie della chiave
@ -38,7 +26,7 @@ bool test_assistance_year()
if (get_serial_number() > 0) if (get_serial_number() > 0)
{ {
const int new_year = dongle().year_assist(); 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; dongle_year = new_year;
} }
@ -57,11 +45,7 @@ bool test_assistance_year()
// @func Inizilizza le variabili globali // @func Inizilizza le variabili globali
void init_global_vars() void init_global_vars()
{ {
TPrefix& pref = prefix_init(); prefix_init();
pref.set(""); // Dati standard
_stdlevel = pref.filelevel();
pref.set("DEF"); // Ditta corrente
} }
// @doc INTERNAL // @doc INTERNAL

View File

@ -62,8 +62,6 @@ typedef unsigned short KEY;
int get_serial_number(); int get_serial_number();
bool test_assistance_year(); bool test_assistance_year();
long get_std_level();
void set_std_level(const long l);
void init_global_vars(); void init_global_vars();
void free_global_vars(); void free_global_vars();