Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : array.cpp Migliorata gestione [] quando non c'e' l'oggetto desiderato classes.h Aggiunta CLASS_CURRENCY_FIELD config.* Aggiunto metodo for_each_paragraph controls.cpp BOOLEAN trasformati in bool currency.* Reimplementati completamente i TCurrency date.* Migliorati operatori aritmetici sulle date default.url Modificati identificatori per gestire popup degli sheet isam.* Aggiunta gestione flag di modifica e ridotto uso __isam_string mask.* Reso pubblico il costruttore vuoto e read_mask Aggiunta gestione TCurrency_field maskfld.* Aggiornati TCurrency_field msksheet.cpp Usata read_mask per leggere la maschera degli sheet multirec.cpp Eliminato memory_leak causato da _fiels.remove prefix.cpp Riga vuota progind.cpp Corretto aggiornamento in assenza di barra rdoc.h Aggiunti campi IMPIANTO e LINEA real.cpp Allungata stringa fissa di lavoro da 24 a 64 relapp.cpp Migliorata gestione /I relation.cpp Corretta gestione indici dei cursori strings.cpp Corretto << dei TObject tabutil.* Eliminato uso TRecfield erratissimo varmask.* Aggiunto costruttore vuoto viswin.cpp Ridotta frequenza di update dell'icona in basso a sinistra window.cpp Corretto disegno in modo _pixmap xvtility.cpp Allungata stringa per status_bar git-svn-id: svn://10.65.10.50/trunk@7391 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a039f14a36
commit
956304d26c
@ -292,15 +292,12 @@ TObject& TArray::operator[] (int index) const
|
||||
if (o == NULL)
|
||||
{
|
||||
NFCHECK("Can't access NULL array item %d of %d", index, _size);
|
||||
if (index >= 0)
|
||||
const int f = last();
|
||||
if (f >= 0)
|
||||
{
|
||||
const int f = first();
|
||||
if (f >= 0)
|
||||
{
|
||||
o = objptr(f)->dup();
|
||||
((TArray*)this)->add(o, index);
|
||||
}
|
||||
}
|
||||
o = objptr(f)->dup();
|
||||
((TArray*)this)->add(o, index);
|
||||
}
|
||||
CHECK(o, "Unrecoverable array access error");
|
||||
}
|
||||
return *o;
|
||||
|
@ -49,6 +49,7 @@
|
||||
#define CLASS_DATE_FIELD 246
|
||||
#define CLASS_GRID_FIELD 247
|
||||
#define CLASS_TREE_FIELD 248
|
||||
#define CLASS_CURRENCY_FIELD 249
|
||||
|
||||
#define CLASS_GOLEM 900
|
||||
|
||||
|
@ -9,6 +9,36 @@
|
||||
|
||||
#include <extcdecl.h> // GetPrawinName
|
||||
|
||||
bool TConfig::add_line(const TString& l)
|
||||
{
|
||||
const int ind = l.find('=');
|
||||
if (ind < 0)
|
||||
return FALSE;
|
||||
|
||||
TString80 key = l.left(ind); key.trim();
|
||||
TString& val = (TString&)l.mid(ind+1); val.trim();
|
||||
|
||||
if (val[0] == '%')
|
||||
{
|
||||
if (val == "%yr%")
|
||||
{
|
||||
time_t ora; time(&ora);
|
||||
struct tm * oggi = localtime(&ora);
|
||||
if (oggi != NULL)
|
||||
val.format("%04d", 1900 + oggi->tm_year);
|
||||
else
|
||||
NFCHECK("Impossibile reperire la data corrente del sistema.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val == "%frm%")
|
||||
val.format("%05ld", prefix().get_codditta());
|
||||
}
|
||||
}
|
||||
// sostituzione abilitata
|
||||
return _data.add(key,val,TRUE);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Legge i dati del paragrafo
|
||||
@ -28,40 +58,12 @@ bool TConfig::_read_paragraph()
|
||||
{
|
||||
itwas = TRUE;
|
||||
// populate array
|
||||
TString key, val;
|
||||
for (;;)
|
||||
while(TRUE)
|
||||
{
|
||||
const TString& l = scan.line();
|
||||
if (l.empty() || l[0] == '[') break; // Fine paragrafo
|
||||
if (l[0] == '#' || l[0] == '/') continue; // Riga di commento
|
||||
|
||||
const int ind = l.find('=');
|
||||
if (ind == -1)
|
||||
{
|
||||
error_box("Errore configurazione:\n file %s, vicino alla riga %u\n %s",
|
||||
(const char*)_file, scan.linenum(), (const char*)l);
|
||||
continue;
|
||||
}
|
||||
|
||||
key = l.left(ind); key.trim();
|
||||
val = l.mid(ind+1); val.trim();
|
||||
|
||||
if (val[0] == '%')
|
||||
{
|
||||
if (val == "%yr%")
|
||||
{
|
||||
// val.format("%04d", TDate(TODAY).year());
|
||||
time_t ora; time(&ora);
|
||||
struct tm * oggi = localtime(&ora);
|
||||
if (oggi == NULL)
|
||||
fatal_box("Impossibile reperire la data corrente del sistema.");
|
||||
val.format("%04d", 1900 + oggi->tm_year);
|
||||
}
|
||||
else
|
||||
if (val == "%frm%") val.format("%05ld", prefix().get_codditta());
|
||||
}
|
||||
// sostituzione abilitata
|
||||
_data.add(key,val,TRUE);
|
||||
add_line(l);
|
||||
}
|
||||
}
|
||||
return itwas;
|
||||
@ -638,6 +640,40 @@ TAssoc_array& TConfig::list_variables(const char* section)
|
||||
return _data;
|
||||
}
|
||||
|
||||
int TConfig::for_each_paragraph(CONFIG_CALLBACK cfgcb, void* jolly)
|
||||
{
|
||||
int count = 0;
|
||||
TScanner scanner(_file);
|
||||
|
||||
_paragraph.cut(0);
|
||||
bool needs_call = FALSE;
|
||||
|
||||
while (scanner.line().not_empty())
|
||||
{
|
||||
const TString& riga = scanner.token();
|
||||
if (riga[0] == '[')
|
||||
{
|
||||
count++;
|
||||
if (_paragraph.not_empty())
|
||||
{
|
||||
needs_call = FALSE;
|
||||
if (cfgcb && cfgcb(*this, jolly))
|
||||
break;
|
||||
}
|
||||
_paragraph = riga;
|
||||
_paragraph.strip("[]");
|
||||
_data.destroy();
|
||||
needs_call = TRUE;
|
||||
}
|
||||
else
|
||||
add_line(riga);
|
||||
}
|
||||
|
||||
if (needs_call && cfgcb)
|
||||
cfgcb(*this, jolly);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
TConfig::TConfig(int which_config, const char* paragraph)
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
#endif
|
||||
|
||||
class ofstream;
|
||||
class TConfig;
|
||||
|
||||
// questo sara' il principale, per ora non c'e'
|
||||
#define CONFIG_GENERAL 0
|
||||
@ -22,6 +23,8 @@ class ofstream;
|
||||
// file parametri stampe
|
||||
#define CONFIG_STAMPE 6
|
||||
|
||||
typedef int (*CONFIG_CALLBACK)(TConfig& cfg, void* jolly);
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TConfig | Classe per la gestione dei file di configurazione in formato
|
||||
@ -69,6 +72,8 @@ protected:
|
||||
void _write_file();
|
||||
// @cmember Inizializza il paragrafo leggendo dal file di nome <p fn > i dati
|
||||
void init(const char *fn, const char* pa, bool warning);
|
||||
// @cmember Carica una variabile da una riga
|
||||
bool add_line(const TString& l);
|
||||
|
||||
// @access Public Memeber
|
||||
public:
|
||||
@ -135,6 +140,9 @@ public:
|
||||
// add_value e' TRUE ci mette "variabile<pipe>valore"
|
||||
// se sort=TRUE, l'array è ordinato per nomevar(i), altrimenti è in ordine HASH
|
||||
int list_variables(TString_array& vl, bool add_value = FALSE, const char* section = NULL, const bool sort=FALSE);
|
||||
|
||||
// @cmember Chiama cfgcb per ogni paragrafo
|
||||
int for_each_paragraph(CONFIG_CALLBACK cfgcb, void* jolly);
|
||||
|
||||
// @cmember Ritorna l'intero array delle variabili della sezione
|
||||
// eventualmente specificata da <p section>
|
||||
|
@ -38,8 +38,8 @@ COLOR DISABLED_COLOR = COLOR_DKGRAY;
|
||||
COLOR DISABLED_BACK_COLOR = MASK_BACK_COLOR;
|
||||
COLOR FOCUS_COLOR = NORMAL_COLOR;
|
||||
COLOR FOCUS_BACK_COLOR = COLOR_YELLOW;
|
||||
BOOLEAN CAMPI_SCAVATI = FALSE;
|
||||
BOOLEAN AUTOSELECT = FALSE;
|
||||
bool CAMPI_SCAVATI = FALSE;
|
||||
bool AUTOSELECT = FALSE;
|
||||
|
||||
#ifndef STX_DATA
|
||||
// Very deep hacking
|
||||
@ -88,7 +88,6 @@ void low_set_focus_id(WINDOW win, short cid)
|
||||
itf->v.itf->focus_obj = NULL;
|
||||
}
|
||||
|
||||
// #define CAMPI_SCAVATI FALSE
|
||||
HIDDEN int X_FU_MULTIPLE = 0;
|
||||
HIDDEN int Y_FU_MULTIPLE = 0;
|
||||
HIDDEN const int ITF_CID = 30000;
|
||||
|
@ -12,26 +12,33 @@ class TDowJones : public TFile_cache
|
||||
real _num;
|
||||
real _den;
|
||||
int _dec;
|
||||
int _dec_prices;
|
||||
|
||||
public:
|
||||
const TExchangeData& operator=(const TExchangeData& d)
|
||||
{ _num = d._num; _den = d._den; _dec = d._dec; return d; }
|
||||
TExchangeData() : _num(1.0), _den(1.0), _dec(0) { }
|
||||
{ _num = d._num; _den = d._den; _dec = d._dec; _dec_prices = d._dec_prices; return d; }
|
||||
TExchangeData() : _num(1.0), _den(1.0), _dec(0), _dec_prices(0) { }
|
||||
};
|
||||
|
||||
char _defval[4];
|
||||
TString16 _base_val, _firm_val;
|
||||
|
||||
protected:
|
||||
virtual TObject* rec2obj(const TRectype& rec) const;
|
||||
virtual void flush();
|
||||
|
||||
void test_cache();
|
||||
const TExchangeData& get(const char* key);
|
||||
|
||||
public:
|
||||
const char* get_defval();
|
||||
const TString& get_base_val();
|
||||
const TString& get_firm_val();
|
||||
const char* expand_value(const char* val);
|
||||
|
||||
real exchange(const real& num, const char* fromval, const char* toval);
|
||||
int get_dec(const char* val);
|
||||
real exchange(const real& num,
|
||||
const char* fromval, const real& fromchg,
|
||||
const char* toval, const real& tochg,
|
||||
bool price = FALSE);
|
||||
int get_dec(const char* val, bool prices = FALSE);
|
||||
|
||||
TDowJones() : TFile_cache("%VAL") { }
|
||||
virtual ~TDowJones() { }
|
||||
@ -46,7 +53,6 @@ TObject* TDowJones::rec2obj(const TRectype& rec) const
|
||||
data->_num = rec.get_real("R11");
|
||||
if (data->_num < 1.0)
|
||||
data->_num = 1.0;
|
||||
data->_dec = rec.get_int("I0");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -54,180 +60,288 @@ TObject* TDowJones::rec2obj(const TRectype& rec) const
|
||||
if (data->_num < 1.0)
|
||||
data->_num = 1.0;
|
||||
data->_den = rec.get_real("R10");
|
||||
|
||||
const TString& codval = rec.get("CODTAB");
|
||||
data->_dec = codval.empty() || codval == "LIT" ? 0 : 2;
|
||||
data->_num = 1.0;
|
||||
}
|
||||
|
||||
const bool invalid = rec.get("CODTAB").empty();
|
||||
data->_dec = invalid ? 0 : rec.get_int("I0");
|
||||
data->_dec_prices = invalid ? data->_dec : rec.get_int("I1");
|
||||
if (data->_dec_prices < data->_dec)
|
||||
data->_dec_prices = data->_dec;
|
||||
|
||||
if (data->_den <= ZERO)
|
||||
{
|
||||
NFCHECK("Cambio nullo: %s = %s",
|
||||
(const char*)rec.get("CODTAB"),
|
||||
data->_den.string());
|
||||
NFCHECK("Codice valuta assente");
|
||||
data->_den = 1.0;
|
||||
data->_num = 1.0;
|
||||
data->_dec = 0;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
void TDowJones::flush()
|
||||
{
|
||||
_base_val.cut(0);
|
||||
_firm_val.cut(0);
|
||||
}
|
||||
|
||||
void TDowJones::test_cache()
|
||||
{
|
||||
if (_cache.items() == 0)
|
||||
{
|
||||
fill();
|
||||
|
||||
*_defval = '\0';
|
||||
FOR_EACH_ASSOC_OBJECT(_cache, hash, key, obj)
|
||||
{
|
||||
const TExchangeData* data = (const TExchangeData*)obj;
|
||||
if (data->_num == 1.0 && data->_den == 1.0)
|
||||
{
|
||||
strcpy(_defval, key);
|
||||
_base_val = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*_defval == '\0')
|
||||
if (_base_val.empty())
|
||||
{
|
||||
strcpy(_defval, "LIT");
|
||||
_cache.add(_defval, new TExchangeData);
|
||||
_base_val = "LIT";
|
||||
_cache.add(_base_val, new TExchangeData);
|
||||
}
|
||||
|
||||
TConfig cfg(CONFIG_DITTA, "cg");
|
||||
_firm_val = cfg.get("CodVal", NULL, -1, _base_val);
|
||||
}
|
||||
}
|
||||
|
||||
const char* TDowJones::expand_value(const char* val)
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
if (*val == '_')
|
||||
{
|
||||
if (stricmp(val, "_FIRM") == 0)
|
||||
val = get_firm_val(); else
|
||||
if (stricmp(val, "_BASE") == 0)
|
||||
val = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
val = "";
|
||||
if (*val == '\0')
|
||||
val = get_base_val();
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
const TDowJones::TExchangeData& TDowJones::get(const char* val)
|
||||
{
|
||||
test_cache();
|
||||
if (val == NULL || *val == '\0')
|
||||
val = _defval;
|
||||
return (const TExchangeData&)query(val);
|
||||
return (const TExchangeData&)query(expand_value(val));
|
||||
}
|
||||
|
||||
const char* TDowJones::get_defval()
|
||||
const TString& TDowJones::get_base_val()
|
||||
{
|
||||
test_cache();
|
||||
return _defval;
|
||||
return _base_val;
|
||||
}
|
||||
|
||||
const TString& TDowJones::get_firm_val()
|
||||
{
|
||||
test_cache();
|
||||
return _firm_val;
|
||||
}
|
||||
|
||||
|
||||
real TDowJones::exchange(const real& num, // Importo da convertire
|
||||
const char* fromval, // Dalla valuta
|
||||
const char* toval) // Alla valuta
|
||||
const real& fromchg, // Dal cambio
|
||||
const char* toval, // Alla valuta
|
||||
const real& tochg, // Al cambio
|
||||
bool price) // e' un prezzo ?
|
||||
{
|
||||
real n = num;
|
||||
if (n != ZERO)
|
||||
{
|
||||
const TExchangeData& datafrom = get(fromval);
|
||||
real fromden = fromchg;
|
||||
real fromnum = 1.0;
|
||||
real toden = tochg;
|
||||
real tonum = 1.0;
|
||||
if (fromden <= ZERO)
|
||||
{
|
||||
const TExchangeData& datafrom = get(fromval);
|
||||
fromden = datafrom._den;
|
||||
fromnum = datafrom._num;
|
||||
}
|
||||
const TExchangeData& datato = get(toval);
|
||||
n *= datafrom._den * datato._num;
|
||||
n /= datafrom._num * datato._den;
|
||||
n.round(datato._dec);
|
||||
if (toden <= ZERO)
|
||||
{
|
||||
toden = datato._den;
|
||||
tonum = datato._num;
|
||||
}
|
||||
n *= fromden * tonum;
|
||||
n /= fromnum * toden;
|
||||
n.round(price ? datato._dec_prices : datato._dec);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int TDowJones::get_dec(const char* val)
|
||||
int TDowJones::get_dec(const char* val, bool price)
|
||||
{
|
||||
const TExchangeData& data = get(val);
|
||||
return data._dec;
|
||||
return price ? data._dec_prices : data._dec;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCurrency
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TCurrency::set_currency(const char* val)
|
||||
const TString& TCurrency::get_base_val()
|
||||
{
|
||||
if (val && *val)
|
||||
strncpy(_val, val, 4);
|
||||
else
|
||||
strcpy(_val, DowJones.get_defval());
|
||||
return DowJones.get_base_val();
|
||||
}
|
||||
|
||||
void TCurrency::change_currency(const char* val)
|
||||
const TString& TCurrency::get_firm_val()
|
||||
{
|
||||
if (_num != ZERO)
|
||||
_num = DowJones.exchange(_num, _val, val);
|
||||
set_currency(val);
|
||||
return DowJones.get_firm_val();
|
||||
}
|
||||
|
||||
void TCurrency::read(const TRectype& rec, const char* field, const char* val)
|
||||
int TCurrency::get_base_dec(bool price)
|
||||
{
|
||||
_num = rec.get_real(field);
|
||||
if (val == NULL || *val == '\0')
|
||||
val = "_VALUTA";
|
||||
TString16 tmpval;
|
||||
if (rec.exist(val))
|
||||
tmpval = rec.get(val);
|
||||
set_currency(tmpval);
|
||||
return DowJones.get_dec(NULL, price);
|
||||
}
|
||||
|
||||
void TCurrency::write(TRectype& rec, const char* field, const char *val, bool forceval) const
|
||||
int TCurrency::get_firm_dec(bool price)
|
||||
{
|
||||
if (val == NULL || *val == '\0')
|
||||
val = "_VALUTA";
|
||||
if (forceval || rec.exist(val))
|
||||
return DowJones.get_dec("_FIRM", price);
|
||||
}
|
||||
|
||||
void TCurrency::force_value(const char* newval, const real& newchange)
|
||||
{
|
||||
newval = DowJones.expand_value(newval);
|
||||
if (newval && *newval)
|
||||
{
|
||||
const TString& recval = rec.get(val);
|
||||
if (recval != _val)
|
||||
{
|
||||
if (forceval || recval.empty())
|
||||
rec.put(val, _val);
|
||||
else
|
||||
NFCHECK("Scrittura della valuta %s su di un record con valuta %s",
|
||||
_val, (const char*)recval);
|
||||
}
|
||||
strncpy(_val, newval, 4);
|
||||
_val[3] = '\0';
|
||||
_exchange = newchange;
|
||||
}
|
||||
else
|
||||
{
|
||||
*_val = '\0';
|
||||
_exchange = ZERO;
|
||||
}
|
||||
rec.put(field, _num);
|
||||
}
|
||||
|
||||
void TCurrency::change_value(const char* val, const real& newchange)
|
||||
{
|
||||
val = DowJones.expand_value(val);
|
||||
if (!_num.is_zero() && stricmp(_val, val) != 0)
|
||||
{
|
||||
_num = DowJones.exchange(_num, _val, _exchange, val, newchange, is_price());
|
||||
}
|
||||
force_value(val, newchange);
|
||||
}
|
||||
|
||||
int TCurrency::decimals() const
|
||||
{
|
||||
return DowJones.get_dec(_val, is_price());
|
||||
}
|
||||
|
||||
int TCurrency::compare(const TSortable& s) const
|
||||
{
|
||||
const TCurrency& cur = (const TCurrency&)s;
|
||||
if (stricmp(cur._val, _val) == 0)
|
||||
if (same_value_as(cur))
|
||||
{
|
||||
return _num == cur._num ? 0 : (_num > cur._num ? +1 : -1);
|
||||
}
|
||||
TCurrency curr(cur);
|
||||
curr.change_currency(_val);
|
||||
curr.change_value(_val);
|
||||
return _num == curr._num ? 0 : (_num > curr._num ? +1 : -1);
|
||||
}
|
||||
|
||||
const TCurrency& TCurrency::operator=(const TCurrency& cur)
|
||||
void TCurrency::copy(const TCurrency& cur)
|
||||
{
|
||||
_num = cur._num;
|
||||
strcpy(_val, cur._val);
|
||||
return cur;
|
||||
force_value(cur._val, cur._exchange);
|
||||
}
|
||||
|
||||
const char* TCurrency::string(bool dotted) const
|
||||
{
|
||||
TString16 picture;
|
||||
if (dotted)
|
||||
{
|
||||
picture << '.';
|
||||
const int dec = DowJones.get_dec(_val);
|
||||
if (dec > 0)
|
||||
picture << dec;
|
||||
TString16 picture;
|
||||
picture.format(".%d", decimals());
|
||||
return _num.string(picture);
|
||||
}
|
||||
return _num.string(picture);
|
||||
return _num.string(0, decimals());
|
||||
}
|
||||
|
||||
TCurrency::TCurrency() : _num(0.0)
|
||||
TCurrency& TCurrency::operator+=(const TCurrency& cur)
|
||||
{
|
||||
CHECK(is_price() == cur.is_price(), "Somma di pere e mele!");
|
||||
if (same_value_as(cur))
|
||||
{
|
||||
_num += cur._num;
|
||||
}
|
||||
else
|
||||
{
|
||||
real n = DowJones.exchange(cur._num, cur._val, cur._exchange,
|
||||
_val, _exchange, is_price());
|
||||
_num += n;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
TCurrency TCurrency::operator+(const TCurrency& num) const
|
||||
{
|
||||
TCurrency cur(*this);
|
||||
cur += num;
|
||||
return cur;
|
||||
}
|
||||
|
||||
TCurrency& TCurrency::operator-=(const TCurrency& cur)
|
||||
{
|
||||
CHECK(is_price() == cur.is_price(), "Sottrazione di pere e mele!");
|
||||
if (same_value_as(cur))
|
||||
_num -= cur._num;
|
||||
else
|
||||
{
|
||||
real n = DowJones.exchange(cur._num, cur._val, cur._exchange,
|
||||
_val, _exchange, is_price());
|
||||
_num -= n;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
TCurrency& TCurrency::operator*=(const real& num)
|
||||
{
|
||||
set_currency(NULL);
|
||||
_num *= num;
|
||||
// Arrotondo forzando price a FALSE
|
||||
_num.round(DowJones.get_dec(_val, _price = FALSE));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
TCurrency::TCurrency(const TCurrency& cur)
|
||||
: _num(cur._num)
|
||||
TCurrency TCurrency::operator*(const real& num) const
|
||||
{
|
||||
strcpy(_val, cur._val);
|
||||
TCurrency cur(*this);
|
||||
cur *= num;
|
||||
return cur;
|
||||
}
|
||||
|
||||
TCurrency::TCurrency(const real& num, const char* val)
|
||||
: _num(num)
|
||||
bool TCurrency::is_base_value() const
|
||||
{
|
||||
set_currency(val);
|
||||
return *_val == '\0' || get_base_val() == _val;
|
||||
}
|
||||
|
||||
bool TCurrency::same_value_as(const TCurrency& cur) const
|
||||
{
|
||||
const int cmp = stricmp(_val, cur._val);
|
||||
if (cmp == 0)
|
||||
return TRUE;
|
||||
if (*_val == '\0' || *cur._val == '\0')
|
||||
return is_base_value() == cur.is_base_value();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
TCurrency::TCurrency(const real& num, const char* val, const real& exchg, bool price)
|
||||
: _num(num), _price(price)
|
||||
{
|
||||
force_value(val, exchg);
|
||||
}
|
||||
|
||||
|
@ -11,30 +11,68 @@ class TRectype;
|
||||
|
||||
class TCurrency : public TSortable
|
||||
{
|
||||
real _num;
|
||||
char _val[4];
|
||||
real _num; // Valore assoluto
|
||||
char _val[4]; // Codice valuta
|
||||
real _exchange; // Cambio personalizzato
|
||||
bool _price;
|
||||
|
||||
protected:
|
||||
virtual int compare(const TSortable& s) const;
|
||||
void copy(const TCurrency& cur);
|
||||
|
||||
public:
|
||||
void change_currency(const char* newval);
|
||||
const char* get_currency() const { return _val; }
|
||||
void set_currency(const char* newval);
|
||||
static const TString& get_base_val();
|
||||
static const TString& get_firm_val();
|
||||
static int get_base_dec(bool price = FALSE);
|
||||
static int get_firm_dec(bool price = FALSE);
|
||||
|
||||
void set_price(bool p) { _price = p; }
|
||||
bool is_price() const { return _price; }
|
||||
|
||||
void force_value(const char* newval, const real& newchange = ZERO);
|
||||
void change_value(const char* newval, const real& newchange = ZERO);
|
||||
void change_to_base_val() { change_value(get_base_val()); }
|
||||
void change_to_firm_val() { change_value(get_firm_val()); }
|
||||
|
||||
const char* get_value() const { return _val; }
|
||||
bool is_base_value() const;
|
||||
bool same_value_as(const TCurrency& cur) const;
|
||||
|
||||
void set_num(const real& num) { _num = num; }
|
||||
const real& get_num() const { return _num; }
|
||||
|
||||
const TCurrency& operator=(const TCurrency& cur);
|
||||
const TCurrency& operator=(const TCurrency& cur) { copy(cur); return *this; }
|
||||
|
||||
TCurrency& operator += (const TCurrency& num);
|
||||
TCurrency operator - (const TCurrency& num) const;
|
||||
TCurrency& operator -= (const TCurrency& num);
|
||||
TCurrency operator + (const TCurrency& num) const;
|
||||
TCurrency& operator *= (const real& num);
|
||||
TCurrency operator * (const real& num) const;
|
||||
TCurrency& operator /= (const real& num);
|
||||
TCurrency operator / (const real& num) const;
|
||||
|
||||
const char* string(bool dotted = FALSE) const;
|
||||
void read(const TRectype& rec, const char* field, const char *val = NULL);
|
||||
void write(TRectype& rec, const char* field, const char *val = NULL, bool forceval = FALSE) const;
|
||||
void read(const TRectype& rec, const char* field, const char *val = NULL, const char *exchange = NULL);
|
||||
void write(TRectype& rec, const char* field, const char *val = NULL, const char *exchange = NULL, bool forceval = FALSE) const;
|
||||
int decimals() const;
|
||||
|
||||
TCurrency();
|
||||
TCurrency(const TCurrency& cur);
|
||||
TCurrency(const real& num, const char* val = "");
|
||||
TCurrency(bool price = FALSE) : _price(price) { _val[0] = '\0'; }
|
||||
TCurrency(const TCurrency& cur) { copy(cur); }
|
||||
TCurrency(const real& num, const char* val = "", const real& exchg = ZERO, bool price = FALSE);
|
||||
virtual ~TCurrency() { }
|
||||
};
|
||||
|
||||
class TPrice : public TCurrency
|
||||
{
|
||||
public:
|
||||
const TPrice& operator=(const TPrice& cur) { copy(cur); return *this; }
|
||||
|
||||
TPrice() : TCurrency(TRUE) { }
|
||||
TPrice(const TPrice& price) { copy(price); }
|
||||
TPrice(const real& num, const char* val = "", const real& exc = ZERO)
|
||||
: TCurrency(num, val, exc, TRUE) { }
|
||||
virtual ~TPrice() { }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -15,8 +15,7 @@
|
||||
// Utility functions
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
HIDDEN TDate __tmp_date;
|
||||
HIDDEN char __date_tmp_string[128];
|
||||
HIDDEN TString __date_tmp_string(80);
|
||||
HIDDEN const byte _days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
|
||||
TDate::TDate(const TDate &d) : _val(d._val)
|
||||
@ -295,7 +294,7 @@ char* TDate::string(
|
||||
|
||||
// build date string
|
||||
|
||||
TFixed_string dfm(__date_tmp_string, 128);
|
||||
TString& dfm = __date_tmp_string;
|
||||
dfm.cut(0);
|
||||
|
||||
switch (ord)
|
||||
@ -323,7 +322,7 @@ char* TDate::string(
|
||||
break;
|
||||
}
|
||||
|
||||
return __date_tmp_string;
|
||||
return dfm.get_buffer();
|
||||
}
|
||||
|
||||
long TDate::date2julian() const
|
||||
@ -376,8 +375,10 @@ int TDate::year() const
|
||||
|
||||
int TDate::week() const
|
||||
{
|
||||
const TDate y(1, 1, year());
|
||||
return (int) ((date2julian()-y.date2julian())/7 )+1;
|
||||
TDate y(1, 1, year());
|
||||
const int w = y.wday();
|
||||
if (w > 1) y -= w-1;
|
||||
return int((*this - y) / 7 + 1);
|
||||
}
|
||||
|
||||
|
||||
@ -447,6 +448,17 @@ bool TDate::ok() const
|
||||
return _val > 0;
|
||||
}
|
||||
|
||||
TDate& TDate::operator +=(long nday)
|
||||
{
|
||||
const long d = day() + nday;
|
||||
if (d > 0 && d < 29)
|
||||
_val += nday;
|
||||
else
|
||||
_val = julian2date(date2julian() + nday);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @func TDate& | operator + | Incrementa la data di un certo numero di giorni
|
||||
@ -459,14 +471,16 @@ TDate operator +(
|
||||
//
|
||||
// @comm E' indifferente quale parametro viene passato per primo
|
||||
{
|
||||
TDate tmp = a.julian2date(a.date2julian() + nday);
|
||||
TDate tmp(a);
|
||||
tmp += nday;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
TDate operator +(const long nday, const TDate& b)
|
||||
{
|
||||
TDate tmp = b.julian2date(b.date2julian() + nday);
|
||||
TDate tmp(b);
|
||||
tmp += nday;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -476,9 +490,9 @@ TDate operator +(const long nday, const TDate& b)
|
||||
TDate operator -(
|
||||
const TDate& a, // @parm Data da decrementare
|
||||
long nday) // @parm Numero di giorni da togliere
|
||||
|
||||
{
|
||||
TDate tmp = a.julian2date(a.date2julian() - nday);
|
||||
TDate tmp(a);
|
||||
tmp += -nday;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
@ -115,17 +115,16 @@ public:
|
||||
void set_format(const char* f);
|
||||
|
||||
// @cmember Incrementa la data di un certo numero di giorni
|
||||
TDate& operator +=(const long nday)
|
||||
{ _val = julian2date(date2julian() + nday); return *this; }
|
||||
TDate& operator +=(long nday);
|
||||
// @cmember Decrementa la data di un certo numero di giorni
|
||||
TDate& operator -=(const long nday)
|
||||
{ _val = julian2date(date2julian() - nday); return *this; }
|
||||
TDate& operator -=(long nday)
|
||||
{ return operator +=(nday); }
|
||||
// @cmember Incrementa la data di un giorno
|
||||
TDate& operator ++()
|
||||
{ _val = julian2date(date2julian() + 1); return *this; }
|
||||
{ return operator +=(1L); }
|
||||
// @cmember Decrementa la data di un giorno
|
||||
TDate& operator --()
|
||||
{ _val = julian2date(date2julian() - 1); return *this; }
|
||||
{ return operator +=(-1L); }
|
||||
|
||||
// @cmember Stampa sull'output passato la data
|
||||
void print_on(ostream& out) const ;
|
||||
|
@ -89,8 +89,8 @@ MENU BROWSE_BAR
|
||||
SUBMENU BROWSE_BAR+1 "~Proprieta'"
|
||||
|
||||
MENU BROWSE_BAR+1
|
||||
ITEM M_EDIT_SEL_ALL "~Salva impostazioni colonne"
|
||||
ITEM M_EDIT_UNDO "~Ripristina impostazioni colonne"
|
||||
ITEM M_EDIT_CLIPBOARD "~Salva impostazioni colonne"
|
||||
ITEM M_EDIT_UNDO "~Ripristina impostazioni colonne"
|
||||
SEPARATOR
|
||||
ITEM M_EDIT_SEARCH "~Informazioni"
|
||||
|
||||
|
102
include/isam.cpp
102
include/isam.cpp
@ -848,7 +848,7 @@ int TBaseisamfile::_write(const TRectype& rec)
|
||||
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
prefix().notify_change(_isam_handle);
|
||||
notify_change();
|
||||
#ifdef JOURNAL
|
||||
if (get_journal())
|
||||
{
|
||||
@ -902,7 +902,7 @@ int TBaseisamfile::_rewrite(const TRectype& rec)
|
||||
_lasterr = DB_rewrite(fhnd);
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
prefix().notify_change(_isam_handle);
|
||||
notify_change();
|
||||
#ifdef JOURNAL
|
||||
if (get_journal())
|
||||
{
|
||||
@ -972,7 +972,7 @@ int TBaseisamfile::_remove(const TRectype& rec)
|
||||
_lasterr = DB_delete(fhnd); // Put only deletion flag on record, must remove keys too!
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
prefix().notify_change(_isam_handle);
|
||||
notify_change();
|
||||
DB_flush(fhnd);
|
||||
#ifdef JOURNAL
|
||||
if (get_journal())
|
||||
@ -1163,6 +1163,17 @@ int TBaseisamfile::is_valid()
|
||||
return err;
|
||||
}
|
||||
|
||||
void TBaseisamfile::notify_change() const
|
||||
{
|
||||
prefix().notify_change(_isam_handle);
|
||||
}
|
||||
|
||||
bool TBaseisamfile::is_changed_since(long clk) const
|
||||
{
|
||||
const clock_t last = prefix().last_change(_isam_handle);
|
||||
return clk < last;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TLocalisamfile
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -2358,7 +2369,7 @@ TRectype::~TRectype()
|
||||
|
||||
void TRectype::unknown_field(const char* name) const
|
||||
{
|
||||
yesnofatal_box("Il campo '%s' non appartiene al file %d", name, _logicnum);
|
||||
NFCHECK("Il campo '%s' non appartiene al file %d", name, _logicnum);
|
||||
}
|
||||
|
||||
void TRectype::write_memo(int fhnd, const TRecnotype recno)
|
||||
@ -2519,9 +2530,7 @@ int TRectype::compare(const TSortable& s) const
|
||||
const int sz = rd.Fd[i].Len;
|
||||
const bool number = (typ == _intfld) || (typ == _realfld) ||
|
||||
(typ == _longfld) || (typ == _wordfld) ||
|
||||
(typ == _intzerofld) || (typ == _longzerofld)
|
||||
|
||||
|| (typ == _datefld) ;
|
||||
(typ == _intzerofld) || (typ == _longzerofld) || (typ == _datefld) ;
|
||||
|
||||
if (fld_empty(b, sz, number)) continue;
|
||||
res = ::fld_cmp(a, b, sz, number);
|
||||
@ -2533,38 +2542,42 @@ int TRectype::compare(const TSortable& s) const
|
||||
TFieldtypes TRectype::type(const char* fieldname) const
|
||||
{
|
||||
const RecDes* recd = rec_des();
|
||||
int p;
|
||||
int p = findfld(recd, fieldname);
|
||||
|
||||
if ((p = findfld(recd, fieldname)) != -1) return (TFieldtypes) recd->Fd[p].TypeF;
|
||||
else return _nullfld;
|
||||
if (p != FIELDERR)
|
||||
return (TFieldtypes) recd->Fd[p].TypeF;
|
||||
else
|
||||
return _nullfld;
|
||||
}
|
||||
|
||||
|
||||
int TRectype::length(const char* fieldname) const
|
||||
|
||||
{
|
||||
int p;
|
||||
const RecDes * recd = rec_des();
|
||||
int p = findfld(recd, fieldname);
|
||||
|
||||
if ((p = findfld(recd, fieldname)) != -1) return(recd->Fd[p].Len);
|
||||
else return(0);
|
||||
if (p != FIELDERR)
|
||||
return(recd->Fd[p].Len);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int TRectype::ndec(const char* fieldname) const
|
||||
|
||||
{
|
||||
int p;
|
||||
const RecDes * recd = rec_des();
|
||||
int p = findfld(recd, fieldname);
|
||||
|
||||
if ((p = findfld(recd, fieldname)) != -1) return(recd->Fd[p].Dec);
|
||||
else return(0);
|
||||
if (p != FIELDERR)
|
||||
return(recd->Fd[p].Dec);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
bool TRectype::exist(const char* fieldname) const
|
||||
{
|
||||
const bool ok = findfld(rec_des(), (char*)fieldname) != FIELDERR;
|
||||
const bool ok = findfld(rec_des(), fieldname) != FIELDERR;
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -2775,7 +2788,10 @@ void TRectype::put_str(const char* fieldname, const char* val)
|
||||
const RecDes* recd = rec_des();
|
||||
const int nf = findfld(recd, fieldname);
|
||||
if (nf == FIELDERR)
|
||||
{
|
||||
unknown_field(fieldname);
|
||||
return;
|
||||
}
|
||||
const TFieldtypes ft = (TFieldtypes)recd->Fd[nf].TypeF;
|
||||
|
||||
if (val == NULL)
|
||||
@ -2960,22 +2976,24 @@ const char* TRectype::key(int numkey) const
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TRecfield::set(int from, int to)
|
||||
|
||||
{
|
||||
int nf;
|
||||
RecDes* rd = _rec->rec_des();
|
||||
|
||||
if ((nf = findfld(rd, _name)) == FIELDERR)
|
||||
const RecDes* rd = _rec->rec_des();
|
||||
const int nf = findfld(rd, _name);
|
||||
if (nf == FIELDERR)
|
||||
{
|
||||
_p = NULL;
|
||||
_len = 0;
|
||||
NFCHECK("File n. %d unknown field %s", _rec->num(), _name);
|
||||
_p = _isam_string;
|
||||
_len = 50;
|
||||
_dec = 0;
|
||||
_type = _nullfld;
|
||||
yesnofatal_box("File n. %d unknown field %s", _rec->num(), _name);
|
||||
_type = _alfafld;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK(from >= 0, "Invalid Start");
|
||||
if (from < 0)
|
||||
{
|
||||
NFCHECK("Invalid Start %d", from);
|
||||
from = 0;
|
||||
}
|
||||
_p = _rec->string() + rd->Fd[nf].RecOff + from;
|
||||
_dec = rd->Fd[nf].Dec;
|
||||
_type = (TFieldtypes)rd->Fd[nf].TypeF;
|
||||
@ -2984,12 +3002,12 @@ void TRecfield::set(int from, int to)
|
||||
CHECK(from <= to && to <= rd->Fd[nf].Len, "Invalid Range");
|
||||
_len = to - from + 1;
|
||||
}
|
||||
else _len = rd->Fd[nf].Len - from;
|
||||
else
|
||||
_len = rd->Fd[nf].Len - from;
|
||||
}
|
||||
}
|
||||
|
||||
TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
||||
|
||||
{
|
||||
strcpy(_name, name);
|
||||
_rec = &rec;
|
||||
@ -2997,20 +3015,20 @@ TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
||||
}
|
||||
|
||||
int TRecfield::operator =(int i)
|
||||
|
||||
{
|
||||
sprintf(_isam_string, "%d", i);
|
||||
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
|
||||
char buff[16];
|
||||
sprintf(buff, "%d", i);
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
_rec->setempty(FALSE);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
long TRecfield::operator =(long l)
|
||||
|
||||
{
|
||||
sprintf(_isam_string, "%ld", l);
|
||||
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
|
||||
char buff[16];
|
||||
sprintf(buff, "%ld", l);
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
_rec->setempty(FALSE);
|
||||
return l;
|
||||
}
|
||||
@ -3020,8 +3038,9 @@ long TRecfield::operator =(long l)
|
||||
|
||||
const real& TRecfield::operator =(const real& r)
|
||||
{
|
||||
strcpy(_isam_string, r.string());
|
||||
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
|
||||
char buff[80];
|
||||
strcpy(buff, r.string());
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
_rec->setempty(FALSE);
|
||||
return r;
|
||||
}
|
||||
@ -3031,8 +3050,9 @@ const real& TRecfield::operator =(const real& r)
|
||||
|
||||
const TDate& TRecfield::operator =(const TDate& d)
|
||||
{
|
||||
strcpy(_isam_string, (const char*)d);
|
||||
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
|
||||
char buff[16];
|
||||
strcpy(buff, (const char*)d);
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
_rec->setempty(FALSE);
|
||||
return d;
|
||||
}
|
||||
|
@ -497,6 +497,11 @@ public:
|
||||
// @cmember Setta il record corrente con il contenuto del record <p rec>
|
||||
TRectype& operator =(const TRectype& rec)
|
||||
{ return curr() = rec;}
|
||||
|
||||
// @cmember Notifica che il file e' stato modificato
|
||||
void notify_change() const;
|
||||
// @cmember Testa se il file e' cambiato dal ciclo di clock <p clk>
|
||||
bool is_changed_since(long clk) const;
|
||||
|
||||
// @cmember Costruttore
|
||||
TBaseisamfile(int logicnum);
|
||||
|
@ -62,7 +62,7 @@ void TMask::init_mask()
|
||||
_msg_field = 0;
|
||||
_msg_key = 0;
|
||||
_pages = 0; // Azzera numero pagine
|
||||
_sheet = NULL; // Non appartiene a nessuno sheet
|
||||
if (_mask_num == 0) _sheet = NULL; // Non appartiene a nessuno sheet
|
||||
|
||||
_enabled.set(MAX_PAGES);
|
||||
_enabled.set(); // Abilita tutte le pagine
|
||||
@ -72,7 +72,6 @@ void TMask::init_mask()
|
||||
_page = -1; // Nessuna pagina corrente
|
||||
_handler = NULL; // Nessun handler utente
|
||||
_mode = NO_MODE; // Inizializza modo
|
||||
_exchange = 1.0; // Il cambio per la valuta e' la lira
|
||||
|
||||
_error_severity = 0;
|
||||
_msg_field = 0;
|
||||
@ -120,6 +119,8 @@ void TMask::read_mask(
|
||||
|
||||
if (num == 0)
|
||||
_total_time = _build_time = _init_time = 0;
|
||||
else
|
||||
_mask_num = num;
|
||||
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
@ -700,7 +701,7 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
||||
case M_EDIT_UNDO:
|
||||
if (_last_sheet)
|
||||
_last_sheet->reset_columns_order();
|
||||
case M_EDIT_SEL_ALL:
|
||||
case M_EDIT_CLIPBOARD:
|
||||
if (_last_sheet)
|
||||
_last_sheet->save_columns_order();
|
||||
break;
|
||||
@ -1069,6 +1070,14 @@ TDate TMask::get_date(short fld_id) const
|
||||
return TDate(s);
|
||||
}
|
||||
|
||||
TCurrency& TMask::get_currency(short fld_id, TCurrency& curr) const
|
||||
{
|
||||
const TMask_field& f = field(fld_id);
|
||||
CHECKD(f.is_kind_of(CLASS_CURRENCY_FIELD), "Not a currency field ", fld_id);
|
||||
const TCurrency_field& cf = (const TCurrency_field&)f;
|
||||
return cf.get_currency(curr);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Setta il campo con un valore
|
||||
@ -1100,7 +1109,7 @@ void TMask::set(short fld_id, long n, bool hit)
|
||||
|
||||
void TMask::set(short fld_id, const real& n, bool hit)
|
||||
{
|
||||
CHECK(field(fld_id).is_kind_of(CLASS_REAL_FIELD), "Can't set a real value in a non-number field");
|
||||
CHECK(field(fld_id).is_edit(), "Can't set a real value in a non-edit field");
|
||||
set(fld_id, n.string(), hit);
|
||||
}
|
||||
|
||||
@ -1110,6 +1119,13 @@ void TMask::set(short fld_id, const TDate& d, bool hit)
|
||||
set(fld_id, d.string(), hit);
|
||||
}
|
||||
|
||||
void TMask::set(short fld_id, const TCurrency& c, bool hit)
|
||||
{
|
||||
CHECK(field(fld_id).is_kind_of(CLASS_CURRENCY_FIELD), "Can't set a currency in a non-currency field");
|
||||
((TCurrency_field&)field(fld_id)).set(c, hit);
|
||||
}
|
||||
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Permette di attivare/disattivare tutta la pagina
|
||||
@ -1340,16 +1356,19 @@ void TMask::autosave(TRelation& r) const
|
||||
|
||||
void TMask::on_firm_change()
|
||||
{
|
||||
TString firm; firm << prefix().get_codditta();
|
||||
TString16 firm, valuta;
|
||||
|
||||
for (int i = fields()-1; i >= 0; i--)
|
||||
{
|
||||
TMask_field& f = fld(i);
|
||||
if (f._flags.firm)
|
||||
{
|
||||
if (firm.empty())
|
||||
firm << prefix().get_codditta();
|
||||
f.set(firm);
|
||||
f.check(STARTING_CHECK);
|
||||
f.on_hit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1867,30 +1886,6 @@ void TMask::post_error_message(const char* msg, int sev)
|
||||
_error_severity = sev;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Setta il valore attuale della valuta
|
||||
void TMask::set_exchange(
|
||||
bool show_value, // @parm Indica se il deve essere visibile l'importo in valuta
|
||||
const real& n) // @parm Indica il cambio attuale della valuta
|
||||
{
|
||||
const real nuo = (n.sign() <= 0) ? _exchange : n;
|
||||
|
||||
TWait_cursor hourglass;
|
||||
for (int i = fields()-1; i >= 0; i--)
|
||||
{
|
||||
TMask_field& f = fld(i);
|
||||
if (f.is_operable())
|
||||
{
|
||||
TOperable_field& o = (TOperable_field&)f;
|
||||
if (o.exchangeable() || o.is_kind_of(CLASS_SHEET_FIELD))
|
||||
o.exchange(show_value, nuo);
|
||||
}
|
||||
}
|
||||
_exchange = nuo; // Update current exchange
|
||||
}
|
||||
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @mfunc costruttore di copia
|
||||
|
@ -10,6 +10,7 @@
|
||||
#endif
|
||||
|
||||
class TSheet_field;
|
||||
class TCurrency;
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
@ -88,8 +89,6 @@ class TMask : public TWindow
|
||||
// @cmember:(INTERNAL) Array per convertire da id a posizione
|
||||
TPointer_array _position;
|
||||
|
||||
// @cmember:(INTERNAL) Cambio attuale per i cambi in valuta
|
||||
real _exchange;
|
||||
// @cmember:(INTERNAL) Controlla se la maschera deve fare i controlli iniziali di validita' dei campi
|
||||
bool _should_check;
|
||||
|
||||
@ -128,8 +127,6 @@ protected:
|
||||
void init_mask();
|
||||
// @cmember Legge la pagina da file
|
||||
WINDOW read_page(TScanner& scanner, bool toolbar = FALSE);
|
||||
// @cmember Legge la maschera da file
|
||||
void read_mask(const char* name, int num, int max);
|
||||
|
||||
// @cmember Aggiunge i tags ad una pagina
|
||||
void add_tag_button(byte pag, TToken_string& tags, byte sel);
|
||||
@ -148,8 +145,6 @@ protected:
|
||||
// @cmember Ritorna il numero della pagina corrente
|
||||
int curr_page() const
|
||||
{ return _page; }
|
||||
// @cmember Costruttore (crea una maschera vuota)
|
||||
TMask();
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
@ -157,6 +152,10 @@ public:
|
||||
TMask(const char* title, int num = 0, int max = MAX_PAGES);
|
||||
// @cmember Costruttore (crea una maschera vuota con i parametri dati)
|
||||
TMask(const char* title, int pages, int cols, int rows, int xpos = -1, int ypos = -1);
|
||||
// @cmember Costruttore (crea una maschera vuota per leggerla con read_mask)
|
||||
TMask();
|
||||
// @cmember Legge la maschera da file
|
||||
void read_mask(const char* name, int num, int max);
|
||||
|
||||
// @cmember Distruttore
|
||||
virtual ~TMask();
|
||||
@ -226,12 +225,6 @@ public:
|
||||
void set_focus_field(short id);
|
||||
void notify_focus_field(short id);
|
||||
|
||||
// @cmember Setta il valore attuale della valuta
|
||||
void set_exchange(bool show_value, const real& nuo);
|
||||
// @cmember Ritorna il valore attuale del cambio
|
||||
const real& exchange() const
|
||||
{ return _exchange; }
|
||||
|
||||
// @cmember Controlla i campi di una maschera (TRUE se tutti validi)
|
||||
bool check_fields();
|
||||
// @cmember Esegue il check e i messaggi sul campo <p fld_id> della maschera
|
||||
@ -270,6 +263,8 @@ public:
|
||||
void set(short fld_id, const TDate& day, bool hit=FALSE);
|
||||
// @cmember Setta il campo con un valore
|
||||
void set(short fld_id, long num, bool hit=FALSE);
|
||||
// @cmember Setta il campo con un valore
|
||||
void set(short fld_id, const TCurrency& curr, bool hit=FALSE);
|
||||
// @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di stringa
|
||||
virtual const TString& get(short fld_id) const;
|
||||
// @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di long
|
||||
@ -284,7 +279,8 @@ public:
|
||||
real get_real(short fld_id) const;
|
||||
// @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di data
|
||||
TDate get_date(short fld_id) const;
|
||||
|
||||
// @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di TCurrency
|
||||
TCurrency& get_currency(short fld_id, TCurrency& cur) const;
|
||||
// @cmember Indica quale campo deve ricevere per primo il focus nella maschera
|
||||
int first_focus(short id);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <colors.h>
|
||||
#include <controls.h>
|
||||
#include <execp.h>
|
||||
#include <mask.h>
|
||||
#include <msksheet.h>
|
||||
#include <prefix.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
@ -48,7 +48,7 @@ TMask_field::TField_Flags::TField_Flags()
|
||||
uppercase = rightjust = FALSE;
|
||||
zerofilled = button = FALSE;
|
||||
dirty = focusdirty = FALSE;
|
||||
roman = exchange = FALSE;
|
||||
roman = FALSE;
|
||||
firm = ghost = FALSE;
|
||||
password = FALSE;
|
||||
trim = 3;
|
||||
@ -92,8 +92,6 @@ char TMask_field::TField_Flags::update(const char* f)
|
||||
rightjust = TRUE; break;
|
||||
case 'U':
|
||||
uppercase = TRUE; break;
|
||||
case 'V':
|
||||
exchange = TRUE; break;
|
||||
case 'Z':
|
||||
zerofilled = TRUE; break;
|
||||
default :
|
||||
@ -1182,7 +1180,8 @@ bool TEditable_field::parse_item(TScanner& scanner)
|
||||
const int pos = mask().id2pos(id);
|
||||
if (pos >= 0)
|
||||
{
|
||||
TEdit_field& driver = mask().efield(id);
|
||||
TOperable_field& driver = (TOperable_field&)mask().fld(pos);
|
||||
CHECKD(driver.is_kind_of(CLASS_OPERABLE_FIELD), "Field not operable ", id);
|
||||
_drivers->add(&driver);
|
||||
TString16 msg;
|
||||
msg.format("CHECK,%d", dlg());
|
||||
@ -1191,6 +1190,24 @@ bool TEditable_field::parse_item(TScanner& scanner)
|
||||
else
|
||||
NFCHECK("Non esiste ancora il campo driver %d", id);
|
||||
}
|
||||
else
|
||||
{
|
||||
TSheet_field* sheet = mask().get_sheet();
|
||||
if (sheet)
|
||||
{
|
||||
const int pos = sheet->mask().id2pos(-id);
|
||||
if (pos >= 0)
|
||||
{
|
||||
TMask_field& driver = sheet->mask().fld(pos);
|
||||
CHECKD(driver.is_kind_of(CLASS_OPERABLE_FIELD), "Field not operable ", -id);
|
||||
_drivers->add(&driver);
|
||||
}
|
||||
else
|
||||
NFCHECK("Non esiste il campo driver %d nella maschera principale", id);
|
||||
}
|
||||
else
|
||||
NFCHECK("Non esiste il campo driver %d", id);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -2267,11 +2284,12 @@ bool TBrowse::do_link(bool insert)
|
||||
_cursor->file().readat(_rec);
|
||||
ok = _cursor->ok();
|
||||
if (ok)
|
||||
{
|
||||
do_output();
|
||||
#ifdef DBG
|
||||
_cursor->file().notify_change();
|
||||
}
|
||||
else
|
||||
yesnofatal_box("Selezione da programma esterno errata");
|
||||
#endif
|
||||
NFCHECK("Selezione da programma esterno errata");
|
||||
}
|
||||
::remove(msg);
|
||||
}
|
||||
@ -3520,12 +3538,6 @@ bool TReal_field::parse_item(TScanner& scanner)
|
||||
_decimals = _picture.len() - comma - 1;
|
||||
}
|
||||
}
|
||||
//#ifdef DBG
|
||||
// const int preferred_size = 19;
|
||||
// if (_ctl_data._size > 9 && _ctl_data._size != preferred_size)
|
||||
// ::warning_box("Guy propone una dimensione di %d per il campo %d: %s\nMa probabilmente ha toppato ...",
|
||||
// preferred_size, _ctl_data._dlg, (const char*)_ctl_data._prompt);
|
||||
//#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -3645,11 +3657,6 @@ const char* TReal_field::raw2win(const char* data) const
|
||||
if (!real::is_null(data))
|
||||
{
|
||||
real n(data);
|
||||
if (exchangeable() && decimals())
|
||||
{
|
||||
const real& e = mask().exchange();
|
||||
n /= e;
|
||||
}
|
||||
if (_picture.empty())
|
||||
{
|
||||
if (_flags.zerofilled)
|
||||
@ -3661,6 +3668,9 @@ const char* TReal_field::raw2win(const char* data) const
|
||||
{
|
||||
s = n.string(_picture);
|
||||
}
|
||||
const int extra = s.len() - _size;
|
||||
if (extra > 0)
|
||||
s.ltrim(extra);
|
||||
}
|
||||
else
|
||||
s.cut(0);
|
||||
@ -3693,11 +3703,6 @@ const char* TReal_field::win2raw(const char* data) const
|
||||
else
|
||||
{
|
||||
real n(real::ita2eng(data));
|
||||
if (exchangeable() && decimals())
|
||||
{
|
||||
const real& e = mask().exchange();
|
||||
n *= e;
|
||||
}
|
||||
if (n.is_zero())
|
||||
str.cut(0);
|
||||
else
|
||||
@ -3722,50 +3727,68 @@ void TReal_field::set_decimals(int d)
|
||||
}
|
||||
}
|
||||
|
||||
void TReal_field::exchange(bool show_value, const real& nuo)
|
||||
{
|
||||
const int dec = show_value ? 2 : 0; // Quanti decimali voglio
|
||||
const bool value = decimals() != 0; // Sono attualmente in valuta ?
|
||||
|
||||
if (show_value == value && show_value) return; // Se cambio da valuta a valuta esco subito!
|
||||
|
||||
if (mask().is_running())
|
||||
{
|
||||
const char* n = get_window_data();
|
||||
if (*n)
|
||||
{
|
||||
const real& vec = mask().exchange();
|
||||
real r(n);
|
||||
if (!show_value)
|
||||
r *= nuo;
|
||||
r /= vec;
|
||||
r.round(dec);
|
||||
set_decimals(dec);
|
||||
TEdit_field::set_window_data(r.string(_picture));
|
||||
}
|
||||
}
|
||||
|
||||
if (decimals() != dec)
|
||||
set_decimals(dec);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Currency_field
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#include <currency.h>
|
||||
|
||||
// Certified 100%
|
||||
word TCurrency_field::class_id() const
|
||||
{ return CLASS_CURRENCY_FIELD; }
|
||||
|
||||
// Certified 100%
|
||||
bool TCurrency_field::is_kind_of(word cid) const
|
||||
{ return cid == CLASS_CURRENCY_FIELD || TEdit_field::is_kind_of(cid); }
|
||||
|
||||
TCurrency& TCurrency_field::get_currency(TCurrency& cur) const
|
||||
{
|
||||
const real num = get();
|
||||
const char* value = NULL;
|
||||
real exchange;
|
||||
const TMask_field* d0 = driver(0);
|
||||
const TMask_field* d1 = driver(1);
|
||||
if (d0)
|
||||
value = d0->get();
|
||||
else
|
||||
value = "_FIRM";
|
||||
if (d1)
|
||||
exchange = real(d1->get());
|
||||
cur.set_num(num);
|
||||
cur.force_value(value, exchange);
|
||||
cur.set_price(_flags.uppercase);
|
||||
return cur;
|
||||
}
|
||||
|
||||
void TCurrency_field::set(const TCurrency& cur, bool hit)
|
||||
{
|
||||
TMask_field* d0 = (TMask_field*)driver(0);
|
||||
if (d0) d0->set(cur.get_value());
|
||||
TEdit_field::set(cur.get_num().string());
|
||||
if (hit)
|
||||
on_hit();
|
||||
}
|
||||
|
||||
const char* TCurrency_field::raw2win(const char* data) const
|
||||
{
|
||||
const real num = data;
|
||||
if (num == ZERO)
|
||||
return "";
|
||||
const char* value = NULL;
|
||||
if (driver(0))
|
||||
value = driver(0)->get();
|
||||
const TMask_field* d0 = driver(0);
|
||||
if (d0)
|
||||
value = d0->get();
|
||||
else
|
||||
value = "_FIRM";
|
||||
|
||||
TCurrency cur(num, value, ZERO, _flags.uppercase);
|
||||
|
||||
TCurrency cur(num, value);
|
||||
return cur.string(TRUE);
|
||||
TString& s = _ctl_data._park;
|
||||
s = cur.string(TRUE);
|
||||
const int extra = s.len() - size();
|
||||
if (extra > 0) s.ltrim(extra);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
const char* TCurrency_field::win2raw(const char* data) const
|
||||
@ -3783,41 +3806,37 @@ bool TCurrency_field::on_key(KEY key)
|
||||
const TString& raw = get_window_data();
|
||||
set_window_data(raw2win(raw));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_ctl->is_edit_key(key))
|
||||
{
|
||||
bool ok = TRUE;
|
||||
switch (key)
|
||||
{
|
||||
case '-':
|
||||
ok = !_flags.uppercase;
|
||||
break;
|
||||
default :
|
||||
ok = strchr("0123456789.,", key) != NULL;
|
||||
break;
|
||||
}
|
||||
if (!ok)
|
||||
beep();
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
return TEdit_field::on_key(key);
|
||||
}
|
||||
|
||||
bool TCurrency_field::autosave(TRelation& r)
|
||||
{
|
||||
if (field())
|
||||
{
|
||||
int file = field()->file();
|
||||
const TString& name = field()->name();
|
||||
const char* value = NULL;
|
||||
if (driver(0))
|
||||
value = driver(0)->get();
|
||||
const real num = get();
|
||||
const TCurrency cur(num, value);
|
||||
cur.write(r.curr(file), name, value);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
return TEditable_field::autosave(r);
|
||||
}
|
||||
|
||||
bool TCurrency_field::autoload(const TRelation& r)
|
||||
{
|
||||
if (field())
|
||||
{
|
||||
int file = field()->file();
|
||||
const TString& name = field()->name();
|
||||
const char* value = NULL;
|
||||
if (driver(0))
|
||||
value = driver(0)->get();
|
||||
TCurrency cur;
|
||||
cur.read(r.curr(file), name, value);
|
||||
set(cur.string());
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
return TEditable_field::autoload(r);
|
||||
}
|
||||
|
||||
void TCurrency_field::parse_head(TScanner& scanner)
|
||||
@ -3830,7 +3849,7 @@ void TCurrency_field::parse_head(TScanner& scanner)
|
||||
|
||||
void TCurrency_field::create(WINDOW w)
|
||||
{
|
||||
_ctl_data._flags.strip("AMVZ");
|
||||
_ctl_data._flags.strip("AMZ");
|
||||
_ctl_data._flags << 'R';
|
||||
TEdit_field::create(w);
|
||||
}
|
||||
@ -4104,8 +4123,7 @@ void TList_field::set(const char* data)
|
||||
{
|
||||
const int i = str2curr(data);
|
||||
current(i);
|
||||
// if (mask().is_running())
|
||||
set_dirty();
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void TList_field::set_window_data(const char* data)
|
||||
|
@ -23,6 +23,8 @@ class TFieldref;
|
||||
|
||||
class TArray_sheet; // __SHEET_H
|
||||
|
||||
class TCurrency; // __CURRENCY_H
|
||||
|
||||
class TMask_field; // Convenience
|
||||
|
||||
|
||||
@ -112,7 +114,6 @@ protected:
|
||||
bool show_default : 1;
|
||||
byte trim : 2; // Trim the string
|
||||
bool uppercase : 1;
|
||||
bool exchange : 1; // Value exchange
|
||||
bool zerofilled : 1;
|
||||
bool pipeallowed : 1;
|
||||
|
||||
@ -216,9 +217,6 @@ public:
|
||||
// @cmember Ritorna TRUE se si tratta di campo fantasma
|
||||
bool ghost() const
|
||||
{ return _flags.ghost; }
|
||||
// @cmember Ritorna TRUE se si tratta di campo in valuta
|
||||
bool exchangeable() const
|
||||
{ return _flags.exchange; }
|
||||
|
||||
// @cmember Controlla se il campo appartiene ad una chiave di ricerca
|
||||
virtual bool in_key(word) const
|
||||
@ -380,7 +378,6 @@ public:
|
||||
// @field bool | show_default: 1 | Indica se il campo e' visibile di default
|
||||
// @field bool | trim: 1 | Indica se bisogna fare il trim della stringa (vedi <mf TString::trim>)
|
||||
// @field bool | uppercase: 1 | Indica se il campo e' maiuscolo
|
||||
// @field bool | exchange: 1 | Indica se si tratta di un cambio valuta
|
||||
// @field bool | zerofilled: 1 | Indica se il campo e' zerofilled
|
||||
// @field bool | pipeallowed: 1 | Indica se il campo e' pipeallowed
|
||||
// @field void | TField_Flags() | Costruttore
|
||||
@ -439,8 +436,6 @@ protected: // TMask_field
|
||||
virtual bool is_operable() const { return TRUE; }
|
||||
virtual bool on_hit();
|
||||
|
||||
TToken_string* message(int m, bool crea = FALSE);
|
||||
|
||||
// @cmember Setta il focus sul campo
|
||||
virtual void highlight() const;
|
||||
|
||||
@ -451,6 +446,8 @@ public:
|
||||
virtual void on_idle()
|
||||
{}
|
||||
|
||||
// @cmember Ritorna il messaggio <p n>-esimo del campo
|
||||
TToken_string* message(int m, bool crea = FALSE);
|
||||
// @cmember Esegue il messaggio <p n>-esimo sul campo
|
||||
bool do_message(int n);
|
||||
|
||||
@ -471,10 +468,6 @@ public:
|
||||
// @cmember Abilita/disabilita il campo (lo rende scrivibile) (vedi <mf TMask_field::enable>)
|
||||
virtual void enable(bool on = TRUE);
|
||||
|
||||
// @cmember Setta il valore del cambio nel campo
|
||||
virtual void exchange(bool, const real&)
|
||||
{ }
|
||||
|
||||
TOperable_field(TMask* m);
|
||||
virtual ~TOperable_field();
|
||||
};
|
||||
@ -532,7 +525,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TLoadable_field | Classe per la gestione dei caricabili da DB
|
||||
@ -658,8 +650,8 @@ public:
|
||||
virtual bool is_editable() const { return TRUE; }
|
||||
|
||||
// @cmember Ritorna un eventuale campo driver
|
||||
const TEditable_field* driver(int n) const
|
||||
{ return _drivers ? (const TEditable_field*)_drivers->objptr(n) : NULL; }
|
||||
TOperable_field* driver(int n) const
|
||||
{ return _drivers ? (TOperable_field*)_drivers->objptr(n) : NULL; }
|
||||
|
||||
TEditable_field(TMask* m);
|
||||
virtual ~TEditable_field();
|
||||
@ -905,10 +897,6 @@ public:
|
||||
const TString& get_insert() const
|
||||
{ return _insert;}
|
||||
|
||||
// @cmember Setta il valore di <p _filter>
|
||||
void set_filter(const char* f)
|
||||
{ _filter = f;}
|
||||
|
||||
// @cmember Ritorna il valore di <p _filter>
|
||||
const TString& get_filter() const
|
||||
{ return _filter;}
|
||||
@ -1136,10 +1124,6 @@ protected: // TEditable_field
|
||||
// @cmember Gestisce la pressione del tasto (TRUE se la gestione ha avuto successo)
|
||||
virtual bool on_key(KEY key);
|
||||
|
||||
protected:
|
||||
// @cmember Setta il valore del cambio nel campo
|
||||
virtual void exchange(bool show_value, const real& n);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Setta la precisione (numero di decimali) del reale e la sua picture
|
||||
@ -1178,6 +1162,12 @@ protected: // TEditable_field
|
||||
virtual bool autoload(const TRelation& r);
|
||||
|
||||
public:
|
||||
virtual word class_id() const;
|
||||
virtual bool is_kind_of(word id) const;
|
||||
|
||||
void set(const TCurrency& cur, bool hit);
|
||||
TCurrency& get_currency(TCurrency& cur) const;
|
||||
|
||||
// @cmember Costruttore
|
||||
TCurrency_field(TMask* mask);
|
||||
// @cmember Distruttore
|
||||
|
@ -187,6 +187,8 @@ public:
|
||||
void activate(bool on);
|
||||
// @cmember Permette di abilitare/disabilitare una colonna
|
||||
void enable_column(int col, bool on = TRUE);
|
||||
// @cmember Permette di visualizzare/nascondere una colonna
|
||||
void show_column(int col, bool on = TRUE);
|
||||
// @cmember Permette di eliminare una colonna dallo spreadsheet
|
||||
void delete_column(const int col) const;
|
||||
// @cmember Sposta la colonna dalla posizione <p fromindex> alla posizione
|
||||
@ -294,7 +296,7 @@ TSpreadsheet::TSpreadsheet(
|
||||
const char* head, // @parm Titolo delle colonne
|
||||
TSheet_field* o) // @parm Indica il campo della maschera che contiene lo spreadsheet
|
||||
:
|
||||
_mask(maskname, maskno), _notify(NULL),
|
||||
_mask(), _notify(NULL),
|
||||
_cur_row(0), _cur_col(1), _cur_rec(0), _edit_field(NULL), _active(TRUE),
|
||||
_row_dirty(FALSE), _cell_dirty(FALSE), _check_enabled(TRUE),
|
||||
_needs_update(-1), _selection_posted(-1), _save_columns_order(FALSE)
|
||||
@ -304,7 +306,8 @@ TSpreadsheet::TSpreadsheet(
|
||||
int lines_in_header = 1; // Number of header lines
|
||||
|
||||
TControl::_fld = o;
|
||||
sheet_mask().set_sheet(o);
|
||||
_mask.set_sheet(o); // Collega la maschera allo sheet
|
||||
_mask.read_mask(maskname, maskno, 0); // Legge la maschera
|
||||
|
||||
// Calcolo larghezza massima tabella
|
||||
|
||||
@ -447,6 +450,7 @@ TSpreadsheet::TSpreadsheet(
|
||||
flags |= XI_ATR_RJUST;
|
||||
break;
|
||||
case CLASS_REAL_FIELD:
|
||||
case CLASS_CURRENCY_FIELD:
|
||||
flags |= XI_ATR_RJUST;
|
||||
break;
|
||||
case CLASS_BOOLEAN_FIELD:
|
||||
@ -512,9 +516,7 @@ int TSpreadsheet::row2rec(int& row)
|
||||
row = rows-1;
|
||||
}
|
||||
const int r = (int)handle[row];
|
||||
|
||||
CHECKD(r >= 0 && r < items(), "Sheet line out of range: ", row);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -526,7 +528,6 @@ int TSpreadsheet::rec2row(int record)
|
||||
int r = int(record - rec[0]);
|
||||
if (r < 0 || r >= rows)
|
||||
r = -1;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1032,7 +1033,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
|
||||
if (items() > 0 && !owner().append())
|
||||
{
|
||||
XI_OBJ* itf = get_interface();
|
||||
// XI_OBJ* itf = get_interface();
|
||||
if (owner().mask().focus_field().dlg() == owner().dlg())
|
||||
rec = _cur_rec + 1;
|
||||
else
|
||||
@ -1056,13 +1057,14 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
set_pos(xiev->v.select.xi_obj->v.row, 1);
|
||||
if (oldrec != _cur_rec)
|
||||
{
|
||||
_row_dirty = FALSE;
|
||||
_row_dirty = _cell_dirty = FALSE;
|
||||
str2mask(_cur_rec);
|
||||
on_idle(); // Forces update delayed by str2mask
|
||||
}
|
||||
|
||||
if (xiev->v.select.column > 0)
|
||||
{
|
||||
str2mask(_cur_rec);
|
||||
// str2mask(_cur_rec); // Spostato sopra
|
||||
TOperable_field* f = col2field(xiev->v.select.column);
|
||||
if (f && f->active())
|
||||
{
|
||||
@ -1085,7 +1087,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
TMask_field& button = sm.fld(button_pos);
|
||||
if (button.active())
|
||||
{
|
||||
str2mask(_cur_rec);
|
||||
// str2mask(_cur_rec); // Spostato sopra
|
||||
button.on_hit();
|
||||
if (sm.dirty())
|
||||
{
|
||||
@ -1094,9 +1096,9 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
}
|
||||
}
|
||||
}
|
||||
_check_enabled = TRUE;
|
||||
owner().highlight();
|
||||
}
|
||||
_check_enabled = TRUE;
|
||||
}
|
||||
refused = TRUE;
|
||||
break;
|
||||
@ -1178,7 +1180,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
if (_cur_rec < items() && notify(_cur_rec, K_TAB))
|
||||
{
|
||||
/* Guy! str2mask(_cur_rec); */
|
||||
_row_dirty = FALSE;
|
||||
_row_dirty = _cell_dirty = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1824,6 +1826,19 @@ void TSpreadsheet::enable_column(
|
||||
}
|
||||
}
|
||||
|
||||
void TSpreadsheet::show_column(int col, bool on)
|
||||
{
|
||||
CHECK(0, "xi_set_attrib(column, XI_ATR_VISIBLE) doesn't work!");
|
||||
XI_OBJ* column = find_column(col);
|
||||
if (column)
|
||||
{
|
||||
dword attr = xi_get_attrib(column);
|
||||
if (on) attr |= XI_ATR_VISIBLE;
|
||||
else attr &= ~XI_ATR_VISIBLE;
|
||||
xi_set_attrib(column, attr); // Set new attributes
|
||||
}
|
||||
}
|
||||
|
||||
void TSpreadsheet::delete_column( const int col ) const
|
||||
{
|
||||
XI_OBJ* column = find_column(col);
|
||||
@ -1831,7 +1846,6 @@ void TSpreadsheet::delete_column( const int col ) const
|
||||
xi_delete(column);
|
||||
}
|
||||
|
||||
|
||||
void TSpreadsheet::move_column( const int fromindex, const int toindex) const
|
||||
{
|
||||
int num;
|
||||
@ -2435,7 +2449,13 @@ bool TSheet_field::cell_disabled(int row, int column) const
|
||||
return s->cell_disabled(row, column);
|
||||
}
|
||||
|
||||
// Matteo
|
||||
void TSheet_field::show_column(int col, bool on) const
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
s->show_column(col, on);
|
||||
}
|
||||
|
||||
// Matteo was here!
|
||||
void TSheet_field::delete_column( const int col ) const
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
@ -2553,48 +2573,6 @@ void TSheet_field::on_idle()
|
||||
((TSpreadsheet*)_ctl)->on_idle();
|
||||
}
|
||||
|
||||
void TSheet_field::exchange(bool show_value, const real& nuo)
|
||||
{
|
||||
TMask& m = sheet_mask();
|
||||
|
||||
const real& vec = mask().exchange();
|
||||
|
||||
if (vec != nuo)
|
||||
{
|
||||
TBit_array valuta(TSpreadsheet::MAX_COL);
|
||||
int i = 0;
|
||||
for (int f = FIRST_FIELD; ;f++, i++)
|
||||
{
|
||||
const int pos = m.id2pos(f);
|
||||
if (pos < 0) break;
|
||||
if (m.fld(pos).class_id() == CLASS_REAL_FIELD)
|
||||
{
|
||||
if (m.fld(pos).exchangeable())
|
||||
valuta.set(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int riga = 0; riga < items(); riga++)
|
||||
{
|
||||
TToken_string& r = row(riga);
|
||||
for (const char* s = r.get(i = 0); s; s = r.get(++i))
|
||||
if (*s > ' ' && valuta[i])
|
||||
{
|
||||
real v(s);
|
||||
v *= nuo;
|
||||
v /= vec;
|
||||
v.round();
|
||||
r.add(v.string(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.set_exchange(show_value, nuo);
|
||||
|
||||
if (mask().is_running())
|
||||
force_update();
|
||||
}
|
||||
|
||||
// Ricopia i campi della maschera nel record dato
|
||||
void TSheet_field::mask2row(int n, TToken_string & rec)
|
||||
{
|
||||
@ -2709,7 +2687,6 @@ void TSheet_field::set_back_and_fore_color(COLOR back, COLOR fore, int row)
|
||||
s.set_back_and_fore_color(back, fore, row);
|
||||
}
|
||||
|
||||
|
||||
void TSheet_field::reset_columns_order()
|
||||
{
|
||||
TSpreadsheet& s = (TSpreadsheet&)*_ctl;
|
||||
|
@ -90,8 +90,6 @@ protected:
|
||||
|
||||
// @cmember Setta il focus sul campo
|
||||
virtual void highlight() const;
|
||||
// @cmember Permette di settare il valore del cambio del campo
|
||||
virtual void exchange(bool show_value, const real& n);
|
||||
// @cmember Ricopia i campi della maschera nel record <p n>-esimo
|
||||
virtual void mask2row(int n, TToken_string & rec);
|
||||
// @cmember Ricopia i campi del record <p n>-esimo nella maschera
|
||||
@ -188,7 +186,8 @@ public:
|
||||
bool column_enabled(int column) const;
|
||||
// @cmember Controlla se una colonna e' disabilitata (vedi <mf TSpreadsheet::column_disabled>)
|
||||
bool column_disabled(int column) const;
|
||||
|
||||
// @cmember Permette di visualizzare una colonna dello spreadsheet
|
||||
void show_column(int col, bool on) const;
|
||||
// @cmember Permette di eliminare una colonna dallo spreadsheet
|
||||
void delete_column( const int col ) const;
|
||||
// @cmember Sposta la colonna dalla posizione <p fromindex> alla posizione
|
||||
|
@ -147,9 +147,7 @@ int TMultiple_rectype::compare(const TSortable& s) const
|
||||
void TMultiple_rectype::remove_body(int logicnum)
|
||||
{
|
||||
const int index = log2ind(logicnum);
|
||||
|
||||
if (_files.objptr(index) != NULL)
|
||||
_files.remove(index);
|
||||
_files.destroy(index);
|
||||
}
|
||||
|
||||
int TMultiple_rectype::log2ind(int logicnum) const
|
||||
@ -297,30 +295,6 @@ int TMultiple_rectype::loaded_rows(int logicnum) const
|
||||
return r->rows();
|
||||
}
|
||||
|
||||
// @mfunc confronta due record multipli
|
||||
int TMultiple_rectype::compare(const TSortable& s) const
|
||||
{
|
||||
int res = TRectype::compare(s);
|
||||
TMultiple_rectype & m = (TMultiple_rectype &) s;
|
||||
for (int i = 0 ; res == 0 && i < _nfiles; i++)
|
||||
{
|
||||
int logicnum = _logicnums[i];
|
||||
TRecord_array & r = body(logicnum);
|
||||
TRecord_array & r1 = m.body(logicnum);
|
||||
res = r.rows() - r1.rows();
|
||||
if (res == 0 && r.rows() > 0 && r1.rows() > 0)
|
||||
{
|
||||
for (int j = r.last_row(), k = r1.last_row(); res == 0 && j > 0 && k > 0; j = r.pred_row(j), k = r1.pred_row(k))
|
||||
{
|
||||
res = j - k;
|
||||
if (res == 0)
|
||||
res = r[j] != r1[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TMultiple_rectype::remove(TBaseisamfile & f) const
|
||||
{
|
||||
int err = NOERR;
|
||||
|
@ -663,7 +663,6 @@ void TFile_manager::unlock_record(TIsam_handle num, TRecnotype rec)
|
||||
i.unlock_record(rec);
|
||||
}
|
||||
|
||||
|
||||
const RecDes& TFile_manager::get_recdes(int logicnum) const
|
||||
{
|
||||
const TRecord_info& i = recinfo(logicnum);
|
||||
|
@ -175,7 +175,8 @@ void TIndwin::update_bar()
|
||||
|
||||
void TIndwin::update()
|
||||
{
|
||||
if (_bar) update_bar();
|
||||
if (_bar)
|
||||
update_bar();
|
||||
}
|
||||
|
||||
bool TIndwin::on_key(KEY k)
|
||||
@ -203,14 +204,18 @@ TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
|
||||
bool TProgind::setstatus(long l)
|
||||
{
|
||||
CHECK(l >= 0, "Bad progind status");
|
||||
if (l < 0)
|
||||
{
|
||||
NFCHECK("Negative progind status");
|
||||
l = 0;
|
||||
}
|
||||
const long old_perc = _status * 100L / _max;
|
||||
_status = l > _max ? _max : l;
|
||||
const long new_perc = _status * 100L / _max;
|
||||
const bool tictac = new_perc != old_perc;
|
||||
if (tictac)
|
||||
{
|
||||
update_bar();
|
||||
update();
|
||||
do_events();
|
||||
}
|
||||
return tictac;
|
||||
|
@ -48,6 +48,8 @@
|
||||
#define RDOC_QTAGG3 "QTAGG3"
|
||||
#define RDOC_QTAGG4 "QTAGG4"
|
||||
#define RDOC_QTAGG5 "QTAGG5"
|
||||
#define RDOC_IMPIANTO "IMPIANTO"
|
||||
#define RDOC_LINEA "LINEA"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ char* real::points (int dec) const
|
||||
{
|
||||
const char *str = stringa (0, dec);
|
||||
const int neg = (*str == '-') ? 1 : 0;
|
||||
TFixed_string n ((char *)str, 24);
|
||||
TFixed_string n ((char *)str, 64);
|
||||
int i;
|
||||
|
||||
int dot = n.find (',');
|
||||
|
@ -1253,17 +1253,17 @@ bool TRelation_application::parse_command_line()
|
||||
{
|
||||
ini = argv(i);
|
||||
ini.upper();
|
||||
if (ini.left(2) == "-I" || ini.left(2) == "/I")
|
||||
if ((ini[0] == '-' || ini[0] == '/') && ini[1] == 'I')
|
||||
{
|
||||
TString16 ininame(ini.mid(2));
|
||||
CHECK(!ininame.blank(),"Manca l'indicazione della transazione. Il nome va indicato di seguito al -i, senza interporre spaziatura.");
|
||||
ini.ltrim(2);
|
||||
CHECK(!ini.blank(),"Manca l'indicazione della transazione. Il nome va indicato di seguito al -i, senza interporre spaziatura.");
|
||||
if (ini.find('*')>=0)
|
||||
{
|
||||
// metachars:
|
||||
list_files(ininame, _trans_ini);
|
||||
list_files(ini, _trans_ini);
|
||||
}
|
||||
else
|
||||
_trans_ini.add(ininame);
|
||||
_trans_ini.add(ini);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -935,14 +935,14 @@ FILE* TCursor::open_index(
|
||||
bool create) // @parm Indica se creare l'indice nel caso manchi (default FALSE)
|
||||
{
|
||||
_last_created = create;
|
||||
if (/*create ||*/ _indexname.empty())
|
||||
if (_indexname.empty())
|
||||
{
|
||||
TString16 radix;
|
||||
radix.format("c%d_", file().num());
|
||||
_indexname.temp(radix);
|
||||
}
|
||||
|
||||
if (_indexname != _last_name)
|
||||
if (_indexname != _last_name || create)
|
||||
{
|
||||
if (_last_ndx != NULL)
|
||||
fclose(_last_ndx);
|
||||
@ -970,7 +970,7 @@ void TCursor::close_index(FILE* f)
|
||||
TRecnotype TCursor::buildcursor(TRecnotype rp)
|
||||
{
|
||||
FILE* _f = open_index(TRUE);
|
||||
// rewind(_f);
|
||||
|
||||
const int handle = file().handle();
|
||||
if (DB_reccount(handle) == 0)
|
||||
{
|
||||
@ -988,33 +988,37 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
|
||||
}
|
||||
|
||||
TRecnotype oldrecno=0,ap = 0;
|
||||
int pagecnt = 0;
|
||||
size_t pagecnt = 0;
|
||||
const bool filtered = has_filter();
|
||||
|
||||
TRecnotype* page = new TRecnotype [CMAXELPAGE];
|
||||
TRecnotype pos = DB_index_recno(handle);
|
||||
_pos=-1;
|
||||
// TRecnotype pos = DB_index_recno(handle);
|
||||
_pos = -1;
|
||||
|
||||
while (TRUE)
|
||||
while (!DB_index_eof(handle))
|
||||
{
|
||||
if (DB_index_eof(handle))
|
||||
break;
|
||||
|
||||
const char* s0 = DB_index_getkey(handle);
|
||||
const TRecnotype recno = DB_index_recno(handle);
|
||||
if (l && (strncmp(to(), s0, l) < 0)) break;
|
||||
if (recno == oldrecno) break; // means that no more keys are available
|
||||
oldrecno=recno;
|
||||
const char* s0 = DB_index_getkey(handle);
|
||||
if (l && (strncmp(to(), s0, l) < 0)) break;
|
||||
if (pagecnt == CMAXELPAGE)
|
||||
{
|
||||
if (filtered) pagecnt = filtercursor(pagecnt,page);
|
||||
fwrite(page,sizeof(TRecnotype),pagecnt,_f);
|
||||
for (int i= 0; i< pagecnt; i++)
|
||||
if (page[i] == rp)
|
||||
{
|
||||
_pos = ap + i;
|
||||
break;
|
||||
}
|
||||
if (filtered)
|
||||
pagecnt = filtercursor(pagecnt,page);
|
||||
|
||||
size_t written = fwrite(page, sizeof(TRecnotype), pagecnt, _f);
|
||||
CHECKS(written == pagecnt, "Error writing index ", (const char*)_indexname);
|
||||
|
||||
if (_pos < 0)
|
||||
{
|
||||
for (size_t i= 0; i < pagecnt; i++)
|
||||
if (page[i] == rp)
|
||||
{
|
||||
_pos = ap + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ap += pagecnt;
|
||||
pagecnt = 0;
|
||||
}
|
||||
@ -1025,17 +1029,23 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
|
||||
} // while
|
||||
if (pagecnt)
|
||||
{
|
||||
if (filtered) pagecnt = filtercursor(pagecnt, page);
|
||||
fwrite(page, sizeof(TRecnotype), pagecnt, _f);
|
||||
for (int i = 0; i < pagecnt; i++)
|
||||
if (page[i] == rp)
|
||||
{
|
||||
_pos = ap + i;
|
||||
break;
|
||||
}
|
||||
if (filtered)
|
||||
pagecnt = filtercursor(pagecnt, page);
|
||||
size_t written = fwrite(page, sizeof(TRecnotype), pagecnt, _f);
|
||||
CHECKS(written == pagecnt, "Error writing index ", (const char*)_indexname);
|
||||
if (_pos < 0)
|
||||
{
|
||||
for (size_t i = 0; i < pagecnt; i++)
|
||||
if (page[i] == rp)
|
||||
{
|
||||
_pos = ap + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ap += pagecnt;
|
||||
}
|
||||
if (_pos == -1) pos = 0;
|
||||
if (_pos == -1 && ap > 0)
|
||||
_pos = 0;
|
||||
delete page;
|
||||
close_index(_f);
|
||||
return ap;
|
||||
@ -1095,13 +1105,13 @@ bool TCursor::ok() const
|
||||
|
||||
bool TCursor::changed()
|
||||
{
|
||||
if (_frozen && _lastrec > 0L)
|
||||
return FALSE;
|
||||
|
||||
if (prefix().get_dirtype(file().num()) == _nordir &&
|
||||
_index_firm != prefix().get_codditta())
|
||||
return TRUE;
|
||||
|
||||
if (_frozen && _lastrec > 0L)
|
||||
return FALSE;
|
||||
|
||||
const int handle = file().handle();
|
||||
const TRecnotype eod = DB_reccount(handle);
|
||||
if (_lastrec != eod ||
|
||||
|
@ -251,7 +251,7 @@ TString& TString::operator <<(long n)
|
||||
TString& TString::operator <<(double n)
|
||||
{
|
||||
char s[32];
|
||||
sprintf(s, "%lf", n);
|
||||
sprintf(s, "%lg", n);
|
||||
return operator <<(s);
|
||||
}
|
||||
|
||||
@ -260,10 +260,11 @@ TString& TString::operator <<(double n)
|
||||
// The object should be completely storable in _spark
|
||||
TString& TString::operator <<(const TObject& obj)
|
||||
{
|
||||
ostrstream out(_spark.get_buffer(), _spark.size());
|
||||
TString256 spark;
|
||||
ostrstream out(spark.get_buffer(), spark.size());
|
||||
obj.print_on(out);
|
||||
out << ends;
|
||||
return operator <<(_spark);
|
||||
return operator <<(spark);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ int TTable::name2log(const char* n)
|
||||
|
||||
|
||||
TTable::TTable(const char* tabname)
|
||||
: TLocalisamfile(name2log(tabname)), _cod(curr(), "COD")
|
||||
: TLocalisamfile(name2log(tabname))
|
||||
{
|
||||
if ((*tabname == '%') || (*tabname == '#')) tabname++;
|
||||
_tabname = tabname;
|
||||
@ -30,7 +30,7 @@ int TTable::skip(TRecnotype nrec, word lockop)
|
||||
{
|
||||
if (!nrec) return NOERR;
|
||||
TBaseisamfile::skip(nrec, lockop);
|
||||
if (_tabname != (const char *)_cod)
|
||||
if (_tabname != get("COD"))
|
||||
{
|
||||
if (nrec > 0)
|
||||
{
|
||||
@ -58,7 +58,7 @@ int TTable::_read(TRectype& rec, word op, word lockop)
|
||||
{
|
||||
zero();
|
||||
TBaseisamfile::_read(rec, _isgteq, lockop);
|
||||
if (_tabname != (const char *)_cod)
|
||||
if (_tabname != rec.get("COD"))
|
||||
setstatus(_isemptyfile);
|
||||
if (bad())
|
||||
zero();
|
||||
@ -75,7 +75,7 @@ int TTable::_read(TRectype& rec, word op, word lockop)
|
||||
setstatus(NOERR);
|
||||
if (bof())
|
||||
setstatus(NOERR);
|
||||
if (_tabname != (const char *)_cod)
|
||||
if (_tabname != rec.get("COD"))
|
||||
setstatus(_isemptyfile);
|
||||
if (bad())
|
||||
zero();
|
||||
@ -86,7 +86,7 @@ int TTable::_read(TRectype& rec, word op, word lockop)
|
||||
const TRecnotype nrec = recno();
|
||||
|
||||
TBaseisamfile::_read(rec, _isprev, lockop);
|
||||
if (_tabname != (const char *)_cod)
|
||||
if (_tabname != rec.get("COD"))
|
||||
{
|
||||
if (lockop == _lock) reread(_unlock);
|
||||
readat(rec, nrec, lockop);
|
||||
@ -99,7 +99,7 @@ int TTable::_read(TRectype& rec, word op, word lockop)
|
||||
const TRecnotype nrec = recno();
|
||||
|
||||
TBaseisamfile::_read(rec, _isnext, lockop);
|
||||
if (_tabname != (const char *)_cod)
|
||||
if (_tabname != rec.get("COD"))
|
||||
{
|
||||
if (lockop == _lock) reread(_unlock);
|
||||
readat(rec, nrec, lockop);
|
||||
@ -109,7 +109,7 @@ int TTable::_read(TRectype& rec, word op, word lockop)
|
||||
else
|
||||
{
|
||||
TBaseisamfile::_read(rec, op, lockop);
|
||||
if (_tabname != (const char *)_cod)
|
||||
if (_tabname != rec.get("COD"))
|
||||
{
|
||||
if (lockop == _lock) reread(_unlock);
|
||||
last(lockop);
|
||||
@ -120,11 +120,9 @@ int TTable::_read(TRectype& rec, word op, word lockop)
|
||||
}
|
||||
|
||||
int TTable::_readat(TRectype& rec ,TRecnotype nrec, word lockop)
|
||||
|
||||
{
|
||||
TBaseisamfile::_readat(rec, nrec, lockop);
|
||||
|
||||
CHECKS(_tabname == (const char *)_cod, "Invalid position : Table ", (const char *)_tabname);
|
||||
CHECKS(_tabname == rec.get("COD"), "Invalid position : Table ", (const char *)_tabname);
|
||||
return status();
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,7 @@ class TTable : public TLocalisamfile
|
||||
TString16 _module;
|
||||
// @cmember:(INTERNAL) Descrizione della tabella
|
||||
TString _description;
|
||||
// @cmember:(INTERNAL) Codice della tabella
|
||||
TRecfield _cod;
|
||||
|
||||
// @cmember:(INTERNAL) Flag che indica l'avvenuto caricamento di descrizione e modulo
|
||||
bool _des_mod_loaded;
|
||||
|
||||
|
@ -53,11 +53,6 @@ TVariable_mask::TVariable_mask(const char* name, int num, int max) : TMask()
|
||||
}
|
||||
|
||||
|
||||
TVariable_mask::TVariable_mask() : TMask()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TMask& TVariable_sheet_field::sheet_mask() const
|
||||
{
|
||||
TMask & m = TSheet_field::sheet_mask();
|
||||
|
@ -39,8 +39,7 @@ public:
|
||||
virtual void enable(short fld_id, bool on = TRUE);
|
||||
// @cmember Legge il campo da file
|
||||
virtual TMask_field* parse_field(TScanner& scanner);
|
||||
// @cmember Costruttore (crea la maschera leggendo la descrizione dal file .msk)
|
||||
TVariable_mask( );
|
||||
|
||||
// @cmember Costruttore (crea la maschera leggendo la descrizione dal file .msk)
|
||||
TVariable_mask( const char* name, int num = 0, int max = MAX_PAGES);
|
||||
// @cmember Distruttore
|
||||
|
@ -1380,10 +1380,10 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
}
|
||||
else if (ep->v.timer.id == _wtimer)
|
||||
{
|
||||
if (_showbuts) paint_waitbar ();
|
||||
xvt_timer_destroy (_wtimer);
|
||||
if (_isopen)
|
||||
_wtimer = xvt_timer_create (win, 150l);
|
||||
if (_showbuts)
|
||||
paint_waitbar ();
|
||||
if (!_isopen)
|
||||
xvt_timer_destroy (_wtimer);
|
||||
}
|
||||
break;
|
||||
case E_MOUSE_DBL:
|
||||
@ -2568,7 +2568,7 @@ TViswin::TViswin(const char *fname,
|
||||
_curbut = 0;
|
||||
|
||||
if (_isopen && _showbuts)
|
||||
_wtimer = xvt_timer_create(win(), 150l);
|
||||
_wtimer = xvt_timer_create(win(), 750L);
|
||||
|
||||
_point.set (0, 0);
|
||||
autoscroll (FALSE);
|
||||
|
@ -924,13 +924,11 @@ void TWindow::frame(
|
||||
r.top = f.v; r.left = f.h;
|
||||
r.bottom = t.v; r.right = t.h;
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
if (!_pixmap && (flag & 2))
|
||||
{
|
||||
r.left += CHARX>>1; r.top += CHARY>>1;
|
||||
r.right-= CHARX>>1; r.bottom -= CHARY>>1;
|
||||
}
|
||||
#endif
|
||||
|
||||
xvt_dwin_draw_rect(win(), &r);
|
||||
|
||||
@ -982,32 +980,31 @@ void TWindow::set_font(
|
||||
PNT TWindow::log2dev(long x, long y) const
|
||||
{
|
||||
PNT pnt;
|
||||
|
||||
pnt.h = (int)x;
|
||||
pnt.v = (int)y;
|
||||
|
||||
if (!_pixmap)
|
||||
{
|
||||
pnt.h *= CHARX;
|
||||
pnt.v *= CHARY;
|
||||
}
|
||||
|
||||
return pnt;
|
||||
}
|
||||
|
||||
TPoint TWindow::dev2log(const PNT& p) const
|
||||
{
|
||||
TPoint pnt(_pixmap ? p.h : p.h/CHARX, _pixmap ? p.v : p.v/CHARY);
|
||||
TPoint pnt(p.h, p.v);
|
||||
if (!_pixmap)
|
||||
{
|
||||
pnt.x /= CHARX;
|
||||
pnt.y /= CHARY;
|
||||
}
|
||||
return pnt;
|
||||
}
|
||||
|
||||
|
||||
void TWindow::stringat(short x, short y, const char* str)
|
||||
{
|
||||
PNT pnt = log2dev(x,y);
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
pnt.v += BASEY;
|
||||
#endif
|
||||
|
||||
xvt_dwin_draw_text(win(), pnt.h, pnt.v, (char *)str, -1);
|
||||
}
|
||||
@ -1049,13 +1046,9 @@ void TWindow::line(short x0, short y0, short x1, short y1)
|
||||
|
||||
void TWindow::icon(short x0, short y0, int iconid)
|
||||
{
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
bar(x0, y0, x0+1, y0+1);
|
||||
#else
|
||||
PNT f = log2dev(x0,y0);
|
||||
if (iconid < 0) iconid = ICON_RSRC;
|
||||
xvt_dwin_draw_icon(win(), f.h, f.v, iconid);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TWindow::clear(COLOR color)
|
||||
|
@ -200,9 +200,6 @@ public:
|
||||
// @cmember Distruttore
|
||||
virtual ~TWindow();
|
||||
|
||||
// @cmember Ritorna l'handler della finestra padre
|
||||
WINDOW parent() const;
|
||||
|
||||
// @cmember Ritorna l'identificatore della classe finestra
|
||||
virtual word class_id() const;
|
||||
|
||||
|
@ -560,7 +560,7 @@ void xvt_statbar_set(
|
||||
if (_statbar)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
TString80 t;
|
||||
TString256 t;
|
||||
t << text << '\t' << oggi.string() << " - " << main_app().title();
|
||||
|
||||
if (def)
|
||||
|
Loading…
x
Reference in New Issue
Block a user