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