Correzioni all'editor dei form

git-svn-id: svn://10.65.10.50/trunk@2651 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-02-28 16:58:50 +00:00
parent 1fe163e2b4
commit 10b377cf0a

View File

@ -518,7 +518,8 @@ bool TForm_item::read_from(const TRectype& prof)
changed = TRUE; changed = TRUE;
} }
TToken_string special(prof.get("SPECIAL"),'\n'); TToken_string special(prof.get("SPECIAL"),'\n');
special.rtrim();
const int sp_items = special.items(); const int sp_items = special.items();
for (i = 0; i < sp_items; i++) for (i = 0; i < sp_items; i++)
{ {
@ -560,7 +561,7 @@ void TForm_item::print_on(TRectype& prof)
// una X alla fine (campo 3) // una X alla fine (campo 3)
{ {
TToken_string special(128,'\n'); TToken_string special(128,'\n');
_special.restart(); _special.restart();
for (int i = 0; i < _special.items(); i++) for (int i = 0; i < _special.items(); i++)
{ {
@ -577,6 +578,7 @@ void TForm_item::print_on(TRectype& prof)
special.add(sp); special.add(sp);
} }
} }
special.rtrim();
prof.put("SPECIAL", special); prof.put("SPECIAL", special);
} }
} }
@ -2568,6 +2570,8 @@ bool TPrint_section::edit(
{ {
const bool is_ba_editor = TString(_form->section_mask()).left(2) == "ba"; const bool is_ba_editor = TString(_form->section_mask()).left(2) == "ba";
bool nstd_dirty = FALSE; bool nstd_dirty = FALSE;
bool font_found = FALSE;
_cur_form = _form; _cur_form = _form;
_cur_sect = this; _cur_sect = this;
@ -2638,7 +2642,6 @@ bool TPrint_section::edit(
const int MAX_FAMILIES = 128; const int MAX_FAMILIES = 128;
char* family[MAX_FAMILIES]; char* family[MAX_FAMILIES];
const int num_families = (int)xvt_fmap_get_families(printer().get_printrcd(), family, MAX_FAMILIES); const int num_families = (int)xvt_fmap_get_families(printer().get_printrcd(), family, MAX_FAMILIES);
bool font_found = FALSE;
TToken_string pn1(256), pn2(256); TToken_string pn1(256), pn2(256);
for (int i = 0; i < num_families; i++) for (int i = 0; i < num_families; i++)
@ -2650,8 +2653,13 @@ bool TPrint_section::edit(
xvt_mem_free(family[i]); xvt_mem_free(family[i]);
} }
TList_field& lst = (TList_field&)m.field(F_FONT); TList_field& lst = (TList_field&)m.field(F_FONT);
if (!font_found)
{
warning_box("Il font %s non esiste per la stampante di default.",(const char*) form().fontname());
pn1.add(form().fontname());
pn2.add(form().fontname());
}
lst.replace_items(pn1, pn2); lst.replace_items(pn1, pn2);
if (!font_found) warning_box("Il font %s non esiste per la stampante di default.",(const char*) form().fontname());
lst.set(form().fontname()); lst.set(form().fontname());
printer().set_char_size(form().fontsize()); printer().set_char_size(form().fontsize());
m.set_handler(F_FONT,font_handler); m.set_handler(F_FONT,font_handler);
@ -2725,45 +2733,48 @@ bool TPrint_section::edit(
{ {
if (!form().dirty()) form().set_dirty(); if (!form().dirty()) form().set_dirty();
_dirty = TRUE; _dirty = TRUE;
s_data prm; if (font_found && yesno_box("E' stato cambiato il font o la dimensione del carattere\ndevo aggiornale le coordinate dei campi"))
prm.size_1=form().fontsize();
strcpy(prm.name_1,form().fontname());
prm.size_2=size;
strcpy(prm.name_2,name);
prm.ratio = 1.0;
// Next 3 lines may be changed
xvt_print_open();
xvt_print_start_thread (wpr, (long)&prm);
xvt_print_close();
form().fontname() = name;
form().fontsize() = size;
const char sechar[4] = { 'B', 'F', 'G', 'H' };
for (int sn = 0; sn < 4 ; sn++)
{ {
const char sc = sechar[sn]; s_data prm;
for (pagetype pt = odd_page; pt <= last_page; pt = pagetype(pt+1)) prm.size_1=form().fontsize();
{ strcpy(prm.name_1,form().fontname());
TPrint_section* sec = form().exist(sc, pt); prm.size_2=size;
if (sec != NULL && !sec->columnwise()) strcpy(prm.name_2,name);
{ prm.ratio = 1.0;
sec->set_dirty(); // Next 3 lines may be changed
for (word i = 0; i < sec->fields() ; i++) xvt_print_open();
{ xvt_print_start_thread (wpr, (long)&prm);
TForm_item& fi = sec->field(i); xvt_print_close();
short value = fi.x();
if (value > 0 && (prm.ratio != 1.0)) const char sechar[4] = { 'B', 'F', 'G', 'H' };
for (int sn = 0; sn < 4 ; sn++)
{
const char sc = sechar[sn];
for (pagetype pt = odd_page; pt <= last_page; pt = pagetype(pt+1))
{
TPrint_section* sec = form().exist(sc, pt);
if (sec != NULL && !sec->columnwise())
{
sec->set_dirty();
for (word i = 0; i < sec->fields() ; i++)
{ {
real x_pos; TForm_item& fi = sec->field(i);
x_pos = value * prm.ratio; short value = fi.x();
x_pos.round(); if (value > 0 && (prm.ratio != 1.0))
fi.set_x((short)x_pos.integer()); {
fi.set_dirty(); real x_pos;
x_pos = value * prm.ratio;
x_pos.round();
fi.set_x((short)x_pos.integer());
fi.set_dirty();
}
} }
} }
} }
} }
} }
form().fontname() = name;
form().fontsize() = size;
} }
} else // controlli se l'editor non e' quello base } else // controlli se l'editor non e' quello base
nstd_dirty = _form->post_edit_checks(m,_cur_sect); nstd_dirty = _form->post_edit_checks(m,_cur_sect);