Aggiunti i messaggi di inizializzazione
git-svn-id: svn://10.65.10.50/trunk@2231 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1a552db81e
commit
b951884742
@ -248,7 +248,7 @@ void TForm_flags::read_from(const TMask& m)
|
||||
|
||||
|
||||
TForm_item::TForm_item(TPrint_section* section)
|
||||
: _section(section), _x(-1), _y(-1), _width(0), _height(0), _id(0)
|
||||
: _section(section), _x(-1), _y(-1), _width(0), _height(0), _effective_height(0), _id(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -321,12 +321,17 @@ bool TForm_item::parse_item(TScanner& scanner)
|
||||
{
|
||||
TFixed_string m(scanner.line());
|
||||
m.strip_spaces();
|
||||
int n = 0;
|
||||
int n = 0; // All'indice 0 ci sono i messaggi che vanno eseguiti sempre se sono da soli o se il campo non è vuoto se sono in congiunzione con gli EMPTY
|
||||
if (m.left(5) == "EMPTY")
|
||||
{
|
||||
n = 1;
|
||||
n = 1; // All'indice 1 ci sono i messaggi che vanno eseguiti se il campo è vuoto
|
||||
m.ltrim(5);
|
||||
}
|
||||
else if (m.left(4) == "INIT")
|
||||
{
|
||||
n = 2; // All'indice 2 ci sono i messaggi che vanno eseguiti sempre, appena dopo la lettura dal file e prima dell'autoformattazione del campo
|
||||
m.ltrim(4);
|
||||
}
|
||||
if (!m.blank())
|
||||
message(n).add(m);
|
||||
return TRUE;
|
||||
@ -568,6 +573,7 @@ bool TForm_item::update()
|
||||
string_at(_x, _y, prompt);
|
||||
}
|
||||
else string_at(_x, _y, _prompt);
|
||||
_effective_height= 1; // Effective height is one row by default, only paragraph strings can be taller
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -1021,8 +1027,10 @@ void TForm_string::put_paragraph(const char* s)
|
||||
int i = _prompt.not_empty() ? 1 : 0;
|
||||
for (; (s = p.get()) != NULL && i < height(); i++)
|
||||
string_at(_x, _y+i, s);
|
||||
_effective_height= i - (_prompt.not_empty() ? 1 : 0);
|
||||
}
|
||||
else string_at(-1, _y, s);
|
||||
else
|
||||
string_at(-1, _y, s);
|
||||
}
|
||||
|
||||
|
||||
@ -1030,6 +1038,7 @@ bool TForm_string::update()
|
||||
{
|
||||
if (read())
|
||||
{
|
||||
if (_message.objptr(2) != NULL) do_message(2); // Lancio dei messaggi di inizializzazione (INIT)
|
||||
TString s;
|
||||
TForm_item::update();
|
||||
if (!picture().blank())
|
||||
@ -2771,12 +2780,33 @@ bool TForm::write_profile()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TForm::TForm(const char* name, const char* code, int lev, const char* desc)
|
||||
: _name(name), _code(code), _relation(NULL), _cursor(NULL), _rel_desc(NULL),
|
||||
_isnew(FALSE), _editlevel(lev), _desc(desc), _fontname("Roman 17cpi"),
|
||||
_fontsize(12), _x(0), _y(0), _char_to_pos('\0'), _ipx(0), _ipy(0), _fpx(0),
|
||||
_arrange(TRUE), _fink("+,+,+,+,+,+,+,+,+,-,|",','), _dirty(FALSE)
|
||||
{
|
||||
void TForm::init()
|
||||
{
|
||||
_relation= NULL;
|
||||
_cursor= NULL;
|
||||
_rel_desc= NULL;
|
||||
_isnew= FALSE;
|
||||
_fontname= "Roman 17cpi";
|
||||
_fontsize= 12;
|
||||
_x= 0;
|
||||
_y= 0;
|
||||
_char_to_pos= '\0';
|
||||
_ipx= 0;
|
||||
_ipy= 0;
|
||||
_fpx= 0;
|
||||
_arrange= TRUE;
|
||||
_fink= "+,+,+,+,+,+,+,+,+,-,|";
|
||||
_fink.separator(',');
|
||||
_dirty= FALSE;
|
||||
}
|
||||
|
||||
void TForm::read(const char* name, const char* code, int lev, const char* desc)
|
||||
{
|
||||
_name= name;
|
||||
_code= code;
|
||||
_editlevel= lev;
|
||||
_desc= desc;
|
||||
|
||||
main_app().begin_wait();
|
||||
|
||||
if (_code.not_empty())
|
||||
@ -2840,6 +2870,16 @@ TForm::TForm(const char* name, const char* code, int lev, const char* desc)
|
||||
main_app().end_wait();
|
||||
}
|
||||
|
||||
TForm::TForm()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
TForm::TForm(const char* name, const char* code, int lev, const char* desc)
|
||||
{
|
||||
init();
|
||||
read(name, code, lev, desc);
|
||||
}
|
||||
|
||||
TForm::~TForm()
|
||||
{
|
||||
|
@ -134,6 +134,9 @@ class TForm : public TObject
|
||||
bool ps_change_number_format(TPrint_section& s, int w, int dec, const char* p);
|
||||
|
||||
protected:
|
||||
void init(); // inizializza il form
|
||||
void read(const char* form, const char * code = "", int editlevel = 0, const char* desc = ""); // carica il form dal file specificato
|
||||
|
||||
// H = Header, B = Body, F = Footer, R = Relation
|
||||
TPrint_section& section(char s = 'B', word page = 1);
|
||||
word height(word page = 1); // Height of first page
|
||||
@ -216,6 +219,7 @@ public:
|
||||
|
||||
// if code == NULL it's a base form
|
||||
// otherwise it's integrated by a file definition
|
||||
TForm();
|
||||
TForm(const char* form, const char * code = "", int editlevel = 0, const char* desc = "");
|
||||
virtual ~TForm();
|
||||
};
|
||||
@ -246,7 +250,7 @@ class TForm_item : public TObject
|
||||
TBit_array _group;
|
||||
|
||||
protected:
|
||||
short _id, _x, _y, _width, _height;
|
||||
short _id, _x, _y, _width, _height, _effective_height;
|
||||
TString _prompt;
|
||||
TString _desc;
|
||||
TString_array _message;
|
||||
@ -268,6 +272,7 @@ public:
|
||||
virtual int width() const { return _width; }
|
||||
virtual void set_width(int w) { _width = w; }
|
||||
virtual int height() const { return _height; }
|
||||
virtual int effective_height() const { return _effective_height; }
|
||||
virtual short& x() { return _x; }
|
||||
virtual short& y() { return _y; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user