Aggiunto l'hiding dei campi del body in anteprima di stampa. Corrette

alcune imprecisioni nelle richieste di input della maschera selezione
profilo e di copia.


git-svn-id: svn://10.65.10.50/trunk@2415 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-01-09 11:39:10 +00:00
parent 9dcd2b684d
commit c68f07cb7c

View File

@ -41,6 +41,8 @@ protected:
bool recalculate_positions(const char* name, int size); bool recalculate_positions(const char* name, int size);
void hook_footer_to_body(TPrint_section* f, TPrint_section* b); void hook_footer_to_body(TPrint_section* f, TPrint_section* b);
void unhook_footer(TPrint_section* f); void unhook_footer(TPrint_section* f);
void hide_body_items(TPrint_section* b);
void show_body_items(TPrint_section* b);
void remove_form(TLocalisamfile& frm, TLocalisamfile& rfr,const TString& t,const TString& c); void remove_form(TLocalisamfile& frm, TLocalisamfile& rfr,const TString& t,const TString& c);
virtual const char* selection_mask() const { return "sc3100a"; } virtual const char* selection_mask() const { return "sc3100a"; }
virtual bool ask_profile(); virtual bool ask_profile();
@ -86,6 +88,8 @@ bool TForm_EC_editor::ccodes_handler(TMask_field& f, KEY k)
frm.put("CODPROF",code); frm.put("CODPROF",code);
if (frm.read(_isequal)== NOERR) if (frm.read(_isequal)== NOERR)
m.set(F_CDESCS,frm.get("DESC")); m.set(F_CDESCS,frm.get("DESC"));
else
m.reset(F_CDESCS);
} }
return TRUE; return TRUE;
} }
@ -104,6 +108,8 @@ bool TForm_EC_editor::clngs_handler(TMask_field& f, KEY key)
frm.put("CODPROF",code); frm.put("CODPROF",code);
if (frm.read(_isequal)== NOERR) if (frm.read(_isequal)== NOERR)
m.set(F_CDESCS,frm.get("DESC")); m.set(F_CDESCS,frm.get("DESC"));
else
m.reset(F_CDESCS);
} }
return TRUE; return TRUE;
} }
@ -191,6 +197,8 @@ bool TForm_EC_editor::code_handler(TMask_field& f, KEY key)
frm.put("CODPROF",code); frm.put("CODPROF",code);
if (frm.read(_isequal)== NOERR) if (frm.read(_isequal)== NOERR)
m.set(F_DESC,frm.get("DESC")); m.set(F_DESC,frm.get("DESC"));
else
m.reset(F_DESC);
} }
return TRUE; return TRUE;
} }
@ -209,6 +217,8 @@ bool TForm_EC_editor::lng_handler(TMask_field& f, KEY key)
frm.put("CODPROF",code); frm.put("CODPROF",code);
if (frm.read(_isequal)== NOERR) if (frm.read(_isequal)== NOERR)
m.set(F_DESC,frm.get("DESC")); m.set(F_DESC,frm.get("DESC"));
else
m.reset(F_DESC);
} }
return TRUE; return TRUE;
} }
@ -326,16 +336,25 @@ bool TForm_EC_editor::recalculate_positions(const char* name, int size)
void TForm_EC_editor::hook_footer_to_body(TPrint_section* f, TPrint_section* b) void TForm_EC_editor::hook_footer_to_body(TPrint_section* f, TPrint_section* b)
{ {
const word items = b->columnwise() ? f->fields() : 0; const word items = b->columnwise() ? f->fields() : 0;
const int min_col_id = b->find_first_col();
b->reset_tabs(); b->reset_tabs();
for (word i=0;i<items;i++) for (word i=0;i<items;i++)
{ {
TForm_item& fi = f->field(i); TForm_item& fi = f->field(i);
if (fi.x()>0 || !fi.shown()) continue; if (fi.x()>0 || !fi.shown()) continue;
short id = fi.id(); short id = fi.id();
if (id >= PEC_TSALDO && id <= PEC_TIMPLIRE) id = PEC_DESCR1; if (id >= PEC_TSALDO && id <= PEC_TIMPLIRE) id = PEC_DESCR;
TForm_item& fb = b->find_field(id); TForm_item& fb = b->find_field(id);
int x = fb.x()+b->ofspc(); if (!fb.shown())
fi.set_x(x); {
fi.hide();
fi.set_x(-1);
} else
{
int x = fb.x()+b->ofspc();
if (id == min_col_id) x++;
fi.set_x(x);
}
fi.ofs() = 999; fi.ofs() = 999;
} }
} }
@ -348,12 +367,41 @@ void TForm_EC_editor::unhook_footer(TPrint_section* f)
TForm_item& fi = f->field(i); TForm_item& fi = f->field(i);
if (fi.ofs()==999) if (fi.ofs()==999)
{ {
if (fi.x() == -1) fi.show();
fi.ofs() = 0; fi.ofs() = 0;
fi.set_x(0); fi.set_x(0);
} }
} }
} }
void TForm_EC_editor::hide_body_items(TPrint_section* b)
{
const word items = b->fields();
for (word i=0;i<items;i++)
{
TForm_item& fi = b->field(i);
if (fi.shown() && fi.prompt().not_empty())
{
fi.hide();
fi.temp() = TRUE;
}
}
}
void TForm_EC_editor::show_body_items(TPrint_section* b)
{
const word items = b->fields();
for (word i=0;i<items;i++)
{
TForm_item& fi = b->field(i);
if (fi.temp())
{
fi.show();
fi.temp() = FALSE;
}
}
}
bool TForm_EC_editor::edit(char s, pagetype p) bool TForm_EC_editor::edit(char s, pagetype p)
{ {
_msk= new TMask("sc3100c"); _msk= new TMask("sc3100c");
@ -362,7 +410,6 @@ bool TForm_EC_editor::edit(char s, pagetype p)
bool other = FALSE; bool other = FALSE;
KEY k; KEY k;
enable_menu_item(M_FILE_PRINT);
if (extra()) if (extra())
{ {
if (s == 'R') if (s == 'R')
@ -423,7 +470,9 @@ bool TForm_EC_editor::edit(char s, pagetype p)
while (TRUE) while (TRUE)
{ {
bool local_dirty = FALSE; bool local_dirty = FALSE;
enable_menu_item(M_FILE_PRINT);
k = _msk->run(); k = _msk->run();
disable_menu_item(M_FILE_PRINT);
if ((_msk->field(F_SFONT).dirty() || _msk->field(F_SSIZE).dirty())) if ((_msk->field(F_SFONT).dirty() || _msk->field(F_SSIZE).dirty()))
{ {
font_changed = TRUE; font_changed = TRUE;
@ -525,13 +574,13 @@ bool TForm_EC_editor::edit(char s, pagetype p)
{ {
TLocalisamfile f(LF_FORM),r(LF_RFORM); TLocalisamfile f(LF_FORM),r(LF_RFORM);
remove_form(f,r,form().name(),form().code()); remove_form(f,r,form().name(),form().code());
mask().reset(F_BASE);
mask().reset(F_CODE); mask().reset(F_CODE);
mask().reset(F_CODEL); mask().reset(F_CODEL);
mask().reset(F_DESC); mask().reset(F_DESC);
} }
if (_msk!=NULL) delete _msk; if (_msk!=NULL) delete _msk;
_msk = NULL; _msk = NULL;
disable_menu_item(M_FILE_PRINT);
if (!extra()) dispatch_e_menu(MENU_ITEM(14)); if (!extra()) dispatch_e_menu(MENU_ITEM(14));
return dirty; return dirty;
} }
@ -578,11 +627,13 @@ void TForm_EC_editor::print()
} else } else
remove = FALSE; remove = FALSE;
hook_footer_to_body(f,b); hook_footer_to_body(f,b);
hide_body_items(b);
form().put_examples('H',odd_page); form().put_examples('H',odd_page);
form().put_examples('F',odd_page); form().put_examples('F',odd_page);
TForm_editor::print(); TForm_editor::print();
form().remove_examples('H',odd_page); form().remove_examples('H',odd_page);
form().remove_examples('F',odd_page); form().remove_examples('F',odd_page);
show_body_items(b);
unhook_footer(f); unhook_footer(f);
if (remove) if (remove)
{ {