Resa virtuale e pubblica la TForm_item::put_paragraph().

Tolti i set_handler() relativi ai bottoni obsoleti in ba2100f e associati
ai relativi K_F9.
Aggiunta la cancellazione del form nuovo se in inserimento l'user
preme Annulla.
Tolta la fastidiosa domanda "Salvo i dati generali" in caso di nuovo form.


git-svn-id: svn://10.65.10.50/trunk@3024 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-06-18 16:44:12 +00:00
parent 1a64b29503
commit 5c0d1e5bf3
2 changed files with 42 additions and 29 deletions

View File

@ -126,7 +126,7 @@ HIDDEN void put_fieldref(const TFieldref& fr, TMask_field& f)
// Handler of F_BUT_FILE field on mask
HIDDEN bool but_file_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
if (k == K_F9)
{
TRelation_description& r = form().rel_desc();
@ -162,7 +162,7 @@ HIDDEN bool but_file_handler_sub(TMask_field& f, KEY k)
// Handler of F_BUT_FIELD field on mask
HIDDEN bool but_field_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
if (k == K_F9)
{
TRelation_description& r = form().rel_desc();
TEdit_field& e = f.mask().efield(f.dlg()-4);
@ -759,6 +759,7 @@ bool TForm_item::do_message(int num)
if (*m == '_')
{
form().validate(*this, msg);
put_paragraph(get());
}
else
{
@ -1190,13 +1191,13 @@ protected:
bool set(const char*);
TFieldref& field(int i) const { return (TFieldref&)_field[i]; }
virtual void put_paragraph(const char* s);
public:
virtual TObject* dup() const;
virtual const int fields() { return _field.items();}
virtual const TString& picture() const { return _picture; }
virtual void set_picture(const char* p) { _picture = p; }
virtual void put_paragraph(const char* s);
virtual bool edit(TMask& m);
TForm_string(TPrint_section* section);
@ -1480,7 +1481,6 @@ protected: // TForm_string
virtual bool parse_head(TScanner& scanner);
virtual bool update();
//virtual int height() const { return 0; }
virtual void put_paragraph(const char * s);
protected:
int decimals() const { return _height; }
@ -1491,6 +1491,7 @@ public:
void set_decimals(int d) { _height = d; }
virtual const char* example() const;
virtual void set_picture(const char* p);
virtual void put_paragraph(const char * s);
TForm_number(TPrint_section* section) : TForm_string(section) {}
virtual ~TForm_number() {}
@ -2372,7 +2373,7 @@ void TPrint_section::repos_fields(const char* name, int size)
{
if (!ps.form().dirty()) ps.form().set_dirty();
ps.set_dirty();
if (yesno_box("E' stato cambiato il font o la dimensione del carattere\ndevo aggiornare le coordinate dei campi"))
if (yesno_box("E' stato cambiato il font o la dimensione del carattere.\nDevo aggiornare le coordinate dei campi?"))
{
s_data prm;
prm.size_1=ps.form().fontsize();
@ -2481,12 +2482,12 @@ bool TPrint_section::detail_field_handler(TMask_field& f, KEY k)
msk.set_handler(F_DDAY, dateformat_handler);
msk.set_handler(F_DSEP, dateformat_handler);
msk.set_handler(F_BUT_FILE1, but_file_handler);
msk.set_handler(F_BUT_FIELD1, but_field_handler);
msk.set_handler(F_FILE1, but_file_handler);
msk.set_handler(F_FIELD1, but_field_handler);
msk.set_handler(F_FROM1, from_handler);
msk.set_handler(F_TO1, to_handler);
msk.set_handler(F_BUT_FILE2, but_file_handler);
msk.set_handler(F_BUT_FIELD2, but_field_handler);
msk.set_handler(F_FILE2, but_file_handler);
msk.set_handler(F_FIELD2, but_field_handler);
msk.set_handler(F_FROM2, from_handler);
msk.set_handler(F_TO2, to_handler);
msk.set_handler(F_PICTURE,fmt_handler);
@ -2851,7 +2852,16 @@ bool TPrint_section::edit(
}
else
if (m.run() == K_ESC)
{
{
// Se premo Annulla ed il form e' nuovo lo devo cancellare.
if (form()._isnew)
{
TLocalisamfile frm(LF_FORM);
frm.zero();
frm.put("TIPOPROF",form().name());
frm.put("CODPROF",form().code());
frm.remove();
}
_msk = NULL;
return FALSE;
}
@ -2906,27 +2916,27 @@ bool TPrint_section::edit(
_msk = NULL;
}
if (is_ba_editor && (_dirty || form()._isnew) &&
yesno_box("Dati generali modificati. Salvare?"))
{
TLocalisamfile frm(LF_FORM);
frm.zero();
frm.put("TIPOPROF",form().name());
frm.put("CODPROF",form().code());
if (frm.read(_isequal,_lock) == NOERR)
if (is_ba_editor)
if (form()._isnew || (_dirty && yesno_box("Dati generali modificati. Salvare?")))
{
frm.put("OFFY",form().offset_y());
frm.put("OFFX",form().offset_x());
frm.put("FONTNAME",form().fontname());
frm.put("FONTSIZE",form().fontsize());
frm.put("CTP",form().char_to_pos());
frm.put("IPX", form().ipx());
frm.put("IPY", form().ipy());
frm.put("FPX", form().fpx());
frm.rewrite();
_dirty = FALSE;
TLocalisamfile frm(LF_FORM);
frm.zero();
frm.put("TIPOPROF",form().name());
frm.put("CODPROF",form().code());
if (frm.read(_isequal,_lock) == NOERR)
{
frm.put("OFFY",form().offset_y());
frm.put("OFFX",form().offset_x());
frm.put("FONTNAME",form().fontname());
frm.put("FONTSIZE",form().fontsize());
frm.put("CTP",form().char_to_pos());
frm.put("IPX", form().ipx());
frm.put("IPY", form().ipy());
frm.put("FPX", form().fpx());
frm.rewrite();
_dirty = FALSE;
}
}
}
if (!_dirty)
for (word j = 0; j < fields(); j++)

View File

@ -692,6 +692,9 @@ public:
// @cmember Ritorna l'altezza effettiva del campo
virtual int effective_height() const
{ return _effective_height; }
// @cmember Scrive la stringa <p s> alla posizione del TForm_item. Funzione che
// per default non fa nulla. Ridefinita solo per TForm_number e TForm_string.
virtual void put_paragraph(const char* s) {};
// @cmember Ritorna se si tratta di una campo temporaneo (reference)
virtual bool& temp()