Aggiunta documentazione in linea
git-svn-id: svn://10.65.10.50/trunk@1511 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5b330aea2c
commit
47c01f7b0c
@ -12,7 +12,7 @@
|
|||||||
// @base public | TObject
|
// @base public | TObject
|
||||||
class THash_object : public TObject
|
class THash_object : public TObject
|
||||||
{
|
{
|
||||||
// @cfriend TAssoc_array
|
// @friend class TAssoc_array
|
||||||
friend class TAssoc_array;
|
friend class TAssoc_array;
|
||||||
|
|
||||||
// @access Private Member
|
// @access Private Member
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#define BLOCKLEN 512
|
#define BLOCKLEN 512
|
||||||
#define INVFLD 255
|
#define INVFLD 255
|
||||||
|
|
||||||
|
// @doc EXTERNAL
|
||||||
|
|
||||||
HIDDEN char _files_tmp_string[128];
|
HIDDEN char _files_tmp_string[128];
|
||||||
|
|
||||||
TFile::TFile (int lenrec, int base)
|
TFile::TFile (int lenrec, int base)
|
||||||
@ -38,8 +40,11 @@ TFile::~TFile ()
|
|||||||
delete _file;
|
delete _file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFile::open (const char *name, TFilelock lockmode)
|
// @mfunc Apre il file specificato
|
||||||
|
void TFile::open (
|
||||||
|
const char *name, // @parm Nome del file da aprire
|
||||||
|
TFilelock lockmode) // @parm Tipo di lock da attivare durante l'apertura del file
|
||||||
|
// (default _manulock)
|
||||||
{
|
{
|
||||||
COpen (_file, (char *) name, _len, _base, lockmode);
|
COpen (_file, (char *) name, _len, _base, lockmode);
|
||||||
}
|
}
|
||||||
@ -51,7 +56,13 @@ bool TFile::verify (const char *name)
|
|||||||
return _file->IOR == NOERR;
|
return _file->IOR == NOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFile::create (const char *name, TRecnotype nrecord)
|
// @mfunc Crea il file specificato
|
||||||
|
void TFile::create (
|
||||||
|
const char *name, // @parm Nome del file da creare
|
||||||
|
TRecnotype nrecord) // @parm Numero di recird che deve avere il file al momento
|
||||||
|
// della creazione (default 0)
|
||||||
|
|
||||||
|
// @comm Il file creato avra' dimensioni sufficienti a contenere <p nrecord> record
|
||||||
|
|
||||||
{
|
{
|
||||||
CCreate (_file, (char *) name, _len, _base, (nrecord * _len) / BLOCKLEN + 1);
|
CCreate (_file, (char *) name, _len, _base, (nrecord * _len) / BLOCKLEN + 1);
|
||||||
@ -75,7 +86,11 @@ void TFile::unlink (const char *name)
|
|||||||
CDelete (_file, (char *) name);
|
CDelete (_file, (char *) name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFile::read (char *record, TRecnotype recnum, TReclock lock)
|
// @mfunc Legge un record dal file
|
||||||
|
void TFile::read (
|
||||||
|
char *record, // @parm Record letto
|
||||||
|
TRecnotype recnum, // @parm Numero del record da leggere
|
||||||
|
TReclock lock) // @parm Tipo di blocco da attivare durante la letture (default _nolock)
|
||||||
|
|
||||||
{
|
{
|
||||||
_file->LenRec = _len;
|
_file->LenRec = _len;
|
||||||
@ -83,7 +98,11 @@ void TFile::read (char *record, TRecnotype recnum, TReclock lock)
|
|||||||
CRead (_file, record, recnum, lock);
|
CRead (_file, record, recnum, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFile::write (char *record, TRecnotype recnum, TReclock lock)
|
// @mfunc Scrive un record sul file
|
||||||
|
void TFile::write (
|
||||||
|
char *record, // @parm Record da scrivere
|
||||||
|
TRecnotype recnum, // @parm Numero del record da scrivere
|
||||||
|
TReclock lock) // @parm Tipo di blocco da attivare durante la letture (default _nolock)
|
||||||
|
|
||||||
{
|
{
|
||||||
_file->LenRec = _len;
|
_file->LenRec = _len;
|
||||||
@ -189,7 +208,12 @@ void TDir::set (const char *name, const RecNoType eod, const RecNoType flag, con
|
|||||||
strncpy (_dir->FCalc, calc, sizeof (_dir->FCalc));
|
strncpy (_dir->FCalc, calc, sizeof (_dir->FCalc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDir::get (int nfile, TReclock lock, TDirtype dirtype, TDirop op)
|
// @mfunc Aggiorna l'oggetto TDir con i parametri del file
|
||||||
|
void TDir::get (
|
||||||
|
int nfile, // @parm Numero del file con cui aggiornare l'oggetto
|
||||||
|
TReclock lock, // @parm Tipo di blocco (default _nolock)
|
||||||
|
TDirtype dirtype, // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||||
|
TDirop op) // @parm Tipo di operazioni effettuabili sul file (default _nordirop)
|
||||||
|
|
||||||
{
|
{
|
||||||
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||||
@ -202,7 +226,11 @@ void TDir::get (int nfile, TReclock lock, TDirtype dirtype, TDirop op)
|
|||||||
_com = _dir->SysName[0] != '$';
|
_com = _dir->SysName[0] != '$';
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDir::put (int nfile, TDirtype dirtype, TDirop op)
|
// @mfunc Aggiorna il file indicato con i parametri passati
|
||||||
|
void TDir::put (
|
||||||
|
int nfile, // @parm Numero del file da aggiornare
|
||||||
|
TDirtype dirtype, // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||||
|
TDirop op) // @parm Tipo di operazioni effettuabili sul file (default _nordirop)
|
||||||
{
|
{
|
||||||
CHECKD(nfile > 0, "Bad file number ", nfile);
|
CHECKD(nfile > 0, "Bad file number ", nfile);
|
||||||
|
|
||||||
@ -266,7 +294,10 @@ TTrec & TTrec::operator = (const TTrec & b)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrec::get (int nfile, TDirtype dirtype)
|
// @mfunc Assegna all'oggetto TTrec il tracciato record del file indicato
|
||||||
|
void TTrec::get (
|
||||||
|
int nfile, // @parm Numero del file da cui estrarre il tracciato record
|
||||||
|
TDirtype dirtype) // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||||
|
|
||||||
{
|
{
|
||||||
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||||
@ -275,7 +306,10 @@ void TTrec::get (int nfile, TDirtype dirtype)
|
|||||||
_num = nfile;
|
_num = nfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrec::put (int nfile, TDirtype dirtype)
|
// @mfunc Setta il file indicato con il tracciato record dell'oggetto
|
||||||
|
void TTrec::put (
|
||||||
|
int nfile, // @parm Numero del file di cui settare il tracciato record
|
||||||
|
TDirtype dirtype) // @parm Direttorio nella quale e' contenuto il file (default _nordir)
|
||||||
|
|
||||||
{
|
{
|
||||||
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||||
|
190
include/files.h
190
include/files.h
@ -17,125 +17,209 @@
|
|||||||
#define DESCTAB "TabDescr"
|
#define DESCTAB "TabDescr"
|
||||||
#define DESCDIR "recdesc"
|
#define DESCDIR "recdesc"
|
||||||
|
|
||||||
// @C
|
// @doc EXTERNAL
|
||||||
// Classe TFile : public TObject
|
|
||||||
//
|
|
||||||
// Il file. I suoi metodi comprendono tutte le procedure per l'accesso
|
|
||||||
// fisico di basso livello ai file.
|
|
||||||
//
|
|
||||||
// @END
|
|
||||||
|
|
||||||
|
// @class TFile | Classe per la definizione dei metodi che comprendono tutte le
|
||||||
|
// procedure per l'accesso fisico di basso livello ai file.
|
||||||
|
//
|
||||||
|
// @base public | TObject
|
||||||
class TFile : public TObject
|
class TFile : public TObject
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @access Private Member
|
||||||
SecDef* _file;
|
|
||||||
int _len;
|
// @cmember Descrittore del file
|
||||||
int _base;
|
SecDef* _file;
|
||||||
|
// @cmember Lunghezza del record
|
||||||
|
int _len;
|
||||||
|
// @cmember Offset iniziale del file in settori
|
||||||
|
int _base;
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @cmember Apre il file specificato
|
||||||
void open(const char* name, TFilelock lockmode = _manulock);
|
void open(const char* name, TFilelock lockmode = _manulock);
|
||||||
|
// @cmember Controlla se il file specificato e' corretto (TRUE se non vi sono errori)
|
||||||
bool verify(const char* name);
|
bool verify(const char* name);
|
||||||
|
// @cmember Crea il file specificato
|
||||||
void create(const char* name, TRecnotype nrecord = 10);
|
void create(const char* name, TRecnotype nrecord = 10);
|
||||||
|
// @cmember Cambia le dimensioni di un file
|
||||||
void chsize(const char* name, TRecnotype nrecord);
|
void chsize(const char* name, TRecnotype nrecord);
|
||||||
|
// @cmember Chiude il file
|
||||||
void close();
|
void close();
|
||||||
|
// @cmember Elimina il file specificato
|
||||||
void unlink(const char* name);
|
void unlink(const char* name);
|
||||||
|
// @cmember Legge un record dal file
|
||||||
void read(char* record, TRecnotype recnum, TReclock lock = _nolock);
|
void read(char* record, TRecnotype recnum, TReclock lock = _nolock);
|
||||||
|
// @cmember Scrive un record sul file
|
||||||
void write(char* record, TRecnotype recnum, TReclock lock = _nolock);
|
void write(char* record, TRecnotype recnum, TReclock lock = _nolock);
|
||||||
|
// @cmember Ritorna lo stato di errore del file
|
||||||
int status() const ;
|
int status() const ;
|
||||||
int& base() { return _base; }
|
// @cmember Ritorna l'offset di base
|
||||||
int& len() { return _len; }
|
int& base()
|
||||||
bool ok() const { return status() == NOERR; }
|
{ return _base; }
|
||||||
|
// @cmember Ritorna la lunghezza del record
|
||||||
|
int& len()
|
||||||
|
{ return _len; }
|
||||||
|
// @cmember Controlla che non vi siano errori nel file aperto (TRUE se tutto normale)
|
||||||
|
bool ok() const
|
||||||
|
{ return status() == NOERR; }
|
||||||
bool error() const { return status() != NOERR; }
|
bool error() const { return status() != NOERR; }
|
||||||
|
|
||||||
|
// @cmember Costruttore
|
||||||
TFile(int lenrec = 0, int base = 0);
|
TFile(int lenrec = 0, int base = 0);
|
||||||
|
// @cmember Distruttore
|
||||||
virtual ~TFile();
|
virtual ~TFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
// @C
|
// @class TDir | Classe per la gestione del file "dir.gen"
|
||||||
// Classe TDir : public TObject
|
|
||||||
//
|
//
|
||||||
// @END
|
// @base public | TObject
|
||||||
|
|
||||||
class TDir : public TObject
|
class TDir : public TObject
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @access Private Member
|
||||||
|
|
||||||
|
// @cmember Descrittore del file
|
||||||
FileDes* _dir;
|
FileDes* _dir;
|
||||||
|
// @cmember Numero di file presenti
|
||||||
int _num;
|
int _num;
|
||||||
|
// @cmember Appartenenza al direttorio comune (TRUE) o a quello della ditta
|
||||||
bool _com;
|
bool _com;
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @cmember Aggiorna l'oggetto TDir con i paramtri del file indicato
|
||||||
void get(int nfile, TReclock lock = _nolock, TDirtype dirtype = _nordir, TDirop op = _nordirop);
|
void get(int nfile, TReclock lock = _nolock, TDirtype dirtype = _nordir, TDirop op = _nordirop);
|
||||||
|
// @cmember Aggiorna il file indicato con i parametri passati
|
||||||
void put(int nfile, TDirtype dirtype = _nordir, TDirop op = _nordirop);
|
void put(int nfile, TDirtype dirtype = _nordir, TDirop op = _nordirop);
|
||||||
|
// @cmember Azzera i parametri del file selezionato
|
||||||
void zero();
|
void zero();
|
||||||
|
|
||||||
|
// @cmember Setta l'EOX del file
|
||||||
void set_eox(const RecNoType eox);
|
void set_eox(const RecNoType eox);
|
||||||
|
// @cmember Setta la lunghezza del file
|
||||||
void set_len(const UINT16 len);
|
void set_len(const UINT16 len);
|
||||||
|
// @cmember Setta il file con i parametri passati
|
||||||
void set (const char * name, const RecNoType eod, const RecNoType flag, const char * des, const char * calc);
|
void set (const char * name, const RecNoType eod, const RecNoType flag, const char * des, const char * calc);
|
||||||
|
|
||||||
|
// @cmember Ritorna il nome del file selezionato
|
||||||
const char* name() const;
|
const char* name() const;
|
||||||
|
// @cmember Ritorna la descrizione del file selezionato
|
||||||
const char* des() const;
|
const char* des() const;
|
||||||
const char* expr() const;
|
// @cmember Ritorna la descrizione della tabella
|
||||||
TRecnotype& eod() const;
|
|
||||||
TRecnotype& eox() const;
|
|
||||||
TRecnotype& flags() const;
|
|
||||||
word& len();
|
|
||||||
int status(TDirtype dirtype = _nordir) const ;
|
|
||||||
int num() const { return _num;}
|
|
||||||
int items(TDirtype dirtype = _nordir) const;
|
|
||||||
FileDes* filedesc() const { return _dir; }
|
|
||||||
bool is_com() const {return _com;} // valido solo se la get e' stata effettuata con _sysdirop
|
|
||||||
bool is_firm() const {return !_com;} // valido solo se la get e' stata effettuata con _sysdirop
|
|
||||||
bool is_valid() {return name()[0] > ' ' && len() > 0;}
|
|
||||||
bool is_active() const; // valido solo se prefhnd e settato a ""
|
|
||||||
|
|
||||||
static const char* tab_des(const char* tabname);
|
static const char* tab_des(const char* tabname);
|
||||||
|
// @cmember Ritorna l'espressione associata al file selezionato
|
||||||
|
const char* expr() const;
|
||||||
|
// @cmember Ritorna l'EOD del file selezioanato
|
||||||
|
TRecnotype& eod() const;
|
||||||
|
// @cmember Ritorna l'EOX del file selezionato
|
||||||
|
TRecnotype& eox() const;
|
||||||
|
// @cmember Ritorna il flag del file selezionato
|
||||||
|
TRecnotype& flags() const;
|
||||||
|
// @cmember Ritorna la lunghezza del tracciato record in bytes
|
||||||
|
word& len();
|
||||||
|
// @cmember Ritorna lo stato d'errore del file
|
||||||
|
int status(TDirtype dirtype = _nordir) const ;
|
||||||
|
// @cmember Ritorna il numero di file presenti
|
||||||
|
int num() const
|
||||||
|
{ return _num;}
|
||||||
|
int items(TDirtype dirtype = _nordir) const;
|
||||||
|
// @cmember Ritorna il descrittore del file "dir.gen"
|
||||||
|
FileDes* filedesc() const
|
||||||
|
{ return _dir; }
|
||||||
|
// @cmember Controlla se il file appartiene ai dati comuni. Valido solo se
|
||||||
|
// la get e' stata effettuata con _sysdirop
|
||||||
|
bool is_com() const
|
||||||
|
{return _com;}
|
||||||
|
// @cmember Controlla se il file appartiene alla ditta. Valido solo se
|
||||||
|
// la get e' stata effettuata con _sysdirop
|
||||||
|
bool is_firm() const
|
||||||
|
{return !_com;}
|
||||||
|
// @cmember Controlle se il file e' valido (nome esistente e dimensione
|
||||||
|
// diversa da 0)
|
||||||
|
bool is_valid()
|
||||||
|
{return name()[0] > ' ' && len() > 0;}
|
||||||
|
// @cmember Controlla se il file e' attivato dalla chiave hardware.
|
||||||
|
// Valido solo se prefhnd e settato a ""
|
||||||
|
bool is_active() const;
|
||||||
|
|
||||||
|
// @cmember Costruttore
|
||||||
TDir();
|
TDir();
|
||||||
|
// @cmember Distruttore
|
||||||
virtual ~TDir();
|
virtual ~TDir();
|
||||||
};
|
};
|
||||||
|
|
||||||
// @C
|
// @class TTrec | Classe per le gestione dei tracciati record dei file
|
||||||
// Classe TTrec : public TObject
|
//
|
||||||
//
|
// @base public | TSortable
|
||||||
// @END
|
|
||||||
|
|
||||||
class TTrec : public TSortable
|
class TTrec : public TSortable
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @access Private Member
|
||||||
|
|
||||||
|
// @cmember Descrittore del tracciato record
|
||||||
RecDes* _rec;
|
RecDes* _rec;
|
||||||
|
// @cmember Numero del file di appartenenza
|
||||||
int _num;
|
int _num;
|
||||||
|
|
||||||
|
// @access Protected Member
|
||||||
protected:
|
protected:
|
||||||
|
// @cmember Permette di comparare due oggetti (vedi classe <c TSortable>)
|
||||||
int compare(const TSortable& a) const;
|
int compare(const TSortable& a) const;
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @cmember Assegna all'oggetto TTrec il tracciato record del file indicato
|
||||||
void get(int nfile, TDirtype dirtype = _nordir);
|
void get(int nfile, TDirtype dirtype = _nordir);
|
||||||
|
// @cmember Setta il file indicato con il tracciato record dell'oggetto
|
||||||
void put(int nfile, TDirtype dirtype = _nordir);
|
void put(int nfile, TDirtype dirtype = _nordir);
|
||||||
|
// @cmember Azzera il tracciato record
|
||||||
void zero();
|
void zero();
|
||||||
|
// @cmember Costruisce i puntatori per la ricerca dei campi
|
||||||
void rehash();
|
void rehash();
|
||||||
|
// @cmember Ritorna lo stato di errore del file
|
||||||
int status(TDirtype dirtype = _nordir) const ;
|
int status(TDirtype dirtype = _nordir) const ;
|
||||||
int num() const { return _num;}
|
// @cmember Ritorna il numero del file
|
||||||
|
int num() const
|
||||||
|
{ return _num;}
|
||||||
int field(const char* fieldname) const;
|
int field(const char* fieldname) const;
|
||||||
RecDes* rec() const { return _rec;}
|
// @cmember Ritorna il descrittore del tracciato record
|
||||||
|
RecDes* rec() const
|
||||||
|
{ return _rec;}
|
||||||
|
// @cmember Assegna un oggetto TTrec
|
||||||
TTrec& operator =(const TTrec& b);
|
TTrec& operator =(const TTrec& b);
|
||||||
int fields() const { return _rec->NFields; }
|
// @cmember Ritorna il numero di campi del tracciato record
|
||||||
int keys() const { return _rec->NKeys; }
|
int fields() const
|
||||||
void set_fields(int nfields) { _rec->NFields = nfields;}
|
{ return _rec->NFields; }
|
||||||
void set_keys(int nkeys) { _rec->NKeys = nkeys;}
|
// @cmember Ritorna il numero di chiavi di ordinamento del tracciato record
|
||||||
const char* fielddef(int fld) const; // ritorna una token string
|
int keys() const
|
||||||
|
{ return _rec->NKeys; }
|
||||||
|
// @cmember Assegna il numero di campi del tracciato record
|
||||||
|
void set_fields(int nfields)
|
||||||
|
{ _rec->NFields = nfields;}
|
||||||
|
// @cmember Assegna il numero di chiavi di ordinamento del tracciato record
|
||||||
|
void set_keys(int nkeys)
|
||||||
|
{ _rec->NKeys = nkeys;}
|
||||||
|
// @cmember Ritorna una token string contenente la descrizione del campo
|
||||||
|
const char* fielddef(int fld) const;
|
||||||
|
// @cmember Ritorna una stringa contenente la chiave
|
||||||
const char* keydef(int key) const;
|
const char* keydef(int key) const;
|
||||||
int len() const { return _rec->Fd[fields() - 1].RecOff +
|
// @cmember Ritorna la lunghezza del record
|
||||||
_rec->Fd[fields() - 1].Len; }
|
int len() const
|
||||||
|
{ return _rec->Fd[fields() - 1].RecOff + _rec->Fd[fields() - 1].Len; }
|
||||||
|
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
void update_keydef(int key, const char* desc); //desc e' una token string
|
// @cmember Aggiorna la chiave. <p desc> e' una token string
|
||||||
void update_fielddef(int nfld, const char* desc); //desc e' una token string
|
void update_keydef(int key, const char* desc);
|
||||||
|
// @cmember Aggiorna il campo. <p desc> e' una token string
|
||||||
|
void update_fielddef(int nfld, const char* desc);
|
||||||
|
// @cmember Stampa il tracciato record sull'output selezionato
|
||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
|
// @cmember Legge il tracciato record da input selezionato
|
||||||
virtual void read_from(istream& in);
|
virtual void read_from(istream& in);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @cmember Costruttore
|
||||||
TTrec();
|
TTrec();
|
||||||
|
// @cmember Distruttore
|
||||||
virtual ~TTrec();
|
virtual ~TTrec();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// $Id: mailbox.cpp,v 1.14 1995-04-26 08:06:41 guy Exp $
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
|
|
||||||
@ -10,6 +8,8 @@
|
|||||||
#define DEF_MSGS_CAPACITY 50
|
#define DEF_MSGS_CAPACITY 50
|
||||||
#define MAX_TXT_LEN 200
|
#define MAX_TXT_LEN 200
|
||||||
|
|
||||||
|
// @doc EXTERNAL
|
||||||
|
|
||||||
TMessage::TMessage(const char* to, const char* sub,
|
TMessage::TMessage(const char* to, const char* sub,
|
||||||
const char* text, const char* from)
|
const char* text, const char* from)
|
||||||
{
|
{
|
||||||
@ -31,8 +31,6 @@ void TMessage::send()
|
|||||||
|
|
||||||
|
|
||||||
void TMailbox::reread()
|
void TMailbox::reread()
|
||||||
// reads new messages from mailbox;
|
|
||||||
// create messages, put messages in _msgs array in cronological order
|
|
||||||
{
|
{
|
||||||
char buf[MAX_TXT_LEN];
|
char buf[MAX_TXT_LEN];
|
||||||
|
|
||||||
@ -81,19 +79,28 @@ TMessage* TMailbox::next_read()
|
|||||||
return this->get(_cnt++);
|
return this->get(_cnt++);
|
||||||
}
|
}
|
||||||
|
|
||||||
TMessage* TMailbox::next(bool read)
|
// @mfunc Ritorna il prossimo messaggio
|
||||||
|
TMessage* TMailbox::next(
|
||||||
|
bool read) // @parm Indica se il messaggio deve essere tra quelli
|
||||||
|
// letti (default FALSE)
|
||||||
|
|
||||||
|
// @comm Se <p read> e' TRUE ritorna il prossimo messaggio non letto
|
||||||
{
|
{
|
||||||
// next message, default unread
|
|
||||||
TMessage* m = read ? next_read() : next_unread();
|
TMessage* m = read ? next_read() : next_unread();
|
||||||
if (m)
|
if (m)
|
||||||
m->setread();
|
m->setread();
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @mfunc Ritorna il prossimo messaggio con lo stesso oggetto
|
||||||
|
TMessage* TMailbox::next_s(
|
||||||
|
char* s, // @parm Oggetto del messaggio da ritornare
|
||||||
|
bool read) // @parm Indica se il messaggio deve essere tra quelli
|
||||||
|
// letti (default FALSE)
|
||||||
|
|
||||||
TMessage* TMailbox::next_s(char* s, bool read)
|
// @comm Ricerca tra i messaggi quello che possiede l'oggetto passato in <p s>.
|
||||||
|
// Se <p read> ritorna il primo messaggio non letto.
|
||||||
{
|
{
|
||||||
// next message with matching subject
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (_cnt == _msgs.items())
|
if (_cnt == _msgs.items())
|
||||||
@ -113,9 +120,16 @@ TMessage* TMailbox::next_s(char* s, bool read)
|
|||||||
return this->get(_cnt);
|
return this->get(_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TMessage* TMailbox::next_f(char* f, bool read)
|
|
||||||
|
// @mfunc Ritorna il prossimo messaggio con lo stesso mandante
|
||||||
|
TMessage* TMailbox::next_f(
|
||||||
|
char* f, // @parm Oggetto del messaggio da ritornare
|
||||||
|
bool read) // @parm Indica se il messaggio deve essere tra quelli
|
||||||
|
// letti (default FALSE)
|
||||||
|
|
||||||
|
// @comm Ricerca tra i messaggi quello che possiede il mandate passato in <p f>.
|
||||||
|
// Se <p read> ritorna il primo messaggio non letto.
|
||||||
{
|
{
|
||||||
// next message with matching sender
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (_cnt == _msgs.items())
|
if (_cnt == _msgs.items())
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
// $Id: mailbox.h,v 1.5 1995-01-16 15:10:24 guy Exp $
|
|
||||||
|
|
||||||
/* si', trattasi di -*-c++-*- */
|
|
||||||
// Mailbox.h
|
|
||||||
// Message passing between applications and command lines
|
|
||||||
|
|
||||||
#ifndef __MAILBOX_H
|
#ifndef __MAILBOX_H
|
||||||
#define __MAILBOX_H
|
#define __MAILBOX_H
|
||||||
|
|
||||||
@ -14,82 +8,147 @@
|
|||||||
// TMessage flags
|
// TMessage flags
|
||||||
#define MSG_READ (0x01)
|
#define MSG_READ (0x01)
|
||||||
|
|
||||||
|
// @doc EXTERNAL
|
||||||
|
|
||||||
|
// @class TMessagge | Classe per il passaggio dei messeggi base tra applicazioni
|
||||||
|
// e linea di comando
|
||||||
|
//
|
||||||
|
// @base public | TObject
|
||||||
class TMessage : public TObject
|
class TMessage : public TObject
|
||||||
// basic message
|
|
||||||
{
|
{
|
||||||
TString16 _from;
|
// @access Private Member
|
||||||
TString16 _to;
|
|
||||||
TString80 _subject;
|
|
||||||
TString _text;
|
|
||||||
byte _flags;
|
|
||||||
int _number;
|
|
||||||
|
|
||||||
friend class TMailbox;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void setread() { _flags |= MSG_READ; }
|
|
||||||
bool isread() { return _flags & MSG_READ; }
|
|
||||||
int number(int n = -1) { return (n == -1 ? _number : (_number = n)); }
|
|
||||||
|
|
||||||
public:
|
|
||||||
const TString& from() const { return _from; }
|
|
||||||
const TString& to() const { return _to; }
|
|
||||||
const TString& subject() const { return _subject; }
|
|
||||||
const TString& body() const { return _text; }
|
|
||||||
|
|
||||||
const TString& from(const char* f) { return _from = f; }
|
|
||||||
const TString& to(const char* t) { return _to = t; }
|
|
||||||
const TString& subject(const char* s) { return _subject = s; }
|
|
||||||
const TString& body(const char* b) { return _text = b; }
|
|
||||||
|
|
||||||
|
// @friend class TMailbox
|
||||||
|
friend class TMailbox;
|
||||||
|
|
||||||
|
// @cmember Applicazione che lancia il messaggio
|
||||||
|
TString16 _from;
|
||||||
|
// @cmember Applicazione che deve ricevere il messaggio
|
||||||
|
TString16 _to;
|
||||||
|
// @cmember Oggetto del messaggio
|
||||||
|
TString80 _subject;
|
||||||
|
// @cmember Testo del messaggio
|
||||||
|
TString _text;
|
||||||
|
// @cmember Flag di controllo del messaggio
|
||||||
|
byte _flags;
|
||||||
|
// #cmember Numero (non si sa cosa faccia)
|
||||||
|
// int _number;
|
||||||
|
|
||||||
|
// @access Protected Member
|
||||||
|
protected:
|
||||||
|
// @cmember Indica che il messaggio e' stato letto
|
||||||
|
void setread()
|
||||||
|
{ _flags |= MSG_READ; }
|
||||||
|
// @cmember Controlla se il messaggio e' stato letto (TRUE se e' stato letto)
|
||||||
|
bool isread()
|
||||||
|
{ return _flags & MSG_READ; }
|
||||||
|
// #cmember Setta il numero. Se viene passato -1 ritorna il valore attuale
|
||||||
|
//int number(int n = -1)
|
||||||
|
//{ return (n == -1 ? _number : (_number = n)); }
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
|
public:
|
||||||
|
// @cmember Ritorna il nome dell'applicazione che lancia il messaggio
|
||||||
|
const TString& from() const
|
||||||
|
{ return _from; }
|
||||||
|
// @cmember Ritorna il nome dell'applicazione che deve ricevere il messaggio
|
||||||
|
const TString& to() const
|
||||||
|
{ return _to; }
|
||||||
|
// @cmember Ritorna l'oggetto del messaggio
|
||||||
|
const TString& subject() const
|
||||||
|
{ return _subject; }
|
||||||
|
// @cmember Ritorna il testo del messaggio
|
||||||
|
const TString& body() const
|
||||||
|
{ return _text; }
|
||||||
|
|
||||||
|
// @cmember Assegna il nome dell'applicazione che lancia il messaggio
|
||||||
|
const TString& from(const char* f)
|
||||||
|
{ return _from = f; }
|
||||||
|
// @cmember Assegna il nome dell'applicazione che deve ricevere il messaggio
|
||||||
|
const TString& to(const char* t)
|
||||||
|
{ return _to = t; }
|
||||||
|
// @cmember Assegna l'oggetto del messaggio
|
||||||
|
const TString& subject(const char* s)
|
||||||
|
{ return _subject = s; }
|
||||||
|
// @cmember Assegna il testo del messaggio
|
||||||
|
const TString& body(const char* b)
|
||||||
|
{ return _text = b; }
|
||||||
|
|
||||||
|
// @cmember Manda il messaggio
|
||||||
void send();
|
void send();
|
||||||
|
|
||||||
TMessage(const char* to, const char* sub, const char* text,
|
// @cmember Costruttore
|
||||||
const char* from = NULL);
|
TMessage(const char* to, const char* sub, const char* text, const char* from = NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// @class TMailbox | Classe per controllare i messaggi ricevuti da una applicazione
|
||||||
|
//
|
||||||
|
// @base public | TObject
|
||||||
class TMailbox : public TObject
|
class TMailbox : public TObject
|
||||||
{
|
{
|
||||||
TFilename _path;
|
// @access Private Member
|
||||||
TArray _msgs;
|
|
||||||
int _lastread, n_new;
|
|
||||||
long _lastpos;
|
|
||||||
int _cnt;
|
|
||||||
|
|
||||||
|
// @cmember Nome del file che contiene i messaggi
|
||||||
|
TFilename _path;
|
||||||
|
// @cmember Array di messaggi ricevuti
|
||||||
|
TArray _msgs;
|
||||||
|
// @cmember Numero dell'ultimo messaggio letto
|
||||||
|
int _lastread;
|
||||||
|
// @cmember Numero di messaggi in attesa di lettura
|
||||||
|
int n_new;
|
||||||
|
// @cmember Posizione nel file dell'ultimo messaggio letto
|
||||||
|
long _lastpos;
|
||||||
|
// @cmember Indice dei messaggi letti e non letti
|
||||||
|
int _cnt;
|
||||||
|
|
||||||
|
// @access Protected Member
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// @cmember Legge un nuovo messaggio dalla mailbox. Crea messaggi, mette i
|
||||||
|
// messaggi nell'array in ordine cronologico
|
||||||
void reread();
|
void reread();
|
||||||
|
// @cmember Ritorna il prossimo messaggio letto (NULL se non e' stato letto)
|
||||||
TMessage* next_read();
|
TMessage* next_read();
|
||||||
|
// @cmember Ritorna il prossimo messaggio non letto
|
||||||
TMessage* next_unread();
|
TMessage* next_unread();
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int check() // return
|
// @cmember Ritorna il numero di messaggi in attesa
|
||||||
{ reread(); return n_new; } // n. of messages waiting
|
int check()
|
||||||
void restart() { _cnt = 0;} // reinitialize read phase
|
{ reread(); return n_new; }
|
||||||
int items() // n. of read+unread messages
|
// @cmember Reinizalizza la fase di lettura
|
||||||
{ return _msgs.items(); } // in mailbox
|
void restart()
|
||||||
TMessage* next(bool read = FALSE); // get next message; if
|
{ _cnt = 0;}
|
||||||
// TRUE passed, get read mess. too
|
// @cmember Ritorna in numero di messaggi, letti e da leggere, presenti nella mailbox
|
||||||
TMessage* next_s(char* s, bool read = FALSE); // next w/ matching subject
|
int items()
|
||||||
TMessage* next_f(char* f, bool read = FALSE); // next w/ matching sender
|
{ return _msgs.items(); }
|
||||||
void send(TMessage& m); // send a message
|
// @cmember Ritorna il prossimo messaggio
|
||||||
void sendcmd(int argc, char* argv[],
|
TMessage* next(bool read = FALSE);
|
||||||
char* to); // transform commandline args
|
// @cmember Ritorna il prossimo messaggio con lo stesso oggetto
|
||||||
// in mail messages
|
TMessage* next_s(char* s, bool read = FALSE);
|
||||||
// NOT IMPLEMENTED
|
// @cmember Ritorna il prossimo messaggio con lo stesso mandante
|
||||||
char* readcmd(char* to = NULL); // transform mailbox in
|
TMessage* next_f(char* f, bool read = FALSE);
|
||||||
// cmdline parms for calling
|
// @cmember Manda un messaggio
|
||||||
// non_compliant applications
|
void send(TMessage& m);
|
||||||
// NOT IMPLEMENTED
|
// @cmember Trasforma gli argomenti della command line in messaggi mail (NON IMPLEMENTATA)
|
||||||
TMessage* get(int n) // nth message
|
void sendcmd(int argc, char* argv[],char* to);
|
||||||
|
// @cmember Trasforma una mailbox in parametri per la command line per la
|
||||||
|
// chaimata di applicazioni non compilanti (NON IMPLEMENTATA)
|
||||||
|
char* readcmd(char* to = NULL);
|
||||||
|
// @cmember Ritorna l'<p n>-esimo messaggio
|
||||||
|
TMessage* get(int n)
|
||||||
{ return (TMessage*)_msgs.objptr(n); }
|
{ return (TMessage*)_msgs.objptr(n); }
|
||||||
|
|
||||||
|
// @cmember Costruttore
|
||||||
TMailbox::TMailbox(const char* appname = NULL);
|
TMailbox::TMailbox(const char* appname = NULL);
|
||||||
|
// @cmember Distruttore
|
||||||
virtual ~TMailbox();
|
virtual ~TMailbox();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// @todo Da implementare in futuro
|
||||||
|
//
|
||||||
// instead of using commandline args directly, user posts
|
// instead of using commandline args directly, user posts
|
||||||
// messages to application, then calls it without arguments
|
// messages to application, then calls it without arguments
|
||||||
// If the application is called by the user with command_line
|
// If the application is called by the user with command_line
|
||||||
|
@ -150,7 +150,18 @@ HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax, TBit_array&
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TPrefix::set(const char* name, bool force, TFilelock mode)
|
// @mfunc Setta la ditta corrente
|
||||||
|
void TPrefix::set(
|
||||||
|
const char* name, // @parm Nome del direttorio dati da attivare (default NULL)
|
||||||
|
bool force, // @parm Permette di settarla anche se non esiste (default FALSE)
|
||||||
|
TFilelock mode) // @parm Permette di aprire la ditta in modo esclusico (default _manulock)
|
||||||
|
|
||||||
|
// @comm Il parametro <p name> puo' assumere i seguenti valori:
|
||||||
|
//
|
||||||
|
// @flag NULL | Chiude tutti i files
|
||||||
|
// @flag COM | Apre il direttorio con i dati comuni
|
||||||
|
// @flga DEF | Riapre la ditta indicata nel file prefix.txt
|
||||||
|
// @flag codice ditta | Apre la ditta indicata
|
||||||
{
|
{
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
{
|
{
|
||||||
@ -282,7 +293,17 @@ bool TPrefix::set_codditta(long codditta, bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* TPrefix::description(const char* cod) const
|
// @mfunc Ritorna la descrizione del file passato
|
||||||
|
const char* TPrefix::description(
|
||||||
|
const char* cod) const // @parm Nome del file di cui si vuole conoscere la descrizione
|
||||||
|
|
||||||
|
// @syntax const char* description(const char* cod);
|
||||||
|
// @syntax const char* description(int cod);
|
||||||
|
//
|
||||||
|
// @comm Il parametro <p cod> puo' indicare anche il nome di una tabella. In questo caso ne
|
||||||
|
// ritorna la descrizione.
|
||||||
|
// <nl>Passando il nome di una tabella in <p cod> si ottiene la stessa cosa della
|
||||||
|
// funzione <mf TDir::Tab_des>, ma viene cercato la descrizione nel titolo della maschera.
|
||||||
{
|
{
|
||||||
TString80 n(cod);
|
TString80 n(cod);
|
||||||
|
|
||||||
|
@ -13,42 +13,75 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @C
|
// @class TPrefix | Classe contenente le informazioni sulla ditta correntemente in uso
|
||||||
// class TPrefix : public TObject
|
//
|
||||||
// @END
|
// @base public | TObject
|
||||||
|
|
||||||
class TPrefix : public TObject
|
class TPrefix : public TObject
|
||||||
|
|
||||||
|
// @author:(INTERNAL) Alex-Guido
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @access Private Member
|
||||||
TString _prefix;
|
|
||||||
int* _dirfl;
|
// @cmember Contenuto del file "prefix.txt"
|
||||||
int* _recfl;
|
TString _prefix;
|
||||||
|
// @cmember Array di flag di apertura dei file (dir.gen)
|
||||||
|
int* _dirfl;
|
||||||
|
// @cmember Array di flag di apertura dei file (trc.gen)
|
||||||
|
int* _recfl;
|
||||||
|
// @cmember Livello degli archivi
|
||||||
long _filelevel;
|
long _filelevel;
|
||||||
|
// @cmember Numero di files esitenti
|
||||||
int _items;
|
int _items;
|
||||||
|
|
||||||
|
// @cmember Puntatore alla lista dei file (dir.gen)
|
||||||
SecDef* _fdir;
|
SecDef* _fdir;
|
||||||
|
// @cmember Puntatore alla lista dei record (trc.gen)
|
||||||
SecDef* _rdir;
|
SecDef* _rdir;
|
||||||
|
|
||||||
|
// @access Protected Member
|
||||||
|
protected:
|
||||||
|
// @cmember Verifica l'effettiva esistenza della directory <p s> sotto
|
||||||
|
// la directory dati
|
||||||
bool test(const char* s) const ;
|
bool test(const char* s) const ;
|
||||||
|
// @cmember Copia fisicamente la stringa <p _prefix> nel file "prefix.txt"
|
||||||
void put();
|
void put();
|
||||||
|
|
||||||
public:
|
// @access Public Member
|
||||||
// @FPUB
|
public:
|
||||||
|
// @cmember Setta la ditta corrente
|
||||||
void set(const char* name = NULL, bool force = FALSE, TFilelock mode = _manulock);
|
void set(const char* name = NULL, bool force = FALSE, TFilelock mode = _manulock);
|
||||||
|
// @cmember Controlla l'esistenza di un codice ditta
|
||||||
bool exist(long codditta) const;
|
bool exist(long codditta) const;
|
||||||
|
// @cmember Controlla l'esistenza di un codice ditta e che non sia in uso
|
||||||
bool test(long codditta) const;
|
bool test(long codditta) const;
|
||||||
|
// @cmember Ritorna il codice della ditta corrente
|
||||||
long get_codditta() const ;
|
long get_codditta() const ;
|
||||||
|
// @cmember Setta il codice della ditta corrente
|
||||||
bool set_codditta(long codditta, bool force = FALSE);
|
bool set_codditta(long codditta, bool force = FALSE);
|
||||||
const char* name() const { return _prefix;}
|
// @cmember Ritorna il contenuto della variabile <p _prefix>
|
||||||
long filelevel() const {return _filelevel;}
|
const char* name() const
|
||||||
|
{ return _prefix;}
|
||||||
int items() const { return _items; }
|
// @cmember Ritorna il livello degli archivi
|
||||||
|
long filelevel() const
|
||||||
|
{return _filelevel;}
|
||||||
|
|
||||||
|
// @cmember Ritorna il numero di archivi
|
||||||
|
int items() const
|
||||||
|
{ return _items; }
|
||||||
|
// @cmember Ritorna la descrizione del file passato
|
||||||
const char* description(const char* cod) const;
|
const char* description(const char* cod) const;
|
||||||
|
// @cmember Ritorna la descrizione del file passato
|
||||||
const char* description(int cod) const;
|
const char* description(int cod) const;
|
||||||
bool is_firm() const { return _prefix.len() == 6 && _prefix[5] == 'a';}
|
// @cmember Controlla che la ditta attiva sia una ditta (e non es. dati comuni)
|
||||||
bool is_com() const { return !is_firm();}
|
bool is_firm() const
|
||||||
|
{ return _prefix.len() == 6 && _prefix[5] == 'a';}
|
||||||
|
// @cmember Controlla che siano attivi i dati comuni (e non una ditta)
|
||||||
|
bool is_com() const
|
||||||
|
{ return !is_firm();}
|
||||||
|
|
||||||
|
// @cmember Costruttore
|
||||||
TPrefix();
|
TPrefix();
|
||||||
|
// @cmember Distruttore
|
||||||
virtual ~TPrefix();
|
virtual ~TPrefix();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// $Id: progind.cpp,v 1.5 1995-03-22 11:38:57 guy Exp $
|
|
||||||
|
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
|
|
||||||
|
// @doc EXTERNAL
|
||||||
|
|
||||||
const char* const CANCEL_TEXT = "Annulla";
|
const char* const CANCEL_TEXT = "Annulla";
|
||||||
const char* const TITLE_TEXT = "Attesa";
|
const char* const TITLE_TEXT = "Attesa";
|
||||||
|
|
||||||
@ -55,7 +55,14 @@ TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
|||||||
do_events();
|
do_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::set_text(const char* t)
|
// @mfunc Setta il testo della finestra
|
||||||
|
void TIndwin::set_text(
|
||||||
|
const char* t) // @parm Testo della finestra
|
||||||
|
|
||||||
|
// @comm Si puo' chiamare questa funzione per cambiare il testo, ma
|
||||||
|
// le dimensioni della finestra sono calcolate sul primo testo
|
||||||
|
// passato, quindi occorre dimensionare correttamente il primo passato
|
||||||
|
// (es. inserire degli spazi) se se ne prevede uno piu' lungo.
|
||||||
{
|
{
|
||||||
xvt_vobj_set_title(_text, (char*)t);
|
xvt_vobj_set_title(_text, (char*)t);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/* $Id: progind.h,v 1.4 1994-12-01 14:49:33 villa Exp $ */
|
|
||||||
|
|
||||||
/* @N
|
|
||||||
progind.h
|
|
||||||
program status and timer boxes
|
|
||||||
fv 20/8/93
|
|
||||||
works for both C and C++
|
|
||||||
@END
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#ifndef __PROGIND_H
|
#ifndef __PROGIND_H
|
||||||
#define __PROGIND_H
|
#define __PROGIND_H
|
||||||
@ -20,112 +10,135 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
// @doc EXTERNAL
|
||||||
@C
|
|
||||||
class TIndwin : public TWindow
|
|
||||||
@END
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
// @class TIndwin | Classe base per la gestione delle finestre con le barre di attesa
|
||||||
|
//
|
||||||
|
// @base public | TWindow
|
||||||
class TIndwin : public TWindow
|
class TIndwin : public TWindow
|
||||||
|
// @author:(INTERNAL) Villa
|
||||||
{
|
{
|
||||||
/* @DPRIV */
|
// @access Private Member
|
||||||
enum { IND_CANCELLED = 0x01, IND_FINISHED= 0x02 };
|
|
||||||
|
enum {
|
||||||
|
// @cmember Controlla se e' stato premuto il tasto "Annulla"
|
||||||
|
IND_CANCELLED = 0x01,
|
||||||
|
// @cmember Controlla se l'operazione e' terminata
|
||||||
|
IND_FINISHED= 0x02 };
|
||||||
|
|
||||||
WINDOW _text; // Static text
|
// @cmember Testo da inserire nella finestra
|
||||||
WINDOW _cancel; // CANCEL button
|
WINDOW _text;
|
||||||
WINDOW _bar; // Moving bar and percentage
|
// @cmember Bottone "Annulla"
|
||||||
byte _flags;
|
WINDOW _cancel;
|
||||||
/* @END */
|
// @cmember Movimento della barra e percentuale
|
||||||
|
WINDOW _bar;
|
||||||
|
// @cmember Flage che indica quali operazioni sono state effettuate
|
||||||
|
byte _flags;
|
||||||
|
|
||||||
|
// @access Protected Member
|
||||||
protected:
|
protected:
|
||||||
/* @FPROT */
|
// @cmember Massima valore da ricercare
|
||||||
|
long _max;
|
||||||
long _max; // maximum value to reach
|
// @cmember Stato corrente dell'esecuzione (settato dell'utente)
|
||||||
long _status; // current status (set by user)
|
long _status;
|
||||||
void draw_window();
|
// @cmember Ritorna il numero di linee necessarie per scrivere il testo nella finestra
|
||||||
word measure_text(TToken_string& t, word& len) const;
|
word measure_text(TToken_string& t, word& len) const;
|
||||||
|
|
||||||
|
// @cmember Gestisce gli eventi della finestra
|
||||||
virtual void handler(WINDOW w, EVENT* e);
|
virtual void handler(WINDOW w, EVENT* e);
|
||||||
|
// @cmember Aggiorna la barra di attesa (chiama update_bar)
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
|
// @cmember Aggiorna la barra di attesa
|
||||||
void update_bar();
|
void update_bar();
|
||||||
|
// @cmember Controlla se ha terminato la barra di attesa
|
||||||
KEY check_stop();
|
KEY check_stop();
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
/* @FPUB */
|
// @cmember Controlla se e' stato premuto il tasto "Annulla"
|
||||||
bool iscancelled() const { do_events(); return _flags & IND_CANCELLED; }
|
bool iscancelled() const
|
||||||
bool isfinished() const { do_events(); return _flags & IND_FINISHED; }
|
{ do_events(); return _flags & IND_CANCELLED; }
|
||||||
long status() const { do_events(); return _status; }
|
// @cmember Controlla se e' finito l'operazione
|
||||||
void cancel() { _flags |= IND_CANCELLED; do_events(); check_stop(); }
|
bool isfinished() const
|
||||||
|
{ do_events(); return _flags & IND_FINISHED; }
|
||||||
|
// @cmember Ritorna lo stato dell'operazione (quantita' dell'applicazione gia' fatta)
|
||||||
|
long status() const
|
||||||
|
{ do_events(); return _status; }
|
||||||
|
// @cmember Ferma l'operazione (chiude la finestra)
|
||||||
|
void cancel()
|
||||||
|
{ _flags |= IND_CANCELLED; do_events(); check_stop(); }
|
||||||
|
|
||||||
|
// @cmember Controlla se l'operazione puo' essere chiusa
|
||||||
virtual bool can_be_closed() const;
|
virtual bool can_be_closed() const;
|
||||||
/* @END */
|
|
||||||
|
|
||||||
/* @LONGDES
|
// @cmember Setta il testo della finestra
|
||||||
si puo' chiamare settext() per cambiare il testo, ma
|
|
||||||
le dimensioni della finestra sono calcolate sul primo
|
|
||||||
passato, quindi occorre dare spazi se se ne prevede
|
|
||||||
uno piu' lungo
|
|
||||||
@END */
|
|
||||||
void set_text(const char* t);
|
void set_text(const char* t);
|
||||||
|
|
||||||
/* FPUB */
|
// @cmember Costruttore
|
||||||
TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 16);
|
TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 16);
|
||||||
|
// @cmember Distruttore
|
||||||
virtual ~TIndwin();
|
virtual ~TIndwin();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
// @class TProgind | Classe per la gestione della barra di attesa di una applicazione
|
||||||
@C
|
//
|
||||||
class TProgind : public TIndwin
|
// @base public | TIndwin
|
||||||
@END
|
|
||||||
*/
|
|
||||||
|
|
||||||
class TProgind : public TIndwin
|
class TProgind : public TIndwin
|
||||||
|
// @author:(INTERNAL) Villa
|
||||||
{
|
{
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
/* @FPUB */
|
// @cmember Setta il valore massimo della barra d'attesa
|
||||||
void setmax(long m) { _max = m; }
|
void setmax(long m)
|
||||||
void setstatus(long l) { _status = l; update_bar(); do_events(); }
|
{ _max = m; }
|
||||||
void addstatus(long l) { setstatus(_status+l); }
|
// @cmember Setta lo stato della barra d'attesa
|
||||||
TProgind(long max, const char* txt = NULL, bool cancel = TRUE,
|
void setstatus(long l)
|
||||||
bool bar = TRUE, int div = 10);
|
{ _status = l; update_bar(); do_events(); }
|
||||||
virtual ~TProgind() {}
|
// @cmember Aggiorna la barra d'attesa aggiungendo l'incremento fatto dell'applicazione
|
||||||
|
void addstatus(long l)
|
||||||
|
{ setstatus(_status+l); }
|
||||||
|
// @cmember Costruttore
|
||||||
|
TProgind(long max, const char* txt = NULL, bool cancel = TRUE, bool bar = TRUE, int div = 10);
|
||||||
|
// @cmember Distruttore
|
||||||
|
virtual ~TProgind()
|
||||||
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
// @class TTimerind | Classe per la definizione di una barra d'attesa gestita
|
||||||
@C
|
// dal tempo e non dallo stato dell'applicazione
|
||||||
class TTimerind : public TIndwin
|
//
|
||||||
@END
|
// @base public | TIndwin
|
||||||
*/
|
|
||||||
|
|
||||||
class TTimerind : public TIndwin
|
class TTimerind : public TIndwin
|
||||||
|
// @author:(INTERNAL) Villa
|
||||||
{
|
{
|
||||||
/* @DPRIV */
|
// @access Private Member
|
||||||
|
|
||||||
|
// @cmember Intervallo di tempo
|
||||||
int _interval;
|
int _interval;
|
||||||
|
// @cmember Indice di tempo
|
||||||
static long _timer_id;
|
static long _timer_id;
|
||||||
|
|
||||||
|
// @access Protected Member
|
||||||
protected:
|
protected:
|
||||||
/* @FPROT */
|
// @cmember Gestisce gli eventi della finestra
|
||||||
virtual void handler(WINDOW w, EVENT* e);
|
virtual void handler(WINDOW w, EVENT* e);
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
/* @FPUB */
|
// @cmember Costruttore
|
||||||
TTimerind(long msec, const char* txt = NULL, bool cancel = TRUE,
|
TTimerind(long msec, const char* txt = NULL, bool cancel = TRUE, bool bar = TRUE, int div = 10, int interval = 1000);
|
||||||
bool bar = TRUE, int div = 10, int interval = 1000);
|
// @cmember Distruttore
|
||||||
virtual ~TTimerind();
|
virtual ~TTimerind();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* @DPRIV */
|
|
||||||
/* extern TIndwin* __indwin__p; */
|
|
||||||
|
|
||||||
/* @FPUB */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
// Non commentate perche' destinate a sparire
|
||||||
void progind_create(long, char*, bool, bool, int);
|
void progind_create(long, char*, bool, bool, int);
|
||||||
void progind_set_status(long);
|
void progind_set_status(long);
|
||||||
void progind_cancel();
|
void progind_cancel();
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include <scanner.h>
|
#include <scanner.h>
|
||||||
|
|
||||||
|
//@doc EXTERNAL
|
||||||
|
|
||||||
HIDDEN const char* strlwr (const char* str)
|
HIDDEN const char* strlwr (const char* str)
|
||||||
{
|
{
|
||||||
for (char* s = __tmp_string; *str; s++, str++) *s = tolower(*str);
|
for (char* s = __tmp_string; *str; s++, str++) *s = tolower(*str);
|
||||||
@ -46,7 +48,9 @@ const TString& TScanner::pop()
|
|||||||
return _token;
|
return _token;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString& TScanner::line(char eol)
|
// @mfunc Ritorna la linea letta dal file
|
||||||
|
TString& TScanner::line(
|
||||||
|
char eol) //@parm Carattere fino al quale leggere la riga (default EOL)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -13,35 +13,71 @@
|
|||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @C
|
// @doc EXTERNAL
|
||||||
|
|
||||||
|
// @class TScanner | Classe per le lettura e la traduzione dei file
|
||||||
|
//
|
||||||
|
// @base private | ifstream
|
||||||
class TScanner : private ifstream
|
class TScanner : private ifstream
|
||||||
|
// @author:(INTERNAL) Guido
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @access Private Member
|
||||||
TString _token, _key, _buffer;
|
// @cmember Prossimo teoken
|
||||||
|
TString _token;
|
||||||
|
// @cmember Chiave del token (prime due lettere)
|
||||||
|
TString _key;
|
||||||
|
// @cmember Buffer utilizzato per la lettura della riga da file
|
||||||
|
TString _buffer;
|
||||||
|
// @cmember Indica se il token e' stato ritornato al file
|
||||||
bool _pushed;
|
bool _pushed;
|
||||||
|
// @cmember Numero della linea in corso di lettura
|
||||||
word _line;
|
word _line;
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @cmember Costruttore
|
||||||
TScanner(const char* filename);
|
TScanner(const char* filename);
|
||||||
~TScanner() {}
|
// @cmember Distruttore
|
||||||
|
~TScanner()
|
||||||
|
{}
|
||||||
|
// @cmember Legge il token dal file e lo ritorna
|
||||||
const TString& pop();
|
const TString& pop();
|
||||||
const TString& key() const { return _key; }
|
// @cmember Ritorna la chiave del token attivo
|
||||||
const TString& popkey() { pop(); return key(); }
|
const TString& key() const
|
||||||
|
{ return _key; }
|
||||||
|
// @cmember Legge il token dal file e ne ritorna la chiave
|
||||||
|
const TString& popkey()
|
||||||
|
{ pop(); return key(); }
|
||||||
|
// @cmember Legge una stringa (la stringa deve essere tra apici) dal file
|
||||||
const TString& string();
|
const TString& string();
|
||||||
|
// @cmember Ritorna la linea letta dal file
|
||||||
TString& line(char eol = '\n');
|
TString& line(char eol = '\n');
|
||||||
const TString& equal() { return line('='); }
|
// @cmember Ritorna il contenuto della linea fino al segno di uguale (chiama <mf TScanner::line>)
|
||||||
|
const TString& equal()
|
||||||
|
{ return line('='); }
|
||||||
|
// @cmember Legge le coordinate del campo dal file e ne setta le dimensioni
|
||||||
void rectangle(RCT& rect);
|
void rectangle(RCT& rect);
|
||||||
|
// @cmember Ritorna un intero letto dal file
|
||||||
int integer();
|
int integer();
|
||||||
|
// @cmember Ritorna un float letto dal file
|
||||||
double number();
|
double number();
|
||||||
|
// @cmember Ritorna un operando letto dal file
|
||||||
const TString& operand();
|
const TString& operand();
|
||||||
|
// @cmember Cerca il paragrafo specificato e ci si posiziona sopra
|
||||||
bool paragraph(const char* name);
|
bool paragraph(const char* name);
|
||||||
|
|
||||||
bool ok() { return good(); }
|
// @cmember Ritorno TRUE se il file non e' in nessun stato di errore
|
||||||
|
bool ok()
|
||||||
|
{ return good(); }
|
||||||
|
|
||||||
|
// @cmember Mette nel file l'ultima stringa letta o quella specificata
|
||||||
void push(const char* tok = NULL);
|
void push(const char* tok = NULL);
|
||||||
const TString& token() const { return _token; }
|
// @cmember Ritorna il token letto
|
||||||
word linenum() { return _line; }
|
const TString& token() const
|
||||||
|
{ return _token; }
|
||||||
|
// @cmember Ritorna il numero di linea corrente
|
||||||
|
word linenum()
|
||||||
|
{ return _line; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,19 @@ void TSort::reset(int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TSort::addsortkey(int pos, int len, char direction)
|
// @doc EXTERNAL
|
||||||
|
|
||||||
|
// @mfunc Inizializza una chiave di ordinamento per il sort
|
||||||
|
void TSort::addsortkey(
|
||||||
|
int pos, // @parm Posizione di inizio
|
||||||
|
int len, // @parm Lunghezza della chiave
|
||||||
|
char direction) // @parm Direzione di ordinamento ('a'= ascendente, 'd'=discendente)
|
||||||
|
// @parm TRecfield& | f | Campo di file da utilizzare come criterio di ordinamento
|
||||||
|
|
||||||
|
// @syntax addsortkey(int pos, int len, char direction = 'a');
|
||||||
|
// @syntax addsortkey(TRecfield& f, char direction = 'a');
|
||||||
|
|
||||||
|
// @comm Nel secondo caso viene ordinato il sort utilizzando il campo di un file
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK(pos >= 0 && pos+len <= _sortvar->rc_len, "Invalid sort key");
|
CHECK(pos >= 0 && pos+len <= _sortvar->rc_len, "Invalid sort key");
|
||||||
|
@ -2,48 +2,56 @@
|
|||||||
#define __SORT_H
|
#define __SORT_H
|
||||||
|
|
||||||
#ifndef __OBJECT_H
|
#ifndef __OBJECT_H
|
||||||
#include <object.h>
|
#include <object.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __ISAM_H
|
#ifndef __ISAM_H
|
||||||
#include <isam.h>
|
#include <isam.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
// @doc EXTERNAL
|
||||||
@(SH) Header
|
|
||||||
|
|
||||||
@(C#) PUBBLICHE
|
|
||||||
|
|
||||||
@(C$) PRIVATE
|
|
||||||
@(VG#) PUBBLICHE
|
|
||||||
@(VG$) PRIVATE
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @C
|
|
||||||
// Classe TSort
|
|
||||||
// @END
|
|
||||||
|
|
||||||
|
// @class TSort | Classe per l'ordinamento di strutture o di record
|
||||||
|
//
|
||||||
|
// @base public | TObject
|
||||||
class TSort : public TObject
|
class TSort : public TObject
|
||||||
|
// @author:(INTERNAL) Alex
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @access Private Member
|
||||||
friend TRecfield;
|
|
||||||
struct s_prm* _sortvar; // Puntatore alla struttura di un sort
|
|
||||||
int nsortkey; // Indice nella tabella dei campi della chiave
|
|
||||||
public:
|
|
||||||
// @FPUB
|
|
||||||
void init(); // Chiama init_sort
|
|
||||||
void sort(const char * record); // Chiama sort (record)
|
|
||||||
void endsort(); // Chiama sort (NULL)
|
|
||||||
const char* retrieve(); // Chiama sort_op()
|
|
||||||
void stats(); // Chiama sort_stats
|
|
||||||
|
|
||||||
int length() const; // Ritorna la lunghezza del record di sort
|
// @friend TRecfield
|
||||||
void reset(int len); // Imposta la lunghezza del record di sort
|
friend TRecfield;
|
||||||
// e inizializza il sort
|
|
||||||
|
// @cmember Puntatore alla struttura di un sort
|
||||||
|
struct s_prm* _sortvar;
|
||||||
|
// @cmember Indice nella tabella dei campi della chiave
|
||||||
|
int nsortkey;
|
||||||
|
|
||||||
|
// @access Public Member
|
||||||
|
public:
|
||||||
|
// @cmember Inizializza il sort
|
||||||
|
void init();
|
||||||
|
// @cmember Aggiunge un record al sort
|
||||||
|
void sort(const char * record);
|
||||||
|
// @cmember Chiude il sort
|
||||||
|
void endsort();
|
||||||
|
// @cmember Restituisce il prossimo record ordinato (ultimo NULL)
|
||||||
|
const char* retrieve();
|
||||||
|
// @cmember Stampa una statistica sul sort
|
||||||
|
void stats();
|
||||||
|
|
||||||
|
// @cmember Ritorna la lunghezza del record di sort
|
||||||
|
int length() const;
|
||||||
|
// @cmember Imposta la lunghezza del record di sort e inizializza il sort
|
||||||
|
void reset(int len);
|
||||||
|
// @cmember Inizializza una chiave di ordinamento per il sort
|
||||||
void addsortkey(int pos, int len, char direction = 'a');
|
void addsortkey(int pos, int len, char direction = 'a');
|
||||||
|
// @cmember Inizializza una chiave di ordinamento per il sort usando il campo di un file
|
||||||
void addsortkey(TRecfield& f, char direction = 'a');
|
void addsortkey(TRecfield& f, char direction = 'a');
|
||||||
|
|
||||||
|
// @cmember Costruttore
|
||||||
TSort(int reclen = 0);
|
TSort(int reclen = 0);
|
||||||
|
// @cmember Distruttore
|
||||||
virtual ~TSort();
|
virtual ~TSort();
|
||||||
};
|
};
|
||||||
#endif // __SORT_H
|
#endif // __SORT_H
|
||||||
|
@ -15,14 +15,38 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
int remove(const char* path)
|
// @doc EXTERNAL
|
||||||
|
|
||||||
|
// @func Permette di rimuovere un file (chiama unlink)
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il risultato dell'operazione
|
||||||
|
//
|
||||||
|
// @flag 0 | Se l'operazione ha successo
|
||||||
|
// @flag -1 | Se l'operazione non e' riuscita. Viene inoltre settata la variabile
|
||||||
|
// <p errno> con la causa dell'insuccesso
|
||||||
|
int remove(
|
||||||
|
const char* path) // @parm Nome del file da eliminare (non valgono i caratteri jolly)
|
||||||
{ return unlink(path); }
|
{ return unlink(path); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __UTILITY_CPP
|
#define __UTILITY_CPP
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
bool fcopy(const char* orig, const char* dest, bool append)
|
// @func Permette di copiare un file
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il risultato dell'operazione:
|
||||||
|
//
|
||||||
|
// @flag TRUE | Se l'operazione e' stata effettuata con successo
|
||||||
|
// @flag FALSE | Se l'operazione non e' stata effettuata con successo
|
||||||
|
bool fcopy(
|
||||||
|
const char* orig, // @parm Nome del file di origine
|
||||||
|
const char* dest, // @parm Nome del file di destinazione
|
||||||
|
bool append) // @parm Controllo per aggiungere il contenuto del
|
||||||
|
// file <p dest> in coda al file <p orig> (default FALSE)
|
||||||
|
|
||||||
|
// @comm Nel caso vengano ravvisati degli errori durante l'operazione vengono
|
||||||
|
// creati dei box di comunicazione che indicano la causa del problema
|
||||||
{
|
{
|
||||||
const char* wflag;
|
const char* wflag;
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
@ -64,14 +88,26 @@ bool fcopy(const char* orig, const char* dest, bool append)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Controlla l'esistenza di un file
|
||||||
bool fexist(const char* file)
|
//
|
||||||
|
// @rdesc Ritrona i seguenti valori:
|
||||||
|
//
|
||||||
|
// @flag TRUE | Se il file esiste
|
||||||
|
// @flag FALSE | Se il file non esiste
|
||||||
|
bool fexist(
|
||||||
|
const char* file) // @parm Nome del file di cui contrallarne l'esistenza
|
||||||
{
|
{
|
||||||
return access(file, F_OK) == 0;
|
return access(file, F_OK) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di creare una directory
|
||||||
bool make_dir(const char* dir)
|
//
|
||||||
|
// @rdesc Ritorna il risultato dell'operazione
|
||||||
|
//
|
||||||
|
// @flag TRUE | Se l'operazione e' avvenuta con successo
|
||||||
|
// @flag FALSE | Se l'operazione non e' riuscita
|
||||||
|
bool make_dir(
|
||||||
|
const char* dir) // @parm Nome della directory da creare
|
||||||
{
|
{
|
||||||
int res =
|
int res =
|
||||||
#if XVT_OS==XVT_OS_WIN
|
#if XVT_OS==XVT_OS_WIN
|
||||||
@ -84,7 +120,17 @@ bool make_dir(const char* dir)
|
|||||||
|
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
|
|
||||||
int list_files(TToken_string& filelist)
|
// @func Setta la token string modificando la lista dei file formata con caratteri jolly
|
||||||
|
// in lista con caratteri estesi
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il numero di file che soddisfano la condizione passata (numero di elementi
|
||||||
|
// della token string)
|
||||||
|
int list_files(
|
||||||
|
TToken_string& filelist) // @parm Stringa contenente la condizione di estrazione
|
||||||
|
// della lista dei file
|
||||||
|
|
||||||
|
// @comm Per comodita' la lista desiderata vine anch'essa messa in <p filelist> in quanto e'
|
||||||
|
// gia' costruita
|
||||||
{
|
{
|
||||||
TFilename dir(filelist.get(0));
|
TFilename dir(filelist.get(0));
|
||||||
for (int i = dir.len()-1; i >= 0; i--)
|
for (int i = dir.len()-1; i >= 0; i--)
|
||||||
@ -124,9 +170,15 @@ int list_files(TToken_string& filelist)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Best function of the year
|
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
char* format(const char* fmt, ...)
|
// @func Permette di ritornare una stringa formata da parametri
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna la stringa desiderata
|
||||||
|
char* format(
|
||||||
|
const char* fmt, ...) // @parm Formato che deve essere dato alla stringa
|
||||||
|
|
||||||
|
// @comm Il funzionamento e' come la <f sprintf> del C, solo che non e' necessario passare la
|
||||||
|
// stringa di destinazione alla funzione
|
||||||
{
|
{
|
||||||
va_list pars;
|
va_list pars;
|
||||||
|
|
||||||
@ -139,8 +191,12 @@ char* format(const char* fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Converte la coppia nome-parametro in una stringa una che identifica il programma
|
// @func Converte la coppia nome-parametro in una stringa che identifica il programma
|
||||||
const char* cmd2name(const char* argv0, const char* argv1)
|
//
|
||||||
|
// @rdesc Ritorna la stringa identificante il programma
|
||||||
|
const char* cmd2name(
|
||||||
|
const char* argv0, // @parm Nome del programma
|
||||||
|
const char* argv1) // @parm Nome del parametro (default "")
|
||||||
{
|
{
|
||||||
TFilename app(argv0);
|
TFilename app(argv0);
|
||||||
app = app.name();
|
app = app.name();
|
||||||
@ -149,7 +205,7 @@ const char* cmd2name(const char* argv0, const char* argv1)
|
|||||||
app.lower();
|
app.lower();
|
||||||
|
|
||||||
const int par = app.find(" -");
|
const int par = app.find(" -");
|
||||||
const int num = par > 0 ? atoi(app.mid(par+2))+1 : 1;
|
const int num = par > 0 ? atoi(app.mid(par+2))+1 : 1;
|
||||||
|
|
||||||
const char c = (num > 9) ? ('a'+num-10) : ('0'+num);
|
const char c = (num > 9) ? ('a'+num-10) : ('0'+num);
|
||||||
app.cut(3);
|
app.cut(3);
|
||||||
@ -176,8 +232,11 @@ HIDDEN int ctoi(char c)
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
// @func Converte una cifra romana in intero normale
|
||||||
int rtoi(const char * val)
|
//
|
||||||
|
// @rdesc Ritorna l'equivalente in numeri della cifra romane
|
||||||
|
int rtoi(
|
||||||
|
const char * val) // @parm Stringa contenente la cifra scritta in numeri romani
|
||||||
{
|
{
|
||||||
if (val == NULL) return 0;
|
if (val == NULL) return 0;
|
||||||
|
|
||||||
@ -194,7 +253,11 @@ int rtoi(const char * val)
|
|||||||
return (value == 0) ? tot : -1;
|
return (value == 0) ? tot : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* itor(int num)
|
// @func Converte un numero intero nell'equivalente cifra romana
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna una stringa contenente la cifra romana
|
||||||
|
const char* itor(
|
||||||
|
int num) // @parm Intero da convertire in cifra romana
|
||||||
{
|
{
|
||||||
HIDDEN char roman_string[16];
|
HIDDEN char roman_string[16];
|
||||||
int cifra = 0;
|
int cifra = 0;
|
||||||
@ -228,8 +291,13 @@ const char* itor(int num)
|
|||||||
return roman_string;
|
return roman_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *esc(const char* s)
|
// @func Permette di codificare i caratteri di escape
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il carattere codificato
|
||||||
|
const char *esc(
|
||||||
|
const char* s) // @parm Carattere da codificare
|
||||||
|
|
||||||
|
// @comm Viene utilizzata soprattuto in UNIX.
|
||||||
{
|
{
|
||||||
const char *s1 = s;
|
const char *s1 = s;
|
||||||
char *s2 = __tmp_string;
|
char *s2 = __tmp_string;
|
||||||
@ -294,7 +362,13 @@ const char *esc(const char* s)
|
|||||||
|
|
||||||
HIDDEN const char * const key = "QSECOFR-";
|
HIDDEN const char * const key = "QSECOFR-";
|
||||||
|
|
||||||
const char * encode( const char * data)
|
// @func Permette di criptare una parola
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna la stringa criptata
|
||||||
|
const char * encode(
|
||||||
|
const char * data) // @parm Stringa da criptare
|
||||||
|
|
||||||
|
// @xref <f decode>
|
||||||
{
|
{
|
||||||
for (int i = 0; data[i]; i++)
|
for (int i = 0; data[i]; i++)
|
||||||
__tmp_string[i] = data[i] + (i < 8 ? key[i] : data[i - 8]);
|
__tmp_string[i] = data[i] + (i < 8 ? key[i] : data[i - 8]);
|
||||||
@ -302,7 +376,13 @@ const char * encode( const char * data)
|
|||||||
return __tmp_string;
|
return __tmp_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * decode( const char * data)
|
// @func Permette di decodificare una stringa criptata
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna la stringa in chiaro
|
||||||
|
const char * decode(
|
||||||
|
const char * data) // @parm Stringa criptata da tradurre
|
||||||
|
|
||||||
|
// @xref <f encode>
|
||||||
{
|
{
|
||||||
for (int i = 0; data[i]; i++)
|
for (int i = 0; data[i]; i++)
|
||||||
__tmp_string[i] = data[i] - (i < 8 ? key[i] : __tmp_string[i - 8]);
|
__tmp_string[i] = data[i] - (i < 8 ? key[i] : __tmp_string[i - 8]);
|
||||||
@ -312,7 +392,16 @@ const char * decode( const char * data)
|
|||||||
|
|
||||||
#if XVT_OS != XVT_OS_WIN
|
#if XVT_OS != XVT_OS_WIN
|
||||||
|
|
||||||
int stricmp(const char* s1, const char* s2)
|
// @func Permette di confrontare due stringhe ignorando la differenza
|
||||||
|
// tra lettere maiuscole o minuscole
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il risultato dell'operazione:
|
||||||
|
//
|
||||||
|
// @flag 0 | Se le stringhe sono uguali
|
||||||
|
// @flag >0 | Se le stringhe sono differenti. Il numero indica la lettera diversa
|
||||||
|
int stricmp(
|
||||||
|
const char* s1, // @parm Prima stringa da confrontare
|
||||||
|
const char* s2) // @parm Seconda stringa da confrontare
|
||||||
{
|
{
|
||||||
for(int d = 0 ; (d = toupper(*s1)-toupper(*s2)) == 0; s1++, s2++)
|
for(int d = 0 ; (d = toupper(*s1)-toupper(*s2)) == 0; s1++, s2++)
|
||||||
if (*s1 == '\0' && *s2 == '\0')
|
if (*s1 == '\0' && *s2 == '\0')
|
||||||
@ -324,7 +413,17 @@ int stricmp(const char* s1, const char* s2)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef __WATCOMC__
|
#ifdef __WATCOMC__
|
||||||
char * tempnam(const char * dir , const char * prefix)
|
// @func Costruisce il percorso per un file temporaneo
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il nome assoluto del file temporaneo
|
||||||
|
char * tempnam(
|
||||||
|
const char * dir , // @parm Nome della directory nel quale inserire il file temporaneo
|
||||||
|
const char * prefix) // @parm Evenutale prefisso da dare al file temporaneo
|
||||||
|
|
||||||
|
// @comm Il nome della directory viene letto dalla variabile d'ambiente chiamata
|
||||||
|
// TMP, solo nel caso questa non esista viene utilizzato il nome passato
|
||||||
|
// in <p dir>.
|
||||||
|
// <nl>E' definita solo nel caso si utilizzi il WATCOM C/C++.
|
||||||
|
|
||||||
{
|
{
|
||||||
TFilename tmpdir(getenv("TMP"));
|
TFilename tmpdir(getenv("TMP"));
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* @FPUB */
|
// @doc EXTERNAL
|
||||||
|
|
||||||
char* format (const char* fmt, ...);
|
char* format (const char* fmt, ...);
|
||||||
const char* cmd2name(const char* argv0, const char* argv1 = "");
|
const char* cmd2name(const char* argv0, const char* argv1 = "");
|
||||||
int rtoi(const char * roman);
|
int rtoi(const char * roman);
|
||||||
@ -17,7 +18,15 @@ bool make_dir(const char* file);
|
|||||||
int list_files(TToken_string& names);
|
int list_files(TToken_string& names);
|
||||||
const char * encode(const char* data);
|
const char * encode(const char* data);
|
||||||
const char * decode(const char* data);
|
const char * decode(const char* data);
|
||||||
inline bool is_not_slash(char s) { return s != '\\' && s != '/'; }
|
// @func Controlla se il carattere passato e' il simbolo di slash ('\\' oppure '/')
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna i seguneti valori:
|
||||||
|
//
|
||||||
|
// @flag TRUE | Se il carattere <p s> e' uno slash
|
||||||
|
// @flag FALSE | Se il carattere <p s> non e' uno slash
|
||||||
|
inline bool is_not_slash(
|
||||||
|
char s) // @parm Carattere da confrontare
|
||||||
|
{ return s != '\\' && s != '/'; }
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_SCOUNIX
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
int stricmp(const char*, const char*);
|
int stricmp(const char*, const char*);
|
||||||
@ -38,6 +47,4 @@ extern char __tmp_string[1024];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* @END */
|
|
||||||
#endif /* __UTILITY_H */
|
#endif /* __UTILITY_H */
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
extern "C" { long nap(long period); }
|
extern "C" { long nap(long period); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// ERROR HOOK che intercetta errori XVT
|
// ERROR HOOK che intercetta errori XVT
|
||||||
// put breakpoint here
|
// put breakpoint here
|
||||||
|
|
||||||
@ -295,8 +297,16 @@ static void createwindow_hook(DWORD* exstyle, LPCSTR* classname, LPCSTR* windown
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// @func Calcola dimensioni e posizione di un controllo contenuto nella finestra
|
||||||
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent)
|
//
|
||||||
|
// @rdesc Ritorna il rettangolo
|
||||||
|
RCT& resize_rect(
|
||||||
|
short x, // @parm Coordinata x del controllo (espresso in caratteri)
|
||||||
|
short y, // @parm Coordinata y del controllo (espresso in caratteri)
|
||||||
|
short dx, // @parm Larghezza del controllo (espresso in caratteri)
|
||||||
|
short dy, // @parm Altezza del controllo (espresso in caratteri)
|
||||||
|
WIN_TYPE wt, // @parm Tipo di controllo da creare
|
||||||
|
WINDOW parent) // @parm Identificatore della finestra padre
|
||||||
{
|
{
|
||||||
static RCT r;
|
static RCT r;
|
||||||
|
|
||||||
@ -398,7 +408,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Emette un suono di default
|
||||||
void beep()
|
void beep()
|
||||||
{ xvt_scr_beep(); }
|
{ xvt_scr_beep(); }
|
||||||
|
|
||||||
@ -452,6 +462,7 @@ void TEvent_manager::pop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Processa tutti gli eventi rimasti in coda
|
||||||
void do_events()
|
void do_events()
|
||||||
{
|
{
|
||||||
xvt_app_process_pending_events();
|
xvt_app_process_pending_events();
|
||||||
@ -461,7 +472,14 @@ void do_events()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
KEY e_char_to_key(const EVENT* ep)
|
// @func Permette di convertire un evento carattere in un codice carattere premuto
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il codice del carattere corrispondente all'evento
|
||||||
|
KEY e_char_to_key(
|
||||||
|
const EVENT* ep) // @parm Evento da codificare
|
||||||
|
|
||||||
|
// @comm Viene controllato se l'evento e' un e_car e viene tradotto, in caso
|
||||||
|
// controrio viene emesso un segnale d'errore.
|
||||||
{
|
{
|
||||||
CHECK(ep->type == E_CHAR, "I can't convert a Non-E_CHAR event to a key");
|
CHECK(ep->type == E_CHAR, "I can't convert a Non-E_CHAR event to a key");
|
||||||
|
|
||||||
@ -474,7 +492,12 @@ KEY e_char_to_key(const EVENT* ep)
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatch_e_menu(WINDOW win, MENU_TAG item)
|
// @func Simula la scelta di una voce di menu
|
||||||
|
void dispatch_e_menu(
|
||||||
|
WINDOW win, // @parm Finestra che contiene il menu
|
||||||
|
MENU_TAG item) // @parm Voce del menu da selezionare
|
||||||
|
|
||||||
|
// @xref <f dispatch_e_char> <f dispatch_e_scroll>
|
||||||
{
|
{
|
||||||
EVENT e;
|
EVENT e;
|
||||||
|
|
||||||
@ -484,7 +507,12 @@ void dispatch_e_menu(WINDOW win, MENU_TAG item)
|
|||||||
EM.push(win, e);
|
EM.push(win, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatch_e_char(WINDOW win, KEY key)
|
// @func Simula la scelta di una combinazione di caratteri
|
||||||
|
void dispatch_e_char(
|
||||||
|
WINDOW win, // @parm Finestra che contiene il menu
|
||||||
|
KEY key) // @parm Combinazione di caratteri da utilizzare
|
||||||
|
|
||||||
|
// @xref <f dispatch_e_menu> <f dispatch_e_scroll>
|
||||||
{
|
{
|
||||||
EVENT e;
|
EVENT e;
|
||||||
|
|
||||||
@ -501,7 +529,12 @@ void dispatch_e_char(WINDOW win, KEY key)
|
|||||||
EM.push(win, e);
|
EM.push(win, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatch_e_scroll(WINDOW win, KEY key)
|
// @func Simula uno scroll all'interno di una finestra
|
||||||
|
void dispatch_e_scroll(
|
||||||
|
WINDOW win, // @parm Finestra nella quale operare
|
||||||
|
KEY key) // @parm Tasto utilizzato per lo scroll nella finestra
|
||||||
|
|
||||||
|
// @xref <f dispatch_e_menu> <f dispatch_e_char>
|
||||||
{
|
{
|
||||||
EVENT e;
|
EVENT e;
|
||||||
EVENT_TYPE& t = e.type;
|
EVENT_TYPE& t = e.type;
|
||||||
@ -561,8 +594,13 @@ void dispatch_e_scroll(WINDOW win, KEY key)
|
|||||||
if (w != SC_NONE) xvt_win_dispatch_event(win, &e);
|
if (w != SC_NONE) xvt_win_dispatch_event(win, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void customize_colors()
|
// @func Permette di cambiare i colori attivi del programma
|
||||||
|
void customize_colors()
|
||||||
|
|
||||||
|
// @comm Legge dal file di configurazione i colori scelti dall'utente e
|
||||||
|
// ne setta le variabili in modo da poter personalizzare i colori
|
||||||
|
//
|
||||||
|
// @xref <c TConfig>
|
||||||
{
|
{
|
||||||
TConfig colors(CONFIG_USER, "Colors");
|
TConfig colors(CONFIG_USER, "Colors");
|
||||||
|
|
||||||
@ -577,7 +615,9 @@ void customize_colors()
|
|||||||
FOCUS_BACK_COLOR = colors.get_color("FocusBack", NULL, -1, FOCUS_BACK_COLOR);
|
FOCUS_BACK_COLOR = colors.get_color("FocusBack", NULL, -1, FOCUS_BACK_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void customize_controls(bool on)
|
// @func Stabilisce i parametri standard dei controlli
|
||||||
|
void customize_controls(
|
||||||
|
bool on) // @parm Permette di inizializzare (TRUE) o scaricare (FALSE) i parametri
|
||||||
|
|
||||||
{
|
{
|
||||||
customize_colors();
|
customize_colors();
|
||||||
@ -704,7 +744,12 @@ XVT_FNTID xvt_default_font()
|
|||||||
return DEF_FONT;
|
return DEF_FONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_set_font(WINDOW win, const char* family, int style, int dim)
|
// @func Permette di settare il font attivo nella finestra
|
||||||
|
void xvt_set_font(
|
||||||
|
WINDOW win, // @parm Finestra nella quale settare il font
|
||||||
|
const char* family, // @parm Nome del font da settare
|
||||||
|
int style, // @parm Stile da applicare al font
|
||||||
|
int dim) // @parm Dimensione del font
|
||||||
{
|
{
|
||||||
CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
|
CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
|
||||||
|
|
||||||
@ -731,15 +776,22 @@ void xvt_set_font(WINDOW win, const char* family, int style, int dim)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di creare una finestra
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna l'identificatore della finestra creata
|
||||||
|
WINDOW xvt_create_window(
|
||||||
|
WIN_TYPE wt, // @parm Tipo di finestra da creare
|
||||||
|
short x, // @parm Coordinata x della finestra (espresso in caratteri)
|
||||||
|
short y, // @parm Coordinata y della finestra (espresso in caratteri)
|
||||||
|
short dx, // @parm Larghezza della finestra (espresso in caratteri)
|
||||||
|
short dy, // @parm Altezza della finestra (espresso in caratteri)
|
||||||
|
const char* caption, // @parm Titolo da assegnare alla finestra
|
||||||
|
int menu, // @parm Menu della finestra (definito nelle risorse, 0=senza)
|
||||||
|
WINDOW parent, // @parm Identificatore della finestra padre
|
||||||
|
long flags, // @parm Attributi della finestra
|
||||||
|
EVENT_HANDLER eh, // @parm Funzioni per la gestione degli eventi diretti alla finestra
|
||||||
|
long app_data) // @parm Puntatore alla classe C++ che gestisce la finestra
|
||||||
|
|
||||||
WINDOW xvt_create_window(WIN_TYPE wt,
|
|
||||||
short x, short y, short dx, short dy,
|
|
||||||
const char* caption,
|
|
||||||
int menu,
|
|
||||||
WINDOW parent,
|
|
||||||
long flags,
|
|
||||||
EVENT_HANDLER eh, long app_data
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
RCT& rect = resize_rect(x, y, dx, dy, wt, parent);
|
RCT& rect = resize_rect(x, y, dx, dy, wt, parent);
|
||||||
|
|
||||||
@ -769,13 +821,20 @@ WINDOW xvt_create_window(WIN_TYPE wt,
|
|||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW xvt_create_control(WIN_TYPE wt,
|
// @func Permette di creare i controlli all'interno di una finestra
|
||||||
short x, short y, short dx, short dy,
|
//
|
||||||
const char* caption,
|
// @rdesc Ritorna la finestra del controllo
|
||||||
WINDOW parent,
|
WINDOW xvt_create_control(
|
||||||
long flags,
|
WIN_TYPE wt, // @parm Tipo di controllo da creare
|
||||||
long app_data,
|
short x, // @parm Coordinata x del control
|
||||||
int id)
|
short y, // @parm Coordinata y del control
|
||||||
|
short dx, // @parm Larghezza della control
|
||||||
|
short dy, // @parm Altezza della control
|
||||||
|
const char* caption, // @parm Titolo da assegnare alla control
|
||||||
|
WINDOW parent, // @parm Identificatore della finestra padre
|
||||||
|
long flags, // @parm Attributi della finestra
|
||||||
|
long app_data, // @parm Puntatore alla classe C++ che gestisce la finestra
|
||||||
|
int id) // @parm Indentificatore del controlllo
|
||||||
{
|
{
|
||||||
RCT r = resize_rect(x, y, dx, dy, wt, parent);
|
RCT r = resize_rect(x, y, dx, dy, wt, parent);
|
||||||
WINDOW win = NULL_WIN;
|
WINDOW win = NULL_WIN;
|
||||||
@ -859,8 +918,13 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
|||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Restituisce il titolo della finestra
|
||||||
|
//
|
||||||
|
// @rdesc Stringa contenente il titolo della finestra
|
||||||
|
const char* xvt_get_title(
|
||||||
|
WINDOW win) // @parm Finestra della quale si vuole conoscere il titolo
|
||||||
|
|
||||||
const char* xvt_get_title(WINDOW win)
|
// @xref <f xvt_set_title>
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
const TControl* c = TControl::WINDOW2TControl(win);
|
const TControl* c = TControl::WINDOW2TControl(win);
|
||||||
@ -871,7 +935,12 @@ const char* xvt_get_title(WINDOW win)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_set_title(WINDOW win, const char* cap)
|
// @func Permette di assegnare il titolo ad una finestra
|
||||||
|
void xvt_set_title(
|
||||||
|
WINDOW win, // @parm Finestra a cui assegnare il titolo
|
||||||
|
const char* cap) // @parm Titolo da assegnare
|
||||||
|
|
||||||
|
// @xref <f xvt_get_title>
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
@ -881,8 +950,9 @@ void xvt_set_title(WINDOW win, const char* cap)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di abilitare il focus su un controllo
|
||||||
void xvt_set_front_control(WINDOW win)
|
void xvt_set_front_control(
|
||||||
|
WINDOW win) // @parm Finestra nella quale abilitare il focus
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
@ -891,8 +961,10 @@ void xvt_set_front_control(WINDOW win)
|
|||||||
xvt_scr_set_focus_vobj(win);
|
xvt_scr_set_focus_vobj(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di abilitare o disabilitare un controllo
|
||||||
void xvt_enable_control(WINDOW win, bool on)
|
void xvt_enable_control(
|
||||||
|
WINDOW win, // @parm Finestra all'interno della quale abilitare il controllo
|
||||||
|
bool on) // @parm Abilita (TRUE) o disabilita (FALSE) il controllo
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
@ -902,8 +974,10 @@ void xvt_enable_control(WINDOW win, bool on)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di gestire un check box all'interno di una finestra
|
||||||
void xvt_check_box(WINDOW win, bool on)
|
void xvt_check_box(
|
||||||
|
WINDOW win, // @parm Finestra all'interno della quale abilitare il check box
|
||||||
|
bool on) // @parm Permette di inizializzare (TRUE) o scaricare (FALSE) i parametri
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||||
@ -913,8 +987,14 @@ void xvt_check_box(WINDOW win, bool on)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di controllare se un controllo e' stato selezionato
|
||||||
bool xvt_get_checked_state(WINDOW win)
|
//
|
||||||
|
// @rdesc Ritorna i seguenti valori:
|
||||||
|
//
|
||||||
|
// @flag TRUE | Se il controllo e' stato selezionato
|
||||||
|
// @flag FALSE | Se il controllo non e' stato selezionato
|
||||||
|
bool xvt_get_checked_state(
|
||||||
|
WINDOW win) // @parm Finestra di cui si vuole conoscere lo stato
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
@ -924,8 +1004,11 @@ bool xvt_get_checked_state(WINDOW win)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di gestire un radio button all'interno di una finestra
|
||||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
void xvt_check_radio_button(
|
||||||
|
WINDOW win, // @parm Finestra all'interno della quale abilitare il radio button
|
||||||
|
const WINDOW* ctls, // @parm Array di stringhe contenenti le scelte del radiobutton
|
||||||
|
int count) // @parm Numero di elementi del radiobutton
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
@ -935,8 +1018,13 @@ void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di controllare lo stato di un radiobutton
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il numero dell'elemento del radiobutton selezionato
|
||||||
|
int xvt_get_checked_radio(
|
||||||
|
const WINDOW* ctls, // @parm Array di stringhe contenenti le scelte del radiobutton
|
||||||
|
int count) // @parm Numero di elemnti del radiobutton
|
||||||
|
|
||||||
int xvt_get_checked_radio(const WINDOW* ctls, int count)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
if (xvt_get_checked_state(ctls[i])) return i;
|
if (xvt_get_checked_state(ctls[i])) return i;
|
||||||
@ -955,7 +1043,12 @@ int xvt_get_checked_radio(const WINDOW* ctls, int count)
|
|||||||
|
|
||||||
HIDDEN WINDOW _statbar = NULL_WIN;
|
HIDDEN WINDOW _statbar = NULL_WIN;
|
||||||
|
|
||||||
|
// @func Permette di creare la barra di stato del programma
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna l'identificatore della barra di stato creata
|
||||||
WINDOW xvt_create_statbar()
|
WINDOW xvt_create_statbar()
|
||||||
|
|
||||||
|
// @xref <f xvt_statbar_set> <f xvt_statbar_refresh>
|
||||||
{
|
{
|
||||||
CHECK(_statbar == NULL_WIN, "Onli uan stabar, plis");
|
CHECK(_statbar == NULL_WIN, "Onli uan stabar, plis");
|
||||||
|
|
||||||
@ -981,7 +1074,14 @@ WINDOW xvt_create_statbar()
|
|||||||
return _statbar;
|
return _statbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_statbar_set(const char* text, bool def)
|
// @func Permette di settare una finestra con la barra di stato
|
||||||
|
void xvt_statbar_set(
|
||||||
|
const char* text, // @parm Testo da inserire nella barra di stato
|
||||||
|
bool def) // @parm (default FALSE)
|
||||||
|
|
||||||
|
// @comm Nella barra di stato vi e' sempre presente la data del sistema
|
||||||
|
//
|
||||||
|
// @xref <f xvt_create_statbar> <f xvt_statbar_refresh>
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
const TDate oggi(TODAY);
|
const TDate oggi(TODAY);
|
||||||
@ -993,7 +1093,10 @@ void xvt_statbar_set(const char* text, bool def)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Permette di cambiare il titolo alla barra di stato presente
|
||||||
void xvt_statbar_refresh()
|
void xvt_statbar_refresh()
|
||||||
|
|
||||||
|
// @xref <f xvt_create_statbar> <f xvt_statbar_set>
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
statbar_set_title(_statbar, NULL);
|
statbar_set_title(_statbar, NULL);
|
||||||
@ -1019,8 +1122,15 @@ HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @func Controlla se e' esiste una voce del menu'
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna i seguenti valori
|
||||||
|
//
|
||||||
|
// @flag TRUE | Se esiste la voce di menu'
|
||||||
|
// @flag FALSE | Se non esiste la voce di menu'
|
||||||
|
bool xvt_test_menu_tag(
|
||||||
|
MENU_TAG tag) // @parm Menu' nel quale cercare la voce
|
||||||
|
|
||||||
bool xvt_test_menu_tag(MENU_TAG tag)
|
|
||||||
{
|
{
|
||||||
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
||||||
const bool ok = test_menu_tag(mi, tag);
|
const bool ok = test_menu_tag(mi, tag);
|
||||||
@ -1029,10 +1139,12 @@ bool xvt_test_menu_tag(MENU_TAG tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// translation of graphics attributes from codes chars
|
// @func Permette di convertire in attributi grafici i codici caratteri usati
|
||||||
// used by print functions
|
// dalle funzioni di stampa
|
||||||
|
//
|
||||||
COLOR trans_color(char c)
|
// @rdesc Ritorna il codice del colore convertito in attributo grafico
|
||||||
|
COLOR trans_color(
|
||||||
|
char c) // @parm Codice carattere da convertire
|
||||||
{
|
{
|
||||||
COLOR col;
|
COLOR col;
|
||||||
switch (c)
|
switch (c)
|
||||||
@ -1067,7 +1179,12 @@ COLOR trans_color(char c)
|
|||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
PAT_STYLE trans_brush(char p)
|
// @func Permette di converitire lo stile del pattern in attributi grafici da
|
||||||
|
// codici carattere.
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna il pattern convertito
|
||||||
|
PAT_STYLE trans_brush(
|
||||||
|
char p) // @parm Codice carattere da convertire
|
||||||
{
|
{
|
||||||
switch (p)
|
switch (p)
|
||||||
{
|
{
|
||||||
@ -1095,7 +1212,11 @@ PAT_STYLE trans_brush(char p)
|
|||||||
return PAT_NONE;
|
return PAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PEN_STYLE trans_pen(char p)
|
// @func Permette di convertire lo stile della penna da codice carattere
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna lo stilo convertito
|
||||||
|
PEN_STYLE trans_pen(
|
||||||
|
char p) // @parm Codice carattere da convertire
|
||||||
{
|
{
|
||||||
PEN_STYLE ps = P_SOLID;
|
PEN_STYLE ps = P_SOLID;
|
||||||
switch (p)
|
switch (p)
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <keys.h>
|
#include <keys.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* @FPUB */
|
|
||||||
|
|
||||||
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent);
|
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent);
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ WINDOW xvt_create_window
|
|||||||
EVENT_HANDLER eh,
|
EVENT_HANDLER eh,
|
||||||
long app_data
|
long app_data
|
||||||
);
|
);
|
||||||
|
|
||||||
WINDOW xvt_create_control
|
WINDOW xvt_create_control
|
||||||
(
|
(
|
||||||
WIN_TYPE wt,
|
WIN_TYPE wt,
|
||||||
@ -65,6 +64,7 @@ WINDOW xvt_create_window
|
|||||||
bool xvt_get_checked_state(WINDOW win);
|
bool xvt_get_checked_state(WINDOW win);
|
||||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
||||||
int xvt_get_checked_radio(const WINDOW* ctls, int count);
|
int xvt_get_checked_radio(const WINDOW* ctls, int count);
|
||||||
|
// ??? NON LA TROVO NEL CPP ??? //
|
||||||
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
|
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
|
||||||
|
|
||||||
bool xvt_test_menu_tag(MENU_TAG tag);
|
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||||
@ -75,6 +75,4 @@ WINDOW xvt_create_window
|
|||||||
|
|
||||||
extern short CHARX, CHARY, BASEY, ROWY;
|
extern short CHARX, CHARY, BASEY, ROWY;
|
||||||
|
|
||||||
/* @END */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user