Correzione errori:
MI3346: aggiunta la set_compulsory_specials() alla fine della TForm::reread() MI3347: implementati i metodi TForm_item::dup(), TForm_item::make_new_item() TForm_item::copy_to_form_item(). Implementate anche le dup() per le classi derivate da TForm_item. Corretto il metodo TPrint_section::copy() git-svn-id: svn://10.65.10.50/trunk@2747 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cfb72fba44
commit
fb2df3ca73
114
include/form.cpp
114
include/form.cpp
@ -328,6 +328,47 @@ TForm_item::TForm_item(TPrint_section* section)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
TForm_item* TForm_item::make_new_item() const
|
||||||
|
{
|
||||||
|
return new TForm_item(_section);
|
||||||
|
}
|
||||||
|
|
||||||
|
TForm_item* TForm_item::copy_to_form_item() const
|
||||||
|
{
|
||||||
|
TForm_item* fi = make_new_item();
|
||||||
|
|
||||||
|
fi->_flag = _flag; fi->_group = _group;
|
||||||
|
// come copiarlo facendo una cosa orrenda...
|
||||||
|
fi->_special.destroy();
|
||||||
|
specials().restart();
|
||||||
|
int items = special_items();
|
||||||
|
for (int k = 0; k < items; k++)
|
||||||
|
{
|
||||||
|
THash_object* ho = specials().get_hashobj();
|
||||||
|
fi->_special.add(ho->key(),ho->obj());
|
||||||
|
}
|
||||||
|
// fi->_special = _special; sarebbe utile avere un "operator =" per i TAssoc_array
|
||||||
|
|
||||||
|
fi->_temp = _temp; fi->_id = _id;
|
||||||
|
fi->_x = _x; fi->_y = _y;
|
||||||
|
fi->_width = _width; fi->_height = _height;
|
||||||
|
fi->_effective_height = _effective_height;
|
||||||
|
fi->_ofs = _ofs; fi->_prompt = _prompt;
|
||||||
|
fi->_desc = _desc; fi->_col_head = _col_head;
|
||||||
|
// Anche qui... copia uno alla volta
|
||||||
|
items = _message.items();
|
||||||
|
for (k = 0; k < items; k++)
|
||||||
|
fi->_message.add(_message.row(k),k);
|
||||||
|
// fi->_message = _message; sarebbe utile avere un "operator =" per i TString_array
|
||||||
|
return fi;
|
||||||
|
}
|
||||||
|
|
||||||
|
TObject* TForm_item::dup() const
|
||||||
|
{
|
||||||
|
TForm_item * fi = copy_to_form_item();
|
||||||
|
return fi;
|
||||||
|
}
|
||||||
|
|
||||||
bool TForm_item::parse_head(TScanner& scanner)
|
bool TForm_item::parse_head(TScanner& scanner)
|
||||||
{
|
{
|
||||||
_id = scanner.integer();
|
_id = scanner.integer();
|
||||||
@ -954,9 +995,9 @@ class TForm_subsection : public TForm_item
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
|
virtual TForm_item* make_new_item() const;
|
||||||
public:
|
public:
|
||||||
|
virtual TObject* dup() const;
|
||||||
virtual bool parse(TScanner& s);
|
virtual bool parse(TScanner& s);
|
||||||
virtual bool update();
|
virtual bool update();
|
||||||
virtual bool edit(TMask& m);
|
virtual bool edit(TMask& m);
|
||||||
@ -982,6 +1023,19 @@ TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm) :
|
|||||||
TForm_item(s), _ssec(&(s->form()), s->section_type(), s->page_type(), TRUE), _file_id(-1), _name(nm)
|
TForm_item(s), _ssec(&(s->form()), s->section_type(), s->page_type(), TRUE), _file_id(-1), _name(nm)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TForm_item* TForm_subsection::make_new_item() const
|
||||||
|
{
|
||||||
|
return (TForm_item*) new TForm_subsection(_section);
|
||||||
|
}
|
||||||
|
|
||||||
|
TObject * TForm_subsection::dup() const
|
||||||
|
{
|
||||||
|
TForm_subsection* fs = (TForm_subsection*) copy_to_form_item();
|
||||||
|
fs->_ssec = _ssec;
|
||||||
|
fs->_name = _name;
|
||||||
|
fs->_file_id = _file_id;
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
bool TForm_subsection::parse(TScanner& s)
|
bool TForm_subsection::parse(TScanner& s)
|
||||||
{
|
{
|
||||||
@ -1126,6 +1180,7 @@ class TForm_string : public TForm_item
|
|||||||
TToken_string _memo;
|
TToken_string _memo;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual TForm_item* make_new_item() const;
|
||||||
virtual const char* class_name() const { return "STRINGA"; }
|
virtual const char* class_name() const { return "STRINGA"; }
|
||||||
virtual void print_body(ostream& out);
|
virtual void print_body(ostream& out);
|
||||||
|
|
||||||
@ -1152,6 +1207,7 @@ protected:
|
|||||||
virtual void put_paragraph(const char* s);
|
virtual void put_paragraph(const char* s);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual TObject* dup() const;
|
||||||
virtual const int fields() { return _field.items();}
|
virtual const int fields() { return _field.items();}
|
||||||
virtual const TString& picture() const { return _picture; }
|
virtual const TString& picture() const { return _picture; }
|
||||||
virtual void set_picture(const char* p) { _picture = p; }
|
virtual void set_picture(const char* p) { _picture = p; }
|
||||||
@ -1165,6 +1221,21 @@ TForm_string::TForm_string(TPrint_section* section)
|
|||||||
: TForm_item(section), _memo("",'\n')
|
: TForm_item(section), _memo("",'\n')
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TForm_item* TForm_string::make_new_item() const
|
||||||
|
{
|
||||||
|
return (TForm_item*) new TForm_string(_section);
|
||||||
|
}
|
||||||
|
|
||||||
|
TObject * TForm_string::dup() const
|
||||||
|
{
|
||||||
|
TForm_string* fs = (TForm_string*) copy_to_form_item();
|
||||||
|
fs->_str = _str;
|
||||||
|
fs->_picture = _picture;
|
||||||
|
fs->_field = _field;
|
||||||
|
fs->_memo = _memo;
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
bool TForm_string::edit(TMask& m)
|
bool TForm_string::edit(TMask& m)
|
||||||
{
|
{
|
||||||
const bool godmode = form().edit_level() > 1;
|
const bool godmode = form().edit_level() > 1;
|
||||||
@ -1442,7 +1513,6 @@ public:
|
|||||||
virtual ~TForm_number() {}
|
virtual ~TForm_number() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool TForm_number::parse_head(TScanner& scanner)
|
bool TForm_number::parse_head(TScanner& scanner)
|
||||||
{
|
{
|
||||||
return TForm_item::parse_head(scanner);
|
return TForm_item::parse_head(scanner);
|
||||||
@ -1569,6 +1639,7 @@ class TForm_date : public TForm_string
|
|||||||
TString16 _format;
|
TString16 _format;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual TForm_item* make_new_item() const;
|
||||||
virtual const char* class_name() const { return "DATA"; }
|
virtual const char* class_name() const { return "DATA"; }
|
||||||
virtual bool read();
|
virtual bool read();
|
||||||
virtual bool set(const char*);
|
virtual bool set(const char*);
|
||||||
@ -1584,6 +1655,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual TObject* dup() const;
|
||||||
void set_format(const char* f) { _format = f; }
|
void set_format(const char* f) { _format = f; }
|
||||||
virtual bool edit(TMask& m);
|
virtual bool edit(TMask& m);
|
||||||
virtual const char* example() const;
|
virtual const char* example() const;
|
||||||
@ -1596,6 +1668,18 @@ TForm_date::TForm_date(TPrint_section* section)
|
|||||||
: TForm_string(section), _format("1444-")
|
: TForm_string(section), _format("1444-")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TForm_item* TForm_date::make_new_item() const
|
||||||
|
{
|
||||||
|
return (TForm_item*) new TForm_date(_section);
|
||||||
|
}
|
||||||
|
|
||||||
|
TObject * TForm_date::dup() const
|
||||||
|
{
|
||||||
|
TForm_date* fd = (TForm_date*) copy_to_form_item();
|
||||||
|
fd->_format = _format;
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
bool TForm_date::read()
|
bool TForm_date::read()
|
||||||
{
|
{
|
||||||
bool ok = TForm_string::read();
|
bool ok = TForm_string::read();
|
||||||
@ -1708,6 +1792,7 @@ class TForm_list : public TForm_string
|
|||||||
TToken_string _values;
|
TToken_string _values;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual TForm_item* make_new_item() const;
|
||||||
virtual const char* class_name() const { return "LISTA"; }
|
virtual const char* class_name() const { return "LISTA"; }
|
||||||
virtual bool parse_item(TScanner& scanner);
|
virtual bool parse_item(TScanner& scanner);
|
||||||
virtual void print_on(TMask& m);
|
virtual void print_on(TMask& m);
|
||||||
@ -1716,6 +1801,7 @@ protected:
|
|||||||
virtual bool update();
|
virtual bool update();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual TObject* dup() const;
|
||||||
TForm_list(TPrint_section* section);
|
TForm_list(TPrint_section* section);
|
||||||
virtual ~TForm_list() {}
|
virtual ~TForm_list() {}
|
||||||
};
|
};
|
||||||
@ -1724,6 +1810,19 @@ TForm_list::TForm_list(TPrint_section* section)
|
|||||||
: TForm_string(section)
|
: TForm_string(section)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TForm_item* TForm_list::make_new_item() const
|
||||||
|
{
|
||||||
|
return (TForm_item*) new TForm_list(_section);
|
||||||
|
}
|
||||||
|
|
||||||
|
TObject * TForm_list::dup() const
|
||||||
|
{
|
||||||
|
TForm_list* fl = (TForm_list*) copy_to_form_item();
|
||||||
|
fl->_codes = _codes;
|
||||||
|
fl->_values = _values;
|
||||||
|
return fl;
|
||||||
|
}
|
||||||
|
|
||||||
bool TForm_list::parse_item(TScanner& scanner)
|
bool TForm_list::parse_item(TScanner& scanner)
|
||||||
{
|
{
|
||||||
if (scanner.key() == "IT")
|
if (scanner.key() == "IT")
|
||||||
@ -2060,8 +2159,12 @@ void TPrint_section::add_field(TForm_item* f)
|
|||||||
|
|
||||||
const TPrint_section& TPrint_section::copy(const TPrint_section& ps)
|
const TPrint_section& TPrint_section::copy(const TPrint_section& ps)
|
||||||
{
|
{
|
||||||
_item = ps._item;
|
_msk = ps._msk; _height = ps._height; _ofspc = ps._ofspc;
|
||||||
_height = ps._height;
|
_ofsvr = ps._ofsvr; _nfld = ps._nfld; _dirty = ps._dirty;
|
||||||
|
_columnwise = ps._columnwise; _temp = ps._temp; _form = ps._form;
|
||||||
|
_sec_type = ps._sec_type; _page_type = ps._page_type; _subsection = ps._subsection;
|
||||||
|
_item = ps._item; _repeat_count = ps._repeat_count;
|
||||||
|
for (int i = 0; i < MAXCOLUMNS; i++) _tab[i] = ps._tab[i];
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3158,6 +3261,7 @@ bool TForm::reread(
|
|||||||
item.read_from(rprof.curr());
|
item.read_from(rprof.curr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
set_compulsory_specials();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user