Corrette descrizioni delle relazioni
Corretta gestion forms Cambiato carattere matilde (~) delle picture in cappello di pinocchio (^) git-svn-id: svn://10.65.10.50/trunk@1416 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
065406728e
commit
a88c72ee56
@ -203,16 +203,15 @@ void TDir::get (int nfile, TReclock lock, TDirtype dirtype, TDirop op)
|
||||
}
|
||||
|
||||
void TDir::put (int nfile, TDirtype dirtype, TDirop op)
|
||||
|
||||
{
|
||||
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||
CHECKD(nfile > 0, "Bad file number ", nfile);
|
||||
|
||||
const int whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
|
||||
|
||||
if (nfile <= 0)
|
||||
fatal_box ("Bad file number %d", nfile);
|
||||
if (op == _nordirop)
|
||||
CCloseFile (nfile, _dir, _whichdir);
|
||||
CCloseFile (nfile, _dir, whichdir);
|
||||
else
|
||||
CPutFile (nfile, _dir, _whichdir);
|
||||
CPutFile (nfile, _dir, whichdir);
|
||||
}
|
||||
|
||||
void TDir::zero ()
|
||||
@ -235,7 +234,6 @@ TTrec::TTrec ()
|
||||
|
||||
{
|
||||
_rec = new RecDes;
|
||||
// if (_rec == NULL) fatal_box ("Can't allocate record description");
|
||||
zero ();
|
||||
_num = -1;
|
||||
}
|
||||
@ -345,10 +343,8 @@ const char *TTrec ::keydef (int key) const
|
||||
#ifndef FOXPRO
|
||||
|
||||
bool TDir::is_active () const
|
||||
|
||||
{
|
||||
int module = (int) flags();
|
||||
if (module < 0) module = -module;
|
||||
const int module = abs((int)flags());
|
||||
return main_app().has_module(module, CHK_DONGLE);
|
||||
}
|
||||
|
||||
|
@ -60,13 +60,14 @@ HIDDEN pagetype char2page(char c)
|
||||
HIDDEN void put_fieldref(const TFieldref& fr, TMask_field& f)
|
||||
{
|
||||
TRelation_description& rd = form().rel_desc();
|
||||
rd.set_cur_file(fr.file());
|
||||
|
||||
TString80 desc; desc << fr;
|
||||
f.set(desc);
|
||||
|
||||
TMask& m = f.mask();
|
||||
const short id = f.dlg(); // Campo contenente il TFieldref
|
||||
rd.set_cur_file(fr.file());
|
||||
|
||||
m.set(id+1, rd.file_desc());
|
||||
m.set(id+3, rd.get_field_description(fr.name()));
|
||||
m.set(id+5, (fr.from() > 0 || fr.to() > 0) ? fr.from()+1 : 0);
|
||||
@ -246,12 +247,12 @@ class TForm_item : public TObject
|
||||
TPrint_section* _section;
|
||||
TForm_flags _flag;
|
||||
TBit_array _group;
|
||||
TString_array _message;
|
||||
|
||||
protected:
|
||||
short _id, _x, _y, _width, _height;
|
||||
TString _prompt;
|
||||
TString _desc;
|
||||
TString_array _message;
|
||||
|
||||
virtual void print_on(ostream& out) const;
|
||||
virtual void print_body(ostream& out) const;
|
||||
@ -390,7 +391,7 @@ bool TForm_item::parse_item(TScanner& scanner)
|
||||
}
|
||||
|
||||
if (scanner.key() == "KE")
|
||||
{
|
||||
{
|
||||
_desc = scanner.string();
|
||||
return TRUE;
|
||||
}
|
||||
@ -673,7 +674,9 @@ bool TForm_item::edit(TMask& m)
|
||||
if (!m.insert_mode())
|
||||
print_on(m);
|
||||
|
||||
m.enable_page(1, form().edit_level() > 1);
|
||||
const bool godmode = form().edit_level() > 1;
|
||||
m.enable_page(1, godmode);
|
||||
m.enable(-7, godmode);
|
||||
|
||||
const bool dirty = m.run() == K_ENTER && m.dirty();
|
||||
if (dirty)
|
||||
@ -889,6 +892,15 @@ void TForm_string::print_on(TMask& m)
|
||||
put_fieldref(field(i), m.field(i == 0 ? F_FIELDREF1 : F_FIELDREF2));
|
||||
|
||||
m.set(F_PICTURE, _picture);
|
||||
|
||||
TSheet_field& s = (TSheet_field&)m.field(F_ITEMS);
|
||||
s.reset();
|
||||
if (_message.items() > 0)
|
||||
{
|
||||
TToken_string& row = s.row(0);
|
||||
row = " | ";
|
||||
row.add(message(0));
|
||||
}
|
||||
}
|
||||
|
||||
void TForm_string::read_from(const TMask& m)
|
||||
@ -912,6 +924,13 @@ void TForm_string::read_from(const TMask& m)
|
||||
else
|
||||
_field.destroy(i);
|
||||
}
|
||||
|
||||
TSheet_field& f = (TSheet_field&)m.field(F_ITEMS);
|
||||
TToken_string& msg = f.row(0);
|
||||
if (msg.empty_items())
|
||||
_message.destroy(0);
|
||||
else
|
||||
_message.add(msg.get(2), 0);
|
||||
}
|
||||
|
||||
bool TForm_string::set(const char* s)
|
||||
@ -1197,7 +1216,7 @@ void TForm_list::print_on(TMask& m)
|
||||
{
|
||||
TForm_string::print_on(m);
|
||||
TSheet_field& s = (TSheet_field&)m.field(F_ITEMS);
|
||||
|
||||
s.reset();
|
||||
_codes.restart(); _values.restart();
|
||||
for (int i = 0; i < _codes.items(); i++)
|
||||
{
|
||||
@ -1206,7 +1225,7 @@ void TForm_list::print_on(TMask& m)
|
||||
row.add(_values.get());
|
||||
row.add(message(i));
|
||||
}
|
||||
s.force_update();
|
||||
// s.force_update();
|
||||
}
|
||||
|
||||
void TForm_list::read_from(const TMask& m)
|
||||
|
@ -409,12 +409,12 @@ char *real ::string (const char *picture)
|
||||
for (int i = f.len () - 1; i >= 0 && j >= 0; i--)
|
||||
{
|
||||
char &z = f[i];
|
||||
if (strchr ("#@~", z))
|
||||
if (strchr ("#@^", z))
|
||||
{
|
||||
char c = v[j--];
|
||||
if (j >= 0 && v[j] == '.')
|
||||
j--;
|
||||
if (z == '~')
|
||||
if (z == '^')
|
||||
c = ' ';
|
||||
else
|
||||
{
|
||||
@ -435,7 +435,7 @@ char *real ::string (const char *picture)
|
||||
switch (f[i])
|
||||
{
|
||||
case '#':
|
||||
case '~':
|
||||
case '^':
|
||||
case '.':
|
||||
f[i] = ' ';
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relation.cpp,v 1.42 1995-05-29 10:24:58 guy Exp $
|
||||
// $Id: relation.cpp,v 1.43 1995-05-30 16:01:34 guy Exp $
|
||||
// relation.cpp
|
||||
// fv 12/8/93
|
||||
// relation class for isam files
|
||||
@ -1557,45 +1557,42 @@ void TRelation_description::read_rel()
|
||||
TToken_string& tt = (TToken_string&)_files[i];
|
||||
TFilename descfname; descfname << DESCDIR << "/d";
|
||||
|
||||
const char* tn = tt.get(0);
|
||||
const char* tn = tt.get(0); // Codice del file o tabella
|
||||
|
||||
int which_file = atoi(tn); // Non spostare questa riga (tn puo' cambiare!)
|
||||
if (which_file == 0)
|
||||
which_file = TTable::name2log(tn); // Numero logico del file
|
||||
|
||||
if (tn[0] == '%' || tn[0] == '$')
|
||||
descfname << (tn+1);
|
||||
else
|
||||
descfname << tn;
|
||||
descfname << ".des";
|
||||
|
||||
int which_file = atoi(tn);
|
||||
if (which_file == 0)
|
||||
which_file = TTable::name2log(tn);
|
||||
TConfig conf(descfname, DESCPAR);
|
||||
// new record descriptor for _fields array
|
||||
TString_array* rdesc = new TString_array;
|
||||
|
||||
if (fexist(descfname))
|
||||
{
|
||||
TConfig conf(descfname, DESCPAR);
|
||||
// new record descriptor for _fields array
|
||||
TString_array* rdesc = new TString_array;
|
||||
|
||||
TTrec trec; trec.get(which_file);
|
||||
TToken_string ttmp(64);
|
||||
|
||||
for (int f = 0; f < trec.fields(); f++)
|
||||
{
|
||||
ttmp = trec.fielddef(f);
|
||||
TString16 name = ttmp.get(0);
|
||||
|
||||
if (!name.blank())
|
||||
{
|
||||
TString80 dfld(conf.get(name));
|
||||
if (!dfld.blank() && dfld[0] != '#')
|
||||
{
|
||||
ttmp.add(dfld,4);
|
||||
// contiene: nome campo, tipo, lunghezza, decimali, descrizione
|
||||
rdesc->add(ttmp);
|
||||
}
|
||||
TTrec trec; trec.get(which_file);
|
||||
TToken_string ttmp(64);
|
||||
|
||||
for (int f = 0; f < trec.fields(); f++)
|
||||
{
|
||||
ttmp = trec.fielddef(f);
|
||||
const TString16 name(ttmp.get(0));
|
||||
if (!name.blank())
|
||||
{
|
||||
TString80 dfld(conf.get(name, NULL, -1, "Missing description"));
|
||||
if (!dfld.blank() && dfld[0] != '#')
|
||||
{
|
||||
ttmp.add(dfld,4);
|
||||
// contiene: nome campo, tipo, lunghezza, decimali, descrizione
|
||||
rdesc->add(ttmp);
|
||||
}
|
||||
}
|
||||
if (rdesc->items() > 0)
|
||||
_fields.add(rdesc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_fields.add(rdesc, i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1612,7 +1609,12 @@ void TRelation_description::print_on(ostream& out) const
|
||||
for (int i = 0; i < _files.items(); i++)
|
||||
{
|
||||
TToken_string& r = ((TRelation_description*)this)->_files.row(i);
|
||||
out << " " << r.get(0) << "->* ";
|
||||
TString16 cod(r.get(4));
|
||||
if (atoi(cod) == 0)
|
||||
cod = r.get(0);
|
||||
else
|
||||
cod << '@';
|
||||
out << " " << cod << "->* ";
|
||||
out << "\"" << r.get(1) << "\"\n";
|
||||
}
|
||||
}
|
||||
@ -1629,15 +1631,18 @@ bool TRelation_description::choose_file(int file)
|
||||
{
|
||||
TToken_string& tf = _files.row(i);
|
||||
tt = tf.get(4);
|
||||
if (tt.blank())
|
||||
|
||||
int num = atoi(tt);
|
||||
if (num == 0)
|
||||
{
|
||||
tt = tf.get(0);
|
||||
if (sel == 0 && file > 0 && atoi(tt) == file)
|
||||
tt = tf.get(0);
|
||||
num = atoi(tt);
|
||||
if (sel == 0 && file > 0 && num == file)
|
||||
sel = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sel == 0 && file < 0 && atoi(tt) == -file)
|
||||
if (sel == 0 && file < 0 && num == -file)
|
||||
sel = i;
|
||||
tt << '@';
|
||||
}
|
||||
@ -1788,22 +1793,21 @@ const char* TRelation_description::get_field_description(const char* field)
|
||||
{
|
||||
TToken_string& tt = fld.row(i);
|
||||
if (strcmp(tt.get(0),field) == 0)
|
||||
return tt.get(1);
|
||||
return tt.get(4);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
TRelation_description::TRelation_description(TRelation& r) :
|
||||
_rel(&r), _menu(FALSE), _cur_file(0), _cur_field(0),
|
||||
_cfile(80), _cfield(80)
|
||||
TRelation_description::TRelation_description(TRelation& r)
|
||||
: _rel(&r), _menu(FALSE), _cur_file(0), _cur_field(0),
|
||||
_cfile(80), _cfield(80)
|
||||
{
|
||||
read_rel();
|
||||
|
||||
if (_files.items() > 0)
|
||||
{
|
||||
_cfile = _files.row(0);
|
||||
_cfield = ((TString_array&)_fields[0]).row(0);
|
||||
_cfield = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: relation.h,v 1.18 1995-05-29 10:25:02 guy Exp $ */
|
||||
/* $Id: relation.h,v 1.19 1995-05-30 16:01:36 guy Exp $ */
|
||||
// join.h
|
||||
// fv 12/8/93
|
||||
// join class for isam files
|
||||
@ -273,7 +273,7 @@ public:
|
||||
int file() const { return _fileid; } // ritorna il file
|
||||
void set_file(int f);
|
||||
|
||||
const char* name() const { return (const char*) _name; } // ritorna il nome del campo
|
||||
const TString& name() const { return _name; } // ritorna il nome del campo
|
||||
void set_name(const char* n) { _name = n; }
|
||||
void set_from(int f) { if (f > 0) f--; else f = 0; _from = f; }
|
||||
void set_to(int t) { _to = t; }
|
||||
|
@ -592,7 +592,7 @@ TString& TString::left_just(
|
||||
|
||||
// @mfunc Formatta una stringa usando il formato dato da <p pic>
|
||||
TString& TString::picture(
|
||||
const char* pic, // @parm Formato dell stringa
|
||||
const char* pic, // @parm Formato della stringa
|
||||
const char* s) // @parm Stringa da formattare
|
||||
{
|
||||
if (pic == NULL || *pic == '\0')
|
||||
@ -607,7 +607,7 @@ TString& TString::picture(
|
||||
const char k = pic[i];
|
||||
if (k == '#') _str[i] = (l >= 0) ? s[l--] : ' ';
|
||||
else if (k == '@') _str[i] = (l >= 0) ? s[l--] : '0';
|
||||
else if (k == '~') { _str[i] = ' '; l--; }
|
||||
else if (k == '^') { _str[i] = ' '; l--; }
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user